Client Test

Client Test

rev. d838bf488731ae5e751cce0fe13f339a5b9be858 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_distinct_streams/_duplex_stream_with_distinct_streams_input.rs

@@ -0,1 +0,75 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::fmt::Debug)]
           5  +
pub struct DuplexStreamWithDistinctStreamsInput {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub stream: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
           8  +
}
           9  +
impl DuplexStreamWithDistinctStreamsInput {
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    pub fn stream(&self) -> &::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError> {
          12  +
        &self.stream
          13  +
    }
          14  +
}
          15  +
impl DuplexStreamWithDistinctStreamsInput {
          16  +
    /// Creates a new builder-style object to manufacture [`DuplexStreamWithDistinctStreamsInput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsInput).
          17  +
    pub fn builder() -> crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder {
          18  +
        crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder::default()
          19  +
    }
          20  +
}
          21  +
          22  +
/// A builder for [`DuplexStreamWithDistinctStreamsInput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsInput).
          23  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          24  +
#[non_exhaustive]
          25  +
pub struct DuplexStreamWithDistinctStreamsInputBuilder {
          26  +
    pub(crate) stream:
          27  +
        ::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>,
          28  +
}
          29  +
impl DuplexStreamWithDistinctStreamsInputBuilder {
          30  +
    #[allow(missing_docs)] // documentation missing in model
          31  +
    pub fn stream(
          32  +
        mut self,
          33  +
        input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
          34  +
    ) -> Self {
          35  +
        self.stream = ::std::option::Option::Some(input);
          36  +
        self
          37  +
    }
          38  +
    #[allow(missing_docs)] // documentation missing in model
          39  +
    pub fn set_stream(
          40  +
        mut self,
          41  +
        input: ::std::option::Option<
          42  +
            ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
          43  +
        >,
          44  +
    ) -> Self {
          45  +
        self.stream = input;
          46  +
        self
          47  +
    }
          48  +
    #[allow(missing_docs)] // documentation missing in model
          49  +
    pub fn get_stream(
          50  +
        &self,
          51  +
    ) -> &::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>
          52  +
    {
          53  +
        &self.stream
          54  +
    }
          55  +
    /// Consumes the builder and constructs a [`DuplexStreamWithDistinctStreamsInput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsInput).
          56  +
    /// This method will fail if any of the following fields are not set:
          57  +
    /// - [`stream`](crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder::stream)
          58  +
    pub fn build(
          59  +
        self,
          60  +
    ) -> ::std::result::Result<
          61  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsInput,
          62  +
        ::aws_smithy_types::error::operation::BuildError,
          63  +
    > {
          64  +
        ::std::result::Result::Ok(
          65  +
            crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsInput {
          66  +
                stream: self.stream.ok_or_else(|| {
          67  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field(
          68  +
                        "stream",
          69  +
                        "stream was not specified but it is required when building DuplexStreamWithDistinctStreamsInput",
          70  +
                    )
          71  +
                })?,
          72  +
            },
          73  +
        )
          74  +
    }
          75  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_distinct_streams/_duplex_stream_with_distinct_streams_output.rs

@@ -0,1 +0,47 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
pub struct DuplexStreamWithDistinctStreamsOutput {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub stream: ::std::option::Option<crate::types::SingletonEventStream>,
           8  +
}
           9  +
impl DuplexStreamWithDistinctStreamsOutput {
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    pub fn stream(&self) -> ::std::option::Option<&crate::types::SingletonEventStream> {
          12  +
        self.stream.as_ref()
          13  +
    }
          14  +
}
          15  +
impl DuplexStreamWithDistinctStreamsOutput {
          16  +
    /// Creates a new builder-style object to manufacture [`DuplexStreamWithDistinctStreamsOutput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput).
          17  +
    pub fn builder() -> crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsOutputBuilder {
          18  +
        crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsOutputBuilder::default()
          19  +
    }
          20  +
}
          21  +
          22  +
/// A builder for [`DuplexStreamWithDistinctStreamsOutput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput).
          23  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          24  +
#[non_exhaustive]
          25  +
pub struct DuplexStreamWithDistinctStreamsOutputBuilder {
          26  +
    pub(crate) stream: ::std::option::Option<crate::types::SingletonEventStream>,
          27  +
}
          28  +
impl DuplexStreamWithDistinctStreamsOutputBuilder {
          29  +
    #[allow(missing_docs)] // documentation missing in model
          30  +
    pub fn stream(mut self, input: crate::types::SingletonEventStream) -> Self {
          31  +
        self.stream = ::std::option::Option::Some(input);
          32  +
        self
          33  +
    }
          34  +
    #[allow(missing_docs)] // documentation missing in model
          35  +
    pub fn set_stream(mut self, input: ::std::option::Option<crate::types::SingletonEventStream>) -> Self {
          36  +
        self.stream = input;
          37  +
        self
          38  +
    }
          39  +
    #[allow(missing_docs)] // documentation missing in model
          40  +
    pub fn get_stream(&self) -> &::std::option::Option<crate::types::SingletonEventStream> {
          41  +
        &self.stream
          42  +
    }
          43  +
    /// Consumes the builder and constructs a [`DuplexStreamWithDistinctStreamsOutput`](crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput).
          44  +
    pub fn build(self) -> crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput {
          45  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput { stream: self.stream }
          46  +
    }
          47  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_distinct_streams/builders.rs

@@ -0,1 +0,135 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use crate::operation::duplex_stream_with_distinct_streams::_duplex_stream_with_distinct_streams_input::DuplexStreamWithDistinctStreamsInputBuilder;
           3  +
           4  +
pub use crate::operation::duplex_stream_with_distinct_streams::_duplex_stream_with_distinct_streams_output::DuplexStreamWithDistinctStreamsOutputBuilder;
           5  +
           6  +
impl crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder {
           7  +
    /// Sends a request with this input using the given client.
           8  +
    pub async fn send_with(
           9  +
        self,
          10  +
        client: &crate::Client,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          13  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          14  +
            crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          15  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          16  +
        >,
          17  +
    > {
          18  +
        let mut fluent_builder = client.duplex_stream_with_distinct_streams();
          19  +
        fluent_builder.inner = self;
          20  +
        fluent_builder.send().await
          21  +
    }
          22  +
}
          23  +
/// Fluent builder constructing a request to `DuplexStreamWithDistinctStreams`.
          24  +
///
          25  +
#[derive(::std::fmt::Debug)]
          26  +
pub struct DuplexStreamWithDistinctStreamsFluentBuilder {
          27  +
    handle: ::std::sync::Arc<crate::client::Handle>,
          28  +
    inner: crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder,
          29  +
    config_override: ::std::option::Option<crate::config::Builder>,
          30  +
}
          31  +
impl
          32  +
    crate::client::customize::internal::CustomizableSend<
          33  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          34  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          35  +
    > for DuplexStreamWithDistinctStreamsFluentBuilder
          36  +
{
          37  +
    fn send(
          38  +
        self,
          39  +
        config_override: crate::config::Builder,
          40  +
    ) -> crate::client::customize::internal::BoxFuture<
          41  +
        crate::client::customize::internal::SendResult<
          42  +
            crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          43  +
            crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          44  +
        >,
          45  +
    > {
          46  +
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
          47  +
    }
          48  +
}
          49  +
impl DuplexStreamWithDistinctStreamsFluentBuilder {
          50  +
    /// Creates a new `DuplexStreamWithDistinctStreamsFluentBuilder`.
          51  +
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
          52  +
        Self {
          53  +
            handle,
          54  +
            inner: ::std::default::Default::default(),
          55  +
            config_override: ::std::option::Option::None,
          56  +
        }
          57  +
    }
          58  +
    /// Access the DuplexStreamWithDistinctStreams as a reference.
          59  +
    pub fn as_input(&self) -> &crate::operation::duplex_stream_with_distinct_streams::builders::DuplexStreamWithDistinctStreamsInputBuilder {
          60  +
        &self.inner
          61  +
    }
          62  +
    /// Sends the request and returns the response.
          63  +
    ///
          64  +
    /// If an error occurs, an `SdkError` will be returned with additional details that
          65  +
    /// can be matched against.
          66  +
    ///
          67  +
    /// By default, any retryable failures will be retried twice. Retry behavior
          68  +
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
          69  +
    /// set when configuring the client.
          70  +
    pub async fn send(
          71  +
        self,
          72  +
    ) -> ::std::result::Result<
          73  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          74  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          75  +
            crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          76  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          77  +
        >,
          78  +
    > {
          79  +
        let input = self
          80  +
            .inner
          81  +
            .build()
          82  +
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
          83  +
        let runtime_plugins = crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreams::operation_runtime_plugins(
          84  +
            self.handle.runtime_plugins.clone(),
          85  +
            &self.handle.conf,
          86  +
            self.config_override,
          87  +
        );
          88  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreams::orchestrate(&runtime_plugins, input).await
          89  +
    }
          90  +
          91  +
    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
          92  +
    pub fn customize(
          93  +
        self,
          94  +
    ) -> crate::client::customize::CustomizableOperation<
          95  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsOutput,
          96  +
        crate::operation::duplex_stream_with_distinct_streams::DuplexStreamWithDistinctStreamsError,
          97  +
        Self,
          98  +
    > {
          99  +
        crate::client::customize::CustomizableOperation::new(self)
         100  +
    }
         101  +
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
         102  +
        self.set_config_override(::std::option::Option::Some(config_override.into()));
         103  +
        self
         104  +
    }
         105  +
         106  +
    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
         107  +
        self.config_override = config_override;
         108  +
        self
         109  +
    }
         110  +
    #[allow(missing_docs)] // documentation missing in model
         111  +
    pub fn stream(
         112  +
        mut self,
         113  +
        input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
         114  +
    ) -> Self {
         115  +
        self.inner = self.inner.stream(input);
         116  +
        self
         117  +
    }
         118  +
    #[allow(missing_docs)] // documentation missing in model
         119  +
    pub fn set_stream(
         120  +
        mut self,
         121  +
        input: ::std::option::Option<
         122  +
            ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
         123  +
        >,
         124  +
    ) -> Self {
         125  +
        self.inner = self.inner.set_stream(input);
         126  +
        self
         127  +
    }
         128  +
    #[allow(missing_docs)] // documentation missing in model
         129  +
    pub fn get_stream(
         130  +
        &self,
         131  +
    ) -> &::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>
         132  +
    {
         133  +
        self.inner.get_stream()
         134  +
    }
         135  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_initial_messages.rs

@@ -0,1 +0,383 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Orchestration and serialization glue logic for `DuplexStreamWithInitialMessages`.
           3  +
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
           4  +
#[non_exhaustive]
           5  +
pub struct DuplexStreamWithInitialMessages;
           6  +
impl DuplexStreamWithInitialMessages {
           7  +
    /// Creates a new `DuplexStreamWithInitialMessages`
           8  +
    pub fn new() -> Self {
           9  +
        Self
          10  +
    }
          11  +
    pub(crate) async fn orchestrate(
          12  +
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          13  +
        input: crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
          14  +
    ) -> ::std::result::Result<
          15  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          16  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          17  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          18  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          19  +
        >,
          20  +
    > {
          21  +
        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
          22  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
          23  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          24  +
        >| {
          25  +
            err.map_service_error(|err| {
          26  +
                err.downcast::<crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError>()
          27  +
                    .expect("correct error type")
          28  +
            })
          29  +
        };
          30  +
        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
          31  +
            .await
          32  +
            .map_err(map_err)?;
          33  +
        let output = context.finalize().map_err(map_err)?;
          34  +
        ::std::result::Result::Ok(
          35  +
            output
          36  +
                .downcast::<crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput>()
          37  +
                .expect("correct output type"),
          38  +
        )
          39  +
    }
          40  +
          41  +
    pub(crate) async fn orchestrate_with_stop_point(
          42  +
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          43  +
        input: crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
          44  +
        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
          45  +
    ) -> ::std::result::Result<
          46  +
        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
          47  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          48  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
          49  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          50  +
        >,
          51  +
    > {
          52  +
        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
          53  +
        use ::tracing::Instrument;
          54  +
        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
          55  +
            "Rest Json Protocol",
          56  +
            "DuplexStreamWithInitialMessages",
          57  +
            input,
          58  +
            runtime_plugins,
          59  +
            stop_point,
          60  +
        )
          61  +
        // Create a parent span for the entire operation. Includes a random, internal-only,
          62  +
        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
          63  +
        .instrument(::tracing::debug_span!(
          64  +
            "Rest Json Protocol.DuplexStreamWithInitialMessages",
          65  +
            "rpc.service" = "Rest Json Protocol",
          66  +
            "rpc.method" = "DuplexStreamWithInitialMessages",
          67  +
            "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
          68  +
        ))
          69  +
        .await
          70  +
    }
          71  +
          72  +
    pub(crate) fn operation_runtime_plugins(
          73  +
        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
          74  +
        client_config: &crate::config::Config,
          75  +
        config_override: ::std::option::Option<crate::config::Builder>,
          76  +
    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
          77  +
        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
          78  +
          79  +
        if let ::std::option::Option::Some(config_override) = config_override {
          80  +
            for plugin in config_override.runtime_plugins.iter().cloned() {
          81  +
                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
          82  +
            }
          83  +
            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
          84  +
                config_override,
          85  +
                client_config.config.clone(),
          86  +
                &client_config.runtime_components,
          87  +
            ));
          88  +
        }
          89  +
        runtime_plugins
          90  +
    }
          91  +
}
          92  +
impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DuplexStreamWithInitialMessages {
          93  +
    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
          94  +
        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DuplexStreamWithInitialMessages");
          95  +
          96  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
          97  +
            DuplexStreamWithInitialMessagesRequestSerializer,
          98  +
        ));
          99  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
         100  +
            DuplexStreamWithInitialMessagesResponseDeserializer,
         101  +
        ));
         102  +
         103  +
        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
         104  +
            crate::config::auth::Params::builder()
         105  +
                .operation_name("DuplexStreamWithInitialMessages")
         106  +
                .build()
         107  +
                .expect("required fields set"),
         108  +
        ));
         109  +
         110  +
        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
         111  +
            "DuplexStreamWithInitialMessages",
         112  +
            "Rest Json Protocol",
         113  +
        ));
         114  +
         115  +
        ::std::option::Option::Some(cfg.freeze())
         116  +
    }
         117  +
         118  +
    fn runtime_components(
         119  +
        &self,
         120  +
        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
         121  +
    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
         122  +
        #[allow(unused_mut)]
         123  +
        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DuplexStreamWithInitialMessages")
         124  +
            .with_interceptor(DuplexStreamWithInitialMessagesEndpointParamsInterceptor)
         125  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
         126  +
                crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
         127  +
            >::new())
         128  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
         129  +
                crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
         130  +
            >::new());
         131  +
         132  +
        ::std::borrow::Cow::Owned(rcb)
         133  +
    }
         134  +
}
         135  +
         136  +
#[derive(Debug)]
         137  +
struct DuplexStreamWithInitialMessagesResponseDeserializer;
         138  +
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DuplexStreamWithInitialMessagesResponseDeserializer {
         139  +
    fn deserialize_streaming(
         140  +
        &self,
         141  +
        response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         142  +
    ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
         143  +
        #[allow(unused_mut)]
         144  +
        let mut force_error = false;
         145  +
         146  +
        // If this is an error, defer to the non-streaming parser
         147  +
        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
         148  +
            return ::std::option::Option::None;
         149  +
        }
         150  +
        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
         151  +
            crate::protocol_serde::shape_duplex_stream_with_initial_messages::de_duplex_stream_with_initial_messages_http_response(response),
         152  +
        ))
         153  +
    }
         154  +
         155  +
    fn deserialize_nonstreaming(
         156  +
        &self,
         157  +
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         158  +
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
         159  +
        // For streaming operations, we only hit this case if its an error
         160  +
        let body = response.body().bytes().expect("body loaded");
         161  +
        crate::protocol_serde::type_erase_result(
         162  +
            crate::protocol_serde::shape_duplex_stream_with_initial_messages::de_duplex_stream_with_initial_messages_http_error(
         163  +
                response.status().as_u16(),
         164  +
                response.headers(),
         165  +
                body,
         166  +
            ),
         167  +
        )
         168  +
    }
         169  +
}
         170  +
#[derive(Debug)]
         171  +
struct DuplexStreamWithInitialMessagesRequestSerializer;
         172  +
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DuplexStreamWithInitialMessagesRequestSerializer {
         173  +
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
         174  +
    fn serialize_input(
         175  +
        &self,
         176  +
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
         177  +
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         178  +
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
         179  +
        let input = input
         180  +
            .downcast::<crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput>()
         181  +
            .expect("correct type");
         182  +
        let _header_serialization_settings = _cfg
         183  +
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
         184  +
            .cloned()
         185  +
            .unwrap_or_default();
         186  +
        let mut request_builder = {
         187  +
            #[allow(clippy::uninlined_format_args)]
         188  +
            fn uri_base(
         189  +
                _input: &crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
         190  +
                output: &mut ::std::string::String,
         191  +
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
         192  +
                use ::std::fmt::Write as _;
         193  +
                ::std::write!(output, "/DuplexStreamWithInitialMessages").expect("formatting should succeed");
         194  +
                ::std::result::Result::Ok(())
         195  +
            }
         196  +
            #[allow(clippy::unnecessary_wraps)]
         197  +
            fn update_http_builder(
         198  +
                input: &crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
         199  +
                builder: ::http_1x::request::Builder,
         200  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         201  +
                let mut uri = ::std::string::String::new();
         202  +
                uri_base(input, &mut uri)?;
         203  +
                let builder = crate::protocol_serde::shape_duplex_stream_with_initial_messages::ser_duplex_stream_with_initial_messages_headers(
         204  +
                    input, builder,
         205  +
                )?;
         206  +
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         207  +
            }
         208  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         209  +
            builder =
         210  +
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
         211  +
            builder
         212  +
        };
         213  +
        let body = ::aws_smithy_types::body::SdkBody::from({
         214  +
            let error_marshaller = crate::event_stream_serde::EventStreamErrorMarshaller::new();
         215  +
            let marshaller = crate::event_stream_serde::EventStreamMarshaller::new();
         216  +
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
         217  +
            _cfg.interceptor_state().store_put(signer_sender);
         218  +
            ::aws_smithy_types::body::SdkBody::from_body_1_x(::http_body_util::StreamBody::new(input.stream.into_body_stream(
         219  +
                marshaller,
         220  +
                error_marshaller,
         221  +
                signer,
         222  +
            )))
         223  +
        });
         224  +
        if let Some(content_length) = body.content_length() {
         225  +
            let content_length = content_length.to_string();
         226  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
         227  +
        }
         228  +
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         229  +
    }
         230  +
}
         231  +
#[derive(Debug)]
         232  +
struct DuplexStreamWithInitialMessagesEndpointParamsInterceptor;
         233  +
         234  +
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DuplexStreamWithInitialMessagesEndpointParamsInterceptor {
         235  +
    fn name(&self) -> &'static str {
         236  +
        "DuplexStreamWithInitialMessagesEndpointParamsInterceptor"
         237  +
    }
         238  +
         239  +
    fn read_before_execution(
         240  +
        &self,
         241  +
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
         242  +
            '_,
         243  +
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
         244  +
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
         245  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
         246  +
        >,
         247  +
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         248  +
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
         249  +
        let _input = context
         250  +
            .input()
         251  +
            .downcast_ref::<DuplexStreamWithInitialMessagesInput>()
         252  +
            .ok_or("failed to downcast to DuplexStreamWithInitialMessagesInput")?;
         253  +
         254  +
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
         255  +
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
         256  +
        })?;
         257  +
        cfg.interceptor_state()
         258  +
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
         259  +
        ::std::result::Result::Ok(())
         260  +
    }
         261  +
}
         262  +
         263  +
// The get_* functions below are generated from JMESPath expressions in the
         264  +
// operationContextParams trait. They target the operation's input shape.
         265  +
         266  +
/// Error type for the `DuplexStreamWithInitialMessagesError` operation.
         267  +
#[non_exhaustive]
         268  +
#[derive(::std::fmt::Debug)]
         269  +
pub enum DuplexStreamWithInitialMessagesError {
         270  +
    #[allow(missing_docs)] // documentation missing in model
         271  +
    ServiceUnavailableError(crate::types::error::ServiceUnavailableError),
         272  +
    #[allow(missing_docs)] // documentation missing in model
         273  +
    ErrorEvent(crate::types::error::ErrorEvent),
         274  +
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
         275  +
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
         276  +
    variable wildcard pattern and check `.code()`:
         277  +
     \
         278  +
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
         279  +
     \
         280  +
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DuplexStreamWithInitialMessagesError) for what information is available for the error.")]
         281  +
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         282  +
}
         283  +
impl DuplexStreamWithInitialMessagesError {
         284  +
    /// Creates the `DuplexStreamWithInitialMessagesError::Unhandled` variant from any error type.
         285  +
    pub fn unhandled(
         286  +
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
         287  +
    ) -> Self {
         288  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         289  +
            source: err.into(),
         290  +
            meta: ::std::default::Default::default(),
         291  +
        })
         292  +
    }
         293  +
         294  +
    /// Creates the `DuplexStreamWithInitialMessagesError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
         295  +
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
         296  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         297  +
            source: err.clone().into(),
         298  +
            meta: err,
         299  +
        })
         300  +
    }
         301  +
    ///
         302  +
    /// Returns error metadata, which includes the error code, message,
         303  +
    /// request ID, and potentially additional information.
         304  +
    ///
         305  +
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         306  +
        match self {
         307  +
            Self::ServiceUnavailableError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         308  +
            Self::ErrorEvent(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         309  +
            Self::Unhandled(e) => &e.meta,
         310  +
        }
         311  +
    }
         312  +
    /// Returns `true` if the error kind is `DuplexStreamWithInitialMessagesError::ServiceUnavailableError`.
         313  +
    pub fn is_service_unavailable_error(&self) -> bool {
         314  +
        matches!(self, Self::ServiceUnavailableError(_))
         315  +
    }
         316  +
    /// Returns `true` if the error kind is `DuplexStreamWithInitialMessagesError::ErrorEvent`.
         317  +
    pub fn is_error_event(&self) -> bool {
         318  +
        matches!(self, Self::ErrorEvent(_))
         319  +
    }
         320  +
}
         321  +
impl ::std::error::Error for DuplexStreamWithInitialMessagesError {
         322  +
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         323  +
        match self {
         324  +
            Self::ServiceUnavailableError(_inner) => ::std::option::Option::Some(_inner),
         325  +
            Self::ErrorEvent(_inner) => ::std::option::Option::Some(_inner),
         326  +
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         327  +
        }
         328  +
    }
         329  +
}
         330  +
impl ::std::fmt::Display for DuplexStreamWithInitialMessagesError {
         331  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         332  +
        match self {
         333  +
            Self::ServiceUnavailableError(_inner) => _inner.fmt(f),
         334  +
            Self::ErrorEvent(_inner) => _inner.fmt(f),
         335  +
            Self::Unhandled(_inner) => {
         336  +
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
         337  +
                    write!(f, "unhandled error ({code})")
         338  +
                } else {
         339  +
                    f.write_str("unhandled error")
         340  +
                }
         341  +
            }
         342  +
        }
         343  +
    }
         344  +
}
         345  +
impl ::aws_smithy_types::retry::ProvideErrorKind for DuplexStreamWithInitialMessagesError {
         346  +
    fn code(&self) -> ::std::option::Option<&str> {
         347  +
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         348  +
    }
         349  +
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         350  +
        ::std::option::Option::None
         351  +
    }
         352  +
}
         353  +
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DuplexStreamWithInitialMessagesError {
         354  +
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         355  +
        match self {
         356  +
            Self::ServiceUnavailableError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         357  +
            Self::ErrorEvent(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         358  +
            Self::Unhandled(_inner) => &_inner.meta,
         359  +
        }
         360  +
    }
         361  +
}
         362  +
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DuplexStreamWithInitialMessagesError {
         363  +
    fn create_unhandled_error(
         364  +
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
         365  +
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
         366  +
    ) -> Self {
         367  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         368  +
            source,
         369  +
            meta: meta.unwrap_or_default(),
         370  +
        })
         371  +
    }
         372  +
}
         373  +
         374  +
pub use crate::operation::duplex_stream_with_initial_messages::_duplex_stream_with_initial_messages_input::DuplexStreamWithInitialMessagesInput;
         375  +
         376  +
pub use crate::operation::duplex_stream_with_initial_messages::_duplex_stream_with_initial_messages_output::DuplexStreamWithInitialMessagesOutput;
         377  +
         378  +
mod _duplex_stream_with_initial_messages_input;
         379  +
         380  +
mod _duplex_stream_with_initial_messages_output;
         381  +
         382  +
/// Builders
         383  +
pub mod builders;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_initial_messages/_duplex_stream_with_initial_messages_input.rs

@@ -0,1 +0,98 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::fmt::Debug)]
           5  +
pub struct DuplexStreamWithInitialMessagesInput {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub initial_request_member: ::std::option::Option<::std::string::String>,
           8  +
    #[allow(missing_docs)] // documentation missing in model
           9  +
    pub stream: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
          10  +
}
          11  +
impl DuplexStreamWithInitialMessagesInput {
          12  +
    #[allow(missing_docs)] // documentation missing in model
          13  +
    pub fn initial_request_member(&self) -> ::std::option::Option<&str> {
          14  +
        self.initial_request_member.as_deref()
          15  +
    }
          16  +
    #[allow(missing_docs)] // documentation missing in model
          17  +
    pub fn stream(&self) -> &::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError> {
          18  +
        &self.stream
          19  +
    }
          20  +
}
          21  +
impl DuplexStreamWithInitialMessagesInput {
          22  +
    /// Creates a new builder-style object to manufacture [`DuplexStreamWithInitialMessagesInput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput).
          23  +
    pub fn builder() -> crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder {
          24  +
        crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder::default()
          25  +
    }
          26  +
}
          27  +
          28  +
/// A builder for [`DuplexStreamWithInitialMessagesInput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput).
          29  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          30  +
#[non_exhaustive]
          31  +
pub struct DuplexStreamWithInitialMessagesInputBuilder {
          32  +
    pub(crate) initial_request_member: ::std::option::Option<::std::string::String>,
          33  +
    pub(crate) stream:
          34  +
        ::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>,
          35  +
}
          36  +
impl DuplexStreamWithInitialMessagesInputBuilder {
          37  +
    #[allow(missing_docs)] // documentation missing in model
          38  +
    /// This field is required.
          39  +
    pub fn initial_request_member(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          40  +
        self.initial_request_member = ::std::option::Option::Some(input.into());
          41  +
        self
          42  +
    }
          43  +
    #[allow(missing_docs)] // documentation missing in model
          44  +
    pub fn set_initial_request_member(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          45  +
        self.initial_request_member = input;
          46  +
        self
          47  +
    }
          48  +
    #[allow(missing_docs)] // documentation missing in model
          49  +
    pub fn get_initial_request_member(&self) -> &::std::option::Option<::std::string::String> {
          50  +
        &self.initial_request_member
          51  +
    }
          52  +
    #[allow(missing_docs)] // documentation missing in model
          53  +
    pub fn stream(
          54  +
        mut self,
          55  +
        input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
          56  +
    ) -> Self {
          57  +
        self.stream = ::std::option::Option::Some(input);
          58  +
        self
          59  +
    }
          60  +
    #[allow(missing_docs)] // documentation missing in model
          61  +
    pub fn set_stream(
          62  +
        mut self,
          63  +
        input: ::std::option::Option<
          64  +
            ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
          65  +
        >,
          66  +
    ) -> Self {
          67  +
        self.stream = input;
          68  +
        self
          69  +
    }
          70  +
    #[allow(missing_docs)] // documentation missing in model
          71  +
    pub fn get_stream(
          72  +
        &self,
          73  +
    ) -> &::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>
          74  +
    {
          75  +
        &self.stream
          76  +
    }
          77  +
    /// Consumes the builder and constructs a [`DuplexStreamWithInitialMessagesInput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput).
          78  +
    /// This method will fail if any of the following fields are not set:
          79  +
    /// - [`stream`](crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder::stream)
          80  +
    pub fn build(
          81  +
        self,
          82  +
    ) -> ::std::result::Result<
          83  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
          84  +
        ::aws_smithy_types::error::operation::BuildError,
          85  +
    > {
          86  +
        ::std::result::Result::Ok(
          87  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput {
          88  +
                initial_request_member: self.initial_request_member,
          89  +
                stream: self.stream.ok_or_else(|| {
          90  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field(
          91  +
                        "stream",
          92  +
                        "stream was not specified but it is required when building DuplexStreamWithInitialMessagesInput",
          93  +
                    )
          94  +
                })?,
          95  +
            },
          96  +
        )
          97  +
    }
          98  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_initial_messages/_duplex_stream_with_initial_messages_output.rs

@@ -0,1 +0,98 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::fmt::Debug)]
           5  +
pub struct DuplexStreamWithInitialMessagesOutput {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub initial_response_member: ::std::string::String,
           8  +
    #[allow(missing_docs)] // documentation missing in model
           9  +
    pub stream: crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
          10  +
}
          11  +
impl DuplexStreamWithInitialMessagesOutput {
          12  +
    #[allow(missing_docs)] // documentation missing in model
          13  +
    pub fn initial_response_member(&self) -> &str {
          14  +
        use std::ops::Deref;
          15  +
        self.initial_response_member.deref()
          16  +
    }
          17  +
    #[allow(missing_docs)] // documentation missing in model
          18  +
    pub fn stream(&self) -> &crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError> {
          19  +
        &self.stream
          20  +
    }
          21  +
}
          22  +
impl DuplexStreamWithInitialMessagesOutput {
          23  +
    /// Creates a new builder-style object to manufacture [`DuplexStreamWithInitialMessagesOutput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput).
          24  +
    pub fn builder() -> crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder {
          25  +
        crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder::default()
          26  +
    }
          27  +
}
          28  +
          29  +
/// A builder for [`DuplexStreamWithInitialMessagesOutput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput).
          30  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          31  +
#[non_exhaustive]
          32  +
pub struct DuplexStreamWithInitialMessagesOutputBuilder {
          33  +
    pub(crate) initial_response_member: ::std::option::Option<::std::string::String>,
          34  +
    pub(crate) stream: ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>>,
          35  +
}
          36  +
impl DuplexStreamWithInitialMessagesOutputBuilder {
          37  +
    #[allow(missing_docs)] // documentation missing in model
          38  +
    /// This field is required.
          39  +
    pub fn initial_response_member(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          40  +
        self.initial_response_member = ::std::option::Option::Some(input.into());
          41  +
        self
          42  +
    }
          43  +
    #[allow(missing_docs)] // documentation missing in model
          44  +
    pub fn set_initial_response_member(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          45  +
        self.initial_response_member = input;
          46  +
        self
          47  +
    }
          48  +
    #[allow(missing_docs)] // documentation missing in model
          49  +
    pub fn get_initial_response_member(&self) -> &::std::option::Option<::std::string::String> {
          50  +
        &self.initial_response_member
          51  +
    }
          52  +
    #[allow(missing_docs)] // documentation missing in model
          53  +
    pub fn stream(mut self, input: crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>) -> Self {
          54  +
        self.stream = ::std::option::Option::Some(input);
          55  +
        self
          56  +
    }
          57  +
    #[allow(missing_docs)] // documentation missing in model
          58  +
    pub fn set_stream(
          59  +
        mut self,
          60  +
        input: ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>>,
          61  +
    ) -> Self {
          62  +
        self.stream = input;
          63  +
        self
          64  +
    }
          65  +
    #[allow(missing_docs)] // documentation missing in model
          66  +
    pub fn get_stream(
          67  +
        &self,
          68  +
    ) -> &::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>> {
          69  +
        &self.stream
          70  +
    }
          71  +
    /// Consumes the builder and constructs a [`DuplexStreamWithInitialMessagesOutput`](crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput).
          72  +
    /// This method will fail if any of the following fields are not set:
          73  +
    /// - [`initial_response_member`](crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder::initial_response_member)
          74  +
    /// - [`stream`](crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder::stream)
          75  +
    pub fn build(
          76  +
        self,
          77  +
    ) -> ::std::result::Result<
          78  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          79  +
        ::aws_smithy_types::error::operation::BuildError,
          80  +
    > {
          81  +
        ::std::result::Result::Ok(
          82  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput {
          83  +
                initial_response_member: self.initial_response_member.ok_or_else(|| {
          84  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field(
          85  +
                        "initial_response_member",
          86  +
                        "initial_response_member was not specified but it is required when building DuplexStreamWithInitialMessagesOutput",
          87  +
                    )
          88  +
                })?,
          89  +
                stream: self.stream.ok_or_else(|| {
          90  +
                    ::aws_smithy_types::error::operation::BuildError::missing_field(
          91  +
                        "stream",
          92  +
                        "stream was not specified but it is required when building DuplexStreamWithInitialMessagesOutput",
          93  +
                    )
          94  +
                })?,
          95  +
            },
          96  +
        )
          97  +
    }
          98  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/duplex_stream_with_initial_messages/builders.rs

@@ -0,1 +0,180 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use crate::operation::duplex_stream_with_initial_messages::_duplex_stream_with_initial_messages_input::DuplexStreamWithInitialMessagesInputBuilder;
           3  +
           4  +
pub use crate::operation::duplex_stream_with_initial_messages::_duplex_stream_with_initial_messages_output::DuplexStreamWithInitialMessagesOutputBuilder;
           5  +
           6  +
impl crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder {
           7  +
    /// Sends a request with this input using the given client.
           8  +
    pub async fn send_with(
           9  +
        self,
          10  +
        client: &crate::Client,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          13  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          14  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          15  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          16  +
        >,
          17  +
    > {
          18  +
        let mut fluent_builder = client.duplex_stream_with_initial_messages();
          19  +
        fluent_builder.inner = self;
          20  +
        fluent_builder.send().await
          21  +
    }
          22  +
}
          23  +
/// Fluent builder constructing a request to `DuplexStreamWithInitialMessages`.
          24  +
///
          25  +
#[derive(::std::fmt::Debug)]
          26  +
pub struct DuplexStreamWithInitialMessagesFluentBuilder {
          27  +
    handle: ::std::sync::Arc<crate::client::Handle>,
          28  +
    inner: crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder,
          29  +
    config_override: ::std::option::Option<crate::config::Builder>,
          30  +
}
          31  +
impl
          32  +
    crate::client::customize::internal::CustomizableSend<
          33  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          34  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          35  +
    > for DuplexStreamWithInitialMessagesFluentBuilder
          36  +
{
          37  +
    fn send(
          38  +
        self,
          39  +
        config_override: crate::config::Builder,
          40  +
    ) -> crate::client::customize::internal::BoxFuture<
          41  +
        crate::client::customize::internal::SendResult<
          42  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          43  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          44  +
        >,
          45  +
    > {
          46  +
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
          47  +
    }
          48  +
}
          49  +
impl DuplexStreamWithInitialMessagesFluentBuilder {
          50  +
    /// Creates a new `DuplexStreamWithInitialMessagesFluentBuilder`.
          51  +
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
          52  +
        Self {
          53  +
            handle,
          54  +
            inner: ::std::default::Default::default(),
          55  +
            config_override: ::std::option::Option::None,
          56  +
        }
          57  +
    }
          58  +
    /// Access the DuplexStreamWithInitialMessages as a reference.
          59  +
    pub fn as_input(&self) -> &crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesInputBuilder {
          60  +
        &self.inner
          61  +
    }
          62  +
    /// Sends the request and returns the response.
          63  +
    ///
          64  +
    /// If an error occurs, an `SdkError` will be returned with additional details that
          65  +
    /// can be matched against.
          66  +
    ///
          67  +
    /// By default, any retryable failures will be retried twice. Retry behavior
          68  +
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
          69  +
    /// set when configuring the client.
          70  +
    pub async fn send(
          71  +
        self,
          72  +
    ) -> ::std::result::Result<
          73  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
          74  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          75  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
          76  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          77  +
        >,
          78  +
    > {
          79  +
        let input = self
          80  +
            .inner
          81  +
            .build()
          82  +
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
          83  +
        let runtime_plugins = crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessages::operation_runtime_plugins(
          84  +
            self.handle.runtime_plugins.clone(),
          85  +
            &self.handle.conf,
          86  +
            self.config_override,
          87  +
        );
          88  +
        let mut output =
          89  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessages::orchestrate(&runtime_plugins, input).await?;
          90  +
          91  +
        // Converts any error encountered beyond this point into an `SdkError` response error
          92  +
        // with an `HttpResponse`. However, since we have already exited the `orchestrate`
          93  +
        // function, the original `HttpResponse` is no longer available and cannot be restored.
          94  +
        // This means that header information from the original response has been lost.
          95  +
        //
          96  +
        // Note that the response body would have been consumed by the deserializer
          97  +
        // regardless, even if the initial message was hypothetically processed during
          98  +
        // the orchestrator's deserialization phase but later resulted in an error.
          99  +
        fn response_error(
         100  +
            err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
         101  +
        ) -> ::aws_smithy_runtime_api::client::result::SdkError<
         102  +
            crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
         103  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         104  +
        > {
         105  +
            ::aws_smithy_runtime_api::client::result::SdkError::response_error(
         106  +
                err,
         107  +
                ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
         108  +
                    ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
         109  +
                    ::aws_smithy_types::body::SdkBody::empty(),
         110  +
                ),
         111  +
            )
         112  +
        }
         113  +
         114  +
        let message = output.stream.try_recv_initial_response().await.map_err(response_error)?;
         115  +
         116  +
        match message {
         117  +
            ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
         118  +
            ::std::option::Option::None => ::std::result::Result::Ok(output),
         119  +
        }
         120  +
    }
         121  +
         122  +
    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
         123  +
    pub fn customize(
         124  +
        self,
         125  +
    ) -> crate::client::customize::CustomizableOperation<
         126  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
         127  +
        crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
         128  +
        Self,
         129  +
    > {
         130  +
        crate::client::customize::CustomizableOperation::new(self)
         131  +
    }
         132  +
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
         133  +
        self.set_config_override(::std::option::Option::Some(config_override.into()));
         134  +
        self
         135  +
    }
         136  +
         137  +
    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
         138  +
        self.config_override = config_override;
         139  +
        self
         140  +
    }
         141  +
    #[allow(missing_docs)] // documentation missing in model
         142  +
    pub fn initial_request_member(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
         143  +
        self.inner = self.inner.initial_request_member(input.into());
         144  +
        self
         145  +
    }
         146  +
    #[allow(missing_docs)] // documentation missing in model
         147  +
    pub fn set_initial_request_member(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         148  +
        self.inner = self.inner.set_initial_request_member(input);
         149  +
        self
         150  +
    }
         151  +
    #[allow(missing_docs)] // documentation missing in model
         152  +
    pub fn get_initial_request_member(&self) -> &::std::option::Option<::std::string::String> {
         153  +
        self.inner.get_initial_request_member()
         154  +
    }
         155  +
    #[allow(missing_docs)] // documentation missing in model
         156  +
    pub fn stream(
         157  +
        mut self,
         158  +
        input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
         159  +
    ) -> Self {
         160  +
        self.inner = self.inner.stream(input);
         161  +
        self
         162  +
    }
         163  +
    #[allow(missing_docs)] // documentation missing in model
         164  +
    pub fn set_stream(
         165  +
        mut self,
         166  +
        input: ::std::option::Option<
         167  +
            ::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>,
         168  +
        >,
         169  +
    ) -> Self {
         170  +
        self.inner = self.inner.set_stream(input);
         171  +
        self
         172  +
    }
         173  +
    #[allow(missing_docs)] // documentation missing in model
         174  +
    pub fn get_stream(
         175  +
        &self,
         176  +
    ) -> &::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>
         177  +
    {
         178  +
        self.inner.get_stream()
         179  +
    }
         180  +
}