Example usage for com.amazonaws.services.s3 AmazonS3Client setBucketVersioningConfiguration

List of usage examples for com.amazonaws.services.s3 AmazonS3Client setBucketVersioningConfiguration

Introduction

In this page you can find the example usage for com.amazonaws.services.s3 AmazonS3Client setBucketVersioningConfiguration.

Prototype

@Override
    public void setBucketVersioningConfiguration(
            SetBucketVersioningConfigurationRequest setBucketVersioningConfigurationRequest)
            throws SdkClientException, AmazonServiceException 

Source Link

Usage

From source file:com.eucalyptus.objectstorage.providers.s3.S3ProviderClient.java

License:Open Source License

@Override
public SetBucketVersioningStatusResponseType setBucketVersioningStatus(SetBucketVersioningStatusType request)
        throws S3Exception {
    SetBucketVersioningStatusResponseType reply = request.getReply();
    User requestUser = getRequestUser(request);
    OsgInternalS3Client internalS3Client = null;

    try {//w w  w. j  av  a 2s  .  c  o  m
        internalS3Client = getS3Client(requestUser);
        AmazonS3Client s3Client = internalS3Client.getS3Client();
        BucketVersioningConfiguration config = new BucketVersioningConfiguration()
                .withStatus(request.getVersioningStatus());
        SetBucketVersioningConfigurationRequest configRequest = new SetBucketVersioningConfigurationRequest(
                request.getBucket(), config);
        s3Client.setBucketVersioningConfiguration(configRequest);
    } catch (AmazonServiceException e) {
        LOG.debug("Error from backend", e);
        throw S3ExceptionMapper.fromAWSJavaSDK(e);
    }

    return reply;
}