aws_sdk_ec2/protocol_serde/
shape_ipam_address_history_record.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_ipam_address_history_record(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::IpamAddressHistoryRecord, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::IpamAddressHistoryRecord::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("resourceOwnerId") /* ResourceOwnerId com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceOwnerId */ =>  {
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_owner_id(var_1);
21            }
22            ,
23            s if s.matches("resourceRegion") /* ResourceRegion com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceRegion */ =>  {
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_resource_region(var_2);
34            }
35            ,
36            s if s.matches("resourceType") /* ResourceType com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceType */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<crate::types::IpamAddressHistoryResourceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            crate::types::IpamAddressHistoryResourceType::from(
41                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            )
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_resource_type(var_3);
48            }
49            ,
50            s if s.matches("resourceId") /* ResourceId com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceId */ =>  {
51                let var_4 =
52                    Some(
53                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
54                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            .into()
56                        )
57                        ?
58                    )
59                ;
60                builder = builder.set_resource_id(var_4);
61            }
62            ,
63            s if s.matches("resourceCidr") /* ResourceCidr com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceCidr */ =>  {
64                let var_5 =
65                    Some(
66                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
67                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68                            .into()
69                        )
70                        ?
71                    )
72                ;
73                builder = builder.set_resource_cidr(var_5);
74            }
75            ,
76            s if s.matches("resourceName") /* ResourceName com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceName */ =>  {
77                let var_6 =
78                    Some(
79                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
80                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
81                            .into()
82                        )
83                        ?
84                    )
85                ;
86                builder = builder.set_resource_name(var_6);
87            }
88            ,
89            s if s.matches("resourceComplianceStatus") /* ResourceComplianceStatus com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceComplianceStatus */ =>  {
90                let var_7 =
91                    Some(
92                        Result::<crate::types::IpamComplianceStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
93                            crate::types::IpamComplianceStatus::from(
94                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
95                            )
96                        )
97                        ?
98                    )
99                ;
100                builder = builder.set_resource_compliance_status(var_7);
101            }
102            ,
103            s if s.matches("resourceOverlapStatus") /* ResourceOverlapStatus com.amazonaws.ec2#IpamAddressHistoryRecord$ResourceOverlapStatus */ =>  {
104                let var_8 =
105                    Some(
106                        Result::<crate::types::IpamOverlapStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
107                            crate::types::IpamOverlapStatus::from(
108                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
109                            )
110                        )
111                        ?
112                    )
113                ;
114                builder = builder.set_resource_overlap_status(var_8);
115            }
116            ,
117            s if s.matches("vpcId") /* VpcId com.amazonaws.ec2#IpamAddressHistoryRecord$VpcId */ =>  {
118                let var_9 =
119                    Some(
120                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
121                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
122                            .into()
123                        )
124                        ?
125                    )
126                ;
127                builder = builder.set_vpc_id(var_9);
128            }
129            ,
130            s if s.matches("sampledStartTime") /* SampledStartTime com.amazonaws.ec2#IpamAddressHistoryRecord$SampledStartTime */ =>  {
131                let var_10 =
132                    Some(
133                        ::aws_smithy_types::DateTime::from_str(
134                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
135                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
136                        )
137                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
138                        ?
139                    )
140                ;
141                builder = builder.set_sampled_start_time(var_10);
142            }
143            ,
144            s if s.matches("sampledEndTime") /* SampledEndTime com.amazonaws.ec2#IpamAddressHistoryRecord$SampledEndTime */ =>  {
145                let var_11 =
146                    Some(
147                        ::aws_smithy_types::DateTime::from_str(
148                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
149                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
150                        )
151                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
152                        ?
153                    )
154                ;
155                builder = builder.set_sampled_end_time(var_11);
156            }
157            ,
158            _ => {}
159        }
160    }
161    Ok(builder.build())
162}