aws_sdk_redshift/protocol_serde/
shape_delete_hsm_configuration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_hsm_configuration_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_hsm_configuration::DeleteHsmConfigurationOutput,
9 crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError,
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_hsm_configuration::DeleteHsmConfigurationError::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 => {
19 return Err(crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::unhandled(
20 generic,
21 ))
22 }
23 };
24
25 let _error_message = generic.message().map(|msg| msg.to_owned());
26 Err(match error_code {
27 "HsmConfigurationNotFoundFault" => crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::HsmConfigurationNotFoundFault({
28 #[allow(unused_mut)]
29 let mut tmp = {
30 #[allow(unused_mut)]
31 let mut output = crate::types::error::builders::HsmConfigurationNotFoundFaultBuilder::default();
32 output = crate::protocol_serde::shape_hsm_configuration_not_found_fault::de_hsm_configuration_not_found_fault_xml_err(
33 _response_body,
34 output,
35 )
36 .map_err(crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::unhandled)?;
37 let output = output.meta(generic);
38 output.build()
39 };
40 if tmp.message.is_none() {
41 tmp.message = _error_message;
42 }
43 tmp
44 }),
45 "InvalidHsmConfigurationStateFault" => {
46 crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::InvalidHsmConfigurationStateFault({
47 #[allow(unused_mut)]
48 let mut tmp = {
49 #[allow(unused_mut)]
50 let mut output = crate::types::error::builders::InvalidHsmConfigurationStateFaultBuilder::default();
51 output = crate::protocol_serde::shape_invalid_hsm_configuration_state_fault::de_invalid_hsm_configuration_state_fault_xml_err(
52 _response_body,
53 output,
54 )
55 .map_err(crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::unhandled)?;
56 let output = output.meta(generic);
57 output.build()
58 };
59 if tmp.message.is_none() {
60 tmp.message = _error_message;
61 }
62 tmp
63 })
64 }
65 _ => crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError::generic(generic),
66 })
67}
68
69#[allow(clippy::unnecessary_wraps)]
70pub fn de_delete_hsm_configuration_http_response(
71 _response_status: u16,
72 _response_headers: &::aws_smithy_runtime_api::http::Headers,
73 _response_body: &[u8],
74) -> std::result::Result<
75 crate::operation::delete_hsm_configuration::DeleteHsmConfigurationOutput,
76 crate::operation::delete_hsm_configuration::DeleteHsmConfigurationError,
77> {
78 Ok({
79 #[allow(unused_mut)]
80 let mut output = crate::operation::delete_hsm_configuration::builders::DeleteHsmConfigurationOutputBuilder::default();
81 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
82 output.build()
83 })
84}