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