aws_sdk_ec2/protocol_serde/
shape_host.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_host(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Host, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Host::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("autoPlacement") /* AutoPlacement com.amazonaws.ec2#Host$AutoPlacement */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<crate::types::AutoPlacement, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            crate::types::AutoPlacement::from(
15                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16                            )
17                        )
18                        ?
19                    )
20                ;
21                builder = builder.set_auto_placement(var_1);
22            }
23            ,
24            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#Host$AvailabilityZone */ =>  {
25                let var_2 =
26                    Some(
27                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
28                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            .into()
30                        )
31                        ?
32                    )
33                ;
34                builder = builder.set_availability_zone(var_2);
35            }
36            ,
37            s if s.matches("availableCapacity") /* AvailableCapacity com.amazonaws.ec2#Host$AvailableCapacity */ =>  {
38                let var_3 =
39                    Some(
40                        crate::protocol_serde::shape_available_capacity::de_available_capacity(&mut tag)
41                        ?
42                    )
43                ;
44                builder = builder.set_available_capacity(var_3);
45            }
46            ,
47            s if s.matches("clientToken") /* ClientToken com.amazonaws.ec2#Host$ClientToken */ =>  {
48                let var_4 =
49                    Some(
50                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
51                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
52                            .into()
53                        )
54                        ?
55                    )
56                ;
57                builder = builder.set_client_token(var_4);
58            }
59            ,
60            s if s.matches("hostId") /* HostId com.amazonaws.ec2#Host$HostId */ =>  {
61                let var_5 =
62                    Some(
63                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
64                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
65                            .into()
66                        )
67                        ?
68                    )
69                ;
70                builder = builder.set_host_id(var_5);
71            }
72            ,
73            s if s.matches("hostProperties") /* HostProperties com.amazonaws.ec2#Host$HostProperties */ =>  {
74                let var_6 =
75                    Some(
76                        crate::protocol_serde::shape_host_properties::de_host_properties(&mut tag)
77                        ?
78                    )
79                ;
80                builder = builder.set_host_properties(var_6);
81            }
82            ,
83            s if s.matches("hostReservationId") /* HostReservationId com.amazonaws.ec2#Host$HostReservationId */ =>  {
84                let var_7 =
85                    Some(
86                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
87                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
88                            .into()
89                        )
90                        ?
91                    )
92                ;
93                builder = builder.set_host_reservation_id(var_7);
94            }
95            ,
96            s if s.matches("instances") /* Instances com.amazonaws.ec2#Host$Instances */ =>  {
97                let var_8 =
98                    Some(
99                        crate::protocol_serde::shape_host_instance_list::de_host_instance_list(&mut tag)
100                        ?
101                    )
102                ;
103                builder = builder.set_instances(var_8);
104            }
105            ,
106            s if s.matches("state") /* State com.amazonaws.ec2#Host$State */ =>  {
107                let var_9 =
108                    Some(
109                        Result::<crate::types::AllocationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
110                            crate::types::AllocationState::from(
111                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
112                            )
113                        )
114                        ?
115                    )
116                ;
117                builder = builder.set_state(var_9);
118            }
119            ,
120            s if s.matches("allocationTime") /* AllocationTime com.amazonaws.ec2#Host$AllocationTime */ =>  {
121                let var_10 =
122                    Some(
123                        ::aws_smithy_types::DateTime::from_str(
124                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
125                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
126                        )
127                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
128                        ?
129                    )
130                ;
131                builder = builder.set_allocation_time(var_10);
132            }
133            ,
134            s if s.matches("releaseTime") /* ReleaseTime com.amazonaws.ec2#Host$ReleaseTime */ =>  {
135                let var_11 =
136                    Some(
137                        ::aws_smithy_types::DateTime::from_str(
138                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
139                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
140                        )
141                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
142                        ?
143                    )
144                ;
145                builder = builder.set_release_time(var_11);
146            }
147            ,
148            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Host$Tags */ =>  {
149                let var_12 =
150                    Some(
151                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
152                        ?
153                    )
154                ;
155                builder = builder.set_tags(var_12);
156            }
157            ,
158            s if s.matches("hostRecovery") /* HostRecovery com.amazonaws.ec2#Host$HostRecovery */ =>  {
159                let var_13 =
160                    Some(
161                        Result::<crate::types::HostRecovery, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
162                            crate::types::HostRecovery::from(
163                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
164                            )
165                        )
166                        ?
167                    )
168                ;
169                builder = builder.set_host_recovery(var_13);
170            }
171            ,
172            s if s.matches("allowsMultipleInstanceTypes") /* AllowsMultipleInstanceTypes com.amazonaws.ec2#Host$AllowsMultipleInstanceTypes */ =>  {
173                let var_14 =
174                    Some(
175                        Result::<crate::types::AllowsMultipleInstanceTypes, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
176                            crate::types::AllowsMultipleInstanceTypes::from(
177                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
178                            )
179                        )
180                        ?
181                    )
182                ;
183                builder = builder.set_allows_multiple_instance_types(var_14);
184            }
185            ,
186            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#Host$OwnerId */ =>  {
187                let var_15 =
188                    Some(
189                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
190                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
191                            .into()
192                        )
193                        ?
194                    )
195                ;
196                builder = builder.set_owner_id(var_15);
197            }
198            ,
199            s if s.matches("availabilityZoneId") /* AvailabilityZoneId com.amazonaws.ec2#Host$AvailabilityZoneId */ =>  {
200                let var_16 =
201                    Some(
202                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
203                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
204                            .into()
205                        )
206                        ?
207                    )
208                ;
209                builder = builder.set_availability_zone_id(var_16);
210            }
211            ,
212            s if s.matches("memberOfServiceLinkedResourceGroup") /* MemberOfServiceLinkedResourceGroup com.amazonaws.ec2#Host$MemberOfServiceLinkedResourceGroup */ =>  {
213                let var_17 =
214                    Some(
215                         {
216                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
217                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
218                            )
219                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
220                        }
221                        ?
222                    )
223                ;
224                builder = builder.set_member_of_service_linked_resource_group(var_17);
225            }
226            ,
227            s if s.matches("outpostArn") /* OutpostArn com.amazonaws.ec2#Host$OutpostArn */ =>  {
228                let var_18 =
229                    Some(
230                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
231                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
232                            .into()
233                        )
234                        ?
235                    )
236                ;
237                builder = builder.set_outpost_arn(var_18);
238            }
239            ,
240            s if s.matches("hostMaintenance") /* HostMaintenance com.amazonaws.ec2#Host$HostMaintenance */ =>  {
241                let var_19 =
242                    Some(
243                        Result::<crate::types::HostMaintenance, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
244                            crate::types::HostMaintenance::from(
245                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
246                            )
247                        )
248                        ?
249                    )
250                ;
251                builder = builder.set_host_maintenance(var_19);
252            }
253            ,
254            s if s.matches("assetId") /* AssetId com.amazonaws.ec2#Host$AssetId */ =>  {
255                let var_20 =
256                    Some(
257                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
258                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
259                            .into()
260                        )
261                        ?
262                    )
263                ;
264                builder = builder.set_asset_id(var_20);
265            }
266            ,
267            _ => {}
268        }
269    }
270    Ok(builder.build())
271}