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_endpoint_with_host_label_operation_http_request<B>(
|
4 6 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 7 | ) -> std::result::Result<
|
6 8 | crate::input::EndpointWithHostLabelOperationInput,
|
7 9 | ::aws_smithy_http_server::protocol::aws_json::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::aws_json::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 =
|
18 23 | crate::input::endpoint_with_host_label_operation_input_internal::Builder::default();
|
24 + | /* RustType.kt:516 */
|
19 25 | #[allow(unused_variables)]
|
26 + | /* ServerHttpBoundProtocolGenerator.kt:728 */
|
20 27 | let ::aws_smithy_runtime_api::http::RequestParts {
|
21 28 | uri, headers, body, ..
|
22 29 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
30 + | /* ServerHttpBoundProtocolGenerator.kt:745 */
|
23 31 | let bytes = ::hyper::body::to_bytes(body).await?;
|
32 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
24 33 | if !bytes.is_empty() {
|
34 + | /* ServerHttpBoundProtocolGenerator.kt:769 */
|
25 35 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
26 36 | &headers,
|
27 37 | Some("application/x-amz-json-1.1"),
|
28 38 | )?;
|
29 39 | input = crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation(bytes.as_ref(), input)?;
|
40 + | /* ServerHttpBoundProtocolGenerator.kt:768 */
|
30 41 | }
|
42 + | /* ServerHttpBoundProtocolGenerator.kt:834 */
|
31 43 | input.build()?
|
44 + | /* ServerHttpBoundProtocolGenerator.kt:399 */
|
32 45 | })
|
46 + | /* ServerHttpBoundProtocolGenerator.kt:383 */
|
33 47 | }
|
34 48 |
|
49 + | /* RustType.kt:516 */
|
35 50 | #[allow(clippy::unnecessary_wraps)]
|
51 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
36 52 | pub fn ser_endpoint_with_host_label_operation_http_response(
|
37 53 | #[allow(unused_variables)] output: crate::output::EndpointWithHostLabelOperationOutput,
|
38 54 | ) -> std::result::Result<
|
39 55 | ::aws_smithy_http_server::response::Response,
|
40 56 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
41 57 | > {
|
58 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
42 59 | Ok({
|
60 + | /* RustType.kt:516 */
|
43 61 | #[allow(unused_mut)]
|
62 + | /* ServerHttpBoundProtocolGenerator.kt:523 */
|
44 63 | let mut builder = ::http::Response::builder();
|
64 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
45 65 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
46 66 | builder,
|
47 67 | ::http::header::CONTENT_TYPE,
|
48 68 | "application/x-amz-json-1.1",
|
49 69 | );
|
70 + | /* ServerHttpBoundProtocolGenerator.kt:682 */
|
50 71 | let http_status: u16 = 200;
|
51 72 | builder = builder.status(http_status);
|
52 - | let payload = "";
|
73 + | /* ServerHttpBoundProtocolGenerator.kt:561 */
|
74 + | let payload =
|
75 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */""
|
76 + | /* ServerHttpBoundProtocolGenerator.kt:561 */;
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
53 78 | let content_length = payload.len();
|
54 79 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
55 80 | builder,
|
56 81 | ::http::header::CONTENT_LENGTH,
|
57 82 | content_length,
|
58 83 | );
|
84 + | /* ServerHttpBoundProtocolGenerator.kt:567 */
|
59 85 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
86 + | /* ServerHttpBoundProtocolGenerator.kt:575 */
|
60 87 | builder.body(body)?
|
88 + | /* ServerHttpBoundProtocolGenerator.kt:433 */
|
61 89 | })
|
90 + | /* ServerHttpBoundProtocolGenerator.kt:421 */
|
62 91 | }
|
63 92 |
|
93 + | /* RustType.kt:516 */
|
64 94 | #[allow(clippy::unnecessary_wraps)]
|
95 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
65 96 | pub fn ser_endpoint_with_host_label_operation_http_error(
|
66 97 | error: &crate::error::EndpointWithHostLabelOperationError,
|
67 98 | ) -> std::result::Result<
|
68 99 | ::aws_smithy_http_server::response::Response,
|
69 100 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
70 101 | > {
|
102 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
71 103 | Ok({
|
104 + | /* ServerHttpBoundProtocolGenerator.kt:468 */
|
72 105 | match error {
|
106 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
73 107 | crate::error::EndpointWithHostLabelOperationError::ValidationException(output) => {
|
108 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
74 109 | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
110 + | /* RustType.kt:516 */
|
75 111 | #[allow(unused_mut)]
|
112 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
76 113 | let mut builder = ::http::Response::builder();
|
114 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
77 115 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
78 116 | builder,
|
79 117 | ::http::header::CONTENT_TYPE,
|
80 118 | "application/x-amz-json-1.1",
|
81 119 | );
|
120 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
82 121 | let content_length = payload.len();
|
83 122 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
84 123 | builder,
|
85 124 | ::http::header::CONTENT_LENGTH,
|
86 125 | content_length,
|
87 126 | );
|
127 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
88 128 | builder
|
89 129 | .status(400)
|
90 130 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
131 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
91 132 | }
|
133 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
92 134 | crate::error::EndpointWithHostLabelOperationError::InternalServerError(output) => {
|
135 + | /* ServerHttpBoundProtocolGenerator.kt:477 */
|
93 136 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
137 + | /* RustType.kt:516 */
|
94 138 | #[allow(unused_mut)]
|
139 + | /* ServerHttpBoundProtocolGenerator.kt:487 */
|
95 140 | let mut builder = ::http::Response::builder();
|
141 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
96 142 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
97 143 | builder,
|
98 144 | ::http::header::CONTENT_TYPE,
|
99 145 | "application/x-amz-json-1.1",
|
100 146 | );
|
147 + | /* ServerHttpBoundProtocolGenerator.kt:663 */
|
101 148 | let content_length = payload.len();
|
102 149 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
103 150 | builder,
|
104 151 | ::http::header::CONTENT_LENGTH,
|
105 152 | content_length,
|
106 153 | );
|
154 + | /* ServerHttpBoundProtocolGenerator.kt:504 */
|
107 155 | builder
|
108 156 | .status(500)
|
109 157 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
158 + | /* ServerHttpBoundProtocolGenerator.kt:476 */
|
159 + | } /* ServerHttpBoundProtocolGenerator.kt:468 */
|
110 160 | }
|
111 - | }
|
161 + | /* ServerHttpBoundProtocolGenerator.kt:452 */
|
112 162 | })
|
163 + | /* ServerHttpBoundProtocolGenerator.kt:447 */
|
113 164 | }
|
114 165 |
|
166 + | /* JsonParserGenerator.kt:148 */
|
115 167 | pub(crate) fn de_endpoint_with_host_label_operation(
|
116 168 | value: &[u8],
|
117 169 | mut builder: crate::input::endpoint_with_host_label_operation_input_internal::Builder,
|
118 170 | ) -> ::std::result::Result<
|
119 171 | crate::input::endpoint_with_host_label_operation_input_internal::Builder,
|
120 172 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
121 173 | > {
|
174 + | /* JsonParserGenerator.kt:153 */
|
122 175 | let mut tokens_owned =
|
123 176 | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
124 177 | .peekable();
|
125 178 | let tokens = &mut tokens_owned;
|
126 179 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
180 + | /* JsonParserGenerator.kt:684 */
|
127 181 | loop {
|
182 + | /* JsonParserGenerator.kt:685 */
|
128 183 | match tokens.next().transpose()? {
|
184 + | /* JsonParserGenerator.kt:686 */
|
129 185 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
130 186 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
187 + | /* JsonParserGenerator.kt:260 */
|
131 188 | match key.to_unescaped()?.as_ref() {
|
189 + | /* JsonParserGenerator.kt:262 */
|
132 190 | "label" => {
|
191 + | /* JsonParserGenerator.kt:276 */
|
133 192 | if let Some(v) =
|
193 + | /* JsonParserGenerator.kt:354 */
|
134 194 | ::aws_smithy_json::deserialize::token::expect_string_or_null(
|
135 195 | tokens.next(),
|
136 196 | )?
|
137 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
197 + | .map(|s|
|
198 + | /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
|
199 + | /* JsonParserGenerator.kt:348 */u.into_owned()
|
200 + | /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
|
138 201 | .transpose()?
|
202 + | /* JsonParserGenerator.kt:278 */
|
139 203 | {
|
140 204 | builder = builder.set_label(v);
|
141 205 | }
|
206 + | /* JsonParserGenerator.kt:262 */
|
142 207 | }
|
143 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
208 + | /* JsonParserGenerator.kt:290 */
|
209 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
144 210 | }
|
211 + | /* JsonParserGenerator.kt:686 */
|
145 212 | }
|
213 + | /* JsonParserGenerator.kt:695 */
|
146 214 | other => {
|
147 215 | return Err(
|
148 216 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
149 217 | "expected object key or end object, found: {:?}",
|
150 218 | other
|
151 219 | )),
|
152 220 | )
|
221 + | } /* JsonParserGenerator.kt:685 */
|
153 222 | }
|
223 + | /* JsonParserGenerator.kt:684 */
|
154 224 | }
|
155 - | }
|
225 + | /* JsonParserGenerator.kt:250 */
|
156 226 | if tokens.next().is_some() {
|
227 + | /* JsonParserGenerator.kt:251 */
|
157 228 | return Err(
|
158 229 | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
159 230 | "found more JSON tokens after completing parsing",
|
160 231 | ),
|
161 232 | );
|
233 + | /* JsonParserGenerator.kt:250 */
|
162 234 | }
|
235 + | /* JsonParserGenerator.kt:163 */
|
163 236 | Ok(builder)
|
237 + | /* JsonParserGenerator.kt:148 */
|
164 238 | }
|