Example usage for com.amazonaws.services.s3 AmazonS3 disableRequesterPays

List of usage examples for com.amazonaws.services.s3 AmazonS3 disableRequesterPays

Introduction

In this page you can find the example usage for com.amazonaws.services.s3 AmazonS3 disableRequesterPays.

Prototype

public void disableRequesterPays(String bucketName) throws AmazonServiceException, SdkClientException;

Source Link

Document

Allows Amazon S3 bucket owner to disable the Requester Pays for the given bucket name.

Usage

From source file:org.alanwilliamson.amazon.s3.RequesterPays.java

License:Open Source License

public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException {

    AmazonKey amazonKey = getAmazonKey(_session, argStruct);
    AmazonS3 s3Client = getAmazonS3(amazonKey);

    String bucket = getNamedStringParam(argStruct, "bucket", null);
    boolean bRequester = getNamedBooleanParam(argStruct, "enabled", false);

    try {/*from w  w  w  . j av  a 2  s .  c o m*/

        if (bRequester)
            s3Client.enableRequesterPays(bucket.toLowerCase());
        else
            s3Client.disableRequesterPays(bucket.toLowerCase());
    } catch (Exception e) {
        throwException(_session, "AmazonS3: " + e.getMessage());
    }

    return cfBooleanData.TRUE;
}