aws_sdk_ec2/protocol_serde/
shape_flow_log.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_flow_log(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::FlowLog, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::FlowLog::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("creationTime") /* CreationTime com.amazonaws.ec2#FlowLog$CreationTime */ =>  {
11                let var_1 =
12                    Some(
13                        ::aws_smithy_types::DateTime::from_str(
14                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
16                        )
17                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
18                        ?
19                    )
20                ;
21                builder = builder.set_creation_time(var_1);
22            }
23            ,
24            s if s.matches("deliverLogsErrorMessage") /* DeliverLogsErrorMessage com.amazonaws.ec2#FlowLog$DeliverLogsErrorMessage */ =>  {
25                let var_2 =
26                    Some(
27                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
28                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            .into()
30                        )
31                        ?
32                    )
33                ;
34                builder = builder.set_deliver_logs_error_message(var_2);
35            }
36            ,
37            s if s.matches("deliverLogsPermissionArn") /* DeliverLogsPermissionArn com.amazonaws.ec2#FlowLog$DeliverLogsPermissionArn */ =>  {
38                let var_3 =
39                    Some(
40                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            .into()
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_deliver_logs_permission_arn(var_3);
48            }
49            ,
50            s if s.matches("deliverCrossAccountRole") /* DeliverCrossAccountRole com.amazonaws.ec2#FlowLog$DeliverCrossAccountRole */ =>  {
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_deliver_cross_account_role(var_4);
61            }
62            ,
63            s if s.matches("deliverLogsStatus") /* DeliverLogsStatus com.amazonaws.ec2#FlowLog$DeliverLogsStatus */ =>  {
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_deliver_logs_status(var_5);
74            }
75            ,
76            s if s.matches("flowLogId") /* FlowLogId com.amazonaws.ec2#FlowLog$FlowLogId */ =>  {
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_flow_log_id(var_6);
87            }
88            ,
89            s if s.matches("flowLogStatus") /* FlowLogStatus com.amazonaws.ec2#FlowLog$FlowLogStatus */ =>  {
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_flow_log_status(var_7);
100            }
101            ,
102            s if s.matches("logGroupName") /* LogGroupName com.amazonaws.ec2#FlowLog$LogGroupName */ =>  {
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_log_group_name(var_8);
113            }
114            ,
115            s if s.matches("resourceId") /* ResourceId com.amazonaws.ec2#FlowLog$ResourceId */ =>  {
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_resource_id(var_9);
126            }
127            ,
128            s if s.matches("trafficType") /* TrafficType com.amazonaws.ec2#FlowLog$TrafficType */ =>  {
129                let var_10 =
130                    Some(
131                        Result::<crate::types::TrafficType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
132                            crate::types::TrafficType::from(
133                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
134                            )
135                        )
136                        ?
137                    )
138                ;
139                builder = builder.set_traffic_type(var_10);
140            }
141            ,
142            s if s.matches("logDestinationType") /* LogDestinationType com.amazonaws.ec2#FlowLog$LogDestinationType */ =>  {
143                let var_11 =
144                    Some(
145                        Result::<crate::types::LogDestinationType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
146                            crate::types::LogDestinationType::from(
147                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
148                            )
149                        )
150                        ?
151                    )
152                ;
153                builder = builder.set_log_destination_type(var_11);
154            }
155            ,
156            s if s.matches("logDestination") /* LogDestination com.amazonaws.ec2#FlowLog$LogDestination */ =>  {
157                let var_12 =
158                    Some(
159                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
160                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
161                            .into()
162                        )
163                        ?
164                    )
165                ;
166                builder = builder.set_log_destination(var_12);
167            }
168            ,
169            s if s.matches("logFormat") /* LogFormat com.amazonaws.ec2#FlowLog$LogFormat */ =>  {
170                let var_13 =
171                    Some(
172                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
173                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
174                            .into()
175                        )
176                        ?
177                    )
178                ;
179                builder = builder.set_log_format(var_13);
180            }
181            ,
182            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#FlowLog$Tags */ =>  {
183                let var_14 =
184                    Some(
185                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
186                        ?
187                    )
188                ;
189                builder = builder.set_tags(var_14);
190            }
191            ,
192            s if s.matches("maxAggregationInterval") /* MaxAggregationInterval com.amazonaws.ec2#FlowLog$MaxAggregationInterval */ =>  {
193                let var_15 =
194                    Some(
195                         {
196                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
197                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
198                            )
199                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
200                        }
201                        ?
202                    )
203                ;
204                builder = builder.set_max_aggregation_interval(var_15);
205            }
206            ,
207            s if s.matches("destinationOptions") /* DestinationOptions com.amazonaws.ec2#FlowLog$DestinationOptions */ =>  {
208                let var_16 =
209                    Some(
210                        crate::protocol_serde::shape_destination_options_response::de_destination_options_response(&mut tag)
211                        ?
212                    )
213                ;
214                builder = builder.set_destination_options(var_16);
215            }
216            ,
217            _ => {}
218        }
219    }
220    Ok(builder.build())
221}