@gradientedge/cdk-utils 9.13.0 → 9.14.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.
Files changed (107) hide show
  1. package/dist/src/lib/aws/common/stack.d.ts +1 -0
  2. package/dist/src/lib/aws/common/stack.js +1 -0
  3. package/dist/src/lib/aws/common/types.d.ts +3 -0
  4. package/dist/src/lib/aws/construct/api-to-any-target/main.js +2 -2
  5. package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +3 -3
  6. package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +4 -4
  7. package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +1 -1
  8. package/dist/src/lib/aws/services/api-gateway/main.js +1 -1
  9. package/dist/src/lib/aws/services/api-gateway/types.d.ts +0 -3
  10. package/dist/src/lib/aws/services/appconfig/main.js +2 -2
  11. package/dist/src/lib/aws/services/appconfig/types.d.ts +0 -2
  12. package/dist/src/lib/aws/services/cloudfront/main.js +2 -2
  13. package/dist/src/lib/aws/services/cloudfront/types.d.ts +0 -2
  14. package/dist/src/lib/aws/services/cloudtrail/main.js +1 -1
  15. package/dist/src/lib/aws/services/cloudtrail/types.d.ts +0 -2
  16. package/dist/src/lib/aws/services/cloudwatch/logs.js +6 -2
  17. package/dist/src/lib/aws/services/cloudwatch/main.js +3 -0
  18. package/dist/src/lib/aws/services/codebuild/main.js +1 -1
  19. package/dist/src/lib/aws/services/dynamodb/main.js +2 -2
  20. package/dist/src/lib/aws/services/dynamodb/types.d.ts +0 -3
  21. package/dist/src/lib/aws/services/elastic-container-service/main.js +2 -2
  22. package/dist/src/lib/aws/services/elastic-container-service/types.d.ts +0 -2
  23. package/dist/src/lib/aws/services/elastic-file-system/main.js +1 -1
  24. package/dist/src/lib/aws/services/elastic-file-system/types.d.ts +0 -2
  25. package/dist/src/lib/aws/services/elastic-kubernetes-service/main.js +1 -1
  26. package/dist/src/lib/aws/services/elastic-kubernetes-service/types.d.ts +0 -2
  27. package/dist/src/lib/aws/services/elasticache/main.js +1 -1
  28. package/dist/src/lib/aws/services/elasticache/types.d.ts +0 -2
  29. package/dist/src/lib/aws/services/eventbridge/main.js +9 -9
  30. package/dist/src/lib/aws/services/eventbridge/types.d.ts +0 -7
  31. package/dist/src/lib/aws/services/evidently/main.js +4 -4
  32. package/dist/src/lib/aws/services/evidently/types.d.ts +0 -5
  33. package/dist/src/lib/aws/services/identity-access-management/main.d.ts +20 -20
  34. package/dist/src/lib/aws/services/identity-access-management/main.js +71 -70
  35. package/dist/src/lib/aws/services/key-management-service/main.js +1 -1
  36. package/dist/src/lib/aws/services/key-management-service/types.d.ts +0 -2
  37. package/dist/src/lib/aws/services/lambda/main.js +7 -8
  38. package/dist/src/lib/aws/services/lambda/types.d.ts +0 -3
  39. package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
  40. package/dist/src/lib/aws/services/secrets-manager/types.d.ts +0 -2
  41. package/dist/src/lib/aws/services/simple-notification-service/main.js +4 -4
  42. package/dist/src/lib/aws/services/simple-notification-service/types.d.ts +0 -2
  43. package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -1
  44. package/dist/src/lib/aws/services/simple-queue-service/types.d.ts +0 -2
  45. package/dist/src/lib/aws/services/simple-storage-service/main.js +1 -1
  46. package/dist/src/lib/aws/services/simple-storage-service/types.d.ts +0 -2
  47. package/dist/src/lib/aws/services/step-function/main.js +1 -1
  48. package/dist/src/lib/aws/services/step-function/types.d.ts +0 -2
  49. package/dist/src/lib/aws/services/systems-manager/main.js +1 -1
  50. package/dist/src/lib/aws/services/systems-manager/types.d.ts +0 -2
  51. package/dist/src/lib/aws/services/virtual-private-cloud/main.js +2 -2
  52. package/dist/src/lib/aws/services/virtual-private-cloud/types.d.ts +0 -2
  53. package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -2
  54. package/dist/src/lib/aws/services/web-application-firewall/types.d.ts +0 -3
  55. package/package.json +6 -6
  56. package/src/lib/aws/common/stack.ts +1 -0
  57. package/src/lib/aws/common/types.ts +1 -0
  58. package/src/lib/aws/construct/api-to-any-target/main.ts +2 -2
  59. package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +3 -3
  60. package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +4 -4
  61. package/src/lib/aws/construct/api-to-lambda-target/main.ts +1 -1
  62. package/src/lib/aws/services/api-gateway/main.ts +1 -1
  63. package/src/lib/aws/services/api-gateway/types.ts +1 -4
  64. package/src/lib/aws/services/appconfig/main.ts +5 -2
  65. package/src/lib/aws/services/appconfig/types.ts +0 -1
  66. package/src/lib/aws/services/cloudfront/main.ts +2 -2
  67. package/src/lib/aws/services/cloudfront/types.ts +0 -1
  68. package/src/lib/aws/services/cloudtrail/main.ts +1 -1
  69. package/src/lib/aws/services/cloudtrail/types.ts +1 -3
  70. package/src/lib/aws/services/cloudwatch/logs.ts +4 -2
  71. package/src/lib/aws/services/cloudwatch/main.ts +5 -0
  72. package/src/lib/aws/services/codebuild/main.ts +1 -1
  73. package/src/lib/aws/services/dynamodb/main.ts +2 -2
  74. package/src/lib/aws/services/dynamodb/types.ts +0 -2
  75. package/src/lib/aws/services/elastic-container-service/main.ts +5 -2
  76. package/src/lib/aws/services/elastic-container-service/types.ts +0 -1
  77. package/src/lib/aws/services/elastic-file-system/main.ts +1 -1
  78. package/src/lib/aws/services/elastic-file-system/types.ts +0 -1
  79. package/src/lib/aws/services/elastic-kubernetes-service/main.ts +1 -1
  80. package/src/lib/aws/services/elastic-kubernetes-service/types.ts +0 -1
  81. package/src/lib/aws/services/elasticache/main.ts +1 -1
  82. package/src/lib/aws/services/elasticache/types.ts +1 -3
  83. package/src/lib/aws/services/eventbridge/main.ts +12 -9
  84. package/src/lib/aws/services/eventbridge/types.ts +1 -8
  85. package/src/lib/aws/services/evidently/main.ts +4 -4
  86. package/src/lib/aws/services/evidently/types.ts +4 -12
  87. package/src/lib/aws/services/identity-access-management/main.ts +80 -79
  88. package/src/lib/aws/services/key-management-service/main.ts +1 -1
  89. package/src/lib/aws/services/key-management-service/types.ts +1 -3
  90. package/src/lib/aws/services/lambda/main.ts +13 -7
  91. package/src/lib/aws/services/lambda/types.ts +0 -2
  92. package/src/lib/aws/services/secrets-manager/main.ts +1 -1
  93. package/src/lib/aws/services/secrets-manager/types.ts +1 -3
  94. package/src/lib/aws/services/simple-notification-service/main.ts +4 -4
  95. package/src/lib/aws/services/simple-notification-service/types.ts +1 -3
  96. package/src/lib/aws/services/simple-queue-service/main.ts +1 -1
  97. package/src/lib/aws/services/simple-queue-service/types.ts +0 -1
  98. package/src/lib/aws/services/simple-storage-service/main.ts +1 -1
  99. package/src/lib/aws/services/simple-storage-service/types.ts +0 -1
  100. package/src/lib/aws/services/step-function/main.ts +4 -1
  101. package/src/lib/aws/services/step-function/types.ts +1 -3
  102. package/src/lib/aws/services/systems-manager/main.ts +1 -1
  103. package/src/lib/aws/services/systems-manager/types.ts +1 -3
  104. package/src/lib/aws/services/virtual-private-cloud/main.ts +2 -2
  105. package/src/lib/aws/services/virtual-private-cloud/types.ts +0 -1
  106. package/src/lib/aws/services/web-application-firewall/main.ts +2 -2
  107. package/src/lib/aws/services/web-application-firewall/types.ts +2 -6
@@ -35,6 +35,7 @@ export declare class CommonStack extends Stack {
35
35
  region: any;
36
36
  globalPrefix: any;
37
37
  globalSuffix: any;
38
+ resourceNameOptions: any;
38
39
  resourcePrefix: any;
39
40
  resourceSuffix: any;
40
41
  skipStageForARecords: any;
@@ -55,6 +55,7 @@ class CommonStack extends aws_cdk_lib_1.Stack {
55
55
  region: this.node.tryGetContext('region'),
56
56
  globalPrefix: this.node.tryGetContext('globalPrefix'),
57
57
  globalSuffix: this.node.tryGetContext('globalSuffix'),
58
+ resourceNameOptions: this.node.tryGetContext('resourceNameOptions'),
58
59
  resourcePrefix: this.node.tryGetContext('resourcePrefix'),
59
60
  resourceSuffix: this.node.tryGetContext('resourceSuffix'),
60
61
  skipStageForARecords: this.node.tryGetContext('skipStageForARecords'),
@@ -17,6 +17,9 @@ export interface CommonStackProps extends BaseProps, StackProps {
17
17
  excludeDomainNameForBuckets?: boolean;
18
18
  excludeAccountNumberForBuckets?: boolean;
19
19
  nodejsRuntime?: Runtime;
20
+ resourceNameOptions?: {
21
+ [key: string]: ResourceNameFormatterProps;
22
+ };
20
23
  }
21
24
  export interface ResourceNameFormatterProps {
22
25
  globalPrefix?: boolean;
@@ -75,7 +75,7 @@ class ApiToAnyTarget extends common_1.CommonConstruct {
75
75
  }
76
76
  createApiToAnyTargetRestApiLogGroup() {
77
77
  this.apiToAnyTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
78
- logGroupName: `/custom/api/${this.id}-rest-api-access`,
78
+ logGroupName: `${this.id}-access`,
79
79
  removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
80
80
  });
81
81
  }
@@ -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.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
115
+ restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway),
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);
@@ -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.format(this.id)}/events/api-to-eventbridge-target`,
124
+ logGroupName: `${this.id}-api-to-event-bridge-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.format(this.id)}-rest-api-access`,
293
+ logGroupName: `${this.id}-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.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
336
+ restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway),
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);
@@ -199,7 +199,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
199
199
  if (this.props.api.useExisting)
200
200
  return;
201
201
  this.apiEvent.logGroupSuccess = this.logManager.createLogGroup(`${this.id}-destination-success-log`, this, {
202
- logGroupName: `/${this.id}/events/api-destination-success`,
202
+ logGroupName: `${this.id}-destination`,
203
203
  ...this.props.event.logGroupSuccess,
204
204
  });
205
205
  }
@@ -233,7 +233,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
233
233
  if (this.props.api.useExisting)
234
234
  return;
235
235
  this.apiEvent.logGroupFailure = this.logManager.createLogGroup(`${this.id}-destination-failure-log`, this, {
236
- logGroupName: `/${this.id}/events/api-destination-failure`,
236
+ logGroupName: `${this.id}-destination-failure`,
237
237
  ...this.props.event.logGroupFailure,
238
238
  });
239
239
  }
@@ -410,7 +410,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
410
410
  return;
411
411
  }
412
412
  const accessLogGroup = this.logManager.createLogGroup(`${this.id}-sns-rest-api-access-log`, this, {
413
- logGroupName: `/custom/api/${this.id}-destined-rest-api-access`,
413
+ logGroupName: `${this.id}-access`,
414
414
  removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
415
415
  });
416
416
  if (!this.props.api.restApi?.restApiName)
@@ -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.format(this.props.api.restApi?.restApiName, this.props.api.restApi?.resourceNameOptions),
441
+ restApiName: this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway),
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);
@@ -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.format(this.id)}-rest-api-access`,
117
+ logGroupName: `${this.id}-access`,
118
118
  removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
119
119
  });
120
120
  this.props.api.restApi = {
@@ -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.format(props.restApiName, props.resourceNameOptions),
58
+ restApiName: scope.resourceNameFormatter.format(props.restApiName, scope.props.resourceNameOptions?.apigateway),
59
59
  });
60
60
  if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
61
61
  lodash_1.default.forEach(props.tags, tag => {
@@ -1,13 +1,10 @@
1
1
  import { LambdaRestApiProps as LambdaRestApigProps, RestApiProps } from 'aws-cdk-lib/aws-apigateway';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  import { TagProps } from '../../types';
4
3
  /**
5
4
  */
6
5
  export interface LambdaRestApiProps extends LambdaRestApigProps {
7
6
  tags?: TagProps[];
8
7
  minCompressionSizeInBytes?: number;
9
- resourceNameOptions?: ResourceNameFormatterProps;
10
8
  }
11
9
  export interface RestApigProps extends RestApiProps {
12
- resourceNameOptions?: ResourceNameFormatterProps;
13
10
  }
@@ -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.format(props.application.name, props.resourceNameOptions),
53
+ name: scope.resourceNameFormatter.format(props.application.name, scope.props.resourceNameOptions?.appconfig),
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.format(props.configurationProfile.name, props.resourceNameOptions),
95
+ name: scope.resourceNameFormatter.format(props.configurationProfile.name, scope.props.resourceNameOptions?.appconfig),
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);
@@ -1,5 +1,4 @@
1
1
  import { CfnApplicationProps, CfnConfigurationProfileProps, CfnDeploymentProps, CfnDeploymentStrategyProps, CfnEnvironmentProps } from 'aws-cdk-lib/aws-appconfig';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface AppConfigProps {
@@ -9,5 +8,4 @@ export interface AppConfigProps {
9
8
  deploymentStrategy: CfnDeploymentStrategyProps;
10
9
  environment: CfnEnvironmentProps;
11
10
  id: string;
12
- resourceNameOptions?: ResourceNameFormatterProps;
13
11
  }
@@ -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.format(props.functionName, props.resourceNameOptions),
240
+ functionName: scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.cloudfront),
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.format(props.functionName, props.resourceNameOptions),
300
+ functionName: scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.cloudfront),
301
301
  });
302
302
  (0, utils_1.createCfnOutput)(`${id}-functionArn`, scope, cloudfrontFunction.functionArn);
303
303
  (0, utils_1.createCfnOutput)(`${id}-functionName`, scope, cloudfrontFunction.functionName);
@@ -1,5 +1,4 @@
1
1
  import { DistributionProps as CfDistributionProps, CloudFrontWebDistributionProps, FunctionProps } from 'aws-cdk-lib/aws-cloudfront';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  import { TagProps } from '../../types';
4
3
  /**
5
4
  */
@@ -16,5 +15,4 @@ export interface DistributionProps extends CfDistributionProps {
16
15
  export interface CloudfrontFunctionProps extends FunctionProps {
17
16
  eventType: string;
18
17
  functionFilePath: string;
19
- resourceNameOptions?: ResourceNameFormatterProps;
20
18
  }
@@ -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.format(props.trailName, props.resourceNameOptions),
65
+ trailName: scope.resourceNameFormatter.format(props.trailName, scope.props.resourceNameOptions?.cloudtrail),
66
66
  });
67
67
  cloudTrail.addDependency(logBucketPolicy);
68
68
  cloudTrail.addDependency(logGroup);
@@ -1,7 +1,5 @@
1
1
  import { CfnTrailProps } from 'aws-cdk-lib/aws-cloudtrail';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface CloudTrailProps extends CfnTrailProps {
6
- resourceNameOptions?: ResourceNameFormatterProps;
7
5
  }
@@ -84,9 +84,11 @@ class LogManager {
84
84
  createCfnLogGroup(id, scope, props) {
85
85
  if (!props)
86
86
  throw `Logs props undefined for ${id}`;
87
+ if (!props.logGroupName)
88
+ throw `Logs logGroupName undefined for ${id}`;
87
89
  const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
88
90
  ...props,
89
- logGroupName: `${props.logGroupName}-${scope.props.stage}`,
91
+ logGroupName: `/${scope.resourceNameFormatter.format(props.logGroupName, scope.props.resourceNameOptions?.logs)}`,
90
92
  retentionInDays: props.retention,
91
93
  });
92
94
  if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
@@ -106,9 +108,11 @@ class LogManager {
106
108
  createLogGroup(id, scope, props) {
107
109
  if (!props)
108
110
  throw `Logs props undefined for ${id}`;
111
+ if (!props.logGroupName)
112
+ throw `Logs logGroupName undefined for ${id}`;
109
113
  const logGroup = new logs.LogGroup(scope, `${id}`, {
110
114
  ...props,
111
- logGroupName: `${props.logGroupName}-${scope.props.stage}`,
115
+ logGroupName: `/${scope.resourceNameFormatter.format(props.logGroupName, scope.props.resourceNameOptions?.logs)}`,
112
116
  removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
113
117
  retention: props.retention,
114
118
  });
@@ -116,8 +116,11 @@ class CloudWatchManager {
116
116
  createDashboard(id, scope, props, widgets) {
117
117
  if (!props)
118
118
  throw `Dashboard props undefined for ${id}`;
119
+ if (!props.dashboardName)
120
+ throw `Dashboard dashboardName undefined for ${id}`;
119
121
  const dashboard = new watch.Dashboard(scope, `${id}`, {
120
122
  ...props,
123
+ dashboardName: scope.resourceNameFormatter.format(props.dashboardName, scope.props.resourceNameOptions?.cloudwatch),
121
124
  end: CloudWatchManager.determineTimeRange(props.end),
122
125
  start: CloudWatchManager.determineTimeRange(props.start),
123
126
  widgets,
@@ -63,7 +63,7 @@ class CodeBuildManager {
63
63
  }),
64
64
  },
65
65
  },
66
- role: scope.iamManager.roleForCloudfrontInvalidation(id, scope),
66
+ role: scope.iamManager.createRoleForCloudfrontInvalidation(id, scope),
67
67
  timeout: aws_cdk_lib_1.Duration.minutes(5),
68
68
  });
69
69
  }
@@ -38,7 +38,7 @@ class DynamodbManager {
38
38
  throw `Table tableName undefined for ${id}`;
39
39
  const table = new aws_dynamodb_1.Table(scope, `${id}`, {
40
40
  ...props,
41
- tableName: scope.resourceNameFormatter.format(props.tableName, props.resourceNameOptions),
41
+ tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
42
42
  });
43
43
  if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
44
44
  lodash_1.default.forEach(props.tags, tag => {
@@ -62,7 +62,7 @@ class DynamodbManager {
62
62
  throw `Table tableName undefined for ${id}`;
63
63
  const table = new aws_dynamodb_1.TableV2(scope, `${id}`, {
64
64
  ...props,
65
- tableName: scope.resourceNameFormatter.format(props.tableName, props.resourceNameOptions),
65
+ tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
66
66
  });
67
67
  if (props.tags && !lodash_1.default.isEmpty(props.tags)) {
68
68
  lodash_1.default.forEach(props.tags, tag => {
@@ -1,13 +1,10 @@
1
1
  import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  import { TagProps } from '../../types';
4
3
  /**
5
4
  */
6
5
  export interface TableProps extends dynamodb.TableProps {
7
- resourceNameOptions?: ResourceNameFormatterProps;
8
6
  tags?: TagProps[];
9
7
  }
10
8
  export interface TablePropsV2 extends dynamodb.TablePropsV2 {
11
- resourceNameOptions?: ResourceNameFormatterProps;
12
9
  tags?: TagProps[];
13
10
  }
@@ -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.format(props.loadBalancerName, props.resourceNameOptions),
128
+ loadBalancerName: scope.resourceNameFormatter.format(props.loadBalancerName, scope.props.resourceNameOptions?.ecs),
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.format(props.serviceName, props.resourceNameOptions),
133
+ serviceName: scope.resourceNameFormatter.format(props.serviceName, scope.props.resourceNameOptions?.ecs),
134
134
  taskImageOptions: {
135
135
  ...props.taskImageOptions,
136
136
  enableLogging: props.taskImageOptions?.enableLogging ?? true,
@@ -2,7 +2,6 @@ import { ScalingSchedule } from 'aws-cdk-lib/aws-applicationautoscaling';
2
2
  import { AwsLogDriverProps, ClusterProps, HealthCheck as FargateHealthCheck, MountPoint, TaskDefinitionProps } from 'aws-cdk-lib/aws-ecs';
3
3
  import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-patterns';
4
4
  import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
5
- import { ResourceNameFormatterProps } from '../../common';
6
5
  import { TagProps } from '../../types';
7
6
  /**
8
7
  */
@@ -43,5 +42,4 @@ export interface EcsApplicationLoadBalancedFargateServiceProps extends Applicati
43
42
  logging?: AwsLogDriverProps;
44
43
  mountPoints?: MountPoint[];
45
44
  siteScaling?: EcsScalingProps;
46
- resourceNameOptions?: ResourceNameFormatterProps;
47
45
  }
@@ -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.format(props.fileSystemName, props.resourceNameOptions),
55
+ fileSystemName: scope.resourceNameFormatter.format(props.fileSystemName, scope.props.resourceNameOptions?.efs),
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,
@@ -1,6 +1,5 @@
1
1
  import { AuthorizationConfig } from 'aws-cdk-lib/aws-ecs';
2
2
  import { AccessPointOptions, FileSystemProps } from 'aws-cdk-lib/aws-efs';
3
- import { ResourceNameFormatterProps } from '../../common';
4
3
  /**
5
4
  */
6
5
  export interface EfsFileSystemProps extends FileSystemProps {
@@ -9,7 +8,6 @@ export interface EfsFileSystemProps extends FileSystemProps {
9
8
  rootDirectory?: string;
10
9
  transitEncryption?: string;
11
10
  transitEncryptionPort?: number;
12
- resourceNameOptions?: ResourceNameFormatterProps;
13
11
  }
14
12
  /**
15
13
  */
@@ -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.format(props.clusterName, props.resourceNameOptions),
76
+ clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.eks),
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,
@@ -1,9 +1,7 @@
1
1
  import { ClusterProps } from 'aws-cdk-lib/aws-eks';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface EksClusterProps extends ClusterProps {
6
5
  appCapacity: number;
7
6
  appContainerPort: number;
8
- resourceNameOptions?: ResourceNameFormatterProps;
9
7
  }
@@ -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.format(props.clusterName, props.resourceNameOptions),
59
+ clusterName: scope.resourceNameFormatter.format(props.clusterName, scope.props.resourceNameOptions?.elasticache),
60
60
  logDeliveryConfigurations,
61
61
  vpcSecurityGroupIds: securityGroupIds,
62
62
  });
@@ -1,9 +1,7 @@
1
1
  import { CfnCacheClusterProps, CfnReplicationGroupProps } from 'aws-cdk-lib/aws-elasticache';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface ElastiCacheProps extends CfnCacheClusterProps {
6
- resourceNameOptions?: ResourceNameFormatterProps;
7
5
  }
8
6
  /**
9
7
  */
@@ -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.format(props.eventBusName, props.resourceNameOptions);
44
+ eventBusName = scope.resourceNameFormatter.format(props.eventBusName, scope.props.resourceNameOptions?.eventbridgeBus);
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.format(props.ruleName, props.resourceNameOptions),
70
+ ruleName: scope.resourceNameFormatter.format(props.ruleName, scope.props.resourceNameOptions?.eventbridgeRule),
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.format(props.name, props.resourceNameOptions),
106
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
107
107
  scheduleExpression,
108
108
  targets: [
109
109
  {
110
110
  arn: lambdaFunction.functionArn,
111
- id: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
111
+ id: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
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.format(props.name, props.resourceNameOptions),
151
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
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.format(props.name, props.resourceNameOptions),
163
+ id: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgeRule),
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.format(props.name, props.resourceNameOptions),
188
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
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.format(props.name, props.resourceNameOptions),
234
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
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.format(props.name, props.resourceNameOptions),
277
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventbridgePipe),
278
278
  roleArn: pipeRole.roleArn,
279
279
  source: sourceDynamoDbStreamArn,
280
280
  sourceParameters: {
@@ -1,6 +1,5 @@
1
1
  import { CfnRuleProps, EventBusProps as EBProps, RuleProps as EBRuleProps } from 'aws-cdk-lib/aws-events';
2
2
  import { CfnPipeProps } from 'aws-cdk-lib/aws-pipes';
3
- import { ResourceNameFormatterProps } from '../../common';
4
3
  import { TagProps } from '../../types';
5
4
  /**
6
5
  */
@@ -10,7 +9,6 @@ export interface SqsToSfnPipeProps extends CfnPipeProps {
10
9
  sfnInvocationType?: string;
11
10
  sqsBatchSize?: number;
12
11
  sqsMaximumBatchingWindowInSeconds?: number;
13
- resourceNameOptions?: ResourceNameFormatterProps;
14
12
  }
15
13
  /**
16
14
  */
@@ -19,25 +17,21 @@ export interface SqsToLambdaPipeProps extends CfnPipeProps {
19
17
  sqsBatchSize?: number;
20
18
  lambdaInputTemplate?: string;
21
19
  sqsMaximumBatchingWindowInSeconds?: number;
22
- resourceNameOptions?: ResourceNameFormatterProps;
23
20
  }
24
21
  /**
25
22
  */
26
23
  export interface EventRuleProps extends EBRuleProps {
27
- resourceNameOptions?: ResourceNameFormatterProps;
28
24
  tags?: TagProps[];
29
25
  }
30
26
  /**
31
27
  */
32
28
  export interface RuleProps extends CfnRuleProps {
33
29
  input?: string;
34
- resourceNameOptions?: ResourceNameFormatterProps;
35
30
  tags?: TagProps[];
36
31
  }
37
32
  /**
38
33
  */
39
34
  export interface EventBusProps extends EBProps {
40
- resourceNameOptions?: ResourceNameFormatterProps;
41
35
  }
42
36
  /**
43
37
  }
@@ -46,5 +40,4 @@ export interface DynamoDbToLambdaPipeProps extends CfnPipeProps {
46
40
  pipeFilterPattern?: any;
47
41
  dynamoDbBatchSize?: number;
48
42
  dynamoDbStartingPosition: string;
49
- resourceNameOptions?: ResourceNameFormatterProps;
50
43
  }
@@ -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.format(props.name, props.resourceNameOptions),
37
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.evidentlyProject),
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.format(props.name, props.resourceNameOptions),
71
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.evidentlyLaunch),
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.format(props.name, props.resourceNameOptions),
91
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.evidentlyExperiment),
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.format(props.name, props.resourceNameOptions),
111
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.evidentlySegment),
112
112
  });
113
113
  (0, utils_1.createCfnOutput)(`${id}-segmentArn`, scope, segment.attrArn);
114
114
  (0, utils_1.createCfnOutput)(`${id}-segmentName`, scope, segment.name);
@@ -1,9 +1,7 @@
1
1
  import { CfnExperimentProps, CfnFeatureProps, CfnLaunchProps, CfnProjectProps, CfnSegmentProps } from 'aws-cdk-lib/aws-evidently';
2
- import { ResourceNameFormatterProps } from '../../common';
3
2
  /**
4
3
  */
5
4
  export interface EvidentlyProjectProps extends CfnProjectProps {
6
- resourceNameOptions?: ResourceNameFormatterProps;
7
5
  }
8
6
  /**
9
7
  */
@@ -12,15 +10,12 @@ export interface EvidentlyFeatureProps extends CfnFeatureProps {
12
10
  /**
13
11
  */
14
12
  export interface EvidentlyLaunchProps extends CfnLaunchProps {
15
- resourceNameOptions?: ResourceNameFormatterProps;
16
13
  }
17
14
  /**
18
15
  */
19
16
  export interface EvidentlyExperimentProps extends CfnExperimentProps {
20
- resourceNameOptions?: ResourceNameFormatterProps;
21
17
  }
22
18
  /**
23
19
  */
24
20
  export interface EvidentlySegmentProps extends CfnSegmentProps {
25
- resourceNameOptions?: ResourceNameFormatterProps;
26
21
  }