@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
@@ -3,7 +3,7 @@ import { Cors, Deployment, DomainName, EndpointType, LambdaRestApi, LogGroupLogD
3
3
  import _ from 'lodash';
4
4
  import { createCfnOutput } from '../../utils/index.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS API Gateway.
6
+ * Provides operations on AWS API Gateway.
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
@@ -18,6 +18,7 @@ import { createCfnOutput } from '../../utils/index.js';
18
18
  * }
19
19
  * }
20
20
  * @see [CDK API Gateway Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway-readme.html}
21
+ * @category Service
21
22
  */
22
23
  export class ApiManager {
23
24
  /**
@@ -29,9 +30,9 @@ export class ApiManager {
29
30
  */
30
31
  createLambdaRestApi(id, scope, props, lambdaFunction) {
31
32
  if (!props)
32
- throw `Api props undefined for ${id}`;
33
+ throw new Error(`Api props undefined for ${id}`);
33
34
  if (!props.restApiName)
34
- throw `Api restApiName undefined for ${id}`;
35
+ throw new Error(`Api restApiName undefined for ${id}`);
35
36
  const restApiName = scope.resourceNameFormatter.format(props.restApiName, scope.props.resourceNameOptions?.apigateway);
36
37
  const restApiAccessLogName = scope.resourceNameFormatter.format(`${props.restApiName}-access`, scope.props.resourceNameOptions?.apigateway);
37
38
  const accessLogGroup = scope.logManager.createLogGroup(`${id}-rest-api-access-log`, scope, {
@@ -2,9 +2,11 @@ import { LambdaRestApiProps as LambdaRestApigProps, RestApiProps } from 'aws-cdk
2
2
  import { TagProps } from '../../types/index.js';
3
3
  /**
4
4
  */
5
+ /** @category Interface */
5
6
  export interface LambdaRestApiProps extends LambdaRestApigProps {
6
7
  tags?: TagProps[];
7
8
  minCompressionSizeInBytes?: number;
8
9
  }
10
+ /** @category Interface */
9
11
  export interface RestApigProps extends RestApiProps {
10
12
  }
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @returns { Map<string, string> } AppConfig extension ARN by region for x84
3
3
  */
4
+ /** @category Constant */
4
5
  export declare const ArnsByRegionForX86_64: {
5
6
  [region: string]: string;
6
7
  };
7
8
  /**
8
9
  * @returns { Map<string, string> } AppConfig extension ARN by region for arm64
9
10
  */
11
+ /** @category Constant */
10
12
  export declare const ArnsByRegionForArm64: {
11
13
  [region: string]: string;
12
14
  };
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @returns { Map<string, string> } AppConfig extension ARN by region for x84
3
3
  */
4
+ /** @category Constant */
4
5
  export const ArnsByRegionForX86_64 = {
5
6
  'af-south-1': 'arn:aws:lambda:af-south-1:574348263942:layer:AWS-AppConfig-Extension:116',
6
7
  'ap-east-1': 'arn:aws:lambda:ap-east-1:630222743974:layer:AWS-AppConfig-Extension:106',
@@ -37,6 +38,7 @@ export const ArnsByRegionForX86_64 = {
37
38
  /**
38
39
  * @returns { Map<string, string> } AppConfig extension ARN by region for arm64
39
40
  */
41
+ /** @category Constant */
40
42
  export const ArnsByRegionForArm64 = {
41
43
  'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:980059726660:layer:AWS-AppConfig-Extension-Arm64:72',
42
44
  'ap-south-1': 'arn:aws:lambda:ap-south-1:554480029851:layer:AWS-AppConfig-Extension-Arm64:81',
@@ -3,7 +3,7 @@ import { CommonConstruct } from '../../common/index.js';
3
3
  import { Architecture } from '../constants.js';
4
4
  import { AppConfigProps } from './types.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS
6
+ * Provides operations on AWS
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 { AppConfigProps } from './types.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK AppConfig Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export declare class AppConfigManager {
22
23
  /**
@@ -4,7 +4,7 @@ import { createCfnOutput } from '../../utils/index.js';
4
4
  import { Architecture } from '../constants.js';
5
5
  import { ArnsByRegionForArm64, ArnsByRegionForX86_64 } from './constants.js';
6
6
  /**
7
- * @classdesc Provides operations on AWS
7
+ * Provides operations on AWS
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 { ArnsByRegionForArm64, ArnsByRegionForX86_64 } from './constants.js';
18
18
  * }
19
19
  * }
20
20
  * @see [CDK AppConfig Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appconfig-readme.html}
21
+ * @category Service
21
22
  */
22
23
  export class AppConfigManager {
23
24
  /**
@@ -32,7 +33,7 @@ export class AppConfigManager {
32
33
  case Architecture.X86_64:
33
34
  return ArnsByRegionForX86_64[scope.props.region];
34
35
  default:
35
- throw `Invalid type ${type} specified`;
36
+ throw new Error(`Invalid type ${type} specified`);
36
37
  }
37
38
  }
38
39
  /**
@@ -44,7 +45,7 @@ export class AppConfigManager {
44
45
  */
45
46
  createApplication(id, scope, props) {
46
47
  if (!props)
47
- throw `AppConfig props undefined for ${id}`;
48
+ throw new Error(`AppConfig props undefined for ${id}`);
48
49
  const application = new CfnApplication(scope, `${id}`, {
49
50
  ...props.application,
50
51
  name: scope.resourceNameFormatter.format(props.application.name, scope.props.resourceNameOptions?.appconfig),
@@ -63,7 +64,7 @@ export class AppConfigManager {
63
64
  */
64
65
  createEnvironment(id, scope, applicationId, props) {
65
66
  if (!props)
66
- throw `AppConfig props undefined for ${id}`;
67
+ throw new Error(`AppConfig props undefined for ${id}`);
67
68
  const environment = new CfnEnvironment(scope, `${id}`, {
68
69
  ...props.environment,
69
70
  applicationId,
@@ -84,7 +85,7 @@ export class AppConfigManager {
84
85
  */
85
86
  createConfigurationProfile(id, scope, applicationId, props) {
86
87
  if (!props)
87
- throw `AppConfig props undefined for ${id}`;
88
+ throw new Error(`AppConfig props undefined for ${id}`);
88
89
  const profile = new CfnConfigurationProfile(scope, `${id}`, {
89
90
  ...props.configurationProfile,
90
91
  applicationId,
@@ -104,9 +105,9 @@ export class AppConfigManager {
104
105
  */
105
106
  createDeploymentStrategy(id, scope, props) {
106
107
  if (!props)
107
- throw `AppConfig props undefined for ${id}`;
108
+ throw new Error(`AppConfig props undefined for ${id}`);
108
109
  if (!props.deploymentStrategy)
109
- throw `AppConfig deploymentStrategy props undefined for ${id}`;
110
+ throw new Error(`AppConfig deploymentStrategy props undefined for ${id}`);
110
111
  const deploymentStrategy = new DeploymentStrategy(scope, `${id}`, {
111
112
  ...props,
112
113
  deploymentStrategyName: scope.resourceNameFormatter.format(props.deploymentStrategy.deploymentStrategyName ?? 'common-deployment-strategy', scope.props.resourceNameOptions?.appconfig),
@@ -2,11 +2,13 @@ import { CfnApplicationProps, CfnConfigurationProfileProps, CfnDeploymentProps,
2
2
  /**
3
3
  *
4
4
  */
5
+ /** @category Interface */
5
6
  export interface AppConfigDeploymentStrategyProps extends DeploymentStrategyProps {
6
7
  deploymentStrategyArn?: string;
7
8
  }
8
9
  /**
9
10
  */
11
+ /** @category Interface */
10
12
  export interface AppConfigProps {
11
13
  application: CfnApplicationProps;
12
14
  configurationProfile: CfnConfigurationProfileProps;
@@ -3,7 +3,7 @@ import { IHostedZone } from 'aws-cdk-lib/aws-route53';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { AcmProps } from './types.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS Certificates.
6
+ * Provides operations on AWS Certificates.
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 { AcmProps } from './types.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export declare class AcmManager {
22
23
  /**
@@ -26,16 +27,17 @@ export declare class AcmManager {
26
27
  * @param props certificate props
27
28
  * @param hostedZone optional hosted zone to perform DNS validation
28
29
  * @returns the resolved certificate
29
- * @mermaid
30
- * graph LR;
31
- * A((Start)) --> B{Valid Properties?};
32
- * B -- Yes --> C(Fetch By ARN);
33
- * B -- No --> D[Throw Error];
34
- * D --> G((Stop));
35
- * C --> E{Valid ARN?};
36
- * E -- Yes --> F(Return Certificate);
37
- * E -- No --> D;
38
- * F --> G;
30
+ * ```mermaid
31
+ * graph LR;
32
+ * A((Start)) --> B{Valid Properties?};
33
+ * B -- Yes --> C(Fetch By ARN);
34
+ * B -- No --> D[Throw Error];
35
+ * D --> G((Stop));
36
+ * C --> E{Valid ARN?};
37
+ * E -- Yes --> F(Return Certificate);
38
+ * E -- No --> D;
39
+ * F --> G;
40
+ * ```
39
41
  */
40
42
  resolveCertificate(id: string, scope: CommonConstruct, props: AcmProps, hostedZone?: IHostedZone): ICertificate;
41
43
  }
@@ -2,7 +2,7 @@ import { Stack } from 'aws-cdk-lib';
2
2
  import { Certificate, CertificateValidation } from 'aws-cdk-lib/aws-certificatemanager';
3
3
  import { createCfnOutput } from '../../utils/index.js';
4
4
  /**
5
- * @classdesc Provides operations on AWS Certificates.
5
+ * Provides operations on AWS Certificates.
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 Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager-readme.html}
19
+ * @category Service
19
20
  */
20
21
  export class AcmManager {
21
22
  /**
@@ -25,20 +26,21 @@ export class AcmManager {
25
26
  * @param props certificate props
26
27
  * @param hostedZone optional hosted zone to perform DNS validation
27
28
  * @returns the resolved certificate
28
- * @mermaid
29
- * graph LR;
30
- * A((Start)) --> B{Valid Properties?};
31
- * B -- Yes --> C(Fetch By ARN);
32
- * B -- No --> D[Throw Error];
33
- * D --> G((Stop));
34
- * C --> E{Valid ARN?};
35
- * E -- Yes --> F(Return Certificate);
36
- * E -- No --> D;
37
- * F --> G;
29
+ * ```mermaid
30
+ * graph LR;
31
+ * A((Start)) --> B{Valid Properties?};
32
+ * B -- Yes --> C(Fetch By ARN);
33
+ * B -- No --> D[Throw Error];
34
+ * D --> G((Stop));
35
+ * C --> E{Valid ARN?};
36
+ * E -- Yes --> F(Return Certificate);
37
+ * E -- No --> D;
38
+ * F --> G;
39
+ * ```
38
40
  */
39
41
  resolveCertificate(id, scope, props, hostedZone) {
40
42
  if (!props)
41
- throw `Certificate props undefined for ${id}`;
43
+ throw new Error(`Certificate props undefined for ${id}`);
42
44
  let certificate;
43
45
  if (props.useExistingCertificate) {
44
46
  let certificateArn = props.certificateArn;
@@ -1,6 +1,7 @@
1
1
  import { CertificateProps } from 'aws-cdk-lib/aws-certificatemanager';
2
2
  /**
3
3
  */
4
+ /** @category Interface */
4
5
  export interface AcmProps extends CertificateProps {
5
6
  certificateAccount?: string;
6
7
  certificateArn?: string;
@@ -11,7 +11,7 @@ import { CommonConstruct } from '../../common/index.js';
11
11
  import { LambdaEdgeProps } from '../lambda/index.js';
12
12
  import { CloudfrontFunctionProps, DistributionProps } from './types.js';
13
13
  /**
14
- * @classdesc Provides operations on AWS
14
+ * Provides operations on AWS
15
15
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
16
16
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
17
17
  * @example
@@ -32,6 +32,7 @@ import { CloudfrontFunctionProps, DistributionProps } from './types.js';
32
32
  * }
33
33
  * }
34
34
  * @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
35
+ * @category Service
35
36
  */
36
37
  export declare class CloudFrontManager {
37
38
  createOriginAccessIdentity(id: string, scope: CommonConstruct, accessBucket?: IBucket): cf.OriginAccessIdentity;
@@ -8,7 +8,7 @@ import _ from 'lodash';
8
8
  import { CommonStack } from '../../common/index.js';
9
9
  import { createCfnOutput } from '../../utils/index.js';
10
10
  /**
11
- * @classdesc Provides operations on AWS
11
+ * Provides operations on AWS
12
12
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
13
13
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
14
14
  * @example
@@ -29,6 +29,7 @@ import { createCfnOutput } from '../../utils/index.js';
29
29
  * }
30
30
  * }
31
31
  * @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
32
+ * @category Service
32
33
  */
33
34
  export class CloudFrontManager {
34
35
  createOriginAccessIdentity(id, scope, accessBucket) {
@@ -146,9 +147,9 @@ export class CloudFrontManager {
146
147
  */
147
148
  createEdgeFunction(id, scope, props, layers, code, role, environment, vpc, securityGroups, accessPoint, mountPath) {
148
149
  if (!props)
149
- throw `EdgeFunction props undefined for ${id}`;
150
+ throw new Error(`EdgeFunction props undefined for ${id}`);
150
151
  if (!props.functionName)
151
- throw `EdgeFunction functionName undefined for ${id}`;
152
+ throw new Error(`EdgeFunction functionName undefined for ${id}`);
152
153
  const functionName = scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.cloudfront);
153
154
  const edgeFunction = new cf.experimental.EdgeFunction(scope, `${id}`, {
154
155
  code: code,
@@ -213,9 +214,9 @@ export class CloudFrontManager {
213
214
  */
214
215
  createCloudfrontFunction(id, scope, props) {
215
216
  if (!props)
216
- throw `CloudFront Function props undefined for ${id}`;
217
+ throw new Error(`CloudFront Function props undefined for ${id}`);
217
218
  if (!props.functionName)
218
- throw `CloudFront Function functionName undefined for ${id}`;
219
+ throw new Error(`CloudFront Function functionName undefined for ${id}`);
219
220
  const cloudfrontFunction = new Function(scope, `${id}`, {
220
221
  ...props,
221
222
  code: FunctionCode.fromFile({
@@ -2,11 +2,13 @@ import { DistributionProps as CfDistributionProps, FunctionProps } from 'aws-cdk
2
2
  import { TagProps } from '../../types/index.js';
3
3
  /**
4
4
  */
5
+ /** @category Interface */
5
6
  export interface DistributionProps extends CfDistributionProps {
6
7
  tags?: TagProps[];
7
8
  }
8
9
  /**
9
10
  */
11
+ /** @category Interface */
10
12
  export interface CloudfrontFunctionProps extends FunctionProps {
11
13
  eventType: string;
12
14
  functionFilePath: string;
@@ -4,7 +4,7 @@ import { CfnBucketPolicy, IBucket } from 'aws-cdk-lib/aws-s3';
4
4
  import { CommonConstruct } from '../../common/index.js';
5
5
  import { CloudTrailProps } from './types.js';
6
6
  /**
7
- * @classdesc Provides operations on AWS CloudTrail.
7
+ * Provides operations on AWS CloudTrail.
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
@@ -25,6 +25,7 @@ import { CloudTrailProps } from './types.js';
25
25
  * }
26
26
  * }
27
27
  * @see [CDK CloudTrail Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html}
28
+ * @category Service
28
29
  */
29
30
  export declare class CloudTrailManager {
30
31
  /**
@@ -1,7 +1,7 @@
1
1
  import { CfnTrail } from 'aws-cdk-lib/aws-cloudtrail';
2
2
  import { createCfnOutput } from '../../utils/index.js';
3
3
  /**
4
- * @classdesc Provides operations on AWS CloudTrail.
4
+ * Provides operations on AWS CloudTrail.
5
5
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
6
6
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
7
7
  * @example
@@ -22,6 +22,7 @@ import { createCfnOutput } from '../../utils/index.js';
22
22
  * }
23
23
  * }
24
24
  * @see [CDK CloudTrail Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html}
25
+ * @category Service
25
26
  */
26
27
  export class CloudTrailManager {
27
28
  /**
@@ -36,9 +37,9 @@ export class CloudTrailManager {
36
37
  */
37
38
  createCloudTrail(id, scope, props, logGroup, dataBucket, logBucket, logBucketPolicy) {
38
39
  if (!props)
39
- throw `CloudTrail props undefined for ${id}`;
40
+ throw new Error(`CloudTrail props undefined for ${id}`);
40
41
  if (!props.trailName)
41
- throw `CloudTrail trailName undefined for ${id}`;
42
+ throw new Error(`CloudTrail trailName undefined for ${id}`);
42
43
  const role = scope.iamManager.createRoleForCloudTrail(`${id}Role`, scope, logGroup);
43
44
  const cloudTrail = new CfnTrail(scope, `${id}`, {
44
45
  ...props,
@@ -1,5 +1,6 @@
1
1
  import { CfnTrailProps } from 'aws-cdk-lib/aws-cloudtrail';
2
2
  /**
3
3
  */
4
+ /** @category Interface */
4
5
  export interface CloudTrailProps extends CfnTrailProps {
5
6
  }
@@ -3,7 +3,7 @@ import * as logs from 'aws-cdk-lib/aws-logs';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { LogProps, MetricFilterProps } from './types.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS CloudWatch.
6
+ * Provides operations on AWS CloudWatch.
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 { LogProps, MetricFilterProps } from './types.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export declare class LogManager {
22
23
  /**
@@ -3,7 +3,7 @@ import * as logs from 'aws-cdk-lib/aws-logs';
3
3
  import _ from 'lodash';
4
4
  import * as utils from '../../utils/index.js';
5
5
  /**
6
- * @classdesc Provides operations on AWS CloudWatch.
6
+ * Provides operations on AWS CloudWatch.
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 * as utils from '../../utils/index.js';
17
17
  * }
18
18
  * }
19
19
  * @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs-readme.html}
20
+ * @category Service
20
21
  */
21
22
  export class LogManager {
22
23
  /**
@@ -28,7 +29,7 @@ export class LogManager {
28
29
  */
29
30
  createMetricFilter(id, scope, props, logGroup) {
30
31
  if (!props)
31
- throw `MetricFilter props undefined for ${id}`;
32
+ throw new Error(`MetricFilter props undefined for ${id}`);
32
33
  const metricFilter = new logs.MetricFilter(scope, `${id}`, {
33
34
  defaultValue: props.defaultValue,
34
35
  filterPattern: props.filterPattern,
@@ -54,9 +55,9 @@ export class LogManager {
54
55
  */
55
56
  createCfnLogGroup(id, scope, props) {
56
57
  if (!props)
57
- throw `Logs props undefined for ${id}`;
58
+ throw new Error(`Logs props undefined for ${id}`);
58
59
  if (!props.logGroupName)
59
- throw `Logs logGroupName undefined for ${id}`;
60
+ throw new Error(`Logs logGroupName undefined for ${id}`);
60
61
  const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
61
62
  ...props,
62
63
  logGroupName: props.logGroupName,
@@ -78,9 +79,9 @@ export class LogManager {
78
79
  */
79
80
  createLogGroup(id, scope, props) {
80
81
  if (!props)
81
- throw `Logs props undefined for ${id}`;
82
+ throw new Error(`Logs props undefined for ${id}`);
82
83
  if (!props.logGroupName)
83
- throw `Logs logGroupName undefined for ${id}`;
84
+ throw new Error(`Logs logGroupName undefined for ${id}`);
84
85
  const logGroup = new logs.LogGroup(scope, `${id}`, {
85
86
  ...props,
86
87
  logGroupName: props.logGroupName,
@@ -4,7 +4,7 @@ import { IMetric } from 'aws-cdk-lib/aws-cloudwatch';
4
4
  import { CommonConstruct } from '../../common/index.js';
5
5
  import { AlarmProps, AlarmStatusWidgetProps, DashboardProps, GraphWidgetProps, GuageWidgetProps, LogQueryWidgetProps, NumericWidgetProps, TextWidgetProps } from './types.js';
6
6
  /**
7
- * @classdesc Provides operations on AWS CloudWatch.
7
+ * Provides operations on AWS CloudWatch.
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 { AlarmProps, AlarmStatusWidgetProps, DashboardProps, GraphWidgetProps, G
18
18
  * }
19
19
  * }
20
20
  * @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch-readme.html}
21
+ * @category Service
21
22
  */
22
23
  export declare class CloudWatchManager {
23
24
  /**