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