aws_sdk_ec2/protocol_serde/
shape_connection_tracking_specification_request.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_connection_tracking_specification_request(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::ConnectionTrackingSpecificationRequest,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("TcpEstablishedTimeout");
9    if let Some(var_2) = &input.tcp_established_timeout {
10        scope_1.number(
11            #[allow(clippy::useless_conversion)]
12            ::aws_smithy_types::Number::NegInt((*var_2).into()),
13        );
14    }
15    #[allow(unused_mut)]
16    let mut scope_3 = writer.prefix("UdpStreamTimeout");
17    if let Some(var_4) = &input.udp_stream_timeout {
18        scope_3.number(
19            #[allow(clippy::useless_conversion)]
20            ::aws_smithy_types::Number::NegInt((*var_4).into()),
21        );
22    }
23    #[allow(unused_mut)]
24    let mut scope_5 = writer.prefix("UdpTimeout");
25    if let Some(var_6) = &input.udp_timeout {
26        scope_5.number(
27            #[allow(clippy::useless_conversion)]
28            ::aws_smithy_types::Number::NegInt((*var_6).into()),
29        );
30    }
31    Ok(())
32}
33
34#[allow(clippy::needless_question_mark)]
35pub fn de_connection_tracking_specification_request(
36    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
37) -> ::std::result::Result<crate::types::ConnectionTrackingSpecificationRequest, ::aws_smithy_xml::decode::XmlDecodeError> {
38    #[allow(unused_mut)]
39    let mut builder = crate::types::ConnectionTrackingSpecificationRequest::builder();
40    while let Some(mut tag) = decoder.next_tag() {
41        match tag.start_el() {
42            s if s.matches("TcpEstablishedTimeout") /* TcpEstablishedTimeout com.amazonaws.ec2#ConnectionTrackingSpecificationRequest$TcpEstablishedTimeout */ =>  {
43                let var_7 =
44                    Some(
45                         {
46                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
47                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
48                            )
49                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
50                        }
51                        ?
52                    )
53                ;
54                builder = builder.set_tcp_established_timeout(var_7);
55            }
56            ,
57            s if s.matches("UdpStreamTimeout") /* UdpStreamTimeout com.amazonaws.ec2#ConnectionTrackingSpecificationRequest$UdpStreamTimeout */ =>  {
58                let var_8 =
59                    Some(
60                         {
61                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
62                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
63                            )
64                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
65                        }
66                        ?
67                    )
68                ;
69                builder = builder.set_udp_stream_timeout(var_8);
70            }
71            ,
72            s if s.matches("UdpTimeout") /* UdpTimeout com.amazonaws.ec2#ConnectionTrackingSpecificationRequest$UdpTimeout */ =>  {
73                let var_9 =
74                    Some(
75                         {
76                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
77                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
78                            )
79                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
80                        }
81                        ?
82                    )
83                ;
84                builder = builder.set_udp_timeout(var_9);
85            }
86            ,
87            _ => {}
88        }
89    }
90    Ok(builder.build())
91}