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 - | /// [`RpcEchoInput`](crate::input::RpcEchoInput) using modelled bindings.
|
5 - | pub struct RpcEchoInputFuture {
|
6 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RpcEchoInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
4 + | /// [`ReservedWordsAsMembersInput`](crate::input::ReservedWordsAsMembersInput) using modelled bindings.
|
5 + | pub struct ReservedWordsAsMembersInputFuture {
|
6 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ReservedWordsAsMembersInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
7 7 | }
|
8 8 | }
|
9 9 |
|
10 - | impl std::future::Future for RpcEchoInputFuture {
|
10 + | impl std::future::Future for ReservedWordsAsMembersInputFuture {
|
11 11 | type Output = Result<
|
12 - | crate::input::RpcEchoInput,
|
12 + | crate::input::ReservedWordsAsMembersInput,
|
13 13 | ::aws_smithy_legacy_http_server::protocol::aws_json::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 26 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
27 27 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
28 28 | B,
|
29 - | > for crate::input::RpcEchoInput
|
29 + | > for crate::input::ReservedWordsAsMembersInput
|
30 30 | where
|
31 31 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
32 32 | B: 'static,
|
33 33 |
|
34 34 | B::Data: Send,
|
35 35 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
36 36 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
37 37 | {
|
38 38 | type Rejection =
|
39 39 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
40 - | type Future = RpcEchoInputFuture;
|
40 + | type Future = ReservedWordsAsMembersInputFuture;
|
41 41 |
|
42 42 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 43 | let fut = async move {
|
44 44 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
45 45 | request.headers(),
|
46 46 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
47 47 | ) {
|
48 48 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
49 49 | }
|
50 - | crate::protocol_serde::shape_rpc_echo::de_rpc_echo_http_request(request).await
|
50 + | crate::protocol_serde::shape_reserved_words_as_members::de_reserved_words_as_members_http_request(request)
|
51 + | .await
|
51 52 | };
|
52 53 | use ::futures_util::future::TryFutureExt;
|
53 54 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
54 55 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
55 56 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
56 57 | });
|
57 - | RpcEchoInputFuture {
|
58 + | ReservedWordsAsMembersInputFuture {
|
58 59 | inner: Box::pin(fut),
|
59 60 | }
|
60 61 | }
|
61 62 | }
|
62 63 | impl
|
63 64 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
64 65 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
65 - | > for crate::output::RpcEchoOutput
|
66 + | > for crate::output::ReservedWordsAsMembersOutput
|
66 67 | {
|
67 68 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
68 - | match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_response(self) {
|
69 - | Ok(response) => response,
|
70 - | Err(e) => {
|
71 - | ::tracing::error!(error = %e, "failed to serialize response");
|
72 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
73 - | }
|
74 - | }
|
69 + | match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_response(self) {
|
70 + | Ok(response) => response,
|
71 + | Err(e) => {
|
72 + | ::tracing::error!(error = %e, "failed to serialize response");
|
73 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
74 + | }
|
75 + | }
|
75 76 | }
|
76 77 | }
|
77 78 | impl
|
78 79 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
79 80 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
80 - | > for crate::error::RPCEchoError
|
81 + | > for crate::error::ReservedWordsAsMembersError
|
81 82 | {
|
82 83 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
83 - | match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_error(&self) {
|
84 + | match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_error(&self) {
|
84 85 | Ok(mut response) => {
|
85 - | response.extensions_mut().insert(
|
86 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
87 - | self.name(),
|
88 - | ),
|
89 - | );
|
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 91 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
95 92 | }
|
96 93 | }
|
97 94 | }
|
98 95 | }
|
99 96 |
|
97 + | #[allow(unreachable_code, unused_variables)]
|
98 + | #[cfg(test)]
|
99 + | mod reserved_words_as_members_test {
|
100 + |
|
101 + | /// Test ID: reserved_words
|
102 + | #[::tokio::test]
|
103 + | #[::tracing_test::traced_test]
|
104 + | async fn reserved_words_request() {
|
105 + | #[allow(unused_mut)]
|
106 + | let mut http_request = ::http::Request::builder()
|
107 + | .uri("/")
|
108 + | .method("POST")
|
109 + | .header("Content-Type", "application/x-amz-json-1.1")
|
110 + | .header("X-Amz-Target", "Config.ReservedWordsAsMembers")
|
111 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
112 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
113 + | "{\"as\": 5, \"async\": true}".as_bytes(),
|
114 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
115 + | )),
|
116 + | ))
|
117 + | .unwrap();
|
118 + | #[allow(unused_mut)]
|
119 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
120 + | let config = crate::service::ConfigConfig::builder().build();
|
121 + | let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
|
122 + | .reserved_words_as_members(move |input: crate::input::ReservedWordsAsMembersInput| {
|
123 + | let sender = sender.clone();
|
124 + | async move {
|
125 + | let result = {
|
126 + | let expected = crate::input::ReservedWordsAsMembersInput {
|
127 + | r#as: ::std::option::Option::Some(5),
|
128 + | r#async: ::std::option::Option::Some(true),
|
129 + | r#enum: ::std::option::Option::None,
|
130 + | self_: ::std::option::Option::None,
|
131 + | crate_: ::std::option::Option::None,
|
132 + | super_: ::std::option::Option::None,
|
133 + | build_value: ::std::option::Option::None,
|
134 + | default_value: ::std::option::Option::None,
|
135 + | send: ::std::option::Option::None,
|
136 + | };
|
137 + | ::pretty_assertions::assert_eq!(input, expected);
|
138 + | let output = crate::output::ReservedWordsAsMembersOutput {};
|
139 + | Ok(output)
|
140 + | };
|
141 + | sender.send(()).await.expect("receiver dropped early");
|
142 + | result
|
143 + | }
|
144 + | })
|
145 + | .build_unchecked();
|
146 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
147 + | .await
|
148 + | .expect("unable to make an HTTP request");
|
149 + | assert!(
|
150 + | receiver.recv().await.is_some(),
|
151 + | "we expected operation handler to be invoked but it was not entered"
|
152 + | );
|
153 + | }
|
154 + | }
|
155 + |
|
100 156 | ::pin_project_lite::pin_project! {
|
101 157 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
102 - | /// [`MatchInput`](crate::input::MatchInput) using modelled bindings.
|
103 - | pub struct MatchInputFuture {
|
104 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MatchInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
158 + | /// [`StructureNamePunningInput`](crate::input::StructureNamePunningInput) using modelled bindings.
|
159 + | pub struct StructureNamePunningInputFuture {
|
160 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StructureNamePunningInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
105 161 | }
|
106 162 | }
|
107 163 |
|
108 - | impl std::future::Future for MatchInputFuture {
|
164 + | impl std::future::Future for StructureNamePunningInputFuture {
|
109 165 | type Output = Result<
|
110 - | crate::input::MatchInput,
|
166 + | crate::input::StructureNamePunningInput,
|
111 167 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
112 168 | >;
|
113 169 |
|
114 170 | fn poll(
|
115 171 | self: std::pin::Pin<&mut Self>,
|
116 172 | cx: &mut std::task::Context<'_>,
|
117 173 | ) -> std::task::Poll<Self::Output> {
|
118 174 | let this = self.project();
|
119 175 | this.inner.as_mut().poll(cx)
|
120 176 | }
|
121 177 | }
|
122 178 |
|
123 179 | impl<B>
|
124 180 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
125 181 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
126 182 | B,
|
127 - | > for crate::input::MatchInput
|
183 + | > for crate::input::StructureNamePunningInput
|
128 184 | where
|
129 185 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
130 186 | B: 'static,
|
131 187 |
|
132 188 | B::Data: Send,
|
133 189 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
134 190 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
135 191 | {
|
136 192 | type Rejection =
|
137 193 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
138 - | type Future = MatchInputFuture;
|
194 + | type Future = StructureNamePunningInputFuture;
|
139 195 |
|
140 196 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
141 197 | let fut = async move {
|
142 198 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
143 199 | request.headers(),
|
144 200 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
145 201 | ) {
|
146 202 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
147 203 | }
|
148 - | crate::protocol_serde::shape_match::de_match_http_request(request).await
|
204 + | crate::protocol_serde::shape_structure_name_punning::de_structure_name_punning_http_request(request)
|
205 + | .await
|
149 206 | };
|
150 207 | use ::futures_util::future::TryFutureExt;
|
151 208 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
152 209 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
153 210 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
154 211 | });
|
155 - | MatchInputFuture {
|
212 + | StructureNamePunningInputFuture {
|
156 213 | inner: Box::pin(fut),
|
157 214 | }
|
158 215 | }
|
159 216 | }
|
160 217 | impl
|
161 218 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
162 219 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
163 - | > for crate::output::MatchOutput
|
220 + | > for crate::output::StructureNamePunningOutput
|
164 221 | {
|
165 222 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
166 - | match crate::protocol_serde::shape_match::ser_match_http_response(self) {
|
167 - | Ok(response) => response,
|
168 - | Err(e) => {
|
169 - | ::tracing::error!(error = %e, "failed to serialize response");
|
170 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
171 - | }
|
172 - | }
|
223 + | match crate::protocol_serde::shape_structure_name_punning::ser_structure_name_punning_http_response(self) {
|
224 + | Ok(response) => response,
|
225 + | Err(e) => {
|
226 + | ::tracing::error!(error = %e, "failed to serialize response");
|
227 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
228 + | }
|
229 + | }
|
173 230 | }
|
174 231 | }
|
175 - | impl
|
176 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
177 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
178 - | > for crate::error::MatchError
|
179 - | {
|
180 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
181 - | match crate::protocol_serde::shape_match::ser_match_http_error(&self) {
|
182 - | Ok(mut response) => {
|
183 - | response.extensions_mut().insert(
|
184 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
185 - | self.name(),
|
186 - | ),
|
187 - | );
|
188 - | response
|
189 - | }
|
190 - | Err(e) => {
|
191 - | ::tracing::error!(error = %e, "failed to serialize response");
|
192 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
193 - | }
|
194 - | }
|
232 + |
|
233 + | #[allow(unreachable_code, unused_variables)]
|
234 + | #[cfg(test)]
|
235 + | mod structure_name_punning_test {
|
236 + |
|
237 + | /// Test ID: structure_punning
|
238 + | #[::tokio::test]
|
239 + | #[::tracing_test::traced_test]
|
240 + | async fn structure_punning_request() {
|
241 + | #[allow(unused_mut)]
|
242 + | let mut http_request = ::http::Request::builder()
|
243 + | .uri("/")
|
244 + | .method("POST")
|
245 + | .header("Content-Type", "application/x-amz-json-1.1")
|
246 + | .header("X-Amz-Target", "Config.StructureNamePunning")
|
247 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
248 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
249 + | "{\"regular_string\": \"hello!\"}".as_bytes(),
|
250 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
251 + | )),
|
252 + | ))
|
253 + | .unwrap();
|
254 + | #[allow(unused_mut)]
|
255 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
256 + | let config = crate::service::ConfigConfig::builder().build();
|
257 + | let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
|
258 + | .structure_name_punning(move |input: crate::input::StructureNamePunningInput| {
|
259 + | let sender = sender.clone();
|
260 + | async move {
|
261 + | let result = {
|
262 + | let expected = crate::input::StructureNamePunningInput {
|
263 + | regular_string: ::std::option::Option::Some("hello!".to_owned()),
|
264 + | punned_vec: ::std::option::Option::None,
|
265 + | };
|
266 + | ::pretty_assertions::assert_eq!(input, expected);
|
267 + | let output = crate::output::StructureNamePunningOutput {};
|
268 + | output
|
269 + | };
|
270 + | sender.send(()).await.expect("receiver dropped early");
|
271 + | result
|
272 + | }
|
273 + | })
|
274 + | .build_unchecked();
|
275 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
276 + | .await
|
277 + | .expect("unable to make an HTTP request");
|
278 + | assert!(
|
279 + | receiver.recv().await.is_some(),
|
280 + | "we expected operation handler to be invoked but it was not entered"
|
281 + | );
|
195 282 | }
|
196 283 | }
|
197 284 |
|
198 285 | ::pin_project_lite::pin_project! {
|
199 286 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
200 - | /// [`OptionInput`](crate::input::OptionInput) using modelled bindings.
|
201 - | pub struct OptionInputFuture {
|
202 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OptionInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
287 + | /// [`ErrCollisionsInput`](crate::input::ErrCollisionsInput) using modelled bindings.
|
288 + | pub struct ErrCollisionsInputFuture {
|
289 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrCollisionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
203 290 | }
|
204 291 | }
|
205 292 |
|
206 - | impl std::future::Future for OptionInputFuture {
|
293 + | impl std::future::Future for ErrCollisionsInputFuture {
|
207 294 | type Output = Result<
|
208 - | crate::input::OptionInput,
|
295 + | crate::input::ErrCollisionsInput,
|
209 296 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
210 297 | >;
|
211 298 |
|
212 299 | fn poll(
|
213 300 | self: std::pin::Pin<&mut Self>,
|
214 301 | cx: &mut std::task::Context<'_>,
|
215 302 | ) -> std::task::Poll<Self::Output> {
|
216 303 | let this = self.project();
|
217 304 | this.inner.as_mut().poll(cx)
|
218 305 | }
|
219 306 | }
|
220 307 |
|
221 308 | impl<B>
|
222 309 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
223 310 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
224 311 | B,
|
225 - | > for crate::input::OptionInput
|
312 + | > for crate::input::ErrCollisionsInput
|
226 313 | where
|
227 314 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
228 315 | B: 'static,
|
229 316 |
|
230 317 | B::Data: Send,
|
231 318 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
232 319 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
233 320 | {
|
234 321 | type Rejection =
|
235 322 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
236 - | type Future = OptionInputFuture;
|
323 + | type Future = ErrCollisionsInputFuture;
|
237 324 |
|
238 325 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
239 326 | let fut = async move {
|
240 327 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
241 328 | request.headers(),
|
242 329 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
243 330 | ) {
|
244 331 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
245 332 | }
|
246 - | crate::protocol_serde::shape_option::de_option_http_request(request).await
|
333 + | crate::protocol_serde::shape_err_collisions::de_err_collisions_http_request(request)
|
334 + | .await
|
247 335 | };
|
248 336 | use ::futures_util::future::TryFutureExt;
|
249 337 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
250 338 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
251 339 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
252 340 | });
|
253 - | OptionInputFuture {
|
341 + | ErrCollisionsInputFuture {
|
254 342 | inner: Box::pin(fut),
|
255 343 | }
|
256 344 | }
|
257 345 | }
|
258 346 | impl
|
259 347 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
260 348 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
261 - | > for crate::output::OptionOutput
|
349 + | > for crate::output::ErrCollisionsOutput
|
262 350 | {
|
263 351 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
264 - | match crate::protocol_serde::shape_option::ser_option_http_response(self) {
|
352 + | match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_response(self) {
|
265 353 | Ok(response) => response,
|
266 354 | Err(e) => {
|
267 355 | ::tracing::error!(error = %e, "failed to serialize response");
|
268 356 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
269 357 | }
|
270 358 | }
|
271 359 | }
|
272 360 | }
|
361 + | impl
|
362 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
363 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
364 + | > for crate::error::ErrCollisionsError
|
365 + | {
|
366 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
367 + | match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_error(&self) {
|
368 + | Ok(mut response) => {
|
369 + | response.extensions_mut().insert(
|
370 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
371 + | self.name(),
|
372 + | ),
|
373 + | );
|
374 + | response
|
375 + | }
|
376 + | Err(e) => {
|
377 + | ::tracing::error!(error = %e, "failed to serialize response");
|
378 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
379 + | }
|
380 + | }
|
381 + | }
|
382 + | }
|
273 383 |
|
274 384 | ::pin_project_lite::pin_project! {
|
275 385 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
276 386 | /// [`ResultInput`](crate::input::ResultInput) using modelled bindings.
|
277 387 | pub struct ResultInputFuture {
|
278 388 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ResultInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
279 389 | }
|
280 390 | }
|
281 391 |
|
282 392 | impl std::future::Future for ResultInputFuture {
|
342 452 | Err(e) => {
|
343 453 | ::tracing::error!(error = %e, "failed to serialize response");
|
344 454 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
345 455 | }
|
346 456 | }
|
347 457 | }
|
348 458 | }
|
349 459 |
|
350 460 | ::pin_project_lite::pin_project! {
|
351 461 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
352 - | /// [`ErrCollisionsInput`](crate::input::ErrCollisionsInput) using modelled bindings.
|
353 - | pub struct ErrCollisionsInputFuture {
|
354 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrCollisionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
462 + | /// [`OptionInput`](crate::input::OptionInput) using modelled bindings.
|
463 + | pub struct OptionInputFuture {
|
464 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OptionInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
355 465 | }
|
356 466 | }
|
357 467 |
|
358 - | impl std::future::Future for ErrCollisionsInputFuture {
|
468 + | impl std::future::Future for OptionInputFuture {
|
359 469 | type Output = Result<
|
360 - | crate::input::ErrCollisionsInput,
|
470 + | crate::input::OptionInput,
|
361 471 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
362 472 | >;
|
363 473 |
|
364 474 | fn poll(
|
365 475 | self: std::pin::Pin<&mut Self>,
|
366 476 | cx: &mut std::task::Context<'_>,
|
367 477 | ) -> std::task::Poll<Self::Output> {
|
368 478 | let this = self.project();
|
369 479 | this.inner.as_mut().poll(cx)
|
370 480 | }
|
371 481 | }
|
372 482 |
|
373 483 | impl<B>
|
374 484 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
375 485 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
376 486 | B,
|
377 - | > for crate::input::ErrCollisionsInput
|
487 + | > for crate::input::OptionInput
|
378 488 | where
|
379 489 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
380 490 | B: 'static,
|
381 491 |
|
382 492 | B::Data: Send,
|
383 493 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
384 494 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
385 495 | {
|
386 496 | type Rejection =
|
387 497 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
388 - | type Future = ErrCollisionsInputFuture;
|
498 + | type Future = OptionInputFuture;
|
389 499 |
|
390 500 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
391 501 | let fut = async move {
|
392 502 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
393 503 | request.headers(),
|
394 504 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
395 505 | ) {
|
396 506 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
397 507 | }
|
398 - | crate::protocol_serde::shape_err_collisions::de_err_collisions_http_request(request)
|
399 - | .await
|
508 + | crate::protocol_serde::shape_option::de_option_http_request(request).await
|
400 509 | };
|
401 510 | use ::futures_util::future::TryFutureExt;
|
402 511 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
403 512 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
404 513 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
405 514 | });
|
406 - | ErrCollisionsInputFuture {
|
515 + | OptionInputFuture {
|
407 516 | inner: Box::pin(fut),
|
408 517 | }
|
409 518 | }
|
410 519 | }
|
411 520 | impl
|
412 521 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
413 522 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
414 - | > for crate::output::ErrCollisionsOutput
|
523 + | > for crate::output::OptionOutput
|
415 524 | {
|
416 525 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
417 - | match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_response(self) {
|
526 + | match crate::protocol_serde::shape_option::ser_option_http_response(self) {
|
418 527 | Ok(response) => response,
|
419 528 | Err(e) => {
|
420 529 | ::tracing::error!(error = %e, "failed to serialize response");
|
421 530 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
422 531 | }
|
423 532 | }
|
424 533 | }
|
425 534 | }
|
426 - | impl
|
427 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
428 - | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
429 - | > for crate::error::ErrCollisionsError
|
430 - | {
|
431 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
432 - | match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_error(&self) {
|
433 - | Ok(mut response) => {
|
434 - | response.extensions_mut().insert(
|
435 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
436 - | self.name(),
|
437 - | ),
|
438 - | );
|
439 - | response
|
440 - | }
|
441 - | Err(e) => {
|
442 - | ::tracing::error!(error = %e, "failed to serialize response");
|
443 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
444 - | }
|
445 - | }
|
446 - | }
|
447 - | }
|
448 535 |
|
449 536 | ::pin_project_lite::pin_project! {
|
450 537 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
451 - | /// [`StructureNamePunningInput`](crate::input::StructureNamePunningInput) using modelled bindings.
|
452 - | pub struct StructureNamePunningInputFuture {
|
453 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StructureNamePunningInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
538 + | /// [`MatchInput`](crate::input::MatchInput) using modelled bindings.
|
539 + | pub struct MatchInputFuture {
|
540 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MatchInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
454 541 | }
|
455 542 | }
|
456 543 |
|
457 - | impl std::future::Future for StructureNamePunningInputFuture {
|
544 + | impl std::future::Future for MatchInputFuture {
|
458 545 | type Output = Result<
|
459 - | crate::input::StructureNamePunningInput,
|
546 + | crate::input::MatchInput,
|
460 547 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
461 548 | >;
|
462 549 |
|
463 550 | fn poll(
|
464 551 | self: std::pin::Pin<&mut Self>,
|
465 552 | cx: &mut std::task::Context<'_>,
|
466 553 | ) -> std::task::Poll<Self::Output> {
|
467 554 | let this = self.project();
|
468 555 | this.inner.as_mut().poll(cx)
|
469 556 | }
|
470 557 | }
|
471 558 |
|
472 559 | impl<B>
|
473 560 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
474 561 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
475 562 | B,
|
476 - | > for crate::input::StructureNamePunningInput
|
563 + | > for crate::input::MatchInput
|
477 564 | where
|
478 565 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
479 566 | B: 'static,
|
480 567 |
|
481 568 | B::Data: Send,
|
482 569 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
483 570 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
484 571 | {
|
485 572 | type Rejection =
|
486 573 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
487 - | type Future = StructureNamePunningInputFuture;
|
574 + | type Future = MatchInputFuture;
|
488 575 |
|
489 576 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
490 577 | let fut = async move {
|
491 578 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
492 579 | request.headers(),
|
493 580 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
494 581 | ) {
|
495 582 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
496 583 | }
|
497 - | crate::protocol_serde::shape_structure_name_punning::de_structure_name_punning_http_request(request)
|
498 - | .await
|
584 + | crate::protocol_serde::shape_match::de_match_http_request(request).await
|
499 585 | };
|
500 586 | use ::futures_util::future::TryFutureExt;
|
501 587 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
502 588 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
503 589 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
504 590 | });
|
505 - | StructureNamePunningInputFuture {
|
591 + | MatchInputFuture {
|
506 592 | inner: Box::pin(fut),
|
507 593 | }
|
508 594 | }
|
509 595 | }
|
510 596 | impl
|
511 597 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
512 598 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
513 - | > for crate::output::StructureNamePunningOutput
|
599 + | > for crate::output::MatchOutput
|
514 600 | {
|
515 601 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
516 - | match crate::protocol_serde::shape_structure_name_punning::ser_structure_name_punning_http_response(self) {
|
517 - | Ok(response) => response,
|
518 - | Err(e) => {
|
519 - | ::tracing::error!(error = %e, "failed to serialize response");
|
520 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
521 - | }
|
522 - | }
|
602 + | match crate::protocol_serde::shape_match::ser_match_http_response(self) {
|
603 + | Ok(response) => response,
|
604 + | Err(e) => {
|
605 + | ::tracing::error!(error = %e, "failed to serialize response");
|
606 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
607 + | }
|
608 + | }
|
523 609 | }
|
524 610 | }
|
525 - |
|
526 - | #[allow(unreachable_code, unused_variables)]
|
527 - | #[cfg(test)]
|
528 - | mod structure_name_punning_test {
|
529 - |
|
530 - | /// Test ID: structure_punning
|
531 - | #[::tokio::test]
|
532 - | #[::tracing_test::traced_test]
|
533 - | async fn structure_punning_request() {
|
534 - | #[allow(unused_mut)]
|
535 - | let mut http_request = ::http::Request::builder()
|
536 - | .uri("/")
|
537 - | .method("POST")
|
538 - | .header("Content-Type", "application/x-amz-json-1.1")
|
539 - | .header("X-Amz-Target", "Config.StructureNamePunning")
|
540 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
541 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
542 - | "{\"regular_string\": \"hello!\"}".as_bytes(),
|
543 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
544 - | )),
|
545 - | ))
|
546 - | .unwrap();
|
547 - | #[allow(unused_mut)]
|
548 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
549 - | let config = crate::service::ConfigConfig::builder().build();
|
550 - | let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
|
551 - | .structure_name_punning(move |input: crate::input::StructureNamePunningInput| {
|
552 - | let sender = sender.clone();
|
553 - | async move {
|
554 - | let result = {
|
555 - | let expected = crate::input::StructureNamePunningInput {
|
556 - | regular_string: ::std::option::Option::Some("hello!".to_owned()),
|
557 - | punned_vec: ::std::option::Option::None,
|
558 - | };
|
559 - | ::pretty_assertions::assert_eq!(input, expected);
|
560 - | let output = crate::output::StructureNamePunningOutput {};
|
561 - | output
|
562 - | };
|
563 - | sender.send(()).await.expect("receiver dropped early");
|
564 - | result
|
565 - | }
|
566 - | })
|
567 - | .build_unchecked();
|
568 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
569 - | .await
|
570 - | .expect("unable to make an HTTP request");
|
571 - | assert!(
|
572 - | receiver.recv().await.is_some(),
|
573 - | "we expected operation handler to be invoked but it was not entered"
|
574 - | );
|
611 + | impl
|
612 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
613 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
614 + | > for crate::error::MatchError
|
615 + | {
|
616 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
617 + | match crate::protocol_serde::shape_match::ser_match_http_error(&self) {
|
618 + | Ok(mut response) => {
|
619 + | response.extensions_mut().insert(
|
620 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
621 + | self.name(),
|
622 + | ),
|
623 + | );
|
624 + | response
|
625 + | }
|
626 + | Err(e) => {
|
627 + | ::tracing::error!(error = %e, "failed to serialize response");
|
628 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
629 + | }
|
630 + | }
|
575 631 | }
|
576 632 | }
|
577 633 |
|
578 634 | ::pin_project_lite::pin_project! {
|
579 635 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
580 - | /// [`ReservedWordsAsMembersInput`](crate::input::ReservedWordsAsMembersInput) using modelled bindings.
|
581 - | pub struct ReservedWordsAsMembersInputFuture {
|
582 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ReservedWordsAsMembersInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
636 + | /// [`RpcEchoInput`](crate::input::RpcEchoInput) using modelled bindings.
|
637 + | pub struct RpcEchoInputFuture {
|
638 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RpcEchoInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
583 639 | }
|
584 640 | }
|
585 641 |
|
586 - | impl std::future::Future for ReservedWordsAsMembersInputFuture {
|
642 + | impl std::future::Future for RpcEchoInputFuture {
|
587 643 | type Output = Result<
|
588 - | crate::input::ReservedWordsAsMembersInput,
|
644 + | crate::input::RpcEchoInput,
|
589 645 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
590 646 | >;
|
591 647 |
|
592 648 | fn poll(
|
593 649 | self: std::pin::Pin<&mut Self>,
|
594 650 | cx: &mut std::task::Context<'_>,
|
595 651 | ) -> std::task::Poll<Self::Output> {
|
596 652 | let this = self.project();
|
597 653 | this.inner.as_mut().poll(cx)
|
598 654 | }
|
599 655 | }
|
600 656 |
|
601 657 | impl<B>
|
602 658 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
603 659 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
604 660 | B,
|
605 - | > for crate::input::ReservedWordsAsMembersInput
|
661 + | > for crate::input::RpcEchoInput
|
606 662 | where
|
607 663 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
608 664 | B: 'static,
|
609 665 |
|
610 666 | B::Data: Send,
|
611 667 | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
612 668 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
613 669 | {
|
614 670 | type Rejection =
|
615 671 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
616 - | type Future = ReservedWordsAsMembersInputFuture;
|
672 + | type Future = RpcEchoInputFuture;
|
617 673 |
|
618 674 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
619 675 | let fut = async move {
|
620 676 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
621 677 | request.headers(),
|
622 678 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
623 679 | ) {
|
624 680 | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
625 681 | }
|
626 - | crate::protocol_serde::shape_reserved_words_as_members::de_reserved_words_as_members_http_request(request)
|
627 - | .await
|
682 + | crate::protocol_serde::shape_rpc_echo::de_rpc_echo_http_request(request).await
|
628 683 | };
|
629 684 | use ::futures_util::future::TryFutureExt;
|
630 685 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
631 686 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
632 687 | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
633 688 | });
|
634 - | ReservedWordsAsMembersInputFuture {
|
689 + | RpcEchoInputFuture {
|
635 690 | inner: Box::pin(fut),
|
636 691 | }
|
637 692 | }
|
638 693 | }
|
639 694 | impl
|
640 695 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
641 696 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
642 - | > for crate::output::ReservedWordsAsMembersOutput
|
697 + | > for crate::output::RpcEchoOutput
|
643 698 | {
|
644 699 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
645 - | match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_response(self) {
|
646 - | Ok(response) => response,
|
647 - | Err(e) => {
|
648 - | ::tracing::error!(error = %e, "failed to serialize response");
|
649 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
650 - | }
|
651 - | }
|
700 + | match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_response(self) {
|
701 + | Ok(response) => response,
|
702 + | Err(e) => {
|
703 + | ::tracing::error!(error = %e, "failed to serialize response");
|
704 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
705 + | }
|
706 + | }
|
652 707 | }
|
653 708 | }
|
654 709 | impl
|
655 710 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
656 711 | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
657 - | > for crate::error::ReservedWordsAsMembersError
|
712 + | > for crate::error::RPCEchoError
|
658 713 | {
|
659 714 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
660 - | match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_error(&self) {
|
715 + | match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_error(&self) {
|
661 716 | Ok(mut response) => {
|
662 - | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
717 + | response.extensions_mut().insert(
|
718 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
719 + | self.name(),
|
720 + | ),
|
721 + | );
|
663 722 | response
|
664 - | },
|
723 + | }
|
665 724 | Err(e) => {
|
666 725 | ::tracing::error!(error = %e, "failed to serialize response");
|
667 726 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
668 727 | }
|
669 728 | }
|
670 729 | }
|
671 730 | }
|
672 - |
|
673 - | #[allow(unreachable_code, unused_variables)]
|
674 - | #[cfg(test)]
|
675 - | mod reserved_words_as_members_test {
|
676 - |
|
677 - | /// Test ID: reserved_words
|
678 - | #[::tokio::test]
|
679 - | #[::tracing_test::traced_test]
|
680 - | async fn reserved_words_request() {
|
681 - | #[allow(unused_mut)]
|
682 - | let mut http_request = ::http::Request::builder()
|
683 - | .uri("/")
|
684 - | .method("POST")
|
685 - | .header("Content-Type", "application/x-amz-json-1.1")
|
686 - | .header("X-Amz-Target", "Config.ReservedWordsAsMembers")
|
687 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
688 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
689 - | "{\"as\": 5, \"async\": true}".as_bytes(),
|
690 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
691 - | )),
|
692 - | ))
|
693 - | .unwrap();
|
694 - | #[allow(unused_mut)]
|
695 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
696 - | let config = crate::service::ConfigConfig::builder().build();
|
697 - | let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
|
698 - | .reserved_words_as_members(move |input: crate::input::ReservedWordsAsMembersInput| {
|
699 - | let sender = sender.clone();
|
700 - | async move {
|
701 - | let result = {
|
702 - | let expected = crate::input::ReservedWordsAsMembersInput {
|
703 - | r#as: ::std::option::Option::Some(5),
|
704 - | r#async: ::std::option::Option::Some(true),
|
705 - | r#enum: ::std::option::Option::None,
|
706 - | self_: ::std::option::Option::None,
|
707 - | crate_: ::std::option::Option::None,
|
708 - | super_: ::std::option::Option::None,
|
709 - | build_value: ::std::option::Option::None,
|
710 - | default_value: ::std::option::Option::None,
|
711 - | send: ::std::option::Option::None,
|
712 - | };
|
713 - | ::pretty_assertions::assert_eq!(input, expected);
|
714 - | let output = crate::output::ReservedWordsAsMembersOutput {};
|
715 - | Ok(output)
|
716 - | };
|
717 - | sender.send(()).await.expect("receiver dropped early");
|
718 - | result
|
719 - | }
|
720 - | })
|
721 - | .build_unchecked();
|
722 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
723 - | .await
|
724 - | .expect("unable to make an HTTP request");
|
725 - | assert!(
|
726 - | receiver.recv().await.is_some(),
|
727 - | "we expected operation handler to be invoked but it was not entered"
|
728 - | );
|
729 - | }
|
730 - | }
|