Search in sources :

Example 1 with PresignedCreateMultipartUploadRequest

use of software.amazon.awssdk.services.s3.presigner.model.PresignedCreateMultipartUploadRequest in project aws-sdk-java-v2 by aws.

the class S3PresignerIntegrationTest method createMultipartUpload_CanBePresigned.

@Test
public void createMultipartUpload_CanBePresigned() throws IOException {
    String objectKey = generateRandomObjectKey();
    PresignedCreateMultipartUploadRequest presigned = presigner.presignCreateMultipartUpload(p -> p.signatureDuration(Duration.ofMinutes(10)).createMultipartUploadRequest(createMultipartUploadRequest(objectKey)));
    HttpExecuteResponse response = execute(presigned, null);
    assertThat(response.httpResponse().isSuccessful()).isTrue();
    Optional<MultipartUpload> upload = getMultipartUpload(objectKey);
    assertThat(upload).isPresent();
    client.abortMultipartUpload(abortMultipartUploadRequest(objectKey, upload.get().uploadId()));
}
Also used : HttpExecuteResponse(software.amazon.awssdk.http.HttpExecuteResponse) PresignedCreateMultipartUploadRequest(software.amazon.awssdk.services.s3.presigner.model.PresignedCreateMultipartUploadRequest) MultipartUpload(software.amazon.awssdk.services.s3.model.MultipartUpload) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 HttpExecuteResponse (software.amazon.awssdk.http.HttpExecuteResponse)1 MultipartUpload (software.amazon.awssdk.services.s3.model.MultipartUpload)1 PresignedCreateMultipartUploadRequest (software.amazon.awssdk.services.s3.presigner.model.PresignedCreateMultipartUploadRequest)1