Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example-http0x/rust-server-codegen/src/types.rs

@@ -0,1 +0,5 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
           3  +
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
           4  +
pub use ::aws_smithy_types::Blob;
           5  +
pub use ::aws_smithy_types::DateTime;

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example/rust-server-codegen/Cargo.toml

@@ -1,1 +46,49 @@
   10     10   
codegen-version = "ci"
   11     11   
protocol = "aws.protocols#restJson1"
   12     12   
[dependencies.aws-smithy-http]
   13     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   14     14   
[dependencies.aws-smithy-http-server]
   15     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server"
   16     16   
[dependencies.aws-smithy-json]
   17     17   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
   18     18   
[dependencies.aws-smithy-runtime-api]
   19     19   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
          20  +
features = ["http-1x"]
   20     21   
[dependencies.aws-smithy-types]
   21     22   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          23  +
features = ["http-body-1-x"]
   22     24   
[dependencies.futures-util]
   23     25   
version = "0.3"
   24         -
[dependencies.http]
   25         -
version = "0.2.9"
   26         -
[dependencies.hyper]
   27         -
version = "0.14.26"
          26  +
[dependencies.http-1x]
          27  +
version = "1"
          28  +
package = "http"
          29  +
[dependencies.http-body-util]
          30  +
version = "0.1.3"
   28     31   
[dependencies.mime]
   29     32   
version = "0.3"
   30     33   
[dependencies.pin-project-lite]
   31     34   
version = "0.2"
   32     35   
[dependencies.tower]
   33     36   
version = "0.4"
   34     37   
[dependencies.tracing]
   35     38   
version = "0.1"
   36     39   
[dev-dependencies.hyper]
   37         -
version = "0.14.12"
          40  +
version = "1"
   38     41   
[dev-dependencies.tokio]
   39     42   
version = "1.23.1"
   40     43   
[features]
   41     44   
rt-tokio = ["aws-smithy-types/rt-tokio"]
   42     45   
aws-lambda = ["aws-smithy-http-server/aws-lambda"]
   43     46   
request-id = ["aws-smithy-http-server/request-id"]
   44     47   
default = ["rt-tokio", "request-id"]
   45     48   
   46     49   

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example/rust-server-codegen/src/lib.rs

@@ -19,19 +128,131 @@
   39     39   
)]
   40     40   
//! The [`crate::input`], [`crate::output`], and [`crate::error`]
   41     41   
//! modules provide the types used in each operation.
   42     42   
//!
   43     43   
//! ### Running on Hyper
   44     44   
//!
   45     45   
//! ```rust,no_run
   46     46   
//! # use std::net::SocketAddr;
   47     47   
//! # async fn dummy() {
   48     48   
//! use custom_validation_exception_example::{CustomValidationExample, CustomValidationExampleConfig};
          49  +
//! use custom_validation_exception_example::serve;
          50  +
//! use ::tokio::net::TcpListener;
   49     51   
//!
   50     52   
//! # let app = CustomValidationExample::builder(
   51     53   
//! #     CustomValidationExampleConfig::builder()
   52     54   
//! #         .build()
   53     55   
//! # ).build_unchecked();
   54         -
//! let server = app.into_make_service();
   55     56   
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
   56     57   
//!     .expect("unable to parse the server bind address and port");
   57         -
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
          58  +
//! let listener = TcpListener::bind(bind).await
          59  +
//!     .expect("failed to bind TCP listener");
          60  +
//! serve(listener, app.into_make_service()).await.unwrap();
   58     61   
//! # }
   59     62   
//! ```
   60     63   
//!
   61     64   
//! ### Running on Lambda
   62     65   
//!
   63     66   
//! ```rust,ignore
   64     67   
//! use custom_validation_exception_example::server::routing::LambdaHandler;
   65     68   
//! use custom_validation_exception_example::CustomValidationExample;
   66     69   
//!
   67     70   
//! # async fn dummy() {
   68     71   
//! # let app = CustomValidationExample::builder(
   69     72   
//! #     CustomValidationExampleConfig::builder()
   70     73   
//! #         .build()
   71     74   
//! # ).build_unchecked();
   72     75   
//! let handler = LambdaHandler::new(app);
   73     76   
//! lambda_http::run(handler).await.unwrap();
   74     77   
//! # }
   75     78   
//! ```
   76     79   
//!
   77     80   
//! # Building the CustomValidationExample
   78     81   
//!
   79     82   
//! To construct [`CustomValidationExample`] we use [`CustomValidationExampleBuilder`] returned by [`CustomValidationExample::builder`].
   80     83   
//!
   81     84   
//! ## Plugins
   82     85   
//!
   83     86   
//! The [`CustomValidationExample::builder`] method, returning [`CustomValidationExampleBuilder`],
   84     87   
//! accepts a config object on which plugins can be registered.
   85     88   
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
   86     89   
//!
   87     90   
//! ```rust,no_run
   88     91   
//! # use custom_validation_exception_example::server::plugin::IdentityPlugin as LoggingPlugin;
   89     92   
//! # use custom_validation_exception_example::server::plugin::IdentityPlugin as MetricsPlugin;
   90         -
//! # use ::hyper::Body;
          93  +
//! # use ::hyper::body::Incoming;
   91     94   
//! use custom_validation_exception_example::server::plugin::HttpPlugins;
   92     95   
//! use custom_validation_exception_example::{CustomValidationExample, CustomValidationExampleConfig, CustomValidationExampleBuilder};
   93     96   
//!
   94     97   
//! let http_plugins = HttpPlugins::new()
   95     98   
//!         .push(LoggingPlugin)
   96     99   
//!         .push(MetricsPlugin);
   97    100   
//! let config = CustomValidationExampleConfig::builder().build();
   98         -
//! let builder: CustomValidationExampleBuilder<Body, _, _, _> = CustomValidationExample::builder(config);
         101  +
//! let builder: CustomValidationExampleBuilder<::hyper::body::Incoming, _, _, _> = CustomValidationExample::builder(config);
   99    102   
//! ```
  100    103   
//!
  101    104   
//! Check out [`crate::server::plugin`] to learn more about plugins.
  102    105   
//!
  103    106   
//! ## Handlers
  104    107   
//!
  105    108   
//! [`CustomValidationExampleBuilder`] 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.
  106    109   
//! We call these async functions **handlers**. This is where your application business logic lives.
  107    110   
//!
  108    111   
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
@@ -135,138 +228,235 @@
  155    158   
//! [`CustomValidationExampleBuilder::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.
  156    159   
//!
  157    160   
//! [`CustomValidationExampleBuilder::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.
  158    161   
//! [`CustomValidationExampleBuilder::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!).
  159    162   
//!
  160    163   
//! # Example
  161    164   
//!
  162    165   
//! ```rust,no_run
  163    166   
//! # use std::net::SocketAddr;
  164    167   
//! use custom_validation_exception_example::{CustomValidationExample, CustomValidationExampleConfig};
         168  +
//! use custom_validation_exception_example::serve;
         169  +
//! use ::tokio::net::TcpListener;
  165    170   
//!
  166    171   
//! #[::tokio::main]
  167    172   
//! pub async fn main() {
  168    173   
//!    let config = CustomValidationExampleConfig::builder().build();
  169    174   
//!    let app = CustomValidationExample::builder(config)
  170    175   
//!        .test_operation(test_operation)
  171    176   
//!        .build()
  172    177   
//!        .expect("failed to build an instance of CustomValidationExample");
  173    178   
//!
  174    179   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  175    180   
//!        .expect("unable to parse the server bind address and port");
  176         -
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
         181  +
//!    let listener = TcpListener::bind(bind).await
         182  +
//!        .expect("failed to bind TCP listener");
  177    183   
//!    # let server = async { Ok::<_, ()>(()) };
  178    184   
//!
  179    185   
//!    // Run your service!
  180         -
//!    if let Err(err) = server.await {
         186  +
//!    if let Err(err) = serve(listener, app.into_make_service()).await {
  181    187   
//!        eprintln!("server error: {:?}", err);
  182    188   
//!    }
  183    189   
//! }
  184    190   
//!
  185    191   
//! use custom_validation_exception_example::{input, output, error};
  186    192   
//!
  187    193   
//! async fn test_operation(input: input::TestOperationInput) -> Result<output::TestOperationOutput, error::TestOperationError> {
  188    194   
//!     todo!()
  189    195   
//! }
  190    196   
//!
  191    197   
//! ```
  192    198   
//!
  193         -
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         199  +
//! [`serve`]: crate::serve
         200  +
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  194    201   
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
  195    202   
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
  196    203   
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
  197         -
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  198    204   
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         205  +
pub use crate::server::serve::serve;
  199    206   
pub use crate::service::{
  200    207   
    CustomValidationExample, CustomValidationExampleBuilder, CustomValidationExampleConfig,
  201    208   
    CustomValidationExampleConfigBuilder, MissingOperationsError,
  202    209   
};
  203    210   
  204    211   
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
  205    212   
pub mod server {
  206    213   
    // Re-export all types from the `aws-smithy-http-server` crate.
  207    214   
    pub use ::aws_smithy_http_server::*;
  208    215   
}

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example/rust-server-codegen/src/operation.rs

@@ -11,11 +71,71 @@
   31     31   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   32     32   
    B: 'static,
   33     33   
   34     34   
    B::Data: Send,
   35     35   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   36     36   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   37     37   
{
   38     38   
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
   39     39   
    type Future = TestOperationInputFuture;
   40     40   
   41         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          41  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
   42     42   
        let fut = async move {
   43     43   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
   44     44   
                request.headers(),
   45     45   
                &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
   46     46   
            ) {
   47     47   
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   48     48   
            }
   49     49   
            crate::protocol_serde::shape_test_operation::de_test_operation_http_request(request)
   50     50   
                .await
   51     51   
        };

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example/rust-server-codegen/src/protocol_serde/shape_test_operation.rs

@@ -1,1 +122,125 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_test_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::TestOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::test_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/json"),
   27     30   
            )?;
   28     31   
            input = crate::protocol_serde::shape_test_operation::de_test_operation(
   29     32   
                bytes.as_ref(),
   30     33   
                input,
   31     34   
            )?;
   32     35   
        }
   33     36   
        input.build()?
   34     37   
    })
   35     38   
}
   36     39   
   37     40   
#[allow(clippy::unnecessary_wraps)]
   38     41   
pub fn ser_test_operation_http_response(
   39     42   
    #[allow(unused_variables)] output: crate::output::TestOperationOutput,
   40     43   
) -> std::result::Result<
   41     44   
    ::aws_smithy_http_server::response::Response,
   42     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     46   
> {
   44     47   
    Ok({
   45     48   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          49  +
        let mut builder = ::http_1x::Response::builder();
   47     50   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     51   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          52  +
            ::http_1x::header::CONTENT_TYPE,
   50     53   
            "application/json",
   51     54   
        );
   52     55   
        let http_status: u16 = 200;
   53     56   
        builder = builder.status(http_status);
   54     57   
        let payload = "";
   55     58   
        let content_length = payload.len();
   56     59   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     60   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          61  +
            ::http_1x::header::CONTENT_LENGTH,
   59     62   
            content_length,
   60     63   
        );
   61     64   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   62     65   
        builder.body(body)?
   63     66   
    })
   64     67   
}
   65     68   
   66     69   
#[allow(clippy::unnecessary_wraps)]
   67     70   
pub fn ser_test_operation_http_error(
   68     71   
    error: &crate::error::TestOperationError,
   69     72   
) -> std::result::Result<
   70     73   
    ::aws_smithy_http_server::response::Response,
   71     74   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72     75   
> {
   73     76   
    Ok({
   74     77   
        match error {
   75     78   
            crate::error::TestOperationError::MyCustomValidationException(output) => {
   76     79   
                let payload = crate::protocol_serde::shape_my_custom_validation_exception::ser_my_custom_validation_exception_error(output)?;
   77     80   
                #[allow(unused_mut)]
   78         -
                let mut builder = ::http::Response::builder();
          81  +
                let mut builder = ::http_1x::Response::builder();
   79     82   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80     83   
                    builder,
   81         -
                    ::http::header::CONTENT_TYPE,
          84  +
                    ::http_1x::header::CONTENT_TYPE,
   82     85   
                    "application/json",
   83     86   
                );
   84     87   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85     88   
                    builder,
   86         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          89  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   87     90   
                    "MyCustomValidationException",
   88     91   
                );
   89     92   
                let content_length = payload.len();
   90     93   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91     94   
                    builder,
   92         -
                    ::http::header::CONTENT_LENGTH,
          95  +
                    ::http_1x::header::CONTENT_LENGTH,
   93     96   
                    content_length,
   94     97   
                );
   95     98   
                builder
   96     99   
                    .status(400)
   97    100   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98    101   
            }
   99    102   
        }
  100    103   
    })
  101    104   
}
  102    105   

tmp-codegen-diff/codegen-server-test/custom-validation-exception-example/rust-server-codegen/src/service.rs

@@ -35,35 +96,96 @@
   55     55   
                            <
   56     56   
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
   57     57   
                                as ::aws_smithy_http_server::plugin::Plugin<
   58     58   
                                    CustomValidationExample<L>,
   59     59   
                                    crate::operation_shape::TestOperation,
   60     60   
                                    ModelPl::Output
   61     61   
                                >
   62     62   
                            >::Output
   63     63   
                        >,
   64     64   
   65         -
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
   66         -
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
          65  +
                        HttpPl::Output: ::tower::Service<::http_1x::Request<Body>, Response = ::http_1x::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
          66  +
                        <HttpPl::Output as ::tower::Service<::http_1x::Request<Body>>>::Future: Send + 'static,
   67     67   
   68     68   
                    {
   69     69   
        use ::aws_smithy_http_server::operation::OperationShapeExt;
   70     70   
        use ::aws_smithy_http_server::plugin::Plugin;
   71     71   
        let svc = crate::operation_shape::TestOperation::from_handler(handler);
   72     72   
        let svc = self.model_plugin.apply(svc);
   73     73   
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
   74     74   
            .apply(svc);
   75     75   
        let svc = self.http_plugin.apply(svc);
   76     76   
        self.test_operation_custom(svc)
@@ -102,102 +182,182 @@
  122    122   
                            <
  123    123   
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
  124    124   
                                as ::aws_smithy_http_server::plugin::Plugin<
  125    125   
                                    CustomValidationExample<L>,
  126    126   
                                    crate::operation_shape::TestOperation,
  127    127   
                                    ModelPl::Output
  128    128   
                                >
  129    129   
                            >::Output
  130    130   
                        >,
  131    131   
  132         -
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
  133         -
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
         132  +
                        HttpPl::Output: ::tower::Service<::http_1x::Request<Body>, Response = ::http_1x::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
         133  +
                        <HttpPl::Output as ::tower::Service<::http_1x::Request<Body>>>::Future: Send + 'static,
  134    134   
  135    135   
                    {
  136    136   
        use ::aws_smithy_http_server::operation::OperationShapeExt;
  137    137   
        use ::aws_smithy_http_server::plugin::Plugin;
  138    138   
        let svc = crate::operation_shape::TestOperation::from_service(service);
  139    139   
        let svc = self.model_plugin.apply(svc);
  140    140   
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
  141    141   
            .apply(svc);
  142    142   
        let svc = self.http_plugin.apply(svc);
  143    143   
        self.test_operation_custom(svc)
  144    144   
    }
  145    145   
  146    146   
    /// Sets the [`TestOperation`](crate::operation_shape::TestOperation) to a custom [`Service`](tower::Service).
  147    147   
    /// not constrained by the Smithy contract.
  148    148   
    fn test_operation_custom<S>(mut self, svc: S) -> Self
  149    149   
    where
  150    150   
        S: ::tower::Service<
  151         -
                ::http::Request<Body>,
  152         -
                Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         151  +
                ::http_1x::Request<Body>,
         152  +
                Response = ::http_1x::Response<::aws_smithy_http_server::body::BoxBody>,
  153    153   
                Error = ::std::convert::Infallible,
  154    154   
            > + Clone
  155    155   
            + Send
  156    156   
            + 'static,
  157    157   
        S::Future: Send + 'static,
  158    158   
    {
  159    159   
        self.test_operation = Some(::aws_smithy_http_server::routing::Route::new(svc));
  160    160   
        self
  161    161   
    }
  162    162   
}
@@ -248,248 +308,308 @@
  268    268   
        }
  269    269   
        Ok(())
  270    270   
    }
  271    271   
}
  272    272   
  273    273   
impl std::error::Error for MissingOperationsError {}
  274    274   
  275    275   
mod request_specs {
  276    276   
    pub(super) fn test_operation() -> ::aws_smithy_http_server::routing::request_spec::RequestSpec {
  277    277   
        ::aws_smithy_http_server::routing::request_spec::RequestSpec::new(
  278         -
                    ::http::Method::POST,
         278  +
                    ::http_1x::Method::POST,
  279    279   
                    ::aws_smithy_http_server::routing::request_spec::UriSpec::new(
  280    280   
                        ::aws_smithy_http_server::routing::request_spec::PathAndQuerySpec::new(
  281    281   
                            ::aws_smithy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
  282    282   
    ::aws_smithy_http_server::routing::request_spec::PathSegment::Literal(String::from("test")),
  283    283   
]),
  284    284   
                            ::aws_smithy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
  285    285   
])
  286    286   
                        )
  287    287   
                    ),
  288    288   
                )
@@ -405,405 +466,466 @@
  425    425   
    ) -> CustomValidationExample<
  426    426   
        ::aws_smithy_http_server::routing::RoutingService<
  427    427   
            ::aws_smithy_http_server::protocol::rest::router::RestRouter<
  428    428   
                ::aws_smithy_http_server::routing::Route<B>,
  429    429   
            >,
  430    430   
            ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  431    431   
        >,
  432    432   
    >
  433    433   
    where
  434    434   
        S: ::tower::Service<
  435         -
            ::http::Request<B>,
  436         -
            Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         435  +
            ::http_1x::Request<B>,
         436  +
            Response = ::http_1x::Response<::aws_smithy_http_server::body::BoxBody>,
  437    437   
            Error = std::convert::Infallible,
  438    438   
        >,
  439    439   
        S: Clone + Send + 'static,
  440    440   
        S::Future: Send + 'static,
  441    441   
    {
  442    442   
        self.layer(&::tower::layer::layer_fn(
  443    443   
            ::aws_smithy_http_server::routing::Route::new,
  444    444   
        ))
  445    445   
    }
  446    446   
}

tmp-codegen-diff/codegen-server-test/ebs-http0x/rust-server-codegen/Cargo.toml

@@ -0,1 +0,54 @@
           1  +
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
[package]
           3  +
name = "ebs-http0x"
           4  +
version = "0.0.1"
           5  +
authors = ["protocoltest@example.com"]
           6  +
description = "test"
           7  +
edition = "2021"
           8  +
           9  +
[package.metadata.smithy]
          10  +
codegen-version = "ci"
          11  +
protocol = "aws.protocols#restJson1"
          12  +
[dependencies.aws-smithy-json]
          13  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
          14  +
[dependencies.aws-smithy-legacy-http]
          15  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http"
          16  +
[dependencies.aws-smithy-legacy-http-server]
          17  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http-server"
          18  +
[dependencies.aws-smithy-runtime-api]
          19  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
          20  +
features = ["http-02x"]
          21  +
[dependencies.aws-smithy-types]
          22  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          23  +
features = ["http-body-0-4-x"]
          24  +
[dependencies.form_urlencoded]
          25  +
version = "1"
          26  +
[dependencies.futures-util]
          27  +
version = "0.3"
          28  +
[dependencies.http]
          29  +
version = "0.2.9"
          30  +
[dependencies.hyper]
          31  +
version = "0.14.26"
          32  +
[dependencies.mime]
          33  +
version = "0.3"
          34  +
[dependencies.nom]
          35  +
version = "7"
          36  +
[dependencies.percent-encoding]
          37  +
version = "2.0.0"
          38  +
[dependencies.pin-project-lite]
          39  +
version = "0.2"
          40  +
[dependencies.regex]
          41  +
version = "1.5.5"
          42  +
[dependencies.tower]
          43  +
version = "0.4"
          44  +
[dependencies.tracing]
          45  +
version = "0.1"
          46  +
[dev-dependencies.tokio]
          47  +
version = "1.23.1"
          48  +
[features]
          49  +
aws-lambda = ["aws-smithy-legacy-http-server/aws-lambda"]
          50  +
request-id = ["aws-smithy-legacy-http-server/request-id"]
          51  +
rt-tokio = ["aws-smithy-types/http-body-1-x", "aws-smithy-types/rt-tokio"]
          52  +
default = ["request-id", "rt-tokio"]
          53  +
          54  +

tmp-codegen-diff/codegen-server-test/ebs-http0x/rust-server-codegen/src/constrained.rs

@@ -0,1 +0,38 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
pub(crate) mod tags_constrained {
           4  +
           5  +
    #[derive(Debug, Clone)]
           6  +
    pub(crate) struct TagsConstrained(pub(crate) std::vec::Vec<crate::model::Tag>);
           7  +
           8  +
    impl crate::constrained::Constrained for TagsConstrained {
           9  +
        type Unconstrained = crate::unconstrained::tags_unconstrained::TagsUnconstrained;
          10  +
    }
          11  +
    impl ::std::convert::From<::std::vec::Vec<crate::model::Tag>> for TagsConstrained {
          12  +
        fn from(v: ::std::vec::Vec<crate::model::Tag>) -> Self {
          13  +
            Self(v)
          14  +
        }
          15  +
    }
          16  +
          17  +
    impl ::std::convert::From<TagsConstrained> for ::std::vec::Vec<crate::model::Tag> {
          18  +
        fn from(v: TagsConstrained) -> Self {
          19  +
            v.0
          20  +
        }
          21  +
    }
          22  +
}
          23  +
          24  +
/*
          25  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
          26  +
 * SPDX-License-Identifier: Apache-2.0
          27  +
 */
          28  +
          29  +
pub(crate) trait Constrained {
          30  +
    type Unconstrained;
          31  +
}
          32  +
          33  +
#[derive(Debug, Clone)]
          34  +
#[allow(dead_code)]
          35  +
pub(crate) enum MaybeConstrained<T: Constrained> {
          36  +
    Constrained(T),
          37  +
    Unconstrained(T::Unconstrained),
          38  +
}

tmp-codegen-diff/codegen-server-test/ebs-http0x/rust-server-codegen/src/error.rs

@@ -0,1 +0,1488 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Error type for the `StartSnapshot` operation.
           3  +
/// Each variant represents an error that can occur for the `StartSnapshot` operation.
           4  +
#[derive(::std::fmt::Debug)]
           5  +
pub enum StartSnapshotError {
           6  +
    /// <p>An internal error has occurred.</p>
           7  +
    InternalServerException(crate::error::InternalServerException),
           8  +
    /// <p>The specified resource does not exist.</p>
           9  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
          10  +
    /// <p>You do not have sufficient access to perform this action.</p>
          11  +
    AccessDeniedException(crate::error::AccessDeniedException),
          12  +
    /// <p>The request uses the same client token as a previous, but non-identical request.</p>
          13  +
    ConflictException(crate::error::ConflictException),
          14  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
          15  +
    RequestThrottledException(crate::error::RequestThrottledException),
          16  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
          17  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
          18  +
    /// <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
          19  +
    ConcurrentLimitExceededException(crate::error::ConcurrentLimitExceededException),
          20  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          21  +
    ValidationException(crate::error::ValidationException),
          22  +
}
          23  +
impl ::std::fmt::Display for StartSnapshotError {
          24  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          25  +
        match &self {
          26  +
            StartSnapshotError::InternalServerException(_inner) => _inner.fmt(f),
          27  +
            StartSnapshotError::ResourceNotFoundException(_inner) => _inner.fmt(f),
          28  +
            StartSnapshotError::AccessDeniedException(_inner) => _inner.fmt(f),
          29  +
            StartSnapshotError::ConflictException(_inner) => _inner.fmt(f),
          30  +
            StartSnapshotError::RequestThrottledException(_inner) => _inner.fmt(f),
          31  +
            StartSnapshotError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
          32  +
            StartSnapshotError::ConcurrentLimitExceededException(_inner) => _inner.fmt(f),
          33  +
            StartSnapshotError::ValidationException(_inner) => _inner.fmt(f),
          34  +
        }
          35  +
    }
          36  +
}
          37  +
impl StartSnapshotError {
          38  +
    /// Returns `true` if the error kind is `StartSnapshotError::InternalServerException`.
          39  +
    pub fn is_internal_server_exception(&self) -> bool {
          40  +
        matches!(&self, StartSnapshotError::InternalServerException(_))
          41  +
    }
          42  +
    /// Returns `true` if the error kind is `StartSnapshotError::ResourceNotFoundException`.
          43  +
    pub fn is_resource_not_found_exception(&self) -> bool {
          44  +
        matches!(&self, StartSnapshotError::ResourceNotFoundException(_))
          45  +
    }
          46  +
    /// Returns `true` if the error kind is `StartSnapshotError::AccessDeniedException`.
          47  +
    pub fn is_access_denied_exception(&self) -> bool {
          48  +
        matches!(&self, StartSnapshotError::AccessDeniedException(_))
          49  +
    }
          50  +
    /// Returns `true` if the error kind is `StartSnapshotError::ConflictException`.
          51  +
    pub fn is_conflict_exception(&self) -> bool {
          52  +
        matches!(&self, StartSnapshotError::ConflictException(_))
          53  +
    }
          54  +
    /// Returns `true` if the error kind is `StartSnapshotError::RequestThrottledException`.
          55  +
    pub fn is_request_throttled_exception(&self) -> bool {
          56  +
        matches!(&self, StartSnapshotError::RequestThrottledException(_))
          57  +
    }
          58  +
    /// Returns `true` if the error kind is `StartSnapshotError::ServiceQuotaExceededException`.
          59  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
          60  +
        matches!(&self, StartSnapshotError::ServiceQuotaExceededException(_))
          61  +
    }
          62  +
    /// Returns `true` if the error kind is `StartSnapshotError::ConcurrentLimitExceededException`.
          63  +
    pub fn is_concurrent_limit_exceeded_exception(&self) -> bool {
          64  +
        matches!(
          65  +
            &self,
          66  +
            StartSnapshotError::ConcurrentLimitExceededException(_)
          67  +
        )
          68  +
    }
          69  +
    /// Returns `true` if the error kind is `StartSnapshotError::ValidationException`.
          70  +
    pub fn is_validation_exception(&self) -> bool {
          71  +
        matches!(&self, StartSnapshotError::ValidationException(_))
          72  +
    }
          73  +
    /// Returns the error name string by matching the correct variant.
          74  +
    pub fn name(&self) -> &'static str {
          75  +
        match &self {
          76  +
            StartSnapshotError::InternalServerException(_inner) => _inner.name(),
          77  +
            StartSnapshotError::ResourceNotFoundException(_inner) => _inner.name(),
          78  +
            StartSnapshotError::AccessDeniedException(_inner) => _inner.name(),
          79  +
            StartSnapshotError::ConflictException(_inner) => _inner.name(),
          80  +
            StartSnapshotError::RequestThrottledException(_inner) => _inner.name(),
          81  +
            StartSnapshotError::ServiceQuotaExceededException(_inner) => _inner.name(),
          82  +
            StartSnapshotError::ConcurrentLimitExceededException(_inner) => _inner.name(),
          83  +
            StartSnapshotError::ValidationException(_inner) => _inner.name(),
          84  +
        }
          85  +
    }
          86  +
}
          87  +
impl ::std::error::Error for StartSnapshotError {
          88  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          89  +
        match &self {
          90  +
            StartSnapshotError::InternalServerException(_inner) => Some(_inner),
          91  +
            StartSnapshotError::ResourceNotFoundException(_inner) => Some(_inner),
          92  +
            StartSnapshotError::AccessDeniedException(_inner) => Some(_inner),
          93  +
            StartSnapshotError::ConflictException(_inner) => Some(_inner),
          94  +
            StartSnapshotError::RequestThrottledException(_inner) => Some(_inner),
          95  +
            StartSnapshotError::ServiceQuotaExceededException(_inner) => Some(_inner),
          96  +
            StartSnapshotError::ConcurrentLimitExceededException(_inner) => Some(_inner),
          97  +
            StartSnapshotError::ValidationException(_inner) => Some(_inner),
          98  +
        }
          99  +
    }
         100  +
}
         101  +
impl ::std::convert::From<crate::error::InternalServerException>
         102  +
    for crate::error::StartSnapshotError
         103  +
{
         104  +
    fn from(variant: crate::error::InternalServerException) -> crate::error::StartSnapshotError {
         105  +
        Self::InternalServerException(variant)
         106  +
    }
         107  +
}
         108  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
         109  +
    for crate::error::StartSnapshotError
         110  +
{
         111  +
    fn from(variant: crate::error::ResourceNotFoundException) -> crate::error::StartSnapshotError {
         112  +
        Self::ResourceNotFoundException(variant)
         113  +
    }
         114  +
}
         115  +
impl ::std::convert::From<crate::error::AccessDeniedException>
         116  +
    for crate::error::StartSnapshotError
         117  +
{
         118  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::StartSnapshotError {
         119  +
        Self::AccessDeniedException(variant)
         120  +
    }
         121  +
}
         122  +
impl ::std::convert::From<crate::error::ConflictException> for crate::error::StartSnapshotError {
         123  +
    fn from(variant: crate::error::ConflictException) -> crate::error::StartSnapshotError {
         124  +
        Self::ConflictException(variant)
         125  +
    }
         126  +
}
         127  +
impl ::std::convert::From<crate::error::RequestThrottledException>
         128  +
    for crate::error::StartSnapshotError
         129  +
{
         130  +
    fn from(variant: crate::error::RequestThrottledException) -> crate::error::StartSnapshotError {
         131  +
        Self::RequestThrottledException(variant)
         132  +
    }
         133  +
}
         134  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
         135  +
    for crate::error::StartSnapshotError
         136  +
{
         137  +
    fn from(
         138  +
        variant: crate::error::ServiceQuotaExceededException,
         139  +
    ) -> crate::error::StartSnapshotError {
         140  +
        Self::ServiceQuotaExceededException(variant)
         141  +
    }
         142  +
}
         143  +
impl ::std::convert::From<crate::error::ConcurrentLimitExceededException>
         144  +
    for crate::error::StartSnapshotError
         145  +
{
         146  +
    fn from(
         147  +
        variant: crate::error::ConcurrentLimitExceededException,
         148  +
    ) -> crate::error::StartSnapshotError {
         149  +
        Self::ConcurrentLimitExceededException(variant)
         150  +
    }
         151  +
}
         152  +
impl ::std::convert::From<crate::error::ValidationException> for crate::error::StartSnapshotError {
         153  +
    fn from(variant: crate::error::ValidationException) -> crate::error::StartSnapshotError {
         154  +
        Self::ValidationException(variant)
         155  +
    }
         156  +
}
         157  +
         158  +
/// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         159  +
#[derive(
         160  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         161  +
)]
         162  +
pub struct ValidationException {
         163  +
    /// A summary of the validation failure.
         164  +
    pub message: ::std::string::String,
         165  +
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         166  +
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         167  +
}
         168  +
impl ValidationException {
         169  +
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         170  +
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
         171  +
        self.field_list.as_deref()
         172  +
    }
         173  +
}
         174  +
impl ValidationException {
         175  +
    /// Returns the error message.
         176  +
    pub fn message(&self) -> &str {
         177  +
        &self.message
         178  +
    }
         179  +
    #[doc(hidden)]
         180  +
    /// Returns the error name.
         181  +
    pub fn name(&self) -> &'static str {
         182  +
        "ValidationException"
         183  +
    }
         184  +
}
         185  +
impl ::std::fmt::Display for ValidationException {
         186  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         187  +
        ::std::write!(f, "ValidationException")?;
         188  +
        {
         189  +
            ::std::write!(f, ": {}", &self.message)?;
         190  +
        }
         191  +
        Ok(())
         192  +
    }
         193  +
}
         194  +
impl ::std::error::Error for ValidationException {}
         195  +
impl ValidationException {
         196  +
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         197  +
    pub fn builder() -> crate::error::validation_exception::Builder {
         198  +
        crate::error::validation_exception::Builder::default()
         199  +
    }
         200  +
}
         201  +
         202  +
/// <p>You have reached the limit for concurrent API requests. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapi-performance">Optimizing performance of the EBS direct APIs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
         203  +
#[derive(
         204  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         205  +
)]
         206  +
pub struct ConcurrentLimitExceededException {
         207  +
    #[allow(missing_docs)] // documentation missing in model
         208  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         209  +
}
         210  +
impl ConcurrentLimitExceededException {
         211  +
    /// Returns the error message.
         212  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         213  +
        self.message.as_ref()
         214  +
    }
         215  +
    #[doc(hidden)]
         216  +
    /// Returns the error name.
         217  +
    pub fn name(&self) -> &'static str {
         218  +
        "ConcurrentLimitExceededException"
         219  +
    }
         220  +
}
         221  +
impl ::std::fmt::Display for ConcurrentLimitExceededException {
         222  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         223  +
        ::std::write!(f, "ConcurrentLimitExceededException")?;
         224  +
        if let ::std::option::Option::Some(inner_1) = &self.message {
         225  +
            {
         226  +
                ::std::write!(f, ": {inner_1}")?;
         227  +
            }
         228  +
        }
         229  +
        Ok(())
         230  +
    }
         231  +
}
         232  +
impl ::std::error::Error for ConcurrentLimitExceededException {}
         233  +
impl ConcurrentLimitExceededException {
         234  +
    /// Creates a new builder-style object to manufacture [`ConcurrentLimitExceededException`](crate::error::ConcurrentLimitExceededException).
         235  +
    pub fn builder() -> crate::error::concurrent_limit_exceeded_exception::Builder {
         236  +
        crate::error::concurrent_limit_exceeded_exception::Builder::default()
         237  +
    }
         238  +
}
         239  +
         240  +
/// <p>Your current service quotas do not allow you to perform this action.</p>
         241  +
#[derive(
         242  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         243  +
)]
         244  +
pub struct ServiceQuotaExceededException {
         245  +
    /// <p>The reason for the exception.</p>
         246  +
    pub reason: ::std::option::Option<crate::model::ServiceQuotaExceededExceptionReason>,
         247  +
    #[allow(missing_docs)] // documentation missing in model
         248  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         249  +
}
         250  +
impl ServiceQuotaExceededException {
         251  +
    /// <p>The reason for the exception.</p>
         252  +
    pub fn reason(
         253  +
        &self,
         254  +
    ) -> ::std::option::Option<&crate::model::ServiceQuotaExceededExceptionReason> {
         255  +
        self.reason.as_ref()
         256  +
    }
         257  +
}
         258  +
impl ServiceQuotaExceededException {
         259  +
    /// Returns the error message.
         260  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         261  +
        self.message.as_ref()
         262  +
    }
         263  +
    #[doc(hidden)]
         264  +
    /// Returns the error name.
         265  +
    pub fn name(&self) -> &'static str {
         266  +
        "ServiceQuotaExceededException"
         267  +
    }
         268  +
}
         269  +
impl ::std::fmt::Display for ServiceQuotaExceededException {
         270  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         271  +
        ::std::write!(f, "ServiceQuotaExceededException")?;
         272  +
        if let ::std::option::Option::Some(inner_2) = &self.message {
         273  +
            {
         274  +
                ::std::write!(f, ": {inner_2}")?;
         275  +
            }
         276  +
        }
         277  +
        Ok(())
         278  +
    }
         279  +
}
         280  +
impl ::std::error::Error for ServiceQuotaExceededException {}
         281  +
impl ServiceQuotaExceededException {
         282  +
    /// Creates a new builder-style object to manufacture [`ServiceQuotaExceededException`](crate::error::ServiceQuotaExceededException).
         283  +
    pub fn builder() -> crate::error::service_quota_exceeded_exception::Builder {
         284  +
        crate::error::service_quota_exceeded_exception::Builder::default()
         285  +
    }
         286  +
}
         287  +
         288  +
/// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
         289  +
#[derive(
         290  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         291  +
)]
         292  +
pub struct RequestThrottledException {
         293  +
    #[allow(missing_docs)] // documentation missing in model
         294  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         295  +
    /// <p>The reason for the exception.</p>
         296  +
    pub reason: ::std::option::Option<crate::model::RequestThrottledExceptionReason>,
         297  +
}
         298  +
impl RequestThrottledException {
         299  +
    /// <p>The reason for the exception.</p>
         300  +
    pub fn reason(&self) -> ::std::option::Option<&crate::model::RequestThrottledExceptionReason> {
         301  +
        self.reason.as_ref()
         302  +
    }
         303  +
}
         304  +
impl RequestThrottledException {
         305  +
    /// Returns the error message.
         306  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         307  +
        self.message.as_ref()
         308  +
    }
         309  +
    #[doc(hidden)]
         310  +
    /// Returns the error name.
         311  +
    pub fn name(&self) -> &'static str {
         312  +
        "RequestThrottledException"
         313  +
    }
         314  +
}
         315  +
impl ::std::fmt::Display for RequestThrottledException {
         316  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         317  +
        ::std::write!(f, "RequestThrottledException")?;
         318  +
        if let ::std::option::Option::Some(inner_3) = &self.message {
         319  +
            {
         320  +
                ::std::write!(f, ": {inner_3}")?;
         321  +
            }
         322  +
        }
         323  +
        Ok(())
         324  +
    }
         325  +
}
         326  +
impl ::std::error::Error for RequestThrottledException {}
         327  +
impl RequestThrottledException {
         328  +
    /// Creates a new builder-style object to manufacture [`RequestThrottledException`](crate::error::RequestThrottledException).
         329  +
    pub fn builder() -> crate::error::request_throttled_exception::Builder {
         330  +
        crate::error::request_throttled_exception::Builder::default()
         331  +
    }
         332  +
}
         333  +
         334  +
/// <p>The request uses the same client token as a previous, but non-identical request.</p>
         335  +
#[derive(
         336  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         337  +
)]
         338  +
pub struct ConflictException {
         339  +
    #[allow(missing_docs)] // documentation missing in model
         340  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         341  +
}
         342  +
impl ConflictException {
         343  +
    /// Returns the error message.
         344  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         345  +
        self.message.as_ref()
         346  +
    }
         347  +
    #[doc(hidden)]
         348  +
    /// Returns the error name.
         349  +
    pub fn name(&self) -> &'static str {
         350  +
        "ConflictException"
         351  +
    }
         352  +
}
         353  +
impl ::std::fmt::Display for ConflictException {
         354  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         355  +
        ::std::write!(f, "ConflictException")?;
         356  +
        if let ::std::option::Option::Some(inner_4) = &self.message {
         357  +
            {
         358  +
                ::std::write!(f, ": {inner_4}")?;
         359  +
            }
         360  +
        }
         361  +
        Ok(())
         362  +
    }
         363  +
}
         364  +
impl ::std::error::Error for ConflictException {}
         365  +
impl ConflictException {
         366  +
    /// Creates a new builder-style object to manufacture [`ConflictException`](crate::error::ConflictException).
         367  +
    pub fn builder() -> crate::error::conflict_exception::Builder {
         368  +
        crate::error::conflict_exception::Builder::default()
         369  +
    }
         370  +
}
         371  +
         372  +
/// <p>You do not have sufficient access to perform this action.</p>
         373  +
#[derive(
         374  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         375  +
)]
         376  +
pub struct AccessDeniedException {
         377  +
    #[allow(missing_docs)] // documentation missing in model
         378  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         379  +
    /// <p>The reason for the exception.</p>
         380  +
    pub reason: crate::model::AccessDeniedExceptionReason,
         381  +
}
         382  +
impl AccessDeniedException {
         383  +
    /// <p>The reason for the exception.</p>
         384  +
    pub fn reason(&self) -> &crate::model::AccessDeniedExceptionReason {
         385  +
        &self.reason
         386  +
    }
         387  +
}
         388  +
impl AccessDeniedException {
         389  +
    /// Returns the error message.
         390  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         391  +
        self.message.as_ref()
         392  +
    }
         393  +
    #[doc(hidden)]
         394  +
    /// Returns the error name.
         395  +
    pub fn name(&self) -> &'static str {
         396  +
        "AccessDeniedException"
         397  +
    }
         398  +
}
         399  +
impl ::std::fmt::Display for AccessDeniedException {
         400  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         401  +
        ::std::write!(f, "AccessDeniedException")?;
         402  +
        if let ::std::option::Option::Some(inner_5) = &self.message {
         403  +
            {
         404  +
                ::std::write!(f, ": {inner_5}")?;
         405  +
            }
         406  +
        }
         407  +
        Ok(())
         408  +
    }
         409  +
}
         410  +
impl ::std::error::Error for AccessDeniedException {}
         411  +
impl AccessDeniedException {
         412  +
    /// Creates a new builder-style object to manufacture [`AccessDeniedException`](crate::error::AccessDeniedException).
         413  +
    pub fn builder() -> crate::error::access_denied_exception::Builder {
         414  +
        crate::error::access_denied_exception::Builder::default()
         415  +
    }
         416  +
}
         417  +
         418  +
/// <p>The specified resource does not exist.</p>
         419  +
#[derive(
         420  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         421  +
)]
         422  +
pub struct ResourceNotFoundException {
         423  +
    #[allow(missing_docs)] // documentation missing in model
         424  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         425  +
    /// <p>The reason for the exception.</p>
         426  +
    pub reason: ::std::option::Option<crate::model::ResourceNotFoundExceptionReason>,
         427  +
}
         428  +
impl ResourceNotFoundException {
         429  +
    /// <p>The reason for the exception.</p>
         430  +
    pub fn reason(&self) -> ::std::option::Option<&crate::model::ResourceNotFoundExceptionReason> {
         431  +
        self.reason.as_ref()
         432  +
    }
         433  +
}
         434  +
impl ResourceNotFoundException {
         435  +
    /// Returns the error message.
         436  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         437  +
        self.message.as_ref()
         438  +
    }
         439  +
    #[doc(hidden)]
         440  +
    /// Returns the error name.
         441  +
    pub fn name(&self) -> &'static str {
         442  +
        "ResourceNotFoundException"
         443  +
    }
         444  +
}
         445  +
impl ::std::fmt::Display for ResourceNotFoundException {
         446  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         447  +
        ::std::write!(f, "ResourceNotFoundException")?;
         448  +
        if let ::std::option::Option::Some(inner_6) = &self.message {
         449  +
            {
         450  +
                ::std::write!(f, ": {inner_6}")?;
         451  +
            }
         452  +
        }
         453  +
        Ok(())
         454  +
    }
         455  +
}
         456  +
impl ::std::error::Error for ResourceNotFoundException {}
         457  +
impl ResourceNotFoundException {
         458  +
    /// Creates a new builder-style object to manufacture [`ResourceNotFoundException`](crate::error::ResourceNotFoundException).
         459  +
    pub fn builder() -> crate::error::resource_not_found_exception::Builder {
         460  +
        crate::error::resource_not_found_exception::Builder::default()
         461  +
    }
         462  +
}
         463  +
         464  +
/// <p>An internal error has occurred.</p>
         465  +
#[derive(
         466  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         467  +
)]
         468  +
pub struct InternalServerException {
         469  +
    #[allow(missing_docs)] // documentation missing in model
         470  +
    pub message: ::std::option::Option<crate::model::ErrorMessage>,
         471  +
}
         472  +
impl InternalServerException {
         473  +
    /// Returns the error message.
         474  +
    pub fn message(&self) -> Option<&crate::model::ErrorMessage> {
         475  +
        self.message.as_ref()
         476  +
    }
         477  +
    #[doc(hidden)]
         478  +
    /// Returns the error name.
         479  +
    pub fn name(&self) -> &'static str {
         480  +
        "InternalServerException"
         481  +
    }
         482  +
}
         483  +
impl ::std::fmt::Display for InternalServerException {
         484  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         485  +
        ::std::write!(f, "InternalServerException")?;
         486  +
        if let ::std::option::Option::Some(inner_7) = &self.message {
         487  +
            {
         488  +
                ::std::write!(f, ": {inner_7}")?;
         489  +
            }
         490  +
        }
         491  +
        Ok(())
         492  +
    }
         493  +
}
         494  +
impl ::std::error::Error for InternalServerException {}
         495  +
impl InternalServerException {
         496  +
    /// Creates a new builder-style object to manufacture [`InternalServerException`](crate::error::InternalServerException).
         497  +
    pub fn builder() -> crate::error::internal_server_exception::Builder {
         498  +
        crate::error::internal_server_exception::Builder::default()
         499  +
    }
         500  +
}
         501  +
         502  +
/// Error type for the `PutSnapshotBlock` operation.
         503  +
/// Each variant represents an error that can occur for the `PutSnapshotBlock` operation.
         504  +
#[derive(::std::fmt::Debug)]
         505  +
pub enum PutSnapshotBlockError {
         506  +
    /// <p>An internal error has occurred.</p>
         507  +
    InternalServerException(crate::error::InternalServerException),
         508  +
    /// <p>The specified resource does not exist.</p>
         509  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
         510  +
    /// <p>You do not have sufficient access to perform this action.</p>
         511  +
    AccessDeniedException(crate::error::AccessDeniedException),
         512  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
         513  +
    RequestThrottledException(crate::error::RequestThrottledException),
         514  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
         515  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
         516  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         517  +
    ValidationException(crate::error::ValidationException),
         518  +
}
         519  +
impl ::std::fmt::Display for PutSnapshotBlockError {
         520  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         521  +
        match &self {
         522  +
            PutSnapshotBlockError::InternalServerException(_inner) => _inner.fmt(f),
         523  +
            PutSnapshotBlockError::ResourceNotFoundException(_inner) => _inner.fmt(f),
         524  +
            PutSnapshotBlockError::AccessDeniedException(_inner) => _inner.fmt(f),
         525  +
            PutSnapshotBlockError::RequestThrottledException(_inner) => _inner.fmt(f),
         526  +
            PutSnapshotBlockError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
         527  +
            PutSnapshotBlockError::ValidationException(_inner) => _inner.fmt(f),
         528  +
        }
         529  +
    }
         530  +
}
         531  +
impl PutSnapshotBlockError {
         532  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::InternalServerException`.
         533  +
    pub fn is_internal_server_exception(&self) -> bool {
         534  +
        matches!(&self, PutSnapshotBlockError::InternalServerException(_))
         535  +
    }
         536  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::ResourceNotFoundException`.
         537  +
    pub fn is_resource_not_found_exception(&self) -> bool {
         538  +
        matches!(&self, PutSnapshotBlockError::ResourceNotFoundException(_))
         539  +
    }
         540  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::AccessDeniedException`.
         541  +
    pub fn is_access_denied_exception(&self) -> bool {
         542  +
        matches!(&self, PutSnapshotBlockError::AccessDeniedException(_))
         543  +
    }
         544  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::RequestThrottledException`.
         545  +
    pub fn is_request_throttled_exception(&self) -> bool {
         546  +
        matches!(&self, PutSnapshotBlockError::RequestThrottledException(_))
         547  +
    }
         548  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::ServiceQuotaExceededException`.
         549  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
         550  +
        matches!(
         551  +
            &self,
         552  +
            PutSnapshotBlockError::ServiceQuotaExceededException(_)
         553  +
        )
         554  +
    }
         555  +
    /// Returns `true` if the error kind is `PutSnapshotBlockError::ValidationException`.
         556  +
    pub fn is_validation_exception(&self) -> bool {
         557  +
        matches!(&self, PutSnapshotBlockError::ValidationException(_))
         558  +
    }
         559  +
    /// Returns the error name string by matching the correct variant.
         560  +
    pub fn name(&self) -> &'static str {
         561  +
        match &self {
         562  +
            PutSnapshotBlockError::InternalServerException(_inner) => _inner.name(),
         563  +
            PutSnapshotBlockError::ResourceNotFoundException(_inner) => _inner.name(),
         564  +
            PutSnapshotBlockError::AccessDeniedException(_inner) => _inner.name(),
         565  +
            PutSnapshotBlockError::RequestThrottledException(_inner) => _inner.name(),
         566  +
            PutSnapshotBlockError::ServiceQuotaExceededException(_inner) => _inner.name(),
         567  +
            PutSnapshotBlockError::ValidationException(_inner) => _inner.name(),
         568  +
        }
         569  +
    }
         570  +
}
         571  +
impl ::std::error::Error for PutSnapshotBlockError {
         572  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         573  +
        match &self {
         574  +
            PutSnapshotBlockError::InternalServerException(_inner) => Some(_inner),
         575  +
            PutSnapshotBlockError::ResourceNotFoundException(_inner) => Some(_inner),
         576  +
            PutSnapshotBlockError::AccessDeniedException(_inner) => Some(_inner),
         577  +
            PutSnapshotBlockError::RequestThrottledException(_inner) => Some(_inner),
         578  +
            PutSnapshotBlockError::ServiceQuotaExceededException(_inner) => Some(_inner),
         579  +
            PutSnapshotBlockError::ValidationException(_inner) => Some(_inner),
         580  +
        }
         581  +
    }
         582  +
}
         583  +
impl ::std::convert::From<crate::error::InternalServerException>
         584  +
    for crate::error::PutSnapshotBlockError
         585  +
{
         586  +
    fn from(variant: crate::error::InternalServerException) -> crate::error::PutSnapshotBlockError {
         587  +
        Self::InternalServerException(variant)
         588  +
    }
         589  +
}
         590  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
         591  +
    for crate::error::PutSnapshotBlockError
         592  +
{
         593  +
    fn from(
         594  +
        variant: crate::error::ResourceNotFoundException,
         595  +
    ) -> crate::error::PutSnapshotBlockError {
         596  +
        Self::ResourceNotFoundException(variant)
         597  +
    }
         598  +
}
         599  +
impl ::std::convert::From<crate::error::AccessDeniedException>
         600  +
    for crate::error::PutSnapshotBlockError
         601  +
{
         602  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::PutSnapshotBlockError {
         603  +
        Self::AccessDeniedException(variant)
         604  +
    }
         605  +
}
         606  +
impl ::std::convert::From<crate::error::RequestThrottledException>
         607  +
    for crate::error::PutSnapshotBlockError
         608  +
{
         609  +
    fn from(
         610  +
        variant: crate::error::RequestThrottledException,
         611  +
    ) -> crate::error::PutSnapshotBlockError {
         612  +
        Self::RequestThrottledException(variant)
         613  +
    }
         614  +
}
         615  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
         616  +
    for crate::error::PutSnapshotBlockError
         617  +
{
         618  +
    fn from(
         619  +
        variant: crate::error::ServiceQuotaExceededException,
         620  +
    ) -> crate::error::PutSnapshotBlockError {
         621  +
        Self::ServiceQuotaExceededException(variant)
         622  +
    }
         623  +
}
         624  +
impl ::std::convert::From<crate::error::ValidationException>
         625  +
    for crate::error::PutSnapshotBlockError
         626  +
{
         627  +
    fn from(variant: crate::error::ValidationException) -> crate::error::PutSnapshotBlockError {
         628  +
        Self::ValidationException(variant)
         629  +
    }
         630  +
}
         631  +
         632  +
/// Error type for the `ListSnapshotBlocks` operation.
         633  +
/// Each variant represents an error that can occur for the `ListSnapshotBlocks` operation.
         634  +
#[derive(::std::fmt::Debug)]
         635  +
pub enum ListSnapshotBlocksError {
         636  +
    /// <p>An internal error has occurred.</p>
         637  +
    InternalServerException(crate::error::InternalServerException),
         638  +
    /// <p>The specified resource does not exist.</p>
         639  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
         640  +
    /// <p>You do not have sufficient access to perform this action.</p>
         641  +
    AccessDeniedException(crate::error::AccessDeniedException),
         642  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
         643  +
    RequestThrottledException(crate::error::RequestThrottledException),
         644  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
         645  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
         646  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         647  +
    ValidationException(crate::error::ValidationException),
         648  +
}
         649  +
impl ::std::fmt::Display for ListSnapshotBlocksError {
         650  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         651  +
        match &self {
         652  +
            ListSnapshotBlocksError::InternalServerException(_inner) => _inner.fmt(f),
         653  +
            ListSnapshotBlocksError::ResourceNotFoundException(_inner) => _inner.fmt(f),
         654  +
            ListSnapshotBlocksError::AccessDeniedException(_inner) => _inner.fmt(f),
         655  +
            ListSnapshotBlocksError::RequestThrottledException(_inner) => _inner.fmt(f),
         656  +
            ListSnapshotBlocksError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
         657  +
            ListSnapshotBlocksError::ValidationException(_inner) => _inner.fmt(f),
         658  +
        }
         659  +
    }
         660  +
}
         661  +
impl ListSnapshotBlocksError {
         662  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::InternalServerException`.
         663  +
    pub fn is_internal_server_exception(&self) -> bool {
         664  +
        matches!(&self, ListSnapshotBlocksError::InternalServerException(_))
         665  +
    }
         666  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ResourceNotFoundException`.
         667  +
    pub fn is_resource_not_found_exception(&self) -> bool {
         668  +
        matches!(&self, ListSnapshotBlocksError::ResourceNotFoundException(_))
         669  +
    }
         670  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::AccessDeniedException`.
         671  +
    pub fn is_access_denied_exception(&self) -> bool {
         672  +
        matches!(&self, ListSnapshotBlocksError::AccessDeniedException(_))
         673  +
    }
         674  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::RequestThrottledException`.
         675  +
    pub fn is_request_throttled_exception(&self) -> bool {
         676  +
        matches!(&self, ListSnapshotBlocksError::RequestThrottledException(_))
         677  +
    }
         678  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ServiceQuotaExceededException`.
         679  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
         680  +
        matches!(
         681  +
            &self,
         682  +
            ListSnapshotBlocksError::ServiceQuotaExceededException(_)
         683  +
        )
         684  +
    }
         685  +
    /// Returns `true` if the error kind is `ListSnapshotBlocksError::ValidationException`.
         686  +
    pub fn is_validation_exception(&self) -> bool {
         687  +
        matches!(&self, ListSnapshotBlocksError::ValidationException(_))
         688  +
    }
         689  +
    /// Returns the error name string by matching the correct variant.
         690  +
    pub fn name(&self) -> &'static str {
         691  +
        match &self {
         692  +
            ListSnapshotBlocksError::InternalServerException(_inner) => _inner.name(),
         693  +
            ListSnapshotBlocksError::ResourceNotFoundException(_inner) => _inner.name(),
         694  +
            ListSnapshotBlocksError::AccessDeniedException(_inner) => _inner.name(),
         695  +
            ListSnapshotBlocksError::RequestThrottledException(_inner) => _inner.name(),
         696  +
            ListSnapshotBlocksError::ServiceQuotaExceededException(_inner) => _inner.name(),
         697  +
            ListSnapshotBlocksError::ValidationException(_inner) => _inner.name(),
         698  +
        }
         699  +
    }
         700  +
}
         701  +
impl ::std::error::Error for ListSnapshotBlocksError {
         702  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         703  +
        match &self {
         704  +
            ListSnapshotBlocksError::InternalServerException(_inner) => Some(_inner),
         705  +
            ListSnapshotBlocksError::ResourceNotFoundException(_inner) => Some(_inner),
         706  +
            ListSnapshotBlocksError::AccessDeniedException(_inner) => Some(_inner),
         707  +
            ListSnapshotBlocksError::RequestThrottledException(_inner) => Some(_inner),
         708  +
            ListSnapshotBlocksError::ServiceQuotaExceededException(_inner) => Some(_inner),
         709  +
            ListSnapshotBlocksError::ValidationException(_inner) => Some(_inner),
         710  +
        }
         711  +
    }
         712  +
}
         713  +
impl ::std::convert::From<crate::error::InternalServerException>
         714  +
    for crate::error::ListSnapshotBlocksError
         715  +
{
         716  +
    fn from(
         717  +
        variant: crate::error::InternalServerException,
         718  +
    ) -> crate::error::ListSnapshotBlocksError {
         719  +
        Self::InternalServerException(variant)
         720  +
    }
         721  +
}
         722  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
         723  +
    for crate::error::ListSnapshotBlocksError
         724  +
{
         725  +
    fn from(
         726  +
        variant: crate::error::ResourceNotFoundException,
         727  +
    ) -> crate::error::ListSnapshotBlocksError {
         728  +
        Self::ResourceNotFoundException(variant)
         729  +
    }
         730  +
}
         731  +
impl ::std::convert::From<crate::error::AccessDeniedException>
         732  +
    for crate::error::ListSnapshotBlocksError
         733  +
{
         734  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::ListSnapshotBlocksError {
         735  +
        Self::AccessDeniedException(variant)
         736  +
    }
         737  +
}
         738  +
impl ::std::convert::From<crate::error::RequestThrottledException>
         739  +
    for crate::error::ListSnapshotBlocksError
         740  +
{
         741  +
    fn from(
         742  +
        variant: crate::error::RequestThrottledException,
         743  +
    ) -> crate::error::ListSnapshotBlocksError {
         744  +
        Self::RequestThrottledException(variant)
         745  +
    }
         746  +
}
         747  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
         748  +
    for crate::error::ListSnapshotBlocksError
         749  +
{
         750  +
    fn from(
         751  +
        variant: crate::error::ServiceQuotaExceededException,
         752  +
    ) -> crate::error::ListSnapshotBlocksError {
         753  +
        Self::ServiceQuotaExceededException(variant)
         754  +
    }
         755  +
}
         756  +
impl ::std::convert::From<crate::error::ValidationException>
         757  +
    for crate::error::ListSnapshotBlocksError
         758  +
{
         759  +
    fn from(variant: crate::error::ValidationException) -> crate::error::ListSnapshotBlocksError {
         760  +
        Self::ValidationException(variant)
         761  +
    }
         762  +
}
         763  +
         764  +
/// Error type for the `ListChangedBlocks` operation.
         765  +
/// Each variant represents an error that can occur for the `ListChangedBlocks` operation.
         766  +
#[derive(::std::fmt::Debug)]
         767  +
pub enum ListChangedBlocksError {
         768  +
    /// <p>An internal error has occurred.</p>
         769  +
    InternalServerException(crate::error::InternalServerException),
         770  +
    /// <p>The specified resource does not exist.</p>
         771  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
         772  +
    /// <p>You do not have sufficient access to perform this action.</p>
         773  +
    AccessDeniedException(crate::error::AccessDeniedException),
         774  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
         775  +
    RequestThrottledException(crate::error::RequestThrottledException),
         776  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
         777  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
         778  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         779  +
    ValidationException(crate::error::ValidationException),
         780  +
}
         781  +
impl ::std::fmt::Display for ListChangedBlocksError {
         782  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         783  +
        match &self {
         784  +
            ListChangedBlocksError::InternalServerException(_inner) => _inner.fmt(f),
         785  +
            ListChangedBlocksError::ResourceNotFoundException(_inner) => _inner.fmt(f),
         786  +
            ListChangedBlocksError::AccessDeniedException(_inner) => _inner.fmt(f),
         787  +
            ListChangedBlocksError::RequestThrottledException(_inner) => _inner.fmt(f),
         788  +
            ListChangedBlocksError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
         789  +
            ListChangedBlocksError::ValidationException(_inner) => _inner.fmt(f),
         790  +
        }
         791  +
    }
         792  +
}
         793  +
impl ListChangedBlocksError {
         794  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::InternalServerException`.
         795  +
    pub fn is_internal_server_exception(&self) -> bool {
         796  +
        matches!(&self, ListChangedBlocksError::InternalServerException(_))
         797  +
    }
         798  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::ResourceNotFoundException`.
         799  +
    pub fn is_resource_not_found_exception(&self) -> bool {
         800  +
        matches!(&self, ListChangedBlocksError::ResourceNotFoundException(_))
         801  +
    }
         802  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::AccessDeniedException`.
         803  +
    pub fn is_access_denied_exception(&self) -> bool {
         804  +
        matches!(&self, ListChangedBlocksError::AccessDeniedException(_))
         805  +
    }
         806  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::RequestThrottledException`.
         807  +
    pub fn is_request_throttled_exception(&self) -> bool {
         808  +
        matches!(&self, ListChangedBlocksError::RequestThrottledException(_))
         809  +
    }
         810  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::ServiceQuotaExceededException`.
         811  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
         812  +
        matches!(
         813  +
            &self,
         814  +
            ListChangedBlocksError::ServiceQuotaExceededException(_)
         815  +
        )
         816  +
    }
         817  +
    /// Returns `true` if the error kind is `ListChangedBlocksError::ValidationException`.
         818  +
    pub fn is_validation_exception(&self) -> bool {
         819  +
        matches!(&self, ListChangedBlocksError::ValidationException(_))
         820  +
    }
         821  +
    /// Returns the error name string by matching the correct variant.
         822  +
    pub fn name(&self) -> &'static str {
         823  +
        match &self {
         824  +
            ListChangedBlocksError::InternalServerException(_inner) => _inner.name(),
         825  +
            ListChangedBlocksError::ResourceNotFoundException(_inner) => _inner.name(),
         826  +
            ListChangedBlocksError::AccessDeniedException(_inner) => _inner.name(),
         827  +
            ListChangedBlocksError::RequestThrottledException(_inner) => _inner.name(),
         828  +
            ListChangedBlocksError::ServiceQuotaExceededException(_inner) => _inner.name(),
         829  +
            ListChangedBlocksError::ValidationException(_inner) => _inner.name(),
         830  +
        }
         831  +
    }
         832  +
}
         833  +
impl ::std::error::Error for ListChangedBlocksError {
         834  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         835  +
        match &self {
         836  +
            ListChangedBlocksError::InternalServerException(_inner) => Some(_inner),
         837  +
            ListChangedBlocksError::ResourceNotFoundException(_inner) => Some(_inner),
         838  +
            ListChangedBlocksError::AccessDeniedException(_inner) => Some(_inner),
         839  +
            ListChangedBlocksError::RequestThrottledException(_inner) => Some(_inner),
         840  +
            ListChangedBlocksError::ServiceQuotaExceededException(_inner) => Some(_inner),
         841  +
            ListChangedBlocksError::ValidationException(_inner) => Some(_inner),
         842  +
        }
         843  +
    }
         844  +
}
         845  +
impl ::std::convert::From<crate::error::InternalServerException>
         846  +
    for crate::error::ListChangedBlocksError
         847  +
{
         848  +
    fn from(
         849  +
        variant: crate::error::InternalServerException,
         850  +
    ) -> crate::error::ListChangedBlocksError {
         851  +
        Self::InternalServerException(variant)
         852  +
    }
         853  +
}
         854  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
         855  +
    for crate::error::ListChangedBlocksError
         856  +
{
         857  +
    fn from(
         858  +
        variant: crate::error::ResourceNotFoundException,
         859  +
    ) -> crate::error::ListChangedBlocksError {
         860  +
        Self::ResourceNotFoundException(variant)
         861  +
    }
         862  +
}
         863  +
impl ::std::convert::From<crate::error::AccessDeniedException>
         864  +
    for crate::error::ListChangedBlocksError
         865  +
{
         866  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::ListChangedBlocksError {
         867  +
        Self::AccessDeniedException(variant)
         868  +
    }
         869  +
}
         870  +
impl ::std::convert::From<crate::error::RequestThrottledException>
         871  +
    for crate::error::ListChangedBlocksError
         872  +
{
         873  +
    fn from(
         874  +
        variant: crate::error::RequestThrottledException,
         875  +
    ) -> crate::error::ListChangedBlocksError {
         876  +
        Self::RequestThrottledException(variant)
         877  +
    }
         878  +
}
         879  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
         880  +
    for crate::error::ListChangedBlocksError
         881  +
{
         882  +
    fn from(
         883  +
        variant: crate::error::ServiceQuotaExceededException,
         884  +
    ) -> crate::error::ListChangedBlocksError {
         885  +
        Self::ServiceQuotaExceededException(variant)
         886  +
    }
         887  +
}
         888  +
impl ::std::convert::From<crate::error::ValidationException>
         889  +
    for crate::error::ListChangedBlocksError
         890  +
{
         891  +
    fn from(variant: crate::error::ValidationException) -> crate::error::ListChangedBlocksError {
         892  +
        Self::ValidationException(variant)
         893  +
    }
         894  +
}
         895  +
         896  +
/// Error type for the `GetSnapshotBlock` operation.
         897  +
/// Each variant represents an error that can occur for the `GetSnapshotBlock` operation.
         898  +
#[derive(::std::fmt::Debug)]
         899  +
pub enum GetSnapshotBlockError {
         900  +
    /// <p>An internal error has occurred.</p>
         901  +
    InternalServerException(crate::error::InternalServerException),
         902  +
    /// <p>The specified resource does not exist.</p>
         903  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
         904  +
    /// <p>You do not have sufficient access to perform this action.</p>
         905  +
    AccessDeniedException(crate::error::AccessDeniedException),
         906  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
         907  +
    RequestThrottledException(crate::error::RequestThrottledException),
         908  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
         909  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
         910  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         911  +
    ValidationException(crate::error::ValidationException),
         912  +
}
         913  +
impl ::std::fmt::Display for GetSnapshotBlockError {
         914  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         915  +
        match &self {
         916  +
            GetSnapshotBlockError::InternalServerException(_inner) => _inner.fmt(f),
         917  +
            GetSnapshotBlockError::ResourceNotFoundException(_inner) => _inner.fmt(f),
         918  +
            GetSnapshotBlockError::AccessDeniedException(_inner) => _inner.fmt(f),
         919  +
            GetSnapshotBlockError::RequestThrottledException(_inner) => _inner.fmt(f),
         920  +
            GetSnapshotBlockError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
         921  +
            GetSnapshotBlockError::ValidationException(_inner) => _inner.fmt(f),
         922  +
        }
         923  +
    }
         924  +
}
         925  +
impl GetSnapshotBlockError {
         926  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::InternalServerException`.
         927  +
    pub fn is_internal_server_exception(&self) -> bool {
         928  +
        matches!(&self, GetSnapshotBlockError::InternalServerException(_))
         929  +
    }
         930  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::ResourceNotFoundException`.
         931  +
    pub fn is_resource_not_found_exception(&self) -> bool {
         932  +
        matches!(&self, GetSnapshotBlockError::ResourceNotFoundException(_))
         933  +
    }
         934  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::AccessDeniedException`.
         935  +
    pub fn is_access_denied_exception(&self) -> bool {
         936  +
        matches!(&self, GetSnapshotBlockError::AccessDeniedException(_))
         937  +
    }
         938  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::RequestThrottledException`.
         939  +
    pub fn is_request_throttled_exception(&self) -> bool {
         940  +
        matches!(&self, GetSnapshotBlockError::RequestThrottledException(_))
         941  +
    }
         942  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::ServiceQuotaExceededException`.
         943  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
         944  +
        matches!(
         945  +
            &self,
         946  +
            GetSnapshotBlockError::ServiceQuotaExceededException(_)
         947  +
        )
         948  +
    }
         949  +
    /// Returns `true` if the error kind is `GetSnapshotBlockError::ValidationException`.
         950  +
    pub fn is_validation_exception(&self) -> bool {
         951  +
        matches!(&self, GetSnapshotBlockError::ValidationException(_))
         952  +
    }
         953  +
    /// Returns the error name string by matching the correct variant.
         954  +
    pub fn name(&self) -> &'static str {
         955  +
        match &self {
         956  +
            GetSnapshotBlockError::InternalServerException(_inner) => _inner.name(),
         957  +
            GetSnapshotBlockError::ResourceNotFoundException(_inner) => _inner.name(),
         958  +
            GetSnapshotBlockError::AccessDeniedException(_inner) => _inner.name(),
         959  +
            GetSnapshotBlockError::RequestThrottledException(_inner) => _inner.name(),
         960  +
            GetSnapshotBlockError::ServiceQuotaExceededException(_inner) => _inner.name(),
         961  +
            GetSnapshotBlockError::ValidationException(_inner) => _inner.name(),
         962  +
        }
         963  +
    }
         964  +
}
         965  +
impl ::std::error::Error for GetSnapshotBlockError {
         966  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         967  +
        match &self {
         968  +
            GetSnapshotBlockError::InternalServerException(_inner) => Some(_inner),
         969  +
            GetSnapshotBlockError::ResourceNotFoundException(_inner) => Some(_inner),
         970  +
            GetSnapshotBlockError::AccessDeniedException(_inner) => Some(_inner),
         971  +
            GetSnapshotBlockError::RequestThrottledException(_inner) => Some(_inner),
         972  +
            GetSnapshotBlockError::ServiceQuotaExceededException(_inner) => Some(_inner),
         973  +
            GetSnapshotBlockError::ValidationException(_inner) => Some(_inner),
         974  +
        }
         975  +
    }
         976  +
}
         977  +
impl ::std::convert::From<crate::error::InternalServerException>
         978  +
    for crate::error::GetSnapshotBlockError
         979  +
{
         980  +
    fn from(variant: crate::error::InternalServerException) -> crate::error::GetSnapshotBlockError {
         981  +
        Self::InternalServerException(variant)
         982  +
    }
         983  +
}
         984  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
         985  +
    for crate::error::GetSnapshotBlockError
         986  +
{
         987  +
    fn from(
         988  +
        variant: crate::error::ResourceNotFoundException,
         989  +
    ) -> crate::error::GetSnapshotBlockError {
         990  +
        Self::ResourceNotFoundException(variant)
         991  +
    }
         992  +
}
         993  +
impl ::std::convert::From<crate::error::AccessDeniedException>
         994  +
    for crate::error::GetSnapshotBlockError
         995  +
{
         996  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::GetSnapshotBlockError {
         997  +
        Self::AccessDeniedException(variant)
         998  +
    }
         999  +
}
        1000  +
impl ::std::convert::From<crate::error::RequestThrottledException>
        1001  +
    for crate::error::GetSnapshotBlockError
        1002  +
{
        1003  +
    fn from(
        1004  +
        variant: crate::error::RequestThrottledException,
        1005  +
    ) -> crate::error::GetSnapshotBlockError {
        1006  +
        Self::RequestThrottledException(variant)
        1007  +
    }
        1008  +
}
        1009  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
        1010  +
    for crate::error::GetSnapshotBlockError
        1011  +
{
        1012  +
    fn from(
        1013  +
        variant: crate::error::ServiceQuotaExceededException,
        1014  +
    ) -> crate::error::GetSnapshotBlockError {
        1015  +
        Self::ServiceQuotaExceededException(variant)
        1016  +
    }
        1017  +
}
        1018  +
impl ::std::convert::From<crate::error::ValidationException>
        1019  +
    for crate::error::GetSnapshotBlockError
        1020  +
{
        1021  +
    fn from(variant: crate::error::ValidationException) -> crate::error::GetSnapshotBlockError {
        1022  +
        Self::ValidationException(variant)
        1023  +
    }
        1024  +
}
        1025  +
        1026  +
/// Error type for the `CompleteSnapshot` operation.
        1027  +
/// Each variant represents an error that can occur for the `CompleteSnapshot` operation.
        1028  +
#[derive(::std::fmt::Debug)]
        1029  +
pub enum CompleteSnapshotError {
        1030  +
    /// <p>An internal error has occurred.</p>
        1031  +
    InternalServerException(crate::error::InternalServerException),
        1032  +
    /// <p>The specified resource does not exist.</p>
        1033  +
    ResourceNotFoundException(crate::error::ResourceNotFoundException),
        1034  +
    /// <p>You do not have sufficient access to perform this action.</p>
        1035  +
    AccessDeniedException(crate::error::AccessDeniedException),
        1036  +
    /// <p>The number of API requests has exceed the maximum allowed API request throttling limit.</p>
        1037  +
    RequestThrottledException(crate::error::RequestThrottledException),
        1038  +
    /// <p>Your current service quotas do not allow you to perform this action.</p>
        1039  +
    ServiceQuotaExceededException(crate::error::ServiceQuotaExceededException),
        1040  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
        1041  +
    ValidationException(crate::error::ValidationException),
        1042  +
}
        1043  +
impl ::std::fmt::Display for CompleteSnapshotError {
        1044  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1045  +
        match &self {
        1046  +
            CompleteSnapshotError::InternalServerException(_inner) => _inner.fmt(f),
        1047  +
            CompleteSnapshotError::ResourceNotFoundException(_inner) => _inner.fmt(f),
        1048  +
            CompleteSnapshotError::AccessDeniedException(_inner) => _inner.fmt(f),
        1049  +
            CompleteSnapshotError::RequestThrottledException(_inner) => _inner.fmt(f),
        1050  +
            CompleteSnapshotError::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
        1051  +
            CompleteSnapshotError::ValidationException(_inner) => _inner.fmt(f),
        1052  +
        }
        1053  +
    }
        1054  +
}
        1055  +
impl CompleteSnapshotError {
        1056  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::InternalServerException`.
        1057  +
    pub fn is_internal_server_exception(&self) -> bool {
        1058  +
        matches!(&self, CompleteSnapshotError::InternalServerException(_))
        1059  +
    }
        1060  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::ResourceNotFoundException`.
        1061  +
    pub fn is_resource_not_found_exception(&self) -> bool {
        1062  +
        matches!(&self, CompleteSnapshotError::ResourceNotFoundException(_))
        1063  +
    }
        1064  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::AccessDeniedException`.
        1065  +
    pub fn is_access_denied_exception(&self) -> bool {
        1066  +
        matches!(&self, CompleteSnapshotError::AccessDeniedException(_))
        1067  +
    }
        1068  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::RequestThrottledException`.
        1069  +
    pub fn is_request_throttled_exception(&self) -> bool {
        1070  +
        matches!(&self, CompleteSnapshotError::RequestThrottledException(_))
        1071  +
    }
        1072  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::ServiceQuotaExceededException`.
        1073  +
    pub fn is_service_quota_exceeded_exception(&self) -> bool {
        1074  +
        matches!(
        1075  +
            &self,
        1076  +
            CompleteSnapshotError::ServiceQuotaExceededException(_)
        1077  +
        )
        1078  +
    }
        1079  +
    /// Returns `true` if the error kind is `CompleteSnapshotError::ValidationException`.
        1080  +
    pub fn is_validation_exception(&self) -> bool {
        1081  +
        matches!(&self, CompleteSnapshotError::ValidationException(_))
        1082  +
    }
        1083  +
    /// Returns the error name string by matching the correct variant.
        1084  +
    pub fn name(&self) -> &'static str {
        1085  +
        match &self {
        1086  +
            CompleteSnapshotError::InternalServerException(_inner) => _inner.name(),
        1087  +
            CompleteSnapshotError::ResourceNotFoundException(_inner) => _inner.name(),
        1088  +
            CompleteSnapshotError::AccessDeniedException(_inner) => _inner.name(),
        1089  +
            CompleteSnapshotError::RequestThrottledException(_inner) => _inner.name(),
        1090  +
            CompleteSnapshotError::ServiceQuotaExceededException(_inner) => _inner.name(),
        1091  +
            CompleteSnapshotError::ValidationException(_inner) => _inner.name(),
        1092  +
        }
        1093  +
    }
        1094  +
}
        1095  +
impl ::std::error::Error for CompleteSnapshotError {
        1096  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
        1097  +
        match &self {
        1098  +
            CompleteSnapshotError::InternalServerException(_inner) => Some(_inner),
        1099  +
            CompleteSnapshotError::ResourceNotFoundException(_inner) => Some(_inner),
        1100  +
            CompleteSnapshotError::AccessDeniedException(_inner) => Some(_inner),
        1101  +
            CompleteSnapshotError::RequestThrottledException(_inner) => Some(_inner),
        1102  +
            CompleteSnapshotError::ServiceQuotaExceededException(_inner) => Some(_inner),
        1103  +
            CompleteSnapshotError::ValidationException(_inner) => Some(_inner),
        1104  +
        }
        1105  +
    }
        1106  +
}
        1107  +
impl ::std::convert::From<crate::error::InternalServerException>
        1108  +
    for crate::error::CompleteSnapshotError
        1109  +
{
        1110  +
    fn from(variant: crate::error::InternalServerException) -> crate::error::CompleteSnapshotError {
        1111  +
        Self::InternalServerException(variant)
        1112  +
    }
        1113  +
}
        1114  +
impl ::std::convert::From<crate::error::ResourceNotFoundException>
        1115  +
    for crate::error::CompleteSnapshotError
        1116  +
{
        1117  +
    fn from(
        1118  +
        variant: crate::error::ResourceNotFoundException,
        1119  +
    ) -> crate::error::CompleteSnapshotError {
        1120  +
        Self::ResourceNotFoundException(variant)
        1121  +
    }
        1122  +
}
        1123  +
impl ::std::convert::From<crate::error::AccessDeniedException>
        1124  +
    for crate::error::CompleteSnapshotError
        1125  +
{
        1126  +
    fn from(variant: crate::error::AccessDeniedException) -> crate::error::CompleteSnapshotError {
        1127  +
        Self::AccessDeniedException(variant)
        1128  +
    }
        1129  +
}
        1130  +
impl ::std::convert::From<crate::error::RequestThrottledException>
        1131  +
    for crate::error::CompleteSnapshotError
        1132  +
{
        1133  +
    fn from(
        1134  +
        variant: crate::error::RequestThrottledException,
        1135  +
    ) -> crate::error::CompleteSnapshotError {
        1136  +
        Self::RequestThrottledException(variant)
        1137  +
    }
        1138  +
}
        1139  +
impl ::std::convert::From<crate::error::ServiceQuotaExceededException>
        1140  +
    for crate::error::CompleteSnapshotError
        1141  +
{
        1142  +
    fn from(
        1143  +
        variant: crate::error::ServiceQuotaExceededException,
        1144  +
    ) -> crate::error::CompleteSnapshotError {
        1145  +
        Self::ServiceQuotaExceededException(variant)
        1146  +
    }
        1147  +
}
        1148  +
impl ::std::convert::From<crate::error::ValidationException>
        1149  +
    for crate::error::CompleteSnapshotError
        1150  +
{
        1151  +
    fn from(variant: crate::error::ValidationException) -> crate::error::CompleteSnapshotError {
        1152  +
        Self::ValidationException(variant)
        1153  +
    }
        1154  +
}
        1155  +
/// See [`ValidationException`](crate::error::ValidationException).
        1156  +
pub mod validation_exception {
        1157  +
        1158  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1159  +
    /// Holds one variant for each of the ways the builder can fail.
        1160  +
    #[non_exhaustive]
        1161  +
    #[allow(clippy::enum_variant_names)]
        1162  +
    pub enum ConstraintViolation {
        1163  +
        /// `message` was not provided but it is required when building `ValidationException`.
        1164  +
        MissingMessage,
        1165  +
    }
        1166  +
    impl ::std::fmt::Display for ConstraintViolation {
        1167  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1168  +
            match self {
        1169  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
        1170  +
            }
        1171  +
        }
        1172  +
    }
        1173  +
    impl ::std::error::Error for ConstraintViolation {}
        1174  +
    impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
        1175  +
        type Error = ConstraintViolation;
        1176  +
        1177  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
        1178  +
            builder.build()
        1179  +
        }
        1180  +
    }
        1181  +
    /// A builder for [`ValidationException`](crate::error::ValidationException).
        1182  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1183  +
    pub struct Builder {
        1184  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
        1185  +
        pub(crate) field_list:
        1186  +
            ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
        1187  +
    }
        1188  +
    impl Builder {
        1189  +
        /// A summary of the validation failure.
        1190  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
        1191  +
            self.message = Some(input);
        1192  +
            self
        1193  +
        }
        1194  +
        /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
        1195  +
        pub fn field_list(
        1196  +
            mut self,
        1197  +
            input: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
        1198  +
        ) -> Self {
        1199  +
            self.field_list = input;
        1200  +
            self
        1201  +
        }
        1202  +
        /// Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
        1203  +
        ///
        1204  +
        /// The builder fails to construct a [`ValidationException`](crate::error::ValidationException) if a [`ConstraintViolation`] occurs.
        1205  +
        ///
        1206  +
        pub fn build(self) -> Result<crate::error::ValidationException, ConstraintViolation> {
        1207  +
            self.build_enforcing_all_constraints()
        1208  +
        }
        1209  +
        fn build_enforcing_all_constraints(
        1210  +
            self,
        1211  +
        ) -> Result<crate::error::ValidationException, ConstraintViolation> {
        1212  +
            Ok(crate::error::ValidationException {
        1213  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
        1214  +
                field_list: self.field_list,
        1215  +
            })
        1216  +
        }
        1217  +
    }
        1218  +
}
        1219  +
/// See [`ConcurrentLimitExceededException`](crate::error::ConcurrentLimitExceededException).
        1220  +
pub mod concurrent_limit_exceeded_exception {
        1221  +
        1222  +
    impl ::std::convert::From<Builder> for crate::error::ConcurrentLimitExceededException {
        1223  +
        fn from(builder: Builder) -> Self {
        1224  +
            builder.build()
        1225  +
        }
        1226  +
    }
        1227  +
    /// A builder for [`ConcurrentLimitExceededException`](crate::error::ConcurrentLimitExceededException).
        1228  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1229  +
    pub struct Builder {
        1230  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1231  +
    }
        1232  +
    impl Builder {
        1233  +
        #[allow(missing_docs)] // documentation missing in model
        1234  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1235  +
            self.message = input;
        1236  +
            self
        1237  +
        }
        1238  +
        /// Consumes the builder and constructs a [`ConcurrentLimitExceededException`](crate::error::ConcurrentLimitExceededException).
        1239  +
        pub fn build(self) -> crate::error::ConcurrentLimitExceededException {
        1240  +
            self.build_enforcing_all_constraints()
        1241  +
        }
        1242  +
        fn build_enforcing_all_constraints(self) -> crate::error::ConcurrentLimitExceededException {
        1243  +
            crate::error::ConcurrentLimitExceededException {
        1244  +
                message: self.message,
        1245  +
            }
        1246  +
        }
        1247  +
    }
        1248  +
}
        1249  +
/// See [`ServiceQuotaExceededException`](crate::error::ServiceQuotaExceededException).
        1250  +
pub mod service_quota_exceeded_exception {
        1251  +
        1252  +
    impl ::std::convert::From<Builder> for crate::error::ServiceQuotaExceededException {
        1253  +
        fn from(builder: Builder) -> Self {
        1254  +
            builder.build()
        1255  +
        }
        1256  +
    }
        1257  +
    /// A builder for [`ServiceQuotaExceededException`](crate::error::ServiceQuotaExceededException).
        1258  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1259  +
    pub struct Builder {
        1260  +
        pub(crate) reason: ::std::option::Option<crate::model::ServiceQuotaExceededExceptionReason>,
        1261  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1262  +
    }
        1263  +
    impl Builder {
        1264  +
        /// <p>The reason for the exception.</p>
        1265  +
        pub fn reason(
        1266  +
            mut self,
        1267  +
            input: ::std::option::Option<crate::model::ServiceQuotaExceededExceptionReason>,
        1268  +
        ) -> Self {
        1269  +
            self.reason = input;
        1270  +
            self
        1271  +
        }
        1272  +
        #[allow(missing_docs)] // documentation missing in model
        1273  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1274  +
            self.message = input;
        1275  +
            self
        1276  +
        }
        1277  +
        /// Consumes the builder and constructs a [`ServiceQuotaExceededException`](crate::error::ServiceQuotaExceededException).
        1278  +
        pub fn build(self) -> crate::error::ServiceQuotaExceededException {
        1279  +
            self.build_enforcing_all_constraints()
        1280  +
        }
        1281  +
        fn build_enforcing_all_constraints(self) -> crate::error::ServiceQuotaExceededException {
        1282  +
            crate::error::ServiceQuotaExceededException {
        1283  +
                reason: self.reason,
        1284  +
                message: self.message,
        1285  +
            }
        1286  +
        }
        1287  +
    }
        1288  +
}
        1289  +
/// See [`RequestThrottledException`](crate::error::RequestThrottledException).
        1290  +
pub mod request_throttled_exception {
        1291  +
        1292  +
    impl ::std::convert::From<Builder> for crate::error::RequestThrottledException {
        1293  +
        fn from(builder: Builder) -> Self {
        1294  +
            builder.build()
        1295  +
        }
        1296  +
    }
        1297  +
    /// A builder for [`RequestThrottledException`](crate::error::RequestThrottledException).
        1298  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1299  +
    pub struct Builder {
        1300  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1301  +
        pub(crate) reason: ::std::option::Option<crate::model::RequestThrottledExceptionReason>,
        1302  +
    }
        1303  +
    impl Builder {
        1304  +
        #[allow(missing_docs)] // documentation missing in model
        1305  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1306  +
            self.message = input;
        1307  +
            self
        1308  +
        }
        1309  +
        /// <p>The reason for the exception.</p>
        1310  +
        pub fn reason(
        1311  +
            mut self,
        1312  +
            input: ::std::option::Option<crate::model::RequestThrottledExceptionReason>,
        1313  +
        ) -> Self {
        1314  +
            self.reason = input;
        1315  +
            self
        1316  +
        }
        1317  +
        /// Consumes the builder and constructs a [`RequestThrottledException`](crate::error::RequestThrottledException).
        1318  +
        pub fn build(self) -> crate::error::RequestThrottledException {
        1319  +
            self.build_enforcing_all_constraints()
        1320  +
        }
        1321  +
        fn build_enforcing_all_constraints(self) -> crate::error::RequestThrottledException {
        1322  +
            crate::error::RequestThrottledException {
        1323  +
                message: self.message,
        1324  +
                reason: self.reason,
        1325  +
            }
        1326  +
        }
        1327  +
    }
        1328  +
}
        1329  +
/// See [`ConflictException`](crate::error::ConflictException).
        1330  +
pub mod conflict_exception {
        1331  +
        1332  +
    impl ::std::convert::From<Builder> for crate::error::ConflictException {
        1333  +
        fn from(builder: Builder) -> Self {
        1334  +
            builder.build()
        1335  +
        }
        1336  +
    }
        1337  +
    /// A builder for [`ConflictException`](crate::error::ConflictException).
        1338  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1339  +
    pub struct Builder {
        1340  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1341  +
    }
        1342  +
    impl Builder {
        1343  +
        #[allow(missing_docs)] // documentation missing in model
        1344  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1345  +
            self.message = input;
        1346  +
            self
        1347  +
        }
        1348  +
        /// Consumes the builder and constructs a [`ConflictException`](crate::error::ConflictException).
        1349  +
        pub fn build(self) -> crate::error::ConflictException {
        1350  +
            self.build_enforcing_all_constraints()
        1351  +
        }
        1352  +
        fn build_enforcing_all_constraints(self) -> crate::error::ConflictException {
        1353  +
            crate::error::ConflictException {
        1354  +
                message: self.message,
        1355  +
            }
        1356  +
        }
        1357  +
    }
        1358  +
}
        1359  +
/// See [`AccessDeniedException`](crate::error::AccessDeniedException).
        1360  +
pub mod access_denied_exception {
        1361  +
        1362  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1363  +
    /// Holds one variant for each of the ways the builder can fail.
        1364  +
    #[non_exhaustive]
        1365  +
    #[allow(clippy::enum_variant_names)]
        1366  +
    pub enum ConstraintViolation {
        1367  +
        /// `reason` was not provided but it is required when building `AccessDeniedException`.
        1368  +
        MissingReason,
        1369  +
    }
        1370  +
    impl ::std::fmt::Display for ConstraintViolation {
        1371  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1372  +
            match self {
        1373  +
                ConstraintViolation::MissingReason => write!(f, "`reason` was not provided but it is required when building `AccessDeniedException`"),
        1374  +
            }
        1375  +
        }
        1376  +
    }
        1377  +
    impl ::std::error::Error for ConstraintViolation {}
        1378  +
    impl ::std::convert::TryFrom<Builder> for crate::error::AccessDeniedException {
        1379  +
        type Error = ConstraintViolation;
        1380  +
        1381  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
        1382  +
            builder.build()
        1383  +
        }
        1384  +
    }
        1385  +
    /// A builder for [`AccessDeniedException`](crate::error::AccessDeniedException).
        1386  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1387  +
    pub struct Builder {
        1388  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1389  +
        pub(crate) reason: ::std::option::Option<crate::model::AccessDeniedExceptionReason>,
        1390  +
    }
        1391  +
    impl Builder {
        1392  +
        #[allow(missing_docs)] // documentation missing in model
        1393  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1394  +
            self.message = input;
        1395  +
            self
        1396  +
        }
        1397  +
        /// <p>The reason for the exception.</p>
        1398  +
        pub fn reason(mut self, input: crate::model::AccessDeniedExceptionReason) -> Self {
        1399  +
            self.reason = Some(input);
        1400  +
            self
        1401  +
        }
        1402  +
        /// Consumes the builder and constructs a [`AccessDeniedException`](crate::error::AccessDeniedException).
        1403  +
        ///
        1404  +
        /// The builder fails to construct a [`AccessDeniedException`](crate::error::AccessDeniedException) if a [`ConstraintViolation`] occurs.
        1405  +
        ///
        1406  +
        pub fn build(self) -> Result<crate::error::AccessDeniedException, ConstraintViolation> {
        1407  +
            self.build_enforcing_all_constraints()
        1408  +
        }
        1409  +
        fn build_enforcing_all_constraints(
        1410  +
            self,
        1411  +
        ) -> Result<crate::error::AccessDeniedException, ConstraintViolation> {
        1412  +
            Ok(crate::error::AccessDeniedException {
        1413  +
                message: self.message,
        1414  +
                reason: self.reason.ok_or(ConstraintViolation::MissingReason)?,
        1415  +
            })
        1416  +
        }
        1417  +
    }
        1418  +
}
        1419  +
/// See [`ResourceNotFoundException`](crate::error::ResourceNotFoundException).
        1420  +
pub mod resource_not_found_exception {
        1421  +
        1422  +
    impl ::std::convert::From<Builder> for crate::error::ResourceNotFoundException {
        1423  +
        fn from(builder: Builder) -> Self {
        1424  +
            builder.build()
        1425  +
        }
        1426  +
    }
        1427  +
    /// A builder for [`ResourceNotFoundException`](crate::error::ResourceNotFoundException).
        1428  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1429  +
    pub struct Builder {
        1430  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1431  +
        pub(crate) reason: ::std::option::Option<crate::model::ResourceNotFoundExceptionReason>,
        1432  +
    }
        1433  +
    impl Builder {
        1434  +
        #[allow(missing_docs)] // documentation missing in model
        1435  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1436  +
            self.message = input;
        1437  +
            self
        1438  +
        }
        1439  +
        /// <p>The reason for the exception.</p>
        1440  +
        pub fn reason(
        1441  +
            mut self,
        1442  +
            input: ::std::option::Option<crate::model::ResourceNotFoundExceptionReason>,
        1443  +
        ) -> Self {
        1444  +
            self.reason = input;
        1445  +
            self
        1446  +
        }
        1447  +
        /// Consumes the builder and constructs a [`ResourceNotFoundException`](crate::error::ResourceNotFoundException).
        1448  +
        pub fn build(self) -> crate::error::ResourceNotFoundException {
        1449  +
            self.build_enforcing_all_constraints()
        1450  +
        }
        1451  +
        fn build_enforcing_all_constraints(self) -> crate::error::ResourceNotFoundException {
        1452  +
            crate::error::ResourceNotFoundException {
        1453  +
                message: self.message,
        1454  +
                reason: self.reason,
        1455  +
            }
        1456  +
        }
        1457  +
    }
        1458  +
}
        1459  +
/// See [`InternalServerException`](crate::error::InternalServerException).
        1460  +
pub mod internal_server_exception {
        1461  +
        1462  +
    impl ::std::convert::From<Builder> for crate::error::InternalServerException {
        1463  +
        fn from(builder: Builder) -> Self {
        1464  +
            builder.build()
        1465  +
        }
        1466  +
    }
        1467  +
    /// A builder for [`InternalServerException`](crate::error::InternalServerException).
        1468  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1469  +
    pub struct Builder {
        1470  +
        pub(crate) message: ::std::option::Option<crate::model::ErrorMessage>,
        1471  +
    }
        1472  +
    impl Builder {
        1473  +
        #[allow(missing_docs)] // documentation missing in model
        1474  +
        pub fn message(mut self, input: ::std::option::Option<crate::model::ErrorMessage>) -> Self {
        1475  +
            self.message = input;
        1476  +
            self
        1477  +
        }
        1478  +
        /// Consumes the builder and constructs a [`InternalServerException`](crate::error::InternalServerException).
        1479  +
        pub fn build(self) -> crate::error::InternalServerException {
        1480  +
            self.build_enforcing_all_constraints()
        1481  +
        }
        1482  +
        fn build_enforcing_all_constraints(self) -> crate::error::InternalServerException {
        1483  +
            crate::error::InternalServerException {
        1484  +
                message: self.message,
        1485  +
            }
        1486  +
        }
        1487  +
    }
        1488  +
}