software.amazon.awssdk.services.s3.model.CopyObjectRequest Java Examples

The following examples show how to use software.amazon.awssdk.services.s3.model.CopyObjectRequest. 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: CopyObjectIntegrationTest.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that the simple form of the copy object operation correctly copies
 * an object.
 */
@Test
public void copyObject_CopiesObjectToNewKey() throws Exception {
    s3.copyObject(CopyObjectRequest.builder()
                                   .copySource(BUCKET_NAME + "/" + SOURCE_KEY)
                                   .bucket(BUCKET_NAME)
                                   .key(DESTINATION_KEY)
                                   .build());

    s3.headObject(HeadObjectRequest.builder()
                                   .bucket(BUCKET_NAME)
                                   .key(DESTINATION_KEY)
                                   .build());
}