@gradientedge/cdk-utils 4.1.0 → 4.2.1
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/README.md +37 -9
- 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 +30 -50
- package/dist/src/lib/common/commonConstruct.d.ts.map +1 -1
- package/dist/src/lib/common/commonConstruct.js +53 -54
- package/dist/src/lib/common/commonConstruct.js.map +1 -1
- package/dist/src/lib/common/commonStack.d.ts +3 -2
- package/dist/src/lib/common/commonStack.d.ts.map +1 -1
- package/dist/src/lib/common/commonStack.js +2 -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 +6 -5
- package/dist/src/lib/construct/graphQLApiLambda.d.ts.map +1 -1
- package/dist/src/lib/construct/graphQLApiLambda.js +3 -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 +21 -8
- package/dist/src/lib/construct/siteWithEcsBackend.d.ts.map +1 -1
- package/dist/src/lib/construct/siteWithEcsBackend.js +33 -5
- package/dist/src/lib/construct/siteWithEcsBackend.js.map +1 -1
- package/dist/src/lib/construct/staticSite.d.ts +18 -5
- package/dist/src/lib/construct/staticSite.d.ts.map +1 -1
- package/dist/src/lib/construct/staticSite.js +31 -2
- package/dist/src/lib/construct/staticSite.js.map +1 -1
- package/dist/src/lib/manager/{acmManager.d.ts → aws/acmManager.d.ts} +9 -8
- package/dist/src/lib/manager/aws/acmManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{acmManager.js → aws/acmManager.js} +9 -8
- package/dist/src/lib/manager/aws/acmManager.js.map +1 -0
- package/dist/src/lib/manager/{apiManager.d.ts → aws/apiManager.d.ts} +12 -11
- package/dist/src/lib/manager/aws/apiManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{apiManager.js → aws/apiManager.js} +12 -11
- package/dist/src/lib/manager/aws/apiManager.js.map +1 -0
- package/dist/src/lib/manager/{appConfigManager.d.ts → aws/appConfigManager.d.ts} +18 -17
- package/dist/src/lib/manager/aws/appConfigManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{appConfigManager.js → aws/appConfigManager.js} +20 -19
- 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} +49 -25
- package/dist/src/lib/manager/aws/cloudFrontManager.js.map +1 -0
- package/dist/src/lib/manager/{cloudTrailManager.d.ts → aws/cloudTrailManager.d.ts} +10 -9
- package/dist/src/lib/manager/aws/cloudTrailManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{cloudTrailManager.js → aws/cloudTrailManager.js} +10 -9
- 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} +48 -36
- package/dist/src/lib/manager/aws/cloudWatchManager.js.map +1 -0
- package/dist/src/lib/manager/aws/codeBuildManager.d.ts +40 -0
- package/dist/src/lib/manager/aws/codeBuildManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{codeBuildManager.js → aws/codeBuildManager.js} +17 -1
- package/dist/src/lib/manager/aws/codeBuildManager.js.map +1 -0
- package/dist/src/lib/manager/{ecrManager.d.ts → aws/ecrManager.d.ts} +8 -7
- package/dist/src/lib/manager/aws/ecrManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ecrManager.js → aws/ecrManager.js} +8 -7
- package/dist/src/lib/manager/aws/ecrManager.js.map +1 -0
- package/dist/src/lib/manager/{ecsManager.d.ts → aws/ecsManager.d.ts} +13 -12
- package/dist/src/lib/manager/aws/ecsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ecsManager.js → aws/ecsManager.js} +13 -12
- package/dist/src/lib/manager/aws/ecsManager.js.map +1 -0
- package/dist/src/lib/manager/{eksManager.d.ts → aws/eksManager.d.ts} +10 -9
- package/dist/src/lib/manager/aws/eksManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{eksManager.js → aws/eksManager.js} +10 -9
- package/dist/src/lib/manager/aws/eksManager.js.map +1 -0
- package/dist/src/lib/manager/{eventManager.d.ts → aws/eventManager.d.ts} +13 -12
- package/dist/src/lib/manager/aws/eventManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{eventManager.js → aws/eventManager.js} +14 -13
- 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} +37 -35
- 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} +21 -20
- package/dist/src/lib/manager/aws/lambdaManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{lambdaManager.js → aws/lambdaManager.js} +21 -20
- package/dist/src/lib/manager/aws/lambdaManager.js.map +1 -0
- package/dist/src/lib/manager/aws/logManager.d.ts +51 -0
- package/dist/src/lib/manager/aws/logManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{logManager.js → aws/logManager.js} +14 -13
- package/dist/src/lib/manager/aws/logManager.js.map +1 -0
- package/dist/src/lib/manager/{route53Manager.d.ts → aws/route53Manager.d.ts} +18 -17
- package/dist/src/lib/manager/aws/route53Manager.d.ts.map +1 -0
- package/dist/src/lib/manager/{route53Manager.js → aws/route53Manager.js} +19 -18
- 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} +17 -16
- package/dist/src/lib/manager/aws/s3Manager.js.map +1 -0
- package/dist/src/lib/manager/{secretsManager.d.ts → aws/secretsManager.d.ts} +8 -7
- package/dist/src/lib/manager/aws/secretsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{secretsManager.js → aws/secretsManager.js} +6 -5
- package/dist/src/lib/manager/aws/secretsManager.js.map +1 -0
- package/dist/src/lib/manager/aws/snsManager.d.ts +42 -0
- package/dist/src/lib/manager/aws/snsManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{snsManager.js → aws/snsManager.js} +14 -13
- package/dist/src/lib/manager/aws/snsManager.js.map +1 -0
- package/dist/src/lib/manager/aws/ssmManager.d.ts +64 -0
- package/dist/src/lib/manager/aws/ssmManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{ssmManager.js → aws/ssmManager.js} +15 -14
- package/dist/src/lib/manager/aws/ssmManager.js.map +1 -0
- package/dist/src/lib/manager/{vpcManager.d.ts → aws/vpcManager.d.ts} +12 -11
- package/dist/src/lib/manager/aws/vpcManager.d.ts.map +1 -0
- package/dist/src/lib/manager/{vpcManager.js → aws/vpcManager.js} +15 -14
- 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} +14 -13
- 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 +28 -19
- package/src/lib/common/commonConstruct.ts +58 -78
- package/src/lib/common/commonStack.ts +3 -2
- package/src/lib/common/index.ts +2 -0
- package/src/lib/construct/graphQLApiLambda.ts +6 -5
- package/src/lib/construct/index.ts +3 -0
- package/src/lib/construct/siteWithEcsBackend.ts +45 -10
- package/src/lib/construct/staticSite.ts +41 -6
- package/src/lib/manager/{acmManager.ts → aws/acmManager.ts} +13 -12
- package/src/lib/manager/{apiManager.ts → aws/apiManager.ts} +16 -15
- package/src/lib/manager/{appConfigManager.ts → aws/appConfigManager.ts} +32 -27
- package/src/lib/manager/{cloudFrontManager.ts → aws/cloudFrontManager.ts} +69 -40
- package/src/lib/manager/{cloudTrailManager.ts → aws/cloudTrailManager.ts} +14 -13
- package/src/lib/manager/{cloudWatchManager.ts → aws/cloudWatchManager.ts} +80 -57
- package/src/lib/manager/{codeBuildManager.ts → aws/codeBuildManager.ts} +20 -4
- package/src/lib/manager/{ecrManager.ts → aws/ecrManager.ts} +10 -9
- package/src/lib/manager/{ecsManager.ts → aws/ecsManager.ts} +18 -17
- package/src/lib/manager/{eksManager.ts → aws/eksManager.ts} +14 -13
- package/src/lib/manager/{eventManager.ts → aws/eventManager.ts} +20 -19
- package/src/lib/manager/{iamManager.ts → aws/iamManager.ts} +67 -55
- package/src/lib/manager/aws/index.ts +21 -0
- package/src/lib/manager/{lambdaManager.ts → aws/lambdaManager.ts} +31 -30
- package/src/lib/manager/{logManager.ts → aws/logManager.ts} +24 -18
- package/src/lib/manager/{route53Manager.ts → aws/route53Manager.ts} +26 -25
- package/src/lib/manager/{s3Manager.ts → aws/s3Manager.ts} +26 -25
- package/src/lib/manager/{secretsManager.ts → aws/secretsManager.ts} +13 -7
- package/src/lib/manager/{snsManager.ts → aws/snsManager.ts} +20 -19
- package/src/lib/manager/{ssmManager.ts → aws/ssmManager.ts} +26 -20
- package/src/lib/manager/{vpcManager.ts → aws/vpcManager.ts} +19 -18
- package/src/lib/manager/{wafManager.ts → aws/wafManager.ts} +18 -17
- 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 -100
- 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 -120
- 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 +0 -25
- 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 -154
- 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 +0 -50
- 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 -72
- 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 +0 -41
- 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 +0 -63
- 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 -38
- 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,38 +1,39 @@
|
|
|
1
1
|
import * as ecr from 'aws-cdk-lib/aws-ecr-assets'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import * as common from '../../common'
|
|
3
|
+
import * as utils from '../../utils'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @stability stable
|
|
7
7
|
* @category Containers
|
|
8
8
|
* @summary Provides operations on AWS Elastic Container Registry.
|
|
9
|
-
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
10
|
-
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
9
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
10
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
11
11
|
* @example
|
|
12
12
|
* import * as common from '@gradientedge/cdk-utils'
|
|
13
13
|
*
|
|
14
|
-
* class CustomConstruct extends common.CommonConstruct {
|
|
14
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
15
15
|
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
16
16
|
* super(parent, id, props)
|
|
17
17
|
* this.props = props
|
|
18
18
|
* this.ecrManager.createDockerImage('MyImage', this, dockerfilePath)
|
|
19
|
+
* }
|
|
19
20
|
* }
|
|
20
21
|
*
|
|
21
|
-
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/
|
|
22
|
+
* @see [CDK ECR Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr-readme.html}
|
|
22
23
|
*/
|
|
23
24
|
export class EcrManager {
|
|
24
25
|
/**
|
|
25
26
|
* @summary Method to create a docker image in ecr
|
|
26
27
|
* @param {string} id scoped id of the resource
|
|
27
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
28
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
28
29
|
* @param {string} dockerfilePath
|
|
29
30
|
*/
|
|
30
|
-
public createDockerImage(id: string, scope: CommonConstruct, dockerfilePath: string) {
|
|
31
|
+
public createDockerImage(id: string, scope: common.CommonConstruct, dockerfilePath: string) {
|
|
31
32
|
const asset = new ecr.DockerImageAsset(scope, `${id}`, {
|
|
32
33
|
directory: dockerfilePath,
|
|
33
34
|
})
|
|
34
35
|
|
|
35
|
-
createCfnOutput(`${id}-dockerImageArn`, scope, asset.imageUri)
|
|
36
|
+
utils.createCfnOutput(`${id}-dockerImageArn`, scope, asset.imageUri)
|
|
36
37
|
|
|
37
38
|
return asset
|
|
38
39
|
}
|
|
@@ -2,37 +2,38 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2'
|
|
|
2
2
|
import * as ecs from 'aws-cdk-lib/aws-ecs'
|
|
3
3
|
import * as iam from 'aws-cdk-lib/aws-iam'
|
|
4
4
|
import * as logs from 'aws-cdk-lib/aws-logs'
|
|
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 Containers
|
|
12
12
|
* @summary Provides operations on AWS Elastic Container Service.
|
|
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
|
|
22
22
|
* this.ecsManager.createEcsCluster('MyCluster', this, vpc)
|
|
23
|
+
* }
|
|
23
24
|
* }
|
|
24
25
|
*
|
|
25
|
-
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/
|
|
26
|
+
* @see [CDK ECS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html}
|
|
26
27
|
*/
|
|
27
28
|
export class EcsManager {
|
|
28
29
|
/**
|
|
29
30
|
* @summary Method to create an ecs cluster
|
|
30
31
|
* @param {string} id scoped id of the resource
|
|
31
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
32
|
-
* @param {EcsClusterProps} props
|
|
32
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
33
|
+
* @param {types.EcsClusterProps} props
|
|
33
34
|
* @param {ec2.IVpc} vpc
|
|
34
35
|
*/
|
|
35
|
-
public createEcsCluster(id: string, scope: CommonConstruct, props: EcsClusterProps, vpc: ec2.IVpc) {
|
|
36
|
+
public createEcsCluster(id: string, scope: common.CommonConstruct, props: types.EcsClusterProps, vpc: ec2.IVpc) {
|
|
36
37
|
if (!props) throw `Ecs Cluster props undefined`
|
|
37
38
|
|
|
38
39
|
const ecsCluster = new ecs.Cluster(scope, `${id}`, {
|
|
@@ -40,8 +41,8 @@ export class EcsManager {
|
|
|
40
41
|
vpc: vpc,
|
|
41
42
|
})
|
|
42
43
|
|
|
43
|
-
createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
|
|
44
|
-
createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName)
|
|
44
|
+
utils.createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
|
|
45
|
+
utils.createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName)
|
|
45
46
|
|
|
46
47
|
return ecsCluster
|
|
47
48
|
}
|
|
@@ -49,8 +50,8 @@ export class EcsManager {
|
|
|
49
50
|
/**
|
|
50
51
|
* @summary Method to create an ecs fargate task
|
|
51
52
|
* @param {string} id scoped id of the resource
|
|
52
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
53
|
-
* @param {EcsTaskProps} props
|
|
53
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
54
|
+
* @param {types.EcsTaskProps} props
|
|
54
55
|
* @param {ecs.ICluster} cluster
|
|
55
56
|
* @param {iam.Role} role
|
|
56
57
|
* @param {logs.ILogGroup} logGroup
|
|
@@ -59,8 +60,8 @@ export class EcsManager {
|
|
|
59
60
|
*/
|
|
60
61
|
public createEcsFargateTask(
|
|
61
62
|
id: string,
|
|
62
|
-
scope: CommonConstruct,
|
|
63
|
-
props: EcsTaskProps,
|
|
63
|
+
scope: common.CommonConstruct,
|
|
64
|
+
props: types.EcsTaskProps,
|
|
64
65
|
cluster: ecs.ICluster,
|
|
65
66
|
role: iam.Role,
|
|
66
67
|
logGroup: logs.ILogGroup,
|
|
@@ -92,7 +93,7 @@ export class EcsManager {
|
|
|
92
93
|
privileged: false,
|
|
93
94
|
})
|
|
94
95
|
|
|
95
|
-
createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn)
|
|
96
|
+
utils.createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn)
|
|
96
97
|
|
|
97
98
|
return ecsTask
|
|
98
99
|
}
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import * as ec2 from 'aws-cdk-lib/aws-ec2'
|
|
2
2
|
import * as ecr from 'aws-cdk-lib/aws-ecr-assets'
|
|
3
3
|
import * as eks from 'aws-cdk-lib/aws-eks'
|
|
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 Containers
|
|
11
11
|
* @summary Provides operations on AWS Elastic Kubernetes 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
|
|
21
21
|
* this.eksManager.createEksDeployment('MyEksDeployment', this, image, vpc)
|
|
22
|
+
* }
|
|
22
23
|
* }
|
|
23
24
|
*
|
|
24
|
-
* @see [CDK EKS Module]{@link https://docs.aws.amazon.com/cdk/api/
|
|
25
|
+
* @see [CDK EKS Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_eks-readme.html}
|
|
25
26
|
*/
|
|
26
27
|
export class EksManager {
|
|
27
28
|
/**
|
|
28
29
|
* @summary Method to create an eks deployment
|
|
29
30
|
* @param {string} id scoped id of the resource
|
|
30
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
31
|
-
* @param {EksClusterProps} props
|
|
31
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
32
|
+
* @param {types.EksClusterProps} props
|
|
32
33
|
* @param {ecr.DockerImageAsset} image
|
|
33
34
|
* @param {ec2.IVpc} vpc
|
|
34
35
|
*/
|
|
35
36
|
public createEksDeployment(
|
|
36
37
|
id: string,
|
|
37
|
-
scope: CommonConstruct,
|
|
38
|
-
props: EksClusterProps,
|
|
38
|
+
scope: common.CommonConstruct,
|
|
39
|
+
props: types.EksClusterProps,
|
|
39
40
|
image: ecr.DockerImageAsset,
|
|
40
41
|
vpc: ec2.IVpc
|
|
41
42
|
) {
|
|
@@ -92,8 +93,8 @@ export class EksManager {
|
|
|
92
93
|
|
|
93
94
|
cluster.addManifest(`${id}Pod`, service, deployment)
|
|
94
95
|
|
|
95
|
-
createCfnOutput(`${id}-clusterArn`, scope, cluster.clusterArn)
|
|
96
|
-
createCfnOutput(`${id}-clusterEndpoint`, scope, cluster.clusterEndpoint)
|
|
96
|
+
utils.createCfnOutput(`${id}-clusterArn`, scope, cluster.clusterArn)
|
|
97
|
+
utils.createCfnOutput(`${id}-clusterEndpoint`, scope, cluster.clusterEndpoint)
|
|
97
98
|
|
|
98
99
|
return cluster
|
|
99
100
|
}
|
|
@@ -2,34 +2,35 @@ import * as ecs from 'aws-cdk-lib/aws-ecs'
|
|
|
2
2
|
import * as events from 'aws-cdk-lib/aws-events'
|
|
3
3
|
import * as iam from 'aws-cdk-lib/aws-iam'
|
|
4
4
|
import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
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 Application Integration
|
|
12
12
|
* @summary Provides operations on AWS EventBridge.
|
|
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
|
|
22
22
|
* this.eventManager.createLambdaRule('MyLambdaRule', this, lambdaFunction)
|
|
23
|
+
* }
|
|
23
24
|
* }
|
|
24
25
|
*
|
|
25
|
-
* @see [CDK EventBridge Module]{@link https://docs.aws.amazon.com/cdk/api/
|
|
26
|
+
* @see [CDK EventBridge Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events-readme.html}
|
|
26
27
|
*/
|
|
27
28
|
export class EventManager {
|
|
28
29
|
/**
|
|
29
30
|
* @summary Method to create an eventbridge rule with lambda target
|
|
30
31
|
* @param {string} id scoped id of the resource
|
|
31
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
32
|
-
* @param {RuleProps} props
|
|
32
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
33
|
+
* @param {types.RuleProps} props
|
|
33
34
|
* @param {lambda.Function} lambdaFunction
|
|
34
35
|
* @param {string} eventBusName
|
|
35
36
|
* @param {any} eventPattern
|
|
@@ -37,8 +38,8 @@ export class EventManager {
|
|
|
37
38
|
*/
|
|
38
39
|
public createLambdaRule(
|
|
39
40
|
id: string,
|
|
40
|
-
scope: CommonConstruct,
|
|
41
|
-
props: RuleProps,
|
|
41
|
+
scope: common.CommonConstruct,
|
|
42
|
+
props: types.RuleProps,
|
|
42
43
|
lambdaFunction: lambda.Function,
|
|
43
44
|
eventBusName?: string,
|
|
44
45
|
eventPattern?: any,
|
|
@@ -63,8 +64,8 @@ export class EventManager {
|
|
|
63
64
|
sourceArn: eventRule.attrArn,
|
|
64
65
|
})
|
|
65
66
|
|
|
66
|
-
createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
|
|
67
|
-
createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
|
|
67
|
+
utils.createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
|
|
68
|
+
utils.createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
|
|
68
69
|
|
|
69
70
|
return eventRule
|
|
70
71
|
}
|
|
@@ -72,8 +73,8 @@ export class EventManager {
|
|
|
72
73
|
/**
|
|
73
74
|
* @summary Method to create an eventbridge rule with fargate task target
|
|
74
75
|
* @param {string} id scoped id of the resource
|
|
75
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
76
|
-
* @param {RuleProps} props
|
|
76
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
77
|
+
* @param {types.RuleProps} props
|
|
77
78
|
* @param {ecs.ICluster} cluster
|
|
78
79
|
* @param {ecs.ITaskDefinition} task
|
|
79
80
|
* @param {string[]} subnetIds
|
|
@@ -82,8 +83,8 @@ export class EventManager {
|
|
|
82
83
|
*/
|
|
83
84
|
public createFargateTaskRule(
|
|
84
85
|
id: string,
|
|
85
|
-
scope: CommonConstruct,
|
|
86
|
-
props: RuleProps,
|
|
86
|
+
scope: common.CommonConstruct,
|
|
87
|
+
props: types.RuleProps,
|
|
87
88
|
cluster: ecs.ICluster,
|
|
88
89
|
task: ecs.ITaskDefinition,
|
|
89
90
|
subnetIds: string[],
|
|
@@ -114,8 +115,8 @@ export class EventManager {
|
|
|
114
115
|
],
|
|
115
116
|
})
|
|
116
117
|
|
|
117
|
-
createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
|
|
118
|
-
createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
|
|
118
|
+
utils.createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
|
|
119
|
+
utils.createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
|
|
119
120
|
|
|
120
121
|
return eventRule
|
|
121
122
|
}
|
|
@@ -3,33 +3,34 @@ import * as ecs from 'aws-cdk-lib/aws-ecs'
|
|
|
3
3
|
import * as iam from 'aws-cdk-lib/aws-iam'
|
|
4
4
|
import * as logs from 'aws-cdk-lib/aws-logs'
|
|
5
5
|
import * as s3 from 'aws-cdk-lib/aws-s3'
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import * as common from '../../common'
|
|
7
|
+
import * as utils from '../../utils'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @stability stable
|
|
11
11
|
* @category Security, Identity & Compliance
|
|
12
12
|
* @summary Provides operations on AWS IAM.
|
|
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
|
|
22
22
|
* this.iamManager.createRoleForEcsEvent('MyEcsRole', this, cluster, task)
|
|
23
|
+
* }
|
|
23
24
|
* }
|
|
24
25
|
*
|
|
25
|
-
* @see [CDK IAM Module]{@link https://docs.aws.amazon.com/cdk/api/
|
|
26
|
+
* @see [CDK IAM Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam-readme.html}
|
|
26
27
|
*/
|
|
27
28
|
export class IamManager {
|
|
28
29
|
/**
|
|
29
30
|
* @summary Method to create iam statement to read secrets
|
|
30
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
31
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
31
32
|
*/
|
|
32
|
-
public statementForReadSecrets(scope: CommonConstruct) {
|
|
33
|
+
public statementForReadSecrets(scope: common.CommonConstruct) {
|
|
33
34
|
return new iam.PolicyStatement({
|
|
34
35
|
effect: iam.Effect.ALLOW,
|
|
35
36
|
actions: ['secretsmanager:GetSecretValue'],
|
|
@@ -39,9 +40,9 @@ export class IamManager {
|
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* @summary Method to create iam statement to read app config
|
|
42
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
43
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
43
44
|
*/
|
|
44
|
-
public statementForReadAnyAppConfig(scope: CommonConstruct) {
|
|
45
|
+
public statementForReadAnyAppConfig(scope: common.CommonConstruct) {
|
|
45
46
|
return new iam.PolicyStatement({
|
|
46
47
|
effect: iam.Effect.ALLOW,
|
|
47
48
|
actions: [
|
|
@@ -64,10 +65,10 @@ export class IamManager {
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* @summary Method to create iam statement to list s3 buckets
|
|
67
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
68
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
68
69
|
* @param {s3.IBucket} bucket
|
|
69
70
|
*/
|
|
70
|
-
public statementForListBucket(scope: CommonConstruct, bucket: s3.IBucket) {
|
|
71
|
+
public statementForListBucket(scope: common.CommonConstruct, bucket: s3.IBucket) {
|
|
71
72
|
return new iam.PolicyStatement({
|
|
72
73
|
effect: iam.Effect.ALLOW,
|
|
73
74
|
actions: ['s3:ListBucket'],
|
|
@@ -77,9 +78,9 @@ export class IamManager {
|
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
80
|
* @summary Method to create iam statement to list all s3 buckets
|
|
80
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
81
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
81
82
|
*/
|
|
82
|
-
public statementForListAllMyBuckets(scope: CommonConstruct) {
|
|
83
|
+
public statementForListAllMyBuckets(scope: common.CommonConstruct) {
|
|
83
84
|
return new iam.PolicyStatement({
|
|
84
85
|
effect: iam.Effect.ALLOW,
|
|
85
86
|
actions: ['s3:ListAllMyBuckets'],
|
|
@@ -89,10 +90,10 @@ export class IamManager {
|
|
|
89
90
|
|
|
90
91
|
/**
|
|
91
92
|
* @summary Method to create iam statement to get s3 objects in buckets
|
|
92
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
93
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
93
94
|
* @param {s3.IBucket} bucket
|
|
94
95
|
*/
|
|
95
|
-
public statementForGetAnyS3Objects(scope: CommonConstruct, bucket: s3.IBucket) {
|
|
96
|
+
public statementForGetAnyS3Objects(scope: common.CommonConstruct, bucket: s3.IBucket) {
|
|
96
97
|
return new iam.PolicyStatement({
|
|
97
98
|
effect: iam.Effect.ALLOW,
|
|
98
99
|
actions: ['s3:GetObject', 's3:GetObjectAcl'],
|
|
@@ -102,10 +103,10 @@ export class IamManager {
|
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
105
|
* @summary Method to create iam statement to delete s3 objects in buckets
|
|
105
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
106
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
106
107
|
* @param {s3.IBucket} bucket
|
|
107
108
|
*/
|
|
108
|
-
public statementForDeleteAnyS3Objects(scope: CommonConstruct, bucket: s3.IBucket) {
|
|
109
|
+
public statementForDeleteAnyS3Objects(scope: common.CommonConstruct, bucket: s3.IBucket) {
|
|
109
110
|
return new iam.PolicyStatement({
|
|
110
111
|
effect: iam.Effect.ALLOW,
|
|
111
112
|
actions: ['s3:DeleteObject'],
|
|
@@ -115,10 +116,10 @@ export class IamManager {
|
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
118
|
* @summary Method to create iam statement to write s3 objects in buckets
|
|
118
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
119
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
119
120
|
* @param {s3.IBucket} bucket
|
|
120
121
|
*/
|
|
121
|
-
public statementForPutAnyS3Objects(scope: CommonConstruct, bucket: s3.IBucket) {
|
|
122
|
+
public statementForPutAnyS3Objects(scope: common.CommonConstruct, bucket: s3.IBucket) {
|
|
122
123
|
return new iam.PolicyStatement({
|
|
123
124
|
effect: iam.Effect.ALLOW,
|
|
124
125
|
actions: ['s3:PutObject', 's3:PutObjectAcl'],
|
|
@@ -128,9 +129,9 @@ export class IamManager {
|
|
|
128
129
|
|
|
129
130
|
/**
|
|
130
131
|
* @summary Method to create iam statement to pass iam role
|
|
131
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
132
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
132
133
|
*/
|
|
133
|
-
public statementForPassRole(scope: CommonConstruct) {
|
|
134
|
+
public statementForPassRole(scope: common.CommonConstruct) {
|
|
134
135
|
return new iam.PolicyStatement({
|
|
135
136
|
effect: iam.Effect.ALLOW,
|
|
136
137
|
actions: ['iam:PassRole'],
|
|
@@ -140,9 +141,9 @@ export class IamManager {
|
|
|
140
141
|
|
|
141
142
|
/**
|
|
142
143
|
* @summary Method to create iam statement to invalidate cloudfront cache
|
|
143
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
144
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
144
145
|
*/
|
|
145
|
-
public statementForCloudfrontInvalidation(scope: CommonConstruct) {
|
|
146
|
+
public statementForCloudfrontInvalidation(scope: common.CommonConstruct) {
|
|
146
147
|
return new iam.PolicyStatement({
|
|
147
148
|
effect: iam.Effect.ALLOW,
|
|
148
149
|
actions: ['cloudfront:GetInvalidation', 'cloudfront:CreateInvalidation'],
|
|
@@ -152,9 +153,9 @@ export class IamManager {
|
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
155
|
* @summary Method to create iam policy to invalidate cloudfront cache
|
|
155
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
156
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
156
157
|
*/
|
|
157
|
-
public policyForCloudfrontInvalidation(scope: CommonConstruct) {
|
|
158
|
+
public policyForCloudfrontInvalidation(scope: common.CommonConstruct) {
|
|
158
159
|
return new iam.PolicyDocument({
|
|
159
160
|
statements: [
|
|
160
161
|
this.statementForCreateAnyLogStream(),
|
|
@@ -177,9 +178,9 @@ export class IamManager {
|
|
|
177
178
|
/**
|
|
178
179
|
* @summary Method to create iam role to invalidate cloudfront cache
|
|
179
180
|
* @param {string} id scoped id of the resource
|
|
180
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
181
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
181
182
|
*/
|
|
182
|
-
public roleForCloudfrontInvalidation(id: string, scope: CommonConstruct) {
|
|
183
|
+
public roleForCloudfrontInvalidation(id: string, scope: common.CommonConstruct) {
|
|
183
184
|
return new iam.Role(scope, `${id}-install-deps-project-role`, {
|
|
184
185
|
assumedBy: new iam.ServicePrincipal('codebuild.amazonaws.com'),
|
|
185
186
|
inlinePolicies: {
|
|
@@ -190,10 +191,10 @@ export class IamManager {
|
|
|
190
191
|
|
|
191
192
|
/**
|
|
192
193
|
* @summary Method to create iam statement to assume iam role
|
|
193
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
194
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
194
195
|
* @param {iam.ServicePrincipal[]} servicePrincipals
|
|
195
196
|
*/
|
|
196
|
-
public statementForAssumeRole(scope: CommonConstruct, servicePrincipals: iam.ServicePrincipal[]) {
|
|
197
|
+
public statementForAssumeRole(scope: common.CommonConstruct, servicePrincipals: iam.ServicePrincipal[]) {
|
|
197
198
|
return new iam.PolicyStatement({
|
|
198
199
|
effect: iam.Effect.ALLOW,
|
|
199
200
|
actions: ['sts:AssumeRole'],
|
|
@@ -203,9 +204,9 @@ export class IamManager {
|
|
|
203
204
|
|
|
204
205
|
/**
|
|
205
206
|
* @summary Method to create iam statement to pass ecs role
|
|
206
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
207
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
207
208
|
*/
|
|
208
|
-
public statementForEcsPassRole(scope: CommonConstruct) {
|
|
209
|
+
public statementForEcsPassRole(scope: common.CommonConstruct) {
|
|
209
210
|
return new iam.PolicyStatement({
|
|
210
211
|
effect: iam.Effect.ALLOW,
|
|
211
212
|
actions: ['iam:PassRole'],
|
|
@@ -216,11 +217,11 @@ export class IamManager {
|
|
|
216
217
|
|
|
217
218
|
/**
|
|
218
219
|
* @summary Method to create iam statement to run ecs task
|
|
219
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
220
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
220
221
|
* @param {ecs.ICluster} cluster
|
|
221
222
|
* @param {ecs.ITaskDefinition} task
|
|
222
223
|
*/
|
|
223
|
-
public statementForRunEcsTask(scope: CommonConstruct, cluster: ecs.ICluster, task: ecs.ITaskDefinition) {
|
|
224
|
+
public statementForRunEcsTask(scope: common.CommonConstruct, cluster: ecs.ICluster, task: ecs.ITaskDefinition) {
|
|
224
225
|
return new iam.PolicyStatement({
|
|
225
226
|
effect: iam.Effect.ALLOW,
|
|
226
227
|
actions: ['ecs:RunTask'],
|
|
@@ -231,10 +232,10 @@ export class IamManager {
|
|
|
231
232
|
|
|
232
233
|
/**
|
|
233
234
|
* @summary Method to create iam statement to create log stream
|
|
234
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
235
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
235
236
|
* @param {logs.CfnLogGroup} logGroup
|
|
236
237
|
*/
|
|
237
|
-
public statementForCreateLogStream(scope: CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
238
|
+
public statementForCreateLogStream(scope: common.CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
238
239
|
return new iam.PolicyStatement({
|
|
239
240
|
effect: iam.Effect.ALLOW,
|
|
240
241
|
actions: ['logs:CreateLogStream'],
|
|
@@ -260,10 +261,10 @@ export class IamManager {
|
|
|
260
261
|
|
|
261
262
|
/**
|
|
262
263
|
* @summary Method to create iam statement to write log events
|
|
263
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
264
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
264
265
|
* @param {logs.CfnLogGroup} logGroup
|
|
265
266
|
*/
|
|
266
|
-
public statementForPutLogEvent(scope: CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
267
|
+
public statementForPutLogEvent(scope: common.CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
267
268
|
return new iam.PolicyStatement({
|
|
268
269
|
effect: iam.Effect.ALLOW,
|
|
269
270
|
actions: ['logs:PutLogEvents'],
|
|
@@ -290,10 +291,10 @@ export class IamManager {
|
|
|
290
291
|
/**
|
|
291
292
|
* @summary Method to create iam statement for cloud trail
|
|
292
293
|
* @param {string} id scoped id of the resource
|
|
293
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
294
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
294
295
|
* @param {logs.CfnLogGroup} logGroup
|
|
295
296
|
*/
|
|
296
|
-
public createRoleForCloudTrail(id: string, scope: CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
297
|
+
public createRoleForCloudTrail(id: string, scope: common.CommonConstruct, logGroup: logs.CfnLogGroup) {
|
|
297
298
|
const policy = new iam.PolicyDocument({
|
|
298
299
|
statements: [this.statementForCreateLogStream(scope, logGroup), this.statementForPutLogEvent(scope, logGroup)],
|
|
299
300
|
})
|
|
@@ -310,8 +311,8 @@ export class IamManager {
|
|
|
310
311
|
roleName: `${id}-${scope.props.stage}`,
|
|
311
312
|
})
|
|
312
313
|
|
|
313
|
-
createCfnOutput(`${id}Arn`, scope, role.attrArn)
|
|
314
|
-
createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
314
|
+
utils.createCfnOutput(`${id}Arn`, scope, role.attrArn)
|
|
315
|
+
utils.createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
315
316
|
|
|
316
317
|
return role
|
|
317
318
|
}
|
|
@@ -319,11 +320,16 @@ export class IamManager {
|
|
|
319
320
|
/**
|
|
320
321
|
* @summary Method to create iam statement for ecs event
|
|
321
322
|
* @param {string} id scoped id of the resource
|
|
322
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
323
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
323
324
|
* @param {ecs.ICluster} cluster
|
|
324
325
|
* @param {ecs.ITaskDefinition} task
|
|
325
326
|
*/
|
|
326
|
-
public createRoleForEcsEvent(
|
|
327
|
+
public createRoleForEcsEvent(
|
|
328
|
+
id: string,
|
|
329
|
+
scope: common.CommonConstruct,
|
|
330
|
+
cluster: ecs.ICluster,
|
|
331
|
+
task: ecs.ITaskDefinition
|
|
332
|
+
) {
|
|
327
333
|
const policy = new iam.PolicyDocument({
|
|
328
334
|
statements: [this.statementForRunEcsTask(scope, cluster, task), this.statementForEcsPassRole(scope)],
|
|
329
335
|
})
|
|
@@ -335,8 +341,8 @@ export class IamManager {
|
|
|
335
341
|
roleName: `${id}-${scope.props.stage}`,
|
|
336
342
|
})
|
|
337
343
|
|
|
338
|
-
createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
339
|
-
createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
344
|
+
utils.createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
345
|
+
utils.createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
340
346
|
|
|
341
347
|
return role
|
|
342
348
|
}
|
|
@@ -344,10 +350,10 @@ export class IamManager {
|
|
|
344
350
|
/**
|
|
345
351
|
* @summary Method to create iam statement for ecs execution
|
|
346
352
|
* @param {string} id scoped id of the resource
|
|
347
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
353
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
348
354
|
* @param {iam.PolicyDocument} policy
|
|
349
355
|
*/
|
|
350
|
-
public createRoleForEcsExecution(id: string, scope: CommonConstruct, policy: iam.PolicyDocument) {
|
|
356
|
+
public createRoleForEcsExecution(id: string, scope: common.CommonConstruct, policy: iam.PolicyDocument) {
|
|
351
357
|
const role = new iam.Role(scope, `${id}`, {
|
|
352
358
|
assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'),
|
|
353
359
|
description: `Role for ${id} ECS Task execution`,
|
|
@@ -362,8 +368,8 @@ export class IamManager {
|
|
|
362
368
|
roleName: `${id}-${scope.props.stage}`,
|
|
363
369
|
})
|
|
364
370
|
|
|
365
|
-
createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
366
|
-
createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
371
|
+
utils.createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
372
|
+
utils.createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
367
373
|
|
|
368
374
|
return role
|
|
369
375
|
}
|
|
@@ -371,12 +377,18 @@ export class IamManager {
|
|
|
371
377
|
/**
|
|
372
378
|
* @summary Method to create iam statement for lambda execution
|
|
373
379
|
* @param {string} id scoped id of the resource
|
|
374
|
-
* @param {CommonConstruct} scope scope in which this resource is defined
|
|
380
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
375
381
|
* @param {iam.PolicyDocument} policy
|
|
382
|
+
* @param {iam.ServicePrincipal} servicePrinicpal
|
|
376
383
|
*/
|
|
377
|
-
public createRoleForLambda(
|
|
384
|
+
public createRoleForLambda(
|
|
385
|
+
id: string,
|
|
386
|
+
scope: common.CommonConstruct,
|
|
387
|
+
policy: iam.PolicyDocument,
|
|
388
|
+
servicePrinicpal?: iam.ServicePrincipal
|
|
389
|
+
) {
|
|
378
390
|
const role = new iam.Role(scope, `${id}`, {
|
|
379
|
-
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
391
|
+
assumedBy: servicePrinicpal ?? new iam.ServicePrincipal('lambda.amazonaws.com'),
|
|
380
392
|
description: `Role for ${id} Lambda function`,
|
|
381
393
|
inlinePolicies: { policy },
|
|
382
394
|
managedPolicies: [
|
|
@@ -389,8 +401,8 @@ export class IamManager {
|
|
|
389
401
|
roleName: `${id}-${scope.props.stage}`,
|
|
390
402
|
})
|
|
391
403
|
|
|
392
|
-
createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
393
|
-
createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
404
|
+
utils.createCfnOutput(`${id}Arn`, scope, role.roleArn)
|
|
405
|
+
utils.createCfnOutput(`${id}Name`, scope, role.roleName)
|
|
394
406
|
|
|
395
407
|
return role
|
|
396
408
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './acmManager'
|
|
2
|
+
export * from './apiManager'
|
|
3
|
+
export * from './appConfigManager'
|
|
4
|
+
export * from './cloudFrontManager'
|
|
5
|
+
export * from './cloudTrailManager'
|
|
6
|
+
export * from './cloudWatchManager'
|
|
7
|
+
export * from './codeBuildManager'
|
|
8
|
+
export * from './ecrManager'
|
|
9
|
+
export * from './ecsManager'
|
|
10
|
+
export * from './eksManager'
|
|
11
|
+
export * from './eventManager'
|
|
12
|
+
export * from './iamManager'
|
|
13
|
+
export * from './lambdaManager'
|
|
14
|
+
export * from './logManager'
|
|
15
|
+
export * from './route53Manager'
|
|
16
|
+
export * from './s3Manager'
|
|
17
|
+
export * from './secretsManager'
|
|
18
|
+
export * from './snsManager'
|
|
19
|
+
export * from './ssmManager'
|
|
20
|
+
export * from './vpcManager'
|
|
21
|
+
export * from './wafManager'
|