aws_sdk_iam/protocol_serde/
shape_get_account_authorization_details.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_account_authorization_details_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsOutput,
9 crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 let error_code = match generic.code() {
17 Some(code) => code,
18 None => return Err(crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "ServiceFailure" => crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::ServiceFailureException({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::ServiceFailureExceptionBuilder::default();
28 output = crate::protocol_serde::shape_service_failure_exception::de_service_failure_exception_xml_err(_response_body, output)
29 .map_err(crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::unhandled)?;
30 let output = output.meta(generic);
31 output.build()
32 };
33 if tmp.message.is_none() {
34 tmp.message = _error_message;
35 }
36 tmp
37 }),
38 _ => crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::generic(generic),
39 })
40}
41
42#[allow(clippy::unnecessary_wraps)]
43pub fn de_get_account_authorization_details_http_response(
44 _response_status: u16,
45 _response_headers: &::aws_smithy_runtime_api::http::Headers,
46 _response_body: &[u8],
47) -> std::result::Result<
48 crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsOutput,
49 crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError,
50> {
51 Ok({
52 #[allow(unused_mut)]
53 let mut output = crate::operation::get_account_authorization_details::builders::GetAccountAuthorizationDetailsOutputBuilder::default();
54 output = crate::protocol_serde::shape_get_account_authorization_details::de_get_account_authorization_details(_response_body, output)
55 .map_err(crate::operation::get_account_authorization_details::GetAccountAuthorizationDetailsError::unhandled)?;
56 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
57 output.build()
58 })
59}
60
61#[allow(unused_mut)]
62pub fn de_get_account_authorization_details(
63 inp: &[u8],
64 mut builder: crate::operation::get_account_authorization_details::builders::GetAccountAuthorizationDetailsOutputBuilder,
65) -> std::result::Result<
66 crate::operation::get_account_authorization_details::builders::GetAccountAuthorizationDetailsOutputBuilder,
67 ::aws_smithy_xml::decode::XmlDecodeError,
68> {
69 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
70
71 #[allow(unused_mut)]
72 let mut decoder = doc.root_element()?;
73 #[allow(unused_variables)]
74 let start_el = decoder.start_el();
75 if !(start_el.matches("GetAccountAuthorizationDetailsResponse")) {
76 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
77 "invalid root, expected GetAccountAuthorizationDetailsResponse got {start_el:?}"
78 )));
79 }
80 if let Some(mut result_tag) = decoder.next_tag() {
81 let start_el = result_tag.start_el();
82 if !(start_el.matches("GetAccountAuthorizationDetailsResult")) {
83 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
84 "invalid result, expected GetAccountAuthorizationDetailsResult got {start_el:?}"
85 )));
86 }
87 while let Some(mut tag) = result_tag.next_tag() {
88 match tag.start_el() {
89 s if s.matches("UserDetailList") => {
90 let var_1 =
91 Some(
92 crate::protocol_serde::shape_user_detail_list_type::de_user_detail_list_type(&mut tag)
93 ?
94 )
95 ;
96 builder = builder.set_user_detail_list(var_1);
97 }
98 ,
99 s if s.matches("GroupDetailList") => {
100 let var_2 =
101 Some(
102 crate::protocol_serde::shape_group_detail_list_type::de_group_detail_list_type(&mut tag)
103 ?
104 )
105 ;
106 builder = builder.set_group_detail_list(var_2);
107 }
108 ,
109 s if s.matches("RoleDetailList") => {
110 let var_3 =
111 Some(
112 crate::protocol_serde::shape_role_detail_list_type::de_role_detail_list_type(&mut tag)
113 ?
114 )
115 ;
116 builder = builder.set_role_detail_list(var_3);
117 }
118 ,
119 s if s.matches("Policies") => {
120 let var_4 =
121 Some(
122 crate::protocol_serde::shape_managed_policy_detail_list_type::de_managed_policy_detail_list_type(&mut tag)
123 ?
124 )
125 ;
126 builder = builder.set_policies(var_4);
127 }
128 ,
129 s if s.matches("IsTruncated") => {
130 let var_5 =
131 Some(
132 {
133 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
134 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
135 )
136 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.iam#booleanType`)"))
137 }
138 ?
139 )
140 ;
141 builder = builder.set_is_truncated(var_5);
142 }
143 ,
144 s if s.matches("Marker") => {
145 let var_6 =
146 Some(
147 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
148 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
149 .into()
150 )
151 ?
152 )
153 ;
154 builder = builder.set_marker(var_6);
155 }
156 ,
157 _ => {}
158 }
159 }
160 } else {
161 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(
162 "expected GetAccountAuthorizationDetailsResult tag",
163 ));
164 };
165 Ok(builder)
166}