Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/config/interceptors.rs

@@ -1,1 +11,12 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ClientRuntimeTypesReExportGenerator.kt:70 */
    2      3   
pub use ::aws_smithy_runtime_api::client::interceptors::context::AfterDeserializationInterceptorContextRef;
    3      4   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeDeserializationInterceptorContextMut;
    4      5   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeDeserializationInterceptorContextRef;
    5      6   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut;
    6      7   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef;
    7      8   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut;
    8      9   
pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextRef;
    9     10   
pub use ::aws_smithy_runtime_api::client::interceptors::context::FinalizerInterceptorContextMut;
   10     11   
pub use ::aws_smithy_runtime_api::client::interceptors::context::FinalizerInterceptorContextRef;
   11     12   
pub use ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/config/retry.rs

@@ -1,1 +7,9 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ClientRuntimeTypesReExportGenerator.kt:48 */
    2      3   
pub use ::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry;
    3      4   
pub use ::aws_smithy_runtime_api::client::retries::classifiers::RetryAction;
    4      5   
pub use ::aws_smithy_runtime_api::client::retries::ShouldAttempt;
    5      6   
    6         -
pub use ::aws_smithy_runtime::client::retries::RetryPartition;
           7  +
/* ResiliencyConfigCustomization.kt:324 */
           8  +
/* ResiliencyConfigCustomization.kt:329 */ pub use ::aws_smithy_runtime::client::retries::RetryPartition;
    7      9   
pub use ::aws_smithy_types::retry::{ReconnectMode, RetryConfig, RetryConfigBuilder, RetryMode};

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/config/timeout.rs

@@ -1,1 +2,3 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ResiliencyConfigCustomization.kt:335 */
    2      3   
pub use ::aws_smithy_types::timeout::{TimeoutConfig, TimeoutConfigBuilder};

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/error.rs

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ClientRuntimeTypesReExportGenerator.kt:96 */
    2      3   
pub use ::aws_smithy_runtime_api::box_error::BoxError;
    3      4   
           5  +
/* RequiredCustomizations.kt:104 */
    4      6   
/// Error type returned by the client.
    5      7   
pub type SdkError<E, R = ::aws_smithy_runtime_api::client::orchestrator::HttpResponse> = ::aws_smithy_runtime_api::client::result::SdkError<E, R>;
    6      8   
pub use ::aws_smithy_runtime_api::client::result::ConnectorError;
    7      9   
pub use ::aws_smithy_types::error::operation::BuildError;
    8     10   
    9     11   
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
   10     12   
pub use ::aws_smithy_types::error::metadata::ErrorMetadata;
   11     13   
pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata;
   12     14   
   13     15   
pub(crate) mod sealed_unhandled;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/error/sealed_unhandled.rs

@@ -1,1 +20,21 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServiceErrorGenerator.kt:277 */
    2      3   
/// This struct is not intended to be used.
    3      4   
///
    4      5   
/// This struct holds information about an unhandled error,
    5      6   
/// but that information should be obtained by using the
    6      7   
/// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait
    7      8   
/// on the error type.
    8      9   
///
    9     10   
/// This struct intentionally doesn't yield any useful information itself.
   10     11   
#[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
   11     12   
variable wildcard pattern and check `.code()`:

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/error_meta.rs

@@ -1,1 +70,104 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServiceErrorGenerator.kt:252 */
    2      3   
/// All possible error types for this service.
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::fmt::Debug)]
    5         -
pub enum Error {
    6         -
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
           8  +
pub /* ServiceErrorGenerator.kt:257 */ enum Error {
           9  +
    /// /* ServiceErrorGenerator.kt:264 */An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
          10  +
    /* ServiceErrorGenerator.kt:320 */
    7     11   
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
    8     12   
    variable wildcard pattern and check `.code()`:
    9     13   
     \
   10     14   
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
   11     15   
     \
   12     16   
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
   13         -
    Unhandled(crate::error::sealed_unhandled::Unhandled),
          17  +
    /* ServiceErrorGenerator.kt:266 */
          18  +
    Unhandled(crate::error::sealed_unhandled::Unhandled), /* ServiceErrorGenerator.kt:257 */
   14     19   
}
          20  +
/* ServiceErrorGenerator.kt:131 */
   15     21   
impl ::std::fmt::Display for Error {
          22  +
    /* ServiceErrorGenerator.kt:132 */
   16     23   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          24  +
        /* ServiceErrorGenerator.kt:133 */
   17     25   
        match self {
          26  +
            /* ServiceErrorGenerator.kt:137 */
   18     27   
            Error::Unhandled(_) => {
   19     28   
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
   20     29   
                    write!(f, "unhandled error ({code})")
   21     30   
                } else {
   22     31   
                    f.write_str("unhandled error")
   23     32   
                }
   24         -
            }
          33  +
            } /* ServiceErrorGenerator.kt:133 */
   25     34   
        }
          35  +
        /* ServiceErrorGenerator.kt:132 */
   26     36   
    }
          37  +
    /* ServiceErrorGenerator.kt:131 */
   27     38   
}
          39  +
/* ServiceErrorGenerator.kt:154 */
   28     40   
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
   29     41   
    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
   30     42   
        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
   31     43   
            source: value.into(),
   32     44   
            meta: ::std::default::Default::default(),
   33     45   
        })
   34     46   
    }
   35     47   
}
          48  +
/* ServiceErrorGenerator.kt:223 */
   36     49   
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
   37     50   
    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
   38     51   
        match self {
   39     52   
            Self::Unhandled(inner) => &inner.meta,
   40     53   
        }
   41     54   
    }
   42     55   
}
          56  +
/* ServiceErrorGenerator.kt:174 */
   43     57   
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::operation::OperationError, R>> for Error
   44     58   
where
   45     59   
    R: Send + Sync + std::fmt::Debug + 'static,
   46     60   
{
          61  +
    /* ServiceErrorGenerator.kt:179 */
   47     62   
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::operation::OperationError, R>) -> Self {
          63  +
        /* ServiceErrorGenerator.kt:184 */
   48     64   
        match err {
          65  +
            /* ServiceErrorGenerator.kt:185 */
   49     66   
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
          67  +
            /* ServiceErrorGenerator.kt:186 */
   50     68   
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
   51     69   
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
   52     70   
                source: err.into(),
   53     71   
            }),
          72  +
            /* ServiceErrorGenerator.kt:184 */
   54     73   
        }
          74  +
        /* ServiceErrorGenerator.kt:179 */
   55     75   
    }
          76  +
    /* ServiceErrorGenerator.kt:174 */
   56     77   
}
          78  +
/* ServiceErrorGenerator.kt:202 */
   57     79   
impl From<crate::operation::operation::OperationError> for Error {
          80  +
    /* ServiceErrorGenerator.kt:203 */
   58     81   
    fn from(err: crate::operation::operation::OperationError) -> Self {
          82  +
        /* ServiceErrorGenerator.kt:204 */
   59     83   
        match err {
          84  +
            /* ServiceErrorGenerator.kt:212 */
   60     85   
            crate::operation::operation::OperationError::Unhandled(inner) => Error::Unhandled(inner),
          86  +
            /* ServiceErrorGenerator.kt:204 */
   61     87   
        }
          88  +
        /* ServiceErrorGenerator.kt:203 */
   62     89   
    }
          90  +
    /* ServiceErrorGenerator.kt:202 */
   63     91   
}
          92  +
/* ServiceErrorGenerator.kt:115 */
   64     93   
impl ::std::error::Error for Error {
          94  +
    /* ServiceErrorGenerator.kt:116 */
   65     95   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          96  +
        /* ServiceErrorGenerator.kt:117 */
   66     97   
        match self {
   67         -
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
          98  +
            /* ServiceErrorGenerator.kt:121 */
          99  +
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source), /* ServiceErrorGenerator.kt:117 */
   68    100   
        }
         101  +
        /* ServiceErrorGenerator.kt:116 */
   69    102   
    }
         103  +
    /* ServiceErrorGenerator.kt:115 */
   70    104   
}

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/lib.rs

@@ -18,18 +127,136 @@
   38     38   
//! The [`operation`](crate::operation) module has a submodule for every API, and in each submodule
   39     39   
//! is the input, output, and error type for that API, as well as builders to construct each of those.
   40     40   
//!
   41     41   
//! There is a top-level [`Error`](crate::Error) type that encompasses all the errors that the
   42     42   
//! client can return. Any other error type can be converted to this `Error` type via the
   43     43   
//! [`From`](std::convert::From) trait.
   44     44   
//!
   45     45   
//! The other modules within this crate are not required for normal usage.
   46     46   
   47     47   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
          48  +
/* ServiceErrorGenerator.kt:127 */
   48     49   
pub use error_meta::Error;
   49     50   
          51  +
/* RustType.kt:516 */
   50     52   
#[doc(inline)]
          53  +
/* ServiceGenerator.kt:63 */
   51     54   
pub use config::Config;
   52     55   
   53         -
/// Client for calling the service.
          56  +
/// /* FluentClientDocs.kt:24 */Client for calling the service.
   54     57   
///
   55     58   
/// ## Constructing a `Client`
   56     59   
///
   57     60   
/// A `Client` requires a config in order to be constructed. With the default set of Cargo features,
   58     61   
/// this config will only require an endpoint to produce a functioning client. However, some Smithy
   59     62   
/// features will require additional configuration. For example, `@auth` requires some kind of identity
   60     63   
/// or identity resolver to be configured. The config is used to customize various aspects of the client,
   61     64   
/// such as:
   62     65   
///
   63     66   
///   - [The underlying HTTP client](crate::config::Builder::http_client)
   64     67   
///   - [Retries](crate::config::Builder::retry_config)
   65     68   
///   - [Timeouts](crate::config::Builder::timeout_config)
   66     69   
///   - [... and more](crate::config::Builder)
   67     70   
///
   68     71   
/// Below is a minimal example of how to create a client:
   69     72   
///
   70     73   
/// ```rust,no_run
   71     74   
/// let config = simple::Config::builder()
   72     75   
///     .endpoint_url("http://localhost:1234")
   73     76   
///     .build();
   74     77   
/// let client = simple::Client::from_conf(config);
   75     78   
/// ```
   76     79   
///
   77     80   
/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should be done
   78     81   
/// once at application start-up. Cloning a client is cheap (it's just an [`Arc`](std::sync::Arc) under the hood),
   79     82   
/// so creating it once at start-up and cloning it around the application as needed is recommended.
   80         -
/// # Using the `Client`
          83  +
/// /* FluentClientDocs.kt:79 */# Using the `Client`
   81     84   
///
   82     85   
/// A client has a function for every operation that can be performed by the service.
   83     86   
/// For example, the [`Operation`](crate::operation::operation) operation has
   84     87   
/// a [`Client::operation`], function which returns a builder for that operation.
   85     88   
/// The fluent builder ultimately has a `send()` function that returns an async future that
   86     89   
/// returns a result, as illustrated below:
   87     90   
///
   88     91   
/// ```rust,ignore
   89     92   
/// let result = client.operation()
   90     93   
///     .message("example")
   91     94   
///     .send()
   92     95   
///     .await;
   93     96   
/// ```
   94     97   
///
   95     98   
/// The underlying HTTP requests that get made by this can be modified with the `customize_operation`
   96     99   
/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more
   97    100   
/// information.
   98    101   
pub mod client;
   99    102   
  100         -
/// Configuration for the service.
         103  +
/// /* ClientRustModule.kt:121 */Configuration for the service.
  101    104   
pub mod config;
  102    105   
  103         -
/// Common errors and error handling utilities.
         106  +
/// /* ClientRustModule.kt:121 */Common errors and error handling utilities.
  104    107   
pub mod error;
  105    108   
         109  +
/* RustModule.kt:172 */
  106    110   
mod error_meta;
  107    111   
  108         -
/// Information about this crate.
         112  +
/// /* ClientRustModule.kt:121 */Information about this crate.
  109    113   
pub mod meta;
  110    114   
  111         -
/// Primitives such as `Blob` or `DateTime` used by other types.
         115  +
/// /* ClientRustModule.kt:121 */Primitives such as `Blob` or `DateTime` used by other types.
  112    116   
pub mod primitives;
  113    117   
         118  +
/* RustModule.kt:172 */
  114    119   
mod auth_plugin;
  115    120   
  116         -
/// All operations that this crate can perform.
         121  +
/// /* ClientRustModule.kt:121 */All operations that this crate can perform.
  117    122   
pub mod operation;
  118    123   
  119    124   
pub(crate) mod protocol_serde;
  120    125   
         126  +
/* RustModule.kt:172 */
  121    127   
mod sdk_feature_tracker;
  122    128   
         129  +
/* RustModule.kt:172 */
  123    130   
mod serialization_settings;
  124    131   
         132  +
/* RustModule.kt:172 */
  125    133   
mod json_errors;
  126    134   
         135  +
/* FluentClientDecorator.kt:76 */
  127    136   
pub use client::Client;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/meta.rs

@@ -1,1 +4,5 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
           3  +
/* CrateVersionCustomization.kt:23 */
    3      4   
/// Crate version number.
    4      5   
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

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

@@ -1,1 +4,4 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// Types for the `Operation` operation.
           2  +
/* CodegenDelegator.kt:51 */
           3  +
/// /* CodegenDelegator.kt:51 */Types for the `Operation` operation.
    4      4   
pub mod operation;

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

@@ -1,1 +40,49 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* OperationGenerator.kt:77 */
    2      3   
/// Orchestration and serialization glue logic for `Operation`.
           4  +
/* RustType.kt:516 */
    3      5   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
           6  +
/* RustType.kt:516 */
    4      7   
#[non_exhaustive]
           8  +
/* OperationGenerator.kt:84 */
    5      9   
pub struct Operation;
          10  +
/* OperationGenerator.kt:85 */
    6     11   
impl Operation {
    7         -
    /// Creates a new `Operation`
          12  +
    /// /* OperationGenerator.kt:86 */Creates a new `Operation`
          13  +
    /* OperationGenerator.kt:87 */
    8     14   
    pub fn new() -> Self {
          15  +
        /* OperationGenerator.kt:88 */
    9     16   
        Self
          17  +
        /* OperationGenerator.kt:87 */
   10     18   
    }
          19  +
    /* OperationGenerator.kt:138 */
   11     20   
    pub(crate) async fn orchestrate(
   12     21   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     22   
        input: crate::operation::operation::OperationInput,
   14     23   
    ) -> ::std::result::Result<
   15     24   
        crate::operation::operation::OperationOutput,
   16     25   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     26   
            crate::operation::operation::OperationError,
   18     27   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     28   
        >,
   20     29   
    > {
@@ -54,63 +324,395 @@
   74     83   
                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
   75     84   
            }
   76     85   
            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
   77     86   
                config_override,
   78     87   
                client_config.config.clone(),
   79     88   
                &client_config.runtime_components,
   80     89   
            ));
   81     90   
        }
   82     91   
        runtime_plugins
   83     92   
    }
          93  +
    /* OperationGenerator.kt:85 */
   84     94   
}
          95  +
/* OperationRuntimePluginGenerator.kt:55 */
   85     96   
impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for Operation {
   86     97   
    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
   87     98   
        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Operation");
   88     99   
   89    100   
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
   90    101   
            OperationRequestSerializer,
   91    102   
        ));
   92    103   
        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
   93    104   
            OperationResponseDeserializer,
   94    105   
        ));
   95    106   
   96    107   
        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
   97    108   
            ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
   98    109   
        ));
   99    110   
  100    111   
        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
  101    112   
            "Operation",
  102    113   
            "SimpleService",
  103    114   
        ));
  104    115   
  105    116   
        ::std::option::Option::Some(cfg.freeze())
  106    117   
    }
  107    118   
  108    119   
    fn runtime_components(
  109    120   
        &self,
  110    121   
        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
  111    122   
    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
  112    123   
        #[allow(unused_mut)]
  113    124   
        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("Operation")
  114    125   
            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
  115    126   
            .with_interceptor(OperationEndpointParamsInterceptor)
  116    127   
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
  117    128   
                crate::operation::operation::OperationError,
  118    129   
            >::new())
  119    130   
            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
  120    131   
                crate::operation::operation::OperationError,
  121    132   
            >::new());
  122    133   
  123    134   
        ::std::borrow::Cow::Owned(rcb)
  124    135   
    }
  125    136   
}
  126    137   
         138  +
/* ResponseDeserializerGenerator.kt:64 */
  127    139   
#[derive(Debug)]
  128    140   
struct OperationResponseDeserializer;
  129    141   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OperationResponseDeserializer {
  130    142   
    fn deserialize_nonstreaming(
  131    143   
        &self,
  132    144   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  133    145   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  134    146   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  135    147   
        let headers = response.headers();
  136    148   
        let body = response.body().bytes().expect("body loaded");
  137    149   
        #[allow(unused_mut)]
  138    150   
        let mut force_error = false;
  139    151   
  140    152   
        let parse_result = if !success && status != 200 || force_error {
  141    153   
            crate::protocol_serde::shape_operation::de_operation_http_error(status, headers, body)
  142    154   
        } else {
  143    155   
            crate::protocol_serde::shape_operation::de_operation_http_response(status, headers, body)
  144    156   
        };
  145    157   
        crate::protocol_serde::type_erase_result(parse_result)
  146    158   
    }
  147    159   
}
         160  +
/* RequestSerializerGenerator.kt:67 */
  148    161   
#[derive(Debug)]
  149    162   
struct OperationRequestSerializer;
  150    163   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OperationRequestSerializer {
  151    164   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  152    165   
    fn serialize_input(
  153    166   
        &self,
  154    167   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  155    168   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  156    169   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  157    170   
        let input = input.downcast::<crate::operation::operation::OperationInput>().expect("correct type");
  158    171   
        let _header_serialization_settings = _cfg
  159    172   
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  160    173   
            .cloned()
  161    174   
            .unwrap_or_default();
  162    175   
        let mut request_builder = {
  163    176   
            fn uri_base(
  164    177   
                _input: &crate::operation::operation::OperationInput,
  165    178   
                output: &mut ::std::string::String,
  166    179   
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  167    180   
                use ::std::fmt::Write as _;
  168    181   
                ::std::write!(output, "/operation").expect("formatting should succeed");
  169    182   
                ::std::result::Result::Ok(())
  170    183   
            }
  171    184   
            #[allow(clippy::unnecessary_wraps)]
  172    185   
            fn update_http_builder(
  173    186   
                input: &crate::operation::operation::OperationInput,
  174    187   
                builder: ::http::request::Builder,
  175    188   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  176    189   
                let mut uri = ::std::string::String::new();
  177    190   
                uri_base(input, &mut uri)?;
  178    191   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  179    192   
            }
  180    193   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  181    194   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json");
  182    195   
            builder
  183    196   
        };
  184    197   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
  185    198   
        if let Some(content_length) = body.content_length() {
  186    199   
            let content_length = content_length.to_string();
  187    200   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  188    201   
        }
  189    202   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  190    203   
    }
  191    204   
}
         205  +
/* EndpointParamsInterceptorGenerator.kt:86 */
  192    206   
#[derive(Debug)]
  193    207   
struct OperationEndpointParamsInterceptor;
  194    208   
  195    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationEndpointParamsInterceptor {
  196    210   
    fn name(&self) -> &'static str {
  197    211   
        "OperationEndpointParamsInterceptor"
  198    212   
    }
  199    213   
  200    214   
    fn read_before_execution(
  201    215   
        &self,
  202    216   
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
  203    217   
            '_,
  204    218   
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
  205    219   
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
  206    220   
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
  207    221   
        >,
  208    222   
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  209    223   
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
  210    224   
        let _input = context
  211    225   
            .input()
  212    226   
            .downcast_ref::<OperationInput>()
  213    227   
            .ok_or("failed to downcast to OperationInput")?;
  214    228   
  215    229   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  216    230   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  217    231   
        })?;
  218    232   
        cfg.interceptor_state()
  219    233   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  220    234   
        ::std::result::Result::Ok(())
  221    235   
    }
  222    236   
}
  223    237   
  224    238   
// The get_* functions below are generated from JMESPath expressions in the
  225    239   
// operationContextParams trait. They target the operation's input shape.
  226    240   
         241  +
/* OperationErrorGenerator.kt:79 */
  227    242   
/// Error type for the `OperationError` operation.
         243  +
/* RustType.kt:516 */
  228    244   
#[non_exhaustive]
         245  +
/* RustType.kt:516 */
  229    246   
#[derive(::std::fmt::Debug)]
  230         -
pub enum OperationError {
         247  +
pub /* OperationErrorGenerator.kt:81 */ enum OperationError {
         248  +
    /* OperationErrorGenerator.kt:88 */
  231    249   
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
  232    250   
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
  233    251   
    variable wildcard pattern and check `.code()`:
  234    252   
     \
  235    253   
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
  236    254   
     \
  237    255   
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OperationError) for what information is available for the error.")]
  238    256   
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         257  +
    /* OperationErrorGenerator.kt:81 */
  239    258   
}
         259  +
/* OperationErrorGenerator.kt:218 */
  240    260   
impl OperationError {
         261  +
    /* OperationErrorGenerator.kt:219 */
  241    262   
    /// Creates the `OperationError::Unhandled` variant from any error type.
  242    263   
    pub fn unhandled(
  243    264   
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
  244    265   
    ) -> Self {
  245    266   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  246    267   
            source: err.into(),
  247    268   
            meta: ::std::default::Default::default(),
  248    269   
        })
  249    270   
    }
  250    271   
  251    272   
    /// Creates the `OperationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
  252    273   
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
  253    274   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  254    275   
            source: err.clone().into(),
  255    276   
            meta: err,
  256    277   
        })
  257    278   
    }
  258         -
    ///
         279  +
    /// /* OperationErrorGenerator.kt:236 */
  259    280   
    /// Returns error metadata, which includes the error code, message,
  260    281   
    /// request ID, and potentially additional information.
  261    282   
    ///
         283  +
    /* OperationErrorGenerator.kt:242 */
  262    284   
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         285  +
        /* OperationErrorGenerator.kt:243 */
  263    286   
        match self {
  264         -
            Self::Unhandled(e) => &e.meta,
         287  +
            /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
         288  +
            /* OperationErrorGenerator.kt:243 */
  265    289   
        }
         290  +
        /* OperationErrorGenerator.kt:242 */
  266    291   
    }
         292  +
    /* OperationErrorGenerator.kt:218 */
  267    293   
}
         294  +
/* OperationErrorGenerator.kt:269 */
  268    295   
impl ::std::error::Error for OperationError {
         296  +
    /* OperationErrorGenerator.kt:270 */
  269    297   
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         298  +
        /* OperationErrorGenerator.kt:318 */
  270    299   
        match self {
  271         -
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         300  +
            /* OperationErrorGenerator.kt:326 */
         301  +
            Self::Unhandled(_inner) => {
         302  +
                /* OperationErrorGenerator.kt:279 */
         303  +
                ::std::option::Option::Some(&*_inner.source)
         304  +
                /* OperationErrorGenerator.kt:326 */
         305  +
            } /* OperationErrorGenerator.kt:318 */
  272    306   
        }
         307  +
        /* OperationErrorGenerator.kt:270 */
  273    308   
    }
         309  +
    /* OperationErrorGenerator.kt:269 */
  274    310   
}
         311  +
/* OperationErrorGenerator.kt:133 */
  275    312   
impl ::std::fmt::Display for OperationError {
         313  +
    /* OperationErrorGenerator.kt:134 */
  276    314   
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         315  +
        /* OperationErrorGenerator.kt:318 */
  277    316   
        match self {
         317  +
            /* OperationErrorGenerator.kt:326 */
  278    318   
            Self::Unhandled(_inner) => {
         319  +
                /* OperationErrorGenerator.kt:139 */
  279    320   
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
  280    321   
                    write!(f, "unhandled error ({code})")
  281    322   
                } else {
  282    323   
                    f.write_str("unhandled error")
  283    324   
                }
  284         -
            }
         325  +
                /* OperationErrorGenerator.kt:326 */
         326  +
            } /* OperationErrorGenerator.kt:318 */
  285    327   
        }
         328  +
        /* OperationErrorGenerator.kt:134 */
  286    329   
    }
         330  +
    /* OperationErrorGenerator.kt:133 */
  287    331   
}
         332  +
/* OperationErrorGenerator.kt:182 */
  288    333   
impl ::aws_smithy_types::retry::ProvideErrorKind for OperationError {
         334  +
    /* OperationErrorGenerator.kt:186 */
  289    335   
    fn code(&self) -> ::std::option::Option<&str> {
         336  +
        /* OperationErrorGenerator.kt:187 */
  290    337   
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         338  +
        /* OperationErrorGenerator.kt:186 */
  291    339   
    }
         340  +
    /* OperationErrorGenerator.kt:190 */
  292    341   
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         342  +
        /* OperationErrorGenerator.kt:197 */
  293    343   
        ::std::option::Option::None
         344  +
        /* OperationErrorGenerator.kt:190 */
  294    345   
    }
         346  +
    /* OperationErrorGenerator.kt:182 */
  295    347   
}
         348  +
/* OperationErrorGenerator.kt:163 */
  296    349   
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OperationError {
         350  +
    /* OperationErrorGenerator.kt:164 */
  297    351   
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         352  +
        /* OperationErrorGenerator.kt:318 */
  298    353   
        match self {
  299         -
            Self::Unhandled(_inner) => &_inner.meta,
         354  +
            /* OperationErrorGenerator.kt:326 */
         355  +
            Self::Unhandled(_inner) => {
         356  +
                /* OperationErrorGenerator.kt:168 */
         357  +
                &_inner.meta
         358  +
                /* OperationErrorGenerator.kt:326 */
         359  +
            } /* OperationErrorGenerator.kt:318 */
  300    360   
        }
         361  +
        /* OperationErrorGenerator.kt:164 */
  301    362   
    }
         363  +
    /* OperationErrorGenerator.kt:163 */
  302    364   
}
         365  +
/* OperationErrorGenerator.kt:109 */
  303    366   
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OperationError {
         367  +
    /* OperationErrorGenerator.kt:110 */
  304    368   
    fn create_unhandled_error(
  305    369   
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
  306    370   
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
  307    371   
    ) -> Self {
         372  +
        /* OperationErrorGenerator.kt:121 */
  308    373   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  309    374   
            source,
  310    375   
            meta: meta.unwrap_or_default(),
  311    376   
        })
         377  +
        /* OperationErrorGenerator.kt:110 */
  312    378   
    }
         379  +
    /* OperationErrorGenerator.kt:109 */
  313    380   
}
  314    381   
         382  +
/* CodegenDelegator.kt:255 */
  315    383   
pub use crate::operation::operation::_operation_output::OperationOutput;
  316    384   
         385  +
/* CodegenDelegator.kt:255 */
  317    386   
pub use crate::operation::operation::_operation_input::OperationInput;
  318    387   
         388  +
/* RustModule.kt:172 */
  319    389   
mod _operation_input;
  320    390   
         391  +
/* RustModule.kt:172 */
  321    392   
mod _operation_output;
  322    393   
  323         -
/// Builders
         394  +
/// /* CodegenDelegator.kt:51 */Builders
  324    395   
pub mod builders;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/operation/operation/_operation_input.rs

@@ -1,1 +47,91 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct OperationInput {
           8  +
pub /* StructureGenerator.kt:201 */ struct OperationInput {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub message: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl OperationInput {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn message(&self) -> ::std::option::Option<&str> {
          20  +
        /* StructureGenerator.kt:169 */
   12     21   
        self.message.as_deref()
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl OperationInput {
   16         -
    /// Creates a new builder-style object to manufacture [`OperationInput`](crate::operation::operation::OperationInput).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`OperationInput`](crate::operation::operation::OperationInput).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::operation::operation::builders::OperationInputBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::operation::operation::builders::OperationInputBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`OperationInput`](crate::operation::operation::OperationInput).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`OperationInput`](crate::operation::operation::OperationInput).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct OperationInputBuilder {
   26         -
    pub(crate) message: ::std::option::Option<::std::string::String>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) message: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl OperationInputBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.message = ::std::option::Option::Some(input.into());
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.message = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.message
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`OperationInput`](crate::operation::operation::OperationInput).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`OperationInput`](crate::operation::operation::OperationInput).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> ::std::result::Result<crate::operation::operation::OperationInput, ::aws_smithy_types::error::operation::BuildError> {
   45         -
        ::std::result::Result::Ok(crate::operation::operation::OperationInput { message: self.message })
          80  +
        /* BuilderGenerator.kt:254 */
          81  +
        ::std::result::Result::Ok(
          82  +
            /* BuilderGenerator.kt:477 */
          83  +
            crate::operation::operation::OperationInput {
          84  +
                /* BuilderGenerator.kt:481 */ message: self.message,
          85  +
                /* BuilderGenerator.kt:477 */
          86  +
            }, /* BuilderGenerator.kt:254 */
          87  +
        )
          88  +
        /* BuilderGenerator.kt:253 */
   46     89   
    }
          90  +
    /* BuilderGenerator.kt:355 */
   47     91   
}

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/operation/operation/_operation_output.rs

@@ -1,1 +47,88 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct OperationOutput {
           8  +
pub /* StructureGenerator.kt:201 */ struct OperationOutput {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub message: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl OperationOutput {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn message(&self) -> ::std::option::Option<&str> {
          20  +
        /* StructureGenerator.kt:169 */
   12     21   
        self.message.as_deref()
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl OperationOutput {
   16         -
    /// Creates a new builder-style object to manufacture [`OperationOutput`](crate::operation::operation::OperationOutput).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`OperationOutput`](crate::operation::operation::OperationOutput).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::operation::operation::builders::OperationOutputBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::operation::operation::builders::OperationOutputBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`OperationOutput`](crate::operation::operation::OperationOutput).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`OperationOutput`](crate::operation::operation::OperationOutput).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct OperationOutputBuilder {
   26         -
    pub(crate) message: ::std::option::Option<::std::string::String>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) message: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl OperationOutputBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.message = ::std::option::Option::Some(input.into());
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.message = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.message
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`OperationOutput`](crate::operation::operation::OperationOutput).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`OperationOutput`](crate::operation::operation::OperationOutput).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> crate::operation::operation::OperationOutput {
   45         -
        crate::operation::operation::OperationOutput { message: self.message }
          80  +
        /* BuilderGenerator.kt:477 */
          81  +
        crate::operation::operation::OperationOutput {
          82  +
            /* BuilderGenerator.kt:481 */ message: self.message,
          83  +
            /* BuilderGenerator.kt:477 */
          84  +
        }
          85  +
        /* BuilderGenerator.kt:253 */
   46     86   
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

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

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

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/primitives.rs

@@ -1,1 +7,8 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* SmithyTypesPubUseExtra.kt:66 */
    2      3   
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
    3      4   
pub use ::aws_smithy_types::Blob;
    4         -
pub use ::aws_smithy_types::DateTime;
           5  +
/* SmithyTypesPubUseExtra.kt:69 */ pub use ::aws_smithy_types::DateTime;
    5      6   
    6         -
/// Event stream related primitives such as `Message` or `Header`.
           7  +
/// /* ClientRustModule.kt:121 */Event stream related primitives such as `Message` or `Header`.
    7      8   
pub mod event_stream;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/protocol_serde.rs

@@ -1,1 +36,39 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ResponseDeserializerGenerator.kt:170 */
    2      3   
pub(crate) fn type_erase_result<O, E>(
    3      4   
    result: ::std::result::Result<O, E>,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::aws_smithy_runtime_api::client::interceptors::context::Output,
    6      7   
    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError<::aws_smithy_runtime_api::client::interceptors::context::Error>,
    7      8   
>
    8      9   
where
    9     10   
    O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   10     11   
    E: ::std::error::Error + std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   11     12   
{
   12     13   
    result
   13     14   
        .map(|output| ::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
   14     15   
        .map_err(|error| ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(error))
   15     16   
        .map_err(::std::convert::Into::into)
   16     17   
}
   17     18   
          19  +
/* RestJson.kt:122 */
   18     20   
pub fn parse_http_error_metadata(
   19     21   
    _response_status: u16,
   20     22   
    response_headers: &::aws_smithy_runtime_api::http::Headers,
   21     23   
    response_body: &[u8],
   22     24   
) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> {
   23     25   
    crate::json_errors::parse_error_metadata(response_body, response_headers)
   24     26   
}
   25     27   
   26     28   
pub(crate) mod shape_operation;
   27     29   
          30  +
/* JsonParserGenerator.kt:227 */
   28     31   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   29     32   
    if data.is_empty() {
   30     33   
        b"{}"
   31     34   
    } else {
   32     35   
        data
   33     36   
    }
   34     37   
}
   35     38   
   36     39   
pub(crate) mod shape_operation_input;

tmp-codegen-diff/codegen-client-test/simple/rust-client-codegen/src/protocol_serde/shape_operation.rs

@@ -1,1 +74,120 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_operation_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::operation::OperationOutput, crate::operation::operation::OperationError> {
          10  +
    /* RustType.kt:516 */
    8     11   
    #[allow(unused_mut)]
          12  +
    /* ProtocolParserGenerator.kt:106 */
    9     13   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10     14   
        .map_err(crate::operation::operation::OperationError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::operation::OperationError::generic(generic))
          19  +
    /* ProtocolParserGenerator.kt:99 */
   13     20   
}
   14     21   
          22  +
/* RustType.kt:516 */
   15     23   
#[allow(clippy::unnecessary_wraps)]
          24  +
/* ProtocolParserGenerator.kt:71 */
   16     25   
pub fn de_operation_http_response(
   17     26   
    _response_status: u16,
   18     27   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19     28   
    _response_body: &[u8],
   20     29   
) -> std::result::Result<crate::operation::operation::OperationOutput, crate::operation::operation::OperationError> {
          30  +
    /* ProtocolParserGenerator.kt:77 */
   21     31   
    Ok({
          32  +
        /* RustType.kt:516 */
   22     33   
        #[allow(unused_mut)]
          34  +
        /* ProtocolParserGenerator.kt:240 */
   23     35   
        let mut output = crate::operation::operation::builders::OperationOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:247 */
   24     37   
        output = crate::protocol_serde::shape_operation::de_operation(_response_body, output)
   25     38   
            .map_err(crate::operation::operation::OperationError::unhandled)?;
          39  +
        /* ClientBuilderInstantiator.kt:56 */
   26     40   
        output.build()
          41  +
        /* ProtocolParserGenerator.kt:77 */
   27     42   
    })
          43  +
    /* ProtocolParserGenerator.kt:71 */
   28     44   
}
   29     45   
          46  +
/* JsonSerializerGenerator.kt:287 */
   30     47   
pub fn ser_operation_input(
   31     48   
    input: &crate::operation::operation::OperationInput,
   32     49   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          50  +
    /* JsonSerializerGenerator.kt:291 */
   33     51   
    let mut out = String::new();
          52  +
    /* JsonSerializerGenerator.kt:292 */
   34     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          54  +
    /* JsonSerializerGenerator.kt:375 */
   35     55   
    crate::protocol_serde::shape_operation_input::ser_operation_input_input(&mut object, input)?;
          56  +
    /* JsonSerializerGenerator.kt:295 */
   36     57   
    object.finish();
          58  +
    /* JsonSerializerGenerator.kt:296 */
   37     59   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          60  +
    /* JsonSerializerGenerator.kt:287 */
   38     61   
}
   39     62   
          63  +
/* JsonParserGenerator.kt:148 */
   40     64   
pub(crate) fn de_operation(
   41     65   
    value: &[u8],
   42     66   
    mut builder: crate::operation::operation::builders::OperationOutputBuilder,
   43     67   
) -> ::std::result::Result<crate::operation::operation::builders::OperationOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
          68  +
    /* JsonParserGenerator.kt:153 */
   44     69   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   45     70   
    let tokens = &mut tokens_owned;
   46     71   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          72  +
    /* JsonParserGenerator.kt:684 */
   47     73   
    loop {
          74  +
        /* JsonParserGenerator.kt:685 */
   48     75   
        match tokens.next().transpose()? {
   49         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   50         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   51         -
                "message" => {
   52         -
                    builder = builder.set_message(
   53         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   54         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   55         -
                            .transpose()?,
   56         -
                    );
          76  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          77  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          78  +
                /* JsonParserGenerator.kt:260 */
          79  +
                match key.to_unescaped()?.as_ref() {
          80  +
                    /* JsonParserGenerator.kt:262 */
          81  +
                    "message" => {
          82  +
                        /* JsonParserGenerator.kt:265 */
          83  +
                        builder = builder.set_message(
          84  +
                            /* JsonParserGenerator.kt:354 */
          85  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          86  +
                                .map(|s|
          87  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          88  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          89  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          90  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
          91  +
                        );
          92  +
                        /* JsonParserGenerator.kt:262 */
          93  +
                    }
          94  +
                    /* JsonParserGenerator.kt:290 */
          95  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   57     96   
                }
   58         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   59         -
            },
          97  +
                /* JsonParserGenerator.kt:686 */
          98  +
            }
          99  +
            /* JsonParserGenerator.kt:695 */
   60    100   
            other => {
   61    101   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   62    102   
                    "expected object key or end object, found: {:?}",
   63    103   
                    other
   64    104   
                )))
   65         -
            }
         105  +
            } /* JsonParserGenerator.kt:685 */
   66    106   
        }
         107  +
        /* JsonParserGenerator.kt:684 */
   67    108   
    }
         109  +
    /* JsonParserGenerator.kt:250 */
   68    110   
    if tokens.next().is_some() {
         111  +
        /* JsonParserGenerator.kt:251 */
   69    112   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   70    113   
            "found more JSON tokens after completing parsing",
   71    114   
        ));
         115  +
        /* JsonParserGenerator.kt:250 */
   72    116   
    }
         117  +
    /* JsonParserGenerator.kt:163 */
   73    118   
    Ok(builder)
         119  +
    /* JsonParserGenerator.kt:148 */
   74    120   
}