@gradientedge/cdk-utils-aws 1.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +31 -0
  2. package/dist/src/common/construct.d.ts +2 -2
  3. package/dist/src/common/construct.js +2 -2
  4. package/dist/src/common/resource-name-formatter.d.ts +1 -0
  5. package/dist/src/common/resource-name-formatter.js +1 -0
  6. package/dist/src/common/stack.d.ts +4 -3
  7. package/dist/src/common/stack.js +6 -5
  8. package/dist/src/common/types.d.ts +2 -0
  9. package/dist/src/construct/api-to-any-target/main.d.ts +2 -1
  10. package/dist/src/construct/api-to-any-target/main.js +3 -2
  11. package/dist/src/construct/api-to-any-target/target.d.ts +1 -0
  12. package/dist/src/construct/api-to-any-target/target.js +1 -0
  13. package/dist/src/construct/api-to-any-target/types.d.ts +4 -0
  14. package/dist/src/construct/api-to-eventbridge-target/api.d.ts +2 -1
  15. package/dist/src/construct/api-to-eventbridge-target/api.js +2 -1
  16. package/dist/src/construct/api-to-eventbridge-target/event.d.ts +2 -1
  17. package/dist/src/construct/api-to-eventbridge-target/event.js +2 -1
  18. package/dist/src/construct/api-to-eventbridge-target/main.d.ts +3 -2
  19. package/dist/src/construct/api-to-eventbridge-target/main.js +6 -5
  20. package/dist/src/construct/api-to-eventbridge-target/types.d.ts +8 -3
  21. package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +2 -1
  22. package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +2 -1
  23. package/dist/src/construct/api-to-eventbridge-target-with-sns/main.d.ts +3 -2
  24. package/dist/src/construct/api-to-eventbridge-target-with-sns/main.js +6 -5
  25. package/dist/src/construct/api-to-eventbridge-target-with-sns/types.d.ts +3 -1
  26. package/dist/src/construct/api-to-lambda-target/api.d.ts +2 -1
  27. package/dist/src/construct/api-to-lambda-target/api.js +2 -1
  28. package/dist/src/construct/api-to-lambda-target/main.d.ts +1 -0
  29. package/dist/src/construct/api-to-lambda-target/main.js +2 -1
  30. package/dist/src/construct/api-to-lambda-target/types.d.ts +5 -2
  31. package/dist/src/construct/application-configuration/main.d.ts +1 -0
  32. package/dist/src/construct/application-configuration/main.js +1 -0
  33. package/dist/src/construct/application-configuration/types.d.ts +1 -0
  34. package/dist/src/construct/event-handler/handler.d.ts +1 -0
  35. package/dist/src/construct/event-handler/handler.js +1 -0
  36. package/dist/src/construct/event-handler/main.d.ts +2 -1
  37. package/dist/src/construct/event-handler/main.js +2 -1
  38. package/dist/src/construct/event-handler/types.d.ts +2 -0
  39. package/dist/src/construct/lambda-with-iam-access/main.d.ts +2 -1
  40. package/dist/src/construct/lambda-with-iam-access/main.js +2 -1
  41. package/dist/src/construct/lambda-with-iam-access/types.d.ts +2 -0
  42. package/dist/src/construct/piped-event-handler/main.d.ts +2 -1
  43. package/dist/src/construct/piped-event-handler/main.js +2 -1
  44. package/dist/src/construct/piped-event-handler/types.d.ts +1 -0
  45. package/dist/src/construct/rest-api-lambda/main.d.ts +3 -2
  46. package/dist/src/construct/rest-api-lambda/main.js +3 -2
  47. package/dist/src/construct/rest-api-lambda/types.d.ts +3 -1
  48. package/dist/src/construct/rest-api-lambda-with-cache/main.d.ts +4 -3
  49. package/dist/src/construct/rest-api-lambda-with-cache/main.js +3 -2
  50. package/dist/src/construct/rest-api-lambda-with-cache/types.d.ts +1 -0
  51. package/dist/src/construct/site-with-ecs-backend/constants.d.ts +1 -0
  52. package/dist/src/construct/site-with-ecs-backend/constants.js +1 -0
  53. package/dist/src/construct/site-with-ecs-backend/main.d.ts +2 -1
  54. package/dist/src/construct/site-with-ecs-backend/main.js +5 -4
  55. package/dist/src/construct/site-with-ecs-backend/types.d.ts +7 -2
  56. package/dist/src/construct/site-with-lambda-backend/constants.d.ts +2 -0
  57. package/dist/src/construct/site-with-lambda-backend/constants.js +2 -0
  58. package/dist/src/construct/site-with-lambda-backend/main.d.ts +2 -1
  59. package/dist/src/construct/site-with-lambda-backend/main.js +5 -4
  60. package/dist/src/construct/site-with-lambda-backend/types.d.ts +5 -0
  61. package/dist/src/construct/static-asset-deployment/main.d.ts +2 -1
  62. package/dist/src/construct/static-asset-deployment/main.js +4 -3
  63. package/dist/src/construct/static-asset-deployment/types.d.ts +3 -0
  64. package/dist/src/construct/static-site/main.d.ts +2 -1
  65. package/dist/src/construct/static-site/main.js +3 -2
  66. package/dist/src/construct/static-site/types.d.ts +2 -1
  67. package/dist/src/services/api-gateway/main.d.ts +2 -1
  68. package/dist/src/services/api-gateway/main.js +4 -3
  69. package/dist/src/services/api-gateway/types.d.ts +2 -0
  70. package/dist/src/services/appconfig/constants.d.ts +2 -0
  71. package/dist/src/services/appconfig/constants.js +2 -0
  72. package/dist/src/services/appconfig/main.d.ts +2 -1
  73. package/dist/src/services/appconfig/main.js +8 -7
  74. package/dist/src/services/appconfig/types.d.ts +2 -0
  75. package/dist/src/services/certificate-manager/main.d.ts +13 -11
  76. package/dist/src/services/certificate-manager/main.js +14 -12
  77. package/dist/src/services/certificate-manager/types.d.ts +1 -0
  78. package/dist/src/services/cloudfront/main.d.ts +2 -1
  79. package/dist/src/services/cloudfront/main.js +6 -5
  80. package/dist/src/services/cloudfront/types.d.ts +2 -0
  81. package/dist/src/services/cloudtrail/main.d.ts +2 -1
  82. package/dist/src/services/cloudtrail/main.js +4 -3
  83. package/dist/src/services/cloudtrail/types.d.ts +1 -0
  84. package/dist/src/services/cloudwatch/logs.d.ts +2 -1
  85. package/dist/src/services/cloudwatch/logs.js +7 -6
  86. package/dist/src/services/cloudwatch/main.d.ts +2 -1
  87. package/dist/src/services/cloudwatch/main.js +29 -28
  88. package/dist/src/services/cloudwatch/types.d.ts +11 -0
  89. package/dist/src/services/codebuild/main.d.ts +2 -1
  90. package/dist/src/services/codebuild/main.js +2 -1
  91. package/dist/src/services/constants.d.ts +1 -0
  92. package/dist/src/services/constants.js +1 -0
  93. package/dist/src/services/dynamodb/main.d.ts +2 -1
  94. package/dist/src/services/dynamodb/main.js +6 -5
  95. package/dist/src/services/dynamodb/types.d.ts +2 -0
  96. package/dist/src/services/elastic-container-registry/main.d.ts +2 -1
  97. package/dist/src/services/elastic-container-registry/main.js +2 -1
  98. package/dist/src/services/elastic-container-service/main.d.ts +2 -1
  99. package/dist/src/services/elastic-container-service/main.js +8 -7
  100. package/dist/src/services/elastic-container-service/types.d.ts +6 -0
  101. package/dist/src/services/elastic-file-system/main.d.ts +4 -1
  102. package/dist/src/services/elastic-file-system/main.js +7 -4
  103. package/dist/src/services/elastic-file-system/types.d.ts +2 -0
  104. package/dist/src/services/elastic-kubernetes-service/main.d.ts +2 -1
  105. package/dist/src/services/elastic-kubernetes-service/main.js +4 -3
  106. package/dist/src/services/elastic-kubernetes-service/types.d.ts +1 -0
  107. package/dist/src/services/elasticache/main.d.ts +1 -0
  108. package/dist/src/services/elasticache/main.js +4 -3
  109. package/dist/src/services/elasticache/types.d.ts +2 -0
  110. package/dist/src/services/eventbridge/main.d.ts +3 -2
  111. package/dist/src/services/eventbridge/main.js +18 -17
  112. package/dist/src/services/eventbridge/target.d.ts +6 -5
  113. package/dist/src/services/eventbridge/target.js +4 -4
  114. package/dist/src/services/eventbridge/types.d.ts +6 -0
  115. package/dist/src/services/evidently/main.d.ts +2 -1
  116. package/dist/src/services/evidently/main.js +11 -10
  117. package/dist/src/services/evidently/types.d.ts +5 -0
  118. package/dist/src/services/identity-access-management/main.d.ts +2 -1
  119. package/dist/src/services/identity-access-management/main.js +2 -1
  120. package/dist/src/services/key-management-service/main.d.ts +2 -1
  121. package/dist/src/services/key-management-service/main.js +4 -3
  122. package/dist/src/services/key-management-service/types.d.ts +1 -0
  123. package/dist/src/services/lambda/main.d.ts +2 -1
  124. package/dist/src/services/lambda/main.js +7 -6
  125. package/dist/src/services/lambda/types.d.ts +7 -0
  126. package/dist/src/services/route53/main.d.ts +2 -1
  127. package/dist/src/services/route53/main.js +7 -6
  128. package/dist/src/services/route53/types.d.ts +1 -0
  129. package/dist/src/services/secrets-manager/main.d.ts +2 -1
  130. package/dist/src/services/secrets-manager/main.js +5 -4
  131. package/dist/src/services/secrets-manager/types.d.ts +1 -0
  132. package/dist/src/services/simple-notification-service/main.d.ts +2 -1
  133. package/dist/src/services/simple-notification-service/main.js +6 -5
  134. package/dist/src/services/simple-notification-service/types.d.ts +1 -0
  135. package/dist/src/services/simple-queue-service/main.d.ts +2 -1
  136. package/dist/src/services/simple-queue-service/main.js +4 -3
  137. package/dist/src/services/simple-queue-service/types.d.ts +1 -0
  138. package/dist/src/services/simple-storage-service/main.d.ts +2 -1
  139. package/dist/src/services/simple-storage-service/main.js +5 -4
  140. package/dist/src/services/simple-storage-service/types.d.ts +3 -0
  141. package/dist/src/services/step-function/main.d.ts +2 -1
  142. package/dist/src/services/step-function/main.js +17 -16
  143. package/dist/src/services/step-function/types.d.ts +16 -0
  144. package/dist/src/services/systems-manager/main.d.ts +4 -2
  145. package/dist/src/services/systems-manager/main.js +12 -10
  146. package/dist/src/services/systems-manager/types.d.ts +2 -0
  147. package/dist/src/services/virtual-private-cloud/ipv6.d.ts +1 -0
  148. package/dist/src/services/virtual-private-cloud/ipv6.js +1 -0
  149. package/dist/src/services/virtual-private-cloud/main.d.ts +2 -1
  150. package/dist/src/services/virtual-private-cloud/main.js +4 -3
  151. package/dist/src/services/virtual-private-cloud/types.d.ts +1 -0
  152. package/dist/src/services/web-application-firewall/main.d.ts +2 -1
  153. package/dist/src/services/web-application-firewall/main.js +6 -5
  154. package/dist/src/services/web-application-firewall/types.d.ts +2 -0
  155. package/dist/src/types/index.d.ts +1 -0
  156. package/dist/src/utils/index.d.ts +4 -0
  157. package/dist/src/utils/index.js +4 -0
  158. package/package.json +17 -5
@@ -6,11 +6,13 @@ import { QueueProps } from '../simple-queue-service/index.js';
6
6
  * Props for Lambda@Edge function, matching aws-cdk-lib experimental EdgeFunctionProps.
7
7
  * Inlined because aws-cdk-lib does not export this subpath via its package exports map.
8
8
  */
9
+ /** @category Interface */
9
10
  export interface EdgeFunctionProps extends FunctionProps {
10
11
  readonly stackId?: string;
11
12
  }
12
13
  /**
13
14
  */
15
+ /** @category Interface */
14
16
  export interface ProvisionedConcurrencyProps {
15
17
  maxCapacity: number;
16
18
  minCapacity: number;
@@ -18,6 +20,7 @@ export interface ProvisionedConcurrencyProps {
18
20
  }
19
21
  /**
20
22
  */
23
+ /** @category Interface */
21
24
  export interface LambdaProps extends FunctionProps {
22
25
  dlq?: QueueProps;
23
26
  excludeLastModifiedTimestamp?: boolean;
@@ -30,18 +33,21 @@ export interface LambdaProps extends FunctionProps {
30
33
  }
31
34
  /**
32
35
  */
36
+ /** @category Interface */
33
37
  export interface LambdaAliasProps extends AliasProps {
34
38
  id?: string;
35
39
  provisionedConcurrency?: ProvisionedConcurrencyProps;
36
40
  }
37
41
  /**
38
42
  */
43
+ /** @category Interface */
39
44
  export interface LambdaEdgeProps extends EdgeFunctionProps {
40
45
  tags?: TagProps[];
41
46
  timeoutInSecs?: number;
42
47
  }
43
48
  /**
44
49
  */
50
+ /** @category Interface */
45
51
  export interface LambdaEnvironment {
46
52
  LOG_LEVEL: string;
47
53
  NODE_ENV: string;
@@ -49,6 +55,7 @@ export interface LambdaEnvironment {
49
55
  STAGE?: string;
50
56
  TZ: string;
51
57
  }
58
+ /** @category Interface */
52
59
  export interface SQSEventSourceProps extends SqsEventSourceProps {
53
60
  maxBatchingWindowInSecs: number;
54
61
  }
@@ -4,7 +4,7 @@ import { ARecord, IHostedZone } from 'aws-cdk-lib/aws-route53';
4
4
  import { CommonConstruct } from '../../common/index.js';
5
5
  import { Route53Props } from './types.js';
6
6
  /**
7
- * @classdesc Provides operations on AWS Route53
7
+ * Provides operations on AWS Route53
8
8
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
9
9
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
10
10
  * @example
@@ -18,6 +18,7 @@ import { Route53Props } from './types.js';
18
18
  * }
19
19
  * }
20
20
  * @see [CDK Route53 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53-readme.html}
21
+ * @category Service
21
22
  */
22
23
  export declare class Route53Manager {
23
24
  /**
@@ -2,7 +2,7 @@ import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
2
2
  import { ApiGatewayDomain, CloudFrontTarget } from 'aws-cdk-lib/aws-route53-targets';
3
3
  import { createCfnOutput } from '../../utils/index.js';
4
4
  /**
5
- * @classdesc Provides operations on AWS Route53
5
+ * Provides operations on AWS Route53
6
6
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
7
7
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
8
8
  * @example
@@ -16,6 +16,7 @@ import { createCfnOutput } from '../../utils/index.js';
16
16
  * }
17
17
  * }
18
18
  * @see [CDK Route53 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53-readme.html}
19
+ * @category Service
19
20
  */
20
21
  export class Route53Manager {
21
22
  /**
@@ -27,7 +28,7 @@ export class Route53Manager {
27
28
  createHostedZone(id, scope, props) {
28
29
  let hostedZone;
29
30
  if (!props)
30
- throw `Route53 props undefined for ${id}`;
31
+ throw new Error(`Route53 props undefined for ${id}`);
31
32
  if (props.useExistingHostedZone) {
32
33
  hostedZone = HostedZone.fromLookup(scope, `${id}`, {
33
34
  domainName: scope.props.domainName,
@@ -77,9 +78,9 @@ export class Route53Manager {
77
78
  */
78
79
  createCloudFrontTargetARecord(id, scope, distribution, hostedZone, recordName, skipStageFromRecord) {
79
80
  if (!distribution)
80
- throw `Distribution undefined for ${id}`;
81
+ throw new Error(`Distribution undefined for ${id}`);
81
82
  if (!hostedZone)
82
- throw `HostedZone undefined for ${id}`;
83
+ throw new Error(`HostedZone undefined for ${id}`);
83
84
  const aRecord = new ARecord(scope, `${id}`, {
84
85
  recordName: (recordName && scope.isProductionStage()) || skipStageFromRecord
85
86
  ? `${recordName}`
@@ -100,9 +101,9 @@ export class Route53Manager {
100
101
  */
101
102
  createCloudFrontTargetARecordV2(id, scope, distribution, hostedZone, recordName) {
102
103
  if (!distribution)
103
- throw `Distribution undefined for ${id}`;
104
+ throw new Error(`Distribution undefined for ${id}`);
104
105
  if (!hostedZone)
105
- throw `HostedZone undefined for ${id}`;
106
+ throw new Error(`HostedZone undefined for ${id}`);
106
107
  const aRecord = new ARecord(scope, `${id}`, {
107
108
  recordName: recordName,
108
109
  target: RecordTarget.fromAlias(new CloudFrontTarget(distribution)),
@@ -1,6 +1,7 @@
1
1
  import { HostedZoneProps } from 'aws-cdk-lib/aws-route53';
2
2
  /**
3
3
  */
4
+ /** @category Interface */
4
5
  export interface Route53Props extends HostedZoneProps {
5
6
  useExistingHostedZone?: boolean;
6
7
  }
@@ -2,7 +2,7 @@ import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
2
2
  import { CommonConstruct } from '../../common/index.js';
3
3
  import { SecretBaseProps } from './types.js';
4
4
  /**
5
- * @classdesc Provides operations on AWS Secrets Manager.
5
+ * Provides operations on AWS Secrets Manager.
6
6
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
7
7
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
8
8
  * @example
@@ -16,6 +16,7 @@ import { SecretBaseProps } from './types.js';
16
16
  * }
17
17
  * }
18
18
  * @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
19
+ * @category Service
19
20
  */
20
21
  export declare class SecretsManager {
21
22
  /**
@@ -3,7 +3,7 @@ import { Fn } from 'aws-cdk-lib';
3
3
  import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
4
4
  import { createCfnOutput, determineCredentials } from '../../utils/index.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Secrets Manager.
6
+ * Provides operations on AWS Secrets Manager.
7
7
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
8
8
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
9
  * @example
@@ -17,6 +17,7 @@ import { createCfnOutput, determineCredentials } from '../../utils/index.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export class SecretsManager {
22
23
  /**
@@ -27,9 +28,9 @@ export class SecretsManager {
27
28
  */
28
29
  createSecret(id, scope, props) {
29
30
  if (!props)
30
- throw `Secret props undefined for ${id}`;
31
+ throw new Error(`Secret props undefined for ${id}`);
31
32
  if (!props.secretName)
32
- throw `Secret name undefined for ${id}`;
33
+ throw new Error(`Secret name undefined for ${id}`);
33
34
  const secret = new Secret(scope, `${id}`, {
34
35
  ...props,
35
36
  secretName: scope.resourceNameFormatter.format(props.secretName, scope.props.resourceNameOptions?.secret),
@@ -64,7 +65,7 @@ export class SecretsManager {
64
65
  });
65
66
  const response = await client.send(command);
66
67
  if (!response.SecretString)
67
- throw `Unable to resolve secret for ${secretId}`;
68
+ throw new Error(`Unable to resolve secret for ${secretId}`);
68
69
  const secretString = JSON.parse(response.SecretString);
69
70
  return secretString[secretKey];
70
71
  }
@@ -1,3 +1,4 @@
1
1
  import { SecretProps } from 'aws-cdk-lib/aws-secretsmanager';
2
+ /** @category Interface */
2
3
  export interface SecretBaseProps extends SecretProps {
3
4
  }
@@ -3,7 +3,7 @@ import { Topic } from 'aws-cdk-lib/aws-sns';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { SubscriptionProps } from './types.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Simple Notification Service.
6
+ * Provides operations on AWS Simple Notification Service.
7
7
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
8
8
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
9
  * @example
@@ -17,6 +17,7 @@ import { SubscriptionProps } from './types.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Simple Notification Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export declare class SnsManager {
22
23
  /**
@@ -3,7 +3,7 @@ import { EmailSubscription, LambdaSubscription } from 'aws-cdk-lib/aws-sns-subsc
3
3
  import _ from 'lodash';
4
4
  import { createCfnOutput } from '../../utils/index.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Simple Notification Service.
6
+ * Provides operations on AWS Simple Notification Service.
7
7
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
8
8
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
9
  * @example
@@ -17,6 +17,7 @@ import { createCfnOutput } from '../../utils/index.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Simple Notification Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export class SnsManager {
22
23
  /**
@@ -28,9 +29,9 @@ export class SnsManager {
28
29
  */
29
30
  createEmailNotificationService(id, scope, props, emails) {
30
31
  if (!props)
31
- throw `Subscription props undefined for ${id}`;
32
+ throw new Error(`Subscription props undefined for ${id}`);
32
33
  if (!props.topicName)
33
- throw `Subscription topicName undefined for ${id}`;
34
+ throw new Error(`Subscription topicName undefined for ${id}`);
34
35
  const topic = new Topic(scope, id, {
35
36
  ...props,
36
37
  displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
@@ -52,9 +53,9 @@ export class SnsManager {
52
53
  */
53
54
  createLambdaNotificationService(id, scope, props, lambdaFunction) {
54
55
  if (!props)
55
- throw `Subscription props undefined for ${id}`;
56
+ throw new Error(`Subscription props undefined for ${id}`);
56
57
  if (!props.topicName)
57
- throw `Subscription topicName undefined for ${id}`;
58
+ throw new Error(`Subscription topicName undefined for ${id}`);
58
59
  const topic = new Topic(scope, id, {
59
60
  ...props,
60
61
  displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
@@ -1,5 +1,6 @@
1
1
  import { TopicProps } from 'aws-cdk-lib/aws-sns';
2
2
  /**
3
3
  */
4
+ /** @category Interface */
4
5
  export interface SubscriptionProps extends TopicProps {
5
6
  }
@@ -3,7 +3,7 @@ import { CommonConstruct } from '../../common/index.js';
3
3
  import { LambdaProps } from '../lambda/index.js';
4
4
  import { QueueProps } from './types.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Simple Queue Service.
6
+ * Provides operations on AWS Simple Queue Service.
7
7
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
8
8
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
9
  * @example
@@ -17,6 +17,7 @@ import { QueueProps } from './types.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Simple Queue Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export declare class SqsManager {
22
23
  /**
@@ -3,7 +3,7 @@ import { Queue } from 'aws-cdk-lib/aws-sqs';
3
3
  import _ from 'lodash';
4
4
  import { createCfnOutput } from '../../utils/index.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Simple Queue Service.
6
+ * Provides operations on AWS Simple Queue Service.
7
7
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
8
8
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
9
  * @example
@@ -17,6 +17,7 @@ import { createCfnOutput } from '../../utils/index.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Simple Queue Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export class SqsManager {
22
23
  /**
@@ -28,9 +29,9 @@ export class SqsManager {
28
29
  */
29
30
  createQueue(id, scope, props, deadLetterQueue) {
30
31
  if (!props)
31
- throw `Queue props undefined for ${id}`;
32
+ throw new Error(`Queue props undefined for ${id}`);
32
33
  if (!props.queueName)
33
- throw `Queue queueName undefined for ${id}`;
34
+ throw new Error(`Queue queueName undefined for ${id}`);
34
35
  let queueName = scope.resourceNameFormatter.format(props.queueName, scope.props.resourceNameOptions?.sqs);
35
36
  if (props.fifo)
36
37
  queueName += '.fifo';
@@ -2,6 +2,7 @@ import * as sqs from 'aws-cdk-lib/aws-sqs';
2
2
  import { TagProps } from '../../types/index.js';
3
3
  /**
4
4
  */
5
+ /** @category Interface */
5
6
  export interface QueueProps extends sqs.QueueProps {
6
7
  dataKeyReuseInSecs?: number;
7
8
  deliveryDelayInSecs?: number;
@@ -4,7 +4,7 @@ import { ISource } from 'aws-cdk-lib/aws-s3-deployment';
4
4
  import { CommonConstruct } from '../../common/index.js';
5
5
  import { LifecycleRule, S3BucketProps } from './types.js';
6
6
  /**
7
- * @classdesc Provides operations on AWS S3
7
+ * Provides operations on AWS S3
8
8
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
9
9
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
10
10
  * @example
@@ -18,6 +18,7 @@ import { LifecycleRule, S3BucketProps } from './types.js';
18
18
  * }
19
19
  * }
20
20
  * @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
21
+ * @category Service
21
22
  */
22
23
  export declare class S3Manager {
23
24
  /**
@@ -5,7 +5,7 @@ import { BucketDeployment, ServerSideEncryption, Source } from 'aws-cdk-lib/aws-
5
5
  import _ from 'lodash';
6
6
  import { createCfnOutput } from '../../utils/index.js';
7
7
  /**
8
- * @classdesc Provides operations on AWS S3
8
+ * Provides operations on AWS S3
9
9
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
10
10
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
11
11
  * @example
@@ -19,6 +19,7 @@ import { createCfnOutput } from '../../utils/index.js';
19
19
  * }
20
20
  * }
21
21
  * @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
22
+ * @category Service
22
23
  */
23
24
  export class S3Manager {
24
25
  /**
@@ -80,7 +81,7 @@ export class S3Manager {
80
81
  */
81
82
  createS3Bucket(id, scope, props) {
82
83
  if (!props)
83
- throw `S3 props undefined for ${id}`;
84
+ throw new Error(`S3 props undefined for ${id}`);
84
85
  let bucket;
85
86
  const bucketName = S3Manager.determineBucketName(scope, props, props.bucketName);
86
87
  if (props.existingBucket && props.bucketName) {
@@ -176,8 +177,8 @@ export class S3Manager {
176
177
  * @param folders list of folder names to be created in the bucket
177
178
  */
178
179
  createBucketFolders(id, scope, bucket, folders) {
179
- if (!folders || folders.length == 0) {
180
- throw `Folder unspecified for ${id}`;
180
+ if (!folders || folders.length === 0) {
181
+ throw new Error(`Folder unspecified for ${id}`);
181
182
  }
182
183
  _.forEach(folders, folder => {
183
184
  new BucketDeployment(scope, `${id}-${folder}`, {
@@ -3,18 +3,21 @@ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
3
3
  import { TagProps } from '../../types/index.js';
4
4
  /**
5
5
  */
6
+ /** @category Interface */
6
7
  export interface LifecycleRule extends s3.LifecycleRule {
7
8
  expirationInDays?: number;
8
9
  noncurrentVersionExpirationInDays?: number;
9
10
  }
10
11
  /**
11
12
  */
13
+ /** @category Interface */
12
14
  export interface BucketDeploymentProps extends s3deploy.BucketDeploymentProps {
13
15
  expirationInDays?: number;
14
16
  noncurrentVersionExpirationInDays?: number;
15
17
  }
16
18
  /**
17
19
  */
20
+ /** @category Interface */
18
21
  export interface S3BucketProps extends s3.BucketProps {
19
22
  bucketName: string;
20
23
  enableEventBridge?: boolean;
@@ -9,7 +9,7 @@ import { CallApiGatewayRestApiEndpoint, DynamoAttributeValue, DynamoDeleteItem,
9
9
  import { CommonConstruct } from '../../common/index.js';
10
10
  import { SfnCallApiGatewayRestApiEndpointProps, SfnChoiceProps, SfnDynamoDeleteItemProps, SfnDynamoGetItemProps, SfnDynamoPutItemProps, SfnFailProps, SfnLambdaInvokeProps, SfnMapProps, SfnParallelProps, SfnPassProps, SfnSqsSendMessageProps, SfnStartExecutionProps, SfnStateMachineProps, SfnSucceedProps, SfnWaitProps } from './types.js';
11
11
  /**
12
- * @classdesc Provides operations on AWS Step Functions Service.
12
+ * Provides operations on AWS Step Functions Service.
13
13
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
14
14
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
15
15
  * @example
@@ -23,6 +23,7 @@ import { SfnCallApiGatewayRestApiEndpointProps, SfnChoiceProps, SfnDynamoDeleteI
23
23
  * }
24
24
  * }
25
25
  * @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
26
+ * @category Service
26
27
  */
27
28
  export declare class SfnManager {
28
29
  /**
@@ -13,7 +13,7 @@ const DEFAULT_RETRY_CONFIG = [
13
13
  },
14
14
  ];
15
15
  /**
16
- * @classdesc Provides operations on AWS Step Functions Service.
16
+ * Provides operations on AWS Step Functions Service.
17
17
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
18
18
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
19
19
  * @example
@@ -27,6 +27,7 @@ const DEFAULT_RETRY_CONFIG = [
27
27
  * }
28
28
  * }
29
29
  * @see [CDK Step Functions Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html}
30
+ * @category Service
30
31
  */
31
32
  export class SfnManager {
32
33
  /**
@@ -37,7 +38,7 @@ export class SfnManager {
37
38
  */
38
39
  createSuccessStep(id, scope, props) {
39
40
  if (!props)
40
- throw `Step props undefined for ${id}`;
41
+ throw new Error(`Step props undefined for ${id}`);
41
42
  return new Succeed(scope, `${props.name}`, {
42
43
  ...props,
43
44
  comment: `Succeed step for ${props.name} - ${scope.props.stage} stage`,
@@ -51,7 +52,7 @@ export class SfnManager {
51
52
  */
52
53
  createFailStep(id, scope, props) {
53
54
  if (!props)
54
- throw `Step props undefined for ${id}`;
55
+ throw new Error(`Step props undefined for ${id}`);
55
56
  return new Fail(scope, `${props.name}`, {
56
57
  ...props,
57
58
  comment: `Fail step for ${props.name} - ${scope.props.stage} stage`,
@@ -65,7 +66,7 @@ export class SfnManager {
65
66
  */
66
67
  createPassStep(id, scope, props) {
67
68
  if (!props)
68
- throw `Step props undefined for ${id}`;
69
+ throw new Error(`Step props undefined for ${id}`);
69
70
  return new Pass(scope, `${props.name}`, {
70
71
  ...props,
71
72
  comment: `Pass step for ${props.name} - ${scope.props.stage} stage`,
@@ -79,7 +80,7 @@ export class SfnManager {
79
80
  */
80
81
  createParallelStep(id, scope, props) {
81
82
  if (!props)
82
- throw `Step props undefined for ${id}`;
83
+ throw new Error(`Step props undefined for ${id}`);
83
84
  return new Parallel(scope, `${props.name}`, {
84
85
  ...props,
85
86
  comment: `Parallel step for ${props.name} - ${scope.props.stage} stage`,
@@ -93,7 +94,7 @@ export class SfnManager {
93
94
  */
94
95
  createChoiceStep(id, scope, props) {
95
96
  if (!props)
96
- throw `Step props undefined for ${id}`;
97
+ throw new Error(`Step props undefined for ${id}`);
97
98
  return new Choice(scope, `${props.name}`, {
98
99
  ...props,
99
100
  comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
@@ -122,7 +123,7 @@ export class SfnManager {
122
123
  */
123
124
  createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
124
125
  if (!props)
125
- throw `Step props undefined for ${id}`;
126
+ throw new Error(`Step props undefined for ${id}`);
126
127
  const step = new DynamoGetItem(scope, `${props.name}`, {
127
128
  ...props,
128
129
  comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
@@ -151,7 +152,7 @@ export class SfnManager {
151
152
  */
152
153
  createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
153
154
  if (!props)
154
- throw `Step props undefined for ${id}`;
155
+ throw new Error(`Step props undefined for ${id}`);
155
156
  const step = new DynamoPutItem(scope, `${props.name}`, {
156
157
  ...props,
157
158
  comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
@@ -180,7 +181,7 @@ export class SfnManager {
180
181
  */
181
182
  createDynamoDbDeleteItemStep(id, scope, props, table, tableKey) {
182
183
  if (!props)
183
- throw `Step props undefined for ${id}`;
184
+ throw new Error(`Step props undefined for ${id}`);
184
185
  const step = new DynamoDeleteItem(scope, `${props.name}`, {
185
186
  ...props,
186
187
  comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
@@ -208,9 +209,9 @@ export class SfnManager {
208
209
  */
209
210
  createSendSqsMessageStep(id, scope, props, queue) {
210
211
  if (!props)
211
- throw `Step props undefined for ${id}`;
212
+ throw new Error(`Step props undefined for ${id}`);
212
213
  if (!props.messageBody)
213
- throw 'Message body undefined';
214
+ throw new Error('Message body undefined');
214
215
  const step = new SqsSendMessage(scope, `${props.name}`, {
215
216
  ...props,
216
217
  comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
@@ -237,7 +238,7 @@ export class SfnManager {
237
238
  */
238
239
  createLambdaStep(id, scope, props, lambdaFunction) {
239
240
  if (!props)
240
- throw `Step props undefined for ${id}`;
241
+ throw new Error(`Step props undefined for ${id}`);
241
242
  const step = new LambdaInvoke(scope, `${props.name}`, {
242
243
  ...props,
243
244
  comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
@@ -265,7 +266,7 @@ export class SfnManager {
265
266
  */
266
267
  createSkippableLambdaStep(id, scope, props, lambdaFunction, skipExecution) {
267
268
  if (!props)
268
- throw `Step props undefined for ${id}`;
269
+ throw new Error(`Step props undefined for ${id}`);
269
270
  if (skipExecution)
270
271
  return this.createPassStep(id, scope, { comment: props.comment, name: props.name });
271
272
  const step = new LambdaInvoke(scope, `${props.name}`, {
@@ -294,7 +295,7 @@ export class SfnManager {
294
295
  */
295
296
  createApiStep(id, scope, props, api) {
296
297
  if (!props)
297
- throw `Step props undefined for ${id}`;
298
+ throw new Error(`Step props undefined for ${id}`);
298
299
  const step = new CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
299
300
  ...props,
300
301
  api,
@@ -359,9 +360,9 @@ export class SfnManager {
359
360
  */
360
361
  createStateMachine(id, scope, props, definition, logGroup, role) {
361
362
  if (!props)
362
- throw `State Machine props undefined for ${id}`;
363
+ throw new Error(`State Machine props undefined for ${id}`);
363
364
  if (!props.stateMachineName)
364
- throw `State Machine stateMachineName undefined for ${id}`;
365
+ throw new Error(`State Machine stateMachineName undefined for ${id}`);
365
366
  const stateMachine = new StateMachine(scope, `${id}`, {
366
367
  ...props,
367
368
  definitionBody: DefinitionBody.fromChainable(definition),
@@ -2,87 +2,103 @@ import { ChoiceProps, FailProps, MapProps, ParallelProps, PassProps, RetryProps,
2
2
  import { CallApiGatewayRestApiEndpointProps, DynamoDeleteItemProps, DynamoGetItemProps, DynamoPutItemProps, LambdaInvokeProps, SqsSendMessageProps, StepFunctionsStartExecutionProps } from 'aws-cdk-lib/aws-stepfunctions-tasks';
3
3
  /**
4
4
  */
5
+ /** @category Interface */
5
6
  export interface SfnSucceedProps extends SucceedProps {
6
7
  name: string;
7
8
  }
8
9
  /**
9
10
  */
11
+ /** @category Interface */
10
12
  export interface SfnRetryProps extends RetryProps {
11
13
  intervalInSecs: number;
12
14
  }
13
15
  /**
14
16
  */
17
+ /** @category Interface */
15
18
  export interface SfnFailProps extends FailProps {
16
19
  name: string;
17
20
  }
18
21
  /**
19
22
  */
23
+ /** @category Interface */
20
24
  export interface SfnPassProps extends PassProps {
21
25
  name: string;
22
26
  }
23
27
  /**
24
28
  */
29
+ /** @category Interface */
25
30
  export interface SfnDynamoGetItemProps extends DynamoGetItemProps {
26
31
  name: string;
27
32
  retries?: SfnRetryProps[];
28
33
  }
29
34
  /**
30
35
  */
36
+ /** @category Interface */
31
37
  export interface SfnDynamoPutItemProps extends DynamoPutItemProps {
32
38
  name: string;
33
39
  retries?: SfnRetryProps[];
34
40
  }
35
41
  /**
36
42
  */
43
+ /** @category Interface */
37
44
  export interface SfnDynamoDeleteItemProps extends DynamoDeleteItemProps {
38
45
  name: string;
39
46
  retries?: SfnRetryProps[];
40
47
  }
41
48
  /**
42
49
  */
50
+ /** @category Interface */
43
51
  export interface SfnSqsSendMessageProps extends SqsSendMessageProps {
44
52
  name: string;
45
53
  retries?: SfnRetryProps[];
46
54
  }
47
55
  /**
48
56
  */
57
+ /** @category Interface */
49
58
  export interface SfnParallelProps extends ParallelProps {
50
59
  name: string;
51
60
  retries?: SfnRetryProps[];
52
61
  }
53
62
  /**
54
63
  */
64
+ /** @category Interface */
55
65
  export interface SfnChoiceProps extends ChoiceProps {
56
66
  name: string;
57
67
  }
58
68
  /**
59
69
  */
70
+ /** @category Interface */
60
71
  export interface SfnWaitProps extends WaitProps {
61
72
  name: string;
62
73
  delayInSeconds: number;
63
74
  }
64
75
  /**
65
76
  */
77
+ /** @category Interface */
66
78
  export interface SfnLambdaInvokeProps extends LambdaInvokeProps {
67
79
  name: string;
68
80
  retries?: SfnRetryProps[];
69
81
  }
70
82
  /**
71
83
  */
84
+ /** @category Interface */
72
85
  export interface SfnCallApiGatewayRestApiEndpointProps extends CallApiGatewayRestApiEndpointProps {
73
86
  name: string;
74
87
  retries?: SfnRetryProps[];
75
88
  }
76
89
  /**
77
90
  */
91
+ /** @category Interface */
78
92
  export interface SfnStateMachineProps extends StateMachineProps {
79
93
  }
80
94
  /**
81
95
  */
96
+ /** @category Interface */
82
97
  export interface SfnMapProps extends MapProps {
83
98
  }
84
99
  /**
85
100
  */
101
+ /** @category Interface */
86
102
  export interface SfnStartExecutionProps extends StepFunctionsStartExecutionProps {
87
103
  retries?: SfnRetryProps[];
88
104
  }