Java Code Examples for com.amazonaws.services.s3.model.UploadPartRequest#setSSECustomerKey()

The following examples show how to use com.amazonaws.services.s3.model.UploadPartRequest#setSSECustomerKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: S3WritableByteChannel.java    From beam with Apache License 2.0 6 votes vote down vote up
private void flush() throws IOException {
  uploadBuffer.flip();
  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());
}
 
Example 2
Source File: ServerSideCEncryptionStrategy.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public void configureUploadPartRequest(UploadPartRequest request, ObjectMetadata objectMetadata, String keyValue) {
    SSECustomerKey customerKey = new SSECustomerKey(keyValue);
    request.setSSECustomerKey(customerKey);
}