#[allow(clippy::unnecessary_wraps)]
pub fn de_enable_client_authentication_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::enable_client_authentication::EnableClientAuthenticationOutput,
crate::operation::enable_client_authentication::EnableClientAuthenticationError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::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::enable_client_authentication::EnableClientAuthenticationError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::operation::enable_client_authentication::EnableClientAuthenticationError::AccessDeniedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ClientException" => crate::operation::enable_client_authentication::EnableClientAuthenticationError::ClientException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ClientExceptionBuilder::default();
output = crate::protocol_serde::shape_client_exception::de_client_exception_json_err(_response_body, output)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"DirectoryDoesNotExistException" => {
crate::operation::enable_client_authentication::EnableClientAuthenticationError::DirectoryDoesNotExistException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::DirectoryDoesNotExistExceptionBuilder::default();
output = crate::protocol_serde::shape_directory_does_not_exist_exception::de_directory_does_not_exist_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"InvalidClientAuthStatusException" => {
crate::operation::enable_client_authentication::EnableClientAuthenticationError::InvalidClientAuthStatusException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidClientAuthStatusExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_client_auth_status_exception::de_invalid_client_auth_status_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"NoAvailableCertificateException" => {
crate::operation::enable_client_authentication::EnableClientAuthenticationError::NoAvailableCertificateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::NoAvailableCertificateExceptionBuilder::default();
output = crate::protocol_serde::shape_no_available_certificate_exception::de_no_available_certificate_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"ServiceException" => crate::operation::enable_client_authentication::EnableClientAuthenticationError::ServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ServiceExceptionBuilder::default();
output = crate::protocol_serde::shape_service_exception::de_service_exception_json_err(_response_body, output)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedOperationException" => {
crate::operation::enable_client_authentication::EnableClientAuthenticationError::UnsupportedOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnsupportedOperationExceptionBuilder::default();
output = crate::protocol_serde::shape_unsupported_operation_exception::de_unsupported_operation_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::enable_client_authentication::EnableClientAuthenticationError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
_ => crate::operation::enable_client_authentication::EnableClientAuthenticationError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_enable_client_authentication_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::enable_client_authentication::EnableClientAuthenticationOutput,
crate::operation::enable_client_authentication::EnableClientAuthenticationError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::enable_client_authentication::builders::EnableClientAuthenticationOutputBuilder::default();
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_enable_client_authentication_input(
input: &crate::operation::enable_client_authentication::EnableClientAuthenticationInput,
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
let mut out = String::new();
let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
crate::protocol_serde::shape_enable_client_authentication_input::ser_enable_client_authentication_input_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_types::body::SdkBody::from(out))
}