aws_sdk_ec2/protocol_serde/
shape_host_reservation.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_host_reservation(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::HostReservation, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::HostReservation::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("count") => {
11 let var_1 =
12 Some(
13 {
14 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
15 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16 )
17 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
18 }
19 ?
20 )
21 ;
22 builder = builder.set_count(var_1);
23 }
24 ,
25 s if s.matches("currencyCode") => {
26 let var_2 =
27 Some(
28 Result::<crate::types::CurrencyCodeValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
29 crate::types::CurrencyCodeValues::from(
30 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
31 )
32 )
33 ?
34 )
35 ;
36 builder = builder.set_currency_code(var_2);
37 }
38 ,
39 s if s.matches("duration") => {
40 let var_3 =
41 Some(
42 {
43 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
44 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
45 )
46 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
47 }
48 ?
49 )
50 ;
51 builder = builder.set_duration(var_3);
52 }
53 ,
54 s if s.matches("end") => {
55 let var_4 =
56 Some(
57 ::aws_smithy_types::DateTime::from_str(
58 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
59 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
60 )
61 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
62 ?
63 )
64 ;
65 builder = builder.set_end(var_4);
66 }
67 ,
68 s if s.matches("hostIdSet") => {
69 let var_5 =
70 Some(
71 crate::protocol_serde::shape_response_host_id_set::de_response_host_id_set(&mut tag)
72 ?
73 )
74 ;
75 builder = builder.set_host_id_set(var_5);
76 }
77 ,
78 s if s.matches("hostReservationId") => {
79 let var_6 =
80 Some(
81 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
82 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83 .into()
84 )
85 ?
86 )
87 ;
88 builder = builder.set_host_reservation_id(var_6);
89 }
90 ,
91 s if s.matches("hourlyPrice") => {
92 let var_7 =
93 Some(
94 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
95 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96 .into()
97 )
98 ?
99 )
100 ;
101 builder = builder.set_hourly_price(var_7);
102 }
103 ,
104 s if s.matches("instanceFamily") => {
105 let var_8 =
106 Some(
107 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
108 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
109 .into()
110 )
111 ?
112 )
113 ;
114 builder = builder.set_instance_family(var_8);
115 }
116 ,
117 s if s.matches("offeringId") => {
118 let var_9 =
119 Some(
120 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
121 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
122 .into()
123 )
124 ?
125 )
126 ;
127 builder = builder.set_offering_id(var_9);
128 }
129 ,
130 s if s.matches("paymentOption") => {
131 let var_10 =
132 Some(
133 Result::<crate::types::PaymentOption, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
134 crate::types::PaymentOption::from(
135 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
136 )
137 )
138 ?
139 )
140 ;
141 builder = builder.set_payment_option(var_10);
142 }
143 ,
144 s if s.matches("start") => {
145 let var_11 =
146 Some(
147 ::aws_smithy_types::DateTime::from_str(
148 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
149 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
150 )
151 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
152 ?
153 )
154 ;
155 builder = builder.set_start(var_11);
156 }
157 ,
158 s if s.matches("state") => {
159 let var_12 =
160 Some(
161 Result::<crate::types::ReservationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
162 crate::types::ReservationState::from(
163 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
164 )
165 )
166 ?
167 )
168 ;
169 builder = builder.set_state(var_12);
170 }
171 ,
172 s if s.matches("upfrontPrice") => {
173 let var_13 =
174 Some(
175 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
176 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
177 .into()
178 )
179 ?
180 )
181 ;
182 builder = builder.set_upfront_price(var_13);
183 }
184 ,
185 s if s.matches("tagSet") => {
186 let var_14 =
187 Some(
188 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
189 ?
190 )
191 ;
192 builder = builder.set_tags(var_14);
193 }
194 ,
195 _ => {}
196 }
197 }
198 Ok(builder.build())
199}