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::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 + | /* JsonParserGenerator.kt:148 */
|
75 105 | pub(crate) fn de_simple_scalar_properties(
|
76 106 | value: &[u8],
|
77 107 | mut builder: crate::input::simple_scalar_properties_input::Builder,
|
78 108 | ) -> ::std::result::Result<
|
79 109 | crate::input::simple_scalar_properties_input::Builder,
|
80 110 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
81 111 | > {
|
112 + | /* JsonParserGenerator.kt:153 */
|
82 113 | let mut tokens_owned =
|
83 114 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
84 115 | .peekable();
|
85 116 | let tokens = &mut tokens_owned;
|
86 117 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
118 + | /* JsonParserGenerator.kt:684 */
|
87 119 | loop {
|
120 + | /* JsonParserGenerator.kt:685 */
|
88 121 | match tokens.next().transpose()? {
|
122 + | /* JsonParserGenerator.kt:686 */
|
89 123 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
90 124 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
125 + | /* JsonParserGenerator.kt:260 */
|
91 126 | match key.to_unescaped()?.as_ref() {
|
127 + | /* JsonParserGenerator.kt:262 */
|
92 128 | "byteValue" => {
|
129 + | /* JsonParserGenerator.kt:272 */
|
93 130 | builder = builder.set_byte_value(
|
131 + | /* JsonParserGenerator.kt:365 */
|
94 132 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
95 133 | tokens.next(),
|
96 134 | )?
|
97 135 | .map(i8::try_from)
|
98 - | .transpose()?,
|
136 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
99 137 | );
|
138 + | /* JsonParserGenerator.kt:262 */
|
100 139 | }
|
140 + | /* JsonParserGenerator.kt:262 */
|
101 141 | "DoubleDribble" => {
|
142 + | /* JsonParserGenerator.kt:272 */
|
102 143 | builder = builder.set_double_value(
|
144 + | /* JsonParserGenerator.kt:363 */
|
103 145 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
104 146 | tokens.next(),
|
105 147 | )?
|
106 - | .map(|v| v.to_f64_lossy()),
|
148 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
107 149 | );
|
150 + | /* JsonParserGenerator.kt:262 */
|
108 151 | }
|
152 + | /* JsonParserGenerator.kt:262 */
|
109 153 | "falseBooleanValue" => {
|
154 + | /* JsonParserGenerator.kt:272 */
|
110 155 | builder = builder.set_false_boolean_value(
|
156 + | /* JsonParserGenerator.kt:298 */
|
111 157 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
112 158 | tokens.next(),
|
113 - | )?,
|
159 + | )?, /* JsonParserGenerator.kt:272 */
|
114 160 | );
|
161 + | /* JsonParserGenerator.kt:262 */
|
115 162 | }
|
163 + | /* JsonParserGenerator.kt:262 */
|
116 164 | "floatValue" => {
|
165 + | /* JsonParserGenerator.kt:272 */
|
117 166 | builder = builder.set_float_value(
|
167 + | /* JsonParserGenerator.kt:361 */
|
118 168 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
119 169 | tokens.next(),
|
120 170 | )?
|
121 - | .map(|v| v.to_f32_lossy()),
|
171 + | .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
|
122 172 | );
|
173 + | /* JsonParserGenerator.kt:262 */
|
123 174 | }
|
175 + | /* JsonParserGenerator.kt:262 */
|
124 176 | "integerValue" => {
|
177 + | /* JsonParserGenerator.kt:272 */
|
125 178 | builder = builder.set_integer_value(
|
179 + | /* JsonParserGenerator.kt:365 */
|
126 180 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
127 181 | tokens.next(),
|
128 182 | )?
|
129 183 | .map(i32::try_from)
|
130 - | .transpose()?,
|
184 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
131 185 | );
|
186 + | /* JsonParserGenerator.kt:262 */
|
132 187 | }
|
188 + | /* JsonParserGenerator.kt:262 */
|
133 189 | "longValue" => {
|
190 + | /* JsonParserGenerator.kt:272 */
|
134 191 | builder = builder.set_long_value(
|
192 + | /* JsonParserGenerator.kt:365 */
|
135 193 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
136 194 | tokens.next(),
|
137 195 | )?
|
138 196 | .map(i64::try_from)
|
139 - | .transpose()?,
|
197 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
140 198 | );
|
199 + | /* JsonParserGenerator.kt:262 */
|
141 200 | }
|
201 + | /* JsonParserGenerator.kt:262 */
|
142 202 | "shortValue" => {
|
203 + | /* JsonParserGenerator.kt:272 */
|
143 204 | builder = builder.set_short_value(
|
205 + | /* JsonParserGenerator.kt:365 */
|
144 206 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
145 207 | tokens.next(),
|
146 208 | )?
|
147 209 | .map(i16::try_from)
|
148 - | .transpose()?,
|
210 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
149 211 | );
|
212 + | /* JsonParserGenerator.kt:262 */
|
150 213 | }
|
214 + | /* JsonParserGenerator.kt:262 */
|
151 215 | "stringValue" => {
|
216 + | /* JsonParserGenerator.kt:272 */
|
152 217 | builder = builder.set_string_value(
|
218 + | /* JsonParserGenerator.kt:354 */
|
153 219 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
154 220 | tokens.next(),
|
155 221 | )?
|
156 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
157 - | .transpose()?,
|
222 + | .map(|s|
|
223 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
224 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
225 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
226 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
158 227 | );
|
228 + | /* JsonParserGenerator.kt:262 */
|
159 229 | }
|
230 + | /* JsonParserGenerator.kt:262 */
|
160 231 | "trueBooleanValue" => {
|
232 + | /* JsonParserGenerator.kt:272 */
|
161 233 | builder = builder.set_true_boolean_value(
|
234 + | /* JsonParserGenerator.kt:298 */
|
162 235 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
163 236 | tokens.next(),
|
164 - | )?,
|
237 + | )?, /* JsonParserGenerator.kt:272 */
|
165 238 | );
|
239 + | /* JsonParserGenerator.kt:262 */
|
166 240 | }
|
167 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
241 + | /* JsonParserGenerator.kt:290 */
|
242 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
168 243 | }
|
244 + | /* JsonParserGenerator.kt:686 */
|
169 245 | }
|
246 + | /* JsonParserGenerator.kt:695 */
|
170 247 | other => {
|
171 248 | return Err(
|
172 249 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
173 250 | "expected object key or end object, found: {:?}",
|
174 251 | other
|
175 252 | )),
|
176 253 | )
|
254 + | } /* JsonParserGenerator.kt:685 */
|
177 255 | }
|
256 + | /* JsonParserGenerator.kt:684 */
|
178 257 | }
|
179 - | }
|
258 + | /* JsonParserGenerator.kt:250 */
|
180 259 | if tokens.next().is_some() {
|
260 + | /* JsonParserGenerator.kt:251 */
|
181 261 | return Err(
|
182 262 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
183 263 | "found more JSON tokens after completing parsing",
|
184 264 | ),
|
185 265 | );
|
266 + | /* JsonParserGenerator.kt:250 */
|
186 267 | }
|
268 + | /* JsonParserGenerator.kt:163 */
|
187 269 | Ok(builder)
|
270 + | /* JsonParserGenerator.kt:148 */
|
188 271 | }
|
189 272 |
|
273 + | /* HttpBindingGenerator.kt:542 */
|
190 274 | pub fn ser_simple_scalar_properties_headers(
|
191 275 | input: &crate::output::SimpleScalarPropertiesOutput,
|
192 276 | mut builder: ::http::response::Builder,
|
193 277 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
194 278 | {
|
279 + | /* HttpBindingGenerator.kt:592 */
|
195 280 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
281 + | /* HttpBindingGenerator.kt:704 */
|
196 282 | let formatted_2 = inner_1.as_str();
|
283 + | /* HttpBindingGenerator.kt:705 */
|
197 284 | if !formatted_2.is_empty() {
|
285 + | /* HttpBindingGenerator.kt:706 */
|
198 286 | let header_value = formatted_2;
|
199 287 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
200 288 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
201 289 | "foo",
|
202 290 | format!(
|
203 291 | "`{}` cannot be used as a header value: {}",
|
204 292 | &header_value, err
|
205 293 | ),
|
206 294 | )
|
207 295 | })?;
|
208 296 | builder = builder.header("X-Foo", header_value);
|
297 + | /* HttpBindingGenerator.kt:705 */
|
209 298 | }
|
299 + | /* HttpBindingGenerator.kt:592 */
|
210 300 | }
|
301 + | /* HttpBindingGenerator.kt:555 */
|
211 302 | Ok(builder)
|
303 + | /* HttpBindingGenerator.kt:542 */
|
212 304 | }
|