aws_sdk_ec2/protocol_serde/
shape_disable_image_deregistration_protection.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_disable_image_deregistration_protection_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::disable_image_deregistration_protection::DisableImageDeregistrationProtectionOutput,
9    crate::operation::disable_image_deregistration_protection::DisableImageDeregistrationProtectionError,
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::disable_image_deregistration_protection::DisableImageDeregistrationProtectionError::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::disable_image_deregistration_protection::DisableImageDeregistrationProtectionError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_disable_image_deregistration_protection_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::disable_image_deregistration_protection::DisableImageDeregistrationProtectionOutput,
26    crate::operation::disable_image_deregistration_protection::DisableImageDeregistrationProtectionError,
27> {
28    Ok({
29        #[allow(unused_mut)]
30        let mut output =
31            crate::operation::disable_image_deregistration_protection::builders::DisableImageDeregistrationProtectionOutputBuilder::default();
32        output =
33            crate::protocol_serde::shape_disable_image_deregistration_protection::de_disable_image_deregistration_protection(_response_body, output)
34                .map_err(crate::operation::disable_image_deregistration_protection::DisableImageDeregistrationProtectionError::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_disable_image_deregistration_protection(
42    inp: &[u8],
43    mut builder: crate::operation::disable_image_deregistration_protection::builders::DisableImageDeregistrationProtectionOutputBuilder,
44) -> std::result::Result<
45    crate::operation::disable_image_deregistration_protection::builders::DisableImageDeregistrationProtectionOutputBuilder,
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("DisableImageDeregistrationProtectionResponse")) {
55        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
56            "invalid root, expected DisableImageDeregistrationProtectionResponse got {start_el:?}"
57        )));
58    }
59    while let Some(mut tag) = decoder.next_tag() {
60        match tag.start_el() {
61            s if s.matches("return") /* Return com.amazonaws.ec2.synthetic#DisableImageDeregistrationProtectionOutput$Return */ =>  {
62                let var_1 =
63                    Some(
64                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
65                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
66                            .into()
67                        )
68                        ?
69                    )
70                ;
71                builder = builder.set_return(var_1);
72            }
73            ,
74            _ => {}
75        }
76    }
77    Ok(builder)
78}