aws_sdk_ec2/protocol_serde/
shape_service_link_virtual_interface.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_service_link_virtual_interface(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::ServiceLinkVirtualInterface, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::ServiceLinkVirtualInterface::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("serviceLinkVirtualInterfaceId") /* ServiceLinkVirtualInterfaceId com.amazonaws.ec2#ServiceLinkVirtualInterface$ServiceLinkVirtualInterfaceId */ =>  {
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_service_link_virtual_interface_id(var_1);
21            }
22            ,
23            s if s.matches("serviceLinkVirtualInterfaceArn") /* ServiceLinkVirtualInterfaceArn com.amazonaws.ec2#ServiceLinkVirtualInterface$ServiceLinkVirtualInterfaceArn */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28                            .into()
29                        )
30                        ?
31                    )
32                ;
33                builder = builder.set_service_link_virtual_interface_arn(var_2);
34            }
35            ,
36            s if s.matches("outpostId") /* OutpostId com.amazonaws.ec2#ServiceLinkVirtualInterface$OutpostId */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41                            .into()
42                        )
43                        ?
44                    )
45                ;
46                builder = builder.set_outpost_id(var_3);
47            }
48            ,
49            s if s.matches("outpostArn") /* OutpostArn com.amazonaws.ec2#ServiceLinkVirtualInterface$OutpostArn */ =>  {
50                let var_4 =
51                    Some(
52                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
53                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            .into()
55                        )
56                        ?
57                    )
58                ;
59                builder = builder.set_outpost_arn(var_4);
60            }
61            ,
62            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#ServiceLinkVirtualInterface$OwnerId */ =>  {
63                let var_5 =
64                    Some(
65                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
66                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
67                            .into()
68                        )
69                        ?
70                    )
71                ;
72                builder = builder.set_owner_id(var_5);
73            }
74            ,
75            s if s.matches("localAddress") /* LocalAddress com.amazonaws.ec2#ServiceLinkVirtualInterface$LocalAddress */ =>  {
76                let var_6 =
77                    Some(
78                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
79                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
80                            .into()
81                        )
82                        ?
83                    )
84                ;
85                builder = builder.set_local_address(var_6);
86            }
87            ,
88            s if s.matches("peerAddress") /* PeerAddress com.amazonaws.ec2#ServiceLinkVirtualInterface$PeerAddress */ =>  {
89                let var_7 =
90                    Some(
91                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
92                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
93                            .into()
94                        )
95                        ?
96                    )
97                ;
98                builder = builder.set_peer_address(var_7);
99            }
100            ,
101            s if s.matches("peerBgpAsn") /* PeerBgpAsn com.amazonaws.ec2#ServiceLinkVirtualInterface$PeerBgpAsn */ =>  {
102                let var_8 =
103                    Some(
104                         {
105                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
106                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
107                            )
108                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.ec2#Long`)"))
109                        }
110                        ?
111                    )
112                ;
113                builder = builder.set_peer_bgp_asn(var_8);
114            }
115            ,
116            s if s.matches("vlan") /* Vlan com.amazonaws.ec2#ServiceLinkVirtualInterface$Vlan */ =>  {
117                let var_9 =
118                    Some(
119                         {
120                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
121                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
122                            )
123                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
124                        }
125                        ?
126                    )
127                ;
128                builder = builder.set_vlan(var_9);
129            }
130            ,
131            s if s.matches("outpostLagId") /* OutpostLagId com.amazonaws.ec2#ServiceLinkVirtualInterface$OutpostLagId */ =>  {
132                let var_10 =
133                    Some(
134                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
135                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
136                            .into()
137                        )
138                        ?
139                    )
140                ;
141                builder = builder.set_outpost_lag_id(var_10);
142            }
143            ,
144            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#ServiceLinkVirtualInterface$Tags */ =>  {
145                let var_11 =
146                    Some(
147                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
148                        ?
149                    )
150                ;
151                builder = builder.set_tags(var_11);
152            }
153            ,
154            s if s.matches("configurationState") /* ConfigurationState com.amazonaws.ec2#ServiceLinkVirtualInterface$ConfigurationState */ =>  {
155                let var_12 =
156                    Some(
157                        Result::<crate::types::ServiceLinkVirtualInterfaceConfigurationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
158                            crate::types::ServiceLinkVirtualInterfaceConfigurationState::from(
159                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
160                            )
161                        )
162                        ?
163                    )
164                ;
165                builder = builder.set_configuration_state(var_12);
166            }
167            ,
168            _ => {}
169        }
170    }
171    Ok(builder.build())
172}