aws_sdk_s3/protocol_serde/
shape_destination.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_destination(
    input: &crate::types::Destination,
    writer: ::aws_smithy_xml::encode::ElWriter,
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope = writer.finish();
    {
        let mut inner_writer = scope.start_el("Bucket").finish();
        inner_writer.data(input.bucket.as_str());
    }
    if let Some(var_1) = &input.account {
        let mut inner_writer = scope.start_el("Account").finish();
        inner_writer.data(var_1.as_str());
    }
    if let Some(var_2) = &input.storage_class {
        let mut inner_writer = scope.start_el("StorageClass").finish();
        inner_writer.data(var_2.as_str());
    }
    if let Some(var_3) = &input.access_control_translation {
        let inner_writer = scope.start_el("AccessControlTranslation");
        crate::protocol_serde::shape_access_control_translation::ser_access_control_translation(var_3, inner_writer)?
    }
    if let Some(var_4) = &input.encryption_configuration {
        let inner_writer = scope.start_el("EncryptionConfiguration");
        crate::protocol_serde::shape_encryption_configuration::ser_encryption_configuration(var_4, inner_writer)?
    }
    if let Some(var_5) = &input.replication_time {
        let inner_writer = scope.start_el("ReplicationTime");
        crate::protocol_serde::shape_replication_time::ser_replication_time(var_5, inner_writer)?
    }
    if let Some(var_6) = &input.metrics {
        let inner_writer = scope.start_el("Metrics");
        crate::protocol_serde::shape_metrics::ser_metrics(var_6, inner_writer)?
    }
    scope.finish();
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_destination(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::types::Destination, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::Destination::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("Bucket") /* Bucket com.amazonaws.s3#Destination$Bucket */ =>  {
                let var_7 =
                    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_bucket(var_7);
            }
            ,
            s if s.matches("Account") /* Account com.amazonaws.s3#Destination$Account */ =>  {
                let var_8 =
                    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_account(var_8);
            }
            ,
            s if s.matches("StorageClass") /* StorageClass com.amazonaws.s3#Destination$StorageClass */ =>  {
                let var_9 =
                    Some(
                        Result::<crate::types::StorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::StorageClass::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_storage_class(var_9);
            }
            ,
            s if s.matches("AccessControlTranslation") /* AccessControlTranslation com.amazonaws.s3#Destination$AccessControlTranslation */ =>  {
                let var_10 =
                    Some(
                        crate::protocol_serde::shape_access_control_translation::de_access_control_translation(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_access_control_translation(var_10);
            }
            ,
            s if s.matches("EncryptionConfiguration") /* EncryptionConfiguration com.amazonaws.s3#Destination$EncryptionConfiguration */ =>  {
                let var_11 =
                    Some(
                        crate::protocol_serde::shape_encryption_configuration::de_encryption_configuration(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_encryption_configuration(var_11);
            }
            ,
            s if s.matches("ReplicationTime") /* ReplicationTime com.amazonaws.s3#Destination$ReplicationTime */ =>  {
                let var_12 =
                    Some(
                        crate::protocol_serde::shape_replication_time::de_replication_time(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_replication_time(var_12);
            }
            ,
            s if s.matches("Metrics") /* Metrics com.amazonaws.s3#Destination$Metrics */ =>  {
                let var_13 =
                    Some(
                        crate::protocol_serde::shape_metrics::de_metrics(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_metrics(var_13);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::destination_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}