From 20b32eb1159a1fa2458a5f5c1c4a9d332173372d Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Mon, 27 Mar 2023 14:34:38 -0700 Subject: [PATCH] Fix request ID logging for streaming operations (#2495) --- CHANGELOG.next.toml | 12 ++++++++++++ .../smithy/protocols/HttpBoundProtocolGenerator.kt | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index eff610036..71743b31a 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -22,3 +22,15 @@ message = "The outputs for event stream operations now implement the `Sync` auto references = ["smithy-rs#2496"] meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "all"} author = "jdisanti" + +[[aws-sdk-rust]] +message = "Streaming operations now emit the request ID at the `debug` log level like their non-streaming counterparts." +references = ["smithy-rs#2495"] +meta = { "breaking" = false, "tada" = false, "bug" = true } +author = "jdisanti" + +[[smithy-rs]] +message = "Streaming operations now emit the request ID at the `debug` log level like their non-streaming counterparts." +references = ["smithy-rs#2495"] +meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "client"} +author = "jdisanti" \ No newline at end of file diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt index a8ea456cf..6a5aeaff8 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt @@ -145,6 +145,7 @@ class HttpBoundProtocolTraitImplGenerator( impl #{ParseResponse} for $operationName { type Output = std::result::Result<#{O}, #{E}>; fn parse_unloaded(&self, response: &mut #{operation}::Response) -> Option { + #{BeforeParseResponse} // This is an error, defer to the non-streaming parser if !response.http().status().is_success() && response.http().status().as_u16() != $successCode { return None; @@ -161,6 +162,9 @@ class HttpBoundProtocolTraitImplGenerator( "E" to symbolProvider.symbolForOperationError(operationShape), "parse_streaming_response" to parseStreamingResponse(operationShape, customizations), "parse_error" to parseError(operationShape, customizations), + "BeforeParseResponse" to writable { + writeCustomizations(customizations, OperationSection.BeforeParseResponse(customizations, "response")) + }, *codegenScope, ) } -- GitLab