1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
5 + | pub async fn de_capture_pokemon_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::CapturePokemonInput,
|
9 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
13 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
14 + | B::Data: Send,
|
15 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
16 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
17 + | {
|
18 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
19 + | Ok({
|
20 + | /* RustType.kt:534 */
|
21 + | #[allow(unused_mut)]
|
22 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
23 + | let mut input = crate::input::capture_pokemon_input::Builder::default();
|
24 + | /* RustType.kt:534 */
|
25 + | #[allow(unused_variables)]
|
26 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
27 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
28 + | uri, headers, body, ..
|
29 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
30 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
31 + | if let Some(value) = {
|
32 + | let mut receiver =
|
33 + | crate::protocol_serde::shape_capture_pokemon_input::de_events_payload(
|
34 + | &mut body.into().into_inner(),
|
35 + | )?;
|
36 + | if let Some(_initial_event) = receiver
|
37 + | .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
|
38 + | .await
|
39 + | .map_err(
|
40 + | |ev_error| ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection::ConstraintViolation(
|
41 + | #[allow(clippy::useless_conversion)]
|
42 + | format!("{ev_error}").into()
|
43 + | )
|
44 + | )? {
|
45 + |
|
46 + | }
|
47 + | Some(receiver)
|
48 + | } {
|
49 + | input = input.set_events(value)
|
50 + | }
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:1134 */
|
52 + | let input_string = uri.path();
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:1146 */
|
54 + | let (input_string, (_, m1)) =
|
55 + | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
56 + | ::nom::sequence::preceded(
|
57 + | ::nom::bytes::complete::tag("/"),
|
58 + | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
59 + | "capture-pokemon-event",
|
60 + | ),
|
61 + | ),
|
62 + | ::nom::sequence::preceded(
|
63 + | ::nom::bytes::complete::tag("/"),
|
64 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
65 + | ::nom::bytes::complete::take_until("/"),
|
66 + | ::nom::combinator::rest,
|
67 + | )),
|
68 + | ),
|
69 + | ))(input_string)?;
|
70 + | debug_assert_eq!("", input_string);
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
72 + | input =
|
73 + | input.set_region(crate::protocol_serde::shape_capture_pokemon_input::de_region(m1)?);
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
75 + | input.build()?
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
77 + | })
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
79 + | }
|
80 + |
|
81 + | /* RustType.kt:534 */
|
82 + | #[allow(clippy::unnecessary_wraps)]
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
84 + | pub fn ser_capture_pokemon_http_response(
|
85 + | #[allow(unused_variables)] output: crate::output::CapturePokemonOutput,
|
86 + | ) -> std::result::Result<
|
87 + | ::aws_smithy_legacy_http_server::response::Response,
|
88 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
89 + | > {
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
91 + | Ok({
|
92 + | /* RustType.kt:534 */
|
93 + | #[allow(unused_mut)]
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
95 + | let mut builder = ::http::Response::builder();
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
97 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
98 + | builder,
|
99 + | ::http::header::CONTENT_TYPE,
|
100 + | "application/vnd.amazon.eventstream",
|
101 + | );
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
103 + | let http_status: u16 = 200;
|
104 + | builder = builder.status(http_status);
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
106 + | let body = ::aws_smithy_legacy_http_server::body::boxed(
|
107 + | ::aws_smithy_legacy_http_server::body::Body::wrap_stream(
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:142 */
|
109 + | {
|
110 + | let error_marshaller =
|
111 + | crate::event_stream_serde::CapturePokemonEventsErrorMarshaller::new();
|
112 + | let marshaller =
|
113 + | crate::event_stream_serde::CapturePokemonEventsMarshaller::new();
|
114 + | let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
|
115 + | output
|
116 + | .events
|
117 + | .into_body_stream(marshaller, error_marshaller, signer)
|
118 + | }, /* ServerHttpBoundProtocolGenerator.kt:575 */
|
119 + | ),
|
120 + | );
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
122 + | builder.body(body)?
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
124 + | })
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
126 + | }
|
127 + |
|
128 + | /* RustType.kt:534 */
|
129 + | #[allow(clippy::unnecessary_wraps)]
|
130 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
131 + | pub fn ser_capture_pokemon_http_error(
|
132 + | error: &crate::error::CapturePokemonError,
|
133 + | ) -> std::result::Result<
|
134 + | ::aws_smithy_legacy_http_server::response::Response,
|
135 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
136 + | > {
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
138 + | Ok({
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
140 + | match error {
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
142 + | crate::error::CapturePokemonError::UnsupportedRegionError(output) => {
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
144 + | let payload = crate::protocol_serde::shape_unsupported_region_error::ser_unsupported_region_error_error(output)?;
|
145 + | /* RustType.kt:534 */
|
146 + | #[allow(unused_mut)]
|
147 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
148 + | let mut builder = ::http::Response::builder();
|
149 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
150 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
151 + | builder,
|
152 + | ::http::header::CONTENT_TYPE,
|
153 + | "application/vnd.amazon.eventstream",
|
154 + | );
|
155 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
156 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
157 + | builder,
|
158 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
159 + | "UnsupportedRegionError",
|
160 + | );
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
162 + | let content_length = payload.len();
|
163 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
164 + | builder,
|
165 + | ::http::header::CONTENT_LENGTH,
|
166 + | content_length,
|
167 + | );
|
168 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
169 + | builder
|
170 + | .status(500)
|
171 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
172 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
173 + | }
|
174 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
175 + | crate::error::CapturePokemonError::ThrottlingError(output) => {
|
176 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
177 + | let payload =
|
178 + | crate::protocol_serde::shape_throttling_error::ser_throttling_error_error(
|
179 + | output,
|
180 + | )?;
|
181 + | /* RustType.kt:534 */
|
182 + | #[allow(unused_mut)]
|
183 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
184 + | let mut builder = ::http::Response::builder();
|
185 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
186 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
187 + | builder,
|
188 + | ::http::header::CONTENT_TYPE,
|
189 + | "application/vnd.amazon.eventstream",
|
190 + | );
|
191 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
192 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
193 + | builder,
|
194 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
195 + | "ThrottlingError",
|
196 + | );
|
197 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
198 + | let content_length = payload.len();
|
199 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
200 + | builder,
|
201 + | ::http::header::CONTENT_LENGTH,
|
202 + | content_length,
|
203 + | );
|
204 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
205 + | builder
|
206 + | .status(400)
|
207 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
208 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
209 + | }
|
210 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
211 + | crate::error::CapturePokemonError::ValidationException(output) => {
|
212 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
213 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
214 + | /* RustType.kt:534 */
|
215 + | #[allow(unused_mut)]
|
216 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
217 + | let mut builder = ::http::Response::builder();
|
218 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
219 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
220 + | builder,
|
221 + | ::http::header::CONTENT_TYPE,
|
222 + | "application/vnd.amazon.eventstream",
|
223 + | );
|
224 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
225 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
226 + | builder,
|
227 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
228 + | "ValidationException",
|
229 + | );
|
230 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
231 + | let content_length = payload.len();
|
232 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
233 + | builder,
|
234 + | ::http::header::CONTENT_LENGTH,
|
235 + | content_length,
|
236 + | );
|
237 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
238 + | builder
|
239 + | .status(400)
|
240 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
241 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
242 + | }
|
243 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
244 + | crate::error::CapturePokemonError::MasterBallUnsuccessful(output) => {
|
245 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
246 + | let payload = crate::protocol_serde::shape_master_ball_unsuccessful::ser_master_ball_unsuccessful_error(output)?;
|
247 + | /* RustType.kt:534 */
|
248 + | #[allow(unused_mut)]
|
249 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
250 + | let mut builder = ::http::Response::builder();
|
251 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
252 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
253 + | builder,
|
254 + | ::http::header::CONTENT_TYPE,
|
255 + | "application/vnd.amazon.eventstream",
|
256 + | );
|
257 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
258 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
259 + | builder,
|
260 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
261 + | "MasterBallUnsuccessful",
|
262 + | );
|
263 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
264 + | let content_length = payload.len();
|
265 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
266 + | builder,
|
267 + | ::http::header::CONTENT_LENGTH,
|
268 + | content_length,
|
269 + | );
|
270 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
271 + | builder
|
272 + | .status(500)
|
273 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
274 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
275 + | }
|
276 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
277 + | crate::error::CapturePokemonError::InvalidPokeballError(output) => {
|
278 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
279 + | let payload = crate::protocol_serde::shape_invalid_pokeball_error::ser_invalid_pokeball_error_error(output)?;
|
280 + | /* RustType.kt:534 */
|
281 + | #[allow(unused_mut)]
|
282 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
283 + | let mut builder = ::http::Response::builder();
|
284 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
285 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
286 + | builder,
|
287 + | ::http::header::CONTENT_TYPE,
|
288 + | "application/vnd.amazon.eventstream",
|
289 + | );
|
290 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
291 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
292 + | builder,
|
293 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
294 + | "InvalidPokeballError",
|
295 + | );
|
296 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
297 + | let content_length = payload.len();
|
298 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
299 + | builder,
|
300 + | ::http::header::CONTENT_LENGTH,
|
301 + | content_length,
|
302 + | );
|
303 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
304 + | builder
|
305 + | .status(400)
|
306 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
307 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
308 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
309 + | }
|
310 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
311 + | })
|
312 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
313 + | }
|