@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
|
@@ -2,20 +2,20 @@ import * as apig from 'aws-cdk-lib/aws-apigateway'
|
|
|
2
2
|
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'
|
|
3
3
|
import * as route53 from 'aws-cdk-lib/aws-route53'
|
|
4
4
|
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets'
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import * as common from '../../common'
|
|
6
|
+
import * as types from '../../types'
|
|
7
|
+
import * as utils from '../../utils'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @stability stable
|
|
11
11
|
* @category Networking & Content Delivery
|
|
12
12
|
* @summary Provides operations on AWS Route53.
|
|
13
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
14
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
13
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
14
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
15
15
|
* @example
|
|
16
16
|
* import * as common from '@gradientedge/cdk-utils'
|
|
17
17
|
*
|
|
18
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
18
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
19
19
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
20
20
|
* super(parent, id, props)
|
|
21
21
|
* this.props = props
|
|
@@ -29,10 +29,10 @@ export class Route53Manager {
|
|
|
29
29
|
/**
|
|
30
30
|
* @summary Method to create a hosted zone
|
|
31
31
|
* @param {string} id scoped id of the resource
|
|
32
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
33
|
-
* @param {Route53Props} props
|
|
32
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
33
|
+
* @param {types.Route53Props} props
|
|
34
34
|
*/
|
|
35
|
-
public createHostedZone(id: string, scope: CommonConstruct, props: Route53Props) {
|
|
35
|
+
public createHostedZone(id: string, scope: common.CommonConstruct, props: types.Route53Props) {
|
|
36
36
|
let hostedZone: route53.IHostedZone
|
|
37
37
|
|
|
38
38
|
if (!props) throw `Route53 props undefined`
|
|
@@ -48,8 +48,8 @@ export class Route53Manager {
|
|
|
48
48
|
})
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId)
|
|
52
|
-
createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn)
|
|
51
|
+
utils.createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId)
|
|
52
|
+
utils.createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn)
|
|
53
53
|
|
|
54
54
|
return hostedZone
|
|
55
55
|
}
|
|
@@ -57,12 +57,12 @@ export class Route53Manager {
|
|
|
57
57
|
/**
|
|
58
58
|
* @summary Method to create/lookup a hosted zone
|
|
59
59
|
* @param {string} id scoped id of the resource
|
|
60
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
60
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
61
61
|
* @param useExistingHostedZone Flag to indicate whether to lookup vs create new hosted zone
|
|
62
62
|
*/
|
|
63
63
|
public withHostedZoneFromFullyQualifiedDomainName(
|
|
64
64
|
id: string,
|
|
65
|
-
scope: CommonConstruct,
|
|
65
|
+
scope: common.CommonConstruct,
|
|
66
66
|
useExistingHostedZone: boolean
|
|
67
67
|
) {
|
|
68
68
|
let hostedZone: route53.IHostedZone
|
|
@@ -78,8 +78,8 @@ export class Route53Manager {
|
|
|
78
78
|
})
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId)
|
|
82
|
-
createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn)
|
|
81
|
+
utils.createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId)
|
|
82
|
+
utils.createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn)
|
|
83
83
|
|
|
84
84
|
return hostedZone
|
|
85
85
|
}
|
|
@@ -87,14 +87,14 @@ export class Route53Manager {
|
|
|
87
87
|
/**
|
|
88
88
|
* @summary Method to create a-record for cloudfront target
|
|
89
89
|
* @param {string} id scoped id of the resource
|
|
90
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
90
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
91
91
|
* @param {cloudfront.IDistribution} distribution
|
|
92
92
|
* @param {route53.IHostedZone} hostedZone
|
|
93
93
|
* @param {string} recordName
|
|
94
94
|
*/
|
|
95
95
|
public createCloudFrontTargetARecord(
|
|
96
96
|
id: string,
|
|
97
|
-
scope: CommonConstruct,
|
|
97
|
+
scope: common.CommonConstruct,
|
|
98
98
|
distribution?: cloudfront.IDistribution,
|
|
99
99
|
hostedZone?: route53.IHostedZone,
|
|
100
100
|
recordName?: string
|
|
@@ -108,7 +108,7 @@ export class Route53Manager {
|
|
|
108
108
|
zone: hostedZone,
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName)
|
|
111
|
+
utils.createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName)
|
|
112
112
|
|
|
113
113
|
return aRecord
|
|
114
114
|
}
|
|
@@ -116,14 +116,14 @@ export class Route53Manager {
|
|
|
116
116
|
/**
|
|
117
117
|
* @summary Method to create a-record for cloudfront target
|
|
118
118
|
* @param {string} id scoped id of the resource
|
|
119
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
119
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
120
120
|
* @param {cloudfront.IDistribution} distribution
|
|
121
121
|
* @param {route53.IHostedZone} hostedZone
|
|
122
122
|
* @param {string} recordName
|
|
123
123
|
*/
|
|
124
124
|
public createCloudFrontTargetARecordV2(
|
|
125
125
|
id: string,
|
|
126
|
-
scope: CommonConstruct,
|
|
126
|
+
scope: common.CommonConstruct,
|
|
127
127
|
distribution?: cloudfront.IDistribution,
|
|
128
128
|
hostedZone?: route53.IHostedZone,
|
|
129
129
|
recordName?: string
|
|
@@ -137,7 +137,7 @@ export class Route53Manager {
|
|
|
137
137
|
zone: hostedZone,
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
-
createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName)
|
|
140
|
+
utils.createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName)
|
|
141
141
|
|
|
142
142
|
return aRecord
|
|
143
143
|
}
|
|
@@ -145,14 +145,14 @@ export class Route53Manager {
|
|
|
145
145
|
/**
|
|
146
146
|
* @summary Method to create a-record for api gateway target
|
|
147
147
|
* @param {string} id scoped id of the resource
|
|
148
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
148
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
149
149
|
* @param recordName
|
|
150
150
|
* @param apiDomain
|
|
151
151
|
* @param hostedZone
|
|
152
152
|
*/
|
|
153
153
|
public createApiGatewayARecord(
|
|
154
154
|
id: string,
|
|
155
|
-
scope: CommonConstruct,
|
|
155
|
+
scope: common.CommonConstruct,
|
|
156
156
|
recordName: string,
|
|
157
157
|
apiDomain: apig.DomainName,
|
|
158
158
|
hostedZone: route53.IHostedZone
|
|
@@ -167,7 +167,7 @@ export class Route53Manager {
|
|
|
167
167
|
zone: hostedZone,
|
|
168
168
|
})
|
|
169
169
|
|
|
170
|
-
createCfnOutput(`${id}-a-record-domain-name`, scope, apiARecord.domainName)
|
|
170
|
+
utils.createCfnOutput(`${id}-a-record-domain-name`, scope, apiARecord.domainName)
|
|
171
171
|
|
|
172
172
|
return apiARecord
|
|
173
173
|
}
|
|
@@ -3,20 +3,20 @@ import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'
|
|
|
3
3
|
import * as iam from 'aws-cdk-lib/aws-iam'
|
|
4
4
|
import * as s3 from 'aws-cdk-lib/aws-s3'
|
|
5
5
|
import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import * as common from '../../common'
|
|
7
|
+
import * as types from '../../types'
|
|
8
|
+
import * as utils from '../../utils'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @stability stable
|
|
12
12
|
* @category Storage
|
|
13
13
|
* @summary Provides operations on AWS S3.
|
|
14
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
15
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
14
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
15
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
16
16
|
* @example
|
|
17
17
|
* import * as common from '@gradientedge/cdk-utils'
|
|
18
18
|
*
|
|
19
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
19
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
20
20
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
21
21
|
* super(parent, id, props)
|
|
22
22
|
* this.props = props
|
|
@@ -29,13 +29,13 @@ import { createCfnOutput } from '../utils'
|
|
|
29
29
|
export class S3Manager {
|
|
30
30
|
/**
|
|
31
31
|
* @summary Method to determine S3 Bucket lifecycle properties
|
|
32
|
-
* @param {S3BucketProps} props bucket properties
|
|
32
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
33
33
|
* @private
|
|
34
34
|
*/
|
|
35
|
-
protected determineBucketLifecycleRules(props: S3BucketProps) {
|
|
35
|
+
protected determineBucketLifecycleRules(props: types.S3BucketProps) {
|
|
36
36
|
if (!props.lifecycleRules) return undefined
|
|
37
37
|
|
|
38
|
-
const bucketLifecycleRules: LifecycleRule[] = []
|
|
38
|
+
const bucketLifecycleRules: types.LifecycleRule[] = []
|
|
39
39
|
props.lifecycleRules.forEach(lifecycleRule => {
|
|
40
40
|
bucketLifecycleRules.push({
|
|
41
41
|
id: lifecycleRule.id,
|
|
@@ -59,11 +59,11 @@ export class S3Manager {
|
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* @summary Method to determine the bucket name
|
|
62
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
63
|
-
* @param {S3BucketProps} props bucket properties
|
|
62
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
63
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
64
64
|
* @private
|
|
65
65
|
*/
|
|
66
|
-
protected static determineBucketName(scope: CommonConstruct, props: S3BucketProps) {
|
|
66
|
+
protected static determineBucketName(scope: common.CommonConstruct, props: types.S3BucketProps) {
|
|
67
67
|
return scope.isProductionStage()
|
|
68
68
|
? `${props.bucketName}.${scope.fullyQualifiedDomainName}`
|
|
69
69
|
: `${props.bucketName}-${scope.props.stage}.${scope.fullyQualifiedDomainName}`
|
|
@@ -71,11 +71,11 @@ export class S3Manager {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @summary Method to determine the log bucket name
|
|
74
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
75
|
-
* @param {S3BucketProps} props bucket properties
|
|
74
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
75
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
76
76
|
* @private
|
|
77
77
|
*/
|
|
78
|
-
protected static determineLogBucketName(scope: CommonConstruct, props: S3BucketProps) {
|
|
78
|
+
protected static determineLogBucketName(scope: common.CommonConstruct, props: types.S3BucketProps) {
|
|
79
79
|
return scope.isProductionStage()
|
|
80
80
|
? `${props.logBucketName}.${scope.fullyQualifiedDomainName}`
|
|
81
81
|
: `${props.logBucketName}-${scope.props.stage}.${scope.fullyQualifiedDomainName}`
|
|
@@ -84,10 +84,10 @@ export class S3Manager {
|
|
|
84
84
|
/**
|
|
85
85
|
* @summary Method to create a s3 bucket
|
|
86
86
|
* @param {string} id scoped id of the resource
|
|
87
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
88
|
-
* @param {S3BucketProps} props bucket properties
|
|
87
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
88
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
89
89
|
*/
|
|
90
|
-
public createS3Bucket(id: string, scope: CommonConstruct, props: S3BucketProps) {
|
|
90
|
+
public createS3Bucket(id: string, scope: common.CommonConstruct, props: types.S3BucketProps) {
|
|
91
91
|
if (!props) throw `S3 props undefined`
|
|
92
92
|
|
|
93
93
|
let bucket: s3.IBucket
|
|
@@ -131,8 +131,8 @@ export class S3Manager {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
createCfnOutput(`${id}-bucketName`, scope, bucket.bucketName)
|
|
135
|
-
createCfnOutput(`${id}-bucketArn`, scope, bucket.bucketArn)
|
|
134
|
+
utils.createCfnOutput(`${id}-bucketName`, scope, bucket.bucketName)
|
|
135
|
+
utils.createCfnOutput(`${id}-bucketArn`, scope, bucket.bucketArn)
|
|
136
136
|
|
|
137
137
|
return bucket
|
|
138
138
|
}
|
|
@@ -140,10 +140,10 @@ export class S3Manager {
|
|
|
140
140
|
/**
|
|
141
141
|
* @summary Method to create an iam bucket policy for cloudtrail
|
|
142
142
|
* @param {string} id scoped id of the resource
|
|
143
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
143
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
144
144
|
* @param {s3.IBucket} bucket
|
|
145
145
|
*/
|
|
146
|
-
public createBucketPolicyForCloudTrail(id: string, scope: CommonConstruct, bucket: s3.IBucket) {
|
|
146
|
+
public createBucketPolicyForCloudTrail(id: string, scope: common.CommonConstruct, bucket: s3.IBucket) {
|
|
147
147
|
const bucketPolicyDocument = new iam.PolicyDocument({
|
|
148
148
|
statements: [
|
|
149
149
|
new iam.PolicyStatement({
|
|
@@ -172,7 +172,7 @@ export class S3Manager {
|
|
|
172
172
|
/**
|
|
173
173
|
* @summary Method to create a s3 bucket deployment
|
|
174
174
|
* @param {string} id scoped id of the resource
|
|
175
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
175
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
176
176
|
* @param {s3.IBucket} siteBucket
|
|
177
177
|
* @param {cloudfront.IDistribution} distribution
|
|
178
178
|
* @param {s3deploy.ISource[]} sources
|
|
@@ -181,7 +181,7 @@ export class S3Manager {
|
|
|
181
181
|
*/
|
|
182
182
|
public doBucketDeployment(
|
|
183
183
|
id: string,
|
|
184
|
-
scope: CommonConstruct,
|
|
184
|
+
scope: common.CommonConstruct,
|
|
185
185
|
siteBucket: s3.IBucket,
|
|
186
186
|
distribution: cloudfront.IDistribution,
|
|
187
187
|
sources: s3deploy.ISource[],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CommonConstruct } from '../common/commonConstruct'
|
|
2
1
|
import * as cdk from 'aws-cdk-lib'
|
|
3
2
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
|
|
3
|
+
import * as common from '../../common'
|
|
4
4
|
|
|
5
5
|
const AWS = require('aws-sdk')
|
|
6
6
|
const fs = require('fs')
|
|
@@ -9,12 +9,12 @@ const fs = require('fs')
|
|
|
9
9
|
* @stability experimental
|
|
10
10
|
* @category Security, Identity & Compliance
|
|
11
11
|
* @summary Provides operations on AWS Secrets Manager.
|
|
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
|
|
@@ -100,7 +100,12 @@ export class SecretsManager {
|
|
|
100
100
|
* @param stackName
|
|
101
101
|
* @param exportName
|
|
102
102
|
*/
|
|
103
|
-
public retrieveSecretFromSecretsManager(
|
|
103
|
+
public retrieveSecretFromSecretsManager(
|
|
104
|
+
id: string,
|
|
105
|
+
scope: common.CommonConstruct,
|
|
106
|
+
stackName: string,
|
|
107
|
+
exportName: string
|
|
108
|
+
) {
|
|
104
109
|
return secretsManager.Secret.fromSecretNameV2(
|
|
105
110
|
scope,
|
|
106
111
|
`${id}`,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
2
2
|
import * as sns from 'aws-cdk-lib/aws-sns'
|
|
3
3
|
import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'
|
|
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 Application Integration
|
|
11
11
|
* @summary Provides operations on AWS Simple Notification Service.
|
|
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
|
|
@@ -28,14 +28,14 @@ export class SnsManager {
|
|
|
28
28
|
/**
|
|
29
29
|
* @summary Method to create an email notification service
|
|
30
30
|
* @param {string} id scoped id of the resource
|
|
31
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
32
|
-
* @param {SubscriptionProps} props
|
|
31
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
32
|
+
* @param {types.SubscriptionProps} props
|
|
33
33
|
* @param {string[]} emails
|
|
34
34
|
*/
|
|
35
35
|
public createEmailNotificationService(
|
|
36
36
|
id: string,
|
|
37
|
-
scope: CommonConstruct,
|
|
38
|
-
props: SubscriptionProps,
|
|
37
|
+
scope: common.CommonConstruct,
|
|
38
|
+
props: types.SubscriptionProps,
|
|
39
39
|
emails: string[]
|
|
40
40
|
) {
|
|
41
41
|
if (!props) throw `Subscription props undefined`
|
|
@@ -50,8 +50,8 @@ export class SnsManager {
|
|
|
50
50
|
emails.forEach((email: string) => topic.addSubscription(new subs.EmailSubscription(email)))
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
createCfnOutput(`${id}-subscriptionArn`, scope, topic.topicArn)
|
|
54
|
-
createCfnOutput(`${id}-subscriptionName`, scope, topic.topicName)
|
|
53
|
+
utils.createCfnOutput(`${id}-subscriptionArn`, scope, topic.topicArn)
|
|
54
|
+
utils.createCfnOutput(`${id}-subscriptionName`, scope, topic.topicName)
|
|
55
55
|
|
|
56
56
|
return topic
|
|
57
57
|
}
|
|
@@ -59,14 +59,14 @@ export class SnsManager {
|
|
|
59
59
|
/**
|
|
60
60
|
* @summary Method to create a lambda notification service
|
|
61
61
|
* @param {string} id scoped id of the resource
|
|
62
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
63
|
-
* @param {SubscriptionProps} props
|
|
62
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
63
|
+
* @param {types.SubscriptionProps} props
|
|
64
64
|
* @param {lambda.Function} lambdaFunction
|
|
65
65
|
*/
|
|
66
66
|
public createLambdaNotificationService(
|
|
67
67
|
id: string,
|
|
68
|
-
scope: CommonConstruct,
|
|
69
|
-
props: SubscriptionProps,
|
|
68
|
+
scope: common.CommonConstruct,
|
|
69
|
+
props: types.SubscriptionProps,
|
|
70
70
|
lambdaFunction: lambda.Function
|
|
71
71
|
) {
|
|
72
72
|
if (!props) throw `Subscription props undefined`
|
|
@@ -79,8 +79,8 @@ export class SnsManager {
|
|
|
79
79
|
|
|
80
80
|
topic.addSubscription(new subs.LambdaSubscription(lambdaFunction))
|
|
81
81
|
|
|
82
|
-
createCfnOutput(`${id}-subscriptionArn`, scope, topic.topicArn)
|
|
83
|
-
createCfnOutput(`${id}-subscriptionName`, scope, topic.topicName)
|
|
82
|
+
utils.createCfnOutput(`${id}-subscriptionArn`, scope, topic.topicArn)
|
|
83
|
+
utils.createCfnOutput(`${id}-subscriptionName`, scope, topic.topicName)
|
|
84
84
|
|
|
85
85
|
return topic
|
|
86
86
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { CommonConstruct } from '../common/commonConstruct'
|
|
2
1
|
import * as ssm from 'aws-cdk-lib/aws-ssm'
|
|
3
|
-
import { createCfnOutput } from '../utils'
|
|
4
2
|
import * as cr from 'aws-cdk-lib/custom-resources'
|
|
5
|
-
import
|
|
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
|
|
9
9
|
* @category Management & Governance
|
|
10
10
|
* @summary Provides operations on AWS Systems Manager.
|
|
11
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
12
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
11
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
12
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
13
13
|
* @example
|
|
14
|
-
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
14
|
+
* import { common.CommonConstruct } from '@gradientedge/cdk-utils'
|
|
15
15
|
*
|
|
16
|
-
* class CustomConstruct extends CommonConstruct {
|
|
16
|
+
* class CustomConstruct extends common.CommonConstruct {
|
|
17
17
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
18
18
|
* super(parent, id, props)
|
|
19
19
|
* this.props = props
|
|
@@ -27,10 +27,10 @@ export class SsmManager {
|
|
|
27
27
|
/**
|
|
28
28
|
* Method to write a string parameter to the parameters store
|
|
29
29
|
* @param {string} id scoped id of the resource
|
|
30
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
30
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
31
31
|
* @param {ssm.StringParameterProps} props parameter props
|
|
32
32
|
*/
|
|
33
|
-
public writeStringToParameters(id: string, scope: CommonConstruct, props: ssm.StringParameterProps) {
|
|
33
|
+
public writeStringToParameters(id: string, scope: common.CommonConstruct, props: ssm.StringParameterProps) {
|
|
34
34
|
if (!props) throw `Parameter props undefined`
|
|
35
35
|
|
|
36
36
|
const parameter = new ssm.StringParameter(scope, `${id}`, {
|
|
@@ -39,8 +39,8 @@ export class SsmManager {
|
|
|
39
39
|
stringValue: props.stringValue,
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
createCfnOutput(`${id}-parameterArn`, scope, parameter.parameterArn)
|
|
43
|
-
createCfnOutput(`${id}-parameterName`, scope, parameter.parameterName)
|
|
42
|
+
utils.createCfnOutput(`${id}-parameterArn`, scope, parameter.parameterArn)
|
|
43
|
+
utils.createCfnOutput(`${id}-parameterName`, scope, parameter.parameterName)
|
|
44
44
|
|
|
45
45
|
return parameter
|
|
46
46
|
}
|
|
@@ -48,10 +48,10 @@ export class SsmManager {
|
|
|
48
48
|
/**
|
|
49
49
|
* Method to read a string parameter from the parameters store
|
|
50
50
|
* @param {string} id scoped id of the resource
|
|
51
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
51
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
52
52
|
* @param {string} parameterName parameter name to lookup
|
|
53
53
|
*/
|
|
54
|
-
public readStringParameter(id: string, scope: CommonConstruct, parameterName: string) {
|
|
54
|
+
public readStringParameter(id: string, scope: common.CommonConstruct, parameterName: string) {
|
|
55
55
|
if (!parameterName || parameterName == '') throw 'Invalid parameter name'
|
|
56
56
|
|
|
57
57
|
return ssm.StringParameter.fromStringParameterName(scope, `${id}`, parameterName).stringValue
|
|
@@ -60,11 +60,16 @@ export class SsmManager {
|
|
|
60
60
|
/**
|
|
61
61
|
* Method to read a string parameter from the parameters store in a given region
|
|
62
62
|
* @param {string} id scoped id of the resource
|
|
63
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
63
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
64
64
|
* @param {string} parameterName parameter name to lookup
|
|
65
65
|
* @param {string} region region name to lookup parameter
|
|
66
66
|
*/
|
|
67
|
-
public readStringParameterFromRegion(
|
|
67
|
+
public readStringParameterFromRegion(
|
|
68
|
+
id: string,
|
|
69
|
+
scope: common.CommonConstruct,
|
|
70
|
+
parameterName: string,
|
|
71
|
+
region: string
|
|
72
|
+
) {
|
|
68
73
|
if (!parameterName || parameterName == '') throw 'Invalid parameter name'
|
|
69
74
|
if (!region || region == '') throw 'Invalid region'
|
|
70
75
|
|
|
@@ -81,11 +86,11 @@ export class SsmManager {
|
|
|
81
86
|
export class SSMParameterReader extends cr.AwsCustomResource {
|
|
82
87
|
/**
|
|
83
88
|
*
|
|
84
|
-
* @param scope
|
|
85
|
-
* @param name
|
|
86
|
-
* @param props
|
|
89
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
90
|
+
* @param {string} name parameter name
|
|
91
|
+
* @param {types.SSMParameterReaderProps} props
|
|
87
92
|
*/
|
|
88
|
-
constructor(scope: CommonConstruct, name: string, props: SSMParameterReaderProps) {
|
|
93
|
+
constructor(scope: common.CommonConstruct, name: string, props: types.SSMParameterReaderProps) {
|
|
89
94
|
const { parameterName, region } = props
|
|
90
95
|
|
|
91
96
|
const ssmAwsSdkCall: cr.AwsSdkCall = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as cdk from 'aws-cdk-lib'
|
|
2
2
|
import * as ec2 from 'aws-cdk-lib/aws-ec2'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import * as common from '../../common'
|
|
4
|
+
import * as utils from '../../utils'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @stability stable
|
|
@@ -12,12 +12,12 @@ const CommonVpcIdentifier = 'CommonVpc'
|
|
|
12
12
|
/**
|
|
13
13
|
* @category Networking & Content Delivery
|
|
14
14
|
* @summary Provides operations on AWS VPC.
|
|
15
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
16
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
15
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
16
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
17
17
|
* @example
|
|
18
18
|
* import * as common from '@gradientedge/cdk-utils'
|
|
19
19
|
*
|
|
20
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
20
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
21
21
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
22
22
|
* super(parent, id, props)
|
|
23
23
|
* this.props = props
|
|
@@ -31,40 +31,40 @@ export class VpcManager {
|
|
|
31
31
|
/**
|
|
32
32
|
* @summary Method to create a new vpc
|
|
33
33
|
* @param {string} id scoped id of the resource
|
|
34
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
34
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
35
35
|
* @param {ec2.VpcProps} props
|
|
36
36
|
*/
|
|
37
|
-
public createVpc(id: string, scope: CommonConstruct, props: ec2.VpcProps) {
|
|
37
|
+
public createVpc(id: string, scope: common.CommonConstruct, props: ec2.VpcProps) {
|
|
38
38
|
if (!props) throw 'Vpc props undefined'
|
|
39
39
|
const vpc = new ec2.Vpc(scope, `${id}`, {
|
|
40
40
|
maxAzs: props.maxAzs,
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
createCfnOutput(`${id}Id`, scope, vpc.vpcId)
|
|
44
|
-
createCfnOutput(`${id}PublicSubnetIds`, scope, vpc.publicSubnets.map(subnet => subnet.subnetId).toString())
|
|
45
|
-
createCfnOutput(`${id}PrivateSubnetIds`, scope, vpc.privateSubnets.map(subnet => subnet.subnetId).toString())
|
|
46
|
-
createCfnOutput(
|
|
43
|
+
utils.createCfnOutput(`${id}Id`, scope, vpc.vpcId)
|
|
44
|
+
utils.createCfnOutput(`${id}PublicSubnetIds`, scope, vpc.publicSubnets.map(subnet => subnet.subnetId).toString())
|
|
45
|
+
utils.createCfnOutput(`${id}PrivateSubnetIds`, scope, vpc.privateSubnets.map(subnet => subnet.subnetId).toString())
|
|
46
|
+
utils.createCfnOutput(
|
|
47
47
|
`${id}PublicSubnetRouteTableIds`,
|
|
48
48
|
scope,
|
|
49
49
|
vpc.publicSubnets.map(subnet => subnet.routeTable.routeTableId).toString()
|
|
50
50
|
)
|
|
51
|
-
createCfnOutput(
|
|
51
|
+
utils.createCfnOutput(
|
|
52
52
|
`${id}PrivateSubnetRouteTableIds`,
|
|
53
53
|
scope,
|
|
54
54
|
vpc.privateSubnets.map(subnet => subnet.routeTable.routeTableId).toString()
|
|
55
55
|
)
|
|
56
|
-
createCfnOutput(`${id}AvailabilityZones`, scope, vpc.availabilityZones.toString())
|
|
56
|
+
utils.createCfnOutput(`${id}AvailabilityZones`, scope, vpc.availabilityZones.toString())
|
|
57
57
|
|
|
58
58
|
return vpc
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* @summary Method to create a common vpc
|
|
63
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
63
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
64
64
|
* @param {ec2.VpcProps} props
|
|
65
65
|
* @param {string?} vpcIdentifier optional identifier for VPC
|
|
66
66
|
*/
|
|
67
|
-
public createCommonVpc(scope: CommonConstruct, props: ec2.VpcProps, vpcIdentifier?: string) {
|
|
67
|
+
public createCommonVpc(scope: common.CommonConstruct, props: ec2.VpcProps, vpcIdentifier?: string) {
|
|
68
68
|
const vpc = this.createVpc(CommonVpcIdentifier, scope, props)
|
|
69
69
|
cdk.Tags.of(vpc).add('Name', vpcIdentifier ?? CommonVpcIdentifier)
|
|
70
70
|
|
|
@@ -74,9 +74,9 @@ export class VpcManager {
|
|
|
74
74
|
/**
|
|
75
75
|
* @summary Method to retrieve a common vpc
|
|
76
76
|
* @param {string} id scoped id of the resource
|
|
77
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
77
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
78
78
|
*/
|
|
79
|
-
public retrieveCommonVpc(id: string, scope: CommonConstruct) {
|
|
79
|
+
public retrieveCommonVpc(id: string, scope: common.CommonConstruct) {
|
|
80
80
|
return ec2.Vpc.fromLookup(scope, `${id}`, { vpcName: CommonVpcIdentifier })
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as wafv2 from 'aws-cdk-lib/aws-wafv2'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import * as common from '../../common'
|
|
3
|
+
import * as types from '../../types'
|
|
4
|
+
import * as utils from '../../utils'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @stability stable
|
|
8
8
|
* @category Security, Identity & Compliance
|
|
9
9
|
* @summary Provides operations on AWS WAF.
|
|
10
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
10
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
11
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
12
12
|
* @example
|
|
13
13
|
* import * as common from '@gradientedge/cdk-utils'
|
|
14
14
|
*
|
|
15
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
15
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
16
16
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
17
17
|
* super(parent, id, props)
|
|
18
18
|
* this.props = props
|
|
@@ -26,10 +26,10 @@ export class WafManager {
|
|
|
26
26
|
/**
|
|
27
27
|
* @summary Method to create an ip set
|
|
28
28
|
* @param {string} id scoped id of the resource
|
|
29
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
30
|
-
* @param {WafIPSetProps} props
|
|
29
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
30
|
+
* @param {types.WafIPSetProps} props
|
|
31
31
|
*/
|
|
32
|
-
public createIpSet(id: string, scope: CommonConstruct, props: WafIPSetProps) {
|
|
32
|
+
public createIpSet(id: string, scope: common.CommonConstruct, props: types.WafIPSetProps) {
|
|
33
33
|
if (!props) throw `WAF Ip Set props undefined`
|
|
34
34
|
|
|
35
35
|
const ipSet = new wafv2.CfnIPSet(scope, `${id}`, {
|
|
@@ -40,8 +40,8 @@ export class WafManager {
|
|
|
40
40
|
scope: props.scope,
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
createCfnOutput(`${id}-ipSetId`, scope, ipSet.attrId)
|
|
44
|
-
createCfnOutput(`${id}-ipSetArn`, scope, ipSet.attrArn)
|
|
43
|
+
utils.createCfnOutput(`${id}-ipSetId`, scope, ipSet.attrId)
|
|
44
|
+
utils.createCfnOutput(`${id}-ipSetArn`, scope, ipSet.attrArn)
|
|
45
45
|
|
|
46
46
|
return ipSet
|
|
47
47
|
}
|
|
@@ -49,10 +49,10 @@ export class WafManager {
|
|
|
49
49
|
/**
|
|
50
50
|
* @summary Method to create a web acl
|
|
51
51
|
* @param {string} id scoped id of the resource
|
|
52
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
53
|
-
* @param {WafWebACLProps} props
|
|
52
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
53
|
+
* @param {types.WafWebACLProps} props
|
|
54
54
|
*/
|
|
55
|
-
public createWebAcl(id: string, scope: CommonConstruct, props: WafWebACLProps) {
|
|
55
|
+
public createWebAcl(id: string, scope: common.CommonConstruct, props: types.WafWebACLProps) {
|
|
56
56
|
if (!props) throw `WAF WebACL props undefined`
|
|
57
57
|
|
|
58
58
|
const webAcl = new wafv2.CfnWebACL(scope, `${id}`, {
|
|
@@ -65,8 +65,8 @@ export class WafManager {
|
|
|
65
65
|
tags: [{ key: 'service', value: scope.props.name }],
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
createCfnOutput(`${id}-webAclId`, scope, webAcl.attrId)
|
|
69
|
-
createCfnOutput(`${id}-webAclArn`, scope, webAcl.attrArn)
|
|
68
|
+
utils.createCfnOutput(`${id}-webAclId`, scope, webAcl.attrId)
|
|
69
|
+
utils.createCfnOutput(`${id}-webAclArn`, scope, webAcl.attrArn)
|
|
70
70
|
|
|
71
71
|
return webAcl
|
|
72
72
|
}
|