pub fn ser_inline_redaction_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::InlineRedactionConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
let mut array_1 = object.key("inlineRedactionPatterns").start_array();
for item_2 in &input.inline_redaction_patterns {
{
#[allow(unused_mut)]
let mut object_3 = array_1.value().start_object();
crate::protocol_serde::shape_inline_redaction_pattern::ser_inline_redaction_pattern(&mut object_3, item_2)?;
object_3.finish();
}
}
array_1.finish();
}
if let Some(var_4) = &input.global_enforced_urls {
let mut array_5 = object.key("globalEnforcedUrls").start_array();
for item_6 in var_4 {
{
array_5.value().string(item_6.as_str());
}
}
array_5.finish();
}
if let Some(var_7) = &input.global_exempt_urls {
let mut array_8 = object.key("globalExemptUrls").start_array();
for item_9 in var_7 {
{
array_8.value().string(item_9.as_str());
}
}
array_8.finish();
}
if let Some(var_10) = &input.global_confidence_level {
object.key("globalConfidenceLevel").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_10).into()),
);
}
Ok(())
}
pub(crate) fn de_inline_redaction_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::InlineRedactionConfiguration>, ::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::InlineRedactionConfigurationBuilder::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() {
"inlineRedactionPatterns" => {
builder = builder.set_inline_redaction_patterns(
crate::protocol_serde::shape_inline_redaction_patterns::de_inline_redaction_patterns(tokens, _value)?,
);
}
"globalEnforcedUrls" => {
builder = builder.set_global_enforced_urls(
crate::protocol_serde::shape_global_inline_redaction_urls::de_global_inline_redaction_urls(tokens, _value)?,
);
}
"globalExemptUrls" => {
builder = builder.set_global_exempt_urls(
crate::protocol_serde::shape_global_inline_redaction_urls::de_global_inline_redaction_urls(tokens, _value)?,
);
}
"globalConfidenceLevel" => {
builder = builder.set_global_confidence_level(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
_ => ::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::inline_redaction_configuration_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",
)),
}
}