aws_sdk_ec2/protocol_serde/
shape_image_usage_report_entry.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_image_usage_report_entry(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::ImageUsageReportEntry, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::ImageUsageReportEntry::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("resourceType") => {
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_resource_type(var_1);
21 }
22 ,
23 s if s.matches("reportId") => {
24 let var_2 =
25 Some(
26 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28 .into()
29 )
30 ?
31 )
32 ;
33 builder = builder.set_report_id(var_2);
34 }
35 ,
36 s if s.matches("usageCount") => {
37 let var_3 =
38 Some(
39 {
40 <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
41 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42 )
43 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.ec2#Long`)"))
44 }
45 ?
46 )
47 ;
48 builder = builder.set_usage_count(var_3);
49 }
50 ,
51 s if s.matches("accountId") => {
52 let var_4 =
53 Some(
54 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56 .into()
57 )
58 ?
59 )
60 ;
61 builder = builder.set_account_id(var_4);
62 }
63 ,
64 s if s.matches("imageId") => {
65 let var_5 =
66 Some(
67 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69 .into()
70 )
71 ?
72 )
73 ;
74 builder = builder.set_image_id(var_5);
75 }
76 ,
77 s if s.matches("reportCreationTime") => {
78 let var_6 =
79 Some(
80 ::aws_smithy_types::DateTime::from_str(
81 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
83 )
84 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
85 ?
86 )
87 ;
88 builder = builder.set_report_creation_time(var_6);
89 }
90 ,
91 _ => {}
92 }
93 }
94 Ok(builder.build())
95}