@gradientedge/cdk-utils-aws 1.0.0 → 2.0.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/src/common/stack.d.ts +2 -2
- package/dist/src/common/stack.js +4 -4
- package/dist/src/construct/api-to-any-target/main.js +1 -1
- package/dist/src/construct/api-to-eventbridge-target/main.js +3 -3
- package/dist/src/construct/api-to-eventbridge-target-with-sns/main.js +3 -3
- package/dist/src/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -1
- package/dist/src/construct/api-to-lambda-target/main.js +1 -1
- package/dist/src/construct/api-to-lambda-target/types.d.ts +2 -2
- package/dist/src/construct/rest-api-lambda/types.d.ts +1 -1
- package/dist/src/construct/rest-api-lambda-with-cache/main.d.ts +1 -1
- package/dist/src/construct/site-with-ecs-backend/main.js +3 -3
- package/dist/src/construct/site-with-ecs-backend/types.d.ts +2 -2
- package/dist/src/construct/site-with-lambda-backend/main.js +3 -3
- package/dist/src/construct/static-asset-deployment/main.js +2 -2
- package/dist/src/construct/static-site/main.js +1 -1
- package/dist/src/construct/static-site/types.d.ts +1 -1
- package/dist/src/services/api-gateway/main.js +2 -2
- package/dist/src/services/appconfig/main.js +6 -6
- package/dist/src/services/certificate-manager/main.js +1 -1
- package/dist/src/services/cloudfront/main.js +4 -4
- package/dist/src/services/cloudtrail/main.js +2 -2
- package/dist/src/services/cloudwatch/logs.js +5 -5
- package/dist/src/services/cloudwatch/main.js +27 -27
- package/dist/src/services/dynamodb/main.js +4 -4
- package/dist/src/services/elastic-container-service/main.js +6 -6
- package/dist/src/services/elastic-file-system/main.js +3 -3
- package/dist/src/services/elastic-kubernetes-service/main.js +2 -2
- package/dist/src/services/elasticache/main.js +3 -3
- package/dist/src/services/eventbridge/main.js +15 -15
- package/dist/src/services/eventbridge/target.d.ts +2 -4
- package/dist/src/services/eventbridge/target.js +1 -3
- package/dist/src/services/evidently/main.js +9 -9
- package/dist/src/services/key-management-service/main.js +2 -2
- package/dist/src/services/lambda/main.js +5 -5
- package/dist/src/services/route53/main.js +5 -5
- package/dist/src/services/secrets-manager/main.js +3 -3
- package/dist/src/services/simple-notification-service/main.js +4 -4
- package/dist/src/services/simple-queue-service/main.js +2 -2
- package/dist/src/services/simple-storage-service/main.js +3 -3
- package/dist/src/services/step-function/main.js +15 -15
- package/dist/src/services/systems-manager/main.js +8 -8
- package/dist/src/services/virtual-private-cloud/main.js +2 -2
- package/dist/src/services/web-application-firewall/main.js +4 -4
- package/package.json +12 -12
|
@@ -29,7 +29,7 @@ export class EcsManager {
|
|
|
29
29
|
*/
|
|
30
30
|
createEcsCluster(id, scope, props, vpc) {
|
|
31
31
|
if (!props)
|
|
32
|
-
throw `Ecs Cluster props undefined for ${id}
|
|
32
|
+
throw new Error(`Ecs Cluster props undefined for ${id}`);
|
|
33
33
|
const ecsCluster = new Cluster(scope, `${id}`, {
|
|
34
34
|
...props,
|
|
35
35
|
clusterName: `${props.clusterName}-${scope.props.stage}`,
|
|
@@ -59,7 +59,7 @@ export class EcsManager {
|
|
|
59
59
|
*/
|
|
60
60
|
createEcsFargateTask(id, scope, props, cluster, role, logGroup, containerImage, environment, secrets, command) {
|
|
61
61
|
if (!props)
|
|
62
|
-
throw `EcsTask props undefined for ${id}
|
|
62
|
+
throw new Error(`EcsTask props undefined for ${id}`);
|
|
63
63
|
const ecsTask = new TaskDefinition(scope, `${id}`, {
|
|
64
64
|
...props,
|
|
65
65
|
compatibility: Compatibility.FARGATE,
|
|
@@ -106,13 +106,13 @@ export class EcsManager {
|
|
|
106
106
|
*/
|
|
107
107
|
createLoadBalancedFargateService(id, scope, props, cluster, logGroup) {
|
|
108
108
|
if (!props)
|
|
109
|
-
throw `Ecs Load balanced Fargate Service props undefined for ${id}
|
|
109
|
+
throw new Error(`Ecs Load balanced Fargate Service props undefined for ${id}`);
|
|
110
110
|
if (!props.loadBalancerName)
|
|
111
|
-
throw `Ecs loadBalancerName undefined for ${id}
|
|
111
|
+
throw new Error(`Ecs loadBalancerName undefined for ${id}`);
|
|
112
112
|
if (!props.serviceName)
|
|
113
|
-
throw `Ecs serviceName undefined for ${id}
|
|
113
|
+
throw new Error(`Ecs serviceName undefined for ${id}`);
|
|
114
114
|
if (!props.taskImageOptions)
|
|
115
|
-
throw `TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}
|
|
115
|
+
throw new Error(`TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}`);
|
|
116
116
|
const fargateService = new ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
|
|
117
117
|
...props,
|
|
118
118
|
assignPublicIp: props.assignPublicIp ?? true,
|
|
@@ -40,9 +40,9 @@ export class EfsManager {
|
|
|
40
40
|
*/
|
|
41
41
|
createFileSystem(id, scope, props, vpc, accessPointOptions, securityGroup, vpcSubnets) {
|
|
42
42
|
if (!props)
|
|
43
|
-
throw `EFS props undefined for ${id}
|
|
43
|
+
throw new Error(`EFS props undefined for ${id}`);
|
|
44
44
|
if (!props.fileSystemName)
|
|
45
|
-
throw `EFS fileSystemName undefined for ${id}
|
|
45
|
+
throw new Error(`EFS fileSystemName undefined for ${id}`);
|
|
46
46
|
const fileSystemId = props.provisionNewOnDeployment ? `${id}-${new Date().getMilliseconds()}` : `${id}`;
|
|
47
47
|
const fileSystem = new FileSystem(scope, `${fileSystemId}`, {
|
|
48
48
|
...props,
|
|
@@ -61,7 +61,7 @@ export class EfsManager {
|
|
|
61
61
|
if (accessPointOptions && !_.isEmpty(accessPointOptions)) {
|
|
62
62
|
for (const [index, accessPointOption] of accessPointOptions.entries()) {
|
|
63
63
|
if (!accessPointOption.path)
|
|
64
|
-
throw `Undefined access point path for option: [${accessPointOption}], id: [${id}]
|
|
64
|
+
throw new Error(`Undefined access point path for option: [${accessPointOption}], id: [${id}]`);
|
|
65
65
|
const accessPoint = fileSystem.addAccessPoint(`${id}-ap-${index}`, {
|
|
66
66
|
createAcl: accessPointOption.createAcl ?? DEFAULT_CREATE_ACL,
|
|
67
67
|
path: accessPointOption.path,
|
|
@@ -28,9 +28,9 @@ export class EksManager {
|
|
|
28
28
|
*/
|
|
29
29
|
createEksDeployment(id, scope, props, image, vpc) {
|
|
30
30
|
if (!props)
|
|
31
|
-
throw `EksCluster props undefined for ${id}
|
|
31
|
+
throw new Error(`EksCluster props undefined for ${id}`);
|
|
32
32
|
if (!props.clusterName)
|
|
33
|
-
throw `EksCluster clusterName undefined for ${id}
|
|
33
|
+
throw new Error(`EksCluster clusterName undefined for ${id}`);
|
|
34
34
|
const appLabel = { app: `${id}`.toLowerCase() };
|
|
35
35
|
const deployment = {
|
|
36
36
|
apiVersion: 'apps/v1',
|
|
@@ -43,9 +43,9 @@ export class ElastiCacheManager {
|
|
|
43
43
|
*/
|
|
44
44
|
createElastiCache(id, scope, props, subnetIds, securityGroupIds, logDeliveryConfigurations) {
|
|
45
45
|
if (!props)
|
|
46
|
-
throw `ElastiCache props undefined for ${id}
|
|
46
|
+
throw new Error(`ElastiCache props undefined for ${id}`);
|
|
47
47
|
if (!props.clusterName)
|
|
48
|
-
throw `ElastiCache clusterName undefined for ${id}
|
|
48
|
+
throw new Error(`ElastiCache clusterName undefined for ${id}`);
|
|
49
49
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
50
50
|
const elasticacheCluster = new CfnCacheCluster(scope, `${id}`, {
|
|
51
51
|
...props,
|
|
@@ -75,7 +75,7 @@ export class ElastiCacheManager {
|
|
|
75
75
|
*/
|
|
76
76
|
createReplicatedElastiCache(id, scope, props, subnetIds, securityGroupIds) {
|
|
77
77
|
if (!props)
|
|
78
|
-
throw `ElastiCache props undefined for ${id}
|
|
78
|
+
throw new Error(`ElastiCache props undefined for ${id}`);
|
|
79
79
|
const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
|
|
80
80
|
const elasticacheCluster = new CfnReplicationGroup(scope, `${id}`, {
|
|
81
81
|
...props,
|
|
@@ -30,11 +30,11 @@ export class EventManager {
|
|
|
30
30
|
*/
|
|
31
31
|
createEventBus(id, scope, props) {
|
|
32
32
|
if (!props)
|
|
33
|
-
throw `EventBus props undefined for ${id}
|
|
33
|
+
throw new Error(`EventBus props undefined for ${id}`);
|
|
34
34
|
if (!props.eventBusName)
|
|
35
|
-
throw `EventBus eventBusName undefined for ${id}
|
|
35
|
+
throw new Error(`EventBus eventBusName undefined for ${id}`);
|
|
36
36
|
let eventBusName = props.eventBusName;
|
|
37
|
-
if (eventBusName
|
|
37
|
+
if (eventBusName !== 'default') {
|
|
38
38
|
eventBusName = scope.resourceNameFormatter.format(props.eventBusName, scope.props.resourceNameOptions?.eventbridgeBus);
|
|
39
39
|
}
|
|
40
40
|
const eventBus = new EventBus(scope, `${id}`, {
|
|
@@ -55,9 +55,9 @@ export class EventManager {
|
|
|
55
55
|
*/
|
|
56
56
|
createRule(id, scope, props, eventBus, targets) {
|
|
57
57
|
if (!props)
|
|
58
|
-
throw `EventRule props undefined for ${id}
|
|
58
|
+
throw new Error(`EventRule props undefined for ${id}`);
|
|
59
59
|
if (!props.ruleName)
|
|
60
|
-
throw `EventRule ruleName undefined for ${id}
|
|
60
|
+
throw new Error(`EventRule ruleName undefined for ${id}`);
|
|
61
61
|
const rule = new Rule(scope, `${id}`, {
|
|
62
62
|
...props,
|
|
63
63
|
eventBus,
|
|
@@ -89,9 +89,9 @@ export class EventManager {
|
|
|
89
89
|
*/
|
|
90
90
|
createLambdaRule(id, scope, props, lambdaFunction, eventBusName, eventPattern, scheduleExpression) {
|
|
91
91
|
if (!props)
|
|
92
|
-
throw `EventRule props undefined for ${id}
|
|
92
|
+
throw new Error(`EventRule props undefined for ${id}`);
|
|
93
93
|
if (!props.name)
|
|
94
|
-
throw `EventRule name undefined for ${id}
|
|
94
|
+
throw new Error(`EventRule name undefined for ${id}`);
|
|
95
95
|
const eventRule = new CfnRule(scope, `${id}`, {
|
|
96
96
|
...props,
|
|
97
97
|
description: 'Rule to send notification to lambda function target',
|
|
@@ -135,9 +135,9 @@ export class EventManager {
|
|
|
135
135
|
*/
|
|
136
136
|
createFargateTaskRule(id, scope, props, cluster, task, subnetIds, role, eventPattern) {
|
|
137
137
|
if (!props)
|
|
138
|
-
throw `EventRule props undefined for ${id}
|
|
138
|
+
throw new Error(`EventRule props undefined for ${id}`);
|
|
139
139
|
if (!props.name)
|
|
140
|
-
throw `EventRule name undefined for ${id}
|
|
140
|
+
throw new Error(`EventRule name undefined for ${id}`);
|
|
141
141
|
const eventRule = new CfnRule(scope, `${id}`, {
|
|
142
142
|
...props,
|
|
143
143
|
description: 'Rule to send notification on new objects in data bucket to ecs task target',
|
|
@@ -173,9 +173,9 @@ export class EventManager {
|
|
|
173
173
|
*/
|
|
174
174
|
createSqsToSfnCfnPipe(id, scope, props, sourceQueue, targetStepFunction) {
|
|
175
175
|
if (!props)
|
|
176
|
-
throw `Pipe props undefined for ${id}
|
|
176
|
+
throw new Error(`Pipe props undefined for ${id}`);
|
|
177
177
|
if (!props.name)
|
|
178
|
-
throw `Pipe name undefined for ${id}
|
|
178
|
+
throw new Error(`Pipe name undefined for ${id}`);
|
|
179
179
|
const pipeRole = scope.iamManager.createRoleForSqsToSfnPipe(`${id}-role`, scope, sourceQueue.queueArn, targetStepFunction.stateMachineArn);
|
|
180
180
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
181
181
|
...props,
|
|
@@ -219,9 +219,9 @@ export class EventManager {
|
|
|
219
219
|
*/
|
|
220
220
|
createSqsToLambdaCfnPipe(id, scope, props, sourceQueue, targetLambdaFunction) {
|
|
221
221
|
if (!props)
|
|
222
|
-
throw `Pipe props undefined for ${id}
|
|
222
|
+
throw new Error(`Pipe props undefined for ${id}`);
|
|
223
223
|
if (!props.name)
|
|
224
|
-
throw `Pipe name undefined for ${id}
|
|
224
|
+
throw new Error(`Pipe name undefined for ${id}`);
|
|
225
225
|
const pipeRole = scope.iamManager.createRoleForSqsToLambdaPipe(`${id}-role`, scope, sourceQueue.queueArn, targetLambdaFunction.functionArn);
|
|
226
226
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
227
227
|
...props,
|
|
@@ -262,9 +262,9 @@ export class EventManager {
|
|
|
262
262
|
*/
|
|
263
263
|
createDynamoDbToLambdaCfnPipe(id, scope, props, sourceDynamoDbStreamArn, targetLambdaFunction) {
|
|
264
264
|
if (!props)
|
|
265
|
-
throw `Pipe props undefined for ${id}
|
|
265
|
+
throw new Error(`Pipe props undefined for ${id}`);
|
|
266
266
|
if (!props.name)
|
|
267
|
-
throw `Pipe name undefined for ${id}
|
|
267
|
+
throw new Error(`Pipe name undefined for ${id}`);
|
|
268
268
|
const pipeRole = scope.iamManager.createRoleForDynamoDbToLambdaPipe(`${id}-role`, scope, sourceDynamoDbStreamArn, targetLambdaFunction.functionArn);
|
|
269
269
|
const pipe = new CfnPipe(scope, `${id}`, {
|
|
270
270
|
...props,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRuleTarget, RuleTargetConfig, RuleTargetInput } from 'aws-cdk-lib/aws-events';
|
|
2
2
|
import { TargetBaseProps } from 'aws-cdk-lib/aws-events-targets';
|
|
3
3
|
import { ILogGroup } from 'aws-cdk-lib/aws-logs';
|
|
4
4
|
import { CommonConstruct } from '../../common/index.js';
|
|
@@ -50,8 +50,6 @@ export declare class CloudWatchLogGroupNoPolicy implements IRuleTarget {
|
|
|
50
50
|
constructor(logGroup: ILogGroup, props?: LogGroupNoPolicyProps);
|
|
51
51
|
/**
|
|
52
52
|
* Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
53
|
-
* @param _rule
|
|
54
|
-
* @param _id
|
|
55
53
|
*/
|
|
56
|
-
bind(
|
|
54
|
+
bind(): RuleTargetConfig;
|
|
57
55
|
}
|
|
@@ -41,10 +41,8 @@ export class CloudWatchLogGroupNoPolicy {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
|
|
44
|
-
* @param _rule
|
|
45
|
-
* @param _id
|
|
46
44
|
*/
|
|
47
|
-
bind(
|
|
45
|
+
bind() {
|
|
48
46
|
const logGroupStack = Stack.of(this.logGroup);
|
|
49
47
|
return {
|
|
50
48
|
...bindBaseTargetConfig(this.props),
|
|
@@ -25,9 +25,9 @@ export class EvidentlyManager {
|
|
|
25
25
|
*/
|
|
26
26
|
createProject(id, scope, props) {
|
|
27
27
|
if (!props)
|
|
28
|
-
throw `EvidentlyProject props undefined for ${id}
|
|
28
|
+
throw new Error(`EvidentlyProject props undefined for ${id}`);
|
|
29
29
|
if (!props.name)
|
|
30
|
-
throw `EvidentlyProject name undefined for ${id}
|
|
30
|
+
throw new Error(`EvidentlyProject name undefined for ${id}`);
|
|
31
31
|
const project = new CfnProject(scope, `${id}`, {
|
|
32
32
|
...props,
|
|
33
33
|
description: `${props.description} ${scope.props.stage}`,
|
|
@@ -45,7 +45,7 @@ export class EvidentlyManager {
|
|
|
45
45
|
*/
|
|
46
46
|
createFeature(id, scope, props) {
|
|
47
47
|
if (!props)
|
|
48
|
-
throw `EvidentlyFeature props undefined for ${id}
|
|
48
|
+
throw new Error(`EvidentlyFeature props undefined for ${id}`);
|
|
49
49
|
const feature = new CfnFeature(scope, `${id}`, props);
|
|
50
50
|
createCfnOutput(`${id}-featureArn`, scope, feature.attrArn);
|
|
51
51
|
createCfnOutput(`${id}-featureName`, scope, feature.name);
|
|
@@ -59,9 +59,9 @@ export class EvidentlyManager {
|
|
|
59
59
|
*/
|
|
60
60
|
createLaunch(id, scope, props) {
|
|
61
61
|
if (!props)
|
|
62
|
-
throw `EvidentlyLaunch props undefined for ${id}
|
|
62
|
+
throw new Error(`EvidentlyLaunch props undefined for ${id}`);
|
|
63
63
|
if (!props.name)
|
|
64
|
-
throw `EvidentlyLaunch name undefined for ${id}
|
|
64
|
+
throw new Error(`EvidentlyLaunch name undefined for ${id}`);
|
|
65
65
|
const launch = new CfnLaunch(scope, `${id}`, {
|
|
66
66
|
...props,
|
|
67
67
|
description: `${props.description} ${scope.props.stage}`,
|
|
@@ -79,9 +79,9 @@ export class EvidentlyManager {
|
|
|
79
79
|
*/
|
|
80
80
|
createExperiment(id, scope, props) {
|
|
81
81
|
if (!props)
|
|
82
|
-
throw `EvidentlyExperiment props undefined for ${id}
|
|
82
|
+
throw new Error(`EvidentlyExperiment props undefined for ${id}`);
|
|
83
83
|
if (!props.name)
|
|
84
|
-
throw `EvidentlyExperiment name undefined for ${id}
|
|
84
|
+
throw new Error(`EvidentlyExperiment name undefined for ${id}`);
|
|
85
85
|
const experiment = new CfnExperiment(scope, `${id}`, {
|
|
86
86
|
...props,
|
|
87
87
|
description: `${props.description} ${scope.props.stage}`,
|
|
@@ -99,9 +99,9 @@ export class EvidentlyManager {
|
|
|
99
99
|
*/
|
|
100
100
|
createSegment(id, scope, props) {
|
|
101
101
|
if (!props)
|
|
102
|
-
throw `EvidentlySegment props undefined for ${id}
|
|
102
|
+
throw new Error(`EvidentlySegment props undefined for ${id}`);
|
|
103
103
|
if (!props.name)
|
|
104
|
-
throw `EvidentlySegment name undefined for ${id}
|
|
104
|
+
throw new Error(`EvidentlySegment name undefined for ${id}`);
|
|
105
105
|
const segment = new CfnSegment(scope, `${id}`, {
|
|
106
106
|
...props,
|
|
107
107
|
description: `${props.description} ${scope.props.stage}`,
|
|
@@ -25,9 +25,9 @@ export class KmsManager {
|
|
|
25
25
|
*/
|
|
26
26
|
createKey(id, scope, props) {
|
|
27
27
|
if (!props)
|
|
28
|
-
throw `KMS Key props undefined for ${id}
|
|
28
|
+
throw new Error(`KMS Key props undefined for ${id}`);
|
|
29
29
|
if (!props.alias)
|
|
30
|
-
throw `KMS Key alias undefined for ${id}
|
|
30
|
+
throw new Error(`KMS Key alias undefined for ${id}`);
|
|
31
31
|
const key = new Key(scope, `${id}`, {
|
|
32
32
|
...props,
|
|
33
33
|
alias: scope.resourceNameFormatter.format(props.alias, scope.props.resourceNameOptions?.kms),
|
|
@@ -65,9 +65,9 @@ export class LambdaManager {
|
|
|
65
65
|
*/
|
|
66
66
|
createLambdaFunction(id, scope, props, role, layers, code, handler, environment, vpc, securityGroups, accessPoint, mountPath, vpcSubnets) {
|
|
67
67
|
if (!props)
|
|
68
|
-
throw `Lambda props undefined for ${id}
|
|
68
|
+
throw new Error(`Lambda props undefined for ${id}`);
|
|
69
69
|
if (!props.functionName)
|
|
70
|
-
throw `Lambda functionName undefined for ${id}
|
|
70
|
+
throw new Error(`Lambda functionName undefined for ${id}`);
|
|
71
71
|
const functionName = scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.lambdaFunction);
|
|
72
72
|
let deadLetterQueue;
|
|
73
73
|
if (props.deadLetterQueueEnabled) {
|
|
@@ -166,9 +166,9 @@ export class LambdaManager {
|
|
|
166
166
|
*/
|
|
167
167
|
createLambdaDockerFunction(id, scope, props, role, code, environment, vpc, securityGroups, accessPoint, mountPath, vpcSubnets) {
|
|
168
168
|
if (!props)
|
|
169
|
-
throw `Lambda props undefined for ${id}
|
|
169
|
+
throw new Error(`Lambda props undefined for ${id}`);
|
|
170
170
|
if (!props.functionName)
|
|
171
|
-
throw `Lambda functionName undefined for ${id}
|
|
171
|
+
throw new Error(`Lambda functionName undefined for ${id}`);
|
|
172
172
|
const functionName = scope.resourceNameFormatter.format(props.functionName, scope.props.resourceNameOptions?.lambdaFunction);
|
|
173
173
|
let deadLetterQueue;
|
|
174
174
|
if (props.deadLetterQueueEnabled) {
|
|
@@ -220,7 +220,7 @@ export class LambdaManager {
|
|
|
220
220
|
*/
|
|
221
221
|
createLambdaFunctionAlias(id, scope, props, lambdaVersion) {
|
|
222
222
|
if (!props)
|
|
223
|
-
throw `Lambda Alias props undefined for ${id}
|
|
223
|
+
throw new Error(`Lambda Alias props undefined for ${id}`);
|
|
224
224
|
const lambdaFunctionAlias = new Alias(scope, `${id}`, {
|
|
225
225
|
...props,
|
|
226
226
|
version: lambdaVersion,
|
|
@@ -27,7 +27,7 @@ export class Route53Manager {
|
|
|
27
27
|
createHostedZone(id, scope, props) {
|
|
28
28
|
let hostedZone;
|
|
29
29
|
if (!props)
|
|
30
|
-
throw `Route53 props undefined for ${id}
|
|
30
|
+
throw new Error(`Route53 props undefined for ${id}`);
|
|
31
31
|
if (props.useExistingHostedZone) {
|
|
32
32
|
hostedZone = HostedZone.fromLookup(scope, `${id}`, {
|
|
33
33
|
domainName: scope.props.domainName,
|
|
@@ -77,9 +77,9 @@ export class Route53Manager {
|
|
|
77
77
|
*/
|
|
78
78
|
createCloudFrontTargetARecord(id, scope, distribution, hostedZone, recordName, skipStageFromRecord) {
|
|
79
79
|
if (!distribution)
|
|
80
|
-
throw `Distribution undefined for ${id}
|
|
80
|
+
throw new Error(`Distribution undefined for ${id}`);
|
|
81
81
|
if (!hostedZone)
|
|
82
|
-
throw `HostedZone undefined for ${id}
|
|
82
|
+
throw new Error(`HostedZone undefined for ${id}`);
|
|
83
83
|
const aRecord = new ARecord(scope, `${id}`, {
|
|
84
84
|
recordName: (recordName && scope.isProductionStage()) || skipStageFromRecord
|
|
85
85
|
? `${recordName}`
|
|
@@ -100,9 +100,9 @@ export class Route53Manager {
|
|
|
100
100
|
*/
|
|
101
101
|
createCloudFrontTargetARecordV2(id, scope, distribution, hostedZone, recordName) {
|
|
102
102
|
if (!distribution)
|
|
103
|
-
throw `Distribution undefined for ${id}
|
|
103
|
+
throw new Error(`Distribution undefined for ${id}`);
|
|
104
104
|
if (!hostedZone)
|
|
105
|
-
throw `HostedZone undefined for ${id}
|
|
105
|
+
throw new Error(`HostedZone undefined for ${id}`);
|
|
106
106
|
const aRecord = new ARecord(scope, `${id}`, {
|
|
107
107
|
recordName: recordName,
|
|
108
108
|
target: RecordTarget.fromAlias(new CloudFrontTarget(distribution)),
|
|
@@ -27,9 +27,9 @@ export class SecretsManager {
|
|
|
27
27
|
*/
|
|
28
28
|
createSecret(id, scope, props) {
|
|
29
29
|
if (!props)
|
|
30
|
-
throw `Secret props undefined for ${id}
|
|
30
|
+
throw new Error(`Secret props undefined for ${id}`);
|
|
31
31
|
if (!props.secretName)
|
|
32
|
-
throw `Secret name undefined for ${id}
|
|
32
|
+
throw new Error(`Secret name undefined for ${id}`);
|
|
33
33
|
const secret = new Secret(scope, `${id}`, {
|
|
34
34
|
...props,
|
|
35
35
|
secretName: scope.resourceNameFormatter.format(props.secretName, scope.props.resourceNameOptions?.secret),
|
|
@@ -64,7 +64,7 @@ export class SecretsManager {
|
|
|
64
64
|
});
|
|
65
65
|
const response = await client.send(command);
|
|
66
66
|
if (!response.SecretString)
|
|
67
|
-
throw `Unable to resolve secret for ${secretId}
|
|
67
|
+
throw new Error(`Unable to resolve secret for ${secretId}`);
|
|
68
68
|
const secretString = JSON.parse(response.SecretString);
|
|
69
69
|
return secretString[secretKey];
|
|
70
70
|
}
|
|
@@ -28,9 +28,9 @@ export class SnsManager {
|
|
|
28
28
|
*/
|
|
29
29
|
createEmailNotificationService(id, scope, props, emails) {
|
|
30
30
|
if (!props)
|
|
31
|
-
throw `Subscription props undefined for ${id}
|
|
31
|
+
throw new Error(`Subscription props undefined for ${id}`);
|
|
32
32
|
if (!props.topicName)
|
|
33
|
-
throw `Subscription topicName undefined for ${id}
|
|
33
|
+
throw new Error(`Subscription topicName undefined for ${id}`);
|
|
34
34
|
const topic = new Topic(scope, id, {
|
|
35
35
|
...props,
|
|
36
36
|
displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
|
|
@@ -52,9 +52,9 @@ export class SnsManager {
|
|
|
52
52
|
*/
|
|
53
53
|
createLambdaNotificationService(id, scope, props, lambdaFunction) {
|
|
54
54
|
if (!props)
|
|
55
|
-
throw `Subscription props undefined for ${id}
|
|
55
|
+
throw new Error(`Subscription props undefined for ${id}`);
|
|
56
56
|
if (!props.topicName)
|
|
57
|
-
throw `Subscription topicName undefined for ${id}
|
|
57
|
+
throw new Error(`Subscription topicName undefined for ${id}`);
|
|
58
58
|
const topic = new Topic(scope, id, {
|
|
59
59
|
...props,
|
|
60
60
|
displayName: scope.resourceNameFormatter.format(props.topicName, scope.props.resourceNameOptions?.sns),
|
|
@@ -28,9 +28,9 @@ export class SqsManager {
|
|
|
28
28
|
*/
|
|
29
29
|
createQueue(id, scope, props, deadLetterQueue) {
|
|
30
30
|
if (!props)
|
|
31
|
-
throw `Queue props undefined for ${id}
|
|
31
|
+
throw new Error(`Queue props undefined for ${id}`);
|
|
32
32
|
if (!props.queueName)
|
|
33
|
-
throw `Queue queueName undefined for ${id}
|
|
33
|
+
throw new Error(`Queue queueName undefined for ${id}`);
|
|
34
34
|
let queueName = scope.resourceNameFormatter.format(props.queueName, scope.props.resourceNameOptions?.sqs);
|
|
35
35
|
if (props.fifo)
|
|
36
36
|
queueName += '.fifo';
|
|
@@ -80,7 +80,7 @@ export class S3Manager {
|
|
|
80
80
|
*/
|
|
81
81
|
createS3Bucket(id, scope, props) {
|
|
82
82
|
if (!props)
|
|
83
|
-
throw `S3 props undefined for ${id}
|
|
83
|
+
throw new Error(`S3 props undefined for ${id}`);
|
|
84
84
|
let bucket;
|
|
85
85
|
const bucketName = S3Manager.determineBucketName(scope, props, props.bucketName);
|
|
86
86
|
if (props.existingBucket && props.bucketName) {
|
|
@@ -176,8 +176,8 @@ export class S3Manager {
|
|
|
176
176
|
* @param folders list of folder names to be created in the bucket
|
|
177
177
|
*/
|
|
178
178
|
createBucketFolders(id, scope, bucket, folders) {
|
|
179
|
-
if (!folders || folders.length
|
|
180
|
-
throw `Folder unspecified for ${id}
|
|
179
|
+
if (!folders || folders.length === 0) {
|
|
180
|
+
throw new Error(`Folder unspecified for ${id}`);
|
|
181
181
|
}
|
|
182
182
|
_.forEach(folders, folder => {
|
|
183
183
|
new BucketDeployment(scope, `${id}-${folder}`, {
|
|
@@ -37,7 +37,7 @@ export class SfnManager {
|
|
|
37
37
|
*/
|
|
38
38
|
createSuccessStep(id, scope, props) {
|
|
39
39
|
if (!props)
|
|
40
|
-
throw `Step props undefined for ${id}
|
|
40
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
41
41
|
return new Succeed(scope, `${props.name}`, {
|
|
42
42
|
...props,
|
|
43
43
|
comment: `Succeed step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -51,7 +51,7 @@ export class SfnManager {
|
|
|
51
51
|
*/
|
|
52
52
|
createFailStep(id, scope, props) {
|
|
53
53
|
if (!props)
|
|
54
|
-
throw `Step props undefined for ${id}
|
|
54
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
55
55
|
return new Fail(scope, `${props.name}`, {
|
|
56
56
|
...props,
|
|
57
57
|
comment: `Fail step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -65,7 +65,7 @@ export class SfnManager {
|
|
|
65
65
|
*/
|
|
66
66
|
createPassStep(id, scope, props) {
|
|
67
67
|
if (!props)
|
|
68
|
-
throw `Step props undefined for ${id}
|
|
68
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
69
69
|
return new Pass(scope, `${props.name}`, {
|
|
70
70
|
...props,
|
|
71
71
|
comment: `Pass step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -79,7 +79,7 @@ export class SfnManager {
|
|
|
79
79
|
*/
|
|
80
80
|
createParallelStep(id, scope, props) {
|
|
81
81
|
if (!props)
|
|
82
|
-
throw `Step props undefined for ${id}
|
|
82
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
83
83
|
return new Parallel(scope, `${props.name}`, {
|
|
84
84
|
...props,
|
|
85
85
|
comment: `Parallel step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -93,7 +93,7 @@ export class SfnManager {
|
|
|
93
93
|
*/
|
|
94
94
|
createChoiceStep(id, scope, props) {
|
|
95
95
|
if (!props)
|
|
96
|
-
throw `Step props undefined for ${id}
|
|
96
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
97
97
|
return new Choice(scope, `${props.name}`, {
|
|
98
98
|
...props,
|
|
99
99
|
comment: `Choice step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -122,7 +122,7 @@ export class SfnManager {
|
|
|
122
122
|
*/
|
|
123
123
|
createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
|
|
124
124
|
if (!props)
|
|
125
|
-
throw `Step props undefined for ${id}
|
|
125
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
126
126
|
const step = new DynamoGetItem(scope, `${props.name}`, {
|
|
127
127
|
...props,
|
|
128
128
|
comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -151,7 +151,7 @@ export class SfnManager {
|
|
|
151
151
|
*/
|
|
152
152
|
createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
|
|
153
153
|
if (!props)
|
|
154
|
-
throw `Step props undefined for ${id}
|
|
154
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
155
155
|
const step = new DynamoPutItem(scope, `${props.name}`, {
|
|
156
156
|
...props,
|
|
157
157
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -180,7 +180,7 @@ export class SfnManager {
|
|
|
180
180
|
*/
|
|
181
181
|
createDynamoDbDeleteItemStep(id, scope, props, table, tableKey) {
|
|
182
182
|
if (!props)
|
|
183
|
-
throw `Step props undefined for ${id}
|
|
183
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
184
184
|
const step = new DynamoDeleteItem(scope, `${props.name}`, {
|
|
185
185
|
...props,
|
|
186
186
|
comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -208,9 +208,9 @@ export class SfnManager {
|
|
|
208
208
|
*/
|
|
209
209
|
createSendSqsMessageStep(id, scope, props, queue) {
|
|
210
210
|
if (!props)
|
|
211
|
-
throw `Step props undefined for ${id}
|
|
211
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
212
212
|
if (!props.messageBody)
|
|
213
|
-
throw 'Message body undefined';
|
|
213
|
+
throw new Error('Message body undefined');
|
|
214
214
|
const step = new SqsSendMessage(scope, `${props.name}`, {
|
|
215
215
|
...props,
|
|
216
216
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -237,7 +237,7 @@ export class SfnManager {
|
|
|
237
237
|
*/
|
|
238
238
|
createLambdaStep(id, scope, props, lambdaFunction) {
|
|
239
239
|
if (!props)
|
|
240
|
-
throw `Step props undefined for ${id}
|
|
240
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
241
241
|
const step = new LambdaInvoke(scope, `${props.name}`, {
|
|
242
242
|
...props,
|
|
243
243
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
@@ -265,7 +265,7 @@ export class SfnManager {
|
|
|
265
265
|
*/
|
|
266
266
|
createSkippableLambdaStep(id, scope, props, lambdaFunction, skipExecution) {
|
|
267
267
|
if (!props)
|
|
268
|
-
throw `Step props undefined for ${id}
|
|
268
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
269
269
|
if (skipExecution)
|
|
270
270
|
return this.createPassStep(id, scope, { comment: props.comment, name: props.name });
|
|
271
271
|
const step = new LambdaInvoke(scope, `${props.name}`, {
|
|
@@ -294,7 +294,7 @@ export class SfnManager {
|
|
|
294
294
|
*/
|
|
295
295
|
createApiStep(id, scope, props, api) {
|
|
296
296
|
if (!props)
|
|
297
|
-
throw `Step props undefined for ${id}
|
|
297
|
+
throw new Error(`Step props undefined for ${id}`);
|
|
298
298
|
const step = new CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
|
|
299
299
|
...props,
|
|
300
300
|
api,
|
|
@@ -359,9 +359,9 @@ export class SfnManager {
|
|
|
359
359
|
*/
|
|
360
360
|
createStateMachine(id, scope, props, definition, logGroup, role) {
|
|
361
361
|
if (!props)
|
|
362
|
-
throw `State Machine props undefined for ${id}
|
|
362
|
+
throw new Error(`State Machine props undefined for ${id}`);
|
|
363
363
|
if (!props.stateMachineName)
|
|
364
|
-
throw `State Machine stateMachineName undefined for ${id}
|
|
364
|
+
throw new Error(`State Machine stateMachineName undefined for ${id}`);
|
|
365
365
|
const stateMachine = new StateMachine(scope, `${id}`, {
|
|
366
366
|
...props,
|
|
367
367
|
definitionBody: DefinitionBody.fromChainable(definition),
|
|
@@ -27,9 +27,9 @@ export class SsmManager {
|
|
|
27
27
|
*/
|
|
28
28
|
writeStringToParameters(id, scope, props) {
|
|
29
29
|
if (!props)
|
|
30
|
-
throw `Parameter props undefined for ${id}
|
|
30
|
+
throw new Error(`Parameter props undefined for ${id}`);
|
|
31
31
|
if (!props.parameterName)
|
|
32
|
-
throw `Parameter parameterName undefined for ${id}
|
|
32
|
+
throw new Error(`Parameter parameterName undefined for ${id}`);
|
|
33
33
|
const parameter = new StringParameter(scope, `${id}`, {
|
|
34
34
|
...props,
|
|
35
35
|
description: `${props.description} - ${scope.props.stage} stage`,
|
|
@@ -46,8 +46,8 @@ export class SsmManager {
|
|
|
46
46
|
* @param parameterName parameter name to lookup
|
|
47
47
|
*/
|
|
48
48
|
readStringParameter(id, scope, parameterName) {
|
|
49
|
-
if (!parameterName || parameterName
|
|
50
|
-
throw 'Invalid parameter name';
|
|
49
|
+
if (!parameterName || parameterName === '')
|
|
50
|
+
throw new Error('Invalid parameter name');
|
|
51
51
|
return StringParameter.valueFromLookup(scope, scope.resourceNameFormatter.format(parameterName, scope.props.resourceNameOptions?.ssm));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -58,10 +58,10 @@ export class SsmManager {
|
|
|
58
58
|
* @param region region name to lookup parameter
|
|
59
59
|
*/
|
|
60
60
|
readStringParameterFromRegion(id, scope, parameterName, region) {
|
|
61
|
-
if (!parameterName || parameterName
|
|
62
|
-
throw `Invalid parameter name for ${id}
|
|
63
|
-
if (!region || region
|
|
64
|
-
throw `Invalid region for ${id}
|
|
61
|
+
if (!parameterName || parameterName === '')
|
|
62
|
+
throw new Error(`Invalid parameter name for ${id}`);
|
|
63
|
+
if (!region || region === '')
|
|
64
|
+
throw new Error(`Invalid region for ${id}`);
|
|
65
65
|
return new SSMParameterReader(scope, `${id}`, {
|
|
66
66
|
parameterName: scope.resourceNameFormatter.format(parameterName, scope.props.resourceNameOptions?.ssm),
|
|
67
67
|
region,
|
|
@@ -31,9 +31,9 @@ export class VpcManager {
|
|
|
31
31
|
*/
|
|
32
32
|
createVpc(id, scope, props) {
|
|
33
33
|
if (!props)
|
|
34
|
-
throw `Vpc props undefined for ${id}
|
|
34
|
+
throw new Error(`Vpc props undefined for ${id}`);
|
|
35
35
|
if (!props.vpcName)
|
|
36
|
-
throw `Vpc vpcName undefined for ${id}
|
|
36
|
+
throw new Error(`Vpc vpcName undefined for ${id}`);
|
|
37
37
|
const vpcName = scope.resourceNameFormatter.format(props.vpcName, scope.props.resourceNameOptions?.vpc);
|
|
38
38
|
let vpc;
|
|
39
39
|
if (props.isIPV6) {
|
|
@@ -25,9 +25,9 @@ export class WafManager {
|
|
|
25
25
|
*/
|
|
26
26
|
createIpSet(id, scope, props) {
|
|
27
27
|
if (!props)
|
|
28
|
-
throw `WAF Ip Set props undefined for ${id}
|
|
28
|
+
throw new Error(`WAF Ip Set props undefined for ${id}`);
|
|
29
29
|
if (!props.name)
|
|
30
|
-
throw `WAF Ip Set name undefined for ${id}
|
|
30
|
+
throw new Error(`WAF Ip Set name undefined for ${id}`);
|
|
31
31
|
const ipSet = new CfnIPSet(scope, `${id}`, {
|
|
32
32
|
...props,
|
|
33
33
|
description: `IP Set for ${id} - ${scope.props.stage} stage`,
|
|
@@ -45,9 +45,9 @@ export class WafManager {
|
|
|
45
45
|
*/
|
|
46
46
|
createWebAcl(id, scope, props) {
|
|
47
47
|
if (!props)
|
|
48
|
-
throw `WAF WebACL props undefined for ${id}
|
|
48
|
+
throw new Error(`WAF WebACL props undefined for ${id}`);
|
|
49
49
|
if (!props.name)
|
|
50
|
-
throw `WAF WebACL name undefined for ${id}
|
|
50
|
+
throw new Error(`WAF WebACL name undefined for ${id}`);
|
|
51
51
|
const webAcl = new CfnWebACL(scope, `${id}`, {
|
|
52
52
|
...props,
|
|
53
53
|
description: `Web Acl for ${id} - ${scope.props.stage} stage`,
|