aws_sdk_iam/protocol_serde/
shape_generate_organizations_access_report.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_generate_organizations_access_report_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::generate_organizations_access_report::GenerateOrganizationsAccessReportOutput,
9 crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError,
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::generate_organizations_access_report::GenerateOrganizationsAccessReportError::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::generate_organizations_access_report::GenerateOrganizationsAccessReportError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "ReportGenerationLimitExceeded" => {
24 crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError::ReportGenerationLimitExceededException({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::ReportGenerationLimitExceededExceptionBuilder::default();
29 output = crate::protocol_serde::shape_report_generation_limit_exceeded_exception::de_report_generation_limit_exceeded_exception_xml_err(_response_body, output).map_err(crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError::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 }
39 _ => crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError::generic(generic),
40 })
41}
42
43#[allow(clippy::unnecessary_wraps)]
44pub fn de_generate_organizations_access_report_http_response(
45 _response_status: u16,
46 _response_headers: &::aws_smithy_runtime_api::http::Headers,
47 _response_body: &[u8],
48) -> std::result::Result<
49 crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportOutput,
50 crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError,
51> {
52 Ok({
53 #[allow(unused_mut)]
54 let mut output = crate::operation::generate_organizations_access_report::builders::GenerateOrganizationsAccessReportOutputBuilder::default();
55 output = crate::protocol_serde::shape_generate_organizations_access_report::de_generate_organizations_access_report(_response_body, output)
56 .map_err(crate::operation::generate_organizations_access_report::GenerateOrganizationsAccessReportError::unhandled)?;
57 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
58 output.build()
59 })
60}
61
62#[allow(unused_mut)]
63pub fn de_generate_organizations_access_report(
64 inp: &[u8],
65 mut builder: crate::operation::generate_organizations_access_report::builders::GenerateOrganizationsAccessReportOutputBuilder,
66) -> std::result::Result<
67 crate::operation::generate_organizations_access_report::builders::GenerateOrganizationsAccessReportOutputBuilder,
68 ::aws_smithy_xml::decode::XmlDecodeError,
69> {
70 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
71
72 #[allow(unused_mut)]
73 let mut decoder = doc.root_element()?;
74 #[allow(unused_variables)]
75 let start_el = decoder.start_el();
76 if !(start_el.matches("GenerateOrganizationsAccessReportResponse")) {
77 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
78 "invalid root, expected GenerateOrganizationsAccessReportResponse got {start_el:?}"
79 )));
80 }
81 if let Some(mut result_tag) = decoder.next_tag() {
82 let start_el = result_tag.start_el();
83 if !(start_el.matches("GenerateOrganizationsAccessReportResult")) {
84 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
85 "invalid result, expected GenerateOrganizationsAccessReportResult got {start_el:?}"
86 )));
87 }
88 while let Some(mut tag) = result_tag.next_tag() {
89 match tag.start_el() {
90 s if s.matches("JobId") => {
91 let var_1 =
92 Some(
93 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
94 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
95 .into()
96 )
97 ?
98 )
99 ;
100 builder = builder.set_job_id(var_1);
101 }
102 ,
103 _ => {}
104 }
105 }
106 } else {
107 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(
108 "expected GenerateOrganizationsAccessReportResult tag",
109 ));
110 };
111 Ok(builder)
112}