aws_sdk_ec2/protocol_serde/
shape_create_dhcp_options.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_create_dhcp_options_http_error(
4    _response_status: u16,
5    _response_headers: &::aws_smithy_runtime_api::http::Headers,
6    _response_body: &[u8],
7) -> std::result::Result<crate::operation::create_dhcp_options::CreateDhcpOptionsOutput, crate::operation::create_dhcp_options::CreateDhcpOptionsError>
8{
9    #[allow(unused_mut)]
10    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11        .map_err(crate::operation::create_dhcp_options::CreateDhcpOptionsError::unhandled)?;
12    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13    let generic = generic_builder.build();
14    Err(crate::operation::create_dhcp_options::CreateDhcpOptionsError::generic(generic))
15}
16
17#[allow(clippy::unnecessary_wraps)]
18pub fn de_create_dhcp_options_http_response(
19    _response_status: u16,
20    _response_headers: &::aws_smithy_runtime_api::http::Headers,
21    _response_body: &[u8],
22) -> std::result::Result<crate::operation::create_dhcp_options::CreateDhcpOptionsOutput, crate::operation::create_dhcp_options::CreateDhcpOptionsError>
23{
24    Ok({
25        #[allow(unused_mut)]
26        let mut output = crate::operation::create_dhcp_options::builders::CreateDhcpOptionsOutputBuilder::default();
27        output = crate::protocol_serde::shape_create_dhcp_options::de_create_dhcp_options(_response_body, output)
28            .map_err(crate::operation::create_dhcp_options::CreateDhcpOptionsError::unhandled)?;
29        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
30        output.build()
31    })
32}
33
34#[allow(unused_mut)]
35pub fn de_create_dhcp_options(
36    inp: &[u8],
37    mut builder: crate::operation::create_dhcp_options::builders::CreateDhcpOptionsOutputBuilder,
38) -> std::result::Result<crate::operation::create_dhcp_options::builders::CreateDhcpOptionsOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
39    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
40
41    #[allow(unused_mut)]
42    let mut decoder = doc.root_element()?;
43    #[allow(unused_variables)]
44    let start_el = decoder.start_el();
45    if !(start_el.matches("CreateDhcpOptionsResponse")) {
46        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
47            "invalid root, expected CreateDhcpOptionsResponse got {:?}",
48            start_el
49        )));
50    }
51    while let Some(mut tag) = decoder.next_tag() {
52        match tag.start_el() {
53            s if s.matches("dhcpOptions") /* DhcpOptions com.amazonaws.ec2.synthetic#CreateDhcpOptionsOutput$DhcpOptions */ =>  {
54                let var_1 =
55                    Some(
56                        crate::protocol_serde::shape_dhcp_options::de_dhcp_options(&mut tag)
57                        ?
58                    )
59                ;
60                builder = builder.set_dhcp_options(var_1);
61            }
62            ,
63            _ => {}
64        }
65    }
66    Ok(builder)
67}