Skip to main content

aws_sdk_connect/protocol_serde/
shape_update_routing_profile_default_outbound_queue.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_routing_profile_default_outbound_queue_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::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueOutput,
9    crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError,
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::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::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(
20                crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled(generic),
21            )
22        }
23    };
24
25    let _error_message = generic.message().map(|msg| msg.to_owned());
26    Err(match error_code {
27        "InternalServiceException" => {
28            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::InternalServiceException(
29                {
30                    #[allow(unused_mut)]
31                    let mut tmp = {
32                        #[allow(unused_mut)]
33                        let mut output = crate::types::error::builders::InternalServiceExceptionBuilder::default();
34                        output = crate::protocol_serde::shape_internal_service_exception::de_internal_service_exception_json_err(
35                            _response_body,
36                            output,
37                        )
38                        .map_err(
39                            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled,
40                        )?;
41                        let output = output.meta(generic);
42                        output.build()
43                    };
44                    if tmp.message.is_none() {
45                        tmp.message = _error_message;
46                    }
47                    tmp
48                },
49            )
50        }
51        "InvalidParameterException" => {
52            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::InvalidParameterException(
53                {
54                    #[allow(unused_mut)]
55                    let mut tmp = {
56                        #[allow(unused_mut)]
57                        let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
58                        output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(
59                            _response_body,
60                            output,
61                        )
62                        .map_err(
63                            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled,
64                        )?;
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        }
75        "InvalidRequestException" => {
76            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::InvalidRequestException({
77                #[allow(unused_mut)]
78                let mut tmp = {
79                    #[allow(unused_mut)]
80                    let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
81                    output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
82                        .map_err(
83                            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled,
84                        )?;
85                    let output = output.meta(generic);
86                    output.build()
87                };
88                if tmp.message.is_none() {
89                    tmp.message = _error_message;
90                }
91                tmp
92            })
93        }
94        "ResourceNotFoundException" => {
95            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::ResourceNotFoundException(
96                {
97                    #[allow(unused_mut)]
98                    let mut tmp = {
99                        #[allow(unused_mut)]
100                        let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
101                        output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(
102                            _response_body,
103                            output,
104                        )
105                        .map_err(
106                            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled,
107                        )?;
108                        let output = output.meta(generic);
109                        output.build()
110                    };
111                    if tmp.message.is_none() {
112                        tmp.message = _error_message;
113                    }
114                    tmp
115                },
116            )
117        }
118        "ThrottlingException" => {
119            crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::ThrottlingException({
120                #[allow(unused_mut)]
121                let mut tmp = {
122                    #[allow(unused_mut)]
123                    let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
124                    output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output).map_err(
125                        crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::unhandled,
126                    )?;
127                    let output = output.meta(generic);
128                    output.build()
129                };
130                if tmp.message.is_none() {
131                    tmp.message = _error_message;
132                }
133                tmp
134            })
135        }
136        _ => crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError::generic(generic),
137    })
138}
139
140#[allow(clippy::unnecessary_wraps)]
141pub fn de_update_routing_profile_default_outbound_queue_http_response(
142    _response_status: u16,
143    _response_headers: &::aws_smithy_runtime_api::http::Headers,
144    _response_body: &[u8],
145) -> std::result::Result<
146    crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueOutput,
147    crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueError,
148> {
149    Ok({
150        #[allow(unused_mut)]
151        let mut output =
152            crate::operation::update_routing_profile_default_outbound_queue::builders::UpdateRoutingProfileDefaultOutboundQueueOutputBuilder::default(
153            );
154        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
155        output.build()
156    })
157}
158
159pub fn ser_update_routing_profile_default_outbound_queue_input(
160    input: &crate::operation::update_routing_profile_default_outbound_queue::UpdateRoutingProfileDefaultOutboundQueueInput,
161) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
162    let mut out = String::new();
163    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
164    crate::protocol_serde::shape_update_routing_profile_default_outbound_queue_input::ser_update_routing_profile_default_outbound_queue_input_input(
165        &mut object,
166        input,
167    )?;
168    object.finish();
169    Ok(::aws_smithy_types::body::SdkBody::from(out))
170}