aws_sdk_ec2/protocol_serde/
shape_describe_prefix_lists.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_prefix_lists_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::describe_prefix_lists::DescribePrefixListsOutput,
9    crate::operation::describe_prefix_lists::DescribePrefixListsError,
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::describe_prefix_lists::DescribePrefixListsError::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::describe_prefix_lists::DescribePrefixListsError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_describe_prefix_lists_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::describe_prefix_lists::DescribePrefixListsOutput,
26    crate::operation::describe_prefix_lists::DescribePrefixListsError,
27> {
28    Ok({
29        #[allow(unused_mut)]
30        let mut output = crate::operation::describe_prefix_lists::builders::DescribePrefixListsOutputBuilder::default();
31        output = crate::protocol_serde::shape_describe_prefix_lists::de_describe_prefix_lists(_response_body, output)
32            .map_err(crate::operation::describe_prefix_lists::DescribePrefixListsError::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_describe_prefix_lists(
40    inp: &[u8],
41    mut builder: crate::operation::describe_prefix_lists::builders::DescribePrefixListsOutputBuilder,
42) -> std::result::Result<crate::operation::describe_prefix_lists::builders::DescribePrefixListsOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError>
43{
44    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
45
46    #[allow(unused_mut)]
47    let mut decoder = doc.root_element()?;
48    #[allow(unused_variables)]
49    let start_el = decoder.start_el();
50    if !(start_el.matches("DescribePrefixListsResponse")) {
51        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
52            "invalid root, expected DescribePrefixListsResponse got {:?}",
53            start_el
54        )));
55    }
56    while let Some(mut tag) = decoder.next_tag() {
57        match tag.start_el() {
58            s if s.matches("nextToken") /* NextToken com.amazonaws.ec2.synthetic#DescribePrefixListsOutput$NextToken */ =>  {
59                let var_1 =
60                    Some(
61                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
62                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
63                            .into()
64                        )
65                        ?
66                    )
67                ;
68                builder = builder.set_next_token(var_1);
69            }
70            ,
71            s if s.matches("prefixListSet") /* PrefixLists com.amazonaws.ec2.synthetic#DescribePrefixListsOutput$PrefixLists */ =>  {
72                let var_2 =
73                    Some(
74                        crate::protocol_serde::shape_prefix_list_set::de_prefix_list_set(&mut tag)
75                        ?
76                    )
77                ;
78                builder = builder.set_prefix_lists(var_2);
79            }
80            ,
81            _ => {}
82        }
83    }
84    Ok(builder)
85}