From 5e41fcbaf9c1773c65b6f2a3f7641f05f9ce2529 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Wed, 3 Jul 2024 14:40:27 -0700 Subject: [PATCH] S3Client breaking change: DEFAULT requests must pass operation name (#802) **Issue:** see: https://github.com/awslabs/aws-c-s3/pull/439 **Description of changes:** - When making requests with the `S3Client` of type `MetaRequestType.DEFAULT`, the user MUST specify the operation name - Latest submodules: ``` aws-c-cal v0.6.15 -> v0.7.1 aws-c-common v0.9.21 -> v0.9.23 aws-c-s3 v0.5.10 -> v0.6.0 s2n v1.4.16 -> v1.4.17 ``` --- crt/aws-c-cal | 2 +- crt/aws-c-common | 2 +- crt/aws-c-s3 | 2 +- crt/s2n | 2 +- .../java/software/amazon/awssdk/crt/s3/S3Client.java | 9 ++++----- .../amazon/awssdk/crt/s3/S3MetaRequestOptions.java | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/crt/aws-c-cal b/crt/aws-c-cal index 96c47e339..71810b1ad 160000 --- a/crt/aws-c-cal +++ b/crt/aws-c-cal @@ -1 +1 @@ -Subproject commit 96c47e339d030d1fa4eaca201be948bc4442510d +Subproject commit 71810b1ade7af4747104ae245b74240ae8e8cf77 diff --git a/crt/aws-c-common b/crt/aws-c-common index 4f874cea5..6d974f92c 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 4f874cea50a70bc6ebcd85c6ce1c6c0016b5aff4 +Subproject commit 6d974f92c1d86391c1dcb1173239adf757c52b2d diff --git a/crt/aws-c-s3 b/crt/aws-c-s3 index 6588f9a71..cb431ba06 160000 --- a/crt/aws-c-s3 +++ b/crt/aws-c-s3 @@ -1 +1 @@ -Subproject commit 6588f9a714ee7a8be1bddd63ea5ea1ea224d00b4 +Subproject commit cb431ba06b5d3db4373cd8fb55d6c16464cbf2ea diff --git a/crt/s2n b/crt/s2n index 114ccab0f..073c7b415 160000 --- a/crt/s2n +++ b/crt/s2n @@ -1 +1 @@ -Subproject commit 114ccab0ff2cde491203ac841837d0d39b767412 +Subproject commit 073c7b415a17d271a7b2c8c385d0e641fc94871f diff --git a/src/main/java/software/amazon/awssdk/crt/s3/S3Client.java b/src/main/java/software/amazon/awssdk/crt/s3/S3Client.java index ac5f86671..f7cca31c2 100644 --- a/src/main/java/software/amazon/awssdk/crt/s3/S3Client.java +++ b/src/main/java/software/amazon/awssdk/crt/s3/S3Client.java @@ -142,11 +142,10 @@ public S3MetaRequest makeMetaRequest(S3MetaRequestOptions options) { } String operationName = options.getOperationName(); - if (operationName == null && options.getMetaRequestType() == S3MetaRequestOptions.MetaRequestType.DEFAULT) { - // The upcoming release of aws-c-s3 v0.6.0 will require an operation name for DEFAULT meta-requests. - // Set a default value for now, in case this code gets mixed with the upcoming aws-c-s3 release. - // But when we take the upcoming release for real, change this code to throw IllegalArgumentException. - operationName = new String("DEFAULT"); + if (options.getMetaRequestType() == S3MetaRequestOptions.MetaRequestType.DEFAULT && operationName == null) { + Log.log(Log.LogLevel.Error, Log.LogSubject.S3Client, + "S3Client.makeMetaRequest has invalid options; Operation name must be set for MetaRequestType.DEFAULT."); + throw new IllegalArgumentException("S3Client.makeMetaRequest has invalid options; Operation name must be set for MetaRequestType.DEFAULT."); } S3MetaRequest metaRequest = new S3MetaRequest(); diff --git a/src/main/java/software/amazon/awssdk/crt/s3/S3MetaRequestOptions.java b/src/main/java/software/amazon/awssdk/crt/s3/S3MetaRequestOptions.java index 9ce0a4db3..d3cb7fd84 100644 --- a/src/main/java/software/amazon/awssdk/crt/s3/S3MetaRequestOptions.java +++ b/src/main/java/software/amazon/awssdk/crt/s3/S3MetaRequestOptions.java @@ -102,7 +102,7 @@ public MetaRequestType getMetaRequestType() { /** * The S3 operation name (eg: "CreateBucket"), - * this should be set for {@link MetaRequestType#DEFAULT}, + * this MUST be set for {@link MetaRequestType#DEFAULT}, * it is ignored for other meta request types since the operation is implicit. * * See