#[allow(clippy::unnecessary_wraps)]
pub fn de_list_geo_locations_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::list_geo_locations::ListGeoLocationsOutput, crate::operation::list_geo_locations::ListGeoLocationsError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
let generic = generic_builder.build();
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidInput" => crate::operation::list_geo_locations::ListGeoLocationsError::InvalidInput({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidInputBuilder::default();
output = crate::protocol_serde::shape_invalid_input::de_invalid_input_xml_err(_response_body, output)
.map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::list_geo_locations::ListGeoLocationsError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_list_geo_locations_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::list_geo_locations::ListGeoLocationsOutput, crate::operation::list_geo_locations::ListGeoLocationsError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder::default();
output = crate::protocol_serde::shape_list_geo_locations::de_list_geo_locations(_response_body, output)
.map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
crate::serde_util::list_geo_locations_output_output_correct_errors(output)
.build()
.map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?
})
}
#[allow(unused_mut)]
pub fn de_list_geo_locations(
inp: &[u8],
mut builder: crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder,
) -> std::result::Result<crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
#[allow(unused_mut)]
let mut decoder = doc.root_element()?;
#[allow(unused_variables)]
let start_el = decoder.start_el();
if !start_el.matches("ListGeoLocationsResponse") {
return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
"encountered invalid XML root: expected ListGeoLocationsResponse but got {start_el:?}. This is likely a bug in the SDK."
)));
}
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("NextSubdivisionCode") => {
let var_1 =
Some(
Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_next_subdivision_code(var_1);
}
,
s if s.matches("NextCountryCode") => {
let var_2 =
Some(
Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_next_country_code(var_2);
}
,
s if s.matches("GeoLocationDetailsList") => {
let var_3 =
Some(
crate::protocol_serde::shape_geo_location_details_list::de_geo_location_details_list(&mut tag)
?
)
;
builder = builder.set_geo_location_details_list(var_3);
}
,
s if s.matches("IsTruncated") => {
let var_4 =
Some(
{
<bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.route53#PageTruncated`)"))
}
?
)
;
builder = builder.set_is_truncated(var_4);
}
,
s if s.matches("NextContinentCode") => {
let var_5 =
Some(
Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_next_continent_code(var_5);
}
,
s if s.matches("MaxItems") => {
let var_6 =
Some(
{
<i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `smithy.api#Integer`)"))
}
?
)
;
builder = builder.set_max_items(var_6);
}
,
_ => {}
}
}
Ok(builder)
}