1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(clippy::unnecessary_wraps)]
|
3 + | pub async fn de_rpc_v2_cbor_lists_http_request<B>(
|
4 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 + | ) -> std::result::Result<
|
6 + | crate::input::RpcV2CborListsInput,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::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::rpc_v2_cbor::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::rpc_v2_cbor_lists_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/cbor"),
|
27 + | )?;
|
28 + | input = crate::protocol_serde::shape_rpc_v2_cbor_lists::de_rpc_v2_cbor_lists(
|
29 + | bytes.as_ref(),
|
30 + | input,
|
31 + | )?;
|
32 + | }
|
33 + | input.build()?
|
34 + | })
|
35 + | }
|
36 + |
|
37 + | #[allow(clippy::unnecessary_wraps)]
|
38 + | pub fn ser_rpc_v2_cbor_lists_http_response(
|
39 + | #[allow(unused_variables)] output: crate::output::RpcV2CborListsOutput,
|
40 + | ) -> std::result::Result<
|
41 + | ::aws_smithy_legacy_http_server::response::Response,
|
42 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::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/cbor",
|
51 + | );
|
52 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
53 + | builder,
|
54 + | ::http::header::HeaderName::from_static("smithy-protocol"),
|
55 + | "rpc-v2-cbor",
|
56 + | );
|
57 + | let http_status: u16 = 200;
|
58 + | builder = builder.status(http_status);
|
59 + | let payload =
|
60 + | crate::protocol_serde::shape_rpc_v2_cbor_lists_output::ser_rpc_v2_cbor_lists_output_output_output(&output)?
|
61 + | ;
|
62 + | let content_length = payload.len();
|
63 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
64 + | builder,
|
65 + | ::http::header::CONTENT_LENGTH,
|
66 + | content_length,
|
67 + | );
|
68 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
69 + | builder.body(body)?
|
70 + | })
|
71 + | }
|
72 + |
|
73 + | #[allow(clippy::unnecessary_wraps)]
|
74 + | pub fn ser_rpc_v2_cbor_lists_http_error(
|
75 + | error: &crate::error::RpcV2CborListsError,
|
76 + | ) -> std::result::Result<
|
77 + | ::aws_smithy_legacy_http_server::response::Response,
|
78 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
|
79 + | > {
|
80 + | Ok({
|
81 + | match error {
|
82 + | crate::error::RpcV2CborListsError::ValidationException(output) => {
|
83 + | let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
|
84 + | #[allow(unused_mut)]
|
85 + | let mut builder = ::http::Response::builder();
|
86 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
87 + | builder,
|
88 + | ::http::header::CONTENT_TYPE,
|
89 + | "application/cbor",
|
90 + | );
|
91 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
92 + | builder,
|
93 + | ::http::header::HeaderName::from_static("smithy-protocol"),
|
94 + | "rpc-v2-cbor",
|
95 + | );
|
96 + | let content_length = payload.len();
|
97 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
98 + | builder,
|
99 + | ::http::header::CONTENT_LENGTH,
|
100 + | content_length,
|
101 + | );
|
102 + | builder
|
103 + | .status(400)
|
104 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
105 + | }
|
106 + | }
|
107 + | })
|
108 + | }
|
109 + |
|
110 + | pub(crate) fn de_rpc_v2_cbor_lists(
|
111 + | value: &[u8],
|
112 + | mut builder: crate::input::rpc_v2_cbor_lists_input::Builder,
|
113 + | ) -> ::std::result::Result<
|
114 + | crate::input::rpc_v2_cbor_lists_input::Builder,
|
115 + | ::aws_smithy_cbor::decode::DeserializeError,
|
116 + | > {
|
117 + | #[allow(clippy::match_single_binding)]
|
118 + | fn pair(
|
119 + | mut builder: crate::input::rpc_v2_cbor_lists_input::Builder,
|
120 + | decoder: &mut ::aws_smithy_cbor::Decoder,
|
121 + | ) -> ::std::result::Result<
|
122 + | crate::input::rpc_v2_cbor_lists_input::Builder,
|
123 + | ::aws_smithy_cbor::decode::DeserializeError,
|
124 + | > {
|
125 + | builder = match decoder.str()?.as_ref() {
|
126 + | "stringList" => {
|
127 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
128 + | Ok(builder.set_string_list(Some(
|
129 + | crate::protocol_serde::shape_string_list::de_string_list(decoder)?,
|
130 + | )))
|
131 + | })?
|
132 + | }
|
133 + | "stringSet" => {
|
134 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
135 + | Ok(builder.set_string_set(Some(
|
136 + | crate::protocol_serde::shape_string_set::de_string_set(decoder)?,
|
137 + | )))
|
138 + | })?
|
139 + | }
|
140 + | "integerList" => {
|
141 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
142 + | Ok(builder.set_integer_list(Some(
|
143 + | crate::protocol_serde::shape_integer_list::de_integer_list(decoder)?,
|
144 + | )))
|
145 + | })?
|
146 + | }
|
147 + | "booleanList" => {
|
148 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
149 + | Ok(builder.set_boolean_list(Some(
|
150 + | crate::protocol_serde::shape_boolean_list::de_boolean_list(decoder)?,
|
151 + | )))
|
152 + | })?
|
153 + | }
|
154 + | "timestampList" => {
|
155 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
156 + | Ok(builder.set_timestamp_list(Some(
|
157 + | crate::protocol_serde::shape_timestamp_list::de_timestamp_list(decoder)?,
|
158 + | )))
|
159 + | })?
|
160 + | }
|
161 + | "enumList" => {
|
162 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
163 + | Ok(builder.set_enum_list(Some(
|
164 + | crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(decoder)?,
|
165 + | )))
|
166 + | })?
|
167 + | }
|
168 + | "intEnumList" => {
|
169 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
170 + | Ok(builder.set_int_enum_list(Some(
|
171 + | crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
|
172 + | decoder,
|
173 + | )?,
|
174 + | )))
|
175 + | })?
|
176 + | }
|
177 + | "nestedStringList" => {
|
178 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
179 + | Ok(builder.set_nested_string_list(Some(
|
180 + | crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
|
181 + | decoder,
|
182 + | )?,
|
183 + | )))
|
184 + | })?
|
185 + | }
|
186 + | "structureList" => {
|
187 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
188 + | Ok(builder.set_structure_list(Some(
|
189 + | crate::protocol_serde::shape_structure_list::de_structure_list(decoder)?,
|
190 + | )))
|
191 + | })?
|
192 + | }
|
193 + | "blobList" => {
|
194 + | ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
|
195 + | Ok(builder.set_blob_list(Some(
|
196 + | crate::protocol_serde::shape_blob_list::de_blob_list(decoder)?,
|
197 + | )))
|
198 + | })?
|
199 + | }
|
200 + | _ => {
|
201 + | decoder.skip()?;
|
202 + | builder
|
203 + | }
|
204 + | };
|
205 + | Ok(builder)
|
206 + | }
|
207 + |
|
208 + | let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
|
209 + |
|
210 + | match decoder.map()? {
|
211 + | None => loop {
|
212 + | match decoder.datatype()? {
|
213 + | ::aws_smithy_cbor::data::Type::Break => {
|
214 + | decoder.skip()?;
|
215 + | break;
|
216 + | }
|
217 + | _ => {
|
218 + | builder = pair(builder, decoder)?;
|
219 + | }
|
220 + | };
|
221 + | },
|
222 + | Some(n) => {
|
223 + | for _ in 0..n {
|
224 + | builder = pair(builder, decoder)?;
|
225 + | }
|
226 + | }
|
227 + | };
|
228 + |
|
229 + | if decoder.position() != value.len() {
|
230 + | return Err(
|
231 + | ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
|
232 + | );
|
233 + | }
|
234 + |
|
235 + | Ok(builder)
|
236 + | }
|