@gradientedge/cdk-utils-aws 1.0.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.
- package/LICENSE +21 -0
- package/dist/src/common/construct.d.ts +85 -0
- package/dist/src/common/construct.js +125 -0
- package/dist/src/common/index.d.ts +4 -0
- package/dist/src/common/index.js +4 -0
- package/dist/src/common/resource-name-formatter.d.ts +13 -0
- package/dist/src/common/resource-name-formatter.js +30 -0
- package/dist/src/common/stack.d.ts +62 -0
- package/dist/src/common/stack.js +139 -0
- package/dist/src/common/types.d.ts +30 -0
- package/dist/src/common/types.js +1 -0
- package/dist/src/construct/api-to-any-target/index.d.ts +3 -0
- package/dist/src/construct/api-to-any-target/index.js +3 -0
- package/dist/src/construct/api-to-any-target/main.d.ts +47 -0
- package/dist/src/construct/api-to-any-target/main.js +154 -0
- package/dist/src/construct/api-to-any-target/target.d.ts +23 -0
- package/dist/src/construct/api-to-any-target/target.js +14 -0
- package/dist/src/construct/api-to-any-target/types.d.ts +60 -0
- package/dist/src/construct/api-to-any-target/types.js +1 -0
- package/dist/src/construct/api-to-eventbridge-target/api.d.ts +34 -0
- package/dist/src/construct/api-to-eventbridge-target/api.js +23 -0
- package/dist/src/construct/api-to-eventbridge-target/event.d.ts +15 -0
- package/dist/src/construct/api-to-eventbridge-target/event.js +12 -0
- package/dist/src/construct/api-to-eventbridge-target/index.d.ts +4 -0
- package/dist/src/construct/api-to-eventbridge-target/index.js +4 -0
- package/dist/src/construct/api-to-eventbridge-target/main.d.ts +121 -0
- package/dist/src/construct/api-to-eventbridge-target/main.js +442 -0
- package/dist/src/construct/api-to-eventbridge-target/types.d.ts +100 -0
- package/dist/src/construct/api-to-eventbridge-target/types.js +1 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +16 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +12 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/index.d.ts +3 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/index.js +3 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.d.ts +159 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.js +547 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/types.d.ts +22 -0
- package/dist/src/construct/api-to-eventbridge-target-with-sns/types.js +1 -0
- package/dist/src/construct/api-to-lambda-target/api.d.ts +35 -0
- package/dist/src/construct/api-to-lambda-target/api.js +24 -0
- package/dist/src/construct/api-to-lambda-target/index.d.ts +3 -0
- package/dist/src/construct/api-to-lambda-target/index.js +3 -0
- package/dist/src/construct/api-to-lambda-target/main.d.ts +70 -0
- package/dist/src/construct/api-to-lambda-target/main.js +218 -0
- package/dist/src/construct/api-to-lambda-target/types.d.ts +62 -0
- package/dist/src/construct/api-to-lambda-target/types.js +1 -0
- package/dist/src/construct/application-configuration/index.d.ts +2 -0
- package/dist/src/construct/application-configuration/index.js +2 -0
- package/dist/src/construct/application-configuration/main.d.ts +23 -0
- package/dist/src/construct/application-configuration/main.js +79 -0
- package/dist/src/construct/application-configuration/types.d.ts +6 -0
- package/dist/src/construct/application-configuration/types.js +1 -0
- package/dist/src/construct/event-handler/handler.d.ts +29 -0
- package/dist/src/construct/event-handler/handler.js +21 -0
- package/dist/src/construct/event-handler/index.d.ts +3 -0
- package/dist/src/construct/event-handler/index.js +3 -0
- package/dist/src/construct/event-handler/main.d.ts +91 -0
- package/dist/src/construct/event-handler/main.js +196 -0
- package/dist/src/construct/event-handler/types.d.ts +41 -0
- package/dist/src/construct/event-handler/types.js +1 -0
- package/dist/src/construct/index.d.ts +14 -0
- package/dist/src/construct/index.js +14 -0
- package/dist/src/construct/lambda-with-iam-access/index.d.ts +2 -0
- package/dist/src/construct/lambda-with-iam-access/index.js +2 -0
- package/dist/src/construct/lambda-with-iam-access/main.d.ts +78 -0
- package/dist/src/construct/lambda-with-iam-access/main.js +182 -0
- package/dist/src/construct/lambda-with-iam-access/types.d.ts +20 -0
- package/dist/src/construct/lambda-with-iam-access/types.js +1 -0
- package/dist/src/construct/piped-event-handler/index.d.ts +2 -0
- package/dist/src/construct/piped-event-handler/index.js +2 -0
- package/dist/src/construct/piped-event-handler/main.d.ts +38 -0
- package/dist/src/construct/piped-event-handler/main.js +62 -0
- package/dist/src/construct/piped-event-handler/types.d.ts +9 -0
- package/dist/src/construct/piped-event-handler/types.js +1 -0
- package/dist/src/construct/rest-api-lambda/index.d.ts +2 -0
- package/dist/src/construct/rest-api-lambda/index.js +2 -0
- package/dist/src/construct/rest-api-lambda/main.d.ts +96 -0
- package/dist/src/construct/rest-api-lambda/main.js +170 -0
- package/dist/src/construct/rest-api-lambda/types.d.ts +23 -0
- package/dist/src/construct/rest-api-lambda/types.js +1 -0
- package/dist/src/construct/rest-api-lambda-with-cache/index.d.ts +2 -0
- package/dist/src/construct/rest-api-lambda-with-cache/index.js +2 -0
- package/dist/src/construct/rest-api-lambda-with-cache/main.d.ts +56 -0
- package/dist/src/construct/rest-api-lambda-with-cache/main.js +118 -0
- package/dist/src/construct/rest-api-lambda-with-cache/types.d.ts +11 -0
- package/dist/src/construct/rest-api-lambda-with-cache/types.js +1 -0
- package/dist/src/construct/site-with-ecs-backend/constants.d.ts +4 -0
- package/dist/src/construct/site-with-ecs-backend/constants.js +5 -0
- package/dist/src/construct/site-with-ecs-backend/index.d.ts +3 -0
- package/dist/src/construct/site-with-ecs-backend/index.js +3 -0
- package/dist/src/construct/site-with-ecs-backend/main.d.ts +154 -0
- package/dist/src/construct/site-with-ecs-backend/main.js +437 -0
- package/dist/src/construct/site-with-ecs-backend/types.d.ts +49 -0
- package/dist/src/construct/site-with-ecs-backend/types.js +1 -0
- package/dist/src/construct/site-with-lambda-backend/constants.d.ts +5 -0
- package/dist/src/construct/site-with-lambda-backend/constants.js +6 -0
- package/dist/src/construct/site-with-lambda-backend/index.d.ts +3 -0
- package/dist/src/construct/site-with-lambda-backend/index.js +3 -0
- package/dist/src/construct/site-with-lambda-backend/main.d.ts +116 -0
- package/dist/src/construct/site-with-lambda-backend/main.js +316 -0
- package/dist/src/construct/site-with-lambda-backend/types.d.ts +45 -0
- package/dist/src/construct/site-with-lambda-backend/types.js +1 -0
- package/dist/src/construct/static-asset-deployment/index.d.ts +2 -0
- package/dist/src/construct/static-asset-deployment/index.js +2 -0
- package/dist/src/construct/static-asset-deployment/main.d.ts +41 -0
- package/dist/src/construct/static-asset-deployment/main.js +113 -0
- package/dist/src/construct/static-asset-deployment/types.d.ts +41 -0
- package/dist/src/construct/static-asset-deployment/types.js +1 -0
- package/dist/src/construct/static-site/index.d.ts +2 -0
- package/dist/src/construct/static-site/index.js +2 -0
- package/dist/src/construct/static-site/main.d.ts +84 -0
- package/dist/src/construct/static-site/main.js +136 -0
- package/dist/src/construct/static-site/types.d.ts +30 -0
- package/dist/src/construct/static-site/types.js +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/services/api-gateway/index.d.ts +2 -0
- package/dist/src/services/api-gateway/index.js +2 -0
- package/dist/src/services/api-gateway/main.d.ts +68 -0
- package/dist/src/services/api-gateway/main.js +173 -0
- package/dist/src/services/api-gateway/types.d.ts +10 -0
- package/dist/src/services/api-gateway/types.js +1 -0
- package/dist/src/services/appconfig/constants.d.ts +12 -0
- package/dist/src/services/appconfig/constants.js +51 -0
- package/dist/src/services/appconfig/index.d.ts +3 -0
- package/dist/src/services/appconfig/index.js +3 -0
- package/dist/src/services/appconfig/main.d.ts +63 -0
- package/dist/src/services/appconfig/main.js +119 -0
- package/dist/src/services/appconfig/types.d.ts +17 -0
- package/dist/src/services/appconfig/types.js +1 -0
- package/dist/src/services/certificate-manager/index.d.ts +2 -0
- package/dist/src/services/certificate-manager/index.js +2 -0
- package/dist/src/services/certificate-manager/main.d.ts +41 -0
- package/dist/src/services/certificate-manager/main.js +62 -0
- package/dist/src/services/certificate-manager/types.d.ts +11 -0
- package/dist/src/services/certificate-manager/types.js +1 -0
- package/dist/src/services/cloudfront/index.d.ts +2 -0
- package/dist/src/services/cloudfront/index.js +2 -0
- package/dist/src/services/cloudfront/main.d.ts +96 -0
- package/dist/src/services/cloudfront/main.js +233 -0
- package/dist/src/services/cloudfront/types.d.ts +13 -0
- package/dist/src/services/cloudfront/types.js +1 -0
- package/dist/src/services/cloudtrail/index.d.ts +2 -0
- package/dist/src/services/cloudtrail/index.js +2 -0
- package/dist/src/services/cloudtrail/main.d.ts +44 -0
- package/dist/src/services/cloudtrail/main.js +71 -0
- package/dist/src/services/cloudtrail/types.d.ts +5 -0
- package/dist/src/services/cloudtrail/types.js +1 -0
- package/dist/src/services/cloudwatch/index.d.ts +3 -0
- package/dist/src/services/cloudwatch/index.js +3 -0
- package/dist/src/services/cloudwatch/logs.d.ts +47 -0
- package/dist/src/services/cloudwatch/logs.js +98 -0
- package/dist/src/services/cloudwatch/main.d.ts +207 -0
- package/dist/src/services/cloudwatch/main.js +552 -0
- package/dist/src/services/cloudwatch/types.d.ts +89 -0
- package/dist/src/services/cloudwatch/types.js +1 -0
- package/dist/src/services/codebuild/index.d.ts +1 -0
- package/dist/src/services/codebuild/index.js +1 -0
- package/dist/src/services/codebuild/main.d.ts +36 -0
- package/dist/src/services/codebuild/main.js +67 -0
- package/dist/src/services/constants.d.ts +4 -0
- package/dist/src/services/constants.js +5 -0
- package/dist/src/services/dynamodb/index.d.ts +2 -0
- package/dist/src/services/dynamodb/index.js +2 -0
- package/dist/src/services/dynamodb/main.d.ts +35 -0
- package/dist/src/services/dynamodb/main.js +72 -0
- package/dist/src/services/dynamodb/types.d.ts +10 -0
- package/dist/src/services/dynamodb/types.js +1 -0
- package/dist/src/services/elastic-container-registry/index.d.ts +1 -0
- package/dist/src/services/elastic-container-registry/index.js +1 -0
- package/dist/src/services/elastic-container-registry/main.d.ts +27 -0
- package/dist/src/services/elastic-container-registry/main.js +33 -0
- package/dist/src/services/elastic-container-service/index.d.ts +2 -0
- package/dist/src/services/elastic-container-service/index.js +2 -0
- package/dist/src/services/elastic-container-service/main.d.ts +56 -0
- package/dist/src/services/elastic-container-service/main.js +149 -0
- package/dist/src/services/elastic-container-service/types.d.ts +45 -0
- package/dist/src/services/elastic-container-service/types.js +1 -0
- package/dist/src/services/elastic-file-system/index.d.ts +2 -0
- package/dist/src/services/elastic-file-system/index.js +2 -0
- package/dist/src/services/elastic-file-system/main.d.ts +42 -0
- package/dist/src/services/elastic-file-system/main.js +76 -0
- package/dist/src/services/elastic-file-system/types.d.ts +15 -0
- package/dist/src/services/elastic-file-system/types.js +1 -0
- package/dist/src/services/elastic-kubernetes-service/index.d.ts +2 -0
- package/dist/src/services/elastic-kubernetes-service/index.js +2 -0
- package/dist/src/services/elastic-kubernetes-service/main.d.ts +32 -0
- package/dist/src/services/elastic-kubernetes-service/main.js +85 -0
- package/dist/src/services/elastic-kubernetes-service/types.d.ts +7 -0
- package/dist/src/services/elastic-kubernetes-service/types.js +1 -0
- package/dist/src/services/elasticache/index.d.ts +2 -0
- package/dist/src/services/elasticache/index.js +2 -0
- package/dist/src/services/elasticache/main.d.ts +47 -0
- package/dist/src/services/elasticache/main.js +90 -0
- package/dist/src/services/elasticache/types.d.ts +9 -0
- package/dist/src/services/elasticache/types.js +1 -0
- package/dist/src/services/eventbridge/index.d.ts +3 -0
- package/dist/src/services/eventbridge/index.js +3 -0
- package/dist/src/services/eventbridge/main.d.ts +93 -0
- package/dist/src/services/eventbridge/main.js +295 -0
- package/dist/src/services/eventbridge/target.d.ts +57 -0
- package/dist/src/services/eventbridge/target.js +61 -0
- package/dist/src/services/eventbridge/types.d.ts +43 -0
- package/dist/src/services/eventbridge/types.js +1 -0
- package/dist/src/services/evidently/index.d.ts +2 -0
- package/dist/src/services/evidently/index.js +2 -0
- package/dist/src/services/evidently/main.d.ts +56 -0
- package/dist/src/services/evidently/main.js +114 -0
- package/dist/src/services/evidently/types.d.ts +21 -0
- package/dist/src/services/evidently/types.js +1 -0
- package/dist/src/services/identity-access-management/index.d.ts +1 -0
- package/dist/src/services/identity-access-management/index.js +1 -0
- package/dist/src/services/identity-access-management/main.d.ts +263 -0
- package/dist/src/services/identity-access-management/main.js +609 -0
- package/dist/src/services/index.d.ts +28 -0
- package/dist/src/services/index.js +28 -0
- package/dist/src/services/key-management-service/index.d.ts +2 -0
- package/dist/src/services/key-management-service/index.js +2 -0
- package/dist/src/services/key-management-service/main.d.ts +28 -0
- package/dist/src/services/key-management-service/main.js +39 -0
- package/dist/src/services/key-management-service/types.d.ts +5 -0
- package/dist/src/services/key-management-service/types.js +1 -0
- package/dist/src/services/lambda/index.d.ts +2 -0
- package/dist/src/services/lambda/index.js +2 -0
- package/dist/src/services/lambda/main.d.ts +89 -0
- package/dist/src/services/lambda/main.js +232 -0
- package/dist/src/services/lambda/types.d.ts +54 -0
- package/dist/src/services/lambda/types.js +1 -0
- package/dist/src/services/route53/index.d.ts +2 -0
- package/dist/src/services/route53/index.js +2 -0
- package/dist/src/services/route53/main.d.ts +66 -0
- package/dist/src/services/route53/main.js +136 -0
- package/dist/src/services/route53/types.d.ts +6 -0
- package/dist/src/services/route53/types.js +1 -0
- package/dist/src/services/secrets-manager/index.d.ts +2 -0
- package/dist/src/services/secrets-manager/index.js +2 -0
- package/dist/src/services/secrets-manager/main.d.ts +43 -0
- package/dist/src/services/secrets-manager/main.js +71 -0
- package/dist/src/services/secrets-manager/types.d.ts +3 -0
- package/dist/src/services/secrets-manager/types.js +1 -0
- package/dist/src/services/simple-notification-service/index.d.ts +2 -0
- package/dist/src/services/simple-notification-service/index.js +2 -0
- package/dist/src/services/simple-notification-service/main.d.ts +38 -0
- package/dist/src/services/simple-notification-service/main.js +68 -0
- package/dist/src/services/simple-notification-service/types.d.ts +5 -0
- package/dist/src/services/simple-notification-service/types.js +1 -0
- package/dist/src/services/simple-queue-service/index.d.ts +2 -0
- package/dist/src/services/simple-queue-service/index.js +2 -0
- package/dist/src/services/simple-queue-service/main.d.ts +45 -0
- package/dist/src/services/simple-queue-service/main.js +101 -0
- package/dist/src/services/simple-queue-service/types.d.ts +15 -0
- package/dist/src/services/simple-queue-service/types.js +1 -0
- package/dist/src/services/simple-storage-service/index.d.ts +2 -0
- package/dist/src/services/simple-storage-service/index.js +2 -0
- package/dist/src/services/simple-storage-service/main.d.ts +79 -0
- package/dist/src/services/simple-storage-service/main.js +191 -0
- package/dist/src/services/simple-storage-service/types.d.ts +25 -0
- package/dist/src/services/simple-storage-service/types.js +1 -0
- package/dist/src/services/step-function/index.d.ts +2 -0
- package/dist/src/services/step-function/index.js +2 -0
- package/dist/src/services/step-function/main.d.ts +161 -0
- package/dist/src/services/step-function/main.js +380 -0
- package/dist/src/services/step-function/types.d.ts +88 -0
- package/dist/src/services/step-function/types.js +1 -0
- package/dist/src/services/systems-manager/index.d.ts +2 -0
- package/dist/src/services/systems-manager/index.js +2 -0
- package/dist/src/services/systems-manager/main.d.ts +55 -0
- package/dist/src/services/systems-manager/main.js +97 -0
- package/dist/src/services/systems-manager/types.d.ts +9 -0
- package/dist/src/services/systems-manager/types.js +1 -0
- package/dist/src/services/virtual-private-cloud/index.d.ts +2 -0
- package/dist/src/services/virtual-private-cloud/index.js +2 -0
- package/dist/src/services/virtual-private-cloud/ipv6.d.ts +7 -0
- package/dist/src/services/virtual-private-cloud/ipv6.js +38 -0
- package/dist/src/services/virtual-private-cloud/main.d.ts +43 -0
- package/dist/src/services/virtual-private-cloud/main.js +87 -0
- package/dist/src/services/virtual-private-cloud/types.d.ts +4 -0
- package/dist/src/services/virtual-private-cloud/types.js +1 -0
- package/dist/src/services/web-application-firewall/index.d.ts +2 -0
- package/dist/src/services/web-application-firewall/index.js +2 -0
- package/dist/src/services/web-application-firewall/main.d.ts +35 -0
- package/dist/src/services/web-application-firewall/main.js +61 -0
- package/dist/src/services/web-application-firewall/types.d.ts +9 -0
- package/dist/src/services/web-application-firewall/types.js +1 -0
- package/dist/src/types/index.d.ts +6 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/utils/index.d.ts +45 -0
- package/dist/src/utils/index.js +61 -0
- package/package.json +44 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Duration } from 'aws-cdk-lib';
|
|
2
|
+
import { BuildSpec, ComputeType, LinuxBuildImage, Project } from 'aws-cdk-lib/aws-codebuild';
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Provides operations on AWS Code Build.
|
|
5
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
|
+
* @example
|
|
8
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
9
|
+
*
|
|
10
|
+
* class CustomConstruct extends CommonConstruct {
|
|
11
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
12
|
+
* super(parent, id, props)
|
|
13
|
+
* this.props = props
|
|
14
|
+
* this.codeBuildManager.createImageForCloudfrontInvalidation('MyInvalidation', this, './docker ')
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* @see [CDK Codebuild Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codebuild-readme.html}
|
|
18
|
+
*/
|
|
19
|
+
export class CodeBuildManager {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param id
|
|
23
|
+
* @param scope
|
|
24
|
+
* @param dockerfilePath
|
|
25
|
+
*/
|
|
26
|
+
createImageForCloudfrontInvalidation(id, scope, dockerfilePath) {
|
|
27
|
+
return scope.ecrManager.createDockerImage(`${id}-build-image`, scope, dockerfilePath);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param id
|
|
32
|
+
* @param scope
|
|
33
|
+
* @param dockerFilepath
|
|
34
|
+
* @param distributionId
|
|
35
|
+
* @param paths
|
|
36
|
+
*/
|
|
37
|
+
createProjectForCloudfrontInvalidation(id, scope, dockerFilepath, distributionId, paths) {
|
|
38
|
+
const invalidationPaths = paths ?? '/*';
|
|
39
|
+
return new Project(scope, `${id}-install-deps-project`, {
|
|
40
|
+
buildSpec: BuildSpec.fromObject({
|
|
41
|
+
phases: {
|
|
42
|
+
build: {
|
|
43
|
+
commands: [
|
|
44
|
+
`aws cloudfront create-invalidation --distribution-id ${distributionId} --paths "${invalidationPaths}"`,
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
version: '0.1',
|
|
49
|
+
}),
|
|
50
|
+
environment: {
|
|
51
|
+
buildImage: LinuxBuildImage.fromDockerRegistry(this.createImageForCloudfrontInvalidation(id, scope, dockerFilepath).imageUri),
|
|
52
|
+
computeType: ComputeType.SMALL,
|
|
53
|
+
privileged: true,
|
|
54
|
+
},
|
|
55
|
+
logging: {
|
|
56
|
+
cloudWatch: {
|
|
57
|
+
enabled: true,
|
|
58
|
+
logGroup: scope.logManager.createLogGroup(`${id}-project-log-group`, scope, {
|
|
59
|
+
logGroupName: `${id}-cloudfront-invalidation`,
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
role: scope.iamManager.createRoleForCloudfrontInvalidation(id, scope),
|
|
64
|
+
timeout: Duration.minutes(5),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Table, TableV2 } from 'aws-cdk-lib/aws-dynamodb';
|
|
2
|
+
import { CommonConstruct } from '../../common/index.js';
|
|
3
|
+
import { TableProps, TablePropsV2 } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Provides operations on AWS DynamoDB
|
|
6
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
7
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
8
|
+
* @example
|
|
9
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
10
|
+
*
|
|
11
|
+
* class CustomConstruct extends CommonConstruct {
|
|
12
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
13
|
+
* super(parent, id, props)
|
|
14
|
+
* this.props = props
|
|
15
|
+
* this.dynamodbManager.createTable('MyTable', this, tableProps)
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb-readme.html}
|
|
19
|
+
*/
|
|
20
|
+
export declare class DynamodbManager {
|
|
21
|
+
/**
|
|
22
|
+
* @summary Method to create a table
|
|
23
|
+
* @param id scoped id of the resource
|
|
24
|
+
* @param scope scope in which this resource is defined
|
|
25
|
+
* @param props table props
|
|
26
|
+
*/
|
|
27
|
+
createTable(id: string, scope: CommonConstruct, props: TableProps): Table;
|
|
28
|
+
/**
|
|
29
|
+
* @summary Method to create a table
|
|
30
|
+
* @param id scoped id of the resource
|
|
31
|
+
* @param scope scope in which this resource is defined
|
|
32
|
+
* @param props table props
|
|
33
|
+
*/
|
|
34
|
+
createTableV2(id: string, scope: CommonConstruct, props: TablePropsV2): TableV2;
|
|
35
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Tags } from 'aws-cdk-lib';
|
|
2
|
+
import { BillingMode, Table, TableV2, TableEncryption } from 'aws-cdk-lib/aws-dynamodb';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { createCfnOutput } from '../../utils/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* @classdesc Provides operations on AWS DynamoDB
|
|
7
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
8
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
9
|
+
* @example
|
|
10
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
11
|
+
*
|
|
12
|
+
* class CustomConstruct extends CommonConstruct {
|
|
13
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
14
|
+
* super(parent, id, props)
|
|
15
|
+
* this.props = props
|
|
16
|
+
* this.dynamodbManager.createTable('MyTable', this, tableProps)
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* @see [CDK Certificate Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb-readme.html}
|
|
20
|
+
*/
|
|
21
|
+
export class DynamodbManager {
|
|
22
|
+
/**
|
|
23
|
+
* @summary Method to create a table
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props table props
|
|
27
|
+
*/
|
|
28
|
+
createTable(id, scope, props) {
|
|
29
|
+
if (!props)
|
|
30
|
+
throw `Table props undefined for ${id}`;
|
|
31
|
+
if (!props.tableName)
|
|
32
|
+
throw `Table tableName undefined for ${id}`;
|
|
33
|
+
const table = new Table(scope, `${id}`, {
|
|
34
|
+
...props,
|
|
35
|
+
billingMode: props.billingMode ?? BillingMode.PAY_PER_REQUEST,
|
|
36
|
+
encryption: props.encryption ?? TableEncryption.AWS_MANAGED,
|
|
37
|
+
tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
|
|
38
|
+
});
|
|
39
|
+
if (props.tags && !_.isEmpty(props.tags)) {
|
|
40
|
+
_.forEach(props.tags, tag => {
|
|
41
|
+
Tags.of(table).add(tag.key, tag.value);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
createCfnOutput(`${id}-tableName`, scope, table.tableName);
|
|
45
|
+
createCfnOutput(`${id}-tableArn`, scope, table.tableArn);
|
|
46
|
+
return table;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @summary Method to create a table
|
|
50
|
+
* @param id scoped id of the resource
|
|
51
|
+
* @param scope scope in which this resource is defined
|
|
52
|
+
* @param props table props
|
|
53
|
+
*/
|
|
54
|
+
createTableV2(id, scope, props) {
|
|
55
|
+
if (!props)
|
|
56
|
+
throw `Table props undefined for ${id}`;
|
|
57
|
+
if (!props.tableName)
|
|
58
|
+
throw `Table tableName undefined for ${id}`;
|
|
59
|
+
const table = new TableV2(scope, `${id}`, {
|
|
60
|
+
...props,
|
|
61
|
+
tableName: scope.resourceNameFormatter.format(props.tableName, scope.props.resourceNameOptions?.table),
|
|
62
|
+
});
|
|
63
|
+
if (props.tags && !_.isEmpty(props.tags)) {
|
|
64
|
+
_.forEach(props.tags, tag => {
|
|
65
|
+
Tags.of(table).add(tag.key, tag.value);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
createCfnOutput(`${id}-tableName`, scope, table.tableName);
|
|
69
|
+
createCfnOutput(`${id}-tableArn`, scope, table.tableArn);
|
|
70
|
+
return table;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
2
|
+
import { TagProps } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
*/
|
|
5
|
+
export interface TableProps extends dynamodb.TableProps {
|
|
6
|
+
tags?: TagProps[];
|
|
7
|
+
}
|
|
8
|
+
export interface TablePropsV2 extends dynamodb.TablePropsV2 {
|
|
9
|
+
tags?: TagProps[];
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './main.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './main.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
|
|
2
|
+
import { CommonConstruct } from '../../common/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Provides operations on AWS Elastic Container Registry.
|
|
5
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
|
+
* @example
|
|
8
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
9
|
+
*
|
|
10
|
+
* class CustomConstruct extends CommonConstruct {
|
|
11
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
12
|
+
* super(parent, id, props)
|
|
13
|
+
* this.props = props
|
|
14
|
+
* this.ecrManager.createDockerImage('MyImage', this, dockerfilePath)
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
18
|
+
*/
|
|
19
|
+
export declare class EcrManager {
|
|
20
|
+
/**
|
|
21
|
+
* @summary Method to create a docker image in ecr
|
|
22
|
+
* @param id scoped id of the resource
|
|
23
|
+
* @param scope scope in which this resource is defined
|
|
24
|
+
* @param dockerfilePath
|
|
25
|
+
*/
|
|
26
|
+
createDockerImage(id: string, scope: CommonConstruct, dockerfilePath: string): DockerImageAsset;
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
|
|
2
|
+
import { createCfnOutput } from '../../utils/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Provides operations on AWS Elastic Container Registry.
|
|
5
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
6
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
7
|
+
* @example
|
|
8
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
9
|
+
*
|
|
10
|
+
* class CustomConstruct extends CommonConstruct {
|
|
11
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
12
|
+
* super(parent, id, props)
|
|
13
|
+
* this.props = props
|
|
14
|
+
* this.ecrManager.createDockerImage('MyImage', this, dockerfilePath)
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
18
|
+
*/
|
|
19
|
+
export class EcrManager {
|
|
20
|
+
/**
|
|
21
|
+
* @summary Method to create a docker image in ecr
|
|
22
|
+
* @param id scoped id of the resource
|
|
23
|
+
* @param scope scope in which this resource is defined
|
|
24
|
+
* @param dockerfilePath
|
|
25
|
+
*/
|
|
26
|
+
createDockerImage(id, scope, dockerfilePath) {
|
|
27
|
+
const asset = new DockerImageAsset(scope, `${id}`, {
|
|
28
|
+
directory: dockerfilePath,
|
|
29
|
+
});
|
|
30
|
+
createCfnOutput(`${id}-dockerImageArn`, scope, asset.imageUri);
|
|
31
|
+
return asset;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IVpc } from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import { Cluster, ContainerImage, ICluster, TaskDefinition } from 'aws-cdk-lib/aws-ecs';
|
|
3
|
+
import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns';
|
|
4
|
+
import { Role } from 'aws-cdk-lib/aws-iam';
|
|
5
|
+
import { ILogGroup } from 'aws-cdk-lib/aws-logs';
|
|
6
|
+
import { CommonConstruct } from '../../common/index.js';
|
|
7
|
+
import { EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EcsTaskProps } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* @classdesc Provides operations on AWS Elastic Container Service.
|
|
10
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
12
|
+
* @example
|
|
13
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
14
|
+
*
|
|
15
|
+
* class CustomConstruct extends CommonConstruct {
|
|
16
|
+
* constructor(parent: Construct, id: string, props: common.CommonStackProps) {
|
|
17
|
+
* super(parent, id, props)
|
|
18
|
+
* this.props = props
|
|
19
|
+
* this.ecsManager.createEcsCluster('MyCluster', this, vpc)
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
23
|
+
*/
|
|
24
|
+
export declare class EcsManager {
|
|
25
|
+
/**
|
|
26
|
+
* @summary Method to create an ecs cluster
|
|
27
|
+
* @param id scoped id of the resource
|
|
28
|
+
* @param scope scope in which this resource is defined
|
|
29
|
+
* @param props
|
|
30
|
+
* @param vpc
|
|
31
|
+
*/
|
|
32
|
+
createEcsCluster(id: string, scope: CommonConstruct, props: EcsClusterProps, vpc: IVpc): Cluster;
|
|
33
|
+
/**
|
|
34
|
+
* @summary Method to create an ecs fargate task
|
|
35
|
+
* @param id scoped id of the resource
|
|
36
|
+
* @param scope scope in which this resource is defined
|
|
37
|
+
* @param props
|
|
38
|
+
* @param cluster
|
|
39
|
+
* @param role
|
|
40
|
+
* @param logGroup
|
|
41
|
+
* @param containerImage
|
|
42
|
+
* @param environment
|
|
43
|
+
* @param secrets
|
|
44
|
+
* @param command
|
|
45
|
+
*/
|
|
46
|
+
createEcsFargateTask(id: string, scope: CommonConstruct, props: EcsTaskProps, cluster: ICluster, role: Role, logGroup: ILogGroup, containerImage: ContainerImage, environment?: any, secrets?: any, command?: string[]): TaskDefinition;
|
|
47
|
+
/**
|
|
48
|
+
* @summary Method to create an application load balanced ecs fargate task
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props
|
|
52
|
+
* @param cluster
|
|
53
|
+
* @param logGroup
|
|
54
|
+
*/
|
|
55
|
+
createLoadBalancedFargateService(id: string, scope: CommonConstruct, props: EcsApplicationLoadBalancedFargateServiceProps, cluster: ICluster, logGroup: ILogGroup): ApplicationLoadBalancedFargateService;
|
|
56
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Duration, Tags } from 'aws-cdk-lib';
|
|
2
|
+
import { Cluster, Compatibility, CpuArchitecture, LogDriver, NetworkMode, OperatingSystemFamily, TaskDefinition, } from 'aws-cdk-lib/aws-ecs';
|
|
3
|
+
import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
import { createCfnOutput } from '../../utils/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on AWS Elastic Container Service.
|
|
8
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
12
|
+
*
|
|
13
|
+
* class CustomConstruct extends CommonConstruct {
|
|
14
|
+
* constructor(parent: Construct, id: string, props: common.CommonStackProps) {
|
|
15
|
+
* super(parent, id, props)
|
|
16
|
+
* this.props = props
|
|
17
|
+
* this.ecsManager.createEcsCluster('MyCluster', this, vpc)
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
21
|
+
*/
|
|
22
|
+
export class EcsManager {
|
|
23
|
+
/**
|
|
24
|
+
* @summary Method to create an ecs cluster
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props
|
|
28
|
+
* @param vpc
|
|
29
|
+
*/
|
|
30
|
+
createEcsCluster(id, scope, props, vpc) {
|
|
31
|
+
if (!props)
|
|
32
|
+
throw `Ecs Cluster props undefined for ${id}`;
|
|
33
|
+
const ecsCluster = new Cluster(scope, `${id}`, {
|
|
34
|
+
...props,
|
|
35
|
+
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
36
|
+
vpc,
|
|
37
|
+
});
|
|
38
|
+
if (props.tags && !_.isEmpty(props.tags)) {
|
|
39
|
+
_.forEach(props.tags, tag => {
|
|
40
|
+
Tags.of(ecsCluster).add(tag.key, tag.value);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn);
|
|
44
|
+
createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName);
|
|
45
|
+
return ecsCluster;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @summary Method to create an ecs fargate task
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props
|
|
52
|
+
* @param cluster
|
|
53
|
+
* @param role
|
|
54
|
+
* @param logGroup
|
|
55
|
+
* @param containerImage
|
|
56
|
+
* @param environment
|
|
57
|
+
* @param secrets
|
|
58
|
+
* @param command
|
|
59
|
+
*/
|
|
60
|
+
createEcsFargateTask(id, scope, props, cluster, role, logGroup, containerImage, environment, secrets, command) {
|
|
61
|
+
if (!props)
|
|
62
|
+
throw `EcsTask props undefined for ${id}`;
|
|
63
|
+
const ecsTask = new TaskDefinition(scope, `${id}`, {
|
|
64
|
+
...props,
|
|
65
|
+
compatibility: Compatibility.FARGATE,
|
|
66
|
+
executionRole: role,
|
|
67
|
+
family: `${props.family}-${scope.props.stage}`,
|
|
68
|
+
networkMode: NetworkMode.AWS_VPC,
|
|
69
|
+
runtimePlatform: {
|
|
70
|
+
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
|
|
71
|
+
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
|
|
72
|
+
},
|
|
73
|
+
taskRole: role,
|
|
74
|
+
});
|
|
75
|
+
ecsTask.addContainer('EcsContainer', {
|
|
76
|
+
command,
|
|
77
|
+
cpu: props.cpu ? parseInt(props.cpu) : undefined,
|
|
78
|
+
disableNetworking: false,
|
|
79
|
+
environment,
|
|
80
|
+
image: containerImage,
|
|
81
|
+
logging: LogDriver.awsLogs({
|
|
82
|
+
logGroup,
|
|
83
|
+
logRetention: props.logging?.logRetention,
|
|
84
|
+
multilinePattern: props.logging?.multilinePattern,
|
|
85
|
+
streamPrefix: `${id}`,
|
|
86
|
+
}),
|
|
87
|
+
memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
|
|
88
|
+
privileged: false,
|
|
89
|
+
secrets,
|
|
90
|
+
});
|
|
91
|
+
if (props.tags && !_.isEmpty(props.tags)) {
|
|
92
|
+
_.forEach(props.tags, tag => {
|
|
93
|
+
Tags.of(ecsTask).add(tag.key, tag.value);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn);
|
|
97
|
+
return ecsTask;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @summary Method to create an application load balanced ecs fargate task
|
|
101
|
+
* @param id scoped id of the resource
|
|
102
|
+
* @param scope scope in which this resource is defined
|
|
103
|
+
* @param props
|
|
104
|
+
* @param cluster
|
|
105
|
+
* @param logGroup
|
|
106
|
+
*/
|
|
107
|
+
createLoadBalancedFargateService(id, scope, props, cluster, logGroup) {
|
|
108
|
+
if (!props)
|
|
109
|
+
throw `Ecs Load balanced Fargate Service props undefined for ${id}`;
|
|
110
|
+
if (!props.loadBalancerName)
|
|
111
|
+
throw `Ecs loadBalancerName undefined for ${id}`;
|
|
112
|
+
if (!props.serviceName)
|
|
113
|
+
throw `Ecs serviceName undefined for ${id}`;
|
|
114
|
+
if (!props.taskImageOptions)
|
|
115
|
+
throw `TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}`;
|
|
116
|
+
const fargateService = new ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
|
|
117
|
+
...props,
|
|
118
|
+
assignPublicIp: props.assignPublicIp ?? true,
|
|
119
|
+
cluster,
|
|
120
|
+
enableECSManagedTags: true,
|
|
121
|
+
healthCheckGracePeriod: props.healthCheckGracePeriod ?? Duration.seconds(60),
|
|
122
|
+
loadBalancerName: scope.resourceNameFormatter.format(props.loadBalancerName, scope.props.resourceNameOptions?.ecs),
|
|
123
|
+
runtimePlatform: {
|
|
124
|
+
cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
|
|
125
|
+
operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
|
|
126
|
+
},
|
|
127
|
+
serviceName: scope.resourceNameFormatter.format(props.serviceName, scope.props.resourceNameOptions?.ecs),
|
|
128
|
+
taskImageOptions: {
|
|
129
|
+
...props.taskImageOptions,
|
|
130
|
+
enableLogging: props.taskImageOptions?.enableLogging ?? true,
|
|
131
|
+
logDriver: props.taskImageOptions?.logDriver ??
|
|
132
|
+
LogDriver.awsLogs({
|
|
133
|
+
logGroup: logGroup,
|
|
134
|
+
logRetention: props.logging?.logRetention,
|
|
135
|
+
multilinePattern: props.logging?.multilinePattern,
|
|
136
|
+
streamPrefix: `${id}-${scope.props.stage}/ecs`,
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
if (props.healthCheck) {
|
|
141
|
+
fargateService.targetGroup.configureHealthCheck({
|
|
142
|
+
...props.healthCheck,
|
|
143
|
+
interval: props.healthCheck.interval ?? Duration.seconds(props.healthCheck.intervalInSecs),
|
|
144
|
+
timeout: props.healthCheck.timeout ?? Duration.seconds(props.healthCheck.timeoutInSecs),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return fargateService;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ScalingSchedule } from 'aws-cdk-lib/aws-applicationautoscaling';
|
|
2
|
+
import { AwsLogDriverProps, ClusterProps, HealthCheck as FargateHealthCheck, MountPoint, TaskDefinitionProps } from 'aws-cdk-lib/aws-ecs';
|
|
3
|
+
import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-patterns';
|
|
4
|
+
import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
5
|
+
import { TagProps } from '../../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
*/
|
|
8
|
+
export interface EcsClusterProps extends ClusterProps {
|
|
9
|
+
tags?: TagProps[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
export interface EcsTaskProps extends TaskDefinitionProps {
|
|
14
|
+
logging?: AwsLogDriverProps;
|
|
15
|
+
tags?: TagProps[];
|
|
16
|
+
}
|
|
17
|
+
export interface EcsScalingProps {
|
|
18
|
+
maxCapacity?: number;
|
|
19
|
+
minCapacity?: number;
|
|
20
|
+
scaleOnCpuUtilization?: number;
|
|
21
|
+
scaleOnMemoryUtilization?: number;
|
|
22
|
+
scaleOnRequestsPerTarget?: number;
|
|
23
|
+
scaleOnSchedule?: ScalingSchedule;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*/
|
|
27
|
+
export interface HealthCheck extends ElbHealthCheck {
|
|
28
|
+
intervalInSecs: number;
|
|
29
|
+
timeoutInSecs: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export interface EcsApplicationLoadBalancedFargateServiceHealthCheck extends FargateHealthCheck {
|
|
35
|
+
intervalInSecs: number;
|
|
36
|
+
timeoutInSecs: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
*/
|
|
40
|
+
export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
|
|
41
|
+
healthCheck?: EcsApplicationLoadBalancedFargateServiceHealthCheck;
|
|
42
|
+
logging?: AwsLogDriverProps;
|
|
43
|
+
mountPoints?: MountPoint[];
|
|
44
|
+
siteScaling?: EcsScalingProps;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ISecurityGroup, IVpc, SubnetSelection } from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import { FileSystem } from 'aws-cdk-lib/aws-efs';
|
|
3
|
+
import { CommonConstruct } from '../../common/index.js';
|
|
4
|
+
import { EfsAccessPointOptions, EfsFileSystemProps } from './types.js';
|
|
5
|
+
export declare const DEFAULT_CREATE_ACL: {
|
|
6
|
+
ownerGid: string;
|
|
7
|
+
ownerUid: string;
|
|
8
|
+
permissions: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_POSIX_USER: {
|
|
11
|
+
gid: string;
|
|
12
|
+
uid: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @classdesc Provides operations on AWS Elastic File System.
|
|
16
|
+
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
17
|
+
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
18
|
+
* @example
|
|
19
|
+
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
20
|
+
*
|
|
21
|
+
* class CustomConstruct extends CommonConstruct {
|
|
22
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
23
|
+
* super(parent, id, props)
|
|
24
|
+
* this.props = props
|
|
25
|
+
* this.efsManager.createFileSystem('MyFileSystem', this, fileSystemProps, vpc)
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* @see [CDK EFS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs-readme.html}
|
|
29
|
+
*/
|
|
30
|
+
export declare class EfsManager {
|
|
31
|
+
/**
|
|
32
|
+
* @summary Method to create an efs file system
|
|
33
|
+
* @param id scoped id of the resource
|
|
34
|
+
* @param scope scope in which this resource is defined
|
|
35
|
+
* @param props the file system props
|
|
36
|
+
* @param vpc the vpc to use for the file system
|
|
37
|
+
* @param accessPointOptions optional access point configuration options for the file system
|
|
38
|
+
* @param securityGroup optional security groups to configure for the file system
|
|
39
|
+
* @param vpcSubnets optional subnets to configure for the file system
|
|
40
|
+
*/
|
|
41
|
+
createFileSystem(id: string, scope: CommonConstruct, props: EfsFileSystemProps, vpc: IVpc, accessPointOptions?: EfsAccessPointOptions[], securityGroup?: ISecurityGroup, vpcSubnets?: SubnetSelection): FileSystem;
|
|
42
|
+
}
|