aws-sdk-securityhub 1.110.0

AWS SDK for AWS SecurityHub
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_aws_cloud_front_distribution_details(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::AwsCloudFrontDistributionDetails,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.cache_behaviors {
        #[allow(unused_mut)]
        let mut object_2 = object.key("CacheBehaviors").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_cache_behaviors::ser_aws_cloud_front_distribution_cache_behaviors(
            &mut object_2,
            var_1,
        )?;
        object_2.finish();
    }
    if let Some(var_3) = &input.default_cache_behavior {
        #[allow(unused_mut)]
        let mut object_4 = object.key("DefaultCacheBehavior").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_default_cache_behavior::ser_aws_cloud_front_distribution_default_cache_behavior(
            &mut object_4,
            var_3,
        )?;
        object_4.finish();
    }
    if let Some(var_5) = &input.default_root_object {
        object.key("DefaultRootObject").string(var_5.as_str());
    }
    if let Some(var_6) = &input.domain_name {
        object.key("DomainName").string(var_6.as_str());
    }
    if let Some(var_7) = &input.e_tag {
        object.key("ETag").string(var_7.as_str());
    }
    if let Some(var_8) = &input.last_modified_time {
        object.key("LastModifiedTime").string(var_8.as_str());
    }
    if let Some(var_9) = &input.logging {
        #[allow(unused_mut)]
        let mut object_10 = object.key("Logging").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_logging::ser_aws_cloud_front_distribution_logging(&mut object_10, var_9)?;
        object_10.finish();
    }
    if let Some(var_11) = &input.origins {
        #[allow(unused_mut)]
        let mut object_12 = object.key("Origins").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_origins::ser_aws_cloud_front_distribution_origins(&mut object_12, var_11)?;
        object_12.finish();
    }
    if let Some(var_13) = &input.origin_groups {
        #[allow(unused_mut)]
        let mut object_14 = object.key("OriginGroups").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_origin_groups::ser_aws_cloud_front_distribution_origin_groups(
            &mut object_14,
            var_13,
        )?;
        object_14.finish();
    }
    if let Some(var_15) = &input.viewer_certificate {
        #[allow(unused_mut)]
        let mut object_16 = object.key("ViewerCertificate").start_object();
        crate::protocol_serde::shape_aws_cloud_front_distribution_viewer_certificate::ser_aws_cloud_front_distribution_viewer_certificate(
            &mut object_16,
            var_15,
        )?;
        object_16.finish();
    }
    if let Some(var_17) = &input.status {
        object.key("Status").string(var_17.as_str());
    }
    if let Some(var_18) = &input.web_acl_id {
        object.key("WebAclId").string(var_18.as_str());
    }
    Ok(())
}

pub(crate) fn de_aws_cloud_front_distribution_details<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::AwsCloudFrontDistributionDetails>, ::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::AwsCloudFrontDistributionDetailsBuilder::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() {
                        "CacheBehaviors" => {
                            builder = builder.set_cache_behaviors(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_cache_behaviors::de_aws_cloud_front_distribution_cache_behaviors(tokens, _value)?
                                );
                        }
                        "DefaultCacheBehavior" => {
                            builder = builder.set_default_cache_behavior(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_default_cache_behavior::de_aws_cloud_front_distribution_default_cache_behavior(tokens, _value)?
                                );
                        }
                        "DefaultRootObject" => {
                            builder = builder.set_default_root_object(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "DomainName" => {
                            builder = builder.set_domain_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ETag" => {
                            builder = builder.set_e_tag(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "LastModifiedTime" => {
                            builder = builder.set_last_modified_time(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "Logging" => {
                            builder = builder.set_logging(
                                crate::protocol_serde::shape_aws_cloud_front_distribution_logging::de_aws_cloud_front_distribution_logging(
                                    tokens, _value,
                                )?,
                            );
                        }
                        "Origins" => {
                            builder = builder.set_origins(
                                crate::protocol_serde::shape_aws_cloud_front_distribution_origins::de_aws_cloud_front_distribution_origins(
                                    tokens, _value,
                                )?,
                            );
                        }
                        "OriginGroups" => {
                            builder = builder.set_origin_groups(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_origin_groups::de_aws_cloud_front_distribution_origin_groups(tokens, _value)?
                                );
                        }
                        "ViewerCertificate" => {
                            builder = builder.set_viewer_certificate(
                                    crate::protocol_serde::shape_aws_cloud_front_distribution_viewer_certificate::de_aws_cloud_front_distribution_viewer_certificate(tokens, _value)?
                                );
                        }
                        "Status" => {
                            builder = builder.set_status(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "WebAclId" => {
                            builder = builder.set_web_acl_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .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(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}