Client Test

Client Test

rev. 7254d43655ed63111c94f599437f2b0d3f55446e

Files changed:

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

@@ -1876,1876 +1915,1915 @@
 1896   1896   
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
 1897   1897   
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
 1898   1898   
    ) -> Self {
 1899   1899   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
 1900   1900   
            source,
 1901   1901   
            meta: meta.unwrap_or_default(),
 1902   1902   
        })
 1903   1903   
    }
 1904   1904   
}
 1905   1905   
 1906         -
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_output::InputAndOutputWithHeadersOutput;
 1907         -
 1908   1906   
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_input::InputAndOutputWithHeadersInput;
 1909   1907   
        1908  +
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_output::InputAndOutputWithHeadersOutput;
        1909  +
 1910   1910   
mod _input_and_output_with_headers_input;
 1911   1911   
 1912   1912   
mod _input_and_output_with_headers_output;
 1913   1913   
 1914   1914   
/// Builders
 1915   1915   
pub mod builders;

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

@@ -1,1 +35,35 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_output::InputAndOutputWithHeadersOutputBuilder;
    3         -
    4      2   
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_input::InputAndOutputWithHeadersInputBuilder;
    5      3   
           4  +
pub use crate::operation::input_and_output_with_headers::_input_and_output_with_headers_output::InputAndOutputWithHeadersOutputBuilder;
           5  +
    6      6   
impl crate::operation::input_and_output_with_headers::builders::InputAndOutputWithHeadersInputBuilder {
    7      7   
    /// Sends a request with this input using the given client.
    8      8   
    pub async fn send_with(
    9      9   
        self,
   10     10   
        client: &crate::Client,
   11     11   
    ) -> ::std::result::Result<
   12     12   
        crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
   13     13   
        ::aws_smithy_runtime_api::client::result::SdkError<
   14     14   
            crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
   15     15   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,

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

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

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

@@ -0,1 +0,68 @@
           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 InputStreamInput {
           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 InputStreamInput {
          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 InputStreamInput {
          16  +
    /// Creates a new builder-style object to manufacture [`InputStreamInput`](crate::operation::input_stream::InputStreamInput).
          17  +
    pub fn builder() -> crate::operation::input_stream::builders::InputStreamInputBuilder {
          18  +
        crate::operation::input_stream::builders::InputStreamInputBuilder::default()
          19  +
    }
          20  +
}
          21  +
          22  +
/// A builder for [`InputStreamInput`](crate::operation::input_stream::InputStreamInput).
          23  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          24  +
#[non_exhaustive]
          25  +
pub struct InputStreamInputBuilder {
          26  +
    pub(crate) stream:
          27  +
        ::std::option::Option<::aws_smithy_http::event_stream::EventStreamSender<crate::types::EventStream, crate::types::error::EventStreamError>>,
          28  +
}
          29  +
impl InputStreamInputBuilder {
          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 [`InputStreamInput`](crate::operation::input_stream::InputStreamInput).
          56  +
    /// This method will fail if any of the following fields are not set:
          57  +
    /// - [`stream`](crate::operation::input_stream::builders::InputStreamInputBuilder::stream)
          58  +
    pub fn build(self) -> ::std::result::Result<crate::operation::input_stream::InputStreamInput, ::aws_smithy_types::error::operation::BuildError> {
          59  +
        ::std::result::Result::Ok(crate::operation::input_stream::InputStreamInput {
          60  +
            stream: self.stream.ok_or_else(|| {
          61  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
          62  +
                    "stream",
          63  +
                    "stream was not specified but it is required when building InputStreamInput",
          64  +
                )
          65  +
            })?,
          66  +
        })
          67  +
    }
          68  +
}

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

@@ -0,1 +0,22 @@
           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 InputStreamOutput {}
           6  +
impl InputStreamOutput {
           7  +
    /// Creates a new builder-style object to manufacture [`InputStreamOutput`](crate::operation::input_stream::InputStreamOutput).
           8  +
    pub fn builder() -> crate::operation::input_stream::builders::InputStreamOutputBuilder {
           9  +
        crate::operation::input_stream::builders::InputStreamOutputBuilder::default()
          10  +
    }
          11  +
}
          12  +
          13  +
/// A builder for [`InputStreamOutput`](crate::operation::input_stream::InputStreamOutput).
          14  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          15  +
#[non_exhaustive]
          16  +
pub struct InputStreamOutputBuilder {}
          17  +
impl InputStreamOutputBuilder {
          18  +
    /// Consumes the builder and constructs a [`InputStreamOutput`](crate::operation::input_stream::InputStreamOutput).
          19  +
    pub fn build(self) -> crate::operation::input_stream::InputStreamOutput {
          20  +
        crate::operation::input_stream::InputStreamOutput {}
          21  +
    }
          22  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/input_stream/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::input_stream::_input_stream_input::InputStreamInputBuilder;
           3  +
           4  +
pub use crate::operation::input_stream::_input_stream_output::InputStreamOutputBuilder;
           5  +
           6  +
impl crate::operation::input_stream::builders::InputStreamInputBuilder {
           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::input_stream::InputStreamOutput,
          13  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          14  +
            crate::operation::input_stream::InputStreamError,
          15  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          16  +
        >,
          17  +
    > {
          18  +
        let mut fluent_builder = client.input_stream();
          19  +
        fluent_builder.inner = self;
          20  +
        fluent_builder.send().await
          21  +
    }
          22  +
}
          23  +
/// Fluent builder constructing a request to `InputStream`.
          24  +
///
          25  +
#[derive(::std::fmt::Debug)]
          26  +
pub struct InputStreamFluentBuilder {
          27  +
    handle: ::std::sync::Arc<crate::client::Handle>,
          28  +
    inner: crate::operation::input_stream::builders::InputStreamInputBuilder,
          29  +
    config_override: ::std::option::Option<crate::config::Builder>,
          30  +
}
          31  +
impl
          32  +
    crate::client::customize::internal::CustomizableSend<
          33  +
        crate::operation::input_stream::InputStreamOutput,
          34  +
        crate::operation::input_stream::InputStreamError,
          35  +
    > for InputStreamFluentBuilder
          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::input_stream::InputStreamOutput,
          43  +
            crate::operation::input_stream::InputStreamError,
          44  +
        >,
          45  +
    > {
          46  +
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
          47  +
    }
          48  +
}
          49  +
impl InputStreamFluentBuilder {
          50  +
    /// Creates a new `InputStreamFluentBuilder`.
          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 InputStream as a reference.
          59  +
    pub fn as_input(&self) -> &crate::operation::input_stream::builders::InputStreamInputBuilder {
          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::input_stream::InputStreamOutput,
          74  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          75  +
            crate::operation::input_stream::InputStreamError,
          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::input_stream::InputStream::operation_runtime_plugins(
          84  +
            self.handle.runtime_plugins.clone(),
          85  +
            &self.handle.conf,
          86  +
            self.config_override,
          87  +
        );
          88  +
        crate::operation::input_stream::InputStream::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::input_stream::InputStreamOutput,
          96  +
        crate::operation::input_stream::InputStreamError,
          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/input_stream_with_initial_request.rs

@@ -0,1 +0,359 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Orchestration and serialization glue logic for `InputStreamWithInitialRequest`.
           3  +
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
           4  +
#[non_exhaustive]
           5  +
pub struct InputStreamWithInitialRequest;
           6  +
impl InputStreamWithInitialRequest {
           7  +
    /// Creates a new `InputStreamWithInitialRequest`
           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::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
          14  +
    ) -> ::std::result::Result<
          15  +
        crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
          16  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          17  +
            crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
          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::input_stream_with_initial_request::InputStreamWithInitialRequestError>()
          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::input_stream_with_initial_request::InputStreamWithInitialRequestOutput>()
          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::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
          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  +
            "InputStreamWithInitialRequest",
          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.InputStreamWithInitialRequest",
          65  +
            "rpc.service" = "Rest Json Protocol",
          66  +
            "rpc.method" = "InputStreamWithInitialRequest",
          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 InputStreamWithInitialRequest {
          93  +
    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
          94  +
        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("InputStreamWithInitialRequest");
          95  +
          96  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
          97  +
            InputStreamWithInitialRequestRequestSerializer,
          98  +
        ));
          99  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
         100  +
            InputStreamWithInitialRequestResponseDeserializer,
         101  +
        ));
         102  +
         103  +
        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
         104  +
            crate::config::auth::Params::builder()
         105  +
                .operation_name("InputStreamWithInitialRequest")
         106  +
                .build()
         107  +
                .expect("required fields set"),
         108  +
        ));
         109  +
         110  +
        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
         111  +
            "InputStreamWithInitialRequest",
         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("InputStreamWithInitialRequest")
         124  +
            .with_interceptor(InputStreamWithInitialRequestEndpointParamsInterceptor)
         125  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
         126  +
                crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
         127  +
            >::new())
         128  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
         129  +
                crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
         130  +
            >::new());
         131  +
         132  +
        ::std::borrow::Cow::Owned(rcb)
         133  +
    }
         134  +
}
         135  +
         136  +
#[derive(Debug)]
         137  +
struct InputStreamWithInitialRequestResponseDeserializer;
         138  +
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for InputStreamWithInitialRequestResponseDeserializer {
         139  +
    fn deserialize_nonstreaming(
         140  +
        &self,
         141  +
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         142  +
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
         143  +
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        let headers = response.headers();
         145  +
        let body = response.body().bytes().expect("body loaded");
         146  +
        #[allow(unused_mut)]
         147  +
        let mut force_error = false;
         148  +
         149  +
        let parse_result = if !success && status != 200 || force_error {
         150  +
            crate::protocol_serde::shape_input_stream_with_initial_request::de_input_stream_with_initial_request_http_error(status, headers, body)
         151  +
        } else {
         152  +
            crate::protocol_serde::shape_input_stream_with_initial_request::de_input_stream_with_initial_request_http_response(status, headers, body)
         153  +
        };
         154  +
        crate::protocol_serde::type_erase_result(parse_result)
         155  +
    }
         156  +
}
         157  +
#[derive(Debug)]
         158  +
struct InputStreamWithInitialRequestRequestSerializer;
         159  +
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for InputStreamWithInitialRequestRequestSerializer {
         160  +
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
         161  +
    fn serialize_input(
         162  +
        &self,
         163  +
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
         164  +
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         165  +
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
         166  +
        let input = input
         167  +
            .downcast::<crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput>()
         168  +
            .expect("correct type");
         169  +
        let _header_serialization_settings = _cfg
         170  +
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
         171  +
            .cloned()
         172  +
            .unwrap_or_default();
         173  +
        let mut request_builder = {
         174  +
            #[allow(clippy::uninlined_format_args)]
         175  +
            fn uri_base(
         176  +
                _input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
         177  +
                output: &mut ::std::string::String,
         178  +
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
         179  +
                use ::std::fmt::Write as _;
         180  +
                ::std::write!(output, "/InputStreamWithInitialRequest").expect("formatting should succeed");
         181  +
                ::std::result::Result::Ok(())
         182  +
            }
         183  +
            #[allow(clippy::unnecessary_wraps)]
         184  +
            fn update_http_builder(
         185  +
                input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
         186  +
                builder: ::http_1x::request::Builder,
         187  +
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         188  +
                let mut uri = ::std::string::String::new();
         189  +
                uri_base(input, &mut uri)?;
         190  +
                let builder =
         191  +
                    crate::protocol_serde::shape_input_stream_with_initial_request::ser_input_stream_with_initial_request_headers(input, builder)?;
         192  +
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         193  +
            }
         194  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         195  +
            builder =
         196  +
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
         197  +
            builder
         198  +
        };
         199  +
        let body = ::aws_smithy_types::body::SdkBody::from({
         200  +
            let error_marshaller = crate::event_stream_serde::EventStreamErrorMarshaller::new();
         201  +
            let marshaller = crate::event_stream_serde::EventStreamMarshaller::new();
         202  +
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
         203  +
            _cfg.interceptor_state().store_put(signer_sender);
         204  +
            ::aws_smithy_types::body::SdkBody::from_body_1_x(::http_body_util::StreamBody::new(input.stream.into_body_stream(
         205  +
                marshaller,
         206  +
                error_marshaller,
         207  +
                signer,
         208  +
            )))
         209  +
        });
         210  +
        if let Some(content_length) = body.content_length() {
         211  +
            let content_length = content_length.to_string();
         212  +
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
         213  +
        }
         214  +
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         215  +
    }
         216  +
}
         217  +
#[derive(Debug)]
         218  +
struct InputStreamWithInitialRequestEndpointParamsInterceptor;
         219  +
         220  +
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for InputStreamWithInitialRequestEndpointParamsInterceptor {
         221  +
    fn name(&self) -> &'static str {
         222  +
        "InputStreamWithInitialRequestEndpointParamsInterceptor"
         223  +
    }
         224  +
         225  +
    fn read_before_execution(
         226  +
        &self,
         227  +
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
         228  +
            '_,
         229  +
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
         230  +
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
         231  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
         232  +
        >,
         233  +
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         234  +
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
         235  +
        let _input = context
         236  +
            .input()
         237  +
            .downcast_ref::<InputStreamWithInitialRequestInput>()
         238  +
            .ok_or("failed to downcast to InputStreamWithInitialRequestInput")?;
         239  +
         240  +
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
         241  +
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
         242  +
        })?;
         243  +
        cfg.interceptor_state()
         244  +
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
         245  +
        ::std::result::Result::Ok(())
         246  +
    }
         247  +
}
         248  +
         249  +
// The get_* functions below are generated from JMESPath expressions in the
         250  +
// operationContextParams trait. They target the operation's input shape.
         251  +
         252  +
/// Error type for the `InputStreamWithInitialRequestError` operation.
         253  +
#[non_exhaustive]
         254  +
#[derive(::std::fmt::Debug)]
         255  +
pub enum InputStreamWithInitialRequestError {
         256  +
    #[allow(missing_docs)] // documentation missing in model
         257  +
    ErrorEvent(crate::types::error::ErrorEvent),
         258  +
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
         259  +
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
         260  +
    variable wildcard pattern and check `.code()`:
         261  +
     \
         262  +
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
         263  +
     \
         264  +
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-InputStreamWithInitialRequestError) for what information is available for the error.")]
         265  +
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         266  +
}
         267  +
impl InputStreamWithInitialRequestError {
         268  +
    /// Creates the `InputStreamWithInitialRequestError::Unhandled` variant from any error type.
         269  +
    pub fn unhandled(
         270  +
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
         271  +
    ) -> Self {
         272  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         273  +
            source: err.into(),
         274  +
            meta: ::std::default::Default::default(),
         275  +
        })
         276  +
    }
         277  +
         278  +
    /// Creates the `InputStreamWithInitialRequestError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
         279  +
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
         280  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         281  +
            source: err.clone().into(),
         282  +
            meta: err,
         283  +
        })
         284  +
    }
         285  +
    ///
         286  +
    /// Returns error metadata, which includes the error code, message,
         287  +
    /// request ID, and potentially additional information.
         288  +
    ///
         289  +
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         290  +
        match self {
         291  +
            Self::ErrorEvent(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         292  +
            Self::Unhandled(e) => &e.meta,
         293  +
        }
         294  +
    }
         295  +
    /// Returns `true` if the error kind is `InputStreamWithInitialRequestError::ErrorEvent`.
         296  +
    pub fn is_error_event(&self) -> bool {
         297  +
        matches!(self, Self::ErrorEvent(_))
         298  +
    }
         299  +
}
         300  +
impl ::std::error::Error for InputStreamWithInitialRequestError {
         301  +
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         302  +
        match self {
         303  +
            Self::ErrorEvent(_inner) => ::std::option::Option::Some(_inner),
         304  +
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         305  +
        }
         306  +
    }
         307  +
}
         308  +
impl ::std::fmt::Display for InputStreamWithInitialRequestError {
         309  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         310  +
        match self {
         311  +
            Self::ErrorEvent(_inner) => _inner.fmt(f),
         312  +
            Self::Unhandled(_inner) => {
         313  +
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
         314  +
                    write!(f, "unhandled error ({code})")
         315  +
                } else {
         316  +
                    f.write_str("unhandled error")
         317  +
                }
         318  +
            }
         319  +
        }
         320  +
    }
         321  +
}
         322  +
impl ::aws_smithy_types::retry::ProvideErrorKind for InputStreamWithInitialRequestError {
         323  +
    fn code(&self) -> ::std::option::Option<&str> {
         324  +
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         325  +
    }
         326  +
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         327  +
        ::std::option::Option::None
         328  +
    }
         329  +
}
         330  +
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InputStreamWithInitialRequestError {
         331  +
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         332  +
        match self {
         333  +
            Self::ErrorEvent(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         334  +
            Self::Unhandled(_inner) => &_inner.meta,
         335  +
        }
         336  +
    }
         337  +
}
         338  +
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for InputStreamWithInitialRequestError {
         339  +
    fn create_unhandled_error(
         340  +
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
         341  +
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
         342  +
    ) -> Self {
         343  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         344  +
            source,
         345  +
            meta: meta.unwrap_or_default(),
         346  +
        })
         347  +
    }
         348  +
}
         349  +
         350  +
pub use crate::operation::input_stream_with_initial_request::_input_stream_with_initial_request_input::InputStreamWithInitialRequestInput;
         351  +
         352  +
pub use crate::operation::input_stream_with_initial_request::_input_stream_with_initial_request_output::InputStreamWithInitialRequestOutput;
         353  +
         354  +
mod _input_stream_with_initial_request_input;
         355  +
         356  +
mod _input_stream_with_initial_request_output;
         357  +
         358  +
/// Builders
         359  +
pub mod builders;

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

@@ -0,1 +0,96 @@
           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 InputStreamWithInitialRequestInput {
           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 InputStreamWithInitialRequestInput {
          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 InputStreamWithInitialRequestInput {
          22  +
    /// Creates a new builder-style object to manufacture [`InputStreamWithInitialRequestInput`](crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput).
          23  +
    pub fn builder() -> crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestInputBuilder {
          24  +
        crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestInputBuilder::default()
          25  +
    }
          26  +
}
          27  +
          28  +
/// A builder for [`InputStreamWithInitialRequestInput`](crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput).
          29  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          30  +
#[non_exhaustive]
          31  +
pub struct InputStreamWithInitialRequestInputBuilder {
          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 InputStreamWithInitialRequestInputBuilder {
          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 [`InputStreamWithInitialRequestInput`](crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput).
          78  +
    /// This method will fail if any of the following fields are not set:
          79  +
    /// - [`stream`](crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestInputBuilder::stream)
          80  +
    pub fn build(
          81  +
        self,
          82  +
    ) -> ::std::result::Result<
          83  +
        crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
          84  +
        ::aws_smithy_types::error::operation::BuildError,
          85  +
    > {
          86  +
        ::std::result::Result::Ok(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput {
          87  +
            initial_request_member: self.initial_request_member,
          88  +
            stream: self.stream.ok_or_else(|| {
          89  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
          90  +
                    "stream",
          91  +
                    "stream was not specified but it is required when building InputStreamWithInitialRequestInput",
          92  +
                )
          93  +
            })?,
          94  +
        })
          95  +
    }
          96  +
}