aws_sdk_ec2/protocol_serde/
shape_create_network_insights_path.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_create_network_insights_path_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::create_network_insights_path::CreateNetworkInsightsPathOutput,
9    crate::operation::create_network_insights_path::CreateNetworkInsightsPathError,
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::create_network_insights_path::CreateNetworkInsightsPathError::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::create_network_insights_path::CreateNetworkInsightsPathError::generic(
17        generic,
18    ))
19}
20
21#[allow(clippy::unnecessary_wraps)]
22pub fn de_create_network_insights_path_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::create_network_insights_path::CreateNetworkInsightsPathOutput,
28    crate::operation::create_network_insights_path::CreateNetworkInsightsPathError,
29> {
30    Ok({
31        #[allow(unused_mut)]
32        let mut output = crate::operation::create_network_insights_path::builders::CreateNetworkInsightsPathOutputBuilder::default();
33        output = crate::protocol_serde::shape_create_network_insights_path::de_create_network_insights_path(_response_body, output)
34            .map_err(crate::operation::create_network_insights_path::CreateNetworkInsightsPathError::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_create_network_insights_path(
42    inp: &[u8],
43    mut builder: crate::operation::create_network_insights_path::builders::CreateNetworkInsightsPathOutputBuilder,
44) -> std::result::Result<
45    crate::operation::create_network_insights_path::builders::CreateNetworkInsightsPathOutputBuilder,
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("CreateNetworkInsightsPathResponse")) {
55        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
56            "invalid root, expected CreateNetworkInsightsPathResponse 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("networkInsightsPath") /* NetworkInsightsPath com.amazonaws.ec2.synthetic#CreateNetworkInsightsPathOutput$NetworkInsightsPath */ =>  {
63                let var_1 =
64                    Some(
65                        crate::protocol_serde::shape_network_insights_path::de_network_insights_path(&mut tag)
66                        ?
67                    )
68                ;
69                builder = builder.set_network_insights_path(var_1);
70            }
71            ,
72            _ => {}
73        }
74    }
75    Ok(builder)
76}