aws_sdk_redshift/protocol_serde/
shape_modify_cluster_snapshot_schedule.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_modify_cluster_snapshot_schedule_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::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleOutput,
9    crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError,
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::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::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::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::unhandled(generic)),
19    };
20
21    let _error_message = generic.message().map(|msg| msg.to_owned());
22    Err(match error_code {
23        "ClusterNotFound" => crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::ClusterNotFoundFault({
24            #[allow(unused_mut)]
25            let mut tmp = {
26                #[allow(unused_mut)]
27                let mut output = crate::types::error::builders::ClusterNotFoundFaultBuilder::default();
28                output = crate::protocol_serde::shape_cluster_not_found_fault::de_cluster_not_found_fault_xml_err(_response_body, output)
29                    .map_err(crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::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        "InvalidClusterSnapshotScheduleState" => {
39            crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::InvalidClusterSnapshotScheduleStateFault({
40                #[allow(unused_mut)]
41                let mut tmp = {
42                    #[allow(unused_mut)]
43                    let mut output = crate::types::error::builders::InvalidClusterSnapshotScheduleStateFaultBuilder::default();
44                    output = crate::protocol_serde::shape_invalid_cluster_snapshot_schedule_state_fault::de_invalid_cluster_snapshot_schedule_state_fault_xml_err(_response_body, output).map_err(crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::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        }
54        "SnapshotScheduleNotFound" => {
55            crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::SnapshotScheduleNotFoundFault({
56                #[allow(unused_mut)]
57                let mut tmp = {
58                    #[allow(unused_mut)]
59                    let mut output = crate::types::error::builders::SnapshotScheduleNotFoundFaultBuilder::default();
60                    output = crate::protocol_serde::shape_snapshot_schedule_not_found_fault::de_snapshot_schedule_not_found_fault_xml_err(
61                        _response_body,
62                        output,
63                    )
64                    .map_err(crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::unhandled)?;
65                    let output = output.meta(generic);
66                    output.build()
67                };
68                if tmp.message.is_none() {
69                    tmp.message = _error_message;
70                }
71                tmp
72            })
73        }
74        _ => crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError::generic(generic),
75    })
76}
77
78#[allow(clippy::unnecessary_wraps)]
79pub fn de_modify_cluster_snapshot_schedule_http_response(
80    _response_status: u16,
81    _response_headers: &::aws_smithy_runtime_api::http::Headers,
82    _response_body: &[u8],
83) -> std::result::Result<
84    crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleOutput,
85    crate::operation::modify_cluster_snapshot_schedule::ModifyClusterSnapshotScheduleError,
86> {
87    Ok({
88        #[allow(unused_mut)]
89        let mut output = crate::operation::modify_cluster_snapshot_schedule::builders::ModifyClusterSnapshotScheduleOutputBuilder::default();
90        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
91        output.build()
92    })
93}