@gradientedge/cdk-utils 8.91.0 → 8.92.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 +0 -18
  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 +0 -18
  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 +1 -19
  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 +1 -19
  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,11 +16,7 @@ import { CommonConstruct } from '../../common'
16
16
  import { SiteWithEcsBackendProps } from './types'
17
17
 
18
18
  /**
19
- * @stability stable
20
- * @category cdk-utils.site-with-ecs-backend
21
- * @subcategory construct
22
19
  * @classdesc Provides a construct to create and deploy a site hosted with an clustered ECS/ELB backend
23
- *
24
20
  * @example
25
21
  * import { SiteWithEcsBackend, SiteWithEcsBackendProps } '@gradientedge/cdk-utils'
26
22
  * import { Construct } from 'constructs'
@@ -33,7 +29,6 @@ import { SiteWithEcsBackendProps } from './types'
33
29
  * this.initResources()
34
30
  * }
35
31
  * }
36
- * @mixin
37
32
  */
38
33
  export class SiteWithEcsBackend extends CommonConstruct {
39
34
  /* site properties */
@@ -77,7 +72,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
77
72
 
78
73
  /**
79
74
  * @summary Initialise and provision resources
80
- * @protected
81
75
  */
82
76
  protected initResources() {
83
77
  this.resolveHostedZone()
@@ -104,7 +98,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
104
98
 
105
99
  /**
106
100
  * @summary Method to resolve a hosted zone based on domain attributes
107
- * @protected
108
101
  */
109
102
  protected resolveHostedZone() {
110
103
  this.siteHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(
@@ -116,7 +109,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
116
109
 
117
110
  /**
118
111
  * @summary Method to resolve a certificate based on attributes
119
- * @protected
120
112
  */
121
113
  protected resolveCertificate() {
122
114
  /* determine site certificate */
@@ -149,13 +141,11 @@ export class SiteWithEcsBackend extends CommonConstruct {
149
141
  /**
150
142
  * @summary Method to resolve secrets from SecretsManager
151
143
  * - To be implemented in the overriding method in the implementation class
152
- * @protected
153
144
  */
154
145
  protected resolveSiteSecrets() {}
155
146
 
156
147
  /**
157
148
  * @summary Method to resolve site domain names
158
- * @protected
159
149
  */
160
150
  protected resolveSiteDomainNames() {
161
151
  /* the internal domain name used by ELB */
@@ -175,15 +165,17 @@ export class SiteWithEcsBackend extends CommonConstruct {
175
165
 
176
166
  /**
177
167
  * Create VPC
178
- * @protected
179
168
  */
180
169
  protected createVpc() {
181
- this.siteVpc = this.vpcManager.createCommonVpc(this, this.props.siteVpc, this.props.siteVpc.vpcName)
170
+ if (this.props.useExistingVpc) {
171
+ this.siteVpc = this.vpcManager.retrieveCommonVpc(`${this.id}`, this, this.props.siteVpc.vpcName)
172
+ } else {
173
+ this.siteVpc = this.vpcManager.createCommonVpc(this, this.props.siteVpc, this.props.siteVpc.vpcName)
174
+ }
182
175
  }
183
176
 
184
177
  /**
185
178
  * @summary Method to create iam policy for ECS Task
186
- * @protected
187
179
  */
188
180
  protected createEcsPolicy() {
189
181
  this.siteEcsPolicy = new iam.PolicyDocument({
@@ -193,7 +185,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
193
185
 
194
186
  /**
195
187
  * @summary Method to create iam role for ECS Task
196
- * @protected
197
188
  */
198
189
  protected createEcsRole() {
199
190
  this.siteEcsRole = this.iamManager.createRoleForEcsExecution(`${this.id}-ecs-role`, this, this.siteEcsPolicy)
@@ -201,19 +192,17 @@ export class SiteWithEcsBackend extends CommonConstruct {
201
192
 
202
193
  /**
203
194
  * @summary Method to create environment variables used by ECS task
204
- * @protected
205
195
  */
206
196
  protected createEcsEnvironment() {
207
197
  this.siteEcsEnvironment = {
208
- NODE_ENV: this.props.nodeEnv,
209
198
  LOG_LEVEL: this.props.logLevel,
199
+ NODE_ENV: this.props.nodeEnv,
210
200
  TZ: this.props.timezone,
211
201
  }
212
202
  }
213
203
 
214
204
  /**
215
205
  * Method to create an ECS cluster
216
- * @protected
217
206
  */
218
207
  protected createEcsCluster() {
219
208
  this.siteEcsCluster = this.ecsManager.createEcsCluster(
@@ -226,7 +215,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
226
215
 
227
216
  /**
228
217
  * Method to create log group used by ECS task
229
- * @protected
230
218
  */
231
219
  protected createEcsLogGroup() {
232
220
  this.siteEcsLogGroup = this.logManager.createLogGroup(`${this.id}-ecs-log-group`, this, this.props.siteLog)
@@ -234,7 +222,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
234
222
 
235
223
  /**
236
224
  * Method to create docker build arguments for ECS Image step
237
- * @protected
238
225
  */
239
226
  protected createEcsBuildArgs() {
240
227
  this.siteEcsBuildArgs = {}
@@ -242,7 +229,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
242
229
 
243
230
  /**
244
231
  * Method to create container image for ECS task
245
- * @protected
246
232
  */
247
233
  protected createEcsContainerImage() {
248
234
  this.siteEcsContainerImage = ecs.ContainerImage.fromAsset(this.props.siteEcsContainerImagePath, {
@@ -252,57 +238,56 @@ export class SiteWithEcsBackend extends CommonConstruct {
252
238
 
253
239
  /**
254
240
  * Method to create Application Loadbalanced ECS Fargate Service
255
- * @protected
256
241
  */
257
242
  protected createEcsService() {
258
243
  const fargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, `${this.id}-ecs-service`, {
244
+ assignPublicIp: true,
245
+ certificate: this.siteRegionalCertificate,
259
246
  cluster: this.siteEcsCluster,
247
+ cpu: this.props.siteTask.cpu,
260
248
  desiredCount: this.props.siteTask.desiredCount,
249
+ domainName: this.siteInternalDomainName,
250
+ domainZone: this.siteHostedZone,
261
251
  enableECSManagedTags: true,
262
- serviceName: `${this.id}-${this.props.stage}`,
263
- cpu: this.props.siteTask.cpu,
252
+ healthCheckGracePeriod: cdk.Duration.seconds(60),
253
+ listenerPort: this.props.siteTask.listenerPort,
264
254
  loadBalancerName: this.props.siteTask.loadBalancerName
265
255
  ? `${this.props.siteTask.loadBalancerName}-${this.props.stage}`
266
256
  : `${this.id}-${this.props.stage}`,
267
- certificate: this.siteRegionalCertificate,
268
- domainName: this.siteInternalDomainName,
269
- domainZone: this.siteHostedZone,
270
- listenerPort: this.props.siteTask.listenerPort,
257
+ maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
271
258
  memoryLimitMiB: this.props.siteTask.memoryLimitMiB,
272
- healthCheckGracePeriod: cdk.Duration.seconds(60),
273
- assignPublicIp: true,
274
259
  minHealthyPercent: this.props.siteTask.minHealthyPercent,
275
- maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
260
+ serviceName: `${this.id}-${this.props.stage}`,
276
261
  taskDefinition: this.props.siteTask.taskDefinition,
277
262
  taskImageOptions: {
263
+ containerPort: this.props.siteTask.taskImageOptions?.containerPort,
278
264
  enableLogging: true,
265
+ environment: this.siteEcsEnvironment,
266
+ executionRole: this.siteEcsRole,
267
+ image: this.siteEcsContainerImage,
279
268
  logDriver: ecs.LogDriver.awsLogs({
280
269
  logGroup: this.siteEcsLogGroup,
281
- streamPrefix: `${this.id}-${this.props.stage}/ecs`,
282
- multilinePattern: this.props.siteTask.logging?.multilinePattern,
283
270
  logRetention: this.props.siteTask.logging?.logRetention,
271
+ multilinePattern: this.props.siteTask.logging?.multilinePattern,
272
+ streamPrefix: `${this.id}-${this.props.stage}/ecs`,
284
273
  }),
285
- image: this.siteEcsContainerImage,
286
- executionRole: this.siteEcsRole,
287
- taskRole: this.siteEcsRole,
288
- containerPort: this.props.siteTask.taskImageOptions?.containerPort,
289
- environment: this.siteEcsEnvironment,
290
274
  secrets: this.siteSecrets,
275
+ taskRole: this.siteEcsRole,
291
276
  },
292
277
  })
293
278
 
294
279
  if (this.props.siteHealthCheck) {
295
280
  fargateService.targetGroup.configureHealthCheck({
296
281
  enabled: this.props.siteHealthCheck.enabled ?? true,
282
+ healthyGrpcCodes: this.props.siteHealthCheck.healthyGrpcCodes,
283
+ healthyHttpCodes: this.props.siteHealthCheck.healthyHttpCodes,
284
+ healthyThresholdCount: this.props.siteHealthCheck.healthyThresholdCount,
285
+ interval: cdk.Duration.seconds(this.props.siteHealthCheck.intervalInSecs),
297
286
  path: this.props.siteHealthCheck.path ?? '/',
298
287
  port: this.props.siteHealthCheck.port,
299
- interval: cdk.Duration.seconds(this.props.siteHealthCheck.intervalInSecs),
288
+ protocol: this.props.siteHealthCheck.protocol,
300
289
  timeout: cdk.Duration.seconds(this.props.siteHealthCheck.timeoutInSecs),
301
- healthyThresholdCount: this.props.siteHealthCheck.healthyThresholdCount,
302
290
  unhealthyThresholdCount: this.props.siteHealthCheck.unhealthyThresholdCount,
303
- healthyGrpcCodes: this.props.siteHealthCheck.healthyGrpcCodes,
304
- healthyHttpCodes: this.props.siteHealthCheck.healthyHttpCodes,
305
- protocol: this.props.siteHealthCheck.protocol,
306
291
  })
307
292
  }
308
293
 
@@ -316,8 +301,8 @@ export class SiteWithEcsBackend extends CommonConstruct {
316
301
 
317
302
  if (this.props.siteTask.siteScaling) {
318
303
  const scalableTaskCount = this.siteEcsService.autoScaleTaskCount({
319
- minCapacity: this.props.siteTask.siteScaling.minCapacity,
320
304
  maxCapacity: this.props.siteTask.siteScaling.maxCapacity ?? 4,
305
+ minCapacity: this.props.siteTask.siteScaling.minCapacity,
321
306
  })
322
307
 
323
308
  if (this.props.siteTask.siteScaling.scaleOnCpuUtilization) {
@@ -365,14 +350,14 @@ export class SiteWithEcsBackend extends CommonConstruct {
365
350
 
366
351
  /* add the efs volume to ecs task definition */
367
352
  this.siteEcsTaskDefinition.addVolume({
368
- name: `${this.id}-fs`,
369
353
  efsVolumeConfiguration: {
354
+ authorizationConfig: this.props.siteFileSystem.authorizationConfig,
370
355
  fileSystemId: this.siteFileSystem.fileSystemId,
371
356
  rootDirectory: this.props.siteFileSystem.rootDirectory,
372
357
  transitEncryption: this.props.siteFileSystem.transitEncryption,
373
358
  transitEncryptionPort: this.props.siteFileSystem.transitEncryptionPort,
374
- authorizationConfig: this.props.siteFileSystem.authorizationConfig,
375
359
  },
360
+ name: `${this.id}-fs`,
376
361
  })
377
362
 
378
363
  if (this.props.siteTask.mountPoints && this.props.siteTask.mountPoints.length > 0) {
@@ -394,7 +379,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
394
379
 
395
380
  /**
396
381
  * Method to create log bucket for site distribution
397
- * @protected
398
382
  */
399
383
  protected createSiteLogBucket() {
400
384
  this.siteLogBucket = this.s3Manager.createS3Bucket(`${this.id}-site-logs`, this, this.props.siteLogBucket)
@@ -409,7 +393,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
409
393
 
410
394
  /**
411
395
  * @summary Method to create a site cloudfront function
412
- * @protected
413
396
  */
414
397
  protected createSiteCloudfrontFunction() {
415
398
  if (this.props.siteCloudfrontFunctionProps) {
@@ -423,14 +406,13 @@ export class SiteWithEcsBackend extends CommonConstruct {
423
406
 
424
407
  /**
425
408
  * @summary Method to create a site cloudfront function associations
426
- * @protected
427
409
  */
428
410
  protected resolveSiteFunctionAssociations() {
429
411
  if (this.props.siteCloudfrontFunctionProps) {
430
412
  this.siteFunctionAssociations = [
431
413
  {
432
- function: this.siteCloudfrontFunction,
433
414
  eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
415
+ function: this.siteCloudfrontFunction,
434
416
  },
435
417
  ]
436
418
  }
@@ -438,7 +420,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
438
420
 
439
421
  /**
440
422
  * Method to create Site distribution
441
- * @protected
442
423
  */
443
424
  protected createDistribution() {
444
425
  this.siteDistribution = this.cloudFrontManager.createDistributionWithHttpOrigin(
@@ -455,7 +436,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
455
436
 
456
437
  /**
457
438
  * Method to create Route53 records for distribution
458
- * @protected
459
439
  */
460
440
  protected createNetworkMappings() {
461
441
  this.route53Manager.createCloudFrontTargetARecord(
@@ -470,7 +450,6 @@ export class SiteWithEcsBackend extends CommonConstruct {
470
450
 
471
451
  /**
472
452
  * Method to invalidation the cloudfront distribution cache after a deployment
473
- * @protected
474
453
  */
475
454
  protected invalidateDistributionCache() {
476
455
  if (this.props.siteCacheInvalidationDockerFilePath) {
@@ -14,29 +14,28 @@ import {
14
14
  import { VpcProps } from 'aws-cdk-lib/aws-ec2'
15
15
 
16
16
  /**
17
- * @category cdk-utils.site-with-ecs-backend
18
- * @subcategory Properties
19
17
  */
20
18
  export interface SiteWithEcsBackendProps extends CommonStackProps {
19
+ logLevel: string
20
+ nodeEnv: string
21
21
  siteCacheInvalidationDockerFilePath?: string
22
- siteHealthCheck: HealthCheck
23
22
  siteCertificate: AcmProps
24
- siteRegionalCertificate: AcmProps
23
+ siteCloudfrontFunctionProps?: CloudfrontFunctionProps
25
24
  siteCluster: EcsClusterProps
26
25
  siteDistribution: DistributionProps
27
- siteCloudfrontFunctionProps?: CloudfrontFunctionProps
28
- siteFunctionFilePath?: string
29
26
  siteEcsContainerImagePath: string
27
+ siteFileSystem?: EfsFileSystemProps
28
+ siteFileSystemAccessPoints?: EfsAccessPointOptions[]
29
+ siteFunctionFilePath?: string
30
+ siteHealthCheck: HealthCheck
30
31
  siteLog: LogProps
31
32
  siteLogBucket: S3BucketProps
32
33
  siteRecordName?: string
34
+ siteRegionalCertificate: AcmProps
33
35
  siteSubDomain: string
34
36
  siteTask: EcsApplicationLoadBalancedFargateServiceProps
35
37
  siteVpc: VpcProps
36
- siteFileSystem?: EfsFileSystemProps
37
- siteFileSystemAccessPoints?: EfsAccessPointOptions[]
38
- useExistingHostedZone: boolean
39
- nodeEnv: string
40
- logLevel: string
41
38
  timezone: string
39
+ useExistingHostedZone: boolean
40
+ useExistingVpc: boolean
42
41
  }
@@ -5,11 +5,7 @@ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'
5
5
  import { StaticAssetDeploymentProps } from './types'
6
6
 
7
7
  /**
8
- * @stability stable
9
- * @category cdk-utils.static-asset-deployment
10
- * @subcategory construct
11
8
  * @classdesc Provides a construct to create and deploy static assets into S3 bucket
12
- *
13
9
  * @example
14
10
  * import { StaticAssetDeployment, StaticAssetDeploymentProps } '@gradientedge/cdk-utils'
15
11
  * import { Construct } from 'constructs'
@@ -22,7 +18,6 @@ import { StaticAssetDeploymentProps } from './types'
22
18
  * this.initResources()
23
19
  * }
24
20
  * }
25
- * @mixin
26
21
  */
27
22
  export class StaticAssetDeployment extends CommonConstruct {
28
23
  /* construct properties */
@@ -40,7 +35,6 @@ export class StaticAssetDeployment extends CommonConstruct {
40
35
 
41
36
  /**
42
37
  * @summary Initialise and provision resources
43
- * @protected
44
38
  */
45
39
  public initResources() {
46
40
  this.createAssetBucket()
@@ -49,7 +43,6 @@ export class StaticAssetDeployment extends CommonConstruct {
49
43
 
50
44
  /**
51
45
  * @summary Create the static asset bucket
52
- * @protected
53
46
  */
54
47
  protected createAssetBucket() {
55
48
  this.staticAssetBucket = this.s3Manager.createS3Bucket(`${this.id}-sa-bucket`, this, this.props.staticAssetBucket)
@@ -57,7 +50,6 @@ export class StaticAssetDeployment extends CommonConstruct {
57
50
 
58
51
  /**
59
52
  * @summary Deploy the static assests into the static asset bucket
60
- * @protected
61
53
  */
62
54
  protected deployStaticAssets() {
63
55
  new s3deploy.BucketDeployment(this, `${this.id}-static-deployment`, {
@@ -7,8 +7,8 @@ export interface AssetExport {
7
7
  }
8
8
 
9
9
  export interface StaticAssetDeploymentProps extends CommonStackProps {
10
+ staticAssetBucket: S3BucketProps
10
11
  staticAssetDeployment: BucketDeploymentProps
11
12
  staticAssetSources: any[]
12
- staticAssetBucket: S3BucketProps
13
13
  staticAssetsForExport?: AssetExport[]
14
14
  }
@@ -8,11 +8,7 @@ import { CommonConstruct } from '../../common'
8
8
  import { StaticSiteProps } from './types'
9
9
 
10
10
  /**
11
- * @stability stable
12
- * @category cdk-utils.static-site
13
- * @subcategory construct
14
11
  * @classdesc Provides a construct to create and deploy a s3 hosted static site
15
- *
16
12
  * @example
17
13
  * import { StaticSite, StaticSiteProps } '@gradientedge/cdk-utils'
18
14
  * import { Construct } from 'constructs'
@@ -25,7 +21,6 @@ import { StaticSiteProps } from './types'
25
21
  * this.initResources()
26
22
  * }
27
23
  * }
28
- * @mixin
29
24
  */
30
25
  export class StaticSite extends CommonConstruct {
31
26
  /* static site properties */
@@ -53,7 +48,6 @@ export class StaticSite extends CommonConstruct {
53
48
 
54
49
  /**
55
50
  * @summary Initialise and provision resources
56
- * @protected
57
51
  */
58
52
  protected initResources() {
59
53
  this.resolveHostedZone()
@@ -72,7 +66,6 @@ export class StaticSite extends CommonConstruct {
72
66
 
73
67
  /**
74
68
  * @summary Method to resolve a hosted zone based on domain attributes
75
- * @protected
76
69
  */
77
70
  protected resolveHostedZone() {
78
71
  this.siteHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(
@@ -84,7 +77,6 @@ export class StaticSite extends CommonConstruct {
84
77
 
85
78
  /**
86
79
  * @summary Method to resolve a certificate based on attributes
87
- * @protected
88
80
  */
89
81
  protected resolveCertificate() {
90
82
  if (
@@ -108,7 +100,6 @@ export class StaticSite extends CommonConstruct {
108
100
 
109
101
  /**
110
102
  * @summary Method to create a site log bucket
111
- * @protected
112
103
  */
113
104
  protected createSiteLogBucket() {
114
105
  this.siteLogBucket = this.s3Manager.createS3Bucket(`${this.id}-site-logs`, this, this.props.siteLogBucket)
@@ -116,7 +107,6 @@ export class StaticSite extends CommonConstruct {
116
107
 
117
108
  /**
118
109
  * @summary Method to create a site bucket
119
- * @protected
120
110
  */
121
111
  protected createSiteBucket() {
122
112
  this.siteBucket = this.s3Manager.createS3Bucket(`${this.id}-site`, this, this.props.siteBucket)
@@ -128,7 +118,6 @@ export class StaticSite extends CommonConstruct {
128
118
 
129
119
  /**
130
120
  * @summary Method to create a site cloudfront function
131
- * @protected
132
121
  */
133
122
  protected createSiteCloudfrontFunction() {
134
123
  if (this.props.siteCloudfrontFunctionProps) {
@@ -142,14 +131,13 @@ export class StaticSite extends CommonConstruct {
142
131
 
143
132
  /**
144
133
  * @summary Method to create a site cloudfront function associations
145
- * @protected
146
134
  */
147
135
  protected resolveSiteFunctionAssociations() {
148
136
  if (this.props.siteCloudfrontFunctionProps) {
149
137
  this.siteFunctionAssociations = [
150
138
  {
151
- function: this.siteCloudfrontFunction,
152
139
  eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
140
+ function: this.siteCloudfrontFunction,
153
141
  },
154
142
  ]
155
143
  }
@@ -157,13 +145,11 @@ export class StaticSite extends CommonConstruct {
157
145
 
158
146
  /**
159
147
  * @summary Method to create a site origin access identity
160
- * @protected
161
148
  */
162
149
  protected createSiteOriginAccessIdentity() {}
163
150
 
164
151
  /**
165
152
  * @summary Method to create a site cloudfront distribution
166
- * @protected
167
153
  */
168
154
  protected createSiteDistribution() {
169
155
  if (!this.props.siteDistribution) throw 'SiteDistribution props undefined'
@@ -184,7 +170,6 @@ export class StaticSite extends CommonConstruct {
184
170
 
185
171
  /**
186
172
  * @summary Method to create route53 records for static site
187
- * @protected
188
173
  */
189
174
  protected createSiteRouteAssets() {
190
175
  this.siteARecord = this.route53Manager.createCloudFrontTargetARecord(
@@ -199,7 +184,6 @@ export class StaticSite extends CommonConstruct {
199
184
 
200
185
  /**
201
186
  * @summary Method to deploy the static assets into s3 bucket for static site
202
- * @protected
203
187
  */
204
188
  protected deploySite() {
205
189
  this.s3Manager.doBucketDeployment(
@@ -215,7 +199,6 @@ export class StaticSite extends CommonConstruct {
215
199
 
216
200
  /**
217
201
  * Method to invalidation the cloudfront distribution cache after a deployment
218
- * @protected
219
202
  */
220
203
  protected invalidateDistributionCache() {
221
204
  if (this.props.siteCacheInvalidationDockerFilePath) {
@@ -3,25 +3,23 @@ import { AcmProps, CloudfrontFunctionProps, DistributionProps, S3BucketProps } f
3
3
  import { ISource } from 'aws-cdk-lib/aws-s3-deployment'
4
4
 
5
5
  /**
6
- * @category cdk-utils.static-site
7
- * @subcategory Properties
8
6
  */
9
7
  export interface StaticSiteProps extends CommonStackProps {
8
+ logLevel: string
9
+ nodeEnv: string
10
+ siteAliases?: string[]
11
+ siteBucket: S3BucketProps
10
12
  siteCacheInvalidationDockerFilePath?: string
11
- siteCreateAltARecord: boolean
12
13
  siteCertificate: AcmProps
13
- siteBucket: S3BucketProps
14
- siteLogBucket: S3BucketProps
15
- siteDistribution?: DistributionProps
16
14
  siteCloudfrontFunctionProps?: CloudfrontFunctionProps
15
+ siteCreateAltARecord: boolean
16
+ siteDistribution?: DistributionProps
17
17
  siteFunctionFilePath?: string
18
- siteSource: ISource
19
18
  siteHostedZoneDomainName?: string
19
+ siteLogBucket: S3BucketProps
20
20
  siteRecordName?: string
21
+ siteSource: ISource
21
22
  siteSubDomain?: string
22
- siteAliases?: string[]
23
- useExistingHostedZone: boolean
24
- nodeEnv: string
25
- logLevel: string
26
23
  timezone: string
24
+ useExistingHostedZone: boolean
27
25
  }