aws-sdk-glue 1.58.0

AWS SDK for AWS Glue
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_encryption_configuration(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::EncryptionConfiguration,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.s3_encryption {
        let mut array_2 = object.key("S3Encryption").start_array();
        for item_3 in var_1 {
            {
                #[allow(unused_mut)]
                let mut object_4 = array_2.value().start_object();
                crate::protocol_serde::shape_s3_encryption::ser_s3_encryption(&mut object_4, item_3)?;
                object_4.finish();
            }
        }
        array_2.finish();
    }
    if let Some(var_5) = &input.cloud_watch_encryption {
        #[allow(unused_mut)]
        let mut object_6 = object.key("CloudWatchEncryption").start_object();
        crate::protocol_serde::shape_cloud_watch_encryption::ser_cloud_watch_encryption(&mut object_6, var_5)?;
        object_6.finish();
    }
    if let Some(var_7) = &input.job_bookmarks_encryption {
        #[allow(unused_mut)]
        let mut object_8 = object.key("JobBookmarksEncryption").start_object();
        crate::protocol_serde::shape_job_bookmarks_encryption::ser_job_bookmarks_encryption(&mut object_8, var_7)?;
        object_8.finish();
    }
    Ok(())
}

pub(crate) fn de_encryption_configuration<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> Result<Option<crate::types::EncryptionConfiguration>, ::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::EncryptionConfigurationBuilder::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() {
                        "S3Encryption" => {
                            builder = builder.set_s3_encryption(crate::protocol_serde::shape_s3_encryption_list::de_s3_encryption_list(tokens)?);
                        }
                        "CloudWatchEncryption" => {
                            builder = builder
                                .set_cloud_watch_encryption(crate::protocol_serde::shape_cloud_watch_encryption::de_cloud_watch_encryption(tokens)?);
                        }
                        "JobBookmarksEncryption" => {
                            builder = builder.set_job_bookmarks_encryption(
                                crate::protocol_serde::shape_job_bookmarks_encryption::de_job_bookmarks_encryption(tokens)?,
                            );
                        }
                        _ => ::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",
        )),
    }
}