@jaypie/constructs 1.1.34 → 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 +197 -193
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/JaypieLambda.d.ts +2 -2
- package/dist/esm/index.js +196 -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/cjs/index.cjs
CHANGED
|
@@ -7,12 +7,12 @@ var apiGateway = require('aws-cdk-lib/aws-apigateway');
|
|
|
7
7
|
var route53 = require('aws-cdk-lib/aws-route53');
|
|
8
8
|
var route53Targets = require('aws-cdk-lib/aws-route53-targets');
|
|
9
9
|
var cdk = require('@jaypie/cdk');
|
|
10
|
+
var lambda = require('aws-cdk-lib/aws-lambda');
|
|
11
|
+
var secretsmanager = require('aws-cdk-lib/aws-secretsmanager');
|
|
10
12
|
var s3 = require('aws-cdk-lib/aws-s3');
|
|
11
13
|
var s3n = require('aws-cdk-lib/aws-s3-notifications');
|
|
12
|
-
var lambda = require('aws-cdk-lib/aws-lambda');
|
|
13
14
|
var sqs = require('aws-cdk-lib/aws-sqs');
|
|
14
15
|
var lambdaEventSources = require('aws-cdk-lib/aws-lambda-event-sources');
|
|
15
|
-
var secretsmanager = require('aws-cdk-lib/aws-secretsmanager');
|
|
16
16
|
var awsIam = require('aws-cdk-lib/aws-iam');
|
|
17
17
|
var awsLogs = require('aws-cdk-lib/aws-logs');
|
|
18
18
|
var sso = require('aws-cdk-lib/aws-sso');
|
|
@@ -41,12 +41,12 @@ var acm__namespace = /*#__PURE__*/_interopNamespaceDefault(acm);
|
|
|
41
41
|
var apiGateway__namespace = /*#__PURE__*/_interopNamespaceDefault(apiGateway);
|
|
42
42
|
var route53__namespace = /*#__PURE__*/_interopNamespaceDefault(route53);
|
|
43
43
|
var route53Targets__namespace = /*#__PURE__*/_interopNamespaceDefault(route53Targets);
|
|
44
|
+
var lambda__namespace = /*#__PURE__*/_interopNamespaceDefault(lambda);
|
|
45
|
+
var secretsmanager__namespace = /*#__PURE__*/_interopNamespaceDefault(secretsmanager);
|
|
44
46
|
var s3__namespace = /*#__PURE__*/_interopNamespaceDefault(s3);
|
|
45
47
|
var s3n__namespace = /*#__PURE__*/_interopNamespaceDefault(s3n);
|
|
46
|
-
var lambda__namespace = /*#__PURE__*/_interopNamespaceDefault(lambda);
|
|
47
48
|
var sqs__namespace = /*#__PURE__*/_interopNamespaceDefault(sqs);
|
|
48
49
|
var lambdaEventSources__namespace = /*#__PURE__*/_interopNamespaceDefault(lambdaEventSources);
|
|
49
|
-
var secretsmanager__namespace = /*#__PURE__*/_interopNamespaceDefault(secretsmanager);
|
|
50
50
|
var sso__namespace = /*#__PURE__*/_interopNamespaceDefault(sso);
|
|
51
51
|
var cloudfront__namespace = /*#__PURE__*/_interopNamespaceDefault(cloudfront);
|
|
52
52
|
var origins__namespace = /*#__PURE__*/_interopNamespaceDefault(origins);
|
|
@@ -138,186 +138,6 @@ function stackTagger(stack, { name } = {}) {
|
|
|
138
138
|
return true;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
class JaypieApiGateway extends constructs.Construct {
|
|
142
|
-
constructor(scope, id, props) {
|
|
143
|
-
super(scope, id);
|
|
144
|
-
const { certificate = true, handler, host: propsHost, name, roleTag = cdk.CDK.ROLE.API, zone: propsZone, } = props;
|
|
145
|
-
// Determine zone from props or environment
|
|
146
|
-
let zone = propsZone;
|
|
147
|
-
if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
148
|
-
zone = process.env.CDK_ENV_API_HOSTED_ZONE;
|
|
149
|
-
}
|
|
150
|
-
// Determine host from props or environment
|
|
151
|
-
let host = propsHost;
|
|
152
|
-
if (!host) {
|
|
153
|
-
if (process.env.CDK_ENV_API_HOST_NAME) {
|
|
154
|
-
host = process.env.CDK_ENV_API_HOST_NAME;
|
|
155
|
-
}
|
|
156
|
-
else if (process.env.CDK_ENV_API_SUBDOMAIN &&
|
|
157
|
-
process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
158
|
-
host = cdk.mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const apiGatewayName = name || constructEnvName("ApiGateway");
|
|
162
|
-
const certificateName = constructEnvName("Certificate");
|
|
163
|
-
const apiDomainName = constructEnvName("ApiDomainName");
|
|
164
|
-
let hostedZone;
|
|
165
|
-
let certificateToUse;
|
|
166
|
-
if (host && zone) {
|
|
167
|
-
if (typeof zone === "string") {
|
|
168
|
-
hostedZone = route53__namespace.HostedZone.fromLookup(this, "HostedZone", {
|
|
169
|
-
domainName: zone,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
hostedZone = zone;
|
|
174
|
-
}
|
|
175
|
-
if (certificate === true) {
|
|
176
|
-
certificateToUse = new acm__namespace.Certificate(this, certificateName, {
|
|
177
|
-
domainName: host,
|
|
178
|
-
validation: acm__namespace.CertificateValidation.fromDns(hostedZone),
|
|
179
|
-
});
|
|
180
|
-
cdk$1.Tags.of(certificateToUse).add(cdk.CDK.TAG.ROLE, cdk.CDK.ROLE.HOSTING);
|
|
181
|
-
}
|
|
182
|
-
else if (typeof certificate === "object") {
|
|
183
|
-
certificateToUse = certificate;
|
|
184
|
-
}
|
|
185
|
-
this._certificate = certificateToUse;
|
|
186
|
-
this._host = host;
|
|
187
|
-
}
|
|
188
|
-
const {
|
|
189
|
-
// * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
|
|
190
|
-
// Ignore the variables we already assigned to other properties
|
|
191
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
192
|
-
certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
|
|
193
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
194
|
-
...lambdaRestApiProps } = props;
|
|
195
|
-
this._api = new apiGateway__namespace.LambdaRestApi(this, apiGatewayName, {
|
|
196
|
-
handler,
|
|
197
|
-
...lambdaRestApiProps,
|
|
198
|
-
});
|
|
199
|
-
cdk$1.Tags.of(this._api).add(cdk.CDK.TAG.ROLE, roleTag);
|
|
200
|
-
if (host && certificateToUse && hostedZone) {
|
|
201
|
-
this._domainName = this._api.addDomainName(apiDomainName, {
|
|
202
|
-
domainName: host,
|
|
203
|
-
certificate: certificateToUse,
|
|
204
|
-
});
|
|
205
|
-
cdk$1.Tags.of(this._domainName).add(cdk.CDK.TAG.ROLE, roleTag);
|
|
206
|
-
const record = new route53__namespace.ARecord(this, "AliasRecord", {
|
|
207
|
-
recordName: host,
|
|
208
|
-
target: route53__namespace.RecordTarget.fromAlias(new route53Targets__namespace.ApiGatewayDomain(this._domainName)),
|
|
209
|
-
zone: hostedZone,
|
|
210
|
-
});
|
|
211
|
-
cdk$1.Tags.of(record).add(cdk.CDK.TAG.ROLE, cdk.CDK.ROLE.NETWORKING);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
get api() {
|
|
215
|
-
return this._api;
|
|
216
|
-
}
|
|
217
|
-
get url() {
|
|
218
|
-
return this._api.url;
|
|
219
|
-
}
|
|
220
|
-
get certificateArn() {
|
|
221
|
-
return this._certificate?.certificateArn;
|
|
222
|
-
}
|
|
223
|
-
get domainName() {
|
|
224
|
-
return this._domainName?.domainName;
|
|
225
|
-
}
|
|
226
|
-
get host() {
|
|
227
|
-
return this._host;
|
|
228
|
-
}
|
|
229
|
-
get restApiId() {
|
|
230
|
-
return this._api.restApiId;
|
|
231
|
-
}
|
|
232
|
-
get restApiName() {
|
|
233
|
-
return this._api.restApiName;
|
|
234
|
-
}
|
|
235
|
-
get restApiRootResourceId() {
|
|
236
|
-
return this._api.restApiRootResourceId;
|
|
237
|
-
}
|
|
238
|
-
get deploymentStage() {
|
|
239
|
-
return this._api.deploymentStage;
|
|
240
|
-
}
|
|
241
|
-
get domainNameAliasDomainName() {
|
|
242
|
-
return this._domainName?.domainNameAliasDomainName;
|
|
243
|
-
}
|
|
244
|
-
get domainNameAliasHostedZoneId() {
|
|
245
|
-
return this._domainName?.domainNameAliasHostedZoneId;
|
|
246
|
-
}
|
|
247
|
-
get root() {
|
|
248
|
-
return this._api.root;
|
|
249
|
-
}
|
|
250
|
-
get env() {
|
|
251
|
-
return {
|
|
252
|
-
account: cdk$1.Stack.of(this).account,
|
|
253
|
-
region: cdk$1.Stack.of(this).region,
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
get stack() {
|
|
257
|
-
return this._api.stack;
|
|
258
|
-
}
|
|
259
|
-
arnForExecuteApi(method, path, stage) {
|
|
260
|
-
return this._api.arnForExecuteApi(method, path, stage);
|
|
261
|
-
}
|
|
262
|
-
metric(metricName, props) {
|
|
263
|
-
return this._api.metric(metricName, props);
|
|
264
|
-
}
|
|
265
|
-
metricCacheHitCount(props) {
|
|
266
|
-
return this._api.metricCacheHitCount(props);
|
|
267
|
-
}
|
|
268
|
-
metricCacheMissCount(props) {
|
|
269
|
-
return this._api.metricCacheMissCount(props);
|
|
270
|
-
}
|
|
271
|
-
metricClientError(props) {
|
|
272
|
-
return this._api.metricClientError(props);
|
|
273
|
-
}
|
|
274
|
-
metricCount(props) {
|
|
275
|
-
return this._api.metricCount(props);
|
|
276
|
-
}
|
|
277
|
-
metricIntegrationLatency(props) {
|
|
278
|
-
return this._api.metricIntegrationLatency(props);
|
|
279
|
-
}
|
|
280
|
-
metricLatency(props) {
|
|
281
|
-
return this._api.metricLatency(props);
|
|
282
|
-
}
|
|
283
|
-
metricServerError(props) {
|
|
284
|
-
return this._api.metricServerError(props);
|
|
285
|
-
}
|
|
286
|
-
applyRemovalPolicy(policy) {
|
|
287
|
-
this._api.applyRemovalPolicy(policy);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
class JaypieStack extends cdk$1.Stack {
|
|
292
|
-
constructor(scope, id, props = {}) {
|
|
293
|
-
const { key, ...stackProps } = props;
|
|
294
|
-
// Handle stackName
|
|
295
|
-
if (!stackProps.stackName) {
|
|
296
|
-
stackProps.stackName = constructStackName(key);
|
|
297
|
-
}
|
|
298
|
-
// Handle env
|
|
299
|
-
stackProps.env = {
|
|
300
|
-
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
301
|
-
region: process.env.CDK_DEFAULT_REGION,
|
|
302
|
-
...stackProps.env,
|
|
303
|
-
};
|
|
304
|
-
super(scope, id, stackProps);
|
|
305
|
-
// Apply tags
|
|
306
|
-
stackTagger(this, { name: stackProps.stackName });
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
class JaypieAppStack extends JaypieStack {
|
|
311
|
-
constructor(scope, id, props = {}) {
|
|
312
|
-
const { key = "app", ...stackProps } = props;
|
|
313
|
-
// Handle stackName
|
|
314
|
-
if (!stackProps.stackName) {
|
|
315
|
-
stackProps.stackName = constructStackName(key);
|
|
316
|
-
}
|
|
317
|
-
super(scope, id, { key, ...stackProps });
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
141
|
class JaypieLambda extends constructs.Construct {
|
|
322
142
|
constructor(scope, id, props) {
|
|
323
143
|
super(scope, id);
|
|
@@ -473,13 +293,13 @@ class JaypieLambda extends constructs.Construct {
|
|
|
473
293
|
// Use currentVersion which is auto-published with proper configuration
|
|
474
294
|
const version = this._lambda.currentVersion;
|
|
475
295
|
// Create alias for provisioned concurrency
|
|
476
|
-
this.
|
|
296
|
+
this._provisioned = new lambda__namespace.Alias(this, "ProvisionedAlias", {
|
|
477
297
|
aliasName: "provisioned",
|
|
478
298
|
version,
|
|
479
299
|
provisionedConcurrentExecutions,
|
|
480
300
|
});
|
|
481
301
|
// Add explicit dependencies to ensure proper creation order
|
|
482
|
-
this.
|
|
302
|
+
this._provisioned.node.addDependency(version);
|
|
483
303
|
}
|
|
484
304
|
if (roleTag) {
|
|
485
305
|
cdk$1.Tags.of(this._lambda).add(cdk.CDK.TAG.ROLE, roleTag);
|
|
@@ -492,18 +312,18 @@ class JaypieLambda extends constructs.Construct {
|
|
|
492
312
|
get lambda() {
|
|
493
313
|
return this._lambda;
|
|
494
314
|
}
|
|
495
|
-
get
|
|
496
|
-
return this.
|
|
315
|
+
get provisioned() {
|
|
316
|
+
return this._provisioned;
|
|
497
317
|
}
|
|
498
318
|
get code() {
|
|
499
319
|
return this._code;
|
|
500
320
|
}
|
|
501
321
|
// IFunction implementation
|
|
502
322
|
get functionArn() {
|
|
503
|
-
return this.
|
|
323
|
+
return this._lambda.functionArn;
|
|
504
324
|
}
|
|
505
325
|
get functionName() {
|
|
506
|
-
return this.
|
|
326
|
+
return this._lambda.functionName;
|
|
507
327
|
}
|
|
508
328
|
get grantPrincipal() {
|
|
509
329
|
return this._lambda.grantPrincipal;
|
|
@@ -527,8 +347,7 @@ class JaypieLambda extends constructs.Construct {
|
|
|
527
347
|
return this._lambda.permissionsNode;
|
|
528
348
|
}
|
|
529
349
|
get resourceArnsForGrantInvoke() {
|
|
530
|
-
return
|
|
531
|
-
this._lambda.resourceArnsForGrantInvoke);
|
|
350
|
+
return this._lambda.resourceArnsForGrantInvoke;
|
|
532
351
|
}
|
|
533
352
|
addEventSource(source) {
|
|
534
353
|
this._lambda.addEventSource(source);
|
|
@@ -552,7 +371,7 @@ class JaypieLambda extends constructs.Construct {
|
|
|
552
371
|
this._lambda.configureAsyncInvoke(options);
|
|
553
372
|
}
|
|
554
373
|
grantInvoke(grantee) {
|
|
555
|
-
return
|
|
374
|
+
return this._lambda.grantInvoke(grantee);
|
|
556
375
|
}
|
|
557
376
|
grantInvokeCompositePrincipal(compositePrincipal) {
|
|
558
377
|
return this._lambda.grantInvokeCompositePrincipal(compositePrincipal);
|
|
@@ -596,6 +415,191 @@ class JaypieLambda extends constructs.Construct {
|
|
|
596
415
|
}
|
|
597
416
|
}
|
|
598
417
|
|
|
418
|
+
class JaypieApiGateway extends constructs.Construct {
|
|
419
|
+
constructor(scope, id, props) {
|
|
420
|
+
super(scope, id);
|
|
421
|
+
const { certificate = true, handler, host: propsHost, name, roleTag = cdk.CDK.ROLE.API, zone: propsZone, } = props;
|
|
422
|
+
// Determine zone from props or environment
|
|
423
|
+
let zone = propsZone;
|
|
424
|
+
if (!zone && process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
425
|
+
zone = process.env.CDK_ENV_API_HOSTED_ZONE;
|
|
426
|
+
}
|
|
427
|
+
// Determine host from props or environment
|
|
428
|
+
let host = propsHost;
|
|
429
|
+
if (!host) {
|
|
430
|
+
if (process.env.CDK_ENV_API_HOST_NAME) {
|
|
431
|
+
host = process.env.CDK_ENV_API_HOST_NAME;
|
|
432
|
+
}
|
|
433
|
+
else if (process.env.CDK_ENV_API_SUBDOMAIN &&
|
|
434
|
+
process.env.CDK_ENV_API_HOSTED_ZONE) {
|
|
435
|
+
host = cdk.mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const apiGatewayName = name || constructEnvName("ApiGateway");
|
|
439
|
+
const certificateName = constructEnvName("Certificate");
|
|
440
|
+
const apiDomainName = constructEnvName("ApiDomainName");
|
|
441
|
+
let hostedZone;
|
|
442
|
+
let certificateToUse;
|
|
443
|
+
if (host && zone) {
|
|
444
|
+
if (typeof zone === "string") {
|
|
445
|
+
hostedZone = route53__namespace.HostedZone.fromLookup(this, "HostedZone", {
|
|
446
|
+
domainName: zone,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
hostedZone = zone;
|
|
451
|
+
}
|
|
452
|
+
if (certificate === true) {
|
|
453
|
+
certificateToUse = new acm__namespace.Certificate(this, certificateName, {
|
|
454
|
+
domainName: host,
|
|
455
|
+
validation: acm__namespace.CertificateValidation.fromDns(hostedZone),
|
|
456
|
+
});
|
|
457
|
+
cdk$1.Tags.of(certificateToUse).add(cdk.CDK.TAG.ROLE, cdk.CDK.ROLE.HOSTING);
|
|
458
|
+
}
|
|
459
|
+
else if (typeof certificate === "object") {
|
|
460
|
+
certificateToUse = certificate;
|
|
461
|
+
}
|
|
462
|
+
this._certificate = certificateToUse;
|
|
463
|
+
this._host = host;
|
|
464
|
+
}
|
|
465
|
+
const {
|
|
466
|
+
// * `...lambdaRestApiProps` cannot be moved to the first const destructuring because it needs to exclude the custom properties first.
|
|
467
|
+
// Ignore the variables we already assigned to other properties
|
|
468
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
469
|
+
certificate: _certificate, host: _host, name: _name, roleTag: _roleTag, zone: _zone, handler: _handler,
|
|
470
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
471
|
+
...lambdaRestApiProps } = props;
|
|
472
|
+
// Check if handler is a JaypieLambda instance and use provisioned alias if available
|
|
473
|
+
let handlerToUse = handler;
|
|
474
|
+
if (handler instanceof JaypieLambda && handler.provisioned) {
|
|
475
|
+
handlerToUse = handler.provisioned;
|
|
476
|
+
}
|
|
477
|
+
this._api = new apiGateway__namespace.LambdaRestApi(this, apiGatewayName, {
|
|
478
|
+
handler: handlerToUse,
|
|
479
|
+
...lambdaRestApiProps,
|
|
480
|
+
});
|
|
481
|
+
cdk$1.Tags.of(this._api).add(cdk.CDK.TAG.ROLE, roleTag);
|
|
482
|
+
if (host && certificateToUse && hostedZone) {
|
|
483
|
+
this._domainName = this._api.addDomainName(apiDomainName, {
|
|
484
|
+
domainName: host,
|
|
485
|
+
certificate: certificateToUse,
|
|
486
|
+
});
|
|
487
|
+
cdk$1.Tags.of(this._domainName).add(cdk.CDK.TAG.ROLE, roleTag);
|
|
488
|
+
const record = new route53__namespace.ARecord(this, "AliasRecord", {
|
|
489
|
+
recordName: host,
|
|
490
|
+
target: route53__namespace.RecordTarget.fromAlias(new route53Targets__namespace.ApiGatewayDomain(this._domainName)),
|
|
491
|
+
zone: hostedZone,
|
|
492
|
+
});
|
|
493
|
+
cdk$1.Tags.of(record).add(cdk.CDK.TAG.ROLE, cdk.CDK.ROLE.NETWORKING);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
get api() {
|
|
497
|
+
return this._api;
|
|
498
|
+
}
|
|
499
|
+
get url() {
|
|
500
|
+
return this._api.url;
|
|
501
|
+
}
|
|
502
|
+
get certificateArn() {
|
|
503
|
+
return this._certificate?.certificateArn;
|
|
504
|
+
}
|
|
505
|
+
get domainName() {
|
|
506
|
+
return this._domainName?.domainName;
|
|
507
|
+
}
|
|
508
|
+
get host() {
|
|
509
|
+
return this._host;
|
|
510
|
+
}
|
|
511
|
+
get restApiId() {
|
|
512
|
+
return this._api.restApiId;
|
|
513
|
+
}
|
|
514
|
+
get restApiName() {
|
|
515
|
+
return this._api.restApiName;
|
|
516
|
+
}
|
|
517
|
+
get restApiRootResourceId() {
|
|
518
|
+
return this._api.restApiRootResourceId;
|
|
519
|
+
}
|
|
520
|
+
get deploymentStage() {
|
|
521
|
+
return this._api.deploymentStage;
|
|
522
|
+
}
|
|
523
|
+
get domainNameAliasDomainName() {
|
|
524
|
+
return this._domainName?.domainNameAliasDomainName;
|
|
525
|
+
}
|
|
526
|
+
get domainNameAliasHostedZoneId() {
|
|
527
|
+
return this._domainName?.domainNameAliasHostedZoneId;
|
|
528
|
+
}
|
|
529
|
+
get root() {
|
|
530
|
+
return this._api.root;
|
|
531
|
+
}
|
|
532
|
+
get env() {
|
|
533
|
+
return {
|
|
534
|
+
account: cdk$1.Stack.of(this).account,
|
|
535
|
+
region: cdk$1.Stack.of(this).region,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
get stack() {
|
|
539
|
+
return this._api.stack;
|
|
540
|
+
}
|
|
541
|
+
arnForExecuteApi(method, path, stage) {
|
|
542
|
+
return this._api.arnForExecuteApi(method, path, stage);
|
|
543
|
+
}
|
|
544
|
+
metric(metricName, props) {
|
|
545
|
+
return this._api.metric(metricName, props);
|
|
546
|
+
}
|
|
547
|
+
metricCacheHitCount(props) {
|
|
548
|
+
return this._api.metricCacheHitCount(props);
|
|
549
|
+
}
|
|
550
|
+
metricCacheMissCount(props) {
|
|
551
|
+
return this._api.metricCacheMissCount(props);
|
|
552
|
+
}
|
|
553
|
+
metricClientError(props) {
|
|
554
|
+
return this._api.metricClientError(props);
|
|
555
|
+
}
|
|
556
|
+
metricCount(props) {
|
|
557
|
+
return this._api.metricCount(props);
|
|
558
|
+
}
|
|
559
|
+
metricIntegrationLatency(props) {
|
|
560
|
+
return this._api.metricIntegrationLatency(props);
|
|
561
|
+
}
|
|
562
|
+
metricLatency(props) {
|
|
563
|
+
return this._api.metricLatency(props);
|
|
564
|
+
}
|
|
565
|
+
metricServerError(props) {
|
|
566
|
+
return this._api.metricServerError(props);
|
|
567
|
+
}
|
|
568
|
+
applyRemovalPolicy(policy) {
|
|
569
|
+
this._api.applyRemovalPolicy(policy);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
class JaypieStack extends cdk$1.Stack {
|
|
574
|
+
constructor(scope, id, props = {}) {
|
|
575
|
+
const { key, ...stackProps } = props;
|
|
576
|
+
// Handle stackName
|
|
577
|
+
if (!stackProps.stackName) {
|
|
578
|
+
stackProps.stackName = constructStackName(key);
|
|
579
|
+
}
|
|
580
|
+
// Handle env
|
|
581
|
+
stackProps.env = {
|
|
582
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
583
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
584
|
+
...stackProps.env,
|
|
585
|
+
};
|
|
586
|
+
super(scope, id, stackProps);
|
|
587
|
+
// Apply tags
|
|
588
|
+
stackTagger(this, { name: stackProps.stackName });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
class JaypieAppStack extends JaypieStack {
|
|
593
|
+
constructor(scope, id, props = {}) {
|
|
594
|
+
const { key = "app", ...stackProps } = props;
|
|
595
|
+
// Handle stackName
|
|
596
|
+
if (!stackProps.stackName) {
|
|
597
|
+
stackProps.stackName = constructStackName(key);
|
|
598
|
+
}
|
|
599
|
+
super(scope, id, { key, ...stackProps });
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
599
603
|
class JaypieQueuedLambda extends constructs.Construct {
|
|
600
604
|
constructor(scope, id, props) {
|
|
601
605
|
super(scope, id);
|