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