Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/lib.rs

@@ -0,1 +0,311 @@
           1  +
#![allow(deprecated)]
           2  +
#![allow(unknown_lints)]
           3  +
#![allow(clippy::module_inception)]
           4  +
#![allow(clippy::upper_case_acronyms)]
           5  +
#![allow(clippy::large_enum_variant)]
           6  +
#![allow(clippy::wrong_self_convention)]
           7  +
#![allow(clippy::should_implement_trait)]
           8  +
#![allow(clippy::disallowed_names)]
           9  +
#![allow(clippy::vec_init_then_push)]
          10  +
#![allow(clippy::type_complexity)]
          11  +
#![allow(clippy::needless_return)]
          12  +
#![allow(clippy::derive_partial_eq_without_eq)]
          13  +
#![allow(clippy::result_large_err)]
          14  +
#![allow(clippy::unnecessary_map_on_constructor)]
          15  +
#![allow(clippy::deprecated_semver)]
          16  +
#![allow(clippy::uninlined_format_args)]
          17  +
#![allow(rustdoc::bare_urls)]
          18  +
#![allow(rustdoc::redundant_explicit_links)]
          19  +
#![allow(rustdoc::invalid_html_tags)]
          20  +
#![forbid(unsafe_code)]
          21  +
#![cfg_attr(docsrs, feature(doc_cfg))]
          22  +
//! rpcv2cbor-http0x
          23  +
          24  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
          25  +
//! A fast and customizable Rust implementation of the RpcV2Protocol Smithy service.
          26  +
//!
          27  +
//! # Using RpcV2Protocol
          28  +
//!
          29  +
//! The primary entrypoint is [`RpcV2Protocol`]: it satisfies the [`Service<http::Request, Response = http::Response>`](::tower::Service)
          30  +
//! trait and therefore can be handed to a [`hyper` server](https://github.com/hyperium/hyper) via [`RpcV2Protocol::into_make_service`]
          31  +
//! or used in AWS Lambda
          32  +
#![cfg_attr(
          33  +
    feature = "aws-lambda",
          34  +
    doc = " via [`LambdaHandler`](crate::server::routing::LambdaHandler)."
          35  +
)]
          36  +
#![cfg_attr(
          37  +
    not(feature = "aws-lambda"),
          38  +
    doc = " by enabling the `aws-lambda` feature flag and utilizing the `LambdaHandler`."
          39  +
)]
          40  +
//! The [`crate::input`], [`crate::output`], and [`crate::error`]
          41  +
//! modules provide the types used in each operation.
          42  +
//!
          43  +
//! ### Running on Hyper
          44  +
//!
          45  +
//! ```rust,no_run
          46  +
//! # use std::net::SocketAddr;
          47  +
//! # async fn dummy() {
          48  +
//! use rpcv2cbor_http0x::{RpcV2Protocol, RpcV2ProtocolConfig};
          49  +
//!
          50  +
//! # let app = RpcV2Protocol::builder(
          51  +
//! #     RpcV2ProtocolConfig::builder()
          52  +
//! #         .build()
          53  +
//! # ).build_unchecked();
          54  +
//! let server = app.into_make_service();
          55  +
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
          56  +
//!     .expect("unable to parse the server bind address and port");
          57  +
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
          58  +
//! # }
          59  +
//!
          60  +
//! ```
          61  +
//!
          62  +
//! ### Running on Lambda
          63  +
//!
          64  +
//! ```rust,ignore
          65  +
//! use rpcv2cbor_http0x::server::routing::LambdaHandler;
          66  +
//! use rpcv2cbor_http0x::RpcV2Protocol;
          67  +
//!
          68  +
//! # async fn dummy() {
          69  +
//! # let app = RpcV2Protocol::builder(
          70  +
//! #     RpcV2ProtocolConfig::builder()
          71  +
//! #         .build()
          72  +
//! # ).build_unchecked();
          73  +
//! let handler = LambdaHandler::new(app);
          74  +
//! lambda_http::run(handler).await.unwrap();
          75  +
//! # }
          76  +
//! ```
          77  +
//!
          78  +
//! # Building the RpcV2Protocol
          79  +
//!
          80  +
//! To construct [`RpcV2Protocol`] we use [`RpcV2ProtocolBuilder`] returned by [`RpcV2Protocol::builder`].
          81  +
//!
          82  +
//! ## Plugins
          83  +
//!
          84  +
//! The [`RpcV2Protocol::builder`] method, returning [`RpcV2ProtocolBuilder`],
          85  +
//! accepts a config object on which plugins can be registered.
          86  +
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
          87  +
//!
          88  +
//! ```rust,no_run
          89  +
//! # use rpcv2cbor_http0x::server::plugin::IdentityPlugin as LoggingPlugin;
          90  +
//! # use rpcv2cbor_http0x::server::plugin::IdentityPlugin as MetricsPlugin;
          91  +
//! # use ::hyper::Body;
          92  +
//! use rpcv2cbor_http0x::server::plugin::HttpPlugins;
          93  +
//! use rpcv2cbor_http0x::{RpcV2Protocol, RpcV2ProtocolConfig, RpcV2ProtocolBuilder};
          94  +
//!
          95  +
//! let http_plugins = HttpPlugins::new()
          96  +
//!         .push(LoggingPlugin)
          97  +
//!         .push(MetricsPlugin);
          98  +
//! let config = RpcV2ProtocolConfig::builder().build();
          99  +
//! let builder: RpcV2ProtocolBuilder<::hyper::Body, _, _, _> = RpcV2Protocol::builder(config);
         100  +
//! ```
         101  +
//!
         102  +
//! Check out [`crate::server::plugin`] to learn more about plugins.
         103  +
//!
         104  +
//! ## Handlers
         105  +
//!
         106  +
//! [`RpcV2ProtocolBuilder`] provides a setter method for each operation in your Smithy model. The setter methods expect an async function as input, matching the signature for the corresponding operation in your Smithy model.
         107  +
//! We call these async functions **handlers**. This is where your application business logic lives.
         108  +
//!
         109  +
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
         110  +
//!
         111  +
//! * A `Result<Output, Error>` if your operation has modeled errors, or
         112  +
//! * An `Output` otherwise.
         113  +
//!
         114  +
//! ```rust,no_run
         115  +
//! # struct Input;
         116  +
//! # struct Output;
         117  +
//! # struct Error;
         118  +
//! async fn infallible_handler(input: Input) -> Output { todo!() }
         119  +
//!
         120  +
//! async fn fallible_handler(input: Input) -> Result<Output, Error> { todo!() }
         121  +
//! ```
         122  +
//!
         123  +
//! Handlers can accept up to 8 extractors:
         124  +
//!
         125  +
//! ```rust,no_run
         126  +
//! # struct Input;
         127  +
//! # struct Output;
         128  +
//! # struct Error;
         129  +
//! # struct State;
         130  +
//! # use std::net::SocketAddr;
         131  +
//! use rpcv2cbor_http0x::server::request::{extension::Extension, connect_info::ConnectInfo};
         132  +
//!
         133  +
//! async fn handler_with_no_extensions(input: Input) -> Output {
         134  +
//!     todo!()
         135  +
//! }
         136  +
//!
         137  +
//! async fn handler_with_one_extractor(input: Input, ext: Extension<State>) -> Output {
         138  +
//!     todo!()
         139  +
//! }
         140  +
//!
         141  +
//! async fn handler_with_two_extractors(
         142  +
//!     input: Input,
         143  +
//!     ext0: Extension<State>,
         144  +
//!     ext1: ConnectInfo<SocketAddr>,
         145  +
//! ) -> Output {
         146  +
//!     todo!()
         147  +
//! }
         148  +
//! ```
         149  +
//!
         150  +
//! See the [`operation module`](crate::operation) for information on precisely what constitutes a handler.
         151  +
//!
         152  +
//! ## Build
         153  +
//!
         154  +
//! You can convert [`RpcV2ProtocolBuilder`] into [`RpcV2Protocol`] using either [`RpcV2ProtocolBuilder::build`] or [`RpcV2ProtocolBuilder::build_unchecked`].
         155  +
//!
         156  +
//! [`RpcV2ProtocolBuilder::build`] requires you to provide a handler for every single operation in your Smithy model. It will return an error if that is not the case.
         157  +
//!
         158  +
//! [`RpcV2ProtocolBuilder::build_unchecked`], instead, does not require exhaustiveness. The server will automatically return 500 Internal Server Error to all requests for operations that do not have a registered handler.
         159  +
//! [`RpcV2ProtocolBuilder::build_unchecked`] is particularly useful if you are deploying your Smithy service as a collection of Lambda functions, where each Lambda is only responsible for a subset of the operations in the Smithy service (or even a single one!).
         160  +
//!
         161  +
//! # Example
         162  +
//!
         163  +
//! ```rust,no_run
         164  +
//! # use std::net::SocketAddr;
         165  +
//! use rpcv2cbor_http0x::{RpcV2Protocol, RpcV2ProtocolConfig};
         166  +
//!
         167  +
//! #[::tokio::main]
         168  +
//! pub async fn main() {
         169  +
//!    let config = RpcV2ProtocolConfig::builder().build();
         170  +
//!    let app = RpcV2Protocol::builder(config)
         171  +
//!        .empty_input_output(empty_input_output)
         172  +
//!        .float16(float16)
         173  +
//!        .fractional_seconds(fractional_seconds)
         174  +
//!        .greeting_with_errors(greeting_with_errors)
         175  +
//!        .no_input_output(no_input_output)
         176  +
//!        .operation_with_defaults(operation_with_defaults)
         177  +
//!        .optional_input_output(optional_input_output)
         178  +
//!        .recursive_shapes(recursive_shapes)
         179  +
//!        .rpc_v2_cbor_dense_maps(rpc_v2_cbor_dense_maps)
         180  +
//!        .rpc_v2_cbor_lists(rpc_v2_cbor_lists)
         181  +
//!        .rpc_v2_cbor_sparse_maps(rpc_v2_cbor_sparse_maps)
         182  +
//!        .simple_scalar_properties(simple_scalar_properties)
         183  +
//!        .sparse_nulls_operation(sparse_nulls_operation)
         184  +
//!        .build()
         185  +
//!        .expect("failed to build an instance of RpcV2Protocol");
         186  +
//!
         187  +
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
         188  +
//!        .expect("unable to parse the server bind address and port");
         189  +
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
         190  +
//!    # let server = async { Ok::<_, ()>(()) };
         191  +
//!
         192  +
//!    // Run your service!
         193  +
//!    if let Err(err) = server.await {
         194  +
//!        eprintln!("server error: {:?}", err);
         195  +
//!    }
         196  +
//! }
         197  +
//!
         198  +
//! use rpcv2cbor_http0x::{input, output, error};
         199  +
//!
         200  +
//! async fn empty_input_output(input: input::EmptyInputOutputInput) -> output::EmptyInputOutputOutput {
         201  +
//!     todo!()
         202  +
//! }
         203  +
//!
         204  +
//! async fn float16(input: input::Float16Input) -> output::Float16Output {
         205  +
//!     todo!()
         206  +
//! }
         207  +
//!
         208  +
//! async fn fractional_seconds(input: input::FractionalSecondsInput) -> output::FractionalSecondsOutput {
         209  +
//!     todo!()
         210  +
//! }
         211  +
//!
         212  +
//! async fn greeting_with_errors(input: input::GreetingWithErrorsInput) -> Result<output::GreetingWithErrorsOutput, error::GreetingWithErrorsError> {
         213  +
//!     todo!()
         214  +
//! }
         215  +
//!
         216  +
//! async fn no_input_output(input: input::NoInputOutputInput) -> output::NoInputOutputOutput {
         217  +
//!     todo!()
         218  +
//! }
         219  +
//!
         220  +
//! async fn operation_with_defaults(input: input::OperationWithDefaultsInput) -> Result<output::OperationWithDefaultsOutput, error::OperationWithDefaultsError> {
         221  +
//!     todo!()
         222  +
//! }
         223  +
//!
         224  +
//! async fn optional_input_output(input: input::OptionalInputOutputInput) -> output::OptionalInputOutputOutput {
         225  +
//!     todo!()
         226  +
//! }
         227  +
//!
         228  +
//! async fn recursive_shapes(input: input::RecursiveShapesInput) -> output::RecursiveShapesOutput {
         229  +
//!     todo!()
         230  +
//! }
         231  +
//!
         232  +
//! async fn rpc_v2_cbor_dense_maps(input: input::RpcV2CborDenseMapsInput) -> Result<output::RpcV2CborDenseMapsOutput, error::RpcV2CborDenseMapsError> {
         233  +
//!     todo!()
         234  +
//! }
         235  +
//!
         236  +
//! async fn rpc_v2_cbor_lists(input: input::RpcV2CborListsInput) -> Result<output::RpcV2CborListsOutput, error::RpcV2CborListsError> {
         237  +
//!     todo!()
         238  +
//! }
         239  +
//!
         240  +
//! async fn rpc_v2_cbor_sparse_maps(input: input::RpcV2CborSparseMapsInput) -> Result<output::RpcV2CborSparseMapsOutput, error::RpcV2CborSparseMapsError> {
         241  +
//!     todo!()
         242  +
//! }
         243  +
//!
         244  +
//! async fn simple_scalar_properties(input: input::SimpleScalarPropertiesInput) -> output::SimpleScalarPropertiesOutput {
         245  +
//!     todo!()
         246  +
//! }
         247  +
//!
         248  +
//! async fn sparse_nulls_operation(input: input::SparseNullsOperationInput) -> output::SparseNullsOperationOutput {
         249  +
//!     todo!()
         250  +
//! }
         251  +
//!
         252  +
//! ```
         253  +
//!
         254  +
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         255  +
//! [hyper server]: https://docs.rs/hyper/0.14.26/hyper/server/index.html
         256  +
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
         257  +
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
         258  +
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
         259  +
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         260  +
pub use crate::service::{
         261  +
    MissingOperationsError, RpcV2Protocol, RpcV2ProtocolBuilder, RpcV2ProtocolConfig,
         262  +
    RpcV2ProtocolConfigBuilder,
         263  +
};
         264  +
         265  +
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
         266  +
pub mod server {
         267  +
    // Re-export all types from the `aws-smithy-http-server` crate.
         268  +
    pub use ::aws_smithy_legacy_http_server::*;
         269  +
}
         270  +
         271  +
/// Crate version number.
         272  +
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
         273  +
         274  +
/// Constrained types for constrained shapes.
         275  +
mod constrained;
         276  +
         277  +
/// All error types that operations can return. Documentation on these types is copied from the model.
         278  +
pub mod error;
         279  +
         280  +
/// Input structures for operations. Documentation on these types is copied from the model.
         281  +
pub mod input;
         282  +
         283  +
/// Data structures used by operation inputs/outputs. Documentation on these types is copied from the model.
         284  +
pub mod model;
         285  +
         286  +
/// All operations that this crate can perform.
         287  +
pub mod operation;
         288  +
         289  +
/// A collection of types representing each operation defined in the service closure.
         290  +
///
         291  +
/// The [plugin system](::aws_smithy_legacy_http_server::plugin) makes use of these
         292  +
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
         293  +
/// parameterize [`Plugin`](::aws_smithy_legacy_http_server::plugin::Plugin) implementations. Their traits, such as
         294  +
/// [`OperationShape`](::aws_smithy_legacy_http_server::operation::OperationShape), can be used to provide
         295  +
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
         296  +
pub mod operation_shape;
         297  +
         298  +
/// Output structures for operations. Documentation on these types is copied from the model.
         299  +
pub mod output;
         300  +
         301  +
mod service;
         302  +
         303  +
/// Data primitives referenced by other data types.
         304  +
pub mod types;
         305  +
         306  +
/// Unconstrained types for constrained shapes.
         307  +
mod unconstrained;
         308  +
         309  +
mod mimes;
         310  +
         311  +
pub(crate) mod protocol_serde;

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/mimes.rs

@@ -0,1 +0,7 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) static CONTENT_TYPE_APPLICATION_CBOR: std::sync::LazyLock<::mime::Mime> =
           3  +
    std::sync::LazyLock::new(|| {
           4  +
        "application/cbor"
           5  +
            .parse::<::mime::Mime>()
           6  +
            .expect("BUG: MIME parsing failed, content_type is not valid")
           7  +
    });

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/model.rs

@@ -0,1 +0,1546 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// Describes one specific validation failure for an input member.
           4  +
#[derive(
           5  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           6  +
)]
           7  +
pub struct ValidationExceptionField {
           8  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
           9  +
    pub path: ::std::string::String,
          10  +
    /// A detailed description of the validation failure.
          11  +
    pub message: ::std::string::String,
          12  +
}
          13  +
impl ValidationExceptionField {
          14  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          15  +
    pub fn path(&self) -> &str {
          16  +
        use std::ops::Deref;
          17  +
        self.path.deref()
          18  +
    }
          19  +
    /// A detailed description of the validation failure.
          20  +
    pub fn message(&self) -> &str {
          21  +
        use std::ops::Deref;
          22  +
        self.message.deref()
          23  +
    }
          24  +
}
          25  +
impl ValidationExceptionField {
          26  +
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
          27  +
    pub fn builder() -> crate::model::validation_exception_field::Builder {
          28  +
        crate::model::validation_exception_field::Builder::default()
          29  +
    }
          30  +
}
          31  +
          32  +
#[allow(missing_docs)] // documentation missing in model
          33  +
#[derive(
          34  +
    ::std::clone::Clone,
          35  +
    ::std::cmp::Eq,
          36  +
    ::std::cmp::Ord,
          37  +
    ::std::cmp::PartialEq,
          38  +
    ::std::cmp::PartialOrd,
          39  +
    ::std::fmt::Debug,
          40  +
    ::std::hash::Hash,
          41  +
)]
          42  +
pub enum TestEnum {
          43  +
    #[allow(missing_docs)] // documentation missing in model
          44  +
    Bar,
          45  +
    #[allow(missing_docs)] // documentation missing in model
          46  +
    Baz,
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    Foo,
          49  +
}
          50  +
/// See [`TestEnum`](crate::model::TestEnum).
          51  +
pub mod test_enum {
          52  +
    #[derive(Debug, PartialEq)]
          53  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
          54  +
          55  +
    impl ::std::fmt::Display for ConstraintViolation {
          56  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          57  +
            write!(
          58  +
                f,
          59  +
                r#"Value provided for 'smithy.protocoltests.rpcv2Cbor#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
          60  +
            )
          61  +
        }
          62  +
    }
          63  +
          64  +
    impl ::std::error::Error for ConstraintViolation {}
          65  +
    impl ConstraintViolation {
          66  +
        pub(crate) fn as_validation_exception_field(
          67  +
            self,
          68  +
            path: ::std::string::String,
          69  +
        ) -> crate::model::ValidationExceptionField {
          70  +
            crate::model::ValidationExceptionField {
          71  +
                message: format!(
          72  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
          73  +
                    &path
          74  +
                ),
          75  +
                path,
          76  +
            }
          77  +
        }
          78  +
    }
          79  +
}
          80  +
impl ::std::convert::TryFrom<&str> for TestEnum {
          81  +
    type Error = crate::model::test_enum::ConstraintViolation;
          82  +
    fn try_from(
          83  +
        s: &str,
          84  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
          85  +
        match s {
          86  +
            "BAR" => Ok(TestEnum::Bar),
          87  +
            "BAZ" => Ok(TestEnum::Baz),
          88  +
            "FOO" => Ok(TestEnum::Foo),
          89  +
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
          90  +
        }
          91  +
    }
          92  +
}
          93  +
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
          94  +
    type Error = crate::model::test_enum::ConstraintViolation;
          95  +
    fn try_from(
          96  +
        s: ::std::string::String,
          97  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
          98  +
    {
          99  +
        s.as_str().try_into()
         100  +
    }
         101  +
}
         102  +
impl std::str::FromStr for TestEnum {
         103  +
    type Err = crate::model::test_enum::ConstraintViolation;
         104  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         105  +
        Self::try_from(s)
         106  +
    }
         107  +
}
         108  +
impl TestEnum {
         109  +
    /// Returns the `&str` value of the enum member.
         110  +
    pub fn as_str(&self) -> &str {
         111  +
        match self {
         112  +
            TestEnum::Bar => "BAR",
         113  +
            TestEnum::Baz => "BAZ",
         114  +
            TestEnum::Foo => "FOO",
         115  +
        }
         116  +
    }
         117  +
    /// Returns all the `&str` representations of the enum members.
         118  +
    pub const fn values() -> &'static [&'static str] {
         119  +
        &["BAR", "BAZ", "FOO"]
         120  +
    }
         121  +
}
         122  +
impl ::std::convert::AsRef<str> for TestEnum {
         123  +
    fn as_ref(&self) -> &str {
         124  +
        self.as_str()
         125  +
    }
         126  +
}
         127  +
impl crate::constrained::Constrained for TestEnum {
         128  +
    type Unconstrained = ::std::string::String;
         129  +
}
         130  +
         131  +
impl ::std::convert::From<::std::string::String>
         132  +
    for crate::constrained::MaybeConstrained<crate::model::TestEnum>
         133  +
{
         134  +
    fn from(value: ::std::string::String) -> Self {
         135  +
        Self::Unconstrained(value)
         136  +
    }
         137  +
}
         138  +
         139  +
#[allow(missing_docs)] // documentation missing in model
         140  +
#[derive(
         141  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         142  +
)]
         143  +
pub struct ClientOptionalDefaults {
         144  +
    #[allow(missing_docs)] // documentation missing in model
         145  +
    pub member: i32,
         146  +
}
         147  +
impl ClientOptionalDefaults {
         148  +
    #[allow(missing_docs)] // documentation missing in model
         149  +
    pub fn member(&self) -> i32 {
         150  +
        self.member
         151  +
    }
         152  +
}
         153  +
impl ClientOptionalDefaults {
         154  +
    /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         155  +
    pub fn builder() -> crate::model::client_optional_defaults::Builder {
         156  +
        crate::model::client_optional_defaults::Builder::default()
         157  +
    }
         158  +
}
         159  +
impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
         160  +
    type Unconstrained = crate::model::client_optional_defaults::Builder;
         161  +
}
         162  +
         163  +
#[allow(missing_docs)] // documentation missing in model
         164  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         165  +
pub struct Defaults {
         166  +
    #[allow(missing_docs)] // documentation missing in model
         167  +
    pub default_string: ::std::string::String,
         168  +
    #[allow(missing_docs)] // documentation missing in model
         169  +
    pub default_boolean: bool,
         170  +
    #[allow(missing_docs)] // documentation missing in model
         171  +
    pub default_list: ::std::vec::Vec<::std::string::String>,
         172  +
    #[allow(missing_docs)] // documentation missing in model
         173  +
    pub default_timestamp: ::aws_smithy_types::DateTime,
         174  +
    #[allow(missing_docs)] // documentation missing in model
         175  +
    pub default_blob: ::aws_smithy_types::Blob,
         176  +
    #[allow(missing_docs)] // documentation missing in model
         177  +
    pub default_byte: i8,
         178  +
    #[allow(missing_docs)] // documentation missing in model
         179  +
    pub default_short: i16,
         180  +
    #[allow(missing_docs)] // documentation missing in model
         181  +
    pub default_integer: i32,
         182  +
    #[allow(missing_docs)] // documentation missing in model
         183  +
    pub default_long: i64,
         184  +
    #[allow(missing_docs)] // documentation missing in model
         185  +
    pub default_float: f32,
         186  +
    #[allow(missing_docs)] // documentation missing in model
         187  +
    pub default_double: f64,
         188  +
    #[allow(missing_docs)] // documentation missing in model
         189  +
    pub default_map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
         190  +
    #[allow(missing_docs)] // documentation missing in model
         191  +
    pub default_enum: crate::model::TestEnum,
         192  +
    #[allow(missing_docs)] // documentation missing in model
         193  +
    pub default_int_enum: i32,
         194  +
    #[allow(missing_docs)] // documentation missing in model
         195  +
    pub empty_string: ::std::string::String,
         196  +
    #[allow(missing_docs)] // documentation missing in model
         197  +
    pub false_boolean: bool,
         198  +
    #[allow(missing_docs)] // documentation missing in model
         199  +
    pub empty_blob: ::aws_smithy_types::Blob,
         200  +
    #[allow(missing_docs)] // documentation missing in model
         201  +
    pub zero_byte: i8,
         202  +
    #[allow(missing_docs)] // documentation missing in model
         203  +
    pub zero_short: i16,
         204  +
    #[allow(missing_docs)] // documentation missing in model
         205  +
    pub zero_integer: i32,
         206  +
    #[allow(missing_docs)] // documentation missing in model
         207  +
    pub zero_long: i64,
         208  +
    #[allow(missing_docs)] // documentation missing in model
         209  +
    pub zero_float: f32,
         210  +
    #[allow(missing_docs)] // documentation missing in model
         211  +
    pub zero_double: f64,
         212  +
}
         213  +
impl Defaults {
         214  +
    #[allow(missing_docs)] // documentation missing in model
         215  +
    pub fn default_string(&self) -> &str {
         216  +
        use std::ops::Deref;
         217  +
        self.default_string.deref()
         218  +
    }
         219  +
    #[allow(missing_docs)] // documentation missing in model
         220  +
    pub fn default_boolean(&self) -> bool {
         221  +
        self.default_boolean
         222  +
    }
         223  +
    #[allow(missing_docs)] // documentation missing in model
         224  +
    pub fn default_list(&self) -> &[::std::string::String] {
         225  +
        use std::ops::Deref;
         226  +
        self.default_list.deref()
         227  +
    }
         228  +
    #[allow(missing_docs)] // documentation missing in model
         229  +
    pub fn default_timestamp(&self) -> &::aws_smithy_types::DateTime {
         230  +
        &self.default_timestamp
         231  +
    }
         232  +
    #[allow(missing_docs)] // documentation missing in model
         233  +
    pub fn default_blob(&self) -> &::aws_smithy_types::Blob {
         234  +
        &self.default_blob
         235  +
    }
         236  +
    #[allow(missing_docs)] // documentation missing in model
         237  +
    pub fn default_byte(&self) -> i8 {
         238  +
        self.default_byte
         239  +
    }
         240  +
    #[allow(missing_docs)] // documentation missing in model
         241  +
    pub fn default_short(&self) -> i16 {
         242  +
        self.default_short
         243  +
    }
         244  +
    #[allow(missing_docs)] // documentation missing in model
         245  +
    pub fn default_integer(&self) -> i32 {
         246  +
        self.default_integer
         247  +
    }
         248  +
    #[allow(missing_docs)] // documentation missing in model
         249  +
    pub fn default_long(&self) -> i64 {
         250  +
        self.default_long
         251  +
    }
         252  +
    #[allow(missing_docs)] // documentation missing in model
         253  +
    pub fn default_float(&self) -> f32 {
         254  +
        self.default_float
         255  +
    }
         256  +
    #[allow(missing_docs)] // documentation missing in model
         257  +
    pub fn default_double(&self) -> f64 {
         258  +
        self.default_double
         259  +
    }
         260  +
    #[allow(missing_docs)] // documentation missing in model
         261  +
    pub fn default_map(
         262  +
        &self,
         263  +
    ) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
         264  +
        &self.default_map
         265  +
    }
         266  +
    #[allow(missing_docs)] // documentation missing in model
         267  +
    pub fn default_enum(&self) -> &crate::model::TestEnum {
         268  +
        &self.default_enum
         269  +
    }
         270  +
    #[allow(missing_docs)] // documentation missing in model
         271  +
    pub fn default_int_enum(&self) -> i32 {
         272  +
        self.default_int_enum
         273  +
    }
         274  +
    #[allow(missing_docs)] // documentation missing in model
         275  +
    pub fn empty_string(&self) -> &str {
         276  +
        use std::ops::Deref;
         277  +
        self.empty_string.deref()
         278  +
    }
         279  +
    #[allow(missing_docs)] // documentation missing in model
         280  +
    pub fn false_boolean(&self) -> bool {
         281  +
        self.false_boolean
         282  +
    }
         283  +
    #[allow(missing_docs)] // documentation missing in model
         284  +
    pub fn empty_blob(&self) -> &::aws_smithy_types::Blob {
         285  +
        &self.empty_blob
         286  +
    }
         287  +
    #[allow(missing_docs)] // documentation missing in model
         288  +
    pub fn zero_byte(&self) -> i8 {
         289  +
        self.zero_byte
         290  +
    }
         291  +
    #[allow(missing_docs)] // documentation missing in model
         292  +
    pub fn zero_short(&self) -> i16 {
         293  +
        self.zero_short
         294  +
    }
         295  +
    #[allow(missing_docs)] // documentation missing in model
         296  +
    pub fn zero_integer(&self) -> i32 {
         297  +
        self.zero_integer
         298  +
    }
         299  +
    #[allow(missing_docs)] // documentation missing in model
         300  +
    pub fn zero_long(&self) -> i64 {
         301  +
        self.zero_long
         302  +
    }
         303  +
    #[allow(missing_docs)] // documentation missing in model
         304  +
    pub fn zero_float(&self) -> f32 {
         305  +
        self.zero_float
         306  +
    }
         307  +
    #[allow(missing_docs)] // documentation missing in model
         308  +
    pub fn zero_double(&self) -> f64 {
         309  +
        self.zero_double
         310  +
    }
         311  +
}
         312  +
impl Defaults {
         313  +
    /// Creates a new builder-style object to manufacture [`Defaults`](crate::model::Defaults).
         314  +
    pub fn builder() -> crate::model::defaults::Builder {
         315  +
        crate::model::defaults::Builder::default()
         316  +
    }
         317  +
}
         318  +
impl crate::constrained::Constrained for crate::model::Defaults {
         319  +
    type Unconstrained = crate::model::defaults::Builder;
         320  +
}
         321  +
         322  +
#[allow(missing_docs)] // documentation missing in model
         323  +
#[derive(
         324  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         325  +
)]
         326  +
pub struct ComplexNestedErrorData {
         327  +
    #[allow(missing_docs)] // documentation missing in model
         328  +
    pub foo: ::std::option::Option<::std::string::String>,
         329  +
}
         330  +
impl ComplexNestedErrorData {
         331  +
    #[allow(missing_docs)] // documentation missing in model
         332  +
    pub fn foo(&self) -> ::std::option::Option<&str> {
         333  +
        self.foo.as_deref()
         334  +
    }
         335  +
}
         336  +
impl ComplexNestedErrorData {
         337  +
    /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
         338  +
    pub fn builder() -> crate::model::complex_nested_error_data::Builder {
         339  +
        crate::model::complex_nested_error_data::Builder::default()
         340  +
    }
         341  +
}
         342  +
         343  +
#[allow(missing_docs)] // documentation missing in model
         344  +
#[derive(
         345  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         346  +
)]
         347  +
pub struct RecursiveShapesInputOutputNested1 {
         348  +
    #[allow(missing_docs)] // documentation missing in model
         349  +
    pub foo: ::std::option::Option<::std::string::String>,
         350  +
    #[allow(missing_docs)] // documentation missing in model
         351  +
    pub nested:
         352  +
        ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
         353  +
}
         354  +
impl RecursiveShapesInputOutputNested1 {
         355  +
    #[allow(missing_docs)] // documentation missing in model
         356  +
    pub fn foo(&self) -> ::std::option::Option<&str> {
         357  +
        self.foo.as_deref()
         358  +
    }
         359  +
    #[allow(missing_docs)] // documentation missing in model
         360  +
    pub fn nested(
         361  +
        &self,
         362  +
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
         363  +
        self.nested.as_deref()
         364  +
    }
         365  +
}
         366  +
impl RecursiveShapesInputOutputNested1 {
         367  +
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
         368  +
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
         369  +
        crate::model::recursive_shapes_input_output_nested1::Builder::default()
         370  +
    }
         371  +
}
         372  +
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
         373  +
    type Unconstrained = crate::model::recursive_shapes_input_output_nested1::Builder;
         374  +
}
         375  +
         376  +
#[allow(missing_docs)] // documentation missing in model
         377  +
#[derive(
         378  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         379  +
)]
         380  +
pub struct RecursiveShapesInputOutputNested2 {
         381  +
    #[allow(missing_docs)] // documentation missing in model
         382  +
    pub bar: ::std::option::Option<::std::string::String>,
         383  +
    #[allow(missing_docs)] // documentation missing in model
         384  +
    pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
         385  +
}
         386  +
impl RecursiveShapesInputOutputNested2 {
         387  +
    #[allow(missing_docs)] // documentation missing in model
         388  +
    pub fn bar(&self) -> ::std::option::Option<&str> {
         389  +
        self.bar.as_deref()
         390  +
    }
         391  +
    #[allow(missing_docs)] // documentation missing in model
         392  +
    pub fn recursive_member(
         393  +
        &self,
         394  +
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
         395  +
        self.recursive_member.as_ref()
         396  +
    }
         397  +
}
         398  +
impl RecursiveShapesInputOutputNested2 {
         399  +
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
         400  +
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
         401  +
        crate::model::recursive_shapes_input_output_nested2::Builder::default()
         402  +
    }
         403  +
}
         404  +
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
         405  +
    type Unconstrained = crate::model::recursive_shapes_input_output_nested2::Builder;
         406  +
}
         407  +
         408  +
#[allow(missing_docs)] // documentation missing in model
         409  +
///
         410  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
         411  +
/// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
         412  +
///
         413  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
         414  +
///
         415  +
#[derive(
         416  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         417  +
)]
         418  +
pub struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
         419  +
impl StringSet {
         420  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::string::String>`].
         421  +
    pub fn inner(&self) -> &::std::vec::Vec<::std::string::String> {
         422  +
        &self.0
         423  +
    }
         424  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
         425  +
    pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
         426  +
        self.0
         427  +
    }
         428  +
         429  +
    fn check_unique_items(
         430  +
        items: ::std::vec::Vec<::std::string::String>,
         431  +
    ) -> ::std::result::Result<
         432  +
        ::std::vec::Vec<::std::string::String>,
         433  +
        crate::model::string_set::ConstraintViolation,
         434  +
    > {
         435  +
        let mut seen = ::std::collections::HashMap::new();
         436  +
        let mut duplicate_indices = ::std::vec::Vec::new();
         437  +
        for (idx, item) in items.iter().enumerate() {
         438  +
            if let Some(prev_idx) = seen.insert(item, idx) {
         439  +
                duplicate_indices.push(prev_idx);
         440  +
            }
         441  +
        }
         442  +
         443  +
        let mut last_duplicate_indices = ::std::vec::Vec::new();
         444  +
        for idx in &duplicate_indices {
         445  +
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
         446  +
                last_duplicate_indices.push(prev_idx);
         447  +
            }
         448  +
        }
         449  +
        duplicate_indices.extend(last_duplicate_indices);
         450  +
         451  +
        if !duplicate_indices.is_empty() {
         452  +
            debug_assert!(duplicate_indices.len() >= 2);
         453  +
            Err(crate::model::string_set::ConstraintViolation::UniqueItems {
         454  +
                duplicate_indices,
         455  +
                original: items,
         456  +
            })
         457  +
        } else {
         458  +
            Ok(items)
         459  +
        }
         460  +
    }
         461  +
}
         462  +
impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
         463  +
    type Error = crate::model::string_set::ConstraintViolation;
         464  +
         465  +
    /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
         466  +
    fn try_from(
         467  +
        value: ::std::vec::Vec<::std::string::String>,
         468  +
    ) -> ::std::result::Result<Self, Self::Error> {
         469  +
        let value = Self::check_unique_items(value)?;
         470  +
         471  +
        Ok(Self(value))
         472  +
    }
         473  +
}
         474  +
         475  +
impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
         476  +
    fn from(value: StringSet) -> Self {
         477  +
        value.into_inner()
         478  +
    }
         479  +
}
         480  +
impl crate::constrained::Constrained for StringSet {
         481  +
    type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
         482  +
}
         483  +
         484  +
#[allow(missing_docs)] // documentation missing in model
         485  +
#[derive(
         486  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         487  +
)]
         488  +
pub struct GreetingStruct {
         489  +
    #[allow(missing_docs)] // documentation missing in model
         490  +
    pub hi: ::std::option::Option<::std::string::String>,
         491  +
}
         492  +
impl GreetingStruct {
         493  +
    #[allow(missing_docs)] // documentation missing in model
         494  +
    pub fn hi(&self) -> ::std::option::Option<&str> {
         495  +
        self.hi.as_deref()
         496  +
    }
         497  +
}
         498  +
impl GreetingStruct {
         499  +
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
         500  +
    pub fn builder() -> crate::model::greeting_struct::Builder {
         501  +
        crate::model::greeting_struct::Builder::default()
         502  +
    }
         503  +
}
         504  +
impl crate::constrained::Constrained for crate::model::GreetingStruct {
         505  +
    type Unconstrained = crate::model::greeting_struct::Builder;
         506  +
}
         507  +
         508  +
#[allow(missing_docs)] // documentation missing in model
         509  +
#[derive(
         510  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         511  +
)]
         512  +
pub struct StructureListMember {
         513  +
    #[allow(missing_docs)] // documentation missing in model
         514  +
    pub a: ::std::option::Option<::std::string::String>,
         515  +
    #[allow(missing_docs)] // documentation missing in model
         516  +
    pub b: ::std::option::Option<::std::string::String>,
         517  +
}
         518  +
impl StructureListMember {
         519  +
    #[allow(missing_docs)] // documentation missing in model
         520  +
    pub fn a(&self) -> ::std::option::Option<&str> {
         521  +
        self.a.as_deref()
         522  +
    }
         523  +
    #[allow(missing_docs)] // documentation missing in model
         524  +
    pub fn b(&self) -> ::std::option::Option<&str> {
         525  +
        self.b.as_deref()
         526  +
    }
         527  +
}
         528  +
impl StructureListMember {
         529  +
    /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
         530  +
    pub fn builder() -> crate::model::structure_list_member::Builder {
         531  +
        crate::model::structure_list_member::Builder::default()
         532  +
    }
         533  +
}
         534  +
impl crate::constrained::Constrained for crate::model::StructureListMember {
         535  +
    type Unconstrained = crate::model::structure_list_member::Builder;
         536  +
}
         537  +
         538  +
#[allow(missing_docs)] // documentation missing in model
         539  +
#[derive(
         540  +
    ::std::clone::Clone,
         541  +
    ::std::cmp::Eq,
         542  +
    ::std::cmp::Ord,
         543  +
    ::std::cmp::PartialEq,
         544  +
    ::std::cmp::PartialOrd,
         545  +
    ::std::fmt::Debug,
         546  +
    ::std::hash::Hash,
         547  +
)]
         548  +
pub enum FooEnum {
         549  +
    #[allow(missing_docs)] // documentation missing in model
         550  +
    Zero,
         551  +
    #[allow(missing_docs)] // documentation missing in model
         552  +
    One,
         553  +
    #[allow(missing_docs)] // documentation missing in model
         554  +
    Bar,
         555  +
    #[allow(missing_docs)] // documentation missing in model
         556  +
    Baz,
         557  +
    #[allow(missing_docs)] // documentation missing in model
         558  +
    Foo,
         559  +
}
         560  +
/// See [`FooEnum`](crate::model::FooEnum).
         561  +
pub mod foo_enum {
         562  +
    #[derive(Debug, PartialEq)]
         563  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
         564  +
         565  +
    impl ::std::fmt::Display for ConstraintViolation {
         566  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         567  +
            write!(
         568  +
                f,
         569  +
                r#"Value provided for 'smithy.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
         570  +
            )
         571  +
        }
         572  +
    }
         573  +
         574  +
    impl ::std::error::Error for ConstraintViolation {}
         575  +
    impl ConstraintViolation {
         576  +
        pub(crate) fn as_validation_exception_field(
         577  +
            self,
         578  +
            path: ::std::string::String,
         579  +
        ) -> crate::model::ValidationExceptionField {
         580  +
            crate::model::ValidationExceptionField {
         581  +
                message: format!(
         582  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
         583  +
                    &path
         584  +
                ),
         585  +
                path,
         586  +
            }
         587  +
        }
         588  +
    }
         589  +
}
         590  +
impl ::std::convert::TryFrom<&str> for FooEnum {
         591  +
    type Error = crate::model::foo_enum::ConstraintViolation;
         592  +
    fn try_from(
         593  +
        s: &str,
         594  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
         595  +
        match s {
         596  +
            "0" => Ok(FooEnum::Zero),
         597  +
            "1" => Ok(FooEnum::One),
         598  +
            "Bar" => Ok(FooEnum::Bar),
         599  +
            "Baz" => Ok(FooEnum::Baz),
         600  +
            "Foo" => Ok(FooEnum::Foo),
         601  +
            _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
         602  +
        }
         603  +
    }
         604  +
}
         605  +
impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
         606  +
    type Error = crate::model::foo_enum::ConstraintViolation;
         607  +
    fn try_from(
         608  +
        s: ::std::string::String,
         609  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         610  +
    {
         611  +
        s.as_str().try_into()
         612  +
    }
         613  +
}
         614  +
impl std::str::FromStr for FooEnum {
         615  +
    type Err = crate::model::foo_enum::ConstraintViolation;
         616  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         617  +
        Self::try_from(s)
         618  +
    }
         619  +
}
         620  +
impl FooEnum {
         621  +
    /// Returns the `&str` value of the enum member.
         622  +
    pub fn as_str(&self) -> &str {
         623  +
        match self {
         624  +
            FooEnum::Zero => "0",
         625  +
            FooEnum::One => "1",
         626  +
            FooEnum::Bar => "Bar",
         627  +
            FooEnum::Baz => "Baz",
         628  +
            FooEnum::Foo => "Foo",
         629  +
        }
         630  +
    }
         631  +
    /// Returns all the `&str` representations of the enum members.
         632  +
    pub const fn values() -> &'static [&'static str] {
         633  +
        &["0", "1", "Bar", "Baz", "Foo"]
         634  +
    }
         635  +
}
         636  +
impl ::std::convert::AsRef<str> for FooEnum {
         637  +
    fn as_ref(&self) -> &str {
         638  +
        self.as_str()
         639  +
    }
         640  +
}
         641  +
impl crate::constrained::Constrained for FooEnum {
         642  +
    type Unconstrained = ::std::string::String;
         643  +
}
         644  +
         645  +
impl ::std::convert::From<::std::string::String>
         646  +
    for crate::constrained::MaybeConstrained<crate::model::FooEnum>
         647  +
{
         648  +
    fn from(value: ::std::string::String) -> Self {
         649  +
        Self::Unconstrained(value)
         650  +
    }
         651  +
}
         652  +
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         653  +
pub mod validation_exception_field {
         654  +
         655  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
         656  +
    /// Holds one variant for each of the ways the builder can fail.
         657  +
    #[non_exhaustive]
         658  +
    #[allow(clippy::enum_variant_names)]
         659  +
    pub enum ConstraintViolation {
         660  +
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
         661  +
        MissingPath,
         662  +
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
         663  +
        MissingMessage,
         664  +
    }
         665  +
    impl ::std::fmt::Display for ConstraintViolation {
         666  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         667  +
            match self {
         668  +
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
         669  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
         670  +
            }
         671  +
        }
         672  +
    }
         673  +
    impl ::std::error::Error for ConstraintViolation {}
         674  +
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
         675  +
        type Error = ConstraintViolation;
         676  +
         677  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
         678  +
            builder.build()
         679  +
        }
         680  +
    }
         681  +
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         682  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         683  +
    pub struct Builder {
         684  +
        pub(crate) path: ::std::option::Option<::std::string::String>,
         685  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
         686  +
    }
         687  +
    impl Builder {
         688  +
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         689  +
        pub fn path(mut self, input: ::std::string::String) -> Self {
         690  +
            self.path = Some(input);
         691  +
            self
         692  +
        }
         693  +
        /// A detailed description of the validation failure.
         694  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
         695  +
            self.message = Some(input);
         696  +
            self
         697  +
        }
         698  +
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         699  +
        ///
         700  +
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
         701  +
        ///
         702  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
         703  +
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
         704  +
            self.build_enforcing_all_constraints()
         705  +
        }
         706  +
        fn build_enforcing_all_constraints(
         707  +
            self,
         708  +
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
         709  +
            Ok(crate::model::ValidationExceptionField {
         710  +
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
         711  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
         712  +
            })
         713  +
        }
         714  +
    }
         715  +
}
         716  +
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         717  +
pub mod client_optional_defaults {
         718  +
         719  +
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
         720  +
        fn from(builder: Builder) -> Self {
         721  +
            builder.build()
         722  +
        }
         723  +
    }
         724  +
    /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         725  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         726  +
    pub struct Builder {
         727  +
        pub(crate) member: ::std::option::Option<i32>,
         728  +
    }
         729  +
    impl Builder {
         730  +
        #[allow(missing_docs)] // documentation missing in model
         731  +
        pub fn member(mut self, input: i32) -> Self {
         732  +
            self.member = Some(input);
         733  +
            self
         734  +
        }
         735  +
        #[allow(missing_docs)] // documentation missing in model
         736  +
        pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
         737  +
            self.member = Some(input.into());
         738  +
            self
         739  +
        }
         740  +
        /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         741  +
        pub fn build(self) -> crate::model::ClientOptionalDefaults {
         742  +
            self.build_enforcing_all_constraints()
         743  +
        }
         744  +
        fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
         745  +
            crate::model::ClientOptionalDefaults {
         746  +
                member: self.member.unwrap_or(0i32),
         747  +
            }
         748  +
        }
         749  +
    }
         750  +
}
         751  +
/// See [`Defaults`](crate::model::Defaults).
         752  +
pub mod defaults {
         753  +
         754  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
         755  +
    /// Holds one variant for each of the ways the builder can fail.
         756  +
    #[non_exhaustive]
         757  +
    #[allow(clippy::enum_variant_names)]
         758  +
    pub enum ConstraintViolation {
         759  +
        /// Constraint violation occurred building member `default_enum` when building `Defaults`.
         760  +
        #[doc(hidden)]
         761  +
        DefaultEnum(crate::model::test_enum::ConstraintViolation),
         762  +
    }
         763  +
    impl ::std::fmt::Display for ConstraintViolation {
         764  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         765  +
            match self {
         766  +
                ConstraintViolation::DefaultEnum(_) => write!(f, "constraint violation occurred building member `default_enum` when building `Defaults`"),
         767  +
            }
         768  +
        }
         769  +
    }
         770  +
    impl ::std::error::Error for ConstraintViolation {}
         771  +
    impl ConstraintViolation {
         772  +
        pub(crate) fn as_validation_exception_field(
         773  +
            self,
         774  +
            path: ::std::string::String,
         775  +
        ) -> crate::model::ValidationExceptionField {
         776  +
            match self {
         777  +
                ConstraintViolation::DefaultEnum(inner) => {
         778  +
                    inner.as_validation_exception_field(path + "/defaultEnum")
         779  +
                }
         780  +
            }
         781  +
        }
         782  +
    }
         783  +
    impl ::std::convert::From<Builder>
         784  +
        for crate::constrained::MaybeConstrained<crate::model::Defaults>
         785  +
    {
         786  +
        fn from(builder: Builder) -> Self {
         787  +
            Self::Unconstrained(builder)
         788  +
        }
         789  +
    }
         790  +
    impl ::std::convert::TryFrom<Builder> for crate::model::Defaults {
         791  +
        type Error = ConstraintViolation;
         792  +
         793  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
         794  +
            builder.build()
         795  +
        }
         796  +
    }
         797  +
    /// A builder for [`Defaults`](crate::model::Defaults).
         798  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         799  +
    pub struct Builder {
         800  +
        pub(crate) default_string: ::std::option::Option<::std::string::String>,
         801  +
        pub(crate) default_boolean: ::std::option::Option<bool>,
         802  +
        pub(crate) default_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
         803  +
        pub(crate) default_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
         804  +
        pub(crate) default_blob: ::std::option::Option<::aws_smithy_types::Blob>,
         805  +
        pub(crate) default_byte: ::std::option::Option<i8>,
         806  +
        pub(crate) default_short: ::std::option::Option<i16>,
         807  +
        pub(crate) default_integer: ::std::option::Option<i32>,
         808  +
        pub(crate) default_long: ::std::option::Option<i64>,
         809  +
        pub(crate) default_float: ::std::option::Option<f32>,
         810  +
        pub(crate) default_double: ::std::option::Option<f64>,
         811  +
        pub(crate) default_map: ::std::option::Option<
         812  +
            ::std::collections::HashMap<::std::string::String, ::std::string::String>,
         813  +
        >,
         814  +
        pub(crate) default_enum:
         815  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TestEnum>>,
         816  +
        pub(crate) default_int_enum: ::std::option::Option<i32>,
         817  +
        pub(crate) empty_string: ::std::option::Option<::std::string::String>,
         818  +
        pub(crate) false_boolean: ::std::option::Option<bool>,
         819  +
        pub(crate) empty_blob: ::std::option::Option<::aws_smithy_types::Blob>,
         820  +
        pub(crate) zero_byte: ::std::option::Option<i8>,
         821  +
        pub(crate) zero_short: ::std::option::Option<i16>,
         822  +
        pub(crate) zero_integer: ::std::option::Option<i32>,
         823  +
        pub(crate) zero_long: ::std::option::Option<i64>,
         824  +
        pub(crate) zero_float: ::std::option::Option<f32>,
         825  +
        pub(crate) zero_double: ::std::option::Option<f64>,
         826  +
    }
         827  +
    impl Builder {
         828  +
        #[allow(missing_docs)] // documentation missing in model
         829  +
        pub fn default_string(mut self, input: ::std::string::String) -> Self {
         830  +
            self.default_string = Some(input);
         831  +
            self
         832  +
        }
         833  +
        #[allow(missing_docs)] // documentation missing in model
         834  +
        pub(crate) fn set_default_string(
         835  +
            mut self,
         836  +
            input: impl ::std::convert::Into<::std::string::String>,
         837  +
        ) -> Self {
         838  +
            self.default_string = Some(input.into());
         839  +
            self
         840  +
        }
         841  +
        #[allow(missing_docs)] // documentation missing in model
         842  +
        pub fn default_boolean(mut self, input: bool) -> Self {
         843  +
            self.default_boolean = Some(input);
         844  +
            self
         845  +
        }
         846  +
        #[allow(missing_docs)] // documentation missing in model
         847  +
        pub(crate) fn set_default_boolean(
         848  +
            mut self,
         849  +
            input: impl ::std::convert::Into<bool>,
         850  +
        ) -> Self {
         851  +
            self.default_boolean = Some(input.into());
         852  +
            self
         853  +
        }
         854  +
        #[allow(missing_docs)] // documentation missing in model
         855  +
        pub fn default_list(mut self, input: ::std::vec::Vec<::std::string::String>) -> Self {
         856  +
            self.default_list = Some(input);
         857  +
            self
         858  +
        }
         859  +
        #[allow(missing_docs)] // documentation missing in model
         860  +
        pub(crate) fn set_default_list(
         861  +
            mut self,
         862  +
            input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>,
         863  +
        ) -> Self {
         864  +
            self.default_list = Some(input.into());
         865  +
            self
         866  +
        }
         867  +
        #[allow(missing_docs)] // documentation missing in model
         868  +
        pub fn default_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
         869  +
            self.default_timestamp = Some(input);
         870  +
            self
         871  +
        }
         872  +
        #[allow(missing_docs)] // documentation missing in model
         873  +
        pub(crate) fn set_default_timestamp(
         874  +
            mut self,
         875  +
            input: impl ::std::convert::Into<::aws_smithy_types::DateTime>,
         876  +
        ) -> Self {
         877  +
            self.default_timestamp = Some(input.into());
         878  +
            self
         879  +
        }
         880  +
        #[allow(missing_docs)] // documentation missing in model
         881  +
        pub fn default_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
         882  +
            self.default_blob = Some(input);
         883  +
            self
         884  +
        }
         885  +
        #[allow(missing_docs)] // documentation missing in model
         886  +
        pub(crate) fn set_default_blob(
         887  +
            mut self,
         888  +
            input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
         889  +
        ) -> Self {
         890  +
            self.default_blob = Some(input.into());
         891  +
            self
         892  +
        }
         893  +
        #[allow(missing_docs)] // documentation missing in model
         894  +
        pub fn default_byte(mut self, input: i8) -> Self {
         895  +
            self.default_byte = Some(input);
         896  +
            self
         897  +
        }
         898  +
        #[allow(missing_docs)] // documentation missing in model
         899  +
        pub(crate) fn set_default_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
         900  +
            self.default_byte = Some(input.into());
         901  +
            self
         902  +
        }
         903  +
        #[allow(missing_docs)] // documentation missing in model
         904  +
        pub fn default_short(mut self, input: i16) -> Self {
         905  +
            self.default_short = Some(input);
         906  +
            self
         907  +
        }
         908  +
        #[allow(missing_docs)] // documentation missing in model
         909  +
        pub(crate) fn set_default_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
         910  +
            self.default_short = Some(input.into());
         911  +
            self
         912  +
        }
         913  +
        #[allow(missing_docs)] // documentation missing in model
         914  +
        pub fn default_integer(mut self, input: i32) -> Self {
         915  +
            self.default_integer = Some(input);
         916  +
            self
         917  +
        }
         918  +
        #[allow(missing_docs)] // documentation missing in model
         919  +
        pub(crate) fn set_default_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
         920  +
            self.default_integer = Some(input.into());
         921  +
            self
         922  +
        }
         923  +
        #[allow(missing_docs)] // documentation missing in model
         924  +
        pub fn default_long(mut self, input: i64) -> Self {
         925  +
            self.default_long = Some(input);
         926  +
            self
         927  +
        }
         928  +
        #[allow(missing_docs)] // documentation missing in model
         929  +
        pub(crate) fn set_default_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
         930  +
            self.default_long = Some(input.into());
         931  +
            self
         932  +
        }
         933  +
        #[allow(missing_docs)] // documentation missing in model
         934  +
        pub fn default_float(mut self, input: f32) -> Self {
         935  +
            self.default_float = Some(input);
         936  +
            self
         937  +
        }
         938  +
        #[allow(missing_docs)] // documentation missing in model
         939  +
        pub(crate) fn set_default_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
         940  +
            self.default_float = Some(input.into());
         941  +
            self
         942  +
        }
         943  +
        #[allow(missing_docs)] // documentation missing in model
         944  +
        pub fn default_double(mut self, input: f64) -> Self {
         945  +
            self.default_double = Some(input);
         946  +
            self
         947  +
        }
         948  +
        #[allow(missing_docs)] // documentation missing in model
         949  +
        pub(crate) fn set_default_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
         950  +
            self.default_double = Some(input.into());
         951  +
            self
         952  +
        }
         953  +
        #[allow(missing_docs)] // documentation missing in model
         954  +
        pub fn default_map(
         955  +
            mut self,
         956  +
            input: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
         957  +
        ) -> Self {
         958  +
            self.default_map = Some(input);
         959  +
            self
         960  +
        }
         961  +
        #[allow(missing_docs)] // documentation missing in model
         962  +
        pub(crate) fn set_default_map(
         963  +
            mut self,
         964  +
            input: impl ::std::convert::Into<
         965  +
                ::std::collections::HashMap<::std::string::String, ::std::string::String>,
         966  +
            >,
         967  +
        ) -> Self {
         968  +
            self.default_map = Some(input.into());
         969  +
            self
         970  +
        }
         971  +
        #[allow(missing_docs)] // documentation missing in model
         972  +
        pub fn default_enum(mut self, input: crate::model::TestEnum) -> Self {
         973  +
            self.default_enum = Some(crate::constrained::MaybeConstrained::Constrained(input));
         974  +
            self
         975  +
        }
         976  +
        #[allow(missing_docs)] // documentation missing in model
         977  +
        pub(crate) fn set_default_enum(
         978  +
            mut self,
         979  +
            input: impl ::std::convert::Into<
         980  +
                crate::constrained::MaybeConstrained<crate::model::TestEnum>,
         981  +
            >,
         982  +
        ) -> Self {
         983  +
            self.default_enum = Some(input.into());
         984  +
            self
         985  +
        }
         986  +
        #[allow(missing_docs)] // documentation missing in model
         987  +
        pub fn default_int_enum(mut self, input: i32) -> Self {
         988  +
            self.default_int_enum = Some(input);
         989  +
            self
         990  +
        }
         991  +
        #[allow(missing_docs)] // documentation missing in model
         992  +
        pub(crate) fn set_default_int_enum(
         993  +
            mut self,
         994  +
            input: impl ::std::convert::Into<i32>,
         995  +
        ) -> Self {
         996  +
            self.default_int_enum = Some(input.into());
         997  +
            self
         998  +
        }
         999  +
        #[allow(missing_docs)] // documentation missing in model
        1000  +
        pub fn empty_string(mut self, input: ::std::string::String) -> Self {
        1001  +
            self.empty_string = Some(input);
        1002  +
            self
        1003  +
        }
        1004  +
        #[allow(missing_docs)] // documentation missing in model
        1005  +
        pub(crate) fn set_empty_string(
        1006  +
            mut self,
        1007  +
            input: impl ::std::convert::Into<::std::string::String>,
        1008  +
        ) -> Self {
        1009  +
            self.empty_string = Some(input.into());
        1010  +
            self
        1011  +
        }
        1012  +
        #[allow(missing_docs)] // documentation missing in model
        1013  +
        pub fn false_boolean(mut self, input: bool) -> Self {
        1014  +
            self.false_boolean = Some(input);
        1015  +
            self
        1016  +
        }
        1017  +
        #[allow(missing_docs)] // documentation missing in model
        1018  +
        pub(crate) fn set_false_boolean(mut self, input: impl ::std::convert::Into<bool>) -> Self {
        1019  +
            self.false_boolean = Some(input.into());
        1020  +
            self
        1021  +
        }
        1022  +
        #[allow(missing_docs)] // documentation missing in model
        1023  +
        pub fn empty_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
        1024  +
            self.empty_blob = Some(input);
        1025  +
            self
        1026  +
        }
        1027  +
        #[allow(missing_docs)] // documentation missing in model
        1028  +
        pub(crate) fn set_empty_blob(
        1029  +
            mut self,
        1030  +
            input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
        1031  +
        ) -> Self {
        1032  +
            self.empty_blob = Some(input.into());
        1033  +
            self
        1034  +
        }
        1035  +
        #[allow(missing_docs)] // documentation missing in model
        1036  +
        pub fn zero_byte(mut self, input: i8) -> Self {
        1037  +
            self.zero_byte = Some(input);
        1038  +
            self
        1039  +
        }
        1040  +
        #[allow(missing_docs)] // documentation missing in model
        1041  +
        pub(crate) fn set_zero_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
        1042  +
            self.zero_byte = Some(input.into());
        1043  +
            self
        1044  +
        }
        1045  +
        #[allow(missing_docs)] // documentation missing in model
        1046  +
        pub fn zero_short(mut self, input: i16) -> Self {
        1047  +
            self.zero_short = Some(input);
        1048  +
            self
        1049  +
        }
        1050  +
        #[allow(missing_docs)] // documentation missing in model
        1051  +
        pub(crate) fn set_zero_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
        1052  +
            self.zero_short = Some(input.into());
        1053  +
            self
        1054  +
        }
        1055  +
        #[allow(missing_docs)] // documentation missing in model
        1056  +
        pub fn zero_integer(mut self, input: i32) -> Self {
        1057  +
            self.zero_integer = Some(input);
        1058  +
            self
        1059  +
        }
        1060  +
        #[allow(missing_docs)] // documentation missing in model
        1061  +
        pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        1062  +
            self.zero_integer = Some(input.into());
        1063  +
            self
        1064  +
        }
        1065  +
        #[allow(missing_docs)] // documentation missing in model
        1066  +
        pub fn zero_long(mut self, input: i64) -> Self {
        1067  +
            self.zero_long = Some(input);
        1068  +
            self
        1069  +
        }
        1070  +
        #[allow(missing_docs)] // documentation missing in model
        1071  +
        pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
        1072  +
            self.zero_long = Some(input.into());
        1073  +
            self
        1074  +
        }
        1075  +
        #[allow(missing_docs)] // documentation missing in model
        1076  +
        pub fn zero_float(mut self, input: f32) -> Self {
        1077  +
            self.zero_float = Some(input);
        1078  +
            self
        1079  +
        }
        1080  +
        #[allow(missing_docs)] // documentation missing in model
        1081  +
        pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
        1082  +
            self.zero_float = Some(input.into());
        1083  +
            self
        1084  +
        }
        1085  +
        #[allow(missing_docs)] // documentation missing in model
        1086  +
        pub fn zero_double(mut self, input: f64) -> Self {
        1087  +
            self.zero_double = Some(input);
        1088  +
            self
        1089  +
        }
        1090  +
        #[allow(missing_docs)] // documentation missing in model
        1091  +
        pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
        1092  +
            self.zero_double = Some(input.into());
        1093  +
            self
        1094  +
        }
        1095  +
        /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
        1096  +
        ///
        1097  +
        /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
        1098  +
        ///
        1099  +
        pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
        1100  +
            self.build_enforcing_all_constraints()
        1101  +
        }
        1102  +
        fn build_enforcing_all_constraints(
        1103  +
            self,
        1104  +
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
        1105  +
            Ok(crate::model::Defaults {
        1106  +
                default_string: self.default_string.unwrap_or_else(|| String::from("hi")),
        1107  +
                default_boolean: self.default_boolean.unwrap_or(true),
        1108  +
                default_list: self.default_list.unwrap_or_default(),
        1109  +
                default_timestamp: self.default_timestamp.unwrap_or_else(|| {
        1110  +
                    ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)
        1111  +
                }),
        1112  +
                default_blob: self
        1113  +
                    .default_blob
        1114  +
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("YWJj")),
        1115  +
                default_byte: self.default_byte.unwrap_or(1i8),
        1116  +
                default_short: self.default_short.unwrap_or(1i16),
        1117  +
                default_integer: self.default_integer.unwrap_or(10i32),
        1118  +
                default_long: self.default_long.unwrap_or(100i64),
        1119  +
                default_float: self.default_float.unwrap_or(1.0f32),
        1120  +
                default_double: self.default_double.unwrap_or(1.0f64),
        1121  +
                default_map: self.default_map.unwrap_or_default(),
        1122  +
                default_enum: self
        1123  +
                    .default_enum
        1124  +
                    .map(|v| match v {
        1125  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        1126  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        1127  +
                    })
        1128  +
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
        1129  +
                    .transpose()?
        1130  +
                    .unwrap_or(
        1131  +
                        "FOO"
        1132  +
                            .parse::<crate::model::TestEnum>()
        1133  +
                            .expect("static value validated to member"),
        1134  +
                    ),
        1135  +
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
        1136  +
                empty_string: self.empty_string.unwrap_or_else(|| String::from("")),
        1137  +
                false_boolean: self.false_boolean.unwrap_or(false),
        1138  +
                empty_blob: self
        1139  +
                    .empty_blob
        1140  +
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("")),
        1141  +
                zero_byte: self.zero_byte.unwrap_or(0i8),
        1142  +
                zero_short: self.zero_short.unwrap_or(0i16),
        1143  +
                zero_integer: self.zero_integer.unwrap_or(0i32),
        1144  +
                zero_long: self.zero_long.unwrap_or(0i64),
        1145  +
                zero_float: self.zero_float.unwrap_or(0.0f32),
        1146  +
                zero_double: self.zero_double.unwrap_or(0.0f64),
        1147  +
            })
        1148  +
        }
        1149  +
    }
        1150  +
}
        1151  +
/// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
        1152  +
pub mod complex_nested_error_data {
        1153  +
        1154  +
    impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
        1155  +
        fn from(builder: Builder) -> Self {
        1156  +
            builder.build()
        1157  +
        }
        1158  +
    }
        1159  +
    /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
        1160  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1161  +
    pub struct Builder {
        1162  +
        pub(crate) foo: ::std::option::Option<::std::string::String>,
        1163  +
    }
        1164  +
    impl Builder {
        1165  +
        #[allow(missing_docs)] // documentation missing in model
        1166  +
        pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1167  +
            self.foo = input;
        1168  +
            self
        1169  +
        }
        1170  +
        /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
        1171  +
        pub fn build(self) -> crate::model::ComplexNestedErrorData {
        1172  +
            self.build_enforcing_all_constraints()
        1173  +
        }
        1174  +
        fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
        1175  +
            crate::model::ComplexNestedErrorData { foo: self.foo }
        1176  +
        }
        1177  +
    }
        1178  +
}
        1179  +
/// See [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
        1180  +
pub mod recursive_shapes_input_output_nested1 {
        1181  +
        1182  +
    impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested1 {
        1183  +
        fn from(builder: Builder) -> Self {
        1184  +
            builder.build()
        1185  +
        }
        1186  +
    }
        1187  +
    /// A builder for [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
        1188  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1189  +
    pub struct Builder {
        1190  +
        pub(crate) foo: ::std::option::Option<::std::string::String>,
        1191  +
        pub(crate) nested: ::std::option::Option<
        1192  +
            ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
        1193  +
        >,
        1194  +
    }
        1195  +
    impl Builder {
        1196  +
        #[allow(missing_docs)] // documentation missing in model
        1197  +
        pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1198  +
            self.foo = input;
        1199  +
            self
        1200  +
        }
        1201  +
        #[allow(missing_docs)] // documentation missing in model
        1202  +
        pub(crate) fn set_foo(
        1203  +
            mut self,
        1204  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1205  +
        ) -> Self {
        1206  +
            self.foo = input.map(|v| v.into());
        1207  +
            self
        1208  +
        }
        1209  +
        #[allow(missing_docs)] // documentation missing in model
        1210  +
        pub fn nested(
        1211  +
            mut self,
        1212  +
            input: ::std::option::Option<
        1213  +
                ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
        1214  +
            >,
        1215  +
        ) -> Self {
        1216  +
            self.nested = input;
        1217  +
            self
        1218  +
        }
        1219  +
        #[allow(missing_docs)] // documentation missing in model
        1220  +
        pub(crate) fn set_nested(
        1221  +
            mut self,
        1222  +
            input: Option<
        1223  +
                impl ::std::convert::Into<
        1224  +
                    ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
        1225  +
                >,
        1226  +
            >,
        1227  +
        ) -> Self {
        1228  +
            self.nested = input.map(|v| v.into());
        1229  +
            self
        1230  +
        }
        1231  +
        /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
        1232  +
        pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested1 {
        1233  +
            self.build_enforcing_all_constraints()
        1234  +
        }
        1235  +
        fn build_enforcing_all_constraints(
        1236  +
            self,
        1237  +
        ) -> crate::model::RecursiveShapesInputOutputNested1 {
        1238  +
            crate::model::RecursiveShapesInputOutputNested1 {
        1239  +
                foo: self.foo,
        1240  +
                nested: self.nested,
        1241  +
            }
        1242  +
        }
        1243  +
    }
        1244  +
}
        1245  +
/// See [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
        1246  +
pub mod recursive_shapes_input_output_nested2 {
        1247  +
        1248  +
    impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested2 {
        1249  +
        fn from(builder: Builder) -> Self {
        1250  +
            builder.build()
        1251  +
        }
        1252  +
    }
        1253  +
    /// A builder for [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
        1254  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1255  +
    pub struct Builder {
        1256  +
        pub(crate) bar: ::std::option::Option<::std::string::String>,
        1257  +
        pub(crate) recursive_member:
        1258  +
            ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
        1259  +
    }
        1260  +
    impl Builder {
        1261  +
        #[allow(missing_docs)] // documentation missing in model
        1262  +
        pub fn bar(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1263  +
            self.bar = input;
        1264  +
            self
        1265  +
        }
        1266  +
        #[allow(missing_docs)] // documentation missing in model
        1267  +
        pub(crate) fn set_bar(
        1268  +
            mut self,
        1269  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1270  +
        ) -> Self {
        1271  +
            self.bar = input.map(|v| v.into());
        1272  +
            self
        1273  +
        }
        1274  +
        #[allow(missing_docs)] // documentation missing in model
        1275  +
        pub fn recursive_member(
        1276  +
            mut self,
        1277  +
            input: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
        1278  +
        ) -> Self {
        1279  +
            self.recursive_member = input;
        1280  +
            self
        1281  +
        }
        1282  +
        #[allow(missing_docs)] // documentation missing in model
        1283  +
        pub(crate) fn set_recursive_member(
        1284  +
            mut self,
        1285  +
            input: Option<
        1286  +
                impl ::std::convert::Into<crate::model::RecursiveShapesInputOutputNested1>,
        1287  +
            >,
        1288  +
        ) -> Self {
        1289  +
            self.recursive_member = input.map(|v| v.into());
        1290  +
            self
        1291  +
        }
        1292  +
        /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
        1293  +
        pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested2 {
        1294  +
            self.build_enforcing_all_constraints()
        1295  +
        }
        1296  +
        fn build_enforcing_all_constraints(
        1297  +
            self,
        1298  +
        ) -> crate::model::RecursiveShapesInputOutputNested2 {
        1299  +
            crate::model::RecursiveShapesInputOutputNested2 {
        1300  +
                bar: self.bar,
        1301  +
                recursive_member: self.recursive_member,
        1302  +
            }
        1303  +
        }
        1304  +
    }
        1305  +
}
        1306  +
pub mod sparse_set_map {
        1307  +
        1308  +
    #[allow(clippy::enum_variant_names)]
        1309  +
    #[derive(Debug, PartialEq)]
        1310  +
    pub enum ConstraintViolation {
        1311  +
        #[doc(hidden)]
        1312  +
        Value(
        1313  +
            ::std::string::String,
        1314  +
            crate::model::string_set::ConstraintViolation,
        1315  +
        ),
        1316  +
    }
        1317  +
        1318  +
    impl ::std::fmt::Display for ConstraintViolation {
        1319  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1320  +
            match self {
        1321  +
                Self::Value(_, value_constraint_violation) => {
        1322  +
                    write!(f, "{}", value_constraint_violation)
        1323  +
                }
        1324  +
            }
        1325  +
        }
        1326  +
    }
        1327  +
        1328  +
    impl ::std::error::Error for ConstraintViolation {}
        1329  +
    impl ConstraintViolation {
        1330  +
        pub(crate) fn as_validation_exception_field(
        1331  +
            self,
        1332  +
            path: ::std::string::String,
        1333  +
        ) -> crate::model::ValidationExceptionField {
        1334  +
            match self {
        1335  +
                Self::Value(key, value_constraint_violation) => value_constraint_violation
        1336  +
                    .as_validation_exception_field(path + "/" + key.as_str()),
        1337  +
            }
        1338  +
        }
        1339  +
    }
        1340  +
}
        1341  +
/// See [`StringSet`](crate::model::StringSet).
        1342  +
pub mod string_set {
        1343  +
        1344  +
    #[allow(clippy::enum_variant_names)]
        1345  +
    #[derive(Debug, PartialEq)]
        1346  +
    pub enum ConstraintViolation {
        1347  +
        /// Constraint violation error when the list does not contain unique items
        1348  +
        UniqueItems {
        1349  +
            /// A vector of indices into `original` pointing to all duplicate items. This vector has
        1350  +
            /// at least two elements.
        1351  +
            /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
        1352  +
            /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
        1353  +
            /// Nothing is guaranteed about the order of the indices.
        1354  +
            duplicate_indices: ::std::vec::Vec<usize>,
        1355  +
            /// The original vector, that contains duplicate items.
        1356  +
            original: ::std::vec::Vec<::std::string::String>,
        1357  +
        },
        1358  +
    }
        1359  +
        1360  +
    impl ::std::fmt::Display for ConstraintViolation {
        1361  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1362  +
            let message = match self {
        1363  +
                                Self::UniqueItems { duplicate_indices, .. } =>
        1364  +
                            format!("Value with repeated values at indices {:?} provided for 'smithy.protocoltests.shared#StringSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
        1365  +
                            };
        1366  +
            write!(f, "{message}")
        1367  +
        }
        1368  +
    }
        1369  +
        1370  +
    impl ::std::error::Error for ConstraintViolation {}
        1371  +
    impl ConstraintViolation {
        1372  +
        pub(crate) fn as_validation_exception_field(
        1373  +
            self,
        1374  +
            path: ::std::string::String,
        1375  +
        ) -> crate::model::ValidationExceptionField {
        1376  +
            match self {
        1377  +
                        Self::UniqueItems { duplicate_indices, .. } =>
        1378  +
                                crate::model::ValidationExceptionField {
        1379  +
                                    message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
        1380  +
                                    path,
        1381  +
                                },
        1382  +
                    }
        1383  +
        }
        1384  +
    }
        1385  +
}
        1386  +
/// See [`GreetingStruct`](crate::model::GreetingStruct).
        1387  +
pub mod greeting_struct {
        1388  +
        1389  +
    impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
        1390  +
        fn from(builder: Builder) -> Self {
        1391  +
            builder.build()
        1392  +
        }
        1393  +
    }
        1394  +
    /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
        1395  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1396  +
    pub struct Builder {
        1397  +
        pub(crate) hi: ::std::option::Option<::std::string::String>,
        1398  +
    }
        1399  +
    impl Builder {
        1400  +
        #[allow(missing_docs)] // documentation missing in model
        1401  +
        pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1402  +
            self.hi = input;
        1403  +
            self
        1404  +
        }
        1405  +
        #[allow(missing_docs)] // documentation missing in model
        1406  +
        pub(crate) fn set_hi(
        1407  +
            mut self,
        1408  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1409  +
        ) -> Self {
        1410  +
            self.hi = input.map(|v| v.into());
        1411  +
            self
        1412  +
        }
        1413  +
        /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
        1414  +
        pub fn build(self) -> crate::model::GreetingStruct {
        1415  +
            self.build_enforcing_all_constraints()
        1416  +
        }
        1417  +
        fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
        1418  +
            crate::model::GreetingStruct { hi: self.hi }
        1419  +
        }
        1420  +
    }
        1421  +
}
        1422  +
pub mod dense_set_map {
        1423  +
        1424  +
    #[allow(clippy::enum_variant_names)]
        1425  +
    #[derive(Debug, PartialEq)]
        1426  +
    pub enum ConstraintViolation {
        1427  +
        #[doc(hidden)]
        1428  +
        Value(
        1429  +
            ::std::string::String,
        1430  +
            crate::model::string_set::ConstraintViolation,
        1431  +
        ),
        1432  +
    }
        1433  +
        1434  +
    impl ::std::fmt::Display for ConstraintViolation {
        1435  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1436  +
            match self {
        1437  +
                Self::Value(_, value_constraint_violation) => {
        1438  +
                    write!(f, "{}", value_constraint_violation)
        1439  +
                }
        1440  +
            }
        1441  +
        }
        1442  +
    }
        1443  +
        1444  +
    impl ::std::error::Error for ConstraintViolation {}
        1445  +
    impl ConstraintViolation {
        1446  +
        pub(crate) fn as_validation_exception_field(
        1447  +
            self,
        1448  +
            path: ::std::string::String,
        1449  +
        ) -> crate::model::ValidationExceptionField {
        1450  +
            match self {
        1451  +
                Self::Value(key, value_constraint_violation) => value_constraint_violation
        1452  +
                    .as_validation_exception_field(path + "/" + key.as_str()),
        1453  +
            }
        1454  +
        }
        1455  +
    }
        1456  +
}
        1457  +
/// See [`StructureListMember`](crate::model::StructureListMember).
        1458  +
pub mod structure_list_member {
        1459  +
        1460  +
    impl ::std::convert::From<Builder> for crate::model::StructureListMember {
        1461  +
        fn from(builder: Builder) -> Self {
        1462  +
            builder.build()
        1463  +
        }
        1464  +
    }
        1465  +
    /// A builder for [`StructureListMember`](crate::model::StructureListMember).
        1466  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1467  +
    pub struct Builder {
        1468  +
        pub(crate) a: ::std::option::Option<::std::string::String>,
        1469  +
        pub(crate) b: ::std::option::Option<::std::string::String>,
        1470  +
    }
        1471  +
    impl Builder {
        1472  +
        #[allow(missing_docs)] // documentation missing in model
        1473  +
        pub fn a(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1474  +
            self.a = input;
        1475  +
            self
        1476  +
        }
        1477  +
        #[allow(missing_docs)] // documentation missing in model
        1478  +
        pub(crate) fn set_a(
        1479  +
            mut self,
        1480  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1481  +
        ) -> Self {
        1482  +
            self.a = input.map(|v| v.into());
        1483  +
            self
        1484  +
        }
        1485  +
        #[allow(missing_docs)] // documentation missing in model
        1486  +
        pub fn b(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1487  +
            self.b = input;
        1488  +
            self
        1489  +
        }
        1490  +
        #[allow(missing_docs)] // documentation missing in model
        1491  +
        pub(crate) fn set_b(
        1492  +
            mut self,
        1493  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1494  +
        ) -> Self {
        1495  +
            self.b = input.map(|v| v.into());
        1496  +
            self
        1497  +
        }
        1498  +
        /// Consumes the builder and constructs a [`StructureListMember`](crate::model::StructureListMember).
        1499  +
        pub fn build(self) -> crate::model::StructureListMember {
        1500  +
            self.build_enforcing_all_constraints()
        1501  +
        }
        1502  +
        fn build_enforcing_all_constraints(self) -> crate::model::StructureListMember {
        1503  +
            crate::model::StructureListMember {
        1504  +
                a: self.a,
        1505  +
                b: self.b,
        1506  +
            }
        1507  +
        }
        1508  +
    }
        1509  +
}
        1510  +
pub mod foo_enum_list {
        1511  +
        1512  +
    #[allow(clippy::enum_variant_names)]
        1513  +
    #[derive(Debug, PartialEq)]
        1514  +
    pub enum ConstraintViolation {
        1515  +
        /// Constraint violation error when an element doesn't satisfy its own constraints.
        1516  +
        /// The first component of the tuple is the index in the collection where the
        1517  +
        /// first constraint violation was found.
        1518  +
        #[doc(hidden)]
        1519  +
        Member(usize, crate::model::foo_enum::ConstraintViolation),
        1520  +
    }
        1521  +
        1522  +
    impl ::std::fmt::Display for ConstraintViolation {
        1523  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1524  +
            let message = match self {
        1525  +
                Self::Member(index, failing_member) => format!(
        1526  +
                    "Value at index {index} failed to satisfy constraint. {}",
        1527  +
                    failing_member
        1528  +
                ),
        1529  +
            };
        1530  +
            write!(f, "{message}")
        1531  +
        }
        1532  +
    }
        1533  +
        1534  +
    impl ::std::error::Error for ConstraintViolation {}
        1535  +
    impl ConstraintViolation {
        1536  +
        pub(crate) fn as_validation_exception_field(
        1537  +
            self,
        1538  +
            path: ::std::string::String,
        1539  +
        ) -> crate::model::ValidationExceptionField {
        1540  +
            match self {
        1541  +
                Self::Member(index, member_constraint_violation) => member_constraint_violation
        1542  +
                    .as_validation_exception_field(path + "/" + &index.to_string()),
        1543  +
            }
        1544  +
        }
        1545  +
    }
        1546  +
}