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_simple_scalar_properties_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::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:424 */
|
15 18 | Ok({
|
19 + | /* RustType.kt:534 */
|
16 20 | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
17 22 | let mut input = crate::input::simple_scalar_properties_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 =
|
29 42 | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
|
30 43 | bytes.as_ref(),
|
31 44 | input,
|
32 45 | )?;
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
33 47 | }
|
48 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
34 49 | if let Some(value) =
|
35 50 | crate::protocol_serde::shape_simple_scalar_properties_input::de_foo_header(&headers)?
|
36 51 | {
|
37 52 | input = input.set_foo(Some(value))
|
38 53 | }
|
54 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
39 55 | input.build()
|
56 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
40 57 | })
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
41 59 | }
|
42 60 |
|
61 + | /* RustType.kt:534 */
|
43 62 | #[allow(clippy::unnecessary_wraps)]
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
44 64 | pub fn ser_simple_scalar_properties_http_response(
|
45 65 | #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
|
46 66 | ) -> std::result::Result<
|
47 67 | ::aws_smithy_http_server::response::Response,
|
48 68 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
49 69 | > {
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
50 71 | Ok({
|
72 + | /* RustType.kt:534 */
|
51 73 | #[allow(unused_mut)]
|
52 - | let mut builder = ::http::Response::builder();
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
75 + | let mut builder = ::http_1x::Response::builder();
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
53 77 | builder = crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_headers(&output, builder)?;
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
54 79 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
55 80 | builder,
|
56 - | ::http::header::CONTENT_TYPE,
|
81 + | ::http_1x::header::CONTENT_TYPE,
|
57 82 | "application/json",
|
58 83 | );
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
59 85 | let http_status: u16 = 200;
|
60 86 | builder = builder.status(http_status);
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
61 88 | let payload =
|
62 - | crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
|
63 - | ;
|
89 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
64 92 | let content_length = payload.len();
|
65 93 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
66 94 | builder,
|
67 - | ::http::header::CONTENT_LENGTH,
|
95 + | ::http_1x::header::CONTENT_LENGTH,
|
68 96 | content_length,
|
69 97 | );
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
70 99 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
100 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
71 101 | builder.body(body)?
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
72 103 | })
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
73 105 | }
|
74 106 |
|
107 + | /* JsonParserGenerator.kt:148 */
|
75 108 | pub(crate) fn de_simple_scalar_properties(
|
76 109 | value: &[u8],
|
77 110 | mut builder: crate::input::simple_scalar_properties_input::Builder,
|
78 111 | ) -> ::std::result::Result<
|
79 112 | crate::input::simple_scalar_properties_input::Builder,
|
80 113 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
81 114 | > {
|
115 + | /* JsonParserGenerator.kt:153 */
|
82 116 | let mut tokens_owned =
|
83 117 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
84 118 | .peekable();
|
85 119 | let tokens = &mut tokens_owned;
|
86 120 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
121 + | /* JsonParserGenerator.kt:684 */
|
87 122 | loop {
|
123 + | /* JsonParserGenerator.kt:685 */
|
88 124 | match tokens.next().transpose()? {
|
125 + | /* JsonParserGenerator.kt:686 */
|
89 126 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
90 127 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
128 + | /* JsonParserGenerator.kt:260 */
|
91 129 | match key.to_unescaped()?.as_ref() {
|
130 + | /* JsonParserGenerator.kt:262 */
|
92 131 | "byteValue" => {
|
132 + | /* JsonParserGenerator.kt:272 */
|
93 133 | builder = builder.set_byte_value(
|
134 + | /* JsonParserGenerator.kt:365 */
|
94 135 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
95 136 | tokens.next(),
|
96 137 | )?
|
97 138 | .map(i8::try_from)
|
98 - | .transpose()?,
|
139 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
99 140 | );
|
141 + | /* JsonParserGenerator.kt:262 */
|
100 142 | }
|
143 + | /* JsonParserGenerator.kt:262 */
|
101 144 | "DoubleDribble" => {
|
145 + | /* JsonParserGenerator.kt:272 */
|
102 146 | builder = builder.set_double_value(
|
147 + | /* JsonParserGenerator.kt:363 */
|
103 148 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
104 149 | tokens.next(),
|
105 150 | )?
|
106 - | .map(|v| v.to_f64_lossy()),
|
151 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
107 152 | );
|
153 + | /* JsonParserGenerator.kt:262 */
|
108 154 | }
|
155 + | /* JsonParserGenerator.kt:262 */
|
109 156 | "falseBooleanValue" => {
|
157 + | /* JsonParserGenerator.kt:272 */
|
110 158 | builder = builder.set_false_boolean_value(
|
159 + | /* JsonParserGenerator.kt:298 */
|
111 160 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
112 161 | tokens.next(),
|
113 - | )?,
|
162 + | )?, /* JsonParserGenerator.kt:272 */
|
114 163 | );
|
164 + | /* JsonParserGenerator.kt:262 */
|
115 165 | }
|
166 + | /* JsonParserGenerator.kt:262 */
|
116 167 | "floatValue" => {
|
168 + | /* JsonParserGenerator.kt:272 */
|
117 169 | builder = builder.set_float_value(
|
170 + | /* JsonParserGenerator.kt:361 */
|
118 171 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
119 172 | tokens.next(),
|
120 173 | )?
|
121 - | .map(|v| v.to_f32_lossy()),
|
174 + | .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
|
122 175 | );
|
176 + | /* JsonParserGenerator.kt:262 */
|
123 177 | }
|
178 + | /* JsonParserGenerator.kt:262 */
|
124 179 | "integerValue" => {
|
180 + | /* JsonParserGenerator.kt:272 */
|
125 181 | builder = builder.set_integer_value(
|
182 + | /* JsonParserGenerator.kt:365 */
|
126 183 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
127 184 | tokens.next(),
|
128 185 | )?
|
129 186 | .map(i32::try_from)
|
130 - | .transpose()?,
|
187 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
131 188 | );
|
189 + | /* JsonParserGenerator.kt:262 */
|
132 190 | }
|
191 + | /* JsonParserGenerator.kt:262 */
|
133 192 | "longValue" => {
|
193 + | /* JsonParserGenerator.kt:272 */
|
134 194 | builder = builder.set_long_value(
|
195 + | /* JsonParserGenerator.kt:365 */
|
135 196 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
136 197 | tokens.next(),
|
137 198 | )?
|
138 199 | .map(i64::try_from)
|
139 - | .transpose()?,
|
200 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
140 201 | );
|
202 + | /* JsonParserGenerator.kt:262 */
|
141 203 | }
|
204 + | /* JsonParserGenerator.kt:262 */
|
142 205 | "shortValue" => {
|
206 + | /* JsonParserGenerator.kt:272 */
|
143 207 | builder = builder.set_short_value(
|
208 + | /* JsonParserGenerator.kt:365 */
|
144 209 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
145 210 | tokens.next(),
|
146 211 | )?
|
147 212 | .map(i16::try_from)
|
148 - | .transpose()?,
|
213 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
149 214 | );
|
215 + | /* JsonParserGenerator.kt:262 */
|
150 216 | }
|
217 + | /* JsonParserGenerator.kt:262 */
|
151 218 | "stringValue" => {
|
219 + | /* JsonParserGenerator.kt:272 */
|
152 220 | builder = builder.set_string_value(
|
221 + | /* JsonParserGenerator.kt:354 */
|
153 222 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
154 223 | tokens.next(),
|
155 224 | )?
|
156 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
157 - | .transpose()?,
|
225 + | .map(|s|
|
226 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
227 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
228 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
229 + | .transpose()?, /* JsonParserGenerator.kt:272 */
|
158 230 | );
|
231 + | /* JsonParserGenerator.kt:262 */
|
159 232 | }
|
233 + | /* JsonParserGenerator.kt:262 */
|
160 234 | "trueBooleanValue" => {
|
235 + | /* JsonParserGenerator.kt:272 */
|
161 236 | builder = builder.set_true_boolean_value(
|
237 + | /* JsonParserGenerator.kt:298 */
|
162 238 | ::aws_smithy_json::deserialize::token::expect_bool_or_null(
|
163 239 | tokens.next(),
|
164 - | )?,
|
240 + | )?, /* JsonParserGenerator.kt:272 */
|
165 241 | );
|
242 + | /* JsonParserGenerator.kt:262 */
|
166 243 | }
|
167 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
244 + | /* JsonParserGenerator.kt:290 */
|
245 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
168 246 | }
|
247 + | /* JsonParserGenerator.kt:686 */
|
169 248 | }
|
249 + | /* JsonParserGenerator.kt:695 */
|
170 250 | other => {
|
171 251 | return Err(
|
172 252 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
173 253 | "expected object key or end object, found: {other:?}"
|
174 254 | )),
|
175 255 | )
|
176 - | }
|
256 + | } /* JsonParserGenerator.kt:685 */
|
177 257 | }
|
258 + | /* JsonParserGenerator.kt:684 */
|
178 259 | }
|
260 + | /* JsonParserGenerator.kt:250 */
|
179 261 | if tokens.next().is_some() {
|
262 + | /* JsonParserGenerator.kt:251 */
|
180 263 | return Err(
|
181 264 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
182 265 | "found more JSON tokens after completing parsing",
|
183 266 | ),
|
184 267 | );
|
268 + | /* JsonParserGenerator.kt:250 */
|
185 269 | }
|
270 + | /* JsonParserGenerator.kt:163 */
|
186 271 | Ok(builder)
|
272 + | /* JsonParserGenerator.kt:148 */
|
187 273 | }
|
188 274 |
|
275 + | /* HttpBindingGenerator.kt:565 */
|
189 276 | pub fn ser_simple_scalar_properties_headers(
|
190 277 | input: &crate::output::SimpleScalarPropertiesOutput,
|
191 - | mut builder: ::http::response::Builder,
|
192 - | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
193 - | {
|
278 + | mut builder: ::http_1x::response::Builder,
|
279 + | ) -> std::result::Result<
|
280 + | ::http_1x::response::Builder,
|
281 + | ::aws_smithy_types::error::operation::BuildError,
|
282 + | > {
|
283 + | /* HttpBindingGenerator.kt:615 */
|
194 284 | if let ::std::option::Option::Some(inner_1) = &input.foo {
|
285 + | /* HttpBindingGenerator.kt:727 */
|
195 286 | let formatted_2 = inner_1.as_str();
|
287 + | /* HttpBindingGenerator.kt:728 */
|
196 288 | if !formatted_2.is_empty() {
|
289 + | /* HttpBindingGenerator.kt:729 */
|
197 290 | let header_value = formatted_2;
|
198 - | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
291 + | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
199 292 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
200 293 | "foo",
|
201 294 | format!(
|
202 295 | "`{}` cannot be used as a header value: {}",
|
203 296 | &header_value, err
|
204 297 | ),
|
205 298 | )
|
206 299 | })?;
|
207 300 | builder = builder.header("X-Foo", header_value);
|
301 + | /* HttpBindingGenerator.kt:728 */
|
208 302 | }
|
303 + | /* HttpBindingGenerator.kt:615 */
|
209 304 | }
|
305 + | /* HttpBindingGenerator.kt:578 */
|
210 306 | Ok(builder)
|
307 + | /* HttpBindingGenerator.kt:565 */
|
211 308 | }
|