@jaypie/constructs 1.1.35 → 1.1.36-beta.2
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 +1 -0
- package/dist/cjs/index.cjs +215 -218
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/JaypieLambda.d.ts +1 -0
- package/dist/esm/index.js +214 -217
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -37,6 +37,7 @@ export declare class JaypieLambda extends Construct implements lambda.IFunction
|
|
|
37
37
|
private readonly _lambda;
|
|
38
38
|
private readonly _provisioned?;
|
|
39
39
|
private readonly _code;
|
|
40
|
+
private readonly _reference;
|
|
40
41
|
constructor(scope: Construct, id: string, props: JaypieLambdaProps);
|
|
41
42
|
get lambda(): lambda.Function;
|
|
42
43
|
get provisioned(): lambda.Alias | undefined;
|
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, Stack, Duration, 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';
|
|
12
10
|
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
13
11
|
import * as s3n from 'aws-cdk-lib/aws-s3-notifications';
|
|
12
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
14
13
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
15
14
|
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,6 +106,186 @@ 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
|
+
|
|
109
289
|
class JaypieLambda extends Construct {
|
|
110
290
|
constructor(scope, id, props) {
|
|
111
291
|
super(scope, id);
|
|
@@ -248,7 +428,6 @@ class JaypieLambda extends Construct {
|
|
|
248
428
|
});
|
|
249
429
|
// Grant read permissions for JaypieEnvSecrets
|
|
250
430
|
secrets.forEach((secret) => {
|
|
251
|
-
secret.grantRead(this);
|
|
252
431
|
secret.grantRead(this._lambda);
|
|
253
432
|
});
|
|
254
433
|
// Grant Datadog API key read permission if applicable
|
|
@@ -275,6 +454,9 @@ class JaypieLambda extends Construct {
|
|
|
275
454
|
if (vendorTag) {
|
|
276
455
|
Tags.of(this._lambda).add(CDK$2.TAG.VENDOR, vendorTag);
|
|
277
456
|
}
|
|
457
|
+
// Assign _reference based on provisioned state
|
|
458
|
+
this._reference =
|
|
459
|
+
this._provisioned !== undefined ? this._provisioned : this._lambda;
|
|
278
460
|
}
|
|
279
461
|
// Public accessors
|
|
280
462
|
get lambda() {
|
|
@@ -288,214 +470,86 @@ class JaypieLambda extends Construct {
|
|
|
288
470
|
}
|
|
289
471
|
// IFunction implementation
|
|
290
472
|
get functionArn() {
|
|
291
|
-
return this.
|
|
473
|
+
return this._reference.functionArn;
|
|
292
474
|
}
|
|
293
475
|
get functionName() {
|
|
294
|
-
return this.
|
|
476
|
+
return this._reference.functionName;
|
|
295
477
|
}
|
|
296
478
|
get grantPrincipal() {
|
|
297
|
-
return this.
|
|
479
|
+
return this._reference.grantPrincipal;
|
|
298
480
|
}
|
|
299
481
|
get role() {
|
|
300
|
-
return this.
|
|
482
|
+
return this._reference.role;
|
|
301
483
|
}
|
|
302
484
|
get architecture() {
|
|
303
|
-
return this.
|
|
485
|
+
return this._reference.architecture;
|
|
304
486
|
}
|
|
305
487
|
get connections() {
|
|
306
|
-
return this.
|
|
488
|
+
return this._reference.connections;
|
|
307
489
|
}
|
|
308
490
|
get isBoundToVpc() {
|
|
309
|
-
return this.
|
|
491
|
+
return this._reference.isBoundToVpc;
|
|
310
492
|
}
|
|
311
493
|
get latestVersion() {
|
|
312
|
-
return this.
|
|
494
|
+
return this._reference.latestVersion;
|
|
313
495
|
}
|
|
314
496
|
get permissionsNode() {
|
|
315
|
-
return this.
|
|
497
|
+
return this._reference.permissionsNode;
|
|
316
498
|
}
|
|
317
499
|
get resourceArnsForGrantInvoke() {
|
|
318
|
-
return this.
|
|
500
|
+
return this._reference.resourceArnsForGrantInvoke;
|
|
319
501
|
}
|
|
320
502
|
addEventSource(source) {
|
|
321
|
-
this.
|
|
503
|
+
this._reference.addEventSource(source);
|
|
322
504
|
}
|
|
323
505
|
addEventSourceMapping(id, options) {
|
|
324
|
-
return this.
|
|
506
|
+
return this._reference.addEventSourceMapping(id, options);
|
|
325
507
|
}
|
|
326
508
|
addFunctionUrl(options) {
|
|
327
|
-
return this.
|
|
509
|
+
return this._reference.addFunctionUrl(options);
|
|
328
510
|
}
|
|
329
511
|
addPermission(id, permission) {
|
|
330
|
-
this.
|
|
512
|
+
this._reference.addPermission(id, permission);
|
|
331
513
|
}
|
|
332
514
|
addToRolePolicy(statement) {
|
|
333
|
-
this.
|
|
515
|
+
this._reference.addToRolePolicy(statement);
|
|
334
516
|
}
|
|
335
517
|
addEnvironment(key, value, options) {
|
|
336
518
|
return this._lambda.addEnvironment(key, value, options);
|
|
337
519
|
}
|
|
338
520
|
configureAsyncInvoke(options) {
|
|
339
|
-
this.
|
|
521
|
+
this._reference.configureAsyncInvoke(options);
|
|
340
522
|
}
|
|
341
523
|
grantInvoke(grantee) {
|
|
342
|
-
return this.
|
|
524
|
+
return this._reference.grantInvoke(grantee);
|
|
343
525
|
}
|
|
344
526
|
grantInvokeCompositePrincipal(compositePrincipal) {
|
|
345
|
-
return this.
|
|
527
|
+
return this._reference.grantInvokeCompositePrincipal(compositePrincipal);
|
|
346
528
|
}
|
|
347
529
|
grantInvokeUrl(grantee) {
|
|
348
|
-
return this.
|
|
530
|
+
return this._reference.grantInvokeUrl(grantee);
|
|
349
531
|
}
|
|
350
532
|
metric(metricName, props) {
|
|
351
|
-
return this.
|
|
533
|
+
return this._reference.metric(metricName, props);
|
|
352
534
|
}
|
|
353
535
|
metricDuration(props) {
|
|
354
|
-
return this.
|
|
536
|
+
return this._reference.metricDuration(props);
|
|
355
537
|
}
|
|
356
538
|
metricErrors(props) {
|
|
357
|
-
return this.
|
|
539
|
+
return this._reference.metricErrors(props);
|
|
358
540
|
}
|
|
359
541
|
metricInvocations(props) {
|
|
360
|
-
return this.
|
|
542
|
+
return this._reference.metricInvocations(props);
|
|
361
543
|
}
|
|
362
544
|
metricThrottles(props) {
|
|
363
|
-
return this.
|
|
545
|
+
return this._reference.metricThrottles(props);
|
|
364
546
|
}
|
|
365
547
|
// Additional IFunction implementation
|
|
366
548
|
grantInvokeLatestVersion(grantee) {
|
|
367
|
-
return this.
|
|
549
|
+
return this._reference.grantInvokeLatestVersion(grantee);
|
|
368
550
|
}
|
|
369
551
|
grantInvokeVersion(grantee, version) {
|
|
370
|
-
return this.
|
|
371
|
-
}
|
|
372
|
-
get env() {
|
|
373
|
-
return {
|
|
374
|
-
account: Stack.of(this).account,
|
|
375
|
-
region: Stack.of(this).region,
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
get stack() {
|
|
379
|
-
return this._lambda.stack;
|
|
380
|
-
}
|
|
381
|
-
applyRemovalPolicy(policy) {
|
|
382
|
-
this._lambda.applyRemovalPolicy(policy);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
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;
|
|
552
|
+
return this._reference.grantInvokeVersion(grantee, version);
|
|
499
553
|
}
|
|
500
554
|
get env() {
|
|
501
555
|
return {
|
|
@@ -504,67 +558,10 @@ class JaypieApiGateway extends Construct {
|
|
|
504
558
|
};
|
|
505
559
|
}
|
|
506
560
|
get stack() {
|
|
507
|
-
return this.
|
|
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);
|
|
561
|
+
return this._reference.stack;
|
|
535
562
|
}
|
|
536
563
|
applyRemovalPolicy(policy) {
|
|
537
|
-
this.
|
|
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 });
|
|
564
|
+
this._reference.applyRemovalPolicy(policy);
|
|
568
565
|
}
|
|
569
566
|
}
|
|
570
567
|
|