@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
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @gradientedge/cdk-utils-aws
2
+
3
+ AWS CDK utilities for provisioning and managing AWS infrastructure using the [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/home.html).
4
+
5
+ ## Overview
6
+
7
+ This package provides high-level constructs and service managers that simplify common AWS CDK patterns:
8
+
9
+ - **Constructs** — ready-to-use patterns like REST API with Lambda, EventBridge targets, static sites, and ECS backends
10
+ - **Services** — manager classes for AWS services including Lambda, API Gateway, CloudFront, DynamoDB, ECS, S3, SQS, SNS, and more
11
+ - **Common** — base constructs and stack classes that all higher-level constructs extend
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pnpm add @gradientedge/cdk-utils-aws
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ import { CommonConstruct } from '@gradientedge/cdk-utils-aws'
23
+ import { Construct } from 'constructs'
24
+
25
+ class MyStack extends CommonConstruct {
26
+ constructor(parent: Construct, id: string, props: CommonStackProps) {
27
+ super(parent, id, props)
28
+ this.initResources()
29
+ }
30
+ }
31
+ ```
@@ -4,8 +4,7 @@ import { AcmManager, ApiManager, AppConfigManager, CloudFrontManager, CloudTrail
4
4
  import { ResourceNameFormatter } from './resource-name-formatter.js';
5
5
  import { CommonStackProps } from './types.js';
6
6
  /**
7
- * @subcategory Construct
8
- * @classdesc Common construct to use as a base for all higher level constructs.
7
+ * Common construct to use as a base for all higher level constructs.
9
8
  * @example
10
9
  * import { CommonConstruct } from '@gradientedge/cdk-utils';
11
10
  *
@@ -15,6 +14,7 @@ import { CommonStackProps } from './types.js';
15
14
  * this.props = props;
16
15
  * };
17
16
  * };
17
+ * @category Common
18
18
  */
19
19
  export declare class CommonConstruct extends Construct {
20
20
  props: CommonStackProps;
@@ -4,8 +4,7 @@ import { AcmManager, ApiManager, AppConfigManager, CloudFrontManager, CloudTrail
4
4
  import { createCfnOutput } from '../utils/index.js';
5
5
  import { ResourceNameFormatter } from './resource-name-formatter.js';
6
6
  /**
7
- * @subcategory Construct
8
- * @classdesc Common construct to use as a base for all higher level constructs.
7
+ * Common construct to use as a base for all higher level constructs.
9
8
  * @example
10
9
  * import { CommonConstruct } from '@gradientedge/cdk-utils';
11
10
  *
@@ -15,6 +14,7 @@ import { ResourceNameFormatter } from './resource-name-formatter.js';
15
14
  * this.props = props;
16
15
  * };
17
16
  * };
17
+ * @category Common
18
18
  */
19
19
  export class CommonConstruct extends Construct {
20
20
  props;
@@ -1,5 +1,6 @@
1
1
  import { Construct } from 'constructs';
2
2
  import { CommonStackProps, ResourceNameFormatterProps } from './types.js';
3
+ /** @category Common */
3
4
  export declare class ResourceNameFormatter extends Construct {
4
5
  props: CommonStackProps;
5
6
  constructor(parent: Construct, id: string, props: CommonStackProps);
@@ -1,4 +1,5 @@
1
1
  import { Construct } from 'constructs';
2
+ /** @category Common */
2
3
  export class ResourceNameFormatter extends Construct {
3
4
  props;
4
5
  constructor(parent, id, props) {
@@ -1,9 +1,9 @@
1
- import { App, Stack, StackProps } from 'aws-cdk-lib';
2
1
  import { Runtime } from 'aws-cdk-lib/aws-lambda';
3
- import { CommonConstruct } from './construct.js';
2
+ import { App, Stack, StackProps } from 'aws-cdk-lib';
4
3
  import { CommonStackProps } from './types.js';
4
+ import { CommonConstruct } from './construct.js';
5
5
  /**
6
- * @classdesc Common stack to use as a base for all higher level constructs.
6
+ * Common stack to use as a base for all higher level constructs.
7
7
  * @example
8
8
  * import { CommonStack } from '@gradientedge/cdk-utils'
9
9
  *
@@ -13,6 +13,7 @@ import { CommonStackProps } from './types.js';
13
13
  * // provision resources
14
14
  * }
15
15
  * }
16
+ * @category Common
16
17
  */
17
18
  export declare class CommonStack extends Stack {
18
19
  static NODEJS_RUNTIME: Runtime;
@@ -1,13 +1,13 @@
1
- import { Stack } from 'aws-cdk-lib';
2
- import { Runtime } from 'aws-cdk-lib/aws-lambda';
3
1
  import fs from 'fs';
4
2
  import path from 'path';
5
- import { CommonConstruct } from './construct.js';
3
+ import { Runtime } from 'aws-cdk-lib/aws-lambda';
4
+ import { Stack } from 'aws-cdk-lib';
6
5
  import appRoot from 'app-root-path';
7
6
  import _ from 'lodash';
8
7
  import { isDevStage } from '@gradientedge/cdk-utils-common';
8
+ import { CommonConstruct } from './construct.js';
9
9
  /**
10
- * @classdesc Common stack to use as a base for all higher level constructs.
10
+ * Common stack to use as a base for all higher level constructs.
11
11
  * @example
12
12
  * import { CommonStack } from '@gradientedge/cdk-utils'
13
13
  *
@@ -17,6 +17,7 @@ import { isDevStage } from '@gradientedge/cdk-utils-common';
17
17
  * // provision resources
18
18
  * }
19
19
  * }
20
+ * @category Common
20
21
  */
21
22
  export class CommonStack extends Stack {
22
23
  static NODEJS_RUNTIME = Runtime.NODEJS_24_X;
@@ -75,7 +76,7 @@ export class CommonStack extends Stack {
75
76
  const extraContextPath = path.join(appRoot.path, context);
76
77
  /* scenario where extra context is configured in cdk.json but absent in file system */
77
78
  if (!fs.existsSync(extraContextPath))
78
- throw `Extra context properties unavailable in path:${extraContextPath}`;
79
+ throw new Error(`Extra context properties unavailable in path:${extraContextPath}`);
79
80
  /* read the extra properties */
80
81
  const extraContextPropsBuffer = fs.readFileSync(extraContextPath);
81
82
  if (debug)
@@ -4,6 +4,7 @@ import { RetentionDays } from 'aws-cdk-lib/aws-logs';
4
4
  import { BaseProps } from '@gradientedge/cdk-utils-common';
5
5
  /**
6
6
  */
7
+ /** @category Interface */
7
8
  export interface CommonStackProps extends BaseProps, StackProps {
8
9
  region: string;
9
10
  resourceProjectIdentifier?: string;
@@ -21,6 +22,7 @@ export interface CommonStackProps extends BaseProps, StackProps {
21
22
  [key: string]: ResourceNameFormatterProps;
22
23
  };
23
24
  }
25
+ /** @category Interface */
24
26
  export interface ResourceNameFormatterProps {
25
27
  exclude?: boolean;
26
28
  globalPrefix?: boolean;
@@ -4,7 +4,7 @@ import { Construct } from 'constructs';
4
4
  import { CommonConstruct } from '../../common/index.js';
5
5
  import { ApiToAnyTargetProps, ApiToAnyTargetRestApiResource, ApiToAnyTargetRestApiType } from './types.js';
6
6
  /**
7
- * @classdesc Provides a construct to create and deploy a shallow API Gateway
7
+ * Provides a construct to create and deploy a shallow API Gateway
8
8
  * @example
9
9
  * import { ApiToAnyTarget, ApiToAnyTargetProps } '@gradientedge/cdk-utils'
10
10
  * import { Construct } from 'constructs'
@@ -17,6 +17,7 @@ import { ApiToAnyTargetProps, ApiToAnyTargetRestApiResource, ApiToAnyTargetRestA
17
17
  * this.initResources()
18
18
  * }
19
19
  * }
20
+ * @category Construct
20
21
  */
21
22
  export declare class ApiToAnyTarget extends CommonConstruct {
22
23
  props: ApiToAnyTargetProps;
@@ -3,7 +3,7 @@ import { AccessLogFormat, BasePathMapping, Cors, EndpointType, LogGroupLogDestin
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { ApiToAnyTargetRestApi } from './target.js';
5
5
  /**
6
- * @classdesc Provides a construct to create and deploy a shallow API Gateway
6
+ * Provides a construct to create and deploy a shallow API Gateway
7
7
  * @example
8
8
  * import { ApiToAnyTarget, ApiToAnyTargetProps } '@gradientedge/cdk-utils'
9
9
  * import { Construct } from 'constructs'
@@ -16,6 +16,7 @@ import { ApiToAnyTargetRestApi } from './target.js';
16
16
  * this.initResources()
17
17
  * }
18
18
  * }
19
+ * @category Construct
19
20
  */
20
21
  export class ApiToAnyTarget extends CommonConstruct {
21
22
  props;
@@ -75,7 +76,7 @@ export class ApiToAnyTarget extends CommonConstruct {
75
76
  return;
76
77
  }
77
78
  if (!this.props.api.restApi?.restApiName)
78
- throw `RestApi name undefined for ${this.id}`;
79
+ throw new Error(`RestApi name undefined for ${this.id}`);
79
80
  const restApiName = this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway);
80
81
  const restApiAccessLogName = this.resourceNameFormatter.format(`${this.props.api.restApi?.restApiName}-access`, this.props.resourceNameOptions?.apigateway);
81
82
  this.apiToAnyTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
@@ -3,6 +3,7 @@ import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
3
3
  import { LogGroup } from 'aws-cdk-lib/aws-logs';
4
4
  import { IHostedZone } from 'aws-cdk-lib/aws-route53';
5
5
  import { ApiToAnyTargetRestApiType } from './types.js';
6
+ /** @category Construct */
6
7
  export declare class ApiToAnyTargetRestApi implements ApiToAnyTargetRestApiType {
7
8
  accessLogGroup: LogGroup;
8
9
  api: IRestApi;
@@ -1,3 +1,4 @@
1
+ /** @category Construct */
1
2
  export class ApiToAnyTargetRestApi {
2
3
  accessLogGroup;
3
4
  api;
@@ -4,6 +4,7 @@ import { LogGroup } from 'aws-cdk-lib/aws-logs';
4
4
  import { IHostedZone } from 'aws-cdk-lib/aws-route53';
5
5
  import { CommonStackProps } from '../../common/index.js';
6
6
  import { AcmProps, RestApigProps } from '../../services/index.js';
7
+ /** @category Interface */
7
8
  export interface ApiToAnyTargetRestApiType {
8
9
  accessLogGroup: LogGroup;
9
10
  api: IRestApi;
@@ -22,6 +23,7 @@ export interface ApiToAnyTargetRestApiType {
22
23
  [path: string]: Resource;
23
24
  };
24
25
  }
26
+ /** @category Interface */
25
27
  export interface ApiToAnyTargetRestApiResource {
26
28
  addProxy: boolean;
27
29
  authorizer?: IAuthorizer;
@@ -39,6 +41,7 @@ export interface ApiToAnyTargetRestApiResource {
39
41
  mockIntegration?: MockIntegration;
40
42
  mockMethodResponses?: MethodResponse[];
41
43
  }
44
+ /** @category Interface */
42
45
  export interface ApiToAnyTargetRestApiProps {
43
46
  certificate: AcmProps;
44
47
  importedRestApiRef?: string;
@@ -49,6 +52,7 @@ export interface ApiToAnyTargetRestApiProps {
49
52
  useExisting: boolean;
50
53
  withResource?: boolean;
51
54
  }
55
+ /** @category Interface */
52
56
  export interface ApiToAnyTargetProps extends CommonStackProps {
53
57
  api: ApiToAnyTargetRestApiProps;
54
58
  apiRootPaths?: string[];
@@ -6,7 +6,8 @@ import { IHostedZone } from 'aws-cdk-lib/aws-route53';
6
6
  import { Topic } from 'aws-cdk-lib/aws-sns';
7
7
  import { ApiToEventBridgeTargetRestApiType } from './types.js';
8
8
  /**
9
- * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
9
+ * Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
10
+ * @category Construct
10
11
  */
11
12
  export declare class ApiToEventbridgeTargetRestApi implements ApiToEventBridgeTargetRestApiType {
12
13
  accessLogGroup: LogGroup;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
2
+ * Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
3
+ * @category Construct
3
4
  */
4
5
  export class ApiToEventbridgeTargetRestApi {
5
6
  accessLogGroup;
@@ -2,7 +2,8 @@ import { IEventBus, Rule } from 'aws-cdk-lib/aws-events';
2
2
  import { LogGroup } from 'aws-cdk-lib/aws-logs';
3
3
  import { ApiToEventBridgeTargetEventType } from './types.js';
4
4
  /**
5
- * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
5
+ * Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
6
+ * @category Construct
6
7
  */
7
8
  export declare class ApiToEventbridgeTargetEvent implements ApiToEventBridgeTargetEventType {
8
9
  eventBus: IEventBus;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
2
+ * Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
3
+ * @category Construct
3
4
  */
4
5
  export class ApiToEventbridgeTargetEvent {
5
6
  eventBus;
@@ -3,9 +3,9 @@ import { Construct } from 'constructs';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { ApiToEventBridgeTargetEventType, ApiToEventBridgeTargetProps, ApiToEventBridgeTargetRestApiType } from './types.js';
5
5
  /**
6
- * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
6
+ * Provides a construct to create and deploy API Gateway invocations to EventBridge
7
7
  *
8
- * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
8
+ * <b>Architecture</b><br/> ![Architecture](https://raw.githubusercontent.com/gradientedge/cdk-utils/main/img/ApiToEventBridgeTarget.jpg)
9
9
  * @example
10
10
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
11
11
  * import { Construct } from 'constructs'
@@ -18,6 +18,7 @@ import { ApiToEventBridgeTargetEventType, ApiToEventBridgeTargetProps, ApiToEven
18
18
  * this.initResources()
19
19
  * }
20
20
  * }
21
+ * @category Construct
21
22
  */
22
23
  export declare class ApiToEventBridgeTarget extends CommonConstruct {
23
24
  props: ApiToEventBridgeTargetProps;
@@ -7,9 +7,9 @@ import { CommonConstruct } from '../../common/index.js';
7
7
  import { ApiToEventbridgeTargetRestApi } from './api.js';
8
8
  import { ApiToEventbridgeTargetEvent } from './event.js';
9
9
  /**
10
- * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
10
+ * Provides a construct to create and deploy API Gateway invocations to EventBridge
11
11
  *
12
- * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
12
+ * <b>Architecture</b><br/> ![Architecture](https://raw.githubusercontent.com/gradientedge/cdk-utils/main/img/ApiToEventBridgeTarget.jpg)
13
13
  * @example
14
14
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
15
15
  * import { Construct } from 'constructs'
@@ -22,6 +22,7 @@ import { ApiToEventbridgeTargetEvent } from './event.js';
22
22
  * this.initResources()
23
23
  * }
24
24
  * }
25
+ * @category Construct
25
26
  */
26
27
  export class ApiToEventBridgeTarget extends CommonConstruct {
27
28
  props;
@@ -129,7 +130,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
129
130
  if (this.props.api.useExisting)
130
131
  return;
131
132
  if (!this.props.event.rule.ruleName)
132
- throw `Event ruleName undefined for ${this.id}`;
133
+ throw new Error(`Event ruleName undefined for ${this.id}`);
133
134
  this.props.event.rule = {
134
135
  eventPattern: {
135
136
  source: ['api-to-eventbridge-target'],
@@ -148,7 +149,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
148
149
  */
149
150
  createApiToEventBridgeTargetRole() {
150
151
  if (!this.apiToEventBridgeTargetRestApi.policy)
151
- throw 'Policy undefined';
152
+ throw new Error('Policy undefined');
152
153
  this.apiToEventBridgeTargetRestApi.role = new Role(this, `${this.id}-rest-api-role`, {
153
154
  assumedBy: new ServicePrincipal('apigateway.amazonaws.com'),
154
155
  inlinePolicies: { policy: this.apiToEventBridgeTargetRestApi.policy },
@@ -293,7 +294,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
293
294
  return;
294
295
  }
295
296
  if (!this.props.api.restApi?.restApiName)
296
- throw `RestApi name undefined for ${this.id}`;
297
+ throw new Error(`RestApi name undefined for ${this.id}`);
297
298
  const restApiName = this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway);
298
299
  const restApiAccessLogName = this.resourceNameFormatter.format(`${this.props.api.restApi?.restApiName}-access`, this.props.resourceNameOptions?.apigateway);
299
300
  this.apiToEventBridgeTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
@@ -10,6 +10,7 @@ import { CommonStackProps } from '../../common/index.js';
10
10
  import { AcmProps, EventRuleProps, LambdaProps, LogProps, RestApigProps } from '../../services/index.js';
11
11
  /**
12
12
  */
13
+ /** @category Interface */
13
14
  export interface ApiToEventBridgeTargetEventType {
14
15
  eventBus: IEventBus;
15
16
  logGroup: LogGroup;
@@ -21,6 +22,7 @@ export interface ApiToEventBridgeTargetEventType {
21
22
  }
22
23
  /**
23
24
  */
25
+ /** @category Interface */
24
26
  export interface ApiToEventBridgeTargetRestApiType {
25
27
  accessLogGroup: LogGroup;
26
28
  api: IRestApi;
@@ -49,6 +51,7 @@ export interface ApiToEventBridgeTargetRestApiType {
49
51
  }
50
52
  /**
51
53
  */
54
+ /** @category Interface */
52
55
  export interface ApiToEventBridgeTargetRestApiProps {
53
56
  certificate: AcmProps;
54
57
  errorResponseModel?: ModelOptions;
@@ -67,7 +70,8 @@ export interface ApiToEventBridgeTargetRestApiProps {
67
70
  }
68
71
  /**
69
72
  */
70
- interface ApiToEventBridgeTargetLambdaProps {
73
+ /** @category Interface */
74
+ export interface ApiToEventBridgeTargetLambdaProps {
71
75
  function: LambdaProps;
72
76
  handler?: string;
73
77
  layerSource?: AssetCode;
@@ -75,7 +79,8 @@ interface ApiToEventBridgeTargetLambdaProps {
75
79
  }
76
80
  /**
77
81
  */
78
- interface ApiToEventBridgeTargetEventProps {
82
+ /** @category Interface */
83
+ export interface ApiToEventBridgeTargetEventProps {
79
84
  eventBusName?: string;
80
85
  logGroup?: LogProps;
81
86
  logGroupFailure?: LogProps;
@@ -86,6 +91,7 @@ interface ApiToEventBridgeTargetEventProps {
86
91
  }
87
92
  /**
88
93
  */
94
+ /** @category Interface */
89
95
  export interface ApiToEventBridgeTargetProps extends CommonStackProps {
90
96
  api: ApiToEventBridgeTargetRestApiProps;
91
97
  apiRootPaths?: string[];
@@ -97,4 +103,3 @@ export interface ApiToEventBridgeTargetProps extends CommonStackProps {
97
103
  timezone: string;
98
104
  useExistingHostedZone: boolean;
99
105
  }
100
- export {};
@@ -3,7 +3,8 @@ import { IFunction, LayerVersion } from 'aws-cdk-lib/aws-lambda';
3
3
  import { EventBridgeDestination } from 'aws-cdk-lib/aws-lambda-destinations';
4
4
  import { ApiDestinedLambdaEnvironment, ApiDestinedLambdaType } from './types.js';
5
5
  /**
6
- * @classdesc Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
6
+ * Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
7
+ * @category Construct
7
8
  */
8
9
  export declare class ApiDestinedLambda implements ApiDestinedLambdaType {
9
10
  destinationFailure: EventBridgeDestination;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @classdesc Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
2
+ * Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
3
+ * @category Construct
3
4
  */
4
5
  export class ApiDestinedLambda {
5
6
  destinationFailure;
@@ -5,9 +5,9 @@ import { ApiToEventBridgeTargetEventType, ApiToEventBridgeTargetProps, ApiToEven
5
5
  import { ApiDestinedLambdaType } from './types.js';
6
6
  /**
7
7
  * @deprecated Use ApiToEventBridgeTarget instead. This will be removed in a future release.
8
- * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
8
+ * Provides a construct to create and deploy API Gateway invocations to EventBridge
9
9
  *
10
- * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
10
+ * <b>Architecture</b><br/> ![Architecture](https://raw.githubusercontent.com/gradientedge/cdk-utils/main/img/ApiToEventBridgeTargetWithSns.jpg)
11
11
  * @example
12
12
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
13
13
  * import { Construct } from 'constructs'
@@ -20,6 +20,7 @@ import { ApiDestinedLambdaType } from './types.js';
20
20
  * this.initResources()
21
21
  * }
22
22
  * }
23
+ * @category Construct
23
24
  */
24
25
  export declare class ApiToEventBridgeTargetWithSns extends CommonConstruct {
25
26
  props: ApiToEventBridgeTargetProps;
@@ -9,9 +9,9 @@ import { ApiToEventbridgeTargetEvent, ApiToEventbridgeTargetRestApi, } from '../
9
9
  import { ApiDestinedLambda } from './api-destined-lambda.js';
10
10
  /**
11
11
  * @deprecated Use ApiToEventBridgeTarget instead. This will be removed in a future release.
12
- * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
12
+ * Provides a construct to create and deploy API Gateway invocations to EventBridge
13
13
  *
14
- * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
14
+ * <b>Architecture</b><br/> ![Architecture](https://raw.githubusercontent.com/gradientedge/cdk-utils/main/img/ApiToEventBridgeTargetWithSns.jpg)
15
15
  * @example
16
16
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
17
17
  * import { Construct } from 'constructs'
@@ -24,6 +24,7 @@ import { ApiDestinedLambda } from './api-destined-lambda.js';
24
24
  * this.initResources()
25
25
  * }
26
26
  * }
27
+ * @category Construct
27
28
  */
28
29
  export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
29
30
  props;
@@ -170,7 +171,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
170
171
  if (this.props.api.useExisting)
171
172
  return;
172
173
  if (!this.props.lambda || !this.props.lambda.source)
173
- throw 'Api Destined Lambda props undefined';
174
+ throw new Error('Api Destined Lambda props undefined');
174
175
  this.apiDestinedLambda.function = this.lambdaManager.createLambdaFunction(`${this.id}-lambda-destined`, this, {
175
176
  ...this.props.lambda.function,
176
177
  onFailure: this.apiDestinedLambda.destinationFailure,
@@ -291,7 +292,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
291
292
  if (!this.props.api.withResource)
292
293
  return;
293
294
  if (!this.apiDestinedRestApi.topic)
294
- throw 'Topic undefined';
295
+ throw new Error('Topic undefined');
295
296
  this.apiDestinedRestApi.integrationRequestTemplates = {
296
297
  'application/json': [
297
298
  'Action=Publish',
@@ -407,7 +408,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
407
408
  return;
408
409
  }
409
410
  if (!this.props.api.restApi?.restApiName)
410
- throw `RestApi name undefined for ${this.id}`;
411
+ throw new Error(`RestApi name undefined for ${this.id}`);
411
412
  const restApiName = this.resourceNameFormatter.format(this.props.api.restApi?.restApiName, this.props.resourceNameOptions?.apigateway);
412
413
  const restApiAccessLogName = this.resourceNameFormatter.format(`${this.props.api.restApi?.restApiName}-access`, this.props.resourceNameOptions?.apigateway);
413
414
  const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
@@ -1,14 +1,16 @@
1
- import { LambdaEnvironment } from '../../services/index.js';
2
1
  import { EventBridgeDestination } from 'aws-cdk-lib/aws-lambda-destinations';
3
2
  import { AssetCode, IFunction, LayerVersion } from 'aws-cdk-lib/aws-lambda';
4
3
  import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
4
+ import { LambdaEnvironment } from '../../services/index.js';
5
5
  /**
6
6
  */
7
+ /** @category Interface */
7
8
  export interface ApiDestinedLambdaEnvironment extends LambdaEnvironment {
8
9
  SOURCE_ID: string;
9
10
  }
10
11
  /**
11
12
  */
13
+ /** @category Interface */
12
14
  export interface ApiDestinedLambdaType {
13
15
  destinationFailure: EventBridgeDestination;
14
16
  destinationSuccess: EventBridgeDestination;
@@ -6,7 +6,8 @@ import { IHostedZone } from 'aws-cdk-lib/aws-route53';
6
6
  import { Topic } from 'aws-cdk-lib/aws-sns';
7
7
  import { ApiToLambdaTargetRestApiType } from './types.js';
8
8
  /**
9
- * @classdesc Provides a construct to contain api resources for ApiToLambdaTarget
9
+ * Provides a construct to contain api resources for ApiToLambdaTarget
10
+ * @category Construct
10
11
  */
11
12
  export declare class ApiToLambdaTargetRestApi implements ApiToLambdaTargetRestApiType {
12
13
  api: RestApi;
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @classdesc Provides a construct to contain api resources for ApiToLambdaTarget
2
+ * Provides a construct to contain api resources for ApiToLambdaTarget
3
+ * @category Construct
3
4
  */
4
5
  export class ApiToLambdaTargetRestApi {
5
6
  api;
@@ -3,6 +3,7 @@ import { Construct } from 'constructs';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { ApiToLambdaTargetProps, ApiToLambdaTargetRestApiType } from './types.js';
5
5
  /**
6
+ * @category Construct
6
7
  */
7
8
  export declare class ApiToLambdaTarget extends CommonConstruct {
8
9
  props: ApiToLambdaTargetProps;
@@ -5,6 +5,7 @@ import { Function } from 'aws-cdk-lib/aws-lambda';
5
5
  import { CommonConstruct } from '../../common/index.js';
6
6
  import { ApiToLambdaTargetRestApi } from './api.js';
7
7
  /**
8
+ * @category Construct
8
9
  */
9
10
  export class ApiToLambdaTarget extends CommonConstruct {
10
11
  props;
@@ -155,7 +156,7 @@ export class ApiToLambdaTarget extends CommonConstruct {
155
156
  */
156
157
  createApiToLambdaTargetRole() {
157
158
  if (!this.apiToLambdaTargetRestApi.policy)
158
- throw 'Policy undefined';
159
+ throw new Error('Policy undefined');
159
160
  this.apiToLambdaTargetRestApi.role = new Role(this, `${this.id}-rest-api-role`, {
160
161
  assumedBy: new ServicePrincipal('apigateway.amazonaws.com'),
161
162
  inlinePolicies: { policy: this.apiToLambdaTargetRestApi.policy },
@@ -1,13 +1,14 @@
1
- import { CommonStackProps } from '../../common/index.js';
2
1
  import { BasePathMapping, DomainName, IAuthorizer, Integration, IntegrationResponse, IRestApi, Method, MethodResponse, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
3
- import { AcmProps, LambdaRestApiProps } from '../../services/index.js';
4
2
  import * as acm from 'aws-cdk-lib/aws-certificatemanager';
5
3
  import * as route53 from 'aws-cdk-lib/aws-route53';
6
4
  import { IFunction } from 'aws-cdk-lib/aws-lambda';
7
5
  import { ITopic } from 'aws-cdk-lib/aws-sns';
8
6
  import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
7
+ import { AcmProps, LambdaRestApiProps } from '../../services/index.js';
8
+ import { CommonStackProps } from '../../common/index.js';
9
9
  /**
10
10
  */
11
+ /** @category Interface */
11
12
  export interface ApiToLambdaTargetRestApiType {
12
13
  api: IRestApi;
13
14
  authoriser?: IAuthorizer;
@@ -37,6 +38,7 @@ export interface ApiToLambdaTargetRestApiType {
37
38
  }
38
39
  /**
39
40
  */
41
+ /** @category Interface */
40
42
  export interface ApiToLambdaTargetRestApiProps {
41
43
  certificate: AcmProps;
42
44
  importedRestApiRef?: string;
@@ -50,6 +52,7 @@ export interface ApiToLambdaTargetRestApiProps {
50
52
  }
51
53
  /**
52
54
  */
55
+ /** @category Interface */
53
56
  export interface ApiToLambdaTargetProps extends CommonStackProps {
54
57
  api: ApiToLambdaTargetRestApiProps;
55
58
  apiRootPaths?: string[];
@@ -2,6 +2,7 @@ import { CfnApplication, CfnConfigurationProfile, CfnEnvironment, CfnHostedConfi
2
2
  import { Construct } from 'constructs';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
4
  import { ApplicationConfigurationProps } from './types.js';
5
+ /** @category Construct */
5
6
  export declare class ApplicationConfiguration extends CommonConstruct {
6
7
  props: ApplicationConfigurationProps;
7
8
  id: string;
@@ -1,6 +1,7 @@
1
1
  import { Duration, Fn } from 'aws-cdk-lib';
2
2
  import { CfnDeployment, CfnHostedConfigurationVersion, DeploymentStrategy, RolloutStrategy, } from 'aws-cdk-lib/aws-appconfig';
3
3
  import { CommonConstruct } from '../../common/index.js';
4
+ /** @category Construct */
4
5
  export class ApplicationConfiguration extends CommonConstruct {
5
6
  id;
6
7
  appConfigApplication;
@@ -1,5 +1,6 @@
1
1
  import { CommonStackProps } from '../../common/index.js';
2
2
  import { AppConfigProps } from '../../services/index.js';
3
+ /** @category Interface */
3
4
  export interface ApplicationConfigurationProps extends CommonStackProps {
4
5
  appConfig: AppConfigProps;
5
6
  appConfigContent: any;
@@ -6,6 +6,7 @@ import { LogGroup } from 'aws-cdk-lib/aws-logs';
6
6
  import { Queue } from 'aws-cdk-lib/aws-sqs';
7
7
  import { Chain, Map, StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
8
8
  import { EventHandlerType } from './types.js';
9
+ /** @category Construct */
9
10
  export declare class Handler implements EventHandlerType {
10
11
  archive: Archive;
11
12
  ecsTargets: EcsTask[];
@@ -1,3 +1,4 @@
1
+ /** @category Construct */
1
2
  export class Handler {
2
3
  archive;
3
4
  ecsTargets = [];