Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/endpoint-rules/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/endpoint-rules/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/endpoint-rules/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/endpoint-rules/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   
                }
          33  +
            } /* ServiceErrorGenerator.kt:133 */
   24     34   
        }
          35  +
        /* ServiceErrorGenerator.kt:132 */
   25     36   
    }
   26         -
    }
          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::test_operation::TestOperationError, 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::test_operation::TestOperationError, 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::test_operation::TestOperationError> for Error {
          80  +
    /* ServiceErrorGenerator.kt:203 */
   58     81   
    fn from(err: crate::operation::test_operation::TestOperationError) -> Self {
          82  +
        /* ServiceErrorGenerator.kt:204 */
   59     83   
        match err {
          84  +
            /* ServiceErrorGenerator.kt:212 */
   60     85   
            crate::operation::test_operation::TestOperationError::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/endpoint-rules/rust-client-codegen/src/lib.rs

@@ -18,18 +129,139 @@
   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 = endpoint_rules::Config::builder()
   72     75   
///     .endpoint_url("http://localhost:1234")
   73     76   
///     .build();
   74     77   
/// let client = endpoint_rules::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 [`TestOperation`](crate::operation::test_operation) operation has
   84     87   
/// a [`Client::test_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.test_operation()
   90     93   
///     .bucket("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 endpoint_lib;
  126    134   
         135  +
/* RustModule.kt:172 */
  127    136   
mod json_errors;
  128    137   
         138  +
/* FluentClientDecorator.kt:76 */
  129    139   
pub use client::Client;

tmp-codegen-diff/codegen-client-test/endpoint-rules/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/endpoint-rules/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 `TestOperation` operation.
           2  +
/* CodegenDelegator.kt:51 */
           3  +
/// /* CodegenDelegator.kt:51 */Types for the `TestOperation` operation.
    4      4   
pub mod test_operation;

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

tmp-codegen-diff/codegen-client-test/endpoint-rules/rust-client-codegen/src/operation/test_operation/_test_operation_input.rs

@@ -1,1 +49,93 @@
    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 TestOperationInput {
           8  +
pub /* StructureGenerator.kt:201 */ struct TestOperationInput {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub bucket: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl TestOperationInput {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn bucket(&self) -> ::std::option::Option<&str> {
          20  +
        /* StructureGenerator.kt:169 */
   12     21   
        self.bucket.as_deref()
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl TestOperationInput {
   16         -
    /// Creates a new builder-style object to manufacture [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::operation::test_operation::builders::TestOperationInputBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::operation::test_operation::builders::TestOperationInputBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          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 TestOperationInputBuilder {
   26         -
    pub(crate) bucket: ::std::option::Option<::std::string::String>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) bucket: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl TestOperationInputBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.bucket = ::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_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.bucket = 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_bucket(&self) -> &::std::option::Option<::std::string::String> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.bucket
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`TestOperationInput`](crate::operation::test_operation::TestOperationInput).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(
   45     80   
        self,
   46     81   
    ) -> ::std::result::Result<crate::operation::test_operation::TestOperationInput, ::aws_smithy_types::error::operation::BuildError> {
   47         -
        ::std::result::Result::Ok(crate::operation::test_operation::TestOperationInput { bucket: self.bucket })
          82  +
        /* BuilderGenerator.kt:254 */
          83  +
        ::std::result::Result::Ok(
          84  +
            /* BuilderGenerator.kt:477 */
          85  +
            crate::operation::test_operation::TestOperationInput {
          86  +
                /* BuilderGenerator.kt:481 */ bucket: self.bucket,
          87  +
                /* BuilderGenerator.kt:477 */
          88  +
            }, /* BuilderGenerator.kt:254 */
          89  +
        )
          90  +
        /* BuilderGenerator.kt:253 */
   48     91   
    }
          92  +
    /* BuilderGenerator.kt:355 */
   49     93   
}

tmp-codegen-diff/codegen-client-test/endpoint-rules/rust-client-codegen/src/operation/test_operation/_test_operation_output.rs

@@ -1,1 +22,39 @@
    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 TestOperationOutput {}
           8  +
pub /* StructureGenerator.kt:201 */ struct TestOperationOutput {/* StructureGenerator.kt:201 */}
           9  +
/* ClientCodegenVisitor.kt:237 */
    6     10   
impl TestOperationOutput {
    7         -
    /// Creates a new builder-style object to manufacture [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          11  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          12  +
    /* BuilderGenerator.kt:175 */
    8     13   
    pub fn builder() -> crate::operation::test_operation::builders::TestOperationOutputBuilder {
          14  +
        /* BuilderGenerator.kt:176 */
    9     15   
        crate::operation::test_operation::builders::TestOperationOutputBuilder::default()
          16  +
        /* BuilderGenerator.kt:175 */
   10     17   
    }
          18  +
    /* ClientCodegenVisitor.kt:237 */
   11     19   
}
   12     20   
   13         -
/// A builder for [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          21  +
/// /* BuilderGenerator.kt:342 */A builder for [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          22  +
/* RustType.kt:516 */
   14     23   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          24  +
/* RustType.kt:516 */
   15     25   
#[non_exhaustive]
   16         -
pub struct TestOperationOutputBuilder {}
          26  +
/* BuilderGenerator.kt:345 */
          27  +
pub struct TestOperationOutputBuilder {/* BuilderGenerator.kt:345 */}
          28  +
/* BuilderGenerator.kt:355 */
   17     29   
impl TestOperationOutputBuilder {
   18         -
    /// Consumes the builder and constructs a [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          30  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`TestOperationOutput`](crate::operation::test_operation::TestOperationOutput).
          31  +
    /* BuilderGenerator.kt:253 */
   19     32   
    pub fn build(self) -> crate::operation::test_operation::TestOperationOutput {
   20         -
        crate::operation::test_operation::TestOperationOutput {}
          33  +
        /* BuilderGenerator.kt:477 */
          34  +
        crate::operation::test_operation::TestOperationOutput {
          35  +
        /* BuilderGenerator.kt:477 */}
          36  +
        /* BuilderGenerator.kt:253 */
   21     37   
    }
          38  +
    /* BuilderGenerator.kt:355 */
   22     39   
}

tmp-codegen-diff/codegen-client-test/endpoint-rules/rust-client-codegen/src/operation/test_operation/builders.rs

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

tmp-codegen-diff/codegen-client-test/endpoint-rules/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/endpoint-rules/rust-client-codegen/src/protocol_serde.rs

@@ -1,1 +28,30 @@
    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  +
/* AwsJson.kt:203 */
   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_test_operation;
   27     29   

tmp-codegen-diff/codegen-client-test/endpoint-rules/rust-client-codegen/src/protocol_serde/shape_test_operation.rs

@@ -1,1 +36,58 @@
    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_test_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::test_operation::TestOperationOutput, crate::operation::test_operation::TestOperationError> {
          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::test_operation::TestOperationError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::test_operation::TestOperationError::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_test_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::test_operation::TestOperationOutput, crate::operation::test_operation::TestOperationError> {
          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::test_operation::builders::TestOperationOutputBuilder::default();
          36  +
        /* ClientBuilderInstantiator.kt:56 */
   24     37   
        output.build()
          38  +
        /* ProtocolParserGenerator.kt:77 */
   25     39   
    })
          40  +
    /* ProtocolParserGenerator.kt:71 */
   26     41   
}
   27     42   
          43  +
/* JsonSerializerGenerator.kt:287 */
   28     44   
pub fn ser_test_operation_input(
   29     45   
    input: &crate::operation::test_operation::TestOperationInput,
   30     46   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          47  +
    /* JsonSerializerGenerator.kt:291 */
   31     48   
    let mut out = String::new();
          49  +
    /* JsonSerializerGenerator.kt:292 */
   32     50   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          51  +
    /* JsonSerializerGenerator.kt:375 */
   33     52   
    crate::protocol_serde::shape_test_operation_input::ser_test_operation_input_input(&mut object, input)?;
          53  +
    /* JsonSerializerGenerator.kt:295 */
   34     54   
    object.finish();
          55  +
    /* JsonSerializerGenerator.kt:296 */
   35     56   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          57  +
    /* JsonSerializerGenerator.kt:287 */
   36     58   
}

tmp-codegen-diff/codegen-client-test/endpoint-rules/rust-client-codegen/src/protocol_serde/shape_test_operation_input.rs

@@ -1,1 +10,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_test_operation_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::test_operation::TestOperationInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.bucket {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("bucket").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:372 */
    9     14   
    Ok(())
          15  +
    /* JsonSerializerGenerator.kt:358 */
   10     16   
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/client.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* FluentClientGenerator.kt:105 */
    2      3   
#[derive(Debug)]
    3      4   
pub(crate) struct Handle {
    4      5   
    pub(crate) conf: crate::Config,
    5      6   
    #[allow(dead_code)] // unused when a service does not provide any operations
    6      7   
    pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
    7      8   
}
    8      9   
    9     10   
///
   10     11   
/// An ergonomic client for Sample Json 1.0 Protocol Service.
   11     12   
///
@@ -77,78 +160,175 @@
   97     98   
    fn validate_config(handle: &Handle) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
   98     99   
        let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
   99    100   
        handle
  100    101   
            .runtime_plugins
  101    102   
            .apply_client_configuration(&mut cfg)?
  102    103   
            .validate_base_client_config(&cfg)?;
  103    104   
        Ok(())
  104    105   
    }
  105    106   
}
  106    107   
         108  +
/* RustModule.kt:172 */
  107    109   
mod content_type_parameters;
  108    110   
  109         -
/// Operation customization and supporting types.
         111  +
/// /* ClientRustModule.kt:161 */Operation customization and supporting types.
  110    112   
///
  111         -
/// The underlying HTTP requests made during an operation can be customized
         113  +
/// /* ClientRustModule.kt:170 */The underlying HTTP requests made during an operation can be customized
  112    114   
/// by calling the `customize()` method on the builder returned from a client
  113    115   
/// operation call. For example, this can be used to add an additional HTTP header:
  114    116   
///
  115    117   
/// ```ignore
  116    118   
/// # async fn wrapper() -> ::std::result::Result<(), json_rpc10::Error> {
  117    119   
/// # let client: json_rpc10::Client = unimplemented!();
  118    120   
/// use ::http::header::{HeaderName, HeaderValue};
  119    121   
///
  120    122   
/// let result = client.content_type_parameters()
  121    123   
///     .customize()
  122    124   
///     .mutate_request(|req| {
  123    125   
///         // Add `x-example-header` with value
  124    126   
///         req.headers_mut()
  125    127   
///             .insert(
  126    128   
///                 HeaderName::from_static("x-example-header"),
  127    129   
///                 HeaderValue::from_static("1"),
  128    130   
///             );
  129    131   
///     })
  130    132   
///     .send()
  131    133   
///     .await;
  132    134   
/// # }
  133    135   
/// ```
  134    136   
pub mod customize;
  135    137   
         138  +
/* RustModule.kt:172 */
  136    139   
mod empty_input_and_empty_output;
  137    140   
         141  +
/* RustModule.kt:172 */
  138    142   
mod endpoint_operation;
  139    143   
         144  +
/* RustModule.kt:172 */
  140    145   
mod endpoint_with_host_label_operation;
  141    146   
         147  +
/* RustModule.kt:172 */
  142    148   
mod greeting_with_errors;
  143    149   
         150  +
/* RustModule.kt:172 */
  144    151   
mod host_with_path_operation;
  145    152   
         153  +
/* RustModule.kt:172 */
  146    154   
mod json_unions;
  147    155   
         156  +
/* RustModule.kt:172 */
  148    157   
mod no_input_and_no_output;
  149    158   
         159  +
/* RustModule.kt:172 */
  150    160   
mod no_input_and_output;
  151    161   
         162  +
/* RustModule.kt:172 */
  152    163   
mod operation_with_defaults;
  153    164   
         165  +
/* RustModule.kt:172 */
  154    166   
mod operation_with_nested_structure;
  155    167   
         168  +
/* RustModule.kt:172 */
  156    169   
mod operation_with_required_members;
  157    170   
         171  +
/* RustModule.kt:172 */
  158    172   
mod put_with_content_encoding;
  159    173   
         174  +
/* RustModule.kt:172 */
  160    175   
mod simple_scalar_properties;