Example usage for com.amazonaws.services.s3.model CopyObjectRequest withSourceSSECustomerKey

List of usage examples for com.amazonaws.services.s3.model CopyObjectRequest withSourceSSECustomerKey

Introduction

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

Prototype

public CopyObjectRequest withSourceSSECustomerKey(SSECustomerKey sseKey) 

Source Link

Document

Sets the optional customer-provided server-side encryption key to use to decrypt the source object being copied, and returns the updated request object so that additional method calls can be chained together.

Usage

From source file:io.druid.storage.s3.CustomServerSideEncryption.java

License:Apache License

@Override
public CopyObjectRequest decorate(CopyObjectRequest request) {
    // Note: users might want to use a different key when they copy existing objects. This might additionally need to
    // manage key history or support updating keys at run time, either of which requires a huge refactoring. We simply
    // don't support changing keys for now.
    return request.withSourceSSECustomerKey(key).withDestinationSSECustomerKey(key);
}

From source file:io.minio.awssdk.tests.S3TestUtils.java

License:Apache License

void copyObject(String bucketName, String keyName, SSECustomerKey sseKey, String targetBucketName,
        String targetKeyName, SSECustomerKey newSseKey, boolean replace) {
    CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, keyName, targetBucketName, targetKeyName);
    if (sseKey != null) {
        copyRequest.withSourceSSECustomerKey(sseKey);
    }/*  w w w. j a v a 2s  .  c  om*/
    if (newSseKey != null) {
        copyRequest.withDestinationSSECustomerKey(newSseKey);
    }
    if (replace) {
        copyRequest.withMetadataDirective(MetadataDirective.COPY);
    }
    s3Client.copyObject(copyRequest);
}