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_simple_scalar_properties_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::SimpleScalarPropertiesInput,
|
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::simple_scalar_properties_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 =
|
29 39 | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
|
30 40 | bytes.as_ref(),
|
31 41 | input,
|
32 42 | )?;
|
43 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
33 44 | }
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:794 */
|
34 46 | if let Some(value) =
|
35 47 | crate::protocol_serde::shape_simple_scalar_properties_input::de_foo_header(&headers)?
|
36 48 | {
|
37 49 | input = input.set_foo(Some(value))
|
38 50 | }
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
39 52 | input.build()
|
53 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
40 54 | })
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
41 56 | }
|
42 57 |
|
58 + | /* RustType.kt:516 */
|
43 59 | #[allow(clippy::unnecessary_wraps)]
|
60 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
44 61 | pub fn ser_simple_scalar_properties_http_response(
|
45 62 | #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
|
46 63 | ) -> std::result::Result<
|
47 64 | ::aws_smithy_http_server::response::Response,
|
48 65 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
49 66 | > {
|
67 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
50 68 | Ok({
|
69 + | /* RustType.kt:516 */
|
51 70 | #[allow(unused_mut)]
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
52 72 | let mut builder = ::http::Response::builder();
|
73 + | /* ServerHttpBoundProtocolGenerator.kt:629 */
|
53 74 | builder = crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_headers(&output, builder)?;
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
54 76 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
55 77 | builder,
|
56 78 | ::http::header::CONTENT_TYPE,
|
57 79 | "application/json",
|
58 80 | );
|
81 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
59 82 | let http_status: u16 = 200;
|
60 83 | builder = builder.status(http_status);
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
61 85 | let payload =
|
62 - | crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
|
63 - | ;
|
86 + | /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
64 89 | let content_length = payload.len();
|
65 90 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
66 91 | builder,
|
67 92 | ::http::header::CONTENT_LENGTH,
|
68 93 | content_length,
|
69 94 | );
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
70 96 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
71 98 | builder.body(body)?
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
72 100 | })
|
101 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
73 102 | }
|
74 103 |
|
104 + | /* RustType.kt:516 */
|
75 105 | #[allow(clippy::unnecessary_wraps)]
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
76 107 | pub fn ser_simple_scalar_properties_http_error(
|
77 108 | error: &crate::error::SimpleScalarPropertiesError,
|
78 109 | ) -> std::result::Result<
|
79 110 | ::aws_smithy_http_server::response::Response,
|
80 111 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
81 112 | > {
|
113 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
82 114 | Ok({
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
83 116 | match error {
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
84 118 | crate::error::SimpleScalarPropertiesError::InternalServerError(output) => {
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
85 120 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
121 + | /* RustType.kt:516 */
|
86 122 | #[allow(unused_mut)]
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
87 124 | let mut builder = ::http::Response::builder();
|
125 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
88 126 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
89 127 | builder,
|
90 128 | ::http::header::CONTENT_TYPE,
|
91 129 | "application/json",
|
92 130 | );
|
131 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
93 132 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
94 133 | builder,
|
95 134 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
96 135 | "InternalServerError",
|
97 136 | );
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
98 138 | let content_length = payload.len();
|
99 139 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
100 140 | builder,
|
101 141 | ::http::header::CONTENT_LENGTH,
|
102 142 | content_length,
|
103 143 | );
|
144 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
104 145 | builder
|
105 146 | .status(500)
|
106 147 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
149 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
107 150 | }
|
108 - | }
|
151 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
109 152 | })
|
153 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
110 154 | }
|
111 155 |
|
156 + | /* JsonParserGenerator.kt:148 */
|
112 157 | pub(crate) fn de_simple_scalar_properties(
|
113 158 | value: &[u8],
|
114 159 | mut builder: crate::input::simple_scalar_properties_input_internal::Builder,
|
115 160 | ) -> ::std::result::Result<
|
116 161 | crate::input::simple_scalar_properties_input_internal::Builder,
|
117 162 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
118 163 | > {
|
164 + | /* JsonParserGenerator.kt:153 */
|
119 165 | let mut tokens_owned =
|
120 166 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
121 167 | .peekable();
|
122 168 | let tokens = &mut tokens_owned;
|
123 169 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
170 + | /* JsonParserGenerator.kt:684 */
|
124 171 | loop {
|
172 + | /* JsonParserGenerator.kt:685 */
|
125 173 | match tokens.next().transpose()? {
|
174 + | /* JsonParserGenerator.kt:686 */
|
126 175 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
127 176 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
177 + | /* JsonParserGenerator.kt:260 */
|
128 178 | match key.to_unescaped()?.as_ref() {
|
179 + | /* JsonParserGenerator.kt:262 */
|
129 180 | "byteValue" => {
|
181 + | /* JsonParserGenerator.kt:272 */
|
130 182 | builder = builder.set_byte_value(
|
183 + | /* JsonParserGenerator.kt:365 */
|
131 184 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
132 185 | tokens.next(),
|
133 186 | )?
|
134 187 | .map(i8::try_from)
|
135 - | .transpose()?,
|
188 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
136 189 | );
|
190 + | /* JsonParserGenerator.kt:262 */
|
137 191 | }
|
192 + | /* JsonParserGenerator.kt:262 */
|
138 193 | "DoubleDribble" => {
|
194 + | /* JsonParserGenerator.kt:272 */
|
139 195 | builder = builder.set_double_value(
|
196 + | /* JsonParserGenerator.kt:363 */
|
140 197 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
141 198 | tokens.next(),
|
142 199 | )?
|
143 - | .map(|v| v.to_f64_lossy()),
|
200 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
144 201 | );
|
202 + | /* JsonParserGenerator.kt:262 */
|
145 203 | }
|
204 + | /* JsonParserGenerator.kt:262 */
|
146 205 | "falseBooleanValue" => {
|
206 + | /* JsonParserGenerator.kt:272 */
|
147 207 | builder = builder.set_false_boolean_value(
|
208 + | /* JsonParserGenerator.kt:298 */
|
148 209 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
149 210 | tokens.next(),
|
150 - | )?,
|
211 + | )?, /* JsonParserGenerator.kt:272 */
|
151 212 | );
|
213 + | /* JsonParserGenerator.kt:262 */
|
152 214 | }
|
215 + | /* JsonParserGenerator.kt:262 */
|
153 216 | "floatValue" => {
|
217 + | /* JsonParserGenerator.kt:272 */
|
154 218 | builder = builder.set_float_value(
|
219 + | /* JsonParserGenerator.kt:361 */
|
155 220 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
156 221 | tokens.next(),
|
157 222 | )?
|
158 - | .map(|v| v.to_f32_lossy()),
|
223 + | .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
|
159 224 | );
|
225 + | /* JsonParserGenerator.kt:262 */
|
160 226 | }
|
227 + | /* JsonParserGenerator.kt:262 */
|
161 228 | "integerValue" => {
|
229 + | /* JsonParserGenerator.kt:272 */
|
162 230 | builder = builder.set_integer_value(
|
231 + | /* JsonParserGenerator.kt:365 */
|
163 232 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
164 233 | tokens.next(),
|
165 234 | )?
|
166 235 | .map(i32::try_from)
|
167 - | .transpose()?,
|
236 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
168 237 | );
|
238 + | /* JsonParserGenerator.kt:262 */
|
169 239 | }
|
240 + | /* JsonParserGenerator.kt:262 */
|
170 241 | "longValue" => {
|
242 + | /* JsonParserGenerator.kt:272 */
|
171 243 | builder = builder.set_long_value(
|
244 + | /* JsonParserGenerator.kt:365 */
|
172 245 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
173 246 | tokens.next(),
|
174 247 | )?
|
175 248 | .map(i64::try_from)
|
176 - | .transpose()?,
|
249 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
177 250 | );
|
251 + | /* JsonParserGenerator.kt:262 */
|
178 252 | }
|
253 + | /* JsonParserGenerator.kt:262 */
|
179 254 | "shortValue" => {
|
255 + | /* JsonParserGenerator.kt:272 */
|
180 256 | builder = builder.set_short_value(
|
257 + | /* JsonParserGenerator.kt:365 */
|
181 258 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
182 259 | tokens.next(),
|
183 260 | )?
|
184 261 | .map(i16::try_from)
|
185 - | .transpose()?,
|
262 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
186 263 | );
|
264 + | /* JsonParserGenerator.kt:262 */
|
187 265 | }
|
266 + | /* JsonParserGenerator.kt:262 */
|
188 267 | "stringValue" => {
|
268 + | /* JsonParserGenerator.kt:272 */
|
189 269 | builder = builder.set_string_value(
|
270 + | /* JsonParserGenerator.kt:354 */
|
190 271 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
191 272 | tokens.next(),
|
192 273 | )?
|
193 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
194 - | .transpose()?,
|
274 + | .map(|s|
|
275 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
276 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
277 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
278 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
195 279 | );
|
280 + | /* JsonParserGenerator.kt:262 */
|
196 281 | }
|
282 + | /* JsonParserGenerator.kt:262 */
|
197 283 | "trueBooleanValue" => {
|
284 + | /* JsonParserGenerator.kt:272 */
|
198 285 | builder = builder.set_true_boolean_value(
|
286 + | /* JsonParserGenerator.kt:298 */
|
199 287 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
200 288 | tokens.next(),
|
201 - | )?,
|
289 + | )?, /* JsonParserGenerator.kt:272 */
|
202 290 | );
|
291 + | /* JsonParserGenerator.kt:262 */
|
203 292 | }
|
204 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
293 + | /* JsonParserGenerator.kt:290 */
|
294 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
205 295 | }
|
296 + | /* JsonParserGenerator.kt:686 */
|
206 297 | }
|
298 + | /* JsonParserGenerator.kt:695 */
|
207 299 | other => {
|
208 300 | return Err(
|
209 301 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
210 302 | "expected object key or end object, found: {:?}",
|
211 303 | other
|
212 304 | )),
|
213 305 | )
|
306 + | } /* JsonParserGenerator.kt:685 */
|
214 307 | }
|
308 + | /* JsonParserGenerator.kt:684 */
|
215 309 | }
|
216 - | }
|
310 + | /* JsonParserGenerator.kt:250 */
|
217 311 | if tokens.next().is_some() {
|
312 + | /* JsonParserGenerator.kt:251 */
|
218 313 | return Err(
|
219 314 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
220 315 | "found more JSON tokens after completing parsing",
|
221 316 | ),
|
222 317 | );
|
318 + | /* JsonParserGenerator.kt:250 */
|
223 319 | }
|
320 + | /* JsonParserGenerator.kt:163 */
|
224 321 | Ok(builder)
|
322 + | /* JsonParserGenerator.kt:148 */
|
225 323 | }
|
226 324 |
|
325 + | /* HttpBindingGenerator.kt:542 */
|
227 326 | pub fn ser_simple_scalar_properties_headers(
|
228 327 | input: &crate::output::SimpleScalarPropertiesOutput,
|
229 328 | mut builder: ::http::response::Builder,
|
230 329 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
231 330 | {
|
331 + | /* HttpBindingGenerator.kt:592 */
|
232 332 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
333 + | /* HttpBindingGenerator.kt:704 */
|
233 334 | let formatted_2 = inner_1.as_str();
|
335 + | /* HttpBindingGenerator.kt:705 */
|
234 336 | if !formatted_2.is_empty() {
|
337 + | /* HttpBindingGenerator.kt:706 */
|
235 338 | let header_value = formatted_2;
|
236 339 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
237 340 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
238 341 | "foo",
|
239 342 | format!(
|
240 343 | "`{}` cannot be used as a header value: {}",
|
241 344 | &header_value, err
|
242 345 | ),
|
243 346 | )
|
244 347 | })?;
|
245 348 | builder = builder.header("X-Foo", header_value);
|
349 + | /* HttpBindingGenerator.kt:705 */
|
246 350 | }
|
351 + | /* HttpBindingGenerator.kt:592 */
|
247 352 | }
|
353 + | /* HttpBindingGenerator.kt:555 */
|
248 354 | Ok(builder)
|
355 + | /* HttpBindingGenerator.kt:542 */
|
249 356 | }
|