aws_sdk_ec2/protocol_serde/
shape_unlock_snapshot.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_unlock_snapshot_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::unlock_snapshot::UnlockSnapshotOutput, crate::operation::unlock_snapshot::UnlockSnapshotError> {
8 #[allow(unused_mut)]
9 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
10 .map_err(crate::operation::unlock_snapshot::UnlockSnapshotError::unhandled)?;
11 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12 let generic = generic_builder.build();
13 Err(crate::operation::unlock_snapshot::UnlockSnapshotError::generic(generic))
14}
15
16#[allow(clippy::unnecessary_wraps)]
17pub fn de_unlock_snapshot_http_response(
18 _response_status: u16,
19 _response_headers: &::aws_smithy_runtime_api::http::Headers,
20 _response_body: &[u8],
21) -> std::result::Result<crate::operation::unlock_snapshot::UnlockSnapshotOutput, crate::operation::unlock_snapshot::UnlockSnapshotError> {
22 Ok({
23 #[allow(unused_mut)]
24 let mut output = crate::operation::unlock_snapshot::builders::UnlockSnapshotOutputBuilder::default();
25 output = crate::protocol_serde::shape_unlock_snapshot::de_unlock_snapshot(_response_body, output)
26 .map_err(crate::operation::unlock_snapshot::UnlockSnapshotError::unhandled)?;
27 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
28 output.build()
29 })
30}
31
32#[allow(unused_mut)]
33pub fn de_unlock_snapshot(
34 inp: &[u8],
35 mut builder: crate::operation::unlock_snapshot::builders::UnlockSnapshotOutputBuilder,
36) -> std::result::Result<crate::operation::unlock_snapshot::builders::UnlockSnapshotOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
37 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
38
39 #[allow(unused_mut)]
40 let mut decoder = doc.root_element()?;
41 #[allow(unused_variables)]
42 let start_el = decoder.start_el();
43 if !(start_el.matches("UnlockSnapshotResponse")) {
44 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
45 "invalid root, expected UnlockSnapshotResponse got {start_el:?}"
46 )));
47 }
48 while let Some(mut tag) = decoder.next_tag() {
49 match tag.start_el() {
50 s if s.matches("snapshotId") => {
51 let var_1 =
52 Some(
53 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
54 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55 .into()
56 )
57 ?
58 )
59 ;
60 builder = builder.set_snapshot_id(var_1);
61 }
62 ,
63 _ => {}
64 }
65 }
66 Ok(builder)
67}