pub fn ser_network_configuration(
encoder: &mut ::aws_smithy_cbor::Encoder,
input: &crate::types::NetworkConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.map(1);
match input {
crate::types::NetworkConfiguration::PublicNetworkConfiguration(inner) => {
encoder.str("PublicNetworkConfiguration");
crate::protocol_serde::shape_public_network_configuration::ser_public_network_configuration(encoder, inner)?;
}
crate::types::NetworkConfiguration::PrivateNetworkConfiguration(inner) => {
encoder.str("PrivateNetworkConfiguration");
crate::protocol_serde::shape_private_network_configuration::ser_private_network_configuration(encoder, inner)?;
}
crate::types::NetworkConfiguration::Unknown => {
return ::std::result::Result::Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
"NetworkConfiguration",
))
}
}
::std::result::Result::Ok(())
}
pub(crate) fn de_network_configuration(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::NetworkConfiguration, ::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::NetworkConfiguration, ::aws_smithy_cbor::decode::DeserializeError> {
Ok(match decoder.str()?.as_ref() {
"PublicNetworkConfiguration" => crate::types::NetworkConfiguration::PublicNetworkConfiguration(
crate::protocol_serde::shape_public_network_configuration::de_public_network_configuration(decoder, depth + 1)?,
),
"PrivateNetworkConfiguration" => crate::types::NetworkConfiguration::PrivateNetworkConfiguration(
crate::protocol_serde::shape_private_network_configuration::de_private_network_configuration(decoder, depth + 1)?,
),
_ => {
decoder.skip()?;
crate::types::NetworkConfiguration::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())),
}
}