@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.
- package/.eslintrc.json +40 -0
- package/app/api-destined-function/src/lib/lambda.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
- package/dist/lib/lambda.d.ts +6 -6
- package/dist/lib/lambda.js +6 -6
- package/dist/lib/lambda.js.map +1 -1
- package/dist/src/lib/common/construct.d.ts +4 -7
- package/dist/src/lib/common/construct.js +4 -7
- package/dist/src/lib/common/stack.d.ts +9 -13
- package/dist/src/lib/common/stack.js +9 -13
- package/dist/src/lib/common/types.d.ts +0 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
- package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
- package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
- package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
- package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
- package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
- package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
- package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
- package/dist/src/lib/construct/static-site/main.d.ts +0 -17
- package/dist/src/lib/construct/static-site/main.js +1 -18
- package/dist/src/lib/construct/static-site/types.d.ts +9 -11
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
- package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
- package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
- package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
- package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
- package/dist/src/lib/services/aws/appconfig/main.js +19 -22
- package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
- package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
- package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
- package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
- package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
- package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
- package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
- package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
- package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
- package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
- package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
- package/dist/src/lib/services/aws/codebuild/main.js +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
- package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
- package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
- package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
- package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
- package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
- package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
- package/dist/src/lib/services/aws/elasticache/main.js +35 -39
- package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
- package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
- package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
- package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
- package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
- package/dist/src/lib/services/aws/evidently/main.js +19 -23
- package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
- package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
- package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
- package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
- package/dist/src/lib/services/aws/lambda/main.js +64 -69
- package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
- package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
- package/dist/src/lib/services/aws/route53/main.js +19 -23
- package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
- package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
- package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
- package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
- package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
- package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
- package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
- package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
- package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
- package/dist/src/lib/services/aws/step-function/main.js +91 -95
- package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
- package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
- package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
- package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
- package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
- package/dist/src/lib/types/aws/index.d.ts +0 -2
- package/dist/src/lib/utils/aws/index.d.ts +6 -9
- package/dist/src/lib/utils/aws/index.js +7 -10
- package/dist/src/lib/utils/index.d.ts +6 -13
- package/dist/src/lib/utils/index.js +4 -12
- package/package.json +1 -1
- package/src/lib/common/construct.ts +4 -7
- package/src/lib/common/stack.ts +9 -13
- package/src/lib/common/types.ts +0 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
- package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
- package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
- package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
- package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
- package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
- package/src/lib/construct/graphql-api-lambda/main.ts +1 -19
- package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
- package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
- package/src/lib/construct/rest-api-lambda/main.ts +1 -19
- package/src/lib/construct/rest-api-lambda/types.ts +6 -10
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
- package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
- package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
- package/src/lib/construct/static-asset-deployment/main.ts +0 -8
- package/src/lib/construct/static-asset-deployment/types.ts +1 -1
- package/src/lib/construct/static-site/main.ts +1 -18
- package/src/lib/construct/static-site/types.ts +9 -11
- package/src/lib/services/aws/api-gateway/main.ts +43 -47
- package/src/lib/services/aws/api-gateway/types.ts +0 -2
- package/src/lib/services/aws/appconfig/constants.ts +26 -32
- package/src/lib/services/aws/appconfig/main.ts +19 -22
- package/src/lib/services/aws/appconfig/types.ts +1 -3
- package/src/lib/services/aws/certificate-manager/main.ts +5 -10
- package/src/lib/services/aws/certificate-manager/types.ts +3 -5
- package/src/lib/services/aws/cloudfront/main.ts +56 -62
- package/src/lib/services/aws/cloudfront/types.ts +1 -7
- package/src/lib/services/aws/cloudtrail/main.ts +8 -12
- package/src/lib/services/aws/cloudtrail/types.ts +0 -2
- package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
- package/src/lib/services/aws/cloudwatch/main.ts +116 -122
- package/src/lib/services/aws/cloudwatch/types.ts +20 -42
- package/src/lib/services/aws/codebuild/main.ts +3 -7
- package/src/lib/services/aws/dynamodb/main.ts +13 -17
- package/src/lib/services/aws/dynamodb/types.ts +0 -2
- package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
- package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
- package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
- package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
- package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
- package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
- package/src/lib/services/aws/elasticache/main.ts +35 -39
- package/src/lib/services/aws/elasticache/types.ts +0 -4
- package/src/lib/services/aws/eventbridge/main.ts +34 -38
- package/src/lib/services/aws/eventbridge/target.ts +8 -11
- package/src/lib/services/aws/eventbridge/types.ts +2 -10
- package/src/lib/services/aws/evidently/main.ts +19 -23
- package/src/lib/services/aws/evidently/types.ts +0 -10
- package/src/lib/services/aws/identity-access-management/main.ts +97 -101
- package/src/lib/services/aws/key-management-service/main.ts +6 -10
- package/src/lib/services/aws/key-management-service/types.ts +0 -2
- package/src/lib/services/aws/lambda/main.ts +64 -69
- package/src/lib/services/aws/lambda/types.ts +6 -16
- package/src/lib/services/aws/route53/main.ts +19 -23
- package/src/lib/services/aws/route53/types.ts +0 -2
- package/src/lib/services/aws/secrets-manager/main.ts +6 -28
- package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
- package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
- package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
- package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
- package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
- package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
- package/src/lib/services/aws/step-function/main.ts +91 -95
- package/src/lib/services/aws/step-function/types.ts +0 -32
- package/src/lib/services/aws/systems-manager/main.ts +13 -19
- package/src/lib/services/aws/systems-manager/types.ts +0 -2
- package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
- package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
- package/src/lib/types/aws/index.ts +0 -2
- package/src/lib/utils/aws/index.ts +7 -10
- 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/> 
|
|
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
|
-
|
|
282
|
-
|
|
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
|
-
|
|
290
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|