@gradientedge/cdk-utils-aws 1.0.1 → 2.1.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/README.md +31 -0
- package/dist/src/common/construct.d.ts +2 -2
- package/dist/src/common/construct.js +2 -2
- package/dist/src/common/resource-name-formatter.d.ts +1 -0
- package/dist/src/common/resource-name-formatter.js +1 -0
- package/dist/src/common/stack.d.ts +4 -3
- package/dist/src/common/stack.js +6 -5
- package/dist/src/common/types.d.ts +2 -0
- package/dist/src/construct/api-to-any-target/main.d.ts +2 -1
- package/dist/src/construct/api-to-any-target/main.js +3 -2
- package/dist/src/construct/api-to-any-target/target.d.ts +1 -0
- package/dist/src/construct/api-to-any-target/target.js +1 -0
- package/dist/src/construct/api-to-any-target/types.d.ts +4 -0
- package/dist/src/construct/api-to-eventbridge-target/api.d.ts +2 -1
- package/dist/src/construct/api-to-eventbridge-target/api.js +2 -1
- package/dist/src/construct/api-to-eventbridge-target/event.d.ts +2 -1
- package/dist/src/construct/api-to-eventbridge-target/event.js +2 -1
- package/dist/src/construct/api-to-eventbridge-target/main.d.ts +3 -2
- package/dist/src/construct/api-to-eventbridge-target/main.js +6 -5
- package/dist/src/construct/api-to-eventbridge-target/types.d.ts +8 -3
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +2 -1
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +2 -1
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.d.ts +3 -2
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.js +6 -5
- package/dist/src/construct/api-to-eventbridge-target-with-sns/types.d.ts +3 -1
- package/dist/src/construct/api-to-lambda-target/api.d.ts +2 -1
- package/dist/src/construct/api-to-lambda-target/api.js +2 -1
- package/dist/src/construct/api-to-lambda-target/main.d.ts +1 -0
- package/dist/src/construct/api-to-lambda-target/main.js +2 -1
- package/dist/src/construct/api-to-lambda-target/types.d.ts +5 -2
- package/dist/src/construct/application-configuration/main.d.ts +1 -0
- package/dist/src/construct/application-configuration/main.js +1 -0
- package/dist/src/construct/application-configuration/types.d.ts +1 -0
- package/dist/src/construct/event-handler/handler.d.ts +1 -0
- package/dist/src/construct/event-handler/handler.js +1 -0
- package/dist/src/construct/event-handler/main.d.ts +2 -1
- package/dist/src/construct/event-handler/main.js +2 -1
- package/dist/src/construct/event-handler/types.d.ts +2 -0
- package/dist/src/construct/lambda-with-iam-access/main.d.ts +2 -1
- package/dist/src/construct/lambda-with-iam-access/main.js +2 -1
- package/dist/src/construct/lambda-with-iam-access/types.d.ts +2 -0
- package/dist/src/construct/piped-event-handler/main.d.ts +2 -1
- package/dist/src/construct/piped-event-handler/main.js +2 -1
- package/dist/src/construct/piped-event-handler/types.d.ts +1 -0
- package/dist/src/construct/rest-api-lambda/main.d.ts +3 -2
- package/dist/src/construct/rest-api-lambda/main.js +3 -2
- package/dist/src/construct/rest-api-lambda/types.d.ts +3 -1
- package/dist/src/construct/rest-api-lambda-with-cache/main.d.ts +4 -3
- package/dist/src/construct/rest-api-lambda-with-cache/main.js +3 -2
- package/dist/src/construct/rest-api-lambda-with-cache/types.d.ts +1 -0
- package/dist/src/construct/site-with-ecs-backend/constants.d.ts +1 -0
- package/dist/src/construct/site-with-ecs-backend/constants.js +1 -0
- package/dist/src/construct/site-with-ecs-backend/main.d.ts +2 -1
- package/dist/src/construct/site-with-ecs-backend/main.js +5 -4
- package/dist/src/construct/site-with-ecs-backend/types.d.ts +7 -2
- package/dist/src/construct/site-with-lambda-backend/constants.d.ts +2 -0
- package/dist/src/construct/site-with-lambda-backend/constants.js +2 -0
- package/dist/src/construct/site-with-lambda-backend/main.d.ts +2 -1
- package/dist/src/construct/site-with-lambda-backend/main.js +5 -4
- package/dist/src/construct/site-with-lambda-backend/types.d.ts +5 -0
- package/dist/src/construct/static-asset-deployment/main.d.ts +2 -1
- package/dist/src/construct/static-asset-deployment/main.js +4 -3
- package/dist/src/construct/static-asset-deployment/types.d.ts +3 -0
- package/dist/src/construct/static-site/main.d.ts +2 -1
- package/dist/src/construct/static-site/main.js +3 -2
- package/dist/src/construct/static-site/types.d.ts +2 -1
- package/dist/src/services/api-gateway/main.d.ts +2 -1
- package/dist/src/services/api-gateway/main.js +4 -3
- package/dist/src/services/api-gateway/types.d.ts +2 -0
- package/dist/src/services/appconfig/constants.d.ts +2 -0
- package/dist/src/services/appconfig/constants.js +2 -0
- package/dist/src/services/appconfig/main.d.ts +2 -1
- package/dist/src/services/appconfig/main.js +8 -7
- package/dist/src/services/appconfig/types.d.ts +2 -0
- package/dist/src/services/certificate-manager/main.d.ts +13 -11
- package/dist/src/services/certificate-manager/main.js +14 -12
- package/dist/src/services/certificate-manager/types.d.ts +1 -0
- package/dist/src/services/cloudfront/main.d.ts +2 -1
- package/dist/src/services/cloudfront/main.js +6 -5
- package/dist/src/services/cloudfront/types.d.ts +2 -0
- package/dist/src/services/cloudtrail/main.d.ts +2 -1
- package/dist/src/services/cloudtrail/main.js +4 -3
- package/dist/src/services/cloudtrail/types.d.ts +1 -0
- package/dist/src/services/cloudwatch/logs.d.ts +2 -1
- package/dist/src/services/cloudwatch/logs.js +7 -6
- package/dist/src/services/cloudwatch/main.d.ts +2 -1
- package/dist/src/services/cloudwatch/main.js +29 -28
- package/dist/src/services/cloudwatch/types.d.ts +11 -0
- package/dist/src/services/codebuild/main.d.ts +2 -1
- package/dist/src/services/codebuild/main.js +2 -1
- package/dist/src/services/constants.d.ts +1 -0
- package/dist/src/services/constants.js +1 -0
- package/dist/src/services/dynamodb/main.d.ts +2 -1
- package/dist/src/services/dynamodb/main.js +6 -5
- package/dist/src/services/dynamodb/types.d.ts +2 -0
- package/dist/src/services/elastic-container-registry/main.d.ts +2 -1
- package/dist/src/services/elastic-container-registry/main.js +2 -1
- package/dist/src/services/elastic-container-service/main.d.ts +2 -1
- package/dist/src/services/elastic-container-service/main.js +8 -7
- package/dist/src/services/elastic-container-service/types.d.ts +6 -0
- package/dist/src/services/elastic-file-system/main.d.ts +4 -1
- package/dist/src/services/elastic-file-system/main.js +7 -4
- package/dist/src/services/elastic-file-system/types.d.ts +2 -0
- package/dist/src/services/elastic-kubernetes-service/main.d.ts +2 -1
- package/dist/src/services/elastic-kubernetes-service/main.js +4 -3
- package/dist/src/services/elastic-kubernetes-service/types.d.ts +1 -0
- package/dist/src/services/elasticache/main.d.ts +1 -0
- package/dist/src/services/elasticache/main.js +4 -3
- package/dist/src/services/elasticache/types.d.ts +2 -0
- package/dist/src/services/eventbridge/main.d.ts +3 -2
- package/dist/src/services/eventbridge/main.js +18 -17
- package/dist/src/services/eventbridge/target.d.ts +6 -5
- package/dist/src/services/eventbridge/target.js +4 -4
- package/dist/src/services/eventbridge/types.d.ts +6 -0
- package/dist/src/services/evidently/main.d.ts +2 -1
- package/dist/src/services/evidently/main.js +11 -10
- package/dist/src/services/evidently/types.d.ts +5 -0
- package/dist/src/services/identity-access-management/main.d.ts +2 -1
- package/dist/src/services/identity-access-management/main.js +2 -1
- package/dist/src/services/key-management-service/main.d.ts +2 -1
- package/dist/src/services/key-management-service/main.js +4 -3
- package/dist/src/services/key-management-service/types.d.ts +1 -0
- package/dist/src/services/lambda/main.d.ts +2 -1
- package/dist/src/services/lambda/main.js +7 -6
- package/dist/src/services/lambda/types.d.ts +7 -0
- package/dist/src/services/route53/main.d.ts +2 -1
- package/dist/src/services/route53/main.js +7 -6
- package/dist/src/services/route53/types.d.ts +1 -0
- package/dist/src/services/secrets-manager/main.d.ts +2 -1
- package/dist/src/services/secrets-manager/main.js +5 -4
- package/dist/src/services/secrets-manager/types.d.ts +1 -0
- package/dist/src/services/simple-notification-service/main.d.ts +2 -1
- package/dist/src/services/simple-notification-service/main.js +6 -5
- package/dist/src/services/simple-notification-service/types.d.ts +1 -0
- package/dist/src/services/simple-queue-service/main.d.ts +2 -1
- package/dist/src/services/simple-queue-service/main.js +4 -3
- package/dist/src/services/simple-queue-service/types.d.ts +1 -0
- package/dist/src/services/simple-storage-service/main.d.ts +2 -1
- package/dist/src/services/simple-storage-service/main.js +5 -4
- package/dist/src/services/simple-storage-service/types.d.ts +3 -0
- package/dist/src/services/step-function/main.d.ts +2 -1
- package/dist/src/services/step-function/main.js +17 -16
- package/dist/src/services/step-function/types.d.ts +16 -0
- package/dist/src/services/systems-manager/main.d.ts +4 -2
- package/dist/src/services/systems-manager/main.js +12 -10
- package/dist/src/services/systems-manager/types.d.ts +2 -0
- package/dist/src/services/virtual-private-cloud/ipv6.d.ts +1 -0
- package/dist/src/services/virtual-private-cloud/ipv6.js +1 -0
- package/dist/src/services/virtual-private-cloud/main.d.ts +2 -1
- package/dist/src/services/virtual-private-cloud/main.js +4 -3
- package/dist/src/services/virtual-private-cloud/types.d.ts +1 -0
- package/dist/src/services/web-application-firewall/main.d.ts +2 -1
- package/dist/src/services/web-application-firewall/main.js +6 -5
- package/dist/src/services/web-application-firewall/types.d.ts +2 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.js +4 -0
- package/package.json +17 -5
|
@@ -14,7 +14,7 @@ var CloudWatchWidgetType;
|
|
|
14
14
|
CloudWatchWidgetType["LogQuery"] = "LogQuery";
|
|
15
15
|
})(CloudWatchWidgetType || (CloudWatchWidgetType = {}));
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Provides operations on AWS CloudWatch.
|
|
18
18
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
19
19
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
20
20
|
* @example
|
|
@@ -28,6 +28,7 @@ var CloudWatchWidgetType;
|
|
|
28
28
|
* }
|
|
29
29
|
* }
|
|
30
30
|
* @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch-readme.html}
|
|
31
|
+
* @category Service
|
|
31
32
|
*/
|
|
32
33
|
export class CloudWatchManager {
|
|
33
34
|
/**
|
|
@@ -38,11 +39,11 @@ export class CloudWatchManager {
|
|
|
38
39
|
*/
|
|
39
40
|
createAlarmForExpression(id, scope, props) {
|
|
40
41
|
if (!props)
|
|
41
|
-
throw `Alarm props undefined for ${id}
|
|
42
|
+
throw new Error(`Alarm props undefined for ${id}`);
|
|
42
43
|
if (!props.expression)
|
|
43
|
-
throw `Could not find expression for Alarm props for id:${id}
|
|
44
|
+
throw new Error(`Could not find expression for Alarm props for id:${id}`);
|
|
44
45
|
if (!props.metricProps)
|
|
45
|
-
throw `Could not find metricProps for Alarm props for id:${id}
|
|
46
|
+
throw new Error(`Could not find metricProps for Alarm props for id:${id}`);
|
|
46
47
|
const metrics = {};
|
|
47
48
|
_.map(this.determineMetrics(scope, props.metricProps), (metric, index) => {
|
|
48
49
|
metrics[`m${index}`] = metric;
|
|
@@ -69,7 +70,7 @@ export class CloudWatchManager {
|
|
|
69
70
|
*/
|
|
70
71
|
createAlarmForMetric(id, scope, props, metric) {
|
|
71
72
|
if (!props)
|
|
72
|
-
throw `Alarm props undefined for ${id}
|
|
73
|
+
throw new Error(`Alarm props undefined for ${id}`);
|
|
73
74
|
const alarm = metric.createAlarm(scope, `${id}`, {
|
|
74
75
|
...props,
|
|
75
76
|
});
|
|
@@ -86,9 +87,9 @@ export class CloudWatchManager {
|
|
|
86
87
|
*/
|
|
87
88
|
createDashboard(id, scope, props, widgets) {
|
|
88
89
|
if (!props)
|
|
89
|
-
throw `Dashboard props undefined for ${id}
|
|
90
|
+
throw new Error(`Dashboard props undefined for ${id}`);
|
|
90
91
|
if (!props.dashboardName)
|
|
91
|
-
throw `Dashboard dashboardName undefined for ${id}
|
|
92
|
+
throw new Error(`Dashboard dashboardName undefined for ${id}`);
|
|
92
93
|
const dashboard = new watch.Dashboard(scope, `${id}`, {
|
|
93
94
|
...props,
|
|
94
95
|
dashboardName: scope.resourceNameFormatter.format(props.dashboardName, scope.props.resourceNameOptions?.cloudwatch),
|
|
@@ -105,8 +106,8 @@ export class CloudWatchManager {
|
|
|
105
106
|
* @param props
|
|
106
107
|
*/
|
|
107
108
|
createWidgets(scope, props) {
|
|
108
|
-
if (!props || props.length
|
|
109
|
-
throw `Widget props undefined
|
|
109
|
+
if (!props || props.length === 0)
|
|
110
|
+
throw new Error(`Widget props undefined`);
|
|
110
111
|
const widgets = [];
|
|
111
112
|
_.forEach(props, (widgetProps) => {
|
|
112
113
|
widgets.push(this.createWidget(widgetProps.id, scope, widgetProps));
|
|
@@ -121,7 +122,7 @@ export class CloudWatchManager {
|
|
|
121
122
|
*/
|
|
122
123
|
createWidget(id, scope, props) {
|
|
123
124
|
if (!props)
|
|
124
|
-
throw `Widget props undefined for ${id}
|
|
125
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
125
126
|
const metrics = this.determineMetrics(scope, props.metricProps);
|
|
126
127
|
let alarms, logGroupNames = [];
|
|
127
128
|
switch (props.type) {
|
|
@@ -140,7 +141,7 @@ export class CloudWatchManager {
|
|
|
140
141
|
logGroupNames = props.logGroupNames.map((name) => `${name}-${scope.props.stage}`);
|
|
141
142
|
return this.createLogQueryWidget(id, scope, props, logGroupNames);
|
|
142
143
|
default:
|
|
143
|
-
throw `Unsupported widget type ${props.type}
|
|
144
|
+
throw new Error(`Unsupported widget type ${props.type}`);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
@@ -152,7 +153,7 @@ export class CloudWatchManager {
|
|
|
152
153
|
*/
|
|
153
154
|
createCloudfrontDistributionWidget(id, scope, props, distributionId) {
|
|
154
155
|
if (!props)
|
|
155
|
-
throw `Widget props undefined for ${id}
|
|
156
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
156
157
|
const metricProps = props.metricProps;
|
|
157
158
|
return this.createWidget(id, scope, {
|
|
158
159
|
...props,
|
|
@@ -168,7 +169,7 @@ export class CloudWatchManager {
|
|
|
168
169
|
*/
|
|
169
170
|
createStateWidget(id, scope, props, stateMachineArn) {
|
|
170
171
|
if (!props)
|
|
171
|
-
throw `Widget props undefined for ${id}
|
|
172
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
172
173
|
const metricProps = props.metricProps;
|
|
173
174
|
return this.createWidget(id, scope, {
|
|
174
175
|
...props,
|
|
@@ -185,7 +186,7 @@ export class CloudWatchManager {
|
|
|
185
186
|
*/
|
|
186
187
|
createEventWidget(id, scope, props, eventBusName, ruleName) {
|
|
187
188
|
if (!props)
|
|
188
|
-
throw `Widget props undefined for ${id}
|
|
189
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
189
190
|
const metricProps = props.metricProps;
|
|
190
191
|
return this.createWidget(id, scope, {
|
|
191
192
|
...props,
|
|
@@ -201,7 +202,7 @@ export class CloudWatchManager {
|
|
|
201
202
|
*/
|
|
202
203
|
createApiGatewayWidget(id, scope, props, apiName) {
|
|
203
204
|
if (!props)
|
|
204
|
-
throw `Widget props undefined for ${id}
|
|
205
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
205
206
|
const metricProps = props.metricProps;
|
|
206
207
|
return this.createWidget(id, scope, {
|
|
207
208
|
...props,
|
|
@@ -217,7 +218,7 @@ export class CloudWatchManager {
|
|
|
217
218
|
*/
|
|
218
219
|
createLambdaWidget(id, scope, props, functionName) {
|
|
219
220
|
if (!props)
|
|
220
|
-
throw `Widget props undefined for ${id}
|
|
221
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
221
222
|
const metricProps = props.metricProps;
|
|
222
223
|
return this.createWidget(id, scope, {
|
|
223
224
|
...props,
|
|
@@ -233,7 +234,7 @@ export class CloudWatchManager {
|
|
|
233
234
|
*/
|
|
234
235
|
createCustomWidget(id, scope, props, service) {
|
|
235
236
|
if (!props)
|
|
236
|
-
throw `Widget props undefined for ${id}
|
|
237
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
237
238
|
const metricProps = props.metricProps;
|
|
238
239
|
return this.createWidget(id, scope, {
|
|
239
240
|
...props,
|
|
@@ -249,7 +250,7 @@ export class CloudWatchManager {
|
|
|
249
250
|
*/
|
|
250
251
|
createEcsClusterWidget(id, scope, props, clusterName) {
|
|
251
252
|
if (!props)
|
|
252
|
-
throw `Widget props undefined for ${id}
|
|
253
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
253
254
|
const metricProps = props.metricProps;
|
|
254
255
|
return this.createWidget(id, scope, {
|
|
255
256
|
...props,
|
|
@@ -266,7 +267,7 @@ export class CloudWatchManager {
|
|
|
266
267
|
*/
|
|
267
268
|
createEcsServiceWidget(id, scope, props, clusterName, serviceName) {
|
|
268
269
|
if (!props)
|
|
269
|
-
throw `Widget props undefined for ${id}
|
|
270
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
270
271
|
const metricProps = props.metricProps;
|
|
271
272
|
return this.createWidget(id, scope, {
|
|
272
273
|
...props,
|
|
@@ -282,7 +283,7 @@ export class CloudWatchManager {
|
|
|
282
283
|
*/
|
|
283
284
|
createElbWidget(id, scope, props, loadBalancer) {
|
|
284
285
|
if (!props)
|
|
285
|
-
throw `Widget props undefined for ${id}
|
|
286
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
286
287
|
const metricProps = props.metricProps;
|
|
287
288
|
return this.createWidget(id, scope, {
|
|
288
289
|
...props,
|
|
@@ -298,7 +299,7 @@ export class CloudWatchManager {
|
|
|
298
299
|
*/
|
|
299
300
|
createCacheWidget(id, scope, props, cacheClusterId) {
|
|
300
301
|
if (!props)
|
|
301
|
-
throw `Widget props undefined for ${id}
|
|
302
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
302
303
|
const metricProps = props.metricProps;
|
|
303
304
|
return this.createWidget(id, scope, {
|
|
304
305
|
...props,
|
|
@@ -313,7 +314,7 @@ export class CloudWatchManager {
|
|
|
313
314
|
*/
|
|
314
315
|
createTextWidget(id, scope, props) {
|
|
315
316
|
if (!props)
|
|
316
|
-
throw `Widget props undefined for ${id}
|
|
317
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
317
318
|
const widget = new watch.TextWidget({
|
|
318
319
|
...props,
|
|
319
320
|
});
|
|
@@ -330,7 +331,7 @@ export class CloudWatchManager {
|
|
|
330
331
|
*/
|
|
331
332
|
createSingleValueWidget(id, scope, props, metrics) {
|
|
332
333
|
if (!props)
|
|
333
|
-
throw `Widget props undefined for ${id}
|
|
334
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
334
335
|
const widget = new watch.SingleValueWidget({
|
|
335
336
|
...props,
|
|
336
337
|
metrics,
|
|
@@ -349,7 +350,7 @@ export class CloudWatchManager {
|
|
|
349
350
|
*/
|
|
350
351
|
createGuageWidget(id, scope, props, metrics) {
|
|
351
352
|
if (!props)
|
|
352
|
-
throw `Widget props undefined for ${id}
|
|
353
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
353
354
|
const widget = new watch.GaugeWidget({
|
|
354
355
|
...props,
|
|
355
356
|
metrics,
|
|
@@ -369,7 +370,7 @@ export class CloudWatchManager {
|
|
|
369
370
|
*/
|
|
370
371
|
createGraphWidget(id, scope, props, leftYMetrics, rightYMetrics) {
|
|
371
372
|
if (!props)
|
|
372
|
-
throw `Widget props undefined for ${id}
|
|
373
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
373
374
|
const widget = new watch.GraphWidget({
|
|
374
375
|
...props,
|
|
375
376
|
left: leftYMetrics,
|
|
@@ -389,7 +390,7 @@ export class CloudWatchManager {
|
|
|
389
390
|
*/
|
|
390
391
|
createAlarmStatusWidget(id, scope, props, alarms) {
|
|
391
392
|
if (!props)
|
|
392
|
-
throw `Widget props undefined for ${id}
|
|
393
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
393
394
|
const widget = new watch.AlarmStatusWidget({
|
|
394
395
|
...props,
|
|
395
396
|
alarms,
|
|
@@ -407,7 +408,7 @@ export class CloudWatchManager {
|
|
|
407
408
|
*/
|
|
408
409
|
createLogQueryWidget(id, scope, props, logGroupNames) {
|
|
409
410
|
if (!props)
|
|
410
|
-
throw `Widget props undefined for ${id}
|
|
411
|
+
throw new Error(`Widget props undefined for ${id}`);
|
|
411
412
|
const widget = new watch.LogQueryWidget({
|
|
412
413
|
...props,
|
|
413
414
|
logGroupNames,
|
|
@@ -541,7 +542,7 @@ export class CloudWatchManager {
|
|
|
541
542
|
if (alarmProps) {
|
|
542
543
|
_.forEach(alarmProps, (alarmProp) => {
|
|
543
544
|
if (!alarmProp.alarmName)
|
|
544
|
-
throw `Alarm name undefined for ${id}
|
|
545
|
+
throw new Error(`Alarm name undefined for ${id}`);
|
|
545
546
|
const alarmArn = `arn:aws:cloudwatch:${cdk.Stack.of(scope).region}:${cdk.Stack.of(scope).account}:alarm:${alarmProp.alarmName}`;
|
|
546
547
|
const alarm = watch.Alarm.fromAlarmArn(scope, `${alarmProp.alarmName}`, alarmArn);
|
|
547
548
|
alarms.push(alarm);
|
|
@@ -3,6 +3,7 @@ import * as logs from 'aws-cdk-lib/aws-logs';
|
|
|
3
3
|
import { TagProps } from '../../types/index.js';
|
|
4
4
|
/**
|
|
5
5
|
*/
|
|
6
|
+
/** @category Interface */
|
|
6
7
|
export interface AlarmProps extends watch.AlarmProps {
|
|
7
8
|
expression?: string;
|
|
8
9
|
metricProps?: MetricProps[];
|
|
@@ -10,10 +11,12 @@ export interface AlarmProps extends watch.AlarmProps {
|
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
*/
|
|
14
|
+
/** @category Interface */
|
|
13
15
|
export interface DashboardProps extends watch.DashboardProps {
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
*/
|
|
19
|
+
/** @category Interface */
|
|
17
20
|
export interface MetricProps extends watch.MetricProps {
|
|
18
21
|
apiName?: string;
|
|
19
22
|
cacheClusterId?: string;
|
|
@@ -32,6 +35,7 @@ export interface MetricProps extends watch.MetricProps {
|
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
*/
|
|
38
|
+
/** @category Interface */
|
|
35
39
|
export interface TextWidgetProps extends watch.TextWidgetProps {
|
|
36
40
|
positionX: number;
|
|
37
41
|
positionY: number;
|
|
@@ -39,6 +43,7 @@ export interface TextWidgetProps extends watch.TextWidgetProps {
|
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
*/
|
|
46
|
+
/** @category Interface */
|
|
42
47
|
export interface NumericWidgetProps extends watch.SingleValueWidgetProps {
|
|
43
48
|
metricProps: watch.MetricProps[];
|
|
44
49
|
positionX: number;
|
|
@@ -47,6 +52,7 @@ export interface NumericWidgetProps extends watch.SingleValueWidgetProps {
|
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
*/
|
|
55
|
+
/** @category Interface */
|
|
50
56
|
export interface GuageWidgetProps extends watch.GaugeWidgetProps {
|
|
51
57
|
metricProps: watch.MetricProps[];
|
|
52
58
|
positionX: number;
|
|
@@ -55,6 +61,7 @@ export interface GuageWidgetProps extends watch.GaugeWidgetProps {
|
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
63
|
*/
|
|
64
|
+
/** @category Interface */
|
|
58
65
|
export interface GraphWidgetProps extends watch.GraphWidgetProps {
|
|
59
66
|
metricProps: MetricProps[];
|
|
60
67
|
positionX: number;
|
|
@@ -63,6 +70,7 @@ export interface GraphWidgetProps extends watch.GraphWidgetProps {
|
|
|
63
70
|
}
|
|
64
71
|
/**
|
|
65
72
|
*/
|
|
73
|
+
/** @category Interface */
|
|
66
74
|
export interface AlarmStatusWidgetProps extends watch.AlarmStatusWidgetProps {
|
|
67
75
|
alarmProps: watch.AlarmProps[];
|
|
68
76
|
positionX: number;
|
|
@@ -71,6 +79,7 @@ export interface AlarmStatusWidgetProps extends watch.AlarmStatusWidgetProps {
|
|
|
71
79
|
}
|
|
72
80
|
/**
|
|
73
81
|
*/
|
|
82
|
+
/** @category Interface */
|
|
74
83
|
export interface LogQueryWidgetProps extends watch.LogQueryWidgetProps {
|
|
75
84
|
positionX: number;
|
|
76
85
|
positionY: number;
|
|
@@ -78,12 +87,14 @@ export interface LogQueryWidgetProps extends watch.LogQueryWidgetProps {
|
|
|
78
87
|
}
|
|
79
88
|
/**
|
|
80
89
|
*/
|
|
90
|
+
/** @category Interface */
|
|
81
91
|
export interface MetricFilterProps extends logs.MetricFilterProps {
|
|
82
92
|
options: watch.MetricOptions;
|
|
83
93
|
periodInSecs: number;
|
|
84
94
|
}
|
|
85
95
|
/**
|
|
86
96
|
*/
|
|
97
|
+
/** @category Interface */
|
|
87
98
|
export interface LogProps extends logs.LogGroupProps {
|
|
88
99
|
tags?: TagProps[];
|
|
89
100
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Project } from 'aws-cdk-lib/aws-codebuild';
|
|
2
2
|
import { CommonConstruct } from '../../common/index.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Provides operations on AWS Code Build.
|
|
5
5
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
6
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
7
|
* @example
|
|
@@ -15,6 +15,7 @@ import { CommonConstruct } from '../../common/index.js';
|
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* @see [CDK Codebuild Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html}
|
|
18
|
+
* @category Service
|
|
18
19
|
*/
|
|
19
20
|
export declare class CodeBuildManager {
|
|
20
21
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Duration } from 'aws-cdk-lib';
|
|
2
2
|
import { BuildSpec, ComputeType, LinuxBuildImage, Project } from 'aws-cdk-lib/aws-codebuild';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Provides operations on AWS Code Build.
|
|
5
5
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
6
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
7
|
* @example
|
|
@@ -15,6 +15,7 @@ import { BuildSpec, ComputeType, LinuxBuildImage, Project } from 'aws-cdk-lib/aw
|
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* @see [CDK Codebuild Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html}
|
|
18
|
+
* @category Service
|
|
18
19
|
*/
|
|
19
20
|
export class CodeBuildManager {
|
|
20
21
|
/**
|
|
@@ -2,7 +2,7 @@ import { Table, TableV2 } from 'aws-cdk-lib/aws-dynamodb';
|
|
|
2
2
|
import { CommonConstruct } from '../../common/index.js';
|
|
3
3
|
import { TableProps, TablePropsV2 } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Provides operations on AWS DynamoDB
|
|
6
6
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
7
7
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
8
8
|
* @example
|
|
@@ -16,6 +16,7 @@ import { TableProps, TablePropsV2 } from './types.js';
|
|
|
16
16
|
* }
|
|
17
17
|
* }
|
|
18
18
|
* @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb-readme.html}
|
|
19
|
+
* @category Service
|
|
19
20
|
*/
|
|
20
21
|
export declare class DynamodbManager {
|
|
21
22
|
/**
|
|
@@ -3,7 +3,7 @@ import { BillingMode, Table, TableV2, TableEncryption } from 'aws-cdk-lib/aws-dy
|
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { createCfnOutput } from '../../utils/index.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Provides operations on AWS DynamoDB
|
|
7
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
8
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
9
9
|
* @example
|
|
@@ -17,6 +17,7 @@ import { createCfnOutput } from '../../utils/index.js';
|
|
|
17
17
|
* }
|
|
18
18
|
* }
|
|
19
19
|
* @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb-readme.html}
|
|
20
|
+
* @category Service
|
|
20
21
|
*/
|
|
21
22
|
export class DynamodbManager {
|
|
22
23
|
/**
|
|
@@ -27,9 +28,9 @@ export class DynamodbManager {
|
|
|
27
28
|
*/
|
|
28
29
|
createTable(id, scope, props) {
|
|
29
30
|
if (!props)
|
|
30
|
-
throw `Table props undefined for ${id}
|
|
31
|
+
throw new Error(`Table props undefined for ${id}`);
|
|
31
32
|
if (!props.tableName)
|
|
32
|
-
throw `Table tableName undefined for ${id}
|
|
33
|
+
throw new Error(`Table tableName undefined for ${id}`);
|
|
33
34
|
const table = new Table(scope, `${id}`, {
|
|
34
35
|
...props,
|
|
35
36
|
billingMode: props.billingMode ?? BillingMode.PAY_PER_REQUEST,
|
|
@@ -53,9 +54,9 @@ export class DynamodbManager {
|
|
|
53
54
|
*/
|
|
54
55
|
createTableV2(id, scope, props) {
|
|
55
56
|
if (!props)
|
|
56
|
-
throw `Table props undefined for ${id}
|
|
57
|
+
throw new Error(`Table props undefined for ${id}`);
|
|
57
58
|
if (!props.tableName)
|
|
58
|
-
throw `Table tableName undefined for ${id}
|
|
59
|
+
throw new Error(`Table tableName undefined for ${id}`);
|
|
59
60
|
const table = new TableV2(scope, `${id}`, {
|
|
60
61
|
...props,
|
|
61
62
|
tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
|
|
@@ -2,9 +2,11 @@ import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
|
2
2
|
import { TagProps } from '../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
*/
|
|
5
|
+
/** @category Interface */
|
|
5
6
|
export interface TableProps extends dynamodb.TableProps {
|
|
6
7
|
tags?: TagProps[];
|
|
7
8
|
}
|
|
9
|
+
/** @category Interface */
|
|
8
10
|
export interface TablePropsV2 extends dynamodb.TablePropsV2 {
|
|
9
11
|
tags?: TagProps[];
|
|
10
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
|
|
2
2
|
import { CommonConstruct } from '../../common/index.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Provides operations on AWS Elastic Container Registry.
|
|
5
5
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
6
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
7
|
* @example
|
|
@@ -15,6 +15,7 @@ import { CommonConstruct } from '../../common/index.js';
|
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
18
|
+
* @category Service
|
|
18
19
|
*/
|
|
19
20
|
export declare class EcrManager {
|
|
20
21
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
|
|
2
2
|
import { createCfnOutput } from '../../utils/index.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Provides operations on AWS Elastic Container Registry.
|
|
5
5
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
6
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
7
|
* @example
|
|
@@ -15,6 +15,7 @@ import { createCfnOutput } from '../../utils/index.js';
|
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
18
|
+
* @category Service
|
|
18
19
|
*/
|
|
19
20
|
export class EcrManager {
|
|
20
21
|
/**
|
|
@@ -6,7 +6,7 @@ import { ILogGroup } from 'aws-cdk-lib/aws-logs';
|
|
|
6
6
|
import { CommonConstruct } from '../../common/index.js';
|
|
7
7
|
import { EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EcsTaskProps } from './types.js';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Provides operations on AWS Elastic Container Service.
|
|
10
10
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
11
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
12
12
|
* @example
|
|
@@ -20,6 +20,7 @@ import { EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EcsTask
|
|
|
20
20
|
* }
|
|
21
21
|
* }
|
|
22
22
|
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
23
|
+
* @category Service
|
|
23
24
|
*/
|
|
24
25
|
export declare class EcsManager {
|
|
25
26
|
/**
|
|
@@ -4,7 +4,7 @@ import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patte
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import { createCfnOutput } from '../../utils/index.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Provides operations on AWS Elastic Container Service.
|
|
8
8
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
9
9
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
10
10
|
* @example
|
|
@@ -18,6 +18,7 @@ import { createCfnOutput } from '../../utils/index.js';
|
|
|
18
18
|
* }
|
|
19
19
|
* }
|
|
20
20
|
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
21
|
+
* @category Service
|
|
21
22
|
*/
|
|
22
23
|
export class EcsManager {
|
|
23
24
|
/**
|
|
@@ -29,7 +30,7 @@ export class EcsManager {
|
|
|
29
30
|
*/
|
|
30
31
|
createEcsCluster(id, scope, props, vpc) {
|
|
31
32
|
if (!props)
|
|
32
|
-
throw `Ecs Cluster props undefined for ${id}
|
|
33
|
+
throw new Error(`Ecs Cluster props undefined for ${id}`);
|
|
33
34
|
const ecsCluster = new Cluster(scope, `${id}`, {
|
|
34
35
|
...props,
|
|
35
36
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
@@ -59,7 +60,7 @@ export class EcsManager {
|
|
|
59
60
|
*/
|
|
60
61
|
createEcsFargateTask(id, scope, props, cluster, role, logGroup, containerImage, environment, secrets, command) {
|
|
61
62
|
if (!props)
|
|
62
|
-
throw `EcsTask props undefined for ${id}
|
|
63
|
+
throw new Error(`EcsTask props undefined for ${id}`);
|
|
63
64
|
const ecsTask = new TaskDefinition(scope, `${id}`, {
|
|
64
65
|
...props,
|
|
65
66
|
compatibility: Compatibility.FARGATE,
|
|
@@ -106,13 +107,13 @@ export class EcsManager {
|
|
|
106
107
|
*/
|
|
107
108
|
createLoadBalancedFargateService(id, scope, props, cluster, logGroup) {
|
|
108
109
|
if (!props)
|
|
109
|
-
throw `Ecs Load balanced Fargate Service props undefined for ${id}
|
|
110
|
+
throw new Error(`Ecs Load balanced Fargate Service props undefined for ${id}`);
|
|
110
111
|
if (!props.loadBalancerName)
|
|
111
|
-
throw `Ecs loadBalancerName undefined for ${id}
|
|
112
|
+
throw new Error(`Ecs loadBalancerName undefined for ${id}`);
|
|
112
113
|
if (!props.serviceName)
|
|
113
|
-
throw `Ecs serviceName undefined for ${id}
|
|
114
|
+
throw new Error(`Ecs serviceName undefined for ${id}`);
|
|
114
115
|
if (!props.taskImageOptions)
|
|
115
|
-
throw `TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}
|
|
116
|
+
throw new Error(`TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}`);
|
|
116
117
|
const fargateService = new ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
|
|
117
118
|
...props,
|
|
118
119
|
assignPublicIp: props.assignPublicIp ?? true,
|
|
@@ -5,15 +5,18 @@ import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalanc
|
|
|
5
5
|
import { TagProps } from '../../types/index.js';
|
|
6
6
|
/**
|
|
7
7
|
*/
|
|
8
|
+
/** @category Interface */
|
|
8
9
|
export interface EcsClusterProps extends ClusterProps {
|
|
9
10
|
tags?: TagProps[];
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
*/
|
|
14
|
+
/** @category Interface */
|
|
13
15
|
export interface EcsTaskProps extends TaskDefinitionProps {
|
|
14
16
|
logging?: AwsLogDriverProps;
|
|
15
17
|
tags?: TagProps[];
|
|
16
18
|
}
|
|
19
|
+
/** @category Interface */
|
|
17
20
|
export interface EcsScalingProps {
|
|
18
21
|
maxCapacity?: number;
|
|
19
22
|
minCapacity?: number;
|
|
@@ -24,6 +27,7 @@ export interface EcsScalingProps {
|
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
*/
|
|
30
|
+
/** @category Interface */
|
|
27
31
|
export interface HealthCheck extends ElbHealthCheck {
|
|
28
32
|
intervalInSecs: number;
|
|
29
33
|
timeoutInSecs: number;
|
|
@@ -31,12 +35,14 @@ export interface HealthCheck extends ElbHealthCheck {
|
|
|
31
35
|
/**
|
|
32
36
|
*
|
|
33
37
|
*/
|
|
38
|
+
/** @category Interface */
|
|
34
39
|
export interface EcsApplicationLoadBalancedFargateServiceHealthCheck extends FargateHealthCheck {
|
|
35
40
|
intervalInSecs: number;
|
|
36
41
|
timeoutInSecs: number;
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
*/
|
|
45
|
+
/** @category Interface */
|
|
40
46
|
export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
|
|
41
47
|
healthCheck?: EcsApplicationLoadBalancedFargateServiceHealthCheck;
|
|
42
48
|
logging?: AwsLogDriverProps;
|
|
@@ -2,17 +2,19 @@ import { ISecurityGroup, IVpc, SubnetSelection } from 'aws-cdk-lib/aws-ec2';
|
|
|
2
2
|
import { FileSystem } from 'aws-cdk-lib/aws-efs';
|
|
3
3
|
import { CommonConstruct } from '../../common/index.js';
|
|
4
4
|
import { EfsAccessPointOptions, EfsFileSystemProps } from './types.js';
|
|
5
|
+
/** @category Constant */
|
|
5
6
|
export declare const DEFAULT_CREATE_ACL: {
|
|
6
7
|
ownerGid: string;
|
|
7
8
|
ownerUid: string;
|
|
8
9
|
permissions: string;
|
|
9
10
|
};
|
|
11
|
+
/** @category Constant */
|
|
10
12
|
export declare const DEFAULT_POSIX_USER: {
|
|
11
13
|
gid: string;
|
|
12
14
|
uid: string;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
17
|
+
* Provides operations on AWS Elastic File System.
|
|
16
18
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
17
19
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
18
20
|
* @example
|
|
@@ -26,6 +28,7 @@ export declare const DEFAULT_POSIX_USER: {
|
|
|
26
28
|
* }
|
|
27
29
|
* }
|
|
28
30
|
* @see [CDK EFS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs-readme.html}
|
|
31
|
+
* @category Service
|
|
29
32
|
*/
|
|
30
33
|
export declare class EfsManager {
|
|
31
34
|
/**
|
|
@@ -2,17 +2,19 @@ import { RemovalPolicy } from 'aws-cdk-lib';
|
|
|
2
2
|
import { FileSystem, LifecyclePolicy, OutOfInfrequentAccessPolicy, PerformanceMode } from 'aws-cdk-lib/aws-efs';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { createCfnOutput } from '../../utils/index.js';
|
|
5
|
+
/** @category Constant */
|
|
5
6
|
export const DEFAULT_CREATE_ACL = {
|
|
6
7
|
ownerGid: '1000',
|
|
7
8
|
ownerUid: '1000',
|
|
8
9
|
permissions: '755',
|
|
9
10
|
};
|
|
11
|
+
/** @category Constant */
|
|
10
12
|
export const DEFAULT_POSIX_USER = {
|
|
11
13
|
gid: '1000',
|
|
12
14
|
uid: '1000',
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
17
|
+
* Provides operations on AWS Elastic File System.
|
|
16
18
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
17
19
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
18
20
|
* @example
|
|
@@ -26,6 +28,7 @@ export const DEFAULT_POSIX_USER = {
|
|
|
26
28
|
* }
|
|
27
29
|
* }
|
|
28
30
|
* @see [CDK EFS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs-readme.html}
|
|
31
|
+
* @category Service
|
|
29
32
|
*/
|
|
30
33
|
export class EfsManager {
|
|
31
34
|
/**
|
|
@@ -40,9 +43,9 @@ export class EfsManager {
|
|
|
40
43
|
*/
|
|
41
44
|
createFileSystem(id, scope, props, vpc, accessPointOptions, securityGroup, vpcSubnets) {
|
|
42
45
|
if (!props)
|
|
43
|
-
throw `EFS props undefined for ${id}
|
|
46
|
+
throw new Error(`EFS props undefined for ${id}`);
|
|
44
47
|
if (!props.fileSystemName)
|
|
45
|
-
throw `EFS fileSystemName undefined for ${id}
|
|
48
|
+
throw new Error(`EFS fileSystemName undefined for ${id}`);
|
|
46
49
|
const fileSystemId = props.provisionNewOnDeployment ? `${id}-${new Date().getMilliseconds()}` : `${id}`;
|
|
47
50
|
const fileSystem = new FileSystem(scope, `${fileSystemId}`, {
|
|
48
51
|
...props,
|
|
@@ -61,7 +64,7 @@ export class EfsManager {
|
|
|
61
64
|
if (accessPointOptions && !_.isEmpty(accessPointOptions)) {
|
|
62
65
|
for (const [index, accessPointOption] of accessPointOptions.entries()) {
|
|
63
66
|
if (!accessPointOption.path)
|
|
64
|
-
throw `Undefined access point path for option: [${accessPointOption}], id: [${id}]
|
|
67
|
+
throw new Error(`Undefined access point path for option: [${accessPointOption}], id: [${id}]`);
|
|
65
68
|
const accessPoint = fileSystem.addAccessPoint(`${id}-ap-${index}`, {
|
|
66
69
|
createAcl: accessPointOption.createAcl ?? DEFAULT_CREATE_ACL,
|
|
67
70
|
path: accessPointOption.path,
|
|
@@ -2,6 +2,7 @@ import { AuthorizationConfig } from 'aws-cdk-lib/aws-ecs';
|
|
|
2
2
|
import { AccessPointOptions, FileSystemProps } from 'aws-cdk-lib/aws-efs';
|
|
3
3
|
/**
|
|
4
4
|
*/
|
|
5
|
+
/** @category Interface */
|
|
5
6
|
export interface EfsFileSystemProps extends FileSystemProps {
|
|
6
7
|
authorizationConfig?: AuthorizationConfig;
|
|
7
8
|
provisionNewOnDeployment?: boolean;
|
|
@@ -11,5 +12,6 @@ export interface EfsFileSystemProps extends FileSystemProps {
|
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
*/
|
|
15
|
+
/** @category Interface */
|
|
14
16
|
export interface EfsAccessPointOptions extends AccessPointOptions {
|
|
15
17
|
}
|