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