130 134 | crate::operation::query_precedence::QueryPrecedenceError,
|
131 135 | >::new());
|
132 136 |
|
133 137 | ::std::borrow::Cow::Owned(rcb)
|
134 138 | }
|
135 139 | }
|
136 140 |
|
137 141 | #[derive(Debug)]
|
138 142 | struct QueryPrecedenceResponseDeserializer;
|
139 143 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for QueryPrecedenceResponseDeserializer {
|
140 - | fn deserialize_nonstreaming(
|
144 + | fn deserialize_nonstreaming_with_config(
|
141 145 | &self,
|
142 146 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
147 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 148 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 149 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 + | #[allow(unused_mut)]
|
151 + | let mut force_error = false;
|
152 + |
|
153 + | if !success && status != 200 || force_error {
|
145 154 | let headers = response.headers();
|
146 155 | let body = response.body().bytes().expect("body loaded");
|
147 156 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
157 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
158 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
159 + | })?;
|
149 160 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_query_precedence::de_query_precedence_http_error(status, headers, body)
|
152 - | } else {
|
153 - | crate::protocol_serde::shape_query_precedence::de_query_precedence_http_response(status, headers, body)
|
161 + | let generic = generic_builder.build();
|
162 + | let error_code = match generic.code() {
|
163 + | ::std::option::Option::Some(code) => code,
|
164 + | ::std::option::Option::None => {
|
165 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
166 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::query_precedence::QueryPrecedenceError::unhandled(
|
167 + | generic,
|
168 + | )),
|
169 + | ))
|
170 + | }
|
171 + | };
|
172 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
173 + | let protocol = _cfg
|
174 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
175 + | .expect("a SharedClientProtocol is required");
|
176 + | let err = match error_code {
|
177 + | "ExtraError" => crate::operation::query_precedence::QueryPrecedenceError::ExtraError({
|
178 + | let mut tmp = match protocol
|
179 + | .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
|
180 + | .and_then(|mut deser| {
|
181 + | crate::types::error::ExtraError::deserialize_with_response(
|
182 + | &mut *deser,
|
183 + | response.headers(),
|
184 + | response.status().into(),
|
185 + | body,
|
186 + | )
|
187 + | }) {
|
188 + | ::std::result::Result::Ok(val) => val,
|
189 + | ::std::result::Result::Err(e) => {
|
190 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
191 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
192 + | ))
|
193 + | }
|
154 194 | };
|
155 - | crate::protocol_serde::type_erase_result(parse_result)
|
195 + | tmp.meta = generic;
|
196 + | if tmp.message.is_none() {
|
197 + | tmp.message = _error_message;
|
198 + | }
|
199 + | tmp
|
200 + | }),
|
201 + | _ => crate::operation::query_precedence::QueryPrecedenceError::generic(generic),
|
202 + | };
|
203 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
204 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
205 + | ))
|
206 + | } else {
|
207 + | let protocol = _cfg
|
208 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
209 + | .expect("a SharedClientProtocol is required");
|
210 + | let mut deser = protocol
|
211 + | .deserialize_response(response, QueryPrecedence::OUTPUT_SCHEMA, _cfg)
|
212 + | .map_err(|e| {
|
213 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
214 + | })?;
|
215 + | let body = response.body().bytes().expect("body loaded");
|
216 + | let output = crate::operation::query_precedence::QueryPrecedenceOutput::deserialize_with_response(
|
217 + | &mut *deser,
|
218 + | response.headers(),
|
219 + | response.status().into(),
|
220 + | body,
|
221 + | )
|
222 + | .map_err(|e| {
|
223 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
224 + | })?;
|
225 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
226 + | }
|
156 227 | }
|
157 228 | }
|
158 229 | #[derive(Debug)]
|
159 230 | struct QueryPrecedenceRequestSerializer;
|
160 231 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for QueryPrecedenceRequestSerializer {
|
161 232 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
162 233 | fn serialize_input(
|
163 234 | &self,
|
164 235 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
165 236 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
166 237 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
167 238 | let input = input
|
168 239 | .downcast::<crate::operation::query_precedence::QueryPrecedenceInput>()
|
169 240 | .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_precedence::QueryPrecedenceInput,
|
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, "/Precedence").expect("formatting should succeed");
|
182 - | ::std::result::Result::Ok(())
|
183 - | }
|
184 - | fn uri_query(
|
185 - | _input: &crate::operation::query_precedence::QueryPrecedenceInput,
|
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 = ["bar"];
|
190 - | if let ::std::option::Option::Some(inner_1) = &_input.baz {
|
191 - | {
|
192 - | for (k, v) in inner_1 {
|
193 - | if !protected_params.contains(&k.as_str()) {
|
194 - | query.push_kv(&::aws_smithy_http::query::fmt_string(k), &::aws_smithy_http::query::fmt_string(v));
|
195 - | }
|
196 - | }
|
197 - | }
|
198 - | }
|
199 - | if let ::std::option::Option::Some(inner_2) = &_input.foo {
|
241 + | let protocol = _cfg
|
242 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
243 + | .expect("a SharedClientProtocol is required");
|
244 + | if protocol.supports_http_bindings() {
|
245 + | let mut request = protocol
|
246 + | .serialize_body(&input, QueryPrecedence::INPUT_SCHEMA, "", _cfg)
|
247 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
200 248 | {
|
201 - | query.push_kv("bar", &::aws_smithy_http::query::fmt_string(inner_2));
|
202 - | }
|
249 + | let mut uri = "/Precedence".to_string();
|
250 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
251 + | if let Some(ref val) = input.foo {
|
252 + | query_params.push(("bar".to_string(), val.to_string()));
|
253 + | }
|
254 + | if let Some(ref map) = input.baz {
|
255 + | for (k, v) in map {
|
256 + | if matches!(k.as_str(), "bar") {
|
257 + | continue;
|
258 + | }
|
259 + | query_params.push((k.clone(), v.clone()));
|
260 + | }
|
261 + | }
|
262 + | if !query_params.is_empty() {
|
263 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
264 + | let pairs: Vec<String> = query_params
|
265 + | .iter()
|
266 + | .map(|(k, v)| {
|
267 + | format!(
|
268 + | "{}={}",
|
269 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
270 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
271 + | )
|
272 + | })
|
273 + | .collect();
|
274 + | uri.push_str(&pairs.join("&"));
|
203 275 | }
|
204 - | ::std::result::Result::Ok(())
|
276 + | request.set_uri(uri.as_str()).expect("valid URI");
|
205 277 | }
|
206 - | #[allow(clippy::unnecessary_wraps)]
|
207 - | fn update_http_builder(
|
208 - | input: &crate::operation::query_precedence::QueryPrecedenceInput,
|
209 - | builder: ::http_1x::request::Builder,
|
210 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
211 - | let mut uri = ::std::string::String::new();
|
212 - | uri_base(input, &mut uri)?;
|
213 - | uri_query(input, &mut uri)?;
|
214 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
215 - | }
|
216 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
217 - | builder
|
218 - | };
|
219 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
220 278 |
|
221 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
279 + | return ::std::result::Result::Ok(request);
|
280 + | } else {
|
281 + | let mut request = protocol
|
282 + | .serialize_request(&input, QueryPrecedence::INPUT_SCHEMA, "", _cfg)
|
283 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
284 + |
|
285 + | return ::std::result::Result::Ok(request);
|
286 + | }
|
222 287 | }
|
223 288 | }
|
224 289 | #[derive(Debug)]
|
225 290 | struct QueryPrecedenceEndpointParamsInterceptor;
|
226 291 |
|
227 292 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for QueryPrecedenceEndpointParamsInterceptor {
|
228 293 | fn name(&self) -> &'static str {
|
229 294 | "QueryPrecedenceEndpointParamsInterceptor"
|
230 295 | }
|
231 296 |
|