@gradientedge/cdk-utils 8.91.0 → 8.93.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 (223) hide show
  1. package/.eslintrc.json +40 -0
  2. package/app/api-destined-function/src/lib/lambda.ts +6 -6
  3. package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
  4. package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
  5. package/dist/lib/lambda.d.ts +6 -6
  6. package/dist/lib/lambda.js +6 -6
  7. package/dist/lib/lambda.js.map +1 -1
  8. package/dist/src/lib/common/construct.d.ts +4 -7
  9. package/dist/src/lib/common/construct.js +4 -7
  10. package/dist/src/lib/common/stack.d.ts +9 -13
  11. package/dist/src/lib/common/stack.js +9 -13
  12. package/dist/src/lib/common/types.d.ts +0 -2
  13. package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
  14. package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
  15. package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
  16. package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
  17. package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
  18. package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
  19. package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
  20. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
  21. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
  22. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
  23. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
  24. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
  25. package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
  26. package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
  27. package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
  28. package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
  29. package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
  30. package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +1 -19
  31. package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
  32. package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
  33. package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
  34. package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
  35. package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
  36. package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
  37. package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
  38. package/dist/src/lib/construct/rest-api-lambda/main.d.ts +1 -19
  39. package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
  40. package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
  41. package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
  42. package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
  43. package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
  44. package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
  45. package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
  46. package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
  47. package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
  48. package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
  49. package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
  50. package/dist/src/lib/construct/static-site/main.d.ts +0 -17
  51. package/dist/src/lib/construct/static-site/main.js +1 -18
  52. package/dist/src/lib/construct/static-site/types.d.ts +9 -11
  53. package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
  54. package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
  55. package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
  56. package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
  57. package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
  58. package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
  59. package/dist/src/lib/services/aws/appconfig/main.js +19 -22
  60. package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
  61. package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
  62. package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
  63. package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
  64. package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
  65. package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
  66. package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
  67. package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
  68. package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
  69. package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
  70. package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
  71. package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
  72. package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
  73. package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
  74. package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
  75. package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
  76. package/dist/src/lib/services/aws/codebuild/main.js +3 -7
  77. package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
  78. package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
  79. package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
  80. package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
  81. package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
  82. package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
  83. package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
  84. package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
  85. package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
  86. package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
  87. package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
  88. package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
  89. package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
  90. package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
  91. package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
  92. package/dist/src/lib/services/aws/elasticache/main.js +35 -39
  93. package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
  94. package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
  95. package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
  96. package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
  97. package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
  98. package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
  99. package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
  100. package/dist/src/lib/services/aws/evidently/main.js +19 -23
  101. package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
  102. package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
  103. package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
  104. package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
  105. package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
  106. package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
  107. package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
  108. package/dist/src/lib/services/aws/lambda/main.js +64 -69
  109. package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
  110. package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
  111. package/dist/src/lib/services/aws/route53/main.js +19 -23
  112. package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
  113. package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
  114. package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
  115. package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
  116. package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
  117. package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
  118. package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
  119. package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
  120. package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
  121. package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
  122. package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
  123. package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
  124. package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
  125. package/dist/src/lib/services/aws/step-function/main.js +91 -95
  126. package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
  127. package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
  128. package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
  129. package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
  130. package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
  131. package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
  132. package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
  133. package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
  134. package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
  135. package/dist/src/lib/types/aws/index.d.ts +0 -2
  136. package/dist/src/lib/utils/aws/index.d.ts +6 -9
  137. package/dist/src/lib/utils/aws/index.js +7 -10
  138. package/dist/src/lib/utils/index.d.ts +6 -13
  139. package/dist/src/lib/utils/index.js +4 -12
  140. package/package.json +1 -1
  141. package/src/lib/common/construct.ts +4 -7
  142. package/src/lib/common/stack.ts +9 -13
  143. package/src/lib/common/types.ts +0 -2
  144. package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
  145. package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
  146. package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
  147. package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
  148. package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
  149. package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
  150. package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
  151. package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
  152. package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
  153. package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
  154. package/src/lib/construct/graphql-api-lambda/main.ts +2 -20
  155. package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
  156. package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
  157. package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
  158. package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
  159. package/src/lib/construct/rest-api-lambda/main.ts +2 -20
  160. package/src/lib/construct/rest-api-lambda/types.ts +6 -10
  161. package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
  162. package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
  163. package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
  164. package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
  165. package/src/lib/construct/static-asset-deployment/main.ts +0 -8
  166. package/src/lib/construct/static-asset-deployment/types.ts +1 -1
  167. package/src/lib/construct/static-site/main.ts +1 -18
  168. package/src/lib/construct/static-site/types.ts +9 -11
  169. package/src/lib/services/aws/api-gateway/main.ts +43 -47
  170. package/src/lib/services/aws/api-gateway/types.ts +0 -2
  171. package/src/lib/services/aws/appconfig/constants.ts +26 -32
  172. package/src/lib/services/aws/appconfig/main.ts +19 -22
  173. package/src/lib/services/aws/appconfig/types.ts +1 -3
  174. package/src/lib/services/aws/certificate-manager/main.ts +5 -10
  175. package/src/lib/services/aws/certificate-manager/types.ts +3 -5
  176. package/src/lib/services/aws/cloudfront/main.ts +56 -62
  177. package/src/lib/services/aws/cloudfront/types.ts +1 -7
  178. package/src/lib/services/aws/cloudtrail/main.ts +8 -12
  179. package/src/lib/services/aws/cloudtrail/types.ts +0 -2
  180. package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
  181. package/src/lib/services/aws/cloudwatch/main.ts +116 -122
  182. package/src/lib/services/aws/cloudwatch/types.ts +20 -42
  183. package/src/lib/services/aws/codebuild/main.ts +3 -7
  184. package/src/lib/services/aws/dynamodb/main.ts +13 -17
  185. package/src/lib/services/aws/dynamodb/types.ts +0 -2
  186. package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
  187. package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
  188. package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
  189. package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
  190. package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
  191. package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
  192. package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
  193. package/src/lib/services/aws/elasticache/main.ts +35 -39
  194. package/src/lib/services/aws/elasticache/types.ts +0 -4
  195. package/src/lib/services/aws/eventbridge/main.ts +34 -38
  196. package/src/lib/services/aws/eventbridge/target.ts +8 -11
  197. package/src/lib/services/aws/eventbridge/types.ts +2 -10
  198. package/src/lib/services/aws/evidently/main.ts +19 -23
  199. package/src/lib/services/aws/evidently/types.ts +0 -10
  200. package/src/lib/services/aws/identity-access-management/main.ts +97 -101
  201. package/src/lib/services/aws/key-management-service/main.ts +6 -10
  202. package/src/lib/services/aws/key-management-service/types.ts +0 -2
  203. package/src/lib/services/aws/lambda/main.ts +64 -69
  204. package/src/lib/services/aws/lambda/types.ts +6 -16
  205. package/src/lib/services/aws/route53/main.ts +19 -23
  206. package/src/lib/services/aws/route53/types.ts +0 -2
  207. package/src/lib/services/aws/secrets-manager/main.ts +6 -28
  208. package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
  209. package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
  210. package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
  211. package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
  212. package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
  213. package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
  214. package/src/lib/services/aws/step-function/main.ts +91 -95
  215. package/src/lib/services/aws/step-function/types.ts +0 -32
  216. package/src/lib/services/aws/systems-manager/main.ts +13 -19
  217. package/src/lib/services/aws/systems-manager/types.ts +0 -2
  218. package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
  219. package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
  220. package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
  221. package/src/lib/types/aws/index.ts +0 -2
  222. package/src/lib/utils/aws/index.ts +7 -10
  223. package/src/lib/utils/index.ts +4 -12
@@ -16,8 +16,6 @@ import {
16
16
  } from './types'
17
17
 
18
18
  /**
19
- * @category cdk-utils.cloudwatch-manager
20
- * @subcategory Construct
21
19
  */
22
20
  enum CloudWatchWidgetType {
23
21
  Text = 'Text',
@@ -29,9 +27,6 @@ enum CloudWatchWidgetType {
29
27
  }
30
28
 
31
29
  /**
32
- * @stability stable
33
- * @category cdk-utils.cloudwatch-manager
34
- * @subcategory Construct
35
30
  * @classdesc Provides operations on AWS CloudWatch.
36
31
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
37
32
  * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
@@ -45,15 +40,14 @@ enum CloudWatchWidgetType {
45
40
  * this.cloudWatchManager.createAlarmForMetric('MyAlarm', this, metric)
46
41
  * }
47
42
  * }
48
- *
49
43
  * @see [CDK CloudWatch Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch-readme.html}
50
44
  */
51
45
  export class CloudWatchManager {
52
46
  /**
53
47
  * @summary Method to create a cloudwatch alarm for a given expression
54
- * @param {string} id scoped id of the resource
55
- * @param {CommonConstruct} scope scope in which this resource is defined
56
- * @param {AlarmProps} props
48
+ * @param id scoped id of the resource
49
+ * @param scope scope in which this resource is defined
50
+ * @param props
57
51
  */
58
52
  public createAlarmForExpression(id: string, scope: CommonConstruct, props: AlarmProps) {
59
53
  if (!props) throw `Alarm props undefined for ${id}`
@@ -67,18 +61,18 @@ export class CloudWatchManager {
67
61
  )
68
62
  const expression = new watch.MathExpression({
69
63
  expression: props.expression,
70
- usingMetrics: metrics,
71
64
  period: props.periodInSecs ? cdk.Duration.seconds(props.periodInSecs) : cdk.Duration.minutes(5),
65
+ usingMetrics: metrics,
72
66
  })
73
67
 
74
68
  const alarm = expression.createAlarm(scope, `${id}`, {
75
- alarmName: props.alarmName,
76
69
  alarmDescription: props.alarmDescription,
77
- threshold: props.threshold,
78
- evaluationPeriods: props.evaluationPeriods,
70
+ alarmName: props.alarmName,
79
71
  comparisonOperator: props.comparisonOperator,
80
- treatMissingData: props.treatMissingData,
81
72
  datapointsToAlarm: props.datapointsToAlarm,
73
+ evaluationPeriods: props.evaluationPeriods,
74
+ threshold: props.threshold,
75
+ treatMissingData: props.treatMissingData,
82
76
  })
83
77
 
84
78
  utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
@@ -89,22 +83,22 @@ export class CloudWatchManager {
89
83
 
90
84
  /**
91
85
  * @summary Method to create a cloudwatch alarm for a given metric
92
- * @param {string} id scoped id of the resource
93
- * @param {CommonConstruct} scope scope in which this resource is defined
94
- * @param {AlarmProps} props
86
+ * @param id scoped id of the resource
87
+ * @param scope scope in which this resource is defined
88
+ * @param props
95
89
  * @param metric
96
90
  */
97
91
  public createAlarmForMetric(id: string, scope: CommonConstruct, props: AlarmProps, metric: watch.Metric) {
98
92
  if (!props) throw `Alarm props undefined for ${id}`
99
93
 
100
94
  const alarm = metric.createAlarm(scope, `${id}`, {
101
- alarmName: props.alarmName,
102
95
  alarmDescription: props.alarmDescription,
103
- threshold: props.threshold,
104
- evaluationPeriods: props.evaluationPeriods,
96
+ alarmName: props.alarmName,
105
97
  comparisonOperator: props.comparisonOperator,
106
- treatMissingData: props.treatMissingData,
107
98
  datapointsToAlarm: props.datapointsToAlarm,
99
+ evaluationPeriods: props.evaluationPeriods,
100
+ threshold: props.threshold,
101
+ treatMissingData: props.treatMissingData,
108
102
  })
109
103
 
110
104
  utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
@@ -115,9 +109,9 @@ export class CloudWatchManager {
115
109
 
116
110
  /**
117
111
  * @summary Method to create a cloudwatch dashboard
118
- * @param {string} id scoped id of the resource
119
- * @param {CommonConstruct} scope scope in which this resource is defined
120
- * @param {DashboardProps} props
112
+ * @param id scoped id of the resource
113
+ * @param scope scope in which this resource is defined
114
+ * @param props
121
115
  * @param widgets
122
116
  */
123
117
  public createDashboard(id: string, scope: CommonConstruct, props: DashboardProps, widgets?: watch.IWidget[][]) {
@@ -125,9 +119,9 @@ export class CloudWatchManager {
125
119
 
126
120
  const dashboard = new watch.Dashboard(scope, `${id}`, {
127
121
  dashboardName: props.dashboardName,
122
+ end: CloudWatchManager.determineTimeRange(props.end),
128
123
  periodOverride: props.periodOverride,
129
124
  start: CloudWatchManager.determineTimeRange(props.start),
130
- end: CloudWatchManager.determineTimeRange(props.end),
131
125
  widgets: widgets,
132
126
  })
133
127
 
@@ -138,7 +132,7 @@ export class CloudWatchManager {
138
132
 
139
133
  /**
140
134
  * @summary Method to create cloudwatch widgets
141
- * @param {CommonConstruct} scope scope in which this resource is defined
135
+ * @param scope scope in which this resource is defined
142
136
  * @param props
143
137
  */
144
138
  public createWidgets(scope: CommonConstruct, props: any[]) {
@@ -152,8 +146,8 @@ export class CloudWatchManager {
152
146
 
153
147
  /**
154
148
  * @summary Method to create a cloudwatch widget
155
- * @param {string} id scoped id of the resource
156
- * @param {CommonConstruct} scope scope in which this resource is defined
149
+ * @param id scoped id of the resource
150
+ * @param scope scope in which this resource is defined
157
151
  * @param props
158
152
  */
159
153
  public createWidget(id: string, scope: CommonConstruct, props: any) {
@@ -184,10 +178,10 @@ export class CloudWatchManager {
184
178
 
185
179
  /**
186
180
  * @summary Method to create a cloudfront distribution widget
187
- * @param {string} id scoped id of the resource
188
- * @param {CommonConstruct} scope scope in which this resource is defined
189
- * @param {TextWidgetProps} props
190
- * @param {string} distributionId the cloudfront distribution id
181
+ * @param id scoped id of the resource
182
+ * @param scope scope in which this resource is defined
183
+ * @param props
184
+ * @param distributionId the cloudfront distribution id
191
185
  */
192
186
  public createCloudfrontDistributionWidget(id: string, scope: CommonConstruct, props: any, distributionId: string) {
193
187
  if (!props) throw `Widget props undefined for ${id}`
@@ -202,10 +196,10 @@ export class CloudWatchManager {
202
196
 
203
197
  /**
204
198
  * @summary Method to create a step function widget
205
- * @param {string} id scoped id of the resource
206
- * @param {CommonConstruct} scope scope in which this resource is defined
207
- * @param {TextWidgetProps} props
208
- * @param {string} stateMachineArn the step function arn
199
+ * @param id scoped id of the resource
200
+ * @param scope scope in which this resource is defined
201
+ * @param props
202
+ * @param stateMachineArn the step function arn
209
203
  */
210
204
  public createStateWidget(id: string, scope: CommonConstruct, props: any, stateMachineArn: string) {
211
205
  if (!props) throw `Widget props undefined for ${id}`
@@ -220,11 +214,11 @@ export class CloudWatchManager {
220
214
 
221
215
  /**
222
216
  * @summary Method to create an event widget
223
- * @param {string} id scoped id of the resource
224
- * @param {CommonConstruct} scope scope in which this resource is defined
225
- * @param {TextWidgetProps} props
226
- * @param {string} eventBusName the event bus name
227
- * @param {string} ruleName the event rule name
217
+ * @param id scoped id of the resource
218
+ * @param scope scope in which this resource is defined
219
+ * @param props
220
+ * @param eventBusName the event bus name
221
+ * @param ruleName the event rule name
228
222
  */
229
223
  public createEventWidget(id: string, scope: CommonConstruct, props: any, eventBusName: string, ruleName: string) {
230
224
  if (!props) throw `Widget props undefined for ${id}`
@@ -242,10 +236,10 @@ export class CloudWatchManager {
242
236
 
243
237
  /**
244
238
  * @summary Method to create an api gateway widget
245
- * @param {string} id scoped id of the resource
246
- * @param {CommonConstruct} scope scope in which this resource is defined
247
- * @param {TextWidgetProps} props
248
- * @param {string} apiName the api name
239
+ * @param id scoped id of the resource
240
+ * @param scope scope in which this resource is defined
241
+ * @param props
242
+ * @param apiName the api name
249
243
  */
250
244
  public createApiGatewayWidget(id: string, scope: CommonConstruct, props: any, apiName: string) {
251
245
  if (!props) throw `Widget props undefined for ${id}`
@@ -260,10 +254,10 @@ export class CloudWatchManager {
260
254
 
261
255
  /**
262
256
  * @summary Method to create a lambda function widget
263
- * @param {string} id scoped id of the resource
264
- * @param {CommonConstruct} scope scope in which this resource is defined
265
- * @param {TextWidgetProps} props
266
- * @param {string} functionName the lambda function name
257
+ * @param id scoped id of the resource
258
+ * @param scope scope in which this resource is defined
259
+ * @param props
260
+ * @param functionName the lambda function name
267
261
  */
268
262
  public createLambdaWidget(id: string, scope: CommonConstruct, props: any, functionName: string) {
269
263
  if (!props) throw `Widget props undefined for ${id}`
@@ -278,10 +272,10 @@ export class CloudWatchManager {
278
272
 
279
273
  /**
280
274
  * @summary Method to create a custom widget
281
- * @param {string} id scoped id of the resource
282
- * @param {CommonConstruct} scope scope in which this resource is defined
283
- * @param {TextWidgetProps} props
284
- * @param {string} service the service identifier
275
+ * @param id scoped id of the resource
276
+ * @param scope scope in which this resource is defined
277
+ * @param props
278
+ * @param service the service identifier
285
279
  */
286
280
  public createCustomWidget(id: string, scope: CommonConstruct, props: any, service: string) {
287
281
  if (!props) throw `Widget props undefined for ${id}`
@@ -296,10 +290,10 @@ export class CloudWatchManager {
296
290
 
297
291
  /**
298
292
  * @summary Method to create an ecs cluster widget
299
- * @param {string} id scoped id of the resource
300
- * @param {CommonConstruct} scope scope in which this resource is defined
301
- * @param {TextWidgetProps} props
302
- * @param {string} clusterName the ecs cluster name
293
+ * @param id scoped id of the resource
294
+ * @param scope scope in which this resource is defined
295
+ * @param props
296
+ * @param clusterName the ecs cluster name
303
297
  */
304
298
  public createEcsClusterWidget(id: string, scope: CommonConstruct, props: any, clusterName: string) {
305
299
  if (!props) throw `Widget props undefined for ${id}`
@@ -314,11 +308,11 @@ export class CloudWatchManager {
314
308
 
315
309
  /**
316
310
  * @summary Method to create an ecs service widget
317
- * @param {string} id scoped id of the resource
318
- * @param {CommonConstruct} scope scope in which this resource is defined
319
- * @param {TextWidgetProps} props
320
- * @param {string} clusterName the ecs cluster name
321
- * @param {string} serviceName the ecs service name
311
+ * @param id scoped id of the resource
312
+ * @param scope scope in which this resource is defined
313
+ * @param props
314
+ * @param clusterName the ecs cluster name
315
+ * @param serviceName the ecs service name
322
316
  */
323
317
  public createEcsServiceWidget(
324
318
  id: string,
@@ -342,10 +336,10 @@ export class CloudWatchManager {
342
336
 
343
337
  /**
344
338
  * @summary Method to create an elb widget
345
- * @param {string} id scoped id of the resource
346
- * @param {CommonConstruct} scope scope in which this resource is defined
347
- * @param {TextWidgetProps} props
348
- * @param {string} loadBalancer the loadbalancer reference
339
+ * @param id scoped id of the resource
340
+ * @param scope scope in which this resource is defined
341
+ * @param props
342
+ * @param loadBalancer the loadbalancer reference
349
343
  */
350
344
  public createElbWidget(id: string, scope: CommonConstruct, props: any, loadBalancer: string) {
351
345
  if (!props) throw `Widget props undefined for ${id}`
@@ -360,10 +354,10 @@ export class CloudWatchManager {
360
354
 
361
355
  /**
362
356
  * @summary Method to create an elasticache widget
363
- * @param {string} id scoped id of the resource
364
- * @param {CommonConstruct} scope scope in which this resource is defined
365
- * @param {TextWidgetProps} props
366
- * @param {string} cacheClusterId the elasticache cluster id
357
+ * @param id scoped id of the resource
358
+ * @param scope scope in which this resource is defined
359
+ * @param props
360
+ * @param cacheClusterId the elasticache cluster id
367
361
  */
368
362
  public createCacheWidget(id: string, scope: CommonConstruct, props: any, cacheClusterId: string) {
369
363
  if (!props) throw `Widget props undefined for ${id}`
@@ -378,16 +372,16 @@ export class CloudWatchManager {
378
372
 
379
373
  /**
380
374
  * @summary Method to create a cloudwatch text widget
381
- * @param {string} id scoped id of the resource
382
- * @param {CommonConstruct} scope scope in which this resource is defined
383
- * @param {TextWidgetProps} props
375
+ * @param id scoped id of the resource
376
+ * @param scope scope in which this resource is defined
377
+ * @param props
384
378
  */
385
379
  public createTextWidget(id: string, scope: CommonConstruct, props: TextWidgetProps) {
386
380
  if (!props) throw `Widget props undefined for ${id}`
387
381
  const widget = new watch.TextWidget({
382
+ height: props.height,
388
383
  markdown: props.markdown,
389
384
  width: props.width,
390
- height: props.height,
391
385
  })
392
386
 
393
387
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -397,22 +391,22 @@ export class CloudWatchManager {
397
391
 
398
392
  /**
399
393
  * @summary Method to create a cloudwatch numeric widget
400
- * @param {string} id scoped id of the resource
401
- * @param {CommonConstruct} scope scope in which this resource is defined
402
- * @param {NumericWidgetProps} props
394
+ * @param id scoped id of the resource
395
+ * @param scope scope in which this resource is defined
396
+ * @param props
403
397
  * @param metrics
404
398
  */
405
399
  public createSingleValueWidget(id: string, scope: CommonConstruct, props: NumericWidgetProps, metrics: IMetric[]) {
406
400
  if (!props) throw `Widget props undefined for ${id}`
407
401
  const widget = new watch.SingleValueWidget({
408
- region: props.region ?? scope.props.region,
402
+ fullPrecision: props.fullPrecision,
403
+ height: props.height,
409
404
  metrics: metrics,
405
+ region: props.region ?? scope.props.region,
410
406
  setPeriodToTimeRange: props.setPeriodToTimeRange,
411
- fullPrecision: props.fullPrecision,
412
407
  sparkline: props.sparkline,
413
408
  title: props.title,
414
409
  width: props.width,
415
- height: props.height,
416
410
  })
417
411
 
418
412
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -422,22 +416,22 @@ export class CloudWatchManager {
422
416
 
423
417
  /**
424
418
  * @summary Method to create a cloudwatch guage widget
425
- * @param {string} id scoped id of the resource
426
- * @param {CommonConstruct} scope scope in which this resource is defined
427
- * @param {GuageWidgetProps} props
419
+ * @param id scoped id of the resource
420
+ * @param scope scope in which this resource is defined
421
+ * @param props
428
422
  * @param metrics
429
423
  */
430
424
  public createGuageWidget(id: string, scope: CommonConstruct, props: GuageWidgetProps, metrics: IMetric[]) {
431
425
  if (!props) throw `Widget props undefined for ${id}`
432
426
  const widget = new watch.GaugeWidget({
433
- region: props.region ?? scope.props.region,
434
- metrics: metrics,
427
+ height: props.height,
435
428
  leftYAxis: props.leftYAxis,
436
- statistic: props.statistic,
429
+ metrics: metrics,
430
+ region: props.region ?? scope.props.region,
437
431
  setPeriodToTimeRange: props.setPeriodToTimeRange,
432
+ statistic: props.statistic,
438
433
  title: props.title,
439
434
  width: props.width,
440
- height: props.height,
441
435
  })
442
436
 
443
437
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -447,9 +441,9 @@ export class CloudWatchManager {
447
441
 
448
442
  /**
449
443
  * @summary Method to create a cloudwatch graph widget
450
- * @param {string} id scoped id of the resource
451
- * @param {CommonConstruct} scope scope in which this resource is defined
452
- * @param {GraphWidgetProps} props
444
+ * @param id scoped id of the resource
445
+ * @param scope scope in which this resource is defined
446
+ * @param props
453
447
  * @param leftYMetrics
454
448
  * @param rightYMetrics
455
449
  */
@@ -462,20 +456,20 @@ export class CloudWatchManager {
462
456
  ) {
463
457
  if (!props) throw `Widget props undefined for ${id}`
464
458
  const widget = new watch.GraphWidget({
465
- region: props.region ?? scope.props.region,
459
+ height: props.height,
466
460
  left: leftYMetrics,
467
- right: rightYMetrics,
468
461
  leftAnnotations: props.leftAnnotations,
469
- rightAnnotations: props.rightAnnotations,
470
- stacked: props.stacked,
471
462
  leftYAxis: props.leftYAxis,
472
- rightYAxis: props.rightYAxis,
473
463
  legendPosition: props.legendPosition,
474
464
  liveData: props.liveData,
475
- view: props.view,
465
+ region: props.region ?? scope.props.region,
466
+ right: rightYMetrics,
467
+ rightAnnotations: props.rightAnnotations,
468
+ rightYAxis: props.rightYAxis,
469
+ stacked: props.stacked,
476
470
  title: props.title,
471
+ view: props.view,
477
472
  width: props.width,
478
- height: props.height,
479
473
  })
480
474
 
481
475
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -485,10 +479,10 @@ export class CloudWatchManager {
485
479
 
486
480
  /**
487
481
  * @summary Method to create a cloudwatch alarm status widget
488
- * @param {string} id scoped id of the resource
489
- * @param {CommonConstruct} scope scope in which this resource is defined
490
- * @param {AlarmStatusWidgetProps} props
491
- * @param {watch.IAlarm[]} alarms
482
+ * @param id scoped id of the resource
483
+ * @param scope scope in which this resource is defined
484
+ * @param props
485
+ * @param alarms
492
486
  */
493
487
  public createAlarmStatusWidget(
494
488
  id: string,
@@ -499,9 +493,9 @@ export class CloudWatchManager {
499
493
  if (!props) throw `Widget props undefined for ${id}`
500
494
  const widget = new watch.AlarmStatusWidget({
501
495
  alarms: alarms,
496
+ height: props.height,
502
497
  title: props.title,
503
498
  width: props.width,
504
- height: props.height,
505
499
  })
506
500
 
507
501
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -511,22 +505,22 @@ export class CloudWatchManager {
511
505
 
512
506
  /**
513
507
  * @summary Method to create a cloudwatch log query widget
514
- * @param {string} id scoped id of the resource
515
- * @param {CommonConstruct} scope scope in which this resource is defined
516
- * @param {LogQueryWidgetProps} props
517
- * @param {string[]} logGroupNames
508
+ * @param id scoped id of the resource
509
+ * @param scope scope in which this resource is defined
510
+ * @param props
511
+ * @param logGroupNames
518
512
  */
519
513
  public createLogQueryWidget(id: string, scope: CommonConstruct, props: LogQueryWidgetProps, logGroupNames: string[]) {
520
514
  if (!props) throw `Widget props undefined for ${id}`
521
515
  const widget = new watch.LogQueryWidget({
522
- region: props.region ?? scope.props.region,
516
+ height: props.height,
523
517
  logGroupNames: logGroupNames,
524
- queryString: props.queryString,
525
518
  queryLines: props.queryLines,
526
- view: props.view,
519
+ queryString: props.queryString,
520
+ region: props.region ?? scope.props.region,
527
521
  title: props.title,
522
+ view: props.view,
528
523
  width: props.width,
529
- height: props.height,
530
524
  })
531
525
 
532
526
  if (props.positionX && props.positionY) widget.position(props.positionX, props.positionY)
@@ -536,8 +530,8 @@ export class CloudWatchManager {
536
530
 
537
531
  /**
538
532
  * @summary Utility method to determine the metrics and dimensions
539
- * @param {CommonConstruct} scope scope in which this resource is defined
540
- * @param {MetricProps[]} metricProps
533
+ * @param scope scope in which this resource is defined
534
+ * @param metricProps
541
535
  */
542
536
  private determineMetrics(scope: CommonConstruct, metricProps: MetricProps[]) {
543
537
  const metrics: watch.IMetric[] = []
@@ -556,8 +550,8 @@ export class CloudWatchManager {
556
550
  metricDimensions = {
557
551
  ...metricProp.dimensionsMap,
558
552
  ...{
559
- ServiceName: `${metricProp.serviceName}`,
560
553
  ClusterName: `${metricProp.clusterName}`,
554
+ ServiceName: `${metricProp.serviceName}`,
561
555
  },
562
556
  }
563
557
  }
@@ -597,8 +591,8 @@ export class CloudWatchManager {
597
591
  metricDimensions = {
598
592
  ...metricProp.dimensionsMap,
599
593
  ...{
600
- Region: `Global`,
601
594
  DistributionId: `${metricProp.distributionId}`,
595
+ Region: `Global`,
602
596
  },
603
597
  }
604
598
  }
@@ -645,12 +639,12 @@ export class CloudWatchManager {
645
639
  }
646
640
  }
647
641
  const metric = new watch.Metric({
648
- namespace: metricProp.stageSuffix ? `${metricProp.namespace}-${scope.props.stage}` : metricProp.namespace,
649
- metricName: metricProp.stageSuffix ? `${metricProp.metricName}-${scope.props.stage}` : metricProp.metricName,
650
642
  dimensionsMap: metricDimensions,
651
- statistic: metricProp.statistic,
652
- region: metricProp.region,
643
+ metricName: metricProp.stageSuffix ? `${metricProp.metricName}-${scope.props.stage}` : metricProp.metricName,
644
+ namespace: metricProp.stageSuffix ? `${metricProp.namespace}-${scope.props.stage}` : metricProp.namespace,
653
645
  period: metricProp.periodInSecs ? cdk.Duration.seconds(metricProp.periodInSecs) : cdk.Duration.minutes(5),
646
+ region: metricProp.region,
647
+ statistic: metricProp.statistic,
654
648
  })
655
649
  metrics.push(metric)
656
650
  })
@@ -661,7 +655,7 @@ export class CloudWatchManager {
661
655
 
662
656
  /**
663
657
  * @summary Utility method to determine the time range
664
- * @param {string?} range
658
+ * @param range
665
659
  */
666
660
  private static determineTimeRange(range?: string) {
667
661
  const moment = require('moment')
@@ -678,9 +672,9 @@ export class CloudWatchManager {
678
672
 
679
673
  /**
680
674
  * @summary Utility method to determine the configured alarms
681
- * @param {string} id scoped id of the resource
682
- * @param {CommonConstruct} scope scope in which this resource is defined
683
- * @param {watch.AlarmProps[]} alarmProps
675
+ * @param id scoped id of the resource
676
+ * @param scope scope in which this resource is defined
677
+ * @param alarmProps
684
678
  */
685
679
  private determineAlarms(id: string, scope: CommonConstruct, alarmProps: watch.AlarmProps[]) {
686
680
  const alarms: watch.IAlarm[] = []
@@ -3,8 +3,6 @@ import * as logs from 'aws-cdk-lib/aws-logs'
3
3
  import { TagProps } from '../../../types'
4
4
 
5
5
  /**
6
- * @category cdk-utils.cloudwatch-manager
7
- * @subcategory Properties
8
6
  */
9
7
  export interface AlarmProps extends watch.AlarmProps {
10
8
  expression?: string
@@ -13,108 +11,88 @@ export interface AlarmProps extends watch.AlarmProps {
13
11
  }
14
12
 
15
13
  /**
16
- * @category cdk-utils.cloudwatch-manager
17
- * @subcategory Properties
18
14
  */
19
15
  export interface DashboardProps extends watch.DashboardProps {}
20
16
 
21
17
  /**
22
- * @category cdk-utils.cloudwatch-manager
23
- * @subcategory Properties
24
18
  */
25
19
  export interface MetricProps extends watch.MetricProps {
26
- stageSuffix: boolean
27
- periodInSecs?: number
28
- functionName?: string
29
- dbClusterIdentifier?: string
30
- distributionId?: string
31
- loadBalancer?: string
32
- serviceName?: string
33
- clusterName?: string
34
20
  apiName?: string
35
21
  cacheClusterId?: string
36
- stateMachineArn?: string
22
+ clusterName?: string
23
+ dbClusterIdentifier?: string
24
+ distributionId?: string
37
25
  eventBusName?: string
26
+ functionName?: string
27
+ loadBalancer?: string
28
+ periodInSecs?: number
38
29
  ruleName?: string
39
30
  service?: string
31
+ serviceName?: string
32
+ stageSuffix: boolean
33
+ stateMachineArn?: string
40
34
  }
41
35
 
42
36
  /**
43
- * @category cdk-utils.cloudwatch-manager
44
- * @subcategory Properties
45
37
  */
46
38
  export interface TextWidgetProps extends watch.TextWidgetProps {
47
- type: string
48
39
  positionX: number
49
40
  positionY: number
41
+ type: string
50
42
  }
51
43
 
52
44
  /**
53
- * @category cdk-utils.cloudwatch-manager
54
- * @subcategory Properties
55
45
  */
56
46
  export interface NumericWidgetProps extends watch.SingleValueWidgetProps {
57
- type: string
47
+ metricProps: watch.MetricProps[]
58
48
  positionX: number
59
49
  positionY: number
60
- metricProps: watch.MetricProps[]
50
+ type: string
61
51
  }
62
52
 
63
53
  /**
64
- * @category cdk-utils.cloudwatch-manager
65
- * @subcategory Properties
66
54
  */
67
55
  export interface GuageWidgetProps extends watch.GaugeWidgetProps {
68
- type: string
56
+ metricProps: watch.MetricProps[]
69
57
  positionX: number
70
58
  positionY: number
71
- metricProps: watch.MetricProps[]
59
+ type: string
72
60
  }
73
61
 
74
62
  /**
75
- * @category cdk-utils.cloudwatch-manager
76
- * @subcategory Properties
77
63
  */
78
64
  export interface GraphWidgetProps extends watch.GraphWidgetProps {
79
- type: string
65
+ metricProps: MetricProps[]
80
66
  positionX: number
81
67
  positionY: number
82
- metricProps: MetricProps[]
68
+ type: string
83
69
  }
84
70
 
85
71
  /**
86
- * @category cdk-utils.cloudwatch-manager
87
- * @subcategory Properties
88
72
  */
89
73
  export interface AlarmStatusWidgetProps extends watch.AlarmStatusWidgetProps {
90
- type: string
74
+ alarmProps: watch.AlarmProps[]
91
75
  positionX: number
92
76
  positionY: number
93
- alarmProps: watch.AlarmProps[]
77
+ type: string
94
78
  }
95
79
 
96
80
  /**
97
- * @category cdk-utils.cloudwatch-manager
98
- * @subcategory Properties
99
81
  */
100
82
  export interface LogQueryWidgetProps extends watch.LogQueryWidgetProps {
101
- type: string
102
83
  positionX: number
103
84
  positionY: number
85
+ type: string
104
86
  }
105
87
 
106
88
  /**
107
- * @category cdk-utils.cloudwatch-manager
108
- * @subcategory Properties
109
89
  */
110
90
  export interface MetricFilterProps extends logs.MetricFilterProps {
111
- periodInSecs: number
112
91
  options: watch.MetricOptions
92
+ periodInSecs: number
113
93
  }
114
94
 
115
95
  /**
116
- * @category cdk-utils.cloudwatch-manager
117
- * @subcategory Properties
118
96
  */
119
97
  export interface LogProps extends logs.LogGroupProps {
120
98
  tags?: TagProps[]