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