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("productDescription") => {
125 let var_10 =
126 Some(
127 Result::<crate::types::RiProductDescription, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
128 crate::types::RiProductDescription::from(
129 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
130 )
131 )
132 ?
133 )
134 ;
135 builder = builder.set_product_description(var_10);
136 }
137 ,
138 s if s.matches("spotInstanceRequestId") => {
139 let var_11 =
140 Some(
141 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
142 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
143 .into()
144 )
145 ?
146 )
147 ;
148 builder = builder.set_spot_instance_request_id(var_11);
149 }
150 ,
151 s if s.matches("spotPrice") => {
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_price(var_12);
162 }
163 ,
164 s if s.matches("state") => {
165 let var_13 =
166 Some(
167 Result::<crate::types::SpotInstanceState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
168 crate::types::SpotInstanceState::from(
169 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
170 )
171 )
172 ?
173 )
174 ;
175 builder = builder.set_state(var_13);
176 }
177 ,
178 s if s.matches("status") => {
179 let var_14 =
180 Some(
181 crate::protocol_serde::shape_spot_instance_status::de_spot_instance_status(&mut tag)
182 ?
183 )
184 ;
185 builder = builder.set_status(var_14);
186 }
187 ,
188 s if s.matches("tagSet") => {
189 let var_15 =
190 Some(
191 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
192 ?
193 )
194 ;
195 builder = builder.set_tags(var_15);
196 }
197 ,
198 s if s.matches("type") => {
199 let var_16 =
200 Some(
201 Result::<crate::types::SpotInstanceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
202 crate::types::SpotInstanceType::from(
203 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
204 )
205 )
206 ?
207 )
208 ;
209 builder = builder.set_type(var_16);
210 }
211 ,
212 s if s.matches("validFrom") => {
213 let var_17 =
214 Some(
215 ::aws_smithy_types::DateTime::from_str(
216 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
217 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
218 )
219 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
220 ?
221 )
222 ;
223 builder = builder.set_valid_from(var_17);
224 }
225 ,
226 s if s.matches("validUntil") => {
227 let var_18 =
228 Some(
229 ::aws_smithy_types::DateTime::from_str(
230 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
231 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
232 )
233 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
234 ?
235 )
236 ;
237 builder = builder.set_valid_until(var_18);
238 }
239 ,
240 s if s.matches("instanceInterruptionBehavior") => {
241 let var_19 =
242 Some(
243 Result::<crate::types::InstanceInterruptionBehavior, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
244 crate::types::InstanceInterruptionBehavior::from(
245 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
246 )
247 )
248 ?
249 )
250 ;
251 builder = builder.set_instance_interruption_behavior(var_19);
252 }
253 ,
254 _ => {}
255 }
256 }
257 Ok(builder.build())
258}