aws_sdk_ec2/protocol_serde/
shape_associate_trunk_interface.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_associate_trunk_interface_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::associate_trunk_interface::AssociateTrunkInterfaceOutput,
9    crate::operation::associate_trunk_interface::AssociateTrunkInterfaceError,
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::associate_trunk_interface::AssociateTrunkInterfaceError::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::associate_trunk_interface::AssociateTrunkInterfaceError::generic(
17        generic,
18    ))
19}
20
21#[allow(clippy::unnecessary_wraps)]
22pub fn de_associate_trunk_interface_http_response(
23    _response_status: u16,
24    _response_headers: &::aws_smithy_runtime_api::http::Headers,
25    _response_body: &[u8],
26) -> std::result::Result<
27    crate::operation::associate_trunk_interface::AssociateTrunkInterfaceOutput,
28    crate::operation::associate_trunk_interface::AssociateTrunkInterfaceError,
29> {
30    Ok({
31        #[allow(unused_mut)]
32        let mut output = crate::operation::associate_trunk_interface::builders::AssociateTrunkInterfaceOutputBuilder::default();
33        output = crate::protocol_serde::shape_associate_trunk_interface::de_associate_trunk_interface(_response_body, output)
34            .map_err(crate::operation::associate_trunk_interface::AssociateTrunkInterfaceError::unhandled)?;
35        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
36        output.build()
37    })
38}
39
40#[allow(unused_mut)]
41pub fn de_associate_trunk_interface(
42    inp: &[u8],
43    mut builder: crate::operation::associate_trunk_interface::builders::AssociateTrunkInterfaceOutputBuilder,
44) -> std::result::Result<
45    crate::operation::associate_trunk_interface::builders::AssociateTrunkInterfaceOutputBuilder,
46    ::aws_smithy_xml::decode::XmlDecodeError,
47> {
48    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
49
50    #[allow(unused_mut)]
51    let mut decoder = doc.root_element()?;
52    #[allow(unused_variables)]
53    let start_el = decoder.start_el();
54    if !(start_el.matches("AssociateTrunkInterfaceResponse")) {
55        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
56            "invalid root, expected AssociateTrunkInterfaceResponse got {:?}",
57            start_el
58        )));
59    }
60    while let Some(mut tag) = decoder.next_tag() {
61        match tag.start_el() {
62            s if s.matches("interfaceAssociation") /* InterfaceAssociation com.amazonaws.ec2.synthetic#AssociateTrunkInterfaceOutput$InterfaceAssociation */ =>  {
63                let var_1 =
64                    Some(
65                        crate::protocol_serde::shape_trunk_interface_association::de_trunk_interface_association(&mut tag)
66                        ?
67                    )
68                ;
69                builder = builder.set_interface_association(var_1);
70            }
71            ,
72            s if s.matches("clientToken") /* ClientToken com.amazonaws.ec2.synthetic#AssociateTrunkInterfaceOutput$ClientToken */ =>  {
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_client_token(var_2);
83            }
84            ,
85            _ => {}
86        }
87    }
88    Ok(builder)
89}