@gradientedge/cdk-utils 4.1.2 → 4.2.3
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/dist/index.d.ts +3 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -25
- package/dist/index.js.map +1 -1
- package/dist/src/lib/common/commonConstruct.d.ts +25 -45
- package/dist/src/lib/common/commonConstruct.d.ts.map +1 -1
- package/dist/src/lib/common/commonConstruct.js +48 -49
- package/dist/src/lib/common/commonConstruct.js.map +1 -1
- package/dist/src/lib/common/commonStack.d.ts +1 -1
- package/dist/src/lib/common/commonStack.d.ts.map +1 -1
- package/dist/src/lib/common/commonStack.js.map +1 -1
- package/dist/src/lib/common/index.d.ts +3 -0
- package/dist/src/lib/common/index.d.ts.map +1 -0
- package/dist/src/lib/common/index.js +15 -0
- package/dist/src/lib/common/index.js.map +1 -0
- package/dist/src/lib/construct/graphQLApiLambda.d.ts +5 -5
- package/dist/src/lib/construct/graphQLApiLambda.d.ts.map +1 -1
- package/dist/src/lib/construct/graphQLApiLambda.js +2 -2
- package/dist/src/lib/construct/graphQLApiLambda.js.map +1 -1
- package/dist/src/lib/construct/index.d.ts +4 -0
- package/dist/src/lib/construct/index.d.ts.map +1 -0
- package/dist/src/lib/construct/index.js +16 -0
- package/dist/src/lib/construct/index.js.map +1 -0
- package/dist/src/lib/construct/siteWithEcsBackend.d.ts +20 -8
- package/dist/src/lib/construct/siteWithEcsBackend.d.ts.map +1 -1
- package/dist/src/lib/construct/siteWithEcsBackend.js +32 -5
- package/dist/src/lib/construct/siteWithEcsBackend.js.map +1 -1
- package/dist/src/lib/construct/staticSite.d.ts +17 -5
- package/dist/src/lib/construct/staticSite.d.ts.map +1 -1
- package/dist/src/lib/construct/staticSite.js +30 -2
- package/dist/src/lib/construct/staticSite.js.map +1 -1
- package/dist/src/lib/manager/{acmManager.d.ts → aws/acmManager.d.ts} +7 -7
- package/dist/src/lib/manager/aws/acmManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{acmManager.js → aws/acmManager.js} +7 -7
- package/dist/src/lib/manager/aws/acmManager.js.map +1 -0
- package/dist/src/lib/manager/{apiManager.d.ts → aws/apiManager.d.ts} +10 -10
- package/dist/src/lib/manager/aws/apiManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{apiManager.js → aws/apiManager.js} +12 -14
- package/dist/src/lib/manager/aws/apiManager.js.map +1 -0
- package/dist/src/lib/manager/{appConfigManager.d.ts → aws/appConfigManager.d.ts} +16 -16
- package/dist/src/lib/manager/aws/appConfigManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{appConfigManager.js → aws/appConfigManager.js} +18 -18
- package/dist/src/lib/manager/aws/appConfigManager.js.map +1 -0
- package/dist/src/lib/manager/aws/cloudFrontManager.d.ts +112 -0
- package/dist/src/lib/manager/aws/cloudFrontManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{cloudFrontManager.js → aws/cloudFrontManager.js} +47 -24
- package/dist/src/lib/manager/aws/cloudFrontManager.js.map +1 -0
- package/dist/src/lib/manager/{cloudTrailManager.d.ts → aws/cloudTrailManager.d.ts} +8 -8
- package/dist/src/lib/manager/aws/cloudTrailManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{cloudTrailManager.js → aws/cloudTrailManager.js} +8 -8
- package/dist/src/lib/manager/aws/cloudTrailManager.js.map +1 -0
- package/dist/src/lib/manager/aws/cloudWatchManager.d.ts +121 -0
- package/dist/src/lib/manager/aws/cloudWatchManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{cloudWatchManager.js → aws/cloudWatchManager.js} +46 -35
- package/dist/src/lib/manager/aws/cloudWatchManager.js.map +1 -0
- package/dist/src/lib/manager/{codeBuildManager.d.ts → aws/codeBuildManager.d.ts} +7 -8
- package/dist/src/lib/manager/aws/codeBuildManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{codeBuildManager.js → aws/codeBuildManager.js} +5 -5
- package/dist/src/lib/manager/aws/codeBuildManager.js.map +1 -0
- package/dist/src/lib/manager/{ecrManager.d.ts → aws/ecrManager.d.ts} +6 -6
- package/dist/src/lib/manager/aws/ecrManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ecrManager.js → aws/ecrManager.js} +6 -6
- package/dist/src/lib/manager/aws/ecrManager.js.map +1 -0
- package/dist/src/lib/manager/{ecsManager.d.ts → aws/ecsManager.d.ts} +11 -11
- package/dist/src/lib/manager/aws/ecsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ecsManager.js → aws/ecsManager.js} +11 -11
- package/dist/src/lib/manager/aws/ecsManager.js.map +1 -0
- package/dist/src/lib/manager/{eksManager.d.ts → aws/eksManager.d.ts} +8 -8
- package/dist/src/lib/manager/aws/eksManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{eksManager.js → aws/eksManager.js} +8 -8
- package/dist/src/lib/manager/aws/eksManager.js.map +1 -0
- package/dist/src/lib/manager/{eventManager.d.ts → aws/eventManager.d.ts} +11 -11
- package/dist/src/lib/manager/aws/eventManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{eventManager.js → aws/eventManager.js} +12 -12
- package/dist/src/lib/manager/aws/eventManager.js.map +1 -0
- package/dist/src/lib/manager/aws/iamManager.d.ts +156 -0
- package/dist/src/lib/manager/aws/iamManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{iamManager.js → aws/iamManager.js} +35 -34
- package/dist/src/lib/manager/aws/iamManager.js.map +1 -0
- package/dist/src/lib/manager/aws/index.d.ts +22 -0
- package/dist/src/lib/manager/aws/index.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/index.js +34 -0
- package/dist/src/lib/manager/aws/index.js.map +1 -0
- package/dist/src/lib/manager/{lambdaManager.d.ts → aws/lambdaManager.d.ts} +19 -19
- package/dist/src/lib/manager/aws/lambdaManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{lambdaManager.js → aws/lambdaManager.js} +19 -19
- package/dist/src/lib/manager/aws/lambdaManager.js.map +1 -0
- package/dist/src/lib/manager/{logManager.d.ts → aws/logManager.d.ts} +14 -14
- package/dist/src/lib/manager/aws/logManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{logManager.js → aws/logManager.js} +12 -12
- package/dist/src/lib/manager/aws/logManager.js.map +1 -0
- package/dist/src/lib/manager/{route53Manager.d.ts → aws/route53Manager.d.ts} +16 -16
- package/dist/src/lib/manager/aws/route53Manager.d.ts.map +1 -0
- package/dist/src/lib/manager/{route53Manager.js → aws/route53Manager.js} +17 -17
- package/dist/src/lib/manager/aws/route53Manager.js.map +1 -0
- package/dist/src/lib/manager/aws/s3Manager.d.ts +73 -0
- package/dist/src/lib/manager/aws/s3Manager.d.ts.map +1 -0
- package/dist/src/lib/manager/{s3Manager.js → aws/s3Manager.js} +15 -15
- package/dist/src/lib/manager/aws/s3Manager.js.map +1 -0
- package/dist/src/lib/manager/{secretsManager.d.ts → aws/secretsManager.d.ts} +5 -5
- package/dist/src/lib/manager/aws/secretsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{secretsManager.js → aws/secretsManager.js} +3 -3
- package/dist/src/lib/manager/aws/secretsManager.js.map +1 -0
- package/dist/src/lib/manager/{snsManager.d.ts → aws/snsManager.d.ts} +11 -11
- package/dist/src/lib/manager/aws/snsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{snsManager.js → aws/snsManager.js} +12 -12
- package/dist/src/lib/manager/aws/snsManager.js.map +1 -0
- package/dist/src/lib/manager/{ssmManager.d.ts → aws/ssmManager.d.ts} +16 -16
- package/dist/src/lib/manager/aws/ssmManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ssmManager.js → aws/ssmManager.js} +13 -13
- package/dist/src/lib/manager/aws/ssmManager.js.map +1 -0
- package/dist/src/lib/manager/{vpcManager.d.ts → aws/vpcManager.d.ts} +10 -10
- package/dist/src/lib/manager/aws/vpcManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{vpcManager.js → aws/vpcManager.js} +13 -13
- package/dist/src/lib/manager/aws/vpcManager.js.map +1 -0
- package/dist/src/lib/manager/aws/wafManager.d.ts +39 -0
- package/dist/src/lib/manager/aws/wafManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{wafManager.js → aws/wafManager.js} +12 -12
- package/dist/src/lib/manager/aws/wafManager.js.map +1 -0
- package/dist/src/lib/manager/index.d.ts +2 -0
- package/dist/src/lib/manager/index.d.ts.map +1 -0
- package/dist/src/lib/manager/index.js +14 -0
- package/dist/src/lib/manager/index.js.map +1 -0
- package/dist/src/lib/{types.d.ts → types/aws/index.d.ts} +27 -16
- package/dist/src/lib/types/aws/index.d.ts.map +1 -0
- package/dist/src/lib/{types.js → types/aws/index.js} +1 -1
- package/dist/src/lib/types/aws/index.js.map +1 -0
- package/dist/src/lib/types/index.d.ts +2 -0
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/index.js +14 -0
- package/dist/src/lib/types/index.js.map +1 -0
- package/dist/src/lib/utils/aws/index.d.ts +16 -0
- package/dist/src/lib/utils/aws/index.d.ts.map +1 -0
- package/dist/src/lib/utils/aws/index.js +50 -0
- package/dist/src/lib/utils/aws/index.js.map +1 -0
- package/dist/src/lib/{utils.d.ts → utils/index.d.ts} +2 -26
- package/dist/src/lib/utils/index.d.ts.map +1 -0
- package/dist/src/lib/utils/index.js +85 -0
- package/dist/src/lib/utils/index.js.map +1 -0
- package/index.ts +3 -25
- package/package.json +26 -16
- package/src/lib/common/commonConstruct.ts +53 -73
- package/src/lib/common/commonStack.ts +1 -1
- package/src/lib/common/index.ts +2 -0
- package/src/lib/construct/graphQLApiLambda.ts +5 -5
- package/src/lib/construct/index.ts +3 -0
- package/src/lib/construct/siteWithEcsBackend.ts +44 -10
- package/src/lib/construct/staticSite.ts +40 -6
- package/src/lib/manager/{acmManager.ts → aws/acmManager.ts} +11 -11
- package/src/lib/manager/{apiManager.ts → aws/apiManager.ts} +16 -18
- package/src/lib/manager/{appConfigManager.ts → aws/appConfigManager.ts} +30 -26
- package/src/lib/manager/{cloudFrontManager.ts → aws/cloudFrontManager.ts} +67 -39
- package/src/lib/manager/{cloudTrailManager.ts → aws/cloudTrailManager.ts} +12 -12
- package/src/lib/manager/{cloudWatchManager.ts → aws/cloudWatchManager.ts} +78 -56
- package/src/lib/manager/{codeBuildManager.ts → aws/codeBuildManager.ts} +8 -8
- package/src/lib/manager/{ecrManager.ts → aws/ecrManager.ts} +8 -8
- package/src/lib/manager/{ecsManager.ts → aws/ecsManager.ts} +16 -16
- package/src/lib/manager/{eksManager.ts → aws/eksManager.ts} +12 -12
- package/src/lib/manager/{eventManager.ts → aws/eventManager.ts} +18 -18
- package/src/lib/manager/{iamManager.ts → aws/iamManager.ts} +65 -54
- package/src/lib/manager/aws/index.ts +21 -0
- package/src/lib/manager/{lambdaManager.ts → aws/lambdaManager.ts} +29 -29
- package/src/lib/manager/{logManager.ts → aws/logManager.ts} +22 -17
- package/src/lib/manager/{route53Manager.ts → aws/route53Manager.ts} +24 -24
- package/src/lib/manager/{s3Manager.ts → aws/s3Manager.ts} +24 -24
- package/src/lib/manager/{secretsManager.ts → aws/secretsManager.ts} +10 -5
- package/src/lib/manager/{snsManager.ts → aws/snsManager.ts} +18 -18
- package/src/lib/manager/{ssmManager.ts → aws/ssmManager.ts} +24 -19
- package/src/lib/manager/{vpcManager.ts → aws/vpcManager.ts} +17 -17
- package/src/lib/manager/{wafManager.ts → aws/wafManager.ts} +16 -16
- package/src/lib/manager/index.ts +1 -0
- package/src/lib/{types.ts → types/aws/index.ts} +27 -15
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/aws/index.ts +34 -0
- package/src/lib/{utils.ts → utils/index.ts} +1 -45
- package/dist/src/lib/manager/acmManager.d.ts.map +0 -1
- package/dist/src/lib/manager/acmManager.js.map +0 -1
- package/dist/src/lib/manager/apiManager.d.ts.map +0 -1
- package/dist/src/lib/manager/apiManager.js.map +0 -1
- package/dist/src/lib/manager/appConfigManager.d.ts.map +0 -1
- package/dist/src/lib/manager/appConfigManager.js.map +0 -1
- package/dist/src/lib/manager/cloudFrontManager.d.ts +0 -101
- package/dist/src/lib/manager/cloudFrontManager.d.ts.map +0 -1
- package/dist/src/lib/manager/cloudFrontManager.js.map +0 -1
- package/dist/src/lib/manager/cloudTrailManager.d.ts.map +0 -1
- package/dist/src/lib/manager/cloudTrailManager.js.map +0 -1
- package/dist/src/lib/manager/cloudWatchManager.d.ts +0 -121
- package/dist/src/lib/manager/cloudWatchManager.d.ts.map +0 -1
- package/dist/src/lib/manager/cloudWatchManager.js.map +0 -1
- package/dist/src/lib/manager/codeBuildManager.d.ts.map +0 -1
- package/dist/src/lib/manager/codeBuildManager.js.map +0 -1
- package/dist/src/lib/manager/ecrManager.d.ts.map +0 -1
- package/dist/src/lib/manager/ecrManager.js.map +0 -1
- package/dist/src/lib/manager/ecsManager.d.ts.map +0 -1
- package/dist/src/lib/manager/ecsManager.js.map +0 -1
- package/dist/src/lib/manager/eksManager.d.ts.map +0 -1
- package/dist/src/lib/manager/eksManager.js.map +0 -1
- package/dist/src/lib/manager/eventManager.d.ts.map +0 -1
- package/dist/src/lib/manager/eventManager.js.map +0 -1
- package/dist/src/lib/manager/iamManager.d.ts +0 -155
- package/dist/src/lib/manager/iamManager.d.ts.map +0 -1
- package/dist/src/lib/manager/iamManager.js.map +0 -1
- package/dist/src/lib/manager/lambdaManager.d.ts.map +0 -1
- package/dist/src/lib/manager/lambdaManager.js.map +0 -1
- package/dist/src/lib/manager/logManager.d.ts.map +0 -1
- package/dist/src/lib/manager/logManager.js.map +0 -1
- package/dist/src/lib/manager/route53Manager.d.ts.map +0 -1
- package/dist/src/lib/manager/route53Manager.js.map +0 -1
- package/dist/src/lib/manager/s3Manager.d.ts +0 -73
- package/dist/src/lib/manager/s3Manager.d.ts.map +0 -1
- package/dist/src/lib/manager/s3Manager.js.map +0 -1
- package/dist/src/lib/manager/secretsManager.d.ts.map +0 -1
- package/dist/src/lib/manager/secretsManager.js.map +0 -1
- package/dist/src/lib/manager/snsManager.d.ts.map +0 -1
- package/dist/src/lib/manager/snsManager.js.map +0 -1
- package/dist/src/lib/manager/ssmManager.d.ts.map +0 -1
- package/dist/src/lib/manager/ssmManager.js.map +0 -1
- package/dist/src/lib/manager/vpcManager.d.ts.map +0 -1
- package/dist/src/lib/manager/vpcManager.js.map +0 -1
- package/dist/src/lib/manager/wafManager.d.ts +0 -39
- package/dist/src/lib/manager/wafManager.d.ts.map +0 -1
- package/dist/src/lib/manager/wafManager.js.map +0 -1
- package/dist/src/lib/types.d.ts.map +0 -1
- package/dist/src/lib/types.js.map +0 -1
- package/dist/src/lib/utils.d.ts.map +0 -1
- package/dist/src/lib/utils.js +0 -131
- package/dist/src/lib/utils.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as appconfig from 'aws-cdk-lib/aws-appconfig'
|
|
2
1
|
import * as cdk from 'aws-cdk-lib'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import * as appconfig from 'aws-cdk-lib/aws-appconfig'
|
|
3
|
+
import * as common from '../../common'
|
|
4
|
+
import * as types from '../../types'
|
|
5
|
+
import * as utils from '../../utils'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @stability stable
|
|
@@ -35,12 +35,12 @@ export const ArnsByRegion: { [key: string]: string } = {
|
|
|
35
35
|
/**
|
|
36
36
|
* @category Management & Governance
|
|
37
37
|
* @summary Provides operations on AWS AppConfig.
|
|
38
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
39
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
38
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
39
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
40
40
|
* @example
|
|
41
41
|
* import * as common from '@gradientedge/cdk-utils'
|
|
42
42
|
*
|
|
43
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
43
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
44
44
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
45
45
|
* super(parent, id, props)
|
|
46
46
|
* this.props = props
|
|
@@ -53,20 +53,24 @@ export const ArnsByRegion: { [key: string]: string } = {
|
|
|
53
53
|
export class AppConfigManager {
|
|
54
54
|
/**
|
|
55
55
|
* Method to get static ARNs for AppConfig extensions
|
|
56
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
56
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
57
57
|
*/
|
|
58
|
-
public getArnForAppConfigExtension(scope: CommonConstruct) {
|
|
58
|
+
public getArnForAppConfigExtension(scope: common.CommonConstruct) {
|
|
59
59
|
return ArnsByRegion[scope.props.region]
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* @summary Method to create an AppConfig Application
|
|
64
64
|
* @param {string} id scoped id of the resource
|
|
65
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
66
|
-
* @param {AppConfigProps} props
|
|
65
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
66
|
+
* @param {types.AppConfigProps} props
|
|
67
67
|
* @returns {appconfig.CfnApplication}
|
|
68
68
|
*/
|
|
69
|
-
public createApplication(
|
|
69
|
+
public createApplication(
|
|
70
|
+
id: string,
|
|
71
|
+
scope: common.CommonConstruct,
|
|
72
|
+
props: types.AppConfigProps
|
|
73
|
+
): appconfig.CfnApplication {
|
|
70
74
|
if (!props) throw `AppConfig props undefined`
|
|
71
75
|
|
|
72
76
|
const application = new appconfig.CfnApplication(scope, `${id}`, {
|
|
@@ -75,8 +79,8 @@ export class AppConfigManager {
|
|
|
75
79
|
tags: props.application.tags,
|
|
76
80
|
})
|
|
77
81
|
|
|
78
|
-
createCfnOutput(`${id}-ApplicationId`, scope, cdk.Fn.ref(application.logicalId))
|
|
79
|
-
createCfnOutput(`${id}-ApplicationName`, scope, application.name)
|
|
82
|
+
utils.createCfnOutput(`${id}-ApplicationId`, scope, cdk.Fn.ref(application.logicalId))
|
|
83
|
+
utils.createCfnOutput(`${id}-ApplicationName`, scope, application.name)
|
|
80
84
|
|
|
81
85
|
return application
|
|
82
86
|
}
|
|
@@ -84,16 +88,16 @@ export class AppConfigManager {
|
|
|
84
88
|
/**
|
|
85
89
|
* @summary Method to create an AppConfig Environment for a given application
|
|
86
90
|
* @param {string} id scoped id of the resource
|
|
87
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
91
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
88
92
|
* @param {string} applicationId id of the application
|
|
89
|
-
* @param {AppConfigProps} props
|
|
93
|
+
* @param {types.AppConfigProps} props
|
|
90
94
|
* @returns {appconfig.CfnEnvironment}
|
|
91
95
|
*/
|
|
92
96
|
public createEnvironment(
|
|
93
97
|
id: string,
|
|
94
|
-
scope: CommonConstruct,
|
|
98
|
+
scope: common.CommonConstruct,
|
|
95
99
|
applicationId: string,
|
|
96
|
-
props: AppConfigProps
|
|
100
|
+
props: types.AppConfigProps
|
|
97
101
|
): appconfig.CfnEnvironment {
|
|
98
102
|
if (!props) throw `AppConfig props undefined`
|
|
99
103
|
|
|
@@ -105,8 +109,8 @@ export class AppConfigManager {
|
|
|
105
109
|
tags: props.environment.tags,
|
|
106
110
|
})
|
|
107
111
|
|
|
108
|
-
createCfnOutput(`${id}-configurationEnvironmentId`, scope, cdk.Fn.ref(environment.logicalId))
|
|
109
|
-
createCfnOutput(`${id}-configurationEnvironmentName`, scope, environment.name)
|
|
112
|
+
utils.createCfnOutput(`${id}-configurationEnvironmentId`, scope, cdk.Fn.ref(environment.logicalId))
|
|
113
|
+
utils.createCfnOutput(`${id}-configurationEnvironmentName`, scope, environment.name)
|
|
110
114
|
|
|
111
115
|
return environment
|
|
112
116
|
}
|
|
@@ -115,16 +119,16 @@ export class AppConfigManager {
|
|
|
115
119
|
* @summary Method to create an AppConfig Configuration Profile for a given application
|
|
116
120
|
* - <p>⚠ The <b>locationUri</b> is defaulted to <i>hosted</i> if undefined</p>
|
|
117
121
|
* @param {string} id scoped id of the resource
|
|
118
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
122
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
119
123
|
* @param {string} applicationId id of the application
|
|
120
|
-
* @param {AppConfigProps} props
|
|
124
|
+
* @param {types.AppConfigProps} props
|
|
121
125
|
* @returns {appconfig.CfnConfigurationProfile}
|
|
122
126
|
*/
|
|
123
127
|
public createConfigurationProfile(
|
|
124
128
|
id: string,
|
|
125
|
-
scope: CommonConstruct,
|
|
129
|
+
scope: common.CommonConstruct,
|
|
126
130
|
applicationId: string,
|
|
127
|
-
props: AppConfigProps
|
|
131
|
+
props: types.AppConfigProps
|
|
128
132
|
): appconfig.CfnConfigurationProfile {
|
|
129
133
|
if (!props) throw `AppConfig props undefined`
|
|
130
134
|
|
|
@@ -138,8 +142,8 @@ export class AppConfigManager {
|
|
|
138
142
|
validators: props.configurationProfile.validators,
|
|
139
143
|
})
|
|
140
144
|
|
|
141
|
-
createCfnOutput(`${id}-configurationProfileId`, scope, cdk.Fn.ref(profile.logicalId))
|
|
142
|
-
createCfnOutput(`${id}-configurationProfileName`, scope, profile.name)
|
|
145
|
+
utils.createCfnOutput(`${id}-configurationProfileId`, scope, cdk.Fn.ref(profile.logicalId))
|
|
146
|
+
utils.createCfnOutput(`${id}-configurationProfileName`, scope, profile.name)
|
|
143
147
|
|
|
144
148
|
return profile
|
|
145
149
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib'
|
|
1
2
|
import * as acm from 'aws-cdk-lib/aws-certificatemanager'
|
|
2
3
|
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'
|
|
3
|
-
import * as
|
|
4
|
-
import * as s3 from 'aws-cdk-lib/aws-s3'
|
|
5
|
-
import { CommonConstruct } from '../common/commonConstruct'
|
|
6
|
-
import { CloudFrontProps, DistributionProps, LambdaEdgeProps } from '../types'
|
|
7
|
-
import { createCfnOutput } from '../utils'
|
|
8
|
-
import * as cdk from 'aws-cdk-lib'
|
|
4
|
+
import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'
|
|
9
5
|
import * as ec2 from 'aws-cdk-lib/aws-ec2'
|
|
10
6
|
import * as efs from 'aws-cdk-lib/aws-efs'
|
|
11
|
-
import * as
|
|
7
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
8
|
+
import * as s3 from 'aws-cdk-lib/aws-s3'
|
|
12
9
|
import * as cr from 'aws-cdk-lib/custom-resources'
|
|
10
|
+
import * as common from '../../common'
|
|
11
|
+
import * as types from '../../types'
|
|
12
|
+
import * as utils from '../../utils'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @stability stable
|
|
16
16
|
* @category Networking & Content Delivery
|
|
17
17
|
* @summary Provides operations on AWS CloudFront.
|
|
18
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
19
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
18
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
19
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
20
20
|
* @example
|
|
21
21
|
* import * as common from '@gradientedge/cdk-utils'
|
|
22
22
|
*
|
|
23
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
23
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
24
24
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
25
25
|
* super(parent, id, props)
|
|
26
26
|
* this.props = props
|
|
@@ -38,7 +38,7 @@ import * as cr from 'aws-cdk-lib/custom-resources'
|
|
|
38
38
|
* @see [CDK CloudFront Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront-readme.html}
|
|
39
39
|
*/
|
|
40
40
|
export class CloudFrontManager {
|
|
41
|
-
public createOriginAccessIdentity(id: string, scope: CommonConstruct, accessBucket?: s3.IBucket) {
|
|
41
|
+
public createOriginAccessIdentity(id: string, scope: common.CommonConstruct, accessBucket?: s3.IBucket) {
|
|
42
42
|
const oai = new cloudfront.OriginAccessIdentity(scope, `${id}`, {
|
|
43
43
|
comment: `${id} - ${scope.props.stage} stage`,
|
|
44
44
|
})
|
|
@@ -52,8 +52,8 @@ export class CloudFrontManager {
|
|
|
52
52
|
*
|
|
53
53
|
* @summary Method to create a cloudfront distribution
|
|
54
54
|
* @param {string} id scoped id of the resource
|
|
55
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
56
|
-
* @param {CloudFrontProps} props distribution properties
|
|
55
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
56
|
+
* @param {types.CloudFrontProps} props distribution properties
|
|
57
57
|
* @param {s3.IBucket?} siteBucket
|
|
58
58
|
* @param {s3.IBucket?} logBucket
|
|
59
59
|
* @param {cloudfront.OriginAccessIdentity?} oai
|
|
@@ -62,8 +62,8 @@ export class CloudFrontManager {
|
|
|
62
62
|
*/
|
|
63
63
|
public createCloudFrontDistribution(
|
|
64
64
|
id: string,
|
|
65
|
-
scope: CommonConstruct,
|
|
66
|
-
props: CloudFrontProps,
|
|
65
|
+
scope: common.CommonConstruct,
|
|
66
|
+
props: types.CloudFrontProps,
|
|
67
67
|
siteBucket?: s3.IBucket,
|
|
68
68
|
logBucket?: s3.IBucket,
|
|
69
69
|
oai?: cloudfront.OriginAccessIdentity,
|
|
@@ -104,8 +104,8 @@ export class CloudFrontManager {
|
|
|
104
104
|
webACLId: props.webACLId,
|
|
105
105
|
})
|
|
106
106
|
|
|
107
|
-
createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
108
|
-
createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
107
|
+
utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
108
|
+
utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
109
109
|
|
|
110
110
|
return distribution
|
|
111
111
|
}
|
|
@@ -113,25 +113,27 @@ export class CloudFrontManager {
|
|
|
113
113
|
/**
|
|
114
114
|
* Method to create a CloudFront distribution with S3 Origin
|
|
115
115
|
* @param {string} id scoped id of the resource
|
|
116
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
117
|
-
* @param {
|
|
116
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
117
|
+
* @param {types.DistributionProps} props distribution properties
|
|
118
118
|
* @param {origins.S3Origin} origin
|
|
119
119
|
* @param {s3.IBucket} siteBucket
|
|
120
120
|
* @param {s3.IBucket?} logBucket
|
|
121
121
|
* @param {cloudfront.OriginAccessIdentity?} oai
|
|
122
122
|
* @param {acm.ICertificate?} certificate
|
|
123
123
|
* @param {string[]?} aliases
|
|
124
|
+
* @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
|
|
124
125
|
*/
|
|
125
126
|
public createDistributionWithS3Origin(
|
|
126
127
|
id: string,
|
|
127
|
-
scope: CommonConstruct,
|
|
128
|
-
props: DistributionProps,
|
|
128
|
+
scope: common.CommonConstruct,
|
|
129
|
+
props: types.DistributionProps,
|
|
129
130
|
origin: origins.S3Origin,
|
|
130
131
|
siteBucket: s3.IBucket,
|
|
131
132
|
logBucket?: s3.IBucket,
|
|
132
133
|
oai?: cloudfront.OriginAccessIdentity,
|
|
133
134
|
certificate?: acm.ICertificate,
|
|
134
|
-
aliases?: string[]
|
|
135
|
+
aliases?: string[],
|
|
136
|
+
defaultFunctionAssociations?: cloudfront.FunctionAssociation[]
|
|
135
137
|
) {
|
|
136
138
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
137
139
|
certificate: certificate,
|
|
@@ -140,6 +142,7 @@ export class CloudFrontManager {
|
|
|
140
142
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
141
143
|
origin: origin,
|
|
142
144
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
145
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
143
146
|
},
|
|
144
147
|
additionalBehaviors: props.additionalBehaviors,
|
|
145
148
|
defaultRootObject: props.defaultRootObject,
|
|
@@ -158,8 +161,8 @@ export class CloudFrontManager {
|
|
|
158
161
|
webAclId: props.webAclId,
|
|
159
162
|
})
|
|
160
163
|
|
|
161
|
-
createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
162
|
-
createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
164
|
+
utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
165
|
+
utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
163
166
|
|
|
164
167
|
return distribution
|
|
165
168
|
}
|
|
@@ -167,21 +170,23 @@ export class CloudFrontManager {
|
|
|
167
170
|
/**
|
|
168
171
|
* Method to create a CloudFront distribution with HTTP Origin
|
|
169
172
|
* @param {string} id scoped id of the resource
|
|
170
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
171
|
-
* @param {
|
|
173
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
174
|
+
* @param {types.DistributionProps} props distribution properties
|
|
172
175
|
* @param {origins.S3Origin} origin
|
|
173
176
|
* @param {string[]} domainNames
|
|
174
177
|
* @param {s3.IBucket?} logBucket
|
|
175
178
|
* @param {acm.ICertificate?} certificate
|
|
179
|
+
* @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
|
|
176
180
|
*/
|
|
177
181
|
public createDistributionWithHttpOrigin(
|
|
178
182
|
id: string,
|
|
179
|
-
scope: CommonConstruct,
|
|
180
|
-
props: DistributionProps,
|
|
183
|
+
scope: common.CommonConstruct,
|
|
184
|
+
props: types.DistributionProps,
|
|
181
185
|
origin: origins.HttpOrigin,
|
|
182
186
|
domainNames: string[],
|
|
183
187
|
logBucket?: s3.IBucket,
|
|
184
|
-
certificate?: acm.ICertificate
|
|
188
|
+
certificate?: acm.ICertificate,
|
|
189
|
+
defaultFunctionAssociations?: cloudfront.FunctionAssociation[]
|
|
185
190
|
) {
|
|
186
191
|
const distribution = new cloudfront.Distribution(scope, `${id}`, {
|
|
187
192
|
certificate: certificate,
|
|
@@ -190,6 +195,7 @@ export class CloudFrontManager {
|
|
|
190
195
|
cachePolicy: props.defaultBehavior ? props.defaultBehavior.cachePolicy : undefined,
|
|
191
196
|
origin: origin,
|
|
192
197
|
originRequestPolicy: props.defaultBehavior ? props.defaultBehavior.originRequestPolicy : undefined,
|
|
198
|
+
functionAssociations: defaultFunctionAssociations ?? undefined,
|
|
193
199
|
},
|
|
194
200
|
additionalBehaviors: props.additionalBehaviors,
|
|
195
201
|
defaultRootObject: props.defaultRootObject,
|
|
@@ -208,8 +214,8 @@ export class CloudFrontManager {
|
|
|
208
214
|
webAclId: props.webAclId,
|
|
209
215
|
})
|
|
210
216
|
|
|
211
|
-
createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
212
|
-
createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
217
|
+
utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId)
|
|
218
|
+
utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName)
|
|
213
219
|
|
|
214
220
|
return distribution
|
|
215
221
|
}
|
|
@@ -218,8 +224,8 @@ export class CloudFrontManager {
|
|
|
218
224
|
* @summary Method to provision a Lambda@Edge function
|
|
219
225
|
*
|
|
220
226
|
* @param {string} id scoped id of the resource
|
|
221
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
222
|
-
* @param {LambdaEdgeProps} props lambda@edge properties
|
|
227
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
228
|
+
* @param {types.LambdaEdgeProps} props lambda@edge properties
|
|
223
229
|
* @param {lambda.ILayerVersion[]} layers
|
|
224
230
|
* @param {lambda.AssetCode} code
|
|
225
231
|
* @param {Map<string, string>} environment
|
|
@@ -230,8 +236,8 @@ export class CloudFrontManager {
|
|
|
230
236
|
*/
|
|
231
237
|
public createEdgeFunction(
|
|
232
238
|
id: string,
|
|
233
|
-
scope: CommonConstruct,
|
|
234
|
-
props: LambdaEdgeProps,
|
|
239
|
+
scope: common.CommonConstruct,
|
|
240
|
+
props: types.LambdaEdgeProps,
|
|
235
241
|
layers: lambda.ILayerVersion[],
|
|
236
242
|
code: lambda.AssetCode,
|
|
237
243
|
environment?: any,
|
|
@@ -261,9 +267,9 @@ export class CloudFrontManager {
|
|
|
261
267
|
vpc: vpc,
|
|
262
268
|
})
|
|
263
269
|
|
|
264
|
-
createCfnOutput(`${id}-edgeArn`, scope, edgeFunction.edgeArn)
|
|
265
|
-
createCfnOutput(`${id}-edgeFunctionArn`, scope, edgeFunction.functionArn)
|
|
266
|
-
createCfnOutput(`${id}-edgeFunctionName`, scope, edgeFunction.functionName)
|
|
270
|
+
utils.createCfnOutput(`${id}-edgeArn`, scope, edgeFunction.edgeArn)
|
|
271
|
+
utils.createCfnOutput(`${id}-edgeFunctionArn`, scope, edgeFunction.functionArn)
|
|
272
|
+
utils.createCfnOutput(`${id}-edgeFunctionName`, scope, edgeFunction.functionName)
|
|
267
273
|
|
|
268
274
|
return edgeFunction
|
|
269
275
|
}
|
|
@@ -278,7 +284,7 @@ export class CloudFrontManager {
|
|
|
278
284
|
*/
|
|
279
285
|
public invalidateCache(
|
|
280
286
|
id: string,
|
|
281
|
-
scope: CommonConstruct,
|
|
287
|
+
scope: common.CommonConstruct,
|
|
282
288
|
dockerFilePath: string,
|
|
283
289
|
distributionId: string,
|
|
284
290
|
paths?: string
|
|
@@ -301,4 +307,26 @@ export class CloudFrontManager {
|
|
|
301
307
|
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE }),
|
|
302
308
|
})
|
|
303
309
|
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @summary Method to provision a Cloudfront function
|
|
313
|
+
*
|
|
314
|
+
* @param {string} id scoped id of the resource
|
|
315
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
316
|
+
* @param {types.CloudfrontFunctionProps} props
|
|
317
|
+
*/
|
|
318
|
+
public createCloudfrontFunction(id: string, scope: common.CommonConstruct, props: types.CloudfrontFunctionProps) {
|
|
319
|
+
const cloudfrontFunction = new cloudfront.Function(scope, `${id}`, {
|
|
320
|
+
code: cloudfront.FunctionCode.fromFile({
|
|
321
|
+
filePath: props.functionFilePath,
|
|
322
|
+
}),
|
|
323
|
+
comment: props.comment,
|
|
324
|
+
functionName: `${props.functionName}-${scope.props.stage}`,
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
utils.createCfnOutput(`${id}-functionArn`, scope, cloudfrontFunction.functionArn)
|
|
328
|
+
utils.createCfnOutput(`${id}-functionName`, scope, cloudfrontFunction.functionName)
|
|
329
|
+
|
|
330
|
+
return cloudfrontFunction
|
|
331
|
+
}
|
|
304
332
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'
|
|
2
2
|
import * as logs from 'aws-cdk-lib/aws-logs'
|
|
3
3
|
import * as s3 from 'aws-cdk-lib/aws-s3'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import * as common from '../../common'
|
|
5
|
+
import * as types from '../../types'
|
|
6
|
+
import * as utils from '../../utils'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @stability stable
|
|
10
10
|
* @category Management & Governance
|
|
11
11
|
* @summary Provides operations on AWS CloudTrail.
|
|
12
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
13
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
12
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
13
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
14
14
|
* @example
|
|
15
15
|
* import * as common from '@gradientedge/cdk-utils'
|
|
16
16
|
*
|
|
17
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
17
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
18
18
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
19
19
|
* super(parent, id, props)
|
|
20
20
|
* this.props = props
|
|
@@ -35,8 +35,8 @@ export class CloudTrailManager {
|
|
|
35
35
|
/**
|
|
36
36
|
* @summary Method to create a cloud trail
|
|
37
37
|
* @param {string} id scoped id of the resource
|
|
38
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
39
|
-
* @param {CloudTrailProps} props
|
|
38
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
39
|
+
* @param {types.CloudTrailProps} props
|
|
40
40
|
* @param {logs.CfnLogGroup} logGroup
|
|
41
41
|
* @param {s3.IBucket} dataBucket
|
|
42
42
|
* @param {s3.IBucket} logBucket
|
|
@@ -44,8 +44,8 @@ export class CloudTrailManager {
|
|
|
44
44
|
*/
|
|
45
45
|
public createCloudTrail(
|
|
46
46
|
id: string,
|
|
47
|
-
scope: CommonConstruct,
|
|
48
|
-
props: CloudTrailProps,
|
|
47
|
+
scope: common.CommonConstruct,
|
|
48
|
+
props: types.CloudTrailProps,
|
|
49
49
|
logGroup: logs.CfnLogGroup,
|
|
50
50
|
dataBucket: s3.IBucket,
|
|
51
51
|
logBucket: s3.IBucket,
|
|
@@ -84,8 +84,8 @@ export class CloudTrailManager {
|
|
|
84
84
|
cloudTrail.addDependsOn(logGroup)
|
|
85
85
|
cloudTrail.addDependsOn(role)
|
|
86
86
|
|
|
87
|
-
createCfnOutput(`${id}-trailName`, scope, cloudTrail.trailName)
|
|
88
|
-
createCfnOutput(`${id}-trailArn`, scope, cloudTrail.attrArn)
|
|
87
|
+
utils.createCfnOutput(`${id}-trailName`, scope, cloudTrail.trailName)
|
|
88
|
+
utils.createCfnOutput(`${id}-trailArn`, scope, cloudTrail.attrArn)
|
|
89
89
|
|
|
90
90
|
return { cloudTrailRole: role, cloudTrail }
|
|
91
91
|
}
|