aws_sdk_ec2/protocol_serde/
shape_host_offering.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_host_offering(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::HostOffering, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::HostOffering::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("currencyCode") /* CurrencyCode com.amazonaws.ec2#HostOffering$CurrencyCode */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<crate::types::CurrencyCodeValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            crate::types::CurrencyCodeValues::from(
15                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16                            )
17                        )
18                        ?
19                    )
20                ;
21                builder = builder.set_currency_code(var_1);
22            }
23            ,
24            s if s.matches("duration") /* Duration com.amazonaws.ec2#HostOffering$Duration */ =>  {
25                let var_2 =
26                    Some(
27                         {
28                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
29                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
30                            )
31                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
32                        }
33                        ?
34                    )
35                ;
36                builder = builder.set_duration(var_2);
37            }
38            ,
39            s if s.matches("hourlyPrice") /* HourlyPrice com.amazonaws.ec2#HostOffering$HourlyPrice */ =>  {
40                let var_3 =
41                    Some(
42                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
43                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
44                            .into()
45                        )
46                        ?
47                    )
48                ;
49                builder = builder.set_hourly_price(var_3);
50            }
51            ,
52            s if s.matches("instanceFamily") /* InstanceFamily com.amazonaws.ec2#HostOffering$InstanceFamily */ =>  {
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_instance_family(var_4);
63            }
64            ,
65            s if s.matches("offeringId") /* OfferingId com.amazonaws.ec2#HostOffering$OfferingId */ =>  {
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_offering_id(var_5);
76            }
77            ,
78            s if s.matches("paymentOption") /* PaymentOption com.amazonaws.ec2#HostOffering$PaymentOption */ =>  {
79                let var_6 =
80                    Some(
81                        Result::<crate::types::PaymentOption, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
82                            crate::types::PaymentOption::from(
83                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
84                            )
85                        )
86                        ?
87                    )
88                ;
89                builder = builder.set_payment_option(var_6);
90            }
91            ,
92            s if s.matches("upfrontPrice") /* UpfrontPrice com.amazonaws.ec2#HostOffering$UpfrontPrice */ =>  {
93                let var_7 =
94                    Some(
95                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
96                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
97                            .into()
98                        )
99                        ?
100                    )
101                ;
102                builder = builder.set_upfront_price(var_7);
103            }
104            ,
105            _ => {}
106        }
107    }
108    Ok(builder.build())
109}