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