Example usage for com.amazonaws.services.s3.model SetBucketLoggingConfigurationRequest SetBucketLoggingConfigurationRequest

List of usage examples for com.amazonaws.services.s3.model SetBucketLoggingConfigurationRequest SetBucketLoggingConfigurationRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model SetBucketLoggingConfigurationRequest SetBucketLoggingConfigurationRequest.

Prototype

public SetBucketLoggingConfigurationRequest(String bucketName,
        BucketLoggingConfiguration loggingConfiguration) 

Source Link

Document

Constructs a new SetBucketLoggingConfigurationRequest to set the bucket logging configuration of the specified bucket.

Usage

From source file:com.eucalyptus.cloudformation.resources.standard.actions.AWSS3BucketResourceAction.java

License:Open Source License

private SetBucketLoggingConfigurationRequest convertLoggingConfiguration(String bucketName,
        S3LoggingConfiguration loggingConfiguration) {
    BucketLoggingConfiguration bucketLoggingConfiguration = new BucketLoggingConfiguration();
    bucketLoggingConfiguration.setDestinationBucketName(loggingConfiguration.getDestinationBucketName());
    bucketLoggingConfiguration.setLogFilePrefix(loggingConfiguration.getLogFilePrefix());
    return new SetBucketLoggingConfigurationRequest(bucketName, bucketLoggingConfiguration);
}

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

License:Open Source License

@Override
public SetBucketLoggingStatusResponseType setBucketLoggingStatus(SetBucketLoggingStatusType request)
        throws S3Exception {
    SetBucketLoggingStatusResponseType reply = request.getReply();
    User requestUser = getRequestUser(request);
    OsgInternalS3Client internalS3Client = null;

    try {//from ww w.  j  a v  a 2  s. co m
        internalS3Client = getS3Client(requestUser);
        AmazonS3Client s3Client = internalS3Client.getS3Client();
        BucketLoggingConfiguration config = new BucketLoggingConfiguration();
        LoggingEnabled requestConfig = request.getLoggingEnabled();
        config.setDestinationBucketName(requestConfig == null ? null : requestConfig.getTargetBucket());
        config.setLogFilePrefix(requestConfig == null ? null : requestConfig.getTargetPrefix());

        SetBucketLoggingConfigurationRequest loggingRequest = new SetBucketLoggingConfigurationRequest(
                request.getBucket(), config);
        s3Client.setBucketLoggingConfiguration(loggingRequest);
        reply.setStatus(HttpResponseStatus.OK);
        reply.setStatusMessage("OK");
    } catch (AmazonServiceException e) {
        LOG.debug("Error from backend", e);
        throw S3ExceptionMapper.fromAWSJavaSDK(e);
    }
    return reply;
}