aws_sdk_s3/protocol_serde/
shape_object_version.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_object_version(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> 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("Size") => {
45 let var_4 =
46 Some(
47 {
48 <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
49 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
50 )
51 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.s3#Size`)"))
52 }
53 ?
54 )
55 ;
56 builder = builder.set_size(var_4);
57 }
58 ,
59 s if s.matches("StorageClass") => {
60 let var_5 =
61 Some(
62 Result::<crate::types::ObjectVersionStorageClass, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
63 crate::types::ObjectVersionStorageClass::from(
64 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
65 )
66 )
67 ?
68 )
69 ;
70 builder = builder.set_storage_class(var_5);
71 }
72 ,
73 s if s.matches("Key") => {
74 let var_6 =
75 Some(
76 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
77 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
78 .into()
79 )
80 ?
81 )
82 ;
83 builder = builder.set_key(var_6);
84 }
85 ,
86 s if s.matches("VersionId") => {
87 let var_7 =
88 Some(
89 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
90 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
91 .into()
92 )
93 ?
94 )
95 ;
96 builder = builder.set_version_id(var_7);
97 }
98 ,
99 s if s.matches("IsLatest") => {
100 let var_8 =
101 Some(
102 {
103 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
104 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
105 )
106 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.s3#IsLatest`)"))
107 }
108 ?
109 )
110 ;
111 builder = builder.set_is_latest(var_8);
112 }
113 ,
114 s if s.matches("LastModified") => {
115 let var_9 =
116 Some(
117 ::aws_smithy_types::DateTime::from_str(
118 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
119 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
120 )
121 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.s3#LastModified`)"))
122 ?
123 )
124 ;
125 builder = builder.set_last_modified(var_9);
126 }
127 ,
128 s if s.matches("Owner") => {
129 let var_10 =
130 Some(
131 crate::protocol_serde::shape_owner::de_owner(&mut tag)
132 ?
133 )
134 ;
135 builder = builder.set_owner(var_10);
136 }
137 ,
138 s if s.matches("RestoreStatus") => {
139 let var_11 =
140 Some(
141 crate::protocol_serde::shape_restore_status::de_restore_status(&mut tag)
142 ?
143 )
144 ;
145 builder = builder.set_restore_status(var_11);
146 }
147 ,
148 _ => {}
149 }
150 }
151 Ok(builder.build())
152}