1 | import * as events from '@aws-cdk/aws-events';
|
2 | import * as iam from '@aws-cdk/aws-iam';
|
3 | import * as kms from '@aws-cdk/aws-kms';
|
4 | import { IResource, RemovalPolicy, Resource, ResourceProps, Duration } from '@aws-cdk/core';
|
5 | import { Construct } from 'constructs';
|
6 | import { BucketPolicy } from './bucket-policy';
|
7 | import { IBucketNotificationDestination } from './destination';
|
8 | import { LifecycleRule } from './rule';
|
9 | export interface IBucket extends IResource {
|
10 | /**
|
11 | * The ARN of the bucket.
|
12 | * @attribute
|
13 | */
|
14 | readonly bucketArn: string;
|
15 | /**
|
16 | * The name of the bucket.
|
17 | * @attribute
|
18 | */
|
19 | readonly bucketName: string;
|
20 | /**
|
21 | * The URL of the static website.
|
22 | * @attribute
|
23 | */
|
24 | readonly bucketWebsiteUrl: string;
|
25 | /**
|
26 | * The Domain name of the static website.
|
27 | * @attribute
|
28 | */
|
29 | readonly bucketWebsiteDomainName: string;
|
30 | /**
|
31 | * The IPv4 DNS name of the specified bucket.
|
32 | * @attribute
|
33 | */
|
34 | readonly bucketDomainName: string;
|
35 | /**
|
36 | * The IPv6 DNS name of the specified bucket.
|
37 | * @attribute
|
38 | */
|
39 | readonly bucketDualStackDomainName: string;
|
40 | /**
|
41 | * The regional domain name of the specified bucket.
|
42 | * @attribute
|
43 | */
|
44 | readonly bucketRegionalDomainName: string;
|
45 | /**
|
46 | * If this bucket has been configured for static website hosting.
|
47 | */
|
48 | readonly isWebsite?: boolean;
|
49 | /**
|
50 | * Optional KMS encryption key associated with this bucket.
|
51 | */
|
52 | readonly encryptionKey?: kms.IKey;
|
53 | /**
|
54 | * The resource policy associated with this bucket.
|
55 | *
|
56 | * If `autoCreatePolicy` is true, a `BucketPolicy` will be created upon the
|
57 | * first call to addToResourcePolicy(s).
|
58 | */
|
59 | policy?: BucketPolicy;
|
60 | /**
|
61 | * Adds a statement to the resource policy for a principal (i.e.
|
62 | * account/role/service) to perform actions on this bucket and/or its
|
63 | * contents. Use `bucketArn` and `arnForObjects(keys)` to obtain ARNs for
|
64 | * this bucket or objects.
|
65 | *
|
66 | * Note that the policy statement may or may not be added to the policy.
|
67 | * For example, when an `IBucket` is created from an existing bucket,
|
68 | * it's not possible to tell whether the bucket already has a policy
|
69 | * attached, let alone to re-use that policy to add more statements to it.
|
70 | * So it's safest to do nothing in these cases.
|
71 | *
|
72 | * @param permission the policy statement to be added to the bucket's
|
73 | * policy.
|
74 | * @returns metadata about the execution of this method. If the policy
|
75 | * was not added, the value of `statementAdded` will be `false`. You
|
76 | * should always check this value to make sure that the operation was
|
77 | * actually carried out. Otherwise, synthesis and deploy will terminate
|
78 | * silently, which may be confusing.
|
79 | */
|
80 | addToResourcePolicy(permission: iam.PolicyStatement): iam.AddToResourcePolicyResult;
|
81 | /**
|
82 | * The https URL of an S3 object. For example:
|
83 | *
|
84 | * - `https://s3.us-west-1.amazonaws.com/onlybucket`
|
85 | * - `https://s3.us-west-1.amazonaws.com/bucket/key`
|
86 | * - `https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`
|
87 | * @param key The S3 key of the object. If not specified, the URL of the
|
88 | * bucket is returned.
|
89 | * @returns an ObjectS3Url token
|
90 | */
|
91 | urlForObject(key?: string): string;
|
92 | /**
|
93 | * The https Transfer Acceleration URL of an S3 object. Specify `dualStack: true` at the options
|
94 | * for dual-stack endpoint (connect to the bucket over IPv6). For example:
|
95 | *
|
96 | * - `https://bucket.s3-accelerate.amazonaws.com`
|
97 | * - `https://bucket.s3-accelerate.amazonaws.com/key`
|
98 | *
|
99 | * @param key The S3 key of the object. If not specified, the URL of the
|
100 | * bucket is returned.
|
101 | * @param options Options for generating URL.
|
102 | * @returns an TransferAccelerationUrl token
|
103 | */
|
104 | transferAccelerationUrlForObject(key?: string, options?: TransferAccelerationUrlOptions): string;
|
105 | /**
|
106 | * The virtual hosted-style URL of an S3 object. Specify `regional: false` at
|
107 | * the options for non-regional URL. For example:
|
108 | *
|
109 | * - `https://only-bucket.s3.us-west-1.amazonaws.com`
|
110 | * - `https://bucket.s3.us-west-1.amazonaws.com/key`
|
111 | * - `https://bucket.s3.amazonaws.com/key`
|
112 | * - `https://china-bucket.s3.cn-north-1.amazonaws.com.cn/mykey`
|
113 | * @param key The S3 key of the object. If not specified, the URL of the
|
114 | * bucket is returned.
|
115 | * @param options Options for generating URL.
|
116 | * @returns an ObjectS3Url token
|
117 | */
|
118 | virtualHostedUrlForObject(key?: string, options?: VirtualHostedStyleUrlOptions): string;
|
119 | /**
|
120 | * The S3 URL of an S3 object. For example:
|
121 | * - `s3://onlybucket`
|
122 | * - `s3://bucket/key`
|
123 | * @param key The S3 key of the object. If not specified, the S3 URL of the
|
124 | * bucket is returned.
|
125 | * @returns an ObjectS3Url token
|
126 | */
|
127 | s3UrlForObject(key?: string): string;
|
128 | /**
|
129 | * Returns an ARN that represents all objects within the bucket that match
|
130 | * the key pattern specified. To represent all keys, specify ``"*"``.
|
131 | */
|
132 | arnForObjects(keyPattern: string): string;
|
133 | /**
|
134 | * Grant read permissions for this bucket and it's contents to an IAM
|
135 | * principal (Role/Group/User).
|
136 | *
|
137 | * If encryption is used, permission to use the key to decrypt the contents
|
138 | * of the bucket will also be granted to the same principal.
|
139 | *
|
140 | * @param identity The principal
|
141 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
142 | */
|
143 | grantRead(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
144 | /**
|
145 | * Grant write permissions to this bucket to an IAM principal.
|
146 | *
|
147 | * If encryption is used, permission to use the key to encrypt the contents
|
148 | * of written files will also be granted to the same principal.
|
149 | *
|
150 | * Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
|
151 | * which could be used to grant read/write object access to IAM principals in other accounts.
|
152 | * If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
|
153 | * and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
|
154 | * in the `context` key of your cdk.json file.
|
155 | * If you've already updated, but still need the principal to have permissions to modify the ACLs,
|
156 | * use the {@link grantPutAcl} method.
|
157 | *
|
158 | * @param identity The principal
|
159 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
160 | */
|
161 | grantWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
162 | /**
|
163 | * Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.
|
164 | *
|
165 | * If encryption is used, permission to use the key to encrypt the contents
|
166 | * of written files will also be granted to the same principal.
|
167 | * @param identity The principal
|
168 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
169 | */
|
170 | grantPut(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
171 | /**
|
172 | * Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.
|
173 | *
|
174 | * If your application has the '@aws-cdk/aws-s3:grantWriteWithoutAcl' feature flag set,
|
175 | * calling {@link grantWrite} or {@link grantReadWrite} no longer grants permissions to modify the ACLs of the objects;
|
176 | * in this case, if you need to modify object ACLs, call this method explicitly.
|
177 | *
|
178 | * @param identity The principal
|
179 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
180 | */
|
181 | grantPutAcl(identity: iam.IGrantable, objectsKeyPattern?: string): iam.Grant;
|
182 | /**
|
183 | * Grants s3:DeleteObject* permission to an IAM principal for objects
|
184 | * in this bucket.
|
185 | *
|
186 | * @param identity The principal
|
187 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
188 | */
|
189 | grantDelete(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
190 | /**
|
191 | * Grants read/write permissions for this bucket and it's contents to an IAM
|
192 | * principal (Role/Group/User).
|
193 | *
|
194 | * If an encryption key is used, permission to use the key for
|
195 | * encrypt/decrypt will also be granted.
|
196 | *
|
197 | * Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
|
198 | * which could be used to grant read/write object access to IAM principals in other accounts.
|
199 | * If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
|
200 | * and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
|
201 | * in the `context` key of your cdk.json file.
|
202 | * If you've already updated, but still need the principal to have permissions to modify the ACLs,
|
203 | * use the {@link grantPutAcl} method.
|
204 | *
|
205 | * @param identity The principal
|
206 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
207 | */
|
208 | grantReadWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
209 | /**
|
210 | * Allows unrestricted access to objects from this bucket.
|
211 | *
|
212 | * IMPORTANT: This permission allows anyone to perform actions on S3 objects
|
213 | * in this bucket, which is useful for when you configure your bucket as a
|
214 | * website and want everyone to be able to read objects in the bucket without
|
215 | * needing to authenticate.
|
216 | *
|
217 | * Without arguments, this method will grant read ("s3:GetObject") access to
|
218 | * all objects ("*") in the bucket.
|
219 | *
|
220 | * The method returns the `iam.Grant` object, which can then be modified
|
221 | * as needed. For example, you can add a condition that will restrict access only
|
222 | * to an IPv4 range like this:
|
223 | *
|
224 | * const grant = bucket.grantPublicAccess();
|
225 | * grant.resourceStatement!.addCondition(‘IpAddress’, { “aws:SourceIp”: “54.240.143.0/24” });
|
226 | *
|
227 | *
|
228 | * @param keyPrefix the prefix of S3 object keys (e.g. `home/*`). Default is "*".
|
229 | * @param allowedActions the set of S3 actions to allow. Default is "s3:GetObject".
|
230 | * @returns The `iam.PolicyStatement` object, which can be used to apply e.g. conditions.
|
231 | */
|
232 | grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.Grant;
|
233 | /**
|
234 | * Defines a CloudWatch event that triggers when something happens to this bucket
|
235 | *
|
236 | * Requires that there exists at least one CloudTrail Trail in your account
|
237 | * that captures the event. This method will not create the Trail.
|
238 | *
|
239 | * @param id The id of the rule
|
240 | * @param options Options for adding the rule
|
241 | */
|
242 | onCloudTrailEvent(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
243 | /**
|
244 | * Defines an AWS CloudWatch event that triggers when an object is uploaded
|
245 | * to the specified paths (keys) in this bucket using the PutObject API call.
|
246 | *
|
247 | * Note that some tools like `aws s3 cp` will automatically use either
|
248 | * PutObject or the multipart upload API depending on the file size,
|
249 | * so using `onCloudTrailWriteObject` may be preferable.
|
250 | *
|
251 | * Requires that there exists at least one CloudTrail Trail in your account
|
252 | * that captures the event. This method will not create the Trail.
|
253 | *
|
254 | * @param id The id of the rule
|
255 | * @param options Options for adding the rule
|
256 | */
|
257 | onCloudTrailPutObject(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
258 | /**
|
259 | * Defines an AWS CloudWatch event that triggers when an object at the
|
260 | * specified paths (keys) in this bucket are written to. This includes
|
261 | * the events PutObject, CopyObject, and CompleteMultipartUpload.
|
262 | *
|
263 | * Note that some tools like `aws s3 cp` will automatically use either
|
264 | * PutObject or the multipart upload API depending on the file size,
|
265 | * so using this method may be preferable to `onCloudTrailPutObject`.
|
266 | *
|
267 | * Requires that there exists at least one CloudTrail Trail in your account
|
268 | * that captures the event. This method will not create the Trail.
|
269 | *
|
270 | * @param id The id of the rule
|
271 | * @param options Options for adding the rule
|
272 | */
|
273 | onCloudTrailWriteObject(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
274 | /**
|
275 | * Adds a bucket notification event destination.
|
276 | * @param event The event to trigger the notification
|
277 | * @param dest The notification destination (Lambda, SNS Topic or SQS Queue)
|
278 | *
|
279 | * @param filters S3 object key filter rules to determine which objects
|
280 | * trigger this event. Each filter must include a `prefix` and/or `suffix`
|
281 | * that will be matched against the s3 object key. Refer to the S3 Developer Guide
|
282 | * for details about allowed filter rules.
|
283 | *
|
284 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-filtering
|
285 | *
|
286 | * @example
|
287 | *
|
288 | * declare const myLambda: lambda.Function;
|
289 | * const bucket = new s3.Bucket(this, 'MyBucket');
|
290 | * bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), {prefix: 'home/myusername/*'})
|
291 | *
|
292 | * @see
|
293 | * https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
|
294 | */
|
295 | addEventNotification(event: EventType, dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
296 | /**
|
297 | * Subscribes a destination to receive notifications when an object is
|
298 | * created in the bucket. This is identical to calling
|
299 | * `onEvent(s3.EventType.OBJECT_CREATED)`.
|
300 | *
|
301 | * @param dest The notification destination (see onEvent)
|
302 | * @param filters Filters (see onEvent)
|
303 | */
|
304 | addObjectCreatedNotification(dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
305 | /**
|
306 | * Subscribes a destination to receive notifications when an object is
|
307 | * removed from the bucket. This is identical to calling
|
308 | * `onEvent(EventType.OBJECT_REMOVED)`.
|
309 | *
|
310 | * @param dest The notification destination (see onEvent)
|
311 | * @param filters Filters (see onEvent)
|
312 | */
|
313 | addObjectRemovedNotification(dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
314 | }
|
315 | /**
|
316 | * A reference to a bucket outside this stack
|
317 | */
|
318 | export interface BucketAttributes {
|
319 | /**
|
320 | * The ARN of the bucket. At least one of bucketArn or bucketName must be
|
321 | * defined in order to initialize a bucket ref.
|
322 | */
|
323 | readonly bucketArn?: string;
|
324 | /**
|
325 | * The name of the bucket. If the underlying value of ARN is a string, the
|
326 | * name will be parsed from the ARN. Otherwise, the name is optional, but
|
327 | * some features that require the bucket name such as auto-creating a bucket
|
328 | * policy, won't work.
|
329 | */
|
330 | readonly bucketName?: string;
|
331 | /**
|
332 | * The domain name of the bucket.
|
333 | *
|
334 | * @default Inferred from bucket name
|
335 | */
|
336 | readonly bucketDomainName?: string;
|
337 | /**
|
338 | * The website URL of the bucket (if static web hosting is enabled).
|
339 | *
|
340 | * @default Inferred from bucket name
|
341 | */
|
342 | readonly bucketWebsiteUrl?: string;
|
343 | /**
|
344 | * The regional domain name of the specified bucket.
|
345 | */
|
346 | readonly bucketRegionalDomainName?: string;
|
347 | /**
|
348 | * The IPv6 DNS name of the specified bucket.
|
349 | */
|
350 | readonly bucketDualStackDomainName?: string;
|
351 | /**
|
352 | * The format of the website URL of the bucket. This should be true for
|
353 | * regions launched since 2014.
|
354 | *
|
355 | * @default false
|
356 | */
|
357 | readonly bucketWebsiteNewUrlFormat?: boolean;
|
358 | readonly encryptionKey?: kms.IKey;
|
359 | /**
|
360 | * If this bucket has been configured for static website hosting.
|
361 | *
|
362 | * @default false
|
363 | */
|
364 | readonly isWebsite?: boolean;
|
365 | /**
|
366 | * The account this existing bucket belongs to.
|
367 | *
|
368 | * @default - it's assumed the bucket belongs to the same account as the scope it's being imported into
|
369 | */
|
370 | readonly account?: string;
|
371 | /**
|
372 | * The region this existing bucket is in.
|
373 | *
|
374 | * @default - it's assumed the bucket is in the same region as the scope it's being imported into
|
375 | */
|
376 | readonly region?: string;
|
377 | /**
|
378 | * The role to be used by the notifications handler
|
379 | *
|
380 | * @default - a new role will be created.
|
381 | */
|
382 | readonly notificationsHandlerRole?: iam.IRole;
|
383 | }
|
384 | /**
|
385 | * Represents an S3 Bucket.
|
386 | *
|
387 | * Buckets can be either defined within this stack:
|
388 | *
|
389 | * new Bucket(this, 'MyBucket', { props });
|
390 | *
|
391 | * Or imported from an existing bucket:
|
392 | *
|
393 | * Bucket.import(this, 'MyImportedBucket', { bucketArn: ... });
|
394 | *
|
395 | * You can also export a bucket and import it into another stack:
|
396 | *
|
397 | * const ref = myBucket.export();
|
398 | * Bucket.import(this, 'MyImportedBucket', ref);
|
399 | *
|
400 | */
|
401 | export declare abstract class BucketBase extends Resource implements IBucket {
|
402 | abstract readonly bucketArn: string;
|
403 | abstract readonly bucketName: string;
|
404 | abstract readonly bucketDomainName: string;
|
405 | abstract readonly bucketWebsiteUrl: string;
|
406 | abstract readonly bucketWebsiteDomainName: string;
|
407 | abstract readonly bucketRegionalDomainName: string;
|
408 | abstract readonly bucketDualStackDomainName: string;
|
409 | /**
|
410 | * Optional KMS encryption key associated with this bucket.
|
411 | */
|
412 | abstract readonly encryptionKey?: kms.IKey;
|
413 | /**
|
414 | * If this bucket has been configured for static website hosting.
|
415 | */
|
416 | abstract readonly isWebsite?: boolean;
|
417 | /**
|
418 | * The resource policy associated with this bucket.
|
419 | *
|
420 | * If `autoCreatePolicy` is true, a `BucketPolicy` will be created upon the
|
421 | * first call to addToResourcePolicy(s).
|
422 | */
|
423 | abstract policy?: BucketPolicy;
|
424 | /**
|
425 | * Indicates if a bucket resource policy should automatically created upon
|
426 | * the first call to `addToResourcePolicy`.
|
427 | */
|
428 | protected abstract autoCreatePolicy: boolean;
|
429 | /**
|
430 | * Whether to disallow public access
|
431 | */
|
432 | protected abstract disallowPublicAccess?: boolean;
|
433 | private notifications?;
|
434 | protected notificationsHandlerRole?: iam.IRole;
|
435 | constructor(scope: Construct, id: string, props?: ResourceProps);
|
436 | /**
|
437 | * Define a CloudWatch event that triggers when something happens to this repository
|
438 | *
|
439 | * Requires that there exists at least one CloudTrail Trail in your account
|
440 | * that captures the event. This method will not create the Trail.
|
441 | *
|
442 | * @param id The id of the rule
|
443 | * @param options Options for adding the rule
|
444 | */
|
445 | onCloudTrailEvent(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
446 | /**
|
447 | * Defines an AWS CloudWatch event that triggers when an object is uploaded
|
448 | * to the specified paths (keys) in this bucket using the PutObject API call.
|
449 | *
|
450 | * Note that some tools like `aws s3 cp` will automatically use either
|
451 | * PutObject or the multipart upload API depending on the file size,
|
452 | * so using `onCloudTrailWriteObject` may be preferable.
|
453 | *
|
454 | * Requires that there exists at least one CloudTrail Trail in your account
|
455 | * that captures the event. This method will not create the Trail.
|
456 | *
|
457 | * @param id The id of the rule
|
458 | * @param options Options for adding the rule
|
459 | */
|
460 | onCloudTrailPutObject(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
461 | /**
|
462 | * Defines an AWS CloudWatch event that triggers when an object at the
|
463 | * specified paths (keys) in this bucket are written to. This includes
|
464 | * the events PutObject, CopyObject, and CompleteMultipartUpload.
|
465 | *
|
466 | * Note that some tools like `aws s3 cp` will automatically use either
|
467 | * PutObject or the multipart upload API depending on the file size,
|
468 | * so using this method may be preferable to `onCloudTrailPutObject`.
|
469 | *
|
470 | * Requires that there exists at least one CloudTrail Trail in your account
|
471 | * that captures the event. This method will not create the Trail.
|
472 | *
|
473 | * @param id The id of the rule
|
474 | * @param options Options for adding the rule
|
475 | */
|
476 | onCloudTrailWriteObject(id: string, options?: OnCloudTrailBucketEventOptions): events.Rule;
|
477 | /**
|
478 | * Adds a statement to the resource policy for a principal (i.e.
|
479 | * account/role/service) to perform actions on this bucket and/or its
|
480 | * contents. Use `bucketArn` and `arnForObjects(keys)` to obtain ARNs for
|
481 | * this bucket or objects.
|
482 | *
|
483 | * Note that the policy statement may or may not be added to the policy.
|
484 | * For example, when an `IBucket` is created from an existing bucket,
|
485 | * it's not possible to tell whether the bucket already has a policy
|
486 | * attached, let alone to re-use that policy to add more statements to it.
|
487 | * So it's safest to do nothing in these cases.
|
488 | *
|
489 | * @param permission the policy statement to be added to the bucket's
|
490 | * policy.
|
491 | * @returns metadata about the execution of this method. If the policy
|
492 | * was not added, the value of `statementAdded` will be `false`. You
|
493 | * should always check this value to make sure that the operation was
|
494 | * actually carried out. Otherwise, synthesis and deploy will terminate
|
495 | * silently, which may be confusing.
|
496 | */
|
497 | addToResourcePolicy(permission: iam.PolicyStatement): iam.AddToResourcePolicyResult;
|
498 | protected validate(): string[];
|
499 | /**
|
500 | * The https URL of an S3 object. Specify `regional: false` at the options
|
501 | * for non-regional URLs. For example:
|
502 | *
|
503 | * - `https://s3.us-west-1.amazonaws.com/onlybucket`
|
504 | * - `https://s3.us-west-1.amazonaws.com/bucket/key`
|
505 | * - `https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`
|
506 | *
|
507 | * @param key The S3 key of the object. If not specified, the URL of the
|
508 | * bucket is returned.
|
509 | * @returns an ObjectS3Url token
|
510 | */
|
511 | urlForObject(key?: string): string;
|
512 | /**
|
513 | * The https Transfer Acceleration URL of an S3 object. Specify `dualStack: true` at the options
|
514 | * for dual-stack endpoint (connect to the bucket over IPv6). For example:
|
515 | *
|
516 | * - `https://bucket.s3-accelerate.amazonaws.com`
|
517 | * - `https://bucket.s3-accelerate.amazonaws.com/key`
|
518 | *
|
519 | * @param key The S3 key of the object. If not specified, the URL of the
|
520 | * bucket is returned.
|
521 | * @param options Options for generating URL.
|
522 | * @returns an TransferAccelerationUrl token
|
523 | */
|
524 | transferAccelerationUrlForObject(key?: string, options?: TransferAccelerationUrlOptions): string;
|
525 | /**
|
526 | * The virtual hosted-style URL of an S3 object. Specify `regional: false` at
|
527 | * the options for non-regional URL. For example:
|
528 | *
|
529 | * - `https://only-bucket.s3.us-west-1.amazonaws.com`
|
530 | * - `https://bucket.s3.us-west-1.amazonaws.com/key`
|
531 | * - `https://bucket.s3.amazonaws.com/key`
|
532 | * - `https://china-bucket.s3.cn-north-1.amazonaws.com.cn/mykey`
|
533 | *
|
534 | * @param key The S3 key of the object. If not specified, the URL of the
|
535 | * bucket is returned.
|
536 | * @param options Options for generating URL.
|
537 | * @returns an ObjectS3Url token
|
538 | */
|
539 | virtualHostedUrlForObject(key?: string, options?: VirtualHostedStyleUrlOptions): string;
|
540 | /**
|
541 | * The S3 URL of an S3 object. For example:
|
542 | *
|
543 | * - `s3://onlybucket`
|
544 | * - `s3://bucket/key`
|
545 | *
|
546 | * @param key The S3 key of the object. If not specified, the S3 URL of the
|
547 | * bucket is returned.
|
548 | * @returns an ObjectS3Url token
|
549 | */
|
550 | s3UrlForObject(key?: string): string;
|
551 | /**
|
552 | * Returns an ARN that represents all objects within the bucket that match
|
553 | * the key pattern specified. To represent all keys, specify ``"*"``.
|
554 | *
|
555 | * If you need to specify a keyPattern with multiple components, concatenate them into a single string, e.g.:
|
556 | *
|
557 | * arnForObjects(`home/${team}/${user}/*`)
|
558 | *
|
559 | */
|
560 | arnForObjects(keyPattern: string): string;
|
561 | /**
|
562 | * Grant read permissions for this bucket and it's contents to an IAM
|
563 | * principal (Role/Group/User).
|
564 | *
|
565 | * If encryption is used, permission to use the key to decrypt the contents
|
566 | * of the bucket will also be granted to the same principal.
|
567 | *
|
568 | * @param identity The principal
|
569 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
570 | */
|
571 | grantRead(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
572 | grantWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
573 | /**
|
574 | * Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.
|
575 | *
|
576 | * If encryption is used, permission to use the key to encrypt the contents
|
577 | * of written files will also be granted to the same principal.
|
578 | * @param identity The principal
|
579 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
580 | */
|
581 | grantPut(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
582 | grantPutAcl(identity: iam.IGrantable, objectsKeyPattern?: string): iam.Grant;
|
583 | /**
|
584 | * Grants s3:DeleteObject* permission to an IAM principal for objects
|
585 | * in this bucket.
|
586 | *
|
587 | * @param identity The principal
|
588 | * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*')
|
589 | */
|
590 | grantDelete(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
591 | grantReadWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant;
|
592 | /**
|
593 | * Allows unrestricted access to objects from this bucket.
|
594 | *
|
595 | * IMPORTANT: This permission allows anyone to perform actions on S3 objects
|
596 | * in this bucket, which is useful for when you configure your bucket as a
|
597 | * website and want everyone to be able to read objects in the bucket without
|
598 | * needing to authenticate.
|
599 | *
|
600 | * Without arguments, this method will grant read ("s3:GetObject") access to
|
601 | * all objects ("*") in the bucket.
|
602 | *
|
603 | * The method returns the `iam.Grant` object, which can then be modified
|
604 | * as needed. For example, you can add a condition that will restrict access only
|
605 | * to an IPv4 range like this:
|
606 | *
|
607 | * const grant = bucket.grantPublicAccess();
|
608 | * grant.resourceStatement!.addCondition(‘IpAddress’, { “aws:SourceIp”: “54.240.143.0/24” });
|
609 | *
|
610 | * Note that if this `IBucket` refers to an existing bucket, possibly not
|
611 | * managed by CloudFormation, this method will have no effect, since it's
|
612 | * impossible to modify the policy of an existing bucket.
|
613 | *
|
614 | * @param keyPrefix the prefix of S3 object keys (e.g. `home/*`). Default is "*".
|
615 | * @param allowedActions the set of S3 actions to allow. Default is "s3:GetObject".
|
616 | */
|
617 | grantPublicAccess(keyPrefix?: string, ...allowedActions: string[]): iam.Grant;
|
618 | /**
|
619 | * Adds a bucket notification event destination.
|
620 | * @param event The event to trigger the notification
|
621 | * @param dest The notification destination (Lambda, SNS Topic or SQS Queue)
|
622 | *
|
623 | * @param filters S3 object key filter rules to determine which objects
|
624 | * trigger this event. Each filter must include a `prefix` and/or `suffix`
|
625 | * that will be matched against the s3 object key. Refer to the S3 Developer Guide
|
626 | * for details about allowed filter rules.
|
627 | *
|
628 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-filtering
|
629 | *
|
630 | * @example
|
631 | *
|
632 | * declare const myLambda: lambda.Function;
|
633 | * const bucket = new s3.Bucket(this, 'MyBucket');
|
634 | * bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), {prefix: 'home/myusername/*'});
|
635 | *
|
636 | * @see
|
637 | * https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
|
638 | */
|
639 | addEventNotification(event: EventType, dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
640 | private withNotifications;
|
641 | /**
|
642 | * Subscribes a destination to receive notifications when an object is
|
643 | * created in the bucket. This is identical to calling
|
644 | * `onEvent(EventType.OBJECT_CREATED)`.
|
645 | *
|
646 | * @param dest The notification destination (see onEvent)
|
647 | * @param filters Filters (see onEvent)
|
648 | */
|
649 | addObjectCreatedNotification(dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
650 | /**
|
651 | * Subscribes a destination to receive notifications when an object is
|
652 | * removed from the bucket. This is identical to calling
|
653 | * `onEvent(EventType.OBJECT_REMOVED)`.
|
654 | *
|
655 | * @param dest The notification destination (see onEvent)
|
656 | * @param filters Filters (see onEvent)
|
657 | */
|
658 | addObjectRemovedNotification(dest: IBucketNotificationDestination, ...filters: NotificationKeyFilter[]): void;
|
659 | protected enableEventBridgeNotification(): void;
|
660 | private get writeActions();
|
661 | private get putActions();
|
662 | private urlJoin;
|
663 | private grant;
|
664 | }
|
665 | export interface BlockPublicAccessOptions {
|
666 | /**
|
667 | * Whether to block public ACLs
|
668 | *
|
669 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
|
670 | */
|
671 | readonly blockPublicAcls?: boolean;
|
672 | /**
|
673 | * Whether to block public policy
|
674 | *
|
675 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
|
676 | */
|
677 | readonly blockPublicPolicy?: boolean;
|
678 | /**
|
679 | * Whether to ignore public ACLs
|
680 | *
|
681 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
|
682 | */
|
683 | readonly ignorePublicAcls?: boolean;
|
684 | /**
|
685 | * Whether to restrict public access
|
686 | *
|
687 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-options
|
688 | */
|
689 | readonly restrictPublicBuckets?: boolean;
|
690 | }
|
691 | export declare class BlockPublicAccess {
|
692 | static readonly BLOCK_ALL: BlockPublicAccess;
|
693 | static readonly BLOCK_ACLS: BlockPublicAccess;
|
694 | blockPublicAcls: boolean | undefined;
|
695 | blockPublicPolicy: boolean | undefined;
|
696 | ignorePublicAcls: boolean | undefined;
|
697 | restrictPublicBuckets: boolean | undefined;
|
698 | constructor(options: BlockPublicAccessOptions);
|
699 | }
|
700 | /**
|
701 | * Specifies a metrics configuration for the CloudWatch request metrics from an Amazon S3 bucket.
|
702 | */
|
703 | export interface BucketMetrics {
|
704 | /**
|
705 | * The ID used to identify the metrics configuration.
|
706 | */
|
707 | readonly id: string;
|
708 | /**
|
709 | * The prefix that an object must have to be included in the metrics results.
|
710 | */
|
711 | readonly prefix?: string;
|
712 | /**
|
713 | * Specifies a list of tag filters to use as a metrics configuration filter.
|
714 | * The metrics configuration includes only objects that meet the filter's criteria.
|
715 | */
|
716 | readonly tagFilters?: {
|
717 | [tag: string]: any;
|
718 | };
|
719 | }
|
720 | /**
|
721 | * All http request methods
|
722 | */
|
723 | export declare enum HttpMethods {
|
724 | /**
|
725 | * The GET method requests a representation of the specified resource.
|
726 | */
|
727 | GET = "GET",
|
728 | /**
|
729 | * The PUT method replaces all current representations of the target resource with the request payload.
|
730 | */
|
731 | PUT = "PUT",
|
732 | /**
|
733 | * The HEAD method asks for a response identical to that of a GET request, but without the response body.
|
734 | */
|
735 | HEAD = "HEAD",
|
736 | /**
|
737 | * The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
|
738 | */
|
739 | POST = "POST",
|
740 | /**
|
741 | * The DELETE method deletes the specified resource.
|
742 | */
|
743 | DELETE = "DELETE"
|
744 | }
|
745 | /**
|
746 | * Specifies a cross-origin access rule for an Amazon S3 bucket.
|
747 | */
|
748 | export interface CorsRule {
|
749 | /**
|
750 | * A unique identifier for this rule.
|
751 | *
|
752 | * @default - No id specified.
|
753 | */
|
754 | readonly id?: string;
|
755 | /**
|
756 | * The time in seconds that your browser is to cache the preflight response for the specified resource.
|
757 | *
|
758 | * @default - No caching.
|
759 | */
|
760 | readonly maxAge?: number;
|
761 | /**
|
762 | * Headers that are specified in the Access-Control-Request-Headers header.
|
763 | *
|
764 | * @default - No headers allowed.
|
765 | */
|
766 | readonly allowedHeaders?: string[];
|
767 | /**
|
768 | * An HTTP method that you allow the origin to execute.
|
769 | */
|
770 | readonly allowedMethods: HttpMethods[];
|
771 | /**
|
772 | * One or more origins you want customers to be able to access the bucket from.
|
773 | */
|
774 | readonly allowedOrigins: string[];
|
775 | /**
|
776 | * One or more headers in the response that you want customers to be able to access from their applications.
|
777 | *
|
778 | * @default - No headers exposed.
|
779 | */
|
780 | readonly exposedHeaders?: string[];
|
781 | }
|
782 | /**
|
783 | * All http request methods
|
784 | */
|
785 | export declare enum RedirectProtocol {
|
786 | HTTP = "http",
|
787 | HTTPS = "https"
|
788 | }
|
789 | /**
|
790 | * Specifies a redirect behavior of all requests to a website endpoint of a bucket.
|
791 | */
|
792 | export interface RedirectTarget {
|
793 | /**
|
794 | * Name of the host where requests are redirected
|
795 | */
|
796 | readonly hostName: string;
|
797 | /**
|
798 | * Protocol to use when redirecting requests
|
799 | *
|
800 | * @default - The protocol used in the original request.
|
801 | */
|
802 | readonly protocol?: RedirectProtocol;
|
803 | }
|
804 | /**
|
805 | * All supported inventory list formats.
|
806 | */
|
807 | export declare enum InventoryFormat {
|
808 | /**
|
809 | * Generate the inventory list as CSV.
|
810 | */
|
811 | CSV = "CSV",
|
812 | /**
|
813 | * Generate the inventory list as Parquet.
|
814 | */
|
815 | PARQUET = "Parquet",
|
816 | /**
|
817 | * Generate the inventory list as ORC.
|
818 | */
|
819 | ORC = "ORC"
|
820 | }
|
821 | /**
|
822 | * All supported inventory frequencies.
|
823 | */
|
824 | export declare enum InventoryFrequency {
|
825 | /**
|
826 | * A report is generated every day.
|
827 | */
|
828 | DAILY = "Daily",
|
829 | /**
|
830 | * A report is generated every Sunday (UTC timezone) after the initial report.
|
831 | */
|
832 | WEEKLY = "Weekly"
|
833 | }
|
834 | /**
|
835 | * Inventory version support.
|
836 | */
|
837 | export declare enum InventoryObjectVersion {
|
838 | /**
|
839 | * Includes all versions of each object in the report.
|
840 | */
|
841 | ALL = "All",
|
842 | /**
|
843 | * Includes only the current version of each object in the report.
|
844 | */
|
845 | CURRENT = "Current"
|
846 | }
|
847 | /**
|
848 | * The destination of the inventory.
|
849 | */
|
850 | export interface InventoryDestination {
|
851 | /**
|
852 | * Bucket where all inventories will be saved in.
|
853 | */
|
854 | readonly bucket: IBucket;
|
855 | /**
|
856 | * The prefix to be used when saving the inventory.
|
857 | *
|
858 | * @default - No prefix.
|
859 | */
|
860 | readonly prefix?: string;
|
861 | /**
|
862 | * The account ID that owns the destination S3 bucket.
|
863 | * If no account ID is provided, the owner is not validated before exporting data.
|
864 | * It's recommended to set an account ID to prevent problems if the destination bucket ownership changes.
|
865 | *
|
866 | * @default - No account ID.
|
867 | */
|
868 | readonly bucketOwner?: string;
|
869 | }
|
870 | /**
|
871 | * Specifies the inventory configuration of an S3 Bucket.
|
872 | *
|
873 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html
|
874 | */
|
875 | export interface Inventory {
|
876 | /**
|
877 | * The destination of the inventory.
|
878 | */
|
879 | readonly destination: InventoryDestination;
|
880 | /**
|
881 | * The inventory will only include objects that meet the prefix filter criteria.
|
882 | *
|
883 | * @default - No objects prefix
|
884 | */
|
885 | readonly objectsPrefix?: string;
|
886 | /**
|
887 | * The format of the inventory.
|
888 | *
|
889 | * @default InventoryFormat.CSV
|
890 | */
|
891 | readonly format?: InventoryFormat;
|
892 | /**
|
893 | * Whether the inventory is enabled or disabled.
|
894 | *
|
895 | * @default true
|
896 | */
|
897 | readonly enabled?: boolean;
|
898 | /**
|
899 | * The inventory configuration ID.
|
900 | *
|
901 | * @default - generated ID.
|
902 | */
|
903 | readonly inventoryId?: string;
|
904 | /**
|
905 | * Frequency at which the inventory should be generated.
|
906 | *
|
907 | * @default InventoryFrequency.WEEKLY
|
908 | */
|
909 | readonly frequency?: InventoryFrequency;
|
910 | /**
|
911 | * If the inventory should contain all the object versions or only the current one.
|
912 | *
|
913 | * @default InventoryObjectVersion.ALL
|
914 | */
|
915 | readonly includeObjectVersions?: InventoryObjectVersion;
|
916 | /**
|
917 | * A list of optional fields to be included in the inventory result.
|
918 | *
|
919 | * @default - No optional fields.
|
920 | */
|
921 | readonly optionalFields?: string[];
|
922 | }
|
923 | /**
|
924 | * The ObjectOwnership of the bucket.
|
925 | *
|
926 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html
|
927 | *
|
928 | */
|
929 | export declare enum ObjectOwnership {
|
930 | /**
|
931 | * ACLs are disabled, and the bucket owner automatically owns
|
932 | * and has full control over every object in the bucket.
|
933 | * ACLs no longer affect permissions to data in the S3 bucket.
|
934 | * The bucket uses policies to define access control.
|
935 | */
|
936 | BUCKET_OWNER_ENFORCED = "BucketOwnerEnforced",
|
937 | /**
|
938 | * Objects uploaded to the bucket change ownership to the bucket owner .
|
939 | */
|
940 | BUCKET_OWNER_PREFERRED = "BucketOwnerPreferred",
|
941 | /**
|
942 | * The uploading account will own the object.
|
943 | */
|
944 | OBJECT_WRITER = "ObjectWriter"
|
945 | }
|
946 | /**
|
947 | * The intelligent tiering configuration.
|
948 | */
|
949 | export interface IntelligentTieringConfiguration {
|
950 | /**
|
951 | * Configuration name
|
952 | */
|
953 | readonly name: string;
|
954 | /**
|
955 | * Add a filter to limit the scope of this configuration to a single prefix.
|
956 | *
|
957 | * @default this configuration will apply to **all** objects in the bucket.
|
958 | */
|
959 | readonly prefix?: string;
|
960 | /**
|
961 | * You can limit the scope of this rule to the key value pairs added below.
|
962 | *
|
963 | * @default No filtering will be performed on tags
|
964 | */
|
965 | readonly tags?: Tag[];
|
966 | /**
|
967 | * When enabled, Intelligent-Tiering will automatically move objects that
|
968 | * haven’t been accessed for a minimum of 90 days to the Archive Access tier.
|
969 | *
|
970 | * @default Objects will not move to Glacier
|
971 | */
|
972 | readonly archiveAccessTierTime?: Duration;
|
973 | /**
|
974 | * When enabled, Intelligent-Tiering will automatically move objects that
|
975 | * haven’t been accessed for a minimum of 180 days to the Deep Archive Access
|
976 | * tier.
|
977 | *
|
978 | * @default Objects will not move to Glacier Deep Access
|
979 | */
|
980 | readonly deepArchiveAccessTierTime?: Duration;
|
981 | }
|
982 | export interface BucketProps {
|
983 | /**
|
984 | * The kind of server-side encryption to apply to this bucket.
|
985 | *
|
986 | * If you choose KMS, you can specify a KMS key via `encryptionKey`. If
|
987 | * encryption key is not specified, a key will automatically be created.
|
988 | *
|
989 | * @default - `Kms` if `encryptionKey` is specified, or `Unencrypted` otherwise.
|
990 | */
|
991 | readonly encryption?: BucketEncryption;
|
992 | /**
|
993 | * External KMS key to use for bucket encryption.
|
994 | *
|
995 | * The 'encryption' property must be either not specified or set to "Kms".
|
996 | * An error will be emitted if encryption is set to "Unencrypted" or
|
997 | * "Managed".
|
998 | *
|
999 | * @default - If encryption is set to "Kms" and this property is undefined,
|
1000 | * a new KMS key will be created and associated with this bucket.
|
1001 | */
|
1002 | readonly encryptionKey?: kms.IKey;
|
1003 | /**
|
1004 | * Enforces SSL for requests. S3.5 of the AWS Foundational Security Best Practices Regarding S3.
|
1005 | * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-ssl-requests-only.html
|
1006 | *
|
1007 | * @default false
|
1008 | */
|
1009 | readonly enforceSSL?: boolean;
|
1010 | /**
|
1011 | * Specifies whether Amazon S3 should use an S3 Bucket Key with server-side
|
1012 | * encryption using KMS (SSE-KMS) for new objects in the bucket.
|
1013 | *
|
1014 | * Only relevant, when Encryption is set to {@link BucketEncryption.KMS}
|
1015 | *
|
1016 | * @default - false
|
1017 | */
|
1018 | readonly bucketKeyEnabled?: boolean;
|
1019 | /**
|
1020 | * Physical name of this bucket.
|
1021 | *
|
1022 | * @default - Assigned by CloudFormation (recommended).
|
1023 | */
|
1024 | readonly bucketName?: string;
|
1025 | /**
|
1026 | * Policy to apply when the bucket is removed from this stack.
|
1027 | *
|
1028 | * @default - The bucket will be orphaned.
|
1029 | */
|
1030 | readonly removalPolicy?: RemovalPolicy;
|
1031 | /**
|
1032 | * Whether all objects should be automatically deleted when the bucket is
|
1033 | * removed from the stack or when the stack is deleted.
|
1034 | *
|
1035 | * Requires the `removalPolicy` to be set to `RemovalPolicy.DESTROY`.
|
1036 | *
|
1037 | * **Warning** if you have deployed a bucket with `autoDeleteObjects: true`,
|
1038 | * switching this to `false` in a CDK version *before* `1.126.0` will lead to
|
1039 | * all objects in the bucket being deleted. Be sure to update your bucket resources
|
1040 | * by deploying with CDK version `1.126.0` or later **before** switching this value to `false`.
|
1041 | *
|
1042 | * @default false
|
1043 | */
|
1044 | readonly autoDeleteObjects?: boolean;
|
1045 | /**
|
1046 | * Whether this bucket should have versioning turned on or not.
|
1047 | *
|
1048 | * @default false
|
1049 | */
|
1050 | readonly versioned?: boolean;
|
1051 | /**
|
1052 | * Whether this bucket should send notifications to Amazon EventBridge or not.
|
1053 | *
|
1054 | * @default false
|
1055 | */
|
1056 | readonly eventBridgeEnabled?: boolean;
|
1057 | /**
|
1058 | * Rules that define how Amazon S3 manages objects during their lifetime.
|
1059 | *
|
1060 | * @default - No lifecycle rules.
|
1061 | */
|
1062 | readonly lifecycleRules?: LifecycleRule[];
|
1063 | /**
|
1064 | * The name of the index document (e.g. "index.html") for the website. Enables static website
|
1065 | * hosting for this bucket.
|
1066 | *
|
1067 | * @default - No index document.
|
1068 | */
|
1069 | readonly websiteIndexDocument?: string;
|
1070 | /**
|
1071 | * The name of the error document (e.g. "404.html") for the website.
|
1072 | * `websiteIndexDocument` must also be set if this is set.
|
1073 | *
|
1074 | * @default - No error document.
|
1075 | */
|
1076 | readonly websiteErrorDocument?: string;
|
1077 | /**
|
1078 | * Specifies the redirect behavior of all requests to a website endpoint of a bucket.
|
1079 | *
|
1080 | * If you specify this property, you can't specify "websiteIndexDocument", "websiteErrorDocument" nor , "websiteRoutingRules".
|
1081 | *
|
1082 | * @default - No redirection.
|
1083 | */
|
1084 | readonly websiteRedirect?: RedirectTarget;
|
1085 | /**
|
1086 | * Rules that define when a redirect is applied and the redirect behavior
|
1087 | *
|
1088 | * @default - No redirection rules.
|
1089 | */
|
1090 | readonly websiteRoutingRules?: RoutingRule[];
|
1091 | /**
|
1092 | * Specifies a canned ACL that grants predefined permissions to the bucket.
|
1093 | *
|
1094 | * @default BucketAccessControl.PRIVATE
|
1095 | */
|
1096 | readonly accessControl?: BucketAccessControl;
|
1097 | /**
|
1098 | * Grants public read access to all objects in the bucket.
|
1099 | * Similar to calling `bucket.grantPublicAccess()`
|
1100 | *
|
1101 | * @default false
|
1102 | */
|
1103 | readonly publicReadAccess?: boolean;
|
1104 | /**
|
1105 | * The block public access configuration of this bucket.
|
1106 | *
|
1107 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html
|
1108 | *
|
1109 | *
|
1110 | * @default - CloudFormation defaults will apply. New buckets and objects don't allow public access, but users can modify bucket policies or object permissions to allow public access
|
1111 | */
|
1112 | readonly blockPublicAccess?: BlockPublicAccess;
|
1113 | /**
|
1114 | * The metrics configuration of this bucket.
|
1115 | *
|
1116 | * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-metricsconfiguration.html
|
1117 | *
|
1118 | * @default - No metrics configuration.
|
1119 | */
|
1120 | readonly metrics?: BucketMetrics[];
|
1121 | /**
|
1122 | * The CORS configuration of this bucket.
|
1123 | *
|
1124 | * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors.html
|
1125 | *
|
1126 | * @default - No CORS configuration.
|
1127 | */
|
1128 | readonly cors?: CorsRule[];
|
1129 | /**
|
1130 | * Destination bucket for the server access logs.
|
1131 | * @default - If "serverAccessLogsPrefix" undefined - access logs disabled, otherwise - log to current bucket.
|
1132 | */
|
1133 | readonly serverAccessLogsBucket?: IBucket;
|
1134 | /**
|
1135 | * Optional log file prefix to use for the bucket's access logs.
|
1136 | * If defined without "serverAccessLogsBucket", enables access logs to current bucket with this prefix.
|
1137 | * @default - No log file prefix
|
1138 | */
|
1139 | readonly serverAccessLogsPrefix?: string;
|
1140 | /**
|
1141 | * The inventory configuration of the bucket.
|
1142 | *
|
1143 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html
|
1144 | *
|
1145 | * @default - No inventory configuration
|
1146 | */
|
1147 | readonly inventories?: Inventory[];
|
1148 | /**
|
1149 | * The objectOwnership of the bucket.
|
1150 | *
|
1151 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html
|
1152 | *
|
1153 | * @default - No ObjectOwnership configuration, uploading account will own the object.
|
1154 | *
|
1155 | */
|
1156 | readonly objectOwnership?: ObjectOwnership;
|
1157 | /**
|
1158 | * Whether this bucket should have transfer acceleration turned on or not.
|
1159 | *
|
1160 | * @default false
|
1161 | */
|
1162 | readonly transferAcceleration?: boolean;
|
1163 | /**
|
1164 | * The role to be used by the notifications handler
|
1165 | *
|
1166 | * @default - a new role will be created.
|
1167 | */
|
1168 | readonly notificationsHandlerRole?: iam.IRole;
|
1169 | /**
|
1170 | * Inteligent Tiering Configurations
|
1171 | *
|
1172 | * @see https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html
|
1173 | *
|
1174 | * @default No Intelligent Tiiering Configurations.
|
1175 | */
|
1176 | readonly intelligentTieringConfigurations?: IntelligentTieringConfiguration[];
|
1177 | }
|
1178 | /**
|
1179 | * Tag
|
1180 | */
|
1181 | export interface Tag {
|
1182 | /**
|
1183 | * key to e tagged
|
1184 | */
|
1185 | readonly key: string;
|
1186 | /**
|
1187 | * additional value
|
1188 | */
|
1189 | readonly value: string;
|
1190 | }
|
1191 | /**
|
1192 | * An S3 bucket with associated policy objects
|
1193 | *
|
1194 | * This bucket does not yet have all features that exposed by the underlying
|
1195 | * BucketResource.
|
1196 | */
|
1197 | export declare class Bucket extends BucketBase {
|
1198 | static fromBucketArn(scope: Construct, id: string, bucketArn: string): IBucket;
|
1199 | static fromBucketName(scope: Construct, id: string, bucketName: string): IBucket;
|
1200 | /**
|
1201 | * Creates a Bucket construct that represents an external bucket.
|
1202 | *
|
1203 | * @param scope The parent creating construct (usually `this`).
|
1204 | * @param id The construct's name.
|
1205 | * @param attrs A `BucketAttributes` object. Can be obtained from a call to
|
1206 | * `bucket.export()` or manually created.
|
1207 | */
|
1208 | static fromBucketAttributes(scope: Construct, id: string, attrs: BucketAttributes): IBucket;
|
1209 | /**
|
1210 | * Thrown an exception if the given bucket name is not valid.
|
1211 | *
|
1212 | * @param physicalName name of the bucket.
|
1213 | */
|
1214 | static validateBucketName(physicalName: string): void;
|
1215 | readonly bucketArn: string;
|
1216 | readonly bucketName: string;
|
1217 | readonly bucketDomainName: string;
|
1218 | readonly bucketWebsiteUrl: string;
|
1219 | readonly bucketWebsiteDomainName: string;
|
1220 | readonly bucketDualStackDomainName: string;
|
1221 | readonly bucketRegionalDomainName: string;
|
1222 | readonly encryptionKey?: kms.IKey;
|
1223 | readonly isWebsite?: boolean;
|
1224 | policy?: BucketPolicy;
|
1225 | protected autoCreatePolicy: boolean;
|
1226 | protected disallowPublicAccess?: boolean;
|
1227 | private accessControl?;
|
1228 | private readonly lifecycleRules;
|
1229 | private readonly versioned?;
|
1230 | private readonly eventBridgeEnabled?;
|
1231 | private readonly metrics;
|
1232 | private readonly cors;
|
1233 | private readonly inventories;
|
1234 | private readonly _resource;
|
1235 | constructor(scope: Construct, id: string, props?: BucketProps);
|
1236 | /**
|
1237 | * Add a lifecycle rule to the bucket
|
1238 | *
|
1239 | * @param rule The rule to add
|
1240 | */
|
1241 | addLifecycleRule(rule: LifecycleRule): void;
|
1242 | /**
|
1243 | * Adds a metrics configuration for the CloudWatch request metrics from the bucket.
|
1244 | *
|
1245 | * @param metric The metric configuration to add
|
1246 | */
|
1247 | addMetric(metric: BucketMetrics): void;
|
1248 | /**
|
1249 | * Adds a cross-origin access configuration for objects in an Amazon S3 bucket
|
1250 | *
|
1251 | * @param rule The CORS configuration rule to add
|
1252 | */
|
1253 | addCorsRule(rule: CorsRule): void;
|
1254 | /**
|
1255 | * Add an inventory configuration.
|
1256 | *
|
1257 | * @param inventory configuration to add
|
1258 | */
|
1259 | addInventory(inventory: Inventory): void;
|
1260 | /**
|
1261 | * Adds an iam statement to enforce SSL requests only.
|
1262 | */
|
1263 | private enforceSSLStatement;
|
1264 | /**
|
1265 | * Set up key properties and return the Bucket encryption property from the
|
1266 | * user's configuration.
|
1267 | */
|
1268 | private parseEncryption;
|
1269 | /**
|
1270 | * Parse the lifecycle configuration out of the bucket props
|
1271 | * @param props Par
|
1272 | */
|
1273 | private parseLifecycleConfiguration;
|
1274 | private parseServerAccessLogs;
|
1275 | private parseMetricConfiguration;
|
1276 | private parseCorsConfiguration;
|
1277 | private parseTagFilters;
|
1278 | private parseOwnershipControls;
|
1279 | private parseTieringConfig;
|
1280 | private renderWebsiteConfiguration;
|
1281 | /**
|
1282 | * Allows the LogDelivery group to write, fails if ACL was set differently.
|
1283 | *
|
1284 | * @see
|
1285 | * https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
|
1286 | */
|
1287 | private allowLogDelivery;
|
1288 | private parseInventoryConfiguration;
|
1289 | private enableAutoDeleteObjects;
|
1290 | }
|
1291 | /**
|
1292 | * What kind of server-side encryption to apply to this bucket
|
1293 | */
|
1294 | export declare enum BucketEncryption {
|
1295 | /**
|
1296 | * Objects in the bucket are not encrypted.
|
1297 | */
|
1298 | UNENCRYPTED = "NONE",
|
1299 | /**
|
1300 | * Server-side KMS encryption with a master key managed by KMS.
|
1301 | */
|
1302 | KMS_MANAGED = "MANAGED",
|
1303 | /**
|
1304 | * Server-side encryption with a master key managed by S3.
|
1305 | */
|
1306 | S3_MANAGED = "S3MANAGED",
|
1307 | /**
|
1308 | * Server-side encryption with a KMS key managed by the user.
|
1309 | * If `encryptionKey` is specified, this key will be used, otherwise, one will be defined.
|
1310 | */
|
1311 | KMS = "KMS"
|
1312 | }
|
1313 | /**
|
1314 | * Notification event types.
|
1315 | * @link https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html#supported-notification-event-types
|
1316 | */
|
1317 | export declare enum EventType {
|
1318 | /**
|
1319 | * Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using
|
1320 | * these event types, you can enable notification when an object is created
|
1321 | * using a specific API, or you can use the s3:ObjectCreated:* event type to
|
1322 | * request notification regardless of the API that was used to create an
|
1323 | * object.
|
1324 | */
|
1325 | OBJECT_CREATED = "s3:ObjectCreated:*",
|
1326 | /**
|
1327 | * Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using
|
1328 | * these event types, you can enable notification when an object is created
|
1329 | * using a specific API, or you can use the s3:ObjectCreated:* event type to
|
1330 | * request notification regardless of the API that was used to create an
|
1331 | * object.
|
1332 | */
|
1333 | OBJECT_CREATED_PUT = "s3:ObjectCreated:Put",
|
1334 | /**
|
1335 | * Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using
|
1336 | * these event types, you can enable notification when an object is created
|
1337 | * using a specific API, or you can use the s3:ObjectCreated:* event type to
|
1338 | * request notification regardless of the API that was used to create an
|
1339 | * object.
|
1340 | */
|
1341 | OBJECT_CREATED_POST = "s3:ObjectCreated:Post",
|
1342 | /**
|
1343 | * Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using
|
1344 | * these event types, you can enable notification when an object is created
|
1345 | * using a specific API, or you can use the s3:ObjectCreated:* event type to
|
1346 | * request notification regardless of the API that was used to create an
|
1347 | * object.
|
1348 | */
|
1349 | OBJECT_CREATED_COPY = "s3:ObjectCreated:Copy",
|
1350 | /**
|
1351 | * Amazon S3 APIs such as PUT, POST, and COPY can create an object. Using
|
1352 | * these event types, you can enable notification when an object is created
|
1353 | * using a specific API, or you can use the s3:ObjectCreated:* event type to
|
1354 | * request notification regardless of the API that was used to create an
|
1355 | * object.
|
1356 | */
|
1357 | OBJECT_CREATED_COMPLETE_MULTIPART_UPLOAD = "s3:ObjectCreated:CompleteMultipartUpload",
|
1358 | /**
|
1359 | * By using the ObjectRemoved event types, you can enable notification when
|
1360 | * an object or a batch of objects is removed from a bucket.
|
1361 | *
|
1362 | * You can request notification when an object is deleted or a versioned
|
1363 | * object is permanently deleted by using the s3:ObjectRemoved:Delete event
|
1364 | * type. Or you can request notification when a delete marker is created for
|
1365 | * a versioned object by using s3:ObjectRemoved:DeleteMarkerCreated. For
|
1366 | * information about deleting versioned objects, see Deleting Object
|
1367 | * Versions. You can also use a wildcard s3:ObjectRemoved:* to request
|
1368 | * notification anytime an object is deleted.
|
1369 | *
|
1370 | * You will not receive event notifications from automatic deletes from
|
1371 | * lifecycle policies or from failed operations.
|
1372 | */
|
1373 | OBJECT_REMOVED = "s3:ObjectRemoved:*",
|
1374 | /**
|
1375 | * By using the ObjectRemoved event types, you can enable notification when
|
1376 | * an object or a batch of objects is removed from a bucket.
|
1377 | *
|
1378 | * You can request notification when an object is deleted or a versioned
|
1379 | * object is permanently deleted by using the s3:ObjectRemoved:Delete event
|
1380 | * type. Or you can request notification when a delete marker is created for
|
1381 | * a versioned object by using s3:ObjectRemoved:DeleteMarkerCreated. For
|
1382 | * information about deleting versioned objects, see Deleting Object
|
1383 | * Versions. You can also use a wildcard s3:ObjectRemoved:* to request
|
1384 | * notification anytime an object is deleted.
|
1385 | *
|
1386 | * You will not receive event notifications from automatic deletes from
|
1387 | * lifecycle policies or from failed operations.
|
1388 | */
|
1389 | OBJECT_REMOVED_DELETE = "s3:ObjectRemoved:Delete",
|
1390 | /**
|
1391 | * By using the ObjectRemoved event types, you can enable notification when
|
1392 | * an object or a batch of objects is removed from a bucket.
|
1393 | *
|
1394 | * You can request notification when an object is deleted or a versioned
|
1395 | * object is permanently deleted by using the s3:ObjectRemoved:Delete event
|
1396 | * type. Or you can request notification when a delete marker is created for
|
1397 | * a versioned object by using s3:ObjectRemoved:DeleteMarkerCreated. For
|
1398 | * information about deleting versioned objects, see Deleting Object
|
1399 | * Versions. You can also use a wildcard s3:ObjectRemoved:* to request
|
1400 | * notification anytime an object is deleted.
|
1401 | *
|
1402 | * You will not receive event notifications from automatic deletes from
|
1403 | * lifecycle policies or from failed operations.
|
1404 | */
|
1405 | OBJECT_REMOVED_DELETE_MARKER_CREATED = "s3:ObjectRemoved:DeleteMarkerCreated",
|
1406 | /**
|
1407 | * Using restore object event types you can receive notifications for
|
1408 | * initiation and completion when restoring objects from the S3 Glacier
|
1409 | * storage class.
|
1410 | *
|
1411 | * You use s3:ObjectRestore:Post to request notification of object restoration
|
1412 | * initiation.
|
1413 | */
|
1414 | OBJECT_RESTORE_POST = "s3:ObjectRestore:Post",
|
1415 | /**
|
1416 | * Using restore object event types you can receive notifications for
|
1417 | * initiation and completion when restoring objects from the S3 Glacier
|
1418 | * storage class.
|
1419 | *
|
1420 | * You use s3:ObjectRestore:Completed to request notification of
|
1421 | * restoration completion.
|
1422 | */
|
1423 | OBJECT_RESTORE_COMPLETED = "s3:ObjectRestore:Completed",
|
1424 | /**
|
1425 | * Using restore object event types you can receive notifications for
|
1426 | * initiation and completion when restoring objects from the S3 Glacier
|
1427 | * storage class.
|
1428 | *
|
1429 | * You use s3:ObjectRestore:Delete to request notification of
|
1430 | * restoration completion.
|
1431 | */
|
1432 | OBJECT_RESTORE_DELETE = "s3:ObjectRestore:Delete",
|
1433 | /**
|
1434 | * You can use this event type to request Amazon S3 to send a notification
|
1435 | * message when Amazon S3 detects that an object of the RRS storage class is
|
1436 | * lost.
|
1437 | */
|
1438 | REDUCED_REDUNDANCY_LOST_OBJECT = "s3:ReducedRedundancyLostObject",
|
1439 | /**
|
1440 | * You receive this notification event when an object that was eligible for
|
1441 | * replication using Amazon S3 Replication Time Control failed to replicate.
|
1442 | */
|
1443 | REPLICATION_OPERATION_FAILED_REPLICATION = "s3:Replication:OperationFailedReplication",
|
1444 | /**
|
1445 | * You receive this notification event when an object that was eligible for
|
1446 | * replication using Amazon S3 Replication Time Control exceeded the 15-minute
|
1447 | * threshold for replication.
|
1448 | */
|
1449 | REPLICATION_OPERATION_MISSED_THRESHOLD = "s3:Replication:OperationMissedThreshold",
|
1450 | /**
|
1451 | * You receive this notification event for an object that was eligible for
|
1452 | * replication using the Amazon S3 Replication Time Control feature replicated
|
1453 | * after the 15-minute threshold.
|
1454 | */
|
1455 | REPLICATION_OPERATION_REPLICATED_AFTER_THRESHOLD = "s3:Replication:OperationReplicatedAfterThreshold",
|
1456 | /**
|
1457 | * You receive this notification event for an object that was eligible for
|
1458 | * replication using Amazon S3 Replication Time Control but is no longer tracked
|
1459 | * by replication metrics.
|
1460 | */
|
1461 | REPLICATION_OPERATION_NOT_TRACKED = "s3:Replication:OperationNotTracked",
|
1462 | /**
|
1463 | * By using the LifecycleExpiration event types, you can receive a notification
|
1464 | * when Amazon S3 deletes an object based on your S3 Lifecycle configuration.
|
1465 | */
|
1466 | LIFECYCLE_EXPIRATION = "s3:LifecycleExpiration:*",
|
1467 | /**
|
1468 | * The s3:LifecycleExpiration:Delete event type notifies you when an object
|
1469 | * in an unversioned bucket is deleted.
|
1470 | * It also notifies you when an object version is permanently deleted by an
|
1471 | * S3 Lifecycle configuration.
|
1472 | */
|
1473 | LIFECYCLE_EXPIRATION_DELETE = "s3:LifecycleExpiration:Delete",
|
1474 | /**
|
1475 | * The s3:LifecycleExpiration:DeleteMarkerCreated event type notifies you
|
1476 | * when S3 Lifecycle creates a delete marker when a current version of an
|
1477 | * object in versioned bucket is deleted.
|
1478 | */
|
1479 | LIFECYCLE_EXPIRATION_DELETE_MARKER_CREATED = "s3:LifecycleExpiration:DeleteMarkerCreated",
|
1480 | /**
|
1481 | * You receive this notification event when an object is transitioned to
|
1482 | * another Amazon S3 storage class by an S3 Lifecycle configuration.
|
1483 | */
|
1484 | LIFECYCLE_TRANSITION = "s3:LifecycleTransition",
|
1485 | /**
|
1486 | * You receive this notification event when an object within the
|
1487 | * S3 Intelligent-Tiering storage class moved to the Archive Access tier or
|
1488 | * Deep Archive Access tier.
|
1489 | */
|
1490 | INTELLIGENT_TIERING = "s3:IntelligentTiering",
|
1491 | /**
|
1492 | * By using the ObjectTagging event types, you can enable notification when
|
1493 | * an object tag is added or deleted from an object.
|
1494 | */
|
1495 | OBJECT_TAGGING = "s3:ObjectTagging:*",
|
1496 | /**
|
1497 | * The s3:ObjectTagging:Put event type notifies you when a tag is PUT on an
|
1498 | * object or an existing tag is updated.
|
1499 |
|
1500 | */
|
1501 | OBJECT_TAGGING_PUT = "s3:ObjectTagging:Put",
|
1502 | /**
|
1503 | * The s3:ObjectTagging:Delete event type notifies you when a tag is removed
|
1504 | * from an object.
|
1505 | */
|
1506 | OBJECT_TAGGING_DELETE = "s3:ObjectTagging:Delete",
|
1507 | /**
|
1508 | * You receive this notification event when an ACL is PUT on an object or when
|
1509 | * an existing ACL is changed.
|
1510 | * An event is not generated when a request results in no change to an
|
1511 | * object’s ACL.
|
1512 | */
|
1513 | OBJECT_ACL_PUT = "s3:ObjectAcl:Put"
|
1514 | }
|
1515 | export interface NotificationKeyFilter {
|
1516 | /**
|
1517 | * S3 keys must have the specified prefix.
|
1518 | */
|
1519 | readonly prefix?: string;
|
1520 | /**
|
1521 | * S3 keys must have the specified suffix.
|
1522 | */
|
1523 | readonly suffix?: string;
|
1524 | }
|
1525 | /**
|
1526 | * Options for the onCloudTrailPutObject method
|
1527 | */
|
1528 | export interface OnCloudTrailBucketEventOptions extends events.OnEventOptions {
|
1529 | /**
|
1530 | * Only watch changes to these object paths
|
1531 | *
|
1532 | * @default - Watch changes to all objects
|
1533 | */
|
1534 | readonly paths?: string[];
|
1535 | }
|
1536 | /**
|
1537 | * Default bucket access control types.
|
1538 | *
|
1539 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html
|
1540 | */
|
1541 | export declare enum BucketAccessControl {
|
1542 | /**
|
1543 | * Owner gets FULL_CONTROL. No one else has access rights.
|
1544 | */
|
1545 | PRIVATE = "Private",
|
1546 | /**
|
1547 | * Owner gets FULL_CONTROL. The AllUsers group gets READ access.
|
1548 | */
|
1549 | PUBLIC_READ = "PublicRead",
|
1550 | /**
|
1551 | * Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access.
|
1552 | * Granting this on a bucket is generally not recommended.
|
1553 | */
|
1554 | PUBLIC_READ_WRITE = "PublicReadWrite",
|
1555 | /**
|
1556 | * Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access.
|
1557 | */
|
1558 | AUTHENTICATED_READ = "AuthenticatedRead",
|
1559 | /**
|
1560 | * The LogDelivery group gets WRITE and READ_ACP permissions on the bucket.
|
1561 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html
|
1562 | */
|
1563 | LOG_DELIVERY_WRITE = "LogDeliveryWrite",
|
1564 | /**
|
1565 | * Object owner gets FULL_CONTROL. Bucket owner gets READ access.
|
1566 | * If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
|
1567 | */
|
1568 | BUCKET_OWNER_READ = "BucketOwnerRead",
|
1569 | /**
|
1570 | * Both the object owner and the bucket owner get FULL_CONTROL over the object.
|
1571 | * If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
|
1572 | */
|
1573 | BUCKET_OWNER_FULL_CONTROL = "BucketOwnerFullControl",
|
1574 | /**
|
1575 | * Owner gets FULL_CONTROL. Amazon EC2 gets READ access to GET an Amazon Machine Image (AMI) bundle from Amazon S3.
|
1576 | */
|
1577 | AWS_EXEC_READ = "AwsExecRead"
|
1578 | }
|
1579 | export interface RoutingRuleCondition {
|
1580 | /**
|
1581 | * The HTTP error code when the redirect is applied
|
1582 | *
|
1583 | * In the event of an error, if the error code equals this value, then the specified redirect is applied.
|
1584 | *
|
1585 | * If both condition properties are specified, both must be true for the redirect to be applied.
|
1586 | *
|
1587 | * @default - The HTTP error code will not be verified
|
1588 | */
|
1589 | readonly httpErrorCodeReturnedEquals?: string;
|
1590 | /**
|
1591 | * The object key name prefix when the redirect is applied
|
1592 | *
|
1593 | * If both condition properties are specified, both must be true for the redirect to be applied.
|
1594 | *
|
1595 | * @default - The object key name will not be verified
|
1596 | */
|
1597 | readonly keyPrefixEquals?: string;
|
1598 | }
|
1599 | export declare class ReplaceKey {
|
1600 | readonly withKey?: string | undefined;
|
1601 | readonly prefixWithKey?: string | undefined;
|
1602 | /**
|
1603 | * The specific object key to use in the redirect request
|
1604 | */
|
1605 | static with(keyReplacement: string): ReplaceKey;
|
1606 | /**
|
1607 | * The object key prefix to use in the redirect request
|
1608 | */
|
1609 | static prefixWith(keyReplacement: string): ReplaceKey;
|
1610 | private constructor();
|
1611 | }
|
1612 | /**
|
1613 | * Rule that define when a redirect is applied and the redirect behavior.
|
1614 | *
|
1615 | * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html
|
1616 | */
|
1617 | export interface RoutingRule {
|
1618 | /**
|
1619 | * The host name to use in the redirect request
|
1620 | *
|
1621 | * @default - The host name used in the original request.
|
1622 | */
|
1623 | readonly hostName?: string;
|
1624 | /**
|
1625 | * The HTTP redirect code to use on the response
|
1626 | *
|
1627 | * @default "301" - Moved Permanently
|
1628 | */
|
1629 | readonly httpRedirectCode?: string;
|
1630 | /**
|
1631 | * Protocol to use when redirecting requests
|
1632 | *
|
1633 | * @default - The protocol used in the original request.
|
1634 | */
|
1635 | readonly protocol?: RedirectProtocol;
|
1636 | /**
|
1637 | * Specifies the object key prefix to use in the redirect request
|
1638 | *
|
1639 | * @default - The key will not be replaced
|
1640 | */
|
1641 | readonly replaceKey?: ReplaceKey;
|
1642 | /**
|
1643 | * Specifies a condition that must be met for the specified redirect to apply.
|
1644 | *
|
1645 | * @default - No condition
|
1646 | */
|
1647 | readonly condition?: RoutingRuleCondition;
|
1648 | }
|
1649 | /**
|
1650 | * Options for creating Virtual-Hosted style URL.
|
1651 | */
|
1652 | export interface VirtualHostedStyleUrlOptions {
|
1653 | /**
|
1654 | * Specifies the URL includes the region.
|
1655 | *
|
1656 | * @default - true
|
1657 | */
|
1658 | readonly regional?: boolean;
|
1659 | }
|
1660 | /**
|
1661 | * Options for creating a Transfer Acceleration URL.
|
1662 | */
|
1663 | export interface TransferAccelerationUrlOptions {
|
1664 | /**
|
1665 | * Dual-stack support to connect to the bucket over IPv6.
|
1666 | *
|
1667 | * @default - false
|
1668 | */
|
1669 | readonly dualStack?: boolean;
|
1670 | }
|
1671 |
|
\ | No newline at end of file |