Example usage for com.amazonaws.services.s3.model UploadPartRequest setSSECustomerKey

List of usage examples for com.amazonaws.services.s3.model UploadPartRequest setSSECustomerKey

Introduction

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

Prototype

public void setSSECustomerKey(SSECustomerKey sseKey) 

Source Link

Document

Sets the optional customer-provided server-side encryption key to use to encrypt the object part being uploaded.

Usage

From source file:org.apache.beam.sdk.io.aws.s3.S3WritableByteChannel.java

License:Apache License

private void flush() throws IOException {
    uploadBuffer.flip();/*from w  ww . j a v  a 2  s  . co m*/
    ByteArrayInputStream inputStream = new ByteArrayInputStream(uploadBuffer.array());

    UploadPartRequest request = new UploadPartRequest().withBucketName(path.getBucket()).withKey(path.getKey())
            .withUploadId(uploadId).withPartNumber(partNumber++).withPartSize(uploadBuffer.remaining())
            .withMD5Digest(Base64.encodeAsString(md5.digest())).withInputStream(inputStream);
    request.setSSECustomerKey(options.getSSECustomerKey());

    UploadPartResult result;
    try {
        result = amazonS3.uploadPart(request);
    } catch (AmazonClientException e) {
        throw new IOException(e);
    }
    uploadBuffer.clear();
    md5.reset();
    eTags.add(result.getPartETag());
}

From source file:org.apache.nifi.processors.aws.s3.encryption.ServerSideCEKEncryptionStrategy.java

License:Apache License

@Override
public void configureUploadPartRequest(UploadPartRequest request, ObjectMetadata objectMetadata,
        String keyValue) {/*from   w  ww .j  a  va 2s .c  o  m*/
    SSECustomerKey customerKey = new SSECustomerKey(keyValue);
    request.setSSECustomerKey(customerKey);
}