#[allow(clippy::unnecessary_wraps)]
pub fn de_update_document_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::update_document::UpdateDocumentOutput, crate::operation::update_document::UpdateDocumentError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConcurrentModificationException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ConflictingOperationException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"EntityAlreadyExistsException" => crate::operation::update_document::UpdateDocumentError::EntityAlreadyExistsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::EntityAlreadyExistsExceptionBuilder::default();
output =
crate::protocol_serde::shape_entity_already_exists_exception::de_entity_already_exists_exception_json_err(_response_body, output)
.map_err(crate::operation::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"EntityNotExistsException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"FailedDependencyException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"LimitExceededException" => crate::operation::update_document::UpdateDocumentError::LimitExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
.map_err(crate::operation::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ProhibitedStateException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ServiceUnavailableException" => crate::operation::update_document::UpdateDocumentError::ServiceUnavailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
output =
crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
.map_err(crate::operation::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnauthorizedOperationException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnauthorizedResourceAccessException" => crate::operation::update_document::UpdateDocumentError::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::update_document::UpdateDocumentError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::update_document::UpdateDocumentError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_update_document_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::update_document::UpdateDocumentOutput, crate::operation::update_document::UpdateDocumentError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::update_document::builders::UpdateDocumentOutputBuilder::default();
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_update_document_headers(
input: &crate::operation::update_document::UpdateDocumentInput,
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)
}
pub fn ser_update_document_input(
input: &crate::operation::update_document::UpdateDocumentInput,
) -> 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_update_document_input::ser_update_document_input_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_types::body::SdkBody::from(out))
}