Skip to content

Commit

Permalink
fixes tests and builds dist
Browse files Browse the repository at this point in the history
  • Loading branch information
americk0 committed Sep 8, 2020
1 parent ea63754 commit 8f66692
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 16 deletions.
48 changes: 48 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<dt><a href="#skypieaAccount">skypieaAccount</a> : <code>Object</code></dt>
<dd><p>Skypiea Account</p>
</dd>
<dt><a href="#cloudsploitTrend">cloudsploitTrend</a> : <code>Object</code></dt>
<dd><p>CloudsploitReport</p>
</dd>
<dt><a href="#accountOwners">accountOwners</a> : <code>Object</code></dt>
<dd><p>AccountUserDetails</p>
</dd>
Expand Down Expand Up @@ -64,6 +67,7 @@ ALKS JavaScript API
* [.getUserAccess(props)](#alks+getUserAccess) ⇒ <code>Promise.&lt;Array.&lt;alksUser&gt;&gt;</code>
* [.getUserAccessByRole(props)](#alks+getUserAccessByRole) ⇒ <code>Promise.&lt;Object&gt;</code>
* [.getUserRoleAccess(props)](#alks+getUserRoleAccess) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code>
* [.getAccountOwners(props)](#alks+getAccountOwners) ⇒ <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code>
* [.createAccessKeys(props)](#alks+createAccessKeys)[<code>Promise.&lt;AccessKeys&gt;</code>](#AccessKeys)
* [.deleteIAMUser(props)](#alks+deleteIAMUser) ⇒ <code>Promise.&lt;boolean&gt;</code>
* [.version(props)](#alks+version) ⇒ <code>Promise.&lt;Object&gt;</code>
Expand Down Expand Up @@ -534,6 +538,29 @@ alks.getUserRoleAccess({
// ['Admin', 'LabAdmin', ...]
})
```
<a name="alks+getAccountOwners"></a>

### alks.getAccountOwners(props) ⇒ <code>Promise.&lt;Array.&lt;Object&gt;&gt;</code>
Returns a Promise containing a list of the account owners for an account

**Kind**: instance method of [<code>alks</code>](#alks)
**Params**

- props <code>Object</code> - An object containing the following properties
- .baseUrl <code>string</code> - The base URL of the ALKS service
- .accessToken <code>string</code> - The OAuth2 access token used to authorize the request
- .accountId <code>string</code> - The accountId used to find which users have access to the account

**Example**
```js
alks.getAccountOwners({
baseUrl: 'https://your.alks-host.com',
accessToken: 'abc123',
accountId: '012345678910',
}).then((owners) => {
// owners[0].sAMAccountName, owners[0].displayName, owners[0].email, owners[0].title, owners[0].department
})
```
<a name="alks+createAccessKeys"></a>

### alks.createAccessKeys(props) ⇒ [<code>Promise.&lt;AccessKeys&gt;</code>](#AccessKeys)
Expand Down Expand Up @@ -700,6 +727,27 @@ alks.revoke({
Skypiea Account

**Kind**: global typedef
<a name="cloudsploitTrend"></a>

## cloudsploitTrend : <code>Object</code>
CloudsploitReport

**Kind**: global typedef
**Params**

- year <code>number</code> - the year of the scan
- month <code>number</code> - the month of the scan
- day <code>number</code> - the day of the scan
- href <code>string</code> - the link to the skypiea resource
- awsAccountId <code>string</code> - the AWS account Id
- scanId <code>number</code> - the id of the scan
- scanDate <code>string</code> - the date of the scan
- newRisks <code>number</code> - the amount of new risks
- passing <code>number</code> - the amount of pass
- warning <code>number</code> - the amount of warnings
- failing <code>number</code> - the amount of fails
- unknown <code>number</code> - the amount of unknowns

<a name="accountOwners"></a>

## accountOwners : <code>Object</code>
Expand Down
37 changes: 36 additions & 1 deletion dist/alks.cjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var version = "1.9.3";
var version = "1.10.2";

const Buffer = require('buffer').Buffer;
const fetch = require('node-fetch');
Expand Down Expand Up @@ -582,6 +582,28 @@ class alks {
)
}

/**
* Returns a Promise containing a list of the account owners for an account
*
* @param {Object} props - An object containing the following properties
* @param {string} props.baseUrl - The base URL of the ALKS service
* @param {string} props.accessToken - The OAuth2 access token used to authorize the request
* @param {string} props.accountId - The accountId used to find which users have access to the account
* @returns {Promise<Object[]>}
* @example
* alks.getAccountOwners({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* accountId: '012345678910',
* }).then((owners) => {
* // owners[0].sAMAccountName, owners[0].displayName, owners[0].email, owners[0].title, owners[0].department
* })
*/
getAccountOwners(props) {
const {accountId} = props;
return(this._doFetch(`userAccess/owners/${accountId}`, props, 'GET').then((results) => results.accountOwners))
}

/**
* Response containing access keys.
*
Expand Down Expand Up @@ -769,6 +791,19 @@ class alks {
delete opts.password;
}

if( opts.accessKey ) {
headers['ALKS-STS-Access-Key'] = opts.accessKey;
delete opts.accessKey;
}
if( opts.secretKey ) {
headers['ALKS-STS-Secret-Key'] = opts.secretKey;
delete opts.secretKey;
}
if( opts.sessionToken ) {
headers['ALKS-STS-Session-Token'] = opts.sessionToken;
delete opts.sessionToken;
}

var responsePromise = opts._fetch(`${opts.baseUrl}/${path}/`, {
method, headers, body: method == 'GET' ? undefined : JSON.stringify(opts)
});
Expand Down
37 changes: 36 additions & 1 deletion dist/alks.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var version = "1.9.3";
var version = "1.10.2";

const fetch = window.fetch.bind(window);

Expand Down Expand Up @@ -579,6 +579,28 @@ class alks {
)
}

/**
* Returns a Promise containing a list of the account owners for an account
*
* @param {Object} props - An object containing the following properties
* @param {string} props.baseUrl - The base URL of the ALKS service
* @param {string} props.accessToken - The OAuth2 access token used to authorize the request
* @param {string} props.accountId - The accountId used to find which users have access to the account
* @returns {Promise<Object[]>}
* @example
* alks.getAccountOwners({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* accountId: '012345678910',
* }).then((owners) => {
* // owners[0].sAMAccountName, owners[0].displayName, owners[0].email, owners[0].title, owners[0].department
* })
*/
getAccountOwners(props) {
const {accountId} = props;
return(this._doFetch(`userAccess/owners/${accountId}`, props, 'GET').then((results) => results.accountOwners))
}

/**
* Response containing access keys.
*
Expand Down Expand Up @@ -766,6 +788,19 @@ class alks {
delete opts.password;
}

if( opts.accessKey ) {
headers['ALKS-STS-Access-Key'] = opts.accessKey;
delete opts.accessKey;
}
if( opts.secretKey ) {
headers['ALKS-STS-Secret-Key'] = opts.secretKey;
delete opts.secretKey;
}
if( opts.sessionToken ) {
headers['ALKS-STS-Session-Token'] = opts.sessionToken;
delete opts.sessionToken;
}

var responsePromise = opts._fetch(`${opts.baseUrl}/${path}/`, {
method, headers, body: method == 'GET' ? undefined : JSON.stringify(opts)
});
Expand Down
2 changes: 1 addition & 1 deletion dist/alks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion dist/alks.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(global = global || self, global.alks = factory());
}(this, function () { 'use strict';

var version = "1.9.3";
var version = "1.10.2";

var fetch = window.fetch.bind(window);

Expand Down Expand Up @@ -577,6 +577,28 @@
)
};

/**
* Returns a Promise containing a list of the account owners for an account
*
* @param {Object} props - An object containing the following properties
* @param {string} props.baseUrl - The base URL of the ALKS service
* @param {string} props.accessToken - The OAuth2 access token used to authorize the request
* @param {string} props.accountId - The accountId used to find which users have access to the account
* @returns {Promise<Object[]>}
* @example
* alks.getAccountOwners({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* accountId: '012345678910',
* }).then((owners) => {
* // owners[0].sAMAccountName, owners[0].displayName, owners[0].email, owners[0].title, owners[0].department
* })
*/
alks.prototype.getAccountOwners = function getAccountOwners (props) {
var accountId = props.accountId;
return(this._doFetch(("userAccess/owners/" + accountId), props, 'GET').then(function (results) { return results.accountOwners; }))
};

/**
*Response containing access keys.
*
Expand Down Expand Up @@ -763,6 +785,19 @@
delete opts.password;
}

if( opts.accessKey ) {
headers['ALKS-STS-Access-Key'] = opts.accessKey;
delete opts.accessKey;
}
if( opts.secretKey ) {
headers['ALKS-STS-Secret-Key'] = opts.secretKey;
delete opts.secretKey;
}
if( opts.sessionToken ) {
headers['ALKS-STS-Session-Token'] = opts.sessionToken;
delete opts.sessionToken;
}

var responsePromise = opts._fetch(((opts.baseUrl) + "/" + path + "/"), {
method: method, headers: headers, body: method == 'GET' ? undefined : JSON.stringify(opts)
});
Expand Down
Loading

0 comments on commit 8f66692

Please sign in to comment.