133 139 | ::std::borrow::Cow::Owned(rcb)
|
134 140 | }
|
135 141 | }
|
136 142 |
|
137 143 | #[derive(Debug)]
|
138 144 | struct OmitsSerializingEmptyListsResponseDeserializer;
|
139 145 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OmitsSerializingEmptyListsResponseDeserializer {
|
140 146 | fn deserialize_nonstreaming(
|
141 147 | &self,
|
142 148 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
149 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 150 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 151 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
152 + | #[allow(unused_mut)]
|
153 + | let mut force_error = false;
|
154 + |
|
155 + | if !success && status != 200 || force_error {
|
145 156 | let headers = response.headers();
|
146 157 | let body = response.body().bytes().expect("body loaded");
|
147 158 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
159 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
160 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
161 + | })?;
|
149 162 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_omits_serializing_empty_lists::de_omits_serializing_empty_lists_http_error(status, headers, body)
|
163 + | let generic = generic_builder.build();
|
164 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
165 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
166 + | crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::generic(generic),
|
167 + | ),
|
168 + | ))
|
152 169 | } else {
|
153 - | crate::protocol_serde::shape_omits_serializing_empty_lists::de_omits_serializing_empty_lists_http_response(status, headers, body)
|
154 - | };
|
155 - | crate::protocol_serde::type_erase_result(parse_result)
|
170 + | let protocol = _cfg
|
171 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
172 + | .expect("a SharedClientProtocol is required");
|
173 + | let mut deser = protocol
|
174 + | .deserialize_response(response, OmitsSerializingEmptyLists::OUTPUT_SCHEMA, _cfg)
|
175 + | .map_err(|e| {
|
176 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
177 + | })?;
|
178 + | let body = response.body().bytes().expect("body loaded");
|
179 + | let output = crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput::deserialize_with_response(
|
180 + | &mut *deser,
|
181 + | response.headers(),
|
182 + | response.status().into(),
|
183 + | body,
|
184 + | )
|
185 + | .map_err(|e| {
|
186 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
187 + | })?;
|
188 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
189 + | }
|
156 190 | }
|
157 191 | }
|
158 192 | #[derive(Debug)]
|
159 193 | struct OmitsSerializingEmptyListsRequestSerializer;
|
160 194 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OmitsSerializingEmptyListsRequestSerializer {
|
161 195 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
162 196 | fn serialize_input(
|
163 197 | &self,
|
164 198 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
165 199 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
166 200 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
167 201 | let input = input
|
168 202 | .downcast::<crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput>()
|
169 203 | .expect("correct type");
|
170 - | let _header_serialization_settings = _cfg
|
171 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
172 - | .cloned()
|
173 - | .unwrap_or_default();
|
174 - | let mut request_builder = {
|
175 - | #[allow(clippy::uninlined_format_args)]
|
176 - | fn uri_base(
|
177 - | _input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
|
178 - | output: &mut ::std::string::String,
|
179 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
180 - | use ::std::fmt::Write as _;
|
181 - | ::std::write!(output, "/OmitsSerializingEmptyLists").expect("formatting should succeed");
|
182 - | ::std::result::Result::Ok(())
|
183 - | }
|
184 - | fn uri_query(
|
185 - | _input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
|
186 - | mut output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
189 - | if let ::std::option::Option::Some(inner_1) = &_input.query_string_list {
|
204 + | let protocol = _cfg
|
205 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
206 + | .expect("a SharedClientProtocol is required");
|
207 + | if protocol.supports_http_bindings() {
|
208 + | let mut request = protocol
|
209 + | .serialize_body(&input, OmitsSerializingEmptyLists::INPUT_SCHEMA, "", _cfg)
|
210 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
190 211 | {
|
191 - | for inner_2 in inner_1 {
|
192 - | query.push_kv("StringList", &::aws_smithy_http::query::fmt_string(inner_2));
|
212 + | let mut uri = "/OmitsSerializingEmptyLists".to_string();
|
213 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
214 + | if let Some(ref val) = input.query_string_list {
|
215 + | for item in val {
|
216 + | query_params.push(("StringList".to_string(), item.to_string()));
|
193 217 | }
|
194 218 | }
|
219 + | if let Some(ref val) = input.query_integer_list {
|
220 + | for item in val {
|
221 + | query_params.push(("IntegerList".to_string(), item.to_string()));
|
195 222 | }
|
196 - | if let ::std::option::Option::Some(inner_3) = &_input.query_integer_list {
|
197 - | {
|
198 - | for inner_4 in inner_3 {
|
199 - | query.push_kv("IntegerList", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
|
200 223 | }
|
224 + | if let Some(ref val) = input.query_double_list {
|
225 + | for item in val {
|
226 + | query_params.push(("DoubleList".to_string(), {
|
227 + | let s = item.to_string();
|
228 + | match s.as_str() {
|
229 + | "inf" => "Infinity".to_string(),
|
230 + | "-inf" => "-Infinity".to_string(),
|
231 + | _ => s,
|
201 232 | }
|
233 + | }));
|
202 234 | }
|
203 - | if let ::std::option::Option::Some(inner_5) = &_input.query_double_list {
|
204 - | {
|
205 - | for inner_6 in inner_5 {
|
206 - | query.push_kv("DoubleList", ::aws_smithy_types::primitive::Encoder::from(*inner_6).encode());
|
207 235 | }
|
236 + | if let Some(ref val) = input.query_boolean_list {
|
237 + | for item in val {
|
238 + | query_params.push(("BooleanList".to_string(), item.to_string()));
|
208 239 | }
|
209 240 | }
|
210 - | if let ::std::option::Option::Some(inner_7) = &_input.query_boolean_list {
|
211 - | {
|
212 - | for inner_8 in inner_7 {
|
213 - | query.push_kv("BooleanList", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
|
214 - | }
|
215 - | }
|
216 - | }
|
217 - | if let ::std::option::Option::Some(inner_9) = &_input.query_timestamp_list {
|
218 - | {
|
219 - | for inner_10 in inner_9 {
|
220 - | query.push_kv(
|
221 - | "TimestampList",
|
222 - | &::aws_smithy_http::query::fmt_timestamp(inner_10, ::aws_smithy_types::date_time::Format::DateTime)?,
|
223 - | );
|
224 - | }
|
225 - | }
|
241 + | if let Some(ref val) = input.query_timestamp_list {
|
242 + | for item in val {
|
243 + | query_params.push((
|
244 + | "TimestampList".to_string(),
|
245 + | item.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
246 + | ));
|
226 247 | }
|
227 - | if let ::std::option::Option::Some(inner_11) = &_input.query_enum_list {
|
228 - | {
|
229 - | for inner_12 in inner_11 {
|
230 - | query.push_kv("EnumList", &::aws_smithy_http::query::fmt_string(inner_12.as_str()));
|
231 248 | }
|
249 + | if let Some(ref val) = input.query_enum_list {
|
250 + | for item in val {
|
251 + | query_params.push(("EnumList".to_string(), item.as_str().to_string()));
|
232 252 | }
|
233 253 | }
|
234 - | if let ::std::option::Option::Some(inner_13) = &_input.query_integer_enum_list {
|
235 - | {
|
236 - | for inner_14 in inner_13 {
|
237 - | query.push_kv("IntegerEnumList", ::aws_smithy_types::primitive::Encoder::from(*inner_14).encode());
|
254 + | if let Some(ref val) = input.query_integer_enum_list {
|
255 + | for item in val {
|
256 + | query_params.push(("IntegerEnumList".to_string(), item.to_string()));
|
238 257 | }
|
239 258 | }
|
259 + | if !query_params.is_empty() {
|
260 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
261 + | let pairs: Vec<String> = query_params
|
262 + | .iter()
|
263 + | .map(|(k, v)| {
|
264 + | format!(
|
265 + | "{}={}",
|
266 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
267 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
268 + | )
|
269 + | })
|
270 + | .collect();
|
271 + | uri.push_str(&pairs.join("&"));
|
240 272 | }
|
241 - | ::std::result::Result::Ok(())
|
273 + | request.set_uri(uri.as_str()).expect("valid URI");
|
242 274 | }
|
243 - | #[allow(clippy::unnecessary_wraps)]
|
244 - | fn update_http_builder(
|
245 - | input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
|
246 - | builder: ::http_1x::request::Builder,
|
247 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
248 - | let mut uri = ::std::string::String::new();
|
249 - | uri_base(input, &mut uri)?;
|
250 - | uri_query(input, &mut uri)?;
|
251 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
252 - | }
|
253 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
254 - | builder
|
255 - | };
|
256 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
257 275 |
|
258 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
276 + | return ::std::result::Result::Ok(request);
|
277 + | } else {
|
278 + | let mut request = protocol
|
279 + | .serialize_request(&input, OmitsSerializingEmptyLists::INPUT_SCHEMA, "", _cfg)
|
280 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
281 + |
|
282 + | return ::std::result::Result::Ok(request);
|
283 + | }
|
259 284 | }
|
260 285 | }
|
261 286 | #[derive(Debug)]
|
262 287 | struct OmitsSerializingEmptyListsEndpointParamsInterceptor;
|
263 288 |
|
264 289 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OmitsSerializingEmptyListsEndpointParamsInterceptor {
|
265 290 | fn name(&self) -> &'static str {
|
266 291 | "OmitsSerializingEmptyListsEndpointParamsInterceptor"
|
267 292 | }
|
268 293 |
|