@gradientedge/cdk-utils 7.22.0 → 8.1.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 (49) 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/lambda-manager.d.ts +8 -0
  15. package/dist/src/lib/manager/aws/lambda-manager.js +28 -0
  16. package/dist/src/lib/manager/aws/log-manager.js +3 -3
  17. package/dist/src/lib/manager/aws/route53-manager.js +5 -5
  18. package/dist/src/lib/manager/aws/s3-manager.js +1 -1
  19. package/dist/src/lib/manager/aws/sfn-manager.js +11 -11
  20. package/dist/src/lib/manager/aws/sns-manager.js +2 -2
  21. package/dist/src/lib/manager/aws/sqs-manager.js +1 -1
  22. package/dist/src/lib/manager/aws/ssm-manager.js +3 -3
  23. package/dist/src/lib/manager/aws/vpc-manager.js +1 -1
  24. package/dist/src/lib/manager/aws/waf-manager.js +2 -2
  25. package/dist/src/lib/types/aws/index.d.ts +33 -3
  26. package/package.json +4 -4
  27. package/src/lib/manager/aws/acm-manager.ts +1 -1
  28. package/src/lib/manager/aws/api-manager.ts +1 -0
  29. package/src/lib/manager/aws/app-config-manager.ts +3 -3
  30. package/src/lib/manager/aws/cloudfront-manager.ts +4 -4
  31. package/src/lib/manager/aws/cloudtrail-manager.ts +4 -4
  32. package/src/lib/manager/aws/cloudwatch-manager.ts +312 -7
  33. package/src/lib/manager/aws/dynamodb-manager.ts +1 -1
  34. package/src/lib/manager/aws/ecs-manager.ts +4 -4
  35. package/src/lib/manager/aws/eks-manager.ts +1 -1
  36. package/src/lib/manager/aws/elasticache-manager.ts +5 -7
  37. package/src/lib/manager/aws/event-manager.ts +4 -4
  38. package/src/lib/manager/aws/kms-manager.ts +1 -1
  39. package/src/lib/manager/aws/lambda-manager.ts +36 -0
  40. package/src/lib/manager/aws/log-manager.ts +3 -3
  41. package/src/lib/manager/aws/route53-manager.ts +5 -5
  42. package/src/lib/manager/aws/s3-manager.ts +1 -1
  43. package/src/lib/manager/aws/sfn-manager.ts +11 -11
  44. package/src/lib/manager/aws/sns-manager.ts +2 -2
  45. package/src/lib/manager/aws/sqs-manager.ts +1 -1
  46. package/src/lib/manager/aws/ssm-manager.ts +3 -3
  47. package/src/lib/manager/aws/vpc-manager.ts +1 -1
  48. package/src/lib/manager/aws/waf-manager.ts +2 -2
  49. package/src/lib/types/aws/index.ts +34 -3
@@ -54,12 +54,11 @@ class ElastiCacheManager {
54
54
  * @param {string[]} subnetIds
55
55
  */
56
56
  createElastiCacheSubnetGroup(id, scope, subnetIds) {
57
- const elasticacheSubnetGroup = new elasticache.CfnSubnetGroup(scope, `${id}`, {
57
+ return new elasticache.CfnSubnetGroup(scope, `${id}`, {
58
58
  cacheSubnetGroupName: `${id}-subnet-group-${scope.props.stage}`,
59
59
  subnetIds: subnetIds,
60
60
  description: `${id}-subnet-group-${scope.props.stage}`,
61
61
  });
62
- return elasticacheSubnetGroup;
63
62
  }
64
63
  /**
65
64
  * @summary Method to create an elasticache resource
@@ -72,7 +71,7 @@ class ElastiCacheManager {
72
71
  */
73
72
  createElastiCache(id, scope, props, subnetIds, securityGroupIds, logDeliveryConfigurations) {
74
73
  if (!props)
75
- throw `ElastiCache props undefined`;
74
+ throw `ElastiCache props undefined for ${id}`;
76
75
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
77
76
  const elasticacheCluster = new elasticache.CfnCacheCluster(scope, `${id}`, {
78
77
  engine: props.engine,
@@ -95,7 +94,7 @@ class ElastiCacheManager {
95
94
  snapshotWindow: props.snapshotWindow,
96
95
  logDeliveryConfigurations: logDeliveryConfigurations,
97
96
  });
98
- elasticacheCluster.addDependsOn(subnetGroup);
97
+ elasticacheCluster.addDependency(subnetGroup);
99
98
  utils.createCfnOutput(`${id}-clusterName`, scope, elasticacheCluster.clusterName);
100
99
  utils.createCfnOutput(`${id}-redisEndpointPort`, scope, elasticacheCluster.attrRedisEndpointPort);
101
100
  utils.createCfnOutput(`${id}-redisEndpointAddress`, scope, elasticacheCluster.attrRedisEndpointAddress);
@@ -112,7 +111,7 @@ class ElastiCacheManager {
112
111
  */
113
112
  createReplicatedElastiCache(id, scope, props, subnetIds, securityGroupIds, logDeliveryConfigurations) {
114
113
  if (!props)
115
- throw `ElastiCache props undefined`;
114
+ throw `ElastiCache props undefined for ${id}`;
116
115
  const subnetGroup = this.createElastiCacheSubnetGroup(`${id}-subnetGroup`, scope, subnetIds);
117
116
  const elasticacheCluster = new elasticache.CfnReplicationGroup(scope, `${id}`, {
118
117
  replicationGroupDescription: `${id} Redis Replication Cluster`,
@@ -137,7 +136,7 @@ class ElastiCacheManager {
137
136
  primaryClusterId: props.primaryClusterId,
138
137
  autoMinorVersionUpgrade: props.autoMinorVersionUpgrade,
139
138
  });
140
- elasticacheCluster.addDependsOn(subnetGroup);
139
+ elasticacheCluster.addDependency(subnetGroup);
141
140
  utils.createCfnOutput(`${id}-primaryEndPointPort`, scope, elasticacheCluster.attrPrimaryEndPointPort);
142
141
  utils.createCfnOutput(`${id}-primaryEndPointAddress`, scope, elasticacheCluster.attrPrimaryEndPointAddress);
143
142
  return elasticacheCluster;
@@ -57,7 +57,7 @@ class EventManager {
57
57
  */
58
58
  createEventBus(id, scope, props) {
59
59
  if (!props)
60
- throw 'EventBus props undefined';
60
+ throw `EventBus props undefined for ${id}`;
61
61
  const eventBus = new events.EventBus(scope, `${id}`, {
62
62
  eventBusName: `${props.eventBusName}-${scope.props.stage}`,
63
63
  });
@@ -75,7 +75,7 @@ class EventManager {
75
75
  */
76
76
  createRule(id, scope, props, eventBus, targets) {
77
77
  if (!props)
78
- throw `EventRule props undefined`;
78
+ throw `EventRule props undefined for ${id}`;
79
79
  const rule = new events.Rule(scope, `${id}`, {
80
80
  eventBus: eventBus,
81
81
  description: props.description,
@@ -105,7 +105,7 @@ class EventManager {
105
105
  */
106
106
  createLambdaRule(id, scope, props, lambdaFunction, eventBusName, eventPattern, scheduleExpression) {
107
107
  if (!props)
108
- throw `EventRule props undefined`;
108
+ throw `EventRule props undefined for ${id}`;
109
109
  const eventRule = new events.CfnRule(scope, `${id}`, {
110
110
  description: 'Rule to send notification to lambda function target',
111
111
  eventBusName: eventBusName,
@@ -138,7 +138,7 @@ class EventManager {
138
138
  */
139
139
  createFargateTaskRule(id, scope, props, cluster, task, subnetIds, role, eventPattern) {
140
140
  if (!props)
141
- throw `EventRule props undefined`;
141
+ throw `EventRule props undefined for ${id}`;
142
142
  const eventRule = new events.CfnRule(scope, `${id}`, {
143
143
  description: 'Rule to send notification on new objects in data bucket to ecs task target',
144
144
  eventPattern: eventPattern,
@@ -55,7 +55,7 @@ class KmsManager {
55
55
  */
56
56
  createKey(id, scope, props) {
57
57
  if (!props)
58
- throw `KMS Key props undefined`;
58
+ throw `KMS Key props undefined for ${id}`;
59
59
  const key = new kms.Key(scope, `${id}`, {
60
60
  description: props.description,
61
61
  alias: `${props.alias}-${scope.props.stage}`,
@@ -81,4 +81,12 @@ export declare class LambdaManager {
81
81
  * @param {ec2.SubnetSelection?} vpcSubnets
82
82
  */
83
83
  createLambdaDockerFunction(id: string, scope: common.CommonConstruct, props: types.LambdaProps, role: iam.Role | iam.CfnRole, code: lambda.DockerImageCode, environment?: any, vpc?: ec2.IVpc, securityGroups?: ec2.ISecurityGroup[], accessPoint?: efs.IAccessPoint, mountPath?: string, vpcSubnets?: ec2.SubnetSelection): cdk.aws_lambda.DockerImageFunction;
84
+ /**
85
+ * @summary Method to create a lambda function Alias
86
+ * @param {string} id scoped id of the resource
87
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
88
+ * @param {types.LambdaAliasProps} props
89
+ * @param {types.LambdaAliasProps} lambdaVersion
90
+ */
91
+ createLambdaFunctionAlias(id: string, scope: common.CommonConstruct, props: types.LambdaAliasProps, lambdaVersion: lambda.IVersion): cdk.aws_lambda.Alias;
84
92
  }
@@ -199,5 +199,33 @@ class LambdaManager {
199
199
  utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName);
200
200
  return lambdaFunction;
201
201
  }
202
+ /**
203
+ * @summary Method to create a lambda function Alias
204
+ * @param {string} id scoped id of the resource
205
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
206
+ * @param {types.LambdaAliasProps} props
207
+ * @param {types.LambdaAliasProps} lambdaVersion
208
+ */
209
+ createLambdaFunctionAlias(id, scope, props, lambdaVersion) {
210
+ if (!props)
211
+ throw `Lambda Alias props undefined for ${id}`;
212
+ const lambdaFunctionAlias = new lambda.Alias(scope, `${id}`, {
213
+ ...props,
214
+ ...{
215
+ aliasName: `${id}-lambda-alias`,
216
+ version: lambdaVersion,
217
+ additionalVersions: props.additionalVersions,
218
+ description: props.description,
219
+ maxEventAge: props.maxEventAge,
220
+ onFailure: props.onFailure,
221
+ onSuccess: props.onSuccess,
222
+ provisionedConcurrentExecutions: props.provisionedConcurrentExecutions,
223
+ retryAttempts: props.retryAttempts,
224
+ },
225
+ });
226
+ utils.createCfnOutput(`${id}-lambdaAliasName`, scope, lambdaFunctionAlias.functionArn);
227
+ utils.createCfnOutput(`${id}-lambdaAliasArn`, scope, lambdaFunctionAlias.functionName);
228
+ return lambdaFunctionAlias;
229
+ }
202
230
  }
203
231
  exports.LambdaManager = LambdaManager;
@@ -57,7 +57,7 @@ class LogManager {
57
57
  */
58
58
  createMetricFilter(id, scope, props, logGroup) {
59
59
  if (!props)
60
- throw `MetricFilter props undefined`;
60
+ throw `MetricFilter props undefined for ${id}`;
61
61
  const metricFilter = new logs.MetricFilter(scope, `${id}`, {
62
62
  logGroup: logGroup,
63
63
  metricName: props.metricName,
@@ -83,7 +83,7 @@ class LogManager {
83
83
  */
84
84
  createCfnLogGroup(id, scope, props) {
85
85
  if (!props)
86
- throw `Logs props undefined`;
86
+ throw `Logs props undefined for ${id}`;
87
87
  const logGroup = new logs.CfnLogGroup(scope, `${id}`, {
88
88
  logGroupName: `${props.logGroupName}-${scope.props.stage}`,
89
89
  retentionInDays: props.retention,
@@ -99,7 +99,7 @@ class LogManager {
99
99
  */
100
100
  createLogGroup(id, scope, props) {
101
101
  if (!props)
102
- throw `Logs props undefined`;
102
+ throw `Logs props undefined for ${id}`;
103
103
  const logGroup = new logs.LogGroup(scope, `${id}`, {
104
104
  logGroupName: `${props.logGroupName}-${scope.props.stage}`,
105
105
  retention: props.retention,
@@ -57,7 +57,7 @@ class Route53Manager {
57
57
  createHostedZone(id, scope, props) {
58
58
  let hostedZone;
59
59
  if (!props)
60
- throw `Route53 props undefined`;
60
+ throw `Route53 props undefined for ${id}`;
61
61
  if (props.useExistingHostedZone) {
62
62
  hostedZone = route53.HostedZone.fromLookup(scope, `${id}`, {
63
63
  domainName: scope.props.domainName,
@@ -107,9 +107,9 @@ class Route53Manager {
107
107
  */
108
108
  createCloudFrontTargetARecord(id, scope, distribution, hostedZone, recordName, skipStageFromRecord) {
109
109
  if (!distribution)
110
- throw `Distribution undefined`;
110
+ throw `Distribution undefined for ${id}`;
111
111
  if (!hostedZone)
112
- throw `HostedZone undefined`;
112
+ throw `HostedZone undefined for ${id}`;
113
113
  const aRecord = new route53.ARecord(scope, `${id}`, {
114
114
  recordName: (recordName && scope.isProductionStage()) || skipStageFromRecord
115
115
  ? `${recordName}`
@@ -130,9 +130,9 @@ class Route53Manager {
130
130
  */
131
131
  createCloudFrontTargetARecordV2(id, scope, distribution, hostedZone, recordName) {
132
132
  if (!distribution)
133
- throw `Distribution undefined`;
133
+ throw `Distribution undefined for ${id}`;
134
134
  if (!hostedZone)
135
- throw `HostedZone undefined`;
135
+ throw `HostedZone undefined for ${id}`;
136
136
  const aRecord = new route53.ARecord(scope, `${id}`, {
137
137
  recordName: recordName,
138
138
  target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(distribution)),
@@ -108,7 +108,7 @@ class S3Manager {
108
108
  */
109
109
  createS3Bucket(id, scope, props) {
110
110
  if (!props)
111
- throw `S3 props undefined`;
111
+ throw `S3 props undefined for ${id}`;
112
112
  let bucket;
113
113
  const bucketName = S3Manager.determineBucketName(scope, props);
114
114
  if (props.existingBucket && props.bucketName) {
@@ -57,7 +57,7 @@ class SfnManager {
57
57
  */
58
58
  createSuccessStep(id, scope, props) {
59
59
  if (!props)
60
- throw 'Step props undefined';
60
+ throw `Step props undefined for ${id}`;
61
61
  return new sfn.Succeed(scope, `${props.name}`, {
62
62
  ...props,
63
63
  ...{
@@ -73,7 +73,7 @@ class SfnManager {
73
73
  */
74
74
  createFailStep(id, scope, props) {
75
75
  if (!props)
76
- throw 'Step props undefined';
76
+ throw `Step props undefined for ${id}`;
77
77
  return new sfn.Fail(scope, `${props.name}`, {
78
78
  ...props,
79
79
  ...{
@@ -89,7 +89,7 @@ class SfnManager {
89
89
  */
90
90
  createPassStep(id, scope, props) {
91
91
  if (!props)
92
- throw 'Step props undefined';
92
+ throw `Step props undefined for ${id}`;
93
93
  return new sfn.Pass(scope, `${props.name}`, {
94
94
  ...props,
95
95
  ...{
@@ -105,7 +105,7 @@ class SfnManager {
105
105
  */
106
106
  createParallelStep(id, scope, props) {
107
107
  if (!props)
108
- throw 'Step props undefined';
108
+ throw `Step props undefined for ${id}`;
109
109
  return new sfn.Parallel(scope, `${props.name}`, {
110
110
  ...props,
111
111
  ...{
@@ -121,7 +121,7 @@ class SfnManager {
121
121
  */
122
122
  createChoiceStep(id, scope, props) {
123
123
  if (!props)
124
- throw 'Step props undefined';
124
+ throw `Step props undefined for ${id}`;
125
125
  return new sfn.Choice(scope, `${props.name}`, {
126
126
  ...props,
127
127
  ...{
@@ -154,7 +154,7 @@ class SfnManager {
154
154
  */
155
155
  createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
156
156
  if (!props)
157
- throw 'Step props undefined';
157
+ throw `Step props undefined for ${id}`;
158
158
  return new tasks.DynamoGetItem(scope, `${props.name}`, {
159
159
  ...props,
160
160
  ...{
@@ -185,7 +185,7 @@ class SfnManager {
185
185
  */
186
186
  createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
187
187
  if (!props)
188
- throw 'Step props undefined';
188
+ throw `Step props undefined for ${id}`;
189
189
  return new tasks.DynamoPutItem(scope, `${props.name}`, {
190
190
  ...props,
191
191
  ...{
@@ -217,7 +217,7 @@ class SfnManager {
217
217
  */
218
218
  createSendSqsMessageStep(id, scope, props, queue) {
219
219
  if (!props)
220
- throw 'Step props undefined';
220
+ throw `Step props undefined for ${id}`;
221
221
  if (!props.messageBody)
222
222
  throw 'Message body undefined';
223
223
  return new tasks.SqsSendMessage(scope, `${props.name}`, {
@@ -248,7 +248,7 @@ class SfnManager {
248
248
  */
249
249
  createLambdaStep(id, scope, props, lambdaFunction) {
250
250
  if (!props)
251
- throw 'Step props undefined';
251
+ throw `Step props undefined for ${id}`;
252
252
  return new tasks.LambdaInvoke(scope, `${props.name}`, {
253
253
  ...props,
254
254
  ...{
@@ -266,7 +266,7 @@ class SfnManager {
266
266
  */
267
267
  createApiStep(id, scope, props, api) {
268
268
  if (!props)
269
- throw 'Step props undefined';
269
+ throw `Step props undefined for ${id}`;
270
270
  return new tasks.CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
271
271
  ...props,
272
272
  ...{
@@ -287,7 +287,7 @@ class SfnManager {
287
287
  */
288
288
  createStateMachine(id, scope, props, definition, logGroup, role) {
289
289
  if (!props)
290
- throw 'State Machine props undefined';
290
+ throw `State Machine props undefined for ${id}`;
291
291
  const stateMachine = new sfn.StateMachine(scope, `${id}`, {
292
292
  stateMachineName: `${props.stateMachineName}-${scope.props.stage}`,
293
293
  definition,
@@ -57,7 +57,7 @@ class SnsManager {
57
57
  */
58
58
  createEmailNotificationService(id, scope, props, emails) {
59
59
  if (!props)
60
- throw `Subscription props undefined`;
60
+ throw `Subscription props undefined for ${id}`;
61
61
  const topic = new sns.Topic(scope, id, {
62
62
  displayName: `${props.topicName}-${scope.props.stage}`,
63
63
  topicName: `${props.topicName}-${scope.props.stage}`,
@@ -79,7 +79,7 @@ class SnsManager {
79
79
  */
80
80
  createLambdaNotificationService(id, scope, props, lambdaFunction) {
81
81
  if (!props)
82
- throw `Subscription props undefined`;
82
+ throw `Subscription props undefined for ${id}`;
83
83
  const topic = new sns.Topic(scope, id, {
84
84
  displayName: `${props.topicName}-${scope.props.stage}`,
85
85
  topicName: `${props.topicName}-${scope.props.stage}`,
@@ -57,7 +57,7 @@ class SqsManager {
57
57
  */
58
58
  createQueue(id, scope, props, deadLetterQueue) {
59
59
  if (!props)
60
- throw `Queue props undefined`;
60
+ throw `Queue props undefined for ${id}`;
61
61
  const queue = new sqs.Queue(scope, id, {
62
62
  queueName: props.queueName,
63
63
  visibilityTimeout: props.visibilityTimeoutInSecs
@@ -57,7 +57,7 @@ class SsmManager {
57
57
  */
58
58
  writeStringToParameters(id, scope, props) {
59
59
  if (!props)
60
- throw `Parameter props undefined`;
60
+ throw `Parameter props undefined for ${id}`;
61
61
  const parameter = new ssm.StringParameter(scope, `${id}`, {
62
62
  parameterName: `${props.parameterName}-${scope.props.stage}`,
63
63
  description: `${props.description} - ${scope.props.stage} stage`,
@@ -87,9 +87,9 @@ class SsmManager {
87
87
  */
88
88
  readStringParameterFromRegion(id, scope, parameterName, region) {
89
89
  if (!parameterName || parameterName == '')
90
- throw 'Invalid parameter name';
90
+ throw `Invalid parameter name for ${id}`;
91
91
  if (!region || region == '')
92
- throw 'Invalid region';
92
+ throw `Invalid region for ${id}`;
93
93
  return new SSMParameterReader(scope, `${id}`, {
94
94
  parameterName: parameterName,
95
95
  region: region,
@@ -61,7 +61,7 @@ class VpcManager {
61
61
  */
62
62
  createVpc(id, scope, props) {
63
63
  if (!props)
64
- throw 'Vpc props undefined';
64
+ throw `Vpc props undefined for ${id}`;
65
65
  const vpc = new ec2.Vpc(scope, `${id}`, {
66
66
  maxAzs: props.maxAzs,
67
67
  ipAddresses: props.ipAddresses,
@@ -55,7 +55,7 @@ class WafManager {
55
55
  */
56
56
  createIpSet(id, scope, props) {
57
57
  if (!props)
58
- throw `WAF Ip Set props undefined`;
58
+ throw `WAF Ip Set props undefined for ${id}`;
59
59
  const ipSet = new wafv2.CfnIPSet(scope, `${id}`, {
60
60
  name: scope.isProductionStage() ? props.name : `${props.name}-${scope.props.stage}`,
61
61
  description: `IP Set for ${id} - ${scope.props.stage} stage`,
@@ -75,7 +75,7 @@ class WafManager {
75
75
  */
76
76
  createWebAcl(id, scope, props) {
77
77
  if (!props)
78
- throw `WAF WebACL props undefined`;
78
+ throw `WAF WebACL props undefined for ${id}`;
79
79
  const webAcl = new wafv2.CfnWebACL(scope, `${id}`, {
80
80
  name: scope.isProductionStage() ? props.name : `${props.name}-${scope.props.stage}`,
81
81
  description: `Web Acl for ${id} - ${scope.props.stage} stage`,
@@ -496,12 +496,22 @@ export interface MetricProps extends watch.MetricProps {
496
496
  periodInSecs?: number;
497
497
  functionName?: string;
498
498
  dbClusterIdentifier?: string;
499
+ distributionId?: string;
500
+ loadBalancer?: string;
501
+ serviceName?: string;
502
+ clusterName?: string;
503
+ apiName?: string;
504
+ cacheClusterId?: string;
505
+ stateMachineArn?: string;
506
+ eventBusName?: string;
507
+ ruleName?: string;
499
508
  }
500
509
  /**
501
510
  * @category cdk-utils.cloudwatch-manager
502
511
  * @subcategory Properties
503
512
  */
504
513
  export interface TextWidgetProps extends watch.TextWidgetProps {
514
+ type: string;
505
515
  positionX: number;
506
516
  positionY: number;
507
517
  }
@@ -510,33 +520,47 @@ export interface TextWidgetProps extends watch.TextWidgetProps {
510
520
  * @subcategory Properties
511
521
  */
512
522
  export interface NumericWidgetProps extends watch.SingleValueWidgetProps {
523
+ type: string;
524
+ positionX: number;
525
+ positionY: number;
526
+ metricProps: watch.MetricProps[];
527
+ }
528
+ /**
529
+ * @category cdk-utils.cloudwatch-manager
530
+ * @subcategory Properties
531
+ */
532
+ export interface GuageWidgetProps extends watch.GaugeWidgetProps {
533
+ type: string;
513
534
  positionX: number;
514
535
  positionY: number;
515
- metricProps?: watch.MetricProps[];
536
+ metricProps: watch.MetricProps[];
516
537
  }
517
538
  /**
518
539
  * @category cdk-utils.cloudwatch-manager
519
540
  * @subcategory Properties
520
541
  */
521
542
  export interface GraphWidgetProps extends watch.GraphWidgetProps {
543
+ type: string;
522
544
  positionX: number;
523
545
  positionY: number;
524
- metricProps?: MetricProps[];
546
+ metricProps: MetricProps[];
525
547
  }
526
548
  /**
527
549
  * @category cdk-utils.cloudwatch-manager
528
550
  * @subcategory Properties
529
551
  */
530
552
  export interface AlarmStatusWidgetProps extends watch.AlarmStatusWidgetProps {
553
+ type: string;
531
554
  positionX: number;
532
555
  positionY: number;
533
- alarmProps?: watch.AlarmProps[];
556
+ alarmProps: watch.AlarmProps[];
534
557
  }
535
558
  /**
536
559
  * @category cdk-utils.cloudwatch-manager
537
560
  * @subcategory Properties
538
561
  */
539
562
  export interface LogQueryWidgetProps extends watch.LogQueryWidgetProps {
563
+ type: string;
540
564
  positionX: number;
541
565
  positionY: number;
542
566
  }
@@ -596,6 +620,12 @@ export interface LambdaProps extends lambda.FunctionProps {
596
620
  timeoutInSecs?: number;
597
621
  excludeLastModifiedTimestamp?: boolean;
598
622
  }
623
+ /**
624
+ * @category cdk-utils.lambda-manager
625
+ * @subcategory Properties
626
+ */
627
+ export interface LambdaAliasProps extends lambda.AliasProps {
628
+ }
599
629
  /**
600
630
  * @category cdk-utils.lambda-manager
601
631
  * @subcategory Properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "7.22.0",
3
+ "version": "8.1.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -50,9 +50,9 @@
50
50
  "@types/lodash": "^4.14.191",
51
51
  "@types/node": "^18.11.18",
52
52
  "app-root-path": "^3.1.0",
53
- "aws-cdk-lib": "^2.58.1",
54
- "aws-sdk": "^2.1286.0",
55
- "constructs": "^10.1.208",
53
+ "aws-cdk-lib": "^2.59.0",
54
+ "aws-sdk": "^2.1287.0",
55
+ "constructs": "^10.1.209",
56
56
  "lodash": "^4.17.21",
57
57
  "moment": "^2.29.4",
58
58
  "nconf": "^0.12.0",
@@ -51,7 +51,7 @@ export class AcmManager {
51
51
  props: types.AcmProps,
52
52
  hostedZone?: route53.IHostedZone
53
53
  ): acm.ICertificate {
54
- if (!props) throw `Certificate props undefined`
54
+ if (!props) throw `Certificate props undefined for ${id}`
55
55
 
56
56
  let certificate
57
57
 
@@ -39,6 +39,7 @@ export class ApiManager {
39
39
  props: apig.LambdaRestApiProps,
40
40
  lambdaFunction: lambda.IFunction
41
41
  ) {
42
+ if (!props) throw `Api props undefined for ${id}`
42
43
  const api = new apig.LambdaRestApi(scope, `${id}`, {
43
44
  binaryMediaTypes: props.binaryMediaTypes,
44
45
  minimumCompressionSize: props.minimumCompressionSize,
@@ -73,7 +73,7 @@ export class AppConfigManager {
73
73
  scope: common.CommonConstruct,
74
74
  props: types.AppConfigProps
75
75
  ): appconfig.CfnApplication {
76
- if (!props) throw `AppConfig props undefined`
76
+ if (!props) throw `AppConfig props undefined for ${id}`
77
77
 
78
78
  const application = new appconfig.CfnApplication(scope, `${id}`, {
79
79
  name: `${props.application.name}-${scope.props.stage}`,
@@ -101,7 +101,7 @@ export class AppConfigManager {
101
101
  applicationId: string,
102
102
  props: types.AppConfigProps
103
103
  ): appconfig.CfnEnvironment {
104
- if (!props) throw `AppConfig props undefined`
104
+ if (!props) throw `AppConfig props undefined for ${id}`
105
105
 
106
106
  const environment = new appconfig.CfnEnvironment(scope, `${id}`, {
107
107
  applicationId: applicationId,
@@ -132,7 +132,7 @@ export class AppConfigManager {
132
132
  applicationId: string,
133
133
  props: types.AppConfigProps
134
134
  ): appconfig.CfnConfigurationProfile {
135
- if (!props) throw `AppConfig props undefined`
135
+ if (!props) throw `AppConfig props undefined for ${id}`
136
136
 
137
137
  const profile = new appconfig.CfnConfigurationProfile(scope, `${id}`, {
138
138
  applicationId: applicationId,
@@ -70,9 +70,9 @@ export class CloudFrontManager {
70
70
  certificate?: acm.ICertificate,
71
71
  aliases?: string[]
72
72
  ) {
73
- if (!siteBucket) throw `SiteBucket not defined`
74
- if (!certificate) throw `Certificate not defined`
75
- if (!props) throw `CloudFront props undefined`
73
+ if (!siteBucket) throw `SiteBucket not defined for ${id}`
74
+ if (!certificate) throw `Certificate not defined for ${id}`
75
+ if (!props) throw `CloudFront props undefined for ${id}`
76
76
 
77
77
  const distribution = new cloudfront.CloudFrontWebDistribution(scope, `${id}`, {
78
78
  comment: `${id} - ${scope.props.stage} stage`,
@@ -253,7 +253,7 @@ export class CloudFrontManager {
253
253
  accessPoint?: efs.IAccessPoint,
254
254
  mountPath?: string
255
255
  ) {
256
- if (!props) throw 'EdgeFunction props undefined'
256
+ if (!props) throw `EdgeFunction props undefined for ${id}`
257
257
 
258
258
  const edgeFunction = new cloudfront.experimental.EdgeFunction(scope, `${id}`, {
259
259
  code: code,
@@ -52,7 +52,7 @@ export class CloudTrailManager {
52
52
  logBucket: s3.IBucket,
53
53
  logBucketPolicy: s3.CfnBucketPolicy
54
54
  ) {
55
- if (!props) throw `CloudTrail props undefined`
55
+ if (!props) throw `CloudTrail props undefined for ${id}`
56
56
 
57
57
  const role = scope.iamManager.createRoleForCloudTrail(`${id}Role`, scope, logGroup)
58
58
 
@@ -81,9 +81,9 @@ export class CloudTrailManager {
81
81
  trailName: `${props.trailName}-${scope.props.stage}`,
82
82
  })
83
83
 
84
- cloudTrail.addDependsOn(logBucketPolicy)
85
- cloudTrail.addDependsOn(logGroup)
86
- cloudTrail.addDependsOn(role)
84
+ cloudTrail.addDependency(logBucketPolicy)
85
+ cloudTrail.addDependency(logGroup)
86
+ cloudTrail.addDependency(role)
87
87
 
88
88
  utils.createCfnOutput(`${id}-trailName`, scope, cloudTrail.trailName)
89
89
  utils.createCfnOutput(`${id}-trailArn`, scope, cloudTrail.attrArn)