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