Search in sources :

Example 1 with SetBucketVersioningConfigurationRequest

use of com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest in project aws-doc-sdk-examples by awsdocs.

the class CrossRegionReplication method createBucket.

private static void createBucket(AmazonS3 s3Client, Regions region, String bucketName) {
    CreateBucketRequest request = new CreateBucketRequest(bucketName, region.getName());
    s3Client.createBucket(request);
    BucketVersioningConfiguration configuration = new BucketVersioningConfiguration().withStatus(BucketVersioningConfiguration.ENABLED);
    SetBucketVersioningConfigurationRequest enableVersioningRequest = new SetBucketVersioningConfigurationRequest(bucketName, configuration);
    s3Client.setBucketVersioningConfiguration(enableVersioningRequest);
}
Also used : CreateBucketRequest(com.amazonaws.services.s3.model.CreateBucketRequest) SetBucketVersioningConfigurationRequest(com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest) BucketVersioningConfiguration(com.amazonaws.services.s3.model.BucketVersioningConfiguration)

Aggregations

BucketVersioningConfiguration (com.amazonaws.services.s3.model.BucketVersioningConfiguration)1 CreateBucketRequest (com.amazonaws.services.s3.model.CreateBucketRequest)1 SetBucketVersioningConfigurationRequest (com.amazonaws.services.s3.model.SetBucketVersioningConfigurationRequest)1