1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct Decapsulate;
6impl Decapsulate {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::decapsulate::DecapsulateInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::decapsulate::DecapsulateOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::decapsulate::DecapsulateInput,
18 ) -> ::std::result::Result<
19 crate::operation::decapsulate::DecapsulateOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::decapsulate::DecapsulateError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::decapsulate::DecapsulateError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::decapsulate::DecapsulateOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::decapsulate::DecapsulateInput,
48 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
49 ) -> ::std::result::Result<
50 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
51 ::aws_smithy_runtime_api::client::result::SdkError<
52 ::aws_smithy_runtime_api::client::interceptors::context::Error,
53 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
54 >,
55 > {
56 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
57 use ::tracing::Instrument;
58 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "Decapsulate", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "KMS.Decapsulate",
63 "rpc.service" = "KMS",
64 "rpc.method" = "Decapsulate",
65 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
66 "rpc.system" = "aws-api",
67 ))
68 .await
69 }
70
71 pub(crate) fn operation_runtime_plugins(
72 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
73 client_config: &crate::config::Config,
74 config_override: ::std::option::Option<crate::config::Builder>,
75 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
76 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
77
78 if let ::std::option::Option::Some(config_override) = config_override {
79 for plugin in config_override.runtime_plugins.iter().cloned() {
80 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81 }
82 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83 config_override,
84 client_config.config.clone(),
85 &client_config.runtime_components,
86 ));
87 }
88 runtime_plugins
89 }
90}
91pub(crate) mod error_registry {
100 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101 ::aws_smithy_schema::registry::TypeRegistry::builder()
102 .insert_error_shape(
103 crate::types::error::DependencyTimeoutException::SCHEMA,
104 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
106 },
107 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
108 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::DisabledException::SCHEMA,
113 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DisabledException::deserialize(d)?))
115 },
116 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
117 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DisabledException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::DryRunOperationException::SCHEMA,
122 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DryRunOperationException::deserialize(d)?))
124 },
125 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
126 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DryRunOperationException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::InvalidCiphertextException::SCHEMA,
131 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidCiphertextException::deserialize(d)?))
133 },
134 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
135 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidCiphertextException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::InvalidGrantTokenException::SCHEMA,
140 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
142 },
143 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
144 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::InvalidKeyUsageException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
151 },
152 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::KmsInternalException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
160 },
161 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::KmsInvalidStateException::SCHEMA,
167 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
168 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
169 },
170 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
171 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::KeyUnavailableException::SCHEMA,
176 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
177 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
178 },
179 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
180 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
181 },
182 )
183.insert_error_shape(
184 crate::types::error::NotFoundException::SCHEMA,
185 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
186 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
187 },
188 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
189 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
190 },
191 )
192 .build()
193 });
194}
195impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for Decapsulate {
196 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
197 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Decapsulate");
198
199 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
200 DecapsulateRequestSerializer,
201 ));
202 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
203 DecapsulateResponseDeserializer,
204 ));
205
206 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
207 crate::config::auth::Params::builder()
208 .operation_name("Decapsulate")
209 .build()
210 .expect("required fields set"),
211 ));
212
213 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
214 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("Decapsulate", "KMS"));
215 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
216 signing_options.double_uri_encode = true;
217 signing_options.content_sha256_header = false;
218 signing_options.normalize_uri_path = true;
219 signing_options.payload_override = None;
220
221 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
222 signing_options,
223 ..::std::default::Default::default()
224 });
225
226 ::std::option::Option::Some(cfg.freeze())
227 }
228
229 fn runtime_components(
230 &self,
231 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
232 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
233 #[allow(unused_mut)]
234 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("Decapsulate")
235 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
236 DecapsulateTelemetryInputCaptureInterceptor,
237 ))
238 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
239 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
240 ))
241 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
242 DecapsulateEndpointParamsInterceptor,
243 ))
244 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
245 crate::operation::decapsulate::DecapsulateError,
246 >::new())
247 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
248 crate::operation::decapsulate::DecapsulateError,
249 >::new())
250 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
251 crate::operation::decapsulate::DecapsulateError,
252 >::new())
253 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
254 crate::operation::decapsulate::DecapsulateError,
255 >::new());
256
257 ::std::borrow::Cow::Owned(rcb)
258 }
259}
260
261#[derive(Debug)]
262struct DecapsulateTelemetryInputCaptureInterceptor;
263
264#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
265impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DecapsulateTelemetryInputCaptureInterceptor {
266 fn name(&self) -> &'static str {
267 "DecapsulateTelemetryInputCaptureInterceptor"
268 }
269
270 fn read_before_execution(
271 &self,
272 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
273 '_,
274 ::aws_smithy_runtime_api::client::interceptors::context::Input,
275 ::aws_smithy_runtime_api::client::interceptors::context::Output,
276 ::aws_smithy_runtime_api::client::interceptors::context::Error,
277 >,
278 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
279 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
280 let ::std::option::Option::Some(requested) = cfg
282 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
283 .filter(|r| !r.is_empty())
284 else {
285 return ::std::result::Result::Ok(());
286 };
287
288 let ::std::option::Option::Some(input) = context.input().downcast_ref::<DecapsulateInput>() else {
289 return ::std::result::Result::Ok(());
291 };
292
293 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
294 if requested.should_capture("KeyId") {
295 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
296 captured.insert("KeyId", value);
297 }
298 }
299
300 cfg.interceptor_state().store_put(captured);
301 ::std::result::Result::Ok(())
302 }
303}
304#[derive(Debug)]
305struct DecapsulateResponseDeserializer;
306impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DecapsulateResponseDeserializer {
307 fn deserialize_nonstreaming_with_config(
308 &self,
309 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
310 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
311 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
312 let (success, status) = (response.status().is_success(), response.status().as_u16());
313 #[allow(unused_variables)]
318 let body = response.body().bytes().expect("body loaded");
319 let headers = response.headers();
320 #[allow(unused_mut)]
321 let mut force_error = false;
322 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
323 if !success && status != 200 || force_error {
324 let protocol = _cfg
325 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
326 .expect("a SharedClientProtocol is required");
327 #[allow(unused_mut)]
328 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
329 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
330 })?;
331 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
332 let generic = generic_builder.build();
333 let error_code = match generic.code() {
334 ::std::option::Option::Some(code) => code,
335 ::std::option::Option::None => {
336 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
337 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::decapsulate::DecapsulateError::unhandled(generic)),
338 ))
339 }
340 };
341 let _error_message = generic.message().map(|msg| msg.to_owned());
342 let err = match error_code {
343 "DependencyTimeoutException" => crate::operation::decapsulate::DecapsulateError::DependencyTimeoutException({
344 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
345 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
346 e,
347 ))
348 })?;
349 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
350 tmp.deserialize_members(&mut *deser).map_err(|e| {
351 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
352 e,
353 ))
354 })?;
355 if tmp.message.is_none() {
356 tmp.message = _error_message;
357 }
358 let tmp = tmp.meta(generic);
359 tmp.build()
360 }),
361 "DisabledException" => crate::operation::decapsulate::DecapsulateError::DisabledException({
362 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
363 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
364 e,
365 ))
366 })?;
367 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
368 tmp.deserialize_members(&mut *deser).map_err(|e| {
369 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
370 e,
371 ))
372 })?;
373 if tmp.message.is_none() {
374 tmp.message = _error_message;
375 }
376 let tmp = tmp.meta(generic);
377 tmp.build()
378 }),
379 "DryRunOperationException" => crate::operation::decapsulate::DecapsulateError::DryRunOperationException({
380 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
381 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
382 e,
383 ))
384 })?;
385 let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
386 tmp.deserialize_members(&mut *deser).map_err(|e| {
387 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
388 e,
389 ))
390 })?;
391 if tmp.message.is_none() {
392 tmp.message = _error_message;
393 }
394 let tmp = tmp.meta(generic);
395 tmp.build()
396 }),
397 "InvalidCiphertextException" => crate::operation::decapsulate::DecapsulateError::InvalidCiphertextException({
398 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
399 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
400 e,
401 ))
402 })?;
403 let mut tmp = <crate::types::error::builders::InvalidCiphertextExceptionBuilder>::default();
404 tmp.deserialize_members(&mut *deser).map_err(|e| {
405 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
406 e,
407 ))
408 })?;
409 if tmp.message.is_none() {
410 tmp.message = _error_message;
411 }
412 let tmp = tmp.meta(generic);
413 tmp.build()
414 }),
415 "InvalidGrantTokenException" => crate::operation::decapsulate::DecapsulateError::InvalidGrantTokenException({
416 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
417 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
418 e,
419 ))
420 })?;
421 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
422 tmp.deserialize_members(&mut *deser).map_err(|e| {
423 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
424 e,
425 ))
426 })?;
427 if tmp.message.is_none() {
428 tmp.message = _error_message;
429 }
430 let tmp = tmp.meta(generic);
431 tmp.build()
432 }),
433 "InvalidKeyUsageException" => crate::operation::decapsulate::DecapsulateError::InvalidKeyUsageException({
434 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
435 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
436 e,
437 ))
438 })?;
439 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
440 tmp.deserialize_members(&mut *deser).map_err(|e| {
441 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
442 e,
443 ))
444 })?;
445 if tmp.message.is_none() {
446 tmp.message = _error_message;
447 }
448 let tmp = tmp.meta(generic);
449 tmp.build()
450 }),
451 "KeyUnavailableException" => crate::operation::decapsulate::DecapsulateError::KeyUnavailableException({
452 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
453 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
454 e,
455 ))
456 })?;
457 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
458 tmp.deserialize_members(&mut *deser).map_err(|e| {
459 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
460 e,
461 ))
462 })?;
463 if tmp.message.is_none() {
464 tmp.message = _error_message;
465 }
466 let tmp = tmp.meta(generic);
467 tmp.build()
468 }),
469 "KMSInternalException" => crate::operation::decapsulate::DecapsulateError::KmsInternalException({
470 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
471 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
472 e,
473 ))
474 })?;
475 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
476 tmp.deserialize_members(&mut *deser).map_err(|e| {
477 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
478 e,
479 ))
480 })?;
481 if tmp.message.is_none() {
482 tmp.message = _error_message;
483 }
484 let tmp = tmp.meta(generic);
485 tmp.build()
486 }),
487 "KMSInvalidStateException" => crate::operation::decapsulate::DecapsulateError::KmsInvalidStateException({
488 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
489 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
490 e,
491 ))
492 })?;
493 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
494 tmp.deserialize_members(&mut *deser).map_err(|e| {
495 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
496 e,
497 ))
498 })?;
499 if tmp.message.is_none() {
500 tmp.message = _error_message;
501 }
502 let tmp = tmp.meta(generic);
503 tmp.build()
504 }),
505 "NotFoundException" => crate::operation::decapsulate::DecapsulateError::NotFoundException({
506 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
507 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
508 e,
509 ))
510 })?;
511 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
512 tmp.deserialize_members(&mut *deser).map_err(|e| {
513 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
514 e,
515 ))
516 })?;
517 if tmp.message.is_none() {
518 tmp.message = _error_message;
519 }
520 let tmp = tmp.meta(generic);
521 tmp.build()
522 }),
523 _ => {
524 match protocol
532 .deserialize_error_response(response, _cfg)
533 .ok()
534 .and_then(|mut deser| {
535 ::aws_smithy_schema::registry::reify_error(
536 crate::operation::decapsulate::error_registry::REGISTRY
537 .or(&crate::error_type_registry::REGISTRY),
538 error_code,
539 &mut *deser,
540 )
541 }) {
542 ::std::option::Option::Some(source) => <crate::operation::decapsulate::DecapsulateError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
543 ::std::option::Option::None => crate::operation::decapsulate::DecapsulateError::generic(generic),
544 }
545 }
546 };
547 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
548 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
549 ))
550 } else {
551 let protocol = _cfg
552 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
553 .expect("a SharedClientProtocol is required");
554 let mut deser = protocol.deserialize_response(response, Decapsulate::OUTPUT_SCHEMA, _cfg).map_err(|e| {
555 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
556 })?;
557 let _response_headers = headers;
561 #[allow(unused_mut)]
565 let mut output = <crate::operation::decapsulate::builders::DecapsulateOutputBuilder>::default();
566 output.deserialize_members(&mut *deser).map_err(|e| {
567 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
568 })?;
569 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
570 let output = output.build();
571 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
572 }
573 }
574}
575#[derive(Debug)]
576struct DecapsulateRequestSerializer;
577impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DecapsulateRequestSerializer {
578 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
579 fn serialize_input(
580 &self,
581 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
582 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
583 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
584 let input = input.downcast::<crate::operation::decapsulate::DecapsulateInput>().expect("correct type");
585
586 let protocol = _cfg
587 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
588 .expect("a SharedClientProtocol is required");
589 let mut request = protocol
590 .serialize_request(&input, Decapsulate::INPUT_SCHEMA, "/", _cfg)
591 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
592
593 return ::std::result::Result::Ok(request);
594 }
595}
596#[derive(Debug)]
597struct DecapsulateEndpointParamsInterceptor;
598
599#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
600impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DecapsulateEndpointParamsInterceptor {
601 fn name(&self) -> &'static str {
602 "DecapsulateEndpointParamsInterceptor"
603 }
604
605 fn read_before_execution(
606 &self,
607 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
608 '_,
609 ::aws_smithy_runtime_api::client::interceptors::context::Input,
610 ::aws_smithy_runtime_api::client::interceptors::context::Output,
611 ::aws_smithy_runtime_api::client::interceptors::context::Error,
612 >,
613 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
614 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
615 let _input = context
616 .input()
617 .downcast_ref::<DecapsulateInput>()
618 .ok_or("failed to downcast to DecapsulateInput")?;
619
620 let params = crate::config::endpoint::Params::builder()
621 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
622 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
623 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
624 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
625 .build()
626 .map_err(|err| {
627 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
628 })?;
629 cfg.interceptor_state()
630 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
631 ::std::result::Result::Ok(())
632 }
633}
634
635#[non_exhaustive]
640#[derive(::std::fmt::Debug)]
641pub enum DecapsulateError {
642 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
644 DisabledException(crate::types::error::DisabledException),
646 DryRunOperationException(crate::types::error::DryRunOperationException),
648 InvalidCiphertextException(crate::types::error::InvalidCiphertextException),
652 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
654 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
664 KeyUnavailableException(crate::types::error::KeyUnavailableException),
666 KmsInternalException(crate::types::error::KmsInternalException),
668 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
678 NotFoundException(crate::types::error::NotFoundException),
680 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
682 variable wildcard pattern and check `.code()`:
683 \
684 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
685 \
686 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DecapsulateError) for what information is available for the error.")]
687 Unhandled(crate::error::sealed_unhandled::Unhandled),
688}
689impl DecapsulateError {
690 pub fn unhandled(
692 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
693 ) -> Self {
694 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
695 source: err.into(),
696 meta: ::std::default::Default::default(),
697 })
698 }
699
700 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
702 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
703 source: err.clone().into(),
704 meta: err,
705 })
706 }
707 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
712 match self {
713 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
714 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
715 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
716 Self::InvalidCiphertextException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
717 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
718 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
719 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
720 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
721 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
722 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
723 Self::Unhandled(e) => &e.meta,
724 }
725 }
726 pub fn is_dependency_timeout_exception(&self) -> bool {
728 matches!(self, Self::DependencyTimeoutException(_))
729 }
730 pub fn is_disabled_exception(&self) -> bool {
732 matches!(self, Self::DisabledException(_))
733 }
734 pub fn is_dry_run_operation_exception(&self) -> bool {
736 matches!(self, Self::DryRunOperationException(_))
737 }
738 pub fn is_invalid_ciphertext_exception(&self) -> bool {
740 matches!(self, Self::InvalidCiphertextException(_))
741 }
742 pub fn is_invalid_grant_token_exception(&self) -> bool {
744 matches!(self, Self::InvalidGrantTokenException(_))
745 }
746 pub fn is_invalid_key_usage_exception(&self) -> bool {
748 matches!(self, Self::InvalidKeyUsageException(_))
749 }
750 pub fn is_key_unavailable_exception(&self) -> bool {
752 matches!(self, Self::KeyUnavailableException(_))
753 }
754 pub fn is_kms_internal_exception(&self) -> bool {
756 matches!(self, Self::KmsInternalException(_))
757 }
758 pub fn is_kms_invalid_state_exception(&self) -> bool {
760 matches!(self, Self::KmsInvalidStateException(_))
761 }
762 pub fn is_not_found_exception(&self) -> bool {
764 matches!(self, Self::NotFoundException(_))
765 }
766}
767impl ::std::error::Error for DecapsulateError {
768 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
769 match self {
770 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
771 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
772 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
773 Self::InvalidCiphertextException(_inner) => ::std::option::Option::Some(_inner),
774 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
775 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
776 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
777 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
778 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
779 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
780 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
781 }
782 }
783}
784impl ::std::fmt::Display for DecapsulateError {
785 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
786 match self {
787 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
788 Self::DisabledException(_inner) => _inner.fmt(f),
789 Self::DryRunOperationException(_inner) => _inner.fmt(f),
790 Self::InvalidCiphertextException(_inner) => _inner.fmt(f),
791 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
792 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
793 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
794 Self::KmsInternalException(_inner) => _inner.fmt(f),
795 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
796 Self::NotFoundException(_inner) => _inner.fmt(f),
797 Self::Unhandled(_inner) => {
798 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
799 write!(f, "unhandled error ({code})")
800 } else {
801 f.write_str("unhandled error")
802 }
803 }
804 }
805 }
806}
807impl ::aws_smithy_types::retry::ProvideErrorKind for DecapsulateError {
808 fn code(&self) -> ::std::option::Option<&str> {
809 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
810 }
811 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
812 ::std::option::Option::None
813 }
814}
815impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DecapsulateError {
816 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
817 match self {
818 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
819 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
820 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
821 Self::InvalidCiphertextException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
822 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
823 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
824 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
825 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
826 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
827 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
828 Self::Unhandled(_inner) => &_inner.meta,
829 }
830 }
831}
832impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DecapsulateError {
833 fn create_unhandled_error(
834 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
835 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
836 ) -> Self {
837 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
838 source,
839 meta: meta.unwrap_or_default(),
840 })
841 }
842}
843impl ::aws_types::request_id::RequestId for crate::operation::decapsulate::DecapsulateError {
844 fn request_id(&self) -> Option<&str> {
845 self.meta().request_id()
846 }
847}
848
849pub use crate::operation::decapsulate::_decapsulate_input::DecapsulateInput;
850
851pub use crate::operation::decapsulate::_decapsulate_output::DecapsulateOutput;
852
853mod _decapsulate_input;
854
855mod _decapsulate_output;
856
857pub mod builders;