138 144 | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError,
|
139 145 | >::new());
|
140 146 |
|
141 147 | ::std::borrow::Cow::Owned(rcb)
|
142 148 | }
|
143 149 | }
|
144 150 |
|
145 151 | #[derive(Debug)]
|
146 152 | struct StartSpeechSynthesisTaskResponseDeserializer;
|
147 153 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StartSpeechSynthesisTaskResponseDeserializer {
|
148 - | fn deserialize_nonstreaming(
|
154 + | fn deserialize_nonstreaming_with_config(
|
149 155 | &self,
|
150 156 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
157 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
151 158 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
152 159 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
153 - | let headers = response.headers();
|
154 - | let body = response.body().bytes().expect("body loaded");
|
155 160 | #[allow(unused_mut)]
|
156 161 | let mut force_error = false;
|
157 162 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
158 - | let parse_result = if !success && status != 200 || force_error {
|
159 - | crate::protocol_serde::shape_start_speech_synthesis_task::de_start_speech_synthesis_task_http_error(status, headers, body)
|
163 + | if !success && status != 200 || force_error {
|
164 + | let headers = response.headers();
|
165 + | let body = response.body().bytes().expect("body loaded");
|
166 + | #[allow(unused_mut)]
|
167 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
168 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
169 + | })?;
|
170 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
171 + | let generic = generic_builder.build();
|
172 + | let error_code = match generic.code() {
|
173 + | ::std::option::Option::Some(code) => code,
|
174 + | ::std::option::Option::None => {
|
175 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
176 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
177 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::unhandled(generic),
|
178 + | ),
|
179 + | ))
|
180 + | }
|
181 + | };
|
182 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
183 + | let protocol = _cfg
|
184 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
185 + | .expect("a SharedClientProtocol is required");
|
186 + | let err = match error_code {
|
187 + | "EngineNotSupportedException" => {
|
188 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::EngineNotSupportedException({
|
189 + | let mut tmp = match protocol
|
190 + | .deserialize_response(response, crate::types::error::EngineNotSupportedException::SCHEMA, _cfg)
|
191 + | .and_then(|mut deser| {
|
192 + | crate::types::error::EngineNotSupportedException::deserialize_with_response(
|
193 + | &mut *deser,
|
194 + | response.headers(),
|
195 + | response.status().into(),
|
196 + | body,
|
197 + | )
|
198 + | }) {
|
199 + | ::std::result::Result::Ok(val) => val,
|
200 + | ::std::result::Result::Err(e) => {
|
201 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
202 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
203 + | ))
|
204 + | }
|
205 + | };
|
206 + | tmp.meta = generic;
|
207 + | if tmp.message.is_none() {
|
208 + | tmp.message = _error_message;
|
209 + | }
|
210 + | tmp
|
211 + | })
|
212 + | }
|
213 + | "InvalidS3BucketException" => {
|
214 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidS3BucketException({
|
215 + | let mut tmp = match protocol
|
216 + | .deserialize_response(response, crate::types::error::InvalidS3BucketException::SCHEMA, _cfg)
|
217 + | .and_then(|mut deser| {
|
218 + | crate::types::error::InvalidS3BucketException::deserialize_with_response(
|
219 + | &mut *deser,
|
220 + | response.headers(),
|
221 + | response.status().into(),
|
222 + | body,
|
223 + | )
|
224 + | }) {
|
225 + | ::std::result::Result::Ok(val) => val,
|
226 + | ::std::result::Result::Err(e) => {
|
227 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
228 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
229 + | ))
|
230 + | }
|
231 + | };
|
232 + | tmp.meta = generic;
|
233 + | if tmp.message.is_none() {
|
234 + | tmp.message = _error_message;
|
235 + | }
|
236 + | tmp
|
237 + | })
|
238 + | }
|
239 + | "InvalidS3KeyException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidS3KeyException({
|
240 + | let mut tmp = match protocol
|
241 + | .deserialize_response(response, crate::types::error::InvalidS3KeyException::SCHEMA, _cfg)
|
242 + | .and_then(|mut deser| {
|
243 + | crate::types::error::InvalidS3KeyException::deserialize_with_response(
|
244 + | &mut *deser,
|
245 + | response.headers(),
|
246 + | response.status().into(),
|
247 + | body,
|
248 + | )
|
249 + | }) {
|
250 + | ::std::result::Result::Ok(val) => val,
|
251 + | ::std::result::Result::Err(e) => {
|
252 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
253 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
254 + | ))
|
255 + | }
|
256 + | };
|
257 + | tmp.meta = generic;
|
258 + | if tmp.message.is_none() {
|
259 + | tmp.message = _error_message;
|
260 + | }
|
261 + | tmp
|
262 + | }),
|
263 + | "InvalidSampleRateException" => {
|
264 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSampleRateException({
|
265 + | let mut tmp = match protocol
|
266 + | .deserialize_response(response, crate::types::error::InvalidSampleRateException::SCHEMA, _cfg)
|
267 + | .and_then(|mut deser| {
|
268 + | crate::types::error::InvalidSampleRateException::deserialize_with_response(
|
269 + | &mut *deser,
|
270 + | response.headers(),
|
271 + | response.status().into(),
|
272 + | body,
|
273 + | )
|
274 + | }) {
|
275 + | ::std::result::Result::Ok(val) => val,
|
276 + | ::std::result::Result::Err(e) => {
|
277 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
278 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
279 + | ))
|
280 + | }
|
281 + | };
|
282 + | tmp.meta = generic;
|
283 + | if tmp.message.is_none() {
|
284 + | tmp.message = _error_message;
|
285 + | }
|
286 + | tmp
|
287 + | })
|
288 + | }
|
289 + | "InvalidSnsTopicArnException" => {
|
290 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSnsTopicArnException({
|
291 + | let mut tmp = match protocol
|
292 + | .deserialize_response(response, crate::types::error::InvalidSnsTopicArnException::SCHEMA, _cfg)
|
293 + | .and_then(|mut deser| {
|
294 + | crate::types::error::InvalidSnsTopicArnException::deserialize_with_response(
|
295 + | &mut *deser,
|
296 + | response.headers(),
|
297 + | response.status().into(),
|
298 + | body,
|
299 + | )
|
300 + | }) {
|
301 + | ::std::result::Result::Ok(val) => val,
|
302 + | ::std::result::Result::Err(e) => {
|
303 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
304 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
305 + | ))
|
306 + | }
|
307 + | };
|
308 + | tmp.meta = generic;
|
309 + | if tmp.message.is_none() {
|
310 + | tmp.message = _error_message;
|
311 + | }
|
312 + | tmp
|
313 + | })
|
314 + | }
|
315 + | "InvalidSsmlException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::InvalidSsmlException({
|
316 + | let mut tmp = match protocol
|
317 + | .deserialize_response(response, crate::types::error::InvalidSsmlException::SCHEMA, _cfg)
|
318 + | .and_then(|mut deser| {
|
319 + | crate::types::error::InvalidSsmlException::deserialize_with_response(
|
320 + | &mut *deser,
|
321 + | response.headers(),
|
322 + | response.status().into(),
|
323 + | body,
|
324 + | )
|
325 + | }) {
|
326 + | ::std::result::Result::Ok(val) => val,
|
327 + | ::std::result::Result::Err(e) => {
|
328 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
329 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
330 + | ))
|
331 + | }
|
332 + | };
|
333 + | tmp.meta = generic;
|
334 + | if tmp.message.is_none() {
|
335 + | tmp.message = _error_message;
|
336 + | }
|
337 + | tmp
|
338 + | }),
|
339 + | "LanguageNotSupportedException" => {
|
340 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::LanguageNotSupportedException({
|
341 + | let mut tmp = match protocol
|
342 + | .deserialize_response(response, crate::types::error::LanguageNotSupportedException::SCHEMA, _cfg)
|
343 + | .and_then(|mut deser| {
|
344 + | crate::types::error::LanguageNotSupportedException::deserialize_with_response(
|
345 + | &mut *deser,
|
346 + | response.headers(),
|
347 + | response.status().into(),
|
348 + | body,
|
349 + | )
|
350 + | }) {
|
351 + | ::std::result::Result::Ok(val) => val,
|
352 + | ::std::result::Result::Err(e) => {
|
353 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
354 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
355 + | ))
|
356 + | }
|
357 + | };
|
358 + | tmp.meta = generic;
|
359 + | if tmp.message.is_none() {
|
360 + | tmp.message = _error_message;
|
361 + | }
|
362 + | tmp
|
363 + | })
|
364 + | }
|
365 + | "LexiconNotFoundException" => {
|
366 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::LexiconNotFoundException({
|
367 + | let mut tmp = match protocol
|
368 + | .deserialize_response(response, crate::types::error::LexiconNotFoundException::SCHEMA, _cfg)
|
369 + | .and_then(|mut deser| {
|
370 + | crate::types::error::LexiconNotFoundException::deserialize_with_response(
|
371 + | &mut *deser,
|
372 + | response.headers(),
|
373 + | response.status().into(),
|
374 + | body,
|
375 + | )
|
376 + | }) {
|
377 + | ::std::result::Result::Ok(val) => val,
|
378 + | ::std::result::Result::Err(e) => {
|
379 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
380 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
381 + | ))
|
382 + | }
|
383 + | };
|
384 + | tmp.meta = generic;
|
385 + | if tmp.message.is_none() {
|
386 + | tmp.message = _error_message;
|
387 + | }
|
388 + | tmp
|
389 + | })
|
390 + | }
|
391 + | "MarksNotSupportedForFormatException" => {
|
392 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::MarksNotSupportedForFormatException({
|
393 + | let mut tmp = match protocol
|
394 + | .deserialize_response(response, crate::types::error::MarksNotSupportedForFormatException::SCHEMA, _cfg)
|
395 + | .and_then(|mut deser| {
|
396 + | crate::types::error::MarksNotSupportedForFormatException::deserialize_with_response(
|
397 + | &mut *deser,
|
398 + | response.headers(),
|
399 + | response.status().into(),
|
400 + | body,
|
401 + | )
|
402 + | }) {
|
403 + | ::std::result::Result::Ok(val) => val,
|
404 + | ::std::result::Result::Err(e) => {
|
405 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
406 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
407 + | ))
|
408 + | }
|
409 + | };
|
410 + | tmp.meta = generic;
|
411 + | if tmp.message.is_none() {
|
412 + | tmp.message = _error_message;
|
413 + | }
|
414 + | tmp
|
415 + | })
|
416 + | }
|
417 + | "ServiceFailureException" => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::ServiceFailureException({
|
418 + | let mut tmp = match protocol
|
419 + | .deserialize_response(response, crate::types::error::ServiceFailureException::SCHEMA, _cfg)
|
420 + | .and_then(|mut deser| {
|
421 + | crate::types::error::ServiceFailureException::deserialize_with_response(
|
422 + | &mut *deser,
|
423 + | response.headers(),
|
424 + | response.status().into(),
|
425 + | body,
|
426 + | )
|
427 + | }) {
|
428 + | ::std::result::Result::Ok(val) => val,
|
429 + | ::std::result::Result::Err(e) => {
|
430 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
431 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
432 + | ))
|
433 + | }
|
434 + | };
|
435 + | tmp.meta = generic;
|
436 + | if tmp.message.is_none() {
|
437 + | tmp.message = _error_message;
|
438 + | }
|
439 + | tmp
|
440 + | }),
|
441 + | "SsmlMarksNotSupportedForTextTypeException" => {
|
442 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::SsmlMarksNotSupportedForTextTypeException({
|
443 + | let mut tmp = match protocol
|
444 + | .deserialize_response(response, crate::types::error::SsmlMarksNotSupportedForTextTypeException::SCHEMA, _cfg)
|
445 + | .and_then(|mut deser| {
|
446 + | crate::types::error::SsmlMarksNotSupportedForTextTypeException::deserialize_with_response(
|
447 + | &mut *deser,
|
448 + | response.headers(),
|
449 + | response.status().into(),
|
450 + | body,
|
451 + | )
|
452 + | }) {
|
453 + | ::std::result::Result::Ok(val) => val,
|
454 + | ::std::result::Result::Err(e) => {
|
455 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
456 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
457 + | ))
|
458 + | }
|
459 + | };
|
460 + | tmp.meta = generic;
|
461 + | if tmp.message.is_none() {
|
462 + | tmp.message = _error_message;
|
463 + | }
|
464 + | tmp
|
465 + | })
|
466 + | }
|
467 + | "TextLengthExceededException" => {
|
468 + | crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::TextLengthExceededException({
|
469 + | let mut tmp = match protocol
|
470 + | .deserialize_response(response, crate::types::error::TextLengthExceededException::SCHEMA, _cfg)
|
471 + | .and_then(|mut deser| {
|
472 + | crate::types::error::TextLengthExceededException::deserialize_with_response(
|
473 + | &mut *deser,
|
474 + | response.headers(),
|
475 + | response.status().into(),
|
476 + | body,
|
477 + | )
|
478 + | }) {
|
479 + | ::std::result::Result::Ok(val) => val,
|
480 + | ::std::result::Result::Err(e) => {
|
481 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
482 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
483 + | ))
|
484 + | }
|
485 + | };
|
486 + | tmp.meta = generic;
|
487 + | if tmp.message.is_none() {
|
488 + | tmp.message = _error_message;
|
489 + | }
|
490 + | tmp
|
491 + | })
|
492 + | }
|
493 + | _ => crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskError::generic(generic),
|
494 + | };
|
495 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
496 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
497 + | ))
|
160 498 | } else {
|
161 - | crate::protocol_serde::shape_start_speech_synthesis_task::de_start_speech_synthesis_task_http_response(status, headers, body)
|
162 - | };
|
163 - | crate::protocol_serde::type_erase_result(parse_result)
|
499 + | let protocol = _cfg
|
500 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
501 + | .expect("a SharedClientProtocol is required");
|
502 + | let mut deser = protocol
|
503 + | .deserialize_response(response, StartSpeechSynthesisTask::OUTPUT_SCHEMA, _cfg)
|
504 + | .map_err(|e| {
|
505 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
506 + | })?;
|
507 + | let body = response.body().bytes().expect("body loaded");
|
508 + | let output = crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskOutput::deserialize_with_response(
|
509 + | &mut *deser,
|
510 + | response.headers(),
|
511 + | response.status().into(),
|
512 + | body,
|
513 + | )
|
514 + | .map_err(|e| {
|
515 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
516 + | })?;
|
517 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
518 + | }
|
164 519 | }
|
165 520 | }
|
166 521 | #[derive(Debug)]
|
167 522 | struct StartSpeechSynthesisTaskRequestSerializer;
|
168 523 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StartSpeechSynthesisTaskRequestSerializer {
|
169 524 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
170 525 | fn serialize_input(
|
171 526 | &self,
|
172 527 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
173 528 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
174 529 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
175 530 | let input = input
|
176 531 | .downcast::<crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskInput>()
|
177 532 | .expect("correct type");
|
178 - | let _header_serialization_settings = _cfg
|
179 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
180 - | .cloned()
|
181 - | .unwrap_or_default();
|
182 - | let mut request_builder = {
|
183 - | #[allow(clippy::uninlined_format_args)]
|
184 - | fn uri_base(
|
185 - | _input: &crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskInput,
|
186 - | output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | use ::std::fmt::Write as _;
|
189 - | ::std::write!(output, "/v1/synthesisTasks").expect("formatting should succeed");
|
190 - | ::std::result::Result::Ok(())
|
191 - | }
|
192 - | #[allow(clippy::unnecessary_wraps)]
|
193 - | fn update_http_builder(
|
194 - | input: &crate::operation::start_speech_synthesis_task::StartSpeechSynthesisTaskInput,
|
195 - | builder: ::http_1x::request::Builder,
|
196 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
197 - | let mut uri = ::std::string::String::new();
|
198 - | uri_base(input, &mut uri)?;
|
199 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
200 - | }
|
201 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
202 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
203 - | builder
|
204 - | };
|
205 - | let body = ::aws_smithy_types::body::SdkBody::from(
|
206 - | crate::protocol_serde::shape_start_speech_synthesis_task::ser_start_speech_synthesis_task_input(&input)?,
|
207 - | );
|
208 - | if let Some(content_length) = body.content_length() {
|
209 - | let content_length = content_length.to_string();
|
210 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
211 - | }
|
212 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
533 + | let protocol = _cfg
|
534 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
535 + | .expect("a SharedClientProtocol is required");
|
536 + | let mut request = protocol
|
537 + | .serialize_request(&input, StartSpeechSynthesisTask::INPUT_SCHEMA, "", _cfg)
|
538 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
539 + |
|
540 + | return ::std::result::Result::Ok(request);
|
213 541 | }
|
214 542 | }
|
215 543 | #[derive(Debug)]
|
216 544 | struct StartSpeechSynthesisTaskEndpointParamsInterceptor;
|
217 545 |
|
218 546 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartSpeechSynthesisTaskEndpointParamsInterceptor {
|
219 547 | fn name(&self) -> &'static str {
|
220 548 | "StartSpeechSynthesisTaskEndpointParamsInterceptor"
|
221 549 | }
|
222 550 |
|