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

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

Introduction

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

Prototype

public BucketLoggingConfiguration() 

Source Link

Document

Creates a new bucket logging configuration, which by default is disabled.

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 {/*  w w  w.j av a2s. 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;
}