aws_sdk_ec2/protocol_serde/
shape_on_demand_options.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_on_demand_options(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::OnDemandOptions, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::OnDemandOptions::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("allocationStrategy") => {
11 let var_1 =
12 Some(
13 Result::<crate::types::FleetOnDemandAllocationStrategy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14 crate::types::FleetOnDemandAllocationStrategy::from(
15 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16 )
17 )
18 ?
19 )
20 ;
21 builder = builder.set_allocation_strategy(var_1);
22 }
23 ,
24 s if s.matches("capacityReservationOptions") => {
25 let var_2 =
26 Some(
27 crate::protocol_serde::shape_capacity_reservation_options::de_capacity_reservation_options(&mut tag)
28 ?
29 )
30 ;
31 builder = builder.set_capacity_reservation_options(var_2);
32 }
33 ,
34 s if s.matches("singleInstanceType") => {
35 let var_3 =
36 Some(
37 {
38 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
39 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
40 )
41 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
42 }
43 ?
44 )
45 ;
46 builder = builder.set_single_instance_type(var_3);
47 }
48 ,
49 s if s.matches("singleAvailabilityZone") => {
50 let var_4 =
51 Some(
52 {
53 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
54 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55 )
56 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
57 }
58 ?
59 )
60 ;
61 builder = builder.set_single_availability_zone(var_4);
62 }
63 ,
64 s if s.matches("minTargetCapacity") => {
65 let var_5 =
66 Some(
67 {
68 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
69 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
70 )
71 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
72 }
73 ?
74 )
75 ;
76 builder = builder.set_min_target_capacity(var_5);
77 }
78 ,
79 s if s.matches("maxTotalPrice") => {
80 let var_6 =
81 Some(
82 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
83 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
84 .into()
85 )
86 ?
87 )
88 ;
89 builder = builder.set_max_total_price(var_6);
90 }
91 ,
92 _ => {}
93 }
94 }
95 Ok(builder.build())
96}