@jaypie/constructs 1.1.33 → 1.1.35
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/dist/cjs/JaypieLambda.d.ts +2 -2
- package/dist/cjs/index.cjs +220 -193
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/JaypieLambda.d.ts +2 -2
- package/dist/esm/index.js +219 -192
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -35,11 +35,11 @@ export interface JaypieLambdaProps {
|
|
|
35
35
|
}
|
|
36
36
|
export declare class JaypieLambda extends Construct implements lambda.IFunction {
|
|
37
37
|
private readonly _lambda;
|
|
38
|
-
private readonly
|
|
38
|
+
private readonly _provisioned?;
|
|
39
39
|
private readonly _code;
|
|
40
40
|
constructor(scope: Construct, id: string, props: JaypieLambdaProps);
|
|
41
41
|
get lambda(): lambda.Function;
|
|
42
|
-
get
|
|
42
|
+
get provisioned(): lambda.Alias | undefined;
|
|
43
43
|
get code(): lambda.Code;
|
|
44
44
|
get functionArn(): string;
|
|
45
45
|
get functionName(): string;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
2
|
import * as cdk from 'aws-cdk-lib';
|
|
3
|
-
import { Tags,
|
|
3
|
+
import { Tags, Duration, Stack, RemovalPolicy, Fn, CfnOutput, SecretValue } from 'aws-cdk-lib';
|
|
4
4
|
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
|
|
5
5
|
import * as apiGateway from 'aws-cdk-lib/aws-apigateway';
|
|
6
6
|
import * as route53 from 'aws-cdk-lib/aws-route53';
|
|
7
7
|
import { HostedZone } from 'aws-cdk-lib/aws-route53';
|
|
8
8
|
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets';
|
|
9
9
|
import { CDK as CDK$2, mergeDomain, isValidSubdomain, ConfigurationError, isValidHostname } from '@jaypie/cdk';
|
|
10
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
11
|
+
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
10
12
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
11
13
|
import * as s3n from 'aws-cdk-lib/aws-s3-notifications';
|
|
12
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
13
14
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
14
15
|
import * as lambdaEventSources from 'aws-cdk-lib/aws-lambda-event-sources';
|
|
15
|
-
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
16
16
|
import { ServicePrincipal, Role, FederatedPrincipal, PolicyStatement, Effect } from 'aws-cdk-lib/aws-iam';
|
|
17
17
|
import { LogGroup, RetentionDays, FilterPattern } from 'aws-cdk-lib/aws-logs';
|
|
18
18
|
import * as sso from 'aws-cdk-lib/aws-sso';
|
|
@@ -106,192 +106,35 @@ function stackTagger(stack, { name } = {}) {
|
|
|
106
106
|
return true;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
class JaypieApiGateway extends Construct {
|
|
110
|
-
constructor(scope, id, props) {
|
|
111
|
-
super(scope, id);
|
|
112
|
-
const { certificate = true, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
|
|
113
|
-
// Determine zone from props or environment
|
|
114
|
-
let zone = propsZone;
|
|
115
|
-
if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
116
|
-
zone = process.env.CDK_ENV_API_HOSTED_ZONE;
|
|
117
|
-
}
|
|
118
|
-
// Determine host from props or environment
|
|
119
|
-
let host = propsHost;
|
|
120
|
-
if (!host) {
|
|
121
|
-
if (process.env.CDK_ENV_API_HOST_NAME) {
|
|
122
|
-
host = process.env.CDK_ENV_API_HOST_NAME;
|
|
123
|
-
}
|
|
124
|
-
else if (process.env.CDK_ENV_API_SUBDOMAIN &&
|
|
125
|
-
process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
126
|
-
host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const apiGatewayName = name || constructEnvName("ApiGateway");
|
|
130
|
-
const certificateName = constructEnvName("Certificate");
|
|
131
|
-
const apiDomainName = constructEnvName("ApiDomainName");
|
|
132
|
-
let hostedZone;
|
|
133
|
-
let certificateToUse;
|
|
134
|
-
if (host && zone) {
|
|
135
|
-
if (typeof zone === "string") {
|
|
136
|
-
hostedZone = route53.HostedZone.fromLookup(this, "HostedZone", {
|
|
137
|
-
domainName: zone,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
hostedZone = zone;
|
|
142
|
-
}
|
|
143
|
-
if (certificate === true) {
|
|
144
|
-
certificateToUse = new acm.Certificate(this, certificateName, {
|
|
145
|
-
domainName: host,
|
|
146
|
-
validation: acm.CertificateValidation.fromDns(hostedZone),
|
|
147
|
-
});
|
|
148
|
-
Tags.of(certificateToUse).add(CDK$2.TAG.ROLE, CDK$2.ROLE.HOSTING);
|
|
149
|
-
}
|
|
150
|
-
else if (typeof certificate === "object") {
|
|
151
|
-
certificateToUse = certificate;
|
|
152
|
-
}
|
|
153
|
-
this._certificate = certificateToUse;
|
|
154
|
-
this._host = host;
|
|
155
|
-
}
|
|
156
|
-
const {
|
|
157
|
-
// * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
|
|
158
|
-
// Ignore the variables we already assigned to other properties
|
|
159
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
160
|
-
certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
|
|
161
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
162
|
-
...lambdaRestApiProps } = props;
|
|
163
|
-
this._api = new apiGateway.LambdaRestApi(this, apiGatewayName, {
|
|
164
|
-
handler,
|
|
165
|
-
...lambdaRestApiProps,
|
|
166
|
-
});
|
|
167
|
-
Tags.of(this._api).add(CDK$2.TAG.ROLE, roleTag);
|
|
168
|
-
if (host && certificateToUse && hostedZone) {
|
|
169
|
-
this._domainName = this._api.addDomainName(apiDomainName, {
|
|
170
|
-
domainName: host,
|
|
171
|
-
certificate: certificateToUse,
|
|
172
|
-
});
|
|
173
|
-
Tags.of(this._domainName).add(CDK$2.TAG.ROLE, roleTag);
|
|
174
|
-
const record = new route53.ARecord(this, "AliasRecord", {
|
|
175
|
-
recordName: host,
|
|
176
|
-
target: route53.RecordTarget.fromAlias(new route53Targets.ApiGatewayDomain(this._domainName)),
|
|
177
|
-
zone: hostedZone,
|
|
178
|
-
});
|
|
179
|
-
Tags.of(record).add(CDK$2.TAG.ROLE, CDK$2.ROLE.NETWORKING);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
get api() {
|
|
183
|
-
return this._api;
|
|
184
|
-
}
|
|
185
|
-
get url() {
|
|
186
|
-
return this._api.url;
|
|
187
|
-
}
|
|
188
|
-
get certificateArn() {
|
|
189
|
-
return this._certificate?.certificateArn;
|
|
190
|
-
}
|
|
191
|
-
get domainName() {
|
|
192
|
-
return this._domainName?.domainName;
|
|
193
|
-
}
|
|
194
|
-
get host() {
|
|
195
|
-
return this._host;
|
|
196
|
-
}
|
|
197
|
-
get restApiId() {
|
|
198
|
-
return this._api.restApiId;
|
|
199
|
-
}
|
|
200
|
-
get restApiName() {
|
|
201
|
-
return this._api.restApiName;
|
|
202
|
-
}
|
|
203
|
-
get restApiRootResourceId() {
|
|
204
|
-
return this._api.restApiRootResourceId;
|
|
205
|
-
}
|
|
206
|
-
get deploymentStage() {
|
|
207
|
-
return this._api.deploymentStage;
|
|
208
|
-
}
|
|
209
|
-
get domainNameAliasDomainName() {
|
|
210
|
-
return this._domainName?.domainNameAliasDomainName;
|
|
211
|
-
}
|
|
212
|
-
get domainNameAliasHostedZoneId() {
|
|
213
|
-
return this._domainName?.domainNameAliasHostedZoneId;
|
|
214
|
-
}
|
|
215
|
-
get root() {
|
|
216
|
-
return this._api.root;
|
|
217
|
-
}
|
|
218
|
-
get env() {
|
|
219
|
-
return {
|
|
220
|
-
account: Stack.of(this).account,
|
|
221
|
-
region: Stack.of(this).region,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
get stack() {
|
|
225
|
-
return this._api.stack;
|
|
226
|
-
}
|
|
227
|
-
arnForExecuteApi(method, path, stage) {
|
|
228
|
-
return this._api.arnForExecuteApi(method, path, stage);
|
|
229
|
-
}
|
|
230
|
-
metric(metricName, props) {
|
|
231
|
-
return this._api.metric(metricName, props);
|
|
232
|
-
}
|
|
233
|
-
metricCacheHitCount(props) {
|
|
234
|
-
return this._api.metricCacheHitCount(props);
|
|
235
|
-
}
|
|
236
|
-
metricCacheMissCount(props) {
|
|
237
|
-
return this._api.metricCacheMissCount(props);
|
|
238
|
-
}
|
|
239
|
-
metricClientError(props) {
|
|
240
|
-
return this._api.metricClientError(props);
|
|
241
|
-
}
|
|
242
|
-
metricCount(props) {
|
|
243
|
-
return this._api.metricCount(props);
|
|
244
|
-
}
|
|
245
|
-
metricIntegrationLatency(props) {
|
|
246
|
-
return this._api.metricIntegrationLatency(props);
|
|
247
|
-
}
|
|
248
|
-
metricLatency(props) {
|
|
249
|
-
return this._api.metricLatency(props);
|
|
250
|
-
}
|
|
251
|
-
metricServerError(props) {
|
|
252
|
-
return this._api.metricServerError(props);
|
|
253
|
-
}
|
|
254
|
-
applyRemovalPolicy(policy) {
|
|
255
|
-
this._api.applyRemovalPolicy(policy);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
class JaypieStack extends Stack {
|
|
260
|
-
constructor(scope, id, props = {}) {
|
|
261
|
-
const { key, ...stackProps } = props;
|
|
262
|
-
// Handle stackName
|
|
263
|
-
if (!stackProps.stackName) {
|
|
264
|
-
stackProps.stackName = constructStackName(key);
|
|
265
|
-
}
|
|
266
|
-
// Handle env
|
|
267
|
-
stackProps.env = {
|
|
268
|
-
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
269
|
-
region: process.env.CDK_DEFAULT_REGION,
|
|
270
|
-
...stackProps.env,
|
|
271
|
-
};
|
|
272
|
-
super(scope, id, stackProps);
|
|
273
|
-
// Apply tags
|
|
274
|
-
stackTagger(this, { name: stackProps.stackName });
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
class JaypieAppStack extends JaypieStack {
|
|
279
|
-
constructor(scope, id, props = {}) {
|
|
280
|
-
const { key = "app", ...stackProps } = props;
|
|
281
|
-
// Handle stackName
|
|
282
|
-
if (!stackProps.stackName) {
|
|
283
|
-
stackProps.stackName = constructStackName(key);
|
|
284
|
-
}
|
|
285
|
-
super(scope, id, { key, ...stackProps });
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
109
|
class JaypieLambda extends Construct {
|
|
290
110
|
constructor(scope, id, props) {
|
|
291
111
|
super(scope, id);
|
|
292
112
|
const { code, datadogApiKeyArn, environment: initialEnvironment = {}, envSecrets = {}, handler = "index.handler", layers = [], logRetention = CDK$2.LAMBDA.LOG_RETENTION, memorySize = CDK$2.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, provisionedConcurrentExecutions, reservedConcurrentExecutions, roleTag = CDK$2.ROLE.PROCESSING, runtime = lambda.Runtime.NODEJS_22_X, secrets = [], timeout = Duration.seconds(CDK$2.DURATION.LAMBDA_WORKER), vendorTag, } = props;
|
|
293
113
|
// Create a mutable copy of the environment variables
|
|
294
114
|
let environment = { ...initialEnvironment };
|
|
115
|
+
// Default environment values
|
|
116
|
+
const defaultEnvValues = {
|
|
117
|
+
AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING: "true",
|
|
118
|
+
};
|
|
119
|
+
// Apply default environment values with user overrides
|
|
120
|
+
Object.entries(defaultEnvValues).forEach(([key, defaultValue]) => {
|
|
121
|
+
if (key in initialEnvironment) {
|
|
122
|
+
const userValue = initialEnvironment[key];
|
|
123
|
+
// If user passes a string, use that value
|
|
124
|
+
if (typeof userValue === "string") {
|
|
125
|
+
environment[key] = userValue;
|
|
126
|
+
}
|
|
127
|
+
// If user passes non-string falsy value, omit the key
|
|
128
|
+
else if (!userValue) {
|
|
129
|
+
delete environment[key];
|
|
130
|
+
}
|
|
131
|
+
// Ignore non-string truthy values (key already not present)
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// No user override, use default value
|
|
135
|
+
environment[key] = defaultValue;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
295
138
|
// Default environment variables from process.env if present
|
|
296
139
|
const defaultEnvVars = [
|
|
297
140
|
"DATADOG_API_KEY_ARN",
|
|
@@ -418,13 +261,13 @@ class JaypieLambda extends Construct {
|
|
|
418
261
|
// Use currentVersion which is auto-published with proper configuration
|
|
419
262
|
const version = this._lambda.currentVersion;
|
|
420
263
|
// Create alias for provisioned concurrency
|
|
421
|
-
this.
|
|
264
|
+
this._provisioned = new lambda.Alias(this, "ProvisionedAlias", {
|
|
422
265
|
aliasName: "provisioned",
|
|
423
266
|
version,
|
|
424
267
|
provisionedConcurrentExecutions,
|
|
425
268
|
});
|
|
426
269
|
// Add explicit dependencies to ensure proper creation order
|
|
427
|
-
this.
|
|
270
|
+
this._provisioned.node.addDependency(version);
|
|
428
271
|
}
|
|
429
272
|
if (roleTag) {
|
|
430
273
|
Tags.of(this._lambda).add(CDK$2.TAG.ROLE, roleTag);
|
|
@@ -437,18 +280,18 @@ class JaypieLambda extends Construct {
|
|
|
437
280
|
get lambda() {
|
|
438
281
|
return this._lambda;
|
|
439
282
|
}
|
|
440
|
-
get
|
|
441
|
-
return this.
|
|
283
|
+
get provisioned() {
|
|
284
|
+
return this._provisioned;
|
|
442
285
|
}
|
|
443
286
|
get code() {
|
|
444
287
|
return this._code;
|
|
445
288
|
}
|
|
446
289
|
// IFunction implementation
|
|
447
290
|
get functionArn() {
|
|
448
|
-
return this.
|
|
291
|
+
return this._lambda.functionArn;
|
|
449
292
|
}
|
|
450
293
|
get functionName() {
|
|
451
|
-
return this.
|
|
294
|
+
return this._lambda.functionName;
|
|
452
295
|
}
|
|
453
296
|
get grantPrincipal() {
|
|
454
297
|
return this._lambda.grantPrincipal;
|
|
@@ -472,8 +315,7 @@ class JaypieLambda extends Construct {
|
|
|
472
315
|
return this._lambda.permissionsNode;
|
|
473
316
|
}
|
|
474
317
|
get resourceArnsForGrantInvoke() {
|
|
475
|
-
return
|
|
476
|
-
this._lambda.resourceArnsForGrantInvoke);
|
|
318
|
+
return this._lambda.resourceArnsForGrantInvoke;
|
|
477
319
|
}
|
|
478
320
|
addEventSource(source) {
|
|
479
321
|
this._lambda.addEventSource(source);
|
|
@@ -497,7 +339,7 @@ class JaypieLambda extends Construct {
|
|
|
497
339
|
this._lambda.configureAsyncInvoke(options);
|
|
498
340
|
}
|
|
499
341
|
grantInvoke(grantee) {
|
|
500
|
-
return
|
|
342
|
+
return this._lambda.grantInvoke(grantee);
|
|
501
343
|
}
|
|
502
344
|
grantInvokeCompositePrincipal(compositePrincipal) {
|
|
503
345
|
return this._lambda.grantInvokeCompositePrincipal(compositePrincipal);
|
|
@@ -541,6 +383,191 @@ class JaypieLambda extends Construct {
|
|
|
541
383
|
}
|
|
542
384
|
}
|
|
543
385
|
|
|
386
|
+
class JaypieApiGateway extends Construct {
|
|
387
|
+
constructor(scope, id, props) {
|
|
388
|
+
super(scope, id);
|
|
389
|
+
const { certificate = true, handler, host: propsHost, name, roleTag = CDK$2.ROLE.API, zone: propsZone, } = props;
|
|
390
|
+
// Determine zone from props or environment
|
|
391
|
+
let zone = propsZone;
|
|
392
|
+
if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
393
|
+
zone = process.env.CDK_ENV_API_HOSTED_ZONE;
|
|
394
|
+
}
|
|
395
|
+
// Determine host from props or environment
|
|
396
|
+
let host = propsHost;
|
|
397
|
+
if (!host) {
|
|
398
|
+
if (process.env.CDK_ENV_API_HOST_NAME) {
|
|
399
|
+
host = process.env.CDK_ENV_API_HOST_NAME;
|
|
400
|
+
}
|
|
401
|
+
else if (process.env.CDK_ENV_API_SUBDOMAIN &&
|
|
402
|
+
process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
403
|
+
host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const apiGatewayName = name || constructEnvName("ApiGateway");
|
|
407
|
+
const certificateName = constructEnvName("Certificate");
|
|
408
|
+
const apiDomainName = constructEnvName("ApiDomainName");
|
|
409
|
+
let hostedZone;
|
|
410
|
+
let certificateToUse;
|
|
411
|
+
if (host && zone) {
|
|
412
|
+
if (typeof zone === "string") {
|
|
413
|
+
hostedZone = route53.HostedZone.fromLookup(this, "HostedZone", {
|
|
414
|
+
domainName: zone,
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
hostedZone = zone;
|
|
419
|
+
}
|
|
420
|
+
if (certificate === true) {
|
|
421
|
+
certificateToUse = new acm.Certificate(this, certificateName, {
|
|
422
|
+
domainName: host,
|
|
423
|
+
validation: acm.CertificateValidation.fromDns(hostedZone),
|
|
424
|
+
});
|
|
425
|
+
Tags.of(certificateToUse).add(CDK$2.TAG.ROLE, CDK$2.ROLE.HOSTING);
|
|
426
|
+
}
|
|
427
|
+
else if (typeof certificate === "object") {
|
|
428
|
+
certificateToUse = certificate;
|
|
429
|
+
}
|
|
430
|
+
this._certificate = certificateToUse;
|
|
431
|
+
this._host = host;
|
|
432
|
+
}
|
|
433
|
+
const {
|
|
434
|
+
// * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
|
|
435
|
+
// Ignore the variables we already assigned to other properties
|
|
436
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
437
|
+
certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
|
|
438
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
439
|
+
...lambdaRestApiProps } = props;
|
|
440
|
+
// Check if handler is a JaypieLambda instance and use provisioned alias if available
|
|
441
|
+
let handlerToUse = handler;
|
|
442
|
+
if (handler instanceof JaypieLambda && handler.provisioned) {
|
|
443
|
+
handlerToUse = handler.provisioned;
|
|
444
|
+
}
|
|
445
|
+
this._api = new apiGateway.LambdaRestApi(this, apiGatewayName, {
|
|
446
|
+
handler: handlerToUse,
|
|
447
|
+
...lambdaRestApiProps,
|
|
448
|
+
});
|
|
449
|
+
Tags.of(this._api).add(CDK$2.TAG.ROLE, roleTag);
|
|
450
|
+
if (host && certificateToUse && hostedZone) {
|
|
451
|
+
this._domainName = this._api.addDomainName(apiDomainName, {
|
|
452
|
+
domainName: host,
|
|
453
|
+
certificate: certificateToUse,
|
|
454
|
+
});
|
|
455
|
+
Tags.of(this._domainName).add(CDK$2.TAG.ROLE, roleTag);
|
|
456
|
+
const record = new route53.ARecord(this, "AliasRecord", {
|
|
457
|
+
recordName: host,
|
|
458
|
+
target: route53.RecordTarget.fromAlias(new route53Targets.ApiGatewayDomain(this._domainName)),
|
|
459
|
+
zone: hostedZone,
|
|
460
|
+
});
|
|
461
|
+
Tags.of(record).add(CDK$2.TAG.ROLE, CDK$2.ROLE.NETWORKING);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
get api() {
|
|
465
|
+
return this._api;
|
|
466
|
+
}
|
|
467
|
+
get url() {
|
|
468
|
+
return this._api.url;
|
|
469
|
+
}
|
|
470
|
+
get certificateArn() {
|
|
471
|
+
return this._certificate?.certificateArn;
|
|
472
|
+
}
|
|
473
|
+
get domainName() {
|
|
474
|
+
return this._domainName?.domainName;
|
|
475
|
+
}
|
|
476
|
+
get host() {
|
|
477
|
+
return this._host;
|
|
478
|
+
}
|
|
479
|
+
get restApiId() {
|
|
480
|
+
return this._api.restApiId;
|
|
481
|
+
}
|
|
482
|
+
get restApiName() {
|
|
483
|
+
return this._api.restApiName;
|
|
484
|
+
}
|
|
485
|
+
get restApiRootResourceId() {
|
|
486
|
+
return this._api.restApiRootResourceId;
|
|
487
|
+
}
|
|
488
|
+
get deploymentStage() {
|
|
489
|
+
return this._api.deploymentStage;
|
|
490
|
+
}
|
|
491
|
+
get domainNameAliasDomainName() {
|
|
492
|
+
return this._domainName?.domainNameAliasDomainName;
|
|
493
|
+
}
|
|
494
|
+
get domainNameAliasHostedZoneId() {
|
|
495
|
+
return this._domainName?.domainNameAliasHostedZoneId;
|
|
496
|
+
}
|
|
497
|
+
get root() {
|
|
498
|
+
return this._api.root;
|
|
499
|
+
}
|
|
500
|
+
get env() {
|
|
501
|
+
return {
|
|
502
|
+
account: Stack.of(this).account,
|
|
503
|
+
region: Stack.of(this).region,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
get stack() {
|
|
507
|
+
return this._api.stack;
|
|
508
|
+
}
|
|
509
|
+
arnForExecuteApi(method, path, stage) {
|
|
510
|
+
return this._api.arnForExecuteApi(method, path, stage);
|
|
511
|
+
}
|
|
512
|
+
metric(metricName, props) {
|
|
513
|
+
return this._api.metric(metricName, props);
|
|
514
|
+
}
|
|
515
|
+
metricCacheHitCount(props) {
|
|
516
|
+
return this._api.metricCacheHitCount(props);
|
|
517
|
+
}
|
|
518
|
+
metricCacheMissCount(props) {
|
|
519
|
+
return this._api.metricCacheMissCount(props);
|
|
520
|
+
}
|
|
521
|
+
metricClientError(props) {
|
|
522
|
+
return this._api.metricClientError(props);
|
|
523
|
+
}
|
|
524
|
+
metricCount(props) {
|
|
525
|
+
return this._api.metricCount(props);
|
|
526
|
+
}
|
|
527
|
+
metricIntegrationLatency(props) {
|
|
528
|
+
return this._api.metricIntegrationLatency(props);
|
|
529
|
+
}
|
|
530
|
+
metricLatency(props) {
|
|
531
|
+
return this._api.metricLatency(props);
|
|
532
|
+
}
|
|
533
|
+
metricServerError(props) {
|
|
534
|
+
return this._api.metricServerError(props);
|
|
535
|
+
}
|
|
536
|
+
applyRemovalPolicy(policy) {
|
|
537
|
+
this._api.applyRemovalPolicy(policy);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
class JaypieStack extends Stack {
|
|
542
|
+
constructor(scope, id, props = {}) {
|
|
543
|
+
const { key, ...stackProps } = props;
|
|
544
|
+
// Handle stackName
|
|
545
|
+
if (!stackProps.stackName) {
|
|
546
|
+
stackProps.stackName = constructStackName(key);
|
|
547
|
+
}
|
|
548
|
+
// Handle env
|
|
549
|
+
stackProps.env = {
|
|
550
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
551
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
552
|
+
...stackProps.env,
|
|
553
|
+
};
|
|
554
|
+
super(scope, id, stackProps);
|
|
555
|
+
// Apply tags
|
|
556
|
+
stackTagger(this, { name: stackProps.stackName });
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
class JaypieAppStack extends JaypieStack {
|
|
561
|
+
constructor(scope, id, props = {}) {
|
|
562
|
+
const { key = "app", ...stackProps } = props;
|
|
563
|
+
// Handle stackName
|
|
564
|
+
if (!stackProps.stackName) {
|
|
565
|
+
stackProps.stackName = constructStackName(key);
|
|
566
|
+
}
|
|
567
|
+
super(scope, id, { key, ...stackProps });
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
544
571
|
class JaypieQueuedLambda extends Construct {
|
|
545
572
|
constructor(scope, id, props) {
|
|
546
573
|
super(scope, id);
|