Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transferEncoding for Streaming RequestBody with UnsignedPayload as True #5906

Merged
merged 4 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ default CodeBlock streamingMarshallerCode(IntermediateModel model, OperationMode
builder.add(".requiresLength(true)");
}

if (opModel.getAuthType() == AuthType.V4_UNSIGNED_BODY) {
if (opModel.getAuthType() == AuthType.V4_UNSIGNED_BODY || opModel.isUnsignedPayload()) {
builder.add(".transferEncoding(true)");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static software.amazon.awssdk.codegen.poet.ClientTestModels.customContentTypeModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.customPackageModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.endpointDiscoveryModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.opsWithSigv4a;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.queryServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.restJsonServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.rpcv2ServiceModels;
Expand Down Expand Up @@ -116,6 +117,12 @@ public void asyncClientBatchManager() {
assertThat(aSyncClientBatchManager, generatesTo("test-batchmanager-async.java"));
}

@Test
public void asyncClientWithStreamingUnsignedPayload() {
AsyncClientClass asyncClientClass = createAsyncClientClass(opsWithSigv4a(), false);
assertThat(asyncClientClass, generatesTo("test-unsigned-payload-trait-async-client-class.java"));
}

private AsyncClientClass createAsyncClientClass(IntermediateModel model) {
return new AsyncClientClass(GeneratorTaskParams.create(model, "sources/", "tests/", "resources/"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static software.amazon.awssdk.codegen.poet.ClientTestModels.customContentTypeModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.customPackageModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.endpointDiscoveryModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.opsWithSigv4a;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.queryServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.restJsonServiceModels;
import static software.amazon.awssdk.codegen.poet.ClientTestModels.rpcv2ServiceModels;
Expand Down Expand Up @@ -104,4 +105,11 @@ private SyncClientClass createSyncClientClass(IntermediateModel model, boolean u
model.getCustomizationConfig().setUseSraAuth(useSraAuth);
return createSyncClientClass(model);
}

@Test
public void syncClientClassWithUnsignedPayload() {
SyncClientClass syncClientClass = createSyncClientClass(opsWithSigv4a());
assertThat(syncClientClass, generatesTo("test-unsigned-payload-trait-sync-client-class.java"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,26 @@
"auth": ["aws.auth#sigv4","aws.auth#sigv4a"],
"unsignedPayload": true,
"documentation": "<p>Performs a GET request to get-row with unsigned payload and auth as sigv4 and sigv4a.</p>"
},
"opWithSigv4UnSignedPayloadAndStreaming": {
"name": "opWithSigv4UnSignedPayload",
"http": {
"method": "GET",
"requestUri": "/get-row/"
},
"input": {
"shape": "GetRowRequestWithStreaming"
},
"output": {
"shape": "GetRowResponse"
},
"errors": [
{
"shape": "InvalidInputException"
}
],
"unsignedPayload": true,
"documentation": "<p>Performs a GET with unsignedPayload streaming.</p>"
}
},
"shapes": {
Expand Down Expand Up @@ -287,6 +307,17 @@
},
"exception": true
},
"GetRowRequestWithStreaming":{
"type":"structure",
"members":{
"Body":{
"shape":"Body",
"streaming":true
}
},
"payload":"Body"
},
"Body":{"type":"blob"},
"String":{"type":"string"},
"invalidInputMessage":{"type":"string"}
},
Expand Down
Loading
Loading