@gradientedge/cdk-utils 8.90.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 (226) 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 +7 -12
  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/index.d.ts +1 -0
  133. package/dist/src/lib/services/aws/web-application-firewall/index.js +1 -0
  134. package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
  135. package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
  136. package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
  137. package/dist/src/lib/types/aws/index.d.ts +0 -2
  138. package/dist/src/lib/utils/aws/index.d.ts +6 -9
  139. package/dist/src/lib/utils/aws/index.js +7 -10
  140. package/dist/src/lib/utils/index.d.ts +6 -13
  141. package/dist/src/lib/utils/index.js +4 -12
  142. package/package.json +5 -5
  143. package/src/lib/common/construct.ts +4 -7
  144. package/src/lib/common/stack.ts +9 -13
  145. package/src/lib/common/types.ts +0 -2
  146. package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
  147. package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
  148. package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
  149. package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
  150. package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
  151. package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
  152. package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
  153. package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
  154. package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
  155. package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
  156. package/src/lib/construct/graphql-api-lambda/main.ts +1 -19
  157. package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
  158. package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
  159. package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
  160. package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
  161. package/src/lib/construct/rest-api-lambda/main.ts +1 -19
  162. package/src/lib/construct/rest-api-lambda/types.ts +7 -12
  163. package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
  164. package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
  165. package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
  166. package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
  167. package/src/lib/construct/static-asset-deployment/main.ts +0 -8
  168. package/src/lib/construct/static-asset-deployment/types.ts +1 -1
  169. package/src/lib/construct/static-site/main.ts +1 -18
  170. package/src/lib/construct/static-site/types.ts +9 -11
  171. package/src/lib/services/aws/api-gateway/main.ts +43 -47
  172. package/src/lib/services/aws/api-gateway/types.ts +0 -2
  173. package/src/lib/services/aws/appconfig/constants.ts +26 -32
  174. package/src/lib/services/aws/appconfig/main.ts +19 -22
  175. package/src/lib/services/aws/appconfig/types.ts +1 -3
  176. package/src/lib/services/aws/certificate-manager/main.ts +5 -10
  177. package/src/lib/services/aws/certificate-manager/types.ts +3 -5
  178. package/src/lib/services/aws/cloudfront/main.ts +56 -62
  179. package/src/lib/services/aws/cloudfront/types.ts +1 -7
  180. package/src/lib/services/aws/cloudtrail/main.ts +8 -12
  181. package/src/lib/services/aws/cloudtrail/types.ts +0 -2
  182. package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
  183. package/src/lib/services/aws/cloudwatch/main.ts +116 -122
  184. package/src/lib/services/aws/cloudwatch/types.ts +20 -42
  185. package/src/lib/services/aws/codebuild/main.ts +3 -7
  186. package/src/lib/services/aws/dynamodb/main.ts +13 -17
  187. package/src/lib/services/aws/dynamodb/types.ts +0 -2
  188. package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
  189. package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
  190. package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
  191. package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
  192. package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
  193. package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
  194. package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
  195. package/src/lib/services/aws/elasticache/main.ts +35 -39
  196. package/src/lib/services/aws/elasticache/types.ts +0 -4
  197. package/src/lib/services/aws/eventbridge/main.ts +34 -38
  198. package/src/lib/services/aws/eventbridge/target.ts +8 -11
  199. package/src/lib/services/aws/eventbridge/types.ts +2 -10
  200. package/src/lib/services/aws/evidently/main.ts +19 -23
  201. package/src/lib/services/aws/evidently/types.ts +0 -10
  202. package/src/lib/services/aws/identity-access-management/main.ts +97 -101
  203. package/src/lib/services/aws/key-management-service/main.ts +6 -10
  204. package/src/lib/services/aws/key-management-service/types.ts +0 -2
  205. package/src/lib/services/aws/lambda/main.ts +64 -69
  206. package/src/lib/services/aws/lambda/types.ts +6 -16
  207. package/src/lib/services/aws/route53/main.ts +19 -23
  208. package/src/lib/services/aws/route53/types.ts +0 -2
  209. package/src/lib/services/aws/secrets-manager/main.ts +6 -28
  210. package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
  211. package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
  212. package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
  213. package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
  214. package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
  215. package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
  216. package/src/lib/services/aws/step-function/main.ts +91 -95
  217. package/src/lib/services/aws/step-function/types.ts +0 -32
  218. package/src/lib/services/aws/systems-manager/main.ts +13 -19
  219. package/src/lib/services/aws/systems-manager/types.ts +0 -2
  220. package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
  221. package/src/lib/services/aws/web-application-firewall/index.ts +1 -0
  222. package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
  223. package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
  224. package/src/lib/types/aws/index.ts +0 -2
  225. package/src/lib/utils/aws/index.ts +7 -10
  226. package/src/lib/utils/index.ts +4 -12
@@ -32,11 +32,7 @@ const ecsPatterns = __importStar(require("aws-cdk-lib/aws-ecs-patterns"));
32
32
  const iam = __importStar(require("aws-cdk-lib/aws-iam"));
33
33
  const common_1 = require("../../common");
34
34
  /**
35
- * @stability stable
36
- * @category cdk-utils.site-with-ecs-backend
37
- * @subcategory construct
38
35
  * @classdesc Provides a construct to create and deploy a site hosted with an clustered ECS/ELB backend
39
- *
40
36
  * @example
41
37
  * import { SiteWithEcsBackend, SiteWithEcsBackendProps } '@gradientedge/cdk-utils'
42
38
  * import { Construct } from 'constructs'
@@ -49,7 +45,6 @@ const common_1 = require("../../common");
49
45
  * this.initResources()
50
46
  * }
51
47
  * }
52
- * @mixin
53
48
  */
54
49
  class SiteWithEcsBackend extends common_1.CommonConstruct {
55
50
  /* site properties */
@@ -89,7 +84,6 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
89
84
  }
90
85
  /**
91
86
  * @summary Initialise and provision resources
92
- * @protected
93
87
  */
94
88
  initResources() {
95
89
  this.resolveHostedZone();
@@ -115,14 +109,12 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
115
109
  }
116
110
  /**
117
111
  * @summary Method to resolve a hosted zone based on domain attributes
118
- * @protected
119
112
  */
120
113
  resolveHostedZone() {
121
114
  this.siteHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(`${this.id}-hosted-zone`, this, this.props.useExistingHostedZone);
122
115
  }
123
116
  /**
124
117
  * @summary Method to resolve a certificate based on attributes
125
- * @protected
126
118
  */
127
119
  resolveCertificate() {
128
120
  /* determine site certificate */
@@ -137,12 +129,10 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
137
129
  /**
138
130
  * @summary Method to resolve secrets from SecretsManager
139
131
  * - To be implemented in the overriding method in the implementation class
140
- * @protected
141
132
  */
142
133
  resolveSiteSecrets() { }
143
134
  /**
144
135
  * @summary Method to resolve site domain names
145
- * @protected
146
136
  */
147
137
  resolveSiteDomainNames() {
148
138
  /* the internal domain name used by ELB */
@@ -159,14 +149,17 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
159
149
  }
160
150
  /**
161
151
  * Create VPC
162
- * @protected
163
152
  */
164
153
  createVpc() {
165
- this.siteVpc = this.vpcManager.createCommonVpc(this, this.props.siteVpc, this.props.siteVpc.vpcName);
154
+ if (this.props.useExistingVpc) {
155
+ this.siteVpc = this.vpcManager.retrieveCommonVpc(`${this.id}`, this, this.props.siteVpc.vpcName);
156
+ }
157
+ else {
158
+ this.siteVpc = this.vpcManager.createCommonVpc(this, this.props.siteVpc, this.props.siteVpc.vpcName);
159
+ }
166
160
  }
167
161
  /**
168
162
  * @summary Method to create iam policy for ECS Task
169
- * @protected
170
163
  */
171
164
  createEcsPolicy() {
172
165
  this.siteEcsPolicy = new iam.PolicyDocument({
@@ -175,46 +168,40 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
175
168
  }
176
169
  /**
177
170
  * @summary Method to create iam role for ECS Task
178
- * @protected
179
171
  */
180
172
  createEcsRole() {
181
173
  this.siteEcsRole = this.iamManager.createRoleForEcsExecution(`${this.id}-ecs-role`, this, this.siteEcsPolicy);
182
174
  }
183
175
  /**
184
176
  * @summary Method to create environment variables used by ECS task
185
- * @protected
186
177
  */
187
178
  createEcsEnvironment() {
188
179
  this.siteEcsEnvironment = {
189
- NODE_ENV: this.props.nodeEnv,
190
180
  LOG_LEVEL: this.props.logLevel,
181
+ NODE_ENV: this.props.nodeEnv,
191
182
  TZ: this.props.timezone,
192
183
  };
193
184
  }
194
185
  /**
195
186
  * Method to create an ECS cluster
196
- * @protected
197
187
  */
198
188
  createEcsCluster() {
199
189
  this.siteEcsCluster = this.ecsManager.createEcsCluster(`${this.id}-cluster`, this, this.props.siteCluster, this.siteVpc);
200
190
  }
201
191
  /**
202
192
  * Method to create log group used by ECS task
203
- * @protected
204
193
  */
205
194
  createEcsLogGroup() {
206
195
  this.siteEcsLogGroup = this.logManager.createLogGroup(`${this.id}-ecs-log-group`, this, this.props.siteLog);
207
196
  }
208
197
  /**
209
198
  * Method to create docker build arguments for ECS Image step
210
- * @protected
211
199
  */
212
200
  createEcsBuildArgs() {
213
201
  this.siteEcsBuildArgs = {};
214
202
  }
215
203
  /**
216
204
  * Method to create container image for ECS task
217
- * @protected
218
205
  */
219
206
  createEcsContainerImage() {
220
207
  this.siteEcsContainerImage = ecs.ContainerImage.fromAsset(this.props.siteEcsContainerImagePath, {
@@ -223,56 +210,55 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
223
210
  }
224
211
  /**
225
212
  * Method to create Application Loadbalanced ECS Fargate Service
226
- * @protected
227
213
  */
228
214
  createEcsService() {
229
215
  const fargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, `${this.id}-ecs-service`, {
216
+ assignPublicIp: true,
217
+ certificate: this.siteRegionalCertificate,
230
218
  cluster: this.siteEcsCluster,
219
+ cpu: this.props.siteTask.cpu,
231
220
  desiredCount: this.props.siteTask.desiredCount,
221
+ domainName: this.siteInternalDomainName,
222
+ domainZone: this.siteHostedZone,
232
223
  enableECSManagedTags: true,
233
- serviceName: `${this.id}-${this.props.stage}`,
234
- cpu: this.props.siteTask.cpu,
224
+ healthCheckGracePeriod: cdk.Duration.seconds(60),
225
+ listenerPort: this.props.siteTask.listenerPort,
235
226
  loadBalancerName: this.props.siteTask.loadBalancerName
236
227
  ? `${this.props.siteTask.loadBalancerName}-${this.props.stage}`
237
228
  : `${this.id}-${this.props.stage}`,
238
- certificate: this.siteRegionalCertificate,
239
- domainName: this.siteInternalDomainName,
240
- domainZone: this.siteHostedZone,
241
- listenerPort: this.props.siteTask.listenerPort,
229
+ maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
242
230
  memoryLimitMiB: this.props.siteTask.memoryLimitMiB,
243
- healthCheckGracePeriod: cdk.Duration.seconds(60),
244
- assignPublicIp: true,
245
231
  minHealthyPercent: this.props.siteTask.minHealthyPercent,
246
- maxHealthyPercent: this.props.siteTask.maxHealthyPercent,
232
+ serviceName: `${this.id}-${this.props.stage}`,
247
233
  taskDefinition: this.props.siteTask.taskDefinition,
248
234
  taskImageOptions: {
235
+ containerPort: this.props.siteTask.taskImageOptions?.containerPort,
249
236
  enableLogging: true,
237
+ environment: this.siteEcsEnvironment,
238
+ executionRole: this.siteEcsRole,
239
+ image: this.siteEcsContainerImage,
250
240
  logDriver: ecs.LogDriver.awsLogs({
251
241
  logGroup: this.siteEcsLogGroup,
252
- streamPrefix: `${this.id}-${this.props.stage}/ecs`,
253
- multilinePattern: this.props.siteTask.logging?.multilinePattern,
254
242
  logRetention: this.props.siteTask.logging?.logRetention,
243
+ multilinePattern: this.props.siteTask.logging?.multilinePattern,
244
+ streamPrefix: `${this.id}-${this.props.stage}/ecs`,
255
245
  }),
256
- image: this.siteEcsContainerImage,
257
- executionRole: this.siteEcsRole,
258
- taskRole: this.siteEcsRole,
259
- containerPort: this.props.siteTask.taskImageOptions?.containerPort,
260
- environment: this.siteEcsEnvironment,
261
246
  secrets: this.siteSecrets,
247
+ taskRole: this.siteEcsRole,
262
248
  },
263
249
  });
264
250
  if (this.props.siteHealthCheck) {
265
251
  fargateService.targetGroup.configureHealthCheck({
266
252
  enabled: this.props.siteHealthCheck.enabled ?? true,
253
+ healthyGrpcCodes: this.props.siteHealthCheck.healthyGrpcCodes,
254
+ healthyHttpCodes: this.props.siteHealthCheck.healthyHttpCodes,
255
+ healthyThresholdCount: this.props.siteHealthCheck.healthyThresholdCount,
256
+ interval: cdk.Duration.seconds(this.props.siteHealthCheck.intervalInSecs),
267
257
  path: this.props.siteHealthCheck.path ?? '/',
268
258
  port: this.props.siteHealthCheck.port,
269
- interval: cdk.Duration.seconds(this.props.siteHealthCheck.intervalInSecs),
259
+ protocol: this.props.siteHealthCheck.protocol,
270
260
  timeout: cdk.Duration.seconds(this.props.siteHealthCheck.timeoutInSecs),
271
- healthyThresholdCount: this.props.siteHealthCheck.healthyThresholdCount,
272
261
  unhealthyThresholdCount: this.props.siteHealthCheck.unhealthyThresholdCount,
273
- healthyGrpcCodes: this.props.siteHealthCheck.healthyGrpcCodes,
274
- healthyHttpCodes: this.props.siteHealthCheck.healthyHttpCodes,
275
- protocol: this.props.siteHealthCheck.protocol,
276
262
  });
277
263
  }
278
264
  this.siteEcsService = fargateService.service;
@@ -283,8 +269,8 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
283
269
  fargateService.loadBalancer.logAccessLogs(this.siteLogBucket, 'alb');
284
270
  if (this.props.siteTask.siteScaling) {
285
271
  const scalableTaskCount = this.siteEcsService.autoScaleTaskCount({
286
- minCapacity: this.props.siteTask.siteScaling.minCapacity,
287
272
  maxCapacity: this.props.siteTask.siteScaling.maxCapacity ?? 4,
273
+ minCapacity: this.props.siteTask.siteScaling.minCapacity,
288
274
  });
289
275
  if (this.props.siteTask.siteScaling.scaleOnCpuUtilization) {
290
276
  scalableTaskCount.scaleOnCpuUtilization(`${this.id}-cpu-scaling`, {
@@ -316,14 +302,14 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
316
302
  this.siteEcsRole.addToPolicy(new iam.PolicyStatement(this.iamManager.statementForWriteEfs([this.siteFileSystem.fileSystemArn])));
317
303
  /* add the efs volume to ecs task definition */
318
304
  this.siteEcsTaskDefinition.addVolume({
319
- name: `${this.id}-fs`,
320
305
  efsVolumeConfiguration: {
306
+ authorizationConfig: this.props.siteFileSystem.authorizationConfig,
321
307
  fileSystemId: this.siteFileSystem.fileSystemId,
322
308
  rootDirectory: this.props.siteFileSystem.rootDirectory,
323
309
  transitEncryption: this.props.siteFileSystem.transitEncryption,
324
310
  transitEncryptionPort: this.props.siteFileSystem.transitEncryptionPort,
325
- authorizationConfig: this.props.siteFileSystem.authorizationConfig,
326
311
  },
312
+ name: `${this.id}-fs`,
327
313
  });
328
314
  if (this.props.siteTask.mountPoints && this.props.siteTask.mountPoints.length > 0) {
329
315
  this.props.siteTask.mountPoints.forEach(mountPoint => this.siteEcsTaskDefinition.defaultContainer?.addMountPoints({
@@ -340,7 +326,6 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
340
326
  }
341
327
  /**
342
328
  * Method to create log bucket for site distribution
343
- * @protected
344
329
  */
345
330
  createSiteLogBucket() {
346
331
  this.siteLogBucket = this.s3Manager.createS3Bucket(`${this.id}-site-logs`, this, this.props.siteLogBucket);
@@ -353,7 +338,6 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
353
338
  }
354
339
  /**
355
340
  * @summary Method to create a site cloudfront function
356
- * @protected
357
341
  */
358
342
  createSiteCloudfrontFunction() {
359
343
  if (this.props.siteCloudfrontFunctionProps) {
@@ -362,35 +346,31 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
362
346
  }
363
347
  /**
364
348
  * @summary Method to create a site cloudfront function associations
365
- * @protected
366
349
  */
367
350
  resolveSiteFunctionAssociations() {
368
351
  if (this.props.siteCloudfrontFunctionProps) {
369
352
  this.siteFunctionAssociations = [
370
353
  {
371
- function: this.siteCloudfrontFunction,
372
354
  eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
355
+ function: this.siteCloudfrontFunction,
373
356
  },
374
357
  ];
375
358
  }
376
359
  }
377
360
  /**
378
361
  * Method to create Site distribution
379
- * @protected
380
362
  */
381
363
  createDistribution() {
382
364
  this.siteDistribution = this.cloudFrontManager.createDistributionWithHttpOrigin(`${this.id}-distribution`, this, this.props.siteDistribution, this.siteOrigin, this.siteDomainNames, this.siteLogBucket, this.siteCertificate, this.siteFunctionAssociations);
383
365
  }
384
366
  /**
385
367
  * Method to create Route53 records for distribution
386
- * @protected
387
368
  */
388
369
  createNetworkMappings() {
389
370
  this.route53Manager.createCloudFrontTargetARecord(`${this.id}-a-record`, this, this.siteDistribution, this.siteHostedZone, this.props.siteRecordName, this.props.skipStageForARecords);
390
371
  }
391
372
  /**
392
373
  * Method to invalidation the cloudfront distribution cache after a deployment
393
- * @protected
394
374
  */
395
375
  invalidateDistributionCache() {
396
376
  if (this.props.siteCacheInvalidationDockerFilePath) {
@@ -2,29 +2,28 @@ import { CommonStackProps } from '../../common';
2
2
  import { AcmProps, CloudfrontFunctionProps, DistributionProps, EcsApplicationLoadBalancedFargateServiceProps, EcsClusterProps, EfsAccessPointOptions, EfsFileSystemProps, HealthCheck, LogProps, S3BucketProps } from '../../services';
3
3
  import { VpcProps } from 'aws-cdk-lib/aws-ec2';
4
4
  /**
5
- * @category cdk-utils.site-with-ecs-backend
6
- * @subcategory Properties
7
5
  */
8
6
  export interface SiteWithEcsBackendProps extends CommonStackProps {
7
+ logLevel: string;
8
+ nodeEnv: string;
9
9
  siteCacheInvalidationDockerFilePath?: string;
10
- siteHealthCheck: HealthCheck;
11
10
  siteCertificate: AcmProps;
12
- siteRegionalCertificate: AcmProps;
11
+ siteCloudfrontFunctionProps?: CloudfrontFunctionProps;
13
12
  siteCluster: EcsClusterProps;
14
13
  siteDistribution: DistributionProps;
15
- siteCloudfrontFunctionProps?: CloudfrontFunctionProps;
16
- siteFunctionFilePath?: string;
17
14
  siteEcsContainerImagePath: string;
15
+ siteFileSystem?: EfsFileSystemProps;
16
+ siteFileSystemAccessPoints?: EfsAccessPointOptions[];
17
+ siteFunctionFilePath?: string;
18
+ siteHealthCheck: HealthCheck;
18
19
  siteLog: LogProps;
19
20
  siteLogBucket: S3BucketProps;
20
21
  siteRecordName?: string;
22
+ siteRegionalCertificate: AcmProps;
21
23
  siteSubDomain: string;
22
24
  siteTask: EcsApplicationLoadBalancedFargateServiceProps;
23
25
  siteVpc: VpcProps;
24
- siteFileSystem?: EfsFileSystemProps;
25
- siteFileSystemAccessPoints?: EfsAccessPointOptions[];
26
- useExistingHostedZone: boolean;
27
- nodeEnv: string;
28
- logLevel: string;
29
26
  timezone: string;
27
+ useExistingHostedZone: boolean;
28
+ useExistingVpc: boolean;
30
29
  }
@@ -3,11 +3,7 @@ import { Construct } from 'constructs';
3
3
  import * as s3 from 'aws-cdk-lib/aws-s3';
4
4
  import { StaticAssetDeploymentProps } from './types';
5
5
  /**
6
- * @stability stable
7
- * @category cdk-utils.static-asset-deployment
8
- * @subcategory construct
9
6
  * @classdesc Provides a construct to create and deploy static assets into S3 bucket
10
- *
11
7
  * @example
12
8
  * import { StaticAssetDeployment, StaticAssetDeploymentProps } '@gradientedge/cdk-utils'
13
9
  * import { Construct } from 'constructs'
@@ -20,7 +16,6 @@ import { StaticAssetDeploymentProps } from './types';
20
16
  * this.initResources()
21
17
  * }
22
18
  * }
23
- * @mixin
24
19
  */
25
20
  export declare class StaticAssetDeployment extends CommonConstruct {
26
21
  props: StaticAssetDeploymentProps;
@@ -29,17 +24,14 @@ export declare class StaticAssetDeployment extends CommonConstruct {
29
24
  constructor(parent: Construct, id: string, props: StaticAssetDeploymentProps);
30
25
  /**
31
26
  * @summary Initialise and provision resources
32
- * @protected
33
27
  */
34
28
  initResources(): void;
35
29
  /**
36
30
  * @summary Create the static asset bucket
37
- * @protected
38
31
  */
39
32
  protected createAssetBucket(): void;
40
33
  /**
41
34
  * @summary Deploy the static assests into the static asset bucket
42
- * @protected
43
35
  */
44
36
  protected deployStaticAssets(): void;
45
37
  }
@@ -27,11 +27,7 @@ exports.StaticAssetDeployment = void 0;
27
27
  const common_1 = require("../../common");
28
28
  const s3deploy = __importStar(require("aws-cdk-lib/aws-s3-deployment"));
29
29
  /**
30
- * @stability stable
31
- * @category cdk-utils.static-asset-deployment
32
- * @subcategory construct
33
30
  * @classdesc Provides a construct to create and deploy static assets into S3 bucket
34
- *
35
31
  * @example
36
32
  * import { StaticAssetDeployment, StaticAssetDeploymentProps } '@gradientedge/cdk-utils'
37
33
  * import { Construct } from 'constructs'
@@ -44,7 +40,6 @@ const s3deploy = __importStar(require("aws-cdk-lib/aws-s3-deployment"));
44
40
  * this.initResources()
45
41
  * }
46
42
  * }
47
- * @mixin
48
43
  */
49
44
  class StaticAssetDeployment extends common_1.CommonConstruct {
50
45
  /* construct properties */
@@ -59,7 +54,6 @@ class StaticAssetDeployment extends common_1.CommonConstruct {
59
54
  }
60
55
  /**
61
56
  * @summary Initialise and provision resources
62
- * @protected
63
57
  */
64
58
  initResources() {
65
59
  this.createAssetBucket();
@@ -67,14 +61,12 @@ class StaticAssetDeployment extends common_1.CommonConstruct {
67
61
  }
68
62
  /**
69
63
  * @summary Create the static asset bucket
70
- * @protected
71
64
  */
72
65
  createAssetBucket() {
73
66
  this.staticAssetBucket = this.s3Manager.createS3Bucket(`${this.id}-sa-bucket`, this, this.props.staticAssetBucket);
74
67
  }
75
68
  /**
76
69
  * @summary Deploy the static assests into the static asset bucket
77
- * @protected
78
70
  */
79
71
  deployStaticAssets() {
80
72
  new s3deploy.BucketDeployment(this, `${this.id}-static-deployment`, {
@@ -5,8 +5,8 @@ export interface AssetExport {
5
5
  value: string;
6
6
  }
7
7
  export interface StaticAssetDeploymentProps extends CommonStackProps {
8
+ staticAssetBucket: S3BucketProps;
8
9
  staticAssetDeployment: BucketDeploymentProps;
9
10
  staticAssetSources: any[];
10
- staticAssetBucket: S3BucketProps;
11
11
  staticAssetsForExport?: AssetExport[];
12
12
  }
@@ -7,11 +7,7 @@ import { Construct } from 'constructs';
7
7
  import { CommonConstruct } from '../../common';
8
8
  import { StaticSiteProps } from './types';
9
9
  /**
10
- * @stability stable
11
- * @category cdk-utils.static-site
12
- * @subcategory construct
13
10
  * @classdesc Provides a construct to create and deploy a s3 hosted static site
14
- *
15
11
  * @example
16
12
  * import { StaticSite, StaticSiteProps } '@gradientedge/cdk-utils'
17
13
  * import { Construct } from 'constructs'
@@ -24,7 +20,6 @@ import { StaticSiteProps } from './types';
24
20
  * this.initResources()
25
21
  * }
26
22
  * }
27
- * @mixin
28
23
  */
29
24
  export declare class StaticSite extends CommonConstruct {
30
25
  props: StaticSiteProps;
@@ -42,63 +37,51 @@ export declare class StaticSite extends CommonConstruct {
42
37
  constructor(parent: Construct, id: string, props: StaticSiteProps);
43
38
  /**
44
39
  * @summary Initialise and provision resources
45
- * @protected
46
40
  */
47
41
  protected initResources(): void;
48
42
  /**
49
43
  * @summary Method to resolve a hosted zone based on domain attributes
50
- * @protected
51
44
  */
52
45
  protected resolveHostedZone(): void;
53
46
  /**
54
47
  * @summary Method to resolve a certificate based on attributes
55
- * @protected
56
48
  */
57
49
  protected resolveCertificate(): void;
58
50
  /**
59
51
  * @summary Method to create a site log bucket
60
- * @protected
61
52
  */
62
53
  protected createSiteLogBucket(): void;
63
54
  /**
64
55
  * @summary Method to create a site bucket
65
- * @protected
66
56
  */
67
57
  protected createSiteBucket(): void;
68
58
  protected createSiteOrigin(): void;
69
59
  /**
70
60
  * @summary Method to create a site cloudfront function
71
- * @protected
72
61
  */
73
62
  protected createSiteCloudfrontFunction(): void;
74
63
  /**
75
64
  * @summary Method to create a site cloudfront function associations
76
- * @protected
77
65
  */
78
66
  protected resolveSiteFunctionAssociations(): void;
79
67
  /**
80
68
  * @summary Method to create a site origin access identity
81
- * @protected
82
69
  */
83
70
  protected createSiteOriginAccessIdentity(): void;
84
71
  /**
85
72
  * @summary Method to create a site cloudfront distribution
86
- * @protected
87
73
  */
88
74
  protected createSiteDistribution(): void;
89
75
  /**
90
76
  * @summary Method to create route53 records for static site
91
- * @protected
92
77
  */
93
78
  protected createSiteRouteAssets(): void;
94
79
  /**
95
80
  * @summary Method to deploy the static assets into s3 bucket for static site
96
- * @protected
97
81
  */
98
82
  protected deploySite(): void;
99
83
  /**
100
84
  * Method to invalidation the cloudfront distribution cache after a deployment
101
- * @protected
102
85
  */
103
86
  protected invalidateDistributionCache(): void;
104
87
  }
@@ -28,11 +28,7 @@ const cloudfront = __importStar(require("aws-cdk-lib/aws-cloudfront"));
28
28
  const origins = __importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
29
29
  const common_1 = require("../../common");
30
30
  /**
31
- * @stability stable
32
- * @category cdk-utils.static-site
33
- * @subcategory construct
34
31
  * @classdesc Provides a construct to create and deploy a s3 hosted static site
35
- *
36
32
  * @example
37
33
  * import { StaticSite, StaticSiteProps } '@gradientedge/cdk-utils'
38
34
  * import { Construct } from 'constructs'
@@ -45,7 +41,6 @@ const common_1 = require("../../common");
45
41
  * this.initResources()
46
42
  * }
47
43
  * }
48
- * @mixin
49
44
  */
50
45
  class StaticSite extends common_1.CommonConstruct {
51
46
  /* static site properties */
@@ -69,7 +64,6 @@ class StaticSite extends common_1.CommonConstruct {
69
64
  }
70
65
  /**
71
66
  * @summary Initialise and provision resources
72
- * @protected
73
67
  */
74
68
  initResources() {
75
69
  this.resolveHostedZone();
@@ -87,14 +81,12 @@ class StaticSite extends common_1.CommonConstruct {
87
81
  }
88
82
  /**
89
83
  * @summary Method to resolve a hosted zone based on domain attributes
90
- * @protected
91
84
  */
92
85
  resolveHostedZone() {
93
86
  this.siteHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(`${this.id}-hosted-zone`, this, this.props.useExistingHostedZone);
94
87
  }
95
88
  /**
96
89
  * @summary Method to resolve a certificate based on attributes
97
- * @protected
98
90
  */
99
91
  resolveCertificate() {
100
92
  if (this.props.siteCertificate.useExistingCertificate &&
@@ -106,14 +98,12 @@ class StaticSite extends common_1.CommonConstruct {
106
98
  }
107
99
  /**
108
100
  * @summary Method to create a site log bucket
109
- * @protected
110
101
  */
111
102
  createSiteLogBucket() {
112
103
  this.siteLogBucket = this.s3Manager.createS3Bucket(`${this.id}-site-logs`, this, this.props.siteLogBucket);
113
104
  }
114
105
  /**
115
106
  * @summary Method to create a site bucket
116
- * @protected
117
107
  */
118
108
  createSiteBucket() {
119
109
  this.siteBucket = this.s3Manager.createS3Bucket(`${this.id}-site`, this, this.props.siteBucket);
@@ -123,7 +113,6 @@ class StaticSite extends common_1.CommonConstruct {
123
113
  }
124
114
  /**
125
115
  * @summary Method to create a site cloudfront function
126
- * @protected
127
116
  */
128
117
  createSiteCloudfrontFunction() {
129
118
  if (this.props.siteCloudfrontFunctionProps) {
@@ -132,26 +121,23 @@ class StaticSite extends common_1.CommonConstruct {
132
121
  }
133
122
  /**
134
123
  * @summary Method to create a site cloudfront function associations
135
- * @protected
136
124
  */
137
125
  resolveSiteFunctionAssociations() {
138
126
  if (this.props.siteCloudfrontFunctionProps) {
139
127
  this.siteFunctionAssociations = [
140
128
  {
141
- function: this.siteCloudfrontFunction,
142
129
  eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
130
+ function: this.siteCloudfrontFunction,
143
131
  },
144
132
  ];
145
133
  }
146
134
  }
147
135
  /**
148
136
  * @summary Method to create a site origin access identity
149
- * @protected
150
137
  */
151
138
  createSiteOriginAccessIdentity() { }
152
139
  /**
153
140
  * @summary Method to create a site cloudfront distribution
154
- * @protected
155
141
  */
156
142
  createSiteDistribution() {
157
143
  if (!this.props.siteDistribution)
@@ -160,21 +146,18 @@ class StaticSite extends common_1.CommonConstruct {
160
146
  }
161
147
  /**
162
148
  * @summary Method to create route53 records for static site
163
- * @protected
164
149
  */
165
150
  createSiteRouteAssets() {
166
151
  this.siteARecord = this.route53Manager.createCloudFrontTargetARecord(`${this.id}-domain-a-record`, this, this.siteDistribution, this.siteHostedZone, this.props.siteRecordName, this.props.skipStageForARecords);
167
152
  }
168
153
  /**
169
154
  * @summary Method to deploy the static assets into s3 bucket for static site
170
- * @protected
171
155
  */
172
156
  deploySite() {
173
157
  this.s3Manager.doBucketDeployment(`${this.id}-deployment`, this, this.siteBucket, this.siteDistribution, [this.props.siteSource], '', true);
174
158
  }
175
159
  /**
176
160
  * Method to invalidation the cloudfront distribution cache after a deployment
177
- * @protected
178
161
  */
179
162
  invalidateDistributionCache() {
180
163
  if (this.props.siteCacheInvalidationDockerFilePath) {
@@ -2,25 +2,23 @@ import { CommonStackProps } from '../../common';
2
2
  import { AcmProps, CloudfrontFunctionProps, DistributionProps, S3BucketProps } from '../../services';
3
3
  import { ISource } from 'aws-cdk-lib/aws-s3-deployment';
4
4
  /**
5
- * @category cdk-utils.static-site
6
- * @subcategory Properties
7
5
  */
8
6
  export interface StaticSiteProps extends CommonStackProps {
7
+ logLevel: string;
8
+ nodeEnv: string;
9
+ siteAliases?: string[];
10
+ siteBucket: S3BucketProps;
9
11
  siteCacheInvalidationDockerFilePath?: string;
10
- siteCreateAltARecord: boolean;
11
12
  siteCertificate: AcmProps;
12
- siteBucket: S3BucketProps;
13
- siteLogBucket: S3BucketProps;
14
- siteDistribution?: DistributionProps;
15
13
  siteCloudfrontFunctionProps?: CloudfrontFunctionProps;
14
+ siteCreateAltARecord: boolean;
15
+ siteDistribution?: DistributionProps;
16
16
  siteFunctionFilePath?: string;
17
- siteSource: ISource;
18
17
  siteHostedZoneDomainName?: string;
18
+ siteLogBucket: S3BucketProps;
19
19
  siteRecordName?: string;
20
+ siteSource: ISource;
20
21
  siteSubDomain?: string;
21
- siteAliases?: string[];
22
- useExistingHostedZone: boolean;
23
- nodeEnv: string;
24
- logLevel: string;
25
22
  timezone: string;
23
+ useExistingHostedZone: boolean;
26
24
  }