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_omits_serializing_empty_lists_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::OmitsSerializingEmptyListsInput,
|
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::omits_serializing_empty_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:1221 */
|
30 + | let query_string = uri.query().unwrap_or("");
|
31 + | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
32 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
33 + | let mut query_boolean_list = Vec::new();
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
35 + | let mut query_double_list = Vec::new();
|
36 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
37 + | let mut query_enum_list = Vec::new();
|
38 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
39 + | let mut query_integer_enum_list = Vec::new();
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
41 + | let mut query_integer_list = Vec::new();
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
43 + | let mut query_string_list = Vec::new();
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:1250 */
|
45 + | let mut query_timestamp_list = Vec::new();
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:1253 */
|
47 + | for (k, v) in pairs {
|
48 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
49 + | if k == "BooleanList" {
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:1318 */
|
51 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
52 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
53 + | query_boolean_list.push(v);
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
55 + | }
|
56 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
57 + | else if k == "DoubleList" {
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:1318 */
|
59 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
60 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
61 + | query_double_list.push(v);
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
63 + | }
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
65 + | else if k == "EnumList" {
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:1282 */
|
67 + | let v = v.into_owned();
|
68 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
69 + | query_enum_list.push(v);
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
71 + | }
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
73 + | else if k == "IntegerEnumList" {
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:1318 */
|
75 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
77 + | query_integer_enum_list.push(v);
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
79 + | }
|
80 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
81 + | else if k == "IntegerList" {
|
82 + | /* ServerHttpBoundProtocolGenerator.kt:1318 */
|
83 + | let v = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(&v)?;
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
85 + | query_integer_list.push(v);
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
87 + | }
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
89 + | else if k == "StringList" {
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:1282 */
|
91 + | let v = v.into_owned();
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
93 + | query_string_list.push(v);
|
94 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
95 + | }
|
96 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
97 + | else if k == "TimestampList" {
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:1300 */
|
99 + | let v = ::aws_smithy_types::DateTime::from_str(&v, ::aws_smithy_types::date_time::Format::DateTime)?
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:1314 */;
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:1327 */
|
102 + | query_timestamp_list.push(v);
|
103 + | /* ServerHttpBoundProtocolGenerator.kt:1270 */
|
104 + | }
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:1253 */
|
106 + | }
|
107 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
108 + | if !query_boolean_list.is_empty() {
|
109 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
110 + | input = input.set_query_boolean_list(
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
112 + | Some(
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
114 + | query_boolean_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
115 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
116 + | );
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
118 + | }
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
120 + | if !query_double_list.is_empty() {
|
121 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
122 + | input = input.set_query_double_list(
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
124 + | Some(
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
126 + | query_double_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
127 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
128 + | );
|
129 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
130 + | }
|
131 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
132 + | if !query_enum_list.is_empty() {
|
133 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
134 + | input = input.set_query_enum_list(
|
135 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
136 + | Some(
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:1397 */
|
138 + | crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
140 + | query_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1397 */
|
141 + | ), /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
142 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
143 + | );
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
145 + | }
|
146 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
147 + | if !query_integer_enum_list.is_empty() {
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
149 + | input = input.set_query_integer_enum_list(
|
150 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
151 + | Some(
|
152 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
153 + | query_integer_enum_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
154 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
155 + | );
|
156 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
157 + | }
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
159 + | if !query_integer_list.is_empty() {
|
160 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
161 + | input = input.set_query_integer_list(
|
162 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
163 + | Some(
|
164 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
165 + | query_integer_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
166 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
167 + | );
|
168 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
169 + | }
|
170 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
171 + | if !query_string_list.is_empty() {
|
172 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
173 + | input = input.set_query_string_list(
|
174 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
175 + | Some(
|
176 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
177 + | query_string_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
178 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
179 + | );
|
180 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
181 + | }
|
182 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
183 + | if !query_timestamp_list.is_empty() {
|
184 + | /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
185 + | input = input.set_query_timestamp_list(
|
186 + | /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
187 + | Some(
|
188 + | /* ServerHttpBoundProtocolGenerator.kt:1405 */
|
189 + | query_timestamp_list, /* ServerHttpBoundProtocolGenerator.kt:1396 */
|
190 + | ), /* ServerHttpBoundProtocolGenerator.kt:1390 */
|
191 + | );
|
192 + | /* ServerHttpBoundProtocolGenerator.kt:1389 */
|
193 + | }
|
194 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
195 + | input.build()?
|
196 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
197 + | })
|
198 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
199 + | }
|
200 + |
|
201 + | /* RustType.kt:534 */
|
202 + | #[allow(clippy::unnecessary_wraps)]
|
203 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
204 + | pub fn ser_omits_serializing_empty_lists_http_response(
|
205 + | #[allow(unused_variables)] output: crate::output::OmitsSerializingEmptyListsOutput,
|
206 + | ) -> std::result::Result<
|
207 + | ::aws_smithy_legacy_http_server::response::Response,
|
208 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
209 + | > {
|
210 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
211 + | Ok({
|
212 + | /* RustType.kt:534 */
|
213 + | #[allow(unused_mut)]
|
214 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
215 + | let mut builder = ::http::Response::builder();
|
216 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
217 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
218 + | builder,
|
219 + | ::http::header::CONTENT_TYPE,
|
220 + | "application/json",
|
221 + | );
|
222 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
223 + | let http_status: u16 = 200;
|
224 + | builder = builder.status(http_status);
|
225 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
226 + | let payload =
|
227 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
228 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
229 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
230 + | let content_length = payload.len();
|
231 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
232 + | builder,
|
233 + | ::http::header::CONTENT_LENGTH,
|
234 + | content_length,
|
235 + | );
|
236 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
237 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
238 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
239 + | builder.body(body)?
|
240 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
241 + | })
|
242 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
243 + | }
|
244 + |
|
245 + | /* RustType.kt:534 */
|
246 + | #[allow(clippy::unnecessary_wraps)]
|
247 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
248 + | pub fn ser_omits_serializing_empty_lists_http_error(
|
249 + | error: &crate::error::OmitsSerializingEmptyListsError,
|
250 + | ) -> std::result::Result<
|
251 + | ::aws_smithy_legacy_http_server::response::Response,
|
252 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
253 + | > {
|
254 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
255 + | Ok({
|
256 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
257 + | match error {
|
258 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
259 + | crate::error::OmitsSerializingEmptyListsError::ValidationException(output) => {
|
260 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
261 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
262 + | /* RustType.kt:534 */
|
263 + | #[allow(unused_mut)]
|
264 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
265 + | let mut builder = ::http::Response::builder();
|
266 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
267 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
268 + | builder,
|
269 + | ::http::header::CONTENT_TYPE,
|
270 + | "application/json",
|
271 + | );
|
272 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
273 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
274 + | builder,
|
275 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
276 + | "ValidationException",
|
277 + | );
|
278 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
279 + | let content_length = payload.len();
|
280 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
281 + | builder,
|
282 + | ::http::header::CONTENT_LENGTH,
|
283 + | content_length,
|
284 + | );
|
285 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
286 + | builder
|
287 + | .status(400)
|
288 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
289 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
290 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
291 + | }
|
292 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
293 + | })
|
294 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
295 + | }
|