#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_document_version_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::delete_document_version::DeleteDocumentVersionOutput,
crate::operation::delete_document_version::DeleteDocumentVersionError,
> {
#[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_document_version::DeleteDocumentVersionError::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_document_version::DeleteDocumentVersionError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConcurrentModificationException" => {
crate::operation::delete_document_version::DeleteDocumentVersionError::ConcurrentModificationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ConcurrentModificationExceptionBuilder::default();
output = crate::protocol_serde::shape_concurrent_modification_exception::de_concurrent_modification_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"ConflictingOperationException" => crate::operation::delete_document_version::DeleteDocumentVersionError::ConflictingOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ConflictingOperationExceptionBuilder::default();
output =
crate::protocol_serde::shape_conflicting_operation_exception::de_conflicting_operation_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"EntityNotExistsException" => crate::operation::delete_document_version::DeleteDocumentVersionError::EntityNotExistsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::EntityNotExistsExceptionBuilder::default();
output = crate::protocol_serde::shape_entity_not_exists_exception::de_entity_not_exists_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"FailedDependencyException" => crate::operation::delete_document_version::DeleteDocumentVersionError::FailedDependencyException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::FailedDependencyExceptionBuilder::default();
output = crate::protocol_serde::shape_failed_dependency_exception::de_failed_dependency_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidOperationException" => crate::operation::delete_document_version::DeleteDocumentVersionError::InvalidOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidOperationExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_operation_exception::de_invalid_operation_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ProhibitedStateException" => crate::operation::delete_document_version::DeleteDocumentVersionError::ProhibitedStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ProhibitedStateExceptionBuilder::default();
output = crate::protocol_serde::shape_prohibited_state_exception::de_prohibited_state_exception_json_err(_response_body, output)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnauthorizedOperationException" => crate::operation::delete_document_version::DeleteDocumentVersionError::UnauthorizedOperationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnauthorizedOperationExceptionBuilder::default();
output = crate::protocol_serde::shape_unauthorized_operation_exception::de_unauthorized_operation_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnauthorizedResourceAccessException" => {
crate::operation::delete_document_version::DeleteDocumentVersionError::UnauthorizedResourceAccessException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnauthorizedResourceAccessExceptionBuilder::default();
output = crate::protocol_serde::shape_unauthorized_resource_access_exception::de_unauthorized_resource_access_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::delete_document_version::DeleteDocumentVersionError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
_ => crate::operation::delete_document_version::DeleteDocumentVersionError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_delete_document_version_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::delete_document_version::DeleteDocumentVersionOutput,
crate::operation::delete_document_version::DeleteDocumentVersionError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::delete_document_version::builders::DeleteDocumentVersionOutputBuilder::default();
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_delete_document_version_headers(
input: &crate::operation::delete_document_version::DeleteDocumentVersionInput,
mut builder: ::http::request::Builder,
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
if let ::std::option::Option::Some(inner_1) = &input.authentication_token {
let formatted_2 = inner_1.as_str();
if !formatted_2.is_empty() {
let header_value = formatted_2;
let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
::aws_smithy_types::error::operation::BuildError::invalid_field(
"authentication_token",
format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
)
})?;
builder = builder.header("Authentication", header_value);
}
}
Ok(builder)
}