pub(crate) fn de_security_control_definition<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::SecurityControlDefinition>, ::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::SecurityControlDefinitionBuilder::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() {
"SecurityControlId" => {
builder = builder.set_security_control_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Title" => {
builder = builder.set_title(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Description" => {
builder = builder.set_description(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"RemediationUrl" => {
builder = builder.set_remediation_url(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"SeverityRating" => {
builder = builder.set_severity_rating(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::SeverityRating::from(u.as_ref())))
.transpose()?,
);
}
"CurrentRegionAvailability" => {
builder = builder.set_current_region_availability(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::RegionAvailabilityStatus::from(u.as_ref())))
.transpose()?,
);
}
"CustomizableProperties" => {
builder = builder.set_customizable_properties(
crate::protocol_serde::shape_customizable_properties::de_customizable_properties(tokens, _value)?,
);
}
"ParameterDefinitions" => {
builder = builder.set_parameter_definitions(
crate::protocol_serde::shape_parameter_definitions::de_parameter_definitions(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::security_control_definition_correct_errors(builder).build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}