1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_start_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::start_speech_synthesis_task::StartSpeechSynthesisTaskOutput,
|
9 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError,
|
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::start_speech_synthesis_task::StartSpeechSynthesisTaskError::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::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "EngineNotSupportedException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::EngineNotSupportedException({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut tmp = {
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::types::error::builders::EngineNotSupportedExceptionBuilder::default();
|
32 - | output =
|
33 - | crate::protocol_serde::shape_engine_not_supported_exception::de_engine_not_supported_exception_json_err(_response_body, output)
|
34 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
35 - | let output = output.meta(generic);
|
36 - | output.build()
|
37 - | };
|
38 - | if tmp.message.is_none() {
|
39 - | tmp.message = _error_message;
|
40 - | }
|
41 - | tmp
|
42 - | }),
|
43 - | "InvalidS3BucketException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidS3BucketException({
|
44 - | #[allow(unused_mut)]
|
45 - | let mut tmp = {
|
46 - | #[allow(unused_mut)]
|
47 - | let mut output = crate::types::error::builders::InvalidS3BucketExceptionBuilder::default();
|
48 - | output = crate::protocol_serde::shape_invalid_s3_bucket_exception::de_invalid_s3_bucket_exception_json_err(_response_body, output)
|
49 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::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 - | "InvalidS3KeyException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidS3KeyException({
|
59 - | #[allow(unused_mut)]
|
60 - | let mut tmp = {
|
61 - | #[allow(unused_mut)]
|
62 - | let mut output = crate::types::error::builders::InvalidS3KeyExceptionBuilder::default();
|
63 - | output = crate::protocol_serde::shape_invalid_s3_key_exception::de_invalid_s3_key_exception_json_err(_response_body, output)
|
64 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::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 - | "InvalidSampleRateException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSampleRateException({
|
74 - | #[allow(unused_mut)]
|
75 - | let mut tmp = {
|
76 - | #[allow(unused_mut)]
|
77 - | let mut output = crate::types::error::builders::InvalidSampleRateExceptionBuilder::default();
|
78 - | output =
|
79 - | crate::protocol_serde::shape_invalid_sample_rate_exception::de_invalid_sample_rate_exception_json_err(_response_body, output)
|
80 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
81 - | let output = output.meta(generic);
|
82 - | output.build()
|
83 - | };
|
84 - | if tmp.message.is_none() {
|
85 - | tmp.message = _error_message;
|
86 - | }
|
87 - | tmp
|
88 - | }),
|
89 - | "InvalidSnsTopicArnException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSnsTopicArnException({
|
90 - | #[allow(unused_mut)]
|
91 - | let mut tmp = {
|
92 - | #[allow(unused_mut)]
|
93 - | let mut output = crate::types::error::builders::InvalidSnsTopicArnExceptionBuilder::default();
|
94 - | output =
|
95 - | crate::protocol_serde::shape_invalid_sns_topic_arn_exception::de_invalid_sns_topic_arn_exception_json_err(_response_body, output)
|
96 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
97 - | let output = output.meta(generic);
|
98 - | output.build()
|
99 - | };
|
100 - | if tmp.message.is_none() {
|
101 - | tmp.message = _error_message;
|
102 - | }
|
103 - | tmp
|
104 - | }),
|
105 - | "InvalidSsmlException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSsmlException({
|
106 - | #[allow(unused_mut)]
|
107 - | let mut tmp = {
|
108 - | #[allow(unused_mut)]
|
109 - | let mut output = crate::types::error::builders::InvalidSsmlExceptionBuilder::default();
|
110 - | output = crate::protocol_serde::shape_invalid_ssml_exception::de_invalid_ssml_exception_json_err(_response_body, output)
|
111 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
112 - | let output = output.meta(generic);
|
113 - | output.build()
|
114 - | };
|
115 - | if tmp.message.is_none() {
|
116 - | tmp.message = _error_message;
|
117 - | }
|
118 - | tmp
|
119 - | }),
|
120 - | "LanguageNotSupportedException" => {
|
121 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::LanguageNotSupportedException({
|
122 - | #[allow(unused_mut)]
|
123 - | let mut tmp = {
|
124 - | #[allow(unused_mut)]
|
125 - | let mut output = crate::types::error::builders::LanguageNotSupportedExceptionBuilder::default();
|
126 - | output = crate::protocol_serde::shape_language_not_supported_exception::de_language_not_supported_exception_json_err(
|
127 - | _response_body,
|
128 - | output,
|
129 - | )
|
130 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
131 - | let output = output.meta(generic);
|
132 - | output.build()
|
133 - | };
|
134 - | if tmp.message.is_none() {
|
135 - | tmp.message = _error_message;
|
136 - | }
|
137 - | tmp
|
138 - | })
|
139 - | }
|
140 - | "LexiconNotFoundException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::LexiconNotFoundException({
|
141 - | #[allow(unused_mut)]
|
142 - | let mut tmp = {
|
143 - | #[allow(unused_mut)]
|
144 - | let mut output = crate::types::error::builders::LexiconNotFoundExceptionBuilder::default();
|
145 - | output = crate::protocol_serde::shape_lexicon_not_found_exception::de_lexicon_not_found_exception_json_err(_response_body, output)
|
146 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
147 - | let output = output.meta(generic);
|
148 - | output.build()
|
149 - | };
|
150 - | if tmp.message.is_none() {
|
151 - | tmp.message = _error_message;
|
152 - | }
|
153 - | tmp
|
154 - | }),
|
155 - | "MarksNotSupportedForFormatException" => {
|
156 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::MarksNotSupportedForFormatException({
|
157 - | #[allow(unused_mut)]
|
158 - | let mut tmp = {
|
159 - | #[allow(unused_mut)]
|
160 - | let mut output = crate::types::error::builders::MarksNotSupportedForFormatExceptionBuilder::default();
|
161 - | output =
|
162 - | crate::protocol_serde::shape_marks_not_supported_for_format_exception::de_marks_not_supported_for_format_exception_json_err(
|
163 - | _response_body,
|
164 - | output,
|
165 - | )
|
166 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
167 - | let output = output.meta(generic);
|
168 - | output.build()
|
169 - | };
|
170 - | if tmp.message.is_none() {
|
171 - | tmp.message = _error_message;
|
172 - | }
|
173 - | tmp
|
174 - | })
|
175 - | }
|
176 - | "ServiceFailureException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::ServiceFailureException({
|
177 - | #[allow(unused_mut)]
|
178 - | let mut tmp = {
|
179 - | #[allow(unused_mut)]
|
180 - | let mut output = crate::types::error::builders::ServiceFailureExceptionBuilder::default();
|
181 - | output = crate::protocol_serde::shape_service_failure_exception::de_service_failure_exception_json_err(_response_body, output)
|
182 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
183 - | let output = output.meta(generic);
|
184 - | output.build()
|
185 - | };
|
186 - | if tmp.message.is_none() {
|
187 - | tmp.message = _error_message;
|
188 - | }
|
189 - | tmp
|
190 - | }),
|
191 - | "SsmlMarksNotSupportedForTextTypeException" => {
|
192 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::SsmlMarksNotSupportedForTextTypeException({
|
193 - | #[allow(unused_mut)]
|
194 - | let mut tmp = {
|
195 - | #[allow(unused_mut)]
|
196 - | let mut output = crate::types::error::builders::SsmlMarksNotSupportedForTextTypeExceptionBuilder::default();
|
197 - | output = crate::protocol_serde::shape_ssml_marks_not_supported_for_text_type_exception::de_ssml_marks_not_supported_for_text_type_exception_json_err(_response_body, output).map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
198 - | let output = output.meta(generic);
|
199 - | output.build()
|
200 - | };
|
201 - | if tmp.message.is_none() {
|
202 - | tmp.message = _error_message;
|
203 - | }
|
204 - | tmp
|
205 - | })
|
206 - | }
|
207 - | "TextLengthExceededException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::TextLengthExceededException({
|
208 - | #[allow(unused_mut)]
|
209 - | let mut tmp = {
|
210 - | #[allow(unused_mut)]
|
211 - | let mut output = crate::types::error::builders::TextLengthExceededExceptionBuilder::default();
|
212 - | output =
|
213 - | crate::protocol_serde::shape_text_length_exceeded_exception::de_text_length_exceeded_exception_json_err(_response_body, output)
|
214 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
215 - | let output = output.meta(generic);
|
216 - | output.build()
|
217 - | };
|
218 - | if tmp.message.is_none() {
|
219 - | tmp.message = _error_message;
|
220 - | }
|
221 - | tmp
|
222 - | }),
|
223 - | _ => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::generic(generic),
|
224 - | })
|
225 - | }
|
226 - |
|
227 - | #[allow(clippy::unnecessary_wraps)]
|
228 - | pub fn de_start_speech_synthesis_task_http_response(
|
229 - | _response_status: u16,
|
230 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
231 - | _response_body: &[u8],
|
232 - | ) -> std::result::Result<
|
233 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskOutput,
|
234 - | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError,
|
235 - | > {
|
236 - | Ok({
|
237 - | #[allow(unused_mut)]
|
238 - | let mut output = crate::operation::start_speech_synthesis_task::builders::StartSpeechSynthesisTaskOutputBuilder::default();
|
239 - | output = crate::protocol_serde::shape_start_speech_synthesis_task::de_start_speech_synthesis_task(_response_body, output)
|
240 - | .map_err(crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled)?;
|
241 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
242 - | output.build()
|
243 - | })
|
244 - | }
|
245 - |
|
246 - | pub fn ser_start_speech_synthesis_task_input(
|
247 - | input: &crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskInput,
|
248 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
249 - | let mut out = String::new();
|
250 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
251 - | crate::protocol_serde::shape_start_speech_synthesis_task_input::ser_start_speech_synthesis_task_input_input(&mut object, input)?;
|
252 - | object.finish();
|
253 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
254 - | }
|
255 - |
|
256 - | pub(crate) fn de_start_speech_synthesis_task(
|
257 - | _value: &[u8],
|
258 - | mut builder: crate::operation::start_speech_synthesis_task::builders::StartSpeechSynthesisTaskOutputBuilder,
|
259 - | ) -> ::std::result::Result<
|
260 - | crate::operation::start_speech_synthesis_task::builders::StartSpeechSynthesisTaskOutputBuilder,
|
261 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
262 - | > {
|
263 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
264 - | let tokens = &mut tokens_owned;
|
265 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
266 - | loop {
|
267 - | match tokens.next().transpose()? {
|
268 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
269 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
270 - | "SynthesisTask" => {
|
271 - | builder = builder.set_synthesis_task(crate::protocol_serde::shape_synthesis_task::de_synthesis_task(tokens, _value)?);
|
272 - | }
|
273 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
274 - | },
|
275 - | other => {
|
276 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
277 - | "expected object key or end object, found: {other:?}"
|
278 - | )))
|
279 - | }
|
280 - | }
|
281 - | }
|
282 - | if tokens.next().is_some() {
|
283 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
284 - | "found more JSON tokens after completing parsing",
|
285 - | ));
|
286 - | }
|
287 - | Ok(builder)
|
288 - | }
|