@gradientedge/cdk-utils 4.1.2 → 4.2.3

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 (227) hide show
  1. package/dist/index.d.ts +3 -25
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +3 -25
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/lib/common/commonConstruct.d.ts +25 -45
  6. package/dist/src/lib/common/commonConstruct.d.ts.map +1 -1
  7. package/dist/src/lib/common/commonConstruct.js +48 -49
  8. package/dist/src/lib/common/commonConstruct.js.map +1 -1
  9. package/dist/src/lib/common/commonStack.d.ts +1 -1
  10. package/dist/src/lib/common/commonStack.d.ts.map +1 -1
  11. package/dist/src/lib/common/commonStack.js.map +1 -1
  12. package/dist/src/lib/common/index.d.ts +3 -0
  13. package/dist/src/lib/common/index.d.ts.map +1 -0
  14. package/dist/src/lib/common/index.js +15 -0
  15. package/dist/src/lib/common/index.js.map +1 -0
  16. package/dist/src/lib/construct/graphQLApiLambda.d.ts +5 -5
  17. package/dist/src/lib/construct/graphQLApiLambda.d.ts.map +1 -1
  18. package/dist/src/lib/construct/graphQLApiLambda.js +2 -2
  19. package/dist/src/lib/construct/graphQLApiLambda.js.map +1 -1
  20. package/dist/src/lib/construct/index.d.ts +4 -0
  21. package/dist/src/lib/construct/index.d.ts.map +1 -0
  22. package/dist/src/lib/construct/index.js +16 -0
  23. package/dist/src/lib/construct/index.js.map +1 -0
  24. package/dist/src/lib/construct/siteWithEcsBackend.d.ts +20 -8
  25. package/dist/src/lib/construct/siteWithEcsBackend.d.ts.map +1 -1
  26. package/dist/src/lib/construct/siteWithEcsBackend.js +32 -5
  27. package/dist/src/lib/construct/siteWithEcsBackend.js.map +1 -1
  28. package/dist/src/lib/construct/staticSite.d.ts +17 -5
  29. package/dist/src/lib/construct/staticSite.d.ts.map +1 -1
  30. package/dist/src/lib/construct/staticSite.js +30 -2
  31. package/dist/src/lib/construct/staticSite.js.map +1 -1
  32. package/dist/src/lib/manager/{acmManager.d.ts → aws/acmManager.d.ts} +7 -7
  33. package/dist/src/lib/manager/aws/acmManager.d.ts.map +1 -0
  34. package/dist/src/lib/manager/{acmManager.js → aws/acmManager.js} +7 -7
  35. package/dist/src/lib/manager/aws/acmManager.js.map +1 -0
  36. package/dist/src/lib/manager/{apiManager.d.ts → aws/apiManager.d.ts} +10 -10
  37. package/dist/src/lib/manager/aws/apiManager.d.ts.map +1 -0
  38. package/dist/src/lib/manager/{apiManager.js → aws/apiManager.js} +12 -14
  39. package/dist/src/lib/manager/aws/apiManager.js.map +1 -0
  40. package/dist/src/lib/manager/{appConfigManager.d.ts → aws/appConfigManager.d.ts} +16 -16
  41. package/dist/src/lib/manager/aws/appConfigManager.d.ts.map +1 -0
  42. package/dist/src/lib/manager/{appConfigManager.js → aws/appConfigManager.js} +18 -18
  43. package/dist/src/lib/manager/aws/appConfigManager.js.map +1 -0
  44. package/dist/src/lib/manager/aws/cloudFrontManager.d.ts +112 -0
  45. package/dist/src/lib/manager/aws/cloudFrontManager.d.ts.map +1 -0
  46. package/dist/src/lib/manager/{cloudFrontManager.js → aws/cloudFrontManager.js} +47 -24
  47. package/dist/src/lib/manager/aws/cloudFrontManager.js.map +1 -0
  48. package/dist/src/lib/manager/{cloudTrailManager.d.ts → aws/cloudTrailManager.d.ts} +8 -8
  49. package/dist/src/lib/manager/aws/cloudTrailManager.d.ts.map +1 -0
  50. package/dist/src/lib/manager/{cloudTrailManager.js → aws/cloudTrailManager.js} +8 -8
  51. package/dist/src/lib/manager/aws/cloudTrailManager.js.map +1 -0
  52. package/dist/src/lib/manager/aws/cloudWatchManager.d.ts +121 -0
  53. package/dist/src/lib/manager/aws/cloudWatchManager.d.ts.map +1 -0
  54. package/dist/src/lib/manager/{cloudWatchManager.js → aws/cloudWatchManager.js} +46 -35
  55. package/dist/src/lib/manager/aws/cloudWatchManager.js.map +1 -0
  56. package/dist/src/lib/manager/{codeBuildManager.d.ts → aws/codeBuildManager.d.ts} +7 -8
  57. package/dist/src/lib/manager/aws/codeBuildManager.d.ts.map +1 -0
  58. package/dist/src/lib/manager/{codeBuildManager.js → aws/codeBuildManager.js} +5 -5
  59. package/dist/src/lib/manager/aws/codeBuildManager.js.map +1 -0
  60. package/dist/src/lib/manager/{ecrManager.d.ts → aws/ecrManager.d.ts} +6 -6
  61. package/dist/src/lib/manager/aws/ecrManager.d.ts.map +1 -0
  62. package/dist/src/lib/manager/{ecrManager.js → aws/ecrManager.js} +6 -6
  63. package/dist/src/lib/manager/aws/ecrManager.js.map +1 -0
  64. package/dist/src/lib/manager/{ecsManager.d.ts → aws/ecsManager.d.ts} +11 -11
  65. package/dist/src/lib/manager/aws/ecsManager.d.ts.map +1 -0
  66. package/dist/src/lib/manager/{ecsManager.js → aws/ecsManager.js} +11 -11
  67. package/dist/src/lib/manager/aws/ecsManager.js.map +1 -0
  68. package/dist/src/lib/manager/{eksManager.d.ts → aws/eksManager.d.ts} +8 -8
  69. package/dist/src/lib/manager/aws/eksManager.d.ts.map +1 -0
  70. package/dist/src/lib/manager/{eksManager.js → aws/eksManager.js} +8 -8
  71. package/dist/src/lib/manager/aws/eksManager.js.map +1 -0
  72. package/dist/src/lib/manager/{eventManager.d.ts → aws/eventManager.d.ts} +11 -11
  73. package/dist/src/lib/manager/aws/eventManager.d.ts.map +1 -0
  74. package/dist/src/lib/manager/{eventManager.js → aws/eventManager.js} +12 -12
  75. package/dist/src/lib/manager/aws/eventManager.js.map +1 -0
  76. package/dist/src/lib/manager/aws/iamManager.d.ts +156 -0
  77. package/dist/src/lib/manager/aws/iamManager.d.ts.map +1 -0
  78. package/dist/src/lib/manager/{iamManager.js → aws/iamManager.js} +35 -34
  79. package/dist/src/lib/manager/aws/iamManager.js.map +1 -0
  80. package/dist/src/lib/manager/aws/index.d.ts +22 -0
  81. package/dist/src/lib/manager/aws/index.d.ts.map +1 -0
  82. package/dist/src/lib/manager/aws/index.js +34 -0
  83. package/dist/src/lib/manager/aws/index.js.map +1 -0
  84. package/dist/src/lib/manager/{lambdaManager.d.ts → aws/lambdaManager.d.ts} +19 -19
  85. package/dist/src/lib/manager/aws/lambdaManager.d.ts.map +1 -0
  86. package/dist/src/lib/manager/{lambdaManager.js → aws/lambdaManager.js} +19 -19
  87. package/dist/src/lib/manager/aws/lambdaManager.js.map +1 -0
  88. package/dist/src/lib/manager/{logManager.d.ts → aws/logManager.d.ts} +14 -14
  89. package/dist/src/lib/manager/aws/logManager.d.ts.map +1 -0
  90. package/dist/src/lib/manager/{logManager.js → aws/logManager.js} +12 -12
  91. package/dist/src/lib/manager/aws/logManager.js.map +1 -0
  92. package/dist/src/lib/manager/{route53Manager.d.ts → aws/route53Manager.d.ts} +16 -16
  93. package/dist/src/lib/manager/aws/route53Manager.d.ts.map +1 -0
  94. package/dist/src/lib/manager/{route53Manager.js → aws/route53Manager.js} +17 -17
  95. package/dist/src/lib/manager/aws/route53Manager.js.map +1 -0
  96. package/dist/src/lib/manager/aws/s3Manager.d.ts +73 -0
  97. package/dist/src/lib/manager/aws/s3Manager.d.ts.map +1 -0
  98. package/dist/src/lib/manager/{s3Manager.js → aws/s3Manager.js} +15 -15
  99. package/dist/src/lib/manager/aws/s3Manager.js.map +1 -0
  100. package/dist/src/lib/manager/{secretsManager.d.ts → aws/secretsManager.d.ts} +5 -5
  101. package/dist/src/lib/manager/aws/secretsManager.d.ts.map +1 -0
  102. package/dist/src/lib/manager/{secretsManager.js → aws/secretsManager.js} +3 -3
  103. package/dist/src/lib/manager/aws/secretsManager.js.map +1 -0
  104. package/dist/src/lib/manager/{snsManager.d.ts → aws/snsManager.d.ts} +11 -11
  105. package/dist/src/lib/manager/aws/snsManager.d.ts.map +1 -0
  106. package/dist/src/lib/manager/{snsManager.js → aws/snsManager.js} +12 -12
  107. package/dist/src/lib/manager/aws/snsManager.js.map +1 -0
  108. package/dist/src/lib/manager/{ssmManager.d.ts → aws/ssmManager.d.ts} +16 -16
  109. package/dist/src/lib/manager/aws/ssmManager.d.ts.map +1 -0
  110. package/dist/src/lib/manager/{ssmManager.js → aws/ssmManager.js} +13 -13
  111. package/dist/src/lib/manager/aws/ssmManager.js.map +1 -0
  112. package/dist/src/lib/manager/{vpcManager.d.ts → aws/vpcManager.d.ts} +10 -10
  113. package/dist/src/lib/manager/aws/vpcManager.d.ts.map +1 -0
  114. package/dist/src/lib/manager/{vpcManager.js → aws/vpcManager.js} +13 -13
  115. package/dist/src/lib/manager/aws/vpcManager.js.map +1 -0
  116. package/dist/src/lib/manager/aws/wafManager.d.ts +39 -0
  117. package/dist/src/lib/manager/aws/wafManager.d.ts.map +1 -0
  118. package/dist/src/lib/manager/{wafManager.js → aws/wafManager.js} +12 -12
  119. package/dist/src/lib/manager/aws/wafManager.js.map +1 -0
  120. package/dist/src/lib/manager/index.d.ts +2 -0
  121. package/dist/src/lib/manager/index.d.ts.map +1 -0
  122. package/dist/src/lib/manager/index.js +14 -0
  123. package/dist/src/lib/manager/index.js.map +1 -0
  124. package/dist/src/lib/{types.d.ts → types/aws/index.d.ts} +27 -16
  125. package/dist/src/lib/types/aws/index.d.ts.map +1 -0
  126. package/dist/src/lib/{types.js → types/aws/index.js} +1 -1
  127. package/dist/src/lib/types/aws/index.js.map +1 -0
  128. package/dist/src/lib/types/index.d.ts +2 -0
  129. package/dist/src/lib/types/index.d.ts.map +1 -0
  130. package/dist/src/lib/types/index.js +14 -0
  131. package/dist/src/lib/types/index.js.map +1 -0
  132. package/dist/src/lib/utils/aws/index.d.ts +16 -0
  133. package/dist/src/lib/utils/aws/index.d.ts.map +1 -0
  134. package/dist/src/lib/utils/aws/index.js +50 -0
  135. package/dist/src/lib/utils/aws/index.js.map +1 -0
  136. package/dist/src/lib/{utils.d.ts → utils/index.d.ts} +2 -26
  137. package/dist/src/lib/utils/index.d.ts.map +1 -0
  138. package/dist/src/lib/utils/index.js +85 -0
  139. package/dist/src/lib/utils/index.js.map +1 -0
  140. package/index.ts +3 -25
  141. package/package.json +26 -16
  142. package/src/lib/common/commonConstruct.ts +53 -73
  143. package/src/lib/common/commonStack.ts +1 -1
  144. package/src/lib/common/index.ts +2 -0
  145. package/src/lib/construct/graphQLApiLambda.ts +5 -5
  146. package/src/lib/construct/index.ts +3 -0
  147. package/src/lib/construct/siteWithEcsBackend.ts +44 -10
  148. package/src/lib/construct/staticSite.ts +40 -6
  149. package/src/lib/manager/{acmManager.ts → aws/acmManager.ts} +11 -11
  150. package/src/lib/manager/{apiManager.ts → aws/apiManager.ts} +16 -18
  151. package/src/lib/manager/{appConfigManager.ts → aws/appConfigManager.ts} +30 -26
  152. package/src/lib/manager/{cloudFrontManager.ts → aws/cloudFrontManager.ts} +67 -39
  153. package/src/lib/manager/{cloudTrailManager.ts → aws/cloudTrailManager.ts} +12 -12
  154. package/src/lib/manager/{cloudWatchManager.ts → aws/cloudWatchManager.ts} +78 -56
  155. package/src/lib/manager/{codeBuildManager.ts → aws/codeBuildManager.ts} +8 -8
  156. package/src/lib/manager/{ecrManager.ts → aws/ecrManager.ts} +8 -8
  157. package/src/lib/manager/{ecsManager.ts → aws/ecsManager.ts} +16 -16
  158. package/src/lib/manager/{eksManager.ts → aws/eksManager.ts} +12 -12
  159. package/src/lib/manager/{eventManager.ts → aws/eventManager.ts} +18 -18
  160. package/src/lib/manager/{iamManager.ts → aws/iamManager.ts} +65 -54
  161. package/src/lib/manager/aws/index.ts +21 -0
  162. package/src/lib/manager/{lambdaManager.ts → aws/lambdaManager.ts} +29 -29
  163. package/src/lib/manager/{logManager.ts → aws/logManager.ts} +22 -17
  164. package/src/lib/manager/{route53Manager.ts → aws/route53Manager.ts} +24 -24
  165. package/src/lib/manager/{s3Manager.ts → aws/s3Manager.ts} +24 -24
  166. package/src/lib/manager/{secretsManager.ts → aws/secretsManager.ts} +10 -5
  167. package/src/lib/manager/{snsManager.ts → aws/snsManager.ts} +18 -18
  168. package/src/lib/manager/{ssmManager.ts → aws/ssmManager.ts} +24 -19
  169. package/src/lib/manager/{vpcManager.ts → aws/vpcManager.ts} +17 -17
  170. package/src/lib/manager/{wafManager.ts → aws/wafManager.ts} +16 -16
  171. package/src/lib/manager/index.ts +1 -0
  172. package/src/lib/{types.ts → types/aws/index.ts} +27 -15
  173. package/src/lib/types/index.ts +1 -0
  174. package/src/lib/utils/aws/index.ts +34 -0
  175. package/src/lib/{utils.ts → utils/index.ts} +1 -45
  176. package/dist/src/lib/manager/acmManager.d.ts.map +0 -1
  177. package/dist/src/lib/manager/acmManager.js.map +0 -1
  178. package/dist/src/lib/manager/apiManager.d.ts.map +0 -1
  179. package/dist/src/lib/manager/apiManager.js.map +0 -1
  180. package/dist/src/lib/manager/appConfigManager.d.ts.map +0 -1
  181. package/dist/src/lib/manager/appConfigManager.js.map +0 -1
  182. package/dist/src/lib/manager/cloudFrontManager.d.ts +0 -101
  183. package/dist/src/lib/manager/cloudFrontManager.d.ts.map +0 -1
  184. package/dist/src/lib/manager/cloudFrontManager.js.map +0 -1
  185. package/dist/src/lib/manager/cloudTrailManager.d.ts.map +0 -1
  186. package/dist/src/lib/manager/cloudTrailManager.js.map +0 -1
  187. package/dist/src/lib/manager/cloudWatchManager.d.ts +0 -121
  188. package/dist/src/lib/manager/cloudWatchManager.d.ts.map +0 -1
  189. package/dist/src/lib/manager/cloudWatchManager.js.map +0 -1
  190. package/dist/src/lib/manager/codeBuildManager.d.ts.map +0 -1
  191. package/dist/src/lib/manager/codeBuildManager.js.map +0 -1
  192. package/dist/src/lib/manager/ecrManager.d.ts.map +0 -1
  193. package/dist/src/lib/manager/ecrManager.js.map +0 -1
  194. package/dist/src/lib/manager/ecsManager.d.ts.map +0 -1
  195. package/dist/src/lib/manager/ecsManager.js.map +0 -1
  196. package/dist/src/lib/manager/eksManager.d.ts.map +0 -1
  197. package/dist/src/lib/manager/eksManager.js.map +0 -1
  198. package/dist/src/lib/manager/eventManager.d.ts.map +0 -1
  199. package/dist/src/lib/manager/eventManager.js.map +0 -1
  200. package/dist/src/lib/manager/iamManager.d.ts +0 -155
  201. package/dist/src/lib/manager/iamManager.d.ts.map +0 -1
  202. package/dist/src/lib/manager/iamManager.js.map +0 -1
  203. package/dist/src/lib/manager/lambdaManager.d.ts.map +0 -1
  204. package/dist/src/lib/manager/lambdaManager.js.map +0 -1
  205. package/dist/src/lib/manager/logManager.d.ts.map +0 -1
  206. package/dist/src/lib/manager/logManager.js.map +0 -1
  207. package/dist/src/lib/manager/route53Manager.d.ts.map +0 -1
  208. package/dist/src/lib/manager/route53Manager.js.map +0 -1
  209. package/dist/src/lib/manager/s3Manager.d.ts +0 -73
  210. package/dist/src/lib/manager/s3Manager.d.ts.map +0 -1
  211. package/dist/src/lib/manager/s3Manager.js.map +0 -1
  212. package/dist/src/lib/manager/secretsManager.d.ts.map +0 -1
  213. package/dist/src/lib/manager/secretsManager.js.map +0 -1
  214. package/dist/src/lib/manager/snsManager.d.ts.map +0 -1
  215. package/dist/src/lib/manager/snsManager.js.map +0 -1
  216. package/dist/src/lib/manager/ssmManager.d.ts.map +0 -1
  217. package/dist/src/lib/manager/ssmManager.js.map +0 -1
  218. package/dist/src/lib/manager/vpcManager.d.ts.map +0 -1
  219. package/dist/src/lib/manager/vpcManager.js.map +0 -1
  220. package/dist/src/lib/manager/wafManager.d.ts +0 -39
  221. package/dist/src/lib/manager/wafManager.d.ts.map +0 -1
  222. package/dist/src/lib/manager/wafManager.js.map +0 -1
  223. package/dist/src/lib/types.d.ts.map +0 -1
  224. package/dist/src/lib/types.js.map +0 -1
  225. package/dist/src/lib/utils.d.ts.map +0 -1
  226. package/dist/src/lib/utils.js +0 -131
  227. package/dist/src/lib/utils.js.map +0 -1
@@ -1,29 +1,31 @@
1
1
  import * as cdk from 'aws-cdk-lib'
2
2
  import * as watch from 'aws-cdk-lib/aws-cloudwatch'
3
3
  import { IMetric } from 'aws-cdk-lib/aws-cloudwatch'
4
- import {
5
- AlarmProps,
6
- AlarmStatusWidgetProps,
7
- DashboardProps,
8
- GraphWidgetProps,
9
- LogQueryWidgetProps,
10
- MetricProps,
11
- NumericWidgetProps,
12
- TextWidgetProps,
13
- } from '../types'
14
- import { CommonConstruct } from '../common/commonConstruct'
15
- import { CloudWatchWidgetType, createCfnOutput } from '../utils'
4
+ import * as common from '../../common'
5
+ import * as types from '../../types'
6
+ import * as utils from '../../utils'
7
+
8
+ /**
9
+ * @category Utils
10
+ */
11
+ enum CloudWatchWidgetType {
12
+ Text = 'Text',
13
+ SingleValue = 'SingleValue',
14
+ Graph = 'Graph',
15
+ AlarmStatus = 'AlarmStatus',
16
+ LogQuery = 'LogQuery',
17
+ }
16
18
 
17
19
  /**
18
20
  * @stability stable
19
21
  * @category Management & Governance
20
22
  * @summary Provides operations on AWS CloudWatch.
21
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
22
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
23
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
24
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
23
25
  * @example
24
26
  * import * as common from '@gradientedge/cdk-utils'
25
27
  *
26
- * class CustomConstruct extends common.CommonConstruct {
28
+ * class CustomConstruct extends common.common.CommonConstruct {
27
29
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
28
30
  * super(parent, id, props)
29
31
  * this.props = props
@@ -37,10 +39,10 @@ export class CloudWatchManager {
37
39
  /**
38
40
  * @summary Method to create a cloudwatch alarm for a given expression
39
41
  * @param {string} id scoped id of the resource
40
- * @param {CommonConstruct} scope scope in which this resource is defined
41
- * @param {AlarmProps} props
42
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
43
+ * @param {types.AlarmProps} props
42
44
  */
43
- public createAlarmForExpression(id: string, scope: CommonConstruct, props: AlarmProps) {
45
+ public createAlarmForExpression(id: string, scope: common.CommonConstruct, props: types.AlarmProps) {
44
46
  if (!props) throw `Alarm props undefined`
45
47
 
46
48
  if (!props.expression) throw `Could not find expression for Alarm props for id:${id}`
@@ -66,8 +68,8 @@ export class CloudWatchManager {
66
68
  datapointsToAlarm: props.datapointsToAlarm,
67
69
  })
68
70
 
69
- createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
70
- createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName)
71
+ utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
72
+ utils.createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName)
71
73
 
72
74
  return alarm
73
75
  }
@@ -75,11 +77,16 @@ export class CloudWatchManager {
75
77
  /**
76
78
  * @summary Method to create a cloudwatch alarm for a given metric
77
79
  * @param {string} id scoped id of the resource
78
- * @param {CommonConstruct} scope scope in which this resource is defined
79
- * @param {AlarmProps} props
80
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
81
+ * @param {types.AlarmProps} props
80
82
  * @param metric
81
83
  */
82
- public createAlarmForMetric(id: string, scope: CommonConstruct, props: AlarmProps, metric: watch.Metric) {
84
+ public createAlarmForMetric(
85
+ id: string,
86
+ scope: common.CommonConstruct,
87
+ props: types.AlarmProps,
88
+ metric: watch.Metric
89
+ ) {
83
90
  if (!props) throw `Alarm props undefined`
84
91
 
85
92
  const alarm = metric.createAlarm(scope, `${id}`, {
@@ -92,8 +99,8 @@ export class CloudWatchManager {
92
99
  datapointsToAlarm: props.datapointsToAlarm,
93
100
  })
94
101
 
95
- createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
96
- createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName)
102
+ utils.createCfnOutput(`${id}-alarmArn`, scope, alarm.alarmArn)
103
+ utils.createCfnOutput(`${id}-alarmName`, scope, alarm.alarmName)
97
104
 
98
105
  return alarm
99
106
  }
@@ -101,11 +108,16 @@ export class CloudWatchManager {
101
108
  /**
102
109
  * @summary Method to create a cloudwatch dashboard
103
110
  * @param {string} id scoped id of the resource
104
- * @param {CommonConstruct} scope scope in which this resource is defined
105
- * @param {DashboardProps} props
111
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
112
+ * @param {types.DashboardProps} props
106
113
  * @param widgets
107
114
  */
108
- public createDashboard(id: string, scope: CommonConstruct, props: DashboardProps, widgets?: watch.IWidget[][]) {
115
+ public createDashboard(
116
+ id: string,
117
+ scope: common.CommonConstruct,
118
+ props: types.DashboardProps,
119
+ widgets?: watch.IWidget[][]
120
+ ) {
109
121
  if (!props) throw `Dashboard props undefined`
110
122
 
111
123
  const dashboard = new watch.Dashboard(scope, `${id}`, {
@@ -116,17 +128,17 @@ export class CloudWatchManager {
116
128
  widgets: widgets,
117
129
  })
118
130
 
119
- createCfnOutput(`${id}-dashboardName`, scope, props.dashboardName)
131
+ utils.createCfnOutput(`${id}-dashboardName`, scope, props.dashboardName)
120
132
 
121
133
  return dashboard
122
134
  }
123
135
 
124
136
  /**
125
137
  * @summary Method to create cloudwatch widgets
126
- * @param {CommonConstruct} scope scope in which this resource is defined
138
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
127
139
  * @param props
128
140
  */
129
- public createWidgets(scope: CommonConstruct, props: any[]) {
141
+ public createWidgets(scope: common.CommonConstruct, props: any[]) {
130
142
  if (!props || props.length == 0) throw `Widget props undefined`
131
143
 
132
144
  const widgets: any = []
@@ -138,10 +150,10 @@ export class CloudWatchManager {
138
150
  /**
139
151
  * @summary Method to create a cloudwatch widget
140
152
  * @param {string} id scoped id of the resource
141
- * @param {CommonConstruct} scope scope in which this resource is defined
153
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
142
154
  * @param props
143
155
  */
144
- public createWidget(id: string, scope: CommonConstruct, props: any) {
156
+ public createWidget(id: string, scope: common.CommonConstruct, props: any) {
145
157
  if (!props) throw `Widget props undefined`
146
158
 
147
159
  const metrics = this.determineMetrics(scope, props.metricProps)
@@ -168,10 +180,10 @@ export class CloudWatchManager {
168
180
  /**
169
181
  * @summary Method to create a cloudwatch text widget
170
182
  * @param {string} id scoped id of the resource
171
- * @param {CommonConstruct} scope scope in which this resource is defined
172
- * @param {TextWidgetProps} props
183
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
184
+ * @param {types.TextWidgetProps} props
173
185
  */
174
- public createTextWidget(id: string, scope: CommonConstruct, props: TextWidgetProps) {
186
+ public createTextWidget(id: string, scope: common.CommonConstruct, props: types.TextWidgetProps) {
175
187
  const widget = new watch.TextWidget({
176
188
  markdown: props.markdown,
177
189
  width: props.width,
@@ -186,11 +198,16 @@ export class CloudWatchManager {
186
198
  /**
187
199
  * @summary Method to create a cloudwatch numeric widget
188
200
  * @param {string} id scoped id of the resource
189
- * @param {CommonConstruct} scope scope in which this resource is defined
190
- * @param {NumericWidgetProps} props
201
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
202
+ * @param {types.NumericWidgetProps} props
191
203
  * @param metrics
192
204
  */
193
- public createSingleValueWidget(id: string, scope: CommonConstruct, props: NumericWidgetProps, metrics: IMetric[]) {
205
+ public createSingleValueWidget(
206
+ id: string,
207
+ scope: common.CommonConstruct,
208
+ props: types.NumericWidgetProps,
209
+ metrics: IMetric[]
210
+ ) {
194
211
  const widget = new watch.SingleValueWidget({
195
212
  metrics: metrics,
196
213
  setPeriodToTimeRange: props.setPeriodToTimeRange,
@@ -208,15 +225,15 @@ export class CloudWatchManager {
208
225
  /**
209
226
  * @summary Method to create a cloudwatch graph widget
210
227
  * @param {string} id scoped id of the resource
211
- * @param {CommonConstruct} scope scope in which this resource is defined
212
- * @param {GraphWidgetProps} props
228
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
229
+ * @param {types.GraphWidgetProps} props
213
230
  * @param leftYMetrics
214
231
  * @param rightYMetrics
215
232
  */
216
233
  public createGraphWidget(
217
234
  id: string,
218
- scope: CommonConstruct,
219
- props: GraphWidgetProps,
235
+ scope: common.CommonConstruct,
236
+ props: types.GraphWidgetProps,
220
237
  leftYMetrics?: IMetric[],
221
238
  rightYMetrics?: IMetric[]
222
239
  ) {
@@ -244,14 +261,14 @@ export class CloudWatchManager {
244
261
  /**
245
262
  * @summary Method to create a cloudwatch alarm status widget
246
263
  * @param {string} id scoped id of the resource
247
- * @param {CommonConstruct} scope scope in which this resource is defined
248
- * @param {AlarmStatusWidgetProps} props
264
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
265
+ * @param {types.AlarmStatusWidgetProps} props
249
266
  * @param {watch.IAlarm[]} alarms
250
267
  */
251
268
  public createAlarmStatusWidget(
252
269
  id: string,
253
- scope: CommonConstruct,
254
- props: AlarmStatusWidgetProps,
270
+ scope: common.CommonConstruct,
271
+ props: types.AlarmStatusWidgetProps,
255
272
  alarms: watch.IAlarm[]
256
273
  ) {
257
274
  const widget = new watch.AlarmStatusWidget({
@@ -269,11 +286,16 @@ export class CloudWatchManager {
269
286
  /**
270
287
  * @summary Method to create a cloudwatch log query widget
271
288
  * @param {string} id scoped id of the resource
272
- * @param {CommonConstruct} scope scope in which this resource is defined
273
- * @param {LogQueryWidgetProps} props
289
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
290
+ * @param {types.LogQueryWidgetProps} props
274
291
  * @param {string[]} logGroupNames
275
292
  */
276
- public createLogQueryWidget(id: string, scope: CommonConstruct, props: LogQueryWidgetProps, logGroupNames: string[]) {
293
+ public createLogQueryWidget(
294
+ id: string,
295
+ scope: common.CommonConstruct,
296
+ props: types.LogQueryWidgetProps,
297
+ logGroupNames: string[]
298
+ ) {
277
299
  const widget = new watch.LogQueryWidget({
278
300
  logGroupNames: logGroupNames,
279
301
  queryString: props.queryString,
@@ -291,13 +313,13 @@ export class CloudWatchManager {
291
313
 
292
314
  /**
293
315
  * @summary Utility method to determine the metrics and dimensions
294
- * @param {CommonConstruct} scope scope in which this resource is defined
295
- * @param {MetricProps[]} metricProps
316
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
317
+ * @param {types.MetricProps[]} metricProps
296
318
  */
297
- private determineMetrics(scope: CommonConstruct, metricProps: MetricProps[]) {
319
+ private determineMetrics(scope: common.CommonConstruct, metricProps: types.MetricProps[]) {
298
320
  const metrics: watch.IMetric[] = []
299
321
  if (metricProps) {
300
- metricProps.forEach((metricProp: MetricProps) => {
322
+ metricProps.forEach((metricProp: types.MetricProps) => {
301
323
  let metricDimensions: watch.DimensionHash = metricProp.dimensionsMap || {}
302
324
  if (metricProp.functionName) {
303
325
  metricDimensions = {
@@ -350,10 +372,10 @@ export class CloudWatchManager {
350
372
  /**
351
373
  * @summary Utility method to determine the configured alarms
352
374
  * @param {string} id scoped id of the resource
353
- * @param {CommonConstruct} scope scope in which this resource is defined
375
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
354
376
  * @param {watch.AlarmProps[]} alarmProps
355
377
  */
356
- private determineAlarms(id: string, scope: CommonConstruct, alarmProps: watch.AlarmProps[]) {
378
+ private determineAlarms(id: string, scope: common.CommonConstruct, alarmProps: watch.AlarmProps[]) {
357
379
  const alarms: watch.IAlarm[] = []
358
380
  if (alarmProps) {
359
381
  alarmProps.forEach((alarmProp: watch.AlarmProps) => {
@@ -1,17 +1,17 @@
1
- import { CommonConstruct } from '../common/commonConstruct'
2
- import * as codebuild from 'aws-cdk-lib/aws-codebuild'
3
1
  import * as cdk from 'aws-cdk-lib'
2
+ import * as codebuild from 'aws-cdk-lib/aws-codebuild'
3
+ import * as common from '../../common'
4
4
 
5
5
  /**
6
6
  * @stability stable
7
7
  * @category Developer Tools
8
8
  * @summary Provides operations on AWS Code Build.
9
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
10
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
10
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
11
11
  * @example
12
- * import { CommonConstruct } from '@gradientedge/cdk-utils'
12
+ * import { common.CommonConstruct } from '@gradientedge/cdk-utils'
13
13
  *
14
- * class CustomConstruct extends CommonConstruct {
14
+ * class CustomConstruct extends common.CommonConstruct {
15
15
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
16
16
  * super(parent, id, props)
17
17
  * this.props = props
@@ -28,7 +28,7 @@ export class CodeBuildManager {
28
28
  * @param scope
29
29
  * @param dockerfilePath
30
30
  */
31
- public createImageForCloudfrontInvalidation(id: string, scope: CommonConstruct, dockerfilePath: string) {
31
+ public createImageForCloudfrontInvalidation(id: string, scope: common.CommonConstruct, dockerfilePath: string) {
32
32
  return scope.ecrManager.createDockerImage(`${id}-build-image`, scope, dockerfilePath)
33
33
  }
34
34
 
@@ -42,7 +42,7 @@ export class CodeBuildManager {
42
42
  */
43
43
  public createProjectForCloudfrontInvalidation(
44
44
  id: string,
45
- scope: CommonConstruct,
45
+ scope: common.CommonConstruct,
46
46
  dockerFilepath: string,
47
47
  distributionId: string,
48
48
  paths?: string
@@ -1,17 +1,17 @@
1
1
  import * as ecr from 'aws-cdk-lib/aws-ecr-assets'
2
- import { CommonConstruct } from '../common/commonConstruct'
3
- import { createCfnOutput } from '../utils'
2
+ import * as common from '../../common'
3
+ import * as utils from '../../utils'
4
4
 
5
5
  /**
6
6
  * @stability stable
7
7
  * @category Containers
8
8
  * @summary Provides operations on AWS Elastic Container Registry.
9
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
10
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
9
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
10
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
11
11
  * @example
12
12
  * import * as common from '@gradientedge/cdk-utils'
13
13
  *
14
- * class CustomConstruct extends common.CommonConstruct {
14
+ * class CustomConstruct extends common.common.CommonConstruct {
15
15
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
16
16
  * super(parent, id, props)
17
17
  * this.props = props
@@ -25,15 +25,15 @@ export class EcrManager {
25
25
  /**
26
26
  * @summary Method to create a docker image in ecr
27
27
  * @param {string} id scoped id of the resource
28
- * @param {CommonConstruct} scope scope in which this resource is defined
28
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
29
29
  * @param {string} dockerfilePath
30
30
  */
31
- public createDockerImage(id: string, scope: CommonConstruct, dockerfilePath: string) {
31
+ public createDockerImage(id: string, scope: common.CommonConstruct, dockerfilePath: string) {
32
32
  const asset = new ecr.DockerImageAsset(scope, `${id}`, {
33
33
  directory: dockerfilePath,
34
34
  })
35
35
 
36
- createCfnOutput(`${id}-dockerImageArn`, scope, asset.imageUri)
36
+ utils.createCfnOutput(`${id}-dockerImageArn`, scope, asset.imageUri)
37
37
 
38
38
  return asset
39
39
  }
@@ -2,20 +2,20 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2'
2
2
  import * as ecs from 'aws-cdk-lib/aws-ecs'
3
3
  import * as iam from 'aws-cdk-lib/aws-iam'
4
4
  import * as logs from 'aws-cdk-lib/aws-logs'
5
- import { CommonConstruct } from '../common/commonConstruct'
6
- import { EcsClusterProps, EcsTaskProps } from '../types'
7
- import { createCfnOutput } from '../utils'
5
+ import * as common from '../../common'
6
+ import * as types from '../../types'
7
+ import * as utils from '../../utils'
8
8
 
9
9
  /**
10
10
  * @stability stable
11
11
  * @category Containers
12
12
  * @summary Provides operations on AWS Elastic Container Service.
13
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
14
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
13
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
14
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
15
15
  * @example
16
16
  * import * as common from '@gradientedge/cdk-utils'
17
17
  *
18
- * class CustomConstruct extends common.CommonConstruct {
18
+ * class CustomConstruct extends common.common.CommonConstruct {
19
19
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
20
20
  * super(parent, id, props)
21
21
  * this.props = props
@@ -29,11 +29,11 @@ export class EcsManager {
29
29
  /**
30
30
  * @summary Method to create an ecs cluster
31
31
  * @param {string} id scoped id of the resource
32
- * @param {CommonConstruct} scope scope in which this resource is defined
33
- * @param {EcsClusterProps} props
32
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
33
+ * @param {types.EcsClusterProps} props
34
34
  * @param {ec2.IVpc} vpc
35
35
  */
36
- public createEcsCluster(id: string, scope: CommonConstruct, props: EcsClusterProps, vpc: ec2.IVpc) {
36
+ public createEcsCluster(id: string, scope: common.CommonConstruct, props: types.EcsClusterProps, vpc: ec2.IVpc) {
37
37
  if (!props) throw `Ecs Cluster props undefined`
38
38
 
39
39
  const ecsCluster = new ecs.Cluster(scope, `${id}`, {
@@ -41,8 +41,8 @@ export class EcsManager {
41
41
  vpc: vpc,
42
42
  })
43
43
 
44
- createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
45
- createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName)
44
+ utils.createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
45
+ utils.createCfnOutput(`${id}-clusterName`, scope, ecsCluster.clusterName)
46
46
 
47
47
  return ecsCluster
48
48
  }
@@ -50,8 +50,8 @@ export class EcsManager {
50
50
  /**
51
51
  * @summary Method to create an ecs fargate task
52
52
  * @param {string} id scoped id of the resource
53
- * @param {CommonConstruct} scope scope in which this resource is defined
54
- * @param {EcsTaskProps} props
53
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
54
+ * @param {types.EcsTaskProps} props
55
55
  * @param {ecs.ICluster} cluster
56
56
  * @param {iam.Role} role
57
57
  * @param {logs.ILogGroup} logGroup
@@ -60,8 +60,8 @@ export class EcsManager {
60
60
  */
61
61
  public createEcsFargateTask(
62
62
  id: string,
63
- scope: CommonConstruct,
64
- props: EcsTaskProps,
63
+ scope: common.CommonConstruct,
64
+ props: types.EcsTaskProps,
65
65
  cluster: ecs.ICluster,
66
66
  role: iam.Role,
67
67
  logGroup: logs.ILogGroup,
@@ -93,7 +93,7 @@ export class EcsManager {
93
93
  privileged: false,
94
94
  })
95
95
 
96
- createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn)
96
+ utils.createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn)
97
97
 
98
98
  return ecsTask
99
99
  }
@@ -1,20 +1,20 @@
1
1
  import * as ec2 from 'aws-cdk-lib/aws-ec2'
2
2
  import * as ecr from 'aws-cdk-lib/aws-ecr-assets'
3
3
  import * as eks from 'aws-cdk-lib/aws-eks'
4
- import { CommonConstruct } from '../common/commonConstruct'
5
- import { EksClusterProps } from '../types'
6
- import { createCfnOutput } from '../utils'
4
+ import * as common from '../../common'
5
+ import * as types from '../../types'
6
+ import * as utils from '../../utils'
7
7
 
8
8
  /**
9
9
  * @stability stable
10
10
  * @category Containers
11
11
  * @summary Provides operations on AWS Elastic Kubernetes Service.
12
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
13
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
12
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
13
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
14
14
  * @example
15
15
  * import * as common from '@gradientedge/cdk-utils'
16
16
  *
17
- * class CustomConstruct extends common.CommonConstruct {
17
+ * class CustomConstruct extends common.common.CommonConstruct {
18
18
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
19
19
  * super(parent, id, props)
20
20
  * this.props = props
@@ -28,15 +28,15 @@ export class EksManager {
28
28
  /**
29
29
  * @summary Method to create an eks deployment
30
30
  * @param {string} id scoped id of the resource
31
- * @param {CommonConstruct} scope scope in which this resource is defined
32
- * @param {EksClusterProps} props
31
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
32
+ * @param {types.EksClusterProps} props
33
33
  * @param {ecr.DockerImageAsset} image
34
34
  * @param {ec2.IVpc} vpc
35
35
  */
36
36
  public createEksDeployment(
37
37
  id: string,
38
- scope: CommonConstruct,
39
- props: EksClusterProps,
38
+ scope: common.CommonConstruct,
39
+ props: types.EksClusterProps,
40
40
  image: ecr.DockerImageAsset,
41
41
  vpc: ec2.IVpc
42
42
  ) {
@@ -93,8 +93,8 @@ export class EksManager {
93
93
 
94
94
  cluster.addManifest(`${id}Pod`, service, deployment)
95
95
 
96
- createCfnOutput(`${id}-clusterArn`, scope, cluster.clusterArn)
97
- createCfnOutput(`${id}-clusterEndpoint`, scope, cluster.clusterEndpoint)
96
+ utils.createCfnOutput(`${id}-clusterArn`, scope, cluster.clusterArn)
97
+ utils.createCfnOutput(`${id}-clusterEndpoint`, scope, cluster.clusterEndpoint)
98
98
 
99
99
  return cluster
100
100
  }
@@ -2,20 +2,20 @@ import * as ecs from 'aws-cdk-lib/aws-ecs'
2
2
  import * as events from 'aws-cdk-lib/aws-events'
3
3
  import * as iam from 'aws-cdk-lib/aws-iam'
4
4
  import * as lambda from 'aws-cdk-lib/aws-lambda'
5
- import { CommonConstruct } from '../common/commonConstruct'
6
- import { RuleProps } from '../types'
7
- import { createCfnOutput } from '../utils'
5
+ import * as common from '../../common'
6
+ import * as types from '../../types'
7
+ import * as utils from '../../utils'
8
8
 
9
9
  /**
10
10
  * @stability stable
11
11
  * @category Application Integration
12
12
  * @summary Provides operations on AWS EventBridge.
13
- * - A new instance of this class is injected into {@link CommonConstruct} constructor.
14
- * - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
13
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
14
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
15
15
  * @example
16
16
  * import * as common from '@gradientedge/cdk-utils'
17
17
  *
18
- * class CustomConstruct extends common.CommonConstruct {
18
+ * class CustomConstruct extends common.common.CommonConstruct {
19
19
  * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
20
20
  * super(parent, id, props)
21
21
  * this.props = props
@@ -29,8 +29,8 @@ export class EventManager {
29
29
  /**
30
30
  * @summary Method to create an eventbridge rule with lambda target
31
31
  * @param {string} id scoped id of the resource
32
- * @param {CommonConstruct} scope scope in which this resource is defined
33
- * @param {RuleProps} props
32
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
33
+ * @param {types.RuleProps} props
34
34
  * @param {lambda.Function} lambdaFunction
35
35
  * @param {string} eventBusName
36
36
  * @param {any} eventPattern
@@ -38,8 +38,8 @@ export class EventManager {
38
38
  */
39
39
  public createLambdaRule(
40
40
  id: string,
41
- scope: CommonConstruct,
42
- props: RuleProps,
41
+ scope: common.CommonConstruct,
42
+ props: types.RuleProps,
43
43
  lambdaFunction: lambda.Function,
44
44
  eventBusName?: string,
45
45
  eventPattern?: any,
@@ -64,8 +64,8 @@ export class EventManager {
64
64
  sourceArn: eventRule.attrArn,
65
65
  })
66
66
 
67
- createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
68
- createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
67
+ utils.createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
68
+ utils.createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
69
69
 
70
70
  return eventRule
71
71
  }
@@ -73,8 +73,8 @@ export class EventManager {
73
73
  /**
74
74
  * @summary Method to create an eventbridge rule with fargate task target
75
75
  * @param {string} id scoped id of the resource
76
- * @param {CommonConstruct} scope scope in which this resource is defined
77
- * @param {RuleProps} props
76
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
77
+ * @param {types.RuleProps} props
78
78
  * @param {ecs.ICluster} cluster
79
79
  * @param {ecs.ITaskDefinition} task
80
80
  * @param {string[]} subnetIds
@@ -83,8 +83,8 @@ export class EventManager {
83
83
  */
84
84
  public createFargateTaskRule(
85
85
  id: string,
86
- scope: CommonConstruct,
87
- props: RuleProps,
86
+ scope: common.CommonConstruct,
87
+ props: types.RuleProps,
88
88
  cluster: ecs.ICluster,
89
89
  task: ecs.ITaskDefinition,
90
90
  subnetIds: string[],
@@ -115,8 +115,8 @@ export class EventManager {
115
115
  ],
116
116
  })
117
117
 
118
- createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
119
- createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
118
+ utils.createCfnOutput(`${id}-ruleArn`, scope, eventRule.attrArn)
119
+ utils.createCfnOutput(`${id}-ruleName`, scope, eventRule.name)
120
120
 
121
121
  return eventRule
122
122
  }