aws_sdk_ec2/protocol_serde/
shape_get_console_screenshot.rs

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