#[allow(clippy::unnecessary_wraps)]
pub fn de_manage_propertygraph_statistics_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsOutput,
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::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::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AccessDeniedException" => crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::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::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::access_denied_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"BadRequestException" => crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::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::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::bad_request_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ClientTimeoutException" => crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::ClientTimeoutException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ClientTimeoutExceptionBuilder::default();
output = crate::protocol_serde::shape_client_timeout_exception::de_client_timeout_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::client_timeout_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ConstraintViolationException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::ConstraintViolationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ConstraintViolationExceptionBuilder::default();
output = crate::protocol_serde::shape_constraint_violation_exception::de_constraint_violation_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::constraint_violation_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"IllegalArgumentException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::IllegalArgumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::IllegalArgumentExceptionBuilder::default();
output = crate::protocol_serde::shape_illegal_argument_exception::de_illegal_argument_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::illegal_argument_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"InvalidArgumentException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::InvalidArgumentException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidArgumentExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_argument_exception::de_invalid_argument_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::invalid_argument_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"InvalidParameterException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::InvalidParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
output =
crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::invalid_parameter_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"MissingParameterException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::MissingParameterException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::MissingParameterExceptionBuilder::default();
output =
crate::protocol_serde::shape_missing_parameter_exception::de_missing_parameter_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::missing_parameter_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"PreconditionsFailedException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::PreconditionsFailedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::PreconditionsFailedExceptionBuilder::default();
output = crate::protocol_serde::shape_preconditions_failed_exception::de_preconditions_failed_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::preconditions_failed_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"ReadOnlyViolationException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::ReadOnlyViolationException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::ReadOnlyViolationExceptionBuilder::default();
output =
crate::protocol_serde::shape_read_only_violation_exception::de_read_only_violation_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::read_only_violation_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"StatisticsNotAvailableException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::StatisticsNotAvailableException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::StatisticsNotAvailableExceptionBuilder::default();
output = crate::protocol_serde::shape_statistics_not_available_exception::de_statistics_not_available_exception_json_err(
_response_body,
output,
)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::statistics_not_available_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"TooManyRequestsException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::TooManyRequestsException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
output =
crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::too_many_requests_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"UnsupportedOperationException" => {
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::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::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
let output = output.meta(generic);
crate::serde_util::unsupported_operation_exception_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
_ => crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_manage_propertygraph_statistics_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsOutput,
crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::manage_propertygraph_statistics::builders::ManagePropertygraphStatisticsOutputBuilder::default();
output = crate::protocol_serde::shape_manage_propertygraph_statistics::de_manage_propertygraph_statistics(_response_body, output)
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
crate::serde_util::manage_propertygraph_statistics_output_output_correct_errors(output)
.build()
.map_err(crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsError::unhandled)?
})
}
pub fn ser_manage_propertygraph_statistics_input(
input: &crate::operation::manage_propertygraph_statistics::ManagePropertygraphStatisticsInput,
) -> 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_manage_propertygraph_statistics_input::ser_manage_propertygraph_statistics_input_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_types::body::SdkBody::from(out))
}
pub(crate) fn de_manage_propertygraph_statistics(
value: &[u8],
mut builder: crate::operation::manage_propertygraph_statistics::builders::ManagePropertygraphStatisticsOutputBuilder,
) -> Result<
crate::operation::manage_propertygraph_statistics::builders::ManagePropertygraphStatisticsOutputBuilder,
::aws_smithy_json::deserialize::error::DeserializeError,
> {
let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
let tokens = &mut tokens_owned;
::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"payload" => {
builder = builder.set_payload(crate::protocol_serde::shape_refresh_statistics_id_map::de_refresh_statistics_id_map(
tokens,
)?);
}
"status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {:?}",
other
)))
}
}
}
if tokens.next().is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"found more JSON tokens after completing parsing",
));
}
Ok(builder)
}