pub(crate) fn de_security_hub_policy<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::SecurityHubPolicy>, ::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::SecurityHubPolicyBuilder::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() {
"ServiceEnabled" => {
builder = builder.set_service_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"EnabledStandardIdentifiers" => {
builder = builder.set_enabled_standard_identifiers(
crate::protocol_serde::shape_enabled_standard_identifier_list::de_enabled_standard_identifier_list(tokens, _value)?,
);
}
"SecurityControlsConfiguration" => {
builder = builder.set_security_controls_configuration(
crate::protocol_serde::shape_security_controls_configuration::de_security_controls_configuration(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",
)),
}
}
pub fn ser_security_hub_policy(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::SecurityHubPolicy,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.service_enabled {
object.key("ServiceEnabled").boolean(*var_1);
}
if let Some(var_2) = &input.enabled_standard_identifiers {
let mut array_3 = object.key("EnabledStandardIdentifiers").start_array();
for item_4 in var_2 {
{
array_3.value().string(item_4.as_str());
}
}
array_3.finish();
}
if let Some(var_5) = &input.security_controls_configuration {
#[allow(unused_mut)]
let mut object_6 = object.key("SecurityControlsConfiguration").start_object();
crate::protocol_serde::shape_security_controls_configuration::ser_security_controls_configuration(&mut object_6, var_5)?;
object_6.finish();
}
Ok(())
}