@gradientedge/cdk-utils 8.117.0 → 8.119.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/app/api-destined-function/package.json +1 -1
- package/dist/src/lib/common/construct.d.ts +32 -32
- package/dist/src/lib/common/construct.js +36 -59
- package/dist/src/lib/common/stack.d.ts +8 -7
- package/dist/src/lib/common/stack.js +17 -37
- package/dist/src/lib/common/types.d.ts +2 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +22 -22
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +37 -60
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +40 -63
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +23 -23
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +2 -2
- package/dist/src/lib/construct/api-to-lambda-target/main.js +15 -38
- package/dist/src/lib/construct/application-configuration/main.d.ts +7 -7
- package/dist/src/lib/construct/application-configuration/main.js +17 -41
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +17 -17
- package/dist/src/lib/construct/graphql-api-lambda/main.js +6 -29
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +7 -7
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +16 -16
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +8 -31
- package/dist/src/lib/construct/lambda-with-iam-access/types.d.ts +4 -4
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +16 -16
- package/dist/src/lib/construct/rest-api-lambda/main.js +5 -28
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +9 -32
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +38 -39
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +33 -54
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +4 -4
- package/dist/src/lib/construct/static-asset-deployment/main.js +3 -26
- package/dist/src/lib/construct/static-site/main.d.ts +15 -15
- package/dist/src/lib/construct/static-site/main.js +4 -27
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +10 -10
- package/dist/src/lib/services/aws/api-gateway/main.js +21 -44
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +2 -2
- package/dist/src/lib/services/aws/appconfig/main.d.ts +7 -7
- package/dist/src/lib/services/aws/appconfig/main.js +14 -37
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -5
- package/dist/src/lib/services/aws/certificate-manager/main.js +10 -33
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +2 -2
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +18 -18
- package/dist/src/lib/services/aws/cloudfront/main.js +46 -45
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +2 -3
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +5 -5
- package/dist/src/lib/services/aws/cloudtrail/main.js +5 -28
- package/dist/src/lib/services/aws/codebuild/main.d.ts +3 -3
- package/dist/src/lib/services/aws/codebuild/main.js +7 -30
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -3
- package/dist/src/lib/services/aws/dynamodb/main.js +8 -31
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +2 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +4 -27
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +10 -10
- package/dist/src/lib/services/aws/elastic-container-service/main.js +27 -50
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +4 -4
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +3 -3
- package/dist/src/lib/services/aws/elastic-file-system/main.js +12 -35
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +4 -4
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -31
- package/dist/src/lib/services/aws/elasticache/main.d.ts +4 -4
- package/dist/src/lib/services/aws/elasticache/main.js +10 -33
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +13 -13
- package/dist/src/lib/services/aws/eventbridge/main.js +26 -49
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +10 -10
- package/dist/src/lib/services/aws/eventbridge/target.js +6 -29
- package/dist/src/lib/services/aws/evidently/main.d.ts +7 -7
- package/dist/src/lib/services/aws/evidently/main.js +18 -41
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +48 -49
- package/dist/src/lib/services/aws/identity-access-management/main.js +110 -133
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +2 -2
- package/dist/src/lib/services/aws/key-management-service/main.js +5 -28
- package/dist/src/lib/services/aws/lambda/main.d.ts +11 -13
- package/dist/src/lib/services/aws/lambda/main.js +31 -58
- package/dist/src/lib/services/aws/route53/main.d.ts +9 -9
- package/dist/src/lib/services/aws/route53/main.js +21 -44
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +5 -6
- package/dist/src/lib/services/aws/secrets-manager/main.js +10 -33
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +4 -4
- package/dist/src/lib/services/aws/simple-notification-service/main.js +11 -34
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +6 -7
- package/dist/src/lib/services/aws/simple-queue-service/main.js +15 -38
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +10 -11
- package/dist/src/lib/services/aws/simple-storage-service/main.js +31 -54
- package/dist/src/lib/services/aws/step-function/main.d.ts +31 -32
- package/dist/src/lib/services/aws/step-function/main.js +33 -57
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +4 -4
- package/dist/src/lib/services/aws/systems-manager/main.js +10 -33
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +5 -6
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +14 -37
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +3 -3
- package/dist/src/lib/services/aws/web-application-firewall/main.js +8 -31
- package/dist/src/lib/utils/aws/index.d.ts +6 -3
- package/dist/src/lib/utils/aws/index.js +9 -26
- package/package.json +21 -21
- package/src/lib/common/construct.ts +97 -67
- package/src/lib/common/stack.ts +12 -12
- package/src/lib/common/types.ts +2 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +31 -22
- package/src/lib/construct/api-to-eventbridge-target/event.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target/main.ts +56 -41
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +62 -47
- package/src/lib/construct/api-to-lambda-target/api.ts +33 -23
- package/src/lib/construct/api-to-lambda-target/main.ts +24 -18
- package/src/lib/construct/application-configuration/main.ts +31 -24
- package/src/lib/construct/graphql-api-lambda/main.ts +22 -22
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +13 -13
- package/src/lib/construct/lambda-with-iam-access/main.ts +25 -25
- package/src/lib/construct/lambda-with-iam-access/types.ts +4 -4
- package/src/lib/construct/rest-api-lambda/main.ts +21 -21
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +14 -14
- package/src/lib/construct/site-with-ecs-backend/main.ts +79 -60
- package/src/lib/construct/static-asset-deployment/main.ts +6 -6
- package/src/lib/construct/static-site/main.ts +23 -17
- package/src/lib/services/aws/api-gateway/main.ts +42 -36
- package/src/lib/services/aws/api-gateway/types.ts +2 -2
- package/src/lib/services/aws/appconfig/main.ts +19 -19
- package/src/lib/services/aws/certificate-manager/main.ts +14 -14
- package/src/lib/services/aws/certificate-manager/types.ts +2 -2
- package/src/lib/services/aws/cloudfront/main.ts +88 -74
- package/src/lib/services/aws/cloudfront/types.ts +6 -3
- package/src/lib/services/aws/cloudtrail/main.ts +11 -11
- package/src/lib/services/aws/codebuild/main.ts +7 -7
- package/src/lib/services/aws/dynamodb/main.ts +8 -8
- package/src/lib/services/aws/elastic-container-registry/main.ts +4 -4
- package/src/lib/services/aws/elastic-container-service/main.ts +48 -37
- package/src/lib/services/aws/elastic-container-service/types.ts +4 -4
- package/src/lib/services/aws/elastic-file-system/main.ts +16 -16
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +11 -11
- package/src/lib/services/aws/elasticache/main.ts +10 -10
- package/src/lib/services/aws/eventbridge/main.ts +37 -37
- package/src/lib/services/aws/eventbridge/target.ts +14 -14
- package/src/lib/services/aws/evidently/main.ts +18 -18
- package/src/lib/services/aws/identity-access-management/main.ts +142 -134
- package/src/lib/services/aws/key-management-service/main.ts +5 -5
- package/src/lib/services/aws/lambda/main.ts +65 -59
- package/src/lib/services/aws/route53/main.ts +31 -31
- package/src/lib/services/aws/secrets-manager/main.ts +11 -15
- package/src/lib/services/aws/simple-notification-service/main.ts +13 -13
- package/src/lib/services/aws/simple-queue-service/main.ts +18 -18
- package/src/lib/services/aws/simple-storage-service/main.ts +40 -40
- package/src/lib/services/aws/step-function/main.ts +77 -65
- package/src/lib/services/aws/systems-manager/main.ts +17 -12
- package/src/lib/services/aws/virtual-private-cloud/main.ts +16 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +8 -8
- package/src/lib/utils/aws/index.ts +8 -5
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.SfnManager = void 0;
|
|
27
|
-
const
|
|
28
|
-
const sfn = __importStar(require("aws-cdk-lib/aws-stepfunctions"));
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
29
5
|
const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions");
|
|
30
|
-
const
|
|
31
|
-
const utils = __importStar(require("../../../utils"));
|
|
6
|
+
const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks");
|
|
32
7
|
const uuid_1 = require("uuid");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
33
9
|
const DEFAULT_RETRY_CONFIG = [
|
|
34
10
|
{
|
|
35
11
|
backoffRate: 2,
|
|
@@ -46,7 +22,7 @@ const DEFAULT_RETRY_CONFIG = [
|
|
|
46
22
|
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
47
23
|
*
|
|
48
24
|
* class CustomConstruct extends CommonConstruct {
|
|
49
|
-
* constructor(parent:
|
|
25
|
+
* constructor(parent: Construct, id: string, props: common.CommonStackProps) {
|
|
50
26
|
* super(parent, id, props)
|
|
51
27
|
* this.props = props
|
|
52
28
|
* this.sfnManager.createSuccessStep('MyStep', this, myStepProps)
|
|
@@ -64,7 +40,7 @@ class SfnManager {
|
|
|
64
40
|
createSuccessStep(id, scope, props) {
|
|
65
41
|
if (!props)
|
|
66
42
|
throw `Step props undefined for ${id}`;
|
|
67
|
-
return new
|
|
43
|
+
return new aws_stepfunctions_1.Succeed(scope, `${props.name}`, {
|
|
68
44
|
...props,
|
|
69
45
|
...{
|
|
70
46
|
comment: `Succeed step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -80,7 +56,7 @@ class SfnManager {
|
|
|
80
56
|
createFailStep(id, scope, props) {
|
|
81
57
|
if (!props)
|
|
82
58
|
throw `Step props undefined for ${id}`;
|
|
83
|
-
return new
|
|
59
|
+
return new aws_stepfunctions_1.Fail(scope, `${props.name}`, {
|
|
84
60
|
...props,
|
|
85
61
|
...{
|
|
86
62
|
comment: `Fail step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -96,7 +72,7 @@ class SfnManager {
|
|
|
96
72
|
createPassStep(id, scope, props) {
|
|
97
73
|
if (!props)
|
|
98
74
|
throw `Step props undefined for ${id}`;
|
|
99
|
-
return new
|
|
75
|
+
return new aws_stepfunctions_1.Pass(scope, `${props.name}`, {
|
|
100
76
|
...props,
|
|
101
77
|
...{
|
|
102
78
|
comment: `Pass step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -112,7 +88,7 @@ class SfnManager {
|
|
|
112
88
|
createParallelStep(id, scope, props) {
|
|
113
89
|
if (!props)
|
|
114
90
|
throw `Step props undefined for ${id}`;
|
|
115
|
-
return new
|
|
91
|
+
return new aws_stepfunctions_1.Parallel(scope, `${props.name}`, {
|
|
116
92
|
...props,
|
|
117
93
|
...{
|
|
118
94
|
comment: `Parallel step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -128,7 +104,7 @@ class SfnManager {
|
|
|
128
104
|
createChoiceStep(id, scope, props) {
|
|
129
105
|
if (!props)
|
|
130
106
|
throw `Step props undefined for ${id}`;
|
|
131
|
-
return new
|
|
107
|
+
return new aws_stepfunctions_1.Choice(scope, `${props.name}`, {
|
|
132
108
|
...props,
|
|
133
109
|
...{
|
|
134
110
|
comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -142,11 +118,11 @@ class SfnManager {
|
|
|
142
118
|
* @param props
|
|
143
119
|
*/
|
|
144
120
|
createWaitStep(id, scope, props) {
|
|
145
|
-
return new
|
|
121
|
+
return new aws_stepfunctions_1.Wait(scope, `${props.name}`, {
|
|
146
122
|
...props,
|
|
147
123
|
...{
|
|
148
124
|
comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
|
|
149
|
-
time:
|
|
125
|
+
time: aws_stepfunctions_1.WaitTime.duration(aws_cdk_lib_1.Duration.seconds(props.delayInSeconds)),
|
|
150
126
|
},
|
|
151
127
|
});
|
|
152
128
|
}
|
|
@@ -161,7 +137,7 @@ class SfnManager {
|
|
|
161
137
|
createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
|
|
162
138
|
if (!props)
|
|
163
139
|
throw `Step props undefined for ${id}`;
|
|
164
|
-
const step = new
|
|
140
|
+
const step = new aws_stepfunctions_tasks_1.DynamoGetItem(scope, `${props.name}`, {
|
|
165
141
|
...props,
|
|
166
142
|
...{
|
|
167
143
|
comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -186,7 +162,7 @@ class SfnManager {
|
|
|
186
162
|
}
|
|
187
163
|
retries.forEach(retry => step.addRetry({
|
|
188
164
|
...retry,
|
|
189
|
-
...{ interval: retry.intervalInSecs ?
|
|
165
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
190
166
|
}));
|
|
191
167
|
return step;
|
|
192
168
|
}
|
|
@@ -201,7 +177,7 @@ class SfnManager {
|
|
|
201
177
|
createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
|
|
202
178
|
if (!props)
|
|
203
179
|
throw `Step props undefined for ${id}`;
|
|
204
|
-
const step = new
|
|
180
|
+
const step = new aws_stepfunctions_tasks_1.DynamoPutItem(scope, `${props.name}`, {
|
|
205
181
|
...props,
|
|
206
182
|
...{
|
|
207
183
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -228,7 +204,7 @@ class SfnManager {
|
|
|
228
204
|
}
|
|
229
205
|
retries.forEach(retry => step.addRetry({
|
|
230
206
|
...retry,
|
|
231
|
-
...{ interval: retry.intervalInSecs ?
|
|
207
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
232
208
|
}));
|
|
233
209
|
return step;
|
|
234
210
|
}
|
|
@@ -243,7 +219,7 @@ class SfnManager {
|
|
|
243
219
|
createDynamoDbDeleteItemStep(id, scope, props, table, tableKey) {
|
|
244
220
|
if (!props)
|
|
245
221
|
throw `Step props undefined for ${id}`;
|
|
246
|
-
const step = new
|
|
222
|
+
const step = new aws_stepfunctions_tasks_1.DynamoDeleteItem(scope, `${props.name}`, {
|
|
247
223
|
...props,
|
|
248
224
|
...{
|
|
249
225
|
comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -270,7 +246,7 @@ class SfnManager {
|
|
|
270
246
|
}
|
|
271
247
|
retries.forEach(retry => step.addRetry({
|
|
272
248
|
...retry,
|
|
273
|
-
...{ interval: retry.intervalInSecs ?
|
|
249
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
274
250
|
}));
|
|
275
251
|
return step;
|
|
276
252
|
}
|
|
@@ -286,7 +262,7 @@ class SfnManager {
|
|
|
286
262
|
throw `Step props undefined for ${id}`;
|
|
287
263
|
if (!props.messageBody)
|
|
288
264
|
throw 'Message body undefined';
|
|
289
|
-
const step = new
|
|
265
|
+
const step = new aws_stepfunctions_tasks_1.SqsSendMessage(scope, `${props.name}`, {
|
|
290
266
|
...props,
|
|
291
267
|
...{
|
|
292
268
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -310,7 +286,7 @@ class SfnManager {
|
|
|
310
286
|
}
|
|
311
287
|
retries.forEach(retry => step.addRetry({
|
|
312
288
|
...retry,
|
|
313
|
-
...{ interval: retry.intervalInSecs ?
|
|
289
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
314
290
|
}));
|
|
315
291
|
return step;
|
|
316
292
|
}
|
|
@@ -324,7 +300,7 @@ class SfnManager {
|
|
|
324
300
|
createLambdaStep(id, scope, props, lambdaFunction) {
|
|
325
301
|
if (!props)
|
|
326
302
|
throw `Step props undefined for ${id}`;
|
|
327
|
-
const step = new
|
|
303
|
+
const step = new aws_stepfunctions_tasks_1.LambdaInvoke(scope, `${props.name}`, {
|
|
328
304
|
...props,
|
|
329
305
|
...{
|
|
330
306
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -337,7 +313,7 @@ class SfnManager {
|
|
|
337
313
|
}
|
|
338
314
|
retries.forEach(retry => step.addRetry({
|
|
339
315
|
...retry,
|
|
340
|
-
...{ interval: retry.intervalInSecs ?
|
|
316
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
341
317
|
}));
|
|
342
318
|
return step;
|
|
343
319
|
}
|
|
@@ -353,8 +329,8 @@ class SfnManager {
|
|
|
353
329
|
if (!props)
|
|
354
330
|
throw `Step props undefined for ${id}`;
|
|
355
331
|
if (skipExecution)
|
|
356
|
-
return this.createPassStep(id, scope, {
|
|
357
|
-
const step = new
|
|
332
|
+
return this.createPassStep(id, scope, { comment: props.comment, name: props.name });
|
|
333
|
+
const step = new aws_stepfunctions_tasks_1.LambdaInvoke(scope, `${props.name}`, {
|
|
358
334
|
...props,
|
|
359
335
|
...{
|
|
360
336
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -367,7 +343,7 @@ class SfnManager {
|
|
|
367
343
|
}
|
|
368
344
|
retries.forEach(retry => step.addRetry({
|
|
369
345
|
...retry,
|
|
370
|
-
...{ interval: retry.intervalInSecs ?
|
|
346
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
371
347
|
}));
|
|
372
348
|
return step;
|
|
373
349
|
}
|
|
@@ -381,7 +357,7 @@ class SfnManager {
|
|
|
381
357
|
createApiStep(id, scope, props, api) {
|
|
382
358
|
if (!props)
|
|
383
359
|
throw `Step props undefined for ${id}`;
|
|
384
|
-
const step = new
|
|
360
|
+
const step = new aws_stepfunctions_tasks_1.CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
|
|
385
361
|
...props,
|
|
386
362
|
...{
|
|
387
363
|
api,
|
|
@@ -395,7 +371,7 @@ class SfnManager {
|
|
|
395
371
|
}
|
|
396
372
|
retries.forEach(retry => step.addRetry({
|
|
397
373
|
...retry,
|
|
398
|
-
...{ interval: retry.intervalInSecs ?
|
|
374
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
399
375
|
}));
|
|
400
376
|
return step;
|
|
401
377
|
}
|
|
@@ -407,7 +383,7 @@ class SfnManager {
|
|
|
407
383
|
* @param stateMachine the state machine to execute
|
|
408
384
|
*/
|
|
409
385
|
createSfnExecutionStep(id, scope, props, stateMachine) {
|
|
410
|
-
const step = new
|
|
386
|
+
const step = new aws_stepfunctions_tasks_1.StepFunctionsStartExecution(scope, `${id}`, {
|
|
411
387
|
...props,
|
|
412
388
|
associateWithParent: props.associateWithParent ?? true,
|
|
413
389
|
inputPath: props.inputPath,
|
|
@@ -420,7 +396,7 @@ class SfnManager {
|
|
|
420
396
|
}
|
|
421
397
|
retries.forEach(retry => step.addRetry({
|
|
422
398
|
...retry,
|
|
423
|
-
...{ interval: retry.intervalInSecs ?
|
|
399
|
+
...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
424
400
|
}));
|
|
425
401
|
return step;
|
|
426
402
|
}
|
|
@@ -431,7 +407,7 @@ class SfnManager {
|
|
|
431
407
|
* @param props props for the map state
|
|
432
408
|
*/
|
|
433
409
|
createMapState(id, scope, props) {
|
|
434
|
-
return new
|
|
410
|
+
return new aws_stepfunctions_1.Map(scope, `${id}`, props);
|
|
435
411
|
}
|
|
436
412
|
/**
|
|
437
413
|
* @summary Method to create a state machine
|
|
@@ -445,12 +421,12 @@ class SfnManager {
|
|
|
445
421
|
createStateMachine(id, scope, props, definition, logGroup, role) {
|
|
446
422
|
if (!props)
|
|
447
423
|
throw `State Machine props undefined for ${id}`;
|
|
448
|
-
const stateMachine = new
|
|
424
|
+
const stateMachine = new aws_stepfunctions_1.StateMachine(scope, `${id}`, {
|
|
449
425
|
definitionBody: aws_stepfunctions_1.DefinitionBody.fromChainable(definition),
|
|
450
426
|
logs: {
|
|
451
427
|
destination: logGroup,
|
|
452
428
|
includeExecutionData: props.logs?.includeExecutionData ?? true,
|
|
453
|
-
level: props.logs?.level ??
|
|
429
|
+
level: props.logs?.level ?? aws_stepfunctions_1.LogLevel.ALL,
|
|
454
430
|
},
|
|
455
431
|
role,
|
|
456
432
|
stateMachineName: `${props.stateMachineName}-${scope.props.stage}`,
|
|
@@ -458,8 +434,8 @@ class SfnManager {
|
|
|
458
434
|
timeout: props.timeout,
|
|
459
435
|
tracingEnabled: props.tracingEnabled,
|
|
460
436
|
});
|
|
461
|
-
|
|
462
|
-
|
|
437
|
+
(0, utils_1.createCfnOutput)(`${id}-stateMachineName`, scope, stateMachine.stateMachineName);
|
|
438
|
+
(0, utils_1.createCfnOutput)(`${id}-stateMachineArn`, scope, stateMachine.stateMachineArn);
|
|
463
439
|
return stateMachine;
|
|
464
440
|
}
|
|
465
441
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { StringParameter, StringParameterProps } from 'aws-cdk-lib/aws-ssm';
|
|
2
|
+
import { AwsCustomResource } from 'aws-cdk-lib/custom-resources';
|
|
3
3
|
import { CommonConstruct } from '../../../common';
|
|
4
4
|
import { SSMParameterReaderProps } from './types';
|
|
5
5
|
/**
|
|
@@ -26,7 +26,7 @@ export declare class SsmManager {
|
|
|
26
26
|
* @param scope scope in which this resource is defined
|
|
27
27
|
* @param props parameter props
|
|
28
28
|
*/
|
|
29
|
-
writeStringToParameters(id: string, scope: CommonConstruct, props:
|
|
29
|
+
writeStringToParameters(id: string, scope: CommonConstruct, props: StringParameterProps): StringParameter;
|
|
30
30
|
/**
|
|
31
31
|
* Method to read a string parameter from the parameters store
|
|
32
32
|
* @param id scoped id of the resource
|
|
@@ -46,7 +46,7 @@ export declare class SsmManager {
|
|
|
46
46
|
/**
|
|
47
47
|
* @classdesc Provides utilities to read same/cross region SSM parameters
|
|
48
48
|
*/
|
|
49
|
-
export declare class SSMParameterReader extends
|
|
49
|
+
export declare class SSMParameterReader extends AwsCustomResource {
|
|
50
50
|
constructor(scope: CommonConstruct, name: string, props: SSMParameterReaderProps);
|
|
51
51
|
/**
|
|
52
52
|
*
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.SSMParameterReader = exports.SsmManager = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
4
|
+
const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
|
|
5
|
+
const custom_resources_1 = require("aws-cdk-lib/custom-resources");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
30
7
|
/**
|
|
31
8
|
* @classdesc Provides operations on AWS Systems Manager.
|
|
32
9
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
@@ -54,13 +31,13 @@ class SsmManager {
|
|
|
54
31
|
writeStringToParameters(id, scope, props) {
|
|
55
32
|
if (!props)
|
|
56
33
|
throw `Parameter props undefined for ${id}`;
|
|
57
|
-
const parameter = new
|
|
34
|
+
const parameter = new aws_ssm_1.StringParameter(scope, `${id}`, {
|
|
58
35
|
description: `${props.description} - ${scope.props.stage} stage`,
|
|
59
36
|
parameterName: `${props.parameterName}-${scope.props.stage}`,
|
|
60
37
|
stringValue: props.stringValue,
|
|
61
38
|
});
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
(0, utils_1.createCfnOutput)(`${id}-parameterArn`, scope, parameter.parameterArn);
|
|
40
|
+
(0, utils_1.createCfnOutput)(`${id}-parameterName`, scope, parameter.parameterName);
|
|
64
41
|
return parameter;
|
|
65
42
|
}
|
|
66
43
|
/**
|
|
@@ -72,7 +49,7 @@ class SsmManager {
|
|
|
72
49
|
readStringParameter(id, scope, parameterName) {
|
|
73
50
|
if (!parameterName || parameterName == '')
|
|
74
51
|
throw 'Invalid parameter name';
|
|
75
|
-
return
|
|
52
|
+
return aws_ssm_1.StringParameter.valueFromLookup(scope, parameterName);
|
|
76
53
|
}
|
|
77
54
|
/**
|
|
78
55
|
* Method to read a string parameter from the parameters store in a given region
|
|
@@ -96,7 +73,7 @@ exports.SsmManager = SsmManager;
|
|
|
96
73
|
/**
|
|
97
74
|
* @classdesc Provides utilities to read same/cross region SSM parameters
|
|
98
75
|
*/
|
|
99
|
-
class SSMParameterReader extends
|
|
76
|
+
class SSMParameterReader extends custom_resources_1.AwsCustomResource {
|
|
100
77
|
constructor(scope, name, props) {
|
|
101
78
|
const { parameterName, region } = props;
|
|
102
79
|
const ssmAwsSdkCall = {
|
|
@@ -104,13 +81,13 @@ class SSMParameterReader extends cr.AwsCustomResource {
|
|
|
104
81
|
parameters: {
|
|
105
82
|
Name: `${parameterName}-${scope.props.stage}`,
|
|
106
83
|
},
|
|
107
|
-
physicalResourceId:
|
|
84
|
+
physicalResourceId: custom_resources_1.PhysicalResourceId.of(Date.now().toString()),
|
|
108
85
|
region,
|
|
109
86
|
service: 'SSM',
|
|
110
87
|
};
|
|
111
88
|
super(scope, name, {
|
|
112
89
|
onUpdate: ssmAwsSdkCall,
|
|
113
|
-
policy:
|
|
90
|
+
policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE }),
|
|
114
91
|
});
|
|
115
92
|
}
|
|
116
93
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
1
|
+
import { Vpc, VpcProps } from 'aws-cdk-lib/aws-ec2';
|
|
3
2
|
import { CommonConstruct } from '../../../common';
|
|
4
3
|
/**
|
|
5
4
|
* @classdesc Provides operations on AWS VPC.
|
|
@@ -15,7 +14,7 @@ import { CommonConstruct } from '../../../common';
|
|
|
15
14
|
* this.vpcManager.createVpc('MyVPC', this)
|
|
16
15
|
* }
|
|
17
16
|
* }
|
|
18
|
-
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.@aws-cdk_aws-
|
|
17
|
+
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.@aws-cdk_aws-Vpc.html}
|
|
19
18
|
*/
|
|
20
19
|
export declare class VpcManager {
|
|
21
20
|
/**
|
|
@@ -24,19 +23,19 @@ export declare class VpcManager {
|
|
|
24
23
|
* @param scope scope in which this resource is defined
|
|
25
24
|
* @param props
|
|
26
25
|
*/
|
|
27
|
-
createVpc(id: string, scope: CommonConstruct, props:
|
|
26
|
+
createVpc(id: string, scope: CommonConstruct, props: VpcProps): Vpc;
|
|
28
27
|
/**
|
|
29
28
|
* @summary Method to create a common vpc
|
|
30
29
|
* @param scope scope in which this resource is defined
|
|
31
30
|
* @param props
|
|
32
31
|
* @param vpcIdentifier optional identifier for VPC
|
|
33
32
|
*/
|
|
34
|
-
createCommonVpc(scope: CommonConstruct, props:
|
|
33
|
+
createCommonVpc(scope: CommonConstruct, props: VpcProps, vpcIdentifier?: string): Vpc;
|
|
35
34
|
/**
|
|
36
35
|
* @summary Method to retrieve a common vpc
|
|
37
36
|
* @param id scoped id of the resource
|
|
38
37
|
* @param scope scope in which this resource is defined
|
|
39
38
|
* @param vpcIdentifier optional identifier for VPC
|
|
40
39
|
*/
|
|
41
|
-
retrieveCommonVpc(id: string, scope: CommonConstruct, vpcIdentifier?: string): cdk.
|
|
40
|
+
retrieveCommonVpc(id: string, scope: CommonConstruct, vpcIdentifier?: string): import("aws-cdk-lib/aws-ec2").IVpc;
|
|
42
41
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.VpcManager = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
+
const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
30
7
|
/**
|
|
31
8
|
*/
|
|
32
9
|
const CommonVpcIdentifier = 'CommonVpc';
|
|
@@ -44,7 +21,7 @@ const CommonVpcIdentifier = 'CommonVpc';
|
|
|
44
21
|
* this.vpcManager.createVpc('MyVPC', this)
|
|
45
22
|
* }
|
|
46
23
|
* }
|
|
47
|
-
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.@aws-cdk_aws-
|
|
24
|
+
* @see [CDK VPC Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.@aws-cdk_aws-Vpc.html}
|
|
48
25
|
*/
|
|
49
26
|
class VpcManager {
|
|
50
27
|
/**
|
|
@@ -56,17 +33,17 @@ class VpcManager {
|
|
|
56
33
|
createVpc(id, scope, props) {
|
|
57
34
|
if (!props)
|
|
58
35
|
throw `Vpc props undefined for ${id}`;
|
|
59
|
-
const vpc = new
|
|
36
|
+
const vpc = new aws_ec2_1.Vpc(scope, `${id}`, {
|
|
60
37
|
ipAddresses: props.ipAddresses,
|
|
61
38
|
maxAzs: props.maxAzs,
|
|
62
39
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
40
|
+
(0, utils_1.createCfnOutput)(`${id}Id`, scope, vpc.vpcId);
|
|
41
|
+
(0, utils_1.createCfnOutput)(`${id}PublicSubnetIds`, scope, vpc.publicSubnets.map(subnet => subnet.subnetId).toString());
|
|
42
|
+
(0, utils_1.createCfnOutput)(`${id}PrivateSubnetIds`, scope, vpc.privateSubnets.map(subnet => subnet.subnetId).toString());
|
|
43
|
+
(0, utils_1.createCfnOutput)(`${id}PublicSubnetRouteTableIds`, scope, vpc.publicSubnets.map(subnet => subnet.routeTable.routeTableId).toString());
|
|
44
|
+
(0, utils_1.createCfnOutput)(`${id}PrivateSubnetRouteTableIds`, scope, vpc.privateSubnets.map(subnet => subnet.routeTable.routeTableId).toString());
|
|
45
|
+
(0, utils_1.createCfnOutput)(`${id}AvailabilityZones`, scope, vpc.availabilityZones.toString());
|
|
46
|
+
(0, utils_1.createCfnOutput)(`${id}DefaultSecurityGroup`, scope, vpc.vpcDefaultSecurityGroup.toString());
|
|
70
47
|
return vpc;
|
|
71
48
|
}
|
|
72
49
|
/**
|
|
@@ -77,7 +54,7 @@ class VpcManager {
|
|
|
77
54
|
*/
|
|
78
55
|
createCommonVpc(scope, props, vpcIdentifier) {
|
|
79
56
|
const vpc = this.createVpc(CommonVpcIdentifier, scope, props);
|
|
80
|
-
|
|
57
|
+
aws_cdk_lib_1.Tags.of(vpc).add('Name', vpcIdentifier ?? CommonVpcIdentifier);
|
|
81
58
|
return vpc;
|
|
82
59
|
}
|
|
83
60
|
/**
|
|
@@ -87,7 +64,7 @@ class VpcManager {
|
|
|
87
64
|
* @param vpcIdentifier optional identifier for VPC
|
|
88
65
|
*/
|
|
89
66
|
retrieveCommonVpc(id, scope, vpcIdentifier) {
|
|
90
|
-
return
|
|
67
|
+
return aws_ec2_1.Vpc.fromLookup(scope, `${id}`, { vpcName: vpcIdentifier ?? CommonVpcIdentifier });
|
|
91
68
|
}
|
|
92
69
|
}
|
|
93
70
|
exports.VpcManager = VpcManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CfnIPSet, CfnWebACL } from 'aws-cdk-lib/aws-wafv2';
|
|
2
2
|
import { CommonConstruct } from '../../../common';
|
|
3
3
|
import { WafIPSetProps, WafWebACLProps } from './types';
|
|
4
4
|
/**
|
|
@@ -24,12 +24,12 @@ export declare class WafManager {
|
|
|
24
24
|
* @param scope scope in which this resource is defined
|
|
25
25
|
* @param props
|
|
26
26
|
*/
|
|
27
|
-
createIpSet(id: string, scope: CommonConstruct, props: WafIPSetProps):
|
|
27
|
+
createIpSet(id: string, scope: CommonConstruct, props: WafIPSetProps): CfnIPSet;
|
|
28
28
|
/**
|
|
29
29
|
* @summary Method to create a web acl
|
|
30
30
|
* @param id scoped id of the resource
|
|
31
31
|
* @param scope scope in which this resource is defined
|
|
32
32
|
* @param props
|
|
33
33
|
*/
|
|
34
|
-
createWebAcl(id: string, scope: CommonConstruct, props: WafWebACLProps):
|
|
34
|
+
createWebAcl(id: string, scope: CommonConstruct, props: WafWebACLProps): CfnWebACL;
|
|
35
35
|
}
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.WafManager = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
4
|
+
const aws_wafv2_1 = require("aws-cdk-lib/aws-wafv2");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
29
6
|
/**
|
|
30
7
|
* @classdesc Provides operations on AWS WAF.
|
|
31
8
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
@@ -52,15 +29,15 @@ class WafManager {
|
|
|
52
29
|
createIpSet(id, scope, props) {
|
|
53
30
|
if (!props)
|
|
54
31
|
throw `WAF Ip Set props undefined for ${id}`;
|
|
55
|
-
const ipSet = new
|
|
32
|
+
const ipSet = new aws_wafv2_1.CfnIPSet(scope, `${id}`, {
|
|
56
33
|
addresses: props.addresses,
|
|
57
34
|
description: `IP Set for ${id} - ${scope.props.stage} stage`,
|
|
58
35
|
ipAddressVersion: props.ipAddressVersion,
|
|
59
36
|
name: scope.isProductionStage() ? props.name : `${props.name}-${scope.props.stage}`,
|
|
60
37
|
scope: props.scope,
|
|
61
38
|
});
|
|
62
|
-
|
|
63
|
-
|
|
39
|
+
(0, utils_1.createCfnOutput)(`${id}-ipSetId`, scope, ipSet.attrId);
|
|
40
|
+
(0, utils_1.createCfnOutput)(`${id}-ipSetArn`, scope, ipSet.attrArn);
|
|
64
41
|
return ipSet;
|
|
65
42
|
}
|
|
66
43
|
/**
|
|
@@ -72,7 +49,7 @@ class WafManager {
|
|
|
72
49
|
createWebAcl(id, scope, props) {
|
|
73
50
|
if (!props)
|
|
74
51
|
throw `WAF WebACL props undefined for ${id}`;
|
|
75
|
-
const webAcl = new
|
|
52
|
+
const webAcl = new aws_wafv2_1.CfnWebACL(scope, `${id}`, {
|
|
76
53
|
defaultAction: props.defaultAction,
|
|
77
54
|
description: `Web Acl for ${id} - ${scope.props.stage} stage`,
|
|
78
55
|
name: scope.isProductionStage() ? props.name : `${props.name}-${scope.props.stage}`,
|
|
@@ -81,8 +58,8 @@ class WafManager {
|
|
|
81
58
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
82
59
|
visibilityConfig: props.visibilityConfig,
|
|
83
60
|
});
|
|
84
|
-
|
|
85
|
-
|
|
61
|
+
(0, utils_1.createCfnOutput)(`${id}-webAclId`, scope, webAcl.attrId);
|
|
62
|
+
(0, utils_1.createCfnOutput)(`${id}-webAclArn`, scope, webAcl.attrArn);
|
|
86
63
|
return webAcl;
|
|
87
64
|
}
|
|
88
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as cdk from 'aws-cdk-lib';
|
|
2
|
-
import { CommonConstruct } from '../../common';
|
|
3
1
|
import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
2
|
+
import { CfnOutput } from 'aws-cdk-lib';
|
|
3
|
+
import { CommonConstruct } from '../../common';
|
|
4
4
|
/**
|
|
5
5
|
* @summary Helper method to add CloudFormation outputs from the construct
|
|
6
6
|
* @param id scoped id of the resource
|
|
@@ -10,5 +10,8 @@ import { AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
|
10
10
|
* @param overrideId Flag which indicates whether to override the default logical id of the output
|
|
11
11
|
* @returns The CloudFormation output
|
|
12
12
|
*/
|
|
13
|
-
export declare function createCfnOutput(id: string, scope: CommonConstruct, value?: string, description?: string, overrideId?: boolean):
|
|
13
|
+
export declare function createCfnOutput(id: string, scope: CommonConstruct, value?: string, description?: string, overrideId?: boolean): CfnOutput;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
14
17
|
export declare function determineCredentials(): AwsCredentialIdentityProvider;
|