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_escaped_string_values_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::EscapedStringValuesInput,
|
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::escaped_string_values_input_internal::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_escaped_string_values::de_escaped_string_values(
|
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_escaped_string_values_http_response(
|
39 55 | #[allow(unused_variables)] output: crate::output::EscapedStringValuesOutput,
|
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_escaped_string_values_output::ser_escaped_string_values_output_output_output(&output)?
|
56 - | ;
|
77 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_escaped_string_values_output::ser_escaped_string_values_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_escaped_string_values_http_error(
|
70 99 | error: &crate::error::EscapedStringValuesError,
|
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::EscapedStringValuesError::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))?
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
100 140 | }
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
101 142 | crate::error::EscapedStringValuesError::ExtraError(output) => {
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
102 144 | let payload =
|
103 145 | crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
|
146 + | /* RustType.kt:516 */
|
104 147 | #[allow(unused_mut)]
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
105 149 | let mut builder = ::http::Response::builder();
|
150 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
106 151 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
107 152 | builder,
|
108 153 | ::http::header::CONTENT_TYPE,
|
109 154 | "application/json",
|
110 155 | );
|
156 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
111 157 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
112 158 | builder,
|
113 159 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
114 160 | "ExtraError",
|
115 161 | );
|
162 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
116 163 | let content_length = payload.len();
|
117 164 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
118 165 | builder,
|
119 166 | ::http::header::CONTENT_LENGTH,
|
120 167 | content_length,
|
121 168 | );
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
122 170 | builder
|
123 171 | .status(500)
|
124 172 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
173 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
125 174 | }
|
175 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
126 176 | crate::error::EscapedStringValuesError::InternalServerError(output) => {
|
177 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
127 178 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
179 + | /* RustType.kt:516 */
|
128 180 | #[allow(unused_mut)]
|
181 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
129 182 | let mut builder = ::http::Response::builder();
|
183 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
130 184 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
131 185 | builder,
|
132 186 | ::http::header::CONTENT_TYPE,
|
133 187 | "application/json",
|
134 188 | );
|
189 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
135 190 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
136 191 | builder,
|
137 192 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
138 193 | "InternalServerError",
|
139 194 | );
|
195 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
140 196 | let content_length = payload.len();
|
141 197 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
142 198 | builder,
|
143 199 | ::http::header::CONTENT_LENGTH,
|
144 200 | content_length,
|
145 201 | );
|
202 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
146 203 | builder
|
147 204 | .status(500)
|
148 205 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
206 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
207 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
149 208 | }
|
150 - | }
|
209 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
151 210 | })
|
211 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
152 212 | }
|
153 213 |
|
214 + | /* JsonParserGenerator.kt:148 */
|
154 215 | pub(crate) fn de_escaped_string_values(
|
155 216 | value: &[u8],
|
156 217 | mut builder: crate::input::escaped_string_values_input_internal::Builder,
|
157 218 | ) -> ::std::result::Result<
|
158 219 | crate::input::escaped_string_values_input_internal::Builder,
|
159 220 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
160 221 | > {
|
222 + | /* JsonParserGenerator.kt:153 */
|
161 223 | let mut tokens_owned =
|
162 224 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
163 225 | .peekable();
|
164 226 | let tokens = &mut tokens_owned;
|
165 227 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
228 + | /* JsonParserGenerator.kt:684 */
|
166 229 | loop {
|
230 + | /* JsonParserGenerator.kt:685 */
|
167 231 | match tokens.next().transpose()? {
|
232 + | /* JsonParserGenerator.kt:686 */
|
168 233 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
169 234 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
235 + | /* JsonParserGenerator.kt:260 */
|
170 236 | match key.to_unescaped()?.as_ref() {
|
237 + | /* JsonParserGenerator.kt:262 */
|
171 238 | "enum" => {
|
239 + | /* JsonParserGenerator.kt:272 */
|
172 240 | builder = builder.set_enum(
|
241 + | /* JsonParserGenerator.kt:354 */
|
173 242 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
174 243 | tokens.next(),
|
175 244 | )?
|
176 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
177 - | .transpose()?,
|
245 + | .map(|s|
|
246 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
247 + | /* JsonParserGenerator.kt:343 */u.into_owned()
|
248 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
249 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
178 250 | );
|
251 + | /* JsonParserGenerator.kt:262 */
|
179 252 | }
|
253 + | /* JsonParserGenerator.kt:262 */
|
180 254 | "also\"has\"quotes" => {
|
255 + | /* JsonParserGenerator.kt:272 */
|
181 256 | builder = builder.set_some_string(
|
257 + | /* JsonParserGenerator.kt:354 */
|
182 258 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
183 259 | tokens.next(),
|
184 260 | )?
|
185 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
186 - | .transpose()?,
|
261 + | .map(|s|
|
262 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
263 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
264 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
265 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
187 266 | );
|
267 + | /* JsonParserGenerator.kt:262 */
|
188 268 | }
|
189 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
269 + | /* JsonParserGenerator.kt:290 */
|
270 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
190 271 | }
|
272 + | /* JsonParserGenerator.kt:686 */
|
191 273 | }
|
274 + | /* JsonParserGenerator.kt:695 */
|
192 275 | other => {
|
193 276 | return Err(
|
194 277 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
195 278 | "expected object key or end object, found: {:?}",
|
196 279 | other
|
197 280 | )),
|
198 281 | )
|
282 + | } /* JsonParserGenerator.kt:685 */
|
199 283 | }
|
284 + | /* JsonParserGenerator.kt:684 */
|
200 285 | }
|
201 - | }
|
286 + | /* JsonParserGenerator.kt:250 */
|
202 287 | if tokens.next().is_some() {
|
288 + | /* JsonParserGenerator.kt:251 */
|
203 289 | return Err(
|
204 290 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
205 291 | "found more JSON tokens after completing parsing",
|
206 292 | ),
|
207 293 | );
|
294 + | /* JsonParserGenerator.kt:250 */
|
208 295 | }
|
296 + | /* JsonParserGenerator.kt:163 */
|
209 297 | Ok(builder)
|
298 + | /* JsonParserGenerator.kt:148 */
|
210 299 | }
|