1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub async fn de_malformed_unique_items_http_request<B>(
|
4 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 + | ) -> std::result::Result<
|
6 + | crate::input::MalformedUniqueItemsInput,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 + | >
|
9 + | where
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 + | B::Data: Send,
|
12 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
14 + | {
|
15 + | Ok({
|
16 + | #[allow(unused_mut)]
|
17 + | let mut input = crate::input::malformed_unique_items_input::Builder::default();
|
18 + | #[allow(unused_variables)]
|
19 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 + | uri, headers, body, ..
|
21 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
22 + | let bytes = ::hyper::body::to_bytes(body).await?;
|
23 + | if !bytes.is_empty() {
|
24 + | ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
|
25 + | &headers,
|
26 + | Some("application/json"),
|
27 + | )?;
|
28 + | input = crate::protocol_serde::shape_malformed_unique_items::de_malformed_unique_items(
|
29 + | bytes.as_ref(),
|
30 + | input,
|
31 + | )?;
|
32 + | }
|
33 + | input.build()?
|
34 + | })
|
35 + | }
|
36 + |
|
37 + | #[allow(clippy::unnecessary_wraps)]
|
38 + | pub fn ser_malformed_unique_items_http_response(
|
39 + | #[allow(unused_variables)] output: crate::output::MalformedUniqueItemsOutput,
|
40 + | ) -> std::result::Result<
|
41 + | ::aws_smithy_legacy_http_server::response::Response,
|
42 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
43 + | > {
|
44 + | Ok({
|
45 + | #[allow(unused_mut)]
|
46 + | let mut builder = ::http::Response::builder();
|
47 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
48 + | builder,
|
49 + | ::http::header::CONTENT_TYPE,
|
50 + | "application/json",
|
51 + | );
|
52 + | let http_status: u16 = 200;
|
53 + | builder = builder.status(http_status);
|
54 + | let payload = "";
|
55 + | let content_length = payload.len();
|
56 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
57 + | builder,
|
58 + | ::http::header::CONTENT_LENGTH,
|
59 + | content_length,
|
60 + | );
|
61 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
62 + | builder.body(body)?
|
63 + | })
|
64 + | }
|
65 + |
|
66 + | #[allow(clippy::unnecessary_wraps)]
|
67 + | pub fn ser_malformed_unique_items_http_error(
|
68 + | error: &crate::error::MalformedUniqueItemsError,
|
69 + | ) -> std::result::Result<
|
70 + | ::aws_smithy_legacy_http_server::response::Response,
|
71 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
72 + | > {
|
73 + | Ok({
|
74 + | match error {
|
75 + | crate::error::MalformedUniqueItemsError::ValidationException(output) => {
|
76 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
77 + | #[allow(unused_mut)]
|
78 + | let mut builder = ::http::Response::builder();
|
79 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
80 + | builder,
|
81 + | ::http::header::CONTENT_TYPE,
|
82 + | "application/json",
|
83 + | );
|
84 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
85 + | builder,
|
86 + | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
87 + | "ValidationException",
|
88 + | );
|
89 + | let content_length = payload.len();
|
90 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
91 + | builder,
|
92 + | ::http::header::CONTENT_LENGTH,
|
93 + | content_length,
|
94 + | );
|
95 + | builder
|
96 + | .status(400)
|
97 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
98 + | }
|
99 + | }
|
100 + | })
|
101 + | }
|
102 + |
|
103 + | pub(crate) fn de_malformed_unique_items(
|
104 + | value: &[u8],
|
105 + | mut builder: crate::input::malformed_unique_items_input::Builder,
|
106 + | ) -> ::std::result::Result<
|
107 + | crate::input::malformed_unique_items_input::Builder,
|
108 + | ::aws_smithy_json::deserialize::error::DeserializeError,
|
109 + | > {
|
110 + | let mut tokens_owned =
|
111 + | ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
|
112 + | .peekable();
|
113 + | let tokens = &mut tokens_owned;
|
114 + | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
115 + | loop {
|
116 + | match tokens.next().transpose()? {
|
117 + | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
118 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
119 + | match key.to_unescaped()?.as_ref() {
|
120 + | "blobList" => {
|
121 + | builder = builder.set_blob_list(
|
122 + | crate::protocol_serde::shape_blob_set::de_blob_set(tokens)?,
|
123 + | );
|
124 + | }
|
125 + | "booleanList" => {
|
126 + | builder = builder.set_boolean_list(
|
127 + | crate::protocol_serde::shape_boolean_set::de_boolean_set(tokens)?,
|
128 + | );
|
129 + | }
|
130 + | "byteList" => {
|
131 + | builder = builder.set_byte_list(
|
132 + | crate::protocol_serde::shape_byte_set::de_byte_set(tokens)?,
|
133 + | );
|
134 + | }
|
135 + | "dateTimeList" => {
|
136 + | builder = builder.set_date_time_list(
|
137 + | crate::protocol_serde::shape_date_time_set::de_date_time_set(tokens)?,
|
138 + | );
|
139 + | }
|
140 + | "enumList" => {
|
141 + | builder = builder.set_enum_list(
|
142 + | crate::protocol_serde::shape_foo_enum_set::de_foo_enum_set(tokens)?,
|
143 + | );
|
144 + | }
|
145 + | "httpDateList" => {
|
146 + | builder = builder.set_http_date_list(
|
147 + | crate::protocol_serde::shape_http_date_set::de_http_date_set(tokens)?,
|
148 + | );
|
149 + | }
|
150 + | "intEnumList" => {
|
151 + | builder = builder.set_int_enum_list(
|
152 + | crate::protocol_serde::shape_integer_enum_set::de_integer_enum_set(
|
153 + | tokens,
|
154 + | )?,
|
155 + | );
|
156 + | }
|
157 + | "integerList" => {
|
158 + | builder = builder.set_integer_list(
|
159 + | crate::protocol_serde::shape_integer_set::de_integer_set(tokens)?,
|
160 + | );
|
161 + | }
|
162 + | "listList" => {
|
163 + | builder = builder.set_list_list(
|
164 + | crate::protocol_serde::shape_list_set::de_list_set(tokens)?,
|
165 + | );
|
166 + | }
|
167 + | "longList" => {
|
168 + | builder = builder.set_long_list(
|
169 + | crate::protocol_serde::shape_long_set::de_long_set(tokens)?,
|
170 + | );
|
171 + | }
|
172 + | "shortList" => {
|
173 + | builder = builder.set_short_list(
|
174 + | crate::protocol_serde::shape_short_set::de_short_set(tokens)?,
|
175 + | );
|
176 + | }
|
177 + | "stringList" => {
|
178 + | builder = builder.set_string_list(
|
179 + | crate::protocol_serde::shape_string_set::de_string_set(tokens)?,
|
180 + | );
|
181 + | }
|
182 + | "structureList" => {
|
183 + | builder = builder.set_structure_list(
|
184 + | crate::protocol_serde::shape_structure_set::de_structure_set(tokens)?,
|
185 + | );
|
186 + | }
|
187 + | "structureListWithNoKey" => {
|
188 + | builder = builder.set_structure_list_with_no_key(
|
189 + | crate::protocol_serde::shape_structure_set_with_no_key::de_structure_set_with_no_key(tokens)?
|
190 + | );
|
191 + | }
|
192 + | "timestampList" => {
|
193 + | builder = builder.set_timestamp_list(
|
194 + | crate::protocol_serde::shape_timestamp_set::de_timestamp_set(tokens)?,
|
195 + | );
|
196 + | }
|
197 + | "unionList" => {
|
198 + | builder = builder.set_union_list(
|
199 + | crate::protocol_serde::shape_union_set::de_union_set(tokens)?,
|
200 + | );
|
201 + | }
|
202 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
203 + | }
|
204 + | }
|
205 + | other => {
|
206 + | return Err(
|
207 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
208 + | "expected object key or end object, found: {other:?}"
|
209 + | )),
|
210 + | )
|
211 + | }
|
212 + | }
|
213 + | }
|
214 + | if tokens.next().is_some() {
|
215 + | return Err(
|
216 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
217 + | "found more JSON tokens after completing parsing",
|
218 + | ),
|
219 + | );
|
220 + | }
|
221 + | Ok(builder)
|
222 + | }
|