Skip to main content

aws_sdk_ec2/protocol_serde/
shape_replace_image_criteria_in_allowed_images_settings.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_replace_image_criteria_in_allowed_images_settings_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::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsOutput,
9    crate::operation::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsError,
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::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsError::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::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_replace_image_criteria_in_allowed_images_settings_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::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsOutput,
26    crate::operation::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsError,
27> {
28    Ok({
29        #[allow(unused_mut)]
30        let mut output = crate::operation::replace_image_criteria_in_allowed_images_settings::builders::ReplaceImageCriteriaInAllowedImagesSettingsOutputBuilder::default();
31        output =
32            crate::protocol_serde::shape_replace_image_criteria_in_allowed_images_settings::de_replace_image_criteria_in_allowed_images_settings(
33                _response_body,
34                output,
35            )
36            .map_err(
37                crate::operation::replace_image_criteria_in_allowed_images_settings::ReplaceImageCriteriaInAllowedImagesSettingsError::unhandled,
38            )?;
39        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
40        output.build()
41    })
42}
43
44#[allow(unused_mut)]
45pub fn de_replace_image_criteria_in_allowed_images_settings(
46    inp: &[u8],
47    mut builder: crate::operation::replace_image_criteria_in_allowed_images_settings::builders::ReplaceImageCriteriaInAllowedImagesSettingsOutputBuilder,
48) -> std::result::Result<
49    crate::operation::replace_image_criteria_in_allowed_images_settings::builders::ReplaceImageCriteriaInAllowedImagesSettingsOutputBuilder,
50    ::aws_smithy_xml::decode::XmlDecodeError,
51> {
52    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
53
54    #[allow(unused_mut)]
55    let mut decoder = doc.root_element()?;
56    #[allow(unused_variables)]
57    let start_el = decoder.start_el();
58    if !(start_el.matches("ReplaceImageCriteriaInAllowedImagesSettingsResponse")) {
59        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
60            "invalid root, expected ReplaceImageCriteriaInAllowedImagesSettingsResponse got {start_el:?}"
61        )));
62    }
63    while let Some(mut tag) = decoder.next_tag() {
64        match tag.start_el() {
65            s if s.matches("return") /* ReturnValue com.amazonaws.ec2.synthetic#ReplaceImageCriteriaInAllowedImagesSettingsOutput$ReturnValue */ =>  {
66                let var_1 =
67                    Some(
68                         {
69                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
70                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
71                            )
72                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
73                        }
74                        ?
75                    )
76                ;
77                builder = builder.set_return_value(var_1);
78            }
79            ,
80            _ => {}
81        }
82    }
83    Ok(builder)
84}