pub fn ser_kms_key_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::KmsKeyConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.key_policies {
#[allow(unused_mut)]
let mut object_2 = object.key("keyPolicies").start_object();
for (key_3, value_4) in var_1 {
{
object_2.key(key_3.as_str()).string(value_4.as_str());
}
}
object_2.finish();
}
if let Some(var_5) = &input.grants {
let mut array_6 = object.key("grants").start_array();
for item_7 in var_5 {
{
#[allow(unused_mut)]
let mut object_8 = array_6.value().start_object();
crate::protocol_serde::shape_kms_grant_configuration::ser_kms_grant_configuration(&mut object_8, item_7)?;
object_8.finish();
}
}
array_6.finish();
}
Ok(())
}
pub(crate) fn de_kms_key_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::KmsKeyConfiguration>, ::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::KmsKeyConfigurationBuilder::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() {
"keyPolicies" => {
builder = builder.set_key_policies(crate::protocol_serde::shape_kms_key_policies_map::de_kms_key_policies_map(
tokens, _value,
)?);
}
"grants" => {
builder = builder.set_grants(
crate::protocol_serde::shape_kms_grant_configurations_list::de_kms_grant_configurations_list(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(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}