aws_sdk_s3/protocol_serde/
shape_object.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_object(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Object, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Object::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("Key") /* Key com.amazonaws.s3#Object$Key */ =>  {
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_key(var_1);
21            }
22            ,
23            s if s.matches("LastModified") /* LastModified com.amazonaws.s3#Object$LastModified */ =>  {
24                let var_2 =
25                    Some(
26                        ::aws_smithy_types::DateTime::from_str(
27                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
29                        )
30                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.s3#LastModified`)"))
31                        ?
32                    )
33                ;
34                builder = builder.set_last_modified(var_2);
35            }
36            ,
37            s if s.matches("ETag") /* ETag com.amazonaws.s3#Object$ETag */ =>  {
38                let var_3 =
39                    Some(
40                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            .into()
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_e_tag(var_3);
48            }
49            ,
50            s if s.matches("ChecksumAlgorithm") /* ChecksumAlgorithm com.amazonaws.s3#Object$ChecksumAlgorithm */ =>  {
51                let var_4 =
52                    Some(
53                        Result::<::std::vec::Vec::<crate::types::ChecksumAlgorithm>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
54                            let mut list_5 = builder.checksum_algorithm.take().unwrap_or_default();
55                            list_5.push(
56                                Result::<crate::types::ChecksumAlgorithm, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
57                                    crate::types::ChecksumAlgorithm::from(
58                                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
59                                    )
60                                )
61                                ?
62                            );
63                            list_5
64                        })
65                        ?
66                    )
67                ;
68                builder = builder.set_checksum_algorithm(var_4);
69            }
70            ,
71            s if s.matches("ChecksumType") /* ChecksumType com.amazonaws.s3#Object$ChecksumType */ =>  {
72                let var_6 =
73                    Some(
74                        Result::<crate::types::ChecksumType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
75                            crate::types::ChecksumType::from(
76                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
77                            )
78                        )
79                        ?
80                    )
81                ;
82                builder = builder.set_checksum_type(var_6);
83            }
84            ,
85            s if s.matches("Size") /* Size com.amazonaws.s3#Object$Size */ =>  {
86                let var_7 =
87                    Some(
88                         {
89                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
90                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
91                            )
92                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.s3#Size`)"))
93                        }
94                        ?
95                    )
96                ;
97                builder = builder.set_size(var_7);
98            }
99            ,
100            s if s.matches("StorageClass") /* StorageClass com.amazonaws.s3#Object$StorageClass */ =>  {
101                let var_8 =
102                    Some(
103                        Result::<crate::types::ObjectStorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
104                            crate::types::ObjectStorageClass::from(
105                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
106                            )
107                        )
108                        ?
109                    )
110                ;
111                builder = builder.set_storage_class(var_8);
112            }
113            ,
114            s if s.matches("Owner") /* Owner com.amazonaws.s3#Object$Owner */ =>  {
115                let var_9 =
116                    Some(
117                        crate::protocol_serde::shape_owner::de_owner(&mut tag)
118                        ?
119                    )
120                ;
121                builder = builder.set_owner(var_9);
122            }
123            ,
124            s if s.matches("RestoreStatus") /* RestoreStatus com.amazonaws.s3#Object$RestoreStatus */ =>  {
125                let var_10 =
126                    Some(
127                        crate::protocol_serde::shape_restore_status::de_restore_status(&mut tag)
128                        ?
129                    )
130                ;
131                builder = builder.set_restore_status(var_10);
132            }
133            ,
134            _ => {}
135        }
136    }
137    Ok(builder.build())
138}