@gradientedge/cdk-utils 4.2.0 → 4.3.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/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 +26 -45
- package/dist/src/lib/common/commonConstruct.d.ts.map +1 -1
- package/dist/src/lib/common/commonConstruct.js +50 -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 +8 -8
- package/dist/src/lib/construct/siteWithEcsBackend.d.ts.map +1 -1
- package/dist/src/lib/construct/siteWithEcsBackend.js +4 -4
- package/dist/src/lib/construct/siteWithEcsBackend.js.map +1 -1
- package/dist/src/lib/construct/staticSite.d.ts +5 -5
- package/dist/src/lib/construct/staticSite.d.ts.map +1 -1
- package/dist/src/lib/construct/staticSite.js +1 -1
- 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/{cloudFrontManager.d.ts → aws/cloudFrontManager.d.ts} +26 -25
- package/dist/src/lib/manager/aws/cloudFrontManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{cloudFrontManager.js → aws/cloudFrontManager.js} +26 -26
- 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/aws/dynamodbManager.d.ts +32 -0
- package/dist/src/lib/manager/aws/dynamodbManager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/dynamodbManager.js +79 -0
- package/dist/src/lib/manager/aws/dynamodbManager.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 +23 -0
- package/dist/src/lib/manager/aws/index.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/index.js +35 -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} +22 -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 +19 -16
- package/src/lib/common/commonConstruct.ts +55 -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 +9 -9
- package/src/lib/construct/staticSite.ts +5 -5
- 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} +42 -42
- 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/aws/dynamodbManager.ts +60 -0
- 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 +22 -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} +21 -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.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,24 +1,24 @@
|
|
|
1
|
+
import * as pylambda from '@aws-cdk/aws-lambda-python-alpha'
|
|
1
2
|
import * as cdk from 'aws-cdk-lib'
|
|
2
3
|
import * as ec2 from 'aws-cdk-lib/aws-ec2'
|
|
3
4
|
import * as efs from 'aws-cdk-lib/aws-efs'
|
|
4
5
|
import * as iam from 'aws-cdk-lib/aws-iam'
|
|
5
6
|
import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { createCfnOutput } from '../utils'
|
|
7
|
+
import * as common from '../../common'
|
|
8
|
+
import * as types from '../../types'
|
|
9
|
+
import * as utils from '../../utils'
|
|
10
10
|
import { CloudFrontManager } from './cloudFrontManager'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @stability stable
|
|
14
14
|
* @category Compute
|
|
15
15
|
* @summary Provides operations on AWS Lambda.
|
|
16
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
17
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
16
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
17
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
18
18
|
* @example
|
|
19
19
|
* import * as common from '@gradientedge/cdk-utils'
|
|
20
20
|
*
|
|
21
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
21
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
22
22
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
23
23
|
* super(parent, id, props)
|
|
24
24
|
* this.props = props
|
|
@@ -32,10 +32,10 @@ export class LambdaManager {
|
|
|
32
32
|
/**
|
|
33
33
|
* @summary Method to create a lambda layer (nodejs)
|
|
34
34
|
* @param {string} id scoped id of the resource
|
|
35
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
35
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
36
36
|
* @param {lambda.AssetCode} code
|
|
37
37
|
*/
|
|
38
|
-
public createLambdaLayer(id: string, scope: CommonConstruct, code: lambda.AssetCode) {
|
|
38
|
+
public createLambdaLayer(id: string, scope: common.CommonConstruct, code: lambda.AssetCode) {
|
|
39
39
|
const lambdaLayer = new lambda.LayerVersion(scope, `${id}`, {
|
|
40
40
|
compatibleRuntimes: [lambda.Runtime.NODEJS_14_X],
|
|
41
41
|
code: code,
|
|
@@ -43,7 +43,7 @@ export class LambdaManager {
|
|
|
43
43
|
layerVersionName: `${id}-${scope.props.stage}`,
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
-
createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
|
|
46
|
+
utils.createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
|
|
47
47
|
|
|
48
48
|
return lambdaLayer
|
|
49
49
|
}
|
|
@@ -51,10 +51,10 @@ export class LambdaManager {
|
|
|
51
51
|
/**
|
|
52
52
|
* @summary Method to create a lambda layer (python)
|
|
53
53
|
* @param {string} id scoped id of the resource
|
|
54
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
54
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
55
55
|
* @param {string} entry path to layer source
|
|
56
56
|
*/
|
|
57
|
-
public createPythonLambdaLayer(id: string, scope: CommonConstruct, entry: string) {
|
|
57
|
+
public createPythonLambdaLayer(id: string, scope: common.CommonConstruct, entry: string) {
|
|
58
58
|
const lambdaLayer = new pylambda.PythonLayerVersion(scope, `${id}`, {
|
|
59
59
|
compatibleRuntimes: [lambda.Runtime.PYTHON_3_8],
|
|
60
60
|
description: `${id}`,
|
|
@@ -62,7 +62,7 @@ export class LambdaManager {
|
|
|
62
62
|
layerVersionName: `${id}-${scope.props.stage}`,
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
|
|
65
|
+
utils.createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
|
|
66
66
|
|
|
67
67
|
return lambdaLayer
|
|
68
68
|
}
|
|
@@ -70,8 +70,8 @@ export class LambdaManager {
|
|
|
70
70
|
/**
|
|
71
71
|
* @summary Method to create a lambda function (nodejs)
|
|
72
72
|
* @param {string} id scoped id of the resource
|
|
73
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
74
|
-
* @param {LambdaProps} props
|
|
73
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
74
|
+
* @param {types.LambdaProps} props
|
|
75
75
|
* @param {iam.Role | iam.CfnRole} role
|
|
76
76
|
* @param {lambda.ILayerVersion[]} layers
|
|
77
77
|
* @param {lambda.AssetCode} code
|
|
@@ -84,8 +84,8 @@ export class LambdaManager {
|
|
|
84
84
|
*/
|
|
85
85
|
public createLambdaFunction(
|
|
86
86
|
id: string,
|
|
87
|
-
scope: CommonConstruct,
|
|
88
|
-
props: LambdaProps,
|
|
87
|
+
scope: common.CommonConstruct,
|
|
88
|
+
props: types.LambdaProps,
|
|
89
89
|
role: iam.Role | iam.CfnRole,
|
|
90
90
|
layers: lambda.ILayerVersion[],
|
|
91
91
|
code: lambda.AssetCode,
|
|
@@ -120,8 +120,8 @@ export class LambdaManager {
|
|
|
120
120
|
vpc: vpc,
|
|
121
121
|
})
|
|
122
122
|
|
|
123
|
-
createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
|
|
124
|
-
createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
|
|
123
|
+
utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
|
|
124
|
+
utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
|
|
125
125
|
|
|
126
126
|
return lambdaFunction
|
|
127
127
|
}
|
|
@@ -129,8 +129,8 @@ export class LambdaManager {
|
|
|
129
129
|
/**
|
|
130
130
|
* @summary Method to create a lambda function (python)
|
|
131
131
|
* @param {string} id scoped id of the resource
|
|
132
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
133
|
-
* @param {LambdaProps} props
|
|
132
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
133
|
+
* @param {types.LambdaProps} props
|
|
134
134
|
* @param {iam.Role | iam.CfnRole} role
|
|
135
135
|
* @param {lambda.ILayerVersion[]} layers
|
|
136
136
|
* @param {string} entry path to lambda source
|
|
@@ -145,8 +145,8 @@ export class LambdaManager {
|
|
|
145
145
|
|
|
146
146
|
public createPythonLambdaFunction(
|
|
147
147
|
id: string,
|
|
148
|
-
scope: CommonConstruct,
|
|
149
|
-
props: LambdaProps,
|
|
148
|
+
scope: common.CommonConstruct,
|
|
149
|
+
props: types.LambdaProps,
|
|
150
150
|
role: iam.Role | iam.CfnRole,
|
|
151
151
|
layers: lambda.ILayerVersion[],
|
|
152
152
|
entry: string,
|
|
@@ -183,8 +183,8 @@ export class LambdaManager {
|
|
|
183
183
|
vpc: vpc,
|
|
184
184
|
})
|
|
185
185
|
|
|
186
|
-
createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
|
|
187
|
-
createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
|
|
186
|
+
utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
|
|
187
|
+
utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
|
|
188
188
|
|
|
189
189
|
return lambdaFunction
|
|
190
190
|
}
|
|
@@ -193,8 +193,8 @@ export class LambdaManager {
|
|
|
193
193
|
* @summary Method to provision a Lambda@Edge function
|
|
194
194
|
*
|
|
195
195
|
* @param {string} id scoped id of the resource
|
|
196
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
197
|
-
* @param {LambdaEdgeProps} props lambda@edge properties
|
|
196
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
197
|
+
* @param {types.LambdaEdgeProps} props lambda@edge properties
|
|
198
198
|
* @param {lambda.ILayerVersion[]} layers
|
|
199
199
|
* @param {lambda.AssetCode} code
|
|
200
200
|
* @param {Map<string, string>} environment
|
|
@@ -205,8 +205,8 @@ export class LambdaManager {
|
|
|
205
205
|
*/
|
|
206
206
|
public createEdgeFunction(
|
|
207
207
|
id: string,
|
|
208
|
-
scope: CommonConstruct,
|
|
209
|
-
props: LambdaEdgeProps,
|
|
208
|
+
scope: common.CommonConstruct,
|
|
209
|
+
props: types.LambdaEdgeProps,
|
|
210
210
|
layers: lambda.ILayerVersion[],
|
|
211
211
|
code: lambda.AssetCode,
|
|
212
212
|
environment?: any,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as cdk from 'aws-cdk-lib'
|
|
2
2
|
import * as logs from 'aws-cdk-lib/aws-logs'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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 CloudWatch.
|
|
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
14
|
* import * as common from '@gradientedge/cdk-utils'
|
|
15
15
|
*
|
|
16
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
16
|
+
* class CustomConstruct extends common.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,11 +27,16 @@ export class LogManager {
|
|
|
27
27
|
/**
|
|
28
28
|
* @summary Method to create a cloudwatch metric filter
|
|
29
29
|
* @param {string} id scoped id of the resource
|
|
30
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
31
|
-
* @param {MetricFilterProps} props
|
|
30
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
31
|
+
* @param {types.MetricFilterProps} props
|
|
32
32
|
* @param {logs.ILogGroup} logGroup
|
|
33
33
|
*/
|
|
34
|
-
public createMetricFilter(
|
|
34
|
+
public createMetricFilter(
|
|
35
|
+
id: string,
|
|
36
|
+
scope: common.CommonConstruct,
|
|
37
|
+
props: types.MetricFilterProps,
|
|
38
|
+
logGroup: logs.ILogGroup
|
|
39
|
+
) {
|
|
35
40
|
if (!props) throw `MetricFilter props undefined`
|
|
36
41
|
|
|
37
42
|
const metricFilter = new logs.MetricFilter(scope, `${id}`, {
|
|
@@ -57,10 +62,10 @@ export class LogManager {
|
|
|
57
62
|
/**
|
|
58
63
|
* @summary Method to create a cloudwatch log group (cfn)
|
|
59
64
|
* @param {string} id scoped id of the resource
|
|
60
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
61
|
-
* @param {LogProps} props
|
|
65
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
66
|
+
* @param {types.LogProps} props
|
|
62
67
|
*/
|
|
63
|
-
public createCfnLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
|
|
68
|
+
public createCfnLogGroup(id: string, scope: common.CommonConstruct, props: types.LogProps) {
|
|
64
69
|
if (!props) throw `Logs props undefined`
|
|
65
70
|
|
|
66
71
|
const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
|
|
@@ -68,7 +73,7 @@ export class LogManager {
|
|
|
68
73
|
retentionInDays: props.retention,
|
|
69
74
|
})
|
|
70
75
|
|
|
71
|
-
createCfnOutput(`${id}-logGroupArn`, scope, logGroup.attrArn)
|
|
76
|
+
utils.createCfnOutput(`${id}-logGroupArn`, scope, logGroup.attrArn)
|
|
72
77
|
|
|
73
78
|
return logGroup
|
|
74
79
|
}
|
|
@@ -76,10 +81,10 @@ export class LogManager {
|
|
|
76
81
|
/**
|
|
77
82
|
* @summary Method to create a cloudwatch log group
|
|
78
83
|
* @param {string} id scoped id of the resource
|
|
79
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
80
|
-
* @param {LogProps} props
|
|
84
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
85
|
+
* @param {types.LogProps} props
|
|
81
86
|
*/
|
|
82
|
-
public createLogGroup(id: string, scope: CommonConstruct, props: LogProps) {
|
|
87
|
+
public createLogGroup(id: string, scope: common.CommonConstruct, props: types.LogProps) {
|
|
83
88
|
if (!props) throw `Logs props undefined`
|
|
84
89
|
|
|
85
90
|
const logGroup = new logs.LogGroup(scope, `${id}`, {
|
|
@@ -88,7 +93,7 @@ export class LogManager {
|
|
|
88
93
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
89
94
|
})
|
|
90
95
|
|
|
91
|
-
createCfnOutput(`${id}-logGroupArn`, scope, logGroup.logGroupArn)
|
|
96
|
+
utils.createCfnOutput(`${id}-logGroupArn`, scope, logGroup.logGroupArn)
|
|
92
97
|
|
|
93
98
|
return logGroup
|
|
94
99
|
}
|
|
@@ -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
|
}
|