@gradientedge/cdk-utils 8.91.0 → 8.93.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/.eslintrc.json +40 -0
- package/app/api-destined-function/src/lib/lambda.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
- package/dist/lib/lambda.d.ts +6 -6
- package/dist/lib/lambda.js +6 -6
- package/dist/lib/lambda.js.map +1 -1
- package/dist/src/lib/common/construct.d.ts +4 -7
- package/dist/src/lib/common/construct.js +4 -7
- package/dist/src/lib/common/stack.d.ts +9 -13
- package/dist/src/lib/common/stack.js +9 -13
- package/dist/src/lib/common/types.d.ts +0 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
- package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
- package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
- package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +1 -19
- package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
- package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
- package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
- package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
- package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
- package/dist/src/lib/construct/static-site/main.d.ts +0 -17
- package/dist/src/lib/construct/static-site/main.js +1 -18
- package/dist/src/lib/construct/static-site/types.d.ts +9 -11
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
- package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
- package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
- package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
- package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
- package/dist/src/lib/services/aws/appconfig/main.js +19 -22
- package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
- package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
- package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
- package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
- package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
- package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
- package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
- package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
- package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
- package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
- package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
- package/dist/src/lib/services/aws/codebuild/main.js +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
- package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
- package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
- package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
- package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
- package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
- package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
- package/dist/src/lib/services/aws/elasticache/main.js +35 -39
- package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
- package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
- package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
- package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
- package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
- package/dist/src/lib/services/aws/evidently/main.js +19 -23
- package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
- package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
- package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
- package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
- package/dist/src/lib/services/aws/lambda/main.js +64 -69
- package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
- package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
- package/dist/src/lib/services/aws/route53/main.js +19 -23
- package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
- package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
- package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
- package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
- package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
- package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
- package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
- package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
- package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
- package/dist/src/lib/services/aws/step-function/main.js +91 -95
- package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
- package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
- package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
- package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
- package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
- package/dist/src/lib/types/aws/index.d.ts +0 -2
- package/dist/src/lib/utils/aws/index.d.ts +6 -9
- package/dist/src/lib/utils/aws/index.js +7 -10
- package/dist/src/lib/utils/index.d.ts +6 -13
- package/dist/src/lib/utils/index.js +4 -12
- package/package.json +1 -1
- package/src/lib/common/construct.ts +4 -7
- package/src/lib/common/stack.ts +9 -13
- package/src/lib/common/types.ts +0 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
- package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
- package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
- package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
- package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
- package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
- package/src/lib/construct/graphql-api-lambda/main.ts +2 -20
- package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
- package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
- package/src/lib/construct/rest-api-lambda/main.ts +2 -20
- package/src/lib/construct/rest-api-lambda/types.ts +6 -10
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
- package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
- package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
- package/src/lib/construct/static-asset-deployment/main.ts +0 -8
- package/src/lib/construct/static-asset-deployment/types.ts +1 -1
- package/src/lib/construct/static-site/main.ts +1 -18
- package/src/lib/construct/static-site/types.ts +9 -11
- package/src/lib/services/aws/api-gateway/main.ts +43 -47
- package/src/lib/services/aws/api-gateway/types.ts +0 -2
- package/src/lib/services/aws/appconfig/constants.ts +26 -32
- package/src/lib/services/aws/appconfig/main.ts +19 -22
- package/src/lib/services/aws/appconfig/types.ts +1 -3
- package/src/lib/services/aws/certificate-manager/main.ts +5 -10
- package/src/lib/services/aws/certificate-manager/types.ts +3 -5
- package/src/lib/services/aws/cloudfront/main.ts +56 -62
- package/src/lib/services/aws/cloudfront/types.ts +1 -7
- package/src/lib/services/aws/cloudtrail/main.ts +8 -12
- package/src/lib/services/aws/cloudtrail/types.ts +0 -2
- package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
- package/src/lib/services/aws/cloudwatch/main.ts +116 -122
- package/src/lib/services/aws/cloudwatch/types.ts +20 -42
- package/src/lib/services/aws/codebuild/main.ts +3 -7
- package/src/lib/services/aws/dynamodb/main.ts +13 -17
- package/src/lib/services/aws/dynamodb/types.ts +0 -2
- package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
- package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
- package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
- package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
- package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
- package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
- package/src/lib/services/aws/elasticache/main.ts +35 -39
- package/src/lib/services/aws/elasticache/types.ts +0 -4
- package/src/lib/services/aws/eventbridge/main.ts +34 -38
- package/src/lib/services/aws/eventbridge/target.ts +8 -11
- package/src/lib/services/aws/eventbridge/types.ts +2 -10
- package/src/lib/services/aws/evidently/main.ts +19 -23
- package/src/lib/services/aws/evidently/types.ts +0 -10
- package/src/lib/services/aws/identity-access-management/main.ts +97 -101
- package/src/lib/services/aws/key-management-service/main.ts +6 -10
- package/src/lib/services/aws/key-management-service/types.ts +0 -2
- package/src/lib/services/aws/lambda/main.ts +64 -69
- package/src/lib/services/aws/lambda/types.ts +6 -16
- package/src/lib/services/aws/route53/main.ts +19 -23
- package/src/lib/services/aws/route53/types.ts +0 -2
- package/src/lib/services/aws/secrets-manager/main.ts +6 -28
- package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
- package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
- package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
- package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
- package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
- package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
- package/src/lib/services/aws/step-function/main.ts +91 -95
- package/src/lib/services/aws/step-function/types.ts +0 -32
- package/src/lib/services/aws/systems-manager/main.ts +13 -19
- package/src/lib/services/aws/systems-manager/types.ts +0 -2
- package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
- package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
- package/src/lib/types/aws/index.ts +0 -2
- package/src/lib/utils/aws/index.ts +7 -10
- package/src/lib/utils/index.ts +4 -12
|
@@ -11,9 +11,6 @@ import { CommonConstruct } from '../../../common';
|
|
|
11
11
|
import { CloudfrontFunctionProps, CloudFrontProps, DistributionProps } from './types';
|
|
12
12
|
import { LambdaEdgeProps } from '../lambda';
|
|
13
13
|
/**
|
|
14
|
-
* @stability stable
|
|
15
|
-
* @category cdk-utils.cloudfront-manager
|
|
16
|
-
* @subcategory Construct
|
|
17
14
|
* @classdesc Provides operations on AWS CloudFront.
|
|
18
15
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
19
16
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -34,64 +31,62 @@ import { LambdaEdgeProps } from '../lambda';
|
|
|
34
31
|
* )
|
|
35
32
|
* }
|
|
36
33
|
* }
|
|
37
|
-
*
|
|
38
34
|
* @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
|
|
39
35
|
*/
|
|
40
36
|
export declare class CloudFrontManager {
|
|
41
37
|
createOriginAccessIdentity(id: string, scope: CommonConstruct, accessBucket?: s3.IBucket): cdk.aws_cloudfront.OriginAccessIdentity;
|
|
42
38
|
/**
|
|
43
39
|
* @summary Method to create a cloudfront distribution
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
40
|
+
* @param id scoped id of the resource
|
|
41
|
+
* @param scope scope in which this resource is defined
|
|
42
|
+
* @param props distribution properties
|
|
43
|
+
* @param siteBucket
|
|
44
|
+
* @param logBucket
|
|
45
|
+
* @param oai
|
|
46
|
+
* @param certificate
|
|
47
|
+
* @param aliases
|
|
52
48
|
*/
|
|
53
49
|
createCloudFrontDistribution(id: string, scope: CommonConstruct, props: CloudFrontProps, siteBucket?: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[]): cdk.aws_cloudfront.CloudFrontWebDistribution;
|
|
54
50
|
/**
|
|
55
51
|
* Method to create a CloudFront distribution with S3 Origin
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
52
|
+
* @param id scoped id of the resource
|
|
53
|
+
* @param scope scope in which this resource is defined
|
|
54
|
+
* @param props distribution properties
|
|
55
|
+
* @param origin
|
|
56
|
+
* @param siteBucket
|
|
57
|
+
* @param logBucket
|
|
58
|
+
* @param oai
|
|
59
|
+
* @param certificate
|
|
60
|
+
* @param aliases
|
|
61
|
+
* @param defaultFunctionAssociations
|
|
66
62
|
*/
|
|
67
63
|
createDistributionWithS3Origin(id: string, scope: CommonConstruct, props: DistributionProps, origin: origins.S3Origin, siteBucket: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[], defaultFunctionAssociations?: cloudfront.FunctionAssociation[]): cdk.aws_cloudfront.Distribution;
|
|
68
64
|
/**
|
|
69
65
|
* Method to create a CloudFront distribution with HTTP Origin
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
66
|
+
* @param id scoped id of the resource
|
|
67
|
+
* @param scope scope in which this resource is defined
|
|
68
|
+
* @param props distribution properties
|
|
69
|
+
* @param origin
|
|
70
|
+
* @param domainNames
|
|
71
|
+
* @param logBucket
|
|
72
|
+
* @param certificate
|
|
73
|
+
* @param defaultFunctionAssociations
|
|
74
|
+
* @param responseHeadersPolicy
|
|
79
75
|
*/
|
|
80
76
|
createDistributionWithHttpOrigin(id: string, scope: CommonConstruct, props: DistributionProps, origin: origins.HttpOrigin, domainNames: string[], logBucket?: s3.IBucket, certificate?: acm.ICertificate, defaultFunctionAssociations?: cloudfront.FunctionAssociation[], responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy): cdk.aws_cloudfront.Distribution;
|
|
81
77
|
/**
|
|
82
78
|
* @summary Method to provision a Lambda@Edge function
|
|
83
|
-
*
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
93
|
-
* @param
|
|
94
|
-
* @param {string} mountPath
|
|
79
|
+
* @param id scoped id of the resource
|
|
80
|
+
* @param scope scope in which this resource is defined
|
|
81
|
+
* @param props lambda@edge properties
|
|
82
|
+
* @param layers
|
|
83
|
+
* @param code
|
|
84
|
+
* @param role
|
|
85
|
+
* @param environment
|
|
86
|
+
* @param vpc
|
|
87
|
+
* @param securityGroups
|
|
88
|
+
* @param accessPoint
|
|
89
|
+
* @param mountPath
|
|
95
90
|
*/
|
|
96
91
|
createEdgeFunction(id: string, scope: CommonConstruct, props: LambdaEdgeProps, layers: lambda.ILayerVersion[], code: lambda.AssetCode, role: iam.Role, environment?: any, vpc?: ec2.IVpc, securityGroups?: ec2.ISecurityGroup[], accessPoint?: efs.IAccessPoint, mountPath?: string): cdk.aws_cloudfront.experimental.EdgeFunction;
|
|
97
92
|
/**
|
|
@@ -105,10 +100,9 @@ export declare class CloudFrontManager {
|
|
|
105
100
|
invalidateCache(id: string, scope: CommonConstruct, dockerFilePath: string, distributionId: string, paths?: string): void;
|
|
106
101
|
/**
|
|
107
102
|
* @summary Method to provision a Cloudfront function
|
|
108
|
-
*
|
|
109
|
-
* @param
|
|
110
|
-
* @param
|
|
111
|
-
* @param {CloudfrontFunctionProps} props
|
|
103
|
+
* @param id scoped id of the resource
|
|
104
|
+
* @param scope scope in which this resource is defined
|
|
105
|
+
* @param props
|
|
112
106
|
*/
|
|
113
107
|
createCloudfrontFunction(id: string, scope: CommonConstruct, props: CloudfrontFunctionProps): cdk.aws_cloudfront.Function;
|
|
114
108
|
}
|
|
@@ -31,9 +31,6 @@ const cr = __importStar(require("aws-cdk-lib/custom-resources"));
|
|
|
31
31
|
const common_1 = require("../../../common");
|
|
32
32
|
const utils = __importStar(require("../../../utils"));
|
|
33
33
|
/**
|
|
34
|
-
* @stability stable
|
|
35
|
-
* @category cdk-utils.cloudfront-manager
|
|
36
|
-
* @subcategory Construct
|
|
37
34
|
* @classdesc Provides operations on AWS CloudFront.
|
|
38
35
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
39
36
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -54,7 +51,6 @@ const utils = __importStar(require("../../../utils"));
|
|
|
54
51
|
* )
|
|
55
52
|
* }
|
|
56
53
|
* }
|
|
57
|
-
*
|
|
58
54
|
* @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
|
|
59
55
|
*/
|
|
60
56
|
class CloudFrontManager {
|
|
@@ -68,14 +64,14 @@ class CloudFrontManager {
|
|
|
68
64
|
}
|
|
69
65
|
/**
|
|
70
66
|
* @summary Method to create a cloudfront distribution
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
67
|
+
* @param id scoped id of the resource
|
|
68
|
+
* @param scope scope in which this resource is defined
|
|
69
|
+
* @param props distribution properties
|
|
70
|
+
* @param siteBucket
|
|
71
|
+
* @param logBucket
|
|
72
|
+
* @param oai
|
|
73
|
+
* @param certificate
|
|
74
|
+
* @param aliases
|
|
79
75
|
*/
|
|
80
76
|
createCloudFrontDistribution(id, scope, props, siteBucket, logBucket, oai, certificate, aliases) {
|
|
81
77
|
if (!siteBucket)
|
|
@@ -87,8 +83,8 @@ class CloudFrontManager {
|
|
|
87
83
|
const distribution = new cloudfront.CloudFrontWebDistribution(scope, `${id}`, {
|
|
88
84
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
89
85
|
defaultRootObject: props.defaultRootObject,
|
|
90
|
-
enabled: props.enabled ?? true,
|
|
91
86
|
enableIpV6: props.enableIpV6,
|
|
87
|
+
enabled: props.enabled ?? true,
|
|
92
88
|
errorConfigurations: props.errorConfigurations,
|
|
93
89
|
geoRestriction: props.geoRestriction,
|
|
94
90
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
@@ -98,11 +94,11 @@ class CloudFrontManager {
|
|
|
98
94
|
},
|
|
99
95
|
originConfigs: [
|
|
100
96
|
{
|
|
97
|
+
behaviors: [{ isDefaultBehavior: true }],
|
|
101
98
|
s3OriginSource: {
|
|
102
|
-
s3BucketSource: siteBucket,
|
|
103
99
|
originAccessIdentity: oai,
|
|
100
|
+
s3BucketSource: siteBucket,
|
|
104
101
|
},
|
|
105
|
-
behaviors: [{ isDefaultBehavior: true }],
|
|
106
102
|
},
|
|
107
103
|
],
|
|
108
104
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
@@ -124,41 +120,41 @@ class CloudFrontManager {
|
|
|
124
120
|
}
|
|
125
121
|
/**
|
|
126
122
|
* Method to create a CloudFront distribution with S3 Origin
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
123
|
+
* @param id scoped id of the resource
|
|
124
|
+
* @param scope scope in which this resource is defined
|
|
125
|
+
* @param props distribution properties
|
|
126
|
+
* @param origin
|
|
127
|
+
* @param siteBucket
|
|
128
|
+
* @param logBucket
|
|
129
|
+
* @param oai
|
|
130
|
+
* @param certificate
|
|
131
|
+
* @param aliases
|
|
132
|
+
* @param defaultFunctionAssociations
|
|
137
133
|
*/
|
|
138
134
|
createDistributionWithS3Origin(id, scope, props, origin, siteBucket, logBucket, oai, certificate, aliases, defaultFunctionAssociations) {
|
|
139
135
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
136
|
+
additionalBehaviors: props.additionalBehaviors,
|
|
140
137
|
certificate: certificate,
|
|
141
138
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
142
139
|
defaultBehavior: {
|
|
143
140
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
141
|
+
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
142
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
144
143
|
origin: origin,
|
|
145
144
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
146
|
-
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
147
145
|
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
148
|
-
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
149
146
|
},
|
|
150
|
-
additionalBehaviors: props.additionalBehaviors,
|
|
151
147
|
defaultRootObject: props.defaultRootObject,
|
|
152
148
|
domainNames: aliases,
|
|
153
|
-
enabled: props.enabled ?? true,
|
|
154
149
|
enableIpv6: props.enableIpv6,
|
|
155
150
|
enableLogging: props.enableLogging ?? true,
|
|
151
|
+
enabled: props.enabled ?? true,
|
|
156
152
|
errorResponses: props.errorResponses,
|
|
157
153
|
geoRestriction: props.geoRestriction,
|
|
158
154
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
159
155
|
logBucket: logBucket,
|
|
160
|
-
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
161
156
|
logFilePrefix: props.logFilePrefix ?? `edge/`,
|
|
157
|
+
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
162
158
|
minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
163
159
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
164
160
|
webAclId: props.webAclId,
|
|
@@ -174,41 +170,41 @@ class CloudFrontManager {
|
|
|
174
170
|
}
|
|
175
171
|
/**
|
|
176
172
|
* Method to create a CloudFront distribution with HTTP Origin
|
|
177
|
-
* @param
|
|
178
|
-
* @param
|
|
179
|
-
* @param
|
|
180
|
-
* @param
|
|
181
|
-
* @param
|
|
182
|
-
* @param
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
-
* @param
|
|
173
|
+
* @param id scoped id of the resource
|
|
174
|
+
* @param scope scope in which this resource is defined
|
|
175
|
+
* @param props distribution properties
|
|
176
|
+
* @param origin
|
|
177
|
+
* @param domainNames
|
|
178
|
+
* @param logBucket
|
|
179
|
+
* @param certificate
|
|
180
|
+
* @param defaultFunctionAssociations
|
|
181
|
+
* @param responseHeadersPolicy
|
|
186
182
|
*/
|
|
187
183
|
createDistributionWithHttpOrigin(id, scope, props, origin, domainNames, logBucket, certificate, defaultFunctionAssociations, responseHeadersPolicy) {
|
|
188
184
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
185
|
+
additionalBehaviors: props.additionalBehaviors,
|
|
189
186
|
certificate: certificate,
|
|
190
187
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
191
188
|
defaultBehavior: {
|
|
192
189
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
190
|
+
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
191
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
193
192
|
origin: origin,
|
|
194
193
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
195
|
-
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
196
|
-
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
197
194
|
responseHeadersPolicy: responseHeadersPolicy ?? undefined,
|
|
198
|
-
|
|
195
|
+
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
199
196
|
},
|
|
200
|
-
additionalBehaviors: props.additionalBehaviors,
|
|
201
197
|
defaultRootObject: props.defaultRootObject,
|
|
202
198
|
domainNames: domainNames,
|
|
203
|
-
enabled: props.enabled ?? true,
|
|
204
199
|
enableIpv6: props.enableIpv6,
|
|
205
200
|
enableLogging: props.enableLogging ?? true,
|
|
201
|
+
enabled: props.enabled ?? true,
|
|
206
202
|
errorResponses: props.errorResponses,
|
|
207
203
|
geoRestriction: props.geoRestriction,
|
|
208
204
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
209
205
|
logBucket: logBucket,
|
|
210
|
-
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
211
206
|
logFilePrefix: props.logFilePrefix ?? `edge/`,
|
|
207
|
+
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
212
208
|
minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
213
209
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
214
210
|
webAclId: props.webAclId,
|
|
@@ -224,18 +220,17 @@ class CloudFrontManager {
|
|
|
224
220
|
}
|
|
225
221
|
/**
|
|
226
222
|
* @summary Method to provision a Lambda@Edge function
|
|
227
|
-
*
|
|
228
|
-
* @param
|
|
229
|
-
* @param
|
|
230
|
-
* @param
|
|
231
|
-
* @param
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
234
|
-
* @param
|
|
235
|
-
* @param
|
|
236
|
-
* @param
|
|
237
|
-
* @param
|
|
238
|
-
* @param {string} mountPath
|
|
223
|
+
* @param id scoped id of the resource
|
|
224
|
+
* @param scope scope in which this resource is defined
|
|
225
|
+
* @param props lambda@edge properties
|
|
226
|
+
* @param layers
|
|
227
|
+
* @param code
|
|
228
|
+
* @param role
|
|
229
|
+
* @param environment
|
|
230
|
+
* @param vpc
|
|
231
|
+
* @param securityGroups
|
|
232
|
+
* @param accessPoint
|
|
233
|
+
* @param mountPath
|
|
239
234
|
*/
|
|
240
235
|
createEdgeFunction(id, scope, props, layers, code, role, environment, vpc, securityGroups, accessPoint, mountPath) {
|
|
241
236
|
if (!props)
|
|
@@ -281,22 +276,21 @@ class CloudFrontManager {
|
|
|
281
276
|
invalidateCache(id, scope, dockerFilePath, distributionId, paths) {
|
|
282
277
|
new cr.AwsCustomResource(scope, `${id}-trigger-codebuild-${new Date().getTime()}`, {
|
|
283
278
|
onCreate: {
|
|
284
|
-
service: 'CodeBuild',
|
|
285
279
|
action: 'startBuild',
|
|
286
280
|
parameters: {
|
|
287
281
|
projectName: scope.codeBuildManager.createProjectForCloudfrontInvalidation(id, scope, dockerFilePath, distributionId, paths).projectName,
|
|
288
282
|
},
|
|
289
283
|
physicalResourceId: cr.PhysicalResourceId.fromResponse('build.id'),
|
|
284
|
+
service: 'CodeBuild',
|
|
290
285
|
},
|
|
291
286
|
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE }),
|
|
292
287
|
});
|
|
293
288
|
}
|
|
294
289
|
/**
|
|
295
290
|
* @summary Method to provision a Cloudfront function
|
|
296
|
-
*
|
|
297
|
-
* @param
|
|
298
|
-
* @param
|
|
299
|
-
* @param {CloudfrontFunctionProps} props
|
|
291
|
+
* @param id scoped id of the resource
|
|
292
|
+
* @param scope scope in which this resource is defined
|
|
293
|
+
* @param props
|
|
300
294
|
*/
|
|
301
295
|
createCloudfrontFunction(id, scope, props) {
|
|
302
296
|
const cloudfrontFunction = new cloudfront.Function(scope, `${id}`, {
|
|
@@ -2,24 +2,18 @@ import { TagProps } from '../../../types';
|
|
|
2
2
|
import * as cf from 'aws-cdk-lib/aws-cloudfront';
|
|
3
3
|
import { CloudFrontWebDistributionProps, FunctionProps } from 'aws-cdk-lib/aws-cloudfront';
|
|
4
4
|
/**
|
|
5
|
-
* @category cdk-utils.cloudfront-manager
|
|
6
|
-
* @subcategory Properties
|
|
7
5
|
*/
|
|
8
6
|
export interface CloudFrontProps extends CloudFrontWebDistributionProps {
|
|
9
7
|
tags?: TagProps[];
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
|
-
* @category cdk-utils.cloudfront-manager
|
|
13
|
-
* @subcategory Properties
|
|
14
10
|
*/
|
|
15
11
|
export interface DistributionProps extends cf.DistributionProps {
|
|
16
12
|
tags?: TagProps[];
|
|
17
13
|
}
|
|
18
14
|
/**
|
|
19
|
-
* @category cdk-utils.cloudfront-manager
|
|
20
|
-
* @subcategory Properties
|
|
21
15
|
*/
|
|
22
16
|
export interface CloudfrontFunctionProps extends FunctionProps {
|
|
23
|
-
functionFilePath: string;
|
|
24
17
|
eventType: string;
|
|
18
|
+
functionFilePath: string;
|
|
25
19
|
}
|
|
@@ -4,9 +4,6 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
|
4
4
|
import { CommonConstruct } from '../../../common';
|
|
5
5
|
import { CloudTrailProps } from './types';
|
|
6
6
|
/**
|
|
7
|
-
* @stability stable
|
|
8
|
-
* @category cdk-utils.cloudtrail-manager
|
|
9
|
-
* @subcategory Construct
|
|
10
7
|
* @classdesc Provides operations on AWS CloudTrail.
|
|
11
8
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
12
9
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -27,22 +24,21 @@ import { CloudTrailProps } from './types';
|
|
|
27
24
|
* )
|
|
28
25
|
* }
|
|
29
26
|
* }
|
|
30
|
-
*
|
|
31
27
|
* @see [CDK CloudTrail Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html}
|
|
32
28
|
*/
|
|
33
29
|
export declare class CloudTrailManager {
|
|
34
30
|
/**
|
|
35
31
|
* @summary Method to create a cloud trail
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
32
|
+
* @param id scoped id of the resource
|
|
33
|
+
* @param scope scope in which this resource is defined
|
|
34
|
+
* @param props
|
|
35
|
+
* @param logGroup
|
|
36
|
+
* @param dataBucket
|
|
37
|
+
* @param logBucket
|
|
38
|
+
* @param logBucketPolicy
|
|
43
39
|
*/
|
|
44
40
|
createCloudTrail(id: string, scope: CommonConstruct, props: CloudTrailProps, logGroup: logs.CfnLogGroup, dataBucket: s3.IBucket, logBucket: s3.IBucket, logBucketPolicy: s3.CfnBucketPolicy): {
|
|
45
|
-
cloudTrailRole: import("aws-cdk-lib/aws-iam").CfnRole;
|
|
46
41
|
cloudTrail: cloudtrail.CfnTrail;
|
|
42
|
+
cloudTrailRole: import("aws-cdk-lib/aws-iam").CfnRole;
|
|
47
43
|
};
|
|
48
44
|
}
|
|
@@ -27,9 +27,6 @@ exports.CloudTrailManager = void 0;
|
|
|
27
27
|
const cloudtrail = __importStar(require("aws-cdk-lib/aws-cloudtrail"));
|
|
28
28
|
const utils = __importStar(require("../../../utils"));
|
|
29
29
|
/**
|
|
30
|
-
* @stability stable
|
|
31
|
-
* @category cdk-utils.cloudtrail-manager
|
|
32
|
-
* @subcategory Construct
|
|
33
30
|
* @classdesc Provides operations on AWS CloudTrail.
|
|
34
31
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
35
32
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -50,19 +47,18 @@ const utils = __importStar(require("../../../utils"));
|
|
|
50
47
|
* )
|
|
51
48
|
* }
|
|
52
49
|
* }
|
|
53
|
-
*
|
|
54
50
|
* @see [CDK CloudTrail Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html}
|
|
55
51
|
*/
|
|
56
52
|
class CloudTrailManager {
|
|
57
53
|
/**
|
|
58
54
|
* @summary Method to create a cloud trail
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
55
|
+
* @param id scoped id of the resource
|
|
56
|
+
* @param scope scope in which this resource is defined
|
|
57
|
+
* @param props
|
|
58
|
+
* @param logGroup
|
|
59
|
+
* @param dataBucket
|
|
60
|
+
* @param logBucket
|
|
61
|
+
* @param logBucketPolicy
|
|
66
62
|
*/
|
|
67
63
|
createCloudTrail(id, scope, props, logGroup, dataBucket, logBucket, logBucketPolicy) {
|
|
68
64
|
if (!props)
|
|
@@ -97,7 +93,7 @@ class CloudTrailManager {
|
|
|
97
93
|
cloudTrail.addDependency(role);
|
|
98
94
|
utils.createCfnOutput(`${id}-trailName`, scope, cloudTrail.trailName);
|
|
99
95
|
utils.createCfnOutput(`${id}-trailArn`, scope, cloudTrail.attrArn);
|
|
100
|
-
return { cloudTrailRole: role
|
|
96
|
+
return { cloudTrail, cloudTrailRole: role };
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
exports.CloudTrailManager = CloudTrailManager;
|
|
@@ -3,9 +3,6 @@ import * as logs from 'aws-cdk-lib/aws-logs';
|
|
|
3
3
|
import { CommonConstruct } from '../../../common';
|
|
4
4
|
import { LogProps, MetricFilterProps } from './types';
|
|
5
5
|
/**
|
|
6
|
-
* @stability stable
|
|
7
|
-
* @category cdk-utils.cloudwatch-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS CloudWatch.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,33 +16,32 @@ import { LogProps, MetricFilterProps } from './types';
|
|
|
19
16
|
* this.logsManager.createMetricFilter('MyMetricFilter', this, logGroup)
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export declare class LogManager {
|
|
26
22
|
/**
|
|
27
23
|
* @summary Method to create a cloudwatch metric filter
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props
|
|
27
|
+
* @param logGroup
|
|
32
28
|
*/
|
|
33
29
|
createMetricFilter(id: string, scope: CommonConstruct, props: MetricFilterProps, logGroup: logs.ILogGroup): {
|
|
34
|
-
metricFilter: cdk.aws_logs.MetricFilter;
|
|
35
30
|
metric: cdk.aws_cloudwatch.Metric;
|
|
31
|
+
metricFilter: cdk.aws_logs.MetricFilter;
|
|
36
32
|
};
|
|
37
33
|
/**
|
|
38
34
|
* @summary Method to create a cloudwatch log group (cfn)
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
35
|
+
* @param id scoped id of the resource
|
|
36
|
+
* @param scope scope in which this resource is defined
|
|
37
|
+
* @param props
|
|
42
38
|
*/
|
|
43
39
|
createCfnLogGroup(id: string, scope: CommonConstruct, props: LogProps): cdk.aws_logs.CfnLogGroup;
|
|
44
40
|
/**
|
|
45
41
|
* @summary Method to create a cloudwatch log group
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
42
|
+
* @param id scoped id of the resource
|
|
43
|
+
* @param scope scope in which this resource is defined
|
|
44
|
+
* @param props
|
|
49
45
|
*/
|
|
50
46
|
createLogGroup(id: string, scope: CommonConstruct, props: LogProps): cdk.aws_logs.LogGroup;
|
|
51
47
|
}
|
|
@@ -28,9 +28,6 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
28
28
|
const logs = __importStar(require("aws-cdk-lib/aws-logs"));
|
|
29
29
|
const utils = __importStar(require("../../../utils"));
|
|
30
30
|
/**
|
|
31
|
-
* @stability stable
|
|
32
|
-
* @category cdk-utils.cloudwatch-manager
|
|
33
|
-
* @subcategory Construct
|
|
34
31
|
* @classdesc Provides operations on AWS CloudWatch.
|
|
35
32
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
36
33
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -44,42 +41,41 @@ const utils = __importStar(require("../../../utils"));
|
|
|
44
41
|
* this.logsManager.createMetricFilter('MyMetricFilter', this, logGroup)
|
|
45
42
|
* }
|
|
46
43
|
* }
|
|
47
|
-
*
|
|
48
44
|
* @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs-readme.html}
|
|
49
45
|
*/
|
|
50
46
|
class LogManager {
|
|
51
47
|
/**
|
|
52
48
|
* @summary Method to create a cloudwatch metric filter
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props
|
|
52
|
+
* @param logGroup
|
|
57
53
|
*/
|
|
58
54
|
createMetricFilter(id, scope, props, logGroup) {
|
|
59
55
|
if (!props)
|
|
60
56
|
throw `MetricFilter props undefined for ${id}`;
|
|
61
57
|
const metricFilter = new logs.MetricFilter(scope, `${id}`, {
|
|
58
|
+
defaultValue: props.defaultValue,
|
|
59
|
+
filterPattern: props.filterPattern,
|
|
62
60
|
logGroup: logGroup,
|
|
63
61
|
metricName: props.metricName,
|
|
64
62
|
metricNamespace: props.metricNamespace,
|
|
65
63
|
metricValue: props.metricValue,
|
|
66
|
-
defaultValue: props.defaultValue,
|
|
67
|
-
filterPattern: props.filterPattern,
|
|
68
64
|
});
|
|
69
65
|
const metric = props.options
|
|
70
66
|
? metricFilter.metric({
|
|
71
67
|
dimensionsMap: props.options.dimensionsMap,
|
|
72
|
-
statistic: props.options.statistic,
|
|
73
68
|
period: props.periodInSecs ? cdk.Duration.seconds(props.periodInSecs) : cdk.Duration.minutes(5),
|
|
69
|
+
statistic: props.options.statistic,
|
|
74
70
|
})
|
|
75
71
|
: metricFilter.metric();
|
|
76
|
-
return {
|
|
72
|
+
return { metric, metricFilter };
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
75
|
* @summary Method to create a cloudwatch log group (cfn)
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
76
|
+
* @param id scoped id of the resource
|
|
77
|
+
* @param scope scope in which this resource is defined
|
|
78
|
+
* @param props
|
|
83
79
|
*/
|
|
84
80
|
createCfnLogGroup(id, scope, props) {
|
|
85
81
|
if (!props)
|
|
@@ -99,9 +95,9 @@ class LogManager {
|
|
|
99
95
|
}
|
|
100
96
|
/**
|
|
101
97
|
* @summary Method to create a cloudwatch log group
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
98
|
+
* @param id scoped id of the resource
|
|
99
|
+
* @param scope scope in which this resource is defined
|
|
100
|
+
* @param props
|
|
105
101
|
*/
|
|
106
102
|
createLogGroup(id, scope, props) {
|
|
107
103
|
if (!props)
|
|
@@ -109,8 +105,8 @@ class LogManager {
|
|
|
109
105
|
const logGroup = new logs.LogGroup(scope, `${id}`, {
|
|
110
106
|
...props,
|
|
111
107
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
112
|
-
retention: props.retention,
|
|
113
108
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
109
|
+
retention: props.retention,
|
|
114
110
|
});
|
|
115
111
|
if (props.tags && props.tags.length > 0) {
|
|
116
112
|
props.tags.forEach(tag => {
|