130 136 | crate::operation::query_params_as_string_list_map::QueryParamsAsStringListMapError,
|
131 137 | >::new());
|
132 138 |
|
133 139 | ::std::borrow::Cow::Owned(rcb)
|
134 140 | }
|
135 141 | }
|
136 142 |
|
137 143 | #[derive(Debug)]
|
138 144 | struct QueryParamsAsStringListMapResponseDeserializer;
|
139 145 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for QueryParamsAsStringListMapResponseDeserializer {
|
140 - | fn deserialize_nonstreaming(
|
146 + | fn deserialize_nonstreaming_with_config(
|
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());
|
145 - | let headers = response.headers();
|
146 - | let body = response.body().bytes().expect("body loaded");
|
147 152 | #[allow(unused_mut)]
|
148 153 | let mut force_error = false;
|
149 154 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_query_params_as_string_list_map::de_query_params_as_string_list_map_http_error(status, headers, body)
|
155 + | if !success && status != 200 || force_error {
|
156 + | let headers = response.headers();
|
157 + | let body = response.body().bytes().expect("body loaded");
|
158 + | #[allow(unused_mut)]
|
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 + | })?;
|
162 + |
|
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::query_params_as_string_list_map::QueryParamsAsStringListMapError::generic(generic),
|
167 + | ),
|
168 + | ))
|
152 169 | } else {
|
153 - | crate::protocol_serde::shape_query_params_as_string_list_map::de_query_params_as_string_list_map_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, QueryParamsAsStringListMap::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::query_params_as_string_list_map::QueryParamsAsStringListMapOutput::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 QueryParamsAsStringListMapRequestSerializer;
|
160 194 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for QueryParamsAsStringListMapRequestSerializer {
|
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::query_params_as_string_list_map::QueryParamsAsStringListMapInput>()
|
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::query_params_as_string_list_map::QueryParamsAsStringListMapInput,
|
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, "/StringListMap").expect("formatting should succeed");
|
182 - | ::std::result::Result::Ok(())
|
183 - | }
|
184 - | fn uri_query(
|
185 - | _input: &crate::operation::query_params_as_string_list_map::QueryParamsAsStringListMapInput,
|
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 - | let protected_params = ["corge"];
|
190 - | if let ::std::option::Option::Some(inner_1) = &_input.foo {
|
191 - | {
|
192 - | for (k, v) in inner_1 {
|
193 - | for inner_2 in v {
|
194 - | if !protected_params.contains(&k.as_str()) {
|
195 - | query.push_kv(&::aws_smithy_http::query::fmt_string(k), &::aws_smithy_http::query::fmt_string(inner_2));
|
196 - | }
|
197 - | }
|
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, QueryParamsAsStringListMap::INPUT_SCHEMA, "", _cfg)
|
210 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
211 + | {
|
212 + | let mut uri = "/StringListMap".to_string();
|
213 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
214 + | if let Some(ref val) = input.qux {
|
215 + | query_params.push(("corge".to_string(), val.to_string()));
|
216 + | }
|
217 + | if let Some(ref map) = input.foo {
|
218 + | for (k, v) in map {
|
219 + | if matches!(k.as_str(), "corge") {
|
220 + | continue;
|
221 + | }
|
222 + | for item in v {
|
223 + | query_params.push((k.clone(), item.clone()));
|
198 224 | }
|
199 225 | }
|
200 226 | }
|
201 - | if let ::std::option::Option::Some(inner_3) = &_input.qux {
|
202 - | {
|
203 - | query.push_kv("corge", &::aws_smithy_http::query::fmt_string(inner_3));
|
204 - | }
|
227 + | if !query_params.is_empty() {
|
228 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
229 + | let pairs: Vec<String> = query_params
|
230 + | .iter()
|
231 + | .map(|(k, v)| {
|
232 + | format!(
|
233 + | "{}={}",
|
234 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
235 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
236 + | )
|
237 + | })
|
238 + | .collect();
|
239 + | uri.push_str(&pairs.join("&"));
|
205 240 | }
|
206 - | ::std::result::Result::Ok(())
|
207 - | }
|
208 - | #[allow(clippy::unnecessary_wraps)]
|
209 - | fn update_http_builder(
|
210 - | input: &crate::operation::query_params_as_string_list_map::QueryParamsAsStringListMapInput,
|
211 - | builder: ::http_1x::request::Builder,
|
212 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
213 - | let mut uri = ::std::string::String::new();
|
214 - | uri_base(input, &mut uri)?;
|
215 - | uri_query(input, &mut uri)?;
|
216 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
241 + | request.set_uri(uri.as_str()).expect("valid URI");
|
217 242 | }
|
218 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
219 - | builder
|
220 - | };
|
221 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
222 243 |
|
223 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
244 + | return ::std::result::Result::Ok(request);
|
245 + | } else {
|
246 + | let mut request = protocol
|
247 + | .serialize_request(&input, QueryParamsAsStringListMap::INPUT_SCHEMA, "", _cfg)
|
248 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
249 + |
|
250 + | return ::std::result::Result::Ok(request);
|
251 + | }
|
224 252 | }
|
225 253 | }
|
226 254 | #[derive(Debug)]
|
227 255 | struct QueryParamsAsStringListMapEndpointParamsInterceptor;
|
228 256 |
|
229 257 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for QueryParamsAsStringListMapEndpointParamsInterceptor {
|
230 258 | fn name(&self) -> &'static str {
|
231 259 | "QueryParamsAsStringListMapEndpointParamsInterceptor"
|
232 260 | }
|
233 261 |
|