aws_sdk_ec2/protocol_serde/
shape_capacity_block_status.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_capacity_block_status(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::CapacityBlockStatus, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::CapacityBlockStatus::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("capacityBlockId") => {
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_block_id(var_1);
21 }
22 ,
23 s if s.matches("interconnectStatus") => {
24 let var_2 =
25 Some(
26 Result::<crate::types::CapacityBlockInterconnectStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27 crate::types::CapacityBlockInterconnectStatus::from(
28 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29 )
30 )
31 ?
32 )
33 ;
34 builder = builder.set_interconnect_status(var_2);
35 }
36 ,
37 s if s.matches("totalCapacity") => {
38 let var_3 =
39 Some(
40 {
41 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
42 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43 )
44 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
45 }
46 ?
47 )
48 ;
49 builder = builder.set_total_capacity(var_3);
50 }
51 ,
52 s if s.matches("totalAvailableCapacity") => {
53 let var_4 =
54 Some(
55 {
56 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
57 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
58 )
59 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
60 }
61 ?
62 )
63 ;
64 builder = builder.set_total_available_capacity(var_4);
65 }
66 ,
67 s if s.matches("totalUnavailableCapacity") => {
68 let var_5 =
69 Some(
70 {
71 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
72 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
73 )
74 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
75 }
76 ?
77 )
78 ;
79 builder = builder.set_total_unavailable_capacity(var_5);
80 }
81 ,
82 s if s.matches("capacityReservationStatusSet") => {
83 let var_6 =
84 Some(
85 crate::protocol_serde::shape_capacity_reservation_status_set::de_capacity_reservation_status_set(&mut tag)
86 ?
87 )
88 ;
89 builder = builder.set_capacity_reservation_statuses(var_6);
90 }
91 ,
92 _ => {}
93 }
94 }
95 Ok(builder.build())
96}