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