Skip to main content

aws_sdk_cloudformation/protocol_serde/
shape_record_handler_progress.rs

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