AWS SDK

AWS SDK

rev. 24b01eb5db276bb003a50c3217d5e7030eff55ff

Files changed:

tmp-codegen-diff/aws-sdk/sdk/aws-smithy-http/src/event_stream/receiver.rs

@@ -1,1 +39,39 @@
    1      1   
/*
    2      2   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    3      3   
 * SPDX-License-Identifier: Apache-2.0
    4      4   
 */
    5      5   
    6      6   
use aws_smithy_eventstream::frame::{
    7      7   
    DecodedFrame, MessageFrameDecoder, UnmarshallMessage, UnmarshalledMessage,
    8      8   
};
    9         -
use aws_smithy_runtime_api::client::result::{ConnectorError, ResponseError, SdkError};
           9  +
use aws_smithy_runtime_api::client::result::{ConnectorError, SdkError};
   10     10   
use aws_smithy_types::body::SdkBody;
   11     11   
use aws_smithy_types::event_stream::{Message, RawMessage};
   12     12   
use bytes::Buf;
   13     13   
use bytes::Bytes;
   14     14   
use bytes_utils::SegmentedBuf;
   15     15   
use std::error::Error as StdError;
   16     16   
use std::fmt;
   17     17   
use std::marker::PhantomData;
   18     18   
use std::mem;
   19     19   
use tracing::trace;
@@ -202,202 +300,277 @@
  222    222   
        Ok(None)
  223    223   
    }
  224    224   
  225    225   
    /// Tries to receive the initial response message that has `:event-type` of a given `message_type`.
  226    226   
    /// If a different event type is received, then it is buffered and `Ok(None)` is returned.
  227    227   
    #[doc(hidden)]
  228    228   
    pub async fn try_recv_initial(
  229    229   
        &mut self,
  230    230   
        message_type: InitialMessageType,
  231    231   
    ) -> Result<Option<Message>, SdkError<E, RawMessage>> {
  232         -
        self.try_recv_initial_with_preprocessor(message_type, |msg| Ok((msg, ())))
  233         -
            .await
  234         -
            .map(|opt| opt.map(|(msg, _)| msg))
  235         -
    }
  236         -
  237         -
    /// Tries to receive the initial response message with preprocessing support.
  238         -
    ///
  239         -
    /// The preprocessor function can transform the raw message (e.g., unwrap envelopes)
  240         -
    /// and return metadata alongside the transformed message. If the transformed message
  241         -
    /// matches the expected `message_type`, both the message and metadata are returned.
  242         -
    /// Otherwise, the transformed message is buffered and `Ok(None)` is returned.
  243         -
    #[doc(hidden)]
  244         -
    pub async fn try_recv_initial_with_preprocessor<F, M>(
  245         -
        &mut self,
  246         -
        message_type: InitialMessageType,
  247         -
        preprocessor: F,
  248         -
    ) -> Result<Option<(Message, M)>, SdkError<E, RawMessage>>
  249         -
    where
  250         -
        F: FnOnce(Message) -> Result<(Message, M), ResponseError<RawMessage>>,
  251         -
    {
  252    232   
        if let Some(message) = self.next_message().await? {
  253         -
            let (processed_message, metadata) =
  254         -
                preprocessor(message.clone()).map_err(|err| SdkError::ResponseError(err))?;
  255         -
  256         -
            if let Some(event_type) = processed_message
         233  +
            if let Some(event_type) = message
  257    234   
                .headers()
  258    235   
                .iter()
  259    236   
                .find(|h| h.name().as_str() == ":event-type")
  260    237   
            {
  261    238   
                if event_type
  262    239   
                    .value()
  263    240   
                    .as_string()
  264    241   
                    .map(|s| s.as_str() == message_type.as_str())
  265    242   
                    .unwrap_or(false)
  266    243   
                {
  267         -
                    return Ok(Some((processed_message, metadata)));
         244  +
                    return Ok(Some(message));
  268    245   
                }
  269    246   
            }
  270         -
            // Buffer the processed message so that it can be returned by the next call to `recv()`
         247  +
            // Buffer the message so that it can be returned by the next call to `recv()`
  271    248   
            self.buffered_message = Some(message);
  272    249   
        }
  273    250   
        Ok(None)
  274    251   
    }
  275    252   
  276    253   
    /// Asynchronously tries to receive a message from the stream. If the stream has ended,
  277    254   
    /// it returns an `Ok(None)`. If there is a transport layer error, it will return
  278    255   
    /// `Err(SdkError::DispatchFailure)`. Service-modeled errors will be a part of the returned
  279    256   
    /// messages.
  280    257   
    pub async fn recv(&mut self) -> Result<Option<T>, SdkError<E, RawMessage>> {

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_converse_stream_output.rs

@@ -1,1 +12,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_stream_payload(
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<crate::types::ConverseStreamOutput, crate::types::error::ConverseStreamOutputError>,
    6      6   
    crate::operation::converse_stream::ConverseStreamError,
    7      7   
> {
    8      8   
    let unmarshaller = crate::event_stream_serde::ConverseStreamOutputUnmarshaller::new();
    9      9   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   11         -
    Ok(receiver)
          10  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          11  +
        unmarshaller,
          12  +
        body,
          13  +
    )))
   12     14   
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_invoke_model_with_bidirectional_stream_output.rs

@@ -1,1 +15,17 @@
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<
    6      6   
        crate::types::InvokeModelWithBidirectionalStreamOutput,
    7      7   
        crate::types::error::InvokeModelWithBidirectionalStreamOutputError,
    8      8   
    >,
    9      9   
    crate::operation::invoke_model_with_bidirectional_stream::InvokeModelWithBidirectionalStreamError,
   10     10   
> {
   11     11   
    let unmarshaller = crate::event_stream_serde::InvokeModelWithBidirectionalStreamOutputUnmarshaller::new();
   12     12   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   13         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   14         -
    Ok(receiver)
          13  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          14  +
        unmarshaller,
          15  +
        body,
          16  +
    )))
   15     17   
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_invoke_model_with_response_stream_output.rs

@@ -1,1 +26,28 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_body_payload(
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>,
    6      6   
    crate::operation::invoke_model_with_response_stream::InvokeModelWithResponseStreamError,
    7      7   
> {
    8      8   
    let unmarshaller = crate::event_stream_serde::ResponseStreamUnmarshaller::new();
    9      9   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   11         -
    Ok(receiver)
          10  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          11  +
        unmarshaller,
          12  +
        body,
          13  +
    )))
   12     14   
}
   13     15   
   14     16   
pub(crate) fn de_content_type_header(
   15     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   16     18   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   17     19   
    let headers = header_map.get_all("X-Amzn-Bedrock-Content-Type");
   18     20   
    ::aws_smithy_http::header::one_or_none(headers)
   19     21   
}
   20     22   
   21     23   
pub(crate) fn de_performance_config_latency_header(

tmp-codegen-diff/aws-sdk/sdk/cloudwatchlogs/src/protocol_serde/shape_get_log_object_output.rs

@@ -1,1 +12,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_field_stream_payload(
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<crate::types::GetLogObjectResponseStream, crate::types::error::GetLogObjectResponseStreamError>,
    6      6   
    crate::operation::get_log_object::GetLogObjectError,
    7      7   
> {
    8      8   
    let unmarshaller = crate::event_stream_serde::GetLogObjectResponseStreamUnmarshaller::new();
    9      9   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   11         -
    Ok(receiver)
          10  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          11  +
        unmarshaller,
          12  +
        body,
          13  +
    )))
   12     14   
}

tmp-codegen-diff/aws-sdk/sdk/cloudwatchlogs/src/protocol_serde/shape_start_live_tail_output.rs

@@ -1,1 +12,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_response_stream_payload(
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<crate::types::StartLiveTailResponseStream, crate::types::error::StartLiveTailResponseStreamError>,
    6      6   
    crate::operation::start_live_tail::StartLiveTailError,
    7      7   
> {
    8      8   
    let unmarshaller = crate::event_stream_serde::StartLiveTailResponseStreamUnmarshaller::new();
    9      9   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   11         -
    Ok(receiver)
          10  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          11  +
        unmarshaller,
          12  +
        body,
          13  +
    )))
   12     14   
}

tmp-codegen-diff/aws-sdk/sdk/lambda/src/protocol_serde/shape_invoke_with_response_stream_output.rs

@@ -1,1 +29,31 @@
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<
    6      6   
        crate::types::InvokeWithResponseStreamResponseEvent,
    7      7   
        crate::types::error::InvokeWithResponseStreamResponseEventError,
    8      8   
    >,
    9      9   
    crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
   10     10   
> {
   11     11   
    let unmarshaller = crate::event_stream_serde::InvokeWithResponseStreamResponseEventUnmarshaller::new();
   12     12   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   13         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   14         -
    Ok(receiver)
          13  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          14  +
        unmarshaller,
          15  +
        body,
          16  +
    )))
   15     17   
}
   16     18   
   17     19   
pub(crate) fn de_executed_version_header(
   18     20   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   19     21   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   20     22   
    let headers = header_map.get_all("X-Amz-Executed-Version");
   21     23   
    ::aws_smithy_http::header::one_or_none(headers)
   22     24   
}
   23     25   
   24     26   
pub(crate) fn de_response_stream_content_type_header(

tmp-codegen-diff/aws-sdk/sdk/s3/src/protocol_serde/shape_select_object_content_output.rs

@@ -1,1 +12,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_payload_payload(
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<crate::types::SelectObjectContentEventStream, crate::types::error::SelectObjectContentEventStreamError>,
    6      6   
    crate::operation::select_object_content::SelectObjectContentError,
    7      7   
> {
    8      8   
    let unmarshaller = crate::event_stream_serde::SelectObjectContentEventStreamUnmarshaller::new();
    9      9   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   11         -
    Ok(receiver)
          10  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          11  +
        unmarshaller,
          12  +
        body,
          13  +
    )))
   12     14   
}

tmp-codegen-diff/aws-sdk/sdk/transcribestreaming/src/protocol_serde/shape_start_call_analytics_stream_transcription_output.rs

@@ -1,1 +44,46 @@
    3      3   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      4   
) -> std::result::Result<
    5      5   
    crate::event_receiver::EventReceiver<
    6      6   
        crate::types::CallAnalyticsTranscriptResultStream,
    7      7   
        crate::types::error::CallAnalyticsTranscriptResultStreamError,
    8      8   
    >,
    9      9   
    crate::operation::start_call_analytics_stream_transcription::StartCallAnalyticsStreamTranscriptionError,
   10     10   
> {
   11     11   
    let unmarshaller = crate::event_stream_serde::CallAnalyticsTranscriptResultStreamUnmarshaller::new();
   12     12   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   13         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   14         -
    Ok(receiver)
          13  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          14  +
        unmarshaller,
          15  +
        body,
          16  +
    )))
   15     17   
}
   16     18   
   17     19   
pub(crate) fn de_content_identification_type_header(
   18     20   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   19     21   
) -> ::std::result::Result<::std::option::Option<crate::types::ContentIdentificationType>, ::aws_smithy_http::header::ParseError> {
   20     22   
    let headers = header_map.get_all("x-amzn-transcribe-content-identification-type");
   21     23   
    ::aws_smithy_http::header::one_or_none(headers)
   22     24   
}
   23     25   
   24     26   
pub(crate) fn de_content_redaction_type_header(

tmp-codegen-diff/aws-sdk/sdk/transcribestreaming/src/protocol_serde/shape_start_medical_scribe_stream_output.rs

@@ -17,17 +56,58 @@
   37     37   
}
   38     38   
   39     39   
pub fn de_result_stream_payload(
   40     40   
    body: &mut ::aws_smithy_types::body::SdkBody,
   41     41   
) -> std::result::Result<
   42     42   
    crate::event_receiver::EventReceiver<crate::types::MedicalScribeResultStream, crate::types::error::MedicalScribeResultStreamError>,
   43     43   
    crate::operation::start_medical_scribe_stream::StartMedicalScribeStreamError,
   44     44   
> {
   45     45   
    let unmarshaller = crate::event_stream_serde::MedicalScribeResultStreamUnmarshaller::new();
   46     46   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   47         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
   48         -
    Ok(receiver)
          47  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
          48  +
        unmarshaller,
          49  +
        body,
          50  +
    )))
   49     51   
}
   50     52   
   51     53   
pub(crate) fn de_session_id_header(
   52     54   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   53     55   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   54     56   
    let headers = header_map.get_all("x-amzn-transcribe-session-id");
   55     57   
    ::aws_smithy_http::header::one_or_none(headers)
   56     58   
}

tmp-codegen-diff/aws-sdk/sdk/transcribestreaming/src/protocol_serde/shape_start_medical_stream_transcription_output.rs

@@ -86,86 +132,134 @@
  106    106   
}
  107    107   
  108    108   
pub fn de_transcript_result_stream_payload(
  109    109   
    body: &mut ::aws_smithy_types::body::SdkBody,
  110    110   
) -> std::result::Result<
  111    111   
    crate::event_receiver::EventReceiver<crate::types::MedicalTranscriptResultStream, crate::types::error::MedicalTranscriptResultStreamError>,
  112    112   
    crate::operation::start_medical_stream_transcription::StartMedicalStreamTranscriptionError,
  113    113   
> {
  114    114   
    let unmarshaller = crate::event_stream_serde::MedicalTranscriptResultStreamUnmarshaller::new();
  115    115   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
  116         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
  117         -
    Ok(receiver)
         116  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
         117  +
        unmarshaller,
         118  +
        body,
         119  +
    )))
  118    120   
}
  119    121   
  120    122   
pub(crate) fn de_type_header(
  121    123   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  122    124   
) -> ::std::result::Result<::std::option::Option<crate::types::Type>, ::aws_smithy_http::header::ParseError> {
  123    125   
    let headers = header_map.get_all("x-amzn-transcribe-type");
  124    126   
    ::aws_smithy_http::header::one_or_none(headers)
  125    127   
}
  126    128   
  127    129   
pub(crate) fn de_vocabulary_name_header(

tmp-codegen-diff/aws-sdk/sdk/transcribestreaming/src/protocol_serde/shape_start_stream_transcription_output.rs

@@ -169,169 +230,232 @@
  189    189   
}
  190    190   
  191    191   
pub fn de_transcript_result_stream_payload(
  192    192   
    body: &mut ::aws_smithy_types::body::SdkBody,
  193    193   
) -> std::result::Result<
  194    194   
    crate::event_receiver::EventReceiver<crate::types::TranscriptResultStream, crate::types::error::TranscriptResultStreamError>,
  195    195   
    crate::operation::start_stream_transcription::StartStreamTranscriptionError,
  196    196   
> {
  197    197   
    let unmarshaller = crate::event_stream_serde::TranscriptResultStreamUnmarshaller::new();
  198    198   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
  199         -
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
  200         -
    Ok(receiver)
         199  +
    Ok(crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(
         200  +
        unmarshaller,
         201  +
        body,
         202  +
    )))
  201    203   
}
  202    204   
  203    205   
pub(crate) fn de_vocabulary_filter_method_header(
  204    206   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  205    207   
) -> ::std::result::Result<::std::option::Option<crate::types::VocabularyFilterMethod>, ::aws_smithy_http::header::ParseError> {
  206    208   
    let headers = header_map.get_all("x-amzn-transcribe-vocabulary-filter-method");
  207    209   
    ::aws_smithy_http::header::one_or_none(headers)
  208    210   
}
  209    211   
  210    212   
pub(crate) fn de_vocabulary_filter_name_header(