@ttoss/cloud-roles 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +6 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -4
- package/package.json +6 -6
- package/src/index.ts +44 -1
- package/src/createRolesTemplate.ts +0 -38
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/index.ts
|
|
4
4
|
var IAM_PATH = "/custom-iam/";
|
|
5
5
|
var createRolesTemplate = ({
|
|
6
6
|
path = IAM_PATH,
|
|
@@ -12,10 +12,13 @@ var createRolesTemplate = ({
|
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
const outputs = Object.keys(resources).reduce((acc, key) => {
|
|
15
|
-
|
|
15
|
+
const newKey = key + "Arn";
|
|
16
|
+
acc[newKey] = {
|
|
16
17
|
Description: `Arn of the ${key} role.`,
|
|
17
18
|
Value: { "Fn::GetAtt": [key, "Arn"] },
|
|
18
|
-
Export: {
|
|
19
|
+
Export: {
|
|
20
|
+
Name: { "Fn::Join": [":", [{ Ref: "AWS::StackName" }, newKey]] }
|
|
21
|
+
}
|
|
19
22
|
};
|
|
20
23
|
return acc;
|
|
21
24
|
}, {});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IAMRoleResource, CloudFormationTemplate } from '@ttoss/cloudformation';
|
|
2
|
+
export { CloudFormationTemplate, IAMRoleResource, Outputs } from '@ttoss/cloudformation';
|
|
2
3
|
|
|
3
4
|
declare const IAM_PATH = "/custom-iam/";
|
|
5
|
+
|
|
4
6
|
declare const createRolesTemplate: ({ path, resources, }: {
|
|
5
7
|
path?: string | undefined;
|
|
6
8
|
resources: {
|
package/dist/index.js
CHANGED
|
@@ -25,8 +25,6 @@ __export(src_exports, {
|
|
|
25
25
|
createRolesTemplate: () => createRolesTemplate
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(src_exports);
|
|
28
|
-
|
|
29
|
-
// src/createRolesTemplate.ts
|
|
30
28
|
var IAM_PATH = "/custom-iam/";
|
|
31
29
|
var createRolesTemplate = ({
|
|
32
30
|
path = IAM_PATH,
|
|
@@ -38,10 +36,13 @@ var createRolesTemplate = ({
|
|
|
38
36
|
}
|
|
39
37
|
});
|
|
40
38
|
const outputs = Object.keys(resources).reduce((acc, key) => {
|
|
41
|
-
|
|
39
|
+
const newKey = key + "Arn";
|
|
40
|
+
acc[newKey] = {
|
|
42
41
|
Description: `Arn of the ${key} role.`,
|
|
43
42
|
Value: { "Fn::GetAtt": [key, "Arn"] },
|
|
44
|
-
Export: {
|
|
43
|
+
Export: {
|
|
44
|
+
Name: { "Fn::Join": [":", [{ Ref: "AWS::StackName" }, newKey]] }
|
|
45
|
+
}
|
|
45
46
|
};
|
|
46
47
|
return acc;
|
|
47
48
|
}, {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/cloud-roles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Create CloudFormation templates for roles with TypeScript.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
},
|
|
20
20
|
"typings": "dist/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ttoss/cloudformation": "^0.
|
|
22
|
+
"@ttoss/cloudformation": "^0.4.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@ttoss/config": "^1.
|
|
26
|
-
"@ttoss/test-utils": "^1.20.
|
|
27
|
-
"@types/jest": "^29.2.
|
|
25
|
+
"@ttoss/config": "^1.27.0",
|
|
26
|
+
"@ttoss/test-utils": "^1.20.1",
|
|
27
|
+
"@types/jest": "^29.2.5",
|
|
28
28
|
"jest": "^29.3.1"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [],
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "2bf304efc726a34b95859bb9b6fe8749c1a16844"
|
|
35
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -1 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import type {
|
|
2
|
+
CloudFormationTemplate,
|
|
3
|
+
IAMRoleResource,
|
|
4
|
+
Outputs,
|
|
5
|
+
} from '@ttoss/cloudformation';
|
|
6
|
+
|
|
7
|
+
export const IAM_PATH = '/custom-iam/';
|
|
8
|
+
|
|
9
|
+
export type { CloudFormationTemplate, IAMRoleResource, Outputs };
|
|
10
|
+
|
|
11
|
+
export const createRolesTemplate = ({
|
|
12
|
+
path = IAM_PATH,
|
|
13
|
+
resources,
|
|
14
|
+
}: {
|
|
15
|
+
path?: string;
|
|
16
|
+
resources: { [key: string]: IAMRoleResource };
|
|
17
|
+
}): CloudFormationTemplate => {
|
|
18
|
+
Object.values(resources).forEach((resource) => {
|
|
19
|
+
if (!resource.Properties.Path) {
|
|
20
|
+
resource.Properties.Path = path;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const outputs: Outputs = Object.keys(resources).reduce((acc, key) => {
|
|
25
|
+
const newKey = key + 'Arn';
|
|
26
|
+
|
|
27
|
+
acc[newKey] = {
|
|
28
|
+
Description: `Arn of the ${key} role.`,
|
|
29
|
+
Value: { 'Fn::GetAtt': [key, 'Arn'] },
|
|
30
|
+
Export: {
|
|
31
|
+
Name: { 'Fn::Join': [':', [{ Ref: 'AWS::StackName' }, newKey]] },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return acc;
|
|
36
|
+
}, {} as Outputs);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
AWSTemplateFormatVersion: '2010-09-09',
|
|
40
|
+
Description: 'Roles template. Created by @ttoss/cloud-roles.',
|
|
41
|
+
Resources: resources,
|
|
42
|
+
Outputs: outputs,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CloudFormationTemplate,
|
|
3
|
-
IAMRoleResource,
|
|
4
|
-
Outputs,
|
|
5
|
-
} from '@ttoss/cloudformation';
|
|
6
|
-
|
|
7
|
-
export const IAM_PATH = '/custom-iam/';
|
|
8
|
-
|
|
9
|
-
export const createRolesTemplate = ({
|
|
10
|
-
path = IAM_PATH,
|
|
11
|
-
resources,
|
|
12
|
-
}: {
|
|
13
|
-
path?: string;
|
|
14
|
-
resources: { [key: string]: IAMRoleResource };
|
|
15
|
-
}): CloudFormationTemplate => {
|
|
16
|
-
Object.values(resources).forEach((resource) => {
|
|
17
|
-
if (!resource.Properties.Path) {
|
|
18
|
-
resource.Properties.Path = path;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const outputs: Outputs = Object.keys(resources).reduce((acc, key) => {
|
|
23
|
-
acc[key + 'Arn'] = {
|
|
24
|
-
Description: `Arn of the ${key} role.`,
|
|
25
|
-
Value: { 'Fn::GetAtt': [key, 'Arn'] },
|
|
26
|
-
Export: { Name: { 'Fn::Join': [':', [{ Ref: 'AWS::StackName' }, key]] } },
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return acc;
|
|
30
|
-
}, {} as Outputs);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
AWSTemplateFormatVersion: '2010-09-09',
|
|
34
|
-
Description: 'Roles template. Created by @ttoss/cloud-roles.',
|
|
35
|
-
Resources: resources,
|
|
36
|
-
Outputs: outputs,
|
|
37
|
-
};
|
|
38
|
-
};
|