Server Test Python

Server Test Python

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/Cargo.toml

@@ -1,1 +59,59 @@
    2      2   
[package]
    3      3   
name = "simple"
    4      4   
version = "0.0.1"
    5      5   
authors = ["protocoltest@example.com"]
    6      6   
description = "test"
    7      7   
edition = "2021"
    8      8   
    9      9   
[package.metadata.smithy]
   10     10   
codegen-version = "ci"
   11     11   
protocol = "aws.protocols#restJson1"
   12         -
[dependencies.aws-smithy-http]
   13         -
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   14         -
[dependencies.aws-smithy-http-server]
   15         -
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server"
   16     12   
[dependencies.aws-smithy-http-server-python]
   17     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server-python"
   18     14   
[dependencies.aws-smithy-json]
   19     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
          16  +
[dependencies.aws-smithy-legacy-http]
          17  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http"
          18  +
[dependencies.aws-smithy-legacy-http-server]
          19  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http-server"
   20     20   
[dependencies.aws-smithy-runtime-api]
   21     21   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
          22  +
features = ["http-02x"]
   22     23   
[dependencies.aws-smithy-types]
   23     24   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          25  +
features = ["http-body-0-4-x"]
   24     26   
[dependencies.futures-util]
   25     27   
version = "0.3"
   26     28   
[dependencies.http]
   27     29   
version = "0.2.9"
   28     30   
[dependencies.hyper]
   29     31   
version = "0.14.26"
   30     32   
[dependencies.mime]
   31     33   
version = "0.3"
   32     34   
[dependencies.parking_lot]
   33     35   
version = "0.12"
   34     36   
[dependencies.pin-project-lite]
   35     37   
version = "0.2"
   36     38   
[dependencies.pyo3]
   37     39   
version = "0.20"
   38     40   
[dependencies.pyo3-asyncio]
   39     41   
version = "0.20"
   40     42   
features = ["attributes", "tokio-runtime"]
   41     43   
[dependencies.tower]
   42     44   
version = "0.4"
   43     45   
[dependencies.tracing]
   44     46   
version = "0.1"
   45         -
[dev-dependencies.hyper]
   46         -
version = "0.14.12"
   47     47   
[dev-dependencies.tokio]
   48     48   
version = "1.23.1"
   49     49   
[features]
   50     50   
rt-tokio = ["aws-smithy-types/rt-tokio"]
   51         -
aws-lambda = ["aws-smithy-http-server/aws-lambda"]
   52         -
request-id = ["aws-smithy-http-server/request-id"]
          51  +
aws-lambda = ["aws-smithy-legacy-http-server/aws-lambda"]
          52  +
request-id = ["aws-smithy-legacy-http-server/request-id"]
   53     53   
extension-module = ["pyo3/extension-module"]
   54     54   
default = ["rt-tokio", "request-id", "extension-module"]
   55     55   
[lib]
   56     56   
name = "simple"
   57     57   
crate-type = ["cdylib"]
   58     58   
   59     59   

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/python/simple/middleware/__init__.pyi

@@ -1,1 +38,38 @@
    1      1   
import typing
    2      2   
    3      3   
class MiddlewareException(Exception):
    4      4   
    """
    5      5   
    Exception that can be thrown from a Python middleware.
    6      6   
    7      7   
    It allows to specify a message and HTTP status code and implementing protocol specific capabilities
    8         -
    to build a [aws_smithy_http_server::response::Response] from it.
           8  +
    to build a [aws_smithy_legacy_http_server::response::Response] from it.
    9      9   
    """
   10     10   
   11     11   
    message: str
   12     12   
   13     13   
    status_code: int
   14     14   
   15     15   
    def __init__(self, message: str, status_code: typing.Optional[int] = ...) -> None:
   16     16   
        ...
   17     17   
   18     18   

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

@@ -29,29 +128,129 @@
   49     49   
//!
   50     50   
//! # let app = SimpleService::builder(
   51     51   
//! #     SimpleServiceConfig::builder()
   52     52   
//! #         .build()
   53     53   
//! # ).build_unchecked();
   54     54   
//! let server = app.into_make_service();
   55     55   
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
   56     56   
//!     .expect("unable to parse the server bind address and port");
   57     57   
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
   58     58   
//! # }
          59  +
//!
   59     60   
//! ```
   60     61   
//!
   61     62   
//! ### Running on Lambda
   62     63   
//!
   63     64   
//! ```rust,ignore
   64     65   
//! use simple::server::routing::LambdaHandler;
   65     66   
//! use simple::SimpleService;
   66     67   
//!
   67     68   
//! # async fn dummy() {
   68     69   
//! # let app = SimpleService::builder(
   69     70   
//! #     SimpleServiceConfig::builder()
   70     71   
//! #         .build()
   71     72   
//! # ).build_unchecked();
   72     73   
//! let handler = LambdaHandler::new(app);
   73     74   
//! lambda_http::run(handler).await.unwrap();
   74     75   
//! # }
   75     76   
//! ```
   76     77   
//!
   77     78   
//! # Building the SimpleService
   78     79   
//!
   79     80   
//! To construct [`SimpleService`] we use [`SimpleServiceBuilder`] returned by [`SimpleService::builder`].
   80     81   
//!
   81     82   
//! ## Plugins
   82     83   
//!
   83     84   
//! The [`SimpleService::builder`] method, returning [`SimpleServiceBuilder`],
   84     85   
//! accepts a config object on which plugins can be registered.
   85     86   
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
   86     87   
//!
   87     88   
//! ```rust,no_run
   88     89   
//! # use simple::server::plugin::IdentityPlugin as LoggingPlugin;
   89     90   
//! # use simple::server::plugin::IdentityPlugin as MetricsPlugin;
   90     91   
//! # use ::hyper::Body;
   91     92   
//! use simple::server::plugin::HttpPlugins;
   92     93   
//! use simple::{SimpleService, SimpleServiceConfig, SimpleServiceBuilder};
   93     94   
//!
   94     95   
//! let http_plugins = HttpPlugins::new()
   95     96   
//!         .push(LoggingPlugin)
   96     97   
//!         .push(MetricsPlugin);
   97     98   
//! let config = SimpleServiceConfig::builder().build();
   98         -
//! let builder: SimpleServiceBuilder<Body, _, _, _> = SimpleService::builder(config);
          99  +
//! let builder: SimpleServiceBuilder<::hyper::Body, _, _, _> = SimpleService::builder(config);
   99    100   
//! ```
  100    101   
//!
  101    102   
//! Check out [`crate::server::plugin`] to learn more about plugins.
  102    103   
//!
  103    104   
//! ## Handlers
  104    105   
//!
  105    106   
//! [`SimpleServiceBuilder`] 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    107   
//! We call these async functions **handlers**. This is where your application business logic lives.
  107    108   
//!
  108    109   
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
@@ -164,165 +257,258 @@
  184    185   
//!
  185    186   
//! use simple::{input, output, error};
  186    187   
//!
  187    188   
//! async fn operation(input: input::OperationInput) -> Result<output::OperationOutput, error::OperationError> {
  188    189   
//!     todo!()
  189    190   
//! }
  190    191   
//!
  191    192   
//! ```
  192    193   
//!
  193    194   
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         195  +
//! [hyper server]: https://docs.rs/hyper/0.14.26/hyper/server/index.html
  194    196   
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
  195    197   
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
  196    198   
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
  197         -
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  198    199   
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
  199    200   
pub use crate::service::{
  200    201   
    MissingOperationsError, SimpleService, SimpleServiceBuilder, SimpleServiceConfig,
  201    202   
    SimpleServiceConfigBuilder,
  202    203   
};
  203    204   
  204    205   
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
  205    206   
pub mod server {
  206    207   
    // Re-export all types from the `aws-smithy-http-server` crate.
  207         -
    pub use ::aws_smithy_http_server::*;
         208  +
    pub use ::aws_smithy_legacy_http_server::*;
  208    209   
}
  209    210   
  210    211   
/// Crate version number.
  211    212   
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
  212    213   
  213    214   
/// All error types that operations can return. Documentation on these types is copied from the model.
  214    215   
pub mod error;
  215    216   
  216    217   
/// Input structures for operations. Documentation on these types is copied from the model.
  217    218   
pub mod input;
  218    219   
  219    220   
/// All operations that this crate can perform.
  220    221   
pub mod operation;
  221    222   
  222    223   
/// A collection of types representing each operation defined in the service closure.
  223    224   
///
  224         -
/// The [plugin system](::aws_smithy_http_server::plugin) makes use of these
         225  +
/// The [plugin system](::aws_smithy_legacy_http_server::plugin) makes use of these
  225    226   
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
  226         -
/// parameterize [`Plugin`](::aws_smithy_http_server::plugin::Plugin) implementations. Their traits, such as
  227         -
/// [`OperationShape`](::aws_smithy_http_server::operation::OperationShape), can be used to provide
         227  +
/// parameterize [`Plugin`](::aws_smithy_legacy_http_server::plugin::Plugin) implementations. Their traits, such as
         228  +
/// [`OperationShape`](::aws_smithy_legacy_http_server::operation::OperationShape), can be used to provide
  228    229   
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
  229    230   
pub mod operation_shape;
  230    231   
  231    232   
/// Output structures for operations. Documentation on these types is copied from the model.
  232    233   
pub mod output;
  233    234   
  234    235   
/// Export PyO3 symbols in the shared library
  235    236   
pub mod python_module_export;
  236    237   
  237    238   
/// Operation adapters that delegate to Python handlers.

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

@@ -1,1 +99,98 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
::pin_project_lite::pin_project! {
    3      3   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
    4      4   
    /// [`OperationInput`](crate::input::OperationInput) using modelled bindings.
    5      5   
    pub struct OperationInputFuture {
    6         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
           6  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
    7      7   
    }
    8      8   
}
    9      9   
   10     10   
impl std::future::Future for OperationInputFuture {
   11     11   
    type Output = Result<
   12     12   
        crate::input::OperationInput,
   13         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
          13  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
   14     14   
    >;
   15     15   
   16     16   
    fn poll(
   17     17   
        self: std::pin::Pin<&mut Self>,
   18     18   
        cx: &mut std::task::Context<'_>,
   19     19   
    ) -> std::task::Poll<Self::Output> {
   20     20   
        let this = self.project();
   21     21   
        this.inner.as_mut().poll(cx)
   22     22   
    }
   23     23   
}
   24     24   
   25     25   
impl<B>
   26         -
    ::aws_smithy_http_server::request::FromRequest<
   27         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          26  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
          27  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   28     28   
        B,
   29     29   
    > for crate::input::OperationInput
   30     30   
where
   31         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          31  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   32     32   
    B: 'static,
   33     33   
   34     34   
    B::Data: Send,
   35         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   36         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          36  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   37     37   
{
   38         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
          38  +
    type Rejection =
          39  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
   39     40   
    type Future = OperationInputFuture;
   40     41   
   41     42   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
   42     43   
        let fut = async move {
   43         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
          44  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
   44     45   
                request.headers(),
   45     46   
                &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
   46     47   
            ) {
   47         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
          48  +
                return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   48     49   
            }
   49     50   
            crate::protocol_serde::shape_operation::de_operation_http_request(request).await
   50     51   
        };
   51     52   
        use ::futures_util::future::TryFutureExt;
   52         -
        let fut = fut.map_err(
   53         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
          53  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
   54     54   
                        ::tracing::debug!(error = %e, "failed to deserialize request");
   55         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   56         -
                    e,
   57         -
                )
   58         -
            },
   59         -
        );
          55  +
                        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
          56  +
                    });
   60     57   
        OperationInputFuture {
   61     58   
            inner: Box::pin(fut),
   62     59   
        }
   63     60   
    }
   64     61   
}
   65     62   
impl
   66         -
    ::aws_smithy_http_server::response::IntoResponse<
   67         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          63  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          64  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   68     65   
    > for crate::output::OperationOutput
   69     66   
{
   70         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          67  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
   71     68   
        match crate::protocol_serde::shape_operation::ser_operation_http_response(self) {
   72     69   
            Ok(response) => response,
   73     70   
            Err(e) => {
   74     71   
                ::tracing::error!(error = %e, "failed to serialize response");
   75         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
          72  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   76     73   
            }
   77     74   
        }
   78     75   
    }
   79     76   
}
   80     77   
impl
   81         -
    ::aws_smithy_http_server::response::IntoResponse<
   82         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          78  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          79  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   83     80   
    > for crate::error::OperationError
   84     81   
{
   85         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          82  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
   86     83   
        match crate::protocol_serde::shape_operation::ser_operation_http_error(&self) {
   87     84   
            Ok(mut response) => {
   88     85   
                response.extensions_mut().insert(
   89         -
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
          86  +
                    ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
          87  +
                        self.name(),
          88  +
                    ),
   90     89   
                );
   91     90   
                response
   92     91   
            }
   93     92   
            Err(e) => {
   94     93   
                ::tracing::error!(error = %e, "failed to serialize response");
   95         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
          94  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   96     95   
            }
   97     96   
        }
   98     97   
    }
   99     98   
}

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/operation_shape.rs

@@ -1,1 +38,38 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
pub struct Operation;
    4      4   
    5         -
impl ::aws_smithy_http_server::operation::OperationShape for Operation {
    6         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
    7         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
           5  +
impl ::aws_smithy_legacy_http_server::operation::OperationShape for Operation {
           6  +
    const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
           7  +
        ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
    8      8   
            "com.amazonaws.simple#Operation",
    9      9   
            "com.amazonaws.simple",
   10     10   
            "Operation",
   11     11   
        );
   12     12   
   13     13   
    type Input = crate::input::OperationInput;
   14     14   
    type Output = crate::output::OperationOutput;
   15     15   
    type Error = crate::error::OperationError;
   16     16   
}
   17     17   
   18         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for Operation {
   19         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   20         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   21         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
   22         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   23         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
          18  +
impl ::aws_smithy_legacy_http_server::instrumentation::sensitivity::Sensitivity for Operation {
          19  +
    type RequestFmt = ::aws_smithy_legacy_http_server::instrumentation::sensitivity::RequestFmt<
          20  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          21  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::uri::MakeUri<
          22  +
            ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          23  +
            ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
   24     24   
        >,
   25     25   
    >;
   26         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
   27         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   28         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
          26  +
    type ResponseFmt = ::aws_smithy_legacy_http_server::instrumentation::sensitivity::ResponseFmt<
          27  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          28  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
   29     29   
    >;
   30     30   
   31     31   
    fn request_fmt() -> Self::RequestFmt {
   32         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
          32  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::RequestFmt::new()
   33     33   
    }
   34     34   
   35     35   
    fn response_fmt() -> Self::ResponseFmt {
   36         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
          36  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   37     37   
    }
   38     38   
}

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

@@ -1,1 +127,127 @@
    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_operation_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::OperationInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::operation_input_internal::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     22   
        let bytes = ::hyper::body::to_bytes(body).await?;
   23     23   
        if !bytes.is_empty() {
   24         -
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
   25     25   
                &headers,
   26     26   
                Some("application/json"),
   27     27   
            )?;
   28     28   
            input = crate::protocol_serde::shape_operation::de_operation(bytes.as_ref(), input)?;
   29     29   
        }
   30     30   
        input.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
#[allow(clippy::unnecessary_wraps)]
   35     35   
pub fn ser_operation_http_response(
   36     36   
    #[allow(unused_variables)] output: crate::output::OperationOutput,
   37     37   
) -> std::result::Result<
   38         -
    ::aws_smithy_http_server::response::Response,
   39         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          38  +
    ::aws_smithy_legacy_http_server::response::Response,
          39  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     40   
> {
   41     41   
    Ok({
   42     42   
        #[allow(unused_mut)]
   43     43   
        let mut builder = ::http::Response::builder();
   44         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   45     45   
            builder,
   46     46   
            ::http::header::CONTENT_TYPE,
   47     47   
            "application/json",
   48     48   
        );
   49     49   
        let http_status: u16 = 200;
   50     50   
        builder = builder.status(http_status);
   51     51   
        let payload =
   52     52   
            crate::protocol_serde::shape_operation_output::ser_operation_output_output_output(
   53     53   
                &output,
   54     54   
            )?;
   55     55   
        let content_length = payload.len();
   56         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   57     57   
            builder,
   58     58   
            ::http::header::CONTENT_LENGTH,
   59     59   
            content_length,
   60     60   
        );
   61         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   62     62   
        builder.body(body)?
   63     63   
    })
   64     64   
}
   65     65   
   66     66   
#[allow(clippy::unnecessary_wraps)]
   67     67   
pub fn ser_operation_http_error(
   68     68   
    error: &crate::error::OperationError,
   69     69   
) -> std::result::Result<
   70         -
    ::aws_smithy_http_server::response::Response,
   71         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          70  +
    ::aws_smithy_legacy_http_server::response::Response,
          71  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72     72   
> {
   73     73   
    Ok({
   74     74   
        match error {
   75     75   
            crate::error::OperationError::InternalServerError(output) => {
   76     76   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   77     77   
                #[allow(unused_mut)]
   78     78   
                let mut builder = ::http::Response::builder();
   79         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   80     80   
                    builder,
   81     81   
                    ::http::header::CONTENT_TYPE,
   82     82   
                    "application/json",
   83     83   
                );
   84         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   85     85   
                    builder,
   86     86   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87     87   
                    "InternalServerError",
   88     88   
                );
   89     89   
                let content_length = payload.len();
   90         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   91     91   
                    builder,
   92     92   
                    ::http::header::CONTENT_LENGTH,
   93     93   
                    content_length,
   94     94   
                );
   95     95   
                builder
   96     96   
                    .status(500)
   97         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          97  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   98     98   
            }
   99     99   
        }
  100    100   
    })
  101    101   
}
  102    102   
  103    103   
pub(crate) fn de_operation(
  104    104   
    value: &[u8],
  105    105   
    mut builder: crate::input::operation_input_internal::Builder,
  106    106   
) -> ::std::result::Result<
  107    107   
    crate::input::operation_input_internal::Builder,

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/python_operation_adaptor.rs

@@ -1,1 +35,37 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Python handler for operation `Operation`.
    3      3   
pub(crate) async fn operation(
    4      4   
    input: crate::input::OperationInput,
    5         -
    state: ::aws_smithy_http_server::Extension<::aws_smithy_http_server_python::context::PyContext>,
           5  +
    state: ::aws_smithy_legacy_http_server::Extension<
           6  +
        ::aws_smithy_http_server_python::context::PyContext,
           7  +
    >,
    6      8   
    handler: ::aws_smithy_http_server_python::PyHandler,
    7      9   
) -> std::result::Result<crate::output::OperationOutput, crate::error::OperationError> {
    8     10   
    // Async block used to run the handler and catch any Python error.
    9     11   
    let result = if handler.is_coroutine {
   10     12   
        ::tracing::trace!(name = "operation", "executing python handler coroutine");
   11     13   
        let result = ::pyo3::Python::with_gil(|py| {
   12     14   
            let pyhandler: &::pyo3::types::PyFunction = handler.extract(py)?;
   13     15   
            let coroutine = if handler.args == 1 {
   14     16   
                pyhandler.call1((input,))?
   15     17   
            } else {

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/python_server_application.rs

@@ -56,56 +146,146 @@
   76     76   
    fn handlers(
   77     77   
        &mut self,
   78     78   
    ) -> &mut ::std::collections::HashMap<String, ::aws_smithy_http_server_python::PyHandler> {
   79     79   
        &mut self.handlers
   80     80   
    }
   81     81   
    fn build_service(
   82     82   
        &mut self,
   83     83   
        event_loop: &::pyo3::PyAny,
   84     84   
    ) -> ::pyo3::PyResult<
   85     85   
        ::tower::util::BoxCloneService<
   86         -
            ::http::Request<::aws_smithy_http_server::body::Body>,
   87         -
            ::http::Response<::aws_smithy_http_server::body::BoxBody>,
          86  +
            ::http::Request<::aws_smithy_legacy_http_server::body::Body>,
          87  +
            ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
   88     88   
            std::convert::Infallible,
   89     89   
        >,
   90     90   
    > {
   91     91   
        let builder = crate::service::SimpleService::builder_without_plugins();
   92     92   
        let operation_locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
   93     93   
        let handler = self
   94     94   
            .handlers
   95     95   
            .get("operation")
   96     96   
            .expect("Python handler for operation `operation` not found")
   97     97   
            .clone();
   98     98   
        let builder = builder.operation(move |input, state| {
   99     99   
            ::pyo3_asyncio::tokio::scope(
  100    100   
                operation_locals.clone(),
  101    101   
                crate::python_operation_adaptor::operation(input, state, handler.clone()),
  102    102   
            )
  103    103   
        });
  104    104   
        let mut service = ::tower::util::BoxCloneService::new(builder.build().expect("one or more operations do not have a registered handler; this is a bug in the Python code generator, please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"));
  105    105   
  106    106   
        {
  107    107   
            use ::tower::Layer;
  108    108   
            ::tracing::trace!("adding middlewares to rust python router");
  109    109   
            let mut middlewares = self.middlewares.clone();
  110    110   
            // Reverse the middlewares, so they run with same order as they defined
  111    111   
            middlewares.reverse();
  112    112   
            for handler in middlewares {
  113    113   
                ::tracing::trace!(name = &handler.name, "adding python middleware");
  114    114   
                let locals = ::pyo3_asyncio::TaskLocals::new(event_loop);
  115    115   
                let layer = ::aws_smithy_http_server_python::PyMiddlewareLayer::<
  116         -
                    ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         116  +
                    ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  117    117   
                >::new(handler, locals);
  118    118   
                service = ::tower::util::BoxCloneService::new(layer.layer(service));
  119    119   
            }
  120    120   
        }
  121    121   
        Ok(service)
  122    122   
    }
  123    123   
}
  124    124   
#[::pyo3::pymethods]
  125    125   
impl App {
  126    126   
    /// Create a new [App].

tmp-codegen-diff/codegen-server-test-python/simple/rust-server-codegen-python/src/service.rs

@@ -1,1 +634,647 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// The service builder for [`SimpleService`].
    3      3   
///
    4      4   
/// Constructed via [`SimpleService::builder`].
    5      5   
pub struct SimpleServiceBuilder<Body, L, HttpPl, ModelPl> {
    6         -
    operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
           6  +
    operation: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
    7      7   
    layer: L,
    8      8   
    http_plugin: HttpPl,
    9      9   
    model_plugin: ModelPl,
   10     10   
}
   11     11   
   12     12   
impl<Body, L, HttpPl, ModelPl> SimpleServiceBuilder<Body, L, HttpPl, ModelPl> {
   13     13   
    /// Sets the [`Operation`](crate::operation_shape::Operation) operation.
   14     14   
    ///
   15         -
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
   16         -
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          15  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
          16  +
    /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
   17     17   
    ///
   18     18   
    /// # Example
   19     19   
    ///
   20     20   
    /// ```no_run
   21     21   
    /// use simple::{SimpleService, SimpleServiceConfig};
   22     22   
    ///
   23     23   
    /// use simple::{input, output, error};
   24     24   
    ///
   25     25   
    /// async fn handler(input: input::OperationInput) -> Result<output::OperationOutput, error::OperationError> {
   26     26   
    ///     todo!()
   27     27   
    /// }
   28     28   
    ///
   29     29   
    /// let config = SimpleServiceConfig::builder().build();
   30     30   
    /// let app = SimpleService::builder(config)
   31     31   
    ///     .operation(handler)
   32     32   
    ///     /* Set other handlers */
   33     33   
    ///     .build()
   34     34   
    ///     .unwrap();
   35         -
    /// # let app: SimpleService<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::rest::router::RestRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::rest_json_1::RestJson1>> = app;
          35  +
    /// # let app: SimpleService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>> = app;
   36     36   
    /// ```
   37     37   
    ///
   38     38   
                    pub fn operation<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
   39     39   
                    where
   40         -
                        HandlerType: ::aws_smithy_http_server::operation::Handler<crate::operation_shape::Operation, HandlerExtractors>,
          40  +
                        HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::Operation, HandlerExtractors>,
   41     41   
   42         -
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
          42  +
                        ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
   43     43   
                            SimpleService<L>,
   44     44   
                            crate::operation_shape::Operation,
   45         -
                            ::aws_smithy_http_server::operation::IntoService<crate::operation_shape::Operation, HandlerType>
          45  +
                            ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::Operation, HandlerType>
   46     46   
                        >,
   47         -
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
          47  +
                        ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
   48     48   
                            SimpleService<L>,
   49     49   
                            crate::operation_shape::Operation,
   50     50   
                            ModelPl::Output
   51     51   
                        >,
   52         -
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
          52  +
                        HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
   53     53   
                            SimpleService<L>,
   54     54   
                            crate::operation_shape::Operation,
   55     55   
                            <
   56         -
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
   57         -
                                as ::aws_smithy_http_server::plugin::Plugin<
          56  +
                                ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
          57  +
                                as ::aws_smithy_legacy_http_server::plugin::Plugin<
   58     58   
                                    SimpleService<L>,
   59     59   
                                    crate::operation_shape::Operation,
   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,
          65  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
   66     66   
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
   67     67   
   68     68   
                    {
   69         -
        use ::aws_smithy_http_server::operation::OperationShapeExt;
   70         -
        use ::aws_smithy_http_server::plugin::Plugin;
          69  +
        use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
          70  +
        use ::aws_smithy_legacy_http_server::plugin::Plugin;
   71     71   
        let svc = crate::operation_shape::Operation::from_handler(handler);
   72     72   
        let svc = self.model_plugin.apply(svc);
   73         -
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
          73  +
        let svc =
          74  +
            ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
   74     75   
                .apply(svc);
   75     76   
        let svc = self.http_plugin.apply(svc);
   76     77   
        self.operation_custom(svc)
   77     78   
    }
   78     79   
   79     80   
    /// Sets the [`Operation`](crate::operation_shape::Operation) operation.
   80     81   
    ///
   81         -
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
   82         -
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          82  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
          83  +
    /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
   83     84   
    ///
   84     85   
    /// # Example
   85     86   
    ///
   86     87   
    /// ```no_run
   87     88   
    /// use simple::{SimpleService, SimpleServiceConfig};
   88     89   
    ///
   89     90   
    /// use simple::{input, output, error};
   90     91   
    ///
   91     92   
    /// async fn handler(input: input::OperationInput) -> Result<output::OperationOutput, error::OperationError> {
   92     93   
    ///     todo!()
   93     94   
    /// }
   94     95   
    ///
   95     96   
    /// let config = SimpleServiceConfig::builder().build();
   96     97   
    /// let svc = ::tower::util::service_fn(handler);
   97     98   
    /// let app = SimpleService::builder(config)
   98     99   
    ///     .operation_service(svc)
   99    100   
    ///     /* Set other handlers */
  100    101   
    ///     .build()
  101    102   
    ///     .unwrap();
  102         -
    /// # let app: SimpleService<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::rest::router::RestRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::rest_json_1::RestJson1>> = app;
         103  +
    /// # let app: SimpleService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>> = app;
  103    104   
    /// ```
  104    105   
    ///
  105    106   
                    pub fn operation_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
  106    107   
                    where
  107         -
                        S: ::aws_smithy_http_server::operation::OperationService<crate::operation_shape::Operation, ServiceExtractors>,
         108  +
                        S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::Operation, ServiceExtractors>,
  108    109   
  109         -
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
         110  +
                        ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
  110    111   
                            SimpleService<L>,
  111    112   
                            crate::operation_shape::Operation,
  112         -
                            ::aws_smithy_http_server::operation::Normalize<crate::operation_shape::Operation, S>
         113  +
                            ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::Operation, S>
  113    114   
                        >,
  114         -
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
         115  +
                        ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
  115    116   
                            SimpleService<L>,
  116    117   
                            crate::operation_shape::Operation,
  117    118   
                            ModelPl::Output
  118    119   
                        >,
  119         -
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
         120  +
                        HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
  120    121   
                            SimpleService<L>,
  121    122   
                            crate::operation_shape::Operation,
  122    123   
                            <
  123         -
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
  124         -
                                as ::aws_smithy_http_server::plugin::Plugin<
         124  +
                                ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
         125  +
                                as ::aws_smithy_legacy_http_server::plugin::Plugin<
  125    126   
                                    SimpleService<L>,
  126    127   
                                    crate::operation_shape::Operation,
  127    128   
                                    ModelPl::Output
  128    129   
                                >
  129    130   
                            >::Output
  130    131   
                        >,
  131    132   
  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: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
  133    134   
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
  134    135   
  135    136   
                    {
  136         -
        use ::aws_smithy_http_server::operation::OperationShapeExt;
  137         -
        use ::aws_smithy_http_server::plugin::Plugin;
         137  +
        use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
         138  +
        use ::aws_smithy_legacy_http_server::plugin::Plugin;
  138    139   
        let svc = crate::operation_shape::Operation::from_service(service);
  139    140   
        let svc = self.model_plugin.apply(svc);
  140         -
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
         141  +
        let svc =
         142  +
            ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
  141    143   
                .apply(svc);
  142    144   
        let svc = self.http_plugin.apply(svc);
  143    145   
        self.operation_custom(svc)
  144    146   
    }
  145    147   
  146    148   
    /// Sets the [`Operation`](crate::operation_shape::Operation) to a custom [`Service`](tower::Service).
  147    149   
    /// not constrained by the Smithy contract.
  148    150   
    fn operation_custom<S>(mut self, svc: S) -> Self
  149    151   
    where
  150    152   
        S: ::tower::Service<
  151    153   
                ::http::Request<Body>,
  152         -
                Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         154  +
                Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
  153    155   
                Error = ::std::convert::Infallible,
  154    156   
            > + Clone
  155    157   
            + Send
  156    158   
            + 'static,
  157    159   
        S::Future: Send + 'static,
  158    160   
    {
  159         -
        self.operation = Some(::aws_smithy_http_server::routing::Route::new(svc));
         161  +
        self.operation = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
  160    162   
        self
  161    163   
    }
  162    164   
}
  163    165   
  164    166   
impl<Body, L, HttpPl, ModelPl> SimpleServiceBuilder<Body, L, HttpPl, ModelPl> {
  165    167   
    /// Constructs a [`SimpleService`] from the arguments provided to the builder.
  166    168   
    ///
  167    169   
    /// Forgetting to register a handler for one or more operations will result in an error.
  168    170   
    ///
  169    171   
    /// Check out [`SimpleServiceBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
  170    172   
    /// unspecified route is requested.
  171    173   
    pub fn build(
  172    174   
        self,
  173    175   
    ) -> ::std::result::Result<
  174    176   
        SimpleService<
  175         -
            ::aws_smithy_http_server::routing::RoutingService<
  176         -
                ::aws_smithy_http_server::protocol::rest::router::RestRouter<L::Service>,
  177         -
                ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         177  +
            ::aws_smithy_legacy_http_server::routing::RoutingService<
         178  +
                ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
         179  +
                ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  178    180   
            >,
  179    181   
        >,
  180    182   
        MissingOperationsError,
  181    183   
    >
  182    184   
    where
  183         -
        L: ::tower::Layer<::aws_smithy_http_server::routing::Route<Body>>,
         185  +
        L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
  184    186   
    {
  185    187   
        let router = {
  186         -
            use ::aws_smithy_http_server::operation::OperationShape;
         188  +
            use ::aws_smithy_legacy_http_server::operation::OperationShape;
  187    189   
            let mut missing_operation_names = std::collections::HashMap::new();
  188    190   
            if self.operation.is_none() {
  189    191   
                missing_operation_names
  190    192   
                    .insert(crate::operation_shape::Operation::ID, ".operation()");
  191    193   
            }
  192    194   
            if !missing_operation_names.is_empty() {
  193    195   
                return Err(MissingOperationsError {
  194    196   
                    operation_names2setter_methods: missing_operation_names,
  195    197   
                });
  196    198   
            }
  197    199   
            let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
  198    200   
  199         -
            ::aws_smithy_http_server::protocol::rest::router::RestRouter::from_iter([(
         201  +
            ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([(
  200    202   
                request_specs::operation(),
  201    203   
                self.operation.expect(unexpected_error_msg),
  202    204   
            )])
  203    205   
        };
  204         -
        let svc = ::aws_smithy_http_server::routing::RoutingService::new(router);
         206  +
        let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
  205    207   
        let svc = svc.map(|s| s.layer(self.layer));
  206    208   
        Ok(SimpleService { svc })
  207    209   
    }
  208    210   
  209    211   
    /// Constructs a [`SimpleService`] from the arguments provided to the builder.
  210    212   
    /// Operations without a handler default to returning 500 Internal Server Error to the caller.
  211    213   
    ///
  212    214   
    /// Check out [`SimpleServiceBuilder::build`] if you'd prefer the builder to fail if one or more operations do
  213    215   
    /// not have a registered handler.
  214    216   
    pub fn build_unchecked(self) -> SimpleService<L::Service>
  215    217   
    where
  216    218   
        Body: Send + 'static,
  217    219   
        L: ::tower::Layer<
  218         -
            ::aws_smithy_http_server::routing::RoutingService<
  219         -
                ::aws_smithy_http_server::protocol::rest::router::RestRouter<
  220         -
                    ::aws_smithy_http_server::routing::Route<Body>,
         220  +
            ::aws_smithy_legacy_http_server::routing::RoutingService<
         221  +
                ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
         222  +
                    ::aws_smithy_legacy_http_server::routing::Route<Body>,
  221    223   
                >,
  222         -
                ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         224  +
                ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  223    225   
            >,
  224    226   
        >,
  225    227   
    {
  226         -
        let router = ::aws_smithy_http_server::protocol::rest::router::RestRouter::from_iter([(
         228  +
        let router =
         229  +
            ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter::from_iter([(
  227    230   
                request_specs::operation(),
  228    231   
                self.operation.unwrap_or_else(|| {
  229         -
                let svc = ::aws_smithy_http_server::operation::MissingFailure::<
  230         -
                    ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         232  +
                    let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
         233  +
                        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  231    234   
                    >::default();
  232         -
                ::aws_smithy_http_server::routing::Route::new(svc)
         235  +
                    ::aws_smithy_legacy_http_server::routing::Route::new(svc)
  233    236   
                }),
  234    237   
            )]);
  235    238   
        let svc = self
  236    239   
            .layer
  237         -
            .layer(::aws_smithy_http_server::routing::RoutingService::new(
  238         -
                router,
  239         -
            ));
         240  +
            .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
  240    241   
        SimpleService { svc }
  241    242   
    }
  242    243   
}
  243    244   
  244    245   
/// The error encountered when calling the [`SimpleServiceBuilder::build`] method if one or more operation handlers are not
  245    246   
/// specified.
  246    247   
#[derive(Debug)]
  247    248   
pub struct MissingOperationsError {
  248    249   
    operation_names2setter_methods:
  249         -
        std::collections::HashMap<::aws_smithy_http_server::shape_id::ShapeId, &'static str>,
         250  +
        std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
  250    251   
}
  251    252   
  252    253   
impl std::fmt::Display for MissingOperationsError {
  253    254   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  254    255   
        write!(
  255    256   
            f,
  256    257   
            "You must specify a handler for all operations attached to `SimpleService`.\n\
  257    258   
                            We are missing handlers for the following operations:\n",
  258    259   
        )?;
  259    260   
        for operation_name in self.operation_names2setter_methods.keys() {
  260    261   
            writeln!(f, "- {}", operation_name.absolute())?;
  261    262   
        }
  262    263   
  263    264   
        writeln!(f, "\nUse the dedicated methods on `SimpleServiceBuilder` to register the missing handlers:")?;
  264    265   
        for setter_name in self.operation_names2setter_methods.values() {
  265    266   
            writeln!(f, "- {}", setter_name)?;
  266    267   
        }
  267    268   
        Ok(())
  268    269   
    }
  269    270   
}
  270    271   
  271    272   
impl std::error::Error for MissingOperationsError {}
  272    273   
  273    274   
mod request_specs {
  274         -
    pub(super) fn operation() -> ::aws_smithy_http_server::routing::request_spec::RequestSpec {
  275         -
        ::aws_smithy_http_server::routing::request_spec::RequestSpec::new(
         275  +
    pub(super) fn operation() -> ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec
         276  +
    {
         277  +
        ::aws_smithy_legacy_http_server::routing::request_spec::RequestSpec::new(
  276    278   
                    ::http::Method::POST,
  277         -
                    ::aws_smithy_http_server::routing::request_spec::UriSpec::new(
  278         -
                        ::aws_smithy_http_server::routing::request_spec::PathAndQuerySpec::new(
  279         -
                            ::aws_smithy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
  280         -
    ::aws_smithy_http_server::routing::request_spec::PathSegment::Literal(String::from("operation")),
         279  +
                    ::aws_smithy_legacy_http_server::routing::request_spec::UriSpec::new(
         280  +
                        ::aws_smithy_legacy_http_server::routing::request_spec::PathAndQuerySpec::new(
         281  +
                            ::aws_smithy_legacy_http_server::routing::request_spec::PathSpec::from_vector_unchecked(vec![
         282  +
    ::aws_smithy_legacy_http_server::routing::request_spec::PathSegment::Literal(String::from("operation")),
  281    283   
]),
  282         -
                            ::aws_smithy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
         284  +
                            ::aws_smithy_legacy_http_server::routing::request_spec::QuerySpec::from_vector_unchecked(vec![
  283    285   
])
  284    286   
                        )
  285    287   
                    ),
  286    288   
                )
  287    289   
    }
  288    290   
}
  289    291   
  290    292   
#[allow(missing_docs)] // documentation missing in model
  291    293   
///
  292    294   
/// See the [root](crate) documentation for more information.
  293    295   
#[derive(Clone)]
  294    296   
pub struct SimpleService<
  295         -
    S = ::aws_smithy_http_server::routing::RoutingService<
  296         -
        ::aws_smithy_http_server::protocol::rest::router::RestRouter<
  297         -
            ::aws_smithy_http_server::routing::Route<::aws_smithy_http_server::body::BoxBody>,
         297  +
    S = ::aws_smithy_legacy_http_server::routing::RoutingService<
         298  +
        ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
         299  +
            ::aws_smithy_legacy_http_server::routing::Route<
         300  +
                ::aws_smithy_legacy_http_server::body::BoxBody,
         301  +
            >,
  298    302   
        >,
  299         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         303  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  300    304   
    >,
  301    305   
> {
  302    306   
    // This is the router wrapped by layers.
  303    307   
    svc: S,
  304    308   
}
  305    309   
  306    310   
impl SimpleService<()> {
  307    311   
    /// Constructs a builder for [`SimpleService`].
  308    312   
    /// You must specify a configuration object holding any plugins and layers that should be applied
  309    313   
    /// to the operations in this service.
  310    314   
    pub fn builder<
  311    315   
        Body,
  312    316   
        L,
  313         -
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
  314         -
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
         317  +
        HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
         318  +
        ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
  315    319   
    >(
  316    320   
        config: SimpleServiceConfig<L, HttpPl, ModelPl>,
  317    321   
    ) -> SimpleServiceBuilder<Body, L, HttpPl, ModelPl> {
  318    322   
        SimpleServiceBuilder {
  319    323   
            operation: None,
  320    324   
            layer: config.layers,
  321    325   
            http_plugin: config.http_plugins,
  322    326   
            model_plugin: config.model_plugins,
  323    327   
        }
  324    328   
    }
  325    329   
  326    330   
    /// Constructs a builder for [`SimpleService`].
  327    331   
    /// You must specify what plugins should be applied to the operations in this service.
  328    332   
    ///
  329    333   
    /// Use [`SimpleService::builder_without_plugins`] if you don't need to apply plugins.
  330    334   
    ///
  331         -
    /// Check out [`HttpPlugins`](::aws_smithy_http_server::plugin::HttpPlugins) and
  332         -
    /// [`ModelPlugins`](::aws_smithy_http_server::plugin::ModelPlugins) if you need to apply
         335  +
    /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
         336  +
    /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
  333    337   
    /// multiple plugins.
  334    338   
    #[deprecated(
  335    339   
        since = "0.57.0",
  336    340   
        note = "please use the `builder` constructor and register plugins on the `SimpleServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
  337    341   
    )]
  338    342   
    pub fn builder_with_plugins<
  339    343   
        Body,
  340         -
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
  341         -
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
         344  +
        HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
         345  +
        ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
  342    346   
    >(
  343    347   
        http_plugin: HttpPl,
  344    348   
        model_plugin: ModelPl,
  345    349   
    ) -> SimpleServiceBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
  346    350   
        SimpleServiceBuilder {
  347    351   
            operation: None,
  348    352   
            layer: ::tower::layer::util::Identity::new(),
  349    353   
            http_plugin,
  350    354   
            model_plugin,
  351    355   
        }
  352    356   
    }
  353    357   
  354    358   
    /// Constructs a builder for [`SimpleService`].
  355    359   
    ///
  356    360   
    /// Use [`SimpleService::builder_with_plugins`] if you need to specify plugins.
  357    361   
    #[deprecated(
  358    362   
        since = "0.57.0",
  359    363   
        note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
  360    364   
    )]
  361    365   
    pub fn builder_without_plugins<Body>() -> SimpleServiceBuilder<
  362    366   
        Body,
  363    367   
        ::tower::layer::util::Identity,
  364         -
        ::aws_smithy_http_server::plugin::IdentityPlugin,
  365         -
        ::aws_smithy_http_server::plugin::IdentityPlugin,
         368  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         369  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
  366    370   
    > {
  367    371   
        Self::builder_with_plugins(
  368         -
            ::aws_smithy_http_server::plugin::IdentityPlugin,
  369         -
            ::aws_smithy_http_server::plugin::IdentityPlugin,
         372  +
            ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         373  +
            ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
  370    374   
        )
  371    375   
    }
  372    376   
}
  373    377   
  374    378   
impl<S> SimpleService<S> {
  375    379   
    /// Converts [`SimpleService`] into a [`MakeService`](tower::make::MakeService).
  376         -
    pub fn into_make_service(self) -> ::aws_smithy_http_server::routing::IntoMakeService<Self> {
  377         -
        ::aws_smithy_http_server::routing::IntoMakeService::new(self)
         380  +
    pub fn into_make_service(
         381  +
        self,
         382  +
    ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
         383  +
        ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
  378    384   
    }
  379    385   
  380         -
    /// Converts [`SimpleService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_http_server::request::connect_info::ConnectInfo).
         386  +
    /// Converts [`SimpleService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
  381    387   
    pub fn into_make_service_with_connect_info<C>(
  382    388   
        self,
  383         -
    ) -> ::aws_smithy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
  384         -
        ::aws_smithy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
         389  +
    ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
         390  +
        ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
  385    391   
    }
  386    392   
}
  387    393   
  388    394   
impl<S>
  389    395   
    SimpleService<
  390         -
        ::aws_smithy_http_server::routing::RoutingService<
  391         -
            ::aws_smithy_http_server::protocol::rest::router::RestRouter<S>,
  392         -
            ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         396  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         397  +
            ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<S>,
         398  +
            ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  393    399   
        >,
  394    400   
    >
  395    401   
{
  396    402   
    /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
  397    403   
    #[deprecated(
  398    404   
        since = "0.57.0",
  399    405   
        note = "please add layers to the `SimpleServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
  400    406   
    )]
  401    407   
    pub fn layer<L>(
  402    408   
        self,
  403    409   
        layer: &L,
  404    410   
    ) -> SimpleService<
  405         -
        ::aws_smithy_http_server::routing::RoutingService<
  406         -
            ::aws_smithy_http_server::protocol::rest::router::RestRouter<L::Service>,
  407         -
            ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         411  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         412  +
            ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<L::Service>,
         413  +
            ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  408    414   
        >,
  409    415   
    >
  410    416   
    where
  411    417   
        L: ::tower::Layer<S>,
  412    418   
    {
  413    419   
        SimpleService {
  414    420   
            svc: self.svc.map(|s| s.layer(layer)),
  415    421   
        }
  416    422   
    }
  417    423   
  418         -
    /// Applies [`Route::new`](::aws_smithy_http_server::routing::Route::new) to all routes.
         424  +
    /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
  419    425   
    ///
  420    426   
    /// This has the effect of erasing all types accumulated via layers.
  421    427   
    pub fn boxed<B>(
  422    428   
        self,
  423    429   
    ) -> SimpleService<
  424         -
        ::aws_smithy_http_server::routing::RoutingService<
  425         -
            ::aws_smithy_http_server::protocol::rest::router::RestRouter<
  426         -
                ::aws_smithy_http_server::routing::Route<B>,
         430  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         431  +
            ::aws_smithy_legacy_http_server::protocol::rest::router::RestRouter<
         432  +
                ::aws_smithy_legacy_http_server::routing::Route<B>,
  427    433   
            >,
  428         -
            ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
         434  +
            ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
  429    435   
        >,
  430    436   
    >
  431    437   
    where
  432    438   
        S: ::tower::Service<
  433    439   
            ::http::Request<B>,
  434         -
            Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         440  +
            Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
  435    441   
            Error = std::convert::Infallible,
  436    442   
        >,
  437    443   
        S: Clone + Send + 'static,
  438    444   
        S::Future: Send + 'static,
  439    445   
    {
  440    446   
        self.layer(&::tower::layer::layer_fn(
  441         -
            ::aws_smithy_http_server::routing::Route::new,
         447  +
            ::aws_smithy_legacy_http_server::routing::Route::new,
  442    448   
        ))
  443    449   
    }
  444    450   
}
  445    451   
  446    452   
impl<S, R> ::tower::Service<R> for SimpleService<S>
  447    453   
where
  448    454   
    S: ::tower::Service<R>,
  449    455   
{
  450    456   
    type Response = S::Response;
  451    457   
    type Error = S::Error;
  452    458   
    type Future = S::Future;
  453    459   
  454    460   
    fn poll_ready(
  455    461   
        &mut self,
  456    462   
        cx: &mut std::task::Context,
  457    463   
    ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
  458    464   
        self.svc.poll_ready(cx)
  459    465   
    }
  460    466   
  461    467   
    fn call(&mut self, request: R) -> Self::Future {
  462    468   
        self.svc.call(request)
  463    469   
    }
  464    470   
}
  465    471   
  466    472   
/// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in SimpleService.
  467    473   
#[allow(clippy::enum_variant_names)]
  468    474   
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
  469    475   
pub enum Operation {
  470    476   
    Operation,
  471    477   
}
  472    478   
  473    479   
impl Operation {
  474         -
    /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_http_server::shape_id::ShapeId).
  475         -
    pub fn shape_id(&self) -> ::aws_smithy_http_server::shape_id::ShapeId {
         480  +
    /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
         481  +
    pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
  476    482   
        match self {
  477         -
            Operation::Operation => ::aws_smithy_http_server::shape_id::ShapeId::new(
         483  +
            Operation::Operation => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
  478    484   
                "com.amazonaws.simple#Operation",
  479    485   
                "com.amazonaws.simple",
  480    486   
                "Operation",
  481    487   
            ),
  482    488   
        }
  483    489   
    }
  484    490   
}
  485         -
impl<L> ::aws_smithy_http_server::service::ContainsOperation<crate::operation_shape::Operation>
         491  +
impl<L>
         492  +
    ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::Operation>
  486    493   
    for SimpleService<L>
  487    494   
{
  488    495   
    const VALUE: Operation = Operation::Operation;
  489    496   
}
  490    497   
  491         -
impl<S> ::aws_smithy_http_server::service::ServiceShape for SimpleService<S> {
  492         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
  493         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
         498  +
impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for SimpleService<S> {
         499  +
    const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
         500  +
        ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
  494    501   
            "com.amazonaws.simple#SimpleService",
  495    502   
            "com.amazonaws.simple",
  496    503   
            "SimpleService",
  497    504   
        );
  498    505   
  499    506   
    const VERSION: Option<&'static str> = Some("");
  500    507   
  501         -
    type Protocol = ::aws_smithy_http_server::protocol::rest_json_1::RestJson1;
         508  +
    type Protocol = ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1;
  502    509   
  503    510   
    type Operations = Operation;
  504    511   
}
  505    512   
/// Configuration for the [`SimpleService`]. This is the central place where to register and
  506    513   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
  507    514   
///
  508    515   
/// ```rust,no_run
  509    516   
/// # use simple::SimpleServiceConfig;
  510         -
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
         517  +
/// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
  511    518   
/// # use ::tower::layer::util::Identity;
  512    519   
/// # let authentication_plugin = IdentityPlugin;
  513    520   
/// # let authorization_plugin = IdentityPlugin;
  514    521   
/// # let server_request_id_provider_layer = Identity::new();
  515    522   
/// let config = SimpleServiceConfig::builder()
  516    523   
///     // Layers get executed first...
  517    524   
///     .layer(server_request_id_provider_layer)
  518    525   
///     // ...then HTTP plugins...
  519    526   
///     .http_plugin(authentication_plugin)
  520    527   
///     // ...and right after deserialization, model plugins.
  521    528   
///     .model_plugin(authorization_plugin)
  522    529   
///     .build();
  523    530   
/// ```
  524    531   
///
  525    532   
/// See the [`plugin`] system for details.
  526    533   
///
  527         -
/// [`plugin`]: ::aws_smithy_http_server::plugin
         534  +
/// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
  528    535   
#[derive(::std::fmt::Debug)]
  529    536   
pub struct SimpleServiceConfig<L, H, M> {
  530    537   
    layers: L,
  531    538   
    http_plugins: H,
  532    539   
    model_plugins: M,
  533    540   
}
  534    541   
  535    542   
impl SimpleServiceConfig<(), (), ()> {
  536    543   
    /// Returns a builder to construct the configuration.
  537    544   
    pub fn builder() -> SimpleServiceConfigBuilder<
  538    545   
        ::tower::layer::util::Identity,
  539         -
        ::aws_smithy_http_server::plugin::IdentityPlugin,
  540         -
        ::aws_smithy_http_server::plugin::IdentityPlugin,
         546  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         547  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
  541    548   
    > {
  542    549   
        SimpleServiceConfigBuilder {
  543    550   
            layers: ::tower::layer::util::Identity::new(),
  544         -
            http_plugins: ::aws_smithy_http_server::plugin::IdentityPlugin,
  545         -
            model_plugins: ::aws_smithy_http_server::plugin::IdentityPlugin,
         551  +
            http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         552  +
            model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
  546    553   
        }
  547    554   
    }
  548    555   
}
  549    556   
  550    557   
/// Builder returned by [`SimpleServiceConfig::builder()`].
  551    558   
#[derive(::std::fmt::Debug)]
  552    559   
pub struct SimpleServiceConfigBuilder<L, H, M> {
  553    560   
    pub(crate) layers: L,
  554    561   
    pub(crate) http_plugins: H,
  555    562   
    pub(crate) model_plugins: M,
  556    563   
}
  557    564   
  558    565   
impl<L, H, M> SimpleServiceConfigBuilder<L, H, M> {
  559    566   
    /// Add a [`::tower::Layer`] to the service.
  560    567   
    pub fn layer<NewLayer>(
  561    568   
        self,
  562    569   
        layer: NewLayer,
  563    570   
    ) -> SimpleServiceConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
  564    571   
        SimpleServiceConfigBuilder {
  565    572   
            layers: ::tower::layer::util::Stack::new(layer, self.layers),
  566    573   
            http_plugins: self.http_plugins,
  567    574   
            model_plugins: self.model_plugins,
  568    575   
        }
  569    576   
    }
  570    577   
  571    578   
    /// Add a HTTP [plugin] to the service.
  572    579   
    ///
  573         -
    /// [plugin]: ::aws_smithy_http_server::plugin
         580  +
    /// [plugin]: ::aws_smithy_legacy_http_server::plugin
  574    581   
    // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
  575    582   
    // errors get _substantially_ better if the user makes a mistake.
  576         -
    pub fn http_plugin<NewPlugin: ::aws_smithy_http_server::plugin::HttpMarker>(
         583  +
    pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
  577    584   
        self,
  578    585   
        http_plugin: NewPlugin,
  579         -
    ) -> SimpleServiceConfigBuilder<L, ::aws_smithy_http_server::plugin::PluginStack<NewPlugin, H>, M>
  580         -
    {
         586  +
    ) -> SimpleServiceConfigBuilder<
         587  +
        L,
         588  +
        ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
         589  +
        M,
         590  +
    > {
  581    591   
        SimpleServiceConfigBuilder {
  582    592   
            layers: self.layers,
  583         -
            http_plugins: ::aws_smithy_http_server::plugin::PluginStack::new(
         593  +
            http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
  584    594   
                http_plugin,
  585    595   
                self.http_plugins,
  586    596   
            ),
  587    597   
            model_plugins: self.model_plugins,
  588    598   
        }
  589    599   
    }
  590    600   
  591    601   
    /// Add a model [plugin] to the service.
  592    602   
    ///
  593         -
    /// [plugin]: ::aws_smithy_http_server::plugin
         603  +
    /// [plugin]: ::aws_smithy_legacy_http_server::plugin
  594    604   
    // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
  595    605   
    // errors get _substantially_ better if the user makes a mistake.
  596         -
    pub fn model_plugin<NewPlugin: ::aws_smithy_http_server::plugin::ModelMarker>(
         606  +
    pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
  597    607   
        self,
  598    608   
        model_plugin: NewPlugin,
  599         -
    ) -> SimpleServiceConfigBuilder<L, H, ::aws_smithy_http_server::plugin::PluginStack<NewPlugin, M>>
  600         -
    {
         609  +
    ) -> SimpleServiceConfigBuilder<
         610  +
        L,
         611  +
        H,
         612  +
        ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
         613  +
    > {
  601    614   
        SimpleServiceConfigBuilder {
  602    615   
            layers: self.layers,
  603    616   
            http_plugins: self.http_plugins,
  604         -
            model_plugins: ::aws_smithy_http_server::plugin::PluginStack::new(
         617  +
            model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
  605    618   
                model_plugin,
  606    619   
                self.model_plugins,
  607    620   
            ),
  608    621   
        }
  609    622   
    }
  610    623   
  611    624   
    /// Build the configuration.
  612    625   
    pub fn build(self) -> super::SimpleServiceConfig<L, H, M> {
  613    626   
        super::SimpleServiceConfig {
  614    627   
            layers: self.layers,

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/Cargo.toml

@@ -1,1 +59,59 @@
    2      2   
[package]
    3      3   
name = "unique_items"
    4      4   
version = "0.0.1"
    5      5   
authors = ["protocoltest@example.com"]
    6      6   
description = "test"
    7      7   
edition = "2021"
    8      8   
    9      9   
[package.metadata.smithy]
   10     10   
codegen-version = "ci"
   11     11   
protocol = "aws.protocols#restJson1"
   12         -
[dependencies.aws-smithy-http]
   13         -
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   14         -
[dependencies.aws-smithy-http-server]
   15         -
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server"
   16     12   
[dependencies.aws-smithy-http-server-python]
   17     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server-python"
   18     14   
[dependencies.aws-smithy-json]
   19     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
          16  +
[dependencies.aws-smithy-legacy-http]
          17  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http"
          18  +
[dependencies.aws-smithy-legacy-http-server]
          19  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http-server"
   20     20   
[dependencies.aws-smithy-runtime-api]
   21     21   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
          22  +
features = ["http-02x"]
   22     23   
[dependencies.aws-smithy-types]
   23     24   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          25  +
features = ["http-body-0-4-x"]
   24     26   
[dependencies.futures-util]
   25     27   
version = "0.3"
   26     28   
[dependencies.http]
   27     29   
version = "0.2.9"
   28     30   
[dependencies.hyper]
   29     31   
version = "0.14.26"
   30     32   
[dependencies.mime]
   31     33   
version = "0.3"
   32     34   
[dependencies.parking_lot]
   33     35   
version = "0.12"
   34     36   
[dependencies.pin-project-lite]
   35     37   
version = "0.2"
   36     38   
[dependencies.pyo3]
   37     39   
version = "0.20"
   38     40   
[dependencies.pyo3-asyncio]
   39     41   
version = "0.20"
   40     42   
features = ["attributes", "tokio-runtime"]
   41     43   
[dependencies.tower]
   42     44   
version = "0.4"
   43     45   
[dependencies.tracing]
   44     46   
version = "0.1"
   45         -
[dev-dependencies.hyper]
   46         -
version = "0.14.12"
   47     47   
[dev-dependencies.tokio]
   48     48   
version = "1.23.1"
   49     49   
[features]
   50     50   
rt-tokio = ["aws-smithy-types/rt-tokio"]
   51         -
aws-lambda = ["aws-smithy-http-server/aws-lambda"]
   52         -
request-id = ["aws-smithy-http-server/request-id"]
          51  +
aws-lambda = ["aws-smithy-legacy-http-server/aws-lambda"]
          52  +
request-id = ["aws-smithy-legacy-http-server/request-id"]
   53     53   
extension-module = ["pyo3/extension-module"]
   54     54   
default = ["rt-tokio", "request-id", "extension-module"]
   55     55   
[lib]
   56     56   
name = "unique_items"
   57     57   
crate-type = ["cdylib"]
   58     58   
   59     59   

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/python/unique_items/middleware/__init__.pyi

@@ -1,1 +38,38 @@
    1      1   
import typing
    2      2   
    3      3   
class MiddlewareException(Exception):
    4      4   
    """
    5      5   
    Exception that can be thrown from a Python middleware.
    6      6   
    7      7   
    It allows to specify a message and HTTP status code and implementing protocol specific capabilities
    8         -
    to build a [aws_smithy_http_server::response::Response] from it.
           8  +
    to build a [aws_smithy_legacy_http_server::response::Response] from it.
    9      9   
    """
   10     10   
   11     11   
    message: str
   12     12   
   13     13   
    status_code: int
   14     14   
   15     15   
    def __init__(self, message: str, status_code: typing.Optional[int] = ...) -> None:
   16     16   
        ...
   17     17   
   18     18   

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/input.rs

@@ -78,78 +138,138 @@
   98     98   
                ConstraintViolation::Set(inner) => {
   99     99   
                    inner.as_validation_exception_field(path + "/set")
  100    100   
                }
  101    101   
                ConstraintViolation::ComplexSet(inner) => {
  102    102   
                    inner.as_validation_exception_field(path + "/complexSet")
  103    103   
                }
  104    104   
            }
  105    105   
        }
  106    106   
    }
  107    107   
    impl ::std::convert::From<ConstraintViolation>
  108         -
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
         108  +
        for ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection
  109    109   
    {
  110    110   
        fn from(constraint_violation: ConstraintViolation) -> Self {
  111    111   
            let first_validation_exception_field =
  112    112   
                constraint_violation.as_validation_exception_field("".to_owned());
  113    113   
            let validation_exception = crate::error::ValidationException {
  114    114   
                message: format!(
  115    115   
                    "1 validation error detected. {}",
  116    116   
                    &first_validation_exception_field.message
  117    117   
                ),
  118    118   
                field_list: Some(vec![first_validation_exception_field]),

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/lib.rs

@@ -29,29 +128,129 @@
   49     49   
//!
   50     50   
//! # let app = UniqueItemsService::builder(
   51     51   
//! #     UniqueItemsServiceConfig::builder()
   52     52   
//! #         .build()
   53     53   
//! # ).build_unchecked();
   54     54   
//! let server = app.into_make_service();
   55     55   
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
   56     56   
//!     .expect("unable to parse the server bind address and port");
   57     57   
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
   58     58   
//! # }
          59  +
//!
   59     60   
//! ```
   60     61   
//!
   61     62   
//! ### Running on Lambda
   62     63   
//!
   63     64   
//! ```rust,ignore
   64     65   
//! use unique_items::server::routing::LambdaHandler;
   65     66   
//! use unique_items::UniqueItemsService;
   66     67   
//!
   67     68   
//! # async fn dummy() {
   68     69   
//! # let app = UniqueItemsService::builder(
   69     70   
//! #     UniqueItemsServiceConfig::builder()
   70     71   
//! #         .build()
   71     72   
//! # ).build_unchecked();
   72     73   
//! let handler = LambdaHandler::new(app);
   73     74   
//! lambda_http::run(handler).await.unwrap();
   74     75   
//! # }
   75     76   
//! ```
   76     77   
//!
   77     78   
//! # Building the UniqueItemsService
   78     79   
//!
   79     80   
//! To construct [`UniqueItemsService`] we use [`UniqueItemsServiceBuilder`] returned by [`UniqueItemsService::builder`].
   80     81   
//!
   81     82   
//! ## Plugins
   82     83   
//!
   83     84   
//! The [`UniqueItemsService::builder`] method, returning [`UniqueItemsServiceBuilder`],
   84     85   
//! accepts a config object on which plugins can be registered.
   85     86   
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
   86     87   
//!
   87     88   
//! ```rust,no_run
   88     89   
//! # use unique_items::server::plugin::IdentityPlugin as LoggingPlugin;
   89     90   
//! # use unique_items::server::plugin::IdentityPlugin as MetricsPlugin;
   90     91   
//! # use ::hyper::Body;
   91     92   
//! use unique_items::server::plugin::HttpPlugins;
   92     93   
//! use unique_items::{UniqueItemsService, UniqueItemsServiceConfig, UniqueItemsServiceBuilder};
   93     94   
//!
   94     95   
//! let http_plugins = HttpPlugins::new()
   95     96   
//!         .push(LoggingPlugin)
   96     97   
//!         .push(MetricsPlugin);
   97     98   
//! let config = UniqueItemsServiceConfig::builder().build();
   98         -
//! let builder: UniqueItemsServiceBuilder<Body, _, _, _> = UniqueItemsService::builder(config);
          99  +
//! let builder: UniqueItemsServiceBuilder<::hyper::Body, _, _, _> = UniqueItemsService::builder(config);
   99    100   
//! ```
  100    101   
//!
  101    102   
//! Check out [`crate::server::plugin`] to learn more about plugins.
  102    103   
//!
  103    104   
//! ## Handlers
  104    105   
//!
  105    106   
//! [`UniqueItemsServiceBuilder`] 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    107   
//! We call these async functions **handlers**. This is where your application business logic lives.
  107    108   
//!
  108    109   
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
@@ -164,165 +260,261 @@
  184    185   
//!
  185    186   
//! use unique_items::{input, output, error};
  186    187   
//!
  187    188   
//! async fn malformed_unique_items(input: input::MalformedUniqueItemsInput) -> Result<output::MalformedUniqueItemsOutput, error::MalformedUniqueItemsError> {
  188    189   
//!     todo!()
  189    190   
//! }
  190    191   
//!
  191    192   
//! ```
  192    193   
//!
  193    194   
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         195  +
//! [hyper server]: https://docs.rs/hyper/0.14.26/hyper/server/index.html
  194    196   
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
  195    197   
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
  196    198   
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
  197         -
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  198    199   
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
  199    200   
pub use crate::service::{
  200    201   
    MissingOperationsError, UniqueItemsService, UniqueItemsServiceBuilder,
  201    202   
    UniqueItemsServiceConfig, UniqueItemsServiceConfigBuilder,
  202    203   
};
  203    204   
  204    205   
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
  205    206   
pub mod server {
  206    207   
    // Re-export all types from the `aws-smithy-http-server` crate.
  207         -
    pub use ::aws_smithy_http_server::*;
         208  +
    pub use ::aws_smithy_legacy_http_server::*;
  208    209   
}
  209    210   
  210    211   
/// Crate version number.
  211    212   
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
  212    213   
  213    214   
/// All error types that operations can return. Documentation on these types is copied from the model.
  214    215   
pub mod error;
  215    216   
  216    217   
/// Input structures for operations. Documentation on these types is copied from the model.
  217    218   
pub mod input;
  218    219   
  219    220   
/// Data structures used by operation inputs/outputs. Documentation on these types is copied from the model.
  220    221   
pub mod model;
  221    222   
  222    223   
/// All operations that this crate can perform.
  223    224   
pub mod operation;
  224    225   
  225    226   
/// A collection of types representing each operation defined in the service closure.
  226    227   
///
  227         -
/// The [plugin system](::aws_smithy_http_server::plugin) makes use of these
         228  +
/// The [plugin system](::aws_smithy_legacy_http_server::plugin) makes use of these
  228    229   
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
  229         -
/// parameterize [`Plugin`](::aws_smithy_http_server::plugin::Plugin) implementations. Their traits, such as
  230         -
/// [`OperationShape`](::aws_smithy_http_server::operation::OperationShape), can be used to provide
         230  +
/// parameterize [`Plugin`](::aws_smithy_legacy_http_server::plugin::Plugin) implementations. Their traits, such as
         231  +
/// [`OperationShape`](::aws_smithy_legacy_http_server::operation::OperationShape), can be used to provide
  231    232   
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
  232    233   
pub mod operation_shape;
  233    234   
  234    235   
/// Output structures for operations. Documentation on these types is copied from the model.
  235    236   
pub mod output;
  236    237   
  237    238   
/// Export PyO3 symbols in the shared library
  238    239   
pub mod python_module_export;
  239    240   
  240    241   
/// Operation adapters that delegate to Python handlers.

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/operation.rs

@@ -1,1 +98,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
::pin_project_lite::pin_project! {
    3      3   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
    4      4   
    /// [`MalformedUniqueItemsInput`](crate::input::MalformedUniqueItemsInput) using modelled bindings.
    5      5   
    pub struct MalformedUniqueItemsInputFuture {
    6         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
           6  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUniqueItemsInput, ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
    7      7   
    }
    8      8   
}
    9      9   
   10     10   
impl std::future::Future for MalformedUniqueItemsInputFuture {
   11     11   
    type Output = Result<
   12     12   
        crate::input::MalformedUniqueItemsInput,
   13         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
          13  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
   14     14   
    >;
   15     15   
   16     16   
    fn poll(
   17     17   
        self: std::pin::Pin<&mut Self>,
   18     18   
        cx: &mut std::task::Context<'_>,
   19     19   
    ) -> std::task::Poll<Self::Output> {
   20     20   
        let this = self.project();
   21     21   
        this.inner.as_mut().poll(cx)
   22     22   
    }
   23     23   
}
   24     24   
   25     25   
impl<B>
   26         -
    ::aws_smithy_http_server::request::FromRequest<
   27         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          26  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
          27  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   28     28   
        B,
   29     29   
    > for crate::input::MalformedUniqueItemsInput
   30     30   
where
   31         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          31  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   32     32   
    B: 'static,
   33     33   
   34     34   
    B::Data: Send,
   35         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   36         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          35  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          36  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   37     37   
{
   38         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
          38  +
    type Rejection =
          39  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
   39     40   
    type Future = MalformedUniqueItemsInputFuture;
   40     41   
   41     42   
    fn from_request(request: ::http::Request<B>) -> Self::Future {
   42     43   
        let fut = async move {
   43         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
          44  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
   44     45   
                request.headers(),
   45     46   
                &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
   46     47   
            ) {
   47         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
          48  +
                return Err(::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   48     49   
            }
   49     50   
            crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items_http_request(request)
   50     51   
                            .await
   51     52   
        };
   52     53   
        use ::futures_util::future::TryFutureExt;
   53         -
        let fut = fut.map_err(
   54         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
          54  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
   55     55   
                        ::tracing::debug!(error = %e, "failed to deserialize request");
   56         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   57         -
                    e,
   58         -
                )
   59         -
            },
   60         -
        );
          56  +
                        ::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e)
          57  +
                    });
   61     58   
        MalformedUniqueItemsInputFuture {
   62     59   
            inner: Box::pin(fut),
   63     60   
        }
   64     61   
    }
   65     62   
}
   66     63   
impl
   67         -
    ::aws_smithy_http_server::response::IntoResponse<
   68         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          64  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          65  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   69     66   
    > for crate::output::MalformedUniqueItemsOutput
   70     67   
{
   71         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          68  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
   72     69   
        match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_response(self) {
   73     70   
                        Ok(response) => response,
   74     71   
                        Err(e) => {
   75     72   
                            ::tracing::error!(error = %e, "failed to serialize response");
   76         -
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
          73  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   77     74   
                        }
   78     75   
                    }
   79     76   
    }
   80     77   
}
   81     78   
impl
   82         -
    ::aws_smithy_http_server::response::IntoResponse<
   83         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          79  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          80  +
        ::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1,
   84     81   
    > for crate::error::MalformedUniqueItemsError
   85     82   
{
   86         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          83  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
   87     84   
        match crate::protocol_serde::shape_malformed_unique_items::ser_malformed_unique_items_http_error(&self) {
   88     85   
            Ok(mut response) => {
   89         -
                response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
          86  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
   90     87   
                response
   91     88   
            },
   92     89   
            Err(e) => {
   93     90   
                ::tracing::error!(error = %e, "failed to serialize response");
   94         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
          91  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_legacy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   95     92   
            }
   96     93   
        }
   97     94   
    }
   98     95   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/operation_shape.rs

@@ -1,1 +38,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
pub struct MalformedUniqueItems;
    4      4   
    5         -
impl ::aws_smithy_http_server::operation::OperationShape for MalformedUniqueItems {
    6         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
    7         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
           5  +
impl ::aws_smithy_legacy_http_server::operation::OperationShape for MalformedUniqueItems {
           6  +
    const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
           7  +
        ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
    8      8   
            "com.amazonaws.constraints#MalformedUniqueItems",
    9      9   
            "com.amazonaws.constraints",
   10     10   
            "MalformedUniqueItems",
   11     11   
        );
   12     12   
   13     13   
    type Input = crate::input::MalformedUniqueItemsInput;
   14     14   
    type Output = crate::output::MalformedUniqueItemsOutput;
   15     15   
    type Error = crate::error::MalformedUniqueItemsError;
   16     16   
}
   17     17   
   18         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for MalformedUniqueItems {
   19         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   20         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   21         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
   22         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   23         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
          18  +
impl ::aws_smithy_legacy_http_server::instrumentation::sensitivity::Sensitivity
          19  +
    for MalformedUniqueItems
          20  +
{
          21  +
    type RequestFmt = ::aws_smithy_legacy_http_server::instrumentation::sensitivity::RequestFmt<
          22  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          23  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::uri::MakeUri<
          24  +
            ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          25  +
            ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
   24     26   
        >,
   25     27   
    >;
   26         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
   27         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   28         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
          28  +
    type ResponseFmt = ::aws_smithy_legacy_http_server::instrumentation::sensitivity::ResponseFmt<
          29  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
          30  +
        ::aws_smithy_legacy_http_server::instrumentation::MakeIdentity,
   29     31   
    >;
   30     32   
   31     33   
    fn request_fmt() -> Self::RequestFmt {
   32         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
          34  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::RequestFmt::new()
   33     35   
    }
   34     36   
   35     37   
    fn response_fmt() -> Self::ResponseFmt {
   36         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
          38  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   37     39   
    }
   38     40   
}

tmp-codegen-diff/codegen-server-test-python/unique_items/rust-server-codegen-python/src/protocol_serde/shape_malformed_unique_items.rs

@@ -1,1 +151,151 @@
    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_malformed_unique_items_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedUniqueItemsInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::malformed_unique_items_input_internal::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     22   
        let bytes = ::hyper::body::to_bytes(body).await?;
   23     23   
        if !bytes.is_empty() {
   24         -
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
   25     25   
                &headers,
   26     26   
                Some("application/json"),
   27     27   
            )?;
   28     28   
            input = crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items(
   29     29   
                bytes.as_ref(),
   30     30   
                input,
   31     31   
            )?;
   32     32   
        }
   33     33   
        input.build()?
   34     34   
    })
   35     35   
}
   36     36   
   37     37   
#[allow(clippy::unnecessary_wraps)]
   38     38   
pub fn ser_malformed_unique_items_http_response(
   39     39   
    #[allow(unused_variables)] output: crate::output::MalformedUniqueItemsOutput,
   40     40   
) -> std::result::Result<
   41         -
    ::aws_smithy_http_server::response::Response,
   42         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     43   
> {
   44     44   
    Ok({
   45     45   
        #[allow(unused_mut)]
   46     46   
        let mut builder = ::http::Response::builder();
   47         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   48     48   
            builder,
   49     49   
            ::http::header::CONTENT_TYPE,
   50     50   
            "application/json",
   51     51   
        );
   52     52   
        let http_status: u16 = 200;
   53     53   
        builder = builder.status(http_status);
   54     54   
        let payload = "";
   55     55   
        let content_length = payload.len();
   56         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   57     57   
            builder,
   58     58   
            ::http::header::CONTENT_LENGTH,
   59     59   
            content_length,
   60     60   
        );
   61         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   62     62   
        builder.body(body)?
   63     63   
    })
   64     64   
}
   65     65   
   66     66   
#[allow(clippy::unnecessary_wraps)]
   67     67   
pub fn ser_malformed_unique_items_http_error(
   68     68   
    error: &crate::error::MalformedUniqueItemsError,
   69     69   
) -> std::result::Result<
   70         -
    ::aws_smithy_http_server::response::Response,
   71         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          70  +
    ::aws_smithy_legacy_http_server::response::Response,
          71  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72     72   
> {
   73     73   
    Ok({
   74     74   
        match error {
   75     75   
            crate::error::MalformedUniqueItemsError::ValidationException(output) => {
   76     76   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   77     77   
                #[allow(unused_mut)]
   78     78   
                let mut builder = ::http::Response::builder();
   79         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   80     80   
                    builder,
   81     81   
                    ::http::header::CONTENT_TYPE,
   82     82   
                    "application/json",
   83     83   
                );
   84         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   85     85   
                    builder,
   86     86   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87     87   
                    "ValidationException",
   88     88   
                );
   89     89   
                let content_length = payload.len();
   90         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   91     91   
                    builder,
   92     92   
                    ::http::header::CONTENT_LENGTH,
   93     93   
                    content_length,
   94     94   
                );
   95     95   
                builder
   96     96   
                    .status(400)
   97         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          97  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   98     98   
            }
   99     99   
            crate::error::MalformedUniqueItemsError::InternalServerError(output) => {
  100    100   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  101    101   
                #[allow(unused_mut)]
  102    102   
                let mut builder = ::http::Response::builder();
  103         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         103  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  104    104   
                    builder,
  105    105   
                    ::http::header::CONTENT_TYPE,
  106    106   
                    "application/json",
  107    107   
                );
  108         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         108  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  109    109   
                    builder,
  110    110   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  111    111   
                    "InternalServerError",
  112    112   
                );
  113    113   
                let content_length = payload.len();
  114         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         114  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  115    115   
                    builder,
  116    116   
                    ::http::header::CONTENT_LENGTH,
  117    117   
                    content_length,
  118    118   
                );
  119    119   
                builder
  120    120   
                    .status(500)
  121         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         121  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  122    122   
            }
  123    123   
        }
  124    124   
    })
  125    125   
}
  126    126   
  127    127   
pub(crate) fn de_malformed_unique_items(
  128    128   
    value: &[u8],
  129    129   
    mut builder: crate::input::malformed_unique_items_input_internal::Builder,
  130    130   
) -> ::std::result::Result<
  131    131   
    crate::input::malformed_unique_items_input_internal::Builder,