Modifier and Type | Method and Description |
---|---|
Bucket.Builder |
accessControl(BucketAccessControl accessControl)
Specifies a canned ACL that grants predefined permissions to the bucket.
|
Bucket.Builder |
autoDeleteObjects(java.lang.Boolean autoDeleteObjects)
Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted.
|
Bucket.Builder |
blockPublicAccess(BlockPublicAccess blockPublicAccess)
The block public access configuration of this bucket.
|
Bucket.Builder |
bucketKeyEnabled(java.lang.Boolean bucketKeyEnabled)
Specifies whether Amazon S3 should use an S3 Bucket Key with server-side encryption using KMS (SSE-KMS) for new objects in the bucket.
|
Bucket.Builder |
bucketName(java.lang.String bucketName)
Physical name of this bucket.
|
Bucket |
build() |
Bucket.Builder |
cors(java.util.List<? extends CorsRule> cors)
The CORS configuration of this bucket.
|
static Bucket.Builder |
create(software.constructs.Construct scope,
java.lang.String id) |
Bucket.Builder |
encryption(BucketEncryption encryption)
The kind of server-side encryption to apply to this bucket.
|
Bucket.Builder |
encryptionKey(IKey encryptionKey)
External KMS key to use for bucket encryption.
|
Bucket.Builder |
enforceSsl(java.lang.Boolean enforceSsl)
Enforces SSL for requests.
|
Bucket.Builder |
eventBridgeEnabled(java.lang.Boolean eventBridgeEnabled)
Whether this bucket should send notifications to Amazon EventBridge or not.
|
Bucket.Builder |
intelligentTieringConfigurations(java.util.List<? extends IntelligentTieringConfiguration> intelligentTieringConfigurations)
Inteligent Tiering Configurations.
|
Bucket.Builder |
inventories(java.util.List<? extends Inventory> inventories)
The inventory configuration of the bucket.
|
Bucket.Builder |
lifecycleRules(java.util.List<? extends LifecycleRule> lifecycleRules)
Rules that define how Amazon S3 manages objects during their lifetime.
|
Bucket.Builder |
metrics(java.util.List<? extends BucketMetrics> metrics)
The metrics configuration of this bucket.
|
Bucket.Builder |
notificationsHandlerRole(IRole notificationsHandlerRole)
The role to be used by the notifications handler.
|
Bucket.Builder |
objectOwnership(ObjectOwnership objectOwnership)
The objectOwnership of the bucket.
|
Bucket.Builder |
publicReadAccess(java.lang.Boolean publicReadAccess)
Grants public read access to all objects in the bucket.
|
Bucket.Builder |
removalPolicy(RemovalPolicy removalPolicy)
Policy to apply when the bucket is removed from this stack.
|
Bucket.Builder |
serverAccessLogsBucket(IBucket serverAccessLogsBucket)
Destination bucket for the server access logs.
|
Bucket.Builder |
serverAccessLogsPrefix(java.lang.String serverAccessLogsPrefix)
Optional log file prefix to use for the bucket's access logs.
|
Bucket.Builder |
transferAcceleration(java.lang.Boolean transferAcceleration)
Whether this bucket should have transfer acceleration turned on or not.
|
Bucket.Builder |
versioned(java.lang.Boolean versioned)
Whether this bucket should have versioning turned on or not.
|
Bucket.Builder |
websiteErrorDocument(java.lang.String websiteErrorDocument)
The name of the error document (e.g.
|
Bucket.Builder |
websiteIndexDocument(java.lang.String websiteIndexDocument)
The name of the index document (e.g.
|
Bucket.Builder |
websiteRedirect(RedirectTarget websiteRedirect)
Specifies the redirect behavior of all requests to a website endpoint of a bucket.
|
Bucket.Builder |
websiteRoutingRules(java.util.List<? extends RoutingRule> websiteRoutingRules)
Rules that define when a redirect is applied and the redirect behavior.
|
public static Bucket.Builder create(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.Bucket.Builder
.public Bucket.Builder accessControl(BucketAccessControl accessControl)
Default: BucketAccessControl.PRIVATE
accessControl
- Specifies a canned ACL that grants predefined permissions to the bucket. This parameter is required.this
public Bucket.Builder autoDeleteObjects(java.lang.Boolean autoDeleteObjects)
Requires the removalPolicy
to be set to RemovalPolicy.DESTROY
.
Warning if you have deployed a bucket with autoDeleteObjects: true
,
switching this to false
in a CDK version before 1.126.0
will lead to
all objects in the bucket being deleted. Be sure to update your bucket resources
by deploying with CDK version 1.126.0
or later before switching this value to false
.
Default: false
autoDeleteObjects
- Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted. This parameter is required.this
public Bucket.Builder blockPublicAccess(BlockPublicAccess blockPublicAccess)
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
blockPublicAccess
- The block public access configuration of this bucket. This parameter is required.this
public Bucket.Builder bucketKeyEnabled(java.lang.Boolean bucketKeyEnabled)
Only relevant, when Encryption is set to {@link BucketEncryption.KMS}
Default: - false
bucketKeyEnabled
- Specifies whether Amazon S3 should use an S3 Bucket Key with server-side encryption using KMS (SSE-KMS) for new objects in the bucket. This parameter is required.this
public Bucket.Builder bucketName(java.lang.String bucketName)
Default: - Assigned by CloudFormation (recommended).
bucketName
- Physical name of this bucket. This parameter is required.this
public Bucket.Builder cors(java.util.List<? extends CorsRule> cors)
Default: - No CORS configuration.
cors
- The CORS configuration of this bucket. This parameter is required.this
public Bucket.Builder encryption(BucketEncryption encryption)
If you choose KMS, you can specify a KMS key via encryptionKey
. If
encryption key is not specified, a key will automatically be created.
Default: - `Kms` if `encryptionKey` is specified, or `Unencrypted` otherwise.
encryption
- The kind of server-side encryption to apply to this bucket. This parameter is required.this
public Bucket.Builder encryptionKey(IKey encryptionKey)
The 'encryption' property must be either not specified or set to "Kms". An error will be emitted if encryption is set to "Unencrypted" or "Managed".
Default: - If encryption is set to "Kms" and this property is undefined, a new KMS key will be created and associated with this bucket.
encryptionKey
- External KMS key to use for bucket encryption. This parameter is required.this
public Bucket.Builder enforceSsl(java.lang.Boolean enforceSsl)
S3.5 of the AWS Foundational Security Best Practices Regarding S3.
Default: false
enforceSsl
- Enforces SSL for requests. This parameter is required.this
public Bucket.Builder eventBridgeEnabled(java.lang.Boolean eventBridgeEnabled)
Default: false
eventBridgeEnabled
- Whether this bucket should send notifications to Amazon EventBridge or not. This parameter is required.this
public Bucket.Builder intelligentTieringConfigurations(java.util.List<? extends IntelligentTieringConfiguration> intelligentTieringConfigurations)
Default: No Intelligent Tiiering Configurations.
intelligentTieringConfigurations
- Inteligent Tiering Configurations. This parameter is required.this
public Bucket.Builder inventories(java.util.List<? extends Inventory> inventories)
Default: - No inventory configuration
inventories
- The inventory configuration of the bucket. This parameter is required.this
public Bucket.Builder lifecycleRules(java.util.List<? extends LifecycleRule> lifecycleRules)
Default: - No lifecycle rules.
lifecycleRules
- Rules that define how Amazon S3 manages objects during their lifetime. This parameter is required.this
public Bucket.Builder metrics(java.util.List<? extends BucketMetrics> metrics)
Default: - No metrics configuration.
metrics
- The metrics configuration of this bucket. This parameter is required.this
public Bucket.Builder notificationsHandlerRole(IRole notificationsHandlerRole)
Default: - a new role will be created.
notificationsHandlerRole
- The role to be used by the notifications handler. This parameter is required.this
public Bucket.Builder objectOwnership(ObjectOwnership objectOwnership)
Default: - No ObjectOwnership configuration, uploading account will own the object.
objectOwnership
- The objectOwnership of the bucket. This parameter is required.this
public Bucket.Builder publicReadAccess(java.lang.Boolean publicReadAccess)
Similar to calling bucket.grantPublicAccess()
Default: false
publicReadAccess
- Grants public read access to all objects in the bucket. This parameter is required.this
public Bucket.Builder removalPolicy(RemovalPolicy removalPolicy)
Default: - The bucket will be orphaned.
removalPolicy
- Policy to apply when the bucket is removed from this stack. This parameter is required.this
public Bucket.Builder serverAccessLogsBucket(IBucket serverAccessLogsBucket)
Default: - If "serverAccessLogsPrefix" undefined - access logs disabled, otherwise - log to current bucket.
serverAccessLogsBucket
- Destination bucket for the server access logs. This parameter is required.this
public Bucket.Builder serverAccessLogsPrefix(java.lang.String serverAccessLogsPrefix)
If defined without "serverAccessLogsBucket", enables access logs to current bucket with this prefix.
Default: - No log file prefix
serverAccessLogsPrefix
- Optional log file prefix to use for the bucket's access logs. This parameter is required.this
public Bucket.Builder transferAcceleration(java.lang.Boolean transferAcceleration)
Default: false
transferAcceleration
- Whether this bucket should have transfer acceleration turned on or not. This parameter is required.this
public Bucket.Builder versioned(java.lang.Boolean versioned)
Default: false
versioned
- Whether this bucket should have versioning turned on or not. This parameter is required.this
public Bucket.Builder websiteErrorDocument(java.lang.String websiteErrorDocument)
Default: - No error document.
websiteErrorDocument
- The name of the error document (e.g. "404.html") for the website. `websiteIndexDocument` must also be set if this is set. This parameter is required.this
public Bucket.Builder websiteIndexDocument(java.lang.String websiteIndexDocument)
Default: - No index document.
websiteIndexDocument
- The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket. This parameter is required.this
public Bucket.Builder websiteRedirect(RedirectTarget websiteRedirect)
If you specify this property, you can't specify "websiteIndexDocument", "websiteErrorDocument" nor , "websiteRoutingRules".
Default: - No redirection.
websiteRedirect
- Specifies the redirect behavior of all requests to a website endpoint of a bucket. This parameter is required.this
public Bucket.Builder websiteRoutingRules(java.util.List<? extends RoutingRule> websiteRoutingRules)
Default: - No redirection rules.
websiteRoutingRules
- Rules that define when a redirect is applied and the redirect behavior. This parameter is required.this
public Bucket build()