public static final class BucketProps.Builder
extends java.lang.Object
BucketProps
Constructor and Description |
---|
Builder() |
public BucketProps.Builder accessControl(BucketAccessControl accessControl)
BucketProps.getAccessControl()
accessControl
- Specifies a canned ACL that grants predefined permissions to the bucket.this
public BucketProps.Builder autoDeleteObjects(java.lang.Boolean autoDeleteObjects)
BucketProps.getAutoDeleteObjects()
autoDeleteObjects
- Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted.
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
.
this
public BucketProps.Builder blockPublicAccess(BlockPublicAccess blockPublicAccess)
BucketProps.getBlockPublicAccess()
blockPublicAccess
- The block public access configuration of this bucket.this
public BucketProps.Builder bucketKeyEnabled(java.lang.Boolean bucketKeyEnabled)
BucketProps.getBucketKeyEnabled()
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.
Only relevant, when Encryption is set to {@link BucketEncryption.KMS}this
public BucketProps.Builder bucketName(java.lang.String bucketName)
BucketProps.getBucketName()
bucketName
- Physical name of this bucket.this
public BucketProps.Builder cors(java.util.List<? extends CorsRule> cors)
BucketProps.getCors()
cors
- The CORS configuration of this bucket.this
public BucketProps.Builder encryption(BucketEncryption encryption)
BucketProps.getEncryption()
encryption
- The kind of server-side encryption to apply to this bucket.
If you choose KMS, you can specify a KMS key via encryptionKey
. If
encryption key is not specified, a key will automatically be created.this
public BucketProps.Builder encryptionKey(IKey encryptionKey)
BucketProps.getEncryptionKey()
encryptionKey
- External KMS key to use for bucket encryption.
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".this
public BucketProps.Builder enforceSsl(java.lang.Boolean enforceSsl)
BucketProps#getEnforceSsl
enforceSsl
- Enforces SSL for requests.
S3.5 of the AWS Foundational Security Best Practices Regarding S3.this
public BucketProps.Builder eventBridgeEnabled(java.lang.Boolean eventBridgeEnabled)
BucketProps.getEventBridgeEnabled()
eventBridgeEnabled
- Whether this bucket should send notifications to Amazon EventBridge or not.this
public BucketProps.Builder intelligentTieringConfigurations(java.util.List<? extends IntelligentTieringConfiguration> intelligentTieringConfigurations)
BucketProps.getIntelligentTieringConfigurations()
intelligentTieringConfigurations
- Inteligent Tiering Configurations.this
public BucketProps.Builder inventories(java.util.List<? extends Inventory> inventories)
BucketProps.getInventories()
inventories
- The inventory configuration of the bucket.this
public BucketProps.Builder lifecycleRules(java.util.List<? extends LifecycleRule> lifecycleRules)
BucketProps.getLifecycleRules()
lifecycleRules
- Rules that define how Amazon S3 manages objects during their lifetime.this
public BucketProps.Builder metrics(java.util.List<? extends BucketMetrics> metrics)
BucketProps.getMetrics()
metrics
- The metrics configuration of this bucket.this
public BucketProps.Builder notificationsHandlerRole(IRole notificationsHandlerRole)
BucketProps.getNotificationsHandlerRole()
notificationsHandlerRole
- The role to be used by the notifications handler.this
public BucketProps.Builder objectOwnership(ObjectOwnership objectOwnership)
BucketProps.getObjectOwnership()
objectOwnership
- The objectOwnership of the bucket.this
public BucketProps.Builder publicReadAccess(java.lang.Boolean publicReadAccess)
BucketProps.getPublicReadAccess()
publicReadAccess
- Grants public read access to all objects in the bucket.
Similar to calling bucket.grantPublicAccess()
this
public BucketProps.Builder removalPolicy(RemovalPolicy removalPolicy)
BucketProps.getRemovalPolicy()
removalPolicy
- Policy to apply when the bucket is removed from this stack.this
public BucketProps.Builder serverAccessLogsBucket(IBucket serverAccessLogsBucket)
BucketProps.getServerAccessLogsBucket()
serverAccessLogsBucket
- Destination bucket for the server access logs.this
public BucketProps.Builder serverAccessLogsPrefix(java.lang.String serverAccessLogsPrefix)
BucketProps.getServerAccessLogsPrefix()
serverAccessLogsPrefix
- Optional log file prefix to use for the bucket's access logs.
If defined without "serverAccessLogsBucket", enables access logs to current bucket with this prefix.this
public BucketProps.Builder transferAcceleration(java.lang.Boolean transferAcceleration)
BucketProps.getTransferAcceleration()
transferAcceleration
- Whether this bucket should have transfer acceleration turned on or not.this
public BucketProps.Builder versioned(java.lang.Boolean versioned)
BucketProps.getVersioned()
versioned
- Whether this bucket should have versioning turned on or not.this
public BucketProps.Builder websiteErrorDocument(java.lang.String websiteErrorDocument)
BucketProps.getWebsiteErrorDocument()
websiteErrorDocument
- The name of the error document (e.g. "404.html") for the website. `websiteIndexDocument` must also be set if this is set.this
public BucketProps.Builder websiteIndexDocument(java.lang.String websiteIndexDocument)
BucketProps.getWebsiteIndexDocument()
websiteIndexDocument
- The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket.this
public BucketProps.Builder websiteRedirect(RedirectTarget websiteRedirect)
BucketProps.getWebsiteRedirect()
websiteRedirect
- Specifies the redirect behavior of all requests to a website endpoint of a bucket.
If you specify this property, you can't specify "websiteIndexDocument", "websiteErrorDocument" nor , "websiteRoutingRules".this
public BucketProps.Builder websiteRoutingRules(java.util.List<? extends RoutingRule> websiteRoutingRules)
BucketProps.getWebsiteRoutingRules()
websiteRoutingRules
- Rules that define when a redirect is applied and the redirect behavior.this
public BucketProps build()
BucketProps
java.lang.NullPointerException
- if any required attribute was not provided