@jaypie/constructs 1.2.68 → 1.2.69
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.
|
@@ -0,0 +1,2513 @@
|
|
|
1
|
+
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
2
|
+
import { IBucket, BucketProps } from 'aws-cdk-lib/aws-s3';
|
|
3
|
+
import * as constructs from 'constructs';
|
|
4
|
+
import { Construct } from 'constructs';
|
|
5
|
+
import * as aws_cdk_lib_aws_cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
|
|
6
|
+
import * as cdk from 'aws-cdk-lib';
|
|
7
|
+
import { Stack, Duration, RemovalPolicy, SecretValue, StackProps, CfnStack, CfnOutput } from 'aws-cdk-lib';
|
|
8
|
+
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
|
|
9
|
+
import * as apiGateway from 'aws-cdk-lib/aws-apigateway';
|
|
10
|
+
import * as route53 from 'aws-cdk-lib/aws-route53';
|
|
11
|
+
import { ARecord, CnameRecord, MxRecord, NsRecord, TxtRecord, IHostedZone } from 'aws-cdk-lib/aws-route53';
|
|
12
|
+
import * as aws_cdk_lib_aws_events from 'aws-cdk-lib/aws-events';
|
|
13
|
+
import { Rule, RuleProps } from 'aws-cdk-lib/aws-events';
|
|
14
|
+
import * as aws_cdk_lib_aws_kms from 'aws-cdk-lib/aws-kms';
|
|
15
|
+
import { IKey } from 'aws-cdk-lib/aws-kms';
|
|
16
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
17
|
+
import { Policy, IGrantable, Grant, PolicyStatement, AddToResourcePolicyResult, Role } from 'aws-cdk-lib/aws-iam';
|
|
18
|
+
import * as ec2 from 'aws-cdk-lib/aws-ec2';
|
|
19
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
20
|
+
import { IFunction } from 'aws-cdk-lib/aws-lambda';
|
|
21
|
+
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
22
|
+
import * as aws_cdk_lib_aws_codeguruprofiler from 'aws-cdk-lib/aws-codeguruprofiler';
|
|
23
|
+
import * as aws_cdk_lib_aws_sns from 'aws-cdk-lib/aws-sns';
|
|
24
|
+
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
25
|
+
import * as logs from 'aws-cdk-lib/aws-logs';
|
|
26
|
+
import { CfnResourcePolicy, ILogGroup } from 'aws-cdk-lib/aws-logs';
|
|
27
|
+
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
28
|
+
import { ISecret, RotationScheduleOptions, RotationSchedule, ISecretAttachmentTarget } from 'aws-cdk-lib/aws-secretsmanager';
|
|
29
|
+
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
30
|
+
import { LambdaDestination } from 'aws-cdk-lib/aws-s3-notifications';
|
|
31
|
+
import * as wafv2 from 'aws-cdk-lib/aws-wafv2';
|
|
32
|
+
import * as logDestinations from 'aws-cdk-lib/aws-logs-destinations';
|
|
33
|
+
import { LambdaDestination as LambdaDestination$1 } from 'aws-cdk-lib/aws-logs-destinations';
|
|
34
|
+
import * as cdk_nextjs_standalone from 'cdk-nextjs-standalone';
|
|
35
|
+
import { CfnAnalyzer } from 'aws-cdk-lib/aws-accessanalyzer';
|
|
36
|
+
import { Trail } from 'aws-cdk-lib/aws-cloudtrail';
|
|
37
|
+
import { CfnPermissionSet } from 'aws-cdk-lib/aws-sso';
|
|
38
|
+
import { CfnApplication } from 'aws-cdk-lib/aws-sam';
|
|
39
|
+
import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
|
|
40
|
+
|
|
41
|
+
declare const CDK: {
|
|
42
|
+
ACCOUNT: {
|
|
43
|
+
DEVELOPMENT: string;
|
|
44
|
+
MANAGEMENT: string;
|
|
45
|
+
OPERATIONS: string;
|
|
46
|
+
PRODUCTION: string;
|
|
47
|
+
SANDBOX: string;
|
|
48
|
+
SECURITY: string;
|
|
49
|
+
STAGE: string;
|
|
50
|
+
};
|
|
51
|
+
BUILD: {
|
|
52
|
+
CONFIG: {
|
|
53
|
+
ALL: string;
|
|
54
|
+
API: string;
|
|
55
|
+
INFRASTRUCTURE: string;
|
|
56
|
+
NONE: string;
|
|
57
|
+
WEB: string;
|
|
58
|
+
};
|
|
59
|
+
PERSONAL: string;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated rename "ephemeral" to "personal" (since 2/24/2025)
|
|
62
|
+
*/
|
|
63
|
+
EPHEMERAL: string;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated as even "ephemeral" builds have static assets (since 7/6/2024)
|
|
66
|
+
*/
|
|
67
|
+
STATIC: string;
|
|
68
|
+
};
|
|
69
|
+
CREATION: {
|
|
70
|
+
CDK: string;
|
|
71
|
+
CLOUDFORMATION_TEMPLATE: string;
|
|
72
|
+
MANUAL: string;
|
|
73
|
+
};
|
|
74
|
+
DATADOG: {
|
|
75
|
+
SITE: string;
|
|
76
|
+
LAYER: {
|
|
77
|
+
NODE: number;
|
|
78
|
+
EXTENSION: number;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
DEFAULT: {
|
|
82
|
+
REGION: string;
|
|
83
|
+
};
|
|
84
|
+
DNS: {
|
|
85
|
+
CONFIG: {
|
|
86
|
+
TTL: number;
|
|
87
|
+
};
|
|
88
|
+
RECORD: {
|
|
89
|
+
A: string;
|
|
90
|
+
CNAME: string;
|
|
91
|
+
MX: string;
|
|
92
|
+
NS: string;
|
|
93
|
+
TXT: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
DURATION: {
|
|
97
|
+
EXPRESS_API: number;
|
|
98
|
+
CLOUDFRONT_API: number;
|
|
99
|
+
LAMBDA_MAXIMUM: number;
|
|
100
|
+
LAMBDA_WORKER: number;
|
|
101
|
+
};
|
|
102
|
+
ENV: {
|
|
103
|
+
DEMO: string;
|
|
104
|
+
DEVELOPMENT: string;
|
|
105
|
+
/** @deprecated */ EPHEMERAL: string;
|
|
106
|
+
LOCAL: string;
|
|
107
|
+
/** @deprecated */ MAIN: string;
|
|
108
|
+
META: string;
|
|
109
|
+
PERSONAL: string;
|
|
110
|
+
PREVIEW: string;
|
|
111
|
+
PRODUCTION: string;
|
|
112
|
+
RELEASE: string;
|
|
113
|
+
REVIEW: string;
|
|
114
|
+
SANDBOX: string;
|
|
115
|
+
TRAINING: string;
|
|
116
|
+
};
|
|
117
|
+
HOST: {
|
|
118
|
+
APEX: string;
|
|
119
|
+
};
|
|
120
|
+
IMPORT: {
|
|
121
|
+
DATADOG_LOG_FORWARDER: string;
|
|
122
|
+
DATADOG_ROLE: string;
|
|
123
|
+
DATADOG_SECRET: string;
|
|
124
|
+
LOG_BUCKET: string;
|
|
125
|
+
OIDC_PROVIDER: string;
|
|
126
|
+
};
|
|
127
|
+
LAMBDA: {
|
|
128
|
+
LOG_RETENTION: number;
|
|
129
|
+
MEMORY_SIZE: number;
|
|
130
|
+
};
|
|
131
|
+
PRINCIPAL: {
|
|
132
|
+
ROUTE53: string;
|
|
133
|
+
};
|
|
134
|
+
PRINCIPAL_TYPE: {
|
|
135
|
+
GROUP: string;
|
|
136
|
+
USER: string;
|
|
137
|
+
};
|
|
138
|
+
PROJECT: {
|
|
139
|
+
INFRASTRUCTURE: string;
|
|
140
|
+
};
|
|
141
|
+
SECURITY_HEADERS: {
|
|
142
|
+
CONTENT_SECURITY_POLICY: string;
|
|
143
|
+
HSTS_MAX_AGE: number;
|
|
144
|
+
PERMISSIONS_POLICY: string;
|
|
145
|
+
};
|
|
146
|
+
ROLE: {
|
|
147
|
+
API: string;
|
|
148
|
+
DEPLOY: string;
|
|
149
|
+
HOSTING: string;
|
|
150
|
+
MONITORING: string;
|
|
151
|
+
NETWORKING: string;
|
|
152
|
+
PROCESSING: string;
|
|
153
|
+
SECURITY: string;
|
|
154
|
+
STACK: string;
|
|
155
|
+
STORAGE: string;
|
|
156
|
+
TOY: string;
|
|
157
|
+
};
|
|
158
|
+
SERVICE: {
|
|
159
|
+
DATADOG: string;
|
|
160
|
+
INFRASTRUCTURE: string;
|
|
161
|
+
LIBRARIES: string;
|
|
162
|
+
NONE: string;
|
|
163
|
+
SSO: string;
|
|
164
|
+
TRACE: string;
|
|
165
|
+
};
|
|
166
|
+
TAG: {
|
|
167
|
+
BUILD_DATE: string;
|
|
168
|
+
BUILD_HEX: string;
|
|
169
|
+
BUILD_NUMBER: string;
|
|
170
|
+
BUILD_TIME: string;
|
|
171
|
+
BUILD_TYPE: string;
|
|
172
|
+
COMMIT: string;
|
|
173
|
+
CREATION: string;
|
|
174
|
+
ENV: string;
|
|
175
|
+
NONCE: string;
|
|
176
|
+
PROJECT: string;
|
|
177
|
+
ROLE: string;
|
|
178
|
+
SERVICE: string;
|
|
179
|
+
SPONSOR: string;
|
|
180
|
+
STACK: string;
|
|
181
|
+
STACK_SHA: string;
|
|
182
|
+
VENDOR: string;
|
|
183
|
+
VERSION: string;
|
|
184
|
+
};
|
|
185
|
+
TARGET_TYPE: {
|
|
186
|
+
AWS_ACCOUNT: string;
|
|
187
|
+
};
|
|
188
|
+
VENDOR: {
|
|
189
|
+
ANTHROPIC: string;
|
|
190
|
+
AUTH0: string;
|
|
191
|
+
DATADOG: string;
|
|
192
|
+
KNOWTRACE: string;
|
|
193
|
+
MONGODB: string;
|
|
194
|
+
OPENAI: string;
|
|
195
|
+
SPLINTERLANDS: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
interface JaypieAccountLoggingBucketProps extends BucketProps {
|
|
200
|
+
/**
|
|
201
|
+
* Optional construct ID
|
|
202
|
+
* @default "AccountLoggingBucket"
|
|
203
|
+
*/
|
|
204
|
+
id?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Bucket name
|
|
207
|
+
* @default `account-logging-stack-${PROJECT_NONCE}`
|
|
208
|
+
*/
|
|
209
|
+
bucketName?: string;
|
|
210
|
+
/**
|
|
211
|
+
* The service tag value
|
|
212
|
+
* @default CDK.SERVICE.INFRASTRUCTURE
|
|
213
|
+
*/
|
|
214
|
+
service?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Optional project tag value
|
|
217
|
+
*/
|
|
218
|
+
project?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Number of days before logs expire
|
|
221
|
+
* @default 365
|
|
222
|
+
*/
|
|
223
|
+
expirationDays?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Number of days before transitioning to INFREQUENT_ACCESS storage
|
|
226
|
+
* @default 30
|
|
227
|
+
*/
|
|
228
|
+
infrequentAccessTransitionDays?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Number of days before transitioning to GLACIER storage
|
|
231
|
+
* @default 180
|
|
232
|
+
*/
|
|
233
|
+
glacierTransitionDays?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Whether to create CloudFormation output for bucket name
|
|
236
|
+
* @default true
|
|
237
|
+
*/
|
|
238
|
+
createOutput?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Custom export name for the bucket name output
|
|
241
|
+
* @default CDK.IMPORT.LOG_BUCKET
|
|
242
|
+
*/
|
|
243
|
+
exportName?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Description for the CloudFormation output
|
|
246
|
+
* @default "Account-wide logging bucket"
|
|
247
|
+
*/
|
|
248
|
+
outputDescription?: string;
|
|
249
|
+
}
|
|
250
|
+
declare class JaypieAccountLoggingBucket extends Construct {
|
|
251
|
+
readonly bucket: IBucket;
|
|
252
|
+
/**
|
|
253
|
+
* Create a new account-wide logging S3 bucket with lifecycle policies and export
|
|
254
|
+
*/
|
|
255
|
+
constructor(scope: Construct, idOrProps?: string | JaypieAccountLoggingBucketProps, propsOrUndefined?: JaypieAccountLoggingBucketProps);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface AddDatadogLayerOptions {
|
|
259
|
+
datadogApiKeyArn?: string;
|
|
260
|
+
serviceTag?: string;
|
|
261
|
+
}
|
|
262
|
+
declare function addDatadogLayers(lambdaFunction: lambda.Function, options?: AddDatadogLayerOptions): boolean;
|
|
263
|
+
|
|
264
|
+
declare function constructEnvName(name: string, opts?: {
|
|
265
|
+
env?: string;
|
|
266
|
+
key?: string;
|
|
267
|
+
nonce?: string;
|
|
268
|
+
}): string;
|
|
269
|
+
|
|
270
|
+
declare function constructStackName(key?: string): string;
|
|
271
|
+
|
|
272
|
+
declare function constructTagger(construct: Construct, { name }?: {
|
|
273
|
+
name?: string;
|
|
274
|
+
}): boolean;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Build a WAF log bucket name shaped like
|
|
278
|
+
* `aws-waf-logs-${env}-${key}-${name}-waf-${nonce}` (or `-waf-` only when
|
|
279
|
+
* `name` is empty). The `aws-waf-logs-` prefix is required by AWS WAF, and
|
|
280
|
+
* `-${PROJECT_NONCE}` is preserved verbatim for uniqueness; the middle is
|
|
281
|
+
* truncated when needed to fit S3's 63-char limit.
|
|
282
|
+
*/
|
|
283
|
+
declare function constructWafLogBucketName(name?: string): string;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Configuration for resolving a hostname from parts.
|
|
287
|
+
* Used by envHostname() to construct domain names from environment and config.
|
|
288
|
+
*/
|
|
289
|
+
interface HostConfig {
|
|
290
|
+
component?: string;
|
|
291
|
+
domain?: string;
|
|
292
|
+
env?: string;
|
|
293
|
+
subdomain?: string;
|
|
294
|
+
}
|
|
295
|
+
declare function envHostname({ component, domain, env, subdomain, }?: HostConfig): string;
|
|
296
|
+
|
|
297
|
+
interface ExtendDatadogRoleOptions {
|
|
298
|
+
/**
|
|
299
|
+
* Optional construct ID for the policy
|
|
300
|
+
* @default "DatadogCustomPolicy"
|
|
301
|
+
*/
|
|
302
|
+
id?: string;
|
|
303
|
+
/**
|
|
304
|
+
* The service tag value
|
|
305
|
+
* @default CDK.SERVICE.DATADOG
|
|
306
|
+
*/
|
|
307
|
+
service?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Optional project tag value
|
|
310
|
+
*/
|
|
311
|
+
project?: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Extends the Datadog IAM role with additional permissions
|
|
315
|
+
*
|
|
316
|
+
* Checks for CDK_ENV_DATADOG_ROLE_ARN environment variable.
|
|
317
|
+
* If found, creates a custom policy with:
|
|
318
|
+
* - budgets:ViewBudget
|
|
319
|
+
* - logs:DescribeLogGroups
|
|
320
|
+
* - trustedadvisor:ListRecommendations
|
|
321
|
+
*
|
|
322
|
+
* @param scope - The construct scope
|
|
323
|
+
* @param options - Configuration options
|
|
324
|
+
* @returns The created Policy, or undefined if CDK_ENV_DATADOG_ROLE_ARN is not set
|
|
325
|
+
*/
|
|
326
|
+
declare function extendDatadogRole(scope: Construct, options?: ExtendDatadogRoleOptions): Policy | undefined;
|
|
327
|
+
|
|
328
|
+
interface ResolveCertificateOptions {
|
|
329
|
+
/** Certificate input - true creates at stack level, false skips, ICertificate uses as-is, string imports from ARN */
|
|
330
|
+
certificate?: boolean | acm.ICertificate | string;
|
|
331
|
+
/** Domain name for the certificate (required if certificate is true) */
|
|
332
|
+
domainName: string;
|
|
333
|
+
/** Construct ID name prefix (defaults to "Certificate") */
|
|
334
|
+
name?: string;
|
|
335
|
+
/** Role tag for tagging (defaults to CDK.ROLE.API) */
|
|
336
|
+
roleTag?: string;
|
|
337
|
+
/** Hosted zone for DNS validation (required if certificate is true) */
|
|
338
|
+
zone: route53.IHostedZone;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Resolves a certificate based on input type.
|
|
342
|
+
*
|
|
343
|
+
* Key behavior: When certificate is `true`, the certificate is created at the
|
|
344
|
+
* STACK level (not construct level) and cached by domain name. This allows
|
|
345
|
+
* swapping between constructs (e.g., JaypieDistribution to JaypieApiGateway)
|
|
346
|
+
* without recreating the certificate.
|
|
347
|
+
*
|
|
348
|
+
* @param scope - The construct scope (used to find the stack)
|
|
349
|
+
* @param options - Certificate resolution options
|
|
350
|
+
* @returns The resolved certificate, or undefined if certificate is false
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* // Create or get cached certificate at stack level
|
|
354
|
+
* const cert = resolveCertificate(this, {
|
|
355
|
+
* certificate: true,
|
|
356
|
+
* domainName: "api.example.com",
|
|
357
|
+
* zone: hostedZone,
|
|
358
|
+
* });
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* // Use existing certificate
|
|
362
|
+
* const cert = resolveCertificate(this, {
|
|
363
|
+
* certificate: existingCert,
|
|
364
|
+
* domainName: "api.example.com",
|
|
365
|
+
* zone: hostedZone,
|
|
366
|
+
* });
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* // Import certificate from ARN
|
|
370
|
+
* const cert = resolveCertificate(this, {
|
|
371
|
+
* certificate: "arn:aws:acm:us-east-1:123456789:certificate/abc-123",
|
|
372
|
+
* domainName: "api.example.com",
|
|
373
|
+
* zone: hostedZone,
|
|
374
|
+
* });
|
|
375
|
+
*/
|
|
376
|
+
declare function resolveCertificate(scope: Construct, options: ResolveCertificateOptions): acm.ICertificate | undefined;
|
|
377
|
+
/**
|
|
378
|
+
* Clears the certificate cache for a specific stack.
|
|
379
|
+
* Primarily useful for testing.
|
|
380
|
+
*/
|
|
381
|
+
declare function clearCertificateCache(stack: Stack): void;
|
|
382
|
+
/**
|
|
383
|
+
* Clears all certificate caches.
|
|
384
|
+
* Primarily useful for testing.
|
|
385
|
+
*/
|
|
386
|
+
declare function clearAllCertificateCaches(): void;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Create (or return the existing) stack-level CloudWatch Logs resource policy
|
|
390
|
+
* that grants Route53 permission to write query logs to any `/aws/route53/*`
|
|
391
|
+
* log group in the stack's account and region.
|
|
392
|
+
*
|
|
393
|
+
* Consolidates what would otherwise be one `AWS::Logs::ResourcePolicy` per
|
|
394
|
+
* hosted zone into a single wildcard policy, keeping the stack well clear of
|
|
395
|
+
* the 10-resource-policy-per-region account quota.
|
|
396
|
+
*/
|
|
397
|
+
declare function ensureRoute53QueryLoggingPolicy(scope: Construct): CfnResourcePolicy;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Check if the current environment matches the given environment
|
|
401
|
+
*/
|
|
402
|
+
declare function isEnv(env: string): boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Check if the current environment is production
|
|
405
|
+
*/
|
|
406
|
+
declare function isProductionEnv(): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Check if the current environment is sandbox
|
|
409
|
+
*/
|
|
410
|
+
declare function isSandboxEnv(): boolean;
|
|
411
|
+
|
|
412
|
+
declare function isValidHostname(hostname: string): boolean;
|
|
413
|
+
|
|
414
|
+
declare function isValidSubdomain(subdomain: string): boolean;
|
|
415
|
+
|
|
416
|
+
interface JaypieLambdaEnvOptions {
|
|
417
|
+
initialEnvironment?: {
|
|
418
|
+
[key: string]: string;
|
|
419
|
+
};
|
|
420
|
+
serviceTag?: string;
|
|
421
|
+
}
|
|
422
|
+
declare function jaypieLambdaEnv(options?: JaypieLambdaEnvOptions): {
|
|
423
|
+
[key: string]: string;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
declare function mergeDomain(subDomain: string, hostedZone: string): string;
|
|
427
|
+
|
|
428
|
+
interface ResolveDatadogForwarderFunctionOptions {
|
|
429
|
+
import?: string;
|
|
430
|
+
name?: string;
|
|
431
|
+
}
|
|
432
|
+
declare function resolveDatadogForwarderFunction(scope: Construct, options?: ResolveDatadogForwarderFunctionOptions): lambda.IFunction;
|
|
433
|
+
|
|
434
|
+
interface ResolveDatadogLayerOptions {
|
|
435
|
+
datadogApiKeyArn?: string;
|
|
436
|
+
uniqueId?: string;
|
|
437
|
+
}
|
|
438
|
+
declare function resolveDatadogLayers(scope: Construct, options?: ResolveDatadogLayerOptions): lambda.ILayerVersion[] | undefined;
|
|
439
|
+
|
|
440
|
+
declare function resolveDatadogLoggingDestination(scope: Construct, options?: ResolveDatadogForwarderFunctionOptions): logDestinations.LambdaDestination;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Environment value type for the new array syntax
|
|
444
|
+
* - string: key to lookup in process.env
|
|
445
|
+
* - object: key-value pairs to include directly
|
|
446
|
+
*/
|
|
447
|
+
type EnvironmentArrayItem = string | {
|
|
448
|
+
[key: string]: string;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Environment type that supports both legacy object syntax and new array syntax
|
|
452
|
+
*/
|
|
453
|
+
type EnvironmentInput = {
|
|
454
|
+
[key: string]: string;
|
|
455
|
+
} | EnvironmentArrayItem[];
|
|
456
|
+
/**
|
|
457
|
+
* Resolves environment input to a plain object.
|
|
458
|
+
*
|
|
459
|
+
* When environment is an object (legacy syntax), returns it as-is.
|
|
460
|
+
* When environment is an array:
|
|
461
|
+
* - Strings are treated as keys to lookup in process.env
|
|
462
|
+
* - Objects have their key-value pairs merged in
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* // Legacy object syntax
|
|
466
|
+
* resolveEnvironment({ FOO: "bar" })
|
|
467
|
+
* // => { FOO: "bar" }
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* // Array syntax with process.env lookup
|
|
471
|
+
* // Given process.env.MY_VAR = "hello"
|
|
472
|
+
* resolveEnvironment(["MY_VAR"])
|
|
473
|
+
* // => { MY_VAR: "hello" }
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* // Array syntax with objects
|
|
477
|
+
* resolveEnvironment([{ FOO: "bar", BAZ: "qux" }])
|
|
478
|
+
* // => { FOO: "bar", BAZ: "qux" }
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* // Mixed array syntax
|
|
482
|
+
* // Given process.env.MY_VAR = "hello"
|
|
483
|
+
* resolveEnvironment(["MY_VAR", { FOO: "bar" }])
|
|
484
|
+
* // => { MY_VAR: "hello", FOO: "bar" }
|
|
485
|
+
*/
|
|
486
|
+
declare function resolveEnvironment(environment?: EnvironmentInput, env?: Record<string, string | undefined>): {
|
|
487
|
+
[key: string]: string;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
declare function resolveHostedZone(scope: Construct, { name, zone, }?: {
|
|
491
|
+
name?: string;
|
|
492
|
+
zone?: string | route53.IHostedZone;
|
|
493
|
+
}): route53.IHostedZone;
|
|
494
|
+
|
|
495
|
+
interface ResolveParamsAndSecretsOptions {
|
|
496
|
+
cacheSize?: number;
|
|
497
|
+
logLevel?: lambda.ParamsAndSecretsLogLevel;
|
|
498
|
+
parameterStoreTtl?: Duration;
|
|
499
|
+
secretsManagerTtl?: Duration;
|
|
500
|
+
}
|
|
501
|
+
declare const resolveParamsAndSecrets: ({ paramsAndSecrets, options, }?: {
|
|
502
|
+
paramsAndSecrets?: lambda.ParamsAndSecretsLayerVersion | boolean;
|
|
503
|
+
options?: ResolveParamsAndSecretsOptions;
|
|
504
|
+
}) => lambda.ParamsAndSecretsLayerVersion | undefined;
|
|
505
|
+
|
|
506
|
+
interface JaypieSecretProps {
|
|
507
|
+
envKey?: string;
|
|
508
|
+
generateSecretString?: secretsmanager.SecretStringGenerator;
|
|
509
|
+
removalPolicy?: boolean | RemovalPolicy;
|
|
510
|
+
roleTag?: string;
|
|
511
|
+
vendorTag?: string;
|
|
512
|
+
value?: string;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Context handed to {@link JaypieSecret.buildSecret} so subclasses can build the
|
|
516
|
+
* underlying secret differently (e.g. import vs. create) while reusing the
|
|
517
|
+
* shared id/envKey resolution and the full ISecret passthrough.
|
|
518
|
+
*/
|
|
519
|
+
interface BuildSecretContext {
|
|
520
|
+
envKey?: string;
|
|
521
|
+
id: string;
|
|
522
|
+
props: JaypieSecretProps;
|
|
523
|
+
treatAsEnvKey: boolean;
|
|
524
|
+
}
|
|
525
|
+
declare class JaypieSecret extends Construct implements ISecret {
|
|
526
|
+
protected static readonly shorthandPrefix: string;
|
|
527
|
+
protected readonly _envKey?: string;
|
|
528
|
+
protected readonly _secret: secretsmanager.ISecret;
|
|
529
|
+
constructor(scope: Construct, idOrEnvKey: string, props?: JaypieSecretProps);
|
|
530
|
+
/**
|
|
531
|
+
* Builds the underlying secret. The base implementation always creates a new
|
|
532
|
+
* Secrets Manager secret from an envKey value, an explicit value, or a
|
|
533
|
+
* generated string. Subclasses may override to import an existing secret or
|
|
534
|
+
* emit cross-stack outputs.
|
|
535
|
+
*/
|
|
536
|
+
protected buildSecret(context: BuildSecretContext): secretsmanager.ISecret;
|
|
537
|
+
get stack(): Stack;
|
|
538
|
+
get env(): {
|
|
539
|
+
account: string;
|
|
540
|
+
region: string;
|
|
541
|
+
};
|
|
542
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
543
|
+
get secretArn(): string;
|
|
544
|
+
get secretFullArn(): string | undefined;
|
|
545
|
+
get secretName(): string;
|
|
546
|
+
get secretRef(): secretsmanager.SecretReference;
|
|
547
|
+
get encryptionKey(): IKey | undefined;
|
|
548
|
+
get secretValue(): SecretValue;
|
|
549
|
+
secretValueFromJson(key: string): SecretValue;
|
|
550
|
+
grantRead(grantee: IGrantable, versionStages?: string[]): Grant;
|
|
551
|
+
grantWrite(grantee: IGrantable): Grant;
|
|
552
|
+
addRotationSchedule(id: string, options: RotationScheduleOptions): RotationSchedule;
|
|
553
|
+
addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult;
|
|
554
|
+
denyAccountRootDelete(): void;
|
|
555
|
+
attach(target: ISecretAttachmentTarget): ISecret;
|
|
556
|
+
cfnDynamicReferenceKey(options?: Parameters<ISecret["cfnDynamicReferenceKey"]>[0]): string;
|
|
557
|
+
get envKey(): string | undefined;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Secrets input type that supports both JaypieSecret instances and strings
|
|
562
|
+
* - JaypieSecret (including JaypieEnvSecret subclasses): passed through as-is
|
|
563
|
+
* - string: converted to a JaypieEnvSecret with the string as envKey
|
|
564
|
+
*/
|
|
565
|
+
type SecretsArrayItem = JaypieSecret | string;
|
|
566
|
+
/**
|
|
567
|
+
* Resolves secrets input to an array of JaypieSecret instances.
|
|
568
|
+
*
|
|
569
|
+
* When an item is already a JaypieSecret (including a JaypieEnvSecret), it's
|
|
570
|
+
* passed through as-is. When an item is a string, a JaypieEnvSecret is created
|
|
571
|
+
* (or reused from cache) with the string as the envKey.
|
|
572
|
+
*
|
|
573
|
+
* Secrets are cached per scope to avoid creating duplicate secrets when
|
|
574
|
+
* multiple constructs in the same scope reference the same secret.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* // JaypieEnvSecret instances pass through
|
|
578
|
+
* const secret = new JaypieEnvSecret(scope, "MySecret", { envKey: "MY_KEY" });
|
|
579
|
+
* resolveSecrets(scope, [secret])
|
|
580
|
+
* // => [secret]
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* // Strings create JaypieEnvSecret instances
|
|
584
|
+
* resolveSecrets(scope, ["AUTH0_SECRET", "MONGODB_URI"])
|
|
585
|
+
* // => [JaypieEnvSecret(envKey: "AUTH0_SECRET"), JaypieEnvSecret(envKey: "MONGODB_URI")]
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* // Mixed input
|
|
589
|
+
* const existingSecret = new JaypieEnvSecret(scope, "Existing", { envKey: "EXISTING" });
|
|
590
|
+
* resolveSecrets(scope, [existingSecret, "NEW_SECRET"])
|
|
591
|
+
* // => [existingSecret, JaypieEnvSecret(envKey: "NEW_SECRET")]
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* // Secrets are shared across calls with the same scope
|
|
595
|
+
* const secrets1 = resolveSecrets(scope, ["SHARED_SECRET"]);
|
|
596
|
+
* const secrets2 = resolveSecrets(scope, ["SHARED_SECRET"]);
|
|
597
|
+
* // secrets1[0] === secrets2[0] (same instance)
|
|
598
|
+
*/
|
|
599
|
+
declare function resolveSecrets(scope: Construct, secrets?: SecretsArrayItem[]): JaypieSecret[];
|
|
600
|
+
/**
|
|
601
|
+
* Clears the secrets cache for a given scope.
|
|
602
|
+
* Primarily useful for testing.
|
|
603
|
+
*/
|
|
604
|
+
declare function clearSecretsCache(scope: Construct): void;
|
|
605
|
+
/**
|
|
606
|
+
* Clears all secrets caches.
|
|
607
|
+
* Primarily useful for testing.
|
|
608
|
+
*/
|
|
609
|
+
declare function clearAllSecretsCaches(): void;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Canonical sub-rule names for each AWS managed rule group, as published in the
|
|
613
|
+
* AWS WAF developer guide. Used to validate `waf.allow` and
|
|
614
|
+
* `waf.managedRuleOverrides` rule names at synth time — AWS WAF matches
|
|
615
|
+
* `RuleActionOverride` on the exact rule *name* and silently ignores names that
|
|
616
|
+
* match no rule, so a typo or a label/name casing mismatch (e.g. the label
|
|
617
|
+
* `…:NoUserAgent_Header` vs the rule name `NoUserAgent_HEADER`) becomes an
|
|
618
|
+
* undiagnosable no-op.
|
|
619
|
+
*
|
|
620
|
+
* Groups absent from this map (custom rule groups, or AWS groups not yet
|
|
621
|
+
* mirrored here) are not validated.
|
|
622
|
+
*
|
|
623
|
+
* @see https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-list.html
|
|
624
|
+
*/
|
|
625
|
+
declare const AWS_MANAGED_RULE_GROUPS: Record<string, readonly string[]>;
|
|
626
|
+
/** One entry in a `waf.allow` list. Mirrors JaypieWafAllowEntry structurally. */
|
|
627
|
+
interface WafAllowEntryLike {
|
|
628
|
+
path: string | string[];
|
|
629
|
+
[ruleGroupKey: string]: string | string[] | undefined;
|
|
630
|
+
}
|
|
631
|
+
interface AssertValidWafRuleNamesOptions {
|
|
632
|
+
allow?: WafAllowEntryLike | WafAllowEntryLike[];
|
|
633
|
+
managedRuleOverrides?: Record<string, wafv2.CfnWebACL.RuleActionOverrideProperty[]>;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Throw a ConfigurationError if any `waf.allow` or `waf.managedRuleOverrides`
|
|
637
|
+
* rule name does not exist in its AWS managed rule group. Groups not present in
|
|
638
|
+
* AWS_MANAGED_RULE_GROUPS (custom groups) are skipped. A name that matches no
|
|
639
|
+
* rule would otherwise be silently ignored by AWS WAF.
|
|
640
|
+
*/
|
|
641
|
+
declare function assertValidWafRuleNames({ allow, managedRuleOverrides, }?: AssertValidWafRuleNamesOptions): void;
|
|
642
|
+
|
|
643
|
+
interface JaypieApiGatewayProps extends apiGateway.LambdaRestApiProps {
|
|
644
|
+
certificate?: boolean | acm.ICertificate;
|
|
645
|
+
/**
|
|
646
|
+
* Force-delete any existing Route53 A record with the same name before
|
|
647
|
+
* creating the alias record. Useful when migrating from another construct
|
|
648
|
+
* (e.g., JaypieDistribution) that already owns the same hostname, where the
|
|
649
|
+
* default CloudFormation create-before-delete ordering would otherwise
|
|
650
|
+
* collide on the record name.
|
|
651
|
+
* @default false
|
|
652
|
+
*/
|
|
653
|
+
deleteExistingRecord?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* The domain name for the API Gateway.
|
|
656
|
+
*
|
|
657
|
+
* Supports both string and config object:
|
|
658
|
+
* - String: used directly as the domain name (e.g., "api.example.com")
|
|
659
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
660
|
+
* - { subdomain, domain, env, component }
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* // Direct string
|
|
664
|
+
* host: "api.example.com"
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* // Config object - resolves using envHostname()
|
|
668
|
+
* host: { subdomain: "api" }
|
|
669
|
+
*/
|
|
670
|
+
host?: string | HostConfig;
|
|
671
|
+
name?: string;
|
|
672
|
+
roleTag?: string;
|
|
673
|
+
zone?: string | route53.IHostedZone;
|
|
674
|
+
}
|
|
675
|
+
declare class JaypieApiGateway extends Construct implements apiGateway.IRestApi {
|
|
676
|
+
private readonly _api;
|
|
677
|
+
private readonly _certificate?;
|
|
678
|
+
private readonly _domainName?;
|
|
679
|
+
private readonly _host?;
|
|
680
|
+
constructor(scope: Construct, id: string, props: JaypieApiGatewayProps);
|
|
681
|
+
get api(): apiGateway.LambdaRestApi;
|
|
682
|
+
get url(): string;
|
|
683
|
+
get certificateArn(): string | undefined;
|
|
684
|
+
get domainName(): string | undefined;
|
|
685
|
+
get host(): string | undefined;
|
|
686
|
+
get restApiId(): string;
|
|
687
|
+
get restApiName(): string;
|
|
688
|
+
get restApiRootResourceId(): string;
|
|
689
|
+
get deploymentStage(): apiGateway.Stage;
|
|
690
|
+
get domainNameAliasDomainName(): string | undefined;
|
|
691
|
+
get domainNameAliasHostedZoneId(): string | undefined;
|
|
692
|
+
get root(): apiGateway.IResource;
|
|
693
|
+
get env(): {
|
|
694
|
+
account: string;
|
|
695
|
+
region: string;
|
|
696
|
+
};
|
|
697
|
+
get stack(): Stack;
|
|
698
|
+
arnForExecuteApi(method?: string, path?: string, stage?: string): string;
|
|
699
|
+
metric(metricName: string, props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
700
|
+
metricCacheHitCount(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
701
|
+
metricCacheMissCount(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
702
|
+
metricClientError(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
703
|
+
metricCount(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
704
|
+
metricIntegrationLatency(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
705
|
+
metricLatency(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
706
|
+
metricServerError(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
707
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
708
|
+
get restApiRef(): apiGateway.RestApiReference;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
interface JaypieStackProps extends StackProps {
|
|
712
|
+
key?: string;
|
|
713
|
+
}
|
|
714
|
+
declare class JaypieStack extends Stack {
|
|
715
|
+
constructor(scope: Construct, id: string, props?: JaypieStackProps);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
declare class JaypieAppStack extends JaypieStack {
|
|
719
|
+
constructor(scope: Construct, id: string, props?: JaypieStackProps);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
interface JaypieLambdaProps {
|
|
723
|
+
allowAllOutbound?: boolean;
|
|
724
|
+
allowPublicSubnet?: boolean;
|
|
725
|
+
architecture?: lambda.Architecture;
|
|
726
|
+
code: lambda.Code | string;
|
|
727
|
+
datadogApiKeyArn?: string;
|
|
728
|
+
deadLetterQueue?: sqs.IQueue;
|
|
729
|
+
deadLetterQueueEnabled?: boolean;
|
|
730
|
+
deadLetterTopic?: aws_cdk_lib_aws_sns.ITopic;
|
|
731
|
+
description?: string;
|
|
732
|
+
/**
|
|
733
|
+
* DynamoDB tables to grant read/write access to the Lambda function.
|
|
734
|
+
* Each table is granted read/write access and if exactly one table is provided,
|
|
735
|
+
* the DYNAMODB_TABLE_NAME environment variable is set to the table name.
|
|
736
|
+
*/
|
|
737
|
+
tables?: dynamodb.ITable[];
|
|
738
|
+
/**
|
|
739
|
+
* Environment variables for the Lambda function.
|
|
740
|
+
*
|
|
741
|
+
* Supports both legacy object syntax and new array syntax:
|
|
742
|
+
* - Object: { KEY: "value" } - directly sets environment variables
|
|
743
|
+
* - Array: ["KEY1", "KEY2", { KEY3: "value" }]
|
|
744
|
+
* - Strings: lookup value from process.env
|
|
745
|
+
* - Objects: merge key-value pairs directly
|
|
746
|
+
*/
|
|
747
|
+
environment?: EnvironmentInput;
|
|
748
|
+
envSecrets?: {
|
|
749
|
+
[key: string]: secretsmanager.ISecret;
|
|
750
|
+
};
|
|
751
|
+
ephemeralStorageSize?: cdk.Size;
|
|
752
|
+
filesystem?: lambda.FileSystem;
|
|
753
|
+
handler: string;
|
|
754
|
+
initialPolicy?: iam.PolicyStatement[];
|
|
755
|
+
layers?: lambda.ILayerVersion[];
|
|
756
|
+
logGroup?: logs.ILogGroup;
|
|
757
|
+
logRetention?: logs.RetentionDays | number;
|
|
758
|
+
maxEventAge?: Duration;
|
|
759
|
+
memorySize?: number;
|
|
760
|
+
paramsAndSecrets?: lambda.ParamsAndSecretsLayerVersion | boolean;
|
|
761
|
+
paramsAndSecretsOptions?: {
|
|
762
|
+
cacheSize?: number;
|
|
763
|
+
logLevel?: lambda.ParamsAndSecretsLogLevel;
|
|
764
|
+
parameterStoreTtl?: Duration;
|
|
765
|
+
secretsManagerTtl?: Duration;
|
|
766
|
+
};
|
|
767
|
+
profiling?: boolean;
|
|
768
|
+
profilingGroup?: aws_cdk_lib_aws_codeguruprofiler.IProfilingGroup;
|
|
769
|
+
provisionedConcurrentExecutions?: number;
|
|
770
|
+
reservedConcurrentExecutions?: number;
|
|
771
|
+
retryAttempts?: number;
|
|
772
|
+
roleTag?: string;
|
|
773
|
+
runtime?: lambda.Runtime;
|
|
774
|
+
runtimeManagementMode?: lambda.RuntimeManagementMode;
|
|
775
|
+
/**
|
|
776
|
+
* Secrets to make available to the Lambda function.
|
|
777
|
+
*
|
|
778
|
+
* Supports both JaypieSecret instances and strings:
|
|
779
|
+
* - JaypieSecret (including JaypieEnvSecret): used directly
|
|
780
|
+
* - String: creates a JaypieEnvSecret with the string as envKey
|
|
781
|
+
* (reuses existing secrets within the same scope)
|
|
782
|
+
*/
|
|
783
|
+
secrets?: SecretsArrayItem[];
|
|
784
|
+
securityGroups?: ec2.ISecurityGroup[];
|
|
785
|
+
serviceTag?: string;
|
|
786
|
+
timeout?: Duration | number;
|
|
787
|
+
tracing?: lambda.Tracing;
|
|
788
|
+
vendorTag?: string;
|
|
789
|
+
vpc?: ec2.IVpc;
|
|
790
|
+
vpcSubnets?: ec2.SubnetSelection;
|
|
791
|
+
}
|
|
792
|
+
declare class JaypieLambda extends Construct implements lambda.IFunction {
|
|
793
|
+
private readonly _lambda;
|
|
794
|
+
private readonly _provisioned?;
|
|
795
|
+
private readonly _reference;
|
|
796
|
+
constructor(scope: Construct, id: string, props: JaypieLambdaProps);
|
|
797
|
+
get lambda(): lambda.Function;
|
|
798
|
+
get provisioned(): lambda.Alias | undefined;
|
|
799
|
+
get reference(): lambda.IFunction;
|
|
800
|
+
get functionArn(): string;
|
|
801
|
+
get functionName(): string;
|
|
802
|
+
get grantPrincipal(): iam.IPrincipal;
|
|
803
|
+
get role(): iam.IRole | undefined;
|
|
804
|
+
get architecture(): lambda.Architecture;
|
|
805
|
+
get connections(): ec2.Connections;
|
|
806
|
+
get isBoundToVpc(): boolean;
|
|
807
|
+
get latestVersion(): lambda.IVersion;
|
|
808
|
+
get permissionsNode(): constructs.Node;
|
|
809
|
+
get resourceArnsForGrantInvoke(): string[];
|
|
810
|
+
get functionRef(): lambda.FunctionReference;
|
|
811
|
+
addEventSource(source: lambda.IEventSource): void;
|
|
812
|
+
addEventSourceMapping(id: string, options: lambda.EventSourceMappingOptions): lambda.EventSourceMapping;
|
|
813
|
+
addFunctionUrl(options?: lambda.FunctionUrlOptions): lambda.FunctionUrl;
|
|
814
|
+
addPermission(id: string, permission: lambda.Permission): void;
|
|
815
|
+
addToRolePolicy(statement: iam.PolicyStatement): void;
|
|
816
|
+
configureAsyncInvoke(options: lambda.EventInvokeConfigOptions): void;
|
|
817
|
+
grantInvoke(grantee: iam.IGrantable): iam.Grant;
|
|
818
|
+
grantInvokeCompositePrincipal(compositePrincipal: iam.CompositePrincipal): iam.Grant[];
|
|
819
|
+
grantInvokeUrl(grantee: iam.IGrantable): iam.Grant;
|
|
820
|
+
grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
|
|
821
|
+
grantInvokeVersion(grantee: iam.IGrantable, version: lambda.IVersion): iam.Grant;
|
|
822
|
+
metric(metricName: string, props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
823
|
+
metricDuration(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
824
|
+
metricErrors(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
825
|
+
metricInvocations(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
826
|
+
metricThrottles(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
827
|
+
get env(): {
|
|
828
|
+
account: string;
|
|
829
|
+
region: string;
|
|
830
|
+
};
|
|
831
|
+
get stack(): Stack;
|
|
832
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
833
|
+
addEnvironment(key: string, value: string): void;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
interface JaypieQueuedLambdaProps extends JaypieLambdaProps {
|
|
837
|
+
batchSize?: number;
|
|
838
|
+
fifo?: boolean;
|
|
839
|
+
visibilityTimeout?: Duration | number;
|
|
840
|
+
}
|
|
841
|
+
declare class JaypieQueuedLambda extends Construct implements lambda.IFunction, sqs.IQueue {
|
|
842
|
+
private readonly _queue;
|
|
843
|
+
private readonly _lambdaConstruct;
|
|
844
|
+
constructor(scope: Construct, id: string, props: JaypieQueuedLambdaProps);
|
|
845
|
+
get queue(): sqs.Queue;
|
|
846
|
+
get lambda(): lambda.Function;
|
|
847
|
+
get functionArn(): string;
|
|
848
|
+
get functionName(): string;
|
|
849
|
+
get grantPrincipal(): iam.IPrincipal;
|
|
850
|
+
get role(): iam.IRole | undefined;
|
|
851
|
+
get architecture(): lambda.Architecture;
|
|
852
|
+
get connections(): ec2.Connections;
|
|
853
|
+
get isBoundToVpc(): boolean;
|
|
854
|
+
get latestVersion(): lambda.IVersion;
|
|
855
|
+
get permissionsNode(): constructs.Node;
|
|
856
|
+
get resourceArnsForGrantInvoke(): string[];
|
|
857
|
+
get functionRef(): lambda.FunctionReference;
|
|
858
|
+
addEventSource(source: lambda.IEventSource): void;
|
|
859
|
+
addEventSourceMapping(id: string, options: lambda.EventSourceMappingOptions): lambda.EventSourceMapping;
|
|
860
|
+
addFunctionUrl(options?: lambda.FunctionUrlOptions): lambda.FunctionUrl;
|
|
861
|
+
addPermission(id: string, permission: lambda.Permission): void;
|
|
862
|
+
addToRolePolicy(statement: iam.PolicyStatement): void;
|
|
863
|
+
configureAsyncInvoke(options: lambda.EventInvokeConfigOptions): void;
|
|
864
|
+
grantInvoke(grantee: iam.IGrantable): iam.Grant;
|
|
865
|
+
grantInvokeCompositePrincipal(compositePrincipal: iam.CompositePrincipal): iam.Grant[];
|
|
866
|
+
grantInvokeUrl(grantee: iam.IGrantable): iam.Grant;
|
|
867
|
+
metric(metricName: string, props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
868
|
+
metricDuration(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
869
|
+
metricErrors(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
870
|
+
metricInvocations(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
871
|
+
metricThrottles(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
872
|
+
grantInvokeLatestVersion(grantee: iam.IGrantable): iam.Grant;
|
|
873
|
+
grantInvokeVersion(grantee: iam.IGrantable, version: lambda.Version): iam.Grant;
|
|
874
|
+
get env(): {
|
|
875
|
+
account: string;
|
|
876
|
+
region: string;
|
|
877
|
+
};
|
|
878
|
+
get stack(): Stack;
|
|
879
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
880
|
+
get queueRef(): {
|
|
881
|
+
queueUrl: string;
|
|
882
|
+
queueArn: string;
|
|
883
|
+
};
|
|
884
|
+
get fifo(): boolean;
|
|
885
|
+
get queueArn(): string;
|
|
886
|
+
get queueName(): string;
|
|
887
|
+
get queueUrl(): string;
|
|
888
|
+
get encryptionMasterKey(): aws_cdk_lib_aws_kms.IKey | undefined;
|
|
889
|
+
addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult;
|
|
890
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
891
|
+
grantConsumeMessages(grantee: iam.IGrantable): iam.Grant;
|
|
892
|
+
grantPurge(grantee: iam.IGrantable): iam.Grant;
|
|
893
|
+
grantSendMessages(grantee: iam.IGrantable): iam.Grant;
|
|
894
|
+
metricApproximateAgeOfOldestMessage(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
895
|
+
metricApproximateNumberOfMessagesDelayed(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
896
|
+
metricApproximateNumberOfMessagesNotVisible(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
897
|
+
metricApproximateNumberOfMessagesVisible(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
898
|
+
metricNumberOfEmptyReceives(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
899
|
+
metricNumberOfMessagesDeleted(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
900
|
+
metricNumberOfMessagesReceived(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
901
|
+
metricNumberOfMessagesSent(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
902
|
+
metricSentMessageSize(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
903
|
+
addEnvironment(key: string, value: string): void;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
interface JaypieBucketQueuedLambdaProps extends JaypieQueuedLambdaProps {
|
|
907
|
+
bucketName?: string;
|
|
908
|
+
bucketOptions?: s3.BucketProps;
|
|
909
|
+
}
|
|
910
|
+
declare class JaypieBucketQueuedLambda extends JaypieQueuedLambda implements s3.IBucket {
|
|
911
|
+
private readonly _bucket;
|
|
912
|
+
constructor(scope: Construct, id: string, props: JaypieBucketQueuedLambdaProps);
|
|
913
|
+
get bucket(): s3.Bucket;
|
|
914
|
+
get bucketArn(): string;
|
|
915
|
+
get bucketDomainName(): string;
|
|
916
|
+
get bucketDualStackDomainName(): string;
|
|
917
|
+
get bucketName(): string;
|
|
918
|
+
get bucketRegionalDomainName(): string;
|
|
919
|
+
get bucketWebsiteDomainName(): string;
|
|
920
|
+
get bucketWebsiteUrl(): string;
|
|
921
|
+
get encryptionKey(): undefined | aws_cdk_lib_aws_kms.IKey;
|
|
922
|
+
get isWebsite(): boolean;
|
|
923
|
+
get policy(): s3.BucketPolicy | undefined;
|
|
924
|
+
addEventNotification(event: s3.EventType, dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
925
|
+
addObjectCreatedNotification(dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
926
|
+
addObjectRemovedNotification(dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
927
|
+
addToResourcePolicy(permission: iam.PolicyStatement): iam.AddToResourcePolicyResult;
|
|
928
|
+
arnForObjects(objectKeyPattern: string): string;
|
|
929
|
+
enableEventBridgeNotification(): void;
|
|
930
|
+
grantDelete(grantee: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
|
931
|
+
grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.Grant;
|
|
932
|
+
grantPut(grantee: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
|
933
|
+
grantPutAcl(grantee: iam.IGrantable, objectsKeyPattern?: string): iam.Grant;
|
|
934
|
+
grantRead(grantee: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
|
935
|
+
grantReadWrite(grantee: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
|
936
|
+
grantWrite(grantee: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
|
937
|
+
onCloudTrailEvent(id: string, options?: s3.OnCloudTrailBucketEventOptions): aws_cdk_lib_aws_events.Rule;
|
|
938
|
+
onCloudTrailPutObject(id: string, options?: s3.OnCloudTrailBucketEventOptions): aws_cdk_lib_aws_events.Rule;
|
|
939
|
+
onCloudTrailWriteObject(id: string, options?: s3.OnCloudTrailBucketEventOptions): aws_cdk_lib_aws_events.Rule;
|
|
940
|
+
s3UrlForObject(key?: string): string;
|
|
941
|
+
transferAccelerationUrlForObject(key?: string, options?: s3.TransferAccelerationUrlOptions): string;
|
|
942
|
+
urlForObject(key?: string): string;
|
|
943
|
+
virtualHostedUrlForObject(key?: string, options?: s3.VirtualHostedStyleUrlOptions): string;
|
|
944
|
+
grantReplicationPermission(identity: iam.IGrantable, props: any): iam.Grant;
|
|
945
|
+
addReplicationPolicy(policy: any): void;
|
|
946
|
+
get bucketRef(): s3.BucketReference;
|
|
947
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
interface JaypieCertificateProps {
|
|
951
|
+
/**
|
|
952
|
+
* Import certificate from a provider stack instead of creating one.
|
|
953
|
+
* When true, imports the certificate ARN via CloudFormation export.
|
|
954
|
+
* @default false
|
|
955
|
+
*/
|
|
956
|
+
consumer?: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* The domain name for the certificate.
|
|
959
|
+
* @default Derived from CDK_ENV_API_HOST_NAME or CDK_ENV_API_SUBDOMAIN + CDK_ENV_API_HOSTED_ZONE
|
|
960
|
+
*/
|
|
961
|
+
domainName?: string;
|
|
962
|
+
/**
|
|
963
|
+
* Export name override for cross-stack sharing.
|
|
964
|
+
* Only used when provider is true.
|
|
965
|
+
* @default Generated from environment and domain
|
|
966
|
+
*/
|
|
967
|
+
export?: string;
|
|
968
|
+
/**
|
|
969
|
+
* Construct ID override. When not provided, ID is auto-generated from domain.
|
|
970
|
+
* Use this to align with certificates created by other constructs.
|
|
971
|
+
* @default Auto-generated as "JaypieCert-{sanitized-domain}"
|
|
972
|
+
*/
|
|
973
|
+
id?: string;
|
|
974
|
+
/**
|
|
975
|
+
* Export certificate ARN for other stacks to import.
|
|
976
|
+
* When true, creates a CloudFormation export that consumer stacks can import.
|
|
977
|
+
* @default false
|
|
978
|
+
*/
|
|
979
|
+
provider?: boolean;
|
|
980
|
+
/**
|
|
981
|
+
* Role tag for tagging the certificate.
|
|
982
|
+
* @default CDK.ROLE.API
|
|
983
|
+
*/
|
|
984
|
+
roleTag?: string;
|
|
985
|
+
/**
|
|
986
|
+
* The hosted zone for DNS validation.
|
|
987
|
+
* @default CDK_ENV_API_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE
|
|
988
|
+
*/
|
|
989
|
+
zone?: string | route53.IHostedZone;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* A standalone certificate construct that can be shared across constructs.
|
|
993
|
+
*
|
|
994
|
+
* Key feature: Uses the same `resolveCertificate()` helper as JaypieDistribution,
|
|
995
|
+
* JaypieApiGateway, etc. This means:
|
|
996
|
+
* - Certificates are created at the stack level and cached by domain
|
|
997
|
+
* - You can "take over" a certificate from another construct by using the same domain
|
|
998
|
+
* - Swapping between JaypieDistribution and JaypieApiGateway won't recreate certs
|
|
999
|
+
*
|
|
1000
|
+
* Supports flexible constructor signatures:
|
|
1001
|
+
* - `new JaypieCertificate(scope)` - uses environment defaults
|
|
1002
|
+
* - `new JaypieCertificate(scope, props)` - ID auto-generated from domain
|
|
1003
|
+
* - `new JaypieCertificate(scope, id, props)` - explicit ID
|
|
1004
|
+
*
|
|
1005
|
+
* @example
|
|
1006
|
+
* // Minimal - uses environment variables for domain/zone
|
|
1007
|
+
* const cert = new JaypieCertificate(this);
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* // With options - ID auto-generated as "JaypieCert-api-example-com"
|
|
1011
|
+
* const cert = new JaypieCertificate(this, {
|
|
1012
|
+
* domainName: "api.example.com",
|
|
1013
|
+
* zone: "example.com",
|
|
1014
|
+
* });
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* // Explicit ID - useful when you need a specific construct ID
|
|
1018
|
+
* const cert = new JaypieCertificate(this, "MyApiCert", {
|
|
1019
|
+
* domainName: "api.example.com",
|
|
1020
|
+
* zone: "example.com",
|
|
1021
|
+
* });
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* // Take over from JaypieDistribution (uses same ID format)
|
|
1025
|
+
* // After removing JaypieDistribution with certificate: true
|
|
1026
|
+
* const cert = new JaypieCertificate(this, {
|
|
1027
|
+
* domainName: "api.example.com",
|
|
1028
|
+
* zone: "example.com",
|
|
1029
|
+
* });
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* // Optional: Provider/consumer pattern for cross-stack sharing
|
|
1033
|
+
* // In sandbox stack (explicitly export):
|
|
1034
|
+
* new JaypieCertificate(this, { provider: true });
|
|
1035
|
+
*
|
|
1036
|
+
* // In personal build (explicitly import):
|
|
1037
|
+
* new JaypieCertificate(this, { consumer: true });
|
|
1038
|
+
*/
|
|
1039
|
+
declare class JaypieCertificate extends Construct implements acm.ICertificate {
|
|
1040
|
+
readonly certificate: acm.ICertificate;
|
|
1041
|
+
readonly certificateArn: string;
|
|
1042
|
+
readonly domainName: string;
|
|
1043
|
+
/**
|
|
1044
|
+
* Create a certificate with environment defaults.
|
|
1045
|
+
*/
|
|
1046
|
+
constructor(scope: Construct);
|
|
1047
|
+
/**
|
|
1048
|
+
* Create a certificate with options (ID auto-generated from domain).
|
|
1049
|
+
*/
|
|
1050
|
+
constructor(scope: Construct, props: JaypieCertificateProps);
|
|
1051
|
+
/**
|
|
1052
|
+
* Create a certificate with explicit ID.
|
|
1053
|
+
*/
|
|
1054
|
+
constructor(scope: Construct, id: string, props?: JaypieCertificateProps);
|
|
1055
|
+
get stack(): Stack;
|
|
1056
|
+
get env(): {
|
|
1057
|
+
account: string;
|
|
1058
|
+
region: string;
|
|
1059
|
+
};
|
|
1060
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
1061
|
+
get certificateRef(): acm.CertificateReference;
|
|
1062
|
+
metricDaysToExpiry(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
interface JaypieDatadogBucketProps extends BucketProps {
|
|
1066
|
+
/**
|
|
1067
|
+
* Optional construct ID
|
|
1068
|
+
* @default "JaypieDatadogBucket"
|
|
1069
|
+
*/
|
|
1070
|
+
id?: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* The scope to use when creating the S3 bucket
|
|
1073
|
+
* @default this (the construct itself)
|
|
1074
|
+
*/
|
|
1075
|
+
bucketScope?: Construct;
|
|
1076
|
+
/**
|
|
1077
|
+
* The ID to use for the S3 bucket construct
|
|
1078
|
+
* @default "DatadogArchiveBucket"
|
|
1079
|
+
*/
|
|
1080
|
+
bucketId?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* The service tag value
|
|
1083
|
+
* @default CDK.SERVICE.DATADOG
|
|
1084
|
+
*/
|
|
1085
|
+
service?: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Optional project tag value
|
|
1088
|
+
*/
|
|
1089
|
+
project?: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* Whether to grant Datadog role access to this bucket
|
|
1092
|
+
* Uses CDK_ENV_DATADOG_ROLE_ARN if set
|
|
1093
|
+
* @default true
|
|
1094
|
+
*/
|
|
1095
|
+
grantDatadogAccess?: boolean;
|
|
1096
|
+
}
|
|
1097
|
+
declare class JaypieDatadogBucket extends Construct {
|
|
1098
|
+
readonly bucket: IBucket;
|
|
1099
|
+
readonly policy?: Policy;
|
|
1100
|
+
/**
|
|
1101
|
+
* Create a new S3 bucket for Datadog log archiving with automatic IAM permissions
|
|
1102
|
+
*/
|
|
1103
|
+
constructor(scope: Construct, idOrProps?: string | JaypieDatadogBucketProps, propsOrUndefined?: JaypieDatadogBucketProps);
|
|
1104
|
+
/**
|
|
1105
|
+
* Grants the Datadog IAM role access to this bucket
|
|
1106
|
+
*
|
|
1107
|
+
* Checks for CDK_ENV_DATADOG_ROLE_ARN environment variable.
|
|
1108
|
+
* If found, creates a custom policy with:
|
|
1109
|
+
* - s3:ListBucket on bucket
|
|
1110
|
+
* - s3:GetObject and s3:PutObject on bucket/*
|
|
1111
|
+
*
|
|
1112
|
+
* @param options - Configuration options
|
|
1113
|
+
* @returns The created Policy, or undefined if CDK_ENV_DATADOG_ROLE_ARN is not set
|
|
1114
|
+
*/
|
|
1115
|
+
private grantDatadogRoleBucketAccess;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
interface JaypieDatadogForwarderProps {
|
|
1119
|
+
/**
|
|
1120
|
+
* Optional construct ID
|
|
1121
|
+
* @default "DatadogForwarder"
|
|
1122
|
+
*/
|
|
1123
|
+
id?: string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Datadog API key
|
|
1126
|
+
* @default process.env.CDK_ENV_DATADOG_API_KEY
|
|
1127
|
+
*/
|
|
1128
|
+
datadogApiKey?: string;
|
|
1129
|
+
/**
|
|
1130
|
+
* Account identifier for Datadog tags
|
|
1131
|
+
* @default process.env.CDK_ENV_ACCOUNT
|
|
1132
|
+
*/
|
|
1133
|
+
account?: string;
|
|
1134
|
+
/**
|
|
1135
|
+
* Reserved concurrency for the forwarder Lambda
|
|
1136
|
+
* Must be a string as required by the CloudFormation template
|
|
1137
|
+
* @default "10"
|
|
1138
|
+
*/
|
|
1139
|
+
reservedConcurrency?: string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Additional Datadog tags (comma-separated)
|
|
1142
|
+
* Will be appended to account tag
|
|
1143
|
+
*/
|
|
1144
|
+
additionalTags?: string;
|
|
1145
|
+
/**
|
|
1146
|
+
* The service tag value
|
|
1147
|
+
* @default CDK.VENDOR.DATADOG
|
|
1148
|
+
*/
|
|
1149
|
+
service?: string;
|
|
1150
|
+
/**
|
|
1151
|
+
* Optional project tag value
|
|
1152
|
+
*/
|
|
1153
|
+
project?: string;
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether to create CloudFormation events rule
|
|
1156
|
+
* @default true
|
|
1157
|
+
*/
|
|
1158
|
+
enableCloudFormationEvents?: boolean;
|
|
1159
|
+
/**
|
|
1160
|
+
* Whether to extend Datadog role with custom permissions
|
|
1161
|
+
* Uses CDK_ENV_DATADOG_ROLE_ARN if set
|
|
1162
|
+
* @default true
|
|
1163
|
+
*/
|
|
1164
|
+
enableRoleExtension?: boolean;
|
|
1165
|
+
/**
|
|
1166
|
+
* Whether to create CloudFormation output for forwarder ARN
|
|
1167
|
+
* @default true
|
|
1168
|
+
*/
|
|
1169
|
+
createOutput?: boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Custom export name for the forwarder ARN output
|
|
1172
|
+
* @default CDK.IMPORT.DATADOG_LOG_FORWARDER
|
|
1173
|
+
*/
|
|
1174
|
+
exportName?: string;
|
|
1175
|
+
/**
|
|
1176
|
+
* URL to Datadog forwarder CloudFormation template
|
|
1177
|
+
* @default "https://datadog-cloudformation-template.s3.amazonaws.com/aws/forwarder/latest.yaml"
|
|
1178
|
+
*/
|
|
1179
|
+
templateUrl?: string;
|
|
1180
|
+
}
|
|
1181
|
+
declare class JaypieDatadogForwarder extends Construct {
|
|
1182
|
+
readonly cfnStack: CfnStack;
|
|
1183
|
+
readonly forwarderFunction: IFunction;
|
|
1184
|
+
readonly eventsRule?: Rule;
|
|
1185
|
+
/**
|
|
1186
|
+
* Create a new Datadog forwarder with CloudFormation nested stack
|
|
1187
|
+
*/
|
|
1188
|
+
constructor(scope: Construct, idOrProps?: string | JaypieDatadogForwarderProps, propsOrUndefined?: JaypieDatadogForwarderProps);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
interface JaypieEnvSecretProps extends JaypieSecretProps {
|
|
1192
|
+
consumer?: boolean;
|
|
1193
|
+
export?: string;
|
|
1194
|
+
provider?: boolean;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* @deprecated Use {@link JaypieSecret}. JaypieEnvSecret layers an
|
|
1198
|
+
* environment-driven provider/consumer cross-stack pattern on top of
|
|
1199
|
+
* JaypieSecret and will be removed in 2.0.
|
|
1200
|
+
*/
|
|
1201
|
+
declare class JaypieEnvSecret extends JaypieSecret {
|
|
1202
|
+
protected static readonly shorthandPrefix: string;
|
|
1203
|
+
constructor(scope: Construct, idOrEnvKey: string, props?: JaypieEnvSecretProps);
|
|
1204
|
+
protected buildSecret(context: BuildSecretContext): secretsmanager.ISecret;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
declare class JaypieDatadogSecret extends JaypieEnvSecret {
|
|
1208
|
+
constructor(scope: Construct, id?: string, props?: JaypieEnvSecretProps);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* One entry in a `waf.allow` list. Names one or more URL paths and, for each
|
|
1213
|
+
* managed rule group key, the sub-rule names to flip from `block` to `count`
|
|
1214
|
+
* on that path set. See JaypieWafConfig.allow.
|
|
1215
|
+
*/
|
|
1216
|
+
interface JaypieWafAllowEntry {
|
|
1217
|
+
/** URL path or paths. Trailing `*` → STARTS_WITH; otherwise EXACTLY. */
|
|
1218
|
+
path: string | string[];
|
|
1219
|
+
/** Managed-rule-group keys (e.g. AWSManagedRulesCommonRuleSet) → sub-rule names. */
|
|
1220
|
+
[ruleGroupKey: string]: string | string[] | undefined;
|
|
1221
|
+
}
|
|
1222
|
+
interface JaypieWafConfig {
|
|
1223
|
+
/**
|
|
1224
|
+
* Unique name for this distribution's WAF resources. Required when passing a
|
|
1225
|
+
* WAF config object. Injected into the WebACL name and WAF log bucket name
|
|
1226
|
+
* so multiple JaypieDistribution instances can coexist in the same
|
|
1227
|
+
* account/env without S3/WAFv2 name collisions.
|
|
1228
|
+
*
|
|
1229
|
+
* Pass `waf: true` (or omit) to retain the legacy, non-namespaced names.
|
|
1230
|
+
*/
|
|
1231
|
+
name: string;
|
|
1232
|
+
/**
|
|
1233
|
+
* Whether WAF is enabled
|
|
1234
|
+
* @default true
|
|
1235
|
+
*/
|
|
1236
|
+
enabled?: boolean;
|
|
1237
|
+
/**
|
|
1238
|
+
* WAF logging bucket.
|
|
1239
|
+
* - true/undefined: create a logging bucket with Datadog forwarding (default)
|
|
1240
|
+
* - false: disable WAF logging
|
|
1241
|
+
* - IBucket: use an existing bucket (must have "aws-waf-logs-" prefix)
|
|
1242
|
+
* @default true
|
|
1243
|
+
*/
|
|
1244
|
+
logBucket?: boolean | s3.IBucket;
|
|
1245
|
+
/**
|
|
1246
|
+
* Override actions for specific rules within managed rule groups.
|
|
1247
|
+
* Key is the managed rule group name; value is an array of rule action overrides.
|
|
1248
|
+
* @example
|
|
1249
|
+
* managedRuleOverrides: {
|
|
1250
|
+
* AWSManagedRulesCommonRuleSet: [
|
|
1251
|
+
* { name: "SizeRestrictions_BODY", actionToUse: { count: {} } },
|
|
1252
|
+
* ],
|
|
1253
|
+
* }
|
|
1254
|
+
*/
|
|
1255
|
+
managedRuleOverrides?: Record<string, wafv2.CfnWebACL.RuleActionOverrideProperty[]>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Optional scope-down statements per managed rule group. When supplied,
|
|
1258
|
+
* the managed rule group only evaluates requests that match the
|
|
1259
|
+
* scope-down statement. Key is the managed rule group name; value is a
|
|
1260
|
+
* `CfnWebACL.StatementProperty`.
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* // Only run AWSManagedRulesCommonRuleSet for non-/chat paths
|
|
1264
|
+
* managedRuleScopeDowns: {
|
|
1265
|
+
* AWSManagedRulesCommonRuleSet: {
|
|
1266
|
+
* notStatement: {
|
|
1267
|
+
* statement: {
|
|
1268
|
+
* byteMatchStatement: {
|
|
1269
|
+
* fieldToMatch: { uriPath: {} },
|
|
1270
|
+
* positionalConstraint: "STARTS_WITH",
|
|
1271
|
+
* searchString: "/chat",
|
|
1272
|
+
* textTransformations: [{ priority: 0, type: "NONE" }],
|
|
1273
|
+
* },
|
|
1274
|
+
* },
|
|
1275
|
+
* },
|
|
1276
|
+
* },
|
|
1277
|
+
* }
|
|
1278
|
+
*/
|
|
1279
|
+
managedRuleScopeDowns?: Record<string, wafv2.CfnWebACL.StatementProperty>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Managed rule group names to apply
|
|
1282
|
+
* @default ["AWSManagedRulesCommonRuleSet", "AWSManagedRulesKnownBadInputsRuleSet"]
|
|
1283
|
+
*/
|
|
1284
|
+
managedRules?: string[];
|
|
1285
|
+
/**
|
|
1286
|
+
* Rate limit per IP per 5-minute window
|
|
1287
|
+
* @default 2000
|
|
1288
|
+
*/
|
|
1289
|
+
rateLimitPerIp?: number;
|
|
1290
|
+
/**
|
|
1291
|
+
* Path-scoped relaxations layered on top of the default managed-rule groups.
|
|
1292
|
+
* Each entry names one or more URL paths and, for each managed rule group
|
|
1293
|
+
* key, the sub-rule names to flip from `block` to `count` on that path set.
|
|
1294
|
+
* Strict default action is preserved on every other path.
|
|
1295
|
+
*
|
|
1296
|
+
* Composes with `managedRuleOverrides`: the baseline override list applies
|
|
1297
|
+
* to both the relaxed and strict emissions of a group; entries in `allow`
|
|
1298
|
+
* additionally relax specific (path × sub-rule) intersections.
|
|
1299
|
+
*
|
|
1300
|
+
* @example
|
|
1301
|
+
* allow: [
|
|
1302
|
+
* {
|
|
1303
|
+
* path: "/hooks/*",
|
|
1304
|
+
* AWSManagedRulesCommonRuleSet: ["ExploitablePaths_URIPATH"],
|
|
1305
|
+
* AWSManagedRulesKnownBadInputsRuleSet: ["CrossSiteScripting_BODY"],
|
|
1306
|
+
* },
|
|
1307
|
+
* ]
|
|
1308
|
+
*/
|
|
1309
|
+
allow?: JaypieWafAllowEntry | JaypieWafAllowEntry[];
|
|
1310
|
+
/**
|
|
1311
|
+
* Use an existing WebACL ARN instead of creating one
|
|
1312
|
+
*/
|
|
1313
|
+
webAclArn?: string;
|
|
1314
|
+
}
|
|
1315
|
+
interface SecurityHeadersOverrides {
|
|
1316
|
+
contentSecurityPolicy?: string;
|
|
1317
|
+
frameOption?: cloudfront.HeadersFrameOption;
|
|
1318
|
+
hstsIncludeSubdomains?: boolean;
|
|
1319
|
+
hstsMaxAge?: number;
|
|
1320
|
+
permissionsPolicy?: string;
|
|
1321
|
+
referrerPolicy?: cloudfront.HeadersReferrerPolicy;
|
|
1322
|
+
}
|
|
1323
|
+
interface JaypieDistributionProps extends Omit<cloudfront.DistributionProps, "certificate" | "defaultBehavior" | "logBucket"> {
|
|
1324
|
+
/**
|
|
1325
|
+
* SSL certificate for the CloudFront distribution
|
|
1326
|
+
* @default true (creates a new certificate)
|
|
1327
|
+
*/
|
|
1328
|
+
certificate?: boolean | acm.ICertificate;
|
|
1329
|
+
/**
|
|
1330
|
+
* Override default behavior (optional if handler is provided)
|
|
1331
|
+
*/
|
|
1332
|
+
defaultBehavior?: cloudfront.BehaviorOptions;
|
|
1333
|
+
/**
|
|
1334
|
+
* Force-delete any existing Route53 A and AAAA records with the same name
|
|
1335
|
+
* before creating the alias records. Useful when migrating from another
|
|
1336
|
+
* construct (e.g., JaypieApiGateway) that already owns the same hostname,
|
|
1337
|
+
* where the default CloudFormation create-before-delete ordering would
|
|
1338
|
+
* otherwise collide on the record name.
|
|
1339
|
+
* @default false
|
|
1340
|
+
*/
|
|
1341
|
+
deleteExistingRecord?: boolean;
|
|
1342
|
+
/**
|
|
1343
|
+
* Log destination configuration for CloudFront access logs
|
|
1344
|
+
* - LambdaDestination: Use a specific Lambda destination for S3 notifications
|
|
1345
|
+
* - true: Use Datadog forwarder for S3 notifications (default)
|
|
1346
|
+
* - false: Disable S3 notifications (logging still occurs if logBucket is set)
|
|
1347
|
+
* @default true
|
|
1348
|
+
*/
|
|
1349
|
+
destination?: LambdaDestination | boolean;
|
|
1350
|
+
/**
|
|
1351
|
+
* External log bucket for CloudFront access logs.
|
|
1352
|
+
* - IBucket: Use existing bucket directly
|
|
1353
|
+
* - string: Bucket name to import
|
|
1354
|
+
* - { exportName: string }: CloudFormation export name to import
|
|
1355
|
+
* - true: Use account logging bucket (CDK.IMPORT.LOG_BUCKET)
|
|
1356
|
+
* @default undefined (creates new bucket if destination !== false)
|
|
1357
|
+
*/
|
|
1358
|
+
logBucket?: s3.IBucket | string | {
|
|
1359
|
+
exportName: string;
|
|
1360
|
+
} | true;
|
|
1361
|
+
/**
|
|
1362
|
+
* The origin handler - can be an IOrigin, IFunctionUrl, or IFunction
|
|
1363
|
+
* If IFunction, a FunctionUrl will be created with auth NONE
|
|
1364
|
+
*/
|
|
1365
|
+
handler?: cloudfront.IOrigin | lambda.IFunctionUrl | lambda.IFunction;
|
|
1366
|
+
/**
|
|
1367
|
+
* The domain name for the distribution.
|
|
1368
|
+
*
|
|
1369
|
+
* Supports both string and config object:
|
|
1370
|
+
* - String: used directly as the domain name (e.g., "api.example.com")
|
|
1371
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
1372
|
+
* - { subdomain, domain, env, component }
|
|
1373
|
+
*
|
|
1374
|
+
* @default mergeDomain(CDK_ENV_API_SUBDOMAIN, CDK_ENV_API_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE)
|
|
1375
|
+
*
|
|
1376
|
+
* @example
|
|
1377
|
+
* // Direct string
|
|
1378
|
+
* host: "api.example.com"
|
|
1379
|
+
*
|
|
1380
|
+
* @example
|
|
1381
|
+
* // Config object - resolves using envHostname()
|
|
1382
|
+
* host: { subdomain: "api" }
|
|
1383
|
+
*/
|
|
1384
|
+
host?: string | HostConfig;
|
|
1385
|
+
/**
|
|
1386
|
+
* Enable response streaming for Lambda Function URLs.
|
|
1387
|
+
* Use with createLambdaStreamHandler for SSE/streaming responses.
|
|
1388
|
+
* @default false
|
|
1389
|
+
*/
|
|
1390
|
+
streaming?: boolean;
|
|
1391
|
+
/**
|
|
1392
|
+
* Origin read timeout - how long CloudFront waits for a response from the origin.
|
|
1393
|
+
* This is the maximum time allowed for the origin to respond.
|
|
1394
|
+
* @default CDK.DURATION.CLOUDFRONT_API (120 seconds)
|
|
1395
|
+
* @max Duration.seconds(120)
|
|
1396
|
+
*/
|
|
1397
|
+
originReadTimeout?: Duration;
|
|
1398
|
+
/**
|
|
1399
|
+
* Full override for the response headers policy.
|
|
1400
|
+
* When provided, bypasses all default security header logic.
|
|
1401
|
+
*/
|
|
1402
|
+
responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy;
|
|
1403
|
+
/**
|
|
1404
|
+
* Security headers configuration.
|
|
1405
|
+
* - true/undefined: apply sensible defaults (HSTS, X-Frame-Options, CSP, etc.)
|
|
1406
|
+
* - false: disable security headers entirely
|
|
1407
|
+
* - SecurityHeadersOverrides object: merge overrides with defaults
|
|
1408
|
+
* @default true
|
|
1409
|
+
*/
|
|
1410
|
+
securityHeaders?: boolean | SecurityHeadersOverrides;
|
|
1411
|
+
/**
|
|
1412
|
+
* Role tag for tagging resources
|
|
1413
|
+
* @default CDK.ROLE.HOSTING
|
|
1414
|
+
*/
|
|
1415
|
+
roleTag?: string;
|
|
1416
|
+
/**
|
|
1417
|
+
* Service tag for attributing this distribution to a service (parallel to
|
|
1418
|
+
* `roleTag`, matching `JaypieLambda`). When set, the distribution is tagged
|
|
1419
|
+
* with `CDK.TAG.SERVICE` (so metrics carry `service:<value>` instead of
|
|
1420
|
+
* `service:N/A`) and the created access-log and WAF-log buckets are tagged
|
|
1421
|
+
* with the same value, so the Datadog forwarder attributes their forwarded
|
|
1422
|
+
* logs to the service instead of the generic `cloudfront`/source default.
|
|
1423
|
+
*
|
|
1424
|
+
* Omit to preserve current behavior (no service tag). Has no effect on
|
|
1425
|
+
* external/imported log buckets, which this construct does not own.
|
|
1426
|
+
* @default undefined (no service tag)
|
|
1427
|
+
*/
|
|
1428
|
+
serviceTag?: string;
|
|
1429
|
+
/**
|
|
1430
|
+
* WAF WebACL configuration for the CloudFront distribution.
|
|
1431
|
+
* - true/undefined: create and attach a WebACL with sensible defaults
|
|
1432
|
+
* - false: disable WAF
|
|
1433
|
+
* - JaypieWafConfig: customize WAF behavior
|
|
1434
|
+
* @default true
|
|
1435
|
+
*/
|
|
1436
|
+
waf?: boolean | JaypieWafConfig;
|
|
1437
|
+
/**
|
|
1438
|
+
* The hosted zone for DNS records
|
|
1439
|
+
* @default CDK_ENV_API_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE
|
|
1440
|
+
*/
|
|
1441
|
+
zone?: string | route53.IHostedZone;
|
|
1442
|
+
}
|
|
1443
|
+
declare class JaypieDistribution extends Construct implements cloudfront.IDistribution {
|
|
1444
|
+
readonly certificate?: acm.ICertificate;
|
|
1445
|
+
readonly distribution: cloudfront.Distribution;
|
|
1446
|
+
readonly distributionArn: string;
|
|
1447
|
+
readonly distributionDomainName: string;
|
|
1448
|
+
readonly distributionId: string;
|
|
1449
|
+
readonly domainName: string;
|
|
1450
|
+
readonly functionUrl?: lambda.FunctionUrl;
|
|
1451
|
+
readonly host?: string;
|
|
1452
|
+
readonly logBucket?: s3.IBucket;
|
|
1453
|
+
readonly responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy;
|
|
1454
|
+
readonly wafLogBucket?: s3.IBucket;
|
|
1455
|
+
readonly webAcl?: wafv2.CfnWebACL;
|
|
1456
|
+
constructor(scope: Construct, id: string, props: JaypieDistributionProps);
|
|
1457
|
+
private isIOrigin;
|
|
1458
|
+
private isIFunctionUrl;
|
|
1459
|
+
private isIFunction;
|
|
1460
|
+
private isExportNameObject;
|
|
1461
|
+
private resolveWafConfig;
|
|
1462
|
+
private resolveLogBucket;
|
|
1463
|
+
get env(): {
|
|
1464
|
+
account: string;
|
|
1465
|
+
region: string;
|
|
1466
|
+
};
|
|
1467
|
+
get stack(): Stack;
|
|
1468
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
1469
|
+
grant(identity: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
1470
|
+
grantCreateInvalidation(identity: iam.IGrantable): iam.Grant;
|
|
1471
|
+
get distributionRef(): cloudfront.DistributionReference;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
interface JaypieDnsRecordProps {
|
|
1475
|
+
/**
|
|
1476
|
+
* Optional comment to add to the DNS record
|
|
1477
|
+
*/
|
|
1478
|
+
comment?: string;
|
|
1479
|
+
/**
|
|
1480
|
+
* Optional record name (subdomain). If not provided, creates record at zone apex
|
|
1481
|
+
*/
|
|
1482
|
+
recordName?: string;
|
|
1483
|
+
/**
|
|
1484
|
+
* Time to live for the DNS record
|
|
1485
|
+
* @default CDK.DNS.CONFIG.TTL (5 minutes)
|
|
1486
|
+
*/
|
|
1487
|
+
ttl?: cdk.Duration;
|
|
1488
|
+
/**
|
|
1489
|
+
* The DNS record type (A, CNAME, MX, NS, TXT)
|
|
1490
|
+
*/
|
|
1491
|
+
type: string;
|
|
1492
|
+
/**
|
|
1493
|
+
* Values for the DNS record. Format depends on record type:
|
|
1494
|
+
* - A: Array of IPv4 addresses (e.g., ["1.2.3.4", "5.6.7.8"])
|
|
1495
|
+
* - CNAME: Single domain name as first element (e.g., ["example.com"])
|
|
1496
|
+
* - MX: Array of objects with priority and hostName (e.g., [{priority: 10, hostName: "mail.example.com"}])
|
|
1497
|
+
* - NS: Array of name server addresses (e.g., ["ns1.example.com", "ns2.example.com"])
|
|
1498
|
+
* - TXT: Array of text values (e.g., ["v=spf1 include:example.com ~all"])
|
|
1499
|
+
*/
|
|
1500
|
+
values: string[] | Array<{
|
|
1501
|
+
hostName: string;
|
|
1502
|
+
priority: number;
|
|
1503
|
+
}>;
|
|
1504
|
+
/**
|
|
1505
|
+
* The hosted zone where the record will be created.
|
|
1506
|
+
* Can be either:
|
|
1507
|
+
* - A string (zone name) - will lookup the hosted zone by domain name
|
|
1508
|
+
* - An IHostedZone object - will use the provided zone directly
|
|
1509
|
+
*/
|
|
1510
|
+
zone: string | IHostedZone;
|
|
1511
|
+
}
|
|
1512
|
+
declare class JaypieDnsRecord extends Construct {
|
|
1513
|
+
readonly record: ARecord | CnameRecord | MxRecord | NsRecord | TxtRecord;
|
|
1514
|
+
constructor(scope: Construct, id: string, props: JaypieDnsRecordProps);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* GSI index definition for JaypieDynamoDb.
|
|
1519
|
+
*
|
|
1520
|
+
* Shape mirrors `@jaypie/fabric`'s IndexDefinition so a single object can be
|
|
1521
|
+
* shared between CDK provisioning (here) and runtime model code (fabric).
|
|
1522
|
+
* The type is owned locally so `@jaypie/constructs` does not take a runtime
|
|
1523
|
+
* dependency on the pre-1.0 `@jaypie/fabric` package.
|
|
1524
|
+
*
|
|
1525
|
+
* - `pk` fields are combined with a separator to form the partition key attribute
|
|
1526
|
+
* - `sk` with one field uses that field directly as the GSI sort key
|
|
1527
|
+
* - `sk` with multiple fields produces a composite `{indexName}Sk` attribute
|
|
1528
|
+
*/
|
|
1529
|
+
interface IndexDefinition {
|
|
1530
|
+
/** Name of the index (auto-generated from pk fields if not provided) */
|
|
1531
|
+
name?: string;
|
|
1532
|
+
/** Partition key fields - combined with separator */
|
|
1533
|
+
pk: string[];
|
|
1534
|
+
/** Sort key fields - combined with separator when composite */
|
|
1535
|
+
sk?: string[];
|
|
1536
|
+
/** Advisory: index key is only written when all pk/sk fields are present */
|
|
1537
|
+
sparse?: boolean;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "globalSecondaryIndexes" | "partitionKey" | "sortKey"> {
|
|
1541
|
+
/**
|
|
1542
|
+
* Configure GSIs for the table using the IndexDefinition format.
|
|
1543
|
+
* - `undefined`: No GSIs (default)
|
|
1544
|
+
* - Array of IndexDefinition: Use the specified indexes
|
|
1545
|
+
*
|
|
1546
|
+
* @example
|
|
1547
|
+
* // No GSIs (default)
|
|
1548
|
+
* new JaypieDynamoDb(this, "myTable");
|
|
1549
|
+
*
|
|
1550
|
+
* @example
|
|
1551
|
+
* // Inline indexes
|
|
1552
|
+
* new JaypieDynamoDb(this, "myTable", {
|
|
1553
|
+
* indexes: [
|
|
1554
|
+
* { name: "indexModel", pk: ["model"], sk: ["scope", "updatedAt"] },
|
|
1555
|
+
* { name: "indexModelAlias", pk: ["model", "alias"], sk: ["scope", "updatedAt"], sparse: true },
|
|
1556
|
+
* ],
|
|
1557
|
+
* });
|
|
1558
|
+
*/
|
|
1559
|
+
indexes?: IndexDefinition[];
|
|
1560
|
+
/**
|
|
1561
|
+
* Partition key attribute definition.
|
|
1562
|
+
* @default { name: "id", type: AttributeType.STRING }
|
|
1563
|
+
*/
|
|
1564
|
+
partitionKey?: dynamodb.Attribute;
|
|
1565
|
+
/**
|
|
1566
|
+
* Optional project identifier for tagging
|
|
1567
|
+
*/
|
|
1568
|
+
project?: string;
|
|
1569
|
+
/**
|
|
1570
|
+
* Optional role tag for the table
|
|
1571
|
+
*/
|
|
1572
|
+
roleTag?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* Optional service identifier for tagging
|
|
1575
|
+
*/
|
|
1576
|
+
service?: string;
|
|
1577
|
+
/**
|
|
1578
|
+
* Sort key attribute definition. Defaults to `undefined` (no sort key) —
|
|
1579
|
+
* the Jaypie single-table pattern uses `id` as a unique partition key.
|
|
1580
|
+
*/
|
|
1581
|
+
sortKey?: dynamodb.Attribute;
|
|
1582
|
+
/**
|
|
1583
|
+
* Optional vendor tag for the table
|
|
1584
|
+
*/
|
|
1585
|
+
vendorTag?: string;
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* DynamoDB table with Jaypie single-table design patterns.
|
|
1589
|
+
*
|
|
1590
|
+
* Creates a table with:
|
|
1591
|
+
* - Partition key: `id` (String), no sort key
|
|
1592
|
+
* - Billing: PAY_PER_REQUEST (on-demand)
|
|
1593
|
+
* - Removal policy: RETAIN in production, DESTROY otherwise
|
|
1594
|
+
* - No GSIs by default (use `indexes` prop to add them)
|
|
1595
|
+
* - Table name: CDK-generated (includes stack name and unique suffix)
|
|
1596
|
+
*
|
|
1597
|
+
* @example
|
|
1598
|
+
* // Shorthand: construct id is "JaypieDynamoDb-myApp", table name is CDK-generated
|
|
1599
|
+
* const table = new JaypieDynamoDb(this, "myApp");
|
|
1600
|
+
*
|
|
1601
|
+
* @example
|
|
1602
|
+
* // With inline IndexDefinition for GSIs
|
|
1603
|
+
* const table = new JaypieDynamoDb(this, "MyTable", {
|
|
1604
|
+
* tableName: "custom-table-name",
|
|
1605
|
+
* indexes: [
|
|
1606
|
+
* { name: "indexModel", pk: ["model"], sk: ["scope", "updatedAt"] },
|
|
1607
|
+
* { name: "indexModelAlias", pk: ["model", "alias"], sk: ["scope", "updatedAt"], sparse: true },
|
|
1608
|
+
* ],
|
|
1609
|
+
* });
|
|
1610
|
+
*/
|
|
1611
|
+
declare class JaypieDynamoDb extends Construct implements dynamodb.ITableV2 {
|
|
1612
|
+
private readonly _table;
|
|
1613
|
+
constructor(scope: Construct, id: string, props?: JaypieDynamoDbProps);
|
|
1614
|
+
/**
|
|
1615
|
+
* The underlying DynamoDB TableV2 construct
|
|
1616
|
+
*/
|
|
1617
|
+
get table(): dynamodb.TableV2;
|
|
1618
|
+
get env(): cdk.ResourceEnvironment;
|
|
1619
|
+
get stack(): cdk.Stack;
|
|
1620
|
+
get tableArn(): string;
|
|
1621
|
+
get tableId(): string | undefined;
|
|
1622
|
+
get tableName(): string;
|
|
1623
|
+
get tableRef(): dynamodb.TableReference;
|
|
1624
|
+
get tableStreamArn(): string | undefined;
|
|
1625
|
+
get encryptionKey(): aws_cdk_lib_aws_kms.IKey | undefined;
|
|
1626
|
+
get grants(): dynamodb.TableGrants;
|
|
1627
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
1628
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
1629
|
+
grantFullAccess(grantee: iam.IGrantable): iam.Grant;
|
|
1630
|
+
grantReadData(grantee: iam.IGrantable): iam.Grant;
|
|
1631
|
+
grantReadWriteData(grantee: iam.IGrantable): iam.Grant;
|
|
1632
|
+
grantStream(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
1633
|
+
grantStreamRead(grantee: iam.IGrantable): iam.Grant;
|
|
1634
|
+
grantTableListStreams(grantee: iam.IGrantable): iam.Grant;
|
|
1635
|
+
grantWriteData(grantee: iam.IGrantable): iam.Grant;
|
|
1636
|
+
metric(metricName: string, props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1637
|
+
metricConditionalCheckFailedRequests(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1638
|
+
metricConsumedReadCapacityUnits(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1639
|
+
metricConsumedWriteCapacityUnits(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1640
|
+
metricSuccessfulRequestLatency(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1641
|
+
metricSystemErrorsForOperations(props?: dynamodb.SystemErrorsForOperationsMetricOptions): aws_cdk_lib_aws_cloudwatch.IMetric;
|
|
1642
|
+
metricThrottledRequests(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1643
|
+
metricThrottledRequestsForOperations(props?: dynamodb.OperationsMetricOptions): aws_cdk_lib_aws_cloudwatch.IMetric;
|
|
1644
|
+
metricUserErrors(props?: aws_cdk_lib_aws_cloudwatch.MetricOptions): aws_cdk_lib_aws_cloudwatch.Metric;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
interface JaypieEventsRuleProps extends Omit<RuleProps, "targets"> {
|
|
1648
|
+
/**
|
|
1649
|
+
* Optional construct ID
|
|
1650
|
+
* @default Generated from source or "EventsRule"
|
|
1651
|
+
*/
|
|
1652
|
+
id?: string;
|
|
1653
|
+
/**
|
|
1654
|
+
* Event source(s) to match
|
|
1655
|
+
* @default undefined
|
|
1656
|
+
*/
|
|
1657
|
+
source?: string | string[];
|
|
1658
|
+
/**
|
|
1659
|
+
* Lambda function to target
|
|
1660
|
+
* Can be:
|
|
1661
|
+
* - An IFunction instance
|
|
1662
|
+
* - undefined (will resolve Datadog forwarder)
|
|
1663
|
+
* @default Resolves Datadog forwarder via resolveDatadogForwarderFunction
|
|
1664
|
+
*/
|
|
1665
|
+
targetFunction?: IFunction;
|
|
1666
|
+
/**
|
|
1667
|
+
* The service tag value
|
|
1668
|
+
* @default CDK.SERVICE.DATADOG
|
|
1669
|
+
*/
|
|
1670
|
+
service?: string;
|
|
1671
|
+
/**
|
|
1672
|
+
* The vendor tag value
|
|
1673
|
+
* @default CDK.VENDOR.DATADOG
|
|
1674
|
+
*/
|
|
1675
|
+
vendor?: string;
|
|
1676
|
+
/**
|
|
1677
|
+
* Optional project tag value
|
|
1678
|
+
*/
|
|
1679
|
+
project?: string;
|
|
1680
|
+
}
|
|
1681
|
+
declare class JaypieEventsRule extends Construct {
|
|
1682
|
+
readonly rule: Rule;
|
|
1683
|
+
readonly targetFunction: IFunction;
|
|
1684
|
+
/**
|
|
1685
|
+
* Create a new EventBridge rule that targets a Lambda function
|
|
1686
|
+
*/
|
|
1687
|
+
constructor(scope: Construct, idOrSourceOrProps?: string | JaypieEventsRuleProps, propsOrUndefined?: JaypieEventsRuleProps);
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
declare class JaypieExpressLambda extends JaypieLambda {
|
|
1691
|
+
constructor(scope: Construct, id: string, props: JaypieLambdaProps);
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
interface JaypieGitHubDeployRoleProps {
|
|
1695
|
+
ecr?: boolean;
|
|
1696
|
+
oidcProviderArn?: string;
|
|
1697
|
+
output?: boolean | string;
|
|
1698
|
+
repoRestriction?: string;
|
|
1699
|
+
sponsor?: string;
|
|
1700
|
+
}
|
|
1701
|
+
declare class JaypieGitHubDeployRole extends Construct {
|
|
1702
|
+
private readonly _role;
|
|
1703
|
+
constructor(scope: Construct, id?: string, props?: JaypieGitHubDeployRoleProps);
|
|
1704
|
+
get role(): Role;
|
|
1705
|
+
get roleArn(): string;
|
|
1706
|
+
get roleName(): string;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* DNS record configuration for JaypieHostedZone
|
|
1711
|
+
* Omits 'zone' since it will be automatically set to the created hosted zone
|
|
1712
|
+
*/
|
|
1713
|
+
interface JaypieHostedZoneRecordProps extends Omit<JaypieDnsRecordProps, "zone"> {
|
|
1714
|
+
/**
|
|
1715
|
+
* Optional ID for the DNS record construct
|
|
1716
|
+
* @default Generated from record type and name
|
|
1717
|
+
*/
|
|
1718
|
+
id?: string;
|
|
1719
|
+
}
|
|
1720
|
+
interface JaypieHostedZoneProps {
|
|
1721
|
+
/**
|
|
1722
|
+
* Optional construct ID
|
|
1723
|
+
* @default `${zoneName}-HostedZone`
|
|
1724
|
+
*/
|
|
1725
|
+
id?: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* The domain name for the hosted zone
|
|
1728
|
+
*/
|
|
1729
|
+
zoneName: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* The service tag value
|
|
1732
|
+
* @default CDK.SERVICE.INFRASTRUCTURE
|
|
1733
|
+
*/
|
|
1734
|
+
service?: string;
|
|
1735
|
+
/**
|
|
1736
|
+
* Optional project tag value
|
|
1737
|
+
*/
|
|
1738
|
+
project?: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* Log destination configuration
|
|
1741
|
+
* - LambdaDestination: Use a specific Lambda destination
|
|
1742
|
+
* - true: Use Datadog logging destination (default)
|
|
1743
|
+
* - false: Do not use a destination
|
|
1744
|
+
* @default true
|
|
1745
|
+
*/
|
|
1746
|
+
destination?: LambdaDestination$1 | boolean;
|
|
1747
|
+
/**
|
|
1748
|
+
* Optional DNS records to create for this hosted zone
|
|
1749
|
+
* Each record will be created as a JaypieDnsRecord construct
|
|
1750
|
+
*/
|
|
1751
|
+
records?: JaypieHostedZoneRecordProps[];
|
|
1752
|
+
/**
|
|
1753
|
+
* Control the CloudWatch Logs resource policy that grants Route53 permission
|
|
1754
|
+
* to write query logs. Defaults to `true`, which ensures a single
|
|
1755
|
+
* stack-level wildcard policy covering every `/aws/route53/*` log group.
|
|
1756
|
+
* Set to `false` to skip creating a managed policy (useful when an
|
|
1757
|
+
* account-wide policy is provisioned externally).
|
|
1758
|
+
* @default true
|
|
1759
|
+
*/
|
|
1760
|
+
queryLoggingPolicy?: boolean;
|
|
1761
|
+
}
|
|
1762
|
+
declare class JaypieHostedZone extends Construct {
|
|
1763
|
+
readonly hostedZone: IHostedZone;
|
|
1764
|
+
readonly logGroup: ILogGroup;
|
|
1765
|
+
readonly dnsRecords: JaypieDnsRecord[];
|
|
1766
|
+
/**
|
|
1767
|
+
* Create a new hosted zone with query logging and optional DNS records
|
|
1768
|
+
*/
|
|
1769
|
+
constructor(scope: Construct, idOrProps: string | JaypieHostedZoneProps, propsOrRecords?: JaypieHostedZoneProps | JaypieHostedZoneRecordProps[]);
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
declare class JaypieInfrastructureStack extends JaypieStack {
|
|
1773
|
+
constructor(scope: Construct, id: string, props?: JaypieStackProps);
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
interface JaypieMigrationProps {
|
|
1777
|
+
/** Path to the bundled migration code (esbuild output directory) */
|
|
1778
|
+
code: lambda.Code | string;
|
|
1779
|
+
/** Constructs that must be created before the migration runs */
|
|
1780
|
+
dependencies?: Construct[];
|
|
1781
|
+
/** Environment variables for the migration Lambda */
|
|
1782
|
+
environment?: Record<string, string> | (Record<string, string> | string)[];
|
|
1783
|
+
/** Lambda handler entry point */
|
|
1784
|
+
handler?: string;
|
|
1785
|
+
/** Polling interval between isCompleteHandler invocations. Default: 60 seconds. */
|
|
1786
|
+
queryInterval?: cdk.Duration;
|
|
1787
|
+
/** Secrets to make available to the migration Lambda */
|
|
1788
|
+
secrets?: SecretsArrayItem[];
|
|
1789
|
+
/** DynamoDB tables to grant read/write access */
|
|
1790
|
+
tables?: dynamodb.ITable[];
|
|
1791
|
+
/** Lambda timeout per invocation. Defaults to 15 minutes (Lambda max). */
|
|
1792
|
+
timeout?: cdk.Duration;
|
|
1793
|
+
/** Maximum total wall time across all isCompleteHandler invocations. Default: 2 hours. */
|
|
1794
|
+
totalTimeout?: cdk.Duration;
|
|
1795
|
+
}
|
|
1796
|
+
declare class JaypieMigration extends Construct {
|
|
1797
|
+
readonly lambda: JaypieLambda;
|
|
1798
|
+
constructor(scope: Construct, id: string, props: JaypieMigrationProps);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
declare class JaypieMongoDbSecret extends JaypieEnvSecret {
|
|
1802
|
+
constructor(scope: Construct, id?: string, props?: JaypieEnvSecretProps);
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
/**
|
|
1806
|
+
* @deprecated Use HostConfig instead. This alias is kept for backwards compatibility.
|
|
1807
|
+
*/
|
|
1808
|
+
type DomainNameConfig = HostConfig;
|
|
1809
|
+
interface JaypieNextjsProps {
|
|
1810
|
+
datadogApiKeyArn?: string;
|
|
1811
|
+
/**
|
|
1812
|
+
* Domain name for the Next.js application.
|
|
1813
|
+
*
|
|
1814
|
+
* Supports both string and config object:
|
|
1815
|
+
* - String: used directly as the domain name
|
|
1816
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
1817
|
+
* - { component, domain, env, subdomain }
|
|
1818
|
+
*
|
|
1819
|
+
* To deploy without a domain (CloudFront URL only), set domainProps: false
|
|
1820
|
+
*/
|
|
1821
|
+
domainName?: string | DomainNameConfig;
|
|
1822
|
+
/**
|
|
1823
|
+
* Set to false to deploy without a custom domain.
|
|
1824
|
+
* When false, the application will only be accessible via CloudFront URL.
|
|
1825
|
+
* This overrides any domainName configuration.
|
|
1826
|
+
*/
|
|
1827
|
+
domainProps?: false;
|
|
1828
|
+
/**
|
|
1829
|
+
* Environment variables for the Next.js application.
|
|
1830
|
+
*
|
|
1831
|
+
* Supports both legacy object syntax and new array syntax:
|
|
1832
|
+
* - Object: { KEY: "value" } - directly sets environment variables
|
|
1833
|
+
* - Array: ["KEY1", "KEY2", { KEY3: "value" }]
|
|
1834
|
+
* - Strings: lookup value from process.env
|
|
1835
|
+
* - Objects: merge key-value pairs directly
|
|
1836
|
+
*/
|
|
1837
|
+
environment?: EnvironmentInput;
|
|
1838
|
+
envSecrets?: {
|
|
1839
|
+
[key: string]: secretsmanager.ISecret;
|
|
1840
|
+
};
|
|
1841
|
+
hostedZone?: IHostedZone | string;
|
|
1842
|
+
nextjsPath?: string;
|
|
1843
|
+
/**
|
|
1844
|
+
* Secrets to make available to the Next.js application.
|
|
1845
|
+
*
|
|
1846
|
+
* Supports both JaypieSecret instances and strings:
|
|
1847
|
+
* - JaypieSecret (including JaypieEnvSecret): used directly
|
|
1848
|
+
* - String: creates a JaypieEnvSecret with the string as envKey
|
|
1849
|
+
* (reuses existing secrets within the same scope)
|
|
1850
|
+
*/
|
|
1851
|
+
secrets?: SecretsArrayItem[];
|
|
1852
|
+
/**
|
|
1853
|
+
* Enable response streaming for the Next.js server function.
|
|
1854
|
+
* When true, enables Lambda response streaming for faster TTFB.
|
|
1855
|
+
*/
|
|
1856
|
+
streaming?: boolean;
|
|
1857
|
+
/**
|
|
1858
|
+
* DynamoDB tables to grant read/write access to the Next.js server function.
|
|
1859
|
+
* Each table is granted read/write access and if exactly one table is provided,
|
|
1860
|
+
* the DYNAMODB_TABLE_NAME environment variable is set to the table name.
|
|
1861
|
+
*/
|
|
1862
|
+
tables?: dynamodb.ITable[];
|
|
1863
|
+
}
|
|
1864
|
+
declare class JaypieNextJs extends Construct {
|
|
1865
|
+
private readonly _nextjs;
|
|
1866
|
+
readonly domainName?: string;
|
|
1867
|
+
constructor(scope: Construct, id: string, props?: JaypieNextjsProps);
|
|
1868
|
+
/** S3 bucket for static assets */
|
|
1869
|
+
get bucket(): s3.IBucket;
|
|
1870
|
+
/** CloudFront distribution */
|
|
1871
|
+
get distribution(): cdk_nextjs_standalone.NextjsDistribution;
|
|
1872
|
+
/** Route53 domain configuration */
|
|
1873
|
+
get domain(): cdk_nextjs_standalone.NextjsDomain | undefined;
|
|
1874
|
+
/** Image optimization Lambda function */
|
|
1875
|
+
get imageOptimizationFunction(): cdk_nextjs_standalone.NextjsImage;
|
|
1876
|
+
/** Image optimization Lambda function URL */
|
|
1877
|
+
get imageOptimizationLambdaFunctionUrl(): lambda.FunctionUrl;
|
|
1878
|
+
/** Server Lambda function URL */
|
|
1879
|
+
get lambdaFunctionUrl(): lambda.FunctionUrl;
|
|
1880
|
+
/** Next.js build output */
|
|
1881
|
+
get nextBuild(): cdk_nextjs_standalone.NextjsBuild;
|
|
1882
|
+
/** ISR revalidation configuration */
|
|
1883
|
+
get revalidation(): cdk_nextjs_standalone.NextjsRevalidation;
|
|
1884
|
+
/** Next.js server function */
|
|
1885
|
+
get serverFunction(): cdk_nextjs_standalone.NextjsServer;
|
|
1886
|
+
/** Static assets configuration */
|
|
1887
|
+
get staticAssets(): cdk_nextjs_standalone.NextjsStaticAssets;
|
|
1888
|
+
/** CloudFront distribution URL */
|
|
1889
|
+
get url(): string;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
declare class JaypieOpenAiSecret extends JaypieEnvSecret {
|
|
1893
|
+
constructor(scope: Construct, id?: string, props?: JaypieEnvSecretProps);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
interface JaypieOrganizationTrailProps {
|
|
1897
|
+
/**
|
|
1898
|
+
* Optional construct ID
|
|
1899
|
+
* @default Generated from trail name
|
|
1900
|
+
*/
|
|
1901
|
+
id?: string;
|
|
1902
|
+
/**
|
|
1903
|
+
* The name of the CloudTrail trail
|
|
1904
|
+
* @default Uses PROJECT_NONCE: `organization-cloudtrail-${PROJECT_NONCE}`
|
|
1905
|
+
*/
|
|
1906
|
+
trailName?: string;
|
|
1907
|
+
/**
|
|
1908
|
+
* The name of the S3 bucket for CloudTrail logs
|
|
1909
|
+
* @default Uses PROJECT_NONCE: `organization-cloudtrail-${PROJECT_NONCE}`
|
|
1910
|
+
*/
|
|
1911
|
+
bucketName?: string;
|
|
1912
|
+
/**
|
|
1913
|
+
* The service tag value
|
|
1914
|
+
* @default CDK.SERVICE.INFRASTRUCTURE
|
|
1915
|
+
*/
|
|
1916
|
+
service?: string;
|
|
1917
|
+
/**
|
|
1918
|
+
* Optional project tag value
|
|
1919
|
+
*/
|
|
1920
|
+
project?: string;
|
|
1921
|
+
/**
|
|
1922
|
+
* Whether to enable IAM Access Analyzer (organization-level)
|
|
1923
|
+
* @default true
|
|
1924
|
+
*/
|
|
1925
|
+
enableAccessAnalyzer?: boolean;
|
|
1926
|
+
/**
|
|
1927
|
+
* Whether to enable file validation for the trail
|
|
1928
|
+
* @default true
|
|
1929
|
+
*/
|
|
1930
|
+
enableFileValidation?: boolean;
|
|
1931
|
+
/**
|
|
1932
|
+
* Whether to enable Lambda data events in CloudTrail
|
|
1933
|
+
* @default true
|
|
1934
|
+
*/
|
|
1935
|
+
enableLambdaDataEvents?: boolean;
|
|
1936
|
+
/**
|
|
1937
|
+
* Whether to enable S3 data events in CloudTrail
|
|
1938
|
+
* @default false (opt-in due to potential high volume/cost)
|
|
1939
|
+
*/
|
|
1940
|
+
enableS3DataEvents?: boolean;
|
|
1941
|
+
/**
|
|
1942
|
+
* Number of days before logs expire
|
|
1943
|
+
* @default 365
|
|
1944
|
+
*/
|
|
1945
|
+
expirationDays?: number;
|
|
1946
|
+
/**
|
|
1947
|
+
* Number of days before transitioning to INFREQUENT_ACCESS storage
|
|
1948
|
+
* @default 30
|
|
1949
|
+
*/
|
|
1950
|
+
infrequentAccessTransitionDays?: number;
|
|
1951
|
+
/**
|
|
1952
|
+
* Number of days before transitioning to GLACIER storage
|
|
1953
|
+
* @default 180
|
|
1954
|
+
*/
|
|
1955
|
+
glacierTransitionDays?: number;
|
|
1956
|
+
/**
|
|
1957
|
+
* Whether to send S3 notifications to Datadog forwarder
|
|
1958
|
+
* @default true
|
|
1959
|
+
*/
|
|
1960
|
+
enableDatadogNotifications?: boolean;
|
|
1961
|
+
}
|
|
1962
|
+
declare class JaypieOrganizationTrail extends Construct {
|
|
1963
|
+
readonly analyzer?: CfnAnalyzer;
|
|
1964
|
+
readonly bucket: IBucket;
|
|
1965
|
+
readonly trail: Trail;
|
|
1966
|
+
/**
|
|
1967
|
+
* Create a new organization CloudTrail with S3 bucket and lifecycle policies
|
|
1968
|
+
*/
|
|
1969
|
+
constructor(scope: Construct, idOrProps?: string | JaypieOrganizationTrailProps, propsOrUndefined?: JaypieOrganizationTrailProps);
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
/**
|
|
1973
|
+
* Mapping of account IDs to permission set names
|
|
1974
|
+
* Key: AWS account ID
|
|
1975
|
+
* Value: Array of permission set names to assign to this account
|
|
1976
|
+
*/
|
|
1977
|
+
interface AccountAssignments {
|
|
1978
|
+
[accountId: string]: string[];
|
|
1979
|
+
}
|
|
1980
|
+
/**
|
|
1981
|
+
* Properties for the JaypieSsoPermissions construct
|
|
1982
|
+
*/
|
|
1983
|
+
interface JaypieSsoPermissionsProps {
|
|
1984
|
+
/**
|
|
1985
|
+
* ARN of the IAM Identity Center instance
|
|
1986
|
+
* If not provided, falls back to CDK_ENV_IAM_IDENTITY_CENTER_ARN
|
|
1987
|
+
* If neither is set, SSO setup will be skipped
|
|
1988
|
+
*/
|
|
1989
|
+
iamIdentityCenterArn?: string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Google Workspace group GUID for administrators
|
|
1992
|
+
* Example: "b4c8b438-4031-7000-782d-5046945fb956"
|
|
1993
|
+
*/
|
|
1994
|
+
administratorGroupId?: string;
|
|
1995
|
+
/**
|
|
1996
|
+
* Google Workspace group GUID for analysts
|
|
1997
|
+
* Example: "2488f4e8-d061-708e-abe1-c315f0e30005"
|
|
1998
|
+
*/
|
|
1999
|
+
analystGroupId?: string;
|
|
2000
|
+
/**
|
|
2001
|
+
* Google Workspace group GUID for developers
|
|
2002
|
+
* Example: "b438a4f8-e0e1-707c-c6e8-21841daf9ad1"
|
|
2003
|
+
*/
|
|
2004
|
+
developerGroupId?: string;
|
|
2005
|
+
/**
|
|
2006
|
+
* Account assignments for administrator group
|
|
2007
|
+
* Maps account IDs to arrays of permission set names
|
|
2008
|
+
* Example:
|
|
2009
|
+
* {
|
|
2010
|
+
* "211125635435": ["Administrator", "Analyst"],
|
|
2011
|
+
* "381492033431": ["Administrator"],
|
|
2012
|
+
* }
|
|
2013
|
+
*/
|
|
2014
|
+
administratorAccountAssignments?: AccountAssignments;
|
|
2015
|
+
/**
|
|
2016
|
+
* Account assignments for analyst group
|
|
2017
|
+
* Maps account IDs to arrays of permission set names
|
|
2018
|
+
* Example:
|
|
2019
|
+
* {
|
|
2020
|
+
* "211125635435": ["Analyst"],
|
|
2021
|
+
* "381492033431": ["Analyst"],
|
|
2022
|
+
* }
|
|
2023
|
+
*/
|
|
2024
|
+
analystAccountAssignments?: AccountAssignments;
|
|
2025
|
+
/**
|
|
2026
|
+
* Account assignments for developer group
|
|
2027
|
+
* Maps account IDs to arrays of permission set names
|
|
2028
|
+
* Example:
|
|
2029
|
+
* {
|
|
2030
|
+
* "211125635435": ["Developer"],
|
|
2031
|
+
* }
|
|
2032
|
+
*/
|
|
2033
|
+
developerAccountAssignments?: AccountAssignments;
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* JaypieSsoPermissions Construct
|
|
2037
|
+
*
|
|
2038
|
+
* Creates and manages AWS IAM Identity Center (SSO) permission sets and assignments
|
|
2039
|
+
*
|
|
2040
|
+
* @example
|
|
2041
|
+
* const permissionSets = new JaypieSsoPermissions(this, "PermissionSets", {
|
|
2042
|
+
* iamIdentityCenterArn: "arn:aws:sso:::instance/...",
|
|
2043
|
+
* administratorGroupId: "b4c8b438-4031-7000-782d-5046945fb956",
|
|
2044
|
+
* analystGroupId: "2488f4e8-d061-708e-abe1-c315f0e30005",
|
|
2045
|
+
* developerGroupId: "b438a4f8-e0e1-707c-c6e8-21841daf9ad1",
|
|
2046
|
+
* administratorAccountAssignments: {
|
|
2047
|
+
* "211125635435": ["Administrator", "Analyst", "Developer"],
|
|
2048
|
+
* "381492033431": ["Administrator", "Analyst"],
|
|
2049
|
+
* },
|
|
2050
|
+
* analystAccountAssignments: {
|
|
2051
|
+
* "211125635435": ["Analyst", "Developer"],
|
|
2052
|
+
* "381492033431": [],
|
|
2053
|
+
* },
|
|
2054
|
+
* developerAccountAssignments: {
|
|
2055
|
+
* "211125635435": ["Analyst", "Developer"],
|
|
2056
|
+
* "381492033431": [],
|
|
2057
|
+
* },
|
|
2058
|
+
* });
|
|
2059
|
+
*/
|
|
2060
|
+
declare class JaypieSsoPermissions extends Construct {
|
|
2061
|
+
readonly administratorPermissionSet?: CfnPermissionSet;
|
|
2062
|
+
readonly analystPermissionSet?: CfnPermissionSet;
|
|
2063
|
+
readonly developerPermissionSet?: CfnPermissionSet;
|
|
2064
|
+
constructor(scope: Construct, id: string, props: JaypieSsoPermissionsProps);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
interface JaypieSsoSyncApplicationProps {
|
|
2068
|
+
googleAdminEmail?: string;
|
|
2069
|
+
googleAdminEmailEnvKey?: string;
|
|
2070
|
+
googleCredentials?: string;
|
|
2071
|
+
googleCredentialsEnvKey?: string;
|
|
2072
|
+
googleGroupMatch?: string;
|
|
2073
|
+
googleGroupMatchEnvKey?: string;
|
|
2074
|
+
identityStoreId?: string;
|
|
2075
|
+
identityStoreIdEnvKey?: string;
|
|
2076
|
+
scimEndpointAccessToken?: string;
|
|
2077
|
+
scimEndpointAccessTokenEnvKey?: string;
|
|
2078
|
+
scimEndpointUrl?: string;
|
|
2079
|
+
scimEndpointUrlEnvKey?: string;
|
|
2080
|
+
semanticVersion?: string;
|
|
2081
|
+
semanticVersionEnvKey?: string;
|
|
2082
|
+
ssoSyncApplicationId?: string;
|
|
2083
|
+
tags?: {
|
|
2084
|
+
[key: string]: string;
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
declare class JaypieSsoSyncApplication extends Construct {
|
|
2088
|
+
private readonly _application;
|
|
2089
|
+
constructor(scope: Construct, id?: string, props?: JaypieSsoSyncApplicationProps);
|
|
2090
|
+
get application(): CfnApplication;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* WAF configuration for JaypieWebDeploymentBucket. Same shape as
|
|
2095
|
+
* JaypieDistribution's JaypieWafConfig, but `name` is optional — when omitted,
|
|
2096
|
+
* the construct id is used to namespace the WebACL and WAF log bucket.
|
|
2097
|
+
*/
|
|
2098
|
+
type JaypieWebDeploymentBucketWafConfig = Omit<JaypieWafConfig, "name"> & {
|
|
2099
|
+
name?: string;
|
|
2100
|
+
};
|
|
2101
|
+
interface JaypieWebDeploymentBucketProps extends s3.BucketProps {
|
|
2102
|
+
/**
|
|
2103
|
+
* SSL certificate for the CloudFront distribution
|
|
2104
|
+
* @default true (creates a new certificate)
|
|
2105
|
+
*/
|
|
2106
|
+
certificate?: boolean | acm.ICertificate;
|
|
2107
|
+
/**
|
|
2108
|
+
* Log destination configuration for CloudFront access logs.
|
|
2109
|
+
* - LambdaDestination: Use a specific Lambda destination for S3 notifications
|
|
2110
|
+
* - true: Use Datadog forwarder for S3 notifications (default)
|
|
2111
|
+
* - false: Disable S3 notifications (logging still occurs if logBucket is set)
|
|
2112
|
+
* @default true
|
|
2113
|
+
*/
|
|
2114
|
+
destination?: LambdaDestination | boolean;
|
|
2115
|
+
/**
|
|
2116
|
+
* The domain name for the website.
|
|
2117
|
+
*
|
|
2118
|
+
* Supports both string and config object:
|
|
2119
|
+
* - String: used directly as the domain name (e.g., "app.example.com")
|
|
2120
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
2121
|
+
* - { subdomain, domain, env, component }
|
|
2122
|
+
*
|
|
2123
|
+
* @default mergeDomain(CDK_ENV_WEB_SUBDOMAIN, CDK_ENV_WEB_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE)
|
|
2124
|
+
*
|
|
2125
|
+
* @example
|
|
2126
|
+
* // Direct string
|
|
2127
|
+
* host: "app.example.com"
|
|
2128
|
+
*
|
|
2129
|
+
* @example
|
|
2130
|
+
* // Config object - resolves using envHostname()
|
|
2131
|
+
* host: { subdomain: "app" }
|
|
2132
|
+
*/
|
|
2133
|
+
host?: string | HostConfig;
|
|
2134
|
+
/**
|
|
2135
|
+
* External log bucket for CloudFront access logs.
|
|
2136
|
+
* - IBucket: Use existing bucket directly
|
|
2137
|
+
* - string: Bucket name to import
|
|
2138
|
+
* - { exportName: string }: CloudFormation export name to import
|
|
2139
|
+
* - true: Use account logging bucket (CDK.IMPORT.LOG_BUCKET)
|
|
2140
|
+
* @default undefined (creates new bucket if destination !== false)
|
|
2141
|
+
*/
|
|
2142
|
+
logBucket?: s3.IBucket | string | {
|
|
2143
|
+
exportName: string;
|
|
2144
|
+
} | true;
|
|
2145
|
+
/**
|
|
2146
|
+
* Optional bucket name
|
|
2147
|
+
*/
|
|
2148
|
+
name?: string;
|
|
2149
|
+
/**
|
|
2150
|
+
* Full override for the response headers policy.
|
|
2151
|
+
* When provided, bypasses all default security header logic.
|
|
2152
|
+
*/
|
|
2153
|
+
responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy;
|
|
2154
|
+
/**
|
|
2155
|
+
* Role tag for tagging resources
|
|
2156
|
+
* @default CDK.ROLE.HOSTING
|
|
2157
|
+
*/
|
|
2158
|
+
roleTag?: string;
|
|
2159
|
+
/**
|
|
2160
|
+
* Security headers configuration.
|
|
2161
|
+
* - true/undefined: apply sensible defaults (HSTS, X-Frame-Options, CSP, etc.)
|
|
2162
|
+
* - false: disable security headers entirely
|
|
2163
|
+
* - SecurityHeadersOverrides object: merge overrides with defaults
|
|
2164
|
+
* @default true
|
|
2165
|
+
*/
|
|
2166
|
+
securityHeaders?: boolean | SecurityHeadersOverrides;
|
|
2167
|
+
/**
|
|
2168
|
+
* WAF WebACL configuration for the CloudFront distribution.
|
|
2169
|
+
* - true/undefined: create and attach a WebACL with sensible defaults; the
|
|
2170
|
+
* construct id is used to namespace the WebACL and WAF log bucket
|
|
2171
|
+
* - false: disable WAF
|
|
2172
|
+
* - JaypieWebDeploymentBucketWafConfig: customize WAF behavior; if `name`
|
|
2173
|
+
* is omitted the construct id is used
|
|
2174
|
+
* @default true
|
|
2175
|
+
*/
|
|
2176
|
+
waf?: boolean | JaypieWebDeploymentBucketWafConfig;
|
|
2177
|
+
/**
|
|
2178
|
+
* The hosted zone for DNS records
|
|
2179
|
+
* @default CDK_ENV_WEB_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE
|
|
2180
|
+
*/
|
|
2181
|
+
zone?: string | route53.IHostedZone | JaypieHostedZone;
|
|
2182
|
+
}
|
|
2183
|
+
declare class JaypieWebDeploymentBucket extends Construct implements s3.IBucket {
|
|
2184
|
+
readonly bucket: s3.Bucket;
|
|
2185
|
+
readonly bucketArn: string;
|
|
2186
|
+
readonly bucketDomainName: string;
|
|
2187
|
+
readonly bucketDualStackDomainName: string;
|
|
2188
|
+
readonly bucketName: string;
|
|
2189
|
+
readonly bucketRegionalDomainName: string;
|
|
2190
|
+
readonly bucketWebsiteDomainName: string;
|
|
2191
|
+
readonly bucketWebsiteUrl: string;
|
|
2192
|
+
readonly encryptionKey?: aws_cdk_lib_aws_kms.IKey;
|
|
2193
|
+
readonly isWebsite?: boolean;
|
|
2194
|
+
readonly notificationsHandlerRole?: string;
|
|
2195
|
+
readonly policy?: s3.BucketPolicy;
|
|
2196
|
+
readonly deployRoleArn?: string;
|
|
2197
|
+
readonly distributionDomainName?: string;
|
|
2198
|
+
readonly certificate?: acm.ICertificate;
|
|
2199
|
+
readonly distribution?: cloudfront.Distribution;
|
|
2200
|
+
readonly logBucket?: s3.IBucket;
|
|
2201
|
+
readonly responseHeadersPolicy?: cloudfront.IResponseHeadersPolicy;
|
|
2202
|
+
readonly wafLogBucket?: s3.IBucket;
|
|
2203
|
+
readonly webAcl?: wafv2.CfnWebACL;
|
|
2204
|
+
constructor(scope: Construct, id: string, props?: JaypieWebDeploymentBucketProps);
|
|
2205
|
+
/**
|
|
2206
|
+
* Emit stack-level CfnOutputs with stable, hash-free logical IDs so they can
|
|
2207
|
+
* be read directly from `cdk-outputs.json` without prefix-matching. Skips
|
|
2208
|
+
* outputs whose underlying resource is absent.
|
|
2209
|
+
*
|
|
2210
|
+
* Logical IDs (with optional `prefix`):
|
|
2211
|
+
* - `${prefix}DestinationBucketName`
|
|
2212
|
+
* - `${prefix}DestinationBucketDeployRoleArn` (when a deploy role exists)
|
|
2213
|
+
* - `${prefix}DistributionId` (when a distribution exists)
|
|
2214
|
+
* - `${prefix}CertificateArn` (when a certificate exists)
|
|
2215
|
+
*
|
|
2216
|
+
* @returns map of created outputs keyed by their logical ID
|
|
2217
|
+
*/
|
|
2218
|
+
exportOutputs(options?: {
|
|
2219
|
+
prefix?: string;
|
|
2220
|
+
scope?: Construct;
|
|
2221
|
+
}): Record<string, CfnOutput>;
|
|
2222
|
+
private resolveWafConfig;
|
|
2223
|
+
private isExportNameObject;
|
|
2224
|
+
private resolveLogBucket;
|
|
2225
|
+
addEventNotification(event: s3.EventType, dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
2226
|
+
addObjectCreatedNotification(dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
2227
|
+
addObjectRemovedNotification(dest: s3.IBucketNotificationDestination, ...filters: s3.NotificationKeyFilter[]): void;
|
|
2228
|
+
addToResourcePolicy(permission: PolicyStatement): AddToResourcePolicyResult;
|
|
2229
|
+
arnForObjects(keyPattern: string): string;
|
|
2230
|
+
grantDelete(identity: any, objectsKeyPattern?: any): any;
|
|
2231
|
+
grantPublicAccess(allowedActions: string, keyPrefix?: string): any;
|
|
2232
|
+
grantPut(identity: any, objectsKeyPattern?: any): any;
|
|
2233
|
+
grantPutAcl(identity: any, objectsKeyPattern?: string): any;
|
|
2234
|
+
grantRead(identity: any, objectsKeyPattern?: any): any;
|
|
2235
|
+
grantReadWrite(identity: any, objectsKeyPattern?: any): any;
|
|
2236
|
+
grantWrite(identity: any, objectsKeyPattern?: any): any;
|
|
2237
|
+
grantReplicationPermission(identity: any, props: any): any;
|
|
2238
|
+
s3UrlForObject(key?: string): string;
|
|
2239
|
+
urlForObject(key?: string): string;
|
|
2240
|
+
virtualHostedUrlForObject(key?: string, options?: s3.VirtualHostedStyleUrlOptions): string;
|
|
2241
|
+
transferAccelerationUrlForObject(key?: string): string;
|
|
2242
|
+
onCloudTrailEvent(id: string, options?: s3.OnCloudTrailBucketEventOptions): any;
|
|
2243
|
+
onCloudTrailPutObject(id: string, options?: s3.OnCloudTrailBucketEventOptions): any;
|
|
2244
|
+
onCloudTrailWriteObject(id: string, options?: s3.OnCloudTrailBucketEventOptions): any;
|
|
2245
|
+
addCorsRule(rule: s3.CorsRule): void;
|
|
2246
|
+
addInventory(inventory: s3.Inventory): void;
|
|
2247
|
+
addLifecycleRule(rule: s3.LifecycleRule): void;
|
|
2248
|
+
addMetric(metric: s3.BucketMetrics): void;
|
|
2249
|
+
enableEventBridgeNotification(): void;
|
|
2250
|
+
addReplicationPolicy(policy: any): void;
|
|
2251
|
+
get stack(): any;
|
|
2252
|
+
get env(): any;
|
|
2253
|
+
applyRemovalPolicy(policy: RemovalPolicy): void;
|
|
2254
|
+
get bucketRef(): s3.BucketReference;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
interface JaypieStaticWebBucketProps extends Omit<JaypieWebDeploymentBucketProps, "host" | "name" | "roleTag"> {
|
|
2258
|
+
/**
|
|
2259
|
+
* The domain name for the website. Accepts a string or a HostConfig
|
|
2260
|
+
* object resolved via envHostname().
|
|
2261
|
+
* @default envHostname({ subdomain: "static" })
|
|
2262
|
+
*/
|
|
2263
|
+
host?: string | HostConfig;
|
|
2264
|
+
/**
|
|
2265
|
+
* Optional bucket name
|
|
2266
|
+
* @default constructEnvName("static")
|
|
2267
|
+
*/
|
|
2268
|
+
name?: string;
|
|
2269
|
+
/**
|
|
2270
|
+
* Role tag for tagging resources
|
|
2271
|
+
* @default CDK.ROLE.HOSTING
|
|
2272
|
+
*/
|
|
2273
|
+
roleTag?: string;
|
|
2274
|
+
}
|
|
2275
|
+
declare class JaypieStaticWebBucket extends JaypieWebDeploymentBucket {
|
|
2276
|
+
constructor(scope: Construct, id?: string | JaypieStaticWebBucketProps, props?: JaypieStaticWebBucketProps);
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
declare class JaypieTraceSigningKeySecret extends JaypieEnvSecret {
|
|
2280
|
+
constructor(scope: Construct, id?: string, props?: JaypieEnvSecretProps);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
interface JaypieWebSocketProps {
|
|
2284
|
+
/**
|
|
2285
|
+
* Certificate configuration.
|
|
2286
|
+
* - true: Create certificate at stack level (default, reusable)
|
|
2287
|
+
* - false: No certificate (use regional endpoint)
|
|
2288
|
+
* - ICertificate: Use provided certificate
|
|
2289
|
+
* - string: Import certificate from ARN
|
|
2290
|
+
*/
|
|
2291
|
+
certificate?: boolean | acm.ICertificate | string;
|
|
2292
|
+
/**
|
|
2293
|
+
* Lambda handler for $connect route (connection established).
|
|
2294
|
+
* Use this to validate connections (e.g., auth tokens) and store connection IDs.
|
|
2295
|
+
*/
|
|
2296
|
+
connect?: lambda.IFunction;
|
|
2297
|
+
/**
|
|
2298
|
+
* Lambda handler for $default route (catches unmatched messages).
|
|
2299
|
+
* Use this as the main message handler.
|
|
2300
|
+
*/
|
|
2301
|
+
default?: lambda.IFunction;
|
|
2302
|
+
/**
|
|
2303
|
+
* Lambda handler for $disconnect route (connection closed).
|
|
2304
|
+
* Use this to clean up connection IDs from storage.
|
|
2305
|
+
*/
|
|
2306
|
+
disconnect?: lambda.IFunction;
|
|
2307
|
+
/**
|
|
2308
|
+
* Single Lambda handler for all routes.
|
|
2309
|
+
* Alternative to providing separate connect/disconnect/default handlers.
|
|
2310
|
+
* The handler receives routeKey in the context to determine which route was invoked.
|
|
2311
|
+
*/
|
|
2312
|
+
handler?: lambda.IFunction;
|
|
2313
|
+
/**
|
|
2314
|
+
* The domain name for the WebSocket API.
|
|
2315
|
+
*
|
|
2316
|
+
* Supports both string and config object:
|
|
2317
|
+
* - String: used directly as the domain name (e.g., "ws.example.com")
|
|
2318
|
+
* - Object: passed to envHostname() to construct the domain name
|
|
2319
|
+
* - { subdomain, domain, env, component }
|
|
2320
|
+
*
|
|
2321
|
+
* @example
|
|
2322
|
+
* // Direct string
|
|
2323
|
+
* host: "ws.example.com"
|
|
2324
|
+
*
|
|
2325
|
+
* @example
|
|
2326
|
+
* // Config object - resolves using envHostname()
|
|
2327
|
+
* host: { component: "ws" }
|
|
2328
|
+
*/
|
|
2329
|
+
host?: string | HostConfig;
|
|
2330
|
+
/**
|
|
2331
|
+
* Log retention for WebSocket API access logs.
|
|
2332
|
+
* @default logs.RetentionDays.THREE_MONTHS
|
|
2333
|
+
*/
|
|
2334
|
+
logRetention?: logs.RetentionDays;
|
|
2335
|
+
/**
|
|
2336
|
+
* Construct name (used for resource naming).
|
|
2337
|
+
*/
|
|
2338
|
+
name?: string;
|
|
2339
|
+
/**
|
|
2340
|
+
* Role tag for tagging resources.
|
|
2341
|
+
* @default CDK.ROLE.API
|
|
2342
|
+
*/
|
|
2343
|
+
roleTag?: string;
|
|
2344
|
+
/**
|
|
2345
|
+
* Additional named routes beyond $connect, $disconnect, and $default.
|
|
2346
|
+
* Keys are route keys (e.g., "sendMessage", "subscribe").
|
|
2347
|
+
*/
|
|
2348
|
+
routes?: Record<string, lambda.IFunction>;
|
|
2349
|
+
/**
|
|
2350
|
+
* Stage name for the WebSocket API.
|
|
2351
|
+
* @default "production"
|
|
2352
|
+
*/
|
|
2353
|
+
stageName?: string;
|
|
2354
|
+
/**
|
|
2355
|
+
* Route53 hosted zone for DNS records.
|
|
2356
|
+
* - string: Zone domain name (looked up or imported)
|
|
2357
|
+
* - IHostedZone: Use provided hosted zone
|
|
2358
|
+
*/
|
|
2359
|
+
zone?: string | route53.IHostedZone;
|
|
2360
|
+
}
|
|
2361
|
+
declare class JaypieWebSocket extends Construct {
|
|
2362
|
+
private readonly _api;
|
|
2363
|
+
private readonly _certificate?;
|
|
2364
|
+
private readonly _domainName?;
|
|
2365
|
+
private readonly _host?;
|
|
2366
|
+
private readonly _stage;
|
|
2367
|
+
constructor(scope: Construct, id: string, props?: JaypieWebSocketProps);
|
|
2368
|
+
get api(): apigatewayv2.WebSocketApi;
|
|
2369
|
+
get apiId(): string;
|
|
2370
|
+
get certificate(): acm.ICertificate | undefined;
|
|
2371
|
+
get domainName(): string | undefined;
|
|
2372
|
+
/**
|
|
2373
|
+
* The WebSocket endpoint URL.
|
|
2374
|
+
* Uses custom domain if configured, otherwise returns the default stage URL.
|
|
2375
|
+
*/
|
|
2376
|
+
get endpoint(): string;
|
|
2377
|
+
get host(): string | undefined;
|
|
2378
|
+
get stage(): apigatewayv2.WebSocketStage;
|
|
2379
|
+
/**
|
|
2380
|
+
* The callback URL for API Gateway Management API.
|
|
2381
|
+
* Use this URL to send messages to connected clients.
|
|
2382
|
+
*/
|
|
2383
|
+
get callbackUrl(): string;
|
|
2384
|
+
/**
|
|
2385
|
+
* Grant a Lambda function permission to manage WebSocket connections
|
|
2386
|
+
* (post messages to connections, get connection info, delete connections).
|
|
2387
|
+
*/
|
|
2388
|
+
grantManageConnections(grantee: lambda.IFunction): iam.Grant;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* JaypieWebSocketLambda - A Lambda function optimized for WebSocket handlers.
|
|
2393
|
+
*
|
|
2394
|
+
* Provides sensible defaults for WebSocket event handling:
|
|
2395
|
+
* - 30 second timeout (same as API handlers)
|
|
2396
|
+
* - API role tag
|
|
2397
|
+
*
|
|
2398
|
+
* @example
|
|
2399
|
+
* ```typescript
|
|
2400
|
+
* const handler = new JaypieWebSocketLambda(this, "ChatHandler", {
|
|
2401
|
+
* code: "dist/handlers",
|
|
2402
|
+
* handler: "chat.handler",
|
|
2403
|
+
* secrets: ["MONGODB_URI"],
|
|
2404
|
+
* });
|
|
2405
|
+
*
|
|
2406
|
+
* new JaypieWebSocket(this, "Chat", {
|
|
2407
|
+
* host: "ws.example.com",
|
|
2408
|
+
* handler,
|
|
2409
|
+
* });
|
|
2410
|
+
* ```
|
|
2411
|
+
*/
|
|
2412
|
+
declare class JaypieWebSocketLambda extends JaypieLambda {
|
|
2413
|
+
constructor(scope: Construct, id: string, props: JaypieLambdaProps);
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
interface JaypieWebSocketTableProps {
|
|
2417
|
+
/**
|
|
2418
|
+
* Explicit table name. If not provided, uses CDK-generated name.
|
|
2419
|
+
*/
|
|
2420
|
+
tableName?: string;
|
|
2421
|
+
/**
|
|
2422
|
+
* Time-to-live duration for connections.
|
|
2423
|
+
* Connections will be automatically deleted after this duration.
|
|
2424
|
+
* @default Duration.hours(24)
|
|
2425
|
+
*/
|
|
2426
|
+
ttl?: Duration;
|
|
2427
|
+
/**
|
|
2428
|
+
* Whether to create a GSI for looking up connections by user ID.
|
|
2429
|
+
* @default false
|
|
2430
|
+
*/
|
|
2431
|
+
userIndex?: boolean;
|
|
2432
|
+
/**
|
|
2433
|
+
* Role tag for tagging resources.
|
|
2434
|
+
* @default CDK.ROLE.STORAGE
|
|
2435
|
+
*/
|
|
2436
|
+
roleTag?: string;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* JaypieWebSocketTable - DynamoDB table for storing WebSocket connection IDs.
|
|
2440
|
+
*
|
|
2441
|
+
* Provides a simple table structure for tracking active WebSocket connections:
|
|
2442
|
+
* - Partition key: connectionId (String)
|
|
2443
|
+
* - TTL attribute: expiresAt (for automatic cleanup)
|
|
2444
|
+
* - Optional GSI: userId-index (for looking up connections by user)
|
|
2445
|
+
*
|
|
2446
|
+
* @example
|
|
2447
|
+
* ```typescript
|
|
2448
|
+
* const connectionTable = new JaypieWebSocketTable(this, "Connections");
|
|
2449
|
+
*
|
|
2450
|
+
* const ws = new JaypieWebSocket(this, "Chat", {
|
|
2451
|
+
* host: "ws.example.com",
|
|
2452
|
+
* handler: chatHandler,
|
|
2453
|
+
* });
|
|
2454
|
+
*
|
|
2455
|
+
* // Grant Lambda access to the table
|
|
2456
|
+
* connectionTable.grantReadWriteData(chatHandler);
|
|
2457
|
+
*
|
|
2458
|
+
* // Pass table name to Lambda
|
|
2459
|
+
* chatHandler.addEnvironment("CONNECTION_TABLE", connectionTable.tableName);
|
|
2460
|
+
* ```
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* // With user index for looking up all connections for a user
|
|
2464
|
+
* const connectionTable = new JaypieWebSocketTable(this, "Connections", {
|
|
2465
|
+
* userIndex: true,
|
|
2466
|
+
* ttl: Duration.hours(12),
|
|
2467
|
+
* });
|
|
2468
|
+
*/
|
|
2469
|
+
declare class JaypieWebSocketTable extends Construct {
|
|
2470
|
+
private readonly _table;
|
|
2471
|
+
private readonly _ttlDuration;
|
|
2472
|
+
constructor(scope: Construct, id: string, props?: JaypieWebSocketTableProps);
|
|
2473
|
+
/**
|
|
2474
|
+
* The underlying DynamoDB TableV2 construct.
|
|
2475
|
+
*/
|
|
2476
|
+
get table(): dynamodb.TableV2;
|
|
2477
|
+
/**
|
|
2478
|
+
* The name of the DynamoDB table.
|
|
2479
|
+
*/
|
|
2480
|
+
get tableName(): string;
|
|
2481
|
+
/**
|
|
2482
|
+
* The ARN of the DynamoDB table.
|
|
2483
|
+
*/
|
|
2484
|
+
get tableArn(): string;
|
|
2485
|
+
/**
|
|
2486
|
+
* TTL duration for connections in seconds.
|
|
2487
|
+
* Use this to calculate expiresAt when storing connections.
|
|
2488
|
+
*/
|
|
2489
|
+
get ttlSeconds(): number;
|
|
2490
|
+
/**
|
|
2491
|
+
* Grant read permissions to the table.
|
|
2492
|
+
*/
|
|
2493
|
+
grantReadData(grantee: iam.IGrantable): iam.Grant;
|
|
2494
|
+
/**
|
|
2495
|
+
* Grant write permissions to the table.
|
|
2496
|
+
*/
|
|
2497
|
+
grantWriteData(grantee: iam.IGrantable): iam.Grant;
|
|
2498
|
+
/**
|
|
2499
|
+
* Grant read and write permissions to the table.
|
|
2500
|
+
*/
|
|
2501
|
+
grantReadWriteData(grantee: iam.IGrantable): iam.Grant;
|
|
2502
|
+
/**
|
|
2503
|
+
* Add the table name to a Lambda function's environment variables.
|
|
2504
|
+
* Also grants read/write access to the table.
|
|
2505
|
+
*/
|
|
2506
|
+
connectLambda(lambdaFunction: lambda.IFunction, options?: {
|
|
2507
|
+
envKey?: string;
|
|
2508
|
+
readOnly?: boolean;
|
|
2509
|
+
}): void;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
export { AWS_MANAGED_RULE_GROUPS, CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieCertificate, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieDynamoDb, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMigration, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSecret, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, JaypieWebSocket, JaypieWebSocketLambda, JaypieWebSocketTable, addDatadogLayers, assertValidWafRuleNames, clearAllCertificateCaches, clearAllSecretsCaches, clearCertificateCache, clearSecretsCache, constructEnvName, constructStackName, constructTagger, constructWafLogBucketName, ensureRoute53QueryLoggingPolicy, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveCertificate, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
|
|
2513
|
+
export type { AccountAssignments, DomainNameConfig, EnvironmentArrayItem, EnvironmentInput, ExtendDatadogRoleOptions, HostConfig, IndexDefinition, JaypieAccountLoggingBucketProps, JaypieApiGatewayProps, JaypieCertificateProps, JaypieDatadogBucketProps, JaypieDatadogForwarderProps, JaypieDistributionProps, JaypieDnsRecordProps, JaypieDynamoDbProps, JaypieEventsRuleProps, JaypieGitHubDeployRoleProps, JaypieHostedZoneRecordProps, JaypieLambdaProps, JaypieMigrationProps, JaypieNextjsProps, JaypieOrganizationTrailProps, JaypieSecretProps, JaypieSsoPermissionsProps, JaypieSsoSyncApplicationProps, JaypieStackProps, JaypieStaticWebBucketProps, JaypieWafConfig, JaypieWebSocketProps, JaypieWebSocketTableProps, ResolveCertificateOptions, SecretsArrayItem, SecurityHeadersOverrides };
|