pub fn ser_change_set_operation(
encoder: &mut ::aws_smithy_cbor::Encoder,
input: &crate::types::ChangeSetOperation,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.map(1);
match input {
crate::types::ChangeSetOperation::Put(inner) => {
encoder.str("put");
crate::protocol_serde::shape_put_operation::ser_put_operation(encoder, inner)?;
}
crate::types::ChangeSetOperation::Update(inner) => {
encoder.str("update");
crate::protocol_serde::shape_update_operation::ser_update_operation(encoder, inner)?;
}
crate::types::ChangeSetOperation::Delete(inner) => {
encoder.str("delete");
crate::protocol_serde::shape_delete_operation::ser_delete_operation(encoder, inner)?;
}
crate::types::ChangeSetOperation::Unknown => {
return ::std::result::Result::Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
"ChangeSetOperation",
))
}
}
::std::result::Result::Ok(())
}
pub(crate) fn de_change_set_operation(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::ChangeSetOperation, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(unused_variables)]
fn pair(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::ChangeSetOperation, ::aws_smithy_cbor::decode::DeserializeError> {
Ok(match decoder.str()?.as_ref() {
"put" => crate::types::ChangeSetOperation::Put(crate::protocol_serde::shape_put_operation::de_put_operation(decoder, depth + 1)?),
"update" => {
crate::types::ChangeSetOperation::Update(crate::protocol_serde::shape_update_operation::de_update_operation(decoder, depth + 1)?)
}
"delete" => {
crate::types::ChangeSetOperation::Delete(crate::protocol_serde::shape_delete_operation::de_delete_operation(decoder, depth + 1)?)
}
_ => {
decoder.skip()?;
crate::types::ChangeSetOperation::Unknown
}
})
}
match decoder.map()? {
None => {
let variant = pair(decoder, depth)?;
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
Ok(variant)
}
ty => Err(::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
ty,
decoder.position(),
)),
}
}
Some(1) => pair(decoder, depth),
Some(_) => Err(::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position())),
}
}