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