@gradientedge/cdk-utils 8.91.0 → 8.92.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 +0 -18
- 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 +0 -18
- 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 +1 -19
- 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 +1 -19
- 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
|
@@ -31,16 +31,13 @@ const utils = __importStar(require("../../../utils"));
|
|
|
31
31
|
const uuid_1 = require("uuid");
|
|
32
32
|
const DEFAULT_RETRY_CONFIG = [
|
|
33
33
|
{
|
|
34
|
+
backoffRate: 2,
|
|
34
35
|
errors: ['States.ALL'],
|
|
35
36
|
intervalInSecs: 30,
|
|
36
37
|
maxAttempts: 6,
|
|
37
|
-
backoffRate: 2,
|
|
38
38
|
},
|
|
39
39
|
];
|
|
40
40
|
/**
|
|
41
|
-
* @stability stable
|
|
42
|
-
* @category cdk-utils.step-functions-manager
|
|
43
|
-
* @subcategory Construct
|
|
44
41
|
* @classdesc Provides operations on AWS Step Functions Service.
|
|
45
42
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
46
43
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -54,15 +51,14 @@ const DEFAULT_RETRY_CONFIG = [
|
|
|
54
51
|
* this.sfnManager.createSuccessStep('MyStep', this, myStepProps)
|
|
55
52
|
* }
|
|
56
53
|
* }
|
|
57
|
-
*
|
|
58
54
|
* @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
|
|
59
55
|
*/
|
|
60
56
|
class SfnManager {
|
|
61
57
|
/**
|
|
62
58
|
* @summary Method to create a success step
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
59
|
+
* @param id scoped id of the resource
|
|
60
|
+
* @param scope scope in which this resource is defined
|
|
61
|
+
* @param props
|
|
66
62
|
*/
|
|
67
63
|
createSuccessStep(id, scope, props) {
|
|
68
64
|
if (!props)
|
|
@@ -76,9 +72,9 @@ class SfnManager {
|
|
|
76
72
|
}
|
|
77
73
|
/**
|
|
78
74
|
* @summary Method to create a failure step
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
75
|
+
* @param id scoped id of the resource
|
|
76
|
+
* @param scope scope in which this resource is defined
|
|
77
|
+
* @param props
|
|
82
78
|
*/
|
|
83
79
|
createFailStep(id, scope, props) {
|
|
84
80
|
if (!props)
|
|
@@ -92,9 +88,9 @@ class SfnManager {
|
|
|
92
88
|
}
|
|
93
89
|
/**
|
|
94
90
|
* @summary Method to create a pass step
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
91
|
+
* @param id scoped id of the resource
|
|
92
|
+
* @param scope scope in which this resource is defined
|
|
93
|
+
* @param props
|
|
98
94
|
*/
|
|
99
95
|
createPassStep(id, scope, props) {
|
|
100
96
|
if (!props)
|
|
@@ -108,9 +104,9 @@ class SfnManager {
|
|
|
108
104
|
}
|
|
109
105
|
/**
|
|
110
106
|
* @summary Method to create a parallel step
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
107
|
+
* @param id scoped id of the resource
|
|
108
|
+
* @param scope scope in which this resource is defined
|
|
109
|
+
* @param props
|
|
114
110
|
*/
|
|
115
111
|
createParallelStep(id, scope, props) {
|
|
116
112
|
if (!props)
|
|
@@ -133,9 +129,9 @@ class SfnManager {
|
|
|
133
129
|
}
|
|
134
130
|
/**
|
|
135
131
|
* @summary Method to create a choice step
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
* @param
|
|
132
|
+
* @param id scoped id of the resource
|
|
133
|
+
* @param scope scope in which this resource is defined
|
|
134
|
+
* @param props
|
|
139
135
|
*/
|
|
140
136
|
createChoiceStep(id, scope, props) {
|
|
141
137
|
if (!props)
|
|
@@ -149,9 +145,9 @@ class SfnManager {
|
|
|
149
145
|
}
|
|
150
146
|
/**
|
|
151
147
|
* @summary Method to create a wait step
|
|
152
|
-
* @param
|
|
153
|
-
* @param
|
|
154
|
-
* @param
|
|
148
|
+
* @param id scoped id of the resource
|
|
149
|
+
* @param scope scope in which this resource is defined
|
|
150
|
+
* @param props
|
|
155
151
|
*/
|
|
156
152
|
createWaitStep(id, scope, props) {
|
|
157
153
|
return new sfn.Wait(scope, `${props.name}`, {
|
|
@@ -164,10 +160,10 @@ class SfnManager {
|
|
|
164
160
|
}
|
|
165
161
|
/**
|
|
166
162
|
* @summary Method to create a DynamoDB get item step
|
|
167
|
-
* @param
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
170
|
-
* @param
|
|
163
|
+
* @param id scoped id of the resource
|
|
164
|
+
* @param scope scope in which this resource is defined
|
|
165
|
+
* @param props
|
|
166
|
+
* @param table The table to get the item from
|
|
171
167
|
* @param tableKey The table key for query/scan
|
|
172
168
|
*/
|
|
173
169
|
createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
|
|
@@ -176,20 +172,20 @@ class SfnManager {
|
|
|
176
172
|
const step = new tasks.DynamoGetItem(scope, `${props.name}`, {
|
|
177
173
|
...props,
|
|
178
174
|
...{
|
|
179
|
-
|
|
180
|
-
key: tableKey,
|
|
175
|
+
comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
181
176
|
consistentRead: props.consistentRead,
|
|
177
|
+
expressionAttributeNames: props.expressionAttributeNames,
|
|
178
|
+
heartbeatTimeout: props.heartbeatTimeout,
|
|
182
179
|
inputPath: props.inputPath,
|
|
180
|
+
integrationPattern: props.integrationPattern,
|
|
181
|
+
key: tableKey,
|
|
183
182
|
outputPath: props.outputPath,
|
|
183
|
+
projectionExpression: props.projectionExpression,
|
|
184
184
|
resultPath: props.resultPath,
|
|
185
185
|
resultSelector: props.resultSelector,
|
|
186
|
-
taskTimeout: props.taskTimeout,
|
|
187
|
-
heartbeatTimeout: props.heartbeatTimeout,
|
|
188
|
-
integrationPattern: props.integrationPattern,
|
|
189
|
-
expressionAttributeNames: props.expressionAttributeNames,
|
|
190
|
-
projectionExpression: props.projectionExpression,
|
|
191
186
|
returnConsumedCapacity: props.returnConsumedCapacity,
|
|
192
|
-
|
|
187
|
+
table: table,
|
|
188
|
+
taskTimeout: props.taskTimeout,
|
|
193
189
|
},
|
|
194
190
|
});
|
|
195
191
|
let retries = props.retries;
|
|
@@ -204,10 +200,10 @@ class SfnManager {
|
|
|
204
200
|
}
|
|
205
201
|
/**
|
|
206
202
|
* @summary Method to create a DynamoDB put item step
|
|
207
|
-
* @param
|
|
208
|
-
* @param
|
|
209
|
-
* @param
|
|
210
|
-
* @param
|
|
203
|
+
* @param id scoped id of the resource
|
|
204
|
+
* @param scope scope in which this resource is defined
|
|
205
|
+
* @param props
|
|
206
|
+
* @param table The table to put the item in
|
|
211
207
|
* @param tableItem The item to add to the table
|
|
212
208
|
*/
|
|
213
209
|
createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
|
|
@@ -216,22 +212,22 @@ class SfnManager {
|
|
|
216
212
|
const step = new tasks.DynamoPutItem(scope, `${props.name}`, {
|
|
217
213
|
...props,
|
|
218
214
|
...{
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
216
|
+
conditionExpression: props.conditionExpression,
|
|
217
|
+
expressionAttributeNames: props.expressionAttributeNames,
|
|
218
|
+
expressionAttributeValues: props.expressionAttributeValues,
|
|
219
|
+
heartbeatTimeout: props.heartbeatTimeout,
|
|
221
220
|
inputPath: props.inputPath,
|
|
221
|
+
integrationPattern: props.integrationPattern,
|
|
222
|
+
item: tableItem,
|
|
222
223
|
outputPath: props.outputPath,
|
|
223
224
|
resultPath: props.resultPath,
|
|
224
225
|
resultSelector: props.resultSelector,
|
|
225
|
-
taskTimeout: props.taskTimeout,
|
|
226
|
-
heartbeatTimeout: props.heartbeatTimeout,
|
|
227
|
-
integrationPattern: props.integrationPattern,
|
|
228
|
-
conditionExpression: props.conditionExpression,
|
|
229
|
-
expressionAttributeNames: props.expressionAttributeNames,
|
|
230
|
-
expressionAttributeValues: props.expressionAttributeValues,
|
|
231
226
|
returnConsumedCapacity: props.returnConsumedCapacity,
|
|
232
227
|
returnItemCollectionMetrics: props.returnItemCollectionMetrics,
|
|
233
228
|
returnValues: props.returnValues,
|
|
234
|
-
|
|
229
|
+
table: table,
|
|
230
|
+
taskTimeout: props.taskTimeout,
|
|
235
231
|
},
|
|
236
232
|
});
|
|
237
233
|
let retries = props.retries;
|
|
@@ -246,10 +242,10 @@ class SfnManager {
|
|
|
246
242
|
}
|
|
247
243
|
/**
|
|
248
244
|
* @summary Method to create a DynamoDB delete item step
|
|
249
|
-
* @param
|
|
250
|
-
* @param
|
|
251
|
-
* @param
|
|
252
|
-
* @param
|
|
245
|
+
* @param id scoped id of the resource
|
|
246
|
+
* @param scope scope in which this resource is defined
|
|
247
|
+
* @param props
|
|
248
|
+
* @param table The table to put the item in
|
|
253
249
|
* @param tableKey The table key for query/scan
|
|
254
250
|
*/
|
|
255
251
|
createDynamoDbDeleteItemStep(id, scope, props, table, tableKey) {
|
|
@@ -258,22 +254,22 @@ class SfnManager {
|
|
|
258
254
|
const step = new tasks.DynamoDeleteItem(scope, `${props.name}`, {
|
|
259
255
|
...props,
|
|
260
256
|
...{
|
|
261
|
-
|
|
262
|
-
key: tableKey,
|
|
257
|
+
comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
263
258
|
conditionExpression: props.conditionExpression,
|
|
264
259
|
expressionAttributeNames: props.expressionAttributeNames,
|
|
265
260
|
expressionAttributeValues: props.expressionAttributeValues,
|
|
266
|
-
taskTimeout: props.taskTimeout,
|
|
267
261
|
heartbeatTimeout: props.heartbeatTimeout,
|
|
268
262
|
inputPath: props.inputPath,
|
|
263
|
+
integrationPattern: props.integrationPattern,
|
|
264
|
+
key: tableKey,
|
|
269
265
|
outputPath: props.outputPath,
|
|
270
266
|
resultPath: props.resultPath,
|
|
271
267
|
resultSelector: props.resultSelector,
|
|
272
|
-
integrationPattern: props.integrationPattern,
|
|
273
268
|
returnConsumedCapacity: props.returnConsumedCapacity,
|
|
274
269
|
returnItemCollectionMetrics: props.returnItemCollectionMetrics,
|
|
275
270
|
returnValues: props.returnValues,
|
|
276
|
-
|
|
271
|
+
table: table,
|
|
272
|
+
taskTimeout: props.taskTimeout,
|
|
277
273
|
},
|
|
278
274
|
});
|
|
279
275
|
let retries = props.retries;
|
|
@@ -288,10 +284,10 @@ class SfnManager {
|
|
|
288
284
|
}
|
|
289
285
|
/**
|
|
290
286
|
* @summary Method to send a message to SQS step
|
|
291
|
-
* @param
|
|
292
|
-
* @param
|
|
293
|
-
* @param
|
|
294
|
-
* @param
|
|
287
|
+
* @param id scoped id of the resource
|
|
288
|
+
* @param scope scope in which this resource is defined
|
|
289
|
+
* @param props
|
|
290
|
+
* @param queue The queue to send the message to
|
|
295
291
|
*/
|
|
296
292
|
createSendSqsMessageStep(id, scope, props, queue) {
|
|
297
293
|
if (!props)
|
|
@@ -301,19 +297,19 @@ class SfnManager {
|
|
|
301
297
|
const step = new tasks.SqsSendMessage(scope, `${props.name}`, {
|
|
302
298
|
...props,
|
|
303
299
|
...{
|
|
304
|
-
|
|
305
|
-
messageBody: props.messageBody,
|
|
306
|
-
messageGroupId: props.messageGroupId,
|
|
307
|
-
messageDeduplicationId: props.messageDeduplicationId,
|
|
300
|
+
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
308
301
|
delay: props.delay,
|
|
302
|
+
heartbeatTimeout: props.heartbeatTimeout,
|
|
309
303
|
inputPath: props.inputPath,
|
|
304
|
+
integrationPattern: props.integrationPattern,
|
|
305
|
+
messageBody: props.messageBody,
|
|
306
|
+
messageDeduplicationId: props.messageDeduplicationId,
|
|
307
|
+
messageGroupId: props.messageGroupId,
|
|
310
308
|
outputPath: props.outputPath,
|
|
309
|
+
queue: queue,
|
|
311
310
|
resultPath: props.resultPath,
|
|
312
311
|
resultSelector: props.resultSelector,
|
|
313
312
|
taskTimeout: props.taskTimeout,
|
|
314
|
-
heartbeatTimeout: props.heartbeatTimeout,
|
|
315
|
-
integrationPattern: props.integrationPattern,
|
|
316
|
-
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
317
313
|
},
|
|
318
314
|
});
|
|
319
315
|
let retries = props.retries;
|
|
@@ -328,10 +324,10 @@ class SfnManager {
|
|
|
328
324
|
}
|
|
329
325
|
/**
|
|
330
326
|
* @summary Method to create a lambda invoke step
|
|
331
|
-
* @param
|
|
332
|
-
* @param
|
|
333
|
-
* @param
|
|
334
|
-
* @param
|
|
327
|
+
* @param id scoped id of the resource
|
|
328
|
+
* @param scope scope in which this resource is defined
|
|
329
|
+
* @param props
|
|
330
|
+
* @param lambdaFunction
|
|
335
331
|
*/
|
|
336
332
|
createLambdaStep(id, scope, props, lambdaFunction) {
|
|
337
333
|
if (!props)
|
|
@@ -339,8 +335,8 @@ class SfnManager {
|
|
|
339
335
|
const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
|
|
340
336
|
...props,
|
|
341
337
|
...{
|
|
342
|
-
lambdaFunction,
|
|
343
338
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
339
|
+
lambdaFunction,
|
|
344
340
|
},
|
|
345
341
|
});
|
|
346
342
|
let retries = props.retries;
|
|
@@ -355,10 +351,10 @@ class SfnManager {
|
|
|
355
351
|
}
|
|
356
352
|
/**
|
|
357
353
|
* @summary Method to create a API Gateway invoke step
|
|
358
|
-
* @param
|
|
359
|
-
* @param
|
|
360
|
-
* @param
|
|
361
|
-
* @param
|
|
354
|
+
* @param id scoped id of the resource
|
|
355
|
+
* @param scope scope in which this resource is defined
|
|
356
|
+
* @param props
|
|
357
|
+
* @param api
|
|
362
358
|
*/
|
|
363
359
|
createApiStep(id, scope, props, api) {
|
|
364
360
|
if (!props)
|
|
@@ -367,8 +363,8 @@ class SfnManager {
|
|
|
367
363
|
...props,
|
|
368
364
|
...{
|
|
369
365
|
api,
|
|
370
|
-
stageName: scope.props.stage,
|
|
371
366
|
comment: `API step for ${props.name} - ${scope.props.stage} stage`,
|
|
367
|
+
stageName: scope.props.stage,
|
|
372
368
|
},
|
|
373
369
|
});
|
|
374
370
|
let retries = props.retries;
|
|
@@ -383,10 +379,10 @@ class SfnManager {
|
|
|
383
379
|
}
|
|
384
380
|
/**
|
|
385
381
|
* @summary Method to create a step function execution step
|
|
386
|
-
* @param
|
|
387
|
-
* @param
|
|
388
|
-
* @param
|
|
389
|
-
* @param
|
|
382
|
+
* @param id scoped id of the resource
|
|
383
|
+
* @param scope scope in which this resource is defined
|
|
384
|
+
* @param props props for the step
|
|
385
|
+
* @param stateMachine the state machine to execute
|
|
390
386
|
*/
|
|
391
387
|
createSfnExecutionStep(id, scope, props, stateMachine) {
|
|
392
388
|
const step = new tasks.StepFunctionsStartExecution(scope, `${id}`, {
|
|
@@ -408,37 +404,37 @@ class SfnManager {
|
|
|
408
404
|
}
|
|
409
405
|
/**
|
|
410
406
|
* @summary Method to create a step function map state
|
|
411
|
-
* @param
|
|
412
|
-
* @param
|
|
413
|
-
* @param
|
|
407
|
+
* @param id scoped id of the resource
|
|
408
|
+
* @param scope scope in which this resource is defined
|
|
409
|
+
* @param props props for the map state
|
|
414
410
|
*/
|
|
415
411
|
createMapState(id, scope, props) {
|
|
416
412
|
return new sfn.Map(scope, `${id}`, props);
|
|
417
413
|
}
|
|
418
414
|
/**
|
|
419
415
|
* @summary Method to create a state machine
|
|
420
|
-
* @param
|
|
421
|
-
* @param
|
|
422
|
-
* @param
|
|
423
|
-
* @param
|
|
424
|
-
* @param
|
|
425
|
-
* @param
|
|
416
|
+
* @param id scoped id of the resource
|
|
417
|
+
* @param scope scope in which this resource is defined
|
|
418
|
+
* @param props
|
|
419
|
+
* @param definition
|
|
420
|
+
* @param logGroup
|
|
421
|
+
* @param role
|
|
426
422
|
*/
|
|
427
423
|
createStateMachine(id, scope, props, definition, logGroup, role) {
|
|
428
424
|
if (!props)
|
|
429
425
|
throw `State Machine props undefined for ${id}`;
|
|
430
426
|
const stateMachine = new sfn.StateMachine(scope, `${id}`, {
|
|
431
|
-
stateMachineName: `${props.stateMachineName}-${scope.props.stage}`,
|
|
432
427
|
definition,
|
|
433
|
-
role,
|
|
434
|
-
stateMachineType: props.stateMachineType,
|
|
435
428
|
logs: {
|
|
436
429
|
destination: logGroup,
|
|
437
430
|
includeExecutionData: props.logs?.includeExecutionData ?? true,
|
|
438
431
|
level: props.logs?.level ?? sfn.LogLevel.ALL,
|
|
439
432
|
},
|
|
440
|
-
|
|
433
|
+
role,
|
|
434
|
+
stateMachineName: `${props.stateMachineName}-${scope.props.stage}`,
|
|
435
|
+
stateMachineType: props.stateMachineType,
|
|
441
436
|
timeout: props.timeout,
|
|
437
|
+
tracingEnabled: props.tracingEnabled,
|
|
442
438
|
});
|
|
443
439
|
utils.createCfnOutput(`${id}-stateMachineName`, scope, stateMachine.stateMachineName);
|
|
444
440
|
utils.createCfnOutput(`${id}-stateMachineArn`, scope, stateMachine.stateMachineArn);
|
|
@@ -1,119 +1,87 @@
|
|
|
1
1
|
import { ChoiceProps, FailProps, MapProps, ParallelProps, PassProps, RetryProps, StateMachineProps, SucceedProps, WaitProps } from 'aws-cdk-lib/aws-stepfunctions';
|
|
2
2
|
import { CallApiGatewayRestApiEndpointProps, DynamoDeleteItemProps, DynamoGetItemProps, DynamoPutItemProps, LambdaInvokeProps, SqsSendMessageProps, StepFunctionsStartExecutionProps } from 'aws-cdk-lib/aws-stepfunctions-tasks';
|
|
3
3
|
/**
|
|
4
|
-
* @category cdk-utils.step-functions-manager
|
|
5
|
-
* @subcategory Properties
|
|
6
4
|
*/
|
|
7
5
|
export interface SfnSucceedProps extends SucceedProps {
|
|
8
6
|
name: string;
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
11
|
-
* @category cdk-utils.step-functions-manager
|
|
12
|
-
* @subcategory Properties
|
|
13
9
|
*/
|
|
14
10
|
export interface SfnRetryProps extends RetryProps {
|
|
15
11
|
intervalInSecs: number;
|
|
16
12
|
}
|
|
17
13
|
/**
|
|
18
|
-
* @category cdk-utils.step-functions-manager
|
|
19
|
-
* @subcategory Properties
|
|
20
14
|
*/
|
|
21
15
|
export interface SfnFailProps extends FailProps {
|
|
22
16
|
name: string;
|
|
23
17
|
}
|
|
24
18
|
/**
|
|
25
|
-
* @category cdk-utils.step-functions-manager
|
|
26
|
-
* @subcategory Properties
|
|
27
19
|
*/
|
|
28
20
|
export interface SfnPassProps extends PassProps {
|
|
29
21
|
name: string;
|
|
30
22
|
}
|
|
31
23
|
/**
|
|
32
|
-
* @category cdk-utils.step-functions-manager
|
|
33
|
-
* @subcategory Properties
|
|
34
24
|
*/
|
|
35
25
|
export interface SfnDynamoGetItemProps extends DynamoGetItemProps {
|
|
36
26
|
name: string;
|
|
37
27
|
retries?: SfnRetryProps[];
|
|
38
28
|
}
|
|
39
29
|
/**
|
|
40
|
-
* @category cdk-utils.step-functions-manager
|
|
41
|
-
* @subcategory Properties
|
|
42
30
|
*/
|
|
43
31
|
export interface SfnDynamoPutItemProps extends DynamoPutItemProps {
|
|
44
32
|
name: string;
|
|
45
33
|
retries?: SfnRetryProps[];
|
|
46
34
|
}
|
|
47
35
|
/**
|
|
48
|
-
* @category cdk-utils.step-functions-manager
|
|
49
|
-
* @subcategory Properties
|
|
50
36
|
*/
|
|
51
37
|
export interface SfnDynamoDeleteItemProps extends DynamoDeleteItemProps {
|
|
52
38
|
name: string;
|
|
53
39
|
retries?: SfnRetryProps[];
|
|
54
40
|
}
|
|
55
41
|
/**
|
|
56
|
-
* @category cdk-utils.step-functions-manager
|
|
57
|
-
* @subcategory Properties
|
|
58
42
|
*/
|
|
59
43
|
export interface SfnSqsSendMessageProps extends SqsSendMessageProps {
|
|
60
44
|
name: string;
|
|
61
45
|
retries?: SfnRetryProps[];
|
|
62
46
|
}
|
|
63
47
|
/**
|
|
64
|
-
* @category cdk-utils.step-functions-manager
|
|
65
|
-
* @subcategory Properties
|
|
66
48
|
*/
|
|
67
49
|
export interface SfnParallelProps extends ParallelProps {
|
|
68
50
|
name: string;
|
|
69
51
|
retries?: SfnRetryProps[];
|
|
70
52
|
}
|
|
71
53
|
/**
|
|
72
|
-
* @category cdk-utils.step-functions-manager
|
|
73
|
-
* @subcategory Properties
|
|
74
54
|
*/
|
|
75
55
|
export interface SfnChoiceProps extends ChoiceProps {
|
|
76
56
|
name: string;
|
|
77
57
|
}
|
|
78
58
|
/**
|
|
79
|
-
* @category cdk-utils.step-functions-manager
|
|
80
|
-
* @subcategory Properties
|
|
81
59
|
*/
|
|
82
60
|
export interface SfnWaitProps extends WaitProps {
|
|
83
61
|
name: string;
|
|
84
62
|
delayInSeconds: number;
|
|
85
63
|
}
|
|
86
64
|
/**
|
|
87
|
-
* @category cdk-utils.step-functions-manager
|
|
88
|
-
* @subcategory Properties
|
|
89
65
|
*/
|
|
90
66
|
export interface SfnLambdaInvokeProps extends LambdaInvokeProps {
|
|
91
67
|
name: string;
|
|
92
68
|
retries?: SfnRetryProps[];
|
|
93
69
|
}
|
|
94
70
|
/**
|
|
95
|
-
* @category cdk-utils.step-functions-manager
|
|
96
|
-
* @subcategory Properties
|
|
97
71
|
*/
|
|
98
72
|
export interface SfnCallApiGatewayRestApiEndpointProps extends CallApiGatewayRestApiEndpointProps {
|
|
99
73
|
name: string;
|
|
100
74
|
retries?: SfnRetryProps[];
|
|
101
75
|
}
|
|
102
76
|
/**
|
|
103
|
-
* @category cdk-utils.step-functions-manager
|
|
104
|
-
* @subcategory Properties
|
|
105
77
|
*/
|
|
106
78
|
export interface SfnStateMachineProps extends StateMachineProps {
|
|
107
79
|
}
|
|
108
80
|
/**
|
|
109
|
-
* @category cdk-utils.sfn-manager
|
|
110
|
-
* @subcategory Properties
|
|
111
81
|
*/
|
|
112
82
|
export interface SfnMapProps extends MapProps {
|
|
113
83
|
}
|
|
114
84
|
/**
|
|
115
|
-
* @category cdk-utils.sfn-manager
|
|
116
|
-
* @subcategory Properties
|
|
117
85
|
*/
|
|
118
86
|
export interface SfnStartExecutionProps extends StepFunctionsStartExecutionProps {
|
|
119
87
|
retries?: SfnRetryProps[];
|
|
@@ -3,9 +3,6 @@ import * as cr from 'aws-cdk-lib/custom-resources';
|
|
|
3
3
|
import { CommonConstruct } from '../../../common';
|
|
4
4
|
import { SSMParameterReaderProps } from './types';
|
|
5
5
|
/**
|
|
6
|
-
* @stability stable
|
|
7
|
-
* @category cdk-utils.ssm-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS Systems Manager.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,37 +16,34 @@ import { SSMParameterReaderProps } from './types';
|
|
|
19
16
|
* this.acmManager.writeStringToParameters('MyParameter', this, ...props)
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK Systems Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export declare class SsmManager {
|
|
26
22
|
static SECRETS_MODIFIED_TIMESTAMP_PARAM: string;
|
|
27
23
|
/**
|
|
28
24
|
* Method to write a string parameter to the parameters store
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props parameter props
|
|
32
28
|
*/
|
|
33
29
|
writeStringToParameters(id: string, scope: CommonConstruct, props: ssm.StringParameterProps): ssm.StringParameter;
|
|
34
30
|
/**
|
|
35
31
|
* Method to read a string parameter from the parameters store
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
32
|
+
* @param id scoped id of the resource
|
|
33
|
+
* @param scope scope in which this resource is defined
|
|
34
|
+
* @param parameterName parameter name to lookup
|
|
39
35
|
*/
|
|
40
36
|
readStringParameter(id: string, scope: CommonConstruct, parameterName: string): string;
|
|
41
37
|
/**
|
|
42
38
|
* Method to read a string parameter from the parameters store in a given region
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
39
|
+
* @param id scoped id of the resource
|
|
40
|
+
* @param scope scope in which this resource is defined
|
|
41
|
+
* @param parameterName parameter name to lookup
|
|
42
|
+
* @param region region name to lookup parameter
|
|
47
43
|
*/
|
|
48
44
|
readStringParameterFromRegion(id: string, scope: CommonConstruct, parameterName: string, region: string): string;
|
|
49
45
|
}
|
|
50
46
|
/**
|
|
51
|
-
* @category cdk-utils.ssm-manager
|
|
52
|
-
* @subcategory Construct
|
|
53
47
|
* @classdesc Provides utilities to read same/cross region SSM parameters
|
|
54
48
|
*/
|
|
55
49
|
export declare class SSMParameterReader extends cr.AwsCustomResource {
|
|
@@ -28,9 +28,6 @@ const ssm = __importStar(require("aws-cdk-lib/aws-ssm"));
|
|
|
28
28
|
const cr = __importStar(require("aws-cdk-lib/custom-resources"));
|
|
29
29
|
const utils = __importStar(require("../../../utils"));
|
|
30
30
|
/**
|
|
31
|
-
* @stability stable
|
|
32
|
-
* @category cdk-utils.ssm-manager
|
|
33
|
-
* @subcategory Construct
|
|
34
31
|
* @classdesc Provides operations on AWS Systems Manager.
|
|
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,23 +41,22 @@ const utils = __importStar(require("../../../utils"));
|
|
|
44
41
|
* this.acmManager.writeStringToParameters('MyParameter', this, ...props)
|
|
45
42
|
* }
|
|
46
43
|
* }
|
|
47
|
-
*
|
|
48
44
|
* @see [CDK Systems Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm-readme.html}
|
|
49
45
|
*/
|
|
50
46
|
class SsmManager {
|
|
51
47
|
static SECRETS_MODIFIED_TIMESTAMP_PARAM = 'secrets-last-modified-timestamp';
|
|
52
48
|
/**
|
|
53
49
|
* Method to write a string parameter to the parameters store
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
50
|
+
* @param id scoped id of the resource
|
|
51
|
+
* @param scope scope in which this resource is defined
|
|
52
|
+
* @param props parameter props
|
|
57
53
|
*/
|
|
58
54
|
writeStringToParameters(id, scope, props) {
|
|
59
55
|
if (!props)
|
|
60
56
|
throw `Parameter props undefined for ${id}`;
|
|
61
57
|
const parameter = new ssm.StringParameter(scope, `${id}`, {
|
|
62
|
-
parameterName: `${props.parameterName}-${scope.props.stage}`,
|
|
63
58
|
description: `${props.description} - ${scope.props.stage} stage`,
|
|
59
|
+
parameterName: `${props.parameterName}-${scope.props.stage}`,
|
|
64
60
|
stringValue: props.stringValue,
|
|
65
61
|
});
|
|
66
62
|
utils.createCfnOutput(`${id}-parameterArn`, scope, parameter.parameterArn);
|
|
@@ -69,9 +65,9 @@ class SsmManager {
|
|
|
69
65
|
}
|
|
70
66
|
/**
|
|
71
67
|
* Method to read a string parameter from the parameters store
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
68
|
+
* @param id scoped id of the resource
|
|
69
|
+
* @param scope scope in which this resource is defined
|
|
70
|
+
* @param parameterName parameter name to lookup
|
|
75
71
|
*/
|
|
76
72
|
readStringParameter(id, scope, parameterName) {
|
|
77
73
|
if (!parameterName || parameterName == '')
|
|
@@ -80,10 +76,10 @@ class SsmManager {
|
|
|
80
76
|
}
|
|
81
77
|
/**
|
|
82
78
|
* Method to read a string parameter from the parameters store in a given region
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
79
|
+
* @param id scoped id of the resource
|
|
80
|
+
* @param scope scope in which this resource is defined
|
|
81
|
+
* @param parameterName parameter name to lookup
|
|
82
|
+
* @param region region name to lookup parameter
|
|
87
83
|
*/
|
|
88
84
|
readStringParameterFromRegion(id, scope, parameterName, region) {
|
|
89
85
|
if (!parameterName || parameterName == '')
|
|
@@ -98,21 +94,19 @@ class SsmManager {
|
|
|
98
94
|
}
|
|
99
95
|
exports.SsmManager = SsmManager;
|
|
100
96
|
/**
|
|
101
|
-
* @category cdk-utils.ssm-manager
|
|
102
|
-
* @subcategory Construct
|
|
103
97
|
* @classdesc Provides utilities to read same/cross region SSM parameters
|
|
104
98
|
*/
|
|
105
99
|
class SSMParameterReader extends cr.AwsCustomResource {
|
|
106
100
|
constructor(scope, name, props) {
|
|
107
101
|
const { parameterName, region } = props;
|
|
108
102
|
const ssmAwsSdkCall = {
|
|
109
|
-
service: 'SSM',
|
|
110
103
|
action: 'getParameter',
|
|
111
104
|
parameters: {
|
|
112
105
|
Name: `${parameterName}-${scope.props.stage}`,
|
|
113
106
|
},
|
|
114
|
-
region,
|
|
115
107
|
physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
|
|
108
|
+
region,
|
|
109
|
+
service: 'SSM',
|
|
116
110
|
};
|
|
117
111
|
super(scope, name, {
|
|
118
112
|
onUpdate: ssmAwsSdkCall,
|