aws_sdk_ec2/protocol_serde/
shape_route_server.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_route_server(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::RouteServer, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::RouteServer::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("routeServerId") => {
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_route_server_id(var_1);
21 }
22 ,
23 s if s.matches("amazonSideAsn") => {
24 let var_2 =
25 Some(
26 {
27 <i64 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 (long: `com.amazonaws.ec2#Long`)"))
31 }
32 ?
33 )
34 ;
35 builder = builder.set_amazon_side_asn(var_2);
36 }
37 ,
38 s if s.matches("state") => {
39 let var_3 =
40 Some(
41 Result::<crate::types::RouteServerState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42 crate::types::RouteServerState::from(
43 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
44 )
45 )
46 ?
47 )
48 ;
49 builder = builder.set_state(var_3);
50 }
51 ,
52 s if s.matches("tagSet") => {
53 let var_4 =
54 Some(
55 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
56 ?
57 )
58 ;
59 builder = builder.set_tags(var_4);
60 }
61 ,
62 s if s.matches("persistRoutesState") => {
63 let var_5 =
64 Some(
65 Result::<crate::types::RouteServerPersistRoutesState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
66 crate::types::RouteServerPersistRoutesState::from(
67 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68 )
69 )
70 ?
71 )
72 ;
73 builder = builder.set_persist_routes_state(var_5);
74 }
75 ,
76 s if s.matches("persistRoutesDuration") => {
77 let var_6 =
78 Some(
79 {
80 <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
81 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82 )
83 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.ec2#BoxedLong`)"))
84 }
85 ?
86 )
87 ;
88 builder = builder.set_persist_routes_duration(var_6);
89 }
90 ,
91 s if s.matches("snsNotificationsEnabled") => {
92 let var_7 =
93 Some(
94 {
95 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
96 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
97 )
98 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
99 }
100 ?
101 )
102 ;
103 builder = builder.set_sns_notifications_enabled(var_7);
104 }
105 ,
106 s if s.matches("snsTopicArn") => {
107 let var_8 =
108 Some(
109 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
110 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
111 .into()
112 )
113 ?
114 )
115 ;
116 builder = builder.set_sns_topic_arn(var_8);
117 }
118 ,
119 _ => {}
120 }
121 }
122 Ok(builder.build())
123}