aws_sdk_s3/protocol_serde/
shape_upload_part_copy_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_part_result_payload(
19 body: &[u8],
20) -> std::result::Result<::std::option::Option<crate::types::CopyPartResult>, crate::operation::upload_part_copy::UploadPartCopyError> {
21 (!body.is_empty())
22 .then(|| {
23 crate::protocol_serde::shape_upload_part_copy_output::de_copy_part_result(body)
24 .map_err(crate::operation::upload_part_copy::UploadPartCopyError::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_request_charged_header(
37 header_map: &::aws_smithy_runtime_api::http::Headers,
38) -> ::std::result::Result<::std::option::Option<crate::types::RequestCharged>, ::aws_smithy_http::header::ParseError> {
39 let headers = header_map.get_all("x-amz-request-charged");
40 ::aws_smithy_http::header::one_or_none(headers)
41}
42
43pub(crate) fn de_sse_customer_algorithm_header(
44 header_map: &::aws_smithy_runtime_api::http::Headers,
45) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
46 let headers = header_map.get_all("x-amz-server-side-encryption-customer-algorithm");
47 ::aws_smithy_http::header::one_or_none(headers)
48}
49
50pub(crate) fn de_sse_customer_key_md5_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-key-MD5");
54 ::aws_smithy_http::header::one_or_none(headers)
55}
56
57pub(crate) fn de_ssekms_key_id_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-aws-kms-key-id");
61 ::aws_smithy_http::header::one_or_none(headers)
62}
63
64pub(crate) fn de_server_side_encryption_header(
65 header_map: &::aws_smithy_runtime_api::http::Headers,
66) -> ::std::result::Result<::std::option::Option<crate::types::ServerSideEncryption>, ::aws_smithy_http::header::ParseError> {
67 let headers = header_map.get_all("x-amz-server-side-encryption");
68 ::aws_smithy_http::header::one_or_none(headers)
69}
70
71pub fn de_copy_part_result(inp: &[u8]) -> std::result::Result<crate::types::CopyPartResult, ::aws_smithy_xml::decode::XmlDecodeError> {
72 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
73 #[allow(unused_mut)]
74 let mut decoder = doc.root_element()?;
75 let start_el = decoder.start_el();
76 if !(start_el.matches("CopyPartResult")) {
77 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
78 "invalid root, expected CopyPartResult got {:?}",
79 start_el
80 )));
81 }
82 crate::protocol_serde::shape_copy_part_result::de_copy_part_result(&mut decoder)
83}