Client Test

Client Test

rev. d838bf488731ae5e751cce0fe13f339a5b9be858 (ignoring whitespace)

Files changed:

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

@@ -906,906 +945,945 @@
  926    926   
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
  927    927   
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
  928    928   
    ) -> Self {
  929    929   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  930    930   
            source,
  931    931   
            meta: meta.unwrap_or_default(),
  932    932   
        })
  933    933   
    }
  934    934   
}
  935    935   
  936         -
pub use crate::operation::operation_with_defaults::_operation_with_defaults_output::OperationWithDefaultsOutput;
  937         -
  938    936   
pub use crate::operation::operation_with_defaults::_operation_with_defaults_input::OperationWithDefaultsInput;
  939    937   
         938  +
pub use crate::operation::operation_with_defaults::_operation_with_defaults_output::OperationWithDefaultsOutput;
         939  +
  940    940   
mod _operation_with_defaults_input;
  941    941   
  942    942   
mod _operation_with_defaults_output;
  943    943   
  944    944   
/// Builders
  945    945   
pub mod builders;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/operation_with_defaults/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::operation_with_defaults::_operation_with_defaults_output::OperationWithDefaultsOutputBuilder;
    3         -
    4      2   
pub use crate::operation::operation_with_defaults::_operation_with_defaults_input::OperationWithDefaultsInputBuilder;
    5      3   
           4  +
pub use crate::operation::operation_with_defaults::_operation_with_defaults_output::OperationWithDefaultsOutputBuilder;
           5  +
    6      6   
impl crate::operation::operation_with_defaults::builders::OperationWithDefaultsInputBuilder {
    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::operation_with_defaults::OperationWithDefaultsOutput,
   13     13   
        ::aws_smithy_runtime_api::client::result::SdkError<
   14     14   
            crate::operation::operation_with_defaults::OperationWithDefaultsError,
   15     15   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,

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

@@ -487,487 +526,526 @@
  507    507   
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
  508    508   
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
  509    509   
    ) -> Self {
  510    510   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  511    511   
            source,
  512    512   
            meta: meta.unwrap_or_default(),
  513    513   
        })
  514    514   
    }
  515    515   
}
  516    516   
  517         -
pub use crate::operation::operation_with_nested_structure::_operation_with_nested_structure_output::OperationWithNestedStructureOutput;
  518         -
  519    517   
pub use crate::operation::operation_with_nested_structure::_operation_with_nested_structure_input::OperationWithNestedStructureInput;
  520    518   
         519  +
pub use crate::operation::operation_with_nested_structure::_operation_with_nested_structure_output::OperationWithNestedStructureOutput;
         520  +
  521    521   
mod _operation_with_nested_structure_input;
  522    522   
  523    523   
mod _operation_with_nested_structure_output;
  524    524   
  525    525   
/// Builders
  526    526   
pub mod builders;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/operation_with_nested_structure/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::operation_with_nested_structure::_operation_with_nested_structure_output::OperationWithNestedStructureOutputBuilder;
    3         -
    4      2   
pub use crate::operation::operation_with_nested_structure::_operation_with_nested_structure_input::OperationWithNestedStructureInputBuilder;
    5      3   
           4  +
pub use crate::operation::operation_with_nested_structure::_operation_with_nested_structure_output::OperationWithNestedStructureOutputBuilder;
           5  +
    6      6   
impl crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureInputBuilder {
    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::operation_with_nested_structure::OperationWithNestedStructureOutput,
   13     13   
        ::aws_smithy_runtime_api::client::result::SdkError<
   14     14   
            crate::operation::operation_with_nested_structure::OperationWithNestedStructureError,
   15     15   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,

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

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

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

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

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

@@ -0,1 +0,63 @@
           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 OutputStreamOutput {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub stream: crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
           8  +
}
           9  +
impl OutputStreamOutput {
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    pub fn stream(&self) -> &crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError> {
          12  +
        &self.stream
          13  +
    }
          14  +
}
          15  +
impl OutputStreamOutput {
          16  +
    /// Creates a new builder-style object to manufacture [`OutputStreamOutput`](crate::operation::output_stream::OutputStreamOutput).
          17  +
    pub fn builder() -> crate::operation::output_stream::builders::OutputStreamOutputBuilder {
          18  +
        crate::operation::output_stream::builders::OutputStreamOutputBuilder::default()
          19  +
    }
          20  +
}
          21  +
          22  +
/// A builder for [`OutputStreamOutput`](crate::operation::output_stream::OutputStreamOutput).
          23  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          24  +
#[non_exhaustive]
          25  +
pub struct OutputStreamOutputBuilder {
          26  +
    pub(crate) stream: ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>>,
          27  +
}
          28  +
impl OutputStreamOutputBuilder {
          29  +
    #[allow(missing_docs)] // documentation missing in model
          30  +
    pub fn stream(mut self, input: crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>) -> 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(
          36  +
        mut self,
          37  +
        input: ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>>,
          38  +
    ) -> Self {
          39  +
        self.stream = input;
          40  +
        self
          41  +
    }
          42  +
    #[allow(missing_docs)] // documentation missing in model
          43  +
    pub fn get_stream(
          44  +
        &self,
          45  +
    ) -> &::std::option::Option<crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>> {
          46  +
        &self.stream
          47  +
    }
          48  +
    /// Consumes the builder and constructs a [`OutputStreamOutput`](crate::operation::output_stream::OutputStreamOutput).
          49  +
    /// This method will fail if any of the following fields are not set:
          50  +
    /// - [`stream`](crate::operation::output_stream::builders::OutputStreamOutputBuilder::stream)
          51  +
    pub fn build(
          52  +
        self,
          53  +
    ) -> ::std::result::Result<crate::operation::output_stream::OutputStreamOutput, ::aws_smithy_types::error::operation::BuildError> {
          54  +
        ::std::result::Result::Ok(crate::operation::output_stream::OutputStreamOutput {
          55  +
            stream: self.stream.ok_or_else(|| {
          56  +
                ::aws_smithy_types::error::operation::BuildError::missing_field(
          57  +
                    "stream",
          58  +
                    "stream was not specified but it is required when building OutputStreamOutput",
          59  +
                )
          60  +
            })?,
          61  +
        })
          62  +
    }
          63  +
}

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

@@ -0,1 +0,140 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use crate::operation::output_stream::_output_stream_input::OutputStreamInputBuilder;
           3  +
           4  +
pub use crate::operation::output_stream::_output_stream_output::OutputStreamOutputBuilder;
           5  +
           6  +
impl crate::operation::output_stream::builders::OutputStreamInputBuilder {
           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::output_stream::OutputStreamOutput,
          13  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          14  +
            crate::operation::output_stream::OutputStreamError,
          15  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
          16  +
        >,
          17  +
    > {
          18  +
        let mut fluent_builder = client.output_stream();
          19  +
        fluent_builder.inner = self;
          20  +
        fluent_builder.send().await
          21  +
    }
          22  +
}
          23  +
/// Fluent builder constructing a request to `OutputStream`.
          24  +
///
          25  +
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
          26  +
pub struct OutputStreamFluentBuilder {
          27  +
    handle: ::std::sync::Arc<crate::client::Handle>,
          28  +
    inner: crate::operation::output_stream::builders::OutputStreamInputBuilder,
          29  +
    config_override: ::std::option::Option<crate::config::Builder>,
          30  +
}
          31  +
impl
          32  +
    crate::client::customize::internal::CustomizableSend<
          33  +
        crate::operation::output_stream::OutputStreamOutput,
          34  +
        crate::operation::output_stream::OutputStreamError,
          35  +
    > for OutputStreamFluentBuilder
          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::output_stream::OutputStreamOutput,
          43  +
            crate::operation::output_stream::OutputStreamError,
          44  +
        >,
          45  +
    > {
          46  +
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
          47  +
    }
          48  +
}
          49  +
impl OutputStreamFluentBuilder {
          50  +
    /// Creates a new `OutputStreamFluentBuilder`.
          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 OutputStream as a reference.
          59  +
    pub fn as_input(&self) -> &crate::operation::output_stream::builders::OutputStreamInputBuilder {
          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::output_stream::OutputStreamOutput,
          74  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          75  +
            crate::operation::output_stream::OutputStreamError,
          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::output_stream::OutputStream::operation_runtime_plugins(
          84  +
            self.handle.runtime_plugins.clone(),
          85  +
            &self.handle.conf,
          86  +
            self.config_override,
          87  +
        );
          88  +
        let mut output = crate::operation::output_stream::OutputStream::orchestrate(&runtime_plugins, input).await?;
          89  +
          90  +
        // Converts any error encountered beyond this point into an `SdkError` response error
          91  +
        // with an `HttpResponse`. However, since we have already exited the `orchestrate`
          92  +
        // function, the original `HttpResponse` is no longer available and cannot be restored.
          93  +
        // This means that header information from the original response has been lost.
          94  +
        //
          95  +
        // Note that the response body would have been consumed by the deserializer
          96  +
        // regardless, even if the initial message was hypothetically processed during
          97  +
        // the orchestrator's deserialization phase but later resulted in an error.
          98  +
        fn response_error(
          99  +
            err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
         100  +
        ) -> ::aws_smithy_runtime_api::client::result::SdkError<
         101  +
            crate::operation::output_stream::OutputStreamError,
         102  +
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         103  +
        > {
         104  +
            ::aws_smithy_runtime_api::client::result::SdkError::response_error(
         105  +
                err,
         106  +
                ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
         107  +
                    ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
         108  +
                    ::aws_smithy_types::body::SdkBody::empty(),
         109  +
                ),
         110  +
            )
         111  +
        }
         112  +
         113  +
        let message = output.stream.try_recv_initial_response().await.map_err(response_error)?;
         114  +
         115  +
        match message {
         116  +
            ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
         117  +
            ::std::option::Option::None => ::std::result::Result::Ok(output),
         118  +
        }
         119  +
    }
         120  +
         121  +
    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
         122  +
    pub fn customize(
         123  +
        self,
         124  +
    ) -> crate::client::customize::CustomizableOperation<
         125  +
        crate::operation::output_stream::OutputStreamOutput,
         126  +
        crate::operation::output_stream::OutputStreamError,
         127  +
        Self,
         128  +
    > {
         129  +
        crate::client::customize::CustomizableOperation::new(self)
         130  +
    }
         131  +
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
         132  +
        self.set_config_override(::std::option::Option::Some(config_override.into()));
         133  +
        self
         134  +
    }
         135  +
         136  +
    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
         137  +
        self.config_override = config_override;
         138  +
        self
         139  +
    }
         140  +
}

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

@@ -0,1 +0,355 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Orchestration and serialization glue logic for `OutputStreamWithInitialResponse`.
           3  +
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
           4  +
#[non_exhaustive]
           5  +
pub struct OutputStreamWithInitialResponse;
           6  +
impl OutputStreamWithInitialResponse {
           7  +
    /// Creates a new `OutputStreamWithInitialResponse`
           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::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
          14  +
    ) -> ::std::result::Result<
          15  +
        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
          16  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          17  +
            crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
          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::output_stream_with_initial_response::OutputStreamWithInitialResponseError>()
          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::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput>()
          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::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
          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  +
            "OutputStreamWithInitialResponse",
          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.OutputStreamWithInitialResponse",
          65  +
            "rpc.service" = "Rest Json Protocol",
          66  +
            "rpc.method" = "OutputStreamWithInitialResponse",
          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 OutputStreamWithInitialResponse {
          93  +
    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
          94  +
        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("OutputStreamWithInitialResponse");
          95  +
          96  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
          97  +
            OutputStreamWithInitialResponseRequestSerializer,
          98  +
        ));
          99  +
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
         100  +
            OutputStreamWithInitialResponseResponseDeserializer,
         101  +
        ));
         102  +
         103  +
        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
         104  +
            crate::config::auth::Params::builder()
         105  +
                .operation_name("OutputStreamWithInitialResponse")
         106  +
                .build()
         107  +
                .expect("required fields set"),
         108  +
        ));
         109  +
         110  +
        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
         111  +
            "OutputStreamWithInitialResponse",
         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("OutputStreamWithInitialResponse")
         124  +
            .with_interceptor(OutputStreamWithInitialResponseEndpointParamsInterceptor)
         125  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
         126  +
                crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
         127  +
            >::new())
         128  +
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
         129  +
                crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
         130  +
            >::new());
         131  +
         132  +
        ::std::borrow::Cow::Owned(rcb)
         133  +
    }
         134  +
}
         135  +
         136  +
#[derive(Debug)]
         137  +
struct OutputStreamWithInitialResponseResponseDeserializer;
         138  +
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OutputStreamWithInitialResponseResponseDeserializer {
         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_output_stream_with_initial_response::de_output_stream_with_initial_response_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_output_stream_with_initial_response::de_output_stream_with_initial_response_http_error(
         163  +
                response.status().as_u16(),
         164  +
                response.headers(),
         165  +
                body,
         166  +
            ),
         167  +
        )
         168  +
    }
         169  +
}
         170  +
#[derive(Debug)]
         171  +
struct OutputStreamWithInitialResponseRequestSerializer;
         172  +
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OutputStreamWithInitialResponseRequestSerializer {
         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::output_stream_with_initial_response::OutputStreamWithInitialResponseInput>()
         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::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
         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, "/OutputStreamWithInitialResponse").expect("formatting should succeed");
         194  +
                ::std::result::Result::Ok(())
         195  +
            }
         196  +
            #[allow(clippy::unnecessary_wraps)]
         197  +
            fn update_http_builder(
         198  +
                input: &crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
         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  +
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         204  +
            }
         205  +
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
         206  +
            builder
         207  +
        };
         208  +
        let body = ::aws_smithy_types::body::SdkBody::from("");
         209  +
         210  +
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         211  +
    }
         212  +
}
         213  +
#[derive(Debug)]
         214  +
struct OutputStreamWithInitialResponseEndpointParamsInterceptor;
         215  +
         216  +
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OutputStreamWithInitialResponseEndpointParamsInterceptor {
         217  +
    fn name(&self) -> &'static str {
         218  +
        "OutputStreamWithInitialResponseEndpointParamsInterceptor"
         219  +
    }
         220  +
         221  +
    fn read_before_execution(
         222  +
        &self,
         223  +
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
         224  +
            '_,
         225  +
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
         226  +
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
         227  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
         228  +
        >,
         229  +
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
         230  +
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
         231  +
        let _input = context
         232  +
            .input()
         233  +
            .downcast_ref::<OutputStreamWithInitialResponseInput>()
         234  +
            .ok_or("failed to downcast to OutputStreamWithInitialResponseInput")?;
         235  +
         236  +
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
         237  +
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
         238  +
        })?;
         239  +
        cfg.interceptor_state()
         240  +
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
         241  +
        ::std::result::Result::Ok(())
         242  +
    }
         243  +
}
         244  +
         245  +
// The get_* functions below are generated from JMESPath expressions in the
         246  +
// operationContextParams trait. They target the operation's input shape.
         247  +
         248  +
/// Error type for the `OutputStreamWithInitialResponseError` operation.
         249  +
#[non_exhaustive]
         250  +
#[derive(::std::fmt::Debug)]
         251  +
pub enum OutputStreamWithInitialResponseError {
         252  +
    #[allow(missing_docs)] // documentation missing in model
         253  +
    ErrorEvent(crate::types::error::ErrorEvent),
         254  +
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
         255  +
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
         256  +
    variable wildcard pattern and check `.code()`:
         257  +
     \
         258  +
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
         259  +
     \
         260  +
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OutputStreamWithInitialResponseError) for what information is available for the error.")]
         261  +
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         262  +
}
         263  +
impl OutputStreamWithInitialResponseError {
         264  +
    /// Creates the `OutputStreamWithInitialResponseError::Unhandled` variant from any error type.
         265  +
    pub fn unhandled(
         266  +
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
         267  +
    ) -> Self {
         268  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         269  +
            source: err.into(),
         270  +
            meta: ::std::default::Default::default(),
         271  +
        })
         272  +
    }
         273  +
         274  +
    /// Creates the `OutputStreamWithInitialResponseError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
         275  +
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
         276  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         277  +
            source: err.clone().into(),
         278  +
            meta: err,
         279  +
        })
         280  +
    }
         281  +
    ///
         282  +
    /// Returns error metadata, which includes the error code, message,
         283  +
    /// request ID, and potentially additional information.
         284  +
    ///
         285  +
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         286  +
        match self {
         287  +
            Self::ErrorEvent(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
         288  +
            Self::Unhandled(e) => &e.meta,
         289  +
        }
         290  +
    }
         291  +
    /// Returns `true` if the error kind is `OutputStreamWithInitialResponseError::ErrorEvent`.
         292  +
    pub fn is_error_event(&self) -> bool {
         293  +
        matches!(self, Self::ErrorEvent(_))
         294  +
    }
         295  +
}
         296  +
impl ::std::error::Error for OutputStreamWithInitialResponseError {
         297  +
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         298  +
        match self {
         299  +
            Self::ErrorEvent(_inner) => ::std::option::Option::Some(_inner),
         300  +
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         301  +
        }
         302  +
    }
         303  +
}
         304  +
impl ::std::fmt::Display for OutputStreamWithInitialResponseError {
         305  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         306  +
        match self {
         307  +
            Self::ErrorEvent(_inner) => _inner.fmt(f),
         308  +
            Self::Unhandled(_inner) => {
         309  +
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
         310  +
                    write!(f, "unhandled error ({code})")
         311  +
                } else {
         312  +
                    f.write_str("unhandled error")
         313  +
                }
         314  +
            }
         315  +
        }
         316  +
    }
         317  +
}
         318  +
impl ::aws_smithy_types::retry::ProvideErrorKind for OutputStreamWithInitialResponseError {
         319  +
    fn code(&self) -> ::std::option::Option<&str> {
         320  +
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         321  +
    }
         322  +
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         323  +
        ::std::option::Option::None
         324  +
    }
         325  +
}
         326  +
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OutputStreamWithInitialResponseError {
         327  +
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         328  +
        match self {
         329  +
            Self::ErrorEvent(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
         330  +
            Self::Unhandled(_inner) => &_inner.meta,
         331  +
        }
         332  +
    }
         333  +
}
         334  +
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OutputStreamWithInitialResponseError {
         335  +
    fn create_unhandled_error(
         336  +
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
         337  +
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
         338  +
    ) -> Self {
         339  +
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
         340  +
            source,
         341  +
            meta: meta.unwrap_or_default(),
         342  +
        })
         343  +
    }
         344  +
}
         345  +
         346  +
pub use crate::operation::output_stream_with_initial_response::_output_stream_with_initial_response_input::OutputStreamWithInitialResponseInput;
         347  +
         348  +
pub use crate::operation::output_stream_with_initial_response::_output_stream_with_initial_response_output::OutputStreamWithInitialResponseOutput;
         349  +
         350  +
mod _output_stream_with_initial_response_input;
         351  +
         352  +
mod _output_stream_with_initial_response_output;
         353  +
         354  +
/// Builders
         355  +
pub mod builders;

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream_with_initial_response/_output_stream_with_initial_response_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 OutputStreamWithInitialResponseOutput {
           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 OutputStreamWithInitialResponseOutput {
          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 OutputStreamWithInitialResponseOutput {
          23  +
    /// Creates a new builder-style object to manufacture [`OutputStreamWithInitialResponseOutput`](crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput).
          24  +
    pub fn builder() -> crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder {
          25  +
        crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder::default()
          26  +
    }
          27  +
}
          28  +
          29  +
/// A builder for [`OutputStreamWithInitialResponseOutput`](crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput).
          30  +
#[derive(::std::default::Default, ::std::fmt::Debug)]
          31  +
#[non_exhaustive]
          32  +
pub struct OutputStreamWithInitialResponseOutputBuilder {
          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 OutputStreamWithInitialResponseOutputBuilder {
          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 [`OutputStreamWithInitialResponseOutput`](crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput).
          72  +
    /// This method will fail if any of the following fields are not set:
          73  +
    /// - [`initial_response_member`](crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder::initial_response_member)
          74  +
    /// - [`stream`](crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder::stream)
          75  +
    pub fn build(
          76  +
        self,
          77  +
    ) -> ::std::result::Result<
          78  +
        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
          79  +
        ::aws_smithy_types::error::operation::BuildError,
          80  +
    > {
          81  +
        ::std::result::Result::Ok(
          82  +
            crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput {
          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 OutputStreamWithInitialResponseOutput",
          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 OutputStreamWithInitialResponseOutput",
          93  +
                    )
          94  +
                })?,
          95  +
            },
          96  +
        )
          97  +
    }
          98  +
}