pub fn ser_log_configuration(
encoder: &mut ::aws_smithy_cbor::Encoder,
#[allow(unused)] input: &crate::types::LogConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.begin_map();
if let Some(var_1) = &input.log_destination {
encoder.str("LogDestination").str(var_1.as_str());
}
if let Some(var_2) = &input.s3_bucket_name {
encoder.str("S3BucketName").str(var_2.as_str());
}
if let Some(var_3) = &input.log_group_arn {
encoder.str("LogGroupArn").str(var_3.as_str());
}
encoder.end();
Ok(())
}
pub(crate) fn de_log_configuration(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::LogConfiguration, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(clippy::match_single_binding, unused_variables)]
fn pair(
mut builder: crate::types::builders::LogConfigurationBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::builders::LogConfigurationBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
builder =
match decoder.str()?.as_ref() {
"LogDestination" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_log_destination(Some(decoder.string().map(|s| crate::types::LogDestination::from(s.as_ref()))?)))
})?,
"S3BucketName" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_s3_bucket_name(Some(decoder.string()?)))
})?,
"LogGroupArn" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_log_group_arn(Some(decoder.string()?)))
})?,
_ => {
decoder.skip()?;
builder
}
};
Ok(builder)
}
let mut builder = crate::types::builders::LogConfigurationBuilder::default();
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)?;
}
}
};
#[allow(clippy::needless_question_mark)]
{
return Ok(builder.build());
}
}