Loading codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +4 −4 Original line number Diff line number Diff line Loading @@ -99,10 +99,10 @@ class ServerAwsJsonProtocol( override fun markerStruct(): RuntimeType { return when (version) { is AwsJsonVersion.Json10 -> { ServerRuntimeType.Protocol("AwsJson10", "aws_json_10", runtimeConfig) ServerRuntimeType.Protocol("AwsJson1_0", "aws_json_10", runtimeConfig) } is AwsJsonVersion.Json11 -> { ServerRuntimeType.Protocol("AwsJson11", "aws_json_11", runtimeConfig) ServerRuntimeType.Protocol("AwsJson1_1", "aws_json_11", runtimeConfig) } } } Loading Loading @@ -211,7 +211,7 @@ class ServerRestJsonProtocol( fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.codegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", "rest_json_1", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("RestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading Loading @@ -240,7 +240,7 @@ class ServerRestXmlProtocol( } } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", "rest_xml", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("RestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading design/src/rfcs/rfc0020_service_builder.md +3 −3 Original line number Diff line number Diff line Loading @@ -231,7 +231,7 @@ pub struct Route { enum Routes { RestXml(Vec<(Route, RequestSpec)>), RestJson1(Vec<(Route, RequestSpec)>), AwsJson10(TinyMap<String, Route>), AwsJson1_0(TinyMap<String, Route>), AwsJson11(TinyMap<String, Route>), } Loading Loading @@ -729,8 +729,8 @@ Currently there is a single `Router` structure, described in [Router](#router), enum Routes { RestXml(/* Container */), RestJson1(/* Container */), AwsJson10(/* Container */), AwsJson11(/* Container */), AwsJson1_0(/* Container */), AwsJson1_1(/* Container */), } ``` Loading design/src/server/anatomy.md +10 −10 Original line number Diff line number Diff line Loading @@ -241,16 +241,16 @@ Note that both traits are parameterized by `Protocol`. These [protocols](https:/ ```rust /// [AWS REST JSON 1.0 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-restjson1-protocol.html). pub struct AwsRestJson1; pub struct RestJson1; /// [AWS REST XML Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-restxml-protocol.html). pub struct AwsRestXml; pub struct RestXml; /// [AWS JSON 1.0 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-json-1_0-protocol.html). pub struct AwsJson10; pub struct AwsJson1_0; /// [AWS JSON 1.1 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-json-1_1-protocol.html). pub struct AwsJson11; pub struct AwsJson1_1; ``` ## Upgrading a Model Service Loading Loading @@ -526,15 +526,15 @@ To finalize the build and construct the complete service, `PokemonService`, each /// Constructs a [`PokemonService`] from the arguments provided to the builder. pub fn build(self) -> PokemonService<Route> where Op1: Upgradable<AwsRestJson1, CheckHealth>, Op1: Upgradable<RestJson1, CheckHealth>, Op1::Service: tower::Service<http::Request, Error = Infallible>, Op2: Upgradable<AwsRestJson1, DoNothing>, Op2: Upgradable<RestJson1, DoNothing>, Op2::Service: tower::Service<http::Request, Error = Infallible>, /* ... */ Op6: Upgradable<AwsRestJson1, GetStorage>, Op6: Upgradable<RestJson1, GetStorage>, Op6::Service: tower::Service<http::Request, Error = Infallible>, ``` Loading Loading @@ -599,10 +599,10 @@ The build method then proceeds as follows: /// Constructs a [`PokemonService`] from the arguments provided to the builder. pub fn build(self) -> PokemonService<Route> where Op1: Upgradable<AwsRestJson1, CheckHealth>, Op1: Upgradable<RestJson1, CheckHealth>, Op1::Service: tower::Service<http::Request, Error = Infallible>, Op2: Upgradable<AwsRestJson1, DoNothing>, Op2: Upgradable<RestJson1, DoNothing>, Op2::Service: tower::Service<http::Request, Error = Infallible>, /* ... */ Loading Loading @@ -630,7 +630,7 @@ where /// The Pokémon Service allows you to retrieve information about Pokémon species. #[derive(Clone)] pub struct PokemonService<S> { router: RoutingService<RestRouter<S>, AwsRestJson1>, router: RoutingService<RestRouter<S>, RestJson1>, } ``` Loading rust-runtime/aws-smithy-http-server-python/src/error.rs +5 −6 Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ use aws_smithy_http_server::{ body::{to_boxed, BoxBody}, proto::{ aws_json_10::AwsJson10, aws_json_11::AwsJson11, rest_json_1::AwsRestJson1, rest_xml::AwsRestXml, aws_json_10::AwsJson1_0, aws_json_11::AwsJson1_1, rest_json_1::RestJson1, rest_xml::RestXml, }, response::IntoResponse, }; Loading Loading @@ -68,7 +67,7 @@ impl From<PyErr> for PyMiddlewareException { } } impl IntoResponse<AwsRestJson1> for PyMiddlewareException { impl IntoResponse<RestJson1> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -79,7 +78,7 @@ impl IntoResponse<AwsRestJson1> for PyMiddlewareException { } } impl IntoResponse<AwsRestXml> for PyMiddlewareException { impl IntoResponse<RestXml> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -89,7 +88,7 @@ impl IntoResponse<AwsRestXml> for PyMiddlewareException { } } impl IntoResponse<AwsJson10> for PyMiddlewareException { impl IntoResponse<AwsJson1_0> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -100,7 +99,7 @@ impl IntoResponse<AwsJson10> for PyMiddlewareException { } } impl IntoResponse<AwsJson11> for PyMiddlewareException { impl IntoResponse<AwsJson1_1> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading rust-runtime/aws-smithy-http-server-python/src/middleware/handler.rs +5 −5 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ impl PyMiddlewares { #[cfg(test)] mod tests { use aws_smithy_http_server::proto::rest_json_1::AwsRestJson1; use aws_smithy_http_server::proto::rest_json_1::RestJson1; use http::HeaderValue; use hyper::body::to_bytes; use pretty_assertions::assert_eq; Loading @@ -180,7 +180,7 @@ mod tests { #[tokio::test] async fn request_middleware_chain_keeps_headers_changes() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -230,7 +230,7 @@ def second_middleware(request: Request): #[tokio::test] async fn request_middleware_return_response() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -265,7 +265,7 @@ def middleware(request: Request): #[tokio::test] async fn request_middleware_raise_middleware_exception() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -304,7 +304,7 @@ def middleware(request: Request): #[tokio::test] async fn request_middleware_raise_python_exception() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::from_code( Loading Loading
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocol.kt +4 −4 Original line number Diff line number Diff line Loading @@ -99,10 +99,10 @@ class ServerAwsJsonProtocol( override fun markerStruct(): RuntimeType { return when (version) { is AwsJsonVersion.Json10 -> { ServerRuntimeType.Protocol("AwsJson10", "aws_json_10", runtimeConfig) ServerRuntimeType.Protocol("AwsJson1_0", "aws_json_10", runtimeConfig) } is AwsJsonVersion.Json11 -> { ServerRuntimeType.Protocol("AwsJson11", "aws_json_11", runtimeConfig) ServerRuntimeType.Protocol("AwsJson1_1", "aws_json_11", runtimeConfig) } } } Loading Loading @@ -211,7 +211,7 @@ class ServerRestJsonProtocol( fun fromCoreProtocol(restJson: RestJson): ServerRestJsonProtocol = ServerRestJsonProtocol(restJson.codegenContext) } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestJson1", "rest_json_1", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("RestJson1", "rest_json_1", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading Loading @@ -240,7 +240,7 @@ class ServerRestXmlProtocol( } } override fun markerStruct() = ServerRuntimeType.Protocol("AwsRestXml", "rest_xml", runtimeConfig) override fun markerStruct() = ServerRuntimeType.Protocol("RestXml", "rest_xml", runtimeConfig) override fun routerType() = restRouterType(runtimeConfig) Loading
design/src/rfcs/rfc0020_service_builder.md +3 −3 Original line number Diff line number Diff line Loading @@ -231,7 +231,7 @@ pub struct Route { enum Routes { RestXml(Vec<(Route, RequestSpec)>), RestJson1(Vec<(Route, RequestSpec)>), AwsJson10(TinyMap<String, Route>), AwsJson1_0(TinyMap<String, Route>), AwsJson11(TinyMap<String, Route>), } Loading Loading @@ -729,8 +729,8 @@ Currently there is a single `Router` structure, described in [Router](#router), enum Routes { RestXml(/* Container */), RestJson1(/* Container */), AwsJson10(/* Container */), AwsJson11(/* Container */), AwsJson1_0(/* Container */), AwsJson1_1(/* Container */), } ``` Loading
design/src/server/anatomy.md +10 −10 Original line number Diff line number Diff line Loading @@ -241,16 +241,16 @@ Note that both traits are parameterized by `Protocol`. These [protocols](https:/ ```rust /// [AWS REST JSON 1.0 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-restjson1-protocol.html). pub struct AwsRestJson1; pub struct RestJson1; /// [AWS REST XML Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-restxml-protocol.html). pub struct AwsRestXml; pub struct RestXml; /// [AWS JSON 1.0 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-json-1_0-protocol.html). pub struct AwsJson10; pub struct AwsJson1_0; /// [AWS JSON 1.1 Protocol](https://awslabs.github.io/smithy/2.0/aws/protocols/aws-json-1_1-protocol.html). pub struct AwsJson11; pub struct AwsJson1_1; ``` ## Upgrading a Model Service Loading Loading @@ -526,15 +526,15 @@ To finalize the build and construct the complete service, `PokemonService`, each /// Constructs a [`PokemonService`] from the arguments provided to the builder. pub fn build(self) -> PokemonService<Route> where Op1: Upgradable<AwsRestJson1, CheckHealth>, Op1: Upgradable<RestJson1, CheckHealth>, Op1::Service: tower::Service<http::Request, Error = Infallible>, Op2: Upgradable<AwsRestJson1, DoNothing>, Op2: Upgradable<RestJson1, DoNothing>, Op2::Service: tower::Service<http::Request, Error = Infallible>, /* ... */ Op6: Upgradable<AwsRestJson1, GetStorage>, Op6: Upgradable<RestJson1, GetStorage>, Op6::Service: tower::Service<http::Request, Error = Infallible>, ``` Loading Loading @@ -599,10 +599,10 @@ The build method then proceeds as follows: /// Constructs a [`PokemonService`] from the arguments provided to the builder. pub fn build(self) -> PokemonService<Route> where Op1: Upgradable<AwsRestJson1, CheckHealth>, Op1: Upgradable<RestJson1, CheckHealth>, Op1::Service: tower::Service<http::Request, Error = Infallible>, Op2: Upgradable<AwsRestJson1, DoNothing>, Op2: Upgradable<RestJson1, DoNothing>, Op2::Service: tower::Service<http::Request, Error = Infallible>, /* ... */ Loading Loading @@ -630,7 +630,7 @@ where /// The Pokémon Service allows you to retrieve information about Pokémon species. #[derive(Clone)] pub struct PokemonService<S> { router: RoutingService<RestRouter<S>, AwsRestJson1>, router: RoutingService<RestRouter<S>, RestJson1>, } ``` Loading
rust-runtime/aws-smithy-http-server-python/src/error.rs +5 −6 Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ use aws_smithy_http_server::{ body::{to_boxed, BoxBody}, proto::{ aws_json_10::AwsJson10, aws_json_11::AwsJson11, rest_json_1::AwsRestJson1, rest_xml::AwsRestXml, aws_json_10::AwsJson1_0, aws_json_11::AwsJson1_1, rest_json_1::RestJson1, rest_xml::RestXml, }, response::IntoResponse, }; Loading Loading @@ -68,7 +67,7 @@ impl From<PyErr> for PyMiddlewareException { } } impl IntoResponse<AwsRestJson1> for PyMiddlewareException { impl IntoResponse<RestJson1> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -79,7 +78,7 @@ impl IntoResponse<AwsRestJson1> for PyMiddlewareException { } } impl IntoResponse<AwsRestXml> for PyMiddlewareException { impl IntoResponse<RestXml> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -89,7 +88,7 @@ impl IntoResponse<AwsRestXml> for PyMiddlewareException { } } impl IntoResponse<AwsJson10> for PyMiddlewareException { impl IntoResponse<AwsJson1_0> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading @@ -100,7 +99,7 @@ impl IntoResponse<AwsJson10> for PyMiddlewareException { } } impl IntoResponse<AwsJson11> for PyMiddlewareException { impl IntoResponse<AwsJson1_1> for PyMiddlewareException { fn into_response(self) -> http::Response<BoxBody> { http::Response::builder() .status(self.status_code) Loading
rust-runtime/aws-smithy-http-server-python/src/middleware/handler.rs +5 −5 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ impl PyMiddlewares { #[cfg(test)] mod tests { use aws_smithy_http_server::proto::rest_json_1::AwsRestJson1; use aws_smithy_http_server::proto::rest_json_1::RestJson1; use http::HeaderValue; use hyper::body::to_bytes; use pretty_assertions::assert_eq; Loading @@ -180,7 +180,7 @@ mod tests { #[tokio::test] async fn request_middleware_chain_keeps_headers_changes() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -230,7 +230,7 @@ def second_middleware(request: Request): #[tokio::test] async fn request_middleware_return_response() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -265,7 +265,7 @@ def middleware(request: Request): #[tokio::test] async fn request_middleware_raise_middleware_exception() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::new(py, "middleware").unwrap(); Loading Loading @@ -304,7 +304,7 @@ def middleware(request: Request): #[tokio::test] async fn request_middleware_raise_python_exception() -> PyResult<()> { let locals = crate::tests::initialize(); let mut middlewares = PyMiddlewares::new::<AwsRestJson1>(vec![]); let mut middlewares = PyMiddlewares::new::<RestJson1>(vec![]); Python::with_gil(|py| { let middleware = PyModule::from_code( Loading