aws_sdk_ec2/protocol_serde/
shape_spot_options.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_spot_options(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::SpotOptions, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::SpotOptions::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("allocationStrategy") /* AllocationStrategy com.amazonaws.ec2#SpotOptions$AllocationStrategy */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<crate::types::SpotAllocationStrategy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            crate::types::SpotAllocationStrategy::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("maintenanceStrategies") /* MaintenanceStrategies com.amazonaws.ec2#SpotOptions$MaintenanceStrategies */ =>  {
25                let var_2 =
26                    Some(
27                        crate::protocol_serde::shape_fleet_spot_maintenance_strategies::de_fleet_spot_maintenance_strategies(&mut tag)
28                        ?
29                    )
30                ;
31                builder = builder.set_maintenance_strategies(var_2);
32            }
33            ,
34            s if s.matches("instanceInterruptionBehavior") /* InstanceInterruptionBehavior com.amazonaws.ec2#SpotOptions$InstanceInterruptionBehavior */ =>  {
35                let var_3 =
36                    Some(
37                        Result::<crate::types::SpotInstanceInterruptionBehavior, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
38                            crate::types::SpotInstanceInterruptionBehavior::from(
39                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
40                            )
41                        )
42                        ?
43                    )
44                ;
45                builder = builder.set_instance_interruption_behavior(var_3);
46            }
47            ,
48            s if s.matches("instancePoolsToUseCount") /* InstancePoolsToUseCount com.amazonaws.ec2#SpotOptions$InstancePoolsToUseCount */ =>  {
49                let var_4 =
50                    Some(
51                         {
52                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
53                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            )
55                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
56                        }
57                        ?
58                    )
59                ;
60                builder = builder.set_instance_pools_to_use_count(var_4);
61            }
62            ,
63            s if s.matches("singleInstanceType") /* SingleInstanceType com.amazonaws.ec2#SpotOptions$SingleInstanceType */ =>  {
64                let var_5 =
65                    Some(
66                         {
67                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
68                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            )
70                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
71                        }
72                        ?
73                    )
74                ;
75                builder = builder.set_single_instance_type(var_5);
76            }
77            ,
78            s if s.matches("singleAvailabilityZone") /* SingleAvailabilityZone com.amazonaws.ec2#SpotOptions$SingleAvailabilityZone */ =>  {
79                let var_6 =
80                    Some(
81                         {
82                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
83                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
84                            )
85                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
86                        }
87                        ?
88                    )
89                ;
90                builder = builder.set_single_availability_zone(var_6);
91            }
92            ,
93            s if s.matches("minTargetCapacity") /* MinTargetCapacity com.amazonaws.ec2#SpotOptions$MinTargetCapacity */ =>  {
94                let var_7 =
95                    Some(
96                         {
97                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
98                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
99                            )
100                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
101                        }
102                        ?
103                    )
104                ;
105                builder = builder.set_min_target_capacity(var_7);
106            }
107            ,
108            s if s.matches("maxTotalPrice") /* MaxTotalPrice com.amazonaws.ec2#SpotOptions$MaxTotalPrice */ =>  {
109                let var_8 =
110                    Some(
111                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
112                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
113                            .into()
114                        )
115                        ?
116                    )
117                ;
118                builder = builder.set_max_total_price(var_8);
119            }
120            ,
121            _ => {}
122        }
123    }
124    Ok(builder.build())
125}