aws-sdk-s3control 1.119.0

AWS SDK for AWS S3 Control
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_storage_lens_configuration(
    input: &crate::types::StorageLensConfiguration,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    {
        let mut inner_writer = scope.start_el("Id").finish();
        inner_writer.data(input.id.as_str());
    }
    if let Some(var_1) = &input.account_level {
        let inner_writer = scope.start_el("AccountLevel");
        crate::protocol_serde::shape_account_level::ser_account_level(var_1, inner_writer)?
    }
    if let Some(var_2) = &input.include {
        let inner_writer = scope.start_el("Include");
        crate::protocol_serde::shape_include::ser_include(var_2, inner_writer)?
    }
    if let Some(var_3) = &input.exclude {
        let inner_writer = scope.start_el("Exclude");
        crate::protocol_serde::shape_exclude::ser_exclude(var_3, inner_writer)?
    }
    if let Some(var_4) = &input.data_export {
        let inner_writer = scope.start_el("DataExport");
        crate::protocol_serde::shape_storage_lens_data_export::ser_storage_lens_data_export(var_4, inner_writer)?
    }
    if let Some(var_5) = &input.expanded_prefixes_data_export {
        let inner_writer = scope.start_el("ExpandedPrefixesDataExport");
        crate::protocol_serde::shape_storage_lens_expanded_prefixes_data_export::ser_storage_lens_expanded_prefixes_data_export(var_5, inner_writer)?
    }
    {
        let mut inner_writer = scope.start_el("IsEnabled").finish();
        inner_writer.data(::aws_smithy_types::primitive::Encoder::from(input.is_enabled).encode());
    }
    if let Some(var_6) = &input.aws_org {
        let inner_writer = scope.start_el("AwsOrg");
        crate::protocol_serde::shape_storage_lens_aws_org::ser_storage_lens_aws_org(var_6, inner_writer)?
    }
    if let Some(var_7) = &input.storage_lens_arn {
        let mut inner_writer = scope.start_el("StorageLensArn").finish();
        inner_writer.data(var_7.as_str());
    }
    if let Some(var_8) = &input.prefix_delimiter {
        let mut inner_writer = scope.start_el("PrefixDelimiter").finish();
        inner_writer.data(var_8.as_str());
    }
    scope.finish();
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_storage_lens_configuration(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
    depth: u32,
) -> ::std::result::Result<crate::types::StorageLensConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
    if depth >= 128u32 {
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("maximum nesting depth exceeded"));
    }
    #[allow(unused_mut)]
    let mut builder = crate::types::StorageLensConfiguration::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("Id") /* Id com.amazonaws.s3control#StorageLensConfiguration$Id */ =>  {
                let var_9 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_id(var_9);
            }
            ,
            s if s.matches("AccountLevel") /* AccountLevel com.amazonaws.s3control#StorageLensConfiguration$AccountLevel */ =>  {
                let var_10 =
                    Some(
                        crate::protocol_serde::shape_account_level::de_account_level(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_account_level(var_10);
            }
            ,
            s if s.matches("Include") /* Include com.amazonaws.s3control#StorageLensConfiguration$Include */ =>  {
                let var_11 =
                    Some(
                        crate::protocol_serde::shape_include::de_include(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_include(var_11);
            }
            ,
            s if s.matches("Exclude") /* Exclude com.amazonaws.s3control#StorageLensConfiguration$Exclude */ =>  {
                let var_12 =
                    Some(
                        crate::protocol_serde::shape_exclude::de_exclude(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_exclude(var_12);
            }
            ,
            s if s.matches("DataExport") /* DataExport com.amazonaws.s3control#StorageLensConfiguration$DataExport */ =>  {
                let var_13 =
                    Some(
                        crate::protocol_serde::shape_storage_lens_data_export::de_storage_lens_data_export(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_data_export(var_13);
            }
            ,
            s if s.matches("ExpandedPrefixesDataExport") /* ExpandedPrefixesDataExport com.amazonaws.s3control#StorageLensConfiguration$ExpandedPrefixesDataExport */ =>  {
                let var_14 =
                    Some(
                        crate::protocol_serde::shape_storage_lens_expanded_prefixes_data_export::de_storage_lens_expanded_prefixes_data_export(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_expanded_prefixes_data_export(var_14);
            }
            ,
            s if s.matches("IsEnabled") /* IsEnabled com.amazonaws.s3control#StorageLensConfiguration$IsEnabled */ =>  {
                let var_15 =
                    Some(
                         {
                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3control#IsEnabled`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_is_enabled(var_15);
            }
            ,
            s if s.matches("AwsOrg") /* AwsOrg com.amazonaws.s3control#StorageLensConfiguration$AwsOrg */ =>  {
                let var_16 =
                    Some(
                        crate::protocol_serde::shape_storage_lens_aws_org::de_storage_lens_aws_org(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_aws_org(var_16);
            }
            ,
            s if s.matches("StorageLensArn") /* StorageLensArn com.amazonaws.s3control#StorageLensConfiguration$StorageLensArn */ =>  {
                let var_17 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_storage_lens_arn(var_17);
            }
            ,
            s if s.matches("PrefixDelimiter") /* PrefixDelimiter com.amazonaws.s3control#StorageLensConfiguration$PrefixDelimiter */ =>  {
                let var_18 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_prefix_delimiter(var_18);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::storage_lens_configuration_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}