@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
@@ -33,13 +33,9 @@ const common_1 = require("../../common");
33
33
  const event_1 = require("./event");
34
34
  const api_1 = require("./api");
35
35
  /**
36
- * @stability stable
37
- * @category cdk-utils.api-to-eventbridge-target
38
- * @subcategory construct
39
36
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
40
37
  *
41
38
  * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTarget.jpg)
42
- *
43
39
  * @example
44
40
  * import { ApiToEventBridgeTarget, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
45
41
  * import { Construct } from 'constructs'
@@ -52,7 +48,6 @@ const api_1 = require("./api");
52
48
  * this.initResources()
53
49
  * }
54
50
  * }
55
- * @mixin
56
51
  */
57
52
  class ApiToEventBridgeTarget extends common_1.CommonConstruct {
58
53
  props;
@@ -106,21 +101,18 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
106
101
  /**
107
102
  * @summary Method to resolve secrets from SecretsManager
108
103
  * - To be implemented in the overriding method in the implementation class
109
- * @protected
110
104
  */
111
105
  resolveSecrets() {
112
106
  this.applicationSecrets = [];
113
107
  }
114
108
  /**
115
109
  * @summary Method to resolve a hosted zone based on domain attributes
116
- * @protected
117
110
  */
118
111
  resolveHostedZone() {
119
112
  this.apiToEventBridgeTargetRestApi.hostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(`${this.id}-hosted-zone`, this, this.props.useExistingHostedZone);
120
113
  }
121
114
  /**
122
115
  * @summary Method to resolve a certificate based on attributes
123
- * @protected
124
116
  */
125
117
  resolveCertificate() {
126
118
  if (this.props.api.useExisting)
@@ -134,7 +126,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
134
126
  }
135
127
  /**
136
128
  * @summary Method to create or use an existing eventbus for api payload deliveries
137
- * @protected
138
129
  */
139
130
  createApiToEventBridgeTargetEventBus() {
140
131
  if (this.props.api.useExisting) {
@@ -147,7 +138,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
147
138
  }
148
139
  /**
149
140
  * @summary Method to create a log group for successful api payload deliveries
150
- * @protected
151
141
  */
152
142
  createApiToEventBridgeTargetLogGroup() {
153
143
  if (this.props.api.useExisting)
@@ -161,17 +151,16 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
161
151
  }
162
152
  /**
163
153
  * Method to create EventBridge rule with lambda target for success
164
- * @protected
165
154
  */
166
155
  createApiToEventBridgeTargetRule() {
167
156
  if (this.props.api.useExisting)
168
157
  return;
169
158
  this.props.event.rule = {
170
159
  ...{
171
- ruleName: `${this.id}-api-to-eventbridge-target`,
172
160
  eventPattern: {
173
161
  source: ['api-to-eventbridge-target'],
174
162
  },
163
+ ruleName: `${this.id}-api-to-eventbridge-target`,
175
164
  },
176
165
  ...this.props.event.rule,
177
166
  };
@@ -184,7 +173,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
184
173
  }
185
174
  /**
186
175
  * @summary Method to create a role for api integration
187
- * @protected
188
176
  */
189
177
  createApiToEventBridgeTargetRole() {
190
178
  if (!this.apiToEventBridgeTargetRestApi.policy)
@@ -196,7 +184,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
196
184
  }
197
185
  /**
198
186
  * @summary Method to create api integration request parameters
199
- * @protected
200
187
  */
201
188
  createApiToEventBridgeTargetIntegrationRequestParameters() {
202
189
  if (!this.props.api.withResource)
@@ -207,7 +194,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
207
194
  }
208
195
  /**
209
196
  * @summary Method to create api integration request templates
210
- * @protected
211
197
  */
212
198
  createApiToEventBridgeTargetIntegrationRequestTemplates() {
213
199
  if (!this.props.api.withResource)
@@ -231,112 +217,107 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
231
217
  }
232
218
  /**
233
219
  * @summary Method to create api integration response
234
- * @protected
235
220
  */
236
221
  createApiToEventBridgeTargetIntegrationResponse() {
237
222
  if (!this.props.api.withResource)
238
223
  return;
239
224
  this.apiToEventBridgeTargetRestApi.integrationResponse = this.props.api.integrationResponse ?? {
240
225
  ...{
241
- statusCode: '200',
242
226
  responseTemplates: {
243
227
  'application/json': JSON.stringify({ message: 'Payload Submitted' }),
244
228
  },
229
+ statusCode: '200',
245
230
  },
246
231
  };
247
232
  }
248
233
  /**
249
234
  * @summary Method to create api integration error response
250
- * @protected
251
235
  */
252
236
  createApiToEventBridgeTargetIntegrationErrorResponse() {
253
237
  if (!this.props.api.withResource)
254
238
  return;
255
239
  this.apiToEventBridgeTargetRestApi.integrationErrorResponse = {
256
240
  ...{
257
- selectionPattern: '^\\[Error\\].*',
258
- statusCode: '400',
241
+ responseParameters: {
242
+ 'method.response.header.Access-Control-Allow-Credentials': "'true'",
243
+ 'method.response.header.Access-Control-Allow-Origin': "'*'",
244
+ 'method.response.header.Content-Type': "'application/json'",
245
+ },
259
246
  responseTemplates: {
260
247
  'application/json': JSON.stringify({
261
- state: 'error',
262
248
  message: "$util.escapeJavaScript($input.path('$.errorMessage'))",
249
+ state: 'error',
263
250
  }),
264
251
  },
265
- responseParameters: {
266
- 'method.response.header.Content-Type': "'application/json'",
267
- 'method.response.header.Access-Control-Allow-Origin': "'*'",
268
- 'method.response.header.Access-Control-Allow-Credentials': "'true'",
269
- },
252
+ selectionPattern: '^\\[Error\\].*',
253
+ statusCode: '400',
270
254
  },
271
255
  ...this.props.api.integrationErrorResponse,
272
256
  };
273
257
  }
274
258
  /**
275
259
  * @summary Method to create api integration
276
- * @protected
277
260
  */
278
261
  createApiToEventBridgeTargetIntegration() {
279
262
  if (!this.props.api.withResource)
280
263
  return;
281
264
  this.apiToEventBridgeTargetRestApi.integration = new apig.Integration({
282
- type: apig.IntegrationType.AWS,
283
265
  integrationHttpMethod: 'POST',
284
- uri: `arn:aws:apigateway:${this.props.region}:events:path//`,
285
266
  options: {
286
267
  ...{
287
268
  credentialsRole: this.apiToEventBridgeTargetRestApi.role,
288
- requestParameters: this.apiToEventBridgeTargetRestApi.integrationRequestParameters,
289
- requestTemplates: this.apiToEventBridgeTargetRestApi.integrationRequestTemplates,
290
- passthroughBehavior: apig.PassthroughBehavior.NEVER,
291
269
  integrationResponses: [
292
270
  this.apiToEventBridgeTargetRestApi.integrationResponse,
293
271
  this.apiToEventBridgeTargetRestApi.integrationErrorResponse,
294
272
  ],
273
+ passthroughBehavior: apig.PassthroughBehavior.NEVER,
274
+ requestParameters: this.apiToEventBridgeTargetRestApi.integrationRequestParameters,
275
+ requestTemplates: this.apiToEventBridgeTargetRestApi.integrationRequestTemplates,
295
276
  },
296
277
  ...this.props.api.integrationOptions,
297
278
  },
279
+ type: apig.IntegrationType.AWS,
280
+ uri: `arn:aws:apigateway:${this.props.region}:events:path//`,
298
281
  });
299
282
  }
300
283
  /**
301
284
  * @summary Method to create api integration method response
302
- * @protected
303
285
  */
304
286
  createApiToEventBridgeTargetMethodResponse() {
305
287
  if (!this.props.api.withResource)
306
288
  return;
307
289
  this.apiToEventBridgeTargetRestApi.methodResponse = {
308
290
  ...{
309
- statusCode: '200',
310
- responseParameters: {
311
- 'method.response.header.Content-Type': true,
312
- 'method.response.header.Access-Control-Allow-Origin': true,
313
- 'method.response.header.Access-Control-Allow-Credentials': true,
314
- },
315
291
  responseModels: {
316
292
  'application/json': this.apiToEventBridgeTargetRestApi.responseModel,
317
293
  },
294
+ responseParameters: {
295
+ 'method.response.header.Access-Control-Allow-Credentials': true,
296
+ 'method.response.header.Access-Control-Allow-Origin': true,
297
+ 'method.response.header.Content-Type': true,
298
+ },
299
+ statusCode: '200',
318
300
  },
319
301
  ...this.props.api.methodResponse,
320
302
  };
321
303
  }
322
304
  /**
323
305
  * @summary Method to create api integration method error response
324
- * @protected
325
306
  */
326
307
  createApiToEventBridgeTargetMethodErrorResponse() {
327
308
  if (!this.props.api.withResource)
328
309
  return;
329
310
  this.apiToEventBridgeTargetRestApi.methodErrorResponse = {
330
311
  ...{
331
- statusCode: '400',
332
- responseParameters: {
333
- 'method.response.header.Content-Type': true,
334
- 'method.response.header.Access-Control-Allow-Origin': true,
335
- 'method.response.header.Access-Control-Allow-Credentials': true,
336
- },
337
312
  responseModels: {
338
313
  'application/json': this.apiToEventBridgeTargetRestApi.errorResponseModel,
339
314
  },
315
+ responseParameters: {
316
+ 'method.response.header.Access-Control-Allow-Credentials': true,
317
+ 'method.response.header.Access-Control-Allow-Origin': true,
318
+ 'method.response.header.Content-Type': true,
319
+ },
320
+ statusCode: '400',
340
321
  },
341
322
  ...this.props.api.methodErrorResponse,
342
323
  };
@@ -349,7 +330,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
349
330
  }
350
331
  /**
351
332
  * @summary Method to create rest restApi for Api
352
- * @protected
353
333
  */
354
334
  createApiToEventBridgeTargetRestApi() {
355
335
  if (this.props.api.useExisting && this.props.api.importedRestApiRef) {
@@ -359,6 +339,11 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
359
339
  this.apiToEventBridgeTargetRestApi.api = new apig.RestApi(this, `${this.id}-rest-api`, {
360
340
  ...{
361
341
  cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
342
+ defaultCorsPreflightOptions: {
343
+ allowHeaders: apig.Cors.DEFAULT_HEADERS,
344
+ allowMethods: ['POST'],
345
+ allowOrigins: apig.Cors.ALL_ORIGINS,
346
+ },
362
347
  defaultIntegration: this.apiToEventBridgeTargetRestApi.integration,
363
348
  defaultMethodOptions: {
364
349
  methodResponses: [
@@ -368,23 +353,18 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
368
353
  },
369
354
  deploy: this.props.api.restApi?.deploy ?? true,
370
355
  deployOptions: {
371
- tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
356
+ accessLogDestination: new apig.LogGroupLogDestination(this.apiToEventBridgeTargetRestApi.accessLogGroup),
357
+ accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
372
358
  dataTraceEnabled: this.props.api.restApi?.deployOptions?.dataTraceEnabled,
373
359
  description: `${this.id} - ${this.props.stage} stage`,
374
360
  loggingLevel: apig.MethodLoggingLevel.INFO,
375
361
  metricsEnabled: true,
376
362
  stageName: this.props.stage,
377
- accessLogDestination: new apig.LogGroupLogDestination(this.apiToEventBridgeTargetRestApi.accessLogGroup),
378
- accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
363
+ tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
379
364
  },
380
365
  endpointConfiguration: {
381
366
  types: [apig.EndpointType.REGIONAL],
382
367
  },
383
- defaultCorsPreflightOptions: {
384
- allowOrigins: apig.Cors.ALL_ORIGINS,
385
- allowMethods: ['POST'],
386
- allowHeaders: apig.Cors.DEFAULT_HEADERS,
387
- },
388
368
  restApiName: `${this.id}-rest-api-${this.props.stage}`,
389
369
  },
390
370
  ...this.props.api.restApi,
@@ -394,7 +374,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
394
374
  }
395
375
  /**
396
376
  * @summary Method to create api integration response model
397
- * @protected
398
377
  */
399
378
  createApiToEventBridgeTargetResponseModel() {
400
379
  if (!this.props.api.withResource)
@@ -405,10 +384,10 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
405
384
  contentType: 'application/json',
406
385
  modelName: 'ResponseModel',
407
386
  schema: {
387
+ properties: { message: { type: apig.JsonSchemaType.STRING } },
408
388
  schema: apig.JsonSchemaVersion.DRAFT4,
409
389
  title: 'pollResponse',
410
390
  type: apig.JsonSchemaType.OBJECT,
411
- properties: { message: { type: apig.JsonSchemaType.STRING } },
412
391
  },
413
392
  },
414
393
  ...this.props.api.responseModel,
@@ -416,7 +395,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
416
395
  }
417
396
  /**
418
397
  * @summary Method to create api integration error response model
419
- * @protected
420
398
  */
421
399
  createApiToEventBridgeTargetErrorResponseModel() {
422
400
  if (!this.props.api.withResource)
@@ -427,13 +405,13 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
427
405
  contentType: 'application/json',
428
406
  modelName: 'ErrorResponseModel',
429
407
  schema: {
430
- schema: apig.JsonSchemaVersion.DRAFT4,
431
- title: 'errorResponse',
432
- type: apig.JsonSchemaType.OBJECT,
433
408
  properties: {
434
- state: { type: apig.JsonSchemaType.STRING },
435
409
  message: { type: apig.JsonSchemaType.STRING },
410
+ state: { type: apig.JsonSchemaType.STRING },
436
411
  },
412
+ schema: apig.JsonSchemaVersion.DRAFT4,
413
+ title: 'errorResponse',
414
+ type: apig.JsonSchemaType.OBJECT,
437
415
  },
438
416
  },
439
417
  ...this.props.api.errorResponseModel,
@@ -441,7 +419,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
441
419
  }
442
420
  /**
443
421
  * @summary Method to create api integration resource
444
- * @protected
445
422
  */
446
423
  createApiToEventBridgeTargetResource() {
447
424
  if (!this.props.api.withResource)
@@ -449,9 +426,9 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
449
426
  let rootResource;
450
427
  if (this.props.api.withResource && this.props.api.importedRestApiRootResourceRef) {
451
428
  rootResource = apig.Resource.fromResourceAttributes(this, `${this.id}-root-resource`, {
429
+ path: '/',
452
430
  resourceId: cdk.Fn.importValue(this.props.api.importedRestApiRootResourceRef),
453
431
  restApi: this.apiToEventBridgeTargetRestApi.api,
454
- path: '/',
455
432
  });
456
433
  }
457
434
  else {
@@ -461,7 +438,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
461
438
  }
462
439
  /**
463
440
  * @summary Method to create api integration resource method
464
- * @protected
465
441
  */
466
442
  createApiToEventBridgeTargetResourceMethod() {
467
443
  if (!this.props.api.withResource)
@@ -476,7 +452,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
476
452
  }
477
453
  /**
478
454
  * @summary Method to create custom restApi domain for Api
479
- * @protected
480
455
  */
481
456
  createApiDomain() {
482
457
  if (this.props.api.useExisting)
@@ -487,7 +462,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
487
462
  }
488
463
  /**
489
464
  * @summary Method to create base path mappings for Api
490
- * @protected
491
465
  */
492
466
  createApiBasePathMapping() {
493
467
  if (this.props.api.useExisting)
@@ -501,7 +475,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
501
475
  }
502
476
  /**
503
477
  * @summary Method to create route53 records for Api
504
- * @protected
505
478
  */
506
479
  createApiRouteAssets() {
507
480
  if (this.props.api.useExisting)
@@ -9,8 +9,6 @@ import { CommonStackProps } from '../../common';
9
9
  import { AcmProps, EventRuleProps, LambdaProps, LogProps } from '../../services';
10
10
  import { AssetCode } from 'aws-cdk-lib/aws-lambda';
11
11
  /**
12
- * @category cdk-utils.api-to-eventbridge-target
13
- * @subcategory Types
14
12
  */
15
13
  export interface ApiToEventBridgeTargetEventType {
16
14
  eventBus: IEventBus;
@@ -22,8 +20,6 @@ export interface ApiToEventBridgeTargetEventType {
22
20
  ruleSuccess: Rule;
23
21
  }
24
22
  /**
25
- * @category cdk-utils.api-to-eventbridge-target
26
- * @subcategory Types
27
23
  */
28
24
  export interface ApiToEventBridgeTargetRestApiType {
29
25
  accessLogGroup: LogGroup;
@@ -45,63 +41,55 @@ export interface ApiToEventBridgeTargetRestApiType {
45
41
  method: Method;
46
42
  methodErrorResponse: MethodResponse;
47
43
  methodResponse: MethodResponse;
44
+ policy?: PolicyDocument;
48
45
  resource: Resource;
49
46
  responseModel: Model;
50
- topic?: ITopic;
51
47
  role?: Role;
52
- policy?: PolicyDocument;
48
+ topic?: ITopic;
53
49
  }
54
50
  /**
55
- * @category cdk-utils.api-to-eventbridge-target
56
- * @subcategory Properties
57
51
  */
58
52
  export interface ApiToEventBridgeTargetRestApiProps {
59
53
  certificate: AcmProps;
60
- integrationResponse?: IntegrationResponse;
54
+ errorResponseModel?: ModelOptions;
55
+ importedRestApiRef?: string;
56
+ importedRestApiRootResourceRef?: string;
61
57
  integrationErrorResponse?: IntegrationResponse;
62
- methodResponse?: MethodResponse;
63
- methodErrorResponse?: MethodResponse;
64
58
  integrationOptions?: IntegrationOptions;
59
+ integrationResponse?: IntegrationResponse;
60
+ methodErrorResponse?: MethodResponse;
61
+ methodResponse?: MethodResponse;
65
62
  resource: string;
66
- errorResponseModel?: ModelOptions;
67
63
  responseModel?: ModelOptions;
68
64
  restApi?: RestApiProps;
69
- importedRestApiRef?: string;
70
- importedRestApiRootResourceRef?: string;
71
65
  useExisting: boolean;
72
66
  withResource?: boolean;
73
67
  }
74
68
  /**
75
- * @category cdk-utils.api-to-eventbridge-target
76
- * @subcategory Properties
77
69
  */
78
70
  interface ApiToEventBridgeTargetLambdaProps {
79
- handler?: string;
80
71
  function: LambdaProps;
81
- source?: AssetCode;
72
+ handler?: string;
82
73
  layerSource?: AssetCode;
74
+ source?: AssetCode;
83
75
  }
84
76
  /**
85
- * @category cdk-utils.api-to-eventbridge-target
86
- * @subcategory Properties
87
77
  */
88
78
  interface ApiToEventBridgeTargetEventProps {
89
79
  eventBusName?: string;
90
80
  logGroup?: LogProps;
91
- logGroupSuccess?: LogProps;
92
81
  logGroupFailure?: LogProps;
82
+ logGroupSuccess?: LogProps;
93
83
  rule: EventRuleProps;
94
- ruleSuccess: EventRuleProps;
95
84
  ruleFailure: EventRuleProps;
85
+ ruleSuccess: EventRuleProps;
96
86
  }
97
87
  /**
98
- * @category cdk-utils.api-to-eventbridge-target
99
- * @subcategory Properties
100
88
  */
101
89
  export interface ApiToEventBridgeTargetProps extends CommonStackProps {
90
+ api: ApiToEventBridgeTargetRestApiProps;
102
91
  apiRootPaths?: string[];
103
92
  apiSubDomain: string;
104
- api: ApiToEventBridgeTargetRestApiProps;
105
93
  event: ApiToEventBridgeTargetEventProps;
106
94
  lambda?: ApiToEventBridgeTargetLambdaProps;
107
95
  logLevel: string;
@@ -3,9 +3,6 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
3
3
  import * as destinations from 'aws-cdk-lib/aws-lambda-destinations';
4
4
  import { ApiDestinedLambdaEnvironment, ApiDestinedLambdaType } from './types';
5
5
  /**
6
- * @stability stable
7
- * @category cdk-utils.api-to-eventbridge-target
8
- * @subcategory member
9
6
  * @classdesc Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
10
7
  */
11
8
  export declare class ApiDestinedLambda implements ApiDestinedLambdaType {
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiDestinedLambda = void 0;
4
4
  /**
5
- * @stability stable
6
- * @category cdk-utils.api-to-eventbridge-target
7
- * @subcategory member
8
5
  * @classdesc Provides a construct to contain lambda resources for ApiToEventBridgeTargetWithSns
9
6
  */
10
7
  class ApiDestinedLambda {
@@ -5,14 +5,9 @@ import { ApiToEventBridgeTargetEventType, ApiToEventBridgeTargetProps, ApiToEven
5
5
  import { ApiDestinedLambdaType } from './types';
6
6
  /**
7
7
  * @deprecated Use ApiToEventBridgeTarget instead. This will be removed in a future release.
8
- *
9
- * @stability stable
10
- * @category cdk-utils.api-to-eventbridge-target
11
- * @subcategory construct
12
8
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
13
9
  *
14
10
  * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
15
- *
16
11
  * @example
17
12
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
18
13
  * import { Construct } from 'constructs'
@@ -25,7 +20,6 @@ import { ApiDestinedLambdaType } from './types';
25
20
  * this.initResources()
26
21
  * }
27
22
  * }
28
- * @mixin
29
23
  */
30
24
  export declare class ApiToEventBridgeTargetWithSns extends CommonConstruct {
31
25
  props: ApiToEventBridgeTargetProps;
@@ -40,157 +34,126 @@ export declare class ApiToEventBridgeTargetWithSns extends CommonConstruct {
40
34
  /**
41
35
  * @summary Method to resolve secrets from SecretsManager
42
36
  * - To be implemented in the overriding method in the implementation class
43
- * @protected
44
37
  */
45
38
  protected resolveSecrets(): void;
46
39
  /**
47
40
  * @summary Method to resolve a hosted zone based on domain attributes
48
- * @protected
49
41
  */
50
42
  protected resolveHostedZone(): void;
51
43
  /**
52
44
  * @summary Method to resolve a certificate based on attributes
53
- * @protected
54
45
  */
55
46
  protected resolveCertificate(): void;
56
47
  /**
57
48
  * @summary Method to create iam policy for Api Destined Lambda function
58
- * @protected
59
49
  */
60
50
  protected createApiDestinedLambdaPolicy(): void;
61
51
  /**
62
52
  * @summary Method to create iam role for Api Destined Lambda function
63
- * @protected
64
53
  */
65
54
  protected createApiDestinedLambdaRole(): void;
66
55
  /**
67
56
  * @summary Method to create environment variables for Api Destined Lambda function
68
- * @protected
69
57
  */
70
58
  protected createApiDestinedLambdaEnvironment(): void;
71
59
  /**
72
60
  * @summary Method to create layers for Api Destined Lambda function
73
- * @protected
74
61
  */
75
62
  protected createApiDestinedLambdaLayers(): void;
76
63
  /**
77
64
  * @summary Method to create destination for Api Destined function
78
- * @protected
79
65
  */
80
66
  protected createApiDestinedLambdaDestinations(): void;
81
67
  /**
82
68
  * @summary Method to create lambda function for Api Destined
83
- * @protected
84
69
  */
85
70
  protected createApiDestinedLambdaFunction(): void;
86
71
  /**
87
72
  * @summary Method to create or use an existing eventbus for api destined payload deliveries
88
- * @protected
89
73
  */
90
74
  protected createApiDestinedEventBus(): void;
91
75
  /**
92
76
  * @summary Method to create a log group for successful api destined payload deliveries
93
- * @protected
94
77
  */
95
78
  protected createApiDestinationLogGroupSuccess(): void;
96
79
  /**
97
80
  * Method to create EventBridge rule with lambda target for success
98
- * @protected
99
81
  */
100
82
  protected createApiDestinationRuleSuccess(): void;
101
83
  /**
102
84
  * @summary Method to create a log group for failed api destined payload deliveries
103
- * @protected
104
85
  */
105
86
  protected createApiDestinationLogGroupFailure(): void;
106
87
  /**
107
88
  * Method to create EventBridge rule with lambda target for failure
108
- * @protected
109
89
  */
110
90
  protected createApiDestinationRuleFailure(): void;
111
91
  /**
112
92
  * @summary Method to create a role for sns topic
113
- * @protected
114
93
  */
115
94
  protected createApiDestinedTopicRole(): void;
116
95
  /**
117
96
  * @summary Method to create API destined SNS topic
118
- * @protected
119
97
  */
120
98
  protected createApiDestinedTopic(): void;
121
99
  /**
122
100
  * @summary Method to create api integration request parameters
123
- * @protected
124
101
  */
125
102
  protected createApiDestinedIntegrationRequestParameters(): void;
126
103
  /**
127
104
  * @summary Method to create api integration request templates
128
- * @protected
129
105
  */
130
106
  protected createApiDestinedIntegrationRequestTemplates(): void;
131
107
  /**
132
108
  * @summary Method to create api integration response
133
- * @protected
134
109
  */
135
110
  protected createApiDestinedIntegrationResponse(): void;
136
111
  /**
137
112
  * @summary Method to create api integration error response
138
- * @protected
139
113
  */
140
114
  protected createApiDestinedIntegrationErrorResponse(): void;
141
115
  /**
142
116
  * @summary Method to create api integration
143
- * @protected
144
117
  */
145
118
  protected createApiDestinedIntegration(): void;
146
119
  /**
147
120
  * @summary Method to create api integration method response
148
- * @protected
149
121
  */
150
122
  protected createApiDestinedMethodResponse(): void;
151
123
  /**
152
124
  * @summary Method to create api integration method error response
153
- * @protected
154
125
  */
155
126
  protected createApiDestinedMethodErrorResponse(): void;
156
127
  /**
157
128
  * @summary Method to create rest restApi for Api
158
- * @protected
159
129
  */
160
130
  protected createApiDestinedRestApi(): void;
161
131
  /**
162
132
  * @summary Method to create api integration response model
163
- * @protected
164
133
  */
165
134
  protected createApiDestinedResponseModel(): void;
166
135
  /**
167
136
  * @summary Method to create api integration error response model
168
- * @protected
169
137
  */
170
138
  protected createApiDestinedErrorResponseModel(): void;
171
139
  /**
172
140
  * @summary Method to create api integration resource
173
- * @protected
174
141
  */
175
142
  protected createApiDestinedResource(): void;
176
143
  /**
177
144
  * @summary Method to create api integration resource method
178
- * @protected
179
145
  */
180
146
  protected createApiDestinedResourceMethod(): void;
181
147
  /**
182
148
  * @summary Method to create custom restApi domain for Api API
183
- * @protected
184
149
  */
185
150
  protected createApiDomain(): void;
186
151
  /**
187
152
  * @summary Method to create base path mappings for Api API
188
- * @protected
189
153
  */
190
154
  protected createApiBasePathMapping(): void;
191
155
  /**
192
156
  * @summary Method to create route53 records for Api API
193
- * @protected
194
157
  */
195
158
  protected createApiRouteAssets(): void;
196
159
  }