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