aws_sdk_s3/protocol_serde/
shape_copy_object_output.rs
1pub(crate) fn de_bucket_key_enabled_header(
3 header_map: &::aws_smithy_runtime_api::http::Headers,
4) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
5 let headers = header_map.get_all("x-amz-server-side-encryption-bucket-key-enabled");
6 let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
7 if var_1.len() > 1 {
8 Err(::aws_smithy_http::header::ParseError::new(format!(
9 "expected one item but found {}",
10 var_1.len()
11 )))
12 } else {
13 let mut var_1 = var_1;
14 Ok(var_1.pop())
15 }
16}
17
18pub(crate) fn de_copy_object_result_payload(
19 body: &[u8],
20) -> std::result::Result<::std::option::Option<crate::types::CopyObjectResult>, crate::operation::copy_object::CopyObjectError> {
21 (!body.is_empty())
22 .then(|| {
23 crate::protocol_serde::shape_copy_object_output::de_copy_object_result(body)
24 .map_err(crate::operation::copy_object::CopyObjectError::unhandled)
25 })
26 .transpose()
27}
28
29pub(crate) fn de_copy_source_version_id_header(
30 header_map: &::aws_smithy_runtime_api::http::Headers,
31) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
32 let headers = header_map.get_all("x-amz-copy-source-version-id");
33 ::aws_smithy_http::header::one_or_none(headers)
34}
35
36pub(crate) fn de_expiration_header(
37 header_map: &::aws_smithy_runtime_api::http::Headers,
38) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
39 let headers = header_map.get_all("x-amz-expiration");
40 ::aws_smithy_http::header::one_or_none(headers)
41}
42
43pub(crate) fn de_request_charged_header(
44 header_map: &::aws_smithy_runtime_api::http::Headers,
45) -> ::std::result::Result<::std::option::Option<crate::types::RequestCharged>, ::aws_smithy_http::header::ParseError> {
46 let headers = header_map.get_all("x-amz-request-charged");
47 ::aws_smithy_http::header::one_or_none(headers)
48}
49
50pub(crate) fn de_sse_customer_algorithm_header(
51 header_map: &::aws_smithy_runtime_api::http::Headers,
52) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
53 let headers = header_map.get_all("x-amz-server-side-encryption-customer-algorithm");
54 ::aws_smithy_http::header::one_or_none(headers)
55}
56
57pub(crate) fn de_sse_customer_key_md5_header(
58 header_map: &::aws_smithy_runtime_api::http::Headers,
59) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
60 let headers = header_map.get_all("x-amz-server-side-encryption-customer-key-MD5");
61 ::aws_smithy_http::header::one_or_none(headers)
62}
63
64pub(crate) fn de_ssekms_encryption_context_header(
65 header_map: &::aws_smithy_runtime_api::http::Headers,
66) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
67 let headers = header_map.get_all("x-amz-server-side-encryption-context");
68 ::aws_smithy_http::header::one_or_none(headers)
69}
70
71pub(crate) fn de_ssekms_key_id_header(
72 header_map: &::aws_smithy_runtime_api::http::Headers,
73) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
74 let headers = header_map.get_all("x-amz-server-side-encryption-aws-kms-key-id");
75 ::aws_smithy_http::header::one_or_none(headers)
76}
77
78pub(crate) fn de_server_side_encryption_header(
79 header_map: &::aws_smithy_runtime_api::http::Headers,
80) -> ::std::result::Result<::std::option::Option<crate::types::ServerSideEncryption>, ::aws_smithy_http::header::ParseError> {
81 let headers = header_map.get_all("x-amz-server-side-encryption");
82 ::aws_smithy_http::header::one_or_none(headers)
83}
84
85pub(crate) fn de_version_id_header(
86 header_map: &::aws_smithy_runtime_api::http::Headers,
87) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
88 let headers = header_map.get_all("x-amz-version-id");
89 ::aws_smithy_http::header::one_or_none(headers)
90}
91
92pub fn de_copy_object_result(inp: &[u8]) -> std::result::Result<crate::types::CopyObjectResult, ::aws_smithy_xml::decode::XmlDecodeError> {
93 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
94 #[allow(unused_mut)]
95 let mut decoder = doc.root_element()?;
96 let start_el = decoder.start_el();
97 if !(start_el.matches("CopyObjectResult")) {
98 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
99 "invalid root, expected CopyObjectResult got {:?}",
100 start_el
101 )));
102 }
103 crate::protocol_serde::shape_copy_object_result::de_copy_object_result(&mut decoder)
104}