@@ -12,6 +12,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.RustType
1212import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
1313import software.amazon.smithy.rust.codegen.core.smithy.RuntimeConfig
1414import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
15+ import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType.Companion.preludeScope
1516import software.amazon.smithy.rust.codegen.core.smithy.mapRustType
1617import software.amazon.smithy.rust.codegen.core.smithy.rustType
1718import software.amazon.smithy.rust.codegen.core.util.PANIC
@@ -77,11 +78,12 @@ object SigV4EventStreamSupportStructures {
7778 ##[derive(Debug, Clone)]
7879 pub struct SignatureInfo {
7980 /// The chunk signature bytes from the `:chunk-signature` header
80- pub chunk_signature: Vec<u8>,
81+ pub chunk_signature: #{ Vec} <u8>,
8182 /// The timestamp from the `:date` header
8283 pub timestamp: #{SystemTime},
8384 }
8485 """ ,
86+ * preludeScope,
8587 " SystemTime" to RuntimeType .std.resolve(" time::SystemTime" ),
8688 )
8789 }
@@ -116,18 +118,25 @@ object SigV4EventStreamSupportStructures {
116118 ##[derive(Debug)]
117119 pub enum SignedEventError<E> {
118120 /// Error from the underlying event stream
119- Event(E),
121+ Event {
122+ /// The error from the underlying event stream
123+ error: E,
124+ /// Signature information if the message was signed
125+ signature: #{Option}<#{SignatureInfo}>,
126+ },
120127 /// Error extracting signed message
121128 InvalidSignedEvent(#{ExtractionError}),
122129 }
123130
124131 impl<E> From<E> for SignedEventError<E> {
125132 fn from(err: E) -> Self {
126- SignedEventError::Event( err)
133+ SignedEventError::Event { error: err, signature: None }
127134 }
128135 }
129136 """ ,
130137 " ExtractionError" to extractionError(runtimeConfig),
138+ " SignatureInfo" to signatureInfo(),
139+ * preludeScope,
131140 )
132141 }
133142
@@ -182,11 +191,14 @@ object SigV4EventStreamSupportStructures {
182191 #{UnmarshalledMessage}::Event(event) => {
183192 Ok(#{UnmarshalledMessage}::Event(#{SignedEvent} {
184193 message: event,
185- signature: Some(signature),
194+ signature: Some(signature.clone() ),
186195 }))
187196 }
188197 #{UnmarshalledMessage}::Error(err) => {
189- Ok(#{UnmarshalledMessage}::Error(#{SignedEventError}::Event(err)))
198+ Ok(#{UnmarshalledMessage}::Error(#{SignedEventError}::Event {
199+ error: err,
200+ signature: Some(signature),
201+ }))
190202 }
191203 },
192204 Err(err) => Err(err),
@@ -203,7 +215,10 @@ object SigV4EventStreamSupportStructures {
203215 }))
204216 }
205217 #{UnmarshalledMessage}::Error(err) => {
206- Ok(#{UnmarshalledMessage}::Error(#{SignedEventError}::Event(err)))
218+ Ok(#{UnmarshalledMessage}::Error(#{SignedEventError}::Event {
219+ error: err,
220+ signature: None,
221+ }))
207222 }
208223 },
209224 Err(err) => Err(err),
0 commit comments