#[allow(clippy::unnecessary_wraps)]
pub fn de_send_message_batch_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::send_message_batch::SendMessageBatchOutput, crate::operation::send_message_batch::SendMessageBatchError> {
#[allow(unused_mut)]
let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::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::send_message_batch::SendMessageBatchError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"AWS.SimpleQueueService.BatchEntryIdsNotDistinct" => crate::operation::send_message_batch::SendMessageBatchError::BatchEntryIdsNotDistinct({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::BatchEntryIdsNotDistinctBuilder::default();
output = crate::protocol_serde::shape_batch_entry_ids_not_distinct::de_batch_entry_ids_not_distinct_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AWS.SimpleQueueService.BatchRequestTooLong" => crate::operation::send_message_batch::SendMessageBatchError::BatchRequestTooLong({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::BatchRequestTooLongBuilder::default();
output = crate::protocol_serde::shape_batch_request_too_long::de_batch_request_too_long_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AWS.SimpleQueueService.EmptyBatchRequest" => crate::operation::send_message_batch::SendMessageBatchError::EmptyBatchRequest({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::EmptyBatchRequestBuilder::default();
output = crate::protocol_serde::shape_empty_batch_request::de_empty_batch_request_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidAddress" => crate::operation::send_message_batch::SendMessageBatchError::InvalidAddress({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidAddressBuilder::default();
output = crate::protocol_serde::shape_invalid_address::de_invalid_address_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AWS.SimpleQueueService.InvalidBatchEntryId" => crate::operation::send_message_batch::SendMessageBatchError::InvalidBatchEntryId({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidBatchEntryIdBuilder::default();
output = crate::protocol_serde::shape_invalid_batch_entry_id::de_invalid_batch_entry_id_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidSecurity" => crate::operation::send_message_batch::SendMessageBatchError::InvalidSecurity({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidSecurityBuilder::default();
output = crate::protocol_serde::shape_invalid_security::de_invalid_security_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.AccessDeniedException" => crate::operation::send_message_batch::SendMessageBatchError::KmsAccessDenied({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsAccessDeniedBuilder::default();
output = crate::protocol_serde::shape_kms_access_denied::de_kms_access_denied_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.DisabledException" => crate::operation::send_message_batch::SendMessageBatchError::KmsDisabled({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsDisabledBuilder::default();
output = crate::protocol_serde::shape_kms_disabled::de_kms_disabled_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.InvalidKeyUsageException" => crate::operation::send_message_batch::SendMessageBatchError::KmsInvalidKeyUsage({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsInvalidKeyUsageBuilder::default();
output = crate::protocol_serde::shape_kms_invalid_key_usage::de_kms_invalid_key_usage_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.InvalidStateException" => crate::operation::send_message_batch::SendMessageBatchError::KmsInvalidState({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsInvalidStateBuilder::default();
output = crate::protocol_serde::shape_kms_invalid_state::de_kms_invalid_state_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.NotFoundException" => crate::operation::send_message_batch::SendMessageBatchError::KmsNotFound({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsNotFoundBuilder::default();
output = crate::protocol_serde::shape_kms_not_found::de_kms_not_found_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.OptInRequired" => crate::operation::send_message_batch::SendMessageBatchError::KmsOptInRequired({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsOptInRequiredBuilder::default();
output = crate::protocol_serde::shape_kms_opt_in_required::de_kms_opt_in_required_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"KMS.ThrottlingException" => crate::operation::send_message_batch::SendMessageBatchError::KmsThrottled({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::KmsThrottledBuilder::default();
output = crate::protocol_serde::shape_kms_throttled::de_kms_throttled_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AWS.SimpleQueueService.NonExistentQueue" => crate::operation::send_message_batch::SendMessageBatchError::QueueDoesNotExist({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::QueueDoesNotExistBuilder::default();
output = crate::protocol_serde::shape_queue_does_not_exist::de_queue_does_not_exist_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"RequestThrottled" => crate::operation::send_message_batch::SendMessageBatchError::RequestThrottled({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::RequestThrottledBuilder::default();
output = crate::protocol_serde::shape_request_throttled::de_request_throttled_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AWS.SimpleQueueService.TooManyEntriesInBatchRequest" => {
crate::operation::send_message_batch::SendMessageBatchError::TooManyEntriesInBatchRequest({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::TooManyEntriesInBatchRequestBuilder::default();
output = crate::protocol_serde::shape_too_many_entries_in_batch_request::de_too_many_entries_in_batch_request_json_err(
_response_body,
output,
)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
})
}
"AWS.SimpleQueueService.UnsupportedOperation" => crate::operation::send_message_batch::SendMessageBatchError::UnsupportedOperation({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnsupportedOperationBuilder::default();
output = crate::protocol_serde::shape_unsupported_operation::de_unsupported_operation_json_err(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::send_message_batch::SendMessageBatchError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_send_message_batch_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<crate::operation::send_message_batch::SendMessageBatchOutput, crate::operation::send_message_batch::SendMessageBatchError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::send_message_batch::builders::SendMessageBatchOutputBuilder::default();
output = crate::protocol_serde::shape_send_message_batch::de_send_message_batch(_response_body, output)
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
crate::serde_util::send_message_batch_output_output_correct_errors(output)
.build()
.map_err(crate::operation::send_message_batch::SendMessageBatchError::unhandled)?
})
}
pub fn ser_send_message_batch_input(
input: &crate::operation::send_message_batch::SendMessageBatchInput,
) -> 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_send_message_batch_input::ser_send_message_batch_input_input(&mut object, input)?;
object.finish();
Ok(::aws_smithy_types::body::SdkBody::from(out))
}
pub(crate) fn de_send_message_batch(
value: &[u8],
mut builder: crate::operation::send_message_batch::builders::SendMessageBatchOutputBuilder,
) -> Result<crate::operation::send_message_batch::builders::SendMessageBatchOutputBuilder, ::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() {
"Successful" => {
builder = builder.set_successful(
crate::protocol_serde::shape_send_message_batch_result_entry_list::de_send_message_batch_result_entry_list(tokens)?,
);
}
"Failed" => {
builder =
builder.set_failed(crate::protocol_serde::shape_batch_result_error_entry_list::de_batch_result_error_entry_list(tokens)?);
}
_ => ::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)
}