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

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

Introduction

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

Prototype

public void setLogFilePrefix(String logFilePrefix) 

Source Link

Document

Sets the log file prefix for this bucket logging configuration.

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  a v  a 2 s  . c o 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;
}