Skip to content

Commit

Permalink
Merge pull request #67 from Cox-Automotive/template-fields
Browse files Browse the repository at this point in the history
updates types for getAllAWSRoleTypes
  • Loading branch information
americk0 authored Apr 13, 2021
2 parents 6c4c3cc + bd1fa62 commit bc4dcce
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 9 deletions.
11 changes: 11 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ Returns a Promise for an array of all available role types (AWS IAM role types,
- 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
- [.getDynamicValues] <code>boolean</code> - Whether to include the names of any template variables in the response (defaults to false)

**Example**
```js
Expand All @@ -201,6 +202,16 @@ alks.getAllAWSRoleTypes({
// roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship
})
```
**Example**
```js
alks.getAllAWSRoleTypes({
baseUrl: 'https://your.alks-host.com',
accessToken: 'abc123',
getDynamicValues: true,
}).then((roleTypes) {
// roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship, roleTypes[i].templateVariables[i]
})
```
<a name="alks+getAWSRoleTypes"></a>

### ~~alks.getAWSRoleTypes(props) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code>~~
Expand Down
15 changes: 13 additions & 2 deletions dist/alks.cjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var version = "1.11.1";
var version = "1.11.2";

const Buffer = require('buffer').Buffer;
const fetch = require('node-fetch');
Expand Down Expand Up @@ -204,6 +204,7 @@ class alks {
* @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 {boolean} [props.getDynamicValues] - Whether to include the names of any template variables in the response (defaults to false)
* @returns {Promise<Array<awsRoleType>>}
* @example
* alks.getAllAWSRoleTypes({
Expand All @@ -212,9 +213,19 @@ class alks {
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship
* })
*
* @example
* alks.getAllAWSRoleTypes({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* getDynamicValues: true,
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship, roleTypes[i].templateVariables[i]
* })
*/
getAllAWSRoleTypes(props) {
return(this._doFetch('allAwsRoleTypes', props, 'GET').then(results => results.roleTypes))
const url = props.getDynamicValues ? 'allAwsRoleTypes' : 'allAwsRoleTypes?getDynamicValues=true';
return(this._doFetch(url, props, 'GET').then(results => results.roleTypes))
}

/**
Expand Down
15 changes: 13 additions & 2 deletions dist/alks.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var version = "1.11.1";
var version = "1.11.2";

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

Expand Down Expand Up @@ -201,6 +201,7 @@ class alks {
* @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 {boolean} [props.getDynamicValues] - Whether to include the names of any template variables in the response (defaults to false)
* @returns {Promise<Array<awsRoleType>>}
* @example
* alks.getAllAWSRoleTypes({
Expand All @@ -209,9 +210,19 @@ class alks {
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship
* })
*
* @example
* alks.getAllAWSRoleTypes({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* getDynamicValues: true,
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship, roleTypes[i].templateVariables[i]
* })
*/
getAllAWSRoleTypes(props) {
return(this._doFetch('allAwsRoleTypes', props, 'GET').then(results => results.roleTypes))
const url = props.getDynamicValues ? 'allAwsRoleTypes' : 'allAwsRoleTypes?getDynamicValues=true';
return(this._doFetch(url, props, 'GET').then(results => results.roleTypes))
}

/**
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.

15 changes: 13 additions & 2 deletions 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.11.1";
var version = "1.11.2";

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

Expand Down Expand Up @@ -207,6 +207,7 @@
* @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 {boolean} [props.getDynamicValues] - Whether to include the names of any template variables in the response (defaults to false)
* @returns {Promise<Array<awsRoleType>>}
* @example
* alks.getAllAWSRoleTypes({
Expand All @@ -215,9 +216,19 @@
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship
* })
*
* @example
* alks.getAllAWSRoleTypes({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* getDynamicValues: true,
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship, roleTypes[i].templateVariables[i]
* })
*/
alks.prototype.getAllAWSRoleTypes = function getAllAWSRoleTypes (props) {
return(this._doFetch('allAwsRoleTypes', props, 'GET').then(function (results) { return results.roleTypes; }))
var url = props.getDynamicValues ? 'allAwsRoleTypes' : 'allAwsRoleTypes?getDynamicValues=true';
return(this._doFetch(url, props, 'GET').then(function (results) { return results.roleTypes; }))
};

/**
Expand Down
5 changes: 4 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ declare namespace ALKS {
defaultArns: string[];
trustRelationship: object;
instanceProfile: boolean;
templateVariables?: string[];
}

export interface MachineIdentity {
Expand Down Expand Up @@ -203,7 +204,9 @@ declare namespace ALKS {

export type RevokeProps = RevokeByIdProps | RevokeByValueProps;

export interface GetAllAWSRoleTypesProps extends Partial<AlksProps> {}
export interface GetAllAWSRoleTypesProps extends Partial<AlksProps> {
getDynamicValues?: boolean;
}

export interface AddRoleMachineIdentityProps extends Partial<AlksProps> {
roleARN: string;
Expand Down
13 changes: 12 additions & 1 deletion src/alks.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class alks {
* @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 {boolean} [props.getDynamicValues] - Whether to include the names of any template variables in the response (defaults to false)
* @returns {Promise<Array<awsRoleType>>}
* @example
* alks.getAllAWSRoleTypes({
Expand All @@ -211,9 +212,19 @@ class alks {
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship
* })
*
* @example
* alks.getAllAWSRoleTypes({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* getDynamicValues: true,
* }).then((roleTypes) {
* // roleTypes[i].roleTypeName, roleTypes[i].defaultArns, roleTypes[i].trustRelationship, roleTypes[i].templateVariables[i]
* })
*/
getAllAWSRoleTypes(props) {
return(this._doFetch('allAwsRoleTypes', props, 'GET').then(results => results.roleTypes))
const url = props.getDynamicValues ? 'allAwsRoleTypes?getDynamicValues=true' : 'allAwsRoleTypes'
return(this._doFetch(url, props, 'GET').then(results => results.roleTypes))
}

/**
Expand Down

0 comments on commit bc4dcce

Please sign in to comment.