1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
5 + | pub async fn de_http_request_with_labels_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::HttpRequestWithLabelsInput,
|
9 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
13 + | B::Data: Send,
|
14 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
15 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
16 + | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
18 + | Ok({
|
19 + | /* RustType.kt:534 */
|
20 + | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
22 + | let mut input = crate::input::http_request_with_labels_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
24 + | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
26 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
27 + | uri, headers, body, ..
|
28 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:1134 */
|
30 + | let input_string = uri.path();
|
31 + | /* ServerHttpBoundProtocolGenerator.kt:1146 */
|
32 + | let (input_string, (_, m1, m2, m3, m4, m5, m6, m7, m8)) =
|
33 + | ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
|
34 + | ::nom::sequence::preceded(
|
35 + | ::nom::bytes::complete::tag("/"),
|
36 + | ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
|
37 + | "HttpRequestWithLabels",
|
38 + | ),
|
39 + | ),
|
40 + | ::nom::sequence::preceded(
|
41 + | ::nom::bytes::complete::tag("/"),
|
42 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
43 + | ::nom::bytes::complete::take_until("/"),
|
44 + | ::nom::combinator::rest,
|
45 + | )),
|
46 + | ),
|
47 + | ::nom::sequence::preceded(
|
48 + | ::nom::bytes::complete::tag("/"),
|
49 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
50 + | ::nom::bytes::complete::take_until("/"),
|
51 + | ::nom::combinator::rest,
|
52 + | )),
|
53 + | ),
|
54 + | ::nom::sequence::preceded(
|
55 + | ::nom::bytes::complete::tag("/"),
|
56 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
57 + | ::nom::bytes::complete::take_until("/"),
|
58 + | ::nom::combinator::rest,
|
59 + | )),
|
60 + | ),
|
61 + | ::nom::sequence::preceded(
|
62 + | ::nom::bytes::complete::tag("/"),
|
63 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
64 + | ::nom::bytes::complete::take_until("/"),
|
65 + | ::nom::combinator::rest,
|
66 + | )),
|
67 + | ),
|
68 + | ::nom::sequence::preceded(
|
69 + | ::nom::bytes::complete::tag("/"),
|
70 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
71 + | ::nom::bytes::complete::take_until("/"),
|
72 + | ::nom::combinator::rest,
|
73 + | )),
|
74 + | ),
|
75 + | ::nom::sequence::preceded(
|
76 + | ::nom::bytes::complete::tag("/"),
|
77 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
78 + | ::nom::bytes::complete::take_until("/"),
|
79 + | ::nom::combinator::rest,
|
80 + | )),
|
81 + | ),
|
82 + | ::nom::sequence::preceded(
|
83 + | ::nom::bytes::complete::tag("/"),
|
84 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
85 + | ::nom::bytes::complete::take_until("/"),
|
86 + | ::nom::combinator::rest,
|
87 + | )),
|
88 + | ),
|
89 + | ::nom::sequence::preceded(
|
90 + | ::nom::bytes::complete::tag("/"),
|
91 + | ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
|
92 + | ::nom::bytes::complete::take_until("/"),
|
93 + | ::nom::combinator::rest,
|
94 + | )),
|
95 + | ),
|
96 + | ))(input_string)?;
|
97 + | debug_assert_eq!("", input_string);
|
98 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
99 + | input = input.set_string(
|
100 + | crate::protocol_serde::shape_http_request_with_labels_input::de_string(m1)?,
|
101 + | );
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
103 + | input = input
|
104 + | .set_short(crate::protocol_serde::shape_http_request_with_labels_input::de_short(m2)?);
|
105 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
106 + | input = input.set_integer(
|
107 + | crate::protocol_serde::shape_http_request_with_labels_input::de_integer(m3)?,
|
108 + | );
|
109 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
110 + | input = input
|
111 + | .set_long(crate::protocol_serde::shape_http_request_with_labels_input::de_long(m4)?);
|
112 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
113 + | input = input
|
114 + | .set_float(crate::protocol_serde::shape_http_request_with_labels_input::de_float(m5)?);
|
115 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
116 + | input = input.set_double(
|
117 + | crate::protocol_serde::shape_http_request_with_labels_input::de_double(m6)?,
|
118 + | );
|
119 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
120 + | input = input.set_boolean(
|
121 + | crate::protocol_serde::shape_http_request_with_labels_input::de_boolean(m7)?,
|
122 + | );
|
123 + | /* ServerHttpBoundProtocolGenerator.kt:1157 */
|
124 + | input = input.set_timestamp(
|
125 + | crate::protocol_serde::shape_http_request_with_labels_input::de_timestamp(m8)?,
|
126 + | );
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
128 + | input.build()?
|
129 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
130 + | })
|
131 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
132 + | }
|
133 + |
|
134 + | /* RustType.kt:534 */
|
135 + | #[allow(clippy::unnecessary_wraps)]
|
136 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
137 + | pub fn ser_http_request_with_labels_http_response(
|
138 + | #[allow(unused_variables)] output: crate::output::HttpRequestWithLabelsOutput,
|
139 + | ) -> std::result::Result<
|
140 + | ::aws_smithy_legacy_http_server::response::Response,
|
141 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
142 + | > {
|
143 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
144 + | Ok({
|
145 + | /* RustType.kt:534 */
|
146 + | #[allow(unused_mut)]
|
147 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
148 + | let mut builder = ::http::Response::builder();
|
149 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
150 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
151 + | builder,
|
152 + | ::http::header::CONTENT_TYPE,
|
153 + | "application/json",
|
154 + | );
|
155 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
156 + | let http_status: u16 = 200;
|
157 + | builder = builder.status(http_status);
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
159 + | let payload =
|
160 + | /* HttpBoundProtocolPayloadGenerator.kt:233 */""
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
162 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
163 + | let content_length = payload.len();
|
164 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
165 + | builder,
|
166 + | ::http::header::CONTENT_LENGTH,
|
167 + | content_length,
|
168 + | );
|
169 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
170 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
171 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
172 + | builder.body(body)?
|
173 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
174 + | })
|
175 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
176 + | }
|
177 + |
|
178 + | /* RustType.kt:534 */
|
179 + | #[allow(clippy::unnecessary_wraps)]
|
180 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
181 + | pub fn ser_http_request_with_labels_http_error(
|
182 + | error: &crate::error::HttpRequestWithLabelsError,
|
183 + | ) -> std::result::Result<
|
184 + | ::aws_smithy_legacy_http_server::response::Response,
|
185 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
186 + | > {
|
187 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
188 + | Ok({
|
189 + | /* ServerHttpBoundProtocolGenerator.kt:492 */
|
190 + | match error {
|
191 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
192 + | crate::error::HttpRequestWithLabelsError::ValidationException(output) => {
|
193 + | /* ServerHttpBoundProtocolGenerator.kt:501 */
|
194 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
195 + | /* RustType.kt:534 */
|
196 + | #[allow(unused_mut)]
|
197 + | /* ServerHttpBoundProtocolGenerator.kt:511 */
|
198 + | let mut builder = ::http::Response::builder();
|
199 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
200 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
201 + | builder,
|
202 + | ::http::header::CONTENT_TYPE,
|
203 + | "application/json",
|
204 + | );
|
205 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
206 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
207 + | builder,
|
208 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
209 + | "ValidationException",
|
210 + | );
|
211 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
212 + | let content_length = payload.len();
|
213 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
214 + | builder,
|
215 + | ::http::header::CONTENT_LENGTH,
|
216 + | content_length,
|
217 + | );
|
218 + | /* ServerHttpBoundProtocolGenerator.kt:528 */
|
219 + | builder
|
220 + | .status(400)
|
221 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
222 + | /* ServerHttpBoundProtocolGenerator.kt:500 */
|
223 + | } /* ServerHttpBoundProtocolGenerator.kt:492 */
|
224 + | }
|
225 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
226 + | })
|
227 + | /* ServerHttpBoundProtocolGenerator.kt:471 */
|
228 + | }
|