@gradientedge/cdk-utils 8.124.0 → 8.126.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 (44) hide show
  1. package/app/api-destined-function/node_modules/.bin/rimraf +4 -4
  2. package/app/api-destined-function/package.json +2 -2
  3. package/dist/src/lib/aws/services/api-gateway/main.d.ts +2 -2
  4. package/dist/src/lib/aws/services/api-gateway/main.js +8 -28
  5. package/dist/src/lib/aws/services/appconfig/main.d.ts +1 -1
  6. package/dist/src/lib/aws/services/appconfig/main.js +6 -13
  7. package/dist/src/lib/aws/services/cloudfront/main.js +6 -18
  8. package/dist/src/lib/aws/services/cloudtrail/main.js +1 -4
  9. package/dist/src/lib/aws/services/cloudwatch/main.js +25 -66
  10. package/dist/src/lib/aws/services/dynamodb/main.js +1 -16
  11. package/dist/src/lib/aws/services/elastic-container-service/main.js +11 -38
  12. package/dist/src/lib/aws/services/elasticache/main.js +4 -34
  13. package/dist/src/lib/aws/services/eventbridge/main.js +9 -14
  14. package/dist/src/lib/aws/services/key-management-service/main.js +1 -9
  15. package/dist/src/lib/aws/services/lambda/main.d.ts +3 -2
  16. package/dist/src/lib/aws/services/lambda/main.js +48 -64
  17. package/dist/src/lib/aws/services/secrets-manager/main.js +1 -1
  18. package/dist/src/lib/aws/services/simple-notification-service/main.js +2 -2
  19. package/dist/src/lib/aws/services/simple-queue-service/main.js +1 -8
  20. package/dist/src/lib/aws/services/simple-storage-service/main.js +3 -22
  21. package/dist/src/lib/aws/services/step-function/main.js +33 -110
  22. package/dist/src/lib/aws/services/systems-manager/main.js +3 -3
  23. package/dist/src/lib/aws/services/virtual-private-cloud/main.js +1 -2
  24. package/dist/src/lib/aws/services/web-application-firewall/main.js +2 -7
  25. package/package.json +18 -18
  26. package/src/lib/aws/services/api-gateway/main.ts +8 -28
  27. package/src/lib/aws/services/appconfig/main.ts +6 -13
  28. package/src/lib/aws/services/cloudfront/main.ts +6 -18
  29. package/src/lib/aws/services/cloudtrail/main.ts +1 -4
  30. package/src/lib/aws/services/cloudwatch/main.ts +25 -66
  31. package/src/lib/aws/services/dynamodb/main.ts +1 -16
  32. package/src/lib/aws/services/elastic-container-service/main.ts +11 -38
  33. package/src/lib/aws/services/elasticache/main.ts +4 -34
  34. package/src/lib/aws/services/eventbridge/main.ts +9 -14
  35. package/src/lib/aws/services/key-management-service/main.ts +1 -9
  36. package/src/lib/aws/services/lambda/main.ts +57 -73
  37. package/src/lib/aws/services/secrets-manager/main.ts +1 -1
  38. package/src/lib/aws/services/simple-notification-service/main.ts +2 -2
  39. package/src/lib/aws/services/simple-queue-service/main.ts +1 -8
  40. package/src/lib/aws/services/simple-storage-service/main.ts +3 -22
  41. package/src/lib/aws/services/step-function/main.ts +33 -110
  42. package/src/lib/aws/services/systems-manager/main.ts +3 -3
  43. package/src/lib/aws/services/virtual-private-cloud/main.ts +1 -2
  44. package/src/lib/aws/services/web-application-firewall/main.ts +2 -7
@@ -62,19 +62,14 @@ export class CloudWatchManager {
62
62
  })
63
63
 
64
64
  const expression = new watch.MathExpression({
65
+ ...props,
65
66
  expression: props.expression,
66
67
  period: props.periodInSecs ? cdk.Duration.seconds(props.periodInSecs) : cdk.Duration.minutes(5),
67
68
  usingMetrics: metrics,
68
69
  })
69
70
 
70
71
  const alarm = expression.createAlarm(scope, `${id}`, {
71
- alarmDescription: props.alarmDescription,
72
- alarmName: props.alarmName,
73
- comparisonOperator: props.comparisonOperator,
74
- datapointsToAlarm: props.datapointsToAlarm,
75
- evaluationPeriods: props.evaluationPeriods,
76
- threshold: props.threshold,
77
- treatMissingData: props.treatMissingData,
72
+ ...props,
78
73
  })
79
74
 
80
75
  utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
@@ -94,13 +89,7 @@ export class CloudWatchManager {
94
89
  if (!props) throw `Alarm props undefined for ${id}`
95
90
 
96
91
  const alarm = metric.createAlarm(scope, `${id}`, {
97
- alarmDescription: props.alarmDescription,
98
- alarmName: props.alarmName,
99
- comparisonOperator: props.comparisonOperator,
100
- datapointsToAlarm: props.datapointsToAlarm,
101
- evaluationPeriods: props.evaluationPeriods,
102
- threshold: props.threshold,
103
- treatMissingData: props.treatMissingData,
92
+ ...props,
104
93
  })
105
94
 
106
95
  utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
@@ -120,11 +109,10 @@ export class CloudWatchManager {
120
109
  if (!props) throw `Dashboard props undefined for ${id}`
121
110
 
122
111
  const dashboard = new watch.Dashboard(scope, `${id}`, {
123
- dashboardName: props.dashboardName,
112
+ ...props,
124
113
  end: CloudWatchManager.determineTimeRange(props.end),
125
- periodOverride: props.periodOverride,
126
114
  start: CloudWatchManager.determineTimeRange(props.start),
127
- widgets: widgets,
115
+ widgets,
128
116
  })
129
117
 
130
118
  utils.createCfnOutput(`${id}-dashboardName`, scope, props.dashboardName)
@@ -192,7 +180,7 @@ export class CloudWatchManager {
192
180
  const metricProps: any[] = props.metricProps
193
181
  return this.createWidget(id, scope, {
194
182
  ...props,
195
- metricProps: _.map(metricProps, { ..._, distributionId }),
183
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, distributionId })),
196
184
  })
197
185
  }
198
186
 
@@ -208,7 +196,7 @@ export class CloudWatchManager {
208
196
  const metricProps: any[] = props.metricProps
209
197
  return this.createWidget(id, scope, {
210
198
  ...props,
211
- metricProps: _.map(metricProps, { ..._, stateMachineArn }),
199
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, stateMachineArn })),
212
200
  })
213
201
  }
214
202
 
@@ -225,7 +213,7 @@ export class CloudWatchManager {
225
213
  const metricProps: any[] = props.metricProps
226
214
  return this.createWidget(id, scope, {
227
215
  ...props,
228
- metricProps: _.map(metricProps, { ..._, eventBusName, ruleName }),
216
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, eventBusName, ruleName })),
229
217
  })
230
218
  }
231
219
 
@@ -241,7 +229,7 @@ export class CloudWatchManager {
241
229
  const metricProps: any[] = props.metricProps
242
230
  return this.createWidget(id, scope, {
243
231
  ...props,
244
- metricProps: _.map(metricProps, { ..._, apiName }),
232
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, apiName })),
245
233
  })
246
234
  }
247
235
 
@@ -257,7 +245,7 @@ export class CloudWatchManager {
257
245
  const metricProps: any[] = props.metricProps
258
246
  return this.createWidget(id, scope, {
259
247
  ...props,
260
- metricProps: _.map(metricProps, { ..._, functionName }),
248
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, functionName })),
261
249
  })
262
250
  }
263
251
 
@@ -273,7 +261,7 @@ export class CloudWatchManager {
273
261
  const metricProps: any[] = props.metricProps
274
262
  return this.createWidget(id, scope, {
275
263
  ...props,
276
- metricProps: _.map(metricProps, { ..._, service }),
264
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, service })),
277
265
  })
278
266
  }
279
267
 
@@ -289,7 +277,7 @@ export class CloudWatchManager {
289
277
  const metricProps: any[] = props.metricProps
290
278
  return this.createWidget(id, scope, {
291
279
  ...props,
292
- metricProps: _.map(metricProps, { ..._, clusterName }),
280
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, clusterName })),
293
281
  })
294
282
  }
295
283
 
@@ -312,7 +300,7 @@ export class CloudWatchManager {
312
300
  const metricProps: any[] = props.metricProps
313
301
  return this.createWidget(id, scope, {
314
302
  ...props,
315
- metricProps: _.map(metricProps, { ..._, clusterName, serviceName }),
303
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, clusterName, serviceName })),
316
304
  })
317
305
  }
318
306
 
@@ -328,7 +316,7 @@ export class CloudWatchManager {
328
316
  const metricProps: any[] = props.metricProps
329
317
  return this.createWidget(id, scope, {
330
318
  ...props,
331
- metricProps: _.map(metricProps, { ..._, loadBalancer }),
319
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, loadBalancer })),
332
320
  })
333
321
  }
334
322
 
@@ -344,7 +332,7 @@ export class CloudWatchManager {
344
332
  const metricProps: any[] = props.metricProps
345
333
  return this.createWidget(id, scope, {
346
334
  ...props,
347
- metricProps: _.map(metricProps, { ..._, cacheClusterId }),
335
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, cacheClusterId })),
348
336
  })
349
337
  }
350
338
 
@@ -357,9 +345,7 @@ export class CloudWatchManager {
357
345
  public createTextWidget(id: string, scope: CommonConstruct, props: TextWidgetProps) {
358
346
  if (!props) throw `Widget props undefined for ${id}`
359
347
  const widget = new watch.TextWidget({
360
- height: props.height,
361
- markdown: props.markdown,
362
- width: props.width,
348
+ ...props,
363
349
  })
364
350
 
365
351
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -377,14 +363,9 @@ export class CloudWatchManager {
377
363
  public createSingleValueWidget(id: string, scope: CommonConstruct, props: NumericWidgetProps, metrics: IMetric[]) {
378
364
  if (!props) throw `Widget props undefined for ${id}`
379
365
  const widget = new watch.SingleValueWidget({
380
- fullPrecision: props.fullPrecision,
381
- height: props.height,
382
- metrics: metrics,
366
+ ...props,
367
+ metrics,
383
368
  region: props.region ?? scope.props.region,
384
- setPeriodToTimeRange: props.setPeriodToTimeRange,
385
- sparkline: props.sparkline,
386
- title: props.title,
387
- width: props.width,
388
369
  })
389
370
 
390
371
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -402,14 +383,9 @@ export class CloudWatchManager {
402
383
  public createGuageWidget(id: string, scope: CommonConstruct, props: GuageWidgetProps, metrics: IMetric[]) {
403
384
  if (!props) throw `Widget props undefined for ${id}`
404
385
  const widget = new watch.GaugeWidget({
405
- height: props.height,
406
- leftYAxis: props.leftYAxis,
407
- metrics: metrics,
386
+ ...props,
387
+ metrics,
408
388
  region: props.region ?? scope.props.region,
409
- setPeriodToTimeRange: props.setPeriodToTimeRange,
410
- statistic: props.statistic,
411
- title: props.title,
412
- width: props.width,
413
389
  })
414
390
 
415
391
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -434,20 +410,10 @@ export class CloudWatchManager {
434
410
  ) {
435
411
  if (!props) throw `Widget props undefined for ${id}`
436
412
  const widget = new watch.GraphWidget({
437
- height: props.height,
413
+ ...props,
438
414
  left: leftYMetrics,
439
- leftAnnotations: props.leftAnnotations,
440
- leftYAxis: props.leftYAxis,
441
- legendPosition: props.legendPosition,
442
- liveData: props.liveData,
443
415
  region: props.region ?? scope.props.region,
444
416
  right: rightYMetrics,
445
- rightAnnotations: props.rightAnnotations,
446
- rightYAxis: props.rightYAxis,
447
- stacked: props.stacked,
448
- title: props.title,
449
- view: props.view,
450
- width: props.width,
451
417
  })
452
418
 
453
419
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -470,10 +436,8 @@ export class CloudWatchManager {
470
436
  ) {
471
437
  if (!props) throw `Widget props undefined for ${id}`
472
438
  const widget = new watch.AlarmStatusWidget({
473
- alarms: alarms,
474
- height: props.height,
475
- title: props.title,
476
- width: props.width,
439
+ ...props,
440
+ alarms,
477
441
  })
478
442
 
479
443
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -491,14 +455,9 @@ export class CloudWatchManager {
491
455
  public createLogQueryWidget(id: string, scope: CommonConstruct, props: LogQueryWidgetProps, logGroupNames: string[]) {
492
456
  if (!props) throw `Widget props undefined for ${id}`
493
457
  const widget = new watch.LogQueryWidget({
494
- height: props.height,
495
- logGroupNames: logGroupNames,
496
- queryLines: props.queryLines,
497
- queryString: props.queryString,
458
+ ...props,
459
+ logGroupNames,
498
460
  region: props.region ?? scope.props.region,
499
- title: props.title,
500
- view: props.view,
501
- width: props.width,
502
461
  })
503
462
 
504
463
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -32,23 +32,8 @@ export class DynamodbManager {
32
32
  if (!props) throw `Table props undefined for ${id}`
33
33
 
34
34
  const table = new Table(scope, `${id}`, {
35
- billingMode: props.billingMode,
36
- contributorInsightsEnabled: props.contributorInsightsEnabled,
37
- encryption: props.encryption,
38
- encryptionKey: props.encryptionKey,
39
- kinesisStream: props.kinesisStream,
40
- partitionKey: props.partitionKey,
41
- pointInTimeRecovery: props.pointInTimeRecovery,
42
- readCapacity: props.readCapacity,
43
- removalPolicy: props.removalPolicy,
44
- replicationRegions: props.replicationRegions,
45
- replicationTimeout: props.replicationTimeout,
46
- sortKey: props.sortKey,
47
- stream: props.stream,
35
+ ...props,
48
36
  tableName: `${props.tableName}-${scope.props.stage}`,
49
- timeToLiveAttribute: props.timeToLiveAttribute,
50
- waitForReplicationToFinish: props.waitForReplicationToFinish,
51
- writeCapacity: props.writeCapacity,
52
37
  })
53
38
 
54
39
  if (props.tags && !_.isEmpty(props.tags)) {
@@ -47,13 +47,9 @@ export class EcsManager {
47
47
  if (!props) throw `Ecs Cluster props undefined for ${id}`
48
48
 
49
49
  const ecsCluster = new Cluster(scope, `${id}`, {
50
- capacity: props.capacity,
50
+ ...props,
51
51
  clusterName: `${props.clusterName}-${scope.props.stage}`,
52
- containerInsights: props.containerInsights,
53
- defaultCloudMapNamespace: props.defaultCloudMapNamespace,
54
- enableFargateCapacityProviders: props.enableFargateCapacityProviders,
55
- executeCommandConfiguration: props.executeCommandConfiguration,
56
- vpc: vpc,
52
+ vpc,
57
53
  })
58
54
 
59
55
  if (props.tags && !_.isEmpty(props.tags)) {
@@ -96,41 +92,33 @@ export class EcsManager {
96
92
  if (!props) throw `EcsTask props undefined for ${id}`
97
93
 
98
94
  const ecsTask = new TaskDefinition(scope, `${id}`, {
95
+ ...props,
99
96
  compatibility: Compatibility.FARGATE,
100
- cpu: props.cpu,
101
- ephemeralStorageGiB: props.ephemeralStorageGiB,
102
97
  executionRole: role,
103
98
  family: `${props.family}-${scope.props.stage}`,
104
- inferenceAccelerators: props.inferenceAccelerators,
105
- ipcMode: props.ipcMode,
106
- memoryMiB: props.memoryMiB,
107
99
  networkMode: NetworkMode.AWS_VPC,
108
- pidMode: props.pidMode,
109
- placementConstraints: props.placementConstraints,
110
- proxyConfiguration: props.proxyConfiguration,
111
100
  runtimePlatform: {
112
101
  cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
113
102
  operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
114
103
  },
115
104
  taskRole: role,
116
- volumes: props.volumes,
117
105
  })
118
106
 
119
107
  ecsTask.addContainer('EcsContainer', {
120
- command: command,
108
+ command,
121
109
  cpu: props.cpu ? parseInt(props.cpu) : undefined,
122
110
  disableNetworking: false,
123
- environment: environment,
111
+ environment,
124
112
  image: containerImage,
125
113
  logging: LogDriver.awsLogs({
126
- logGroup: logGroup,
114
+ logGroup,
127
115
  logRetention: props.logging?.logRetention,
128
116
  multilinePattern: props.logging?.multilinePattern,
129
117
  streamPrefix: `${id}`,
130
118
  }),
131
119
  memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
132
120
  privileged: false,
133
- secrets: secrets,
121
+ secrets,
134
122
  })
135
123
 
136
124
  if (props.tags && !_.isEmpty(props.tags)) {
@@ -164,29 +152,20 @@ export class EcsManager {
164
152
  throw `TaskImageOptions for Ecs Load balanced Fargate Service props undefined for ${id}`
165
153
 
166
154
  const fargateService = new ApplicationLoadBalancedFargateService(scope, `${id}-ecs-service`, {
155
+ ...props,
167
156
  assignPublicIp: props.assignPublicIp ?? true,
168
- certificate: props.certificate,
169
- cluster: cluster,
170
- cpu: props.cpu,
171
- desiredCount: props.desiredCount,
172
- domainName: props.domainName,
173
- domainZone: props.domainZone,
157
+ cluster,
174
158
  enableECSManagedTags: true,
175
159
  healthCheckGracePeriod: props.healthCheckGracePeriod ?? Duration.seconds(60),
176
- listenerPort: props.listenerPort,
177
160
  loadBalancerName: `${id}-${scope.props.stage}`,
178
- memoryLimitMiB: props.memoryLimitMiB,
179
161
  runtimePlatform: {
180
162
  cpuArchitecture: props.runtimePlatform?.cpuArchitecture ?? CpuArchitecture.X86_64,
181
163
  operatingSystemFamily: props.runtimePlatform?.operatingSystemFamily ?? OperatingSystemFamily.LINUX,
182
164
  },
183
165
  serviceName: `${id}-${scope.props.stage}`,
184
166
  taskImageOptions: {
185
- containerPort: props.taskImageOptions?.containerPort,
167
+ ...props.taskImageOptions,
186
168
  enableLogging: props.taskImageOptions?.enableLogging ?? true,
187
- environment: props.taskImageOptions?.environment,
188
- executionRole: props.taskImageOptions?.executionRole,
189
- image: props.taskImageOptions.image,
190
169
  logDriver:
191
170
  props.taskImageOptions?.logDriver ??
192
171
  LogDriver.awsLogs({
@@ -195,21 +174,15 @@ export class EcsManager {
195
174
  multilinePattern: props.logging?.multilinePattern,
196
175
  streamPrefix: `${id}-${scope.props.stage}/ecs`,
197
176
  }),
198
- secrets: props.taskImageOptions?.secrets,
199
- taskRole: props.taskImageOptions?.taskRole,
200
177
  },
201
178
  })
202
179
 
203
180
  if (props.healthCheck) {
204
181
  fargateService.targetGroup.configureHealthCheck({
182
+ ...props.healthCheck,
205
183
  enabled: props.healthCheck.enabled ?? true,
206
- healthyGrpcCodes: props.healthCheck.healthyGrpcCodes,
207
- healthyHttpCodes: props.healthCheck.healthyHttpCodes,
208
- healthyThresholdCount: props.healthCheck.healthyThresholdCount,
209
184
  interval: props.healthCheck.interval ?? Duration.seconds(props.healthCheck.intervalInSecs),
210
185
  path: props.healthCheck.path ?? '/',
211
- port: props.healthCheck.port,
212
- protocol: props.healthCheck.protocol,
213
186
  timeout: props.healthCheck.timeout ?? Duration.seconds(props.healthCheck.timeoutInSecs),
214
187
  unhealthyThresholdCount: props.healthCheck.unhealthyThresholdCount,
215
188
  })
@@ -58,24 +58,10 @@ export class ElastiCacheManager {
58
58
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
59
59
 
60
60
  const elasticacheCluster = new CfnCacheCluster(scope, `${id}`, {
61
- autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
62
- azMode: props.azMode,
63
- cacheNodeType: props.cacheNodeType,
64
- cacheParameterGroupName: props.cacheParameterGroupName,
65
- cacheSecurityGroupNames: props.cacheSecurityGroupNames,
61
+ ...props,
66
62
  cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
67
63
  clusterName: `${id}-${scope.props.stage}`,
68
- engine: props.engine,
69
- engineVersion: props.engineVersion,
70
- logDeliveryConfigurations: logDeliveryConfigurations,
71
- numCacheNodes: props.numCacheNodes,
72
- port: props.port,
73
- preferredAvailabilityZones: props.preferredAvailabilityZones,
74
- preferredMaintenanceWindow: props.preferredMaintenanceWindow,
75
- snapshotArns: props.snapshotArns,
76
- snapshotName: props.snapshotName,
77
- snapshotRetentionLimit: props.snapshotRetentionLimit,
78
- snapshotWindow: props.snapshotWindow,
64
+ logDeliveryConfigurations,
79
65
  vpcSecurityGroupIds: securityGroupIds,
80
66
  })
81
67
 
@@ -114,27 +100,11 @@ export class ElastiCacheManager {
114
100
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds)
115
101
 
116
102
  const elasticacheCluster = new CfnReplicationGroup(scope, `${id}`, {
117
- autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
118
- automaticFailoverEnabled: props.automaticFailoverEnabled,
119
- cacheNodeType: props.cacheNodeType,
120
- cacheParameterGroupName: props.cacheParameterGroupName,
121
- cacheSecurityGroupNames: props.cacheSecurityGroupNames,
103
+ ...props,
122
104
  cacheSubnetGroupName: subnetGroup.cacheSubnetGroupName,
123
- engine: props.engine,
124
- engineVersion: props.engineVersion,
125
- globalReplicationGroupId: props.globalReplicationGroupId,
126
- logDeliveryConfigurations: props.logDeliveryConfigurations,
127
- multiAzEnabled: props.multiAzEnabled,
128
- numCacheClusters: props.numCacheClusters,
129
- numNodeGroups: props.numNodeGroups,
130
- port: props.port,
131
- preferredCacheClusterAZs: props.preferredCacheClusterAZs,
132
- preferredMaintenanceWindow: props.preferredMaintenanceWindow,
133
- primaryClusterId: props.primaryClusterId,
134
- replicasPerNodeGroup: props.replicasPerNodeGroup,
135
105
  replicationGroupDescription: `${id} Redis Replication Cluster`,
136
106
  replicationGroupId: `${id}-${scope.props.stage}`,
137
- securityGroupIds: securityGroupIds,
107
+ securityGroupIds,
138
108
  })
139
109
 
140
110
  elasticacheCluster.addDependency(subnetGroup)
@@ -38,6 +38,7 @@ export class EventManager {
38
38
  if (!props) throw `EventBus props undefined for ${id}`
39
39
 
40
40
  const eventBus = new EventBus(scope, `${id}`, {
41
+ ...props,
41
42
  eventBusName: `${props.eventBusName}-${scope.props.stage}`,
42
43
  })
43
44
 
@@ -65,12 +66,9 @@ export class EventManager {
65
66
  if (!props) throw `EventRule props undefined for ${id}`
66
67
 
67
68
  const rule = new Rule(scope, `${id}`, {
68
- description: props.description,
69
- enabled: props.enabled,
70
- eventBus: eventBus,
71
- eventPattern: props.eventPattern,
69
+ ...props,
70
+ eventBus,
72
71
  ruleName: `${props.ruleName}-${scope.props.stage}`,
73
- schedule: props.schedule,
74
72
  })
75
73
 
76
74
  if (targets && !_.isEmpty(targets)) {
@@ -113,12 +111,12 @@ export class EventManager {
113
111
  if (!props) throw `EventRule props undefined for ${id}`
114
112
 
115
113
  const eventRule = new CfnRule(scope, `${id}`, {
114
+ ...props,
116
115
  description: 'Rule to send notification to lambda function target',
117
- eventBusName: eventBusName,
118
- eventPattern: eventPattern,
116
+ eventBusName,
117
+ eventPattern,
119
118
  name: `${props.name}-${scope.props.stage}`,
120
- scheduleExpression: scheduleExpression,
121
- state: props.state,
119
+ scheduleExpression,
122
120
  targets: [
123
121
  {
124
122
  arn: lambdaFunction.functionArn,
@@ -165,10 +163,10 @@ export class EventManager {
165
163
  if (!props) throw `EventRule props undefined for ${id}`
166
164
 
167
165
  const eventRule = new CfnRule(scope, `${id}`, {
166
+ ...props,
168
167
  description: 'Rule to send notification on new objects in data bucket to ecs task target',
169
- eventPattern: eventPattern,
168
+ eventPattern,
170
169
  name: `${props.name}-${scope.props.stage}`,
171
- state: props.state,
172
170
  targets: [
173
171
  {
174
172
  arn: cluster.clusterArn,
@@ -216,9 +214,6 @@ export class EventManager {
216
214
 
217
215
  const pipe = new CfnPipe(scope, `${id}`, {
218
216
  ...props,
219
- description: props.description,
220
- enrichment: props.enrichment,
221
- enrichmentParameters: props.enrichmentParameters,
222
217
  name: `${props.name}-${scope.props.stage}`,
223
218
  roleArn: pipeRole.roleArn,
224
219
  source: sourceQueue.queueArn,
@@ -30,16 +30,8 @@ export class KmsManager {
30
30
  if (!props) throw `KMS Key props undefined for ${id}`
31
31
 
32
32
  const key = new Key(scope, `${id}`, {
33
- admins: props.admins,
33
+ ...props,
34
34
  alias: `${props.alias}-${scope.props.stage}`,
35
- description: props.description,
36
- enableKeyRotation: props.enableKeyRotation,
37
- enabled: props.enabled,
38
- keySpec: props.keySpec,
39
- keyUsage: props.keyUsage,
40
- pendingWindow: props.pendingWindow,
41
- policy: props.policy,
42
- removalPolicy: props.removalPolicy,
43
35
  })
44
36
 
45
37
  createCfnOutput(`${id}-keyId`, scope, key.keyId)
@@ -44,10 +44,12 @@ export class LambdaManager {
44
44
  * @param id scoped id of the resource
45
45
  * @param scope scope in which this resource is defined
46
46
  * @param code
47
+ * @param architectures
47
48
  */
48
- public createLambdaLayer(id: string, scope: CommonConstruct, code: AssetCode) {
49
+ public createLambdaLayer(id: string, scope: CommonConstruct, code: AssetCode, architectures?: Architecture[]) {
49
50
  const lambdaLayer = new LayerVersion(scope, `${id}`, {
50
51
  code: code,
52
+ compatibleArchitectures: architectures ?? [Architecture.ARM_64],
51
53
  compatibleRuntimes: [scope.props.nodejsRuntime ?? CommonStack.NODEJS_RUNTIME],
52
54
  description: `${id}`,
53
55
  layerVersionName: `${id}-${scope.props.stage}`,
@@ -101,39 +103,36 @@ export class LambdaManager {
101
103
 
102
104
  const lambdaFunction = new Function(scope, `${id}`, {
103
105
  ...props,
104
- ...{
105
- allowPublicSubnet: !!vpc,
106
- architecture: props.architecture ?? Architecture.ARM_64,
107
- code: code,
108
- deadLetterQueue: deadLetterQueue,
109
- environment: {
110
- LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
111
- ? ''
112
- : scope.ssmManager.readStringParameter(
113
- `${id}-sm-ts`,
114
- scope,
115
- `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
116
- ),
117
- REGION: scope.props.region,
118
- STAGE: scope.props.stage,
119
- ...environment,
120
- },
121
- filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
122
- functionName: functionName,
123
- handler: handler || 'index.lambda_handler',
124
- insightsVersion: props.insightsVersion,
125
- layers: layers,
126
- logRetention: scope.props.logRetention ?? props.logRetention,
127
- reservedConcurrentExecutions:
128
- props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
129
- role: role instanceof Role ? role : undefined,
130
- runtime: props.runtime ?? scope.props.nodejsRuntime ?? CommonStack.NODEJS_RUNTIME,
131
- securityGroups: securityGroups,
132
- timeout: props.timeoutInSecs ? Duration.seconds(props.timeoutInSecs) : Duration.minutes(15),
133
- tracing: scope.props.defaultTracing ?? props.tracing,
134
- vpc,
135
- vpcSubnets,
106
+ allowPublicSubnet: !!vpc,
107
+ architecture: props.architecture ?? Architecture.ARM_64,
108
+ code,
109
+ deadLetterQueue,
110
+ environment: {
111
+ LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
112
+ ? ''
113
+ : scope.ssmManager.readStringParameter(
114
+ `${id}-sm-ts`,
115
+ scope,
116
+ `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
117
+ ),
118
+ REGION: scope.props.region,
119
+ STAGE: scope.props.stage,
120
+ ...environment,
136
121
  },
122
+ filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
123
+ functionName,
124
+ handler: handler || 'index.lambda_handler',
125
+ layers,
126
+ logRetention: scope.props.logRetention ?? props.logRetention,
127
+ reservedConcurrentExecutions:
128
+ props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
129
+ role: role instanceof Role ? role : undefined,
130
+ runtime: props.runtime ?? scope.props.nodejsRuntime ?? CommonStack.NODEJS_RUNTIME,
131
+ securityGroups,
132
+ timeout: props.timeoutInSecs ? Duration.seconds(props.timeoutInSecs) : Duration.minutes(15),
133
+ tracing: scope.props.defaultTracing ?? props.tracing,
134
+ vpc,
135
+ vpcSubnets,
137
136
  })
138
137
 
139
138
  if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
@@ -254,36 +253,31 @@ export class LambdaManager {
254
253
 
255
254
  const lambdaFunction = new DockerImageFunction(scope, `${id}`, {
256
255
  ...props,
257
- ...{
258
- allowPublicSubnet: !!vpc,
259
- architecture: props.architecture ?? Architecture.ARM_64,
260
- code: code,
261
- deadLetterQueue: deadLetterQueue,
262
- environment: {
263
- LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
264
- ? ''
265
- : scope.ssmManager.readStringParameter(
266
- `${id}-sm-ts`,
267
- scope,
268
- `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
269
- ),
270
- REGION: scope.props.region,
271
- STAGE: scope.props.stage,
272
- ...environment,
273
- },
274
- filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
275
- functionName: functionName,
276
- insightsVersion: props.insightsVersion,
277
- logRetention: scope.props.logRetention ?? props.logRetention,
278
- reservedConcurrentExecutions: props.reservedConcurrentExecutions,
279
- role: role instanceof Role ? role : undefined,
280
- runtime: props.runtime ?? scope.props.nodejsRuntime ?? CommonStack.NODEJS_RUNTIME,
281
- securityGroups: securityGroups,
282
- timeout: props.timeoutInSecs ? Duration.seconds(props.timeoutInSecs) : Duration.minutes(1),
283
- tracing: props.tracing,
284
- vpc,
285
- vpcSubnets,
256
+ allowPublicSubnet: !!vpc,
257
+ architecture: props.architecture ?? Architecture.ARM_64,
258
+ code,
259
+ deadLetterQueue,
260
+ environment: {
261
+ LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
262
+ ? ''
263
+ : scope.ssmManager.readStringParameter(
264
+ `${id}-sm-ts`,
265
+ scope,
266
+ `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
267
+ ),
268
+ REGION: scope.props.region,
269
+ STAGE: scope.props.stage,
270
+ ...environment,
286
271
  },
272
+ filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
273
+ functionName,
274
+ logRetention: scope.props.logRetention ?? props.logRetention,
275
+ role: role instanceof Role ? role : undefined,
276
+ securityGroups: securityGroups,
277
+ timeout: props.timeoutInSecs ? Duration.seconds(props.timeoutInSecs) : Duration.minutes(1),
278
+ tracing: props.tracing,
279
+ vpc,
280
+ vpcSubnets,
287
281
  })
288
282
 
289
283
  if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
@@ -318,17 +312,7 @@ export class LambdaManager {
318
312
 
319
313
  const lambdaFunctionAlias = new Alias(scope, `${id}`, {
320
314
  ...props,
321
- ...{
322
- additionalVersions: props.additionalVersions,
323
- aliasName: props.aliasName,
324
- description: props.description,
325
- maxEventAge: props.maxEventAge,
326
- onFailure: props.onFailure,
327
- onSuccess: props.onSuccess,
328
- provisionedConcurrentExecutions: props.provisionedConcurrentExecutions,
329
- retryAttempts: props.retryAttempts,
330
- version: lambdaVersion,
331
- },
315
+ version: lambdaVersion,
332
316
  })
333
317
 
334
318
  createCfnOutput(`${id}-lambdaAliasName`, scope, lambdaFunctionAlias.functionArn)