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