Skip to content

Commit

Permalink
Merge pull request #66 from Cox-Automotive/template-role-types
Browse files Browse the repository at this point in the history
adds documentation for using template role types
  • Loading branch information
americk0 authored Apr 12, 2021
2 parents 0a2c9ce + 2dcbe5b commit d739fab
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 4 deletions.
21 changes: 21 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Returns a Promise for the results of creating a new custom AWS IAM account role
- .roleType <code>string</code> - The type of AWS role to use when creating the new role
- .includeDefaultPolicy <code>number</code> - Whether to include the default policy in the new role (1 = yes, 0 = no)
- .enableAlksAccess <code>boolean</code> - Whether the role has a machine identity
- .templateFields <code>Object</code> - An object whose keys are template variable names and values are the value to substitute for those template variables

**Example**
```js
Expand All @@ -280,6 +281,26 @@ alks.createRole({
// role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
})
```
**Example**
```js
alks.createRole({
baseUrl: 'https://your.alks-host.com',
accessToken: 'abc123',
account: 'anAccount',
role: 'IAMAdmin',
roleName: 'awsRoleName',
roleType: 'Amazon EKS IRSA',
includeDefaultPolicy: 1,
enableAlksAccess: false,
templateFields: {
OIDC_PROVIDER: 'oidc.eks.us-east-1.amazonaws.com/id/88G998884RBAD6687HBE3GETY67FQE04',
K8S_NAMESPACE: 'myNamespace',
K8S_SERVICE_ACCOUNT: 'myServiceAccount'
}
}).then((role) => {
// role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
})
```
<a name="alks+createNonServiceRole"></a>

### alks.createNonServiceRole(props) ⇒ [<code>Promise.&lt;customRole&gt;</code>](#customRole)
Expand Down
22 changes: 21 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.10.2";
var version = "1.11.1";

const Buffer = require('buffer').Buffer;
const fetch = require('node-fetch');
Expand Down Expand Up @@ -282,6 +282,7 @@ class alks {
* @param {string} props.roleType - The type of AWS role to use when creating the new role
* @param {number} props.includeDefaultPolicy - Whether to include the default policy in the new role (1 = yes, 0 = no)
* @param {boolean} props.enableAlksAccess - Whether the role has a machine identity
* @param {Object} props.templateFields - An object whose keys are template variable names and values are the value to substitute for those template variables
* @returns {Promise<customRole>}
* @example
* alks.createRole({
Expand All @@ -296,6 +297,25 @@ class alks {
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*
* @example
* alks.createRole({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* account: 'anAccount',
* role: 'IAMAdmin',
* roleName: 'awsRoleName',
* roleType: 'Amazon EKS IRSA',
* includeDefaultPolicy: 1,
* enableAlksAccess: false,
* templateFields: {
* OIDC_PROVIDER: 'oidc.eks.us-east-1.amazonaws.com/id/88G998884RBAD6687HBE3GETY67FQE04',
* K8S_NAMESPACE: 'myNamespace',
* K8S_SERVICE_ACCOUNT: 'myServiceAccount'
* }
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*/
createRole(props) {
return(this._doFetch('createRole', props).then((results) => {
Expand Down
22 changes: 21 additions & 1 deletion dist/alks.esm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var version = "1.10.2";
var version = "1.11.1";

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

Expand Down Expand Up @@ -279,6 +279,7 @@ class alks {
* @param {string} props.roleType - The type of AWS role to use when creating the new role
* @param {number} props.includeDefaultPolicy - Whether to include the default policy in the new role (1 = yes, 0 = no)
* @param {boolean} props.enableAlksAccess - Whether the role has a machine identity
* @param {Object} props.templateFields - An object whose keys are template variable names and values are the value to substitute for those template variables
* @returns {Promise<customRole>}
* @example
* alks.createRole({
Expand All @@ -293,6 +294,25 @@ class alks {
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*
* @example
* alks.createRole({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* account: 'anAccount',
* role: 'IAMAdmin',
* roleName: 'awsRoleName',
* roleType: 'Amazon EKS IRSA',
* includeDefaultPolicy: 1,
* enableAlksAccess: false,
* templateFields: {
* OIDC_PROVIDER: 'oidc.eks.us-east-1.amazonaws.com/id/88G998884RBAD6687HBE3GETY67FQE04',
* K8S_NAMESPACE: 'myNamespace',
* K8S_SERVICE_ACCOUNT: 'myServiceAccount'
* }
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*/
createRole(props) {
return(this._doFetch('createRole', props).then((results) => {
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.

22 changes: 21 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.10.2";
var version = "1.11.1";

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

Expand Down Expand Up @@ -283,6 +283,7 @@
* @param {string} props.roleType - The type of AWS role to use when creating the new role
* @param {number} props.includeDefaultPolicy - Whether to include the default policy in the new role (1 = yes, 0 = no)
* @param {boolean} props.enableAlksAccess - Whether the role has a machine identity
* @param {Object} props.templateFields - An object whose keys are template variable names and values are the value to substitute for those template variables
* @returns {Promise<customRole>}
* @example
* alks.createRole({
Expand All @@ -297,6 +298,25 @@
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*
* @example
* alks.createRole({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* account: 'anAccount',
* role: 'IAMAdmin',
* roleName: 'awsRoleName',
* roleType: 'Amazon EKS IRSA',
* includeDefaultPolicy: 1,
* enableAlksAccess: false,
* templateFields: {
* OIDC_PROVIDER: 'oidc.eks.us-east-1.amazonaws.com/id/88G998884RBAD6687HBE3GETY67FQE04',
* K8S_NAMESPACE: 'myNamespace',
* K8S_SERVICE_ACCOUNT: 'myServiceAccount'
* }
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*/
alks.prototype.createRole = function createRole (props) {
return(this._doFetch('createRole', props).then(function (results) {
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ declare namespace ALKS {
roleType: string;
enableAlksAccess: boolean;
includeDefaultPolicy: PseudoBoolean;
templateFields?: Record<string, string>;
}

export interface CreateNonServiceRoleProps extends Partial<AlksProps> {
Expand Down
20 changes: 20 additions & 0 deletions src/alks.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class alks {
* @param {string} props.roleType - The type of AWS role to use when creating the new role
* @param {number} props.includeDefaultPolicy - Whether to include the default policy in the new role (1 = yes, 0 = no)
* @param {boolean} props.enableAlksAccess - Whether the role has a machine identity
* @param {Object} props.templateFields - An object whose keys are template variable names and values are the value to substitute for those template variables
* @returns {Promise<customRole>}
* @example
* alks.createRole({
Expand All @@ -295,6 +296,25 @@ class alks {
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*
* @example
* alks.createRole({
* baseUrl: 'https://your.alks-host.com',
* accessToken: 'abc123',
* account: 'anAccount',
* role: 'IAMAdmin',
* roleName: 'awsRoleName',
* roleType: 'Amazon EKS IRSA',
* includeDefaultPolicy: 1,
* enableAlksAccess: false,
* templateFields: {
* OIDC_PROVIDER: 'oidc.eks.us-east-1.amazonaws.com/id/88G998884RBAD6687HBE3GETY67FQE04',
* K8S_NAMESPACE: 'myNamespace',
* K8S_SERVICE_ACCOUNT: 'myServiceAccount'
* }
* }).then((role) => {
* // role.roleArn, role.denyArns, role.instanceProfileArn, role.addedRoleToInstanceProfile
* })
*/
createRole(props) {
return(this._doFetch('createRole', props).then((results) => {
Expand Down

0 comments on commit d739fab

Please sign in to comment.