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_sparse_json_maps_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::SparseJsonMapsInput,
|
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::sparse_json_maps_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_sparse_json_maps::de_sparse_json_maps(
|
39 + | bytes.as_ref(),
|
40 + | input,
|
41 + | )?;
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
43 + | }
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
45 + | input.build()?
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
47 + | })
|
48 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
49 + | }
|
50 + |
|
51 + | /* RustType.kt:534 */
|
52 + | #[allow(clippy::unnecessary_wraps)]
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
54 + | pub fn ser_sparse_json_maps_http_response(
|
55 + | #[allow(unused_variables)] output: crate::output::SparseJsonMapsOutput,
|
56 + | ) -> std::result::Result<
|
57 + | ::aws_smithy_legacy_http_server::response::Response,
|
58 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
59 + | > {
|
60 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
61 + | Ok({
|
62 + | /* RustType.kt:534 */
|
63 + | #[allow(unused_mut)]
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
65 + | let mut builder = ::http::Response::builder();
|
66 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
67 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
68 + | builder,
|
69 + | ::http::header::CONTENT_TYPE,
|
70 + | "application/json",
|
71 + | );
|
72 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
73 + | let http_status: u16 = 200;
|
74 + | builder = builder.status(http_status);
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
76 + | let payload =
|
77 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_sparse_json_maps_output::ser_sparse_json_maps_output_output_output(&output)?
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
80 + | let content_length = payload.len();
|
81 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
82 + | builder,
|
83 + | ::http::header::CONTENT_LENGTH,
|
84 + | content_length,
|
85 + | );
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
87 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
89 + | builder.body(body)?
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
91 + | })
|
92 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
93 + | }
|
94 + |
|
95 + | /* RustType.kt:534 */
|
96 + | #[allow(clippy::unnecessary_wraps)]
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
98 + | pub fn ser_sparse_json_maps_http_error(
|
99 + | error: &crate::error::SparseJsonMapsError,
|
100 + | ) -> std::result::Result<
|
101 + | ::aws_smithy_legacy_http_server::response::Response,
|
102 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
103 + | > {
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
105 + | Ok({
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
107 + | match error {
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
109 + | crate::error::SparseJsonMapsError::ValidationException(output) => {
|
110 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
111 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
112 + | /* RustType.kt:534 */
|
113 + | #[allow(unused_mut)]
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
115 + | let mut builder = ::http::Response::builder();
|
116 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
117 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
118 + | builder,
|
119 + | ::http::header::CONTENT_TYPE,
|
120 + | "application/json",
|
121 + | );
|
122 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
123 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
124 + | builder,
|
125 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
126 + | "ValidationException",
|
127 + | );
|
128 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
129 + | let content_length = payload.len();
|
130 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
131 + | builder,
|
132 + | ::http::header::CONTENT_LENGTH,
|
133 + | content_length,
|
134 + | );
|
135 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
136 + | builder
|
137 + | .status(400)
|
138 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
140 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
141 + | }
|
142 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
143 + | })
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
145 + | }
|
146 + |
|
147 + | /* JsonParserGenerator.kt:148 */
|
148 + | pub(crate) fn de_sparse_json_maps(
|
149 + | value: &[u8],
|
150 + | mut builder: crate::input::sparse_json_maps_input::Builder,
|
151 + | ) -> ::std::result::Result<
|
152 + | crate::input::sparse_json_maps_input::Builder,
|
153 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
154 + | > {
|
155 + | /* JsonParserGenerator.kt:153 */
|
156 + | let mut tokens_owned =
|
157 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
158 + | .peekable();
|
159 + | let tokens = &mut tokens_owned;
|
160 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
161 + | /* JsonParserGenerator.kt:684 */
|
162 + | loop {
|
163 + | /* JsonParserGenerator.kt:685 */
|
164 + | match tokens.next().transpose()? {
|
165 + | /* JsonParserGenerator.kt:686 */
|
166 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
167 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
168 + | /* JsonParserGenerator.kt:260 */
|
169 + | match key.to_unescaped()?.as_ref() {
|
170 + | /* JsonParserGenerator.kt:262 */
|
171 + | "sparseBooleanMap" => {
|
172 + | /* JsonParserGenerator.kt:272 */
|
173 + | builder = builder.set_sparse_boolean_map(
|
174 + | /* JsonParserGenerator.kt:509 */
|
175 + | crate::protocol_serde::shape_sparse_boolean_map::de_sparse_boolean_map(
|
176 + | tokens,
|
177 + | )?, /* JsonParserGenerator.kt:272 */
|
178 + | );
|
179 + | /* JsonParserGenerator.kt:262 */
|
180 + | }
|
181 + | /* JsonParserGenerator.kt:262 */
|
182 + | "sparseNumberMap" => {
|
183 + | /* JsonParserGenerator.kt:272 */
|
184 + | builder = builder.set_sparse_number_map(
|
185 + | /* JsonParserGenerator.kt:509 */
|
186 + | crate::protocol_serde::shape_sparse_number_map::de_sparse_number_map(
|
187 + | tokens,
|
188 + | )?, /* JsonParserGenerator.kt:272 */
|
189 + | );
|
190 + | /* JsonParserGenerator.kt:262 */
|
191 + | }
|
192 + | /* JsonParserGenerator.kt:262 */
|
193 + | "sparseSetMap" => {
|
194 + | /* JsonParserGenerator.kt:272 */
|
195 + | builder =
|
196 + | builder.set_sparse_set_map(
|
197 + | /* JsonParserGenerator.kt:509 */
|
198 + | crate::protocol_serde::shape_sparse_set_map::de_sparse_set_map(
|
199 + | tokens,
|
200 + | )?, /* JsonParserGenerator.kt:272 */
|
201 + | );
|
202 + | /* JsonParserGenerator.kt:262 */
|
203 + | }
|
204 + | /* JsonParserGenerator.kt:262 */
|
205 + | "sparseStringMap" => {
|
206 + | /* JsonParserGenerator.kt:272 */
|
207 + | builder = builder.set_sparse_string_map(
|
208 + | /* JsonParserGenerator.kt:509 */
|
209 + | crate::protocol_serde::shape_sparse_string_map::de_sparse_string_map(
|
210 + | tokens,
|
211 + | )?, /* JsonParserGenerator.kt:272 */
|
212 + | );
|
213 + | /* JsonParserGenerator.kt:262 */
|
214 + | }
|
215 + | /* JsonParserGenerator.kt:262 */
|
216 + | "sparseStructMap" => {
|
217 + | /* JsonParserGenerator.kt:272 */
|
218 + | builder = builder.set_sparse_struct_map(
|
219 + | /* JsonParserGenerator.kt:509 */
|
220 + | crate::protocol_serde::shape_sparse_struct_map::de_sparse_struct_map(
|
221 + | tokens,
|
222 + | )?, /* JsonParserGenerator.kt:272 */
|
223 + | );
|
224 + | /* JsonParserGenerator.kt:262 */
|
225 + | }
|
226 + | /* JsonParserGenerator.kt:290 */
|
227 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
228 + | }
|
229 + | /* JsonParserGenerator.kt:686 */
|
230 + | }
|
231 + | /* JsonParserGenerator.kt:695 */
|
232 + | other => {
|
233 + | return Err(
|
234 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
235 + | "expected object key or end object, found: {other:?}"
|
236 + | )),
|
237 + | )
|
238 + | } /* JsonParserGenerator.kt:685 */
|
239 + | }
|
240 + | /* JsonParserGenerator.kt:684 */
|
241 + | }
|
242 + | /* JsonParserGenerator.kt:250 */
|
243 + | if tokens.next().is_some() {
|
244 + | /* JsonParserGenerator.kt:251 */
|
245 + | return Err(
|
246 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
247 + | "found more JSON tokens after completing parsing",
|
248 + | ),
|
249 + | );
|
250 + | /* JsonParserGenerator.kt:250 */
|
251 + | }
|
252 + | /* JsonParserGenerator.kt:163 */
|
253 + | Ok(builder)
|
254 + | /* JsonParserGenerator.kt:148 */
|
255 + | }
|