1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_object_torrent_http_response(
|
4 - | response: &mut ::aws_smithy_runtime_api::http::Response,
|
3 + | pub fn de_get_object_torrent_http_error(
|
4 + | _response_status: u16,
|
5 + | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 + | _response_body: &[u8],
|
5 7 | ) -> std::result::Result<crate::operation::get_object_torrent::GetObjectTorrentOutput, crate::operation::get_object_torrent::GetObjectTorrentError> {
|
6 - | let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
|
7 - | std::mem::swap(&mut _response_body, response.body_mut());
|
8 - | let _response_body = &mut _response_body;
|
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::get_object_torrent::GetObjectTorrentError::unhandled)?;
|
11 + | generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
|
12 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
13 + | let generic = generic_builder.build();
|
14 + | Err(crate::operation::get_object_torrent::GetObjectTorrentError::generic(generic))
|
15 + | }
|
9 16 |
|
10 - | let _response_status = response.status().as_u16();
|
11 - | let _response_headers = response.headers();
|
17 + | #[allow(clippy::unnecessary_wraps)]
|
18 + | pub fn de_get_object_torrent_http_response(
|
19 + | _response_status: u16,
|
20 + | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
21 + | _response_body: &[u8],
|
22 + | ) -> std::result::Result<crate::operation::get_object_torrent::GetObjectTorrentOutput, crate::operation::get_object_torrent::GetObjectTorrentError> {
|
12 23 | Ok({
|
13 24 | #[allow(unused_mut)]
|
14 25 | let mut output = crate::operation::get_object_torrent::builders::GetObjectTorrentOutputBuilder::default();
|
15 - | output = output.set_body(Some(crate::protocol_serde::shape_get_object_torrent_output::de_body_payload(
|
16 - | _response_body,
|
17 - | )?));
|
18 26 | output = output.set_request_charged(
|
19 27 | crate::protocol_serde::shape_get_object_torrent_output::de_request_charged_header(_response_headers).map_err(|_| {
|
20 28 | crate::operation::get_object_torrent::GetObjectTorrentError::unhandled(
|
21 29 | "Failed to parse RequestCharged from header `x-amz-request-charged",
|
22 30 | )
|
23 31 | })?,
|
24 32 | );
|
25 33 | output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
|
26 34 | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
27 35 | output.build()
|
28 36 | })
|
29 37 | }
|
30 38 |
|
31 - | #[allow(clippy::unnecessary_wraps)]
|
32 - | pub fn de_get_object_torrent_http_error(
|
33 - | _response_status: u16,
|
34 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
35 - | _response_body: &[u8],
|
36 - | ) -> std::result::Result<crate::operation::get_object_torrent::GetObjectTorrentOutput, crate::operation::get_object_torrent::GetObjectTorrentError> {
|
37 - | #[allow(unused_mut)]
|
38 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
39 - | .map_err(crate::operation::get_object_torrent::GetObjectTorrentError::unhandled)?;
|
40 - | generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
|
41 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
42 - | let generic = generic_builder.build();
|
43 - | Err(crate::operation::get_object_torrent::GetObjectTorrentError::generic(generic))
|
44 - | }
|
45 - |
|
46 39 | pub fn ser_get_object_torrent_headers(
|
47 40 | input: &crate::operation::get_object_torrent::GetObjectTorrentInput,
|
48 41 | mut builder: ::http::request::Builder,
|
49 42 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
50 43 | if let ::std::option::Option::Some(inner_1) = &input.request_payer {
|
51 44 | let formatted_2 = inner_1.as_str();
|
52 45 | let header_value = formatted_2;
|
53 46 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
54 47 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
55 48 | "request_payer",
|
56 49 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
57 50 | )
|
58 51 | })?;
|
59 52 | builder = builder.header("x-amz-request-payer", header_value);
|
60 53 | }
|
61 54 | if let ::std::option::Option::Some(inner_3) = &input.expected_bucket_owner {
|
62 55 | let formatted_4 = inner_3.as_str();
|
63 56 | let header_value = formatted_4;
|
64 57 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
65 58 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
66 59 | "expected_bucket_owner",
|
67 60 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
68 61 | )
|
69 62 | })?;
|
70 63 | builder = builder.header("x-amz-expected-bucket-owner", header_value);
|
71 64 | }
|
72 65 | Ok(builder)
|
73 66 | }
|