aws_sdk_ec2/protocol_serde/
shape_vpn_gateway.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_vpn_gateway(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::VpnGateway, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::VpnGateway::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("amazonSideAsn") /* AmazonSideAsn com.amazonaws.ec2#VpnGateway$AmazonSideAsn */ =>  {
11                let var_1 =
12                    Some(
13                         {
14                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
15                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16                            )
17                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.ec2#Long`)"))
18                        }
19                        ?
20                    )
21                ;
22                builder = builder.set_amazon_side_asn(var_1);
23            }
24            ,
25            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#VpnGateway$Tags */ =>  {
26                let var_2 =
27                    Some(
28                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
29                        ?
30                    )
31                ;
32                builder = builder.set_tags(var_2);
33            }
34            ,
35            s if s.matches("vpnGatewayId") /* VpnGatewayId com.amazonaws.ec2#VpnGateway$VpnGatewayId */ =>  {
36                let var_3 =
37                    Some(
38                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
39                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
40                            .into()
41                        )
42                        ?
43                    )
44                ;
45                builder = builder.set_vpn_gateway_id(var_3);
46            }
47            ,
48            s if s.matches("state") /* State com.amazonaws.ec2#VpnGateway$State */ =>  {
49                let var_4 =
50                    Some(
51                        Result::<crate::types::VpnState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
52                            crate::types::VpnState::from(
53                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            )
55                        )
56                        ?
57                    )
58                ;
59                builder = builder.set_state(var_4);
60            }
61            ,
62            s if s.matches("type") /* Type com.amazonaws.ec2#VpnGateway$Type */ =>  {
63                let var_5 =
64                    Some(
65                        Result::<crate::types::GatewayType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
66                            crate::types::GatewayType::from(
67                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68                            )
69                        )
70                        ?
71                    )
72                ;
73                builder = builder.set_type(var_5);
74            }
75            ,
76            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#VpnGateway$AvailabilityZone */ =>  {
77                let var_6 =
78                    Some(
79                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
80                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
81                            .into()
82                        )
83                        ?
84                    )
85                ;
86                builder = builder.set_availability_zone(var_6);
87            }
88            ,
89            s if s.matches("attachments") /* VpcAttachments com.amazonaws.ec2#VpnGateway$VpcAttachments */ =>  {
90                let var_7 =
91                    Some(
92                        crate::protocol_serde::shape_vpc_attachment_list::de_vpc_attachment_list(&mut tag)
93                        ?
94                    )
95                ;
96                builder = builder.set_vpc_attachments(var_7);
97            }
98            ,
99            _ => {}
100        }
101    }
102    Ok(builder.build())
103}