#[allow(clippy::unnecessary_wraps)]
pub fn de_tag_resource_http_error(
_response_status: u16,
_response_headers: &::http::header::HeaderMap,
_response_body: &[u8],
) -> std::result::Result<crate::operation::tag_resource::TagResourceOutput, crate::operation::tag_resource::TagResourceError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::tag_resource::TagResourceError::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::tag_resource::TagResourceError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::operation::tag_resource::TagResourceError::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::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InternalServerException" => crate::operation::tag_resource::TagResourceError::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::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResourceNotFoundException" => crate::operation::tag_resource::TagResourceError::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::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ServiceQuotaExceededException" => crate::operation::tag_resource::TagResourceError::ServiceQuotaExceededException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ServiceQuotaExceededExceptionBuilder::default();
output = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ThrottlingException" => crate::operation::tag_resource::TagResourceError::ThrottlingException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
.map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ValidationException" => crate::operation::tag_resource::TagResourceError::ValidationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
.map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::tag_resource::TagResourceError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_tag_resource_http_response(
_response_status: u16,
_response_headers: &::http::header::HeaderMap,
_response_body: &[u8],
) -> std::result::Result<crate::operation::tag_resource::TagResourceOutput, crate::operation::tag_resource::TagResourceError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::tag_resource::builders::TagResourceOutputBuilder::default();
output._set_request_id(::aws_http::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_tag_resource_input(
input: &crate::operation::tag_resource::TagResourceInput,
) -> 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_tag_resource_input::ser_tag_resource_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_http::body::SdkBody::from(out))
}