Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/query-compat-test/rust-client-codegen/src/config/endpoint.rs

@@ -1,1 +86,107 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ClientRuntimeTypesReExportGenerator.kt:38 */
    2      3   
pub use ::aws_smithy_runtime_api::client::endpoint::EndpointFuture;
    3      4   
pub use ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver;
    4      5   
pub use ::aws_smithy_types::endpoint::Endpoint;
    5      6   
           7  +
/* RustType.kt:516 */
    6      8   
#[cfg(test)]
    7         -
mod test {}
           9  +
/* EndpointsDecorator.kt:175 */
          10  +
mod test {
    8     11   
          12  +
    /* EndpointsDecorator.kt:175 */
          13  +
}
          14  +
          15  +
/* EndpointResolverGenerator.kt:416 */
    9     16   
/// Endpoint resolver trait specific to this service
   10     17   
pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug {
   11     18   
    /// Resolve an endpoint with the given parameters
   12     19   
    fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>;
   13     20   
   14     21   
    /// Convert this service-specific resolver into a `SharedEndpointResolver`
   15     22   
    ///
   16     23   
    /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`.
   17     24   
    fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver
   18     25   
    where
   19     26   
        Self: Sized + 'static,
   20     27   
    {
   21     28   
        ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self))
   22     29   
    }
   23     30   
}
   24     31   
   25     32   
#[derive(Debug)]
   26     33   
struct DowncastParams<T>(T);
   27     34   
impl<T> ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams<T>
   28     35   
where
   29     36   
    T: ResolveEndpoint,
   30     37   
{
   31     38   
    fn resolve_endpoint<'a>(
   32     39   
        &'a self,
   33     40   
        params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams,
   34     41   
    ) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> {
   35     42   
        let ep = match params.get::<crate::config::endpoint::Params>() {
   36     43   
            Some(params) => self.0.resolve_endpoint(params),
   37     44   
            None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())),
   38     45   
        };
   39     46   
        ep
   40     47   
    }
   41     48   
}
   42     49   
          50  +
/* RustType.kt:516 */
   43     51   
#[non_exhaustive]
          52  +
/* RustType.kt:516 */
   44     53   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
   45         -
/// Configuration parameters for resolving the correct endpoint
   46         -
pub struct Params {}
          54  +
/// /* EndpointParamsGenerator.kt:178 */Configuration parameters for resolving the correct endpoint
          55  +
/* EndpointParamsGenerator.kt:179 */
          56  +
pub struct Params {/* EndpointParamsGenerator.kt:179 */}
          57  +
/* EndpointParamsGenerator.kt:188 */
   47     58   
impl Params {
          59  +
    /* EndpointParamsGenerator.kt:189 */
   48     60   
    /// Create a builder for [`Params`]
   49     61   
    pub fn builder() -> crate::config::endpoint::ParamsBuilder {
   50     62   
        crate::config::endpoint::ParamsBuilder::default()
   51     63   
    }
          64  +
    /* EndpointParamsGenerator.kt:188 */
   52     65   
}
   53     66   
   54         -
/// Builder for [`Params`]
          67  +
/// /* EndpointParamsGenerator.kt:234 */Builder for [`Params`]
          68  +
/* RustType.kt:516 */
   55     69   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   56         -
pub struct ParamsBuilder {}
          70  +
/* EndpointParamsGenerator.kt:238 */
          71  +
pub struct ParamsBuilder {/* EndpointParamsGenerator.kt:238 */}
          72  +
/* EndpointParamsGenerator.kt:246 */
   57     73   
impl ParamsBuilder {
   58         -
    /// Consume this builder, creating [`Params`].
          74  +
    /// /* EndpointParamsGenerator.kt:247 */Consume this builder, creating [`Params`].
          75  +
    /* EndpointParamsGenerator.kt:248 */
   59     76   
    pub fn build(self) -> ::std::result::Result<crate::config::endpoint::Params, crate::config::endpoint::InvalidParams> {
          77  +
        /* EndpointParamsGenerator.kt:272 */
   60     78   
        Ok(
   61     79   
            #[allow(clippy::unnecessary_lazy_evaluations)]
   62     80   
            crate::config::endpoint::Params {},
   63     81   
        )
          82  +
        /* EndpointParamsGenerator.kt:248 */
   64     83   
    }
          84  +
    /* EndpointParamsGenerator.kt:246 */
   65     85   
}
   66     86   
          87  +
/* EndpointParamsGenerator.kt:139 */
   67     88   
/// An error that occurred during endpoint resolution
   68     89   
#[derive(Debug)]
   69     90   
pub struct InvalidParams {
   70     91   
    field: std::borrow::Cow<'static, str>,
   71     92   
}
   72     93   
   73     94   
impl InvalidParams {
   74     95   
    #[allow(dead_code)]
   75     96   
    fn missing(field: &'static str) -> Self {
   76     97   
        Self { field: field.into() }

tmp-codegen-diff/codegen-client-test/query-compat-test/rust-client-codegen/src/config/http.rs

@@ -1,1 +3,4 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ClientRuntimeTypesReExportGenerator.kt:60 */
    2      3   
pub use ::aws_smithy_runtime_api::client::orchestrator::HttpRequest;
    3      4   
pub use ::aws_smithy_runtime_api::client::orchestrator::HttpResponse;

tmp-codegen-diff/codegen-client-test/query-compat-test/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/query-compat-test/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/query-compat-test/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/query-compat-test/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/query-compat-test/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/query-compat-test/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::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/query-compat-test/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 = query_compat_test::Config::builder()
   72     75   
///     .endpoint_url("http://localhost:1234")
   73     76   
///     .build();
   74     77   
/// let client = query_compat_test::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 aws_query_compatible_errors;
  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/query-compat-test/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/query-compat-test/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/query-compat-test/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 +364,440 @@
   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   
            "QueryCompatService",
  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, "/").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/x-amz-json-1.0");
  182    195   
            builder = _header_serialization_settings.set_default_header(
  183    196   
                builder,
  184    197   
                ::http::header::HeaderName::from_static("x-amz-target"),
  185    198   
                "QueryCompatService.Operation",
  186    199   
            );
  187    200   
            builder =
  188    201   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("x-amzn-query-mode"), "true");
  189    202   
            builder
  190    203   
        };
  191    204   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
  192    205   
        if let Some(content_length) = body.content_length() {
  193    206   
            let content_length = content_length.to_string();
  194    207   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  195    208   
        }
  196    209   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  197    210   
    }
  198    211   
}
         212  +
/* EndpointParamsInterceptorGenerator.kt:86 */
  199    213   
#[derive(Debug)]
  200    214   
struct OperationEndpointParamsInterceptor;
  201    215   
  202    216   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationEndpointParamsInterceptor {
  203    217   
    fn name(&self) -> &'static str {
  204    218   
        "OperationEndpointParamsInterceptor"
  205    219   
    }
  206    220   
  207    221   
    fn read_before_execution(
  208    222   
        &self,
  209    223   
        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
  210    224   
            '_,
  211    225   
            ::aws_smithy_runtime_api::client::interceptors::context::Input,
  212    226   
            ::aws_smithy_runtime_api::client::interceptors::context::Output,
  213    227   
            ::aws_smithy_runtime_api::client::interceptors::context::Error,
  214    228   
        >,
  215    229   
        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  216    230   
    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
  217    231   
        let _input = context
  218    232   
            .input()
  219    233   
            .downcast_ref::<OperationInput>()
  220    234   
            .ok_or("failed to downcast to OperationInput")?;
  221    235   
  222    236   
        let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
  223    237   
            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
  224    238   
        })?;
  225    239   
        cfg.interceptor_state()
  226    240   
            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
  227    241   
        ::std::result::Result::Ok(())
  228    242   
    }
  229    243   
}
  230    244   
  231    245   
// The get_* functions below are generated from JMESPath expressions in the
  232    246   
// operationContextParams trait. They target the operation's input shape.
  233    247   
         248  +
/* RustType.kt:516 */
  234    249   
#[allow(unreachable_code, unused_variables)]
         250  +
/* RustType.kt:516 */
  235    251   
#[cfg(test)]
         252  +
/* ProtocolTestGenerator.kt:98 */
  236    253   
mod operation_test {
  237    254   
  238    255   
    /// Test ID: BasicQueryCompatTest
  239    256   
    #[::tokio::test]
  240    257   
    #[::tracing_test::traced_test]
  241    258   
    async fn basic_query_compat_test_request() {
  242    259   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  243    260   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  244    261   
  245    262   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  246    263   
        let result = client
  247    264   
            .operation()
  248    265   
            .set_message(::std::option::Option::Some("hello!".to_owned()))
  249    266   
            .send()
  250    267   
            .await;
  251    268   
        let _ = dbg!(result);
  252    269   
        let http_request = request_receiver.expect_request();
  253    270   
        let expected_headers = [("x-amz-target", "QueryCompatService.Operation"), ("x-amzn-query-mode", "true")];
  254    271   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  255    272   
        let body = http_request.body().bytes().expect("body should be strict");
  256    273   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  257    274   
            body,
  258    275   
            "{\"message\":\"hello!\"}",
  259    276   
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  260    277   
        ));
  261    278   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  262    279   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  263    280   
        ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
  264    281   
    }
         282  +
         283  +
    /* ProtocolTestGenerator.kt:98 */
  265    284   
}
  266    285   
         286  +
/* OperationErrorGenerator.kt:79 */
  267    287   
/// Error type for the `OperationError` operation.
         288  +
/* RustType.kt:516 */
  268    289   
#[non_exhaustive]
         290  +
/* RustType.kt:516 */
  269    291   
#[derive(::std::fmt::Debug)]
  270         -
pub enum OperationError {
         292  +
pub /* OperationErrorGenerator.kt:81 */ enum OperationError {
         293  +
    /* OperationErrorGenerator.kt:88 */
  271    294   
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
  272    295   
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
  273    296   
    variable wildcard pattern and check `.code()`:
  274    297   
     \
  275    298   
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
  276    299   
     \
  277    300   
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OperationError) for what information is available for the error.")]
  278    301   
    Unhandled(crate::error::sealed_unhandled::Unhandled),
         302  +
    /* OperationErrorGenerator.kt:81 */
  279    303   
}
         304  +
/* OperationErrorGenerator.kt:218 */
  280    305   
impl OperationError {
         306  +
    /* OperationErrorGenerator.kt:219 */
  281    307   
    /// Creates the `OperationError::Unhandled` variant from any error type.
  282    308   
    pub fn unhandled(
  283    309   
        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
  284    310   
    ) -> Self {
  285    311   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  286    312   
            source: err.into(),
  287    313   
            meta: ::std::default::Default::default(),
  288    314   
        })
  289    315   
    }
  290    316   
  291    317   
    /// Creates the `OperationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
  292    318   
    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
  293    319   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  294    320   
            source: err.clone().into(),
  295    321   
            meta: err,
  296    322   
        })
  297    323   
    }
  298         -
    ///
         324  +
    /// /* OperationErrorGenerator.kt:236 */
  299    325   
    /// Returns error metadata, which includes the error code, message,
  300    326   
    /// request ID, and potentially additional information.
  301    327   
    ///
         328  +
    /* OperationErrorGenerator.kt:242 */
  302    329   
    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         330  +
        /* OperationErrorGenerator.kt:243 */
  303    331   
        match self {
  304         -
            Self::Unhandled(e) => &e.meta,
         332  +
            /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
         333  +
            /* OperationErrorGenerator.kt:243 */
  305    334   
        }
         335  +
        /* OperationErrorGenerator.kt:242 */
  306    336   
    }
         337  +
    /* OperationErrorGenerator.kt:218 */
  307    338   
}
         339  +
/* OperationErrorGenerator.kt:269 */
  308    340   
impl ::std::error::Error for OperationError {
         341  +
    /* OperationErrorGenerator.kt:270 */
  309    342   
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         343  +
        /* OperationErrorGenerator.kt:318 */
  310    344   
        match self {
  311         -
            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
         345  +
            /* OperationErrorGenerator.kt:326 */
         346  +
            Self::Unhandled(_inner) => {
         347  +
                /* OperationErrorGenerator.kt:279 */
         348  +
                ::std::option::Option::Some(&*_inner.source)
         349  +
                /* OperationErrorGenerator.kt:326 */
         350  +
            } /* OperationErrorGenerator.kt:318 */
  312    351   
        }
         352  +
        /* OperationErrorGenerator.kt:270 */
  313    353   
    }
         354  +
    /* OperationErrorGenerator.kt:269 */
  314    355   
}
         356  +
/* OperationErrorGenerator.kt:133 */
  315    357   
impl ::std::fmt::Display for OperationError {
         358  +
    /* OperationErrorGenerator.kt:134 */
  316    359   
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         360  +
        /* OperationErrorGenerator.kt:318 */
  317    361   
        match self {
         362  +
            /* OperationErrorGenerator.kt:326 */
  318    363   
            Self::Unhandled(_inner) => {
         364  +
                /* OperationErrorGenerator.kt:139 */
  319    365   
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
  320    366   
                    write!(f, "unhandled error ({code})")
  321    367   
                } else {
  322    368   
                    f.write_str("unhandled error")
  323    369   
                }
         370  +
                /* OperationErrorGenerator.kt:326 */
         371  +
            } /* OperationErrorGenerator.kt:318 */
  324    372   
        }
         373  +
        /* OperationErrorGenerator.kt:134 */
  325    374   
    }
  326         -
    }
         375  +
    /* OperationErrorGenerator.kt:133 */
  327    376   
}
         377  +
/* OperationErrorGenerator.kt:182 */
  328    378   
impl ::aws_smithy_types::retry::ProvideErrorKind for OperationError {
         379  +
    /* OperationErrorGenerator.kt:186 */
  329    380   
    fn code(&self) -> ::std::option::Option<&str> {
         381  +
        /* OperationErrorGenerator.kt:187 */
  330    382   
        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
         383  +
        /* OperationErrorGenerator.kt:186 */
  331    384   
    }
         385  +
    /* OperationErrorGenerator.kt:190 */
  332    386   
    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
         387  +
        /* OperationErrorGenerator.kt:197 */
  333    388   
        ::std::option::Option::None
         389  +
        /* OperationErrorGenerator.kt:190 */
  334    390   
    }
         391  +
    /* OperationErrorGenerator.kt:182 */
  335    392   
}
         393  +
/* OperationErrorGenerator.kt:163 */
  336    394   
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OperationError {
         395  +
    /* OperationErrorGenerator.kt:164 */
  337    396   
    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
         397  +
        /* OperationErrorGenerator.kt:318 */
  338    398   
        match self {
  339         -
            Self::Unhandled(_inner) => &_inner.meta,
         399  +
            /* OperationErrorGenerator.kt:326 */
         400  +
            Self::Unhandled(_inner) => {
         401  +
                /* OperationErrorGenerator.kt:168 */
         402  +
                &_inner.meta
         403  +
                /* OperationErrorGenerator.kt:326 */
         404  +
            } /* OperationErrorGenerator.kt:318 */
  340    405   
        }
         406  +
        /* OperationErrorGenerator.kt:164 */
  341    407   
    }
         408  +
    /* OperationErrorGenerator.kt:163 */
  342    409   
}
         410  +
/* OperationErrorGenerator.kt:109 */
  343    411   
impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OperationError {
         412  +
    /* OperationErrorGenerator.kt:110 */
  344    413   
    fn create_unhandled_error(
  345    414   
        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
  346    415   
        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
  347    416   
    ) -> Self {
         417  +
        /* OperationErrorGenerator.kt:121 */
  348    418   
        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
  349    419   
            source,
  350    420   
            meta: meta.unwrap_or_default(),
  351    421   
        })
         422  +
        /* OperationErrorGenerator.kt:110 */
  352    423   
    }
         424  +
    /* OperationErrorGenerator.kt:109 */
  353    425   
}
  354    426   
         427  +
/* CodegenDelegator.kt:255 */
  355    428   
pub use crate::operation::operation::_operation_output::OperationOutput;
  356    429   
         430  +
/* CodegenDelegator.kt:255 */
  357    431   
pub use crate::operation::operation::_operation_input::OperationInput;
  358    432   
         433  +
/* RustModule.kt:172 */
  359    434   
mod _operation_input;
  360    435   
         436  +
/* RustModule.kt:172 */
  361    437   
mod _operation_output;
  362    438   
  363         -
/// Builders
         439  +
/// /* CodegenDelegator.kt:51 */Builders
  364    440   
pub mod builders;

tmp-codegen-diff/codegen-client-test/query-compat-test/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/query-compat-test/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 */
   46     84   
        }
          85  +
        /* BuilderGenerator.kt:253 */
          86  +
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

tmp-codegen-diff/codegen-client-test/query-compat-test/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/query-compat-test/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;