/** * Sets the optional customer-provided server-side encryption key to use to * encrypt the destination object being copied, and returns the updated * request object so that additional method calls can be chained together. * * @param sseKey * The optional customer-provided server-side encryption key to * use to encrypt the destination object being copied. * * @return This updated request object so that additional method calls can * be chained together. */ public CopyObjectRequest withDestinationSSECustomerKey(SSECustomerKey sseKey) { setDestinationSSECustomerKey(sseKey); return this; }
/** * Sets the optional customer-provided server-side encryption key to use to * encrypt the destination object being copied, and returns the updated * request object so that additional method calls can be chained together. * * @param sseKey The optional customer-provided server-side encryption key * to use to encrypt the destination object being copied. * @return This updated request object so that additional method calls can be * chained together. */ public CopyObjectRequest withDestinationSSECustomerKey(SSECustomerKey sseKey) { setDestinationSSECustomerKey(sseKey); return this; }
/** * Sets the optional customer-provided server-side encryption key to use to * encrypt the destination object being copied, and returns the updated * request object so that additional method calls can be chained together. * * @param sseKey The optional customer-provided server-side encryption key * to use to encrypt the destination object being copied. * @return This updated request object so that additional method calls can be * chained together. */ public CopyObjectRequest withDestinationSSECustomerKey(SSECustomerKey sseKey) { setDestinationSSECustomerKey(sseKey); return this; }
/** * Sets the optional customer-provided server-side encryption key to use to * encrypt the destination object being copied, and returns the updated * request object so that additional method calls can be chained together. * * @param sseKey * The optional customer-provided server-side encryption key to * use to encrypt the destination object being copied. * * @return This updated request object so that additional method calls can * be chained together. */ public CopyObjectRequest withDestinationSSECustomerKey(SSECustomerKey sseKey) { setDestinationSSECustomerKey(sseKey); return this; }
protected void setOptionalCopyObjectRequestParameters( CopyObjectRequest copyObjectRequest) throws IOException { switch (serverSideEncryptionAlgorithm) { case SSE_KMS: copyObjectRequest.setSSEAwsKeyManagementParams( generateSSEAwsKeyParams() ); break; case SSE_C: if (isNotBlank(getServerSideEncryptionKey(bucket, getConf()))) { //at the moment, only supports copy using the same key SSECustomerKey customerKey = generateSSECustomerKey(); copyObjectRequest.setSourceSSECustomerKey(customerKey); copyObjectRequest.setDestinationSSECustomerKey(customerKey); } break; default: } }
@VisibleForTesting CopyObjectResult atomicCopy( S3ResourceId sourcePath, S3ResourceId destinationPath, ObjectMetadata sourceObjectMetadata) throws AmazonClientException { CopyObjectRequest copyObjectRequest = new CopyObjectRequest( sourcePath.getBucket(), sourcePath.getKey(), destinationPath.getBucket(), destinationPath.getKey()); copyObjectRequest.setNewObjectMetadata(sourceObjectMetadata); copyObjectRequest.setStorageClass(options.getS3StorageClass()); copyObjectRequest.setSourceSSECustomerKey(options.getSSECustomerKey()); copyObjectRequest.setDestinationSSECustomerKey(options.getSSECustomerKey()); return amazonS3.copyObject(copyObjectRequest); }