aws_sdk_sms/protocol_serde/
shape_delete_server_catalog.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_server_catalog_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_server_catalog::DeleteServerCatalogOutput,
9    crate::operation::delete_server_catalog::DeleteServerCatalogError,
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_server_catalog::DeleteServerCatalogError::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_server_catalog::DeleteServerCatalogError::unhandled(generic)),
19    };
20
21    let _error_message = generic.message().map(|msg| msg.to_owned());
22    Err(match error_code {
23        "InvalidParameterException" => crate::operation::delete_server_catalog::DeleteServerCatalogError::InvalidParameterException({
24            #[allow(unused_mut)]
25            let mut tmp = {
26                #[allow(unused_mut)]
27                let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
28                output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
29                    .map_err(crate::operation::delete_server_catalog::DeleteServerCatalogError::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        "MissingRequiredParameterException" => {
39            crate::operation::delete_server_catalog::DeleteServerCatalogError::MissingRequiredParameterException({
40                #[allow(unused_mut)]
41                let mut tmp = {
42                    #[allow(unused_mut)]
43                    let mut output = crate::types::error::builders::MissingRequiredParameterExceptionBuilder::default();
44                    output = crate::protocol_serde::shape_missing_required_parameter_exception::de_missing_required_parameter_exception_json_err(
45                        _response_body,
46                        output,
47                    )
48                    .map_err(crate::operation::delete_server_catalog::DeleteServerCatalogError::unhandled)?;
49                    let output = output.meta(generic);
50                    output.build()
51                };
52                if tmp.message.is_none() {
53                    tmp.message = _error_message;
54                }
55                tmp
56            })
57        }
58        "OperationNotPermittedException" => crate::operation::delete_server_catalog::DeleteServerCatalogError::OperationNotPermittedException({
59            #[allow(unused_mut)]
60            let mut tmp = {
61                #[allow(unused_mut)]
62                let mut output = crate::types::error::builders::OperationNotPermittedExceptionBuilder::default();
63                output = crate::protocol_serde::shape_operation_not_permitted_exception::de_operation_not_permitted_exception_json_err(
64                    _response_body,
65                    output,
66                )
67                .map_err(crate::operation::delete_server_catalog::DeleteServerCatalogError::unhandled)?;
68                let output = output.meta(generic);
69                output.build()
70            };
71            if tmp.message.is_none() {
72                tmp.message = _error_message;
73            }
74            tmp
75        }),
76        "UnauthorizedOperationException" => crate::operation::delete_server_catalog::DeleteServerCatalogError::UnauthorizedOperationException({
77            #[allow(unused_mut)]
78            let mut tmp = {
79                #[allow(unused_mut)]
80                let mut output = crate::types::error::builders::UnauthorizedOperationExceptionBuilder::default();
81                output = crate::protocol_serde::shape_unauthorized_operation_exception::de_unauthorized_operation_exception_json_err(
82                    _response_body,
83                    output,
84                )
85                .map_err(crate::operation::delete_server_catalog::DeleteServerCatalogError::unhandled)?;
86                let output = output.meta(generic);
87                output.build()
88            };
89            if tmp.message.is_none() {
90                tmp.message = _error_message;
91            }
92            tmp
93        }),
94        _ => crate::operation::delete_server_catalog::DeleteServerCatalogError::generic(generic),
95    })
96}
97
98#[allow(clippy::unnecessary_wraps)]
99pub fn de_delete_server_catalog_http_response(
100    _response_status: u16,
101    _response_headers: &::aws_smithy_runtime_api::http::Headers,
102    _response_body: &[u8],
103) -> std::result::Result<
104    crate::operation::delete_server_catalog::DeleteServerCatalogOutput,
105    crate::operation::delete_server_catalog::DeleteServerCatalogError,
106> {
107    Ok({
108        #[allow(unused_mut)]
109        let mut output = crate::operation::delete_server_catalog::builders::DeleteServerCatalogOutputBuilder::default();
110        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
111        output.build()
112    })
113}
114
115pub fn ser_delete_server_catalog_input(
116    _input: &crate::operation::delete_server_catalog::DeleteServerCatalogInput,
117) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
118    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
119}