@gradientedge/cdk-utils 8.118.0 → 8.119.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/app/api-destined-function/package.json +1 -1
- package/dist/src/lib/common/construct.d.ts +32 -32
- package/dist/src/lib/common/construct.js +36 -59
- package/dist/src/lib/common/stack.d.ts +8 -7
- package/dist/src/lib/common/stack.js +17 -37
- package/dist/src/lib/common/types.d.ts +2 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +22 -22
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +37 -60
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +40 -63
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +23 -23
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +2 -2
- package/dist/src/lib/construct/api-to-lambda-target/main.js +15 -38
- package/dist/src/lib/construct/application-configuration/main.d.ts +7 -7
- package/dist/src/lib/construct/application-configuration/main.js +17 -41
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +17 -17
- package/dist/src/lib/construct/graphql-api-lambda/main.js +6 -29
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +7 -7
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +16 -16
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +8 -31
- package/dist/src/lib/construct/lambda-with-iam-access/types.d.ts +4 -4
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +16 -16
- package/dist/src/lib/construct/rest-api-lambda/main.js +5 -28
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +9 -32
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +38 -39
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +33 -54
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +4 -4
- package/dist/src/lib/construct/static-asset-deployment/main.js +3 -26
- package/dist/src/lib/construct/static-site/main.d.ts +15 -15
- package/dist/src/lib/construct/static-site/main.js +4 -27
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +10 -10
- package/dist/src/lib/services/aws/api-gateway/main.js +21 -44
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +2 -2
- package/dist/src/lib/services/aws/appconfig/main.d.ts +7 -7
- package/dist/src/lib/services/aws/appconfig/main.js +14 -37
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -5
- package/dist/src/lib/services/aws/certificate-manager/main.js +10 -33
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +2 -2
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +18 -18
- package/dist/src/lib/services/aws/cloudfront/main.js +46 -45
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +2 -3
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +5 -5
- package/dist/src/lib/services/aws/cloudtrail/main.js +5 -28
- package/dist/src/lib/services/aws/codebuild/main.d.ts +3 -3
- package/dist/src/lib/services/aws/codebuild/main.js +7 -30
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -3
- package/dist/src/lib/services/aws/dynamodb/main.js +8 -31
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +2 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +4 -27
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +10 -10
- package/dist/src/lib/services/aws/elastic-container-service/main.js +27 -50
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +4 -4
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +3 -3
- package/dist/src/lib/services/aws/elastic-file-system/main.js +12 -35
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +4 -4
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -31
- package/dist/src/lib/services/aws/elasticache/main.d.ts +4 -4
- package/dist/src/lib/services/aws/elasticache/main.js +10 -33
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +13 -13
- package/dist/src/lib/services/aws/eventbridge/main.js +26 -49
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +10 -10
- package/dist/src/lib/services/aws/eventbridge/target.js +6 -29
- package/dist/src/lib/services/aws/evidently/main.d.ts +7 -7
- package/dist/src/lib/services/aws/evidently/main.js +18 -41
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +48 -49
- package/dist/src/lib/services/aws/identity-access-management/main.js +110 -133
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +2 -2
- package/dist/src/lib/services/aws/key-management-service/main.js +5 -28
- package/dist/src/lib/services/aws/lambda/main.d.ts +11 -13
- package/dist/src/lib/services/aws/lambda/main.js +31 -58
- package/dist/src/lib/services/aws/route53/main.d.ts +9 -9
- package/dist/src/lib/services/aws/route53/main.js +21 -44
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +5 -6
- package/dist/src/lib/services/aws/secrets-manager/main.js +10 -33
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +4 -4
- package/dist/src/lib/services/aws/simple-notification-service/main.js +11 -34
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +6 -7
- package/dist/src/lib/services/aws/simple-queue-service/main.js +15 -38
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +10 -11
- package/dist/src/lib/services/aws/simple-storage-service/main.js +31 -54
- package/dist/src/lib/services/aws/step-function/main.d.ts +31 -32
- package/dist/src/lib/services/aws/step-function/main.js +33 -57
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +4 -4
- package/dist/src/lib/services/aws/systems-manager/main.js +10 -33
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +5 -6
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +14 -37
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +3 -3
- package/dist/src/lib/services/aws/web-application-firewall/main.js +8 -31
- package/dist/src/lib/utils/aws/index.d.ts +6 -3
- package/dist/src/lib/utils/aws/index.js +9 -26
- package/package.json +15 -15
- package/src/lib/common/construct.ts +97 -67
- package/src/lib/common/stack.ts +12 -12
- package/src/lib/common/types.ts +2 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +31 -22
- package/src/lib/construct/api-to-eventbridge-target/event.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target/main.ts +56 -41
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +62 -47
- package/src/lib/construct/api-to-lambda-target/api.ts +33 -23
- package/src/lib/construct/api-to-lambda-target/main.ts +24 -18
- package/src/lib/construct/application-configuration/main.ts +31 -24
- package/src/lib/construct/graphql-api-lambda/main.ts +22 -22
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +13 -13
- package/src/lib/construct/lambda-with-iam-access/main.ts +25 -25
- package/src/lib/construct/lambda-with-iam-access/types.ts +4 -4
- package/src/lib/construct/rest-api-lambda/main.ts +21 -21
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +14 -14
- package/src/lib/construct/site-with-ecs-backend/main.ts +79 -60
- package/src/lib/construct/static-asset-deployment/main.ts +6 -6
- package/src/lib/construct/static-site/main.ts +23 -17
- package/src/lib/services/aws/api-gateway/main.ts +42 -36
- package/src/lib/services/aws/api-gateway/types.ts +2 -2
- package/src/lib/services/aws/appconfig/main.ts +19 -19
- package/src/lib/services/aws/certificate-manager/main.ts +14 -14
- package/src/lib/services/aws/certificate-manager/types.ts +2 -2
- package/src/lib/services/aws/cloudfront/main.ts +88 -74
- package/src/lib/services/aws/cloudfront/types.ts +6 -3
- package/src/lib/services/aws/cloudtrail/main.ts +11 -11
- package/src/lib/services/aws/codebuild/main.ts +7 -7
- package/src/lib/services/aws/dynamodb/main.ts +8 -8
- package/src/lib/services/aws/elastic-container-registry/main.ts +4 -4
- package/src/lib/services/aws/elastic-container-service/main.ts +48 -37
- package/src/lib/services/aws/elastic-container-service/types.ts +4 -4
- package/src/lib/services/aws/elastic-file-system/main.ts +16 -16
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +11 -11
- package/src/lib/services/aws/elasticache/main.ts +10 -10
- package/src/lib/services/aws/eventbridge/main.ts +37 -37
- package/src/lib/services/aws/eventbridge/target.ts +14 -14
- package/src/lib/services/aws/evidently/main.ts +18 -18
- package/src/lib/services/aws/identity-access-management/main.ts +142 -134
- package/src/lib/services/aws/key-management-service/main.ts +5 -5
- package/src/lib/services/aws/lambda/main.ts +65 -59
- package/src/lib/services/aws/route53/main.ts +31 -31
- package/src/lib/services/aws/secrets-manager/main.ts +11 -15
- package/src/lib/services/aws/simple-notification-service/main.ts +13 -13
- package/src/lib/services/aws/simple-queue-service/main.ts +18 -18
- package/src/lib/services/aws/simple-storage-service/main.ts +40 -40
- package/src/lib/services/aws/step-function/main.ts +77 -65
- package/src/lib/services/aws/systems-manager/main.ts +17 -12
- package/src/lib/services/aws/virtual-private-cloud/main.ts +16 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +8 -8
- package/src/lib/utils/aws/index.ts +8 -5
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.ApiToLambdaTarget = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
+
const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
|
|
6
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
7
|
+
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
31
8
|
const common_1 = require("../../common");
|
|
32
9
|
const api_1 = require("./api");
|
|
33
10
|
/**
|
|
@@ -126,19 +103,19 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
126
103
|
};
|
|
127
104
|
}
|
|
128
105
|
resolveApiToLambdaTargetFunction() {
|
|
129
|
-
this.apiToLambdaTargetRestApi.lambda =
|
|
106
|
+
this.apiToLambdaTargetRestApi.lambda = aws_lambda_1.Function.fromFunctionName(this, `${this.id}-lambda`, this.props.lambdaFunctionName);
|
|
130
107
|
}
|
|
131
108
|
/**
|
|
132
109
|
* @summary Method to create rest restApi for Api
|
|
133
110
|
*/
|
|
134
111
|
createApiToLambdaTargetRestApi() {
|
|
135
112
|
if (this.props.api.useExisting && this.props.api.importedRestApiRef) {
|
|
136
|
-
this.apiToLambdaTargetRestApi.api =
|
|
113
|
+
this.apiToLambdaTargetRestApi.api = aws_apigateway_1.RestApi.fromRestApiId(this, `${this.id}-rest-api`, aws_cdk_lib_1.Fn.importValue(this.props.api.importedRestApiRef));
|
|
137
114
|
return;
|
|
138
115
|
}
|
|
139
116
|
const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
|
|
140
117
|
logGroupName: `/custom/api/${this.id}-rest-api-access`,
|
|
141
|
-
removalPolicy:
|
|
118
|
+
removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
|
|
142
119
|
});
|
|
143
120
|
this.props.api.restApi = {
|
|
144
121
|
...this.props.api.restApi,
|
|
@@ -150,7 +127,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
150
127
|
],
|
|
151
128
|
},
|
|
152
129
|
deployOptions: {
|
|
153
|
-
accessLogDestination: new
|
|
130
|
+
accessLogDestination: new aws_apigateway_1.LogGroupLogDestination(accessLogGroup),
|
|
154
131
|
},
|
|
155
132
|
},
|
|
156
133
|
};
|
|
@@ -166,9 +143,9 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
166
143
|
return;
|
|
167
144
|
let rootResource;
|
|
168
145
|
if (this.props.api.withResource && this.props.api.importedRestApiRootResourceRef) {
|
|
169
|
-
rootResource =
|
|
146
|
+
rootResource = aws_apigateway_1.Resource.fromResourceAttributes(this, `${this.id}-root-resource`, {
|
|
170
147
|
path: '/',
|
|
171
|
-
resourceId:
|
|
148
|
+
resourceId: aws_cdk_lib_1.Fn.importValue(this.props.api.importedRestApiRootResourceRef),
|
|
172
149
|
restApi: this.apiToLambdaTargetRestApi.api,
|
|
173
150
|
});
|
|
174
151
|
}
|
|
@@ -178,7 +155,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
178
155
|
this.apiToLambdaTargetRestApi.resource = rootResource.addResource(this.props.api.resource ?? this.apiResource);
|
|
179
156
|
}
|
|
180
157
|
createApiToLambdaTargetPolicy() {
|
|
181
|
-
this.apiToLambdaTargetRestApi.policy = new
|
|
158
|
+
this.apiToLambdaTargetRestApi.policy = new aws_iam_1.PolicyDocument({
|
|
182
159
|
statements: [
|
|
183
160
|
this.iamManager.statementForPutEvents(),
|
|
184
161
|
this.iamManager.statementForInvokeLambda([this.apiToLambdaTargetRestApi.lambda.functionArn]),
|
|
@@ -191,8 +168,8 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
191
168
|
createApiToLambdaTargetRole() {
|
|
192
169
|
if (!this.apiToLambdaTargetRestApi.policy)
|
|
193
170
|
throw 'Policy undefined';
|
|
194
|
-
this.apiToLambdaTargetRestApi.role = new
|
|
195
|
-
assumedBy: new
|
|
171
|
+
this.apiToLambdaTargetRestApi.role = new aws_iam_1.Role(this, `${this.id}-rest-api-role`, {
|
|
172
|
+
assumedBy: new aws_iam_1.ServicePrincipal('apigateway.amazonaws.com'),
|
|
196
173
|
inlinePolicies: { policy: this.apiToLambdaTargetRestApi.policy },
|
|
197
174
|
});
|
|
198
175
|
}
|
|
@@ -200,7 +177,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
200
177
|
* @summary Method to create api integration resource method
|
|
201
178
|
*/
|
|
202
179
|
createApiToLambdaTargetIntegration() {
|
|
203
|
-
this.apiToLambdaTargetRestApi.integration = new
|
|
180
|
+
this.apiToLambdaTargetRestApi.integration = new aws_apigateway_1.LambdaIntegration(this.apiToLambdaTargetRestApi.lambda, {
|
|
204
181
|
allowTestInvoke: true,
|
|
205
182
|
credentialsRole: this.apiToLambdaTargetRestApi.role,
|
|
206
183
|
});
|
|
@@ -235,7 +212,7 @@ class ApiToLambdaTarget extends common_1.CommonConstruct {
|
|
|
235
212
|
createApiBasePathMapping() {
|
|
236
213
|
if (this.props.api.useExisting)
|
|
237
214
|
return;
|
|
238
|
-
new
|
|
215
|
+
new aws_apigateway_1.BasePathMapping(this, `${this.id}-base-bath-mapping`, {
|
|
239
216
|
basePath: '',
|
|
240
217
|
domainName: this.apiToLambdaTargetRestApi.domain,
|
|
241
218
|
restApi: this.apiToLambdaTargetRestApi.api,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { CfnApplication, CfnConfigurationProfile, CfnDeploymentStrategy, CfnEnvironment, CfnHostedConfigurationVersion } from 'aws-cdk-lib/aws-appconfig';
|
|
1
2
|
import { Construct } from 'constructs';
|
|
2
|
-
import * as appconfig from 'aws-cdk-lib/aws-appconfig';
|
|
3
|
-
import { ApplicationConfigurationProps } from './types';
|
|
4
3
|
import { CommonConstruct } from '../../common';
|
|
4
|
+
import { ApplicationConfigurationProps } from './types';
|
|
5
5
|
export declare class ApplicationConfiguration extends CommonConstruct {
|
|
6
6
|
props: ApplicationConfigurationProps;
|
|
7
7
|
id: string;
|
|
8
|
-
appConfigApplication:
|
|
9
|
-
appConfigEnvironment:
|
|
10
|
-
appConfigProfile:
|
|
11
|
-
appConfigVersion:
|
|
12
|
-
appConfigDeploymentStrategy:
|
|
8
|
+
appConfigApplication: CfnApplication;
|
|
9
|
+
appConfigEnvironment: CfnEnvironment;
|
|
10
|
+
appConfigProfile: CfnConfigurationProfile;
|
|
11
|
+
appConfigVersion: CfnHostedConfigurationVersion;
|
|
12
|
+
appConfigDeploymentStrategy: CfnDeploymentStrategy;
|
|
13
13
|
constructor(parent: Construct, id: string, props: ApplicationConfigurationProps);
|
|
14
14
|
initResources(): void;
|
|
15
15
|
protected createConfiguration(): void;
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.ApplicationConfiguration = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
4
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
+
const aws_appconfig_1 = require("aws-cdk-lib/aws-appconfig");
|
|
29
6
|
const common_1 = require("../../common");
|
|
30
7
|
class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
31
|
-
props;
|
|
32
8
|
id;
|
|
33
9
|
appConfigApplication;
|
|
34
10
|
appConfigEnvironment;
|
|
@@ -56,21 +32,21 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
|
56
32
|
this.appConfigApplication = this.appConfigManager.createApplication(`${this.id}-ac-application`, this, this.props.appConfig);
|
|
57
33
|
}
|
|
58
34
|
createAppConfigEnvironment() {
|
|
59
|
-
this.appConfigEnvironment = this.appConfigManager.createEnvironment(`${this.id}-ac-environment`, this,
|
|
35
|
+
this.appConfigEnvironment = this.appConfigManager.createEnvironment(`${this.id}-ac-environment`, this, aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId), this.props.appConfig);
|
|
60
36
|
}
|
|
61
37
|
createAppConfigProfile() {
|
|
62
|
-
this.appConfigProfile = this.appConfigManager.createConfigurationProfile(`${this.id}-ac-profile`, this,
|
|
38
|
+
this.appConfigProfile = this.appConfigManager.createConfigurationProfile(`${this.id}-ac-profile`, this, aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId), this.props.appConfig);
|
|
63
39
|
}
|
|
64
40
|
createAppConfigVersion() {
|
|
65
|
-
this.appConfigVersion = new
|
|
66
|
-
applicationId:
|
|
67
|
-
configurationProfileId:
|
|
41
|
+
this.appConfigVersion = new aws_appconfig_1.CfnHostedConfigurationVersion(this, `${this.id}-ac-configuration`, {
|
|
42
|
+
applicationId: aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId),
|
|
43
|
+
configurationProfileId: aws_cdk_lib_1.Fn.ref(this.appConfigProfile.logicalId),
|
|
68
44
|
content: JSON.stringify(this.props.appConfigContent),
|
|
69
45
|
contentType: 'application/json',
|
|
70
46
|
});
|
|
71
47
|
}
|
|
72
48
|
createAppConfigDeploymentStrategy() {
|
|
73
|
-
this.appConfigDeploymentStrategy = new
|
|
49
|
+
this.appConfigDeploymentStrategy = new aws_appconfig_1.CfnDeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
|
|
74
50
|
deploymentDurationInMinutes: this.props.appConfig.deploymentStrategy.deploymentDurationInMinutes,
|
|
75
51
|
growthFactor: this.props.appConfig.deploymentStrategy.growthFactor,
|
|
76
52
|
name: this.props.appConfig.deploymentStrategy.name,
|
|
@@ -78,19 +54,19 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
|
78
54
|
});
|
|
79
55
|
}
|
|
80
56
|
createAppConfigDeployment() {
|
|
81
|
-
new
|
|
82
|
-
applicationId:
|
|
83
|
-
configurationProfileId:
|
|
84
|
-
configurationVersion:
|
|
85
|
-
deploymentStrategyId:
|
|
86
|
-
environmentId:
|
|
57
|
+
new aws_appconfig_1.CfnDeployment(this, `${this.id}-app-config-deployment`, {
|
|
58
|
+
applicationId: aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId),
|
|
59
|
+
configurationProfileId: aws_cdk_lib_1.Fn.ref(this.appConfigProfile.logicalId),
|
|
60
|
+
configurationVersion: aws_cdk_lib_1.Fn.ref(this.appConfigVersion.logicalId),
|
|
61
|
+
deploymentStrategyId: aws_cdk_lib_1.Fn.ref(this.appConfigDeploymentStrategy.logicalId),
|
|
62
|
+
environmentId: aws_cdk_lib_1.Fn.ref(this.appConfigEnvironment.logicalId),
|
|
87
63
|
});
|
|
88
64
|
}
|
|
89
65
|
resolveEnvironmentVariables() {
|
|
90
66
|
return {
|
|
91
|
-
APP_CONFIG_APPLICATION_ID:
|
|
92
|
-
APP_CONFIG_CONFIGURATION_PROFILE_ID:
|
|
93
|
-
APP_CONFIG_ENVIRONMENT_ID:
|
|
67
|
+
APP_CONFIG_APPLICATION_ID: aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId),
|
|
68
|
+
APP_CONFIG_CONFIGURATION_PROFILE_ID: aws_cdk_lib_1.Fn.ref(this.appConfigProfile.logicalId),
|
|
69
|
+
APP_CONFIG_ENVIRONMENT_ID: aws_cdk_lib_1.Fn.ref(this.appConfigEnvironment.logicalId),
|
|
94
70
|
};
|
|
95
71
|
}
|
|
96
72
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { BasePathMapping, DomainName, RestApi } from 'aws-cdk-lib/aws-apigateway';
|
|
2
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
3
|
+
import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
|
|
4
|
+
import { IFunction, ILayerVersion } from 'aws-cdk-lib/aws-lambda';
|
|
5
|
+
import { IHostedZone } from 'aws-cdk-lib/aws-route53';
|
|
6
|
+
import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';
|
|
7
7
|
import { Construct } from 'constructs';
|
|
8
8
|
import { CommonConstruct } from '../../common';
|
|
9
9
|
import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types';
|
|
@@ -11,7 +11,7 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types';
|
|
|
11
11
|
* @deprecated Use RestApiLambda instead. This will be removed in a future release.
|
|
12
12
|
* @classdesc Provides a construct to create and deploy a Graphql API as Lambda
|
|
13
13
|
*
|
|
14
|
-
* <b>Architecture</b><br/> 
|
|
15
15
|
* @example
|
|
16
16
|
* import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
|
|
17
17
|
* import { Construct } from 'constructs'
|
|
@@ -28,17 +28,17 @@ import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types';
|
|
|
28
28
|
export declare class GraphQLApiLambda extends CommonConstruct {
|
|
29
29
|
props: GraphQlApiLambdaProps;
|
|
30
30
|
id: string;
|
|
31
|
-
applicationSecrets:
|
|
32
|
-
graphQLApiLambdaPolicy:
|
|
33
|
-
graphQLApiLambdaRole:
|
|
31
|
+
applicationSecrets: ISecret[];
|
|
32
|
+
graphQLApiLambdaPolicy: PolicyDocument;
|
|
33
|
+
graphQLApiLambdaRole: Role;
|
|
34
34
|
graphQLApiLambdaEnvironment: GraphQlApiLambdaEnvironment;
|
|
35
|
-
graphQLApiLambdaLayers:
|
|
36
|
-
graphQLApiLambdaFunction:
|
|
37
|
-
graphQLApi:
|
|
38
|
-
graphQLApiHostedZone:
|
|
39
|
-
graphQLApiCertificate:
|
|
40
|
-
graphQLApiDomain:
|
|
41
|
-
graphQLApiBasePathMappings:
|
|
35
|
+
graphQLApiLambdaLayers: ILayerVersion[];
|
|
36
|
+
graphQLApiLambdaFunction: IFunction;
|
|
37
|
+
graphQLApi: RestApi;
|
|
38
|
+
graphQLApiHostedZone: IHostedZone;
|
|
39
|
+
graphQLApiCertificate: ICertificate;
|
|
40
|
+
graphQLApiDomain: DomainName;
|
|
41
|
+
graphQLApiBasePathMappings: BasePathMapping[];
|
|
42
42
|
constructor(parent: Construct, id: string, props: GraphQlApiLambdaProps);
|
|
43
43
|
/**
|
|
44
44
|
* @summary Initialise and provision resources
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.GraphQLApiLambda = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
4
|
+
const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
|
|
5
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
29
6
|
const common_1 = require("../../common");
|
|
30
7
|
/**
|
|
31
8
|
* @deprecated Use RestApiLambda instead. This will be removed in a future release.
|
|
32
9
|
* @classdesc Provides a construct to create and deploy a Graphql API as Lambda
|
|
33
10
|
*
|
|
34
|
-
* <b>Architecture</b><br/> 
|
|
35
12
|
* @example
|
|
36
13
|
* import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
|
|
37
14
|
* import { Construct } from 'constructs'
|
|
@@ -111,7 +88,7 @@ class GraphQLApiLambda extends common_1.CommonConstruct {
|
|
|
111
88
|
* @summary Method to create iam policy for GraphQL Lambda function
|
|
112
89
|
*/
|
|
113
90
|
createLambdaPolicy() {
|
|
114
|
-
this.graphQLApiLambdaPolicy = new
|
|
91
|
+
this.graphQLApiLambdaPolicy = new aws_iam_1.PolicyDocument({
|
|
115
92
|
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
116
93
|
});
|
|
117
94
|
}
|
|
@@ -170,7 +147,7 @@ class GraphQLApiLambda extends common_1.CommonConstruct {
|
|
|
170
147
|
const apiRootPaths = this.props.apiRootPaths;
|
|
171
148
|
if (apiRootPaths && apiRootPaths.length > 0) {
|
|
172
149
|
apiRootPaths.forEach((apiRootPath) => {
|
|
173
|
-
this.graphQLApiBasePathMappings.push(new
|
|
150
|
+
this.graphQLApiBasePathMappings.push(new aws_apigateway_1.BasePathMapping(this, `${this.id}-base-bath-mapping-${apiRootPath}`, {
|
|
174
151
|
basePath: apiRootPath,
|
|
175
152
|
domainName: this.graphQLApiDomain,
|
|
176
153
|
restApi: this.graphQLApi,
|
|
@@ -180,7 +157,7 @@ class GraphQLApiLambda extends common_1.CommonConstruct {
|
|
|
180
157
|
return;
|
|
181
158
|
}
|
|
182
159
|
// add default mapping if apiRootPaths not set
|
|
183
|
-
new
|
|
160
|
+
new aws_apigateway_1.BasePathMapping(this, `${this.id}-base-bath-mapping`, {
|
|
184
161
|
domainName: this.graphQLApiDomain,
|
|
185
162
|
restApi: this.graphQLApi,
|
|
186
163
|
stage: this.graphQLApi.deploymentStage,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ISecurityGroup, IVpc } from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import { CfnReplicationGroup } from 'aws-cdk-lib/aws-elasticache';
|
|
3
3
|
import { Construct } from 'constructs';
|
|
4
4
|
import { GraphQLApiLambda } from '..';
|
|
5
5
|
import { GraphQlApiLambdaWithCacheProps } from './types';
|
|
@@ -24,9 +24,9 @@ import { GraphQlApiLambdaWithCacheProps } from './types';
|
|
|
24
24
|
export declare class GraphQLApiLambdaWithCache extends GraphQLApiLambda {
|
|
25
25
|
props: GraphQlApiLambdaWithCacheProps;
|
|
26
26
|
id: string;
|
|
27
|
-
graphQLVpc:
|
|
28
|
-
graphQLElastiCache:
|
|
29
|
-
graphQLSecurityGroup:
|
|
27
|
+
graphQLVpc: IVpc;
|
|
28
|
+
graphQLElastiCache: CfnReplicationGroup;
|
|
29
|
+
graphQLSecurityGroup: ISecurityGroup;
|
|
30
30
|
securityGroupExportName: string;
|
|
31
31
|
constructor(parent: Construct, id: string, props: GraphQlApiLambdaWithCacheProps);
|
|
32
32
|
protected initResources(): void;
|
|
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.GraphQLApiLambdaWithCache = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
27
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
28
|
+
const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
|
|
29
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
30
30
|
const __1 = require("..");
|
|
31
31
|
const utils = __importStar(require("../../utils"));
|
|
32
32
|
/**
|
|
@@ -83,14 +83,14 @@ class GraphQLApiLambdaWithCache extends __1.GraphQLApiLambda {
|
|
|
83
83
|
*/
|
|
84
84
|
setSecurityGroup() {
|
|
85
85
|
if (this.props.securityGroupExportName) {
|
|
86
|
-
this.graphQLSecurityGroup =
|
|
86
|
+
this.graphQLSecurityGroup = aws_ec2_1.SecurityGroup.fromSecurityGroupId(this, `${this.id}`, aws_cdk_lib_1.Fn.importValue(this.props.securityGroupExportName));
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
this.graphQLSecurityGroup = new
|
|
89
|
+
this.graphQLSecurityGroup = new aws_ec2_1.SecurityGroup(this, `${this.id}-security-group-${this.props.stage}`, {
|
|
90
90
|
securityGroupName: `${this.id}-security-group-${this.props.stage}`,
|
|
91
91
|
vpc: this.graphQLVpc,
|
|
92
92
|
});
|
|
93
|
-
this.graphQLSecurityGroup.addIngressRule(
|
|
93
|
+
this.graphQLSecurityGroup.addIngressRule(aws_ec2_1.Peer.anyIpv4(), aws_ec2_1.Port.allTraffic(), 'All Traffic');
|
|
94
94
|
utils.createCfnOutput(`${this.id}-security-group-id`, this, this.graphQLSecurityGroup.securityGroupId);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -105,7 +105,7 @@ class GraphQLApiLambdaWithCache extends __1.GraphQLApiLambda {
|
|
|
105
105
|
*/
|
|
106
106
|
createLambdaRole() {
|
|
107
107
|
super.createLambdaRole();
|
|
108
|
-
this.graphQLApiLambdaRole.addManagedPolicy(
|
|
108
|
+
this.graphQLApiLambdaRole.addManagedPolicy(aws_iam_1.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaVPCAccessExecutionRole'));
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* @summary Method to create environment variables for GraphQL Lambda function
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { ISecurityGroup, IVpc, SubnetSelection } from 'aws-cdk-lib/aws-ec2';
|
|
2
|
+
import { IAccessPoint } from 'aws-cdk-lib/aws-efs';
|
|
3
|
+
import { CfnAccessKey, PolicyDocument, Role, User } from 'aws-cdk-lib/aws-iam';
|
|
4
|
+
import { IFunction, ILayerVersion } from 'aws-cdk-lib/aws-lambda';
|
|
5
|
+
import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
|
|
6
6
|
import { Construct } from 'constructs';
|
|
7
7
|
import { CommonConstruct } from '../../common';
|
|
8
8
|
import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './types';
|
|
@@ -24,19 +24,19 @@ import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './type
|
|
|
24
24
|
export declare class LambdaWithIamAccess extends CommonConstruct {
|
|
25
25
|
props: LambdaWithIamAccessProps;
|
|
26
26
|
id: string;
|
|
27
|
-
lambdaPolicy:
|
|
28
|
-
lambdaRole:
|
|
27
|
+
lambdaPolicy: PolicyDocument;
|
|
28
|
+
lambdaRole: Role;
|
|
29
29
|
lambdaEnvironment: LambdaWithIamAccessEnvironment;
|
|
30
|
-
lambdaLayers:
|
|
31
|
-
lambdaFunction:
|
|
32
|
-
lambdaIamUser:
|
|
33
|
-
lambdaUserAccessKey:
|
|
34
|
-
lambdaUserAccessSecret:
|
|
35
|
-
lambdaVpc:
|
|
36
|
-
lambdaSecurityGroups:
|
|
37
|
-
lambdaAccessPoint:
|
|
30
|
+
lambdaLayers: ILayerVersion[];
|
|
31
|
+
lambdaFunction: IFunction;
|
|
32
|
+
lambdaIamUser: User;
|
|
33
|
+
lambdaUserAccessKey: CfnAccessKey;
|
|
34
|
+
lambdaUserAccessSecret: Secret;
|
|
35
|
+
lambdaVpc: IVpc;
|
|
36
|
+
lambdaSecurityGroups: ISecurityGroup[];
|
|
37
|
+
lambdaAccessPoint: IAccessPoint;
|
|
38
38
|
lambdaMountPath: string;
|
|
39
|
-
lambdaVpcSubnets:
|
|
39
|
+
lambdaVpcSubnets: SubnetSelection;
|
|
40
40
|
constructor(parent: Construct, id: string, props: LambdaWithIamAccessProps);
|
|
41
41
|
/**
|
|
42
42
|
* @summary Initialise and provision resources
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.LambdaWithIamAccess = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
4
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
5
|
+
const aws_secretsmanager_1 = require("aws-cdk-lib/aws-secretsmanager");
|
|
29
6
|
const common_1 = require("../../common");
|
|
30
7
|
/**
|
|
31
8
|
* @classdesc Provides a construct to create a lambda function with IAM access
|
|
@@ -91,7 +68,7 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
|
|
|
91
68
|
* @summary Method to create iam policy for Lambda function
|
|
92
69
|
*/
|
|
93
70
|
createLambdaPolicy() {
|
|
94
|
-
this.lambdaPolicy = new
|
|
71
|
+
this.lambdaPolicy = new aws_iam_1.PolicyDocument({
|
|
95
72
|
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
96
73
|
});
|
|
97
74
|
}
|
|
@@ -133,20 +110,20 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
|
|
|
133
110
|
* @summary Method to create iam user for the lambda function
|
|
134
111
|
*/
|
|
135
112
|
createIamUserForLambdaFunction() {
|
|
136
|
-
this.lambdaIamUser = new
|
|
113
|
+
this.lambdaIamUser = new aws_iam_1.User(this, `${this.id}-lambda-user`, {
|
|
137
114
|
userName: `${this.id}-user-${this.props.stage}`,
|
|
138
115
|
});
|
|
139
|
-
new
|
|
116
|
+
new aws_iam_1.Policy(this, `${this.id}-lambda-user-policy`, {
|
|
140
117
|
policyName: `${this.id}-policy-${this.props.stage}`,
|
|
141
118
|
statements: [
|
|
142
|
-
new
|
|
119
|
+
new aws_iam_1.PolicyStatement({
|
|
143
120
|
actions: ['lambda:InvokeFunction'],
|
|
144
121
|
resources: [this.lambdaFunction.functionArn],
|
|
145
122
|
}),
|
|
146
123
|
],
|
|
147
124
|
users: [this.lambdaIamUser],
|
|
148
125
|
});
|
|
149
|
-
this.lambdaUserAccessKey = new
|
|
126
|
+
this.lambdaUserAccessKey = new aws_iam_1.CfnAccessKey(this, `${this.id}-access-key-${this.props.stage}`, {
|
|
150
127
|
userName: this.lambdaIamUser.userName,
|
|
151
128
|
});
|
|
152
129
|
}
|
|
@@ -154,7 +131,7 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
|
|
|
154
131
|
* @summary Method to create iam secret for the lambda function
|
|
155
132
|
*/
|
|
156
133
|
createIamSecretForLambdaFunction() {
|
|
157
|
-
this.lambdaUserAccessSecret = new
|
|
134
|
+
this.lambdaUserAccessSecret = new aws_secretsmanager_1.Secret(this, `${this.id}-lambda-user-secret-${this.props.stage}`, this.props.lambdaSecret);
|
|
158
135
|
const cfnSecret = this.lambdaUserAccessSecret.node.defaultChild;
|
|
159
136
|
cfnSecret.generateSecretString = undefined;
|
|
160
137
|
cfnSecret.secretString = `{ "ACCESS_KEY_ID": "${this.lambdaUserAccessKey.ref}", "ACCESS_KEY_SECRET": "${this.lambdaUserAccessKey.attrSecretAccessKey}" }`;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AssetCode } from 'aws-cdk-lib/aws-lambda';
|
|
2
2
|
import { SecretProps } from 'aws-cdk-lib/aws-secretsmanager';
|
|
3
|
-
import { LambdaEnvironment, LambdaProps } from '../../services';
|
|
4
3
|
import { CommonStackProps } from '../../common';
|
|
4
|
+
import { LambdaEnvironment, LambdaProps } from '../../services';
|
|
5
5
|
export interface LambdaWithIamAccessProps extends CommonStackProps {
|
|
6
6
|
lambda: LambdaProps;
|
|
7
7
|
lambdaHandler?: string;
|
|
8
|
-
lambdaLayerSources:
|
|
8
|
+
lambdaLayerSources: AssetCode[];
|
|
9
9
|
lambdaSecret: SecretProps;
|
|
10
|
-
lambdaSource:
|
|
10
|
+
lambdaSource: AssetCode;
|
|
11
11
|
logLevel: string;
|
|
12
12
|
nodeEnv: string;
|
|
13
13
|
timezone: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { BasePathMapping, DomainName, RestApi } from 'aws-cdk-lib/aws-apigateway';
|
|
2
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
3
|
+
import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
|
|
4
|
+
import { IFunction, ILayerVersion } from 'aws-cdk-lib/aws-lambda';
|
|
5
|
+
import { IHostedZone } from 'aws-cdk-lib/aws-route53';
|
|
6
|
+
import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';
|
|
7
7
|
import { Construct } from 'constructs';
|
|
8
8
|
import { CommonConstruct } from '../../common';
|
|
9
9
|
import { RestApiLambdaEnvironment, RestApiLambdaProps } from './types';
|
|
@@ -27,17 +27,17 @@ import { RestApiLambdaEnvironment, RestApiLambdaProps } from './types';
|
|
|
27
27
|
export declare abstract class RestApiLambda extends CommonConstruct {
|
|
28
28
|
props: RestApiLambdaProps;
|
|
29
29
|
id: string;
|
|
30
|
-
applicationSecrets:
|
|
31
|
-
restApiLambdaPolicy:
|
|
32
|
-
restApiLambdaRole:
|
|
30
|
+
applicationSecrets: ISecret[];
|
|
31
|
+
restApiLambdaPolicy: PolicyDocument;
|
|
32
|
+
restApiLambdaRole: Role;
|
|
33
33
|
restApiLambdaEnvironment: RestApiLambdaEnvironment;
|
|
34
|
-
restApiLambdaLayers:
|
|
35
|
-
restApiLambdaFunction:
|
|
36
|
-
restApi:
|
|
37
|
-
restApiHostedZone:
|
|
38
|
-
restApiCertificate:
|
|
39
|
-
restApiDomain:
|
|
40
|
-
restApiBasePathMappings:
|
|
34
|
+
restApiLambdaLayers: ILayerVersion[];
|
|
35
|
+
restApiLambdaFunction: IFunction;
|
|
36
|
+
restApi: RestApi;
|
|
37
|
+
restApiHostedZone: IHostedZone;
|
|
38
|
+
restApiCertificate: ICertificate;
|
|
39
|
+
restApiDomain: DomainName;
|
|
40
|
+
restApiBasePathMappings: BasePathMapping[];
|
|
41
41
|
protected constructor(parent: Construct, id: string, props: RestApiLambdaProps);
|
|
42
42
|
/**
|
|
43
43
|
* @summary Initialise and provision resources
|