aws_sdk_s3/protocol_serde/
shape_noncurrent_version_transition.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_noncurrent_version_transition(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::NoncurrentVersionTransition, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::NoncurrentVersionTransition::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("NoncurrentDays") /* NoncurrentDays com.amazonaws.s3#NoncurrentVersionTransition$NoncurrentDays */ =>  {
                let var_1 =
                    Some(
                         {
                            <i32 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 (integer: `com.amazonaws.s3#Days`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_noncurrent_days(var_1);
            }
            ,
            s if s.matches("StorageClass") /* StorageClass com.amazonaws.s3#NoncurrentVersionTransition$StorageClass */ =>  {
                let var_2 =
                    Some(
                        Result::<crate::types::TransitionStorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::TransitionStorageClass::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_storage_class(var_2);
            }
            ,
            s if s.matches("NewerNoncurrentVersions") /* NewerNoncurrentVersions com.amazonaws.s3#NoncurrentVersionTransition$NewerNoncurrentVersions */ =>  {
                let var_3 =
                    Some(
                         {
                            <i32 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 (integer: `com.amazonaws.s3#VersionCount`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_newer_noncurrent_versions(var_3);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}

pub fn ser_noncurrent_version_transition(
    input: &crate::types::NoncurrentVersionTransition,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    if let Some(var_4) = &input.noncurrent_days {
        let mut inner_writer = scope.start_el("NoncurrentDays").finish();
        inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_4).encode());
    }
    if let Some(var_5) = &input.storage_class {
        let mut inner_writer = scope.start_el("StorageClass").finish();
        inner_writer.data(var_5.as_str());
    }
    if let Some(var_6) = &input.newer_noncurrent_versions {
        let mut inner_writer = scope.start_el("NewerNoncurrentVersions").finish();
        inner_writer.data(::aws_smithy_types::primitive::Encoder::from(*var_6).encode());
    }
    scope.finish();
    Ok(())
}