1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | ::pin_project_lite::pin_project! {
|
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>>
|
7 + | }
|
8 + | }
|
9 + |
|
10 + | impl std::future::Future for RpcEchoInputFuture {
|
11 + | type Output = Result<
|
12 + | crate::input::RpcEchoInput,
|
13 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
14 + | >;
|
15 + |
|
16 + | fn poll(
|
17 + | self: std::pin::Pin<&mut Self>,
|
18 + | cx: &mut std::task::Context<'_>,
|
19 + | ) -> std::task::Poll<Self::Output> {
|
20 + | let this = self.project();
|
21 + | this.inner.as_mut().poll(cx)
|
22 + | }
|
23 + | }
|
24 + |
|
25 + | impl<B>
|
26 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
27 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
28 + | B,
|
29 + | > for crate::input::RpcEchoInput
|
30 + | where
|
31 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
32 + | B: 'static,
|
33 + |
|
34 + | B::Data: Send,
|
35 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
36 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
37 + | {
|
38 + | type Rejection =
|
39 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
40 + | type Future = RpcEchoInputFuture;
|
41 + |
|
42 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
43 + | let fut = async move {
|
44 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
45 + | request.headers(),
|
46 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
47 + | ) {
|
48 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
49 + | }
|
50 + | crate::protocol_serde::shape_rpc_echo::de_rpc_echo_http_request(request).await
|
51 + | };
|
52 + | use ::futures_util::future::TryFutureExt;
|
53 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
54 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
55 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
56 + | });
|
57 + | RpcEchoInputFuture {
|
58 + | inner: Box::pin(fut),
|
59 + | }
|
60 + | }
|
61 + | }
|
62 + | impl
|
63 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
64 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
65 + | > for crate::output::RpcEchoOutput
|
66 + | {
|
67 + | 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 + | }
|
75 + | }
|
76 + | }
|
77 + | impl
|
78 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
79 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
80 + | > for crate::error::RPCEchoError
|
81 + | {
|
82 + | 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 + | Ok(mut response) => {
|
85 + | response.extensions_mut().insert(
|
86 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
87 + | self.name(),
|
88 + | ),
|
89 + | );
|
90 + | response
|
91 + | }
|
92 + | Err(e) => {
|
93 + | ::tracing::error!(error = %e, "failed to serialize response");
|
94 + | ::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 + | }
|
96 + | }
|
97 + | }
|
98 + | }
|
99 + |
|
100 + | ::pin_project_lite::pin_project! {
|
101 + | /// 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>>
|
105 + | }
|
106 + | }
|
107 + |
|
108 + | impl std::future::Future for MatchInputFuture {
|
109 + | type Output = Result<
|
110 + | crate::input::MatchInput,
|
111 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
112 + | >;
|
113 + |
|
114 + | fn poll(
|
115 + | self: std::pin::Pin<&mut Self>,
|
116 + | cx: &mut std::task::Context<'_>,
|
117 + | ) -> std::task::Poll<Self::Output> {
|
118 + | let this = self.project();
|
119 + | this.inner.as_mut().poll(cx)
|
120 + | }
|
121 + | }
|
122 + |
|
123 + | impl<B>
|
124 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
125 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
126 + | B,
|
127 + | > for crate::input::MatchInput
|
128 + | where
|
129 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
130 + | B: 'static,
|
131 + |
|
132 + | B::Data: Send,
|
133 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
134 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
135 + | {
|
136 + | type Rejection =
|
137 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
138 + | type Future = MatchInputFuture;
|
139 + |
|
140 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
141 + | let fut = async move {
|
142 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
143 + | request.headers(),
|
144 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
145 + | ) {
|
146 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
147 + | }
|
148 + | crate::protocol_serde::shape_match::de_match_http_request(request).await
|
149 + | };
|
150 + | use ::futures_util::future::TryFutureExt;
|
151 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
152 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
153 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
154 + | });
|
155 + | MatchInputFuture {
|
156 + | inner: Box::pin(fut),
|
157 + | }
|
158 + | }
|
159 + | }
|
160 + | impl
|
161 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
162 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
163 + | > for crate::output::MatchOutput
|
164 + | {
|
165 + | 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 + | }
|
173 + | }
|
174 + | }
|
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 + | }
|
195 + | }
|
196 + | }
|
197 + |
|
198 + | ::pin_project_lite::pin_project! {
|
199 + | /// 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>>
|
203 + | }
|
204 + | }
|
205 + |
|
206 + | impl std::future::Future for OptionInputFuture {
|
207 + | type Output = Result<
|
208 + | crate::input::OptionInput,
|
209 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
210 + | >;
|
211 + |
|
212 + | fn poll(
|
213 + | self: std::pin::Pin<&mut Self>,
|
214 + | cx: &mut std::task::Context<'_>,
|
215 + | ) -> std::task::Poll<Self::Output> {
|
216 + | let this = self.project();
|
217 + | this.inner.as_mut().poll(cx)
|
218 + | }
|
219 + | }
|
220 + |
|
221 + | impl<B>
|
222 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
223 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
224 + | B,
|
225 + | > for crate::input::OptionInput
|
226 + | where
|
227 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
228 + | B: 'static,
|
229 + |
|
230 + | B::Data: Send,
|
231 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
232 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
233 + | {
|
234 + | type Rejection =
|
235 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
236 + | type Future = OptionInputFuture;
|
237 + |
|
238 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
239 + | let fut = async move {
|
240 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
241 + | request.headers(),
|
242 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
243 + | ) {
|
244 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
245 + | }
|
246 + | crate::protocol_serde::shape_option::de_option_http_request(request).await
|
247 + | };
|
248 + | use ::futures_util::future::TryFutureExt;
|
249 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
250 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
251 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
252 + | });
|
253 + | OptionInputFuture {
|
254 + | inner: Box::pin(fut),
|
255 + | }
|
256 + | }
|
257 + | }
|
258 + | impl
|
259 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
260 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
261 + | > for crate::output::OptionOutput
|
262 + | {
|
263 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
264 + | match crate::protocol_serde::shape_option::ser_option_http_response(self) {
|
265 + | Ok(response) => response,
|
266 + | Err(e) => {
|
267 + | ::tracing::error!(error = %e, "failed to serialize response");
|
268 + | ::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 + | }
|
270 + | }
|
271 + | }
|
272 + | }
|
273 + |
|
274 + | ::pin_project_lite::pin_project! {
|
275 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
276 + | /// [`ResultInput`](crate::input::ResultInput) using modelled bindings.
|
277 + | pub struct ResultInputFuture {
|
278 + | 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 + | }
|
280 + | }
|
281 + |
|
282 + | impl std::future::Future for ResultInputFuture {
|
283 + | type Output = Result<
|
284 + | crate::input::ResultInput,
|
285 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
286 + | >;
|
287 + |
|
288 + | fn poll(
|
289 + | self: std::pin::Pin<&mut Self>,
|
290 + | cx: &mut std::task::Context<'_>,
|
291 + | ) -> std::task::Poll<Self::Output> {
|
292 + | let this = self.project();
|
293 + | this.inner.as_mut().poll(cx)
|
294 + | }
|
295 + | }
|
296 + |
|
297 + | impl<B>
|
298 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
299 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
300 + | B,
|
301 + | > for crate::input::ResultInput
|
302 + | where
|
303 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
304 + | B: 'static,
|
305 + |
|
306 + | B::Data: Send,
|
307 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
308 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
309 + | {
|
310 + | type Rejection =
|
311 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
312 + | type Future = ResultInputFuture;
|
313 + |
|
314 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
315 + | let fut = async move {
|
316 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
317 + | request.headers(),
|
318 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
319 + | ) {
|
320 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
321 + | }
|
322 + | crate::protocol_serde::shape_result::de_result_http_request(request).await
|
323 + | };
|
324 + | use ::futures_util::future::TryFutureExt;
|
325 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
326 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
327 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
328 + | });
|
329 + | ResultInputFuture {
|
330 + | inner: Box::pin(fut),
|
331 + | }
|
332 + | }
|
333 + | }
|
334 + | impl
|
335 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
336 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
337 + | > for crate::output::ResultOutput
|
338 + | {
|
339 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
340 + | match crate::protocol_serde::shape_result::ser_result_http_response(self) {
|
341 + | Ok(response) => response,
|
342 + | Err(e) => {
|
343 + | ::tracing::error!(error = %e, "failed to serialize response");
|
344 + | ::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 + | }
|
346 + | }
|
347 + | }
|
348 + | }
|
349 + |
|
350 + | ::pin_project_lite::pin_project! {
|
351 + | /// 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>>
|
355 + | }
|
356 + | }
|
357 + |
|
358 + | impl std::future::Future for ErrCollisionsInputFuture {
|
359 + | type Output = Result<
|
360 + | crate::input::ErrCollisionsInput,
|
361 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
362 + | >;
|
363 + |
|
364 + | fn poll(
|
365 + | self: std::pin::Pin<&mut Self>,
|
366 + | cx: &mut std::task::Context<'_>,
|
367 + | ) -> std::task::Poll<Self::Output> {
|
368 + | let this = self.project();
|
369 + | this.inner.as_mut().poll(cx)
|
370 + | }
|
371 + | }
|
372 + |
|
373 + | impl<B>
|
374 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
375 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
376 + | B,
|
377 + | > for crate::input::ErrCollisionsInput
|
378 + | where
|
379 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
380 + | B: 'static,
|
381 + |
|
382 + | B::Data: Send,
|
383 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
384 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
385 + | {
|
386 + | type Rejection =
|
387 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
388 + | type Future = ErrCollisionsInputFuture;
|
389 + |
|
390 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
391 + | let fut = async move {
|
392 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
393 + | request.headers(),
|
394 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
395 + | ) {
|
396 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
397 + | }
|
398 + | crate::protocol_serde::shape_err_collisions::de_err_collisions_http_request(request)
|
399 + | .await
|
400 + | };
|
401 + | use ::futures_util::future::TryFutureExt;
|
402 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
403 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
404 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
405 + | });
|
406 + | ErrCollisionsInputFuture {
|
407 + | inner: Box::pin(fut),
|
408 + | }
|
409 + | }
|
410 + | }
|
411 + | impl
|
412 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
413 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
414 + | > for crate::output::ErrCollisionsOutput
|
415 + | {
|
416 + | 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) {
|
418 + | Ok(response) => response,
|
419 + | Err(e) => {
|
420 + | ::tracing::error!(error = %e, "failed to serialize response");
|
421 + | ::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 + | }
|
423 + | }
|
424 + | }
|
425 + | }
|
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 + |
|
449 + | ::pin_project_lite::pin_project! {
|
450 + | /// 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>>
|
454 + | }
|
455 + | }
|
456 + |
|
457 + | impl std::future::Future for StructureNamePunningInputFuture {
|
458 + | type Output = Result<
|
459 + | crate::input::StructureNamePunningInput,
|
460 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
461 + | >;
|
462 + |
|
463 + | fn poll(
|
464 + | self: std::pin::Pin<&mut Self>,
|
465 + | cx: &mut std::task::Context<'_>,
|
466 + | ) -> std::task::Poll<Self::Output> {
|
467 + | let this = self.project();
|
468 + | this.inner.as_mut().poll(cx)
|
469 + | }
|
470 + | }
|
471 + |
|
472 + | impl<B>
|
473 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
474 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
475 + | B,
|
476 + | > for crate::input::StructureNamePunningInput
|
477 + | where
|
478 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
479 + | B: 'static,
|
480 + |
|
481 + | B::Data: Send,
|
482 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
483 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
484 + | {
|
485 + | type Rejection =
|
486 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
487 + | type Future = StructureNamePunningInputFuture;
|
488 + |
|
489 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
490 + | let fut = async move {
|
491 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
492 + | request.headers(),
|
493 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
494 + | ) {
|
495 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
496 + | }
|
497 + | crate::protocol_serde::shape_structure_name_punning::de_structure_name_punning_http_request(request)
|
498 + | .await
|
499 + | };
|
500 + | use ::futures_util::future::TryFutureExt;
|
501 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
502 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
503 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
504 + | });
|
505 + | StructureNamePunningInputFuture {
|
506 + | inner: Box::pin(fut),
|
507 + | }
|
508 + | }
|
509 + | }
|
510 + | impl
|
511 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
512 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
513 + | > for crate::output::StructureNamePunningOutput
|
514 + | {
|
515 + | 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 + | }
|
523 + | }
|
524 + | }
|
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 + | );
|
575 + | }
|
576 + | }
|
577 + |
|
578 + | ::pin_project_lite::pin_project! {
|
579 + | /// 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>>
|
583 + | }
|
584 + | }
|
585 + |
|
586 + | impl std::future::Future for ReservedWordsAsMembersInputFuture {
|
587 + | type Output = Result<
|
588 + | crate::input::ReservedWordsAsMembersInput,
|
589 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
590 + | >;
|
591 + |
|
592 + | fn poll(
|
593 + | self: std::pin::Pin<&mut Self>,
|
594 + | cx: &mut std::task::Context<'_>,
|
595 + | ) -> std::task::Poll<Self::Output> {
|
596 + | let this = self.project();
|
597 + | this.inner.as_mut().poll(cx)
|
598 + | }
|
599 + | }
|
600 + |
|
601 + | impl<B>
|
602 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
603 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
604 + | B,
|
605 + | > for crate::input::ReservedWordsAsMembersInput
|
606 + | where
|
607 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
608 + | B: 'static,
|
609 + |
|
610 + | B::Data: Send,
|
611 + | ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
|
612 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
613 + | {
|
614 + | type Rejection =
|
615 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
616 + | type Future = ReservedWordsAsMembersInputFuture;
|
617 + |
|
618 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
619 + | let fut = async move {
|
620 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
621 + | request.headers(),
|
622 + | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
623 + | ) {
|
624 + | return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
625 + | }
|
626 + | crate::protocol_serde::shape_reserved_words_as_members::de_reserved_words_as_members_http_request(request)
|
627 + | .await
|
628 + | };
|
629 + | use ::futures_util::future::TryFutureExt;
|
630 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
631 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
632 + | ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
633 + | });
|
634 + | ReservedWordsAsMembersInputFuture {
|
635 + | inner: Box::pin(fut),
|
636 + | }
|
637 + | }
|
638 + | }
|
639 + | impl
|
640 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
641 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
642 + | > for crate::output::ReservedWordsAsMembersOutput
|
643 + | {
|
644 + | 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 + | }
|
652 + | }
|
653 + | }
|
654 + | impl
|
655 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
656 + | ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
|
657 + | > for crate::error::ReservedWordsAsMembersError
|
658 + | {
|
659 + | 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) {
|
661 + | Ok(mut response) => {
|
662 + | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
663 + | response
|
664 + | },
|
665 + | Err(e) => {
|
666 + | ::tracing::error!(error = %e, "failed to serialize response");
|
667 + | ::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 + | }
|
669 + | }
|
670 + | }
|
671 + | }
|
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 + | }
|