@gradientedge/cdk-utils 9.13.0 → 9.15.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 +4 -4
  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 +10 -10
  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 +7 -4
  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 +13 -10
  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
@@ -260,44 +260,6 @@ export class IamManager {
260
260
  })
261
261
  }
262
262
 
263
- /**
264
- * @summary Method to create iam policy to invalidate cloudfront cache
265
- * @param resourceArns list of ARNs to allow access to
266
- */
267
- public policyForCloudfrontInvalidation(resourceArns?: string[]) {
268
- return new PolicyDocument({
269
- statements: [
270
- this.statementForCreateAnyLogStream(),
271
- this.statementForPutAnyLogEvent(),
272
- this.statementForCloudfrontInvalidation(),
273
- new PolicyStatement({
274
- actions: [
275
- 'ecr:GetDownloadUrlForLayer',
276
- 'ecr:BatchGetImage',
277
- 'ecr:BatchCheckLayerAvailability',
278
- 'ecr:GetAuthorizationToken',
279
- ],
280
- effect: Effect.ALLOW,
281
- resources: resourceArns ?? ['*'],
282
- }),
283
- ],
284
- })
285
- }
286
-
287
- /**
288
- * @summary Method to create iam role to invalidate cloudfront cache
289
- * @param id scoped id of the resource
290
- * @param scope scope in which this resource is defined
291
- */
292
- public roleForCloudfrontInvalidation(id: string, scope: CommonConstruct) {
293
- return new Role(scope, `${id}-install-deps-project-role`, {
294
- assumedBy: new ServicePrincipal('codebuild.amazonaws.com'),
295
- inlinePolicies: {
296
- codeBuildPolicy: this.policyForCloudfrontInvalidation(),
297
- },
298
- })
299
- }
300
-
301
263
  /**
302
264
  * @summary Method to create iam statement to assume iam role
303
265
  * @param scope scope in which this resource is defined
@@ -444,6 +406,77 @@ export class IamManager {
444
406
  })
445
407
  }
446
408
 
409
+ /**
410
+ * @summary Method to create iam policy to invalidate cloudfront cache
411
+ * @param resourceArns list of ARNs to allow access to
412
+ */
413
+ public createPolicyForCloudfrontInvalidation(resourceArns?: string[]) {
414
+ return new PolicyDocument({
415
+ statements: [
416
+ this.statementForCreateAnyLogStream(),
417
+ this.statementForPutAnyLogEvent(),
418
+ this.statementForCloudfrontInvalidation(),
419
+ new PolicyStatement({
420
+ actions: [
421
+ 'ecr:GetDownloadUrlForLayer',
422
+ 'ecr:BatchGetImage',
423
+ 'ecr:BatchCheckLayerAvailability',
424
+ 'ecr:GetAuthorizationToken',
425
+ ],
426
+ effect: Effect.ALLOW,
427
+ resources: resourceArns ?? ['*'],
428
+ }),
429
+ ],
430
+ })
431
+ }
432
+
433
+ /**
434
+ * @summary Method to create iam policy for sqs
435
+ * @param id scoped id of the resource
436
+ * @param scope scope in which this resource is defined
437
+ * @param sqsQueue
438
+ * @param eventBridgeRule
439
+ * @param servicePrincipals
440
+ */
441
+ public createPolicyForSqsEvent(
442
+ id: string,
443
+ scope: CommonConstruct,
444
+ sqsQueue: Queue,
445
+ eventBridgeRule: IRule,
446
+ servicePrincipals?: ServicePrincipal[]
447
+ ) {
448
+ return new PolicyDocument({
449
+ statements: [
450
+ new PolicyStatement({
451
+ actions: ['sqs:*'],
452
+ conditions: {
453
+ ArnEquals: {
454
+ 'aws:SourceArn': eventBridgeRule,
455
+ },
456
+ },
457
+ effect: Effect.ALLOW,
458
+ principals: servicePrincipals ?? [new ServicePrincipal('events.amazonaws.com')],
459
+ resources: [sqsQueue.queueArn],
460
+ }),
461
+ ],
462
+ })
463
+ }
464
+
465
+ /**
466
+ * @summary Method to create iam role to invalidate cloudfront cache
467
+ * @param id scoped id of the resource
468
+ * @param scope scope in which this resource is defined
469
+ */
470
+ public createRoleForCloudfrontInvalidation(id: string, scope: CommonConstruct) {
471
+ return new Role(scope, `${id}-install-deps-project-role`, {
472
+ assumedBy: new ServicePrincipal('codebuild.amazonaws.com'),
473
+ inlinePolicies: {
474
+ codeBuildPolicy: this.createPolicyForCloudfrontInvalidation(),
475
+ },
476
+ roleName: scope.resourceNameFormatter.format(`${id}-cf-invalidation`, scope.props.resourceNameOptions?.iam),
477
+ })
478
+ }
479
+
447
480
  /**
448
481
  * @summary Method to create iam statement for cloud trail
449
482
  * @param id scoped id of the resource
@@ -464,7 +497,7 @@ export class IamManager {
464
497
  policyName: scope.resourceNameFormatter.format(`${id}-policy`),
465
498
  },
466
499
  ],
467
- roleName: scope.resourceNameFormatter.format(id),
500
+ roleName: scope.resourceNameFormatter.format(`${id}-trail`, scope.props.resourceNameOptions?.iam),
468
501
  })
469
502
 
470
503
  createCfnOutput(`${id}Arn`, scope, role.attrArn)
@@ -489,7 +522,7 @@ export class IamManager {
489
522
  assumedBy: new ServicePrincipal('events.amazonaws.com'),
490
523
  description: `Role for ${id} ECS Task execution from EventBridge`,
491
524
  inlinePolicies: { policy },
492
- roleName: scope.resourceNameFormatter.format(id),
525
+ roleName: scope.resourceNameFormatter.format(`${id}-ecs-event`, scope.props.resourceNameOptions?.iam),
493
526
  })
494
527
 
495
528
  createCfnOutput(`${id}Arn`, scope, role.roleArn)
@@ -516,7 +549,7 @@ export class IamManager {
516
549
  'arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy'
517
550
  ),
518
551
  ],
519
- roleName: scope.resourceNameFormatter.format(id),
552
+ roleName: scope.resourceNameFormatter.format(`${id}-ecs-exec`, scope.props.resourceNameOptions?.iam),
520
553
  })
521
554
 
522
555
  createCfnOutput(`${id}Arn`, scope, role.roleArn)
@@ -549,7 +582,7 @@ export class IamManager {
549
582
  'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
550
583
  ),
551
584
  ],
552
- roleName: scope.resourceNameFormatter.format(id),
585
+ roleName: scope.resourceNameFormatter.format(`${id}-lambda`, scope.props.resourceNameOptions?.iam),
553
586
  })
554
587
 
555
588
  createCfnOutput(`${id}Arn`, scope, role.roleArn)
@@ -575,7 +608,7 @@ export class IamManager {
575
608
  assumedBy: servicePrincipal ?? new ServicePrincipal('appconfig.amazonaws.com'),
576
609
  description: `Role for ${id} AppConfig Secrets`,
577
610
  inlinePolicies: { policy },
578
- roleName: scope.resourceNameFormatter.format(id),
611
+ roleName: scope.resourceNameFormatter.format(`${id}-app-secrets`, scope.props.resourceNameOptions?.iam),
579
612
  })
580
613
 
581
614
  createCfnOutput(`${id}Arn`, scope, role.roleArn)
@@ -608,7 +641,7 @@ export class IamManager {
608
641
  'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
609
642
  ),
610
643
  ],
611
- roleName: scope.resourceNameFormatter.format(id),
644
+ roleName: scope.resourceNameFormatter.format(`${id}-sfn-exec`, scope.props.resourceNameOptions?.iam),
612
645
  })
613
646
 
614
647
  createCfnOutput(`${id}Arn`, scope, role.roleArn)
@@ -628,7 +661,7 @@ export class IamManager {
628
661
  const role = new Role(scope, `${id}`, {
629
662
  assumedBy: new ServicePrincipal('pipes.amazonaws.com'),
630
663
  description: `Role for ${id} Pipe`,
631
- roleName: scope.resourceNameFormatter.format(id),
664
+ roleName: scope.resourceNameFormatter.format(`${id}-pipe`, scope.props.resourceNameOptions?.iam),
632
665
  })
633
666
 
634
667
  role.addToPolicy(this.statementForPollQueue([queueArn]))
@@ -651,7 +684,7 @@ export class IamManager {
651
684
  const role = new Role(scope, `${id}`, {
652
685
  assumedBy: new ServicePrincipal('pipes.amazonaws.com'),
653
686
  description: `Role for ${id} Pipe`,
654
- roleName: scope.resourceNameFormatter.format(id),
687
+ roleName: scope.resourceNameFormatter.format(`${id}-pipe`, scope.props.resourceNameOptions?.iam),
655
688
  })
656
689
 
657
690
  role.addToPolicy(this.statementForPollQueue([queueArn]))
@@ -663,38 +696,6 @@ export class IamManager {
663
696
  return role
664
697
  }
665
698
 
666
- /**
667
- * @summary Method to create iam policy for sqs
668
- * @param id scoped id of the resource
669
- * @param scope scope in which this resource is defined
670
- * @param sqsQueue
671
- * @param eventBridgeRule
672
- * @param servicePrincipals
673
- */
674
- public createPolicyForSqsEvent(
675
- id: string,
676
- scope: CommonConstruct,
677
- sqsQueue: Queue,
678
- eventBridgeRule: IRule,
679
- servicePrincipals?: ServicePrincipal[]
680
- ) {
681
- return new PolicyDocument({
682
- statements: [
683
- new PolicyStatement({
684
- actions: ['sqs:*'],
685
- conditions: {
686
- ArnEquals: {
687
- 'aws:SourceArn': eventBridgeRule,
688
- },
689
- },
690
- effect: Effect.ALLOW,
691
- principals: servicePrincipals ?? [new ServicePrincipal('events.amazonaws.com')],
692
- resources: [sqsQueue.queueArn],
693
- }),
694
- ],
695
- })
696
- }
697
-
698
699
  /**
699
700
  * @summary Method to create iam statement for dynamoDb to lambda function pipe
700
701
  * @param id scoped id of the resource
@@ -711,7 +712,7 @@ export class IamManager {
711
712
  const role = new Role(scope, `${id}`, {
712
713
  assumedBy: new ServicePrincipal('pipes.amazonaws.com'),
713
714
  description: `Role for ${id} Pipe`,
714
- roleName: scope.resourceNameFormatter.format(id),
715
+ roleName: scope.resourceNameFormatter.format(`${id}-pipe`, scope.props.resourceNameOptions?.iam),
715
716
  })
716
717
 
717
718
  role.addToPolicy(this.statementFordynamoDbStream([dynamoDbStreamArn]))
@@ -32,7 +32,7 @@ export class KmsManager {
32
32
 
33
33
  const key = new Key(scope, `${id}`, {
34
34
  ...props,
35
- alias: scope.resourceNameFormatter.format(props.alias, props.resourceNameOptions),
35
+ alias: scope.resourceNameFormatter.format(props.alias, scope.props.resourceNameOptions?.kms),
36
36
  })
37
37
 
38
38
  createCfnOutput(`${id}-keyId`, scope, key.keyId)
@@ -3,6 +3,4 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  /**
5
5
  */
6
- export interface KmsKeyProps extends KeyProps {
7
- resourceNameOptions?: ResourceNameFormatterProps
8
- }
6
+ export interface KmsKeyProps extends KeyProps {}
@@ -53,7 +53,7 @@ export class LambdaManager {
53
53
  compatibleArchitectures: architectures ?? [Architecture.ARM_64],
54
54
  compatibleRuntimes: [scope.props.nodejsRuntime ?? CommonStack.NODEJS_RUNTIME],
55
55
  description: `${id}`,
56
- layerVersionName: `${id}-${scope.props.stage}`,
56
+ layerVersionName: scope.resourceNameFormatter.format(id, scope.props.resourceNameOptions?.lambdaLayer),
57
57
  })
58
58
 
59
59
  createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
@@ -110,7 +110,10 @@ export class LambdaManager {
110
110
  if (!props) throw `Lambda props undefined for ${id}`
111
111
  if (!props.functionName) throw `Lambda functionName undefined for ${id}`
112
112
 
113
- const functionName = scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions)
113
+ const functionName = scope.resourceNameFormatter.format(
114
+ props.functionName,
115
+ scope.props.resourceNameOptions?.lambdaFunction
116
+ )
114
117
 
115
118
  let deadLetterQueue
116
119
  if (props.deadLetterQueueEnabled) {
@@ -143,8 +146,8 @@ export class LambdaManager {
143
146
  functionName,
144
147
  handler: handler || 'index.lambda_handler',
145
148
  layers,
146
- logGroup: new LogGroup(scope, `${id}-log-group`, {
147
- logGroupName: `/aws/lambda/${functionName}`,
149
+ logGroup: scope.logManager.createLogGroup(`${id}-log-group`, scope, {
150
+ logGroupName: props.functionName,
148
151
  removalPolicy: RemovalPolicy.DESTROY,
149
152
  retention: scope.props.logRetention ?? logRetention,
150
153
  }),
@@ -268,7 +271,10 @@ export class LambdaManager {
268
271
  if (!props) throw `Lambda props undefined for ${id}`
269
272
  if (!props.functionName) throw `Lambda functionName undefined for ${id}`
270
273
 
271
- const functionName = scope.resourceNameFormatter.format(props.functionName, props.resourceNameOptions)
274
+ const functionName = scope.resourceNameFormatter.format(
275
+ props.functionName,
276
+ scope.props.resourceNameOptions?.lambdaFunction
277
+ )
272
278
 
273
279
  let deadLetterQueue
274
280
  if (props.deadLetterQueueEnabled) {
@@ -299,8 +305,8 @@ export class LambdaManager {
299
305
  },
300
306
  filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
301
307
  functionName,
302
- logGroup: new LogGroup(scope, `${id}-log-group`, {
303
- logGroupName: `/aws/lambda/${functionName}`,
308
+ logGroup: scope.logManager.createLogGroup(`${id}-log-group`, scope, {
309
+ logGroupName: props.functionName,
304
310
  removalPolicy: RemovalPolicy.DESTROY,
305
311
  retention: scope.props.logRetention ?? logRetention,
306
312
  }),
@@ -23,7 +23,6 @@ export interface LambdaProps extends FunctionProps {
23
23
  redriveq?: QueueProps
24
24
  tags?: TagProps[]
25
25
  timeoutInSecs?: number
26
- resourceNameOptions?: ResourceNameFormatterProps
27
26
  }
28
27
 
29
28
  /**
@@ -38,7 +37,6 @@ export interface LambdaAliasProps extends AliasProps {
38
37
  export interface LambdaEdgeProps extends EdgeFunctionProps {
39
38
  tags?: TagProps[]
40
39
  timeoutInSecs?: number
41
- resourceNameOptions?: ResourceNameFormatterProps
42
40
  }
43
41
 
44
42
  /**
@@ -34,7 +34,7 @@ export class SecretsManager {
34
34
 
35
35
  const secret = new Secret(scope, `${id}`, {
36
36
  ...props,
37
- secretName: scope.resourceNameFormatter.format(props.secretName, props.resourceNameOptions),
37
+ secretName: scope.resourceNameFormatter.format(props.secretName, scope.props.resourceNameOptions?.secret),
38
38
  })
39
39
 
40
40
  createCfnOutput(`${id}-secretName`, scope, secret.secretName)
@@ -1,6 +1,4 @@
1
1
  import { SecretProps } from 'aws-cdk-lib/aws-secretsmanager'
2
2
  import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
- export interface SecretBaseProps extends SecretProps {
5
- resourceNameOptions?: ResourceNameFormatterProps
6
- }
4
+ export interface SecretBaseProps extends SecretProps {}
@@ -41,8 +41,8 @@ export class SnsManager {
41
41
 
42
42
  const topic = new Topic(scope, id, {
43
43
  ...props,
44
- displayName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
45
- topicName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
44
+ displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
45
+ topicName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
46
46
  })
47
47
 
48
48
  if (emails && !_.isEmpty(emails)) {
@@ -73,8 +73,8 @@ export class SnsManager {
73
73
 
74
74
  const topic = new Topic(scope, id, {
75
75
  ...props,
76
- displayName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
77
- topicName: scope.resourceNameFormatter.format(props.topicName, props.resourceNameOptions),
76
+ displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
77
+ topicName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
78
78
  })
79
79
 
80
80
  topic.addSubscription(new LambdaSubscription(lambdaFunction))
@@ -3,6 +3,4 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  /**
5
5
  */
6
- export interface SubscriptionProps extends TopicProps {
7
- resourceNameOptions?: ResourceNameFormatterProps
8
- }
6
+ export interface SubscriptionProps extends TopicProps {}
@@ -34,7 +34,7 @@ export class SqsManager {
34
34
  if (!props) throw `Queue props undefined for ${id}`
35
35
  if (!props.queueName) throw `Queue queueName undefined for ${id}`
36
36
 
37
- let queueName = scope.resourceNameFormatter.format(props.queueName, props.resourceNameOptions)
37
+ let queueName = scope.resourceNameFormatter.format(props.queueName, scope.props.resourceNameOptions?.sqs)
38
38
  if (props.fifo) queueName += '.fifo'
39
39
 
40
40
  const queue = new Queue(scope, id, {
@@ -14,5 +14,4 @@ export interface QueueProps extends sqs.QueueProps {
14
14
  retryBatchSize?: number
15
15
  tags?: TagProps[]
16
16
  visibilityTimeoutInSecs?: number
17
- resourceNameOptions?: ResourceNameFormatterProps
18
17
  }
@@ -78,7 +78,7 @@ export class S3Manager {
78
78
  if (!scope.props.excludeAccountNumberForBuckets) {
79
79
  return S3Manager.determineBucketNameByAccountAndRegion(scope, bucketName)
80
80
  }
81
- return scope.resourceNameFormatter.format(bucketName, props.resourceNameOptions)
81
+ return scope.resourceNameFormatter.format(bucketName, scope.props.resourceNameOptions?.s3)
82
82
  }
83
83
 
84
84
  /**
@@ -25,6 +25,5 @@ export interface S3BucketProps extends s3.BucketProps {
25
25
  existingBucket?: boolean
26
26
  lifecycleRules?: LifecycleRule[]
27
27
  logBucketName?: string
28
- resourceNameOptions?: ResourceNameFormatterProps
29
28
  tags?: TagProps[]
30
29
  }
@@ -485,7 +485,10 @@ export class SfnManager {
485
485
  level: props.logs?.level ?? LogLevel.ALL,
486
486
  },
487
487
  role,
488
- stateMachineName: scope.resourceNameFormatter.format(props.stateMachineName, props.resourceNameOptions),
488
+ stateMachineName: scope.resourceNameFormatter.format(
489
+ props.stateMachineName,
490
+ scope.props.resourceNameOptions?.stepFunction
491
+ ),
489
492
  })
490
493
 
491
494
  createCfnOutput(`${id}-stateMachineName`, scope, stateMachine.stateMachineName)
@@ -108,9 +108,7 @@ export interface SfnCallApiGatewayRestApiEndpointProps extends CallApiGatewayRes
108
108
 
109
109
  /**
110
110
  */
111
- export interface SfnStateMachineProps extends StateMachineProps {
112
- resourceNameOptions?: ResourceNameFormatterProps
113
- }
111
+ export interface SfnStateMachineProps extends StateMachineProps {}
114
112
 
115
113
  /**
116
114
  */
@@ -41,7 +41,7 @@ export class SsmManager {
41
41
  const parameter = new StringParameter(scope, `${id}`, {
42
42
  ...props,
43
43
  description: `${props.description} - ${scope.props.stage} stage`,
44
- parameterName: scope.resourceNameFormatter.format(props.parameterName, props.resourceNameOptions),
44
+ parameterName: scope.resourceNameFormatter.format(props.parameterName, scope.props.resourceNameOptions?.ssm),
45
45
  })
46
46
 
47
47
  createCfnOutput(`${id}-parameterArn`, scope, parameter.parameterArn)
@@ -8,6 +8,4 @@ export interface SSMParameterReaderProps {
8
8
  region: string
9
9
  }
10
10
 
11
- export interface SSMStringParameterProps extends StringParameterProps {
12
- resourceNameOptions?: ResourceNameFormatterProps
13
- }
11
+ export interface SSMStringParameterProps extends StringParameterProps {}
@@ -37,7 +37,7 @@ export class VpcManager {
37
37
  if (!props) throw `Vpc props undefined for ${id}`
38
38
  if (!props.vpcName) throw `Vpc vpcName undefined for ${id}`
39
39
 
40
- const vpcName = scope.resourceNameFormatter.format(props.vpcName, props.resourceNameOptions)
40
+ const vpcName = scope.resourceNameFormatter.format(props.vpcName, scope.props.resourceNameOptions?.vpc)
41
41
  let vpc
42
42
  if (props.isIPV6) {
43
43
  vpc = new Ipv6Vpc(scope, `${id}`, {
@@ -85,7 +85,7 @@ export class VpcManager {
85
85
  const vpc = this.createVpc(id, scope, props)
86
86
  Tags.of(vpc).add(
87
87
  'Name',
88
- scope.resourceNameFormatter.format(vpcIdentifier ?? CommonVpcIdentifier, props.resourceNameOptions)
88
+ scope.resourceNameFormatter.format(vpcIdentifier ?? CommonVpcIdentifier, scope.props.resourceNameOptions?.vpc)
89
89
  )
90
90
 
91
91
  return vpc
@@ -3,5 +3,4 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  export interface VpcProps extends ec2.VpcProps {
5
5
  isIPV6?: boolean
6
- resourceNameOptions?: ResourceNameFormatterProps
7
6
  }
@@ -33,7 +33,7 @@ export class WafManager {
33
33
  const ipSet = new CfnIPSet(scope, `${id}`, {
34
34
  ...props,
35
35
  description: `IP Set for ${id} - ${scope.props.stage} stage`,
36
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
36
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.waf),
37
37
  })
38
38
 
39
39
  createCfnOutput(`${id}-ipSetId`, scope, ipSet.attrId)
@@ -55,7 +55,7 @@ export class WafManager {
55
55
  const webAcl = new CfnWebACL(scope, `${id}`, {
56
56
  ...props,
57
57
  description: `Web Acl for ${id} - ${scope.props.stage} stage`,
58
- name: scope.resourceNameFormatter.format(props.name, props.resourceNameOptions),
58
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.waf),
59
59
  tags: [{ key: 'service', value: scope.props.name }],
60
60
  })
61
61
 
@@ -3,12 +3,8 @@ import { ResourceNameFormatterProps } from '../../common'
3
3
 
4
4
  /**
5
5
  */
6
- export interface WafIPSetProps extends CfnIPSetProps {
7
- resourceNameOptions?: ResourceNameFormatterProps
8
- }
6
+ export interface WafIPSetProps extends CfnIPSetProps {}
9
7
 
10
8
  /**
11
9
  */
12
- export interface WafWebACLProps extends CfnWebACLProps {
13
- resourceNameOptions?: ResourceNameFormatterProps
14
- }
10
+ export interface WafWebACLProps extends CfnWebACLProps {}