aws-sdk-imagebuilder 1.111.0

AWS SDK for EC2 Image Builder
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_image_scan_finding_aggregation<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::ImageScanFindingAggregation>, ::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::ImageScanFindingAggregationBuilder::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() {
                        "accountAggregation" => {
                            builder = builder
                                .set_account_aggregation(crate::protocol_serde::shape_account_aggregation::de_account_aggregation(tokens, _value)?);
                        }
                        "imageAggregation" => {
                            builder =
                                builder.set_image_aggregation(crate::protocol_serde::shape_image_aggregation::de_image_aggregation(tokens, _value)?);
                        }
                        "imagePipelineAggregation" => {
                            builder = builder.set_image_pipeline_aggregation(
                                crate::protocol_serde::shape_image_pipeline_aggregation::de_image_pipeline_aggregation(tokens, _value)?,
                            );
                        }
                        "vulnerabilityIdAggregation" => {
                            builder = builder.set_vulnerability_id_aggregation(
                                crate::protocol_serde::shape_vulnerability_id_aggregation::de_vulnerability_id_aggregation(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",
        )),
    }
}