76 80 | runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
|
77 81 | }
|
78 82 | runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
|
79 83 | config_override,
|
80 84 | client_config.config.clone(),
|
81 85 | &client_config.runtime_components,
|
82 86 | ));
|
83 87 | }
|
84 88 | runtime_plugins
|
85 89 | }
|
90 + | /// The schema for this operation's presigned input shape.
|
91 + | pub const PRESIGNED_INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = &PRESIGNED_SCHEMA;
|
86 92 | }
|
93 + | static PRESIGNED_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
|
94 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput",
|
95 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
96 + | "SynthesizeSpeechInput",
|
97 + | );
|
98 + | static PRESIGNED_MEMBER_ENGINE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
99 + | ::aws_smithy_schema::ShapeId::from_static(
|
100 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$Engine",
|
101 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
102 + | "SynthesizeSpeechInput",
|
103 + | ),
|
104 + | ::aws_smithy_schema::ShapeType::String,
|
105 + | "Engine",
|
106 + | 0,
|
107 + | )
|
108 + | .with_http_query("Engine");
|
109 + | static PRESIGNED_MEMBER_LANGUAGE_CODE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
110 + | ::aws_smithy_schema::ShapeId::from_static(
|
111 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$LanguageCode",
|
112 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
113 + | "SynthesizeSpeechInput",
|
114 + | ),
|
115 + | ::aws_smithy_schema::ShapeType::String,
|
116 + | "LanguageCode",
|
117 + | 1,
|
118 + | )
|
119 + | .with_http_query("LanguageCode");
|
120 + | static PRESIGNED_MEMBER_LEXICON_NAMES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
121 + | ::aws_smithy_schema::ShapeId::from_static(
|
122 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$LexiconNames",
|
123 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
124 + | "SynthesizeSpeechInput",
|
125 + | ),
|
126 + | ::aws_smithy_schema::ShapeType::List,
|
127 + | "LexiconNames",
|
128 + | 2,
|
129 + | )
|
130 + | .with_http_query("LexiconNames");
|
131 + | static PRESIGNED_MEMBER_OUTPUT_FORMAT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
132 + | ::aws_smithy_schema::ShapeId::from_static(
|
133 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$OutputFormat",
|
134 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
135 + | "SynthesizeSpeechInput",
|
136 + | ),
|
137 + | ::aws_smithy_schema::ShapeType::String,
|
138 + | "OutputFormat",
|
139 + | 3,
|
140 + | )
|
141 + | .with_http_query("OutputFormat");
|
142 + | static PRESIGNED_MEMBER_SAMPLE_RATE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
143 + | ::aws_smithy_schema::ShapeId::from_static(
|
144 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$SampleRate",
|
145 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
146 + | "SynthesizeSpeechInput",
|
147 + | ),
|
148 + | ::aws_smithy_schema::ShapeType::String,
|
149 + | "SampleRate",
|
150 + | 4,
|
151 + | )
|
152 + | .with_http_query("SampleRate");
|
153 + | static PRESIGNED_MEMBER_SPEECH_MARK_TYPES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
154 + | ::aws_smithy_schema::ShapeId::from_static(
|
155 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$SpeechMarkTypes",
|
156 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
157 + | "SynthesizeSpeechInput",
|
158 + | ),
|
159 + | ::aws_smithy_schema::ShapeType::List,
|
160 + | "SpeechMarkTypes",
|
161 + | 5,
|
162 + | )
|
163 + | .with_http_query("SpeechMarkTypes");
|
164 + | static PRESIGNED_MEMBER_TEXT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
165 + | ::aws_smithy_schema::ShapeId::from_static(
|
166 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$Text",
|
167 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
168 + | "SynthesizeSpeechInput",
|
169 + | ),
|
170 + | ::aws_smithy_schema::ShapeType::String,
|
171 + | "Text",
|
172 + | 6,
|
173 + | )
|
174 + | .with_http_query("Text");
|
175 + | static PRESIGNED_MEMBER_TEXT_TYPE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
176 + | ::aws_smithy_schema::ShapeId::from_static(
|
177 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$TextType",
|
178 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
179 + | "SynthesizeSpeechInput",
|
180 + | ),
|
181 + | ::aws_smithy_schema::ShapeType::String,
|
182 + | "TextType",
|
183 + | 7,
|
184 + | )
|
185 + | .with_http_query("TextType");
|
186 + | static PRESIGNED_MEMBER_VOICE_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
187 + | ::aws_smithy_schema::ShapeId::from_static(
|
188 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned#SynthesizeSpeechInput$VoiceId",
|
189 + | "com.amazonaws.polly.synthetic.synthetic.aws.presigned",
|
190 + | "SynthesizeSpeechInput",
|
191 + | ),
|
192 + | ::aws_smithy_schema::ShapeType::String,
|
193 + | "VoiceId",
|
194 + | 8,
|
195 + | )
|
196 + | .with_http_query("VoiceId");
|
197 + | static PRESIGNED_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
198 + | PRESIGNED_SCHEMA_ID,
|
199 + | ::aws_smithy_schema::ShapeType::Structure,
|
200 + | &[
|
201 + | &PRESIGNED_MEMBER_ENGINE,
|
202 + | &PRESIGNED_MEMBER_LANGUAGE_CODE,
|
203 + | &PRESIGNED_MEMBER_LEXICON_NAMES,
|
204 + | &PRESIGNED_MEMBER_OUTPUT_FORMAT,
|
205 + | &PRESIGNED_MEMBER_SAMPLE_RATE,
|
206 + | &PRESIGNED_MEMBER_SPEECH_MARK_TYPES,
|
207 + | &PRESIGNED_MEMBER_TEXT,
|
208 + | &PRESIGNED_MEMBER_TEXT_TYPE,
|
209 + | &PRESIGNED_MEMBER_VOICE_ID,
|
210 + | ],
|
211 + | )
|
212 + | .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/v1/speech", None));
|
87 213 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for SynthesizeSpeech {
|
88 214 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
89 215 | let mut cfg = ::aws_smithy_types::config_bag::Layer::new("SynthesizeSpeech");
|
90 216 |
|
91 217 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
|
92 218 | SynthesizeSpeechRequestSerializer,
|
93 219 | ));
|
94 220 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
|
95 221 | SynthesizeSpeechResponseDeserializer,
|
96 222 | ));
|
152 278 |
|
153 279 | // If this is an error, defer to the non-streaming parser
|
154 280 | if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
|
155 281 | return ::std::option::Option::None;
|
156 282 | }
|
157 283 | ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
|
158 284 | crate::protocol_serde::shape_synthesize_speech::de_synthesize_speech_http_response(response),
|
159 285 | ))
|
160 286 | }
|
161 287 |
|
162 - | fn deserialize_nonstreaming(
|
288 + | fn deserialize_nonstreaming_with_config(
|
163 289 | &self,
|
164 290 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
291 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
165 292 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
166 293 | // For streaming operations, we only hit this case if its an error
|
167 294 | let body = response.body().bytes().expect("body loaded");
|
168 - | crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_synthesize_speech::de_synthesize_speech_http_error(
|
169 - | response.status().as_u16(),
|
295 + | let status = response.status().as_u16();
|
296 + | let headers = response.headers();
|
297 + | #[allow(unused_mut)]
|
298 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
299 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
300 + | })?;
|
301 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
302 + | let generic = generic_builder.build();
|
303 + | let error_code = match generic.code() {
|
304 + | ::std::option::Option::Some(code) => code,
|
305 + | ::std::option::Option::None => {
|
306 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
307 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::synthesize_speech::SynthesizeSpeechError::unhandled(
|
308 + | generic,
|
309 + | )),
|
310 + | ))
|
311 + | }
|
312 + | };
|
313 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
314 + | let protocol = _cfg
|
315 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
316 + | .expect("a SharedClientProtocol is required");
|
317 + | let err = match error_code {
|
318 + | "EngineNotSupportedException" => crate::operation::synthesize_speech::SynthesizeSpeechError::EngineNotSupportedException({
|
319 + | let mut tmp = match protocol
|
320 + | .deserialize_response(response, crate::types::error::EngineNotSupportedException::SCHEMA, _cfg)
|
321 + | .and_then(|mut deser| {
|
322 + | crate::types::error::EngineNotSupportedException::deserialize_with_response(
|
323 + | &mut *deser,
|
324 + | response.headers(),
|
325 + | response.status().into(),
|
326 + | body,
|
327 + | )
|
328 + | }) {
|
329 + | ::std::result::Result::Ok(val) => val,
|
330 + | ::std::result::Result::Err(e) => {
|
331 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
332 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
333 + | ))
|
334 + | }
|
335 + | };
|
336 + | tmp.meta = generic;
|
337 + | if tmp.message.is_none() {
|
338 + | tmp.message = _error_message;
|
339 + | }
|
340 + | tmp
|
341 + | }),
|
342 + | "InvalidSampleRateException" => crate::operation::synthesize_speech::SynthesizeSpeechError::InvalidSampleRateException({
|
343 + | let mut tmp = match protocol
|
344 + | .deserialize_response(response, crate::types::error::InvalidSampleRateException::SCHEMA, _cfg)
|
345 + | .and_then(|mut deser| {
|
346 + | crate::types::error::InvalidSampleRateException::deserialize_with_response(
|
347 + | &mut *deser,
|
348 + | response.headers(),
|
349 + | response.status().into(),
|
350 + | body,
|
351 + | )
|
352 + | }) {
|
353 + | ::std::result::Result::Ok(val) => val,
|
354 + | ::std::result::Result::Err(e) => {
|
355 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
356 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
357 + | ))
|
358 + | }
|
359 + | };
|
360 + | tmp.meta = generic;
|
361 + | if tmp.message.is_none() {
|
362 + | tmp.message = _error_message;
|
363 + | }
|
364 + | tmp
|
365 + | }),
|
366 + | "InvalidSsmlException" => crate::operation::synthesize_speech::SynthesizeSpeechError::InvalidSsmlException({
|
367 + | let mut tmp = match protocol
|
368 + | .deserialize_response(response, crate::types::error::InvalidSsmlException::SCHEMA, _cfg)
|
369 + | .and_then(|mut deser| {
|
370 + | crate::types::error::InvalidSsmlException::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 + | "LanguageNotSupportedException" => crate::operation::synthesize_speech::SynthesizeSpeechError::LanguageNotSupportedException({
|
391 + | let mut tmp = match protocol
|
392 + | .deserialize_response(response, crate::types::error::LanguageNotSupportedException::SCHEMA, _cfg)
|
393 + | .and_then(|mut deser| {
|
394 + | crate::types::error::LanguageNotSupportedException::deserialize_with_response(
|
395 + | &mut *deser,
|
170 396 | response.headers(),
|
397 + | response.status().into(),
|
171 398 | body,
|
399 + | )
|
400 + | }) {
|
401 + | ::std::result::Result::Ok(val) => val,
|
402 + | ::std::result::Result::Err(e) => {
|
403 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
404 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
405 + | ))
|
406 + | }
|
407 + | };
|
408 + | tmp.meta = generic;
|
409 + | if tmp.message.is_none() {
|
410 + | tmp.message = _error_message;
|
411 + | }
|
412 + | tmp
|
413 + | }),
|
414 + | "LexiconNotFoundException" => crate::operation::synthesize_speech::SynthesizeSpeechError::LexiconNotFoundException({
|
415 + | let mut tmp = match protocol
|
416 + | .deserialize_response(response, crate::types::error::LexiconNotFoundException::SCHEMA, _cfg)
|
417 + | .and_then(|mut deser| {
|
418 + | crate::types::error::LexiconNotFoundException::deserialize_with_response(
|
419 + | &mut *deser,
|
420 + | response.headers(),
|
421 + | response.status().into(),
|
422 + | body,
|
423 + | )
|
424 + | }) {
|
425 + | ::std::result::Result::Ok(val) => val,
|
426 + | ::std::result::Result::Err(e) => {
|
427 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
428 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
429 + | ))
|
430 + | }
|
431 + | };
|
432 + | tmp.meta = generic;
|
433 + | if tmp.message.is_none() {
|
434 + | tmp.message = _error_message;
|
435 + | }
|
436 + | tmp
|
437 + | }),
|
438 + | "MarksNotSupportedForFormatException" => {
|
439 + | crate::operation::synthesize_speech::SynthesizeSpeechError::MarksNotSupportedForFormatException({
|
440 + | let mut tmp = match protocol
|
441 + | .deserialize_response(response, crate::types::error::MarksNotSupportedForFormatException::SCHEMA, _cfg)
|
442 + | .and_then(|mut deser| {
|
443 + | crate::types::error::MarksNotSupportedForFormatException::deserialize_with_response(
|
444 + | &mut *deser,
|
445 + | response.headers(),
|
446 + | response.status().into(),
|
447 + | body,
|
448 + | )
|
449 + | }) {
|
450 + | ::std::result::Result::Ok(val) => val,
|
451 + | ::std::result::Result::Err(e) => {
|
452 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
453 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
454 + | ))
|
455 + | }
|
456 + | };
|
457 + | tmp.meta = generic;
|
458 + | if tmp.message.is_none() {
|
459 + | tmp.message = _error_message;
|
460 + | }
|
461 + | tmp
|
462 + | })
|
463 + | }
|
464 + | "ServiceFailureException" => crate::operation::synthesize_speech::SynthesizeSpeechError::ServiceFailureException({
|
465 + | let mut tmp = match protocol
|
466 + | .deserialize_response(response, crate::types::error::ServiceFailureException::SCHEMA, _cfg)
|
467 + | .and_then(|mut deser| {
|
468 + | crate::types::error::ServiceFailureException::deserialize_with_response(
|
469 + | &mut *deser,
|
470 + | response.headers(),
|
471 + | response.status().into(),
|
472 + | body,
|
473 + | )
|
474 + | }) {
|
475 + | ::std::result::Result::Ok(val) => val,
|
476 + | ::std::result::Result::Err(e) => {
|
477 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
478 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
479 + | ))
|
480 + | }
|
481 + | };
|
482 + | tmp.meta = generic;
|
483 + | if tmp.message.is_none() {
|
484 + | tmp.message = _error_message;
|
485 + | }
|
486 + | tmp
|
487 + | }),
|
488 + | "SsmlMarksNotSupportedForTextTypeException" => {
|
489 + | crate::operation::synthesize_speech::SynthesizeSpeechError::SsmlMarksNotSupportedForTextTypeException({
|
490 + | let mut tmp = match protocol
|
491 + | .deserialize_response(response, crate::types::error::SsmlMarksNotSupportedForTextTypeException::SCHEMA, _cfg)
|
492 + | .and_then(|mut deser| {
|
493 + | crate::types::error::SsmlMarksNotSupportedForTextTypeException::deserialize_with_response(
|
494 + | &mut *deser,
|
495 + | response.headers(),
|
496 + | response.status().into(),
|
497 + | body,
|
498 + | )
|
499 + | }) {
|
500 + | ::std::result::Result::Ok(val) => val,
|
501 + | ::std::result::Result::Err(e) => {
|
502 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
503 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
504 + | ))
|
505 + | }
|
506 + | };
|
507 + | tmp.meta = generic;
|
508 + | if tmp.message.is_none() {
|
509 + | tmp.message = _error_message;
|
510 + | }
|
511 + | tmp
|
512 + | })
|
513 + | }
|
514 + | "TextLengthExceededException" => crate::operation::synthesize_speech::SynthesizeSpeechError::TextLengthExceededException({
|
515 + | let mut tmp = match protocol
|
516 + | .deserialize_response(response, crate::types::error::TextLengthExceededException::SCHEMA, _cfg)
|
517 + | .and_then(|mut deser| {
|
518 + | crate::types::error::TextLengthExceededException::deserialize_with_response(
|
519 + | &mut *deser,
|
520 + | response.headers(),
|
521 + | response.status().into(),
|
522 + | body,
|
523 + | )
|
524 + | }) {
|
525 + | ::std::result::Result::Ok(val) => val,
|
526 + | ::std::result::Result::Err(e) => {
|
527 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
528 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
529 + | ))
|
530 + | }
|
531 + | };
|
532 + | tmp.meta = generic;
|
533 + | if tmp.message.is_none() {
|
534 + | tmp.message = _error_message;
|
535 + | }
|
536 + | tmp
|
537 + | }),
|
538 + | _ => crate::operation::synthesize_speech::SynthesizeSpeechError::generic(generic),
|
539 + | };
|
540 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
541 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
172 542 | ))
|
173 543 | }
|
174 544 | }
|
175 545 | #[derive(Debug)]
|
176 546 | struct SynthesizeSpeechRequestSerializer;
|
177 547 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for SynthesizeSpeechRequestSerializer {
|
178 548 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
179 549 | fn serialize_input(
|
180 550 | &self,
|
181 551 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
182 552 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
183 553 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
184 554 | let input = input
|
185 555 | .downcast::<crate::operation::synthesize_speech::SynthesizeSpeechInput>()
|
186 556 | .expect("correct type");
|
187 - | let _header_serialization_settings = _cfg
|
188 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
189 - | .cloned()
|
190 - | .unwrap_or_default();
|
191 - | let mut request_builder = {
|
192 - | #[allow(clippy::uninlined_format_args)]
|
193 - | fn uri_base(
|
194 - | _input: &crate::operation::synthesize_speech::SynthesizeSpeechInput,
|
195 - | output: &mut ::std::string::String,
|
196 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
197 - | use ::std::fmt::Write as _;
|
198 - | ::std::write!(output, "/v1/speech").expect("formatting should succeed");
|
199 - | ::std::result::Result::Ok(())
|
200 - | }
|
201 - | #[allow(clippy::unnecessary_wraps)]
|
202 - | fn update_http_builder(
|
203 - | input: &crate::operation::synthesize_speech::SynthesizeSpeechInput,
|
204 - | builder: ::http_1x::request::Builder,
|
205 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
206 - | let mut uri = ::std::string::String::new();
|
207 - | uri_base(input, &mut uri)?;
|
208 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
209 - | }
|
210 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
211 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
212 - | builder
|
213 - | };
|
214 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_synthesize_speech::ser_synthesize_speech_input(&input)?);
|
215 - | if let Some(content_length) = body.content_length() {
|
216 - | let content_length = content_length.to_string();
|
217 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
218 - | }
|
219 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
557 + | let protocol = _cfg
|
558 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
559 + | .expect("a SharedClientProtocol is required");
|
560 + | let mut request = protocol
|
561 + | .serialize_request(&input, SynthesizeSpeech::INPUT_SCHEMA, "", _cfg)
|
562 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
563 + |
|
564 + | return ::std::result::Result::Ok(request);
|
220 565 | }
|
221 566 | }
|
222 567 | #[derive(Debug)]
|
223 568 | struct SynthesizeSpeechEndpointParamsInterceptor;
|
224 569 |
|
225 570 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for SynthesizeSpeechEndpointParamsInterceptor {
|
226 571 | fn name(&self) -> &'static str {
|
227 572 | "SynthesizeSpeechEndpointParamsInterceptor"
|
228 573 | }
|
229 574 |
|
460 805 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for SynthesizeSpeechPresigningRequestSerializer {
|
461 806 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
462 807 | fn serialize_input(
|
463 808 | &self,
|
464 809 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
465 810 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
466 811 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
467 812 | let input = input
|
468 813 | .downcast::<crate::operation::synthesize_speech::SynthesizeSpeechInput>()
|
469 814 | .expect("correct type");
|
470 - | let _header_serialization_settings = _cfg
|
471 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
472 - | .cloned()
|
473 - | .unwrap_or_default();
|
474 - | let mut request_builder = {
|
475 - | #[allow(clippy::uninlined_format_args)]
|
476 - | fn uri_base(
|
477 - | _input: &crate::operation::synthesize_speech::SynthesizeSpeechInput,
|
478 - | output: &mut ::std::string::String,
|
479 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
480 - | use ::std::fmt::Write as _;
|
481 - | ::std::write!(output, "/v1/speech").expect("formatting should succeed");
|
482 - | ::std::result::Result::Ok(())
|
483 - | }
|
484 - | fn uri_query(
|
485 - | _input: &crate::operation::synthesize_speech::SynthesizeSpeechInput,
|
486 - | mut output: &mut ::std::string::String,
|
487 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
488 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
489 - | if let ::std::option::Option::Some(inner_1) = &_input.engine {
|
490 - | {
|
491 - | query.push_kv("Engine", &::aws_smithy_http::query::fmt_string(inner_1.as_str()));
|
492 - | }
|
493 - | }
|
494 - | if let ::std::option::Option::Some(inner_2) = &_input.language_code {
|
495 - | {
|
496 - | query.push_kv("LanguageCode", &::aws_smithy_http::query::fmt_string(inner_2.as_str()));
|
497 - | }
|
498 - | }
|
499 - | if let ::std::option::Option::Some(inner_3) = &_input.lexicon_names {
|
500 - | {
|
501 - | for inner_4 in inner_3 {
|
502 - | query.push_kv("LexiconNames", &::aws_smithy_http::query::fmt_string(inner_4));
|
503 - | }
|
504 - | }
|
505 - | }
|
506 - | let inner_5 = &_input.output_format;
|
507 - | let inner_5 = inner_5
|
508 - | .as_ref()
|
509 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("output_format", "cannot be empty or unset"))?;
|
510 - | query.push_kv("OutputFormat", &::aws_smithy_http::query::fmt_string(inner_5.as_str()));
|
511 - | if let ::std::option::Option::Some(inner_6) = &_input.sample_rate {
|
512 - | {
|
513 - | query.push_kv("SampleRate", &::aws_smithy_http::query::fmt_string(inner_6));
|
514 - | }
|
515 - | }
|
516 - | if let ::std::option::Option::Some(inner_7) = &_input.speech_mark_types {
|
517 - | {
|
518 - | for inner_8 in inner_7 {
|
519 - | query.push_kv("SpeechMarkTypes", &::aws_smithy_http::query::fmt_string(inner_8.as_str()));
|
520 - | }
|
521 - | }
|
522 - | }
|
523 - | let inner_9 = &_input.text;
|
524 - | let inner_9 = inner_9
|
525 - | .as_ref()
|
526 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("text", "cannot be empty or unset"))?;
|
527 - | if inner_9.is_empty() {
|
528 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
529 - | "text",
|
530 - | "cannot be empty or unset",
|
531 - | ));
|
532 - | }
|
533 - | query.push_kv("Text", &::aws_smithy_http::query::fmt_string(inner_9));
|
534 - | if let ::std::option::Option::Some(inner_10) = &_input.text_type {
|
535 - | {
|
536 - | query.push_kv("TextType", &::aws_smithy_http::query::fmt_string(inner_10.as_str()));
|
537 - | }
|
538 - | }
|
539 - | let inner_11 = &_input.voice_id;
|
540 - | let inner_11 = inner_11
|
541 - | .as_ref()
|
542 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("voice_id", "cannot be empty or unset"))?;
|
543 - | query.push_kv("VoiceId", &::aws_smithy_http::query::fmt_string(inner_11.as_str()));
|
544 - | ::std::result::Result::Ok(())
|
545 - | }
|
546 - | #[allow(clippy::unnecessary_wraps)]
|
547 - | fn update_http_builder(
|
548 - | input: &crate::operation::synthesize_speech::SynthesizeSpeechInput,
|
549 - | builder: ::http_1x::request::Builder,
|
550 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
551 - | let mut uri = ::std::string::String::new();
|
552 - | uri_base(input, &mut uri)?;
|
553 - | uri_query(input, &mut uri)?;
|
554 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
555 - | }
|
556 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
557 - | builder
|
558 - | };
|
559 - | let body = ::aws_smithy_types::body::SdkBody::empty();
|
815 + | let protocol = _cfg
|
816 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
817 + | .expect("a SharedClientProtocol is required");
|
818 + | let mut request = protocol
|
819 + | .serialize_request(&input, SynthesizeSpeech::PRESIGNED_INPUT_SCHEMA, "", _cfg)
|
820 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
560 821 |
|
561 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
822 + | return ::std::result::Result::Ok(request);
|
562 823 | }
|
563 824 | }
|