aws_sdk_ec2/protocol_serde/
shape_scheduled_instance_availability.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_scheduled_instance_availability(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::ScheduledInstanceAvailability, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::ScheduledInstanceAvailability::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#ScheduledInstanceAvailability$AvailabilityZone */ =>  {
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_availability_zone(var_1);
21            }
22            ,
23            s if s.matches("availableInstanceCount") /* AvailableInstanceCount com.amazonaws.ec2#ScheduledInstanceAvailability$AvailableInstanceCount */ =>  {
24                let var_2 =
25                    Some(
26                         {
27                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
28                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            )
30                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
31                        }
32                        ?
33                    )
34                ;
35                builder = builder.set_available_instance_count(var_2);
36            }
37            ,
38            s if s.matches("firstSlotStartTime") /* FirstSlotStartTime com.amazonaws.ec2#ScheduledInstanceAvailability$FirstSlotStartTime */ =>  {
39                let var_3 =
40                    Some(
41                        ::aws_smithy_types::DateTime::from_str(
42                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
44                        )
45                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
46                        ?
47                    )
48                ;
49                builder = builder.set_first_slot_start_time(var_3);
50            }
51            ,
52            s if s.matches("hourlyPrice") /* HourlyPrice com.amazonaws.ec2#ScheduledInstanceAvailability$HourlyPrice */ =>  {
53                let var_4 =
54                    Some(
55                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
56                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
57                            .into()
58                        )
59                        ?
60                    )
61                ;
62                builder = builder.set_hourly_price(var_4);
63            }
64            ,
65            s if s.matches("instanceType") /* InstanceType com.amazonaws.ec2#ScheduledInstanceAvailability$InstanceType */ =>  {
66                let var_5 =
67                    Some(
68                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
69                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
70                            .into()
71                        )
72                        ?
73                    )
74                ;
75                builder = builder.set_instance_type(var_5);
76            }
77            ,
78            s if s.matches("maxTermDurationInDays") /* MaxTermDurationInDays com.amazonaws.ec2#ScheduledInstanceAvailability$MaxTermDurationInDays */ =>  {
79                let var_6 =
80                    Some(
81                         {
82                            <i32 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 (integer: `com.amazonaws.ec2#Integer`)"))
86                        }
87                        ?
88                    )
89                ;
90                builder = builder.set_max_term_duration_in_days(var_6);
91            }
92            ,
93            s if s.matches("minTermDurationInDays") /* MinTermDurationInDays com.amazonaws.ec2#ScheduledInstanceAvailability$MinTermDurationInDays */ =>  {
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_term_duration_in_days(var_7);
106            }
107            ,
108            s if s.matches("networkPlatform") /* NetworkPlatform com.amazonaws.ec2#ScheduledInstanceAvailability$NetworkPlatform */ =>  {
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_network_platform(var_8);
119            }
120            ,
121            s if s.matches("platform") /* Platform com.amazonaws.ec2#ScheduledInstanceAvailability$Platform */ =>  {
122                let var_9 =
123                    Some(
124                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
125                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
126                            .into()
127                        )
128                        ?
129                    )
130                ;
131                builder = builder.set_platform(var_9);
132            }
133            ,
134            s if s.matches("purchaseToken") /* PurchaseToken com.amazonaws.ec2#ScheduledInstanceAvailability$PurchaseToken */ =>  {
135                let var_10 =
136                    Some(
137                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
138                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
139                            .into()
140                        )
141                        ?
142                    )
143                ;
144                builder = builder.set_purchase_token(var_10);
145            }
146            ,
147            s if s.matches("recurrence") /* Recurrence com.amazonaws.ec2#ScheduledInstanceAvailability$Recurrence */ =>  {
148                let var_11 =
149                    Some(
150                        crate::protocol_serde::shape_scheduled_instance_recurrence::de_scheduled_instance_recurrence(&mut tag)
151                        ?
152                    )
153                ;
154                builder = builder.set_recurrence(var_11);
155            }
156            ,
157            s if s.matches("slotDurationInHours") /* SlotDurationInHours com.amazonaws.ec2#ScheduledInstanceAvailability$SlotDurationInHours */ =>  {
158                let var_12 =
159                    Some(
160                         {
161                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
162                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
163                            )
164                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
165                        }
166                        ?
167                    )
168                ;
169                builder = builder.set_slot_duration_in_hours(var_12);
170            }
171            ,
172            s if s.matches("totalScheduledInstanceHours") /* TotalScheduledInstanceHours com.amazonaws.ec2#ScheduledInstanceAvailability$TotalScheduledInstanceHours */ =>  {
173                let var_13 =
174                    Some(
175                         {
176                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
177                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
178                            )
179                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
180                        }
181                        ?
182                    )
183                ;
184                builder = builder.set_total_scheduled_instance_hours(var_13);
185            }
186            ,
187            _ => {}
188        }
189    }
190    Ok(builder.build())
191}