@gradientedge/cdk-utils 8.91.0 → 8.93.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/.eslintrc.json +40 -0
- package/app/api-destined-function/src/lib/lambda.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
- package/dist/lib/lambda.d.ts +6 -6
- package/dist/lib/lambda.js +6 -6
- package/dist/lib/lambda.js.map +1 -1
- package/dist/src/lib/common/construct.d.ts +4 -7
- package/dist/src/lib/common/construct.js +4 -7
- package/dist/src/lib/common/stack.d.ts +9 -13
- package/dist/src/lib/common/stack.js +9 -13
- package/dist/src/lib/common/types.d.ts +0 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
- package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
- package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
- package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +1 -19
- package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
- package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
- package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
- package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
- package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
- package/dist/src/lib/construct/static-site/main.d.ts +0 -17
- package/dist/src/lib/construct/static-site/main.js +1 -18
- package/dist/src/lib/construct/static-site/types.d.ts +9 -11
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
- package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
- package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
- package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
- package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
- package/dist/src/lib/services/aws/appconfig/main.js +19 -22
- package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
- package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
- package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
- package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
- package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
- package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
- package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
- package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
- package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
- package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
- package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
- package/dist/src/lib/services/aws/codebuild/main.js +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
- package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
- package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
- package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
- package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
- package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
- package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
- package/dist/src/lib/services/aws/elasticache/main.js +35 -39
- package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
- package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
- package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
- package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
- package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
- package/dist/src/lib/services/aws/evidently/main.js +19 -23
- package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
- package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
- package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
- package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
- package/dist/src/lib/services/aws/lambda/main.js +64 -69
- package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
- package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
- package/dist/src/lib/services/aws/route53/main.js +19 -23
- package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
- package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
- package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
- package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
- package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
- package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
- package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
- package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
- package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
- package/dist/src/lib/services/aws/step-function/main.js +91 -95
- package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
- package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
- package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
- package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
- package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
- package/dist/src/lib/types/aws/index.d.ts +0 -2
- package/dist/src/lib/utils/aws/index.d.ts +6 -9
- package/dist/src/lib/utils/aws/index.js +7 -10
- package/dist/src/lib/utils/index.d.ts +6 -13
- package/dist/src/lib/utils/index.js +4 -12
- package/package.json +1 -1
- package/src/lib/common/construct.ts +4 -7
- package/src/lib/common/stack.ts +9 -13
- package/src/lib/common/types.ts +0 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
- package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
- package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
- package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
- package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
- package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
- package/src/lib/construct/graphql-api-lambda/main.ts +2 -20
- package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
- package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
- package/src/lib/construct/rest-api-lambda/main.ts +2 -20
- package/src/lib/construct/rest-api-lambda/types.ts +6 -10
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
- package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
- package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
- package/src/lib/construct/static-asset-deployment/main.ts +0 -8
- package/src/lib/construct/static-asset-deployment/types.ts +1 -1
- package/src/lib/construct/static-site/main.ts +1 -18
- package/src/lib/construct/static-site/types.ts +9 -11
- package/src/lib/services/aws/api-gateway/main.ts +43 -47
- package/src/lib/services/aws/api-gateway/types.ts +0 -2
- package/src/lib/services/aws/appconfig/constants.ts +26 -32
- package/src/lib/services/aws/appconfig/main.ts +19 -22
- package/src/lib/services/aws/appconfig/types.ts +1 -3
- package/src/lib/services/aws/certificate-manager/main.ts +5 -10
- package/src/lib/services/aws/certificate-manager/types.ts +3 -5
- package/src/lib/services/aws/cloudfront/main.ts +56 -62
- package/src/lib/services/aws/cloudfront/types.ts +1 -7
- package/src/lib/services/aws/cloudtrail/main.ts +8 -12
- package/src/lib/services/aws/cloudtrail/types.ts +0 -2
- package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
- package/src/lib/services/aws/cloudwatch/main.ts +116 -122
- package/src/lib/services/aws/cloudwatch/types.ts +20 -42
- package/src/lib/services/aws/codebuild/main.ts +3 -7
- package/src/lib/services/aws/dynamodb/main.ts +13 -17
- package/src/lib/services/aws/dynamodb/types.ts +0 -2
- package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
- package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
- package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
- package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
- package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
- package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
- package/src/lib/services/aws/elasticache/main.ts +35 -39
- package/src/lib/services/aws/elasticache/types.ts +0 -4
- package/src/lib/services/aws/eventbridge/main.ts +34 -38
- package/src/lib/services/aws/eventbridge/target.ts +8 -11
- package/src/lib/services/aws/eventbridge/types.ts +2 -10
- package/src/lib/services/aws/evidently/main.ts +19 -23
- package/src/lib/services/aws/evidently/types.ts +0 -10
- package/src/lib/services/aws/identity-access-management/main.ts +97 -101
- package/src/lib/services/aws/key-management-service/main.ts +6 -10
- package/src/lib/services/aws/key-management-service/types.ts +0 -2
- package/src/lib/services/aws/lambda/main.ts +64 -69
- package/src/lib/services/aws/lambda/types.ts +6 -16
- package/src/lib/services/aws/route53/main.ts +19 -23
- package/src/lib/services/aws/route53/types.ts +0 -2
- package/src/lib/services/aws/secrets-manager/main.ts +6 -28
- package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
- package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
- package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
- package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
- package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
- package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
- package/src/lib/services/aws/step-function/main.ts +91 -95
- package/src/lib/services/aws/step-function/types.ts +0 -32
- package/src/lib/services/aws/systems-manager/main.ts +13 -19
- package/src/lib/services/aws/systems-manager/types.ts +0 -2
- package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
- package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
- package/src/lib/types/aws/index.ts +0 -2
- package/src/lib/utils/aws/index.ts +7 -10
- package/src/lib/utils/index.ts +4 -12
|
@@ -28,9 +28,6 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
28
28
|
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
|
|
29
29
|
const utils = __importStar(require("../../../utils"));
|
|
30
30
|
/**
|
|
31
|
-
* @stability stable
|
|
32
|
-
* @category cdk-utils.iam-manager
|
|
33
|
-
* @subcategory Construct
|
|
34
31
|
* @classdesc Provides operations on AWS IAM.
|
|
35
32
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
36
33
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -44,19 +41,18 @@ const utils = __importStar(require("../../../utils"));
|
|
|
44
41
|
* this.iamManager.createRoleForEcsEvent('MyEcsRole', this, cluster, task)
|
|
45
42
|
* }
|
|
46
43
|
* }
|
|
47
|
-
*
|
|
48
44
|
* @see [CDK IAM Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam-readme.html}
|
|
49
45
|
*/
|
|
50
46
|
class IamManager {
|
|
51
47
|
/**
|
|
52
48
|
* @summary Method to create iam statement to read secrets
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
49
|
+
* @param scope scope in which this resource is defined
|
|
50
|
+
* @param resourceArns list of ARNs to allow access to
|
|
55
51
|
*/
|
|
56
52
|
statementForReadSecrets(scope, resourceArns) {
|
|
57
53
|
return new iam.PolicyStatement({
|
|
58
|
-
effect: iam.Effect.ALLOW,
|
|
59
54
|
actions: ['secretsmanager:GetSecretValue'],
|
|
55
|
+
effect: iam.Effect.ALLOW,
|
|
60
56
|
resources: resourceArns ?? [
|
|
61
57
|
`arn:aws:secretsmanager:${cdk.Stack.of(scope).region}:${cdk.Stack.of(scope).account}:secret:*`,
|
|
62
58
|
],
|
|
@@ -64,55 +60,54 @@ class IamManager {
|
|
|
64
60
|
}
|
|
65
61
|
/**
|
|
66
62
|
* @summary Method to create iam statement to put events
|
|
67
|
-
* @param
|
|
63
|
+
* @param resourceArns list of ARNs to allow access to
|
|
68
64
|
*/
|
|
69
65
|
statementForPutEvents(resourceArns) {
|
|
70
66
|
return new iam.PolicyStatement({
|
|
71
|
-
effect: iam.Effect.ALLOW,
|
|
72
67
|
actions: ['events:PutEvents'],
|
|
68
|
+
effect: iam.Effect.ALLOW,
|
|
73
69
|
resources: resourceArns ?? ['*'],
|
|
74
70
|
});
|
|
75
71
|
}
|
|
76
72
|
/**
|
|
77
73
|
* @summary Method to create iam statement to start stepfunction execution
|
|
78
|
-
* @param
|
|
74
|
+
* @param resourceArns list of ARNs to allow access to
|
|
79
75
|
*/
|
|
80
76
|
statementForStartExecution(resourceArns) {
|
|
81
77
|
return new iam.PolicyStatement({
|
|
82
|
-
effect: iam.Effect.ALLOW,
|
|
83
78
|
actions: ['states:StartExecution'],
|
|
79
|
+
effect: iam.Effect.ALLOW,
|
|
84
80
|
resources: resourceArns ?? ['*'],
|
|
85
81
|
});
|
|
86
82
|
}
|
|
87
83
|
/**
|
|
88
84
|
* @summary Method to create iam statement to poll queue
|
|
89
|
-
* @param
|
|
85
|
+
* @param resourceArns list of ARNs to allow access to
|
|
90
86
|
*/
|
|
91
87
|
statementForPollQueue(resourceArns) {
|
|
92
88
|
return new iam.PolicyStatement({
|
|
93
|
-
effect: iam.Effect.ALLOW,
|
|
94
89
|
actions: ['sqs:ReceiveMessage', 'sqs:DeleteMessage', 'sqs:GetQueueAttributes'],
|
|
90
|
+
effect: iam.Effect.ALLOW,
|
|
95
91
|
resources: resourceArns ?? ['*'],
|
|
96
92
|
});
|
|
97
93
|
}
|
|
98
94
|
/**
|
|
99
95
|
* @summary Method to create iam statement to invoke lambda function
|
|
100
|
-
* @param
|
|
96
|
+
* @param resourceArns list of ARNs to allow access to
|
|
101
97
|
*/
|
|
102
98
|
statementForInvokeLambda(resourceArns) {
|
|
103
99
|
return new iam.PolicyStatement({
|
|
104
|
-
effect: iam.Effect.ALLOW,
|
|
105
100
|
actions: ['lambda:InvokeFunction'],
|
|
101
|
+
effect: iam.Effect.ALLOW,
|
|
106
102
|
resources: resourceArns ?? ['*'],
|
|
107
103
|
});
|
|
108
104
|
}
|
|
109
105
|
/**
|
|
110
106
|
* @summary Method to create iam statement to read app config
|
|
111
|
-
* @param
|
|
107
|
+
* @param resourceArns list of ARNs to allow access to
|
|
112
108
|
*/
|
|
113
109
|
statementForReadAnyAppConfig(resourceArns) {
|
|
114
110
|
return new iam.PolicyStatement({
|
|
115
|
-
effect: iam.Effect.ALLOW,
|
|
116
111
|
actions: [
|
|
117
112
|
'ssm:GetDocument',
|
|
118
113
|
'ssm:ListDocuments',
|
|
@@ -127,140 +122,141 @@ class IamManager {
|
|
|
127
122
|
'appconfig:GetConfiguration',
|
|
128
123
|
'appconfig:ListDeployments',
|
|
129
124
|
],
|
|
125
|
+
effect: iam.Effect.ALLOW,
|
|
130
126
|
resources: resourceArns ?? ['*'],
|
|
131
127
|
});
|
|
132
128
|
}
|
|
133
129
|
/**
|
|
134
130
|
* @summary Method to create iam statement to access app config
|
|
135
|
-
* @param
|
|
131
|
+
* @param resourceArns list of ARNs to allow access to
|
|
136
132
|
*/
|
|
137
133
|
statementForAppConfigExecution(resourceArns) {
|
|
138
134
|
return new iam.PolicyStatement({
|
|
139
|
-
effect: iam.Effect.ALLOW,
|
|
140
135
|
actions: ['appconfig:GetLatestConfiguration', 'appconfig:StartConfigurationSession'],
|
|
136
|
+
effect: iam.Effect.ALLOW,
|
|
141
137
|
resources: resourceArns ?? ['*'],
|
|
142
138
|
});
|
|
143
139
|
}
|
|
144
140
|
/**
|
|
145
141
|
* @summary Method to create iam statement to put xray telemetry
|
|
146
|
-
* @param
|
|
142
|
+
* @param resourceArns list of ARNs to allow access to
|
|
147
143
|
*/
|
|
148
144
|
statementForPutXrayTelemetry(resourceArns) {
|
|
149
145
|
return new iam.PolicyStatement({
|
|
150
|
-
effect: iam.Effect.ALLOW,
|
|
151
146
|
actions: ['xray:PutTraceSegments', 'xray:PutTelemetryRecords'],
|
|
147
|
+
effect: iam.Effect.ALLOW,
|
|
152
148
|
resources: resourceArns ?? ['*'],
|
|
153
149
|
});
|
|
154
150
|
}
|
|
155
151
|
/**
|
|
156
152
|
* @summary Method to create iam statement to decrypt kms
|
|
157
|
-
* @param
|
|
153
|
+
* @param resourceArns list of ARNs to allow access to
|
|
158
154
|
*/
|
|
159
155
|
statementForDecryptKms(resourceArns) {
|
|
160
156
|
return new iam.PolicyStatement({
|
|
161
|
-
effect: iam.Effect.ALLOW,
|
|
162
157
|
actions: ['kms:Decrypt'],
|
|
158
|
+
effect: iam.Effect.ALLOW,
|
|
163
159
|
resources: resourceArns ?? ['*'],
|
|
164
160
|
});
|
|
165
161
|
}
|
|
166
162
|
/**
|
|
167
163
|
* @summary Method to create iam statement to list s3 buckets
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
164
|
+
* @param scope scope in which this resource is defined
|
|
165
|
+
* @param bucket
|
|
170
166
|
*/
|
|
171
167
|
statementForListBucket(scope, bucket) {
|
|
172
168
|
return new iam.PolicyStatement({
|
|
173
|
-
effect: iam.Effect.ALLOW,
|
|
174
169
|
actions: ['s3:ListBucket'],
|
|
170
|
+
effect: iam.Effect.ALLOW,
|
|
175
171
|
resources: [bucket.bucketArn],
|
|
176
172
|
});
|
|
177
173
|
}
|
|
178
174
|
/**
|
|
179
175
|
* @summary Method to create iam statement to list all s3 buckets
|
|
180
|
-
* @param
|
|
176
|
+
* @param resourceArns list of ARNs to allow access to
|
|
181
177
|
*/
|
|
182
178
|
statementForListAllMyBuckets(resourceArns) {
|
|
183
179
|
return new iam.PolicyStatement({
|
|
184
|
-
effect: iam.Effect.ALLOW,
|
|
185
180
|
actions: ['s3:ListAllMyBuckets'],
|
|
181
|
+
effect: iam.Effect.ALLOW,
|
|
186
182
|
resources: resourceArns ?? ['*'],
|
|
187
183
|
});
|
|
188
184
|
}
|
|
189
185
|
/**
|
|
190
186
|
* @summary Method to create iam statement to get s3 objects in buckets
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
187
|
+
* @param scope scope in which this resource is defined
|
|
188
|
+
* @param bucket
|
|
189
|
+
* @param resourceArns list of ARNs to allow access to
|
|
194
190
|
*/
|
|
195
191
|
statementForGetAnyS3Objects(scope, bucket, resourceArns) {
|
|
196
192
|
return new iam.PolicyStatement({
|
|
197
|
-
effect: iam.Effect.ALLOW,
|
|
198
193
|
actions: ['s3:GetObject', 's3:GetObjectAcl'],
|
|
194
|
+
effect: iam.Effect.ALLOW,
|
|
199
195
|
resources: resourceArns ?? [bucket.arnForObjects(`*`)],
|
|
200
196
|
});
|
|
201
197
|
}
|
|
202
198
|
/**
|
|
203
199
|
* @summary Method to create iam statement to delete s3 objects in buckets
|
|
204
|
-
* @param
|
|
205
|
-
* @param
|
|
206
|
-
* @param
|
|
200
|
+
* @param scope scope in which this resource is defined
|
|
201
|
+
* @param bucket
|
|
202
|
+
* @param resourceArns list of ARNs to allow access to
|
|
207
203
|
*/
|
|
208
204
|
statementForDeleteAnyS3Objects(scope, bucket, resourceArns) {
|
|
209
205
|
return new iam.PolicyStatement({
|
|
210
|
-
effect: iam.Effect.ALLOW,
|
|
211
206
|
actions: ['s3:DeleteObject'],
|
|
207
|
+
effect: iam.Effect.ALLOW,
|
|
212
208
|
resources: resourceArns ?? [bucket.arnForObjects(`*`)],
|
|
213
209
|
});
|
|
214
210
|
}
|
|
215
211
|
/**
|
|
216
212
|
* @summary Method to create iam statement to write s3 objects in buckets
|
|
217
|
-
* @param
|
|
218
|
-
* @param
|
|
219
|
-
* @param
|
|
213
|
+
* @param scope scope in which this resource is defined
|
|
214
|
+
* @param bucket
|
|
215
|
+
* @param resourceArns list of ARNs to allow access to
|
|
220
216
|
*/
|
|
221
217
|
statementForPutAnyS3Objects(scope, bucket, resourceArns) {
|
|
222
218
|
return new iam.PolicyStatement({
|
|
223
|
-
effect: iam.Effect.ALLOW,
|
|
224
219
|
actions: ['s3:PutObject', 's3:PutObjectAcl'],
|
|
220
|
+
effect: iam.Effect.ALLOW,
|
|
225
221
|
resources: resourceArns ?? [bucket.arnForObjects(`*`)],
|
|
226
222
|
});
|
|
227
223
|
}
|
|
228
224
|
/**
|
|
229
225
|
* @summary Method to create iam statement to pass iam role
|
|
230
|
-
* @param
|
|
226
|
+
* @param resourceArns list of ARNs to allow access to
|
|
231
227
|
*/
|
|
232
228
|
statementForPassRole(resourceArns) {
|
|
233
229
|
return new iam.PolicyStatement({
|
|
234
|
-
effect: iam.Effect.ALLOW,
|
|
235
230
|
actions: ['iam:PassRole'],
|
|
231
|
+
effect: iam.Effect.ALLOW,
|
|
236
232
|
resources: resourceArns ?? ['*'],
|
|
237
233
|
});
|
|
238
234
|
}
|
|
239
235
|
/**
|
|
240
236
|
* @summary Method to create iam statement to invalidate cloudfront cache
|
|
241
|
-
* @param
|
|
237
|
+
* @param resourceArns list of ARNs to allow access to
|
|
242
238
|
*/
|
|
243
239
|
statementForCloudfrontInvalidation(resourceArns) {
|
|
244
240
|
return new iam.PolicyStatement({
|
|
245
|
-
effect: iam.Effect.ALLOW,
|
|
246
241
|
actions: ['cloudfront:GetInvalidation', 'cloudfront:CreateInvalidation'],
|
|
242
|
+
effect: iam.Effect.ALLOW,
|
|
247
243
|
resources: resourceArns ?? ['*'],
|
|
248
244
|
});
|
|
249
245
|
}
|
|
250
246
|
/**
|
|
251
247
|
* @summary Method to create iam statement to access efs
|
|
252
|
-
* @param
|
|
248
|
+
* @param resourceArns list of ARNs to allow access to
|
|
253
249
|
*/
|
|
254
250
|
statementForWriteEfs(resourceArns) {
|
|
255
251
|
return new iam.PolicyStatement({
|
|
256
|
-
effect: iam.Effect.ALLOW,
|
|
257
252
|
actions: ['elasticfilesystem:*'],
|
|
253
|
+
effect: iam.Effect.ALLOW,
|
|
258
254
|
resources: resourceArns ?? ['*'],
|
|
259
255
|
});
|
|
260
256
|
}
|
|
261
257
|
/**
|
|
262
258
|
* @summary Method to create iam policy to invalidate cloudfront cache
|
|
263
|
-
* @param
|
|
259
|
+
* @param resourceArns list of ARNs to allow access to
|
|
264
260
|
*/
|
|
265
261
|
policyForCloudfrontInvalidation(resourceArns) {
|
|
266
262
|
return new iam.PolicyDocument({
|
|
@@ -269,13 +265,13 @@ class IamManager {
|
|
|
269
265
|
this.statementForPutAnyLogEvent(),
|
|
270
266
|
this.statementForCloudfrontInvalidation(),
|
|
271
267
|
new iam.PolicyStatement({
|
|
272
|
-
effect: iam.Effect.ALLOW,
|
|
273
268
|
actions: [
|
|
274
269
|
'ecr:GetDownloadUrlForLayer',
|
|
275
270
|
'ecr:BatchGetImage',
|
|
276
271
|
'ecr:BatchCheckLayerAvailability',
|
|
277
272
|
'ecr:GetAuthorizationToken',
|
|
278
273
|
],
|
|
274
|
+
effect: iam.Effect.ALLOW,
|
|
279
275
|
resources: resourceArns ?? ['*'],
|
|
280
276
|
}),
|
|
281
277
|
],
|
|
@@ -283,8 +279,8 @@ class IamManager {
|
|
|
283
279
|
}
|
|
284
280
|
/**
|
|
285
281
|
* @summary Method to create iam role to invalidate cloudfront cache
|
|
286
|
-
* @param
|
|
287
|
-
* @param
|
|
282
|
+
* @param id scoped id of the resource
|
|
283
|
+
* @param scope scope in which this resource is defined
|
|
288
284
|
*/
|
|
289
285
|
roleForCloudfrontInvalidation(id, scope) {
|
|
290
286
|
return new iam.Role(scope, `${id}-install-deps-project-role`, {
|
|
@@ -296,51 +292,51 @@ class IamManager {
|
|
|
296
292
|
}
|
|
297
293
|
/**
|
|
298
294
|
* @summary Method to create iam statement to assume iam role
|
|
299
|
-
* @param
|
|
300
|
-
* @param
|
|
295
|
+
* @param scope scope in which this resource is defined
|
|
296
|
+
* @param servicePrincipals
|
|
301
297
|
*/
|
|
302
298
|
statementForAssumeRole(scope, servicePrincipals) {
|
|
303
299
|
return new iam.PolicyStatement({
|
|
304
|
-
effect: iam.Effect.ALLOW,
|
|
305
300
|
actions: ['sts:AssumeRole'],
|
|
301
|
+
effect: iam.Effect.ALLOW,
|
|
306
302
|
principals: servicePrincipals,
|
|
307
303
|
});
|
|
308
304
|
}
|
|
309
305
|
/**
|
|
310
306
|
* @summary Method to create iam statement to pass ecs role
|
|
311
|
-
* @param
|
|
307
|
+
* @param resourceArns list of ARNs to allow access to
|
|
312
308
|
*/
|
|
313
309
|
statementForEcsPassRole(resourceArns) {
|
|
314
310
|
return new iam.PolicyStatement({
|
|
315
|
-
effect: iam.Effect.ALLOW,
|
|
316
311
|
actions: ['iam:PassRole'],
|
|
317
|
-
resources: resourceArns ?? ['*'],
|
|
318
312
|
conditions: { StringLike: { 'iam:PassedToService': 'ecs-tasks.amazonaws.com' } },
|
|
313
|
+
effect: iam.Effect.ALLOW,
|
|
314
|
+
resources: resourceArns ?? ['*'],
|
|
319
315
|
});
|
|
320
316
|
}
|
|
321
317
|
/**
|
|
322
318
|
* @summary Method to create iam statement to run ecs task
|
|
323
|
-
* @param
|
|
324
|
-
* @param
|
|
325
|
-
* @param
|
|
319
|
+
* @param scope scope in which this resource is defined
|
|
320
|
+
* @param cluster
|
|
321
|
+
* @param task
|
|
326
322
|
*/
|
|
327
323
|
statementForRunEcsTask(scope, cluster, task) {
|
|
328
324
|
return new iam.PolicyStatement({
|
|
329
|
-
effect: iam.Effect.ALLOW,
|
|
330
325
|
actions: ['ecs:RunTask'],
|
|
331
|
-
resources: [task.taskDefinitionArn],
|
|
332
326
|
conditions: { ArnLike: { 'ecs:cluster': cluster.clusterArn } },
|
|
327
|
+
effect: iam.Effect.ALLOW,
|
|
328
|
+
resources: [task.taskDefinitionArn],
|
|
333
329
|
});
|
|
334
330
|
}
|
|
335
331
|
/**
|
|
336
332
|
* @summary Method to create iam statement to create log stream
|
|
337
|
-
* @param
|
|
338
|
-
* @param
|
|
333
|
+
* @param scope scope in which this resource is defined
|
|
334
|
+
* @param logGroup
|
|
339
335
|
*/
|
|
340
336
|
statementForCreateLogStream(scope, logGroup) {
|
|
341
337
|
return new iam.PolicyStatement({
|
|
342
|
-
effect: iam.Effect.ALLOW,
|
|
343
338
|
actions: ['logs:CreateLogStream'],
|
|
339
|
+
effect: iam.Effect.ALLOW,
|
|
344
340
|
resources: [
|
|
345
341
|
`arn:aws:logs:${cdk.Stack.of(scope).region}:${cdk.Stack.of(scope).account}:log-group:${logGroup.logGroupName}:log-stream:${cdk.Stack.of(scope).account}_CloudTrail_eu-west-1*`,
|
|
346
342
|
],
|
|
@@ -349,24 +345,24 @@ class IamManager {
|
|
|
349
345
|
}
|
|
350
346
|
/**
|
|
351
347
|
* @summary Method to create iam statement to create any log stream
|
|
352
|
-
* @param
|
|
348
|
+
* @param resourceArns list of ARNs to allow access to
|
|
353
349
|
*/
|
|
354
350
|
statementForCreateAnyLogStream(resourceArns) {
|
|
355
351
|
return new iam.PolicyStatement({
|
|
356
|
-
effect: iam.Effect.ALLOW,
|
|
357
352
|
actions: ['logs:CreateLogStream'],
|
|
353
|
+
effect: iam.Effect.ALLOW,
|
|
358
354
|
resources: resourceArns ?? ['*'],
|
|
359
355
|
});
|
|
360
356
|
}
|
|
361
357
|
/**
|
|
362
358
|
* @summary Method to create iam statement to write log events
|
|
363
|
-
* @param
|
|
364
|
-
* @param
|
|
359
|
+
* @param scope scope in which this resource is defined
|
|
360
|
+
* @param logGroup
|
|
365
361
|
*/
|
|
366
362
|
statementForPutLogEvent(scope, logGroup) {
|
|
367
363
|
return new iam.PolicyStatement({
|
|
368
|
-
effect: iam.Effect.ALLOW,
|
|
369
364
|
actions: ['logs:PutLogEvents'],
|
|
365
|
+
effect: iam.Effect.ALLOW,
|
|
370
366
|
resources: [
|
|
371
367
|
`arn:aws:logs:${cdk.Stack.of(scope).region}:${cdk.Stack.of(scope).account}:log-group:${logGroup.logGroupName}:log-stream:${cdk.Stack.of(scope).account}_CloudTrail_eu-west-1*`,
|
|
372
368
|
],
|
|
@@ -375,22 +371,21 @@ class IamManager {
|
|
|
375
371
|
}
|
|
376
372
|
/**
|
|
377
373
|
* @summary Method to create iam statement to write any log events
|
|
378
|
-
* @param
|
|
374
|
+
* @param resourceArns list of ARNs to allow access to
|
|
379
375
|
*/
|
|
380
376
|
statementForPutAnyLogEvent(resourceArns) {
|
|
381
377
|
return new iam.PolicyStatement({
|
|
382
|
-
effect: iam.Effect.ALLOW,
|
|
383
378
|
actions: ['logs:PutLogEvents'],
|
|
379
|
+
effect: iam.Effect.ALLOW,
|
|
384
380
|
resources: resourceArns ?? ['*'],
|
|
385
381
|
});
|
|
386
382
|
}
|
|
387
383
|
/**
|
|
388
384
|
* @summary Method to create iam statement to read items from dynamodb table
|
|
389
|
-
* @param
|
|
385
|
+
* @param resourceArns list of ARNs to allow access to
|
|
390
386
|
*/
|
|
391
387
|
statementForReadTableItems(resourceArns) {
|
|
392
388
|
return new iam.PolicyStatement({
|
|
393
|
-
effect: iam.Effect.ALLOW,
|
|
394
389
|
actions: [
|
|
395
390
|
'dynamodb:PartiQLSelect',
|
|
396
391
|
'dynamodb:DescribeTable',
|
|
@@ -401,25 +396,26 @@ class IamManager {
|
|
|
401
396
|
'dynamodb:GetRecords',
|
|
402
397
|
'dynamodb:BatchGetItem',
|
|
403
398
|
],
|
|
399
|
+
effect: iam.Effect.ALLOW,
|
|
404
400
|
resources: resourceArns ?? ['*'],
|
|
405
401
|
});
|
|
406
402
|
}
|
|
407
403
|
/**
|
|
408
404
|
* @summary Method to create iam statement to write items from dynamodb table
|
|
409
|
-
* @param
|
|
405
|
+
* @param resourceArns list of ARNs to allow access to
|
|
410
406
|
*/
|
|
411
407
|
statementForWriteTableItems(resourceArns) {
|
|
412
408
|
return new iam.PolicyStatement({
|
|
413
|
-
effect: iam.Effect.ALLOW,
|
|
414
409
|
actions: ['dynamodb:BatchWriteItem', 'dynamodb:DeleteItem', 'dynamodb:PutItem', 'dynamodb:UpdateItem'],
|
|
410
|
+
effect: iam.Effect.ALLOW,
|
|
415
411
|
resources: resourceArns ?? ['*'],
|
|
416
412
|
});
|
|
417
413
|
}
|
|
418
414
|
/**
|
|
419
415
|
* @summary Method to create iam statement for cloud trail
|
|
420
|
-
* @param
|
|
421
|
-
* @param
|
|
422
|
-
* @param
|
|
416
|
+
* @param id scoped id of the resource
|
|
417
|
+
* @param scope scope in which this resource is defined
|
|
418
|
+
* @param logGroup
|
|
423
419
|
*/
|
|
424
420
|
createRoleForCloudTrail(id, scope, logGroup) {
|
|
425
421
|
const policy = new iam.PolicyDocument({
|
|
@@ -431,8 +427,8 @@ class IamManager {
|
|
|
431
427
|
}),
|
|
432
428
|
policies: [
|
|
433
429
|
{
|
|
434
|
-
policyName: `${id}-policy-${scope.props.stage}`,
|
|
435
430
|
policyDocument: policy,
|
|
431
|
+
policyName: `${id}-policy-${scope.props.stage}`,
|
|
436
432
|
},
|
|
437
433
|
],
|
|
438
434
|
roleName: `${id}-${scope.props.stage}`,
|
|
@@ -443,10 +439,10 @@ class IamManager {
|
|
|
443
439
|
}
|
|
444
440
|
/**
|
|
445
441
|
* @summary Method to create iam statement for ecs event
|
|
446
|
-
* @param
|
|
447
|
-
* @param
|
|
448
|
-
* @param
|
|
449
|
-
* @param
|
|
442
|
+
* @param id scoped id of the resource
|
|
443
|
+
* @param scope scope in which this resource is defined
|
|
444
|
+
* @param cluster
|
|
445
|
+
* @param task
|
|
450
446
|
*/
|
|
451
447
|
createRoleForEcsEvent(id, scope, cluster, task) {
|
|
452
448
|
const policy = new iam.PolicyDocument({
|
|
@@ -464,9 +460,9 @@ class IamManager {
|
|
|
464
460
|
}
|
|
465
461
|
/**
|
|
466
462
|
* @summary Method to create iam statement for ecs execution
|
|
467
|
-
* @param
|
|
468
|
-
* @param
|
|
469
|
-
* @param
|
|
463
|
+
* @param id scoped id of the resource
|
|
464
|
+
* @param scope scope in which this resource is defined
|
|
465
|
+
* @param policy
|
|
470
466
|
*/
|
|
471
467
|
createRoleForEcsExecution(id, scope, policy) {
|
|
472
468
|
const role = new iam.Role(scope, `${id}`, {
|
|
@@ -484,10 +480,10 @@ class IamManager {
|
|
|
484
480
|
}
|
|
485
481
|
/**
|
|
486
482
|
* @summary Method to create iam statement for lambda execution
|
|
487
|
-
* @param
|
|
488
|
-
* @param
|
|
489
|
-
* @param
|
|
490
|
-
* @param
|
|
483
|
+
* @param id scoped id of the resource
|
|
484
|
+
* @param scope scope in which this resource is defined
|
|
485
|
+
* @param policy
|
|
486
|
+
* @param servicePrinicpal
|
|
491
487
|
*/
|
|
492
488
|
createRoleForLambda(id, scope, policy, servicePrinicpal) {
|
|
493
489
|
const role = new iam.Role(scope, `${id}`, {
|
|
@@ -505,10 +501,10 @@ class IamManager {
|
|
|
505
501
|
}
|
|
506
502
|
/**
|
|
507
503
|
* @summary Method to create iam statement for step function execution
|
|
508
|
-
* @param
|
|
509
|
-
* @param
|
|
510
|
-
* @param
|
|
511
|
-
* @param
|
|
504
|
+
* @param id scoped id of the resource
|
|
505
|
+
* @param scope scope in which this resource is defined
|
|
506
|
+
* @param policy
|
|
507
|
+
* @param servicePrinicpal
|
|
512
508
|
*/
|
|
513
509
|
createRoleForStepFunction(id, scope, policy, servicePrinicpal) {
|
|
514
510
|
const role = new iam.Role(scope, `${id}`, {
|
|
@@ -526,10 +522,10 @@ class IamManager {
|
|
|
526
522
|
}
|
|
527
523
|
/**
|
|
528
524
|
* @summary Method to create iam statement for sqs to step function pipe
|
|
529
|
-
* @param
|
|
530
|
-
* @param
|
|
531
|
-
* @param
|
|
532
|
-
* @param
|
|
525
|
+
* @param id scoped id of the resource
|
|
526
|
+
* @param scope scope in which this resource is defined
|
|
527
|
+
* @param queueArn the arn of the sqs queue
|
|
528
|
+
* @param stepFunctionArn the arn of the step function
|
|
533
529
|
*/
|
|
534
530
|
createRoleForSqsToSfnPipe(id, scope, queueArn, stepFunctionArn) {
|
|
535
531
|
const role = new iam.Role(scope, `${id}`, {
|
|
@@ -545,8 +541,8 @@ class IamManager {
|
|
|
545
541
|
}
|
|
546
542
|
/**
|
|
547
543
|
* @summary Method to create iam policy for sqs
|
|
548
|
-
* @param
|
|
549
|
-
* @param
|
|
544
|
+
* @param id scoped id of the resource
|
|
545
|
+
* @param scope scope in which this resource is defined
|
|
550
546
|
* @param sqsQueue
|
|
551
547
|
* @param eventBridgeRule
|
|
552
548
|
* @param servicePrincipals
|
|
@@ -556,12 +552,12 @@ class IamManager {
|
|
|
556
552
|
statements: [
|
|
557
553
|
new iam.PolicyStatement({
|
|
558
554
|
actions: ['sqs:*'],
|
|
559
|
-
effect: iam.Effect.ALLOW,
|
|
560
555
|
conditions: {
|
|
561
556
|
ArnEquals: {
|
|
562
557
|
'aws:SourceArn': eventBridgeRule,
|
|
563
558
|
},
|
|
564
559
|
},
|
|
560
|
+
effect: iam.Effect.ALLOW,
|
|
565
561
|
principals: servicePrincipals ?? [new iam.ServicePrincipal('events.amazonaws.com')],
|
|
566
562
|
resources: [sqsQueue.queueArn],
|
|
567
563
|
}),
|
|
@@ -2,9 +2,6 @@ import * as kms from 'aws-cdk-lib/aws-kms';
|
|
|
2
2
|
import { CommonConstruct } from '../../../common';
|
|
3
3
|
import { KmsKeyProps } from './types';
|
|
4
4
|
/**
|
|
5
|
-
* @stability stable
|
|
6
|
-
* @category cdk-utils.kms-manager
|
|
7
|
-
* @subcategory Construct
|
|
8
5
|
* @classdesc Provides operations on AWS KMS.
|
|
9
6
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
10
7
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -18,15 +15,14 @@ import { KmsKeyProps } from './types';
|
|
|
18
15
|
* this.kms.createKey('MyKey', this)
|
|
19
16
|
* }
|
|
20
17
|
* }
|
|
21
|
-
*
|
|
22
18
|
* @see [CDK KMS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms-readme.html}
|
|
23
19
|
*/
|
|
24
20
|
export declare class KmsManager {
|
|
25
21
|
/**
|
|
26
22
|
* @summary Method to create a KMS key
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
23
|
+
* @param id scoped id of the resource
|
|
24
|
+
* @param scope scope in which this resource is defined
|
|
25
|
+
* @param props KMS key props
|
|
30
26
|
*/
|
|
31
27
|
createKey(id: string, scope: CommonConstruct, props: KmsKeyProps): kms.Key;
|
|
32
28
|
}
|
|
@@ -27,9 +27,6 @@ exports.KmsManager = void 0;
|
|
|
27
27
|
const kms = __importStar(require("aws-cdk-lib/aws-kms"));
|
|
28
28
|
const utils = __importStar(require("../../../utils"));
|
|
29
29
|
/**
|
|
30
|
-
* @stability stable
|
|
31
|
-
* @category cdk-utils.kms-manager
|
|
32
|
-
* @subcategory Construct
|
|
33
30
|
* @classdesc Provides operations on AWS KMS.
|
|
34
31
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
35
32
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -43,30 +40,29 @@ const utils = __importStar(require("../../../utils"));
|
|
|
43
40
|
* this.kms.createKey('MyKey', this)
|
|
44
41
|
* }
|
|
45
42
|
* }
|
|
46
|
-
*
|
|
47
43
|
* @see [CDK KMS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms-readme.html}
|
|
48
44
|
*/
|
|
49
45
|
class KmsManager {
|
|
50
46
|
/**
|
|
51
47
|
* @summary Method to create a KMS key
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
48
|
+
* @param id scoped id of the resource
|
|
49
|
+
* @param scope scope in which this resource is defined
|
|
50
|
+
* @param props KMS key props
|
|
55
51
|
*/
|
|
56
52
|
createKey(id, scope, props) {
|
|
57
53
|
if (!props)
|
|
58
54
|
throw `KMS Key props undefined for ${id}`;
|
|
59
55
|
const key = new kms.Key(scope, `${id}`, {
|
|
60
|
-
|
|
56
|
+
admins: props.admins,
|
|
61
57
|
alias: `${props.alias}-${scope.props.stage}`,
|
|
58
|
+
description: props.description,
|
|
62
59
|
enableKeyRotation: props.enableKeyRotation,
|
|
63
60
|
enabled: props.enabled,
|
|
64
61
|
keySpec: props.keySpec,
|
|
65
62
|
keyUsage: props.keyUsage,
|
|
63
|
+
pendingWindow: props.pendingWindow,
|
|
66
64
|
policy: props.policy,
|
|
67
|
-
admins: props.admins,
|
|
68
65
|
removalPolicy: props.removalPolicy,
|
|
69
|
-
pendingWindow: props.pendingWindow,
|
|
70
66
|
});
|
|
71
67
|
utils.createCfnOutput(`${id}-keyId`, scope, key.keyId);
|
|
72
68
|
utils.createCfnOutput(`${id}-keyArn`, scope, key.keyArn);
|