@gradientedge/cdk-utils 8.91.0 → 8.93.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 +1 -19
  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 +1 -19
  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 +2 -20
  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 +2 -20
  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
@@ -35,14 +35,9 @@ const api_destined_lambda_1 = require("./api-destined-lambda");
35
35
  const api_to_eventbridge_target_1 = require("../api-to-eventbridge-target");
36
36
  /**
37
37
  * @deprecated Use ApiToEventBridgeTarget instead. This will be removed in a future release.
38
- *
39
- * @stability stable
40
- * @category cdk-utils.api-to-eventbridge-target
41
- * @subcategory construct
42
38
  * @classdesc Provides a construct to create and deploy API Gateway invocations to EventBridge
43
39
  *
44
40
  * <b>Architecture</b><br/> ![Architecture](./ApiToEventBridgeTargetWithSns.jpg)
45
- *
46
41
  * @example
47
42
  * import { ApiToEventBridgeTargetWithSns, ApiToEventBridgeTargetProps } '@gradientedge/cdk-utils'
48
43
  * import { Construct } from 'constructs'
@@ -55,7 +50,6 @@ const api_to_eventbridge_target_1 = require("../api-to-eventbridge-target");
55
50
  * this.initResources()
56
51
  * }
57
52
  * }
58
- * @mixin
59
53
  */
60
54
  class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
61
55
  props;
@@ -120,21 +114,18 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
120
114
  /**
121
115
  * @summary Method to resolve secrets from SecretsManager
122
116
  * - To be implemented in the overriding method in the implementation class
123
- * @protected
124
117
  */
125
118
  resolveSecrets() {
126
119
  this.applicationSecrets = [];
127
120
  }
128
121
  /**
129
122
  * @summary Method to resolve a hosted zone based on domain attributes
130
- * @protected
131
123
  */
132
124
  resolveHostedZone() {
133
125
  this.apiDestinedRestApi.hostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(`${this.id}-hosted-zone`, this, this.props.useExistingHostedZone);
134
126
  }
135
127
  /**
136
128
  * @summary Method to resolve a certificate based on attributes
137
- * @protected
138
129
  */
139
130
  resolveCertificate() {
140
131
  if (this.props.api.useExisting)
@@ -148,7 +139,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
148
139
  }
149
140
  /**
150
141
  * @summary Method to create iam policy for Api Destined Lambda function
151
- * @protected
152
142
  */
153
143
  createApiDestinedLambdaPolicy() {
154
144
  if (this.props.api.useExisting)
@@ -159,7 +149,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
159
149
  }
160
150
  /**
161
151
  * @summary Method to create iam role for Api Destined Lambda function
162
- * @protected
163
152
  */
164
153
  createApiDestinedLambdaRole() {
165
154
  if (this.props.api.useExisting)
@@ -168,21 +157,19 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
168
157
  }
169
158
  /**
170
159
  * @summary Method to create environment variables for Api Destined Lambda function
171
- * @protected
172
160
  */
173
161
  createApiDestinedLambdaEnvironment() {
174
162
  if (this.props.api.useExisting)
175
163
  return;
176
164
  this.apiDestinedLambda.environment = {
177
- NODE_ENV: this.props.nodeEnv,
178
165
  LOG_LEVEL: this.props.logLevel,
179
- TZ: this.props.timezone,
166
+ NODE_ENV: this.props.nodeEnv,
180
167
  SOURCE_ID: this.id,
168
+ TZ: this.props.timezone,
181
169
  };
182
170
  }
183
171
  /**
184
172
  * @summary Method to create layers for Api Destined Lambda function
185
- * @protected
186
173
  */
187
174
  createApiDestinedLambdaLayers() {
188
175
  if (this.props.api.useExisting)
@@ -195,7 +182,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
195
182
  }
196
183
  /**
197
184
  * @summary Method to create destination for Api Destined function
198
- * @protected
199
185
  */
200
186
  createApiDestinedLambdaDestinations() {
201
187
  if (this.props.api.useExisting)
@@ -205,7 +191,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
205
191
  }
206
192
  /**
207
193
  * @summary Method to create lambda function for Api Destined
208
- * @protected
209
194
  */
210
195
  createApiDestinedLambdaFunction() {
211
196
  if (this.props.api.useExisting)
@@ -215,14 +200,13 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
215
200
  this.apiDestinedLambda.function = this.lambdaManager.createLambdaFunction(`${this.id}-lambda-destined`, this, {
216
201
  ...this.props.lambda.function,
217
202
  ...{
218
- onSuccess: this.apiDestinedLambda.destinationSuccess,
219
203
  onFailure: this.apiDestinedLambda.destinationFailure,
204
+ onSuccess: this.apiDestinedLambda.destinationSuccess,
220
205
  },
221
206
  }, this.apiDestinedLambda.role, this.apiDestinedLambda.layers, this.props.lambda.source, this.props.lambda.handler ?? 'lambda.handler', this.apiDestinedLambda.environment);
222
207
  }
223
208
  /**
224
209
  * @summary Method to create or use an existing eventbus for api destined payload deliveries
225
- * @protected
226
210
  */
227
211
  createApiDestinedEventBus() {
228
212
  if (this.props.api.useExisting) {
@@ -235,7 +219,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
235
219
  }
236
220
  /**
237
221
  * @summary Method to create a log group for successful api destined payload deliveries
238
- * @protected
239
222
  */
240
223
  createApiDestinationLogGroupSuccess() {
241
224
  if (this.props.api.useExisting)
@@ -249,14 +232,12 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
249
232
  }
250
233
  /**
251
234
  * Method to create EventBridge rule with lambda target for success
252
- * @protected
253
235
  */
254
236
  createApiDestinationRuleSuccess() {
255
237
  if (this.props.api.useExisting)
256
238
  return;
257
239
  this.props.event.ruleSuccess = {
258
240
  ...{
259
- ruleName: `${this.id}-api-destination-success`,
260
241
  eventPattern: {
261
242
  detail: {
262
243
  requestContext: {
@@ -268,6 +249,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
268
249
  },
269
250
  },
270
251
  },
252
+ ruleName: `${this.id}-api-destination-success`,
271
253
  },
272
254
  ...this.props.event.ruleSuccess,
273
255
  };
@@ -275,7 +257,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
275
257
  }
276
258
  /**
277
259
  * @summary Method to create a log group for failed api destined payload deliveries
278
- * @protected
279
260
  */
280
261
  createApiDestinationLogGroupFailure() {
281
262
  if (this.props.api.useExisting)
@@ -289,14 +270,12 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
289
270
  }
290
271
  /**
291
272
  * Method to create EventBridge rule with lambda target for failure
292
- * @protected
293
273
  */
294
274
  createApiDestinationRuleFailure() {
295
275
  if (this.props.api.useExisting)
296
276
  return;
297
277
  this.props.event.ruleFailure = {
298
278
  ...{
299
- ruleName: `${this.id}-api-destination-failure`,
300
279
  eventPattern: {
301
280
  detail: {
302
281
  responsePayload: {
@@ -304,6 +283,7 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
304
283
  },
305
284
  },
306
285
  },
286
+ ruleName: `${this.id}-api-destination-failure`,
307
287
  },
308
288
  ...this.props.event.ruleFailure,
309
289
  };
@@ -311,7 +291,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
311
291
  }
312
292
  /**
313
293
  * @summary Method to create a role for sns topic
314
- * @protected
315
294
  */
316
295
  createApiDestinedTopicRole() {
317
296
  this.apiDestinedRestApi.role = new iam.Role(this, `${this.id}-sns-rest-api-role`, {
@@ -320,7 +299,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
320
299
  }
321
300
  /**
322
301
  * @summary Method to create API destined SNS topic
323
- * @protected
324
302
  */
325
303
  createApiDestinedTopic() {
326
304
  if (!this.props.api.withResource)
@@ -334,7 +312,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
334
312
  }
335
313
  /**
336
314
  * @summary Method to create api integration request parameters
337
- * @protected
338
315
  */
339
316
  createApiDestinedIntegrationRequestParameters() {
340
317
  if (!this.props.api.withResource)
@@ -345,7 +322,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
345
322
  }
346
323
  /**
347
324
  * @summary Method to create api integration request templates
348
- * @protected
349
325
  */
350
326
  createApiDestinedIntegrationRequestTemplates() {
351
327
  if (!this.props.api.withResource)
@@ -363,119 +339,113 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
363
339
  }
364
340
  /**
365
341
  * @summary Method to create api integration response
366
- * @protected
367
342
  */
368
343
  createApiDestinedIntegrationResponse() {
369
344
  if (!this.props.api.withResource)
370
345
  return;
371
346
  this.apiDestinedRestApi.integrationResponse = this.props.api.integrationResponse ?? {
372
347
  ...{
373
- statusCode: '200',
374
348
  responseTemplates: {
375
349
  'application/json': JSON.stringify({ message: 'Payload Submitted' }),
376
350
  },
351
+ statusCode: '200',
377
352
  },
378
353
  };
379
354
  }
380
355
  /**
381
356
  * @summary Method to create api integration error response
382
- * @protected
383
357
  */
384
358
  createApiDestinedIntegrationErrorResponse() {
385
359
  if (!this.props.api.withResource)
386
360
  return;
387
361
  this.apiDestinedRestApi.integrationErrorResponse = {
388
362
  ...{
389
- selectionPattern: '^\\[Error\\].*',
390
- statusCode: '400',
363
+ responseParameters: {
364
+ 'method.response.header.Access-Control-Allow-Credentials': "'true'",
365
+ 'method.response.header.Access-Control-Allow-Origin': "'*'",
366
+ 'method.response.header.Content-Type': "'application/json'",
367
+ },
391
368
  responseTemplates: {
392
369
  'application/json': JSON.stringify({
393
- state: 'error',
394
370
  message: "$util.escapeJavaScript($input.path('$.errorMessage'))",
371
+ state: 'error',
395
372
  }),
396
373
  },
397
- responseParameters: {
398
- 'method.response.header.Content-Type': "'application/json'",
399
- 'method.response.header.Access-Control-Allow-Origin': "'*'",
400
- 'method.response.header.Access-Control-Allow-Credentials': "'true'",
401
- },
374
+ selectionPattern: '^\\[Error\\].*',
375
+ statusCode: '400',
402
376
  },
403
377
  ...this.props.api.integrationErrorResponse,
404
378
  };
405
379
  }
406
380
  /**
407
381
  * @summary Method to create api integration
408
- * @protected
409
382
  */
410
383
  createApiDestinedIntegration() {
411
384
  if (!this.props.api.withResource)
412
385
  return;
413
386
  this.apiDestinedRestApi.integration = new apig.Integration({
414
- type: apig.IntegrationType.AWS,
415
387
  integrationHttpMethod: 'POST',
416
- uri: `arn:aws:apigateway:${this.props.region}:sns:path//`,
417
388
  options: {
418
389
  ...{
419
390
  credentialsRole: this.apiDestinedRestApi.role,
420
- requestParameters: this.apiDestinedRestApi.integrationRequestParameters,
421
- requestTemplates: this.apiDestinedRestApi.integrationRequestTemplates,
422
- passthroughBehavior: apig.PassthroughBehavior.NEVER,
423
391
  integrationResponses: [
424
392
  this.apiDestinedRestApi.integrationResponse,
425
393
  this.apiDestinedRestApi.integrationErrorResponse,
426
394
  ],
395
+ passthroughBehavior: apig.PassthroughBehavior.NEVER,
396
+ requestParameters: this.apiDestinedRestApi.integrationRequestParameters,
397
+ requestTemplates: this.apiDestinedRestApi.integrationRequestTemplates,
427
398
  },
428
399
  ...this.props.api.integrationOptions,
429
400
  },
401
+ type: apig.IntegrationType.AWS,
402
+ uri: `arn:aws:apigateway:${this.props.region}:sns:path//`,
430
403
  });
431
404
  }
432
405
  /**
433
406
  * @summary Method to create api integration method response
434
- * @protected
435
407
  */
436
408
  createApiDestinedMethodResponse() {
437
409
  if (!this.props.api.withResource)
438
410
  return;
439
411
  this.apiDestinedRestApi.methodResponse = {
440
412
  ...{
441
- statusCode: '200',
442
- responseParameters: {
443
- 'method.response.header.Content-Type': true,
444
- 'method.response.header.Access-Control-Allow-Origin': true,
445
- 'method.response.header.Access-Control-Allow-Credentials': true,
446
- },
447
413
  responseModels: {
448
414
  'application/json': this.apiDestinedRestApi.responseModel,
449
415
  },
416
+ responseParameters: {
417
+ 'method.response.header.Access-Control-Allow-Credentials': true,
418
+ 'method.response.header.Access-Control-Allow-Origin': true,
419
+ 'method.response.header.Content-Type': true,
420
+ },
421
+ statusCode: '200',
450
422
  },
451
423
  ...this.props.api.methodResponse,
452
424
  };
453
425
  }
454
426
  /**
455
427
  * @summary Method to create api integration method error response
456
- * @protected
457
428
  */
458
429
  createApiDestinedMethodErrorResponse() {
459
430
  if (!this.props.api.withResource)
460
431
  return;
461
432
  this.apiDestinedRestApi.methodErrorResponse = {
462
433
  ...{
463
- statusCode: '400',
464
- responseParameters: {
465
- 'method.response.header.Content-Type': true,
466
- 'method.response.header.Access-Control-Allow-Origin': true,
467
- 'method.response.header.Access-Control-Allow-Credentials': true,
468
- },
469
434
  responseModels: {
470
435
  'application/json': this.apiDestinedRestApi.errorResponseModel,
471
436
  },
437
+ responseParameters: {
438
+ 'method.response.header.Access-Control-Allow-Credentials': true,
439
+ 'method.response.header.Access-Control-Allow-Origin': true,
440
+ 'method.response.header.Content-Type': true,
441
+ },
442
+ statusCode: '400',
472
443
  },
473
444
  ...this.props.api.methodErrorResponse,
474
445
  };
475
446
  }
476
447
  /**
477
448
  * @summary Method to create rest restApi for Api
478
- * @protected
479
449
  */
480
450
  createApiDestinedRestApi() {
481
451
  if (this.props.api.useExisting && this.props.api.importedRestApiRef) {
@@ -488,27 +458,27 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
488
458
  });
489
459
  this.apiDestinedRestApi.api = new apig.RestApi(this, `${this.id}-sns-rest-api`, {
490
460
  ...{
461
+ defaultCorsPreflightOptions: {
462
+ allowHeaders: apig.Cors.DEFAULT_HEADERS,
463
+ allowMethods: ['POST'],
464
+ allowOrigins: apig.Cors.ALL_ORIGINS,
465
+ },
491
466
  defaultIntegration: this.apiDestinedRestApi.integration,
492
467
  defaultMethodOptions: {
493
468
  methodResponses: [this.apiDestinedRestApi.methodResponse, this.apiDestinedRestApi.methodErrorResponse],
494
469
  },
495
470
  deployOptions: {
471
+ accessLogDestination: new apig.LogGroupLogDestination(accessLogGroup),
472
+ accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
496
473
  dataTraceEnabled: true,
497
474
  description: `${this.id} - ${this.props.stage} stage`,
498
475
  loggingLevel: apig.MethodLoggingLevel.INFO,
499
476
  metricsEnabled: true,
500
477
  stageName: this.props.stage,
501
- accessLogDestination: new apig.LogGroupLogDestination(accessLogGroup),
502
- accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
503
478
  },
504
479
  endpointConfiguration: {
505
480
  types: [apig.EndpointType.REGIONAL],
506
481
  },
507
- defaultCorsPreflightOptions: {
508
- allowOrigins: apig.Cors.ALL_ORIGINS,
509
- allowMethods: ['POST'],
510
- allowHeaders: apig.Cors.DEFAULT_HEADERS,
511
- },
512
482
  restApiName: `${this.id}-destined-rest-api-${this.props.stage}`,
513
483
  },
514
484
  ...this.props.api,
@@ -518,7 +488,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
518
488
  }
519
489
  /**
520
490
  * @summary Method to create api integration response model
521
- * @protected
522
491
  */
523
492
  createApiDestinedResponseModel() {
524
493
  if (!this.props.api.withResource)
@@ -529,10 +498,10 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
529
498
  contentType: 'application/json',
530
499
  modelName: 'ResponseModel',
531
500
  schema: {
501
+ properties: { message: { type: apig.JsonSchemaType.STRING } },
532
502
  schema: apig.JsonSchemaVersion.DRAFT4,
533
503
  title: 'pollResponse',
534
504
  type: apig.JsonSchemaType.OBJECT,
535
- properties: { message: { type: apig.JsonSchemaType.STRING } },
536
505
  },
537
506
  },
538
507
  ...this.props.api.responseModel,
@@ -540,7 +509,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
540
509
  }
541
510
  /**
542
511
  * @summary Method to create api integration error response model
543
- * @protected
544
512
  */
545
513
  createApiDestinedErrorResponseModel() {
546
514
  if (!this.props.api.withResource)
@@ -551,13 +519,13 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
551
519
  contentType: 'application/json',
552
520
  modelName: 'ErrorResponseModel',
553
521
  schema: {
554
- schema: apig.JsonSchemaVersion.DRAFT4,
555
- title: 'errorResponse',
556
- type: apig.JsonSchemaType.OBJECT,
557
522
  properties: {
558
- state: { type: apig.JsonSchemaType.STRING },
559
523
  message: { type: apig.JsonSchemaType.STRING },
524
+ state: { type: apig.JsonSchemaType.STRING },
560
525
  },
526
+ schema: apig.JsonSchemaVersion.DRAFT4,
527
+ title: 'errorResponse',
528
+ type: apig.JsonSchemaType.OBJECT,
561
529
  },
562
530
  },
563
531
  ...this.props.api.errorResponseModel,
@@ -565,7 +533,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
565
533
  }
566
534
  /**
567
535
  * @summary Method to create api integration resource
568
- * @protected
569
536
  */
570
537
  createApiDestinedResource() {
571
538
  if (!this.props.api.withResource)
@@ -573,9 +540,9 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
573
540
  let rootResource;
574
541
  if (this.props.api.withResource && this.props.api.importedRestApiRootResourceRef) {
575
542
  rootResource = apig.Resource.fromResourceAttributes(this, `${this.id}-root-resource`, {
543
+ path: '/',
576
544
  resourceId: cdk.Fn.importValue(this.props.api.importedRestApiRootResourceRef),
577
545
  restApi: this.apiDestinedRestApi.api,
578
- path: '/',
579
546
  });
580
547
  }
581
548
  else {
@@ -585,7 +552,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
585
552
  }
586
553
  /**
587
554
  * @summary Method to create api integration resource method
588
- * @protected
589
555
  */
590
556
  createApiDestinedResourceMethod() {
591
557
  if (!this.props.api.withResource)
@@ -597,7 +563,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
597
563
  }
598
564
  /**
599
565
  * @summary Method to create custom restApi domain for Api API
600
- * @protected
601
566
  */
602
567
  createApiDomain() {
603
568
  if (this.props.api.useExisting)
@@ -608,7 +573,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
608
573
  }
609
574
  /**
610
575
  * @summary Method to create base path mappings for Api API
611
- * @protected
612
576
  */
613
577
  createApiBasePathMapping() {
614
578
  if (this.props.api.useExisting)
@@ -622,7 +586,6 @@ class ApiToEventBridgeTargetWithSns extends common_1.CommonConstruct {
622
586
  }
623
587
  /**
624
588
  * @summary Method to create route53 records for Api API
625
- * @protected
626
589
  */
627
590
  createApiRouteAssets() {
628
591
  if (this.props.api.useExisting)
@@ -3,23 +3,19 @@ import { EventBridgeDestination } from 'aws-cdk-lib/aws-lambda-destinations';
3
3
  import { AssetCode, IFunction, LayerVersion } from 'aws-cdk-lib/aws-lambda';
4
4
  import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
5
5
  /**
6
- * @category cdk-utils.api-to-eventbridge-target
7
- * @subcategory Types
8
6
  */
9
7
  export interface ApiDestinedLambdaEnvironment extends LambdaEnvironment {
10
8
  SOURCE_ID: string;
11
9
  }
12
10
  /**
13
- * @category cdk-utils.api-to-eventbridge-target
14
- * @subcategory Types
15
11
  */
16
12
  export interface ApiDestinedLambdaType {
17
13
  destinationFailure: EventBridgeDestination;
18
14
  destinationSuccess: EventBridgeDestination;
19
15
  environment: ApiDestinedLambdaEnvironment;
20
16
  function: IFunction;
21
- layers: LayerVersion[];
22
17
  layerSource?: AssetCode;
18
+ layers: LayerVersion[];
23
19
  policy: PolicyDocument;
24
20
  role: Role;
25
21
  source?: AssetCode;
@@ -6,9 +6,6 @@ import * as route53 from 'aws-cdk-lib/aws-route53';
6
6
  import * as sns from 'aws-cdk-lib/aws-sns';
7
7
  import { ApiToLambdaTargetRestApiType } from './types';
8
8
  /**
9
- * @stability stable
10
- * @category cdk-utils.api-to-lambda-target
11
- * @subcategory member
12
9
  * @classdesc Provides a construct to contain api resources for ApiToLambdaTarget
13
10
  */
14
11
  export declare class ApiToLambdaTargetRestApi implements ApiToLambdaTargetRestApiType {
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiToLambdaTargetRestApi = void 0;
4
4
  /**
5
- * @stability stable
6
- * @category cdk-utils.api-to-lambda-target
7
- * @subcategory member
8
5
  * @classdesc Provides a construct to contain api resources for ApiToLambdaTarget
9
6
  */
10
7
  class ApiToLambdaTargetRestApi {
@@ -3,7 +3,6 @@ import { Construct } from 'constructs';
3
3
  import { CommonConstruct } from '../../common';
4
4
  import { ApiToLambdaTargetProps, ApiToLambdaTargetRestApiType } from './types';
5
5
  /**
6
- * @mixin
7
6
  */
8
7
  export declare class ApiToLambdaTarget extends CommonConstruct {
9
8
  props: ApiToLambdaTargetProps;
@@ -16,69 +15,56 @@ export declare class ApiToLambdaTarget extends CommonConstruct {
16
15
  /**
17
16
  * @summary Method to resolve secrets from SecretsManager
18
17
  * - To be implemented in the overriding method in the implementation class
19
- * @protected
20
18
  */
21
19
  protected resolveSecrets(): void;
22
20
  /**
23
21
  * @summary Method to resolve a hosted zone based on domain attributes
24
- * @protected
25
22
  */
26
23
  protected resolveHostedZone(): void;
27
24
  /**
28
25
  * @summary Method to resolve a certificate based on attributes
29
- * @protected
30
26
  */
31
27
  protected resolveCertificate(): void;
32
28
  /**
33
29
  * @summary Method to create api integration method response
34
- * @protected
35
30
  */
36
31
  protected createApiToLambdaTargetMethodResponse(): void;
37
32
  /**
38
33
  * @summary Method to create api integration method error response
39
- * @protected
40
34
  */
41
35
  protected createApiToLambdaTargetMethodErrorResponse(): void;
42
36
  protected resolveApiToLambdaTargetFunction(): void;
43
37
  /**
44
38
  * @summary Method to create rest restApi for Api
45
- * @protected
46
39
  */
47
40
  protected createApiToLambdaTargetRestApi(): void;
48
41
  /**
49
42
  * @summary Method to create api integration resource
50
- * @protected
51
43
  */
52
44
  protected createApiToLambdaTargetResource(): void;
53
45
  protected createApiToLambdaTargetPolicy(): void;
54
46
  /**
55
47
  * @summary Method to create a role for api integration
56
- * @protected
57
48
  */
58
49
  protected createApiToLambdaTargetRole(): void;
59
50
  /**
60
51
  * @summary Method to create api integration resource method
61
- * @protected
62
52
  */
63
53
  protected createApiToLambdaTargetIntegration(): void;
64
54
  /**
65
55
  * @summary Method to create api integration resource method
66
- * @protected
67
56
  */
68
57
  protected createApiToLambdaTargetResourceMethod(): void;
69
58
  /**
70
59
  * @summary Method to create custom restApi domain for Api
71
- * @protected
72
60
  */
73
61
  protected createApiDomain(): void;
74
62
  /**
75
63
  * @summary Method to create base path mappings for Api
76
- * @protected
77
64
  */
78
65
  protected createApiBasePathMapping(): void;
79
66
  /**
80
67
  * @summary Method to create route53 records for Api
81
- * @protected
82
68
  */
83
69
  protected createApiRouteAssets(): void;
84
70
  }