@gradientedge/cdk-utils 8.91.0 → 8.92.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 +0 -18
- 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 +0 -18
- 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 +1 -19
- 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 +1 -19
- 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
|
@@ -14,9 +14,6 @@ import { CloudfrontFunctionProps, CloudFrontProps, DistributionProps } from './t
|
|
|
14
14
|
import { LambdaEdgeProps } from '../lambda'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @stability stable
|
|
18
|
-
* @category cdk-utils.cloudfront-manager
|
|
19
|
-
* @subcategory Construct
|
|
20
17
|
* @classdesc Provides operations on AWS CloudFront.
|
|
21
18
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
22
19
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -37,7 +34,6 @@ import { LambdaEdgeProps } from '../lambda'
|
|
|
37
34
|
* )
|
|
38
35
|
* }
|
|
39
36
|
* }
|
|
40
|
-
*
|
|
41
37
|
* @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
|
|
42
38
|
*/
|
|
43
39
|
export class CloudFrontManager {
|
|
@@ -52,14 +48,14 @@ export class CloudFrontManager {
|
|
|
52
48
|
|
|
53
49
|
/**
|
|
54
50
|
* @summary Method to create a cloudfront distribution
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
51
|
+
* @param id scoped id of the resource
|
|
52
|
+
* @param scope scope in which this resource is defined
|
|
53
|
+
* @param props distribution properties
|
|
54
|
+
* @param siteBucket
|
|
55
|
+
* @param logBucket
|
|
56
|
+
* @param oai
|
|
57
|
+
* @param certificate
|
|
58
|
+
* @param aliases
|
|
63
59
|
*/
|
|
64
60
|
public createCloudFrontDistribution(
|
|
65
61
|
id: string,
|
|
@@ -78,8 +74,8 @@ export class CloudFrontManager {
|
|
|
78
74
|
const distribution = new cloudfront.CloudFrontWebDistribution(scope, `${id}`, {
|
|
79
75
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
80
76
|
defaultRootObject: props.defaultRootObject,
|
|
81
|
-
enabled: props.enabled ?? true,
|
|
82
77
|
enableIpV6: props.enableIpV6,
|
|
78
|
+
enabled: props.enabled ?? true,
|
|
83
79
|
errorConfigurations: props.errorConfigurations,
|
|
84
80
|
geoRestriction: props.geoRestriction,
|
|
85
81
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
@@ -89,11 +85,11 @@ export class CloudFrontManager {
|
|
|
89
85
|
},
|
|
90
86
|
originConfigs: [
|
|
91
87
|
{
|
|
88
|
+
behaviors: [{ isDefaultBehavior: true }],
|
|
92
89
|
s3OriginSource: {
|
|
93
|
-
s3BucketSource: siteBucket,
|
|
94
90
|
originAccessIdentity: oai,
|
|
91
|
+
s3BucketSource: siteBucket,
|
|
95
92
|
},
|
|
96
|
-
behaviors: [{ isDefaultBehavior: true }],
|
|
97
93
|
},
|
|
98
94
|
],
|
|
99
95
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
@@ -119,16 +115,16 @@ export class CloudFrontManager {
|
|
|
119
115
|
|
|
120
116
|
/**
|
|
121
117
|
* Method to create a CloudFront distribution with S3 Origin
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
118
|
+
* @param id scoped id of the resource
|
|
119
|
+
* @param scope scope in which this resource is defined
|
|
120
|
+
* @param props distribution properties
|
|
121
|
+
* @param origin
|
|
122
|
+
* @param siteBucket
|
|
123
|
+
* @param logBucket
|
|
124
|
+
* @param oai
|
|
125
|
+
* @param certificate
|
|
126
|
+
* @param aliases
|
|
127
|
+
* @param defaultFunctionAssociations
|
|
132
128
|
*/
|
|
133
129
|
public createDistributionWithS3Origin(
|
|
134
130
|
id: string,
|
|
@@ -143,28 +139,28 @@ export class CloudFrontManager {
|
|
|
143
139
|
defaultFunctionAssociations?: cloudfront.FunctionAssociation[]
|
|
144
140
|
) {
|
|
145
141
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
142
|
+
additionalBehaviors: props.additionalBehaviors,
|
|
146
143
|
certificate: certificate,
|
|
147
144
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
148
145
|
defaultBehavior: {
|
|
149
146
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
147
|
+
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
148
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
150
149
|
origin: origin,
|
|
151
150
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
152
|
-
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
153
151
|
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
154
|
-
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
155
152
|
},
|
|
156
|
-
additionalBehaviors: props.additionalBehaviors,
|
|
157
153
|
defaultRootObject: props.defaultRootObject,
|
|
158
154
|
domainNames: aliases,
|
|
159
|
-
enabled: props.enabled ?? true,
|
|
160
155
|
enableIpv6: props.enableIpv6,
|
|
161
156
|
enableLogging: props.enableLogging ?? true,
|
|
157
|
+
enabled: props.enabled ?? true,
|
|
162
158
|
errorResponses: props.errorResponses,
|
|
163
159
|
geoRestriction: props.geoRestriction,
|
|
164
160
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
165
161
|
logBucket: logBucket,
|
|
166
|
-
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
167
162
|
logFilePrefix: props.logFilePrefix ?? `edge/`,
|
|
163
|
+
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
168
164
|
minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
169
165
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
170
166
|
webAclId: props.webAclId,
|
|
@@ -184,15 +180,15 @@ export class CloudFrontManager {
|
|
|
184
180
|
|
|
185
181
|
/**
|
|
186
182
|
* Method to create a CloudFront distribution with HTTP Origin
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
194
|
-
* @param
|
|
195
|
-
* @param
|
|
183
|
+
* @param id scoped id of the resource
|
|
184
|
+
* @param scope scope in which this resource is defined
|
|
185
|
+
* @param props distribution properties
|
|
186
|
+
* @param origin
|
|
187
|
+
* @param domainNames
|
|
188
|
+
* @param logBucket
|
|
189
|
+
* @param certificate
|
|
190
|
+
* @param defaultFunctionAssociations
|
|
191
|
+
* @param responseHeadersPolicy
|
|
196
192
|
*/
|
|
197
193
|
public createDistributionWithHttpOrigin(
|
|
198
194
|
id: string,
|
|
@@ -206,29 +202,29 @@ export class CloudFrontManager {
|
|
|
206
202
|
responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy
|
|
207
203
|
) {
|
|
208
204
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
205
|
+
additionalBehaviors: props.additionalBehaviors,
|
|
209
206
|
certificate: certificate,
|
|
210
207
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
211
208
|
defaultBehavior: {
|
|
212
209
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
210
|
+
edgeLambdas: props.defaultBehavior ? props.defaultBehavior.edgeLambdas : undefined,
|
|
211
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
213
212
|
origin: origin,
|
|
214
213
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
215
|
-
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
216
|
-
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
217
214
|
responseHeadersPolicy: responseHeadersPolicy ?? undefined,
|
|
218
|
-
|
|
215
|
+
viewerProtocolPolicy: props.defaultBehavior ? props.defaultBehavior.viewerProtocolPolicy : undefined,
|
|
219
216
|
},
|
|
220
|
-
additionalBehaviors: props.additionalBehaviors,
|
|
221
217
|
defaultRootObject: props.defaultRootObject,
|
|
222
218
|
domainNames: domainNames,
|
|
223
|
-
enabled: props.enabled ?? true,
|
|
224
219
|
enableIpv6: props.enableIpv6,
|
|
225
220
|
enableLogging: props.enableLogging ?? true,
|
|
221
|
+
enabled: props.enabled ?? true,
|
|
226
222
|
errorResponses: props.errorResponses,
|
|
227
223
|
geoRestriction: props.geoRestriction,
|
|
228
224
|
httpVersion: props.httpVersion ?? cloudfront.HttpVersion.HTTP2,
|
|
229
225
|
logBucket: logBucket,
|
|
230
|
-
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
231
226
|
logFilePrefix: props.logFilePrefix ?? `edge/`,
|
|
227
|
+
logIncludesCookies: props.logIncludesCookies ?? true,
|
|
232
228
|
minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
233
229
|
priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
|
|
234
230
|
webAclId: props.webAclId,
|
|
@@ -248,18 +244,17 @@ export class CloudFrontManager {
|
|
|
248
244
|
|
|
249
245
|
/**
|
|
250
246
|
* @summary Method to provision a Lambda@Edge function
|
|
251
|
-
*
|
|
252
|
-
* @param
|
|
253
|
-
* @param
|
|
254
|
-
* @param
|
|
255
|
-
* @param
|
|
256
|
-
* @param
|
|
257
|
-
* @param
|
|
258
|
-
* @param
|
|
259
|
-
* @param
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
262
|
-
* @param {string} mountPath
|
|
247
|
+
* @param id scoped id of the resource
|
|
248
|
+
* @param scope scope in which this resource is defined
|
|
249
|
+
* @param props lambda@edge properties
|
|
250
|
+
* @param layers
|
|
251
|
+
* @param code
|
|
252
|
+
* @param role
|
|
253
|
+
* @param environment
|
|
254
|
+
* @param vpc
|
|
255
|
+
* @param securityGroups
|
|
256
|
+
* @param accessPoint
|
|
257
|
+
* @param mountPath
|
|
263
258
|
*/
|
|
264
259
|
public createEdgeFunction(
|
|
265
260
|
id: string,
|
|
@@ -327,7 +322,6 @@ export class CloudFrontManager {
|
|
|
327
322
|
) {
|
|
328
323
|
new cr.AwsCustomResource(scope, `${id}-trigger-codebuild-${new Date().getTime()}`, {
|
|
329
324
|
onCreate: {
|
|
330
|
-
service: 'CodeBuild',
|
|
331
325
|
action: 'startBuild',
|
|
332
326
|
parameters: {
|
|
333
327
|
projectName: scope.codeBuildManager.createProjectForCloudfrontInvalidation(
|
|
@@ -339,6 +333,7 @@ export class CloudFrontManager {
|
|
|
339
333
|
).projectName,
|
|
340
334
|
},
|
|
341
335
|
physicalResourceId: cr.PhysicalResourceId.fromResponse('build.id'),
|
|
336
|
+
service: 'CodeBuild',
|
|
342
337
|
},
|
|
343
338
|
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE }),
|
|
344
339
|
})
|
|
@@ -346,10 +341,9 @@ export class CloudFrontManager {
|
|
|
346
341
|
|
|
347
342
|
/**
|
|
348
343
|
* @summary Method to provision a Cloudfront function
|
|
349
|
-
*
|
|
350
|
-
* @param
|
|
351
|
-
* @param
|
|
352
|
-
* @param {CloudfrontFunctionProps} props
|
|
344
|
+
* @param id scoped id of the resource
|
|
345
|
+
* @param scope scope in which this resource is defined
|
|
346
|
+
* @param props
|
|
353
347
|
*/
|
|
354
348
|
public createCloudfrontFunction(id: string, scope: CommonConstruct, props: CloudfrontFunctionProps) {
|
|
355
349
|
const cloudfrontFunction = new cloudfront.Function(scope, `${id}`, {
|
|
@@ -3,26 +3,20 @@ import * as cf from 'aws-cdk-lib/aws-cloudfront'
|
|
|
3
3
|
import { CloudFrontWebDistributionProps, FunctionProps } from 'aws-cdk-lib/aws-cloudfront'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @category cdk-utils.cloudfront-manager
|
|
7
|
-
* @subcategory Properties
|
|
8
6
|
*/
|
|
9
7
|
export interface CloudFrontProps extends CloudFrontWebDistributionProps {
|
|
10
8
|
tags?: TagProps[]
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
* @category cdk-utils.cloudfront-manager
|
|
15
|
-
* @subcategory Properties
|
|
16
12
|
*/
|
|
17
13
|
export interface DistributionProps extends cf.DistributionProps {
|
|
18
14
|
tags?: TagProps[]
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
/**
|
|
22
|
-
* @category cdk-utils.cloudfront-manager
|
|
23
|
-
* @subcategory Properties
|
|
24
18
|
*/
|
|
25
19
|
export interface CloudfrontFunctionProps extends FunctionProps {
|
|
26
|
-
functionFilePath: string
|
|
27
20
|
eventType: string
|
|
21
|
+
functionFilePath: string
|
|
28
22
|
}
|
|
@@ -6,9 +6,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
6
6
|
import { CloudTrailProps } from './types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @stability stable
|
|
10
|
-
* @category cdk-utils.cloudtrail-manager
|
|
11
|
-
* @subcategory Construct
|
|
12
9
|
* @classdesc Provides operations on AWS CloudTrail.
|
|
13
10
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
14
11
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -29,19 +26,18 @@ import { CloudTrailProps } from './types'
|
|
|
29
26
|
* )
|
|
30
27
|
* }
|
|
31
28
|
* }
|
|
32
|
-
*
|
|
33
29
|
* @see [CDK CloudTrail Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html}
|
|
34
30
|
*/
|
|
35
31
|
export class CloudTrailManager {
|
|
36
32
|
/**
|
|
37
33
|
* @summary Method to create a cloud trail
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
34
|
+
* @param id scoped id of the resource
|
|
35
|
+
* @param scope scope in which this resource is defined
|
|
36
|
+
* @param props
|
|
37
|
+
* @param logGroup
|
|
38
|
+
* @param dataBucket
|
|
39
|
+
* @param logBucket
|
|
40
|
+
* @param logBucketPolicy
|
|
45
41
|
*/
|
|
46
42
|
public createCloudTrail(
|
|
47
43
|
id: string,
|
|
@@ -88,6 +84,6 @@ export class CloudTrailManager {
|
|
|
88
84
|
utils.createCfnOutput(`${id}-trailName`, scope, cloudTrail.trailName)
|
|
89
85
|
utils.createCfnOutput(`${id}-trailArn`, scope, cloudTrail.attrArn)
|
|
90
86
|
|
|
91
|
-
return { cloudTrailRole: role
|
|
87
|
+
return { cloudTrail, cloudTrailRole: role }
|
|
92
88
|
}
|
|
93
89
|
}
|
|
@@ -5,9 +5,6 @@ import { CommonConstruct } from '../../../common'
|
|
|
5
5
|
import { LogProps, MetricFilterProps } from './types'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @stability stable
|
|
9
|
-
* @category cdk-utils.cloudwatch-manager
|
|
10
|
-
* @subcategory Construct
|
|
11
8
|
* @classdesc Provides operations on AWS CloudWatch.
|
|
12
9
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
13
10
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -21,45 +18,44 @@ import { LogProps, MetricFilterProps } from './types'
|
|
|
21
18
|
* this.logsManager.createMetricFilter('MyMetricFilter', this, logGroup)
|
|
22
19
|
* }
|
|
23
20
|
* }
|
|
24
|
-
*
|
|
25
21
|
* @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs-readme.html}
|
|
26
22
|
*/
|
|
27
23
|
export class LogManager {
|
|
28
24
|
/**
|
|
29
25
|
* @summary Method to create a cloudwatch metric filter
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props
|
|
29
|
+
* @param logGroup
|
|
34
30
|
*/
|
|
35
31
|
public createMetricFilter(id: string, scope: CommonConstruct, props: MetricFilterProps, logGroup: logs.ILogGroup) {
|
|
36
32
|
if (!props) throw `MetricFilter props undefined for ${id}`
|
|
37
33
|
|
|
38
34
|
const metricFilter = new logs.MetricFilter(scope, `${id}`, {
|
|
35
|
+
defaultValue: props.defaultValue,
|
|
36
|
+
filterPattern: props.filterPattern,
|
|
39
37
|
logGroup: logGroup,
|
|
40
38
|
metricName: props.metricName,
|
|
41
39
|
metricNamespace: props.metricNamespace,
|
|
42
40
|
metricValue: props.metricValue,
|
|
43
|
-
defaultValue: props.defaultValue,
|
|
44
|
-
filterPattern: props.filterPattern,
|
|
45
41
|
})
|
|
46
42
|
|
|
47
43
|
const metric = props.options
|
|
48
44
|
? metricFilter.metric({
|
|
49
45
|
dimensionsMap: props.options.dimensionsMap,
|
|
50
|
-
statistic: props.options.statistic,
|
|
51
46
|
period: props.periodInSecs ? cdk.Duration.seconds(props.periodInSecs) : cdk.Duration.minutes(5),
|
|
47
|
+
statistic: props.options.statistic,
|
|
52
48
|
})
|
|
53
49
|
: metricFilter.metric()
|
|
54
50
|
|
|
55
|
-
return {
|
|
51
|
+
return { metric, metricFilter }
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
/**
|
|
59
55
|
* @summary Method to create a cloudwatch log group (cfn)
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
56
|
+
* @param id scoped id of the resource
|
|
57
|
+
* @param scope scope in which this resource is defined
|
|
58
|
+
* @param props
|
|
63
59
|
*/
|
|
64
60
|
public createCfnLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
|
|
65
61
|
if (!props) throw `Logs props undefined for ${id}`
|
|
@@ -83,9 +79,9 @@ export class LogManager {
|
|
|
83
79
|
|
|
84
80
|
/**
|
|
85
81
|
* @summary Method to create a cloudwatch log group
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
* @param
|
|
82
|
+
* @param id scoped id of the resource
|
|
83
|
+
* @param scope scope in which this resource is defined
|
|
84
|
+
* @param props
|
|
89
85
|
*/
|
|
90
86
|
public createLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
|
|
91
87
|
if (!props) throw `Logs props undefined for ${id}`
|
|
@@ -93,8 +89,8 @@ export class LogManager {
|
|
|
93
89
|
const logGroup = new logs.LogGroup(scope, `${id}`, {
|
|
94
90
|
...props,
|
|
95
91
|
logGroupName: `${props.logGroupName}-${scope.props.stage}`,
|
|
96
|
-
retention: props.retention,
|
|
97
92
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
93
|
+
retention: props.retention,
|
|
98
94
|
})
|
|
99
95
|
|
|
100
96
|
if (props.tags && props.tags.length > 0) {
|