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_json_lists_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::JsonListsInput,
|
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::Data: Send,
|
12 14 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 15 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 16 | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:516 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:723 */
|
17 22 | let mut input = crate::input::json_lists_input_internal::Builder::default();
|
23 + | /* RustType.kt:516 */
|
18 24 | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
19 26 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 27 | uri, headers, body, ..
|
21 28 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:745 */
|
22 30 | let bytes = ::hyper::body::to_bytes(body).await?;
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
23 32 | if !bytes.is_empty() {
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:769 */
|
24 34 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 35 | &headers,
|
26 36 | Some("application/json"),
|
27 37 | )?;
|
28 38 | input = crate::protocol_serde::shape_json_lists::de_json_lists(bytes.as_ref(), input)?;
|
39 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
29 40 | }
|
41 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
30 42 | input.build()?
|
43 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
31 44 | })
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
32 46 | }
|
33 47 |
|
48 + | /* RustType.kt:516 */
|
34 49 | #[allow(clippy::unnecessary_wraps)]
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
35 51 | pub fn ser_json_lists_http_response(
|
36 52 | #[allow(unused_variables)] output: crate::output::JsonListsOutput,
|
37 53 | ) -> std::result::Result<
|
38 54 | ::aws_smithy_http_server::response::Response,
|
39 55 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
40 56 | > {
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
41 58 | Ok({
|
59 + | /* RustType.kt:516 */
|
42 60 | #[allow(unused_mut)]
|
61 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
43 62 | let mut builder = ::http::Response::builder();
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
44 64 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
45 65 | builder,
|
46 66 | ::http::header::CONTENT_TYPE,
|
47 67 | "application/json",
|
48 68 | );
|
69 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
49 70 | let http_status: u16 = 200;
|
50 71 | builder = builder.status(http_status);
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
51 73 | let payload =
|
52 - | crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(
|
53 - | &output,
|
54 - | )?;
|
74 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_json_lists_output::ser_json_lists_output_output_output(&output)?
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
55 77 | let content_length = payload.len();
|
56 78 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
57 79 | builder,
|
58 80 | ::http::header::CONTENT_LENGTH,
|
59 81 | content_length,
|
60 82 | );
|
83 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
61 84 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
85 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
62 86 | builder.body(body)?
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
63 88 | })
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
64 90 | }
|
65 91 |
|
92 + | /* RustType.kt:516 */
|
66 93 | #[allow(clippy::unnecessary_wraps)]
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
67 95 | pub fn ser_json_lists_http_error(
|
68 96 | error: &crate::error::JsonListsError,
|
69 97 | ) -> std::result::Result<
|
70 98 | ::aws_smithy_http_server::response::Response,
|
71 99 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
72 100 | > {
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
73 102 | Ok({
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
74 104 | match error {
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
75 106 | crate::error::JsonListsError::ValidationException(output) => {
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
76 108 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
109 + | /* RustType.kt:516 */
|
77 110 | #[allow(unused_mut)]
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
78 112 | let mut builder = ::http::Response::builder();
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
79 114 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
80 115 | builder,
|
81 116 | ::http::header::CONTENT_TYPE,
|
82 117 | "application/json",
|
83 118 | );
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
84 120 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
85 121 | builder,
|
86 122 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
87 123 | "ValidationException",
|
88 124 | );
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
89 126 | let content_length = payload.len();
|
90 127 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
91 128 | builder,
|
92 129 | ::http::header::CONTENT_LENGTH,
|
93 130 | content_length,
|
94 131 | );
|
132 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
95 133 | builder
|
96 134 | .status(400)
|
97 135 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
98 137 | }
|
138 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
99 139 | crate::error::JsonListsError::InternalServerError(output) => {
|
140 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
100 141 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
142 + | /* RustType.kt:516 */
|
101 143 | #[allow(unused_mut)]
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
102 145 | let mut builder = ::http::Response::builder();
|
146 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
103 147 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
104 148 | builder,
|
105 149 | ::http::header::CONTENT_TYPE,
|
106 150 | "application/json",
|
107 151 | );
|
152 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
108 153 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
109 154 | builder,
|
110 155 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
111 156 | "InternalServerError",
|
112 157 | );
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
113 159 | let content_length = payload.len();
|
114 160 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
115 161 | builder,
|
116 162 | ::http::header::CONTENT_LENGTH,
|
117 163 | content_length,
|
118 164 | );
|
165 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
119 166 | builder
|
120 167 | .status(500)
|
121 168 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
170 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
122 171 | }
|
123 - | }
|
172 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
124 173 | })
|
174 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
125 175 | }
|
126 176 |
|
177 + | /* JsonParserGenerator.kt:148 */
|
127 178 | pub(crate) fn de_json_lists(
|
128 179 | value: &[u8],
|
129 180 | mut builder: crate::input::json_lists_input_internal::Builder,
|
130 181 | ) -> ::std::result::Result<
|
131 182 | crate::input::json_lists_input_internal::Builder,
|
132 183 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
133 184 | > {
|
185 + | /* JsonParserGenerator.kt:153 */
|
134 186 | let mut tokens_owned =
|
135 187 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
136 188 | .peekable();
|
137 189 | let tokens = &mut tokens_owned;
|
138 190 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
191 + | /* JsonParserGenerator.kt:684 */
|
139 192 | loop {
|
193 + | /* JsonParserGenerator.kt:685 */
|
140 194 | match tokens.next().transpose()? {
|
195 + | /* JsonParserGenerator.kt:686 */
|
141 196 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
142 197 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
198 + | /* JsonParserGenerator.kt:260 */
|
143 199 | match key.to_unescaped()?.as_ref() {
|
200 + | /* JsonParserGenerator.kt:262 */
|
144 201 | "booleanList" => {
|
202 + | /* JsonParserGenerator.kt:272 */
|
145 203 | builder = builder.set_boolean_list(
|
146 - | crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?,
|
147 - | );
|
204 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?
|
205 + | /* JsonParserGenerator.kt:272 */);
|
206 + | /* JsonParserGenerator.kt:262 */
|
148 207 | }
|
208 + | /* JsonParserGenerator.kt:262 */
|
149 209 | "enumList" => {
|
150 - | builder = builder.set_enum_list(
|
151 - | crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
|
210 + | /* JsonParserGenerator.kt:272 */
|
211 + | builder =
|
212 + | builder.set_enum_list(
|
213 + | /* JsonParserGenerator.kt:451 */
|
214 + | crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(
|
215 + | tokens,
|
216 + | )?, /* JsonParserGenerator.kt:272 */
|
152 217 | );
|
218 + | /* JsonParserGenerator.kt:262 */
|
153 219 | }
|
220 + | /* JsonParserGenerator.kt:262 */
|
154 221 | "intEnumList" => {
|
222 + | /* JsonParserGenerator.kt:272 */
|
155 223 | builder = builder.set_int_enum_list(
|
224 + | /* JsonParserGenerator.kt:451 */
|
156 225 | crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
|
157 226 | tokens,
|
158 - | )?,
|
227 + | )?, /* JsonParserGenerator.kt:272 */
|
159 228 | );
|
229 + | /* JsonParserGenerator.kt:262 */
|
160 230 | }
|
231 + | /* JsonParserGenerator.kt:262 */
|
161 232 | "integerList" => {
|
233 + | /* JsonParserGenerator.kt:272 */
|
162 234 | builder = builder.set_integer_list(
|
163 - | crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?,
|
164 - | );
|
235 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?
|
236 + | /* JsonParserGenerator.kt:272 */);
|
237 + | /* JsonParserGenerator.kt:262 */
|
165 238 | }
|
239 + | /* JsonParserGenerator.kt:262 */
|
166 240 | "nestedStringList" => {
|
241 + | /* JsonParserGenerator.kt:272 */
|
167 242 | builder = builder.set_nested_string_list(
|
243 + | /* JsonParserGenerator.kt:451 */
|
168 244 | crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
|
169 245 | tokens,
|
170 - | )?,
|
246 + | )?, /* JsonParserGenerator.kt:272 */
|
171 247 | );
|
248 + | /* JsonParserGenerator.kt:262 */
|
172 249 | }
|
250 + | /* JsonParserGenerator.kt:262 */
|
173 251 | "stringList" => {
|
252 + | /* JsonParserGenerator.kt:272 */
|
174 253 | builder = builder.set_string_list(
|
175 - | crate::protocol_serde::shape_string_list::de_string_list(tokens)?,
|
176 - | );
|
254 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
|
255 + | /* JsonParserGenerator.kt:272 */);
|
256 + | /* JsonParserGenerator.kt:262 */
|
177 257 | }
|
258 + | /* JsonParserGenerator.kt:262 */
|
178 259 | "stringSet" => {
|
260 + | /* JsonParserGenerator.kt:272 */
|
179 261 | builder = builder.set_string_set(
|
180 - | crate::protocol_serde::shape_string_set::de_string_set(tokens)?,
|
181 - | );
|
262 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
|
263 + | /* JsonParserGenerator.kt:272 */);
|
264 + | /* JsonParserGenerator.kt:262 */
|
182 265 | }
|
266 + | /* JsonParserGenerator.kt:262 */
|
183 267 | "myStructureList" => {
|
184 - | builder = builder.set_structure_list(
|
185 - | crate::protocol_serde::shape_structure_list::de_structure_list(tokens)?,
|
268 + | /* JsonParserGenerator.kt:272 */
|
269 + | builder =
|
270 + | builder.set_structure_list(
|
271 + | /* JsonParserGenerator.kt:451 */
|
272 + | crate::protocol_serde::shape_structure_list::de_structure_list(
|
273 + | tokens,
|
274 + | )?, /* JsonParserGenerator.kt:272 */
|
186 275 | );
|
276 + | /* JsonParserGenerator.kt:262 */
|
187 277 | }
|
278 + | /* JsonParserGenerator.kt:262 */
|
188 279 | "timestampList" => {
|
189 - | builder = builder.set_timestamp_list(
|
190 - | crate::protocol_serde::shape_timestamp_list::de_timestamp_list(tokens)?,
|
280 + | /* JsonParserGenerator.kt:272 */
|
281 + | builder =
|
282 + | builder.set_timestamp_list(
|
283 + | /* JsonParserGenerator.kt:451 */
|
284 + | crate::protocol_serde::shape_timestamp_list::de_timestamp_list(
|
285 + | tokens,
|
286 + | )?, /* JsonParserGenerator.kt:272 */
|
191 287 | );
|
288 + | /* JsonParserGenerator.kt:262 */
|
192 289 | }
|
193 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
290 + | /* JsonParserGenerator.kt:290 */
|
291 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
194 292 | }
|
293 + | /* JsonParserGenerator.kt:686 */
|
195 294 | }
|
295 + | /* JsonParserGenerator.kt:695 */
|
196 296 | other => {
|
197 297 | return Err(
|
198 298 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
199 299 | "expected object key or end object, found: {:?}",
|
200 300 | other
|
201 301 | )),
|
202 302 | )
|
303 + | } /* JsonParserGenerator.kt:685 */
|
203 304 | }
|
305 + | /* JsonParserGenerator.kt:684 */
|
204 306 | }
|
205 - | }
|
307 + | /* JsonParserGenerator.kt:250 */
|
206 308 | if tokens.next().is_some() {
|
309 + | /* JsonParserGenerator.kt:251 */
|
207 310 | return Err(
|
208 311 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
209 312 | "found more JSON tokens after completing parsing",
|
210 313 | ),
|
211 314 | );
|
315 + | /* JsonParserGenerator.kt:250 */
|
212 316 | }
|
317 + | /* JsonParserGenerator.kt:163 */
|
213 318 | Ok(builder)
|
319 + | /* JsonParserGenerator.kt:148 */
|
214 320 | }
|