pub fn ser_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::Configuration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.classification {
object.key("Classification").string(var_1.as_str());
}
if let Some(var_2) = &input.configurations {
let mut array_3 = object.key("Configurations").start_array();
for item_4 in var_2 {
{
#[allow(unused_mut)]
let mut object_5 = array_3.value().start_object();
crate::protocol_serde::shape_configuration::ser_configuration(&mut object_5, item_4)?;
object_5.finish();
}
}
array_3.finish();
}
if let Some(var_6) = &input.properties {
#[allow(unused_mut)]
let mut object_7 = object.key("Properties").start_object();
for (key_8, value_9) in var_6 {
{
object_7.key(key_8.as_str()).string(value_9.as_str());
}
}
object_7.finish();
}
Ok(())
}
pub(crate) fn de_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::Configuration>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
if depth >= 128u32 {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"maximum nesting depth exceeded",
));
}
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::ConfigurationBuilder::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() {
"Classification" => {
builder = builder.set_classification(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Configurations" => {
builder = builder.set_configurations(crate::protocol_serde::shape_configuration_list::de_configuration_list(
tokens,
_value,
depth + 1,
)?);
}
"Properties" => {
builder = builder.set_properties(crate::protocol_serde::shape_string_map::de_string_map(tokens, _value, depth + 1)?);
}
_ => ::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(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}