@gradientedge/cdk-utils 7.21.0 → 8.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.
Files changed (46) hide show
  1. package/dist/src/lib/manager/aws/acm-manager.js +1 -1
  2. package/dist/src/lib/manager/aws/api-manager.js +2 -0
  3. package/dist/src/lib/manager/aws/app-config-manager.js +3 -3
  4. package/dist/src/lib/manager/aws/cloudfront-manager.js +4 -4
  5. package/dist/src/lib/manager/aws/cloudtrail-manager.js +4 -4
  6. package/dist/src/lib/manager/aws/cloudwatch-manager.d.ts +83 -1
  7. package/dist/src/lib/manager/aws/cloudwatch-manager.js +293 -7
  8. package/dist/src/lib/manager/aws/dynamodb-manager.js +1 -1
  9. package/dist/src/lib/manager/aws/ecs-manager.js +4 -4
  10. package/dist/src/lib/manager/aws/eks-manager.js +1 -1
  11. package/dist/src/lib/manager/aws/elasticache-manager.js +5 -6
  12. package/dist/src/lib/manager/aws/event-manager.js +4 -4
  13. package/dist/src/lib/manager/aws/kms-manager.js +1 -1
  14. package/dist/src/lib/manager/aws/log-manager.js +3 -3
  15. package/dist/src/lib/manager/aws/route53-manager.js +5 -5
  16. package/dist/src/lib/manager/aws/s3-manager.js +1 -1
  17. package/dist/src/lib/manager/aws/sfn-manager.js +11 -11
  18. package/dist/src/lib/manager/aws/sns-manager.js +2 -2
  19. package/dist/src/lib/manager/aws/sqs-manager.js +1 -1
  20. package/dist/src/lib/manager/aws/ssm-manager.js +3 -3
  21. package/dist/src/lib/manager/aws/vpc-manager.js +1 -1
  22. package/dist/src/lib/manager/aws/waf-manager.js +2 -2
  23. package/dist/src/lib/types/aws/index.d.ts +27 -3
  24. package/package.json +13 -13
  25. package/src/lib/manager/aws/acm-manager.ts +1 -1
  26. package/src/lib/manager/aws/api-manager.ts +1 -0
  27. package/src/lib/manager/aws/app-config-manager.ts +3 -3
  28. package/src/lib/manager/aws/cloudfront-manager.ts +4 -4
  29. package/src/lib/manager/aws/cloudtrail-manager.ts +4 -4
  30. package/src/lib/manager/aws/cloudwatch-manager.ts +312 -7
  31. package/src/lib/manager/aws/dynamodb-manager.ts +1 -1
  32. package/src/lib/manager/aws/ecs-manager.ts +4 -4
  33. package/src/lib/manager/aws/eks-manager.ts +1 -1
  34. package/src/lib/manager/aws/elasticache-manager.ts +5 -7
  35. package/src/lib/manager/aws/event-manager.ts +4 -4
  36. package/src/lib/manager/aws/kms-manager.ts +1 -1
  37. package/src/lib/manager/aws/log-manager.ts +3 -3
  38. package/src/lib/manager/aws/route53-manager.ts +5 -5
  39. package/src/lib/manager/aws/s3-manager.ts +1 -1
  40. package/src/lib/manager/aws/sfn-manager.ts +11 -11
  41. package/src/lib/manager/aws/sns-manager.ts +2 -2
  42. package/src/lib/manager/aws/sqs-manager.ts +1 -1
  43. package/src/lib/manager/aws/ssm-manager.ts +3 -3
  44. package/src/lib/manager/aws/vpc-manager.ts +1 -1
  45. package/src/lib/manager/aws/waf-manager.ts +2 -2
  46. package/src/lib/types/aws/index.ts +28 -3
@@ -12,6 +12,7 @@ import * as utils from '../../utils'
12
12
  enum CloudWatchWidgetType {
13
13
  Text = 'Text',
14
14
  SingleValue = 'SingleValue',
15
+ Gauge = 'Gauge',
15
16
  Graph = 'Graph',
16
17
  AlarmStatus = 'AlarmStatus',
17
18
  LogQuery = 'LogQuery',
@@ -45,7 +46,7 @@ export class CloudWatchManager {
45
46
  * @param {types.AlarmProps} props
46
47
  */
47
48
  public createAlarmForExpression(id: string, scope: common.CommonConstruct, props: types.AlarmProps) {
48
- if (!props) throw `Alarm props undefined`
49
+ if (!props) throw `Alarm props undefined for ${id}`
49
50
 
50
51
  if (!props.expression) throw `Could not find expression for Alarm props for id:${id}`
51
52
  if (!props.metricProps) throw `Could not find metricProps for Alarm props for id:${id}`
@@ -89,7 +90,7 @@ export class CloudWatchManager {
89
90
  props: types.AlarmProps,
90
91
  metric: watch.Metric
91
92
  ) {
92
- if (!props) throw `Alarm props undefined`
93
+ if (!props) throw `Alarm props undefined for ${id}`
93
94
 
94
95
  const alarm = metric.createAlarm(scope, `${id}`, {
95
96
  alarmName: props.alarmName,
@@ -120,7 +121,7 @@ export class CloudWatchManager {
120
121
  props: types.DashboardProps,
121
122
  widgets?: watch.IWidget[][]
122
123
  ) {
123
- if (!props) throw `Dashboard props undefined`
124
+ if (!props) throw `Dashboard props undefined for ${id}`
124
125
 
125
126
  const dashboard = new watch.Dashboard(scope, `${id}`, {
126
127
  dashboardName: props.dashboardName,
@@ -156,7 +157,7 @@ export class CloudWatchManager {
156
157
  * @param props
157
158
  */
158
159
  public createWidget(id: string, scope: common.CommonConstruct, props: any) {
159
- if (!props) throw `Widget props undefined`
160
+ if (!props) throw `Widget props undefined for ${id}`
160
161
 
161
162
  const metrics = this.determineMetrics(scope, props.metricProps)
162
163
  let alarms,
@@ -166,6 +167,8 @@ export class CloudWatchManager {
166
167
  return this.createTextWidget(id, scope, props)
167
168
  case CloudWatchWidgetType.SingleValue:
168
169
  return this.createSingleValueWidget(id, scope, props, metrics)
170
+ case CloudWatchWidgetType.Gauge:
171
+ return this.createGuageWidget(id, scope, props, metrics)
169
172
  case CloudWatchWidgetType.Graph:
170
173
  return this.createGraphWidget(id, scope, props, metrics)
171
174
  case CloudWatchWidgetType.AlarmStatus:
@@ -175,10 +178,197 @@ export class CloudWatchManager {
175
178
  logGroupNames = props.logGroupNames.map((name: string) => `${name}-${scope.props.stage}`)
176
179
  return this.createLogQueryWidget(id, scope, props, logGroupNames)
177
180
  default:
178
- throw 'Unsupported widget type'
181
+ throw `Unsupported widget type ${props.type}`
179
182
  }
180
183
  }
181
184
 
185
+ /**
186
+ * @summary Method to create a cloudfront distribution widget
187
+ * @param {string} id scoped id of the resource
188
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
189
+ * @param {types.TextWidgetProps} props
190
+ * @param {string} distributionId the cloudfront distribution id
191
+ */
192
+ public createCloudfrontDistributionWidget(
193
+ id: string,
194
+ scope: common.CommonConstruct,
195
+ props: any,
196
+ distributionId: string
197
+ ) {
198
+ if (!props) throw `Widget props undefined for ${id}`
199
+ const metricProps: any[] = props.metricProps
200
+ return this.createWidget(id, scope, {
201
+ ...props,
202
+ ...{
203
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ distributionId: distributionId } })),
204
+ },
205
+ })
206
+ }
207
+
208
+ /**
209
+ * @summary Method to create a step function widget
210
+ * @param {string} id scoped id of the resource
211
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
212
+ * @param {types.TextWidgetProps} props
213
+ * @param {string} stateMachineArn the step function arn
214
+ */
215
+ public createStateWidget(id: string, scope: common.CommonConstruct, props: any, stateMachineArn: string) {
216
+ if (!props) throw `Widget props undefined for ${id}`
217
+ const metricProps: any[] = props.metricProps
218
+ return this.createWidget(id, scope, {
219
+ ...props,
220
+ ...{
221
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ stateMachineArn: stateMachineArn } })),
222
+ },
223
+ })
224
+ }
225
+
226
+ /**
227
+ * @summary Method to create an event widget
228
+ * @param {string} id scoped id of the resource
229
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
230
+ * @param {types.TextWidgetProps} props
231
+ * @param {string} eventBusName the event bus name
232
+ * @param {string} ruleName the event rule name
233
+ */
234
+ public createEventWidget(
235
+ id: string,
236
+ scope: common.CommonConstruct,
237
+ props: any,
238
+ eventBusName: string,
239
+ ruleName: string
240
+ ) {
241
+ if (!props) throw `Widget props undefined for ${id}`
242
+ const metricProps: any[] = props.metricProps
243
+ return this.createWidget(id, scope, {
244
+ ...props,
245
+ ...{
246
+ metricProps: metricProps.map(metricProp => ({
247
+ ...metricProp,
248
+ ...{ eventBusName: eventBusName, ruleName: ruleName },
249
+ })),
250
+ },
251
+ })
252
+ }
253
+
254
+ /**
255
+ * @summary Method to create an api gateway widget
256
+ * @param {string} id scoped id of the resource
257
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
258
+ * @param {types.TextWidgetProps} props
259
+ * @param {string} apiName the api name
260
+ */
261
+ public createApiGatewayWidget(id: string, scope: common.CommonConstruct, props: any, apiName: string) {
262
+ if (!props) throw `Widget props undefined for ${id}`
263
+ const metricProps: any[] = props.metricProps
264
+ return this.createWidget(id, scope, {
265
+ ...props,
266
+ ...{
267
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ apiName: apiName } })),
268
+ },
269
+ })
270
+ }
271
+
272
+ /**
273
+ * @summary Method to create a lambda function widget
274
+ * @param {string} id scoped id of the resource
275
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
276
+ * @param {types.TextWidgetProps} props
277
+ * @param {string} functionName the lambda function name
278
+ */
279
+ public createLambdaWidget(id: string, scope: common.CommonConstruct, props: any, functionName: string) {
280
+ if (!props) throw `Widget props undefined for ${id}`
281
+ const metricProps: any[] = props.metricProps
282
+ return this.createWidget(id, scope, {
283
+ ...props,
284
+ ...{
285
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ functionName: functionName } })),
286
+ },
287
+ })
288
+ }
289
+
290
+ /**
291
+ * @summary Method to create an ecs cluster widget
292
+ * @param {string} id scoped id of the resource
293
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
294
+ * @param {types.TextWidgetProps} props
295
+ * @param {string} clusterName the ecs cluster name
296
+ */
297
+ public createEcsClusterWidget(id: string, scope: common.CommonConstruct, props: any, clusterName: string) {
298
+ if (!props) throw `Widget props undefined for ${id}`
299
+ const metricProps: any[] = props.metricProps
300
+ return this.createWidget(id, scope, {
301
+ ...props,
302
+ ...{
303
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ clusterName: clusterName } })),
304
+ },
305
+ })
306
+ }
307
+
308
+ /**
309
+ * @summary Method to create an ecs service widget
310
+ * @param {string} id scoped id of the resource
311
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
312
+ * @param {types.TextWidgetProps} props
313
+ * @param {string} clusterName the ecs cluster name
314
+ * @param {string} serviceName the ecs service name
315
+ */
316
+ public createEcsServiceWidget(
317
+ id: string,
318
+ scope: common.CommonConstruct,
319
+ props: any,
320
+ clusterName: string,
321
+ serviceName: string
322
+ ) {
323
+ if (!props) throw `Widget props undefined for ${id}`
324
+ const metricProps: any[] = props.metricProps
325
+ return this.createWidget(id, scope, {
326
+ ...props,
327
+ ...{
328
+ metricProps: metricProps.map(metricProp => ({
329
+ ...metricProp,
330
+ ...{ clusterName: clusterName, serviceName: serviceName },
331
+ })),
332
+ },
333
+ })
334
+ }
335
+
336
+ /**
337
+ * @summary Method to create an elb widget
338
+ * @param {string} id scoped id of the resource
339
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
340
+ * @param {types.TextWidgetProps} props
341
+ * @param {string} loadBalancer the loadbalancer reference
342
+ */
343
+ public createElbWidget(id: string, scope: common.CommonConstruct, props: any, loadBalancer: string) {
344
+ if (!props) throw `Widget props undefined for ${id}`
345
+ const metricProps: any[] = props.metricProps
346
+ return this.createWidget(id, scope, {
347
+ ...props,
348
+ ...{
349
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ loadBalancer: loadBalancer } })),
350
+ },
351
+ })
352
+ }
353
+
354
+ /**
355
+ * @summary Method to create an elasticache widget
356
+ * @param {string} id scoped id of the resource
357
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
358
+ * @param {types.TextWidgetProps} props
359
+ * @param {string} cacheClusterId the elasticache cluster id
360
+ */
361
+ public createCacheWidget(id: string, scope: common.CommonConstruct, props: any, cacheClusterId: string) {
362
+ if (!props) throw `Widget props undefined for ${id}`
363
+ const metricProps: any[] = props.metricProps
364
+ return this.createWidget(id, scope, {
365
+ ...props,
366
+ ...{
367
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ cacheClusterId: cacheClusterId } })),
368
+ },
369
+ })
370
+ }
371
+
182
372
  /**
183
373
  * @summary Method to create a cloudwatch text widget
184
374
  * @param {string} id scoped id of the resource
@@ -186,6 +376,7 @@ export class CloudWatchManager {
186
376
  * @param {types.TextWidgetProps} props
187
377
  */
188
378
  public createTextWidget(id: string, scope: common.CommonConstruct, props: types.TextWidgetProps) {
379
+ if (!props) throw `Widget props undefined for ${id}`
189
380
  const widget = new watch.TextWidget({
190
381
  markdown: props.markdown,
191
382
  width: props.width,
@@ -210,10 +401,43 @@ export class CloudWatchManager {
210
401
  props: types.NumericWidgetProps,
211
402
  metrics: IMetric[]
212
403
  ) {
404
+ if (!props) throw `Widget props undefined for ${id}`
213
405
  const widget = new watch.SingleValueWidget({
406
+ region: props.region ?? scope.props.region,
214
407
  metrics: metrics,
215
408
  setPeriodToTimeRange: props.setPeriodToTimeRange,
216
409
  fullPrecision: props.fullPrecision,
410
+ sparkline: props.sparkline,
411
+ title: props.title,
412
+ width: props.width,
413
+ height: props.height,
414
+ })
415
+
416
+ if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
417
+
418
+ return widget
419
+ }
420
+
421
+ /**
422
+ * @summary Method to create a cloudwatch guage widget
423
+ * @param {string} id scoped id of the resource
424
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
425
+ * @param {types.GuageWidgetProps} props
426
+ * @param metrics
427
+ */
428
+ public createGuageWidget(
429
+ id: string,
430
+ scope: common.CommonConstruct,
431
+ props: types.GuageWidgetProps,
432
+ metrics: IMetric[]
433
+ ) {
434
+ if (!props) throw `Widget props undefined for ${id}`
435
+ const widget = new watch.GaugeWidget({
436
+ region: props.region ?? scope.props.region,
437
+ metrics: metrics,
438
+ leftYAxis: props.leftYAxis,
439
+ statistic: props.statistic,
440
+ setPeriodToTimeRange: props.setPeriodToTimeRange,
217
441
  title: props.title,
218
442
  width: props.width,
219
443
  height: props.height,
@@ -239,7 +463,9 @@ export class CloudWatchManager {
239
463
  leftYMetrics?: IMetric[],
240
464
  rightYMetrics?: IMetric[]
241
465
  ) {
466
+ if (!props) throw `Widget props undefined for ${id}`
242
467
  const widget = new watch.GraphWidget({
468
+ region: props.region ?? scope.props.region,
243
469
  left: leftYMetrics,
244
470
  right: rightYMetrics,
245
471
  leftAnnotations: props.leftAnnotations,
@@ -273,6 +499,7 @@ export class CloudWatchManager {
273
499
  props: types.AlarmStatusWidgetProps,
274
500
  alarms: watch.IAlarm[]
275
501
  ) {
502
+ if (!props) throw `Widget props undefined for ${id}`
276
503
  const widget = new watch.AlarmStatusWidget({
277
504
  alarms: alarms,
278
505
  title: props.title,
@@ -298,7 +525,9 @@ export class CloudWatchManager {
298
525
  props: types.LogQueryWidgetProps,
299
526
  logGroupNames: string[]
300
527
  ) {
528
+ if (!props) throw `Widget props undefined for ${id}`
301
529
  const widget = new watch.LogQueryWidget({
530
+ region: props.region ?? scope.props.region,
302
531
  logGroupNames: logGroupNames,
303
532
  queryString: props.queryString,
304
533
  queryLines: props.queryLines,
@@ -327,7 +556,65 @@ export class CloudWatchManager {
327
556
  metricDimensions = {
328
557
  ...metricProp.dimensionsMap,
329
558
  ...{
330
- FunctionName: `${metricProp.functionName}-${scope.props.stage}`,
559
+ FunctionName: `${metricProp.functionName}`,
560
+ },
561
+ }
562
+ }
563
+ if (metricProp.serviceName && metricProp.clusterName) {
564
+ metricDimensions = {
565
+ ...metricProp.dimensionsMap,
566
+ ...{
567
+ ServiceName: `${metricProp.serviceName}`,
568
+ ClusterName: `${metricProp.clusterName}`,
569
+ },
570
+ }
571
+ }
572
+ if (!metricProp.serviceName && metricProp.clusterName) {
573
+ metricDimensions = {
574
+ ...metricProp.dimensionsMap,
575
+ ...{
576
+ ClusterName: `${metricProp.clusterName}`,
577
+ },
578
+ }
579
+ }
580
+ if (metricProp.serviceName && !metricProp.clusterName) {
581
+ metricDimensions = {
582
+ ...metricProp.dimensionsMap,
583
+ ...{
584
+ ServiceName: `${metricProp.serviceName}`,
585
+ },
586
+ }
587
+ }
588
+ if (metricProp.loadBalancer) {
589
+ metricDimensions = {
590
+ ...metricProp.dimensionsMap,
591
+ ...{
592
+ LoadBalancer: `${metricProp.loadBalancer}`,
593
+ },
594
+ }
595
+ }
596
+ if (metricProp.distributionId) {
597
+ metricDimensions = {
598
+ ...metricProp.dimensionsMap,
599
+ ...{
600
+ Region: `Global`,
601
+ DistributionId: `${metricProp.distributionId}`,
602
+ },
603
+ }
604
+ }
605
+ if (metricProp.apiName) {
606
+ metricDimensions = {
607
+ ...metricProp.dimensionsMap,
608
+ ...{
609
+ ApiName: `${metricProp.apiName}`,
610
+ },
611
+ }
612
+ }
613
+ if (metricProp.cacheClusterId) {
614
+ metricDimensions = {
615
+ ...metricProp.dimensionsMap,
616
+ ...{
617
+ CacheClusterId: `${metricProp.cacheClusterId}`,
331
618
  },
332
619
  }
333
620
  }
@@ -335,7 +622,25 @@ export class CloudWatchManager {
335
622
  metricDimensions = {
336
623
  ...metricProp.dimensionsMap,
337
624
  ...{
338
- DBClusterIdentifier: `${metricProp.dbClusterIdentifier}-${scope.props.stage}`,
625
+ DBClusterIdentifier: `${metricProp.dbClusterIdentifier}`,
626
+ },
627
+ }
628
+ }
629
+ if (metricProp.stateMachineArn) {
630
+ metricDimensions = {
631
+ ...metricProp.dimensionsMap,
632
+ ...{
633
+ StateMachineArn: `${metricProp.stateMachineArn}`,
634
+ },
635
+ }
636
+ }
637
+
638
+ if (metricProp.eventBusName && metricProp.ruleName) {
639
+ metricDimensions = {
640
+ ...metricProp.dimensionsMap,
641
+ ...{
642
+ EventBusName: `${metricProp.eventBusName}`,
643
+ RuleName: `${metricProp.ruleName}`,
339
644
  },
340
645
  }
341
646
  }
@@ -31,7 +31,7 @@ export class DynamodbManager {
31
31
  * @param {types.TableProps} props table props
32
32
  */
33
33
  public createTable(id: string, scope: common.CommonConstruct, props: types.TableProps) {
34
- if (!props) throw `Table props undefined`
34
+ if (!props) throw `Table props undefined for ${id}`
35
35
 
36
36
  const table = new dynamodb.Table(scope, `${id}`, {
37
37
  tableName: `${props.tableName}-${scope.props.stage}`,
@@ -37,7 +37,7 @@ export class EcsManager {
37
37
  * @param {ec2.IVpc} vpc
38
38
  */
39
39
  public createEcsCluster(id: string, scope: common.CommonConstruct, props: types.EcsClusterProps, vpc: ec2.IVpc) {
40
- if (!props) throw `Ecs Cluster props undefined`
40
+ if (!props) throw `Ecs Cluster props undefined for ${id}`
41
41
 
42
42
  const ecsCluster = new ecs.Cluster(scope, `${id}`, {
43
43
  clusterName: `${props.clusterName}-${scope.props.stage}`,
@@ -78,7 +78,7 @@ export class EcsManager {
78
78
  environment?: any,
79
79
  secrets?: any
80
80
  ) {
81
- if (!props) throw `EcsTask props undefined`
81
+ if (!props) throw `EcsTask props undefined for ${id}`
82
82
 
83
83
  const ecsTask = new ecs.TaskDefinition(scope, `${id}`, {
84
84
  compatibility: ecs.Compatibility.FARGATE,
@@ -135,8 +135,8 @@ export class EcsManager {
135
135
  cluster: ecs.ICluster,
136
136
  logGroup: logs.ILogGroup
137
137
  ) {
138
- if (!props) throw `EcsLoadbalanced Fargate Serivice props undefined`
139
- if (!props.taskImageOptions) throw `TaskImageOptions for EcsLoadbalanced Fargate Serivice props undefined`
138
+ if (!props) throw `EcsLoadbalanced Fargate Serivice props undefined for ${id}`
139
+ if (!props.taskImageOptions) throw `TaskImageOptions for EcsLoadbalanced Fargate Serivice props undefined for ${id}`
140
140
 
141
141
  const fargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
142
142
  assignPublicIp: props.assignPublicIp ?? true,
@@ -41,7 +41,7 @@ export class EksManager {
41
41
  image: ecr.DockerImageAsset,
42
42
  vpc: ec2.IVpc
43
43
  ) {
44
- if (!props) throw `EksCluster props undefined`
44
+ if (!props) throw `EksCluster props undefined for ${id}`
45
45
 
46
46
  const appLabel = { app: `${id}`.toLowerCase() }
47
47
 
@@ -31,13 +31,11 @@ export class ElastiCacheManager {
31
31
  * @param {string[]} subnetIds
32
32
  */
33
33
  public createElastiCacheSubnetGroup(id: string, scope: common.CommonConstruct, subnetIds: string[]) {
34
- const elasticacheSubnetGroup = new elasticache.CfnSubnetGroup(scope, `${id}`, {
34
+ return new elasticache.CfnSubnetGroup(scope, `${id}`, {
35
35
  cacheSubnetGroupName: `${id}-subnet-group-${scope.props.stage}`,
36
36
  subnetIds: subnetIds,
37
37
  description: `${id}-subnet-group-${scope.props.stage}`,
38
38
  })
39
-
40
- return elasticacheSubnetGroup
41
39
  }
42
40
 
43
41
  /**
@@ -57,7 +55,7 @@ export class ElastiCacheManager {
57
55
  securityGroupIds: string[],
58
56
  logDeliveryConfigurations?: any
59
57
  ) {
60
- if (!props) throw `ElastiCache props undefined`
58
+ if (!props) throw `ElastiCache props undefined for ${id}`
61
59
 
62
60
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
63
61
 
@@ -83,7 +81,7 @@ export class ElastiCacheManager {
83
81
  logDeliveryConfigurations: logDeliveryConfigurations,
84
82
  })
85
83
 
86
- elasticacheCluster.addDependsOn(subnetGroup)
84
+ elasticacheCluster.addDependency(subnetGroup)
87
85
 
88
86
  utils.createCfnOutput(`${id}-clusterName`, scope, elasticacheCluster.clusterName)
89
87
  utils.createCfnOutput(`${id}-redisEndpointPort`, scope, elasticacheCluster.attrRedisEndpointPort)
@@ -109,7 +107,7 @@ export class ElastiCacheManager {
109
107
  securityGroupIds: string[],
110
108
  logDeliveryConfigurations?: any
111
109
  ) {
112
- if (!props) throw `ElastiCache props undefined`
110
+ if (!props) throw `ElastiCache props undefined for ${id}`
113
111
 
114
112
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
115
113
 
@@ -137,7 +135,7 @@ export class ElastiCacheManager {
137
135
  autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
138
136
  })
139
137
 
140
- elasticacheCluster.addDependsOn(subnetGroup)
138
+ elasticacheCluster.addDependency(subnetGroup)
141
139
 
142
140
  utils.createCfnOutput(`${id}-primaryEndPointPort`, scope, elasticacheCluster.attrPrimaryEndPointPort)
143
141
  utils.createCfnOutput(`${id}-primaryEndPointAddress`, scope, elasticacheCluster.attrPrimaryEndPointAddress)
@@ -34,7 +34,7 @@ export class EventManager {
34
34
  * @param {types.EventBusProps} props event bus properties
35
35
  */
36
36
  public createEventBus(id: string, scope: common.CommonConstruct, props: types.EventBusProps) {
37
- if (!props) throw 'EventBus props undefined'
37
+ if (!props) throw `EventBus props undefined for ${id}`
38
38
 
39
39
  const eventBus = new events.EventBus(scope, `${id}`, {
40
40
  eventBusName: `${props.eventBusName}-${scope.props.stage}`,
@@ -61,7 +61,7 @@ export class EventManager {
61
61
  eventBus?: events.IEventBus,
62
62
  targets?: events.IRuleTarget[]
63
63
  ) {
64
- if (!props) throw `EventRule props undefined`
64
+ if (!props) throw `EventRule props undefined for ${id}`
65
65
 
66
66
  const rule = new events.Rule(scope, `${id}`, {
67
67
  eventBus: eventBus,
@@ -103,7 +103,7 @@ export class EventManager {
103
103
  eventPattern?: any,
104
104
  scheduleExpression?: string
105
105
  ) {
106
- if (!props) throw `EventRule props undefined`
106
+ if (!props) throw `EventRule props undefined for ${id}`
107
107
 
108
108
  const eventRule = new events.CfnRule(scope, `${id}`, {
109
109
  description: 'Rule to send notification to lambda function target',
@@ -149,7 +149,7 @@ export class EventManager {
149
149
  role: iam.Role | iam.CfnRole,
150
150
  eventPattern?: any
151
151
  ) {
152
- if (!props) throw `EventRule props undefined`
152
+ if (!props) throw `EventRule props undefined for ${id}`
153
153
 
154
154
  const eventRule = new events.CfnRule(scope, `${id}`, {
155
155
  description: 'Rule to send notification on new objects in data bucket to ecs task target',
@@ -31,7 +31,7 @@ export class KmsManager {
31
31
  * @param {types.AcmProps} props KMS key props
32
32
  */
33
33
  public createKey(id: string, scope: common.CommonConstruct, props: types.KmsKeyProps) {
34
- if (!props) throw `KMS Key props undefined`
34
+ if (!props) throw `KMS Key props undefined for ${id}`
35
35
 
36
36
  const key = new kms.Key(scope, `${id}`, {
37
37
  description: props.description,
@@ -38,7 +38,7 @@ export class LogManager {
38
38
  props: types.MetricFilterProps,
39
39
  logGroup: logs.ILogGroup
40
40
  ) {
41
- if (!props) throw `MetricFilter props undefined`
41
+ if (!props) throw `MetricFilter props undefined for ${id}`
42
42
 
43
43
  const metricFilter = new logs.MetricFilter(scope, `${id}`, {
44
44
  logGroup: logGroup,
@@ -67,7 +67,7 @@ export class LogManager {
67
67
  * @param {types.LogProps} props
68
68
  */
69
69
  public createCfnLogGroup(id: string, scope: common.CommonConstruct, props: types.LogProps) {
70
- if (!props) throw `Logs props undefined`
70
+ if (!props) throw `Logs props undefined for ${id}`
71
71
 
72
72
  const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
73
73
  logGroupName: `${props.logGroupName}-${scope.props.stage}`,
@@ -86,7 +86,7 @@ export class LogManager {
86
86
  * @param {types.LogProps} props
87
87
  */
88
88
  public createLogGroup(id: string, scope: common.CommonConstruct, props: types.LogProps) {
89
- if (!props) throw `Logs props undefined`
89
+ if (!props) throw `Logs props undefined for ${id}`
90
90
 
91
91
  const logGroup = new logs.LogGroup(scope, `${id}`, {
92
92
  logGroupName: `${props.logGroupName}-${scope.props.stage}`,
@@ -36,7 +36,7 @@ export class Route53Manager {
36
36
  public createHostedZone(id: string, scope: common.CommonConstruct, props: types.Route53Props) {
37
37
  let hostedZone: route53.IHostedZone
38
38
 
39
- if (!props) throw `Route53 props undefined`
39
+ if (!props) throw `Route53 props undefined for ${id}`
40
40
 
41
41
  if (props.useExistingHostedZone) {
42
42
  hostedZone = route53.HostedZone.fromLookup(scope, `${id}`, {
@@ -102,8 +102,8 @@ export class Route53Manager {
102
102
  recordName?: string,
103
103
  skipStageFromRecord?: boolean
104
104
  ) {
105
- if (!distribution) throw `Distribution undefined`
106
- if (!hostedZone) throw `HostedZone undefined`
105
+ if (!distribution) throw `Distribution undefined for ${id}`
106
+ if (!hostedZone) throw `HostedZone undefined for ${id}`
107
107
 
108
108
  const aRecord = new route53.ARecord(scope, `${id}`, {
109
109
  recordName:
@@ -134,8 +134,8 @@ export class Route53Manager {
134
134
  hostedZone?: route53.IHostedZone,
135
135
  recordName?: string
136
136
  ) {
137
- if (!distribution) throw `Distribution undefined`
138
- if (!hostedZone) throw `HostedZone undefined`
137
+ if (!distribution) throw `Distribution undefined for ${id}`
138
+ if (!hostedZone) throw `HostedZone undefined for ${id}`
139
139
 
140
140
  const aRecord = new route53.ARecord(scope, `${id}`, {
141
141
  recordName: recordName,
@@ -89,7 +89,7 @@ export class S3Manager {
89
89
  * @param {types.S3BucketProps} props bucket properties
90
90
  */
91
91
  public createS3Bucket(id: string, scope: common.CommonConstruct, props: types.S3BucketProps) {
92
- if (!props) throw `S3 props undefined`
92
+ if (!props) throw `S3 props undefined for ${id}`
93
93
 
94
94
  let bucket: s3.IBucket
95
95