#[allow(clippy::unnecessary_wraps)]
pub fn de_update_event_bus_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
_cfg: &::aws_smithy_types::config_bag::ConfigBag,
) -> std::result::Result<crate::operation::update_event_bus::UpdateEventBusOutput, crate::operation::update_event_bus::UpdateEventBusError> {
#[allow(unused_mut)]
let mut generic_builder = crate::cbor_errors::parse_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::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_event_bus::UpdateEventBusError::unhandled(generic)),
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"ConcurrentModificationException" => crate::operation::update_event_bus::UpdateEventBusError::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_cbor_err(
_response_body,
output,
)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidStateException" => crate::operation::update_event_bus::UpdateEventBusError::InvalidStateException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidStateExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_state_exception::de_invalid_state_exception_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ResourceNotFoundException" => crate::operation::update_event_bus::UpdateEventBusError::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_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"AccessDeniedException" => crate::operation::update_event_bus::UpdateEventBusError::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_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InternalException" => crate::operation::update_event_bus::UpdateEventBusError::InternalException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
output = crate::protocol_serde::shape_internal_exception::de_internal_exception_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidInputException" => crate::operation::update_event_bus::UpdateEventBusError::InvalidInputException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidInputExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_input_exception::de_invalid_input_exception_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"ThrottlingException" => crate::operation::update_event_bus::UpdateEventBusError::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_cbor_err(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::update_event_bus::UpdateEventBusError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_update_event_bus_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
_cfg: &::aws_smithy_types::config_bag::ConfigBag,
) -> std::result::Result<crate::operation::update_event_bus::UpdateEventBusOutput, crate::operation::update_event_bus::UpdateEventBusError> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::update_event_bus::builders::UpdateEventBusOutputBuilder::default();
output = crate::protocol_serde::shape_update_event_bus::de_update_event_bus(_response_body, output)
.map_err(crate::operation::update_event_bus::UpdateEventBusError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
output.build()
})
}
pub fn ser_update_event_bus_input(
input: &crate::operation::update_event_bus::UpdateEventBusInput,
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
let mut encoder = ::aws_smithy_cbor::Encoder::new(Vec::new());
{
let encoder = &mut encoder;
crate::protocol_serde::shape_update_event_bus_input::ser_update_event_bus_input_input(encoder, input)?;
}
Ok(::aws_smithy_types::body::SdkBody::from(encoder.into_writer()))
}
pub(crate) fn de_update_event_bus(
value: &[u8],
mut builder: crate::operation::update_event_bus::builders::UpdateEventBusOutputBuilder,
) -> ::std::result::Result<crate::operation::update_event_bus::builders::UpdateEventBusOutputBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
#[allow(clippy::match_single_binding, unused_variables)]
fn pair(
mut builder: crate::operation::update_event_bus::builders::UpdateEventBusOutputBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::operation::update_event_bus::builders::UpdateEventBusOutputBuilder, ::aws_smithy_cbor::decode::DeserializeError>
{
builder = match decoder.str()?.as_ref() {
"EventBusArn" => {
::aws_smithy_cbor::decode::set_optional(
builder,
decoder,
|builder, decoder| Ok(builder.set_event_bus_arn(Some(decoder.string()?))),
)?
}
"Name" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_name(Some(decoder.string()?))))?,
"Description" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_description(Some(decoder.string()?))))?
}
"EncryptionConfiguration" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_encryption_configuration(Some(
crate::protocol_serde::shape_encryption_configuration::de_encryption_configuration(decoder, depth + 1)?,
)))
})?
}
"StorageConfiguration" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_storage_configuration(Some(
crate::protocol_serde::shape_storage_configuration_output::de_storage_configuration_output(decoder, depth + 1)?,
)))
})?,
"State" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_state(Some(decoder.string().map(|s| crate::types::BusState::from(s.as_str()))?)))
})?,
"StateReason" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_state_reason(Some(decoder.string()?))))?
}
"LastModifiedTime" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_last_modified_time(Some(decoder.timestamp()?)))
})?,
_ => {
decoder.skip()?;
builder
}
};
Ok(builder)
}
let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
#[allow(unused_variables)]
let depth = 0u32;
match decoder.map()? {
None => loop {
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
break;
}
_ => {
builder = pair(builder, decoder, depth)?;
}
};
},
Some(n) => {
for _ in 0..n {
builder = pair(builder, decoder, depth)?;
}
}
};
if decoder.position() != value.len() {
return Err(::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()));
}
Ok(builder)
}