aws_sdk_s3/protocol_serde/
shape_get_bucket_ownership_controls.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_bucket_ownership_controls_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_bucket_ownership_controls::GetBucketOwnershipControlsOutput,
9    crate::operation::get_bucket_ownership_controls::GetBucketOwnershipControlsError,
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_bucket_ownership_controls::GetBucketOwnershipControlsError::unhandled)?;
14    generic_builder = crate::s3_request_id::apply_extended_request_id(generic_builder, _response_headers);
15    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
16    let generic = generic_builder.build();
17    Err(crate::operation::get_bucket_ownership_controls::GetBucketOwnershipControlsError::generic(
18        generic,
19    ))
20}
21
22#[allow(clippy::unnecessary_wraps)]
23pub fn de_get_bucket_ownership_controls_http_response(
24    _response_status: u16,
25    _response_headers: &::aws_smithy_runtime_api::http::Headers,
26    _response_body: &[u8],
27) -> std::result::Result<
28    crate::operation::get_bucket_ownership_controls::GetBucketOwnershipControlsOutput,
29    crate::operation::get_bucket_ownership_controls::GetBucketOwnershipControlsError,
30> {
31    Ok({
32        #[allow(unused_mut)]
33        let mut output = crate::operation::get_bucket_ownership_controls::builders::GetBucketOwnershipControlsOutputBuilder::default();
34        output = output.set_ownership_controls(
35            crate::protocol_serde::shape_get_bucket_ownership_controls_output::de_ownership_controls_payload(_response_body)?,
36        );
37        output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
38        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
39        output.build()
40    })
41}
42
43pub fn ser_get_bucket_ownership_controls_headers(
44    input: &crate::operation::get_bucket_ownership_controls::GetBucketOwnershipControlsInput,
45    mut builder: ::http::request::Builder,
46) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
47    if let ::std::option::Option::Some(inner_1) = &input.expected_bucket_owner {
48        let formatted_2 = inner_1.as_str();
49        let header_value = formatted_2;
50        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
51            ::aws_smithy_types::error::operation::BuildError::invalid_field(
52                "expected_bucket_owner",
53                format!("`{}` cannot be used as a header value: {}", &header_value, err),
54            )
55        })?;
56        builder = builder.header("x-amz-expected-bucket-owner", header_value);
57    }
58    Ok(builder)
59}