pub fn ser_delete_data_protection_policy_input(
input: &crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::error::SerializationError> {
let mut out = String::new();
let mut object = aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::protocol_serde::shape_delete_data_protection_policy_input::ser_delete_data_protection_policy_input(&mut object, input)?;
object.finish();
Ok(aws_smithy_http::body::SdkBody::from(out))
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_data_protection_policy_http_error(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyOutput,
crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(response).map_err(
crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled,
)?;
generic_builder = aws_http::request_id::apply_request_id(generic_builder, response.headers());
let generic = generic_builder.build();
let error_code = match generic.code() {
Some(code) => code,
None => return Err(crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled(generic))
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InvalidParameterException" => crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"OperationAbortedException" => crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::OperationAbortedException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::OperationAbortedExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_operation_aborted_exception::de_operation_aborted_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResourceNotFoundException" => crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::ResourceNotFoundException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ServiceUnavailableException" => crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp =
{
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
let _ = response;
output = crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(response.body().as_ref(), output).map_err(crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::unhandled)?;
let output = output.meta(generic);
output.build()
}
;
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError::generic(generic)
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_data_protection_policy_http_response(
response: &http::Response<bytes::Bytes>,
) -> std::result::Result<
crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyOutput,
crate::operation::delete_data_protection_policy::DeleteDataProtectionPolicyError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::delete_data_protection_policy::builders::DeleteDataProtectionPolicyOutputBuilder::default();
let _ = response;
output._set_request_id(
aws_http::request_id::RequestId::request_id(response).map(str::to_string),
);
output.build()
})
}