aws_sdk_backup/protocol_serde/
shape_delete_restore_testing_plan.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_delete_restore_testing_plan_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_restore_testing_plan::DeleteRestoreTestingPlanOutput,
9    crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError,
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_restore_testing_plan::DeleteRestoreTestingPlanError::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 => {
19            return Err(crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::unhandled(
20                generic,
21            ))
22        }
23    };
24
25    let _error_message = generic.message().map(|msg| msg.to_owned());
26    Err(match error_code {
27        "InvalidRequestException" => crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::InvalidRequestException({
28            #[allow(unused_mut)]
29            let mut tmp = {
30                #[allow(unused_mut)]
31                let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
32                output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
33                    .map_err(crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::unhandled)?;
34                let output = output.meta(generic);
35                output.build()
36            };
37            if tmp.message.is_none() {
38                tmp.message = _error_message;
39            }
40            tmp
41        }),
42        "ServiceUnavailableException" => crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::ServiceUnavailableException({
43            #[allow(unused_mut)]
44            let mut tmp = {
45                #[allow(unused_mut)]
46                let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
47                output =
48                    crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
49                        .map_err(crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::unhandled)?;
50                let output = output.meta(generic);
51                output.build()
52            };
53            if tmp.message.is_none() {
54                tmp.message = _error_message;
55            }
56            tmp
57        }),
58        _ => crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError::generic(generic),
59    })
60}
61
62#[allow(clippy::unnecessary_wraps)]
63pub fn de_delete_restore_testing_plan_http_response(
64    _response_status: u16,
65    _response_headers: &::aws_smithy_runtime_api::http::Headers,
66    _response_body: &[u8],
67) -> std::result::Result<
68    crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanOutput,
69    crate::operation::delete_restore_testing_plan::DeleteRestoreTestingPlanError,
70> {
71    Ok({
72        #[allow(unused_mut)]
73        let mut output = crate::operation::delete_restore_testing_plan::builders::DeleteRestoreTestingPlanOutputBuilder::default();
74        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
75        output.build()
76    })
77}