138 142 | ::std::borrow::Cow::Owned(rcb)
|
139 143 | }
|
140 144 | }
|
141 145 |
|
142 146 | #[derive(Debug)]
|
143 147 | struct DescribeVoicesResponseDeserializer;
|
144 148 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DescribeVoicesResponseDeserializer {
|
145 149 | fn deserialize_nonstreaming(
|
146 150 | &self,
|
147 151 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
152 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
148 153 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
149 154 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 - | let headers = response.headers();
|
151 - | let body = response.body().bytes().expect("body loaded");
|
152 155 | #[allow(unused_mut)]
|
153 156 | let mut force_error = false;
|
154 157 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
155 - | let parse_result = if !success && status != 200 || force_error {
|
156 - | crate::protocol_serde::shape_describe_voices::de_describe_voices_http_error(status, headers, body)
|
157 - | } else {
|
158 - | crate::protocol_serde::shape_describe_voices::de_describe_voices_http_response(status, headers, body)
|
158 + | if !success && status != 200 || force_error {
|
159 + | let headers = response.headers();
|
160 + | let body = response.body().bytes().expect("body loaded");
|
161 + | #[allow(unused_mut)]
|
162 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
163 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
164 + | })?;
|
165 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
166 + | let generic = generic_builder.build();
|
167 + | let error_code = match generic.code() {
|
168 + | ::std::option::Option::Some(code) => code,
|
169 + | ::std::option::Option::None => {
|
170 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
171 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::describe_voices::DescribeVoicesError::unhandled(
|
172 + | generic,
|
173 + | )),
|
174 + | ))
|
175 + | }
|
159 176 | };
|
160 - | crate::protocol_serde::type_erase_result(parse_result)
|
177 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
178 + | let protocol = _cfg
|
179 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
180 + | .expect("a SharedClientProtocol is required");
|
181 + | let err = match error_code {
|
182 + | "InvalidNextTokenException" => crate::operation::describe_voices::DescribeVoicesError::InvalidNextTokenException({
|
183 + | let mut tmp = match protocol
|
184 + | .deserialize_response(response, crate::types::error::InvalidNextTokenException::SCHEMA, _cfg)
|
185 + | .and_then(|mut deser| {
|
186 + | crate::types::error::InvalidNextTokenException::deserialize_with_response(
|
187 + | &mut *deser,
|
188 + | response.headers(),
|
189 + | response.status().into(),
|
190 + | body,
|
191 + | )
|
192 + | }) {
|
193 + | ::std::result::Result::Ok(val) => val,
|
194 + | ::std::result::Result::Err(e) => {
|
195 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
196 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
197 + | ))
|
198 + | }
|
199 + | };
|
200 + | tmp.meta = generic;
|
201 + | if tmp.message.is_none() {
|
202 + | tmp.message = _error_message;
|
203 + | }
|
204 + | tmp
|
205 + | }),
|
206 + | "ServiceFailureException" => crate::operation::describe_voices::DescribeVoicesError::ServiceFailureException({
|
207 + | let mut tmp = match protocol
|
208 + | .deserialize_response(response, crate::types::error::ServiceFailureException::SCHEMA, _cfg)
|
209 + | .and_then(|mut deser| {
|
210 + | crate::types::error::ServiceFailureException::deserialize_with_response(
|
211 + | &mut *deser,
|
212 + | response.headers(),
|
213 + | response.status().into(),
|
214 + | body,
|
215 + | )
|
216 + | }) {
|
217 + | ::std::result::Result::Ok(val) => val,
|
218 + | ::std::result::Result::Err(e) => {
|
219 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
220 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
221 + | ))
|
222 + | }
|
223 + | };
|
224 + | tmp.meta = generic;
|
225 + | if tmp.message.is_none() {
|
226 + | tmp.message = _error_message;
|
227 + | }
|
228 + | tmp
|
229 + | }),
|
230 + | _ => crate::operation::describe_voices::DescribeVoicesError::generic(generic),
|
231 + | };
|
232 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
233 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
234 + | ))
|
235 + | } else {
|
236 + | let protocol = _cfg
|
237 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
238 + | .expect("a SharedClientProtocol is required");
|
239 + | let mut deser = protocol
|
240 + | .deserialize_response(response, DescribeVoices::OUTPUT_SCHEMA, _cfg)
|
241 + | .map_err(|e| {
|
242 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
243 + | })?;
|
244 + | let body = response.body().bytes().expect("body loaded");
|
245 + | let output = crate::operation::describe_voices::DescribeVoicesOutput::deserialize_with_response(
|
246 + | &mut *deser,
|
247 + | response.headers(),
|
248 + | response.status().into(),
|
249 + | body,
|
250 + | )
|
251 + | .map_err(|e| {
|
252 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
253 + | })?;
|
254 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
255 + | }
|
161 256 | }
|
162 257 | }
|
163 258 | #[derive(Debug)]
|
164 259 | struct DescribeVoicesRequestSerializer;
|
165 260 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DescribeVoicesRequestSerializer {
|
166 261 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
167 262 | fn serialize_input(
|
168 263 | &self,
|
169 264 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
170 265 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
171 266 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
172 267 | let input = input
|
173 268 | .downcast::<crate::operation::describe_voices::DescribeVoicesInput>()
|
174 269 | .expect("correct type");
|
175 - | let _header_serialization_settings = _cfg
|
176 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
177 - | .cloned()
|
178 - | .unwrap_or_default();
|
179 - | let mut request_builder = {
|
180 - | #[allow(clippy::uninlined_format_args)]
|
181 - | fn uri_base(
|
182 - | _input: &crate::operation::describe_voices::DescribeVoicesInput,
|
183 - | output: &mut ::std::string::String,
|
184 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
185 - | use ::std::fmt::Write as _;
|
186 - | ::std::write!(output, "/v1/voices").expect("formatting should succeed");
|
187 - | ::std::result::Result::Ok(())
|
188 - | }
|
189 - | fn uri_query(
|
190 - | _input: &crate::operation::describe_voices::DescribeVoicesInput,
|
191 - | mut output: &mut ::std::string::String,
|
192 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
193 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
194 - | if let ::std::option::Option::Some(inner_1) = &_input.engine {
|
195 - | {
|
196 - | query.push_kv("Engine", &::aws_smithy_http::query::fmt_string(inner_1.as_str()));
|
197 - | }
|
198 - | }
|
199 - | if let ::std::option::Option::Some(inner_2) = &_input.language_code {
|
200 - | {
|
201 - | query.push_kv("LanguageCode", &::aws_smithy_http::query::fmt_string(inner_2.as_str()));
|
202 - | }
|
203 - | }
|
204 - | if let ::std::option::Option::Some(inner_3) = &_input.include_additional_language_codes {
|
270 + | let protocol = _cfg
|
271 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
272 + | .expect("a SharedClientProtocol is required");
|
273 + | if protocol.supports_http_bindings() {
|
274 + | let mut request = protocol
|
275 + | .serialize_body(&input, DescribeVoices::INPUT_SCHEMA, "", _cfg)
|
276 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
205 277 | {
|
206 - | query.push_kv(
|
207 - | "IncludeAdditionalLanguageCodes",
|
208 - | ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode(),
|
209 - | );
|
210 - | }
|
211 - | }
|
212 - | if let ::std::option::Option::Some(inner_4) = &_input.next_token {
|
213 - | {
|
214 - | query.push_kv("NextToken", &::aws_smithy_http::query::fmt_string(inner_4));
|
278 + | let mut uri = "/v1/voices".to_string();
|
279 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
280 + | if let Some(ref val) = input.engine {
|
281 + | query_params.push(("Engine".to_string(), val.as_str().to_string()));
|
282 + | }
|
283 + | if let Some(ref val) = input.language_code {
|
284 + | query_params.push(("LanguageCode".to_string(), val.as_str().to_string()));
|
285 + | }
|
286 + | if let Some(ref val) = input.include_additional_language_codes {
|
287 + | query_params.push(("IncludeAdditionalLanguageCodes".to_string(), val.to_string()));
|
288 + | }
|
289 + | if let Some(ref val) = input.next_token {
|
290 + | query_params.push(("NextToken".to_string(), val.to_string()));
|
291 + | }
|
292 + | if !query_params.is_empty() {
|
293 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
294 + | let pairs: Vec<String> = query_params
|
295 + | .iter()
|
296 + | .map(|(k, v)| {
|
297 + | format!(
|
298 + | "{}={}",
|
299 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
300 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
301 + | )
|
302 + | })
|
303 + | .collect();
|
304 + | uri.push_str(&pairs.join("&"));
|
215 305 | }
|
306 + | request.set_uri(uri.as_str()).expect("valid URI");
|
216 307 | }
|
217 - | ::std::result::Result::Ok(())
|
218 - | }
|
219 - | #[allow(clippy::unnecessary_wraps)]
|
220 - | fn update_http_builder(
|
221 - | input: &crate::operation::describe_voices::DescribeVoicesInput,
|
222 - | builder: ::http_1x::request::Builder,
|
223 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
224 - | let mut uri = ::std::string::String::new();
|
225 - | uri_base(input, &mut uri)?;
|
226 - | uri_query(input, &mut uri)?;
|
227 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
228 - | }
|
229 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
230 - | builder
|
231 - | };
|
232 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
233 308 |
|
234 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
309 + | return ::std::result::Result::Ok(request);
|
310 + | } else {
|
311 + | let mut request = protocol
|
312 + | .serialize_request(&input, DescribeVoices::INPUT_SCHEMA, "", _cfg)
|
313 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
314 + |
|
315 + | return ::std::result::Result::Ok(request);
|
316 + | }
|
235 317 | }
|
236 318 | }
|
237 319 | #[derive(Debug)]
|
238 320 | struct DescribeVoicesEndpointParamsInterceptor;
|
239 321 |
|
240 322 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeVoicesEndpointParamsInterceptor {
|
241 323 | fn name(&self) -> &'static str {
|
242 324 | "DescribeVoicesEndpointParamsInterceptor"
|
243 325 | }
|
244 326 |
|