aws_sdk_ec2/protocol_serde/
shape_fleet_data.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_fleet_data(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::FleetData, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::FleetData::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("activityStatus") => {
11 let var_1 =
12 Some(
13 Result::<crate::types::FleetActivityStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14 crate::types::FleetActivityStatus::from(
15 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16 )
17 )
18 ?
19 )
20 ;
21 builder = builder.set_activity_status(var_1);
22 }
23 ,
24 s if s.matches("createTime") => {
25 let var_2 =
26 Some(
27 ::aws_smithy_types::DateTime::from_str(
28 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
30 )
31 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
32 ?
33 )
34 ;
35 builder = builder.set_create_time(var_2);
36 }
37 ,
38 s if s.matches("fleetId") => {
39 let var_3 =
40 Some(
41 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43 .into()
44 )
45 ?
46 )
47 ;
48 builder = builder.set_fleet_id(var_3);
49 }
50 ,
51 s if s.matches("fleetState") => {
52 let var_4 =
53 Some(
54 Result::<crate::types::FleetStateCode, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55 crate::types::FleetStateCode::from(
56 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
57 )
58 )
59 ?
60 )
61 ;
62 builder = builder.set_fleet_state(var_4);
63 }
64 ,
65 s if s.matches("clientToken") => {
66 let var_5 =
67 Some(
68 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
69 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
70 .into()
71 )
72 ?
73 )
74 ;
75 builder = builder.set_client_token(var_5);
76 }
77 ,
78 s if s.matches("excessCapacityTerminationPolicy") => {
79 let var_6 =
80 Some(
81 Result::<crate::types::FleetExcessCapacityTerminationPolicy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
82 crate::types::FleetExcessCapacityTerminationPolicy::from(
83 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
84 )
85 )
86 ?
87 )
88 ;
89 builder = builder.set_excess_capacity_termination_policy(var_6);
90 }
91 ,
92 s if s.matches("fulfilledCapacity") => {
93 let var_7 =
94 Some(
95 {
96 <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
97 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
98 )
99 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (double: `com.amazonaws.ec2#Double`)"))
100 }
101 ?
102 )
103 ;
104 builder = builder.set_fulfilled_capacity(var_7);
105 }
106 ,
107 s if s.matches("fulfilledOnDemandCapacity") => {
108 let var_8 =
109 Some(
110 {
111 <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
112 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
113 )
114 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (double: `com.amazonaws.ec2#Double`)"))
115 }
116 ?
117 )
118 ;
119 builder = builder.set_fulfilled_on_demand_capacity(var_8);
120 }
121 ,
122 s if s.matches("launchTemplateConfigs") => {
123 let var_9 =
124 Some(
125 crate::protocol_serde::shape_fleet_launch_template_config_list::de_fleet_launch_template_config_list(&mut tag)
126 ?
127 )
128 ;
129 builder = builder.set_launch_template_configs(var_9);
130 }
131 ,
132 s if s.matches("targetCapacitySpecification") => {
133 let var_10 =
134 Some(
135 crate::protocol_serde::shape_target_capacity_specification::de_target_capacity_specification(&mut tag)
136 ?
137 )
138 ;
139 builder = builder.set_target_capacity_specification(var_10);
140 }
141 ,
142 s if s.matches("terminateInstancesWithExpiration") => {
143 let var_11 =
144 Some(
145 {
146 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
147 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
148 )
149 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
150 }
151 ?
152 )
153 ;
154 builder = builder.set_terminate_instances_with_expiration(var_11);
155 }
156 ,
157 s if s.matches("type") => {
158 let var_12 =
159 Some(
160 Result::<crate::types::FleetType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
161 crate::types::FleetType::from(
162 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
163 )
164 )
165 ?
166 )
167 ;
168 builder = builder.set_type(var_12);
169 }
170 ,
171 s if s.matches("validFrom") => {
172 let var_13 =
173 Some(
174 ::aws_smithy_types::DateTime::from_str(
175 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
176 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
177 )
178 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
179 ?
180 )
181 ;
182 builder = builder.set_valid_from(var_13);
183 }
184 ,
185 s if s.matches("validUntil") => {
186 let var_14 =
187 Some(
188 ::aws_smithy_types::DateTime::from_str(
189 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
190 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
191 )
192 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
193 ?
194 )
195 ;
196 builder = builder.set_valid_until(var_14);
197 }
198 ,
199 s if s.matches("replaceUnhealthyInstances") => {
200 let var_15 =
201 Some(
202 {
203 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
204 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
205 )
206 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
207 }
208 ?
209 )
210 ;
211 builder = builder.set_replace_unhealthy_instances(var_15);
212 }
213 ,
214 s if s.matches("spotOptions") => {
215 let var_16 =
216 Some(
217 crate::protocol_serde::shape_spot_options::de_spot_options(&mut tag)
218 ?
219 )
220 ;
221 builder = builder.set_spot_options(var_16);
222 }
223 ,
224 s if s.matches("onDemandOptions") => {
225 let var_17 =
226 Some(
227 crate::protocol_serde::shape_on_demand_options::de_on_demand_options(&mut tag)
228 ?
229 )
230 ;
231 builder = builder.set_on_demand_options(var_17);
232 }
233 ,
234 s if s.matches("tagSet") => {
235 let var_18 =
236 Some(
237 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
238 ?
239 )
240 ;
241 builder = builder.set_tags(var_18);
242 }
243 ,
244 s if s.matches("errorSet") => {
245 let var_19 =
246 Some(
247 crate::protocol_serde::shape_describe_fleets_error_set::de_describe_fleets_error_set(&mut tag)
248 ?
249 )
250 ;
251 builder = builder.set_errors(var_19);
252 }
253 ,
254 s if s.matches("fleetInstanceSet") => {
255 let var_20 =
256 Some(
257 crate::protocol_serde::shape_describe_fleets_instances_set::de_describe_fleets_instances_set(&mut tag)
258 ?
259 )
260 ;
261 builder = builder.set_instances(var_20);
262 }
263 ,
264 s if s.matches("context") => {
265 let var_21 =
266 Some(
267 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
268 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
269 .into()
270 )
271 ?
272 )
273 ;
274 builder = builder.set_context(var_21);
275 }
276 ,
277 _ => {}
278 }
279 }
280 Ok(builder.build())
281}