aws_sdk_s3/protocol_serde/
shape_delete_bucket.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_bucket_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::delete_bucket::DeleteBucketOutput, crate::operation::delete_bucket::DeleteBucketError> {
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::delete_bucket::DeleteBucketError::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::delete_bucket::DeleteBucketError::generic(generic))
15}
16
17#[allow(clippy::unnecessary_wraps)]
18pub fn de_delete_bucket_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::delete_bucket::DeleteBucketOutput, crate::operation::delete_bucket::DeleteBucketError> {
23    Ok({
24        #[allow(unused_mut)]
25        let mut output = crate::operation::delete_bucket::builders::DeleteBucketOutputBuilder::default();
26        output._set_extended_request_id(crate::s3_request_id::RequestIdExt::extended_request_id(_response_headers).map(str::to_string));
27        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
28        output.build()
29    })
30}
31
32pub fn ser_delete_bucket_headers(
33    input: &crate::operation::delete_bucket::DeleteBucketInput,
34    mut builder: ::http::request::Builder,
35) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
36    if let ::std::option::Option::Some(inner_1) = &input.expected_bucket_owner {
37        let formatted_2 = inner_1.as_str();
38        let header_value = formatted_2;
39        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
40            ::aws_smithy_types::error::operation::BuildError::invalid_field(
41                "expected_bucket_owner",
42                format!("`{}` cannot be used as a header value: {}", &header_value, err),
43            )
44        })?;
45        builder = builder.header("x-amz-expected-bucket-owner", header_value);
46    }
47    Ok(builder)
48}