aws_sdk_s3/protocol_serde/
shape_object_version.rs
1#[allow(clippy::needless_question_mark)]
3pub fn de_object_version(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::ObjectVersion, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::ObjectVersion::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("ETag") => {
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_e_tag(var_1);
21 }
22 ,
23 s if s.matches("ChecksumAlgorithm") => {
24 let var_2 =
25 Some(
26 Result::<::std::vec::Vec::<crate::types::ChecksumAlgorithm>, ::aws_smithy_xml::decode::XmlDecodeError>::Ok({
27 let mut list_3 = builder.checksum_algorithm.take().unwrap_or_default();
28 list_3.push(
29 Result::<crate::types::ChecksumAlgorithm, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
30 crate::types::ChecksumAlgorithm::from(
31 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
32 )
33 )
34 ?
35 );
36 list_3
37 })
38 ?
39 )
40 ;
41 builder = builder.set_checksum_algorithm(var_2);
42 }
43 ,
44 s if s.matches("ChecksumType") => {
45 let var_4 =
46 Some(
47 Result::<crate::types::ChecksumType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
48 crate::types::ChecksumType::from(
49 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
50 )
51 )
52 ?
53 )
54 ;
55 builder = builder.set_checksum_type(var_4);
56 }
57 ,
58 s if s.matches("Size") => {
59 let var_5 =
60 Some(
61 {
62 <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
63 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
64 )
65 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.s3#Size`)"))
66 }
67 ?
68 )
69 ;
70 builder = builder.set_size(var_5);
71 }
72 ,
73 s if s.matches("StorageClass") => {
74 let var_6 =
75 Some(
76 Result::<crate::types::ObjectVersionStorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
77 crate::types::ObjectVersionStorageClass::from(
78 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
79 )
80 )
81 ?
82 )
83 ;
84 builder = builder.set_storage_class(var_6);
85 }
86 ,
87 s if s.matches("Key") => {
88 let var_7 =
89 Some(
90 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
91 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
92 .into()
93 )
94 ?
95 )
96 ;
97 builder = builder.set_key(var_7);
98 }
99 ,
100 s if s.matches("VersionId") => {
101 let var_8 =
102 Some(
103 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
104 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
105 .into()
106 )
107 ?
108 )
109 ;
110 builder = builder.set_version_id(var_8);
111 }
112 ,
113 s if s.matches("IsLatest") => {
114 let var_9 =
115 Some(
116 {
117 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
118 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
119 )
120 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#IsLatest`)"))
121 }
122 ?
123 )
124 ;
125 builder = builder.set_is_latest(var_9);
126 }
127 ,
128 s if s.matches("LastModified") => {
129 let var_10 =
130 Some(
131 ::aws_smithy_types::DateTime::from_str(
132 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
133 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
134 )
135 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.s3#LastModified`)"))
136 ?
137 )
138 ;
139 builder = builder.set_last_modified(var_10);
140 }
141 ,
142 s if s.matches("Owner") => {
143 let var_11 =
144 Some(
145 crate::protocol_serde::shape_owner::de_owner(&mut tag)
146 ?
147 )
148 ;
149 builder = builder.set_owner(var_11);
150 }
151 ,
152 s if s.matches("RestoreStatus") => {
153 let var_12 =
154 Some(
155 crate::protocol_serde::shape_restore_status::de_restore_status(&mut tag)
156 ?
157 )
158 ;
159 builder = builder.set_restore_status(var_12);
160 }
161 ,
162 _ => {}
163 }
164 }
165 Ok(builder.build())
166}