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