aws_sdk_ec2/protocol_serde/
shape_placement_group.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_placement_group(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::PlacementGroup, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::PlacementGroup::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("groupName") => {
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_group_name(var_1);
21 }
22 ,
23 s if s.matches("state") => {
24 let var_2 =
25 Some(
26 Result::<crate::types::PlacementGroupState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27 crate::types::PlacementGroupState::from(
28 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29 )
30 )
31 ?
32 )
33 ;
34 builder = builder.set_state(var_2);
35 }
36 ,
37 s if s.matches("strategy") => {
38 let var_3 =
39 Some(
40 Result::<crate::types::PlacementStrategy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41 crate::types::PlacementStrategy::from(
42 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43 )
44 )
45 ?
46 )
47 ;
48 builder = builder.set_strategy(var_3);
49 }
50 ,
51 s if s.matches("partitionCount") => {
52 let var_4 =
53 Some(
54 {
55 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
56 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
57 )
58 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
59 }
60 ?
61 )
62 ;
63 builder = builder.set_partition_count(var_4);
64 }
65 ,
66 s if s.matches("groupId") => {
67 let var_5 =
68 Some(
69 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
70 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
71 .into()
72 )
73 ?
74 )
75 ;
76 builder = builder.set_group_id(var_5);
77 }
78 ,
79 s if s.matches("tagSet") => {
80 let var_6 =
81 Some(
82 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
83 ?
84 )
85 ;
86 builder = builder.set_tags(var_6);
87 }
88 ,
89 s if s.matches("groupArn") => {
90 let var_7 =
91 Some(
92 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
93 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
94 .into()
95 )
96 ?
97 )
98 ;
99 builder = builder.set_group_arn(var_7);
100 }
101 ,
102 s if s.matches("spreadLevel") => {
103 let var_8 =
104 Some(
105 Result::<crate::types::SpreadLevel, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
106 crate::types::SpreadLevel::from(
107 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
108 )
109 )
110 ?
111 )
112 ;
113 builder = builder.set_spread_level(var_8);
114 }
115 ,
116 _ => {}
117 }
118 }
119 Ok(builder.build())
120}