pub fn ser_log_destination_config(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::LogDestinationConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("LogType").string(input.log_type.as_str());
}
{
object.key("LogDestinationType").string(input.log_destination_type.as_str());
}
{
#[allow(unused_mut)]
let mut object_1 = object.key("LogDestination").start_object();
for (key_2, value_3) in &input.log_destination {
{
object_1.key(key_2.as_str()).string(value_3.as_str());
}
}
object_1.finish();
}
Ok(())
}
pub(crate) fn de_log_destination_config<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::LogDestinationConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::LogDestinationConfigBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"LogType" => {
builder = builder.set_log_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::LogType::from(u.as_ref())))
.transpose()?,
);
}
"LogDestinationType" => {
builder = builder.set_log_destination_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::LogDestinationType::from(u.as_ref())))
.transpose()?,
);
}
"LogDestination" => {
builder = builder
.set_log_destination(crate::protocol_serde::shape_log_destination_map::de_log_destination_map(tokens, _value)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
}
Ok(Some(crate::serde_util::log_destination_config_correct_errors(builder).build().map_err(
|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
)?))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}