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::aws_json::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::aws_json::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::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:834 */
|
32 41 | input.build()?
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
33 43 | })
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
34 45 | }
|
35 46 |
|
47 + | /* RustType.kt:516 */
|
36 48 | #[allow(clippy::unnecessary_wraps)]
|
49 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
37 50 | pub fn ser_capture_pokemon_http_response(
|
38 51 | #[allow(unused_variables)] output: crate::output::CapturePokemonOutput,
|
39 52 | ) -> std::result::Result<
|
40 53 | ::aws_smithy_http_server::response::Response,
|
41 54 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
42 55 | > {
|
56 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
43 57 | Ok({
|
58 + | /* RustType.kt:516 */
|
44 59 | #[allow(unused_mut)]
|
60 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
45 61 | let mut builder = ::http::Response::builder();
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
46 63 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
47 64 | builder,
|
48 65 | ::http::header::CONTENT_TYPE,
|
49 66 | "application/x-amz-json-1.0",
|
50 67 | );
|
68 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
51 69 | let http_status: u16 = 200;
|
52 70 | builder = builder.status(http_status);
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:543 */
|
53 72 | let body = ::aws_smithy_http_server::body::boxed(
|
54 - | ::aws_smithy_http_server::body::Body::wrap_stream({
|
73 + | ::aws_smithy_http_server::body::Body::wrap_stream(
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:135 */
|
75 + | {
|
55 76 | let error_marshaller =
|
56 77 | crate::event_stream_serde::CapturePokemonEventsErrorMarshaller::new();
|
57 - | let marshaller = crate::event_stream_serde::CapturePokemonEventsMarshaller::new();
|
78 + | let marshaller =
|
79 + | crate::event_stream_serde::CapturePokemonEventsMarshaller::new();
|
58 80 | let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
|
59 - | let adapter: ::aws_smithy_http::event_stream::MessageStreamAdapter<_, _> = output
|
81 + | let adapter: ::aws_smithy_http::event_stream::MessageStreamAdapter<_, _> =
|
82 + | output
|
60 83 | .events
|
61 84 | .into_body_stream(marshaller, error_marshaller, signer);
|
62 85 | adapter
|
63 - | }),
|
86 + | }, /* ServerHttpBoundProtocolGenerator.kt:543 */
|
87 + | ),
|
64 88 | );
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
65 90 | builder.body(body)?
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
66 92 | })
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
67 94 | }
|
68 95 |
|
96 + | /* RustType.kt:516 */
|
69 97 | #[allow(clippy::unnecessary_wraps)]
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
70 99 | pub fn ser_capture_pokemon_http_error(
|
71 100 | error: &crate::error::CapturePokemonError,
|
72 101 | ) -> std::result::Result<
|
73 102 | ::aws_smithy_http_server::response::Response,
|
74 103 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
75 104 | > {
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
76 106 | Ok({
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
77 108 | match error {
|
109 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
78 110 | crate::error::CapturePokemonError::ValidationException(output) => {
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
79 112 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
113 + | /* RustType.kt:516 */
|
80 114 | #[allow(unused_mut)]
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
81 116 | let mut builder = ::http::Response::builder();
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
82 118 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
83 119 | builder,
|
84 120 | ::http::header::CONTENT_TYPE,
|
85 121 | "application/x-amz-json-1.0",
|
86 122 | );
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
87 124 | let content_length = payload.len();
|
88 125 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
89 126 | builder,
|
90 127 | ::http::header::CONTENT_LENGTH,
|
91 128 | content_length,
|
92 129 | );
|
130 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
93 131 | builder
|
94 132 | .status(400)
|
95 133 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
134 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
96 135 | }
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
97 137 | crate::error::CapturePokemonError::MasterBallUnsuccessful(output) => {
|
138 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
98 139 | let payload = crate::protocol_serde::shape_master_ball_unsuccessful::ser_master_ball_unsuccessful_error(output)?;
|
140 + | /* RustType.kt:516 */
|
99 141 | #[allow(unused_mut)]
|
142 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
100 143 | let mut builder = ::http::Response::builder();
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
101 145 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
102 146 | builder,
|
103 147 | ::http::header::CONTENT_TYPE,
|
104 148 | "application/x-amz-json-1.0",
|
105 149 | );
|
150 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
106 151 | let content_length = payload.len();
|
107 152 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
108 153 | builder,
|
109 154 | ::http::header::CONTENT_LENGTH,
|
110 155 | content_length,
|
111 156 | );
|
157 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
112 158 | builder
|
113 159 | .status(500)
|
114 160 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
115 162 | }
|
163 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
116 164 | crate::error::CapturePokemonError::InvalidPokeballError(output) => {
|
165 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
117 166 | let payload = crate::protocol_serde::shape_invalid_pokeball_error::ser_invalid_pokeball_error_error(output)?;
|
167 + | /* RustType.kt:516 */
|
118 168 | #[allow(unused_mut)]
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
119 170 | let mut builder = ::http::Response::builder();
|
171 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
120 172 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
121 173 | builder,
|
122 174 | ::http::header::CONTENT_TYPE,
|
123 175 | "application/x-amz-json-1.0",
|
124 176 | );
|
177 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
125 178 | let content_length = payload.len();
|
126 179 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
127 180 | builder,
|
128 181 | ::http::header::CONTENT_LENGTH,
|
129 182 | content_length,
|
130 183 | );
|
184 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
131 185 | builder
|
132 186 | .status(400)
|
133 187 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
188 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
134 189 | }
|
190 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
135 191 | crate::error::CapturePokemonError::ThrottlingError(output) => {
|
192 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
136 193 | let payload =
|
137 194 | crate::protocol_serde::shape_throttling_error::ser_throttling_error_error(
|
138 195 | output,
|
139 196 | )?;
|
197 + | /* RustType.kt:516 */
|
140 198 | #[allow(unused_mut)]
|
199 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
141 200 | let mut builder = ::http::Response::builder();
|
201 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
142 202 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
143 203 | builder,
|
144 204 | ::http::header::CONTENT_TYPE,
|
145 205 | "application/x-amz-json-1.0",
|
146 206 | );
|
207 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
147 208 | let content_length = payload.len();
|
148 209 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
149 210 | builder,
|
150 211 | ::http::header::CONTENT_LENGTH,
|
151 212 | content_length,
|
152 213 | );
|
214 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
153 215 | builder
|
154 216 | .status(400)
|
155 217 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
218 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
156 219 | }
|
220 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
157 221 | crate::error::CapturePokemonError::UnsupportedRegionError(output) => {
|
222 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
158 223 | let payload = crate::protocol_serde::shape_unsupported_region_error::ser_unsupported_region_error_error(output)?;
|
224 + | /* RustType.kt:516 */
|
159 225 | #[allow(unused_mut)]
|
226 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
160 227 | let mut builder = ::http::Response::builder();
|
228 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
161 229 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
162 230 | builder,
|
163 231 | ::http::header::CONTENT_TYPE,
|
164 232 | "application/x-amz-json-1.0",
|
165 233 | );
|
234 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
166 235 | let content_length = payload.len();
|
167 236 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
168 237 | builder,
|
169 238 | ::http::header::CONTENT_LENGTH,
|
170 239 | content_length,
|
171 240 | );
|
241 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
172 242 | builder
|
173 243 | .status(500)
|
174 244 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
245 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
246 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
175 247 | }
|
176 - | }
|
248 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
177 249 | })
|
250 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
178 251 | }
|