aws_sdk_ec2/protocol_serde/
shape_ipam.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(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Ipam, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Ipam::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#Ipam$OwnerId */ =>  {
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_owner_id(var_1);
21            }
22            ,
23            s if s.matches("ipamId") /* IpamId com.amazonaws.ec2#Ipam$IpamId */ =>  {
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_ipam_id(var_2);
34            }
35            ,
36            s if s.matches("ipamArn") /* IpamArn com.amazonaws.ec2#Ipam$IpamArn */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41                            .into()
42                        )
43                        ?
44                    )
45                ;
46                builder = builder.set_ipam_arn(var_3);
47            }
48            ,
49            s if s.matches("ipamRegion") /* IpamRegion com.amazonaws.ec2#Ipam$IpamRegion */ =>  {
50                let var_4 =
51                    Some(
52                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
53                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            .into()
55                        )
56                        ?
57                    )
58                ;
59                builder = builder.set_ipam_region(var_4);
60            }
61            ,
62            s if s.matches("publicDefaultScopeId") /* PublicDefaultScopeId com.amazonaws.ec2#Ipam$PublicDefaultScopeId */ =>  {
63                let var_5 =
64                    Some(
65                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
66                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
67                            .into()
68                        )
69                        ?
70                    )
71                ;
72                builder = builder.set_public_default_scope_id(var_5);
73            }
74            ,
75            s if s.matches("privateDefaultScopeId") /* PrivateDefaultScopeId com.amazonaws.ec2#Ipam$PrivateDefaultScopeId */ =>  {
76                let var_6 =
77                    Some(
78                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
79                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
80                            .into()
81                        )
82                        ?
83                    )
84                ;
85                builder = builder.set_private_default_scope_id(var_6);
86            }
87            ,
88            s if s.matches("scopeCount") /* ScopeCount com.amazonaws.ec2#Ipam$ScopeCount */ =>  {
89                let var_7 =
90                    Some(
91                         {
92                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
93                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
94                            )
95                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
96                        }
97                        ?
98                    )
99                ;
100                builder = builder.set_scope_count(var_7);
101            }
102            ,
103            s if s.matches("description") /* Description com.amazonaws.ec2#Ipam$Description */ =>  {
104                let var_8 =
105                    Some(
106                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
107                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
108                            .into()
109                        )
110                        ?
111                    )
112                ;
113                builder = builder.set_description(var_8);
114            }
115            ,
116            s if s.matches("operatingRegionSet") /* OperatingRegions com.amazonaws.ec2#Ipam$OperatingRegions */ =>  {
117                let var_9 =
118                    Some(
119                        crate::protocol_serde::shape_ipam_operating_region_set::de_ipam_operating_region_set(&mut tag)
120                        ?
121                    )
122                ;
123                builder = builder.set_operating_regions(var_9);
124            }
125            ,
126            s if s.matches("state") /* State com.amazonaws.ec2#Ipam$State */ =>  {
127                let var_10 =
128                    Some(
129                        Result::<crate::types::IpamState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
130                            crate::types::IpamState::from(
131                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
132                            )
133                        )
134                        ?
135                    )
136                ;
137                builder = builder.set_state(var_10);
138            }
139            ,
140            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Ipam$Tags */ =>  {
141                let var_11 =
142                    Some(
143                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
144                        ?
145                    )
146                ;
147                builder = builder.set_tags(var_11);
148            }
149            ,
150            s if s.matches("defaultResourceDiscoveryId") /* DefaultResourceDiscoveryId com.amazonaws.ec2#Ipam$DefaultResourceDiscoveryId */ =>  {
151                let var_12 =
152                    Some(
153                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
154                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
155                            .into()
156                        )
157                        ?
158                    )
159                ;
160                builder = builder.set_default_resource_discovery_id(var_12);
161            }
162            ,
163            s if s.matches("defaultResourceDiscoveryAssociationId") /* DefaultResourceDiscoveryAssociationId com.amazonaws.ec2#Ipam$DefaultResourceDiscoveryAssociationId */ =>  {
164                let var_13 =
165                    Some(
166                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
167                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
168                            .into()
169                        )
170                        ?
171                    )
172                ;
173                builder = builder.set_default_resource_discovery_association_id(var_13);
174            }
175            ,
176            s if s.matches("resourceDiscoveryAssociationCount") /* ResourceDiscoveryAssociationCount com.amazonaws.ec2#Ipam$ResourceDiscoveryAssociationCount */ =>  {
177                let var_14 =
178                    Some(
179                         {
180                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
181                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
182                            )
183                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
184                        }
185                        ?
186                    )
187                ;
188                builder = builder.set_resource_discovery_association_count(var_14);
189            }
190            ,
191            s if s.matches("stateMessage") /* StateMessage com.amazonaws.ec2#Ipam$StateMessage */ =>  {
192                let var_15 =
193                    Some(
194                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
195                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
196                            .into()
197                        )
198                        ?
199                    )
200                ;
201                builder = builder.set_state_message(var_15);
202            }
203            ,
204            s if s.matches("tier") /* Tier com.amazonaws.ec2#Ipam$Tier */ =>  {
205                let var_16 =
206                    Some(
207                        Result::<crate::types::IpamTier, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
208                            crate::types::IpamTier::from(
209                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
210                            )
211                        )
212                        ?
213                    )
214                ;
215                builder = builder.set_tier(var_16);
216            }
217            ,
218            s if s.matches("enablePrivateGua") /* EnablePrivateGua com.amazonaws.ec2#Ipam$EnablePrivateGua */ =>  {
219                let var_17 =
220                    Some(
221                         {
222                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
223                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
224                            )
225                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
226                        }
227                        ?
228                    )
229                ;
230                builder = builder.set_enable_private_gua(var_17);
231            }
232            ,
233            s if s.matches("meteredAccount") /* MeteredAccount com.amazonaws.ec2#Ipam$MeteredAccount */ =>  {
234                let var_18 =
235                    Some(
236                        Result::<crate::types::IpamMeteredAccount, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
237                            crate::types::IpamMeteredAccount::from(
238                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
239                            )
240                        )
241                        ?
242                    )
243                ;
244                builder = builder.set_metered_account(var_18);
245            }
246            ,
247            _ => {}
248        }
249    }
250    Ok(builder.build())
251}