aws_sdk_ec2/protocol_serde/
shape_network_insights_path.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_network_insights_path(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::NetworkInsightsPath, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::NetworkInsightsPath::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("networkInsightsPathId") /* NetworkInsightsPathId com.amazonaws.ec2#NetworkInsightsPath$NetworkInsightsPathId */ =>  {
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_network_insights_path_id(var_1);
21            }
22            ,
23            s if s.matches("networkInsightsPathArn") /* NetworkInsightsPathArn com.amazonaws.ec2#NetworkInsightsPath$NetworkInsightsPathArn */ =>  {
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_network_insights_path_arn(var_2);
34            }
35            ,
36            s if s.matches("createdDate") /* CreatedDate com.amazonaws.ec2#NetworkInsightsPath$CreatedDate */ =>  {
37                let var_3 =
38                    Some(
39                        ::aws_smithy_types::DateTime::from_str(
40                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
42                        )
43                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
44                        ?
45                    )
46                ;
47                builder = builder.set_created_date(var_3);
48            }
49            ,
50            s if s.matches("source") /* Source com.amazonaws.ec2#NetworkInsightsPath$Source */ =>  {
51                let var_4 =
52                    Some(
53                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
54                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            .into()
56                        )
57                        ?
58                    )
59                ;
60                builder = builder.set_source(var_4);
61            }
62            ,
63            s if s.matches("destination") /* Destination com.amazonaws.ec2#NetworkInsightsPath$Destination */ =>  {
64                let var_5 =
65                    Some(
66                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
67                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68                            .into()
69                        )
70                        ?
71                    )
72                ;
73                builder = builder.set_destination(var_5);
74            }
75            ,
76            s if s.matches("sourceArn") /* SourceArn com.amazonaws.ec2#NetworkInsightsPath$SourceArn */ =>  {
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_source_arn(var_6);
87            }
88            ,
89            s if s.matches("destinationArn") /* DestinationArn com.amazonaws.ec2#NetworkInsightsPath$DestinationArn */ =>  {
90                let var_7 =
91                    Some(
92                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
93                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
94                            .into()
95                        )
96                        ?
97                    )
98                ;
99                builder = builder.set_destination_arn(var_7);
100            }
101            ,
102            s if s.matches("sourceIp") /* SourceIp com.amazonaws.ec2#NetworkInsightsPath$SourceIp */ =>  {
103                let var_8 =
104                    Some(
105                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
106                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
107                            .into()
108                        )
109                        ?
110                    )
111                ;
112                builder = builder.set_source_ip(var_8);
113            }
114            ,
115            s if s.matches("destinationIp") /* DestinationIp com.amazonaws.ec2#NetworkInsightsPath$DestinationIp */ =>  {
116                let var_9 =
117                    Some(
118                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
119                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
120                            .into()
121                        )
122                        ?
123                    )
124                ;
125                builder = builder.set_destination_ip(var_9);
126            }
127            ,
128            s if s.matches("protocol") /* Protocol com.amazonaws.ec2#NetworkInsightsPath$Protocol */ =>  {
129                let var_10 =
130                    Some(
131                        Result::<crate::types::Protocol, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
132                            crate::types::Protocol::from(
133                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
134                            )
135                        )
136                        ?
137                    )
138                ;
139                builder = builder.set_protocol(var_10);
140            }
141            ,
142            s if s.matches("destinationPort") /* DestinationPort com.amazonaws.ec2#NetworkInsightsPath$DestinationPort */ =>  {
143                let var_11 =
144                    Some(
145                         {
146                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
147                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
148                            )
149                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
150                        }
151                        ?
152                    )
153                ;
154                builder = builder.set_destination_port(var_11);
155            }
156            ,
157            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#NetworkInsightsPath$Tags */ =>  {
158                let var_12 =
159                    Some(
160                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
161                        ?
162                    )
163                ;
164                builder = builder.set_tags(var_12);
165            }
166            ,
167            s if s.matches("filterAtSource") /* FilterAtSource com.amazonaws.ec2#NetworkInsightsPath$FilterAtSource */ =>  {
168                let var_13 =
169                    Some(
170                        crate::protocol_serde::shape_path_filter::de_path_filter(&mut tag)
171                        ?
172                    )
173                ;
174                builder = builder.set_filter_at_source(var_13);
175            }
176            ,
177            s if s.matches("filterAtDestination") /* FilterAtDestination com.amazonaws.ec2#NetworkInsightsPath$FilterAtDestination */ =>  {
178                let var_14 =
179                    Some(
180                        crate::protocol_serde::shape_path_filter::de_path_filter(&mut tag)
181                        ?
182                    )
183                ;
184                builder = builder.set_filter_at_destination(var_14);
185            }
186            ,
187            _ => {}
188        }
189    }
190    Ok(builder.build())
191}