aws_sdk_ec2/protocol_serde/
shape_get_vpn_tunnel_replacement_status.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_vpn_tunnel_replacement_status_http_error(
4    _response_status: u16,
5    _response_headers: &::aws_smithy_runtime_api::http::Headers,
6    _response_body: &[u8],
7) -> std::result::Result<
8    crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusOutput,
9    crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusError,
10> {
11    #[allow(unused_mut)]
12    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13        .map_err(crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusError::unhandled)?;
14    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15    let generic = generic_builder.build();
16    Err(crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_get_vpn_tunnel_replacement_status_http_response(
21    _response_status: u16,
22    _response_headers: &::aws_smithy_runtime_api::http::Headers,
23    _response_body: &[u8],
24) -> std::result::Result<
25    crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusOutput,
26    crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusError,
27> {
28    Ok({
29        #[allow(unused_mut)]
30        let mut output = crate::operation::get_vpn_tunnel_replacement_status::builders::GetVpnTunnelReplacementStatusOutputBuilder::default();
31        output = crate::protocol_serde::shape_get_vpn_tunnel_replacement_status::de_get_vpn_tunnel_replacement_status(_response_body, output)
32            .map_err(crate::operation::get_vpn_tunnel_replacement_status::GetVpnTunnelReplacementStatusError::unhandled)?;
33        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
34        output.build()
35    })
36}
37
38#[allow(unused_mut)]
39pub fn de_get_vpn_tunnel_replacement_status(
40    inp: &[u8],
41    mut builder: crate::operation::get_vpn_tunnel_replacement_status::builders::GetVpnTunnelReplacementStatusOutputBuilder,
42) -> std::result::Result<
43    crate::operation::get_vpn_tunnel_replacement_status::builders::GetVpnTunnelReplacementStatusOutputBuilder,
44    ::aws_smithy_xml::decode::XmlDecodeError,
45> {
46    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
47
48    #[allow(unused_mut)]
49    let mut decoder = doc.root_element()?;
50    #[allow(unused_variables)]
51    let start_el = decoder.start_el();
52    if !(start_el.matches("GetVpnTunnelReplacementStatusResponse")) {
53        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
54            "invalid root, expected GetVpnTunnelReplacementStatusResponse got {start_el:?}"
55        )));
56    }
57    while let Some(mut tag) = decoder.next_tag() {
58        match tag.start_el() {
59            s if s.matches("vpnConnectionId") /* VpnConnectionId com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$VpnConnectionId */ =>  {
60                let var_1 =
61                    Some(
62                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
63                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
64                            .into()
65                        )
66                        ?
67                    )
68                ;
69                builder = builder.set_vpn_connection_id(var_1);
70            }
71            ,
72            s if s.matches("transitGatewayId") /* TransitGatewayId com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$TransitGatewayId */ =>  {
73                let var_2 =
74                    Some(
75                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
76                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
77                            .into()
78                        )
79                        ?
80                    )
81                ;
82                builder = builder.set_transit_gateway_id(var_2);
83            }
84            ,
85            s if s.matches("customerGatewayId") /* CustomerGatewayId com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$CustomerGatewayId */ =>  {
86                let var_3 =
87                    Some(
88                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
89                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
90                            .into()
91                        )
92                        ?
93                    )
94                ;
95                builder = builder.set_customer_gateway_id(var_3);
96            }
97            ,
98            s if s.matches("vpnGatewayId") /* VpnGatewayId com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$VpnGatewayId */ =>  {
99                let var_4 =
100                    Some(
101                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
102                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
103                            .into()
104                        )
105                        ?
106                    )
107                ;
108                builder = builder.set_vpn_gateway_id(var_4);
109            }
110            ,
111            s if s.matches("vpnTunnelOutsideIpAddress") /* VpnTunnelOutsideIpAddress com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$VpnTunnelOutsideIpAddress */ =>  {
112                let var_5 =
113                    Some(
114                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
115                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
116                            .into()
117                        )
118                        ?
119                    )
120                ;
121                builder = builder.set_vpn_tunnel_outside_ip_address(var_5);
122            }
123            ,
124            s if s.matches("maintenanceDetails") /* MaintenanceDetails com.amazonaws.ec2.synthetic#GetVpnTunnelReplacementStatusOutput$MaintenanceDetails */ =>  {
125                let var_6 =
126                    Some(
127                        crate::protocol_serde::shape_maintenance_details::de_maintenance_details(&mut tag)
128                        ?
129                    )
130                ;
131                builder = builder.set_maintenance_details(var_6);
132            }
133            ,
134            _ => {}
135        }
136    }
137    Ok(builder)
138}