@gradientedge/cdk-utils 8.124.0 → 8.125.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/aws/services/api-gateway/main.d.ts +2 -2
- package/dist/src/lib/aws/services/api-gateway/main.js +8 -28
- package/dist/src/lib/aws/services/appconfig/main.d.ts +1 -1
- package/dist/src/lib/aws/services/appconfig/main.js +6 -13
- package/dist/src/lib/aws/services/cloudfront/main.js +6 -18
- package/dist/src/lib/aws/services/cloudtrail/main.js +1 -4
- package/dist/src/lib/aws/services/cloudwatch/main.js +15 -56
- package/dist/src/lib/aws/services/dynamodb/main.js +1 -16
- package/dist/src/lib/aws/services/elastic-container-service/main.js +11 -38
- package/dist/src/lib/aws/services/elasticache/main.js +4 -34
- package/dist/src/lib/aws/services/eventbridge/main.js +9 -14
- package/dist/src/lib/aws/services/key-management-service/main.js +1 -9
- package/dist/src/lib/aws/services/lambda/main.js +45 -63
- package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
- package/dist/src/lib/aws/services/simple-notification-service/main.js +2 -2
- package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -8
- package/dist/src/lib/aws/services/simple-storage-service/main.js +3 -22
- package/dist/src/lib/aws/services/step-function/main.js +33 -110
- package/dist/src/lib/aws/services/systems-manager/main.js +3 -3
- package/dist/src/lib/aws/services/virtual-private-cloud/main.js +1 -2
- package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -7
- package/package.json +13 -13
- package/src/lib/aws/services/api-gateway/main.ts +8 -28
- package/src/lib/aws/services/appconfig/main.ts +6 -13
- package/src/lib/aws/services/cloudfront/main.ts +6 -18
- package/src/lib/aws/services/cloudtrail/main.ts +1 -4
- package/src/lib/aws/services/cloudwatch/main.ts +15 -56
- package/src/lib/aws/services/dynamodb/main.ts +1 -16
- package/src/lib/aws/services/elastic-container-service/main.ts +11 -38
- package/src/lib/aws/services/elasticache/main.ts +4 -34
- package/src/lib/aws/services/eventbridge/main.ts +9 -14
- package/src/lib/aws/services/key-management-service/main.ts +1 -9
- package/src/lib/aws/services/lambda/main.ts +54 -72
- package/src/lib/aws/services/secrets-manager/main.ts +1 -1
- package/src/lib/aws/services/simple-notification-service/main.ts +2 -2
- package/src/lib/aws/services/simple-queue-service/main.ts +1 -8
- package/src/lib/aws/services/simple-storage-service/main.ts +3 -22
- package/src/lib/aws/services/step-function/main.ts +33 -110
- package/src/lib/aws/services/systems-manager/main.ts +3 -3
- package/src/lib/aws/services/virtual-private-cloud/main.ts +1 -2
- package/src/lib/aws/services/web-application-firewall/main.ts +2 -7
|
@@ -59,7 +59,7 @@ export declare class ApiManager {
|
|
|
59
59
|
* @summary Method to create an api deployment
|
|
60
60
|
* @param id
|
|
61
61
|
* @param scope
|
|
62
|
-
* @param
|
|
62
|
+
* @param api
|
|
63
63
|
*/
|
|
64
|
-
createApiDeployment(id: string, scope: CommonConstruct,
|
|
64
|
+
createApiDeployment(id: string, scope: CommonConstruct, api: IRestApi): void;
|
|
65
65
|
}
|
|
@@ -37,42 +37,22 @@ class ApiManager {
|
|
|
37
37
|
if (!props)
|
|
38
38
|
throw `Api props undefined for ${id}`;
|
|
39
39
|
const api = new aws_apigateway_1.LambdaRestApi(scope, `${id}`, {
|
|
40
|
-
|
|
40
|
+
...props,
|
|
41
41
|
cloudWatchRole: props.cloudWatchRole || false,
|
|
42
|
-
defaultCorsPreflightOptions: props.defaultCorsPreflightOptions,
|
|
43
|
-
defaultMethodOptions: props.defaultMethodOptions,
|
|
44
42
|
deploy: props.deploy || true,
|
|
45
43
|
deployOptions: {
|
|
46
|
-
|
|
47
|
-
accessLogFormat: props.deployOptions?.accessLogFormat,
|
|
48
|
-
cacheClusterEnabled: props.deployOptions?.cacheClusterEnabled,
|
|
49
|
-
cacheClusterSize: props.deployOptions?.cacheClusterSize,
|
|
50
|
-
cachingEnabled: props.deployOptions?.cachingEnabled,
|
|
51
|
-
clientCertificateId: props.deployOptions?.clientCertificateId,
|
|
52
|
-
dataTraceEnabled: props.deployOptions?.dataTraceEnabled,
|
|
44
|
+
...props.deployOptions,
|
|
53
45
|
description: `${id} - ${scope.props.stage} stage`,
|
|
54
|
-
documentationVersion: props.deployOptions?.documentationVersion,
|
|
55
|
-
loggingLevel: props.deployOptions?.loggingLevel,
|
|
56
|
-
methodOptions: props.deployOptions?.methodOptions,
|
|
57
|
-
metricsEnabled: props.deployOptions?.metricsEnabled,
|
|
58
46
|
stageName: scope.props.stage,
|
|
59
|
-
tracingEnabled: props.deployOptions?.tracingEnabled,
|
|
60
|
-
variables: props.deployOptions?.variables,
|
|
61
47
|
},
|
|
62
|
-
domainName: props.domainName,
|
|
63
48
|
endpointConfiguration: {
|
|
49
|
+
...props.endpointConfiguration,
|
|
64
50
|
types: props.endpointConfiguration?.types || [aws_apigateway_1.EndpointType.REGIONAL],
|
|
65
|
-
vpcEndpoints: props.endpointConfiguration?.vpcEndpoints,
|
|
66
51
|
},
|
|
67
|
-
endpointTypes: props.endpointTypes,
|
|
68
52
|
failOnWarnings: props.failOnWarnings || false,
|
|
69
53
|
handler: lambdaFunction,
|
|
70
|
-
minCompressionSize: props.minCompressionSize,
|
|
71
|
-
parameters: props.parameters,
|
|
72
|
-
policy: props.policy,
|
|
73
54
|
proxy: props.proxy ?? true,
|
|
74
55
|
restApiName: `${props.restApiName}-${scope.props.stage}`,
|
|
75
|
-
retainDeployments: props.retainDeployments,
|
|
76
56
|
});
|
|
77
57
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
78
58
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -92,8 +72,8 @@ class ApiManager {
|
|
|
92
72
|
*/
|
|
93
73
|
createApiDomain(id, scope, domainName, certificate) {
|
|
94
74
|
const apiDomain = new aws_apigateway_1.DomainName(scope, `${id}`, {
|
|
95
|
-
certificate
|
|
96
|
-
domainName
|
|
75
|
+
certificate,
|
|
76
|
+
domainName,
|
|
97
77
|
endpointType: scope.isProductionStage() ? aws_apigateway_1.EndpointType.EDGE : aws_apigateway_1.EndpointType.REGIONAL,
|
|
98
78
|
securityPolicy: aws_apigateway_1.SecurityPolicy.TLS_1_2,
|
|
99
79
|
});
|
|
@@ -155,11 +135,11 @@ class ApiManager {
|
|
|
155
135
|
* @summary Method to create an api deployment
|
|
156
136
|
* @param id
|
|
157
137
|
* @param scope
|
|
158
|
-
* @param
|
|
138
|
+
* @param api
|
|
159
139
|
*/
|
|
160
|
-
createApiDeployment(id, scope,
|
|
140
|
+
createApiDeployment(id, scope, api) {
|
|
161
141
|
new aws_apigateway_1.Deployment(scope, `${id}`, {
|
|
162
|
-
api
|
|
142
|
+
api,
|
|
163
143
|
retainDeployments: false,
|
|
164
144
|
});
|
|
165
145
|
}
|
|
@@ -44,7 +44,7 @@ export declare class AppConfigManager {
|
|
|
44
44
|
createEnvironment(id: string, scope: CommonConstruct, applicationId: string, props: AppConfigProps): CfnEnvironment;
|
|
45
45
|
/**
|
|
46
46
|
* @summary Method to create an AppConfig Configuration Profile for a given application
|
|
47
|
-
* -
|
|
47
|
+
* - The <b>locationUri</b> is defaulted to <i>hosted</i> if undefined</p>
|
|
48
48
|
* @param id scoped id of the resource
|
|
49
49
|
* @param scope scope in which this resource is defined
|
|
50
50
|
* @param applicationId id of the application
|
|
@@ -49,9 +49,8 @@ class AppConfigManager {
|
|
|
49
49
|
if (!props)
|
|
50
50
|
throw `AppConfig props undefined for ${id}`;
|
|
51
51
|
const application = new aws_appconfig_1.CfnApplication(scope, `${id}`, {
|
|
52
|
-
|
|
52
|
+
...props.application,
|
|
53
53
|
name: `${props.application.name}-${scope.props.stage}`,
|
|
54
|
-
tags: props.application.tags,
|
|
55
54
|
});
|
|
56
55
|
(0, utils_1.createCfnOutput)(`${id}-ApplicationId`, scope, aws_cdk_lib_1.Fn.ref(application.logicalId));
|
|
57
56
|
(0, utils_1.createCfnOutput)(`${id}-ApplicationName`, scope, application.name);
|
|
@@ -69,11 +68,9 @@ class AppConfigManager {
|
|
|
69
68
|
if (!props)
|
|
70
69
|
throw `AppConfig props undefined for ${id}`;
|
|
71
70
|
const environment = new aws_appconfig_1.CfnEnvironment(scope, `${id}`, {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
monitors: props.environment.monitors,
|
|
71
|
+
...props.environment,
|
|
72
|
+
applicationId,
|
|
75
73
|
name: props.environment.name ?? scope.props.stage,
|
|
76
|
-
tags: props.environment.tags,
|
|
77
74
|
});
|
|
78
75
|
(0, utils_1.createCfnOutput)(`${id}-configurationEnvironmentId`, scope, aws_cdk_lib_1.Fn.ref(environment.logicalId));
|
|
79
76
|
(0, utils_1.createCfnOutput)(`${id}-configurationEnvironmentName`, scope, environment.name);
|
|
@@ -81,7 +78,7 @@ class AppConfigManager {
|
|
|
81
78
|
}
|
|
82
79
|
/**
|
|
83
80
|
* @summary Method to create an AppConfig Configuration Profile for a given application
|
|
84
|
-
* -
|
|
81
|
+
* - The <b>locationUri</b> is defaulted to <i>hosted</i> if undefined</p>
|
|
85
82
|
* @param id scoped id of the resource
|
|
86
83
|
* @param scope scope in which this resource is defined
|
|
87
84
|
* @param applicationId id of the application
|
|
@@ -92,14 +89,10 @@ class AppConfigManager {
|
|
|
92
89
|
if (!props)
|
|
93
90
|
throw `AppConfig props undefined for ${id}`;
|
|
94
91
|
const profile = new aws_appconfig_1.CfnConfigurationProfile(scope, `${id}`, {
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
...props.configurationProfile,
|
|
93
|
+
applicationId,
|
|
97
94
|
locationUri: props.configurationProfile.locationUri || 'hosted',
|
|
98
95
|
name: `${props.configurationProfile.name}-${scope.props.stage}`,
|
|
99
|
-
retrievalRoleArn: props.configurationProfile.retrievalRoleArn,
|
|
100
|
-
tags: props.configurationProfile.tags,
|
|
101
|
-
type: props.configurationProfile.type,
|
|
102
|
-
validators: props.configurationProfile.validators,
|
|
103
96
|
});
|
|
104
97
|
(0, utils_1.createCfnOutput)(`${id}-configurationProfileId`, scope, aws_cdk_lib_1.Fn.ref(profile.logicalId));
|
|
105
98
|
(0, utils_1.createCfnOutput)(`${id}-configurationProfileName`, scope, profile.name);
|
|
@@ -86,12 +86,9 @@ class CloudFrontManager {
|
|
|
86
86
|
if (!props)
|
|
87
87
|
throw `CloudFront props undefined for ${id}`;
|
|
88
88
|
const distribution = new aws_cloudfront_1.CloudFrontWebDistribution(scope, `${id}`, {
|
|
89
|
+
...props,
|
|
89
90
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
90
|
-
defaultRootObject: props.defaultRootObject,
|
|
91
|
-
enableIpV6: props.enableIpV6,
|
|
92
91
|
enabled: props.enabled ?? true,
|
|
93
|
-
errorConfigurations: props.errorConfigurations,
|
|
94
|
-
geoRestriction: props.geoRestriction,
|
|
95
92
|
httpVersion: props.httpVersion ?? aws_cloudfront_1.HttpVersion.HTTP2,
|
|
96
93
|
loggingConfig: {
|
|
97
94
|
bucket: logBucket,
|
|
@@ -112,7 +109,6 @@ class CloudFrontManager {
|
|
|
112
109
|
securityPolicy: aws_cloudfront_1.SecurityPolicyProtocol.TLS_V1_1_2016,
|
|
113
110
|
sslMethod: aws_cloudfront_1.SSLMethod.SNI,
|
|
114
111
|
}),
|
|
115
|
-
webACLId: props.webACLId,
|
|
116
112
|
});
|
|
117
113
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
118
114
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -138,31 +134,23 @@ class CloudFrontManager {
|
|
|
138
134
|
*/
|
|
139
135
|
createDistributionWithS3Origin(id, scope, props, origin, siteBucket, logBucket, oai, certificate, aliases, defaultFunctionAssociations) {
|
|
140
136
|
const distribution = new aws_cloudfront_1.Distribution(scope, `${id}`, {
|
|
141
|
-
|
|
142
|
-
certificate
|
|
137
|
+
...props,
|
|
138
|
+
certificate,
|
|
143
139
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
144
140
|
defaultBehavior: {
|
|
145
|
-
|
|
146
|
-
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
141
|
+
...props.defaultBehavior,
|
|
147
142
|
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
148
|
-
origin
|
|
149
|
-
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
150
|
-
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
143
|
+
origin,
|
|
151
144
|
},
|
|
152
|
-
defaultRootObject: props.defaultRootObject,
|
|
153
145
|
domainNames: aliases,
|
|
154
|
-
enableIpv6: props.enableIpv6,
|
|
155
146
|
enableLogging: props.enableLogging ?? true,
|
|
156
147
|
enabled: props.enabled ?? true,
|
|
157
|
-
errorResponses: props.errorResponses,
|
|
158
|
-
geoRestriction: props.geoRestriction,
|
|
159
148
|
httpVersion: props.httpVersion ?? aws_cloudfront_1.HttpVersion.HTTP2,
|
|
160
|
-
logBucket
|
|
149
|
+
logBucket,
|
|
161
150
|
logFilePrefix: props.logFilePrefix ?? `edge/`,
|
|
162
151
|
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
163
152
|
minimumProtocolVersion: props.minimumProtocolVersion ?? aws_cloudfront_1.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
164
153
|
priceClass: props.priceClass ?? aws_cloudfront_1.PriceClass.PRICE_CLASS_ALL,
|
|
165
|
-
webAclId: props.webAclId,
|
|
166
154
|
});
|
|
167
155
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
168
156
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -42,9 +42,9 @@ class CloudTrailManager {
|
|
|
42
42
|
throw `CloudTrail props undefined for ${id}`;
|
|
43
43
|
const role = scope.iamManager.createRoleForCloudTrail(`${id}Role`, scope, logGroup);
|
|
44
44
|
const cloudTrail = new aws_cloudtrail_1.CfnTrail(scope, `${id}`, {
|
|
45
|
+
...props,
|
|
45
46
|
cloudWatchLogsLogGroupArn: logGroup.attrArn,
|
|
46
47
|
cloudWatchLogsRoleArn: role.attrArn,
|
|
47
|
-
enableLogFileValidation: props.enableLogFileValidation,
|
|
48
48
|
eventSelectors: [
|
|
49
49
|
{
|
|
50
50
|
dataResources: [
|
|
@@ -57,9 +57,6 @@ class CloudTrailManager {
|
|
|
57
57
|
readWriteType: 'WriteOnly',
|
|
58
58
|
},
|
|
59
59
|
],
|
|
60
|
-
includeGlobalServiceEvents: props.includeGlobalServiceEvents,
|
|
61
|
-
isLogging: props.isLogging,
|
|
62
|
-
isMultiRegionTrail: props.isMultiRegionTrail,
|
|
63
60
|
s3BucketName: logBucket.bucketName,
|
|
64
61
|
s3KeyPrefix: `logs-${props.trailName}`,
|
|
65
62
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
@@ -77,18 +77,13 @@ class CloudWatchManager {
|
|
|
77
77
|
metrics[`m${index}`] = metric;
|
|
78
78
|
});
|
|
79
79
|
const expression = new watch.MathExpression({
|
|
80
|
+
...props,
|
|
80
81
|
expression: props.expression,
|
|
81
82
|
period: props.periodInSecs ? cdk.Duration.seconds(props.periodInSecs) : cdk.Duration.minutes(5),
|
|
82
83
|
usingMetrics: metrics,
|
|
83
84
|
});
|
|
84
85
|
const alarm = expression.createAlarm(scope, `${id}`, {
|
|
85
|
-
|
|
86
|
-
alarmName: props.alarmName,
|
|
87
|
-
comparisonOperator: props.comparisonOperator,
|
|
88
|
-
datapointsToAlarm: props.datapointsToAlarm,
|
|
89
|
-
evaluationPeriods: props.evaluationPeriods,
|
|
90
|
-
threshold: props.threshold,
|
|
91
|
-
treatMissingData: props.treatMissingData,
|
|
86
|
+
...props,
|
|
92
87
|
});
|
|
93
88
|
utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn);
|
|
94
89
|
utils.createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName);
|
|
@@ -105,13 +100,7 @@ class CloudWatchManager {
|
|
|
105
100
|
if (!props)
|
|
106
101
|
throw `Alarm props undefined for ${id}`;
|
|
107
102
|
const alarm = metric.createAlarm(scope, `${id}`, {
|
|
108
|
-
|
|
109
|
-
alarmName: props.alarmName,
|
|
110
|
-
comparisonOperator: props.comparisonOperator,
|
|
111
|
-
datapointsToAlarm: props.datapointsToAlarm,
|
|
112
|
-
evaluationPeriods: props.evaluationPeriods,
|
|
113
|
-
threshold: props.threshold,
|
|
114
|
-
treatMissingData: props.treatMissingData,
|
|
103
|
+
...props,
|
|
115
104
|
});
|
|
116
105
|
utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn);
|
|
117
106
|
utils.createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName);
|
|
@@ -128,11 +117,10 @@ class CloudWatchManager {
|
|
|
128
117
|
if (!props)
|
|
129
118
|
throw `Dashboard props undefined for ${id}`;
|
|
130
119
|
const dashboard = new watch.Dashboard(scope, `${id}`, {
|
|
131
|
-
|
|
120
|
+
...props,
|
|
132
121
|
end: CloudWatchManager.determineTimeRange(props.end),
|
|
133
|
-
periodOverride: props.periodOverride,
|
|
134
122
|
start: CloudWatchManager.determineTimeRange(props.start),
|
|
135
|
-
widgets
|
|
123
|
+
widgets,
|
|
136
124
|
});
|
|
137
125
|
utils.createCfnOutput(`${id}-dashboardName`, scope, props.dashboardName);
|
|
138
126
|
return dashboard;
|
|
@@ -353,9 +341,7 @@ class CloudWatchManager {
|
|
|
353
341
|
if (!props)
|
|
354
342
|
throw `Widget props undefined for ${id}`;
|
|
355
343
|
const widget = new watch.TextWidget({
|
|
356
|
-
|
|
357
|
-
markdown: props.markdown,
|
|
358
|
-
width: props.width,
|
|
344
|
+
...props,
|
|
359
345
|
});
|
|
360
346
|
if (props.positionX && props.positionY)
|
|
361
347
|
widget.position(props.positionX, props.positionY);
|
|
@@ -372,14 +358,9 @@ class CloudWatchManager {
|
|
|
372
358
|
if (!props)
|
|
373
359
|
throw `Widget props undefined for ${id}`;
|
|
374
360
|
const widget = new watch.SingleValueWidget({
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
metrics: metrics,
|
|
361
|
+
...props,
|
|
362
|
+
metrics,
|
|
378
363
|
region: props.region ?? scope.props.region,
|
|
379
|
-
setPeriodToTimeRange: props.setPeriodToTimeRange,
|
|
380
|
-
sparkline: props.sparkline,
|
|
381
|
-
title: props.title,
|
|
382
|
-
width: props.width,
|
|
383
364
|
});
|
|
384
365
|
if (props.positionX && props.positionY)
|
|
385
366
|
widget.position(props.positionX, props.positionY);
|
|
@@ -396,14 +377,9 @@ class CloudWatchManager {
|
|
|
396
377
|
if (!props)
|
|
397
378
|
throw `Widget props undefined for ${id}`;
|
|
398
379
|
const widget = new watch.GaugeWidget({
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
metrics: metrics,
|
|
380
|
+
...props,
|
|
381
|
+
metrics,
|
|
402
382
|
region: props.region ?? scope.props.region,
|
|
403
|
-
setPeriodToTimeRange: props.setPeriodToTimeRange,
|
|
404
|
-
statistic: props.statistic,
|
|
405
|
-
title: props.title,
|
|
406
|
-
width: props.width,
|
|
407
383
|
});
|
|
408
384
|
if (props.positionX && props.positionY)
|
|
409
385
|
widget.position(props.positionX, props.positionY);
|
|
@@ -421,20 +397,10 @@ class CloudWatchManager {
|
|
|
421
397
|
if (!props)
|
|
422
398
|
throw `Widget props undefined for ${id}`;
|
|
423
399
|
const widget = new watch.GraphWidget({
|
|
424
|
-
|
|
400
|
+
...props,
|
|
425
401
|
left: leftYMetrics,
|
|
426
|
-
leftAnnotations: props.leftAnnotations,
|
|
427
|
-
leftYAxis: props.leftYAxis,
|
|
428
|
-
legendPosition: props.legendPosition,
|
|
429
|
-
liveData: props.liveData,
|
|
430
402
|
region: props.region ?? scope.props.region,
|
|
431
403
|
right: rightYMetrics,
|
|
432
|
-
rightAnnotations: props.rightAnnotations,
|
|
433
|
-
rightYAxis: props.rightYAxis,
|
|
434
|
-
stacked: props.stacked,
|
|
435
|
-
title: props.title,
|
|
436
|
-
view: props.view,
|
|
437
|
-
width: props.width,
|
|
438
404
|
});
|
|
439
405
|
if (props.positionX && props.positionY)
|
|
440
406
|
widget.position(props.positionX, props.positionY);
|
|
@@ -451,10 +417,8 @@ class CloudWatchManager {
|
|
|
451
417
|
if (!props)
|
|
452
418
|
throw `Widget props undefined for ${id}`;
|
|
453
419
|
const widget = new watch.AlarmStatusWidget({
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
title: props.title,
|
|
457
|
-
width: props.width,
|
|
420
|
+
...props,
|
|
421
|
+
alarms,
|
|
458
422
|
});
|
|
459
423
|
if (props.positionX && props.positionY)
|
|
460
424
|
widget.position(props.positionX, props.positionY);
|
|
@@ -471,14 +435,9 @@ class CloudWatchManager {
|
|
|
471
435
|
if (!props)
|
|
472
436
|
throw `Widget props undefined for ${id}`;
|
|
473
437
|
const widget = new watch.LogQueryWidget({
|
|
474
|
-
|
|
475
|
-
logGroupNames
|
|
476
|
-
queryLines: props.queryLines,
|
|
477
|
-
queryString: props.queryString,
|
|
438
|
+
...props,
|
|
439
|
+
logGroupNames,
|
|
478
440
|
region: props.region ?? scope.props.region,
|
|
479
|
-
title: props.title,
|
|
480
|
-
view: props.view,
|
|
481
|
-
width: props.width,
|
|
482
441
|
});
|
|
483
442
|
if (props.positionX && props.positionY)
|
|
484
443
|
widget.position(props.positionX, props.positionY);
|
|
@@ -35,23 +35,8 @@ class DynamodbManager {
|
|
|
35
35
|
if (!props)
|
|
36
36
|
throw `Table props undefined for ${id}`;
|
|
37
37
|
const table = new aws_dynamodb_1.Table(scope, `${id}`, {
|
|
38
|
-
|
|
39
|
-
contributorInsightsEnabled: props.contributorInsightsEnabled,
|
|
40
|
-
encryption: props.encryption,
|
|
41
|
-
encryptionKey: props.encryptionKey,
|
|
42
|
-
kinesisStream: props.kinesisStream,
|
|
43
|
-
partitionKey: props.partitionKey,
|
|
44
|
-
pointInTimeRecovery: props.pointInTimeRecovery,
|
|
45
|
-
readCapacity: props.readCapacity,
|
|
46
|
-
removalPolicy: props.removalPolicy,
|
|
47
|
-
replicationRegions: props.replicationRegions,
|
|
48
|
-
replicationTimeout: props.replicationTimeout,
|
|
49
|
-
sortKey: props.sortKey,
|
|
50
|
-
stream: props.stream,
|
|
38
|
+
...props,
|
|
51
39
|
tableName: `${props.tableName}-${scope.props.stage}`,
|
|
52
|
-
timeToLiveAttribute: props.timeToLiveAttribute,
|
|
53
|
-
waitForReplicationToFinish: props.waitForReplicationToFinish,
|
|
54
|
-
writeCapacity: props.writeCapacity,
|
|
55
40
|
});
|
|
56
41
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
57
42
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -37,13 +37,9 @@ class EcsManager {
|
|
|
37
37
|
if (!props)
|
|
38
38
|
throw `Ecs Cluster props undefined for ${id}`;
|
|
39
39
|
const ecsCluster = new aws_ecs_1.Cluster(scope, `${id}`, {
|
|
40
|
-
|
|
40
|
+
...props,
|
|
41
41
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
42
|
-
|
|
43
|
-
defaultCloudMapNamespace: props.defaultCloudMapNamespace,
|
|
44
|
-
enableFargateCapacityProviders: props.enableFargateCapacityProviders,
|
|
45
|
-
executeCommandConfiguration: props.executeCommandConfiguration,
|
|
46
|
-
vpc: vpc,
|
|
42
|
+
vpc,
|
|
47
43
|
});
|
|
48
44
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
49
45
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -71,40 +67,32 @@ class EcsManager {
|
|
|
71
67
|
if (!props)
|
|
72
68
|
throw `EcsTask props undefined for ${id}`;
|
|
73
69
|
const ecsTask = new aws_ecs_1.TaskDefinition(scope, `${id}`, {
|
|
70
|
+
...props,
|
|
74
71
|
compatibility: aws_ecs_1.Compatibility.FARGATE,
|
|
75
|
-
cpu: props.cpu,
|
|
76
|
-
ephemeralStorageGiB: props.ephemeralStorageGiB,
|
|
77
72
|
executionRole: role,
|
|
78
73
|
family: `${props.family}-${scope.props.stage}`,
|
|
79
|
-
inferenceAccelerators: props.inferenceAccelerators,
|
|
80
|
-
ipcMode: props.ipcMode,
|
|
81
|
-
memoryMiB: props.memoryMiB,
|
|
82
74
|
networkMode: aws_ecs_1.NetworkMode.AWS_VPC,
|
|
83
|
-
pidMode: props.pidMode,
|
|
84
|
-
placementConstraints: props.placementConstraints,
|
|
85
|
-
proxyConfiguration: props.proxyConfiguration,
|
|
86
75
|
runtimePlatform: {
|
|
87
76
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? aws_ecs_1.CpuArchitecture.X86_64,
|
|
88
77
|
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? aws_ecs_1.OperatingSystemFamily.LINUX,
|
|
89
78
|
},
|
|
90
79
|
taskRole: role,
|
|
91
|
-
volumes: props.volumes,
|
|
92
80
|
});
|
|
93
81
|
ecsTask.addContainer('EcsContainer', {
|
|
94
|
-
command
|
|
82
|
+
command,
|
|
95
83
|
cpu: props.cpu ? parseInt(props.cpu) : undefined,
|
|
96
84
|
disableNetworking: false,
|
|
97
|
-
environment
|
|
85
|
+
environment,
|
|
98
86
|
image: containerImage,
|
|
99
87
|
logging: aws_ecs_1.LogDriver.awsLogs({
|
|
100
|
-
logGroup
|
|
88
|
+
logGroup,
|
|
101
89
|
logRetention: props.logging?.logRetention,
|
|
102
90
|
multilinePattern: props.logging?.multilinePattern,
|
|
103
91
|
streamPrefix: `${id}`,
|
|
104
92
|
}),
|
|
105
93
|
memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
|
|
106
94
|
privileged: false,
|
|
107
|
-
secrets
|
|
95
|
+
secrets,
|
|
108
96
|
});
|
|
109
97
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
110
98
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -128,29 +116,20 @@ class EcsManager {
|
|
|
128
116
|
if (!props.taskImageOptions)
|
|
129
117
|
throw `TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}`;
|
|
130
118
|
const fargateService = new aws_ecs_patterns_1.ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
|
|
119
|
+
...props,
|
|
131
120
|
assignPublicIp: props.assignPublicIp ?? true,
|
|
132
|
-
|
|
133
|
-
cluster: cluster,
|
|
134
|
-
cpu: props.cpu,
|
|
135
|
-
desiredCount: props.desiredCount,
|
|
136
|
-
domainName: props.domainName,
|
|
137
|
-
domainZone: props.domainZone,
|
|
121
|
+
cluster,
|
|
138
122
|
enableECSManagedTags: true,
|
|
139
123
|
healthCheckGracePeriod: props.healthCheckGracePeriod ?? aws_cdk_lib_1.Duration.seconds(60),
|
|
140
|
-
listenerPort: props.listenerPort,
|
|
141
124
|
loadBalancerName: `${id}-${scope.props.stage}`,
|
|
142
|
-
memoryLimitMiB: props.memoryLimitMiB,
|
|
143
125
|
runtimePlatform: {
|
|
144
126
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? aws_ecs_1.CpuArchitecture.X86_64,
|
|
145
127
|
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? aws_ecs_1.OperatingSystemFamily.LINUX,
|
|
146
128
|
},
|
|
147
129
|
serviceName: `${id}-${scope.props.stage}`,
|
|
148
130
|
taskImageOptions: {
|
|
149
|
-
|
|
131
|
+
...props.taskImageOptions,
|
|
150
132
|
enableLogging: props.taskImageOptions?.enableLogging ?? true,
|
|
151
|
-
environment: props.taskImageOptions?.environment,
|
|
152
|
-
executionRole: props.taskImageOptions?.executionRole,
|
|
153
|
-
image: props.taskImageOptions.image,
|
|
154
133
|
logDriver: props.taskImageOptions?.logDriver ??
|
|
155
134
|
aws_ecs_1.LogDriver.awsLogs({
|
|
156
135
|
logGroup: logGroup,
|
|
@@ -158,20 +137,14 @@ class EcsManager {
|
|
|
158
137
|
multilinePattern: props.logging?.multilinePattern,
|
|
159
138
|
streamPrefix: `${id}-${scope.props.stage}/ecs`,
|
|
160
139
|
}),
|
|
161
|
-
secrets: props.taskImageOptions?.secrets,
|
|
162
|
-
taskRole: props.taskImageOptions?.taskRole,
|
|
163
140
|
},
|
|
164
141
|
});
|
|
165
142
|
if (props.healthCheck) {
|
|
166
143
|
fargateService.targetGroup.configureHealthCheck({
|
|
144
|
+
...props.healthCheck,
|
|
167
145
|
enabled: props.healthCheck.enabled ?? true,
|
|
168
|
-
healthyGrpcCodes: props.healthCheck.healthyGrpcCodes,
|
|
169
|
-
healthyHttpCodes: props.healthCheck.healthyHttpCodes,
|
|
170
|
-
healthyThresholdCount: props.healthCheck.healthyThresholdCount,
|
|
171
146
|
interval: props.healthCheck.interval ?? aws_cdk_lib_1.Duration.seconds(props.healthCheck.intervalInSecs),
|
|
172
147
|
path: props.healthCheck.path ?? '/',
|
|
173
|
-
port: props.healthCheck.port,
|
|
174
|
-
protocol: props.healthCheck.protocol,
|
|
175
148
|
timeout: props.healthCheck.timeout ?? aws_cdk_lib_1.Duration.seconds(props.healthCheck.timeoutInSecs),
|
|
176
149
|
unhealthyThresholdCount: props.healthCheck.unhealthyThresholdCount,
|
|
177
150
|
});
|
|
@@ -52,24 +52,10 @@ class ElastiCacheManager {
|
|
|
52
52
|
throw `ElastiCache props undefined for ${id}`;
|
|
53
53
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
54
54
|
const elasticacheCluster = new aws_elasticache_1.CfnCacheCluster(scope, `${id}`, {
|
|
55
|
-
|
|
56
|
-
azMode: props.azMode,
|
|
57
|
-
cacheNodeType: props.cacheNodeType,
|
|
58
|
-
cacheParameterGroupName: props.cacheParameterGroupName,
|
|
59
|
-
cacheSecurityGroupNames: props.cacheSecurityGroupNames,
|
|
55
|
+
...props,
|
|
60
56
|
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
61
57
|
clusterName: `${id}-${scope.props.stage}`,
|
|
62
|
-
|
|
63
|
-
engineVersion: props.engineVersion,
|
|
64
|
-
logDeliveryConfigurations: logDeliveryConfigurations,
|
|
65
|
-
numCacheNodes: props.numCacheNodes,
|
|
66
|
-
port: props.port,
|
|
67
|
-
preferredAvailabilityZones: props.preferredAvailabilityZones,
|
|
68
|
-
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
|
|
69
|
-
snapshotArns: props.snapshotArns,
|
|
70
|
-
snapshotName: props.snapshotName,
|
|
71
|
-
snapshotRetentionLimit: props.snapshotRetentionLimit,
|
|
72
|
-
snapshotWindow: props.snapshotWindow,
|
|
58
|
+
logDeliveryConfigurations,
|
|
73
59
|
vpcSecurityGroupIds: securityGroupIds,
|
|
74
60
|
});
|
|
75
61
|
elasticacheCluster.addDependency(subnetGroup);
|
|
@@ -96,27 +82,11 @@ class ElastiCacheManager {
|
|
|
96
82
|
throw `ElastiCache props undefined for ${id}`;
|
|
97
83
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
98
84
|
const elasticacheCluster = new aws_elasticache_1.CfnReplicationGroup(scope, `${id}`, {
|
|
99
|
-
|
|
100
|
-
automaticFailoverEnabled: props.automaticFailoverEnabled,
|
|
101
|
-
cacheNodeType: props.cacheNodeType,
|
|
102
|
-
cacheParameterGroupName: props.cacheParameterGroupName,
|
|
103
|
-
cacheSecurityGroupNames: props.cacheSecurityGroupNames,
|
|
85
|
+
...props,
|
|
104
86
|
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
105
|
-
engine: props.engine,
|
|
106
|
-
engineVersion: props.engineVersion,
|
|
107
|
-
globalReplicationGroupId: props.globalReplicationGroupId,
|
|
108
|
-
logDeliveryConfigurations: props.logDeliveryConfigurations,
|
|
109
|
-
multiAzEnabled: props.multiAzEnabled,
|
|
110
|
-
numCacheClusters: props.numCacheClusters,
|
|
111
|
-
numNodeGroups: props.numNodeGroups,
|
|
112
|
-
port: props.port,
|
|
113
|
-
preferredCacheClusterAZs: props.preferredCacheClusterAZs,
|
|
114
|
-
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
|
|
115
|
-
primaryClusterId: props.primaryClusterId,
|
|
116
|
-
replicasPerNodeGroup: props.replicasPerNodeGroup,
|
|
117
87
|
replicationGroupDescription: `${id} Redis Replication Cluster`,
|
|
118
88
|
replicationGroupId: `${id}-${scope.props.stage}`,
|
|
119
|
-
securityGroupIds
|
|
89
|
+
securityGroupIds,
|
|
120
90
|
});
|
|
121
91
|
elasticacheCluster.addDependency(subnetGroup);
|
|
122
92
|
return elasticacheCluster;
|
|
@@ -38,6 +38,7 @@ class EventManager {
|
|
|
38
38
|
if (!props)
|
|
39
39
|
throw `EventBus props undefined for ${id}`;
|
|
40
40
|
const eventBus = new aws_events_1.EventBus(scope, `${id}`, {
|
|
41
|
+
...props,
|
|
41
42
|
eventBusName: `${props.eventBusName}-${scope.props.stage}`,
|
|
42
43
|
});
|
|
43
44
|
(0, utils_1.createCfnOutput)(`${id}-eventBusName`, scope, `${props.eventBusName}-${scope.props.stage}`);
|
|
@@ -56,12 +57,9 @@ class EventManager {
|
|
|
56
57
|
if (!props)
|
|
57
58
|
throw `EventRule props undefined for ${id}`;
|
|
58
59
|
const rule = new aws_events_1.Rule(scope, `${id}`, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
eventBus: eventBus,
|
|
62
|
-
eventPattern: props.eventPattern,
|
|
60
|
+
...props,
|
|
61
|
+
eventBus,
|
|
63
62
|
ruleName: `${props.ruleName}-${scope.props.stage}`,
|
|
64
|
-
schedule: props.schedule,
|
|
65
63
|
});
|
|
66
64
|
if (targets && !lodash_1.default.isEmpty(targets)) {
|
|
67
65
|
lodash_1.default.forEach(targets, target => {
|
|
@@ -91,12 +89,12 @@ class EventManager {
|
|
|
91
89
|
if (!props)
|
|
92
90
|
throw `EventRule props undefined for ${id}`;
|
|
93
91
|
const eventRule = new aws_events_1.CfnRule(scope, `${id}`, {
|
|
92
|
+
...props,
|
|
94
93
|
description: 'Rule to send notification to lambda function target',
|
|
95
|
-
eventBusName
|
|
96
|
-
eventPattern
|
|
94
|
+
eventBusName,
|
|
95
|
+
eventPattern,
|
|
97
96
|
name: `${props.name}-${scope.props.stage}`,
|
|
98
|
-
scheduleExpression
|
|
99
|
-
state: props.state,
|
|
97
|
+
scheduleExpression,
|
|
100
98
|
targets: [
|
|
101
99
|
{
|
|
102
100
|
arn: lambdaFunction.functionArn,
|
|
@@ -130,10 +128,10 @@ class EventManager {
|
|
|
130
128
|
if (!props)
|
|
131
129
|
throw `EventRule props undefined for ${id}`;
|
|
132
130
|
const eventRule = new aws_events_1.CfnRule(scope, `${id}`, {
|
|
131
|
+
...props,
|
|
133
132
|
description: 'Rule to send notification on new objects in data bucket to ecs task target',
|
|
134
|
-
eventPattern
|
|
133
|
+
eventPattern,
|
|
135
134
|
name: `${props.name}-${scope.props.stage}`,
|
|
136
|
-
state: props.state,
|
|
137
135
|
targets: [
|
|
138
136
|
{
|
|
139
137
|
arn: cluster.clusterArn,
|
|
@@ -166,9 +164,6 @@ class EventManager {
|
|
|
166
164
|
const pipeRole = scope.iamManager.createRoleForSqsToSfnPipe(`${id}-role`, scope, sourceQueue.queueArn, targetStepFunction.stateMachineArn);
|
|
167
165
|
const pipe = new aws_pipes_1.CfnPipe(scope, `${id}`, {
|
|
168
166
|
...props,
|
|
169
|
-
description: props.description,
|
|
170
|
-
enrichment: props.enrichment,
|
|
171
|
-
enrichmentParameters: props.enrichmentParameters,
|
|
172
167
|
name: `${props.name}-${scope.props.stage}`,
|
|
173
168
|
roleArn: pipeRole.roleArn,
|
|
174
169
|
source: sourceQueue.queueArn,
|
|
@@ -30,16 +30,8 @@ class KmsManager {
|
|
|
30
30
|
if (!props)
|
|
31
31
|
throw `KMS Key props undefined for ${id}`;
|
|
32
32
|
const key = new aws_kms_1.Key(scope, `${id}`, {
|
|
33
|
-
|
|
33
|
+
...props,
|
|
34
34
|
alias: `${props.alias}-${scope.props.stage}`,
|
|
35
|
-
description: props.description,
|
|
36
|
-
enableKeyRotation: props.enableKeyRotation,
|
|
37
|
-
enabled: props.enabled,
|
|
38
|
-
keySpec: props.keySpec,
|
|
39
|
-
keyUsage: props.keyUsage,
|
|
40
|
-
pendingWindow: props.pendingWindow,
|
|
41
|
-
policy: props.policy,
|
|
42
|
-
removalPolicy: props.removalPolicy,
|
|
43
35
|
});
|
|
44
36
|
(0, utils_1.createCfnOutput)(`${id}-keyId`, scope, key.keyId);
|
|
45
37
|
(0, utils_1.createCfnOutput)(`${id}-keyArn`, scope, key.keyArn);
|