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::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 */
|
137 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
98 138 | }
|
99 - | }
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
100 140 | })
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
101 142 | }
|
102 143 |
|
144 + | /* JsonParserGenerator.kt:148 */
|
103 145 | pub(crate) fn de_json_lists(
|
104 146 | value: &[u8],
|
105 147 | mut builder: crate::input::json_lists_input::Builder,
|
106 148 | ) -> ::std::result::Result<
|
107 149 | crate::input::json_lists_input::Builder,
|
108 150 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
109 151 | > {
|
152 + | /* JsonParserGenerator.kt:153 */
|
110 153 | let mut tokens_owned =
|
111 154 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
112 155 | .peekable();
|
113 156 | let tokens = &mut tokens_owned;
|
114 157 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
158 + | /* JsonParserGenerator.kt:684 */
|
115 159 | loop {
|
160 + | /* JsonParserGenerator.kt:685 */
|
116 161 | match tokens.next().transpose()? {
|
162 + | /* JsonParserGenerator.kt:686 */
|
117 163 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
118 164 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
165 + | /* JsonParserGenerator.kt:260 */
|
119 166 | match key.to_unescaped()?.as_ref() {
|
167 + | /* JsonParserGenerator.kt:262 */
|
120 168 | "booleanList" => {
|
169 + | /* JsonParserGenerator.kt:272 */
|
121 170 | builder = builder.set_boolean_list(
|
122 - | crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?,
|
123 - | );
|
171 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_boolean_list::de_boolean_list(tokens)?
|
172 + | /* JsonParserGenerator.kt:272 */);
|
173 + | /* JsonParserGenerator.kt:262 */
|
124 174 | }
|
175 + | /* JsonParserGenerator.kt:262 */
|
125 176 | "enumList" => {
|
126 - | builder = builder.set_enum_list(
|
127 - | crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(tokens)?,
|
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 */
|
128 184 | );
|
185 + | /* JsonParserGenerator.kt:262 */
|
129 186 | }
|
187 + | /* JsonParserGenerator.kt:262 */
|
130 188 | "intEnumList" => {
|
189 + | /* JsonParserGenerator.kt:272 */
|
131 190 | builder = builder.set_int_enum_list(
|
191 + | /* JsonParserGenerator.kt:451 */
|
132 192 | crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
|
133 193 | tokens,
|
134 - | )?,
|
194 + | )?, /* JsonParserGenerator.kt:272 */
|
135 195 | );
|
196 + | /* JsonParserGenerator.kt:262 */
|
136 197 | }
|
198 + | /* JsonParserGenerator.kt:262 */
|
137 199 | "integerList" => {
|
200 + | /* JsonParserGenerator.kt:272 */
|
138 201 | builder = builder.set_integer_list(
|
139 - | crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?,
|
140 - | );
|
202 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_integer_list::de_integer_list(tokens)?
|
203 + | /* JsonParserGenerator.kt:272 */);
|
204 + | /* JsonParserGenerator.kt:262 */
|
141 205 | }
|
206 + | /* JsonParserGenerator.kt:262 */
|
142 207 | "nestedStringList" => {
|
208 + | /* JsonParserGenerator.kt:272 */
|
143 209 | builder = builder.set_nested_string_list(
|
210 + | /* JsonParserGenerator.kt:451 */
|
144 211 | crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
|
145 212 | tokens,
|
146 - | )?,
|
213 + | )?, /* JsonParserGenerator.kt:272 */
|
147 214 | );
|
215 + | /* JsonParserGenerator.kt:262 */
|
148 216 | }
|
217 + | /* JsonParserGenerator.kt:262 */
|
149 218 | "stringList" => {
|
219 + | /* JsonParserGenerator.kt:272 */
|
150 220 | builder = builder.set_string_list(
|
151 - | crate::protocol_serde::shape_string_list::de_string_list(tokens)?,
|
152 - | );
|
221 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
|
222 + | /* JsonParserGenerator.kt:272 */);
|
223 + | /* JsonParserGenerator.kt:262 */
|
153 224 | }
|
225 + | /* JsonParserGenerator.kt:262 */
|
154 226 | "stringSet" => {
|
227 + | /* JsonParserGenerator.kt:272 */
|
155 228 | builder = builder.set_string_set(
|
156 - | crate::protocol_serde::shape_string_set::de_string_set(tokens)?,
|
157 - | );
|
229 + | /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
|
230 + | /* JsonParserGenerator.kt:272 */);
|
231 + | /* JsonParserGenerator.kt:262 */
|
158 232 | }
|
233 + | /* JsonParserGenerator.kt:262 */
|
159 234 | "myStructureList" => {
|
160 - | builder = builder.set_structure_list(
|
161 - | crate::protocol_serde::shape_structure_list::de_structure_list(tokens)?,
|
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 */
|
162 242 | );
|
243 + | /* JsonParserGenerator.kt:262 */
|
163 244 | }
|
245 + | /* JsonParserGenerator.kt:262 */
|
164 246 | "timestampList" => {
|
165 - | builder = builder.set_timestamp_list(
|
166 - | crate::protocol_serde::shape_timestamp_list::de_timestamp_list(tokens)?,
|
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 */
|
167 254 | );
|
255 + | /* JsonParserGenerator.kt:262 */
|
168 256 | }
|
169 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
257 + | /* JsonParserGenerator.kt:290 */
|
258 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
170 259 | }
|
260 + | /* JsonParserGenerator.kt:686 */
|
171 261 | }
|
262 + | /* JsonParserGenerator.kt:695 */
|
172 263 | other => {
|
173 264 | return Err(
|
174 265 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
175 266 | "expected object key or end object, found: {:?}",
|
176 267 | other
|
177 268 | )),
|
178 269 | )
|
270 + | } /* JsonParserGenerator.kt:685 */
|
179 271 | }
|
272 + | /* JsonParserGenerator.kt:684 */
|
180 273 | }
|
181 - | }
|
274 + | /* JsonParserGenerator.kt:250 */
|
182 275 | if tokens.next().is_some() {
|
276 + | /* JsonParserGenerator.kt:251 */
|
183 277 | return Err(
|
184 278 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
185 279 | "found more JSON tokens after completing parsing",
|
186 280 | ),
|
187 281 | );
|
282 + | /* JsonParserGenerator.kt:250 */
|
188 283 | }
|
284 + | /* JsonParserGenerator.kt:163 */
|
189 285 | Ok(builder)
|
286 + | /* JsonParserGenerator.kt:148 */
|
190 287 | }
|