aws_sdk_ec2/protocol_serde/
shape_capacity_block_extension.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_capacity_block_extension(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::CapacityBlockExtension, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::CapacityBlockExtension::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("capacityReservationId") => {
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_capacity_reservation_id(var_1);
21 }
22 ,
23 s if s.matches("instanceType") => {
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_instance_type(var_2);
34 }
35 ,
36 s if s.matches("instanceCount") => {
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_instance_count(var_3);
49 }
50 ,
51 s if s.matches("availabilityZone") => {
52 let var_4 =
53 Some(
54 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56 .into()
57 )
58 ?
59 )
60 ;
61 builder = builder.set_availability_zone(var_4);
62 }
63 ,
64 s if s.matches("availabilityZoneId") => {
65 let var_5 =
66 Some(
67 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69 .into()
70 )
71 ?
72 )
73 ;
74 builder = builder.set_availability_zone_id(var_5);
75 }
76 ,
77 s if s.matches("capacityBlockExtensionOfferingId") => {
78 let var_6 =
79 Some(
80 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
81 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82 .into()
83 )
84 ?
85 )
86 ;
87 builder = builder.set_capacity_block_extension_offering_id(var_6);
88 }
89 ,
90 s if s.matches("capacityBlockExtensionDurationHours") => {
91 let var_7 =
92 Some(
93 {
94 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
95 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96 )
97 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
98 }
99 ?
100 )
101 ;
102 builder = builder.set_capacity_block_extension_duration_hours(var_7);
103 }
104 ,
105 s if s.matches("capacityBlockExtensionStatus") => {
106 let var_8 =
107 Some(
108 Result::<crate::types::CapacityBlockExtensionStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
109 crate::types::CapacityBlockExtensionStatus::from(
110 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
111 )
112 )
113 ?
114 )
115 ;
116 builder = builder.set_capacity_block_extension_status(var_8);
117 }
118 ,
119 s if s.matches("capacityBlockExtensionPurchaseDate") => {
120 let var_9 =
121 Some(
122 ::aws_smithy_types::DateTime::from_str(
123 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
124 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
125 )
126 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
127 ?
128 )
129 ;
130 builder = builder.set_capacity_block_extension_purchase_date(var_9);
131 }
132 ,
133 s if s.matches("capacityBlockExtensionStartDate") => {
134 let var_10 =
135 Some(
136 ::aws_smithy_types::DateTime::from_str(
137 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
138 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
139 )
140 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
141 ?
142 )
143 ;
144 builder = builder.set_capacity_block_extension_start_date(var_10);
145 }
146 ,
147 s if s.matches("capacityBlockExtensionEndDate") => {
148 let var_11 =
149 Some(
150 ::aws_smithy_types::DateTime::from_str(
151 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
152 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
153 )
154 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
155 ?
156 )
157 ;
158 builder = builder.set_capacity_block_extension_end_date(var_11);
159 }
160 ,
161 s if s.matches("upfrontFee") => {
162 let var_12 =
163 Some(
164 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
165 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
166 .into()
167 )
168 ?
169 )
170 ;
171 builder = builder.set_upfront_fee(var_12);
172 }
173 ,
174 s if s.matches("currencyCode") => {
175 let var_13 =
176 Some(
177 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
178 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
179 .into()
180 )
181 ?
182 )
183 ;
184 builder = builder.set_currency_code(var_13);
185 }
186 ,
187 _ => {}
188 }
189 }
190 Ok(builder.build())
191}