aws_sdk_s3/protocol_serde/
shape_analytics_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_analytics_configuration(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::AnalyticsConfiguration, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::AnalyticsConfiguration::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("Id") /* Id com.amazonaws.s3#AnalyticsConfiguration$Id */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15                            .into()
16                        )
17                        ?
18                    )
19                ;
20                builder = builder.set_id(var_1);
21            }
22            ,
23            s if s.matches("Filter") /* Filter com.amazonaws.s3#AnalyticsConfiguration$Filter */ =>  {
24                let var_2 =
25                    Some(
26                        crate::protocol_serde::shape_analytics_filter::de_analytics_filter(&mut tag)
27                        ?
28                    )
29                ;
30                builder = builder.set_filter(var_2);
31            }
32            ,
33            s if s.matches("StorageClassAnalysis") /* StorageClassAnalysis com.amazonaws.s3#AnalyticsConfiguration$StorageClassAnalysis */ =>  {
34                let var_3 =
35                    Some(
36                        crate::protocol_serde::shape_storage_class_analysis::de_storage_class_analysis(&mut tag)
37                        ?
38                    )
39                ;
40                builder = builder.set_storage_class_analysis(var_3);
41            }
42            ,
43            _ => {}
44        }
45    }
46    Ok(crate::serde_util::analytics_configuration_correct_errors(builder)
47        .build()
48        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
49}
50
51pub fn ser_analytics_configuration(
52    input: &crate::types::AnalyticsConfiguration,
53    writer: ::aws_smithy_xml::encode::ElWriter,
54) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
55    #[allow(unused_mut)]
56    let mut scope = writer.finish();
57    {
58        let mut inner_writer = scope.start_el("Id").finish();
59        inner_writer.data(input.id.as_str());
60    }
61    if let Some(var_4) = &input.filter {
62        let inner_writer = scope.start_el("Filter");
63        crate::protocol_serde::shape_analytics_filter::ser_analytics_filter(var_4, inner_writer)?
64    }
65    if let Some(var_5) = &input.storage_class_analysis {
66        let inner_writer = scope.start_el("StorageClassAnalysis");
67        crate::protocol_serde::shape_storage_class_analysis::ser_storage_class_analysis(var_5, inner_writer)?
68    }
69    scope.finish();
70    Ok(())
71}