1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_speech_synthesis_task_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::get_speech_synthesis_task::GetSpeechSynthesisTaskOutput,
|
9 - | crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError,
|
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::get_speech_synthesis_task::GetSpeechSynthesisTaskError::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::get_speech_synthesis_task::GetSpeechSynthesisTaskError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "InvalidTaskIdException" => crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::InvalidTaskIdException({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut tmp = {
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::types::error::builders::InvalidTaskIdExceptionBuilder::default();
|
32 - | output = crate::protocol_serde::shape_invalid_task_id_exception::de_invalid_task_id_exception_json_err(_response_body, output)
|
33 - | .map_err(crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::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 - | "ServiceFailureException" => crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::ServiceFailureException({
|
43 - | #[allow(unused_mut)]
|
44 - | let mut tmp = {
|
45 - | #[allow(unused_mut)]
|
46 - | let mut output = crate::types::error::builders::ServiceFailureExceptionBuilder::default();
|
47 - | output = crate::protocol_serde::shape_service_failure_exception::de_service_failure_exception_json_err(_response_body, output)
|
48 - | .map_err(crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::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 - | "SynthesisTaskNotFoundException" => {
|
58 - | crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::SynthesisTaskNotFoundException({
|
59 - | #[allow(unused_mut)]
|
60 - | let mut tmp = {
|
61 - | #[allow(unused_mut)]
|
62 - | let mut output = crate::types::error::builders::SynthesisTaskNotFoundExceptionBuilder::default();
|
63 - | output = crate::protocol_serde::shape_synthesis_task_not_found_exception::de_synthesis_task_not_found_exception_json_err(
|
64 - | _response_body,
|
65 - | output,
|
66 - | )
|
67 - | .map_err(crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::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 - | }
|
77 - | _ => crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::generic(generic),
|
78 - | })
|
79 - | }
|
80 - |
|
81 - | #[allow(clippy::unnecessary_wraps)]
|
82 - | pub fn de_get_speech_synthesis_task_http_response(
|
83 - | _response_status: u16,
|
84 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
85 - | _response_body: &[u8],
|
86 - | ) -> std::result::Result<
|
87 - | crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskOutput,
|
88 - | crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError,
|
89 - | > {
|
90 - | Ok({
|
91 - | #[allow(unused_mut)]
|
92 - | let mut output = crate::operation::get_speech_synthesis_task::builders::GetSpeechSynthesisTaskOutputBuilder::default();
|
93 - | output = crate::protocol_serde::shape_get_speech_synthesis_task::de_get_speech_synthesis_task(_response_body, output)
|
94 - | .map_err(crate::operation::get_speech_synthesis_task::GetSpeechSynthesisTaskError::unhandled)?;
|
95 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
96 - | output.build()
|
97 - | })
|
98 - | }
|
99 - |
|
100 - | pub(crate) fn de_get_speech_synthesis_task(
|
101 - | _value: &[u8],
|
102 - | mut builder: crate::operation::get_speech_synthesis_task::builders::GetSpeechSynthesisTaskOutputBuilder,
|
103 - | ) -> ::std::result::Result<
|
104 - | crate::operation::get_speech_synthesis_task::builders::GetSpeechSynthesisTaskOutputBuilder,
|
105 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
106 - | > {
|
107 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
108 - | let tokens = &mut tokens_owned;
|
109 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
110 - | loop {
|
111 - | match tokens.next().transpose()? {
|
112 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
113 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
114 - | "SynthesisTask" => {
|
115 - | builder = builder.set_synthesis_task(crate::protocol_serde::shape_synthesis_task::de_synthesis_task(tokens, _value)?);
|
116 - | }
|
117 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
118 - | },
|
119 - | other => {
|
120 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
121 - | "expected object key or end object, found: {other:?}"
|
122 - | )))
|
123 - | }
|
124 - | }
|
125 - | }
|
126 - | if tokens.next().is_some() {
|
127 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
128 - | "found more JSON tokens after completing parsing",
|
129 - | ));
|
130 - | }
|
131 - | Ok(builder)
|
132 - | }
|