aws_sdk_redshift/protocol_serde/
shape_delete_authentication_profile.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_authentication_profile_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::delete_authentication_profile::DeleteAuthenticationProfileOutput,
9 crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError,
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::delete_authentication_profile::DeleteAuthenticationProfileError::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::delete_authentication_profile::DeleteAuthenticationProfileError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "AuthenticationProfileNotFoundFault" => {
24 crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::AuthenticationProfileNotFoundFault({
25 #[allow(unused_mut)]
26 let mut tmp = {
27 #[allow(unused_mut)]
28 let mut output = crate::types::error::builders::AuthenticationProfileNotFoundFaultBuilder::default();
29 output = crate::protocol_serde::shape_authentication_profile_not_found_fault::de_authentication_profile_not_found_fault_xml_err(
30 _response_body,
31 output,
32 )
33 .map_err(crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::unhandled)?;
34 let output = output.meta(generic);
35 output.build()
36 };
37 if tmp.message.is_none() {
38 tmp.message = _error_message;
39 }
40 tmp
41 })
42 }
43 "InvalidAuthenticationProfileRequestFault" => {
44 crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::InvalidAuthenticationProfileRequestFault({
45 #[allow(unused_mut)]
46 let mut tmp = {
47 #[allow(unused_mut)]
48 let mut output = crate::types::error::builders::InvalidAuthenticationProfileRequestFaultBuilder::default();
49 output = crate::protocol_serde::shape_invalid_authentication_profile_request_fault::de_invalid_authentication_profile_request_fault_xml_err(_response_body, output).map_err(crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::unhandled)?;
50 let output = output.meta(generic);
51 output.build()
52 };
53 if tmp.message.is_none() {
54 tmp.message = _error_message;
55 }
56 tmp
57 })
58 }
59 _ => crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::generic(generic),
60 })
61}
62
63#[allow(clippy::unnecessary_wraps)]
64pub fn de_delete_authentication_profile_http_response(
65 _response_status: u16,
66 _response_headers: &::aws_smithy_runtime_api::http::Headers,
67 _response_body: &[u8],
68) -> std::result::Result<
69 crate::operation::delete_authentication_profile::DeleteAuthenticationProfileOutput,
70 crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError,
71> {
72 Ok({
73 #[allow(unused_mut)]
74 let mut output = crate::operation::delete_authentication_profile::builders::DeleteAuthenticationProfileOutputBuilder::default();
75 output = crate::protocol_serde::shape_delete_authentication_profile::de_delete_authentication_profile(_response_body, output)
76 .map_err(crate::operation::delete_authentication_profile::DeleteAuthenticationProfileError::unhandled)?;
77 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
78 output.build()
79 })
80}
81
82#[allow(unused_mut)]
83pub fn de_delete_authentication_profile(
84 inp: &[u8],
85 mut builder: crate::operation::delete_authentication_profile::builders::DeleteAuthenticationProfileOutputBuilder,
86) -> std::result::Result<
87 crate::operation::delete_authentication_profile::builders::DeleteAuthenticationProfileOutputBuilder,
88 ::aws_smithy_xml::decode::XmlDecodeError,
89> {
90 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
91
92 #[allow(unused_mut)]
93 let mut decoder = doc.root_element()?;
94 #[allow(unused_variables)]
95 let start_el = decoder.start_el();
96 if !(start_el.matches("DeleteAuthenticationProfileResponse")) {
97 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
98 "invalid root, expected DeleteAuthenticationProfileResponse got {:?}",
99 start_el
100 )));
101 }
102 if let Some(mut result_tag) = decoder.next_tag() {
103 let start_el = result_tag.start_el();
104 if !(start_el.matches("DeleteAuthenticationProfileResult")) {
105 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
106 "invalid result, expected DeleteAuthenticationProfileResult got {:?}",
107 start_el
108 )));
109 }
110 while let Some(mut tag) = result_tag.next_tag() {
111 match tag.start_el() {
112 s if s.matches("AuthenticationProfileName") => {
113 let var_1 =
114 Some(
115 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
116 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
117 .into()
118 )
119 ?
120 )
121 ;
122 builder = builder.set_authentication_profile_name(var_1);
123 }
124 ,
125 _ => {}
126 }
127 }
128 } else {
129 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(
130 "expected DeleteAuthenticationProfileResult tag",
131 ));
132 };
133 Ok(builder)
134}