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_malformed_double_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::MalformedDoubleInput,
|
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::malformed_double_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_malformed_double::de_malformed_double(
|
29 42 | bytes.as_ref(),
|
30 43 | input,
|
31 44 | )?;
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:825 */
|
32 46 | }
|
47 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
33 48 | if let Some(value) =
|
34 49 | crate::protocol_serde::shape_malformed_double_input::de_double_in_header_header(
|
35 50 | &headers,
|
36 51 | )?
|
37 52 | {
|
38 53 | input = input.set_double_in_header(Some(value))
|
39 54 | }
|
55 + | /* ServerHttpBoundProtocolGenerator.kt:1134 */
|
40 56 | let input_string = uri.path();
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:1146 */
|
41 58 | let (input_string, (_, m1)) =
|
42 59 | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
43 60 | ::nom::sequence::preceded(
|
44 61 | ::nom::bytes::complete::tag("/"),
|
45 62 | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
46 63 | "MalformedDouble",
|
47 64 | ),
|
48 65 | ),
|
49 66 | ::nom::sequence::preceded(
|
50 67 | ::nom::bytes::complete::tag("/"),
|
51 68 | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
52 69 | ::nom::bytes::complete::take_until("/"),
|
53 70 | ::nom::combinator::rest,
|
54 71 | )),
|
55 72 | ),
|
56 73 | ))(input_string)?;
|
57 74 | debug_assert_eq!("", input_string);
|
75 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
58 76 | input = input.set_double_in_path(
|
59 77 | crate::protocol_serde::shape_malformed_double_input::de_double_in_path(m1)?,
|
60 78 | );
|
79 + | /* ServerHttpBoundProtocolGenerator.kt:1221 */
|
61 80 | let query_string = uri.query().unwrap_or("");
|
62 81 | let pairs = ::form_urlencoded::parse(query_string.as_bytes());
|
82 + | /* ServerHttpBoundProtocolGenerator.kt:1247 */
|
63 83 | let mut double_in_query_seen = false;
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:1253 */
|
64 85 | for (k, v) in pairs {
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:1257 */
|
65 87 | if !double_in_query_seen && k == "doubleInQuery" {
|
66 88 | input = input.set_double_in_query(
|
67 89 | crate::protocol_serde::shape_malformed_double_input::de_double_in_query(&v)?,
|
68 90 | );
|
69 91 | double_in_query_seen = true;
|
70 92 | }
|
93 + | /* ServerHttpBoundProtocolGenerator.kt:1253 */
|
71 94 | }
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
72 96 | input.build()?
|
97 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
73 98 | })
|
99 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
74 100 | }
|
75 101 |
|
102 + | /* RustType.kt:534 */
|
76 103 | #[allow(clippy::unnecessary_wraps)]
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
77 105 | pub fn ser_malformed_double_http_response(
|
78 106 | #[allow(unused_variables)] output: crate::output::MalformedDoubleOutput,
|
79 107 | ) -> std::result::Result<
|
80 108 | ::aws_smithy_http_server::response::Response,
|
81 109 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
82 110 | > {
|
111 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
83 112 | Ok({
|
113 + | /* RustType.kt:534 */
|
84 114 | #[allow(unused_mut)]
|
85 - | let mut builder = ::http::Response::builder();
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
116 + | let mut builder = ::http_1x::Response::builder();
|
117 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
86 118 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
87 119 | builder,
|
88 - | ::http::header::CONTENT_TYPE,
|
120 + | ::http_1x::header::CONTENT_TYPE,
|
89 121 | "application/json",
|
90 122 | );
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
91 124 | let http_status: u16 = 200;
|
92 125 | builder = builder.status(http_status);
|
93 - | let payload = "";
|
126 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
127 + | let payload =
|
128 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
129 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
130 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
94 131 | let content_length = payload.len();
|
95 132 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
96 133 | builder,
|
97 - | ::http::header::CONTENT_LENGTH,
|
134 + | ::http_1x::header::CONTENT_LENGTH,
|
98 135 | content_length,
|
99 136 | );
|
137 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
100 138 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
101 140 | builder.body(body)?
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
102 142 | })
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
103 144 | }
|
104 145 |
|
146 + | /* RustType.kt:534 */
|
105 147 | #[allow(clippy::unnecessary_wraps)]
|
148 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
106 149 | pub fn ser_malformed_double_http_error(
|
107 150 | error: &crate::error::MalformedDoubleError,
|
108 151 | ) -> std::result::Result<
|
109 152 | ::aws_smithy_http_server::response::Response,
|
110 153 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
111 154 | > {
|
155 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
112 156 | Ok({
|
157 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
113 158 | match error {
|
159 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
114 160 | crate::error::MalformedDoubleError::ValidationException(output) => {
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
115 162 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
163 + | /* RustType.kt:534 */
|
116 164 | #[allow(unused_mut)]
|
117 - | let mut builder = ::http::Response::builder();
|
165 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
166 + | let mut builder = ::http_1x::Response::builder();
|
167 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
118 168 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
119 169 | builder,
|
120 - | ::http::header::CONTENT_TYPE,
|
170 + | ::http_1x::header::CONTENT_TYPE,
|
121 171 | "application/json",
|
122 172 | );
|
173 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
123 174 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
124 175 | builder,
|
125 - | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
176 + | ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
|
126 177 | "ValidationException",
|
127 178 | );
|
179 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
128 180 | let content_length = payload.len();
|
129 181 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
130 182 | builder,
|
131 - | ::http::header::CONTENT_LENGTH,
|
183 + | ::http_1x::header::CONTENT_LENGTH,
|
132 184 | content_length,
|
133 185 | );
|
186 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
134 187 | builder
|
135 188 | .status(400)
|
136 189 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
190 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
191 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
137 192 | }
|
138 - | }
|
193 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
139 194 | })
|
195 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
140 196 | }
|
141 197 |
|
198 + | /* JsonParserGenerator.kt:148 */
|
142 199 | pub(crate) fn de_malformed_double(
|
143 200 | value: &[u8],
|
144 201 | mut builder: crate::input::malformed_double_input::Builder,
|
145 202 | ) -> ::std::result::Result<
|
146 203 | crate::input::malformed_double_input::Builder,
|
147 204 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
148 205 | > {
|
206 + | /* JsonParserGenerator.kt:153 */
|
149 207 | let mut tokens_owned =
|
150 208 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
151 209 | .peekable();
|
152 210 | let tokens = &mut tokens_owned;
|
153 211 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
212 + | /* JsonParserGenerator.kt:684 */
|
154 213 | loop {
|
214 + | /* JsonParserGenerator.kt:685 */
|
155 215 | match tokens.next().transpose()? {
|
216 + | /* JsonParserGenerator.kt:686 */
|
156 217 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
157 218 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
219 + | /* JsonParserGenerator.kt:260 */
|
158 220 | match key.to_unescaped()?.as_ref() {
|
221 + | /* JsonParserGenerator.kt:262 */
|
159 222 | "doubleInBody" => {
|
223 + | /* JsonParserGenerator.kt:272 */
|
160 224 | builder = builder.set_double_in_body(
|
225 + | /* JsonParserGenerator.kt:363 */
|
161 226 | ::aws_smithy_json::deserialize::token::expect_number_or_null(
|
162 227 | tokens.next(),
|
163 228 | )?
|
164 - | .map(|v| v.to_f64_lossy()),
|
229 + | .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
|
165 230 | );
|
231 + | /* JsonParserGenerator.kt:262 */
|
166 232 | }
|
167 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
233 + | /* JsonParserGenerator.kt:290 */
|
234 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
168 235 | }
|
236 + | /* JsonParserGenerator.kt:686 */
|
169 237 | }
|
238 + | /* JsonParserGenerator.kt:695 */
|
170 239 | other => {
|
171 240 | return Err(
|
172 241 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
173 242 | "expected object key or end object, found: {other:?}"
|
174 243 | )),
|
175 244 | )
|
245 + | } /* JsonParserGenerator.kt:685 */
|
176 246 | }
|
247 + | /* JsonParserGenerator.kt:684 */
|
177 248 | }
|
178 - | }
|
249 + | /* JsonParserGenerator.kt:250 */
|
179 250 | if tokens.next().is_some() {
|
251 + | /* JsonParserGenerator.kt:251 */
|
180 252 | return Err(
|
181 253 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
182 254 | "found more JSON tokens after completing parsing",
|
183 255 | ),
|
184 256 | );
|
257 + | /* JsonParserGenerator.kt:250 */
|
185 258 | }
|
259 + | /* JsonParserGenerator.kt:163 */
|
186 260 | Ok(builder)
|
261 + | /* JsonParserGenerator.kt:148 */
|
187 262 | }
|