You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sign event stream initial messages with signer (#4431)
## Motivation and Context
#4429
## Description
Event stream operations with initial-request messages send that message
unsigned, whose root cause is described in the issue above.
To resolve it, instead of pre-serializing the initial message to bytes,
this PR
1. creates a wrapper marshaller that can handle both regular events and
initial messages
2. creates a stream out of the initial message
3. chains that stream with the event stream
4. lets the entire combined stream flow through `MessageStreamAdapter`
for signing
## Testing
Added client codegen test for signing initial message and event.
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] For changes to the smithy-rs codegen or runtime crates, I have
created a changelog entry Markdown file in the `.changelog` directory,
specifying "client," "server," or both in the `applies_to` key.
- [x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" in the `applies_to`
key.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: ysaito1001 <awsaito@amazon.com>
Copy file name to clipboardExpand all lines: codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/HttpBoundProtocolGenerator.kt
+24-10Lines changed: 24 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -64,29 +64,43 @@ private fun eventStreamWithInitialRequest(
64
64
returnnull
65
65
}
66
66
67
+
val smithyHttp =RuntimeType.smithyHttp(codegenContext.runtimeConfig)
68
+
val eventOrInitial = smithyHttp.resolve("event_stream::EventOrInitial")
69
+
val eventOrInitialMarshaller = smithyHttp.resolve("event_stream::EventOrInitialMarshaller")
Copy file name to clipboardExpand all lines: codegen-client/src/test/kotlin/software/amazon/smithy/rust/codegen/client/smithy/protocols/eventstream/ClientEventStreamMarshallerGeneratorTest.kt
+128Lines changed: 128 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -181,6 +181,134 @@ class ClientEventStreamMarshallerGeneratorTest {
0 commit comments