#[allow(clippy::unnecessary_wraps)]
pub fn de_create_matchmaking_rule_set_http_error(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetOutput,
crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError,
> {
#[allow(unused_mut)]
let mut generic_builder = crate::cbor_errors::parse_error_metadata(_response_status, _response_headers, _response_body)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::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::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled(
generic,
))
}
};
let _error_message = generic.message().map(|msg| msg.to_owned());
Err(match error_code {
"InternalServiceException" => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::InternalServiceException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InternalServiceExceptionBuilder::default();
output = crate::protocol_serde::shape_internal_service_exception::de_internal_service_exception_cbor_err(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"InvalidRequestException" => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::InvalidRequestException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_cbor_err(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"LimitExceededException" => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::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_cbor_err(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"TaggingFailedException" => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::TaggingFailedException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::TaggingFailedExceptionBuilder::default();
output = crate::protocol_serde::shape_tagging_failed_exception::de_tagging_failed_exception_cbor_err(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
"UnsupportedRegionException" => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::UnsupportedRegionException({
#[allow(unused_mut)]
let mut tmp = {
#[allow(unused_mut)]
let mut output = crate::types::error::builders::UnsupportedRegionExceptionBuilder::default();
output = crate::protocol_serde::shape_unsupported_region_exception::de_unsupported_region_exception_cbor_err(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
let output = output.meta(generic);
output.build()
};
if tmp.message.is_none() {
tmp.message = _error_message;
}
tmp
}),
_ => crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::generic(generic),
})
}
#[allow(clippy::unnecessary_wraps)]
pub fn de_create_matchmaking_rule_set_http_response(
_response_status: u16,
_response_headers: &::aws_smithy_runtime_api::http::Headers,
_response_body: &[u8],
) -> std::result::Result<
crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetOutput,
crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError,
> {
Ok({
#[allow(unused_mut)]
let mut output = crate::operation::create_matchmaking_rule_set::builders::CreateMatchmakingRuleSetOutputBuilder::default();
output = crate::protocol_serde::shape_create_matchmaking_rule_set::de_create_matchmaking_rule_set(_response_body, output)
.map_err(crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetError::unhandled)?;
output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
crate::serde_util::create_matchmaking_rule_set_output_output_correct_errors(output).build()
})
}
pub fn ser_create_matchmaking_rule_set_input(
input: &crate::operation::create_matchmaking_rule_set::CreateMatchmakingRuleSetInput,
) -> ::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_create_matchmaking_rule_set_input::ser_create_matchmaking_rule_set_input_input(encoder, input)?;
}
Ok(::aws_smithy_types::body::SdkBody::from(encoder.into_writer()))
}
pub(crate) fn de_create_matchmaking_rule_set(
value: &[u8],
mut builder: crate::operation::create_matchmaking_rule_set::builders::CreateMatchmakingRuleSetOutputBuilder,
) -> ::std::result::Result<
crate::operation::create_matchmaking_rule_set::builders::CreateMatchmakingRuleSetOutputBuilder,
::aws_smithy_cbor::decode::DeserializeError,
> {
#[allow(clippy::match_single_binding, unused_variables)]
fn pair(
mut builder: crate::operation::create_matchmaking_rule_set::builders::CreateMatchmakingRuleSetOutputBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<
crate::operation::create_matchmaking_rule_set::builders::CreateMatchmakingRuleSetOutputBuilder,
::aws_smithy_cbor::decode::DeserializeError,
> {
builder = match decoder.str()?.as_ref() {
"RuleSet" => builder.set_rule_set(Some(crate::protocol_serde::shape_matchmaking_rule_set::de_matchmaking_rule_set(
decoder,
depth + 1,
)?)),
_ => {
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)
}