aws_sdk_elasticsearch/protocol_serde/
shape_delete_elasticsearch_service_role.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_elasticsearch_service_role_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::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleOutput,
9    crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError,
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::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::unhandled)?;
14    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15    let generic = generic_builder.build();
16    let error_code = match generic.code() {
17        Some(code) => code,
18        None => return Err(crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::unhandled(generic)),
19    };
20
21    let _error_message = generic.message().map(|msg| msg.to_owned());
22    Err(match error_code {
23        "BaseException" => crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::BaseException({
24            #[allow(unused_mut)]
25            let mut tmp = {
26                #[allow(unused_mut)]
27                let mut output = crate::types::error::builders::BaseExceptionBuilder::default();
28                output = crate::protocol_serde::shape_base_exception::de_base_exception_json_err(_response_body, output)
29                    .map_err(crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::unhandled)?;
30                let output = output.meta(generic);
31                output.build()
32            };
33            if tmp.message.is_none() {
34                tmp.message = _error_message;
35            }
36            tmp
37        }),
38        "InternalException" => crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::InternalException({
39            #[allow(unused_mut)]
40            let mut tmp = {
41                #[allow(unused_mut)]
42                let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
43                output = crate::protocol_serde::shape_internal_exception::de_internal_exception_json_err(_response_body, output)
44                    .map_err(crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::unhandled)?;
45                let output = output.meta(generic);
46                output.build()
47            };
48            if tmp.message.is_none() {
49                tmp.message = _error_message;
50            }
51            tmp
52        }),
53        "ValidationException" => crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::ValidationException({
54            #[allow(unused_mut)]
55            let mut tmp = {
56                #[allow(unused_mut)]
57                let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
58                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
59                    .map_err(crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::unhandled)?;
60                let output = output.meta(generic);
61                output.build()
62            };
63            if tmp.message.is_none() {
64                tmp.message = _error_message;
65            }
66            tmp
67        }),
68        _ => crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError::generic(generic),
69    })
70}
71
72#[allow(clippy::unnecessary_wraps)]
73pub fn de_delete_elasticsearch_service_role_http_response(
74    _response_status: u16,
75    _response_headers: &::aws_smithy_runtime_api::http::Headers,
76    _response_body: &[u8],
77) -> std::result::Result<
78    crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleOutput,
79    crate::operation::delete_elasticsearch_service_role::DeleteElasticsearchServiceRoleError,
80> {
81    Ok({
82        #[allow(unused_mut)]
83        let mut output = crate::operation::delete_elasticsearch_service_role::builders::DeleteElasticsearchServiceRoleOutputBuilder::default();
84        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
85        output.build()
86    })
87}