aws_sdk_ec2/protocol_serde/
shape_spot_instance_request.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_spot_instance_request(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::SpotInstanceRequest, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::SpotInstanceRequest::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("actualBlockHourlyPrice") => {
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_actual_block_hourly_price(var_1);
21 }
22 ,
23 s if s.matches("availabilityZoneGroup") => {
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_availability_zone_group(var_2);
34 }
35 ,
36 s if s.matches("blockDurationMinutes") => {
37 let var_3 =
38 Some(
39 {
40 <i32 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 (integer: `com.amazonaws.ec2#Integer`)"))
44 }
45 ?
46 )
47 ;
48 builder = builder.set_block_duration_minutes(var_3);
49 }
50 ,
51 s if s.matches("createTime") => {
52 let var_4 =
53 Some(
54 ::aws_smithy_types::DateTime::from_str(
55 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
57 )
58 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
59 ?
60 )
61 ;
62 builder = builder.set_create_time(var_4);
63 }
64 ,
65 s if s.matches("fault") => {
66 let var_5 =
67 Some(
68 crate::protocol_serde::shape_spot_instance_state_fault::de_spot_instance_state_fault(&mut tag)
69 ?
70 )
71 ;
72 builder = builder.set_fault(var_5);
73 }
74 ,
75 s if s.matches("instanceId") => {
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_instance_id(var_6);
86 }
87 ,
88 s if s.matches("launchGroup") => {
89 let var_7 =
90 Some(
91 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
92 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
93 .into()
94 )
95 ?
96 )
97 ;
98 builder = builder.set_launch_group(var_7);
99 }
100 ,
101 s if s.matches("launchSpecification") => {
102 let var_8 =
103 Some(
104 crate::protocol_serde::shape_launch_specification::de_launch_specification(&mut tag)
105 ?
106 )
107 ;
108 builder = builder.set_launch_specification(var_8);
109 }
110 ,
111 s if s.matches("launchedAvailabilityZone") => {
112 let var_9 =
113 Some(
114 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
115 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
116 .into()
117 )
118 ?
119 )
120 ;
121 builder = builder.set_launched_availability_zone(var_9);
122 }
123 ,
124 s if s.matches("launchedAvailabilityZoneId") => {
125 let var_10 =
126 Some(
127 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
128 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
129 .into()
130 )
131 ?
132 )
133 ;
134 builder = builder.set_launched_availability_zone_id(var_10);
135 }
136 ,
137 s if s.matches("productDescription") => {
138 let var_11 =
139 Some(
140 Result::<crate::types::RiProductDescription, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
141 crate::types::RiProductDescription::from(
142 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
143 )
144 )
145 ?
146 )
147 ;
148 builder = builder.set_product_description(var_11);
149 }
150 ,
151 s if s.matches("spotInstanceRequestId") => {
152 let var_12 =
153 Some(
154 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
155 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
156 .into()
157 )
158 ?
159 )
160 ;
161 builder = builder.set_spot_instance_request_id(var_12);
162 }
163 ,
164 s if s.matches("spotPrice") => {
165 let var_13 =
166 Some(
167 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
168 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
169 .into()
170 )
171 ?
172 )
173 ;
174 builder = builder.set_spot_price(var_13);
175 }
176 ,
177 s if s.matches("state") => {
178 let var_14 =
179 Some(
180 Result::<crate::types::SpotInstanceState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
181 crate::types::SpotInstanceState::from(
182 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
183 )
184 )
185 ?
186 )
187 ;
188 builder = builder.set_state(var_14);
189 }
190 ,
191 s if s.matches("status") => {
192 let var_15 =
193 Some(
194 crate::protocol_serde::shape_spot_instance_status::de_spot_instance_status(&mut tag)
195 ?
196 )
197 ;
198 builder = builder.set_status(var_15);
199 }
200 ,
201 s if s.matches("tagSet") => {
202 let var_16 =
203 Some(
204 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
205 ?
206 )
207 ;
208 builder = builder.set_tags(var_16);
209 }
210 ,
211 s if s.matches("type") => {
212 let var_17 =
213 Some(
214 Result::<crate::types::SpotInstanceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
215 crate::types::SpotInstanceType::from(
216 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
217 )
218 )
219 ?
220 )
221 ;
222 builder = builder.set_type(var_17);
223 }
224 ,
225 s if s.matches("validFrom") => {
226 let var_18 =
227 Some(
228 ::aws_smithy_types::DateTime::from_str(
229 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
230 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
231 )
232 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
233 ?
234 )
235 ;
236 builder = builder.set_valid_from(var_18);
237 }
238 ,
239 s if s.matches("validUntil") => {
240 let var_19 =
241 Some(
242 ::aws_smithy_types::DateTime::from_str(
243 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
244 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
245 )
246 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
247 ?
248 )
249 ;
250 builder = builder.set_valid_until(var_19);
251 }
252 ,
253 s if s.matches("instanceInterruptionBehavior") => {
254 let var_20 =
255 Some(
256 Result::<crate::types::InstanceInterruptionBehavior, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
257 crate::types::InstanceInterruptionBehavior::from(
258 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
259 )
260 )
261 ?
262 )
263 ;
264 builder = builder.set_instance_interruption_behavior(var_20);
265 }
266 ,
267 _ => {}
268 }
269 }
270 Ok(builder.build())
271}