Class BucketProps.Builder
java.lang.Object
software.amazon.awscdk.services.s3.BucketProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<BucketProps>
- Enclosing interface:
BucketProps
@Stability(Stable)
public static final class BucketProps.Builder
extends Object
implements software.amazon.jsii.Builder<BucketProps>
A builder for
BucketProps-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessControl(BucketAccessControl accessControl) Sets the value ofBucketProps.getAccessControl()autoDeleteObjects(Boolean autoDeleteObjects) Sets the value ofBucketProps.getAutoDeleteObjects()blockPublicAccess(BlockPublicAccess blockPublicAccess) Sets the value ofBucketProps.getBlockPublicAccess()bucketKeyEnabled(Boolean bucketKeyEnabled) Sets the value ofBucketProps.getBucketKeyEnabled()bucketName(String bucketName) Sets the value ofBucketProps.getBucketName()build()Builds the configured instance.Sets the value ofBucketProps.getCors()encryption(BucketEncryption encryption) Sets the value ofBucketProps.getEncryption()encryptionKey(IKey encryptionKey) Sets the value ofBucketProps.getEncryptionKey()enforceSsl(Boolean enforceSsl) Sets the value ofinvalid @link
BucketProps#getEnforceSsleventBridgeEnabled(Boolean eventBridgeEnabled) Sets the value ofBucketProps.getEventBridgeEnabled()intelligentTieringConfigurations(List<? extends IntelligentTieringConfiguration> intelligentTieringConfigurations) Sets the value ofBucketProps.getIntelligentTieringConfigurations()inventories(List<? extends Inventory> inventories) Sets the value ofBucketProps.getInventories()lifecycleRules(List<? extends LifecycleRule> lifecycleRules) Sets the value ofBucketProps.getLifecycleRules()metrics(List<? extends BucketMetrics> metrics) Sets the value ofBucketProps.getMetrics()minimumTlsVersion(Number minimumTlsVersion) Sets the value ofinvalid @link
BucketProps#getMinimumTlsVersionnotificationsHandlerRole(IRole notificationsHandlerRole) Sets the value ofBucketProps.getNotificationsHandlerRole()objectLockDefaultRetention(ObjectLockRetention objectLockDefaultRetention) Sets the value ofBucketProps.getObjectLockDefaultRetention()objectLockEnabled(Boolean objectLockEnabled) Sets the value ofBucketProps.getObjectLockEnabled()objectOwnership(ObjectOwnership objectOwnership) Sets the value ofBucketProps.getObjectOwnership()publicReadAccess(Boolean publicReadAccess) Sets the value ofBucketProps.getPublicReadAccess()removalPolicy(RemovalPolicy removalPolicy) Sets the value ofBucketProps.getRemovalPolicy()serverAccessLogsBucket(IBucket serverAccessLogsBucket) Sets the value ofBucketProps.getServerAccessLogsBucket()serverAccessLogsPrefix(String serverAccessLogsPrefix) Sets the value ofBucketProps.getServerAccessLogsPrefix()transferAcceleration(Boolean transferAcceleration) Sets the value ofBucketProps.getTransferAcceleration()Sets the value ofBucketProps.getVersioned()websiteErrorDocument(String websiteErrorDocument) Sets the value ofBucketProps.getWebsiteErrorDocument()websiteIndexDocument(String websiteIndexDocument) Sets the value ofBucketProps.getWebsiteIndexDocument()websiteRedirect(RedirectTarget websiteRedirect) Sets the value ofBucketProps.getWebsiteRedirect()websiteRoutingRules(List<? extends RoutingRule> websiteRoutingRules) Sets the value ofBucketProps.getWebsiteRoutingRules()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
accessControl
Sets the value ofBucketProps.getAccessControl()- Parameters:
accessControl- Specifies a canned ACL that grants predefined permissions to the bucket.- Returns:
this
-
autoDeleteObjects
Sets the value ofBucketProps.getAutoDeleteObjects()- Parameters:
autoDeleteObjects- Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted. Requires theremovalPolicyto be set toRemovalPolicy.DESTROY.Warning if you have deployed a bucket with
autoDeleteObjects: true, switching this tofalsein a CDK version before1.126.0will lead to all objects in the bucket being deleted. Be sure to update your bucket resources by deploying with CDK version1.126.0or later before switching this value tofalse.- Returns:
this
-
blockPublicAccess
@Stability(Stable) public BucketProps.Builder blockPublicAccess(BlockPublicAccess blockPublicAccess) Sets the value ofBucketProps.getBlockPublicAccess()- Parameters:
blockPublicAccess- The block public access configuration of this bucket.- Returns:
this
-
bucketKeyEnabled
Sets the value ofBucketProps.getBucketKeyEnabled()- Parameters:
bucketKeyEnabled- Whether Amazon S3 should use its own intermediary key to generate data keys. Only relevant when using KMS for encryption.- If not enabled, every object GET and PUT will cause an API call to KMS (with the attendant cost implications of that).
- If enabled, S3 will use its own time-limited key instead.
Only relevant, when Encryption is set to
BucketEncryption.KMSorBucketEncryption.KMS_MANAGED.- Returns:
this
-
bucketName
Sets the value ofBucketProps.getBucketName()- Parameters:
bucketName- Physical name of this bucket.- Returns:
this
-
cors
Sets the value ofBucketProps.getCors()- Parameters:
cors- The CORS configuration of this bucket.- Returns:
this
-
encryption
Sets the value ofBucketProps.getEncryption()- Parameters:
encryption- The kind of server-side encryption to apply to this bucket. If you choose KMS, you can specify a KMS key viaencryptionKey. If encryption key is not specified, a key will automatically be created.- Returns:
this
-
encryptionKey
Sets the value ofBucketProps.getEncryptionKey()- Parameters:
encryptionKey- External KMS key to use for bucket encryption. Theencryptionproperty must be either not specified or set toKMSorDSSE. An error will be emitted ifencryptionis set toUNENCRYPTEDorS3_MANAGED.- Returns:
this
-
enforceSsl
Sets the value ofinvalid @link
BucketProps#getEnforceSsl- Parameters:
enforceSsl- Enforces SSL for requests. S3.5 of the AWS Foundational Security Best Practices Regarding S3.- Returns:
this
-
eventBridgeEnabled
Sets the value ofBucketProps.getEventBridgeEnabled()- Parameters:
eventBridgeEnabled- Whether this bucket should send notifications to Amazon EventBridge or not.- Returns:
this
-
intelligentTieringConfigurations
@Stability(Stable) public BucketProps.Builder intelligentTieringConfigurations(List<? extends IntelligentTieringConfiguration> intelligentTieringConfigurations) Sets the value ofBucketProps.getIntelligentTieringConfigurations()- Parameters:
intelligentTieringConfigurations- Inteligent Tiering Configurations.- Returns:
this
-
inventories
Sets the value ofBucketProps.getInventories()- Parameters:
inventories- The inventory configuration of the bucket.- Returns:
this
-
lifecycleRules
@Stability(Stable) public BucketProps.Builder lifecycleRules(List<? extends LifecycleRule> lifecycleRules) Sets the value ofBucketProps.getLifecycleRules()- Parameters:
lifecycleRules- Rules that define how Amazon S3 manages objects during their lifetime.- Returns:
this
-
metrics
Sets the value ofBucketProps.getMetrics()- Parameters:
metrics- The metrics configuration of this bucket.- Returns:
this
-
minimumTlsVersion
Sets the value ofinvalid @link
BucketProps#getMinimumTlsVersion- Parameters:
minimumTlsVersion- Enforces minimum TLS version for requests. RequiresenforceSSLto be enabled.- Returns:
this
-
notificationsHandlerRole
@Stability(Stable) public BucketProps.Builder notificationsHandlerRole(IRole notificationsHandlerRole) Sets the value ofBucketProps.getNotificationsHandlerRole()- Parameters:
notificationsHandlerRole- The role to be used by the notifications handler.- Returns:
this
-
objectLockDefaultRetention
@Stability(Stable) public BucketProps.Builder objectLockDefaultRetention(ObjectLockRetention objectLockDefaultRetention) Sets the value ofBucketProps.getObjectLockDefaultRetention()- Parameters:
objectLockDefaultRetention- The default retention mode and rules for S3 Object Lock. Default retention can be configured after a bucket is created if the bucket already has object lock enabled. Enabling object lock for existing buckets is not supported.- Returns:
this
-
objectLockEnabled
Sets the value ofBucketProps.getObjectLockEnabled()- Parameters:
objectLockEnabled- Enable object lock on the bucket. Enabling object lock for existing buckets is not supported. Object lock must be enabled when the bucket is created.- Returns:
this
-
objectOwnership
Sets the value ofBucketProps.getObjectOwnership()- Parameters:
objectOwnership- The objectOwnership of the bucket.- Returns:
this
-
publicReadAccess
Sets the value ofBucketProps.getPublicReadAccess()- Parameters:
publicReadAccess- Grants public read access to all objects in the bucket. Similar to callingbucket.grantPublicAccess()- Returns:
this
-
removalPolicy
Sets the value ofBucketProps.getRemovalPolicy()- Parameters:
removalPolicy- Policy to apply when the bucket is removed from this stack.- Returns:
this
-
serverAccessLogsBucket
@Stability(Stable) public BucketProps.Builder serverAccessLogsBucket(IBucket serverAccessLogsBucket) Sets the value ofBucketProps.getServerAccessLogsBucket()- Parameters:
serverAccessLogsBucket- Destination bucket for the server access logs.- Returns:
this
-
serverAccessLogsPrefix
Sets the value ofBucketProps.getServerAccessLogsPrefix()- Parameters:
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.- Returns:
this
-
transferAcceleration
Sets the value ofBucketProps.getTransferAcceleration()- Parameters:
transferAcceleration- Whether this bucket should have transfer acceleration turned on or not.- Returns:
this
-
versioned
Sets the value ofBucketProps.getVersioned()- Parameters:
versioned- Whether this bucket should have versioning turned on or not.- Returns:
this
-
websiteErrorDocument
Sets the value ofBucketProps.getWebsiteErrorDocument()- Parameters:
websiteErrorDocument- The name of the error document (e.g. "404.html") for the website.websiteIndexDocumentmust also be set if this is set.- Returns:
this
-
websiteIndexDocument
Sets the value ofBucketProps.getWebsiteIndexDocument()- Parameters:
websiteIndexDocument- The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket.- Returns:
this
-
websiteRedirect
Sets the value ofBucketProps.getWebsiteRedirect()- Parameters:
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".- Returns:
this
-
websiteRoutingRules
@Stability(Stable) public BucketProps.Builder websiteRoutingRules(List<? extends RoutingRule> websiteRoutingRules) Sets the value ofBucketProps.getWebsiteRoutingRules()- Parameters:
websiteRoutingRules- Rules that define when a redirect is applied and the redirect behavior.- Returns:
this
-
build
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<BucketProps>- Returns:
- a new instance of
BucketProps - Throws:
NullPointerException- if any required attribute was not provided
-