@gradientedge/cdk-utils 9.10.1 → 9.11.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/dist/src/lib/aws/common/construct.d.ts +3 -8
- package/dist/src/lib/aws/common/construct.js +3 -14
- package/dist/src/lib/aws/common/resource-name-formatter.d.ts +13 -0
- package/dist/src/lib/aws/common/resource-name-formatter.js +26 -0
- package/dist/src/lib/aws/construct/api-to-any-target/main.js +1 -1
- package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +4 -4
- package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +2 -2
- package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +2 -2
- package/dist/src/lib/aws/construct/application-configuration/main.js +1 -1
- package/dist/src/lib/aws/construct/lambda-with-iam-access/main.js +3 -3
- package/dist/src/lib/aws/construct/site-with-ecs-backend/main.js +7 -7
- package/dist/src/lib/aws/construct/site-with-lambda-backend/main.js +3 -3
- package/dist/src/lib/aws/services/api-gateway/main.js +1 -1
- package/dist/src/lib/aws/services/appconfig/main.js +2 -2
- package/dist/src/lib/aws/services/cloudfront/main.js +2 -2
- package/dist/src/lib/aws/services/cloudtrail/main.js +1 -1
- package/dist/src/lib/aws/services/dynamodb/main.js +1 -1
- package/dist/src/lib/aws/services/elastic-container-service/main.js +2 -2
- package/dist/src/lib/aws/services/elastic-file-system/main.js +1 -1
- package/dist/src/lib/aws/services/elastic-kubernetes-service/main.js +1 -1
- package/dist/src/lib/aws/services/elasticache/main.js +1 -1
- package/dist/src/lib/aws/services/eventbridge/main.js +9 -9
- package/dist/src/lib/aws/services/evidently/main.js +4 -4
- package/dist/src/lib/aws/services/identity-access-management/main.js +10 -10
- package/dist/src/lib/aws/services/lambda/main.js +2 -2
- package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
- package/dist/src/lib/aws/services/simple-notification-service/main.js +4 -4
- package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -1
- package/dist/src/lib/aws/services/simple-storage-service/main.js +1 -1
- package/dist/src/lib/aws/services/step-function/main.js +1 -1
- package/dist/src/lib/aws/services/virtual-private-cloud/main.js +3 -3
- package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -2
- package/package.json +1 -1
- package/src/lib/aws/common/construct.ts +4 -16
- package/src/lib/aws/common/resource-name-formatter.ts +26 -0
- package/src/lib/aws/construct/api-to-any-target/main.ts +1 -1
- package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +4 -4
- package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +2 -2
- package/src/lib/aws/construct/api-to-lambda-target/main.ts +2 -2
- package/src/lib/aws/construct/application-configuration/main.ts +1 -1
- package/src/lib/aws/construct/lambda-with-iam-access/main.ts +3 -3
- package/src/lib/aws/construct/site-with-ecs-backend/main.ts +9 -7
- package/src/lib/aws/construct/site-with-lambda-backend/main.ts +5 -3
- package/src/lib/aws/services/api-gateway/main.ts +1 -1
- package/src/lib/aws/services/appconfig/main.ts +2 -2
- package/src/lib/aws/services/cloudfront/main.ts +2 -2
- package/src/lib/aws/services/cloudtrail/main.ts +1 -1
- package/src/lib/aws/services/dynamodb/main.ts +1 -1
- package/src/lib/aws/services/elastic-container-service/main.ts +2 -2
- package/src/lib/aws/services/elastic-file-system/main.ts +1 -1
- package/src/lib/aws/services/elastic-kubernetes-service/main.ts +1 -1
- package/src/lib/aws/services/elasticache/main.ts +1 -1
- package/src/lib/aws/services/eventbridge/main.ts +9 -9
- package/src/lib/aws/services/evidently/main.ts +4 -4
- package/src/lib/aws/services/identity-access-management/main.ts +10 -10
- package/src/lib/aws/services/lambda/main.ts +2 -2
- package/src/lib/aws/services/secrets-manager/main.ts +1 -1
- package/src/lib/aws/services/simple-notification-service/main.ts +4 -4
- package/src/lib/aws/services/simple-queue-service/main.ts +1 -1
- package/src/lib/aws/services/simple-storage-service/main.ts +1 -1
- package/src/lib/aws/services/step-function/main.ts +1 -1
- package/src/lib/aws/services/virtual-private-cloud/main.ts +3 -3
- package/src/lib/aws/services/web-application-firewall/main.ts +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CfnOutput } from 'aws-cdk-lib';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
3
|
import { AcmManager, ApiManager, AppConfigManager, CloudFrontManager, CloudTrailManager, CloudWatchManager, CodeBuildManager, DynamodbManager, EcrManager, EcsManager, EfsManager, EksManager, ElastiCacheManager, EventManager, EventTargetManager, EvidentlyManager, IamManager, KmsManager, LambdaManager, LogManager, Route53Manager, S3Manager, SecretsManager, SfnManager, SnsManager, SqsManager, SsmManager, VpcManager, WafManager } from '../services';
|
|
4
|
-
import {
|
|
4
|
+
import { ResourceNameFormatter } from './resource-name-formatter';
|
|
5
|
+
import { CommonStackProps } from './types';
|
|
5
6
|
/**
|
|
6
7
|
* @subcategory Construct
|
|
7
8
|
* @classdesc Common construct to use as a base for all higher level constructs.
|
|
@@ -17,6 +18,7 @@ import { CommonStackProps, ResourceNameFormatterProps } from './types';
|
|
|
17
18
|
*/
|
|
18
19
|
export declare class CommonConstruct extends Construct {
|
|
19
20
|
props: CommonStackProps;
|
|
21
|
+
resourceNameFormatter: ResourceNameFormatter;
|
|
20
22
|
acmManager: AcmManager;
|
|
21
23
|
apiManager: ApiManager;
|
|
22
24
|
appConfigManager: AppConfigManager;
|
|
@@ -48,13 +50,6 @@ export declare class CommonConstruct extends Construct {
|
|
|
48
50
|
wafManager: WafManager;
|
|
49
51
|
fullyQualifiedDomainName: string;
|
|
50
52
|
constructor(parent: Construct, id: string, props: CommonStackProps);
|
|
51
|
-
/**
|
|
52
|
-
* @summary Helper method to format a resource name based on the provided options
|
|
53
|
-
* @param resourceName the resource name to format
|
|
54
|
-
* @param options options to control the formatting of the resource name
|
|
55
|
-
* @returns The formatted resource name
|
|
56
|
-
*/
|
|
57
|
-
resourceNameFormatter(resourceName: string, options?: ResourceNameFormatterProps): string;
|
|
58
53
|
/**
|
|
59
54
|
* @summary Helper method to add CloudFormation outputs from the construct
|
|
60
55
|
* @param id scoped id of the resource
|
|
@@ -5,6 +5,7 @@ const constructs_1 = require("constructs");
|
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
const services_1 = require("../services");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
+
const resource_name_formatter_1 = require("./resource-name-formatter");
|
|
8
9
|
/**
|
|
9
10
|
* @subcategory Construct
|
|
10
11
|
* @classdesc Common construct to use as a base for all higher level constructs.
|
|
@@ -20,6 +21,7 @@ const utils_1 = require("../utils");
|
|
|
20
21
|
*/
|
|
21
22
|
class CommonConstruct extends constructs_1.Construct {
|
|
22
23
|
props;
|
|
24
|
+
resourceNameFormatter;
|
|
23
25
|
acmManager;
|
|
24
26
|
apiManager;
|
|
25
27
|
appConfigManager;
|
|
@@ -53,6 +55,7 @@ class CommonConstruct extends constructs_1.Construct {
|
|
|
53
55
|
constructor(parent, id, props) {
|
|
54
56
|
super(parent, id);
|
|
55
57
|
this.props = props;
|
|
58
|
+
this.resourceNameFormatter = new resource_name_formatter_1.ResourceNameFormatter(this, `${id}-rnf`, props);
|
|
56
59
|
this.acmManager = new services_1.AcmManager();
|
|
57
60
|
this.apiManager = new services_1.ApiManager();
|
|
58
61
|
this.appConfigManager = new services_1.AppConfigManager();
|
|
@@ -84,20 +87,6 @@ class CommonConstruct extends constructs_1.Construct {
|
|
|
84
87
|
this.wafManager = new services_1.WafManager();
|
|
85
88
|
this.determineFullyQualifiedDomain();
|
|
86
89
|
}
|
|
87
|
-
/**
|
|
88
|
-
* @summary Helper method to format a resource name based on the provided options
|
|
89
|
-
* @param resourceName the resource name to format
|
|
90
|
-
* @param options options to control the formatting of the resource name
|
|
91
|
-
* @returns The formatted resource name
|
|
92
|
-
*/
|
|
93
|
-
resourceNameFormatter(resourceName, options) {
|
|
94
|
-
const resourceNameElements = [];
|
|
95
|
-
resourceNameElements.push(options?.prefix ?? this.props.resourcePrefix);
|
|
96
|
-
resourceNameElements.push(resourceName);
|
|
97
|
-
resourceNameElements.push(options?.suffix ?? this.props.resourceSuffix);
|
|
98
|
-
resourceNameElements.push(this.props.stage);
|
|
99
|
-
return resourceNameElements.filter(resourceNameElement => resourceNameElement != undefined).join('-');
|
|
100
|
-
}
|
|
101
90
|
/**
|
|
102
91
|
* @summary Helper method to add CloudFormation outputs from the construct
|
|
103
92
|
* @param id scoped id of the resource
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Construct } from 'constructs';
|
|
2
|
+
import { CommonStackProps, ResourceNameFormatterProps } from './types';
|
|
3
|
+
export declare class ResourceNameFormatter extends Construct {
|
|
4
|
+
props: CommonStackProps;
|
|
5
|
+
constructor(parent: Construct, id: string, props: CommonStackProps);
|
|
6
|
+
/**
|
|
7
|
+
* @summary Helper method to format a resource name based on the provided options
|
|
8
|
+
* @param resourceName the resource name to format
|
|
9
|
+
* @param options options to control the formatting of the resource name
|
|
10
|
+
* @returns The formatted resource name
|
|
11
|
+
*/
|
|
12
|
+
format(resourceName: string, options?: ResourceNameFormatterProps): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceNameFormatter = void 0;
|
|
4
|
+
const constructs_1 = require("constructs");
|
|
5
|
+
class ResourceNameFormatter extends constructs_1.Construct {
|
|
6
|
+
props;
|
|
7
|
+
constructor(parent, id, props) {
|
|
8
|
+
super(parent, id);
|
|
9
|
+
this.props = props;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @summary Helper method to format a resource name based on the provided options
|
|
13
|
+
* @param resourceName the resource name to format
|
|
14
|
+
* @param options options to control the formatting of the resource name
|
|
15
|
+
* @returns The formatted resource name
|
|
16
|
+
*/
|
|
17
|
+
format(resourceName, options) {
|
|
18
|
+
const resourceNameElements = [];
|
|
19
|
+
resourceNameElements.push(options?.prefix ?? this.props.resourcePrefix);
|
|
20
|
+
resourceNameElements.push(resourceName);
|
|
21
|
+
resourceNameElements.push(options?.suffix ?? this.props.resourceSuffix);
|
|
22
|
+
resourceNameElements.push(this.props.stage);
|
|
23
|
+
return resourceNameElements.filter(resourceNameElement => resourceNameElement != undefined).join('-');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ResourceNameFormatter = ResourceNameFormatter;
|
|
@@ -112,7 +112,7 @@ class ApiToAnyTarget extends common_1.CommonConstruct {
|
|
|
112
112
|
types: [this.isProductionStage() ? aws_apigateway_1.EndpointType.EDGE : aws_apigateway_1.EndpointType.REGIONAL],
|
|
113
113
|
},
|
|
114
114
|
...this.props.api.restApi,
|
|
115
|
-
restApiName: this.resourceNameFormatter(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
115
|
+
restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
116
116
|
});
|
|
117
117
|
this.addCfnOutput(`${this.id}-restApiId`, this.apiToAnyTargetRestApi.api.restApiId);
|
|
118
118
|
this.addCfnOutput(`${this.id}-restApiRootResourceId`, this.apiToAnyTargetRestApi.api.root.resourceId);
|
|
@@ -106,7 +106,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
106
106
|
*/
|
|
107
107
|
createApiToEventBridgeTargetEventBus() {
|
|
108
108
|
if (this.props.api.useExisting) {
|
|
109
|
-
this.apiEvent.eventBus = aws_events_1.EventBus.fromEventBusName(this, `${this.id}-event-bus`, this.resourceNameFormatter(this.props.event.eventBusName ?? 'default'));
|
|
109
|
+
this.apiEvent.eventBus = aws_events_1.EventBus.fromEventBusName(this, `${this.id}-event-bus`, this.resourceNameFormatter.format(this.props.event.eventBusName ?? 'default'));
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
this.apiEvent.eventBus = this.eventManager.createEventBus(`${this.id}-event-bus`, this, {
|
|
@@ -121,7 +121,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
121
121
|
return;
|
|
122
122
|
this.apiEvent.logGroup = this.logManager.createLogGroup(`${this.id}-log`, this, {
|
|
123
123
|
...{
|
|
124
|
-
logGroupName: `/${this.resourceNameFormatter(this.id)}/events/api-to-eventbridge-target`,
|
|
124
|
+
logGroupName: `/${this.resourceNameFormatter.format(this.id)}/events/api-to-eventbridge-target`,
|
|
125
125
|
},
|
|
126
126
|
...this.props.event.logGroup,
|
|
127
127
|
});
|
|
@@ -290,7 +290,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
290
290
|
}
|
|
291
291
|
createApiToEventBridgeTargetRestApiLogGroup() {
|
|
292
292
|
this.apiToEventBridgeTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
293
|
-
logGroupName: `/custom/api/${this.resourceNameFormatter(this.id)}-rest-api-access`,
|
|
293
|
+
logGroupName: `/custom/api/${this.resourceNameFormatter.format(this.id)}-rest-api-access`,
|
|
294
294
|
removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
|
|
295
295
|
});
|
|
296
296
|
}
|
|
@@ -333,7 +333,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
333
333
|
types: [aws_apigateway_1.EndpointType.REGIONAL],
|
|
334
334
|
},
|
|
335
335
|
...this.props.api.restApi,
|
|
336
|
-
restApiName: this.resourceNameFormatter(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
336
|
+
restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
337
337
|
});
|
|
338
338
|
this.addCfnOutput(`${this.id}-restApiId`, this.apiToEventBridgeTargetRestApi.api.restApiId);
|
|
339
339
|
this.addCfnOutput(`${this.id}-restApiRootResourceId`, this.apiToEventBridgeTargetRestApi.api.root.resourceId);
|
|
@@ -271,7 +271,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
|
|
|
271
271
|
if (!this.props.api.withResource)
|
|
272
272
|
return;
|
|
273
273
|
this.apiDestinedRestApi.topic = this.snsManager.createLambdaNotificationService(`${this.id}-destined-topic`, this, {
|
|
274
|
-
topicName: this.resourceNameFormatter(`${this.id}-destined-topic`),
|
|
274
|
+
topicName: this.resourceNameFormatter.format(`${this.id}-destined-topic`),
|
|
275
275
|
}, this.apiDestinedLambda.function);
|
|
276
276
|
if (this.apiDestinedRestApi.role) {
|
|
277
277
|
this.apiDestinedRestApi.topic.grantPublish(this.apiDestinedRestApi.role);
|
|
@@ -438,7 +438,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
|
|
|
438
438
|
types: [aws_apigateway_1.EndpointType.REGIONAL],
|
|
439
439
|
},
|
|
440
440
|
...this.props.api,
|
|
441
|
-
restApiName: this.resourceNameFormatter(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
441
|
+
restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
|
|
442
442
|
});
|
|
443
443
|
this.addCfnOutput(`${this.id}-restApiId`, this.apiDestinedRestApi.api.restApiId);
|
|
444
444
|
this.addCfnOutput(`${this.id}-restApiRootResourceId`, this.apiDestinedRestApi.api.root.resourceId);
|
|
@@ -103,7 +103,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
resolveApiToLambdaTargetFunction() {
|
|
106
|
-
this.apiToLambdaTargetRestApi.lambda = aws_lambda_1.Function.fromFunctionName(this, `${this.id}-lambda`, this.resourceNameFormatter(this.props.lambdaFunctionName));
|
|
106
|
+
this.apiToLambdaTargetRestApi.lambda = aws_lambda_1.Function.fromFunctionName(this, `${this.id}-lambda`, this.resourceNameFormatter.format(this.props.lambdaFunctionName));
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* @summary Method to create rest restApi for Api
|
|
@@ -114,7 +114,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
117
|
-
logGroupName: `/custom/api/${this.resourceNameFormatter(this.id)}-rest-api-access`,
|
|
117
|
+
logGroupName: `/custom/api/${this.resourceNameFormatter.format(this.id)}-rest-api-access`,
|
|
118
118
|
removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
|
|
119
119
|
});
|
|
120
120
|
this.props.api.restApi = {
|
|
@@ -49,7 +49,7 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
|
49
49
|
this.appConfigDeploymentStrategy = new aws_appconfig_1.CfnDeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
|
|
50
50
|
deploymentDurationInMinutes: this.props.appConfig.deploymentStrategy.deploymentDurationInMinutes,
|
|
51
51
|
growthFactor: this.props.appConfig.deploymentStrategy.growthFactor,
|
|
52
|
-
name: this.resourceNameFormatter(this.props.appConfig.deploymentStrategy.name),
|
|
52
|
+
name: this.resourceNameFormatter.format(this.props.appConfig.deploymentStrategy.name),
|
|
53
53
|
replicateTo: this.props.appConfig.deploymentStrategy.replicateTo,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -143,10 +143,10 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
|
|
|
143
143
|
*/
|
|
144
144
|
createIamUserForLambdaFunction() {
|
|
145
145
|
this.lambdaIamUser = new aws_iam_1.User(this, `${this.id}-lambda-user`, {
|
|
146
|
-
userName: this.resourceNameFormatter(`${this.id}-user`),
|
|
146
|
+
userName: this.resourceNameFormatter.format(`${this.id}-user`),
|
|
147
147
|
});
|
|
148
148
|
new aws_iam_1.Policy(this, `${this.id}-lambda-user-policy`, {
|
|
149
|
-
policyName: this.resourceNameFormatter(`${this.id}-policy`),
|
|
149
|
+
policyName: this.resourceNameFormatter.format(`${this.id}-policy`),
|
|
150
150
|
statements: [
|
|
151
151
|
new aws_iam_1.PolicyStatement({
|
|
152
152
|
actions: ['lambda:InvokeFunction'],
|
|
@@ -158,7 +158,7 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
|
|
|
158
158
|
if (this.props.lambda.lambdaAliases && !lodash_1.default.isEmpty(this.props.lambda.lambdaAliases)) {
|
|
159
159
|
lodash_1.default.forEach(this.props.lambda.lambdaAliases, (alias, index) => {
|
|
160
160
|
new aws_iam_1.Policy(this, `${this.id}-alias-user-policy`, {
|
|
161
|
-
policyName: this.resourceNameFormatter(`${this.id}--alias-policy-${index}`),
|
|
161
|
+
policyName: this.resourceNameFormatter.format(`${this.id}--alias-policy-${index}`),
|
|
162
162
|
statements: [
|
|
163
163
|
new aws_iam_1.PolicyStatement({
|
|
164
164
|
actions: ['lambda:InvokeFunction'],
|
|
@@ -220,11 +220,11 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
220
220
|
enableECSManagedTags: true,
|
|
221
221
|
healthCheckGracePeriod: aws_cdk_lib_1.Duration.seconds(60),
|
|
222
222
|
listenerPort: this.props.siteTask.listenerPort,
|
|
223
|
-
loadBalancerName: this.resourceNameFormatter(this.props.siteTask.loadBalancerName ?? this.id),
|
|
223
|
+
loadBalancerName: this.resourceNameFormatter.format(this.props.siteTask.loadBalancerName ?? this.id),
|
|
224
224
|
maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
|
|
225
225
|
memoryLimitMiB: this.props.siteTask.memoryLimitMiB,
|
|
226
226
|
minHealthyPercent: this.props.siteTask.minHealthyPercent,
|
|
227
|
-
serviceName: this.resourceNameFormatter(this.props.siteTask.serviceName ?? this.id),
|
|
227
|
+
serviceName: this.resourceNameFormatter.format(this.props.siteTask.serviceName ?? this.id),
|
|
228
228
|
taskDefinition: this.props.siteTask.taskDefinition,
|
|
229
229
|
taskImageOptions: {
|
|
230
230
|
containerPort: this.props.siteTask.taskImageOptions?.containerPort,
|
|
@@ -304,14 +304,14 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
304
304
|
transitEncryption: this.props.siteFileSystem.transitEncryption,
|
|
305
305
|
transitEncryptionPort: this.props.siteFileSystem.transitEncryptionPort,
|
|
306
306
|
},
|
|
307
|
-
name: this.resourceNameFormatter(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
307
|
+
name: this.resourceNameFormatter.format(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
308
308
|
});
|
|
309
309
|
if (this.props.siteTask.mountPoints && !lodash_1.default.isEmpty(this.props.siteTask.mountPoints)) {
|
|
310
310
|
lodash_1.default.forEach(this.props.siteTask.mountPoints, mountPoint => {
|
|
311
311
|
this.siteEcsTaskDefinition.defaultContainer?.addMountPoints({
|
|
312
312
|
containerPath: mountPoint.containerPath,
|
|
313
313
|
readOnly: mountPoint.readOnly,
|
|
314
|
-
sourceVolume: this.resourceNameFormatter(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
314
|
+
sourceVolume: this.resourceNameFormatter.format(this.props.siteFileSystem?.fileSystemName ?? this.id),
|
|
315
315
|
});
|
|
316
316
|
});
|
|
317
317
|
}
|
|
@@ -331,7 +331,7 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
331
331
|
if (!siteCachePolicy.cachePolicyName)
|
|
332
332
|
throw `SiteCachePolicy cachePolicyName undefined for ${id}`;
|
|
333
333
|
return new aws_cloudfront_1.CachePolicy(this, `${id}`, {
|
|
334
|
-
cachePolicyName: this.resourceNameFormatter(siteCachePolicy.cachePolicyName),
|
|
334
|
+
cachePolicyName: this.resourceNameFormatter.format(siteCachePolicy.cachePolicyName),
|
|
335
335
|
comment: `Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
336
336
|
cookieBehavior: siteCachePolicy.cookieBehavior,
|
|
337
337
|
enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
|
|
@@ -359,7 +359,7 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
359
359
|
comment: `Request Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
360
360
|
cookieBehavior: this.props.siteOriginRequestPolicy.cookieBehavior,
|
|
361
361
|
headerBehavior: this.props.siteOriginRequestPolicy.headerBehavior,
|
|
362
|
-
originRequestPolicyName: this.resourceNameFormatter(this.props.siteOriginRequestPolicy.originRequestPolicyName),
|
|
362
|
+
originRequestPolicyName: this.resourceNameFormatter.format(this.props.siteOriginRequestPolicy.originRequestPolicyName),
|
|
363
363
|
queryStringBehavior: this.props.siteOriginRequestPolicy.queryStringBehavior,
|
|
364
364
|
});
|
|
365
365
|
lodash_1.default.assign(this.props.siteDistribution.defaultBehavior, {
|
|
@@ -374,7 +374,7 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
|
|
|
374
374
|
return new aws_cloudfront_1.ResponseHeadersPolicy(this, `${this.id}-${props.type}-srhp`, {
|
|
375
375
|
...props,
|
|
376
376
|
comment: `Response Header Policy for ${props.type} for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
377
|
-
responseHeadersPolicyName: this.resourceNameFormatter(props.responseHeadersPolicyName),
|
|
377
|
+
responseHeadersPolicyName: this.resourceNameFormatter.format(props.responseHeadersPolicyName),
|
|
378
378
|
securityHeadersBehavior: {
|
|
379
379
|
...props.securityHeadersBehavior,
|
|
380
380
|
strictTransportSecurity: {
|
|
@@ -139,7 +139,7 @@ class SiteWithLambdaBackend extends common_1.CommonConstruct {
|
|
|
139
139
|
if (!siteCachePolicy.cachePolicyName)
|
|
140
140
|
throw `SiteCachePolicy cachePolicyName undefined for ${id}`;
|
|
141
141
|
return new aws_cloudfront_1.CachePolicy(this, `${id}`, {
|
|
142
|
-
cachePolicyName: this.resourceNameFormatter(siteCachePolicy.cachePolicyName),
|
|
142
|
+
cachePolicyName: this.resourceNameFormatter.format(siteCachePolicy.cachePolicyName),
|
|
143
143
|
comment: `Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
144
144
|
cookieBehavior: siteCachePolicy.cookieBehavior,
|
|
145
145
|
enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
|
|
@@ -167,7 +167,7 @@ class SiteWithLambdaBackend extends common_1.CommonConstruct {
|
|
|
167
167
|
comment: `Request Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
168
168
|
cookieBehavior: this.props.siteOriginRequestPolicy.cookieBehavior,
|
|
169
169
|
headerBehavior: this.props.siteOriginRequestPolicy.headerBehavior,
|
|
170
|
-
originRequestPolicyName: this.resourceNameFormatter(this.props.siteOriginRequestPolicy.originRequestPolicyName),
|
|
170
|
+
originRequestPolicyName: this.resourceNameFormatter.format(this.props.siteOriginRequestPolicy.originRequestPolicyName),
|
|
171
171
|
queryStringBehavior: this.props.siteOriginRequestPolicy.queryStringBehavior,
|
|
172
172
|
});
|
|
173
173
|
lodash_1.default.assign(this.props.siteDistribution.defaultBehavior, {
|
|
@@ -182,7 +182,7 @@ class SiteWithLambdaBackend extends common_1.CommonConstruct {
|
|
|
182
182
|
return new aws_cloudfront_1.ResponseHeadersPolicy(this, `${this.id}-${props.type}-srhp`, {
|
|
183
183
|
...props,
|
|
184
184
|
comment: `Response Header Policy for ${props.type} for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
185
|
-
responseHeadersPolicyName: this.resourceNameFormatter(props.responseHeadersPolicyName),
|
|
185
|
+
responseHeadersPolicyName: this.resourceNameFormatter.format(props.responseHeadersPolicyName),
|
|
186
186
|
securityHeadersBehavior: {
|
|
187
187
|
...props.securityHeadersBehavior,
|
|
188
188
|
strictTransportSecurity: {
|
|
@@ -55,7 +55,7 @@ class ApiManager {
|
|
|
55
55
|
handler: lambdaFunction,
|
|
56
56
|
minCompressionSize: props.minCompressionSizeInBytes ? aws_cdk_lib_1.Size.bytes(props.minCompressionSizeInBytes) : undefined,
|
|
57
57
|
proxy: props.proxy ?? true,
|
|
58
|
-
restApiName: scope.resourceNameFormatter(props.restApiName, props.resourceNameOptions),
|
|
58
|
+
restApiName: scope.resourceNameFormatter.format(props.restApiName, props.resourceNameOptions),
|
|
59
59
|
});
|
|
60
60
|
if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
|
|
61
61
|
lodash_1.default.forEach(props.tags, tag => {
|
|
@@ -50,7 +50,7 @@ class AppConfigManager {
|
|
|
50
50
|
throw `AppConfig props undefined for ${id}`;
|
|
51
51
|
const application = new aws_appconfig_1.CfnApplication(scope, `${id}`, {
|
|
52
52
|
...props.application,
|
|
53
|
-
name: scope.resourceNameFormatter(props.application.name, props.resourceNameOptions),
|
|
53
|
+
name: scope.resourceNameFormatter.format(props.application.name, props.resourceNameOptions),
|
|
54
54
|
});
|
|
55
55
|
(0, utils_1.createCfnOutput)(`${id}-ApplicationId`, scope, aws_cdk_lib_1.Fn.ref(application.logicalId));
|
|
56
56
|
(0, utils_1.createCfnOutput)(`${id}-ApplicationName`, scope, application.name);
|
|
@@ -92,7 +92,7 @@ class AppConfigManager {
|
|
|
92
92
|
...props.configurationProfile,
|
|
93
93
|
applicationId,
|
|
94
94
|
locationUri: props.configurationProfile.locationUri || 'hosted',
|
|
95
|
-
name: scope.resourceNameFormatter(props.configurationProfile.name, props.resourceNameOptions),
|
|
95
|
+
name: scope.resourceNameFormatter.format(props.configurationProfile.name, props.resourceNameOptions),
|
|
96
96
|
});
|
|
97
97
|
(0, utils_1.createCfnOutput)(`${id}-configurationProfileId`, scope, aws_cdk_lib_1.Fn.ref(profile.logicalId));
|
|
98
98
|
(0, utils_1.createCfnOutput)(`${id}-configurationProfileName`, scope, profile.name);
|
|
@@ -237,7 +237,7 @@ class CloudFrontManager {
|
|
|
237
237
|
...environment,
|
|
238
238
|
},
|
|
239
239
|
filesystem: accessPoint ? aws_lambda_1.FileSystem.fromEfsAccessPoint(accessPoint, mountPath ?? '/mnt/msg') : undefined,
|
|
240
|
-
functionName: scope.resourceNameFormatter(props.functionName, props.resourceNameOptions),
|
|
240
|
+
functionName: scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions),
|
|
241
241
|
handler: props.handler ?? 'index.handler',
|
|
242
242
|
layers: layers,
|
|
243
243
|
logRetention: props.logRetention,
|
|
@@ -297,7 +297,7 @@ class CloudFrontManager {
|
|
|
297
297
|
filePath: props.functionFilePath,
|
|
298
298
|
}),
|
|
299
299
|
comment: props.comment,
|
|
300
|
-
functionName: scope.resourceNameFormatter(props.functionName, props.resourceNameOptions),
|
|
300
|
+
functionName: scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions),
|
|
301
301
|
});
|
|
302
302
|
(0, utils_1.createCfnOutput)(`${id}-functionArn`, scope, cloudfrontFunction.functionArn);
|
|
303
303
|
(0, utils_1.createCfnOutput)(`${id}-functionName`, scope, cloudfrontFunction.functionName);
|
|
@@ -62,7 +62,7 @@ class CloudTrailManager {
|
|
|
62
62
|
s3BucketName: logBucket.bucketName,
|
|
63
63
|
s3KeyPrefix: `logs-${props.trailName}`,
|
|
64
64
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
65
|
-
trailName: scope.resourceNameFormatter(props.trailName, props.resourceNameOptions),
|
|
65
|
+
trailName: scope.resourceNameFormatter.format(props.trailName, props.resourceNameOptions),
|
|
66
66
|
});
|
|
67
67
|
cloudTrail.addDependency(logBucketPolicy);
|
|
68
68
|
cloudTrail.addDependency(logGroup);
|
|
@@ -60,7 +60,7 @@ class DynamodbManager {
|
|
|
60
60
|
throw `Table tableName undefined for ${id}`;
|
|
61
61
|
const table = new aws_dynamodb_1.TableV2(scope, `${id}`, {
|
|
62
62
|
...props,
|
|
63
|
-
tableName: scope.resourceNameFormatter(props.tableName, props.resourceNameOptions),
|
|
63
|
+
tableName: scope.resourceNameFormatter.format(props.tableName, props.resourceNameOptions),
|
|
64
64
|
});
|
|
65
65
|
(0, utils_1.createCfnOutput)(`${id}-tableName`, scope, table.tableName);
|
|
66
66
|
(0, utils_1.createCfnOutput)(`${id}-tableArn`, scope, table.tableArn);
|
|
@@ -125,12 +125,12 @@ class EcsManager {
|
|
|
125
125
|
cluster,
|
|
126
126
|
enableECSManagedTags: true,
|
|
127
127
|
healthCheckGracePeriod: props.healthCheckGracePeriod ?? aws_cdk_lib_1.Duration.seconds(60),
|
|
128
|
-
loadBalancerName: scope.resourceNameFormatter(props.loadBalancerName, props.resourceNameOptions),
|
|
128
|
+
loadBalancerName: scope.resourceNameFormatter.format(props.loadBalancerName, props.resourceNameOptions),
|
|
129
129
|
runtimePlatform: {
|
|
130
130
|
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? aws_ecs_1.CpuArchitecture.X86_64,
|
|
131
131
|
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? aws_ecs_1.OperatingSystemFamily.LINUX,
|
|
132
132
|
},
|
|
133
|
-
serviceName: scope.resourceNameFormatter(props.serviceName, props.resourceNameOptions),
|
|
133
|
+
serviceName: scope.resourceNameFormatter.format(props.serviceName, props.resourceNameOptions),
|
|
134
134
|
taskImageOptions: {
|
|
135
135
|
...props.taskImageOptions,
|
|
136
136
|
enableLogging: props.taskImageOptions?.enableLogging ?? true,
|
|
@@ -52,7 +52,7 @@ class EfsManager {
|
|
|
52
52
|
const fileSystemId = props.provisionNewOnDeployment ? `${id}-${new Date().getMilliseconds()}` : `${id}`;
|
|
53
53
|
const fileSystem = new aws_efs_1.FileSystem(scope, `${fileSystemId}`, {
|
|
54
54
|
...props,
|
|
55
|
-
fileSystemName: scope.resourceNameFormatter(props.fileSystemName, props.resourceNameOptions),
|
|
55
|
+
fileSystemName: scope.resourceNameFormatter.format(props.fileSystemName, props.resourceNameOptions),
|
|
56
56
|
lifecyclePolicy: props.lifecyclePolicy ?? aws_efs_1.LifecyclePolicy.AFTER_7_DAYS,
|
|
57
57
|
outOfInfrequentAccessPolicy: props.outOfInfrequentAccessPolicy ?? aws_efs_1.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS,
|
|
58
58
|
performanceMode: props.performanceMode ?? aws_efs_1.PerformanceMode.GENERAL_PURPOSE,
|
|
@@ -73,7 +73,7 @@ class EksManager {
|
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
const cluster = new aws_eks_1.Cluster(scope, `${id}Cluster`, {
|
|
76
|
-
clusterName: scope.resourceNameFormatter(props.clusterName, props.resourceNameOptions),
|
|
76
|
+
clusterName: scope.resourceNameFormatter.format(props.clusterName, props.resourceNameOptions),
|
|
77
77
|
defaultCapacity: props.appCapacity,
|
|
78
78
|
defaultCapacityInstance: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T3, aws_ec2_1.InstanceSize.LARGE),
|
|
79
79
|
version: aws_eks_1.KubernetesVersion.V1_27,
|
|
@@ -56,7 +56,7 @@ class ElastiCacheManager {
|
|
|
56
56
|
const elasticacheCluster = new aws_elasticache_1.CfnCacheCluster(scope, `${id}`, {
|
|
57
57
|
...props,
|
|
58
58
|
cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
|
|
59
|
-
clusterName: scope.resourceNameFormatter(props.clusterName, props.resourceNameOptions),
|
|
59
|
+
clusterName: scope.resourceNameFormatter.format(props.clusterName, props.resourceNameOptions),
|
|
60
60
|
logDeliveryConfigurations,
|
|
61
61
|
vpcSecurityGroupIds: securityGroupIds,
|
|
62
62
|
});
|
|
@@ -41,7 +41,7 @@ class EventManager {
|
|
|
41
41
|
throw `EventBus eventBusName undefined for ${id}`;
|
|
42
42
|
let eventBusName = props.eventBusName;
|
|
43
43
|
if (eventBusName && eventBusName != 'default') {
|
|
44
|
-
eventBusName = scope.resourceNameFormatter(props.eventBusName, props.resourceNameOptions);
|
|
44
|
+
eventBusName = scope.resourceNameFormatter.format(props.eventBusName, props.resourceNameOptions);
|
|
45
45
|
}
|
|
46
46
|
const eventBus = new aws_events_1.EventBus(scope, `${id}`, {
|
|
47
47
|
...props,
|
|
@@ -67,7 +67,7 @@ class EventManager {
|
|
|
67
67
|
const rule = new aws_events_1.Rule(scope, `${id}`, {
|
|
68
68
|
...props,
|
|
69
69
|
eventBus,
|
|
70
|
-
ruleName: scope.resourceNameFormatter(props.ruleName, props.resourceNameOptions),
|
|
70
|
+
ruleName: scope.resourceNameFormatter.format(props.ruleName, props.resourceNameOptions),
|
|
71
71
|
});
|
|
72
72
|
if (targets && !lodash_1.default.isEmpty(targets)) {
|
|
73
73
|
lodash_1.default.forEach(targets, target => {
|
|
@@ -103,12 +103,12 @@ class EventManager {
|
|
|
103
103
|
description: 'Rule to send notification to lambda function target',
|
|
104
104
|
eventBusName,
|
|
105
105
|
eventPattern,
|
|
106
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
106
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
107
107
|
scheduleExpression,
|
|
108
108
|
targets: [
|
|
109
109
|
{
|
|
110
110
|
arn: lambdaFunction.functionArn,
|
|
111
|
-
id: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
111
|
+
id: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
112
112
|
input: props.input ?? undefined,
|
|
113
113
|
},
|
|
114
114
|
],
|
|
@@ -148,7 +148,7 @@ class EventManager {
|
|
|
148
148
|
...props,
|
|
149
149
|
description: 'Rule to send notification on new objects in data bucket to ecs task target',
|
|
150
150
|
eventPattern,
|
|
151
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
151
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
152
152
|
targets: [
|
|
153
153
|
{
|
|
154
154
|
arn: cluster.clusterArn,
|
|
@@ -160,7 +160,7 @@ class EventManager {
|
|
|
160
160
|
taskCount: 1,
|
|
161
161
|
taskDefinitionArn: task.taskDefinitionArn,
|
|
162
162
|
},
|
|
163
|
-
id: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
163
|
+
id: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
164
164
|
roleArn: role instanceof aws_iam_1.Role ? role.roleArn : role.attrArn,
|
|
165
165
|
},
|
|
166
166
|
],
|
|
@@ -185,7 +185,7 @@ class EventManager {
|
|
|
185
185
|
const pipeRole = scope.iamManager.createRoleForSqsToSfnPipe(`${id}-role`, scope, sourceQueue.queueArn, targetStepFunction.stateMachineArn);
|
|
186
186
|
const pipe = new aws_pipes_1.CfnPipe(scope, `${id}`, {
|
|
187
187
|
...props,
|
|
188
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
188
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
189
189
|
roleArn: pipeRole.roleArn,
|
|
190
190
|
source: sourceQueue.queueArn,
|
|
191
191
|
sourceParameters: {
|
|
@@ -231,7 +231,7 @@ class EventManager {
|
|
|
231
231
|
const pipeRole = scope.iamManager.createRoleForSqsToLambdaPipe(`${id}-role`, scope, sourceQueue.queueArn, targetLambdaFunction.functionArn);
|
|
232
232
|
const pipe = new aws_pipes_1.CfnPipe(scope, `${id}`, {
|
|
233
233
|
...props,
|
|
234
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
234
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
235
235
|
roleArn: pipeRole.roleArn,
|
|
236
236
|
source: sourceQueue.queueArn,
|
|
237
237
|
sourceParameters: {
|
|
@@ -274,7 +274,7 @@ class EventManager {
|
|
|
274
274
|
const pipeRole = scope.iamManager.createRoleForDynamoDbToLambdaPipe(`${id}-role`, scope, sourceDynamoDbStreamArn, targetLambdaFunction.functionArn);
|
|
275
275
|
const pipe = new aws_pipes_1.CfnPipe(scope, `${id}`, {
|
|
276
276
|
...props,
|
|
277
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
277
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
278
278
|
roleArn: pipeRole.roleArn,
|
|
279
279
|
source: sourceDynamoDbStreamArn,
|
|
280
280
|
sourceParameters: {
|
|
@@ -34,7 +34,7 @@ class EvidentlyManager {
|
|
|
34
34
|
const project = new aws_evidently_1.CfnProject(scope, `${id}`, {
|
|
35
35
|
...props,
|
|
36
36
|
description: `${props.description} ${scope.props.stage}`,
|
|
37
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
37
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
38
38
|
});
|
|
39
39
|
(0, utils_1.createCfnOutput)(`${id}-projectArn`, scope, project.attrArn);
|
|
40
40
|
(0, utils_1.createCfnOutput)(`${id}-projectName`, scope, project.name);
|
|
@@ -68,7 +68,7 @@ class EvidentlyManager {
|
|
|
68
68
|
const launch = new aws_evidently_1.CfnLaunch(scope, `${id}`, {
|
|
69
69
|
...props,
|
|
70
70
|
description: `${props.description} ${scope.props.stage}`,
|
|
71
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
71
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
72
72
|
});
|
|
73
73
|
(0, utils_1.createCfnOutput)(`${id}-launchArn`, scope, launch.attrArn);
|
|
74
74
|
(0, utils_1.createCfnOutput)(`${id}-launchName`, scope, launch.name);
|
|
@@ -88,7 +88,7 @@ class EvidentlyManager {
|
|
|
88
88
|
const experiment = new aws_evidently_1.CfnExperiment(scope, `${id}`, {
|
|
89
89
|
...props,
|
|
90
90
|
description: `${props.description} ${scope.props.stage}`,
|
|
91
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
91
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
92
92
|
});
|
|
93
93
|
(0, utils_1.createCfnOutput)(`${id}-experimentArn`, scope, experiment.attrArn);
|
|
94
94
|
(0, utils_1.createCfnOutput)(`${id}-experimentName`, scope, experiment.name);
|
|
@@ -108,7 +108,7 @@ class EvidentlyManager {
|
|
|
108
108
|
const segment = new aws_evidently_1.CfnSegment(scope, `${id}`, {
|
|
109
109
|
...props,
|
|
110
110
|
description: `${props.description} ${scope.props.stage}`,
|
|
111
|
-
name: scope.resourceNameFormatter(props.name, props.resourceNameOptions),
|
|
111
|
+
name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
|
|
112
112
|
});
|
|
113
113
|
(0, utils_1.createCfnOutput)(`${id}-segmentArn`, scope, segment.attrArn);
|
|
114
114
|
(0, utils_1.createCfnOutput)(`${id}-segmentName`, scope, segment.name);
|
|
@@ -416,10 +416,10 @@ class IamManager {
|
|
|
416
416
|
policies: [
|
|
417
417
|
{
|
|
418
418
|
policyDocument: policy,
|
|
419
|
-
policyName: scope.resourceNameFormatter(`${id}-policy`),
|
|
419
|
+
policyName: scope.resourceNameFormatter.format(`${id}-policy`),
|
|
420
420
|
},
|
|
421
421
|
],
|
|
422
|
-
roleName: scope.resourceNameFormatter(id),
|
|
422
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
423
423
|
});
|
|
424
424
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.attrArn);
|
|
425
425
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -440,7 +440,7 @@ class IamManager {
|
|
|
440
440
|
assumedBy: new aws_iam_1.ServicePrincipal('events.amazonaws.com'),
|
|
441
441
|
description: `Role for ${id} ECS Task execution from EventBridge`,
|
|
442
442
|
inlinePolicies: { policy },
|
|
443
|
-
roleName: scope.resourceNameFormatter(id),
|
|
443
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
444
444
|
});
|
|
445
445
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
446
446
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -460,7 +460,7 @@ class IamManager {
|
|
|
460
460
|
managedPolicies: [
|
|
461
461
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AmazonECSTaskExecutionRolePolicy`, 'arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy'),
|
|
462
462
|
],
|
|
463
|
-
roleName: scope.resourceNameFormatter(id),
|
|
463
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
464
464
|
});
|
|
465
465
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
466
466
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -481,7 +481,7 @@ class IamManager {
|
|
|
481
481
|
managedPolicies: [
|
|
482
482
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AWSLambdaBasicExecutionRole`, 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'),
|
|
483
483
|
],
|
|
484
|
-
roleName: scope.resourceNameFormatter(id),
|
|
484
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
485
485
|
});
|
|
486
486
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
487
487
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -499,7 +499,7 @@ class IamManager {
|
|
|
499
499
|
assumedBy: servicePrincipal ?? new aws_iam_1.ServicePrincipal('appconfig.amazonaws.com'),
|
|
500
500
|
description: `Role for ${id} AppConfig Secrets`,
|
|
501
501
|
inlinePolicies: { policy },
|
|
502
|
-
roleName: scope.resourceNameFormatter(id),
|
|
502
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
503
503
|
});
|
|
504
504
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
505
505
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -520,7 +520,7 @@ class IamManager {
|
|
|
520
520
|
managedPolicies: [
|
|
521
521
|
aws_iam_1.ManagedPolicy.fromManagedPolicyArn(scope, `${id}-AWSLambdaBasicExecutionRole`, 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'),
|
|
522
522
|
],
|
|
523
|
-
roleName: scope.resourceNameFormatter(id),
|
|
523
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
524
524
|
});
|
|
525
525
|
(0, utils_1.createCfnOutput)(`${id}Arn`, scope, role.roleArn);
|
|
526
526
|
(0, utils_1.createCfnOutput)(`${id}Name`, scope, role.roleName);
|
|
@@ -537,7 +537,7 @@ class IamManager {
|
|
|
537
537
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
538
538
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
539
539
|
description: `Role for ${id} Pipe`,
|
|
540
|
-
roleName: scope.resourceNameFormatter(id),
|
|
540
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
541
541
|
});
|
|
542
542
|
role.addToPolicy(this.statementForPollQueue([queueArn]));
|
|
543
543
|
role.addToPolicy(this.statementForStartExecution([stepFunctionArn]));
|
|
@@ -556,7 +556,7 @@ class IamManager {
|
|
|
556
556
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
557
557
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
558
558
|
description: `Role for ${id} Pipe`,
|
|
559
|
-
roleName: scope.resourceNameFormatter(id),
|
|
559
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
560
560
|
});
|
|
561
561
|
role.addToPolicy(this.statementForPollQueue([queueArn]));
|
|
562
562
|
role.addToPolicy(this.statementForInvokeLambda([lambdaArn]));
|
|
@@ -600,7 +600,7 @@ class IamManager {
|
|
|
600
600
|
const role = new aws_iam_1.Role(scope, `${id}`, {
|
|
601
601
|
assumedBy: new aws_iam_1.ServicePrincipal('pipes.amazonaws.com'),
|
|
602
602
|
description: `Role for ${id} Pipe`,
|
|
603
|
-
roleName: scope.resourceNameFormatter(id),
|
|
603
|
+
roleName: scope.resourceNameFormatter.format(id),
|
|
604
604
|
});
|
|
605
605
|
role.addToPolicy(this.statementFordynamoDbStream([dynamoDbStreamArn]));
|
|
606
606
|
role.addToPolicy(this.statementForInvokeLambda([lambdaFunctionArn]));
|