aws_sdk_route53/protocol_serde/
shape_list_geo_locations.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_list_geo_locations_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<crate::operation::list_geo_locations::ListGeoLocationsOutput, crate::operation::list_geo_locations::ListGeoLocationsError> {
8 #[allow(unused_mut)]
9 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
10 .map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
11 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12 let generic = generic_builder.build();
13 let error_code = match generic.code() {
14 Some(code) => code,
15 None => return Err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled(generic)),
16 };
17
18 let _error_message = generic.message().map(|msg| msg.to_owned());
19 Err(match error_code {
20 "InvalidInput" => crate::operation::list_geo_locations::ListGeoLocationsError::InvalidInput({
21 #[allow(unused_mut)]
22 let mut tmp = {
23 #[allow(unused_mut)]
24 let mut output = crate::types::error::builders::InvalidInputBuilder::default();
25 output = crate::protocol_serde::shape_invalid_input::de_invalid_input_xml_err(_response_body, output)
26 .map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
27 let output = output.meta(generic);
28 output.build()
29 };
30 if tmp.message.is_none() {
31 tmp.message = _error_message;
32 }
33 tmp
34 }),
35 _ => crate::operation::list_geo_locations::ListGeoLocationsError::generic(generic),
36 })
37}
38
39#[allow(clippy::unnecessary_wraps)]
40pub fn de_list_geo_locations_http_response(
41 _response_status: u16,
42 _response_headers: &::aws_smithy_runtime_api::http::Headers,
43 _response_body: &[u8],
44) -> std::result::Result<crate::operation::list_geo_locations::ListGeoLocationsOutput, crate::operation::list_geo_locations::ListGeoLocationsError> {
45 Ok({
46 #[allow(unused_mut)]
47 let mut output = crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder::default();
48 output = crate::protocol_serde::shape_list_geo_locations::de_list_geo_locations(_response_body, output)
49 .map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?;
50 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
51 crate::serde_util::list_geo_locations_output_output_correct_errors(output)
52 .build()
53 .map_err(crate::operation::list_geo_locations::ListGeoLocationsError::unhandled)?
54 })
55}
56
57#[allow(unused_mut)]
58pub fn de_list_geo_locations(
59 inp: &[u8],
60 mut builder: crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder,
61) -> std::result::Result<crate::operation::list_geo_locations::builders::ListGeoLocationsOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
62 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
63
64 #[allow(unused_mut)]
65 let mut decoder = doc.root_element()?;
66 #[allow(unused_variables)]
67 let start_el = decoder.start_el();
68 if !start_el.matches("ListGeoLocationsResponse") {
69 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
70 "encountered invalid XML root: expected ListGeoLocationsResponse but got {:?}. This is likely a bug in the SDK.",
71 start_el
72 )));
73 }
74 while let Some(mut tag) = decoder.next_tag() {
75 match tag.start_el() {
76 s if s.matches("NextSubdivisionCode") => {
77 let var_1 =
78 Some(
79 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
80 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
81 .into()
82 )
83 ?
84 )
85 ;
86 builder = builder.set_next_subdivision_code(var_1);
87 }
88 ,
89 s if s.matches("NextCountryCode") => {
90 let var_2 =
91 Some(
92 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
93 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
94 .into()
95 )
96 ?
97 )
98 ;
99 builder = builder.set_next_country_code(var_2);
100 }
101 ,
102 s if s.matches("GeoLocationDetailsList") => {
103 let var_3 =
104 Some(
105 crate::protocol_serde::shape_geo_location_details_list::de_geo_location_details_list(&mut tag)
106 ?
107 )
108 ;
109 builder = builder.set_geo_location_details_list(var_3);
110 }
111 ,
112 s if s.matches("IsTruncated") => {
113 let var_4 =
114 Some(
115 {
116 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
117 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
118 )
119 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.route53#PageTruncated`)"))
120 }
121 ?
122 )
123 ;
124 builder = builder.set_is_truncated(var_4);
125 }
126 ,
127 s if s.matches("NextContinentCode") => {
128 let var_5 =
129 Some(
130 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
131 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
132 .into()
133 )
134 ?
135 )
136 ;
137 builder = builder.set_next_continent_code(var_5);
138 }
139 ,
140 s if s.matches("MaxItems") => {
141 let var_6 =
142 Some(
143 {
144 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
145 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
146 )
147 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `smithy.api#Integer`)"))
148 }
149 ?
150 )
151 ;
152 builder = builder.set_max_items(var_6);
153 }
154 ,
155 _ => {}
156 }
157 }
158 Ok(builder)
159}