@gradientedge/cdk-utils 6.0.0 → 6.0.1
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/dist/src/lib/construct/api-to-eventbridge-target/main.js +5 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +2 -2
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -1
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +1 -1
- package/dist/src/lib/manager/aws/ecs-manager.js +5 -0
- package/package.json +1 -1
- package/src/lib/construct/api-to-eventbridge-target/main.ts +5 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +2 -2
- package/src/lib/construct/graphql-api-lambda/main.ts +1 -1
- package/src/lib/construct/site-with-ecs-backend/main.ts +1 -1
- package/src/lib/manager/aws/ecs-manager.ts +5 -0
|
@@ -351,11 +351,12 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
353
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
354
|
-
logGroupName: `/custom/api/${this.id}-rest-api-access
|
|
354
|
+
logGroupName: `/custom/api/${this.id}-rest-api-access`,
|
|
355
355
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
356
356
|
});
|
|
357
357
|
this.apiToEventBridgeTargetRestApi.api = new apig.RestApi(this, `${this.id}-rest-api`, {
|
|
358
358
|
...{
|
|
359
|
+
cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
|
|
359
360
|
defaultIntegration: this.apiToEventBridgeTargetRestApi.integration,
|
|
360
361
|
defaultMethodOptions: {
|
|
361
362
|
methodResponses: [
|
|
@@ -364,7 +365,8 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
364
365
|
],
|
|
365
366
|
},
|
|
366
367
|
deployOptions: {
|
|
367
|
-
|
|
368
|
+
tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
|
|
369
|
+
dataTraceEnabled: this.props.api.restApi?.deployOptions?.dataTraceEnabled,
|
|
368
370
|
description: `${this.id} - ${this.props.stage} stage`,
|
|
369
371
|
loggingLevel: apig.MethodLoggingLevel.INFO,
|
|
370
372
|
metricsEnabled: true,
|
|
@@ -382,7 +384,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
382
384
|
},
|
|
383
385
|
restApiName: `${this.id}-rest-api-${this.props.stage}`,
|
|
384
386
|
},
|
|
385
|
-
...this.props.api,
|
|
387
|
+
...this.props.api.restApi,
|
|
386
388
|
});
|
|
387
389
|
this.addCfnOutput(`${this.id}-restApiId`, this.apiToEventBridgeTargetRestApi.api.restApiId);
|
|
388
390
|
this.addCfnOutput(`${this.id}-restApiRootResourceId`, this.apiToEventBridgeTargetRestApi.api.root.resourceId);
|
|
@@ -152,7 +152,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
|
|
|
152
152
|
if (this.props.api.useExisting)
|
|
153
153
|
return;
|
|
154
154
|
this.apiDestinedLambda.policy = new iam.PolicyDocument({
|
|
155
|
-
statements: [this.iamManager.
|
|
155
|
+
statements: [this.iamManager.statementForPutEvents([this.apiEvent.eventBus.eventBusArn])],
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
@@ -481,7 +481,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
|
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-sns-rest-api-access-log`, this, {
|
|
484
|
-
logGroupName: `/custom/api/${this.id}-destined-rest-api-access
|
|
484
|
+
logGroupName: `/custom/api/${this.id}-destined-rest-api-access`,
|
|
485
485
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
486
486
|
});
|
|
487
487
|
this.apiDestinedRestApi.api = new apig.RestApi(this, `${this.id}-sns-rest-api`, {
|
|
@@ -120,7 +120,7 @@ class GraphQLApiLambda extends common_1.CommonConstruct {
|
|
|
120
120
|
*/
|
|
121
121
|
createLambdaPolicy() {
|
|
122
122
|
this.graphQLApiLambdaPolicy = new iam.PolicyDocument({
|
|
123
|
-
statements: [this.iamManager.
|
|
123
|
+
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
@@ -166,7 +166,7 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
166
166
|
*/
|
|
167
167
|
createEcsPolicy() {
|
|
168
168
|
this.siteEcsPolicy = new iam.PolicyDocument({
|
|
169
|
-
statements: [this.iamManager.
|
|
169
|
+
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
@@ -60,6 +60,11 @@ class EcsManager {
|
|
|
60
60
|
const ecsCluster = new ecs.Cluster(scope, `${id}`, {
|
|
61
61
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
62
62
|
vpc: vpc,
|
|
63
|
+
defaultCloudMapNamespace: props.defaultCloudMapNamespace,
|
|
64
|
+
capacity: props.capacity,
|
|
65
|
+
enableFargateCapacityProviders: props.enableFargateCapacityProviders,
|
|
66
|
+
containerInsights: props.containerInsights,
|
|
67
|
+
executeCommandConfiguration: props.executeCommandConfiguration,
|
|
63
68
|
});
|
|
64
69
|
utils.createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn);
|
|
65
70
|
utils.createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName);
|
package/package.json
CHANGED
|
@@ -377,12 +377,13 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
380
|
-
logGroupName: `/custom/api/${this.id}-rest-api-access
|
|
380
|
+
logGroupName: `/custom/api/${this.id}-rest-api-access`,
|
|
381
381
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
382
382
|
})
|
|
383
383
|
|
|
384
384
|
this.apiToEventBridgeTargetRestApi.api = new apig.RestApi(this, `${this.id}-rest-api`, {
|
|
385
385
|
...{
|
|
386
|
+
cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
|
|
386
387
|
defaultIntegration: this.apiToEventBridgeTargetRestApi.integration,
|
|
387
388
|
defaultMethodOptions: {
|
|
388
389
|
methodResponses: [
|
|
@@ -391,7 +392,8 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
391
392
|
],
|
|
392
393
|
},
|
|
393
394
|
deployOptions: {
|
|
394
|
-
|
|
395
|
+
tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
|
|
396
|
+
dataTraceEnabled: this.props.api.restApi?.deployOptions?.dataTraceEnabled,
|
|
395
397
|
description: `${this.id} - ${this.props.stage} stage`,
|
|
396
398
|
loggingLevel: apig.MethodLoggingLevel.INFO,
|
|
397
399
|
metricsEnabled: true,
|
|
@@ -409,7 +411,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
409
411
|
},
|
|
410
412
|
restApiName: `${this.id}-rest-api-${this.props.stage}`,
|
|
411
413
|
},
|
|
412
|
-
...this.props.api,
|
|
414
|
+
...this.props.api.restApi,
|
|
413
415
|
})
|
|
414
416
|
this.addCfnOutput(`${this.id}-restApiId`, this.apiToEventBridgeTargetRestApi.api.restApiId)
|
|
415
417
|
this.addCfnOutput(`${this.id}-restApiRootResourceId`, this.apiToEventBridgeTargetRestApi.api.root.resourceId)
|
|
@@ -162,7 +162,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
|
|
|
162
162
|
protected createApiDestinedLambdaPolicy() {
|
|
163
163
|
if (this.props.api.useExisting) return
|
|
164
164
|
this.apiDestinedLambda.policy = new iam.PolicyDocument({
|
|
165
|
-
statements: [this.iamManager.
|
|
165
|
+
statements: [this.iamManager.statementForPutEvents([this.apiEvent.eventBus.eventBusArn])],
|
|
166
166
|
})
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -536,7 +536,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
|
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-sns-rest-api-access-log`, this, {
|
|
539
|
-
logGroupName: `/custom/api/${this.id}-destined-rest-api-access
|
|
539
|
+
logGroupName: `/custom/api/${this.id}-destined-rest-api-access`,
|
|
540
540
|
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
541
541
|
})
|
|
542
542
|
|
|
@@ -125,7 +125,7 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
125
125
|
*/
|
|
126
126
|
protected createLambdaPolicy() {
|
|
127
127
|
this.graphQLApiLambdaPolicy = new iam.PolicyDocument({
|
|
128
|
-
statements: [this.iamManager.
|
|
128
|
+
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
129
129
|
})
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -177,7 +177,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
177
177
|
*/
|
|
178
178
|
protected createEcsPolicy() {
|
|
179
179
|
this.siteEcsPolicy = new iam.PolicyDocument({
|
|
180
|
-
statements: [this.iamManager.
|
|
180
|
+
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
181
181
|
})
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -40,6 +40,11 @@ export class EcsManager {
|
|
|
40
40
|
const ecsCluster = new ecs.Cluster(scope, `${id}`, {
|
|
41
41
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
42
42
|
vpc: vpc,
|
|
43
|
+
defaultCloudMapNamespace: props.defaultCloudMapNamespace,
|
|
44
|
+
capacity: props.capacity,
|
|
45
|
+
enableFargateCapacityProviders: props.enableFargateCapacityProviders,
|
|
46
|
+
containerInsights: props.containerInsights,
|
|
47
|
+
executeCommandConfiguration: props.executeCommandConfiguration,
|
|
43
48
|
})
|
|
44
49
|
|
|
45
50
|
utils.createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
|