#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_configuration_profile_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::delete_configuration_profile::DeleteConfigurationProfileOutput,
crate::operation::delete_configuration_profile::DeleteConfigurationProfileError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::unhandled)?;
generic_builder = ::aws_types::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_configuration_profile::DeleteConfigurationProfileError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"BadRequestException" => crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::BadRequestException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::BadRequestExceptionBuilder::default();
output = crate::protocol_serde::shape_bad_request_exception::de_bad_request_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ConflictException" => crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::ConflictException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InternalServerException" => crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::InternalServerException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResourceNotFoundException" => crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::ResourceNotFoundException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::delete_configuration_profile::DeleteConfigurationProfileError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_configuration_profile_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::delete_configuration_profile::DeleteConfigurationProfileOutput,
crate::operation::delete_configuration_profile::DeleteConfigurationProfileError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::delete_configuration_profile::builders::DeleteConfigurationProfileOutputBuilder::default();
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_delete_configuration_profile_headers(
input: &crate::operation::delete_configuration_profile::DeleteConfigurationProfileInput,
mut builder: ::http_1x::request::Builder,
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
if let ::std::option::Option::Some(inner_1) = &input.deletion_protection_check {
let formatted_2 = inner_1.as_str();
let header_value = formatted_2;
let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
::aws_smithy_types::error::operation::BuildError::invalid_field(
"deletion_protection_check",
format!("`{}` cannot be used as a header value: {}", &header_value, err),
)
})?;
builder = builder.header("x-amzn-deletion-protection-check", header_value);
}
Ok(builder)
}