@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.
- 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 +1 -19
- 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 +1 -19
- 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 +2 -20
- 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 +2 -20
- 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
|
@@ -19,8 +19,6 @@ import { ITopic } from 'aws-cdk-lib/aws-sns'
|
|
|
19
19
|
import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* @category cdk-utils.api-to-lambda-target
|
|
23
|
-
* @subcategory Types
|
|
24
22
|
*/
|
|
25
23
|
export interface ApiToLambdaTargetRestApiType {
|
|
26
24
|
api: IRestApi
|
|
@@ -39,37 +37,33 @@ export interface ApiToLambdaTargetRestApiType {
|
|
|
39
37
|
method: Method
|
|
40
38
|
methodErrorResponse: MethodResponse
|
|
41
39
|
methodResponse: MethodResponse
|
|
40
|
+
policy?: PolicyDocument
|
|
42
41
|
resource: Resource
|
|
43
42
|
responseModel: Model
|
|
44
|
-
topic?: ITopic
|
|
45
43
|
role?: Role
|
|
46
|
-
|
|
44
|
+
topic?: ITopic
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
|
-
* @category cdk-utils.api-to-lambda-target
|
|
51
|
-
* @subcategory Properties
|
|
52
48
|
*/
|
|
53
49
|
export interface ApiToLambdaTargetRestApiProps {
|
|
54
|
-
resource: string
|
|
55
50
|
certificate: AcmProps
|
|
56
|
-
restApi: LambdaRestApiProps
|
|
57
51
|
importedRestApiRef?: string
|
|
58
52
|
importedRestApiRootResourceRef?: string
|
|
59
|
-
useExisting: boolean
|
|
60
|
-
withResource?: boolean
|
|
61
53
|
methodErrorResponse: MethodResponse
|
|
62
54
|
methodResponse: MethodResponse
|
|
55
|
+
resource: string
|
|
56
|
+
restApi: LambdaRestApiProps
|
|
57
|
+
useExisting: boolean
|
|
58
|
+
withResource?: boolean
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
/**
|
|
66
|
-
* @category cdk-utils.api-to-lambda-target
|
|
67
|
-
* @subcategory Properties
|
|
68
62
|
*/
|
|
69
63
|
export interface ApiToLambdaTargetProps extends CommonStackProps {
|
|
64
|
+
api: ApiToLambdaTargetRestApiProps
|
|
70
65
|
apiRootPaths?: string[]
|
|
71
66
|
apiSubDomain: string
|
|
72
|
-
api: ApiToLambdaTargetRestApiProps
|
|
73
67
|
lambdaFunctionName: string
|
|
74
68
|
logLevel: string
|
|
75
69
|
nodeEnv: string
|
|
@@ -10,13 +10,9 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types'
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @deprecated Use RestApiLambda instead. This will be removed in a future release.
|
|
13
|
-
*
|
|
14
|
-
* @category cdk-utils.graphql-api-lambda
|
|
15
|
-
* @subcategory construct
|
|
16
13
|
* @classdesc Provides a construct to create and deploy a Graphql API as Lambda
|
|
17
14
|
*
|
|
18
15
|
* <b>Architecture</b><br/> 
|
|
19
|
-
*
|
|
20
16
|
* @example
|
|
21
17
|
* import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
|
|
22
18
|
* import { Construct } from 'constructs'
|
|
@@ -29,7 +25,6 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types'
|
|
|
29
25
|
* this.initResources()
|
|
30
26
|
* }
|
|
31
27
|
* }
|
|
32
|
-
* @mixin
|
|
33
28
|
*/
|
|
34
29
|
export class GraphQLApiLambda extends CommonConstruct {
|
|
35
30
|
/* graphql restApi props */
|
|
@@ -41,7 +36,7 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
41
36
|
graphQLApiLambdaPolicy: iam.PolicyDocument
|
|
42
37
|
graphQLApiLambdaRole: iam.Role
|
|
43
38
|
graphQLApiLambdaEnvironment: GraphQlApiLambdaEnvironment
|
|
44
|
-
graphQLApiLambdaLayers: lambda.
|
|
39
|
+
graphQLApiLambdaLayers: lambda.ILayerVersion[] = []
|
|
45
40
|
graphQLApiLambdaFunction: lambda.Function
|
|
46
41
|
graphQLApi: apig.RestApi
|
|
47
42
|
graphQLApiHostedZone: route53.IHostedZone
|
|
@@ -58,7 +53,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
58
53
|
|
|
59
54
|
/**
|
|
60
55
|
* @summary Initialise and provision resources
|
|
61
|
-
* @protected
|
|
62
56
|
*/
|
|
63
57
|
protected initResources() {
|
|
64
58
|
this.resolveSecrets()
|
|
@@ -78,7 +72,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
78
72
|
/**
|
|
79
73
|
* @summary Method to resolve secrets from SecretsManager
|
|
80
74
|
* - To be implemented in the overriding method in the implementation class
|
|
81
|
-
* @protected
|
|
82
75
|
*/
|
|
83
76
|
protected resolveSecrets() {
|
|
84
77
|
this.applicationSecrets = []
|
|
@@ -86,7 +79,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
86
79
|
|
|
87
80
|
/**
|
|
88
81
|
* @summary Method to resolve a hosted zone based on domain attributes
|
|
89
|
-
* @protected
|
|
90
82
|
*/
|
|
91
83
|
protected resolveHostedZone() {
|
|
92
84
|
this.graphQLApiHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(
|
|
@@ -98,7 +90,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
98
90
|
|
|
99
91
|
/**
|
|
100
92
|
* @summary Method to resolve a certificate based on attributes
|
|
101
|
-
* @protected
|
|
102
93
|
*/
|
|
103
94
|
protected resolveCertificate() {
|
|
104
95
|
if (
|
|
@@ -123,7 +114,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
123
114
|
|
|
124
115
|
/**
|
|
125
116
|
* @summary Method to create iam policy for GraphQL Lambda function
|
|
126
|
-
* @protected
|
|
127
117
|
*/
|
|
128
118
|
protected createLambdaPolicy() {
|
|
129
119
|
this.graphQLApiLambdaPolicy = new iam.PolicyDocument({
|
|
@@ -133,7 +123,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
133
123
|
|
|
134
124
|
/**
|
|
135
125
|
* @summary Method to create iam role for GraphQL Lambda function
|
|
136
|
-
* @protected
|
|
137
126
|
*/
|
|
138
127
|
protected createLambdaRole() {
|
|
139
128
|
this.graphQLApiLambdaRole = this.iamManager.createRoleForLambda(
|
|
@@ -145,19 +134,17 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
145
134
|
|
|
146
135
|
/**
|
|
147
136
|
* @summary Method to create environment variables for GraphQL Lambda function
|
|
148
|
-
* @protected
|
|
149
137
|
*/
|
|
150
138
|
protected createLambdaEnvironment() {
|
|
151
139
|
this.graphQLApiLambdaEnvironment = {
|
|
152
|
-
NODE_ENV: this.props.nodeEnv,
|
|
153
140
|
LOG_LEVEL: this.props.logLevel,
|
|
141
|
+
NODE_ENV: this.props.nodeEnv,
|
|
154
142
|
TZ: this.props.timezone,
|
|
155
143
|
}
|
|
156
144
|
}
|
|
157
145
|
|
|
158
146
|
/**
|
|
159
147
|
* @summary Method to create layers for GraphQL Lambda function
|
|
160
|
-
* @protected
|
|
161
148
|
*/
|
|
162
149
|
protected createLambdaLayers() {
|
|
163
150
|
const layers: lambda.LayerVersion[] = []
|
|
@@ -173,7 +160,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
173
160
|
|
|
174
161
|
/**
|
|
175
162
|
* @summary Method to create lambda function for GraphQL
|
|
176
|
-
* @protected
|
|
177
163
|
*/
|
|
178
164
|
protected createLambdaFunction() {
|
|
179
165
|
this.graphQLApiLambdaFunction = this.lambdaManager.createLambdaFunction(
|
|
@@ -190,7 +176,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
190
176
|
|
|
191
177
|
/**
|
|
192
178
|
* @summary Method to create rest restApi for GraphQL
|
|
193
|
-
* @protected
|
|
194
179
|
*/
|
|
195
180
|
protected createRestApi() {
|
|
196
181
|
this.graphQLApi = this.apiManager.createLambdaRestApi(
|
|
@@ -203,7 +188,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
203
188
|
|
|
204
189
|
/**
|
|
205
190
|
* @summary Method to create custom restApi domain for GraphQL API
|
|
206
|
-
* @protected
|
|
207
191
|
*/
|
|
208
192
|
protected createApiDomain() {
|
|
209
193
|
this.graphQLApiDomain = this.apiManager.createApiDomain(
|
|
@@ -218,7 +202,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
218
202
|
|
|
219
203
|
/**
|
|
220
204
|
* @summary Method to create base path mappings for GraphQL API
|
|
221
|
-
* @protected
|
|
222
205
|
*/
|
|
223
206
|
protected createApiBasePathMapping() {
|
|
224
207
|
const apiRootPaths = this.props.apiRootPaths
|
|
@@ -246,7 +229,6 @@ export class GraphQLApiLambda extends CommonConstruct {
|
|
|
246
229
|
|
|
247
230
|
/**
|
|
248
231
|
* @summary Method to create route53 records for GraphQL API
|
|
249
|
-
* @protected
|
|
250
232
|
*/
|
|
251
233
|
protected createApiRouteAssets() {
|
|
252
234
|
this.route53Manager.createApiGatewayARecord(
|
|
@@ -5,27 +5,23 @@ import { AssetCode } from 'aws-cdk-lib/aws-lambda'
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use RestApiLambdaEnvironment instead. This will be removed in a future release.
|
|
8
|
-
* @category cdk-utils.graphql-api-lambda
|
|
9
|
-
* @subcategory Types
|
|
10
8
|
*/
|
|
11
9
|
export interface GraphQlApiLambdaEnvironment extends LambdaEnvironment {}
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* @deprecated Use RestApiLambdaProps instead. This will be removed in a future release.
|
|
15
|
-
* @category cdk-utils.graphql-api-lambda
|
|
16
|
-
* @subcategory Properties
|
|
17
13
|
*/
|
|
18
14
|
export interface GraphQlApiLambdaProps extends CommonStackProps {
|
|
19
15
|
apiRootPaths?: string[]
|
|
20
16
|
apiSubDomain: string
|
|
21
17
|
graphQLApiCertificate: AcmProps
|
|
22
|
-
graphqlRestApi: LambdaRestApiProps
|
|
23
|
-
graphqlApiLambdaLayerSources?: AssetCode[]
|
|
24
18
|
graphQLApiHandler: string
|
|
25
19
|
graphQLApiSource: AssetCode
|
|
26
20
|
graphqlApi: LambdaProps
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
graphqlApiLambdaLayerSources?: AssetCode[]
|
|
22
|
+
graphqlRestApi: LambdaRestApiProps
|
|
29
23
|
logLevel: string
|
|
24
|
+
nodeEnv: string
|
|
30
25
|
timezone: string
|
|
26
|
+
useExistingHostedZone: boolean
|
|
31
27
|
}
|
|
@@ -9,13 +9,9 @@ import * as utils from '../../utils'
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated Use RestApiLambdaWithCache instead. This will be removed in a future release.
|
|
12
|
-
*
|
|
13
|
-
* @category cdk-utils.graphql-api-lambda-with-cache
|
|
14
|
-
* @subcategory construct
|
|
15
12
|
* @classdesc Provides a construct to create and deploy a Graphql API as Lambda with Caching
|
|
16
13
|
*
|
|
17
14
|
* <b>Architecture</b><br/> 
|
|
18
|
-
*
|
|
19
15
|
* @example
|
|
20
16
|
* import { GraphQlApiLambdaWithCacheProps } '@gradientedge/cdk-utils'
|
|
21
17
|
* import { Construct } from 'constructs'
|
|
@@ -28,7 +24,6 @@ import * as utils from '../../utils'
|
|
|
28
24
|
* this.initResources()
|
|
29
25
|
* }
|
|
30
26
|
* }
|
|
31
|
-
* @mixin
|
|
32
27
|
*/
|
|
33
28
|
export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
34
29
|
/* graphql restApi props */
|
|
@@ -57,7 +52,6 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
|
57
52
|
|
|
58
53
|
/**
|
|
59
54
|
* Create VPC
|
|
60
|
-
* @protected
|
|
61
55
|
*/
|
|
62
56
|
protected setVpc() {
|
|
63
57
|
if (this.props.useExistingVpc) {
|
|
@@ -69,7 +63,6 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
|
69
63
|
|
|
70
64
|
/**
|
|
71
65
|
* Resolve Security Group
|
|
72
|
-
* @protected
|
|
73
66
|
*/
|
|
74
67
|
protected setSecurityGroup() {
|
|
75
68
|
if (this.props.securityGroupExportName) {
|
|
@@ -92,7 +85,6 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
|
92
85
|
|
|
93
86
|
/**
|
|
94
87
|
* Create ElastiCache
|
|
95
|
-
* @protected
|
|
96
88
|
*/
|
|
97
89
|
protected createElastiCache() {
|
|
98
90
|
this.graphQLElastiCache = this.elasticacheManager.createReplicatedElastiCache(
|
|
@@ -106,7 +98,6 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
|
106
98
|
|
|
107
99
|
/**
|
|
108
100
|
* Create Lambda Role
|
|
109
|
-
* @protected
|
|
110
101
|
*/
|
|
111
102
|
protected createLambdaRole() {
|
|
112
103
|
super.createLambdaRole()
|
|
@@ -118,19 +109,17 @@ export class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
|
118
109
|
|
|
119
110
|
/**
|
|
120
111
|
* @summary Method to create environment variables for GraphQL Lambda function
|
|
121
|
-
* @protected
|
|
122
112
|
*/
|
|
123
113
|
protected createLambdaEnvironment() {
|
|
124
114
|
this.graphQLApiLambdaEnvironment = {
|
|
125
|
-
NODE_ENV: this.props.nodeEnv,
|
|
126
115
|
LOG_LEVEL: this.props.logLevel,
|
|
116
|
+
NODE_ENV: this.props.nodeEnv,
|
|
127
117
|
TZ: this.props.timezone,
|
|
128
118
|
}
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
/**
|
|
132
122
|
* @summary Method to create lambda function for GraphQL API
|
|
133
|
-
* @protected
|
|
134
123
|
*/
|
|
135
124
|
protected createLambdaFunction() {
|
|
136
125
|
this.graphQLApiLambdaFunction = this.lambdaManager.createLambdaFunction(
|
|
@@ -4,12 +4,10 @@ import { ReplicatedElastiCacheProps } from '../../services'
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use RestApiLambdaWithCacheProps instead. This will be removed in a future release.
|
|
7
|
-
* @category cdk-utils.graphql-api-lambda-with-cache
|
|
8
|
-
* @subcategory Properties
|
|
9
7
|
*/
|
|
10
8
|
export interface GraphQlApiLambdaWithCacheProps extends GraphQlApiLambdaProps {
|
|
11
|
-
graphQLVpc: VpcProps
|
|
12
9
|
graphQLElastiCache: ReplicatedElastiCacheProps
|
|
10
|
+
graphQLVpc: VpcProps
|
|
13
11
|
securityGroupExportName: string
|
|
14
12
|
useExistingVpc: boolean
|
|
15
13
|
vpcName?: string
|
|
@@ -6,10 +6,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
|
6
6
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @category cdk-utils.lambda-with-iam-access
|
|
10
|
-
* @subcategory construct
|
|
11
9
|
* @classdesc Provides a construct to create a lambda function with IAM access
|
|
12
|
-
*
|
|
13
10
|
* @example
|
|
14
11
|
* import { LambdaWithIamAccess, LambdaWithIamAccessProps } '@gradientedge/cdk-utils'
|
|
15
12
|
* import { Construct } from 'constructs'
|
|
@@ -22,7 +19,6 @@ import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
|
|
|
22
19
|
* this.initResources()
|
|
23
20
|
* }
|
|
24
21
|
* }
|
|
25
|
-
* @mixin
|
|
26
22
|
*/
|
|
27
23
|
export class LambdaWithIamAccess extends CommonConstruct {
|
|
28
24
|
/* LambdaWithIamAccess props */
|
|
@@ -48,7 +44,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
48
44
|
|
|
49
45
|
/**
|
|
50
46
|
* @summary Initialise and provision resources
|
|
51
|
-
* @protected
|
|
52
47
|
*/
|
|
53
48
|
public initResources() {
|
|
54
49
|
this.createLambdaPolicy()
|
|
@@ -62,7 +57,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
62
57
|
|
|
63
58
|
/**
|
|
64
59
|
* @summary Method to create iam policy for Lambda function
|
|
65
|
-
* @protected
|
|
66
60
|
*/
|
|
67
61
|
protected createLambdaPolicy() {
|
|
68
62
|
this.lambdaPolicy = new iam.PolicyDocument({
|
|
@@ -72,7 +66,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
72
66
|
|
|
73
67
|
/**
|
|
74
68
|
* @summary Method to create iam role for Lambda function
|
|
75
|
-
* @protected
|
|
76
69
|
*/
|
|
77
70
|
protected createLambdaRole() {
|
|
78
71
|
this.lambdaRole = this.iamManager.createRoleForLambda(`${this.id}-lambda-role`, this, this.lambdaPolicy)
|
|
@@ -80,19 +73,17 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
80
73
|
|
|
81
74
|
/**
|
|
82
75
|
* @summary Method to create environment variables for Lambda function
|
|
83
|
-
* @protected
|
|
84
76
|
*/
|
|
85
77
|
protected createLambdaEnvironment() {
|
|
86
78
|
this.lambdaEnvironment = {
|
|
87
|
-
NODE_ENV: this.props.nodeEnv,
|
|
88
79
|
LOG_LEVEL: this.props.logLevel,
|
|
80
|
+
NODE_ENV: this.props.nodeEnv,
|
|
89
81
|
TZ: this.props.timezone,
|
|
90
82
|
}
|
|
91
83
|
}
|
|
92
84
|
|
|
93
85
|
/**
|
|
94
86
|
* @summary Method to create layers for Lambda function
|
|
95
|
-
* @protected
|
|
96
87
|
*/
|
|
97
88
|
protected createLambdaLayers() {
|
|
98
89
|
const layers: lambda.LayerVersion[] = []
|
|
@@ -108,7 +99,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
108
99
|
|
|
109
100
|
/**
|
|
110
101
|
* @summary Method to create lambda function
|
|
111
|
-
* @protected
|
|
112
102
|
*/
|
|
113
103
|
protected createLambdaFunction() {
|
|
114
104
|
this.lambdaFunction = this.lambdaManager.createLambdaFunction(
|
|
@@ -125,7 +115,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
125
115
|
|
|
126
116
|
/**
|
|
127
117
|
* @summary Method to create iam user for the lambda function
|
|
128
|
-
* @protected
|
|
129
118
|
*/
|
|
130
119
|
protected createIamUserForLambdaFunction() {
|
|
131
120
|
this.lambdaIamUser = new iam.User(this, `${this.id}-lambda-user`, {
|
|
@@ -136,8 +125,8 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
136
125
|
policyName: `${this.id}-policy-${this.props.stage}`,
|
|
137
126
|
statements: [
|
|
138
127
|
new iam.PolicyStatement({
|
|
139
|
-
resources: [this.lambdaFunction.functionArn],
|
|
140
128
|
actions: ['lambda:InvokeFunction'],
|
|
129
|
+
resources: [this.lambdaFunction.functionArn],
|
|
141
130
|
}),
|
|
142
131
|
],
|
|
143
132
|
users: [this.lambdaIamUser],
|
|
@@ -150,7 +139,6 @@ export class LambdaWithIamAccess extends CommonConstruct {
|
|
|
150
139
|
|
|
151
140
|
/**
|
|
152
141
|
* @summary Method to create iam secret for the lambda function
|
|
153
|
-
* @protected
|
|
154
142
|
*/
|
|
155
143
|
protected createIamSecretForLambdaFunction() {
|
|
156
144
|
this.lambdaUserAccessSecret = new secretsManager.Secret(
|
|
@@ -9,12 +9,9 @@ import { CommonConstruct } from '../../common'
|
|
|
9
9
|
import { RestApiLambdaEnvironment, RestApiLambdaProps } from './types'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @category cdk-utils.rest-api-lambda
|
|
13
|
-
* @subcategory construct
|
|
14
12
|
* @classdesc Provides a construct to create and deploy a RestApi as Lambda
|
|
15
13
|
*
|
|
16
14
|
* <b>Architecture</b><br/> 
|
|
17
|
-
*
|
|
18
15
|
* @example
|
|
19
16
|
* import { RestApiLambda, RestApiLambdaProps } '@gradientedge/cdk-utils'
|
|
20
17
|
* import { Construct } from 'constructs'
|
|
@@ -27,7 +24,6 @@ import { RestApiLambdaEnvironment, RestApiLambdaProps } from './types'
|
|
|
27
24
|
* this.initResources()
|
|
28
25
|
* }
|
|
29
26
|
* }
|
|
30
|
-
* @mixin
|
|
31
27
|
*/
|
|
32
28
|
export abstract class RestApiLambda extends CommonConstruct {
|
|
33
29
|
/* restApiLambda props */
|
|
@@ -39,7 +35,7 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
39
35
|
restApiLambdaPolicy: iam.PolicyDocument
|
|
40
36
|
restApiLambdaRole: iam.Role
|
|
41
37
|
restApiLambdaEnvironment: RestApiLambdaEnvironment
|
|
42
|
-
restApiLambdaLayers: lambda.
|
|
38
|
+
restApiLambdaLayers: lambda.ILayerVersion[] = []
|
|
43
39
|
restApiLambdaFunction: lambda.Function
|
|
44
40
|
restApi: apig.RestApi
|
|
45
41
|
restApiHostedZone: route53.IHostedZone
|
|
@@ -56,7 +52,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
56
52
|
|
|
57
53
|
/**
|
|
58
54
|
* @summary Initialise and provision resources
|
|
59
|
-
* @protected
|
|
60
55
|
*/
|
|
61
56
|
protected initResources() {
|
|
62
57
|
this.resolveSecrets()
|
|
@@ -78,7 +73,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
78
73
|
/**
|
|
79
74
|
* @summary Method to resolve secrets from SecretsManager
|
|
80
75
|
* - To be implemented in the overriding method in the implementation class
|
|
81
|
-
* @protected
|
|
82
76
|
*/
|
|
83
77
|
protected resolveSecrets() {
|
|
84
78
|
this.applicationSecrets = []
|
|
@@ -86,7 +80,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
86
80
|
|
|
87
81
|
/**
|
|
88
82
|
* @summary Method to resolve a hosted zone based on domain attributes
|
|
89
|
-
* @protected
|
|
90
83
|
*/
|
|
91
84
|
protected resolveHostedZone() {
|
|
92
85
|
this.restApiHostedZone = this.route53Manager.withHostedZoneFromFullyQualifiedDomainName(
|
|
@@ -98,7 +91,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
98
91
|
|
|
99
92
|
/**
|
|
100
93
|
* @summary Method to resolve a certificate based on attributes
|
|
101
|
-
* @protected
|
|
102
94
|
*/
|
|
103
95
|
protected resolveCertificate() {
|
|
104
96
|
if (
|
|
@@ -123,7 +115,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
123
115
|
|
|
124
116
|
/**
|
|
125
117
|
* @summary Method to create iam policy for RestApi Lambda function
|
|
126
|
-
* @protected
|
|
127
118
|
*/
|
|
128
119
|
protected createLambdaPolicy() {
|
|
129
120
|
this.restApiLambdaPolicy = new iam.PolicyDocument({
|
|
@@ -133,7 +124,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
133
124
|
|
|
134
125
|
/**
|
|
135
126
|
* @summary Method to create iam role for RestApi Lambda function
|
|
136
|
-
* @protected
|
|
137
127
|
*/
|
|
138
128
|
protected createLambdaRole() {
|
|
139
129
|
this.restApiLambdaRole = this.iamManager.createRoleForLambda(
|
|
@@ -145,19 +135,17 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
145
135
|
|
|
146
136
|
/**
|
|
147
137
|
* @summary Method to create environment variables for RestApi Lambda function
|
|
148
|
-
* @protected
|
|
149
138
|
*/
|
|
150
139
|
protected createLambdaEnvironment() {
|
|
151
140
|
this.restApiLambdaEnvironment = {
|
|
152
|
-
NODE_ENV: this.props.nodeEnv,
|
|
153
141
|
LOG_LEVEL: this.props.logLevel,
|
|
142
|
+
NODE_ENV: this.props.nodeEnv,
|
|
154
143
|
TZ: this.props.timezone,
|
|
155
144
|
}
|
|
156
145
|
}
|
|
157
146
|
|
|
158
147
|
/**
|
|
159
148
|
* @summary Method to create layers for RestApi Lambda function
|
|
160
|
-
* @protected
|
|
161
149
|
*/
|
|
162
150
|
protected createLambdaLayers() {
|
|
163
151
|
const layers: lambda.LayerVersion[] = []
|
|
@@ -173,7 +161,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
173
161
|
|
|
174
162
|
/**
|
|
175
163
|
* @summary Method to create lambda function for RestApi
|
|
176
|
-
* @protected
|
|
177
164
|
*/
|
|
178
165
|
protected createLambdaFunction() {
|
|
179
166
|
this.restApiLambdaFunction = this.lambdaManager.createLambdaFunction(
|
|
@@ -190,7 +177,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
190
177
|
|
|
191
178
|
/**
|
|
192
179
|
* @summary Method to create rest restApiLambda for RestApi
|
|
193
|
-
* @protected
|
|
194
180
|
*/
|
|
195
181
|
protected createRestApi() {
|
|
196
182
|
this.restApi = this.apiManager.createLambdaRestApi(
|
|
@@ -205,7 +191,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
205
191
|
|
|
206
192
|
/**
|
|
207
193
|
* @summary Method to create custom restApiLambda domain for RestApi
|
|
208
|
-
* @protected
|
|
209
194
|
*/
|
|
210
195
|
protected createApiDomain() {
|
|
211
196
|
this.restApiDomain = this.apiManager.createApiDomain(
|
|
@@ -220,7 +205,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
220
205
|
|
|
221
206
|
/**
|
|
222
207
|
* @summary Method to create base path mappings for RestApi
|
|
223
|
-
* @protected
|
|
224
208
|
*/
|
|
225
209
|
protected createApiBasePathMapping() {
|
|
226
210
|
const apiRootPaths = this.props.apiRootPaths
|
|
@@ -248,7 +232,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
248
232
|
|
|
249
233
|
/**
|
|
250
234
|
* @summary Method to create route53 records for RestApi
|
|
251
|
-
* @protected
|
|
252
235
|
*/
|
|
253
236
|
protected createApiRouteAssets() {
|
|
254
237
|
this.route53Manager.createApiGatewayARecord(
|
|
@@ -263,7 +246,6 @@ export abstract class RestApiLambda extends CommonConstruct {
|
|
|
263
246
|
|
|
264
247
|
/**
|
|
265
248
|
* @summary Method to deploy the changes to the RestApi
|
|
266
|
-
* @protected
|
|
267
249
|
*/
|
|
268
250
|
protected createRestApiDeployment() {
|
|
269
251
|
this.apiManager.createApiDeployment(`${this.id}-deployment`, this, this.restApi)
|
|
@@ -3,26 +3,22 @@ import { CommonStackProps } from '../../common'
|
|
|
3
3
|
import { AssetCode } from 'aws-cdk-lib/aws-lambda'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @category cdk-utils.rest-api-lambda
|
|
7
|
-
* @subcategory Types
|
|
8
6
|
*/
|
|
9
7
|
export interface RestApiLambdaEnvironment extends LambdaEnvironment {}
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
* @category cdk-utils.rest-api-lambda
|
|
13
|
-
* @subcategory Properties
|
|
14
10
|
*/
|
|
15
11
|
export interface RestApiLambdaProps extends CommonStackProps {
|
|
16
12
|
apiRootPaths?: string[]
|
|
17
13
|
apiSubDomain: string
|
|
18
|
-
|
|
14
|
+
logLevel: string
|
|
15
|
+
nodeEnv: string
|
|
19
16
|
restApi: LambdaRestApiProps
|
|
20
|
-
|
|
17
|
+
restApiCertificate: AcmProps
|
|
21
18
|
restApiHandler: string
|
|
22
|
-
restApiSource: AssetCode
|
|
23
19
|
restApiLambda: LambdaProps
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
logLevel: string
|
|
20
|
+
restApiLambdaLayerSources?: AssetCode[]
|
|
21
|
+
restApiSource: AssetCode
|
|
27
22
|
timezone: string
|
|
23
|
+
useExistingHostedZone: boolean
|
|
28
24
|
}
|
|
@@ -8,13 +8,9 @@ import { RestApiLambdaWithCacheProps } from './types'
|
|
|
8
8
|
import * as utils from '../../utils'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @stability stable
|
|
12
|
-
* @category cdk-utils.rest-api-lambda-with-cache
|
|
13
|
-
* @subcategory construct
|
|
14
11
|
* @classdesc Provides a construct to create and deploy a RestApi API as Lambda with Caching
|
|
15
12
|
*
|
|
16
13
|
* <b>Architecture</b><br/> 
|
|
17
|
-
*
|
|
18
14
|
* @example
|
|
19
15
|
* import { RestApiLambdaWithCacheProps } '@gradientedge/cdk-utils'
|
|
20
16
|
* import { Construct } from 'constructs'
|
|
@@ -27,7 +23,6 @@ import * as utils from '../../utils'
|
|
|
27
23
|
* this.initResources()
|
|
28
24
|
* }
|
|
29
25
|
* }
|
|
30
|
-
* @mixin
|
|
31
26
|
*/
|
|
32
27
|
export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
33
28
|
/* restApiLambdaWithCache props */
|
|
@@ -56,7 +51,6 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
56
51
|
|
|
57
52
|
/**
|
|
58
53
|
* Create VPC
|
|
59
|
-
* @protected
|
|
60
54
|
*/
|
|
61
55
|
protected resolveVpc() {
|
|
62
56
|
if (this.props.useExistingVpc) {
|
|
@@ -68,7 +62,6 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
68
62
|
|
|
69
63
|
/**
|
|
70
64
|
* Resolve Security Group
|
|
71
|
-
* @protected
|
|
72
65
|
*/
|
|
73
66
|
protected resolveSecurityGroup() {
|
|
74
67
|
if (!this.props.restApiCache) {
|
|
@@ -95,7 +88,6 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
95
88
|
|
|
96
89
|
/**
|
|
97
90
|
* Create ElastiCache
|
|
98
|
-
* @protected
|
|
99
91
|
*/
|
|
100
92
|
protected createElastiCache() {
|
|
101
93
|
if (!this.props.restApiCache) {
|
|
@@ -111,21 +103,20 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
111
103
|
)
|
|
112
104
|
|
|
113
105
|
this.ssmManager.writeStringToParameters(`${this.id}-elasticache-endpoint-address`, this, {
|
|
114
|
-
parameterName: `${this.id}-elasticache-endpoint-address`,
|
|
115
106
|
description: `Elasticache address to use by applications`,
|
|
107
|
+
parameterName: `${this.id}-elasticache-endpoint-address`,
|
|
116
108
|
stringValue: this.restApiCache.attrConfigurationEndPointAddress,
|
|
117
109
|
})
|
|
118
110
|
|
|
119
111
|
this.ssmManager.writeStringToParameters(`${this.id}-elasticache-endpoint-port`, this, {
|
|
120
|
-
parameterName: `${this.id}-elasticache-endpoint-port`,
|
|
121
112
|
description: `Elasticache port to use by applications`,
|
|
113
|
+
parameterName: `${this.id}-elasticache-endpoint-port`,
|
|
122
114
|
stringValue: this.restApiCache.attrConfigurationEndPointPort,
|
|
123
115
|
})
|
|
124
116
|
}
|
|
125
117
|
|
|
126
118
|
/**
|
|
127
119
|
* Create Lambda Role
|
|
128
|
-
* @protected
|
|
129
120
|
*/
|
|
130
121
|
protected createLambdaRole() {
|
|
131
122
|
super.createLambdaRole()
|
|
@@ -137,19 +128,17 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
137
128
|
|
|
138
129
|
/**
|
|
139
130
|
* @summary Method to create environment variables for RestApi Lambda function
|
|
140
|
-
* @protected
|
|
141
131
|
*/
|
|
142
132
|
protected createLambdaEnvironment() {
|
|
143
133
|
this.restApiLambdaEnvironment = {
|
|
144
|
-
NODE_ENV: this.props.nodeEnv,
|
|
145
134
|
LOG_LEVEL: this.props.logLevel,
|
|
135
|
+
NODE_ENV: this.props.nodeEnv,
|
|
146
136
|
TZ: this.props.timezone,
|
|
147
137
|
}
|
|
148
138
|
}
|
|
149
139
|
|
|
150
140
|
/**
|
|
151
141
|
* @summary Method to create lambda function for RestApi API
|
|
152
|
-
* @protected
|
|
153
142
|
*/
|
|
154
143
|
protected createLambdaFunction() {
|
|
155
144
|
this.restApiLambdaFunction = this.lambdaManager.createLambdaFunction(
|
|
@@ -3,12 +3,10 @@ import { VpcProps } from 'aws-cdk-lib/aws-ec2'
|
|
|
3
3
|
import { ReplicatedElastiCacheProps } from '../../services'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @category cdk-utils.rest-api-lambda-with-cache
|
|
7
|
-
* @subcategory Properties
|
|
8
6
|
*/
|
|
9
7
|
export interface RestApiLambdaWithCacheProps extends RestApiLambdaProps {
|
|
10
|
-
restApiVpc: VpcProps
|
|
11
8
|
restApiCache: ReplicatedElastiCacheProps
|
|
9
|
+
restApiVpc: VpcProps
|
|
12
10
|
securityGroupExportName: string
|
|
13
11
|
useExistingVpc: boolean
|
|
14
12
|
vpcName?: string
|