Skip to main content

aws_sdk_kms/operation/
decrypt.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `Decrypt`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct Decrypt;
6impl Decrypt {
7    /// Creates a new `Decrypt`
8    pub fn new() -> Self {
9        Self
10    }
11    /// The schema for this operation's input shape.
12    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::decrypt::DecryptInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::decrypt::DecryptOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17        input: crate::operation::decrypt::DecryptInput,
18    ) -> ::std::result::Result<
19        crate::operation::decrypt::DecryptOutput,
20        ::aws_smithy_runtime_api::client::result::SdkError<
21            crate::operation::decrypt::DecryptError,
22            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23        >,
24    > {
25        let map_err =
26            |err: ::aws_smithy_runtime_api::client::result::SdkError<
27                ::aws_smithy_runtime_api::client::interceptors::context::Error,
28                ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
29            >| { err.map_service_error(|err| err.downcast::<crate::operation::decrypt::DecryptError>().expect("correct error type")) };
30        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31            .await
32            .map_err(map_err)?;
33        let output = context.finalize().map_err(map_err)?;
34        ::std::result::Result::Ok(
35            output
36                .downcast::<crate::operation::decrypt::DecryptOutput>()
37                .expect("correct output type"),
38        )
39    }
40
41    pub(crate) async fn orchestrate_with_stop_point(
42        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43        input: crate::operation::decrypt::DecryptInput,
44        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45    ) -> ::std::result::Result<
46        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47        ::aws_smithy_runtime_api::client::result::SdkError<
48            ::aws_smithy_runtime_api::client::interceptors::context::Error,
49            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50        >,
51    > {
52        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53        use ::tracing::Instrument;
54        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "Decrypt", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "KMS.Decrypt",
59                "rpc.service" = "KMS",
60                "rpc.method" = "Decrypt",
61                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62                "rpc.system" = "aws-api",
63            ))
64            .await
65    }
66
67    pub(crate) fn operation_runtime_plugins(
68        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69        client_config: &crate::config::Config,
70        config_override: ::std::option::Option<crate::config::Builder>,
71    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73
74        if let ::std::option::Option::Some(config_override) = config_override {
75            for plugin in config_override.runtime_plugins.iter().cloned() {
76                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77            }
78            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79                config_override,
80                client_config.config.clone(),
81                &client_config.runtime_components,
82            ));
83        }
84        runtime_plugins
85    }
86}
87/// Per-operation error registry. Contains an entry for every modeled
88/// error this operation can throw.
89///
90/// Used by the schema-serde error path as the operation-scoped lookup
91/// for registry-backed error reification: an error code that does not
92/// match one of the operation's modeled errors directly is resolved
93/// against this registry first, then widened to the service-wide error
94/// registry.
95pub(crate) mod error_registry {
96    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
97        ::aws_smithy_schema::registry::TypeRegistry::builder()
98                            .insert_error_shape(
99                        crate::types::error::DependencyTimeoutException::SCHEMA,
100                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
101                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
102                        },
103                        |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> {
104                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
105                        },
106                    )
107.insert_error_shape(
108                        crate::types::error::DisabledException::SCHEMA,
109                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
110                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DisabledException::deserialize(d)?))
111                        },
112                        |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> {
113                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DisabledException::deserialize(d)?))
114                        },
115                    )
116.insert_error_shape(
117                        crate::types::error::DryRunOperationException::SCHEMA,
118                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
119                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DryRunOperationException::deserialize(d)?))
120                        },
121                        |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> {
122                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DryRunOperationException::deserialize(d)?))
123                        },
124                    )
125.insert_error_shape(
126                        crate::types::error::IncorrectKeyException::SCHEMA,
127                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
128                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::IncorrectKeyException::deserialize(d)?))
129                        },
130                        |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> {
131                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::IncorrectKeyException::deserialize(d)?))
132                        },
133                    )
134.insert_error_shape(
135                        crate::types::error::InvalidCiphertextException::SCHEMA,
136                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
137                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidCiphertextException::deserialize(d)?))
138                        },
139                        |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> {
140                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidCiphertextException::deserialize(d)?))
141                        },
142                    )
143.insert_error_shape(
144                        crate::types::error::InvalidGrantTokenException::SCHEMA,
145                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
146                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
147                        },
148                        |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> {
149                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
150                        },
151                    )
152.insert_error_shape(
153                        crate::types::error::InvalidKeyUsageException::SCHEMA,
154                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
155                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
156                        },
157                        |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> {
158                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
159                        },
160                    )
161.insert_error_shape(
162                        crate::types::error::KmsInternalException::SCHEMA,
163                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
164                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
165                        },
166                        |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> {
167                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
168                        },
169                    )
170.insert_error_shape(
171                        crate::types::error::KmsInvalidStateException::SCHEMA,
172                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
173                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
174                        },
175                        |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> {
176                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
177                        },
178                    )
179.insert_error_shape(
180                        crate::types::error::KeyUnavailableException::SCHEMA,
181                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
182                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
183                        },
184                        |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> {
185                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
186                        },
187                    )
188.insert_error_shape(
189                        crate::types::error::NotFoundException::SCHEMA,
190                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
191                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
192                        },
193                        |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> {
194                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
195                        },
196                    )
197                            .build()
198    });
199}
200impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for Decrypt {
201    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
202        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Decrypt");
203
204        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
205            DecryptRequestSerializer,
206        ));
207        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
208            DecryptResponseDeserializer,
209        ));
210
211        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
212            crate::config::auth::Params::builder()
213                .operation_name("Decrypt")
214                .build()
215                .expect("required fields set"),
216        ));
217
218        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
219        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("Decrypt", "KMS"));
220        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
221        signing_options.double_uri_encode = true;
222        signing_options.content_sha256_header = false;
223        signing_options.normalize_uri_path = true;
224        signing_options.payload_override = None;
225
226        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
227            signing_options,
228            ..::std::default::Default::default()
229        });
230
231        ::std::option::Option::Some(cfg.freeze())
232    }
233
234    fn runtime_components(
235        &self,
236        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
237    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
238        #[allow(unused_mut)]
239        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("Decrypt")
240            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
241                DecryptTelemetryInputCaptureInterceptor,
242            ))
243            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
244                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
245            ))
246            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
247                DecryptEndpointParamsInterceptor,
248            ))
249            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
250                crate::operation::decrypt::DecryptError,
251            >::new())
252            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
253                crate::operation::decrypt::DecryptError,
254            >::new())
255            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
256                crate::operation::decrypt::DecryptError,
257            >::new())
258            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
259                crate::operation::decrypt::DecryptError,
260            >::new());
261
262        ::std::borrow::Cow::Owned(rcb)
263    }
264}
265
266#[derive(Debug)]
267struct DecryptTelemetryInputCaptureInterceptor;
268
269#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
270impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DecryptTelemetryInputCaptureInterceptor {
271    fn name(&self) -> &'static str {
272        "DecryptTelemetryInputCaptureInterceptor"
273    }
274
275    fn read_before_execution(
276        &self,
277        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
278            '_,
279            ::aws_smithy_runtime_api::client::interceptors::context::Input,
280            ::aws_smithy_runtime_api::client::interceptors::context::Output,
281            ::aws_smithy_runtime_api::client::interceptors::context::Error,
282        >,
283        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
284    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
285        // Nothing to do unless the customer opted in by naming members to record.
286        let ::std::option::Option::Some(requested) = cfg
287            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
288            .filter(|r| !r.is_empty())
289        else {
290            return ::std::result::Result::Ok(());
291        };
292
293        let ::std::option::Option::Some(input) = context.input().downcast_ref::<DecryptInput>() else {
294            // A mismatched input is not this interceptor's concern; skip quietly.
295            return ::std::result::Result::Ok(());
296        };
297
298        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
299        if requested.should_capture("KeyId") {
300            if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
301                captured.insert("KeyId", value);
302            }
303        }
304
305        cfg.interceptor_state().store_put(captured);
306        ::std::result::Result::Ok(())
307    }
308}
309#[derive(Debug)]
310struct DecryptResponseDeserializer;
311impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DecryptResponseDeserializer {
312    fn deserialize_nonstreaming_with_config(
313        &self,
314        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
315        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
316    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
317        let (success, status) = (response.status().is_success(), response.status().as_u16());
318        // Load body and headers BEFORE BeforeParseResponse so customizations
319        // (e.g., S3's `body_is_error` check that detects errors returned with
320        // HTTP 200) can inspect them. The legacy non-streaming path also
321        // loads `body` before firing this hook.
322        #[allow(unused_variables)]
323        let body = response.body().bytes().expect("body loaded");
324        let headers = response.headers();
325        #[allow(unused_mut)]
326        let mut force_error = false;
327        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
328        if !success && status != 200 || force_error {
329            let protocol = _cfg
330                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
331                .expect("a SharedClientProtocol is required");
332            #[allow(unused_mut)]
333            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
334                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
335            })?;
336            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
337            let generic = generic_builder.build();
338            let error_code = match generic.code() {
339                ::std::option::Option::Some(code) => code,
340                ::std::option::Option::None => {
341                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
342                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::decrypt::DecryptError::unhandled(generic)),
343                    ))
344                }
345            };
346            let _error_message = generic.message().map(|msg| msg.to_owned());
347            let err = match error_code {
348                "DependencyTimeoutException" => crate::operation::decrypt::DecryptError::DependencyTimeoutException({
349                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
350                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
351                            e,
352                        ))
353                    })?;
354                    let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
355                    tmp.deserialize_members(&mut *deser).map_err(|e| {
356                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
357                            e,
358                        ))
359                    })?;
360                    if tmp.message.is_none() {
361                        tmp.message = _error_message;
362                    }
363                    let tmp = tmp.meta(generic);
364                    tmp.build()
365                }),
366                "DisabledException" => crate::operation::decrypt::DecryptError::DisabledException({
367                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
368                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
369                            e,
370                        ))
371                    })?;
372                    let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
373                    tmp.deserialize_members(&mut *deser).map_err(|e| {
374                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
375                            e,
376                        ))
377                    })?;
378                    if tmp.message.is_none() {
379                        tmp.message = _error_message;
380                    }
381                    let tmp = tmp.meta(generic);
382                    tmp.build()
383                }),
384                "DryRunOperationException" => crate::operation::decrypt::DecryptError::DryRunOperationException({
385                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
386                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
387                            e,
388                        ))
389                    })?;
390                    let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
391                    tmp.deserialize_members(&mut *deser).map_err(|e| {
392                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
393                            e,
394                        ))
395                    })?;
396                    if tmp.message.is_none() {
397                        tmp.message = _error_message;
398                    }
399                    let tmp = tmp.meta(generic);
400                    tmp.build()
401                }),
402                "IncorrectKeyException" => crate::operation::decrypt::DecryptError::IncorrectKeyException({
403                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
404                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
405                            e,
406                        ))
407                    })?;
408                    let mut tmp = <crate::types::error::builders::IncorrectKeyExceptionBuilder>::default();
409                    tmp.deserialize_members(&mut *deser).map_err(|e| {
410                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
411                            e,
412                        ))
413                    })?;
414                    if tmp.message.is_none() {
415                        tmp.message = _error_message;
416                    }
417                    let tmp = tmp.meta(generic);
418                    tmp.build()
419                }),
420                "InvalidCiphertextException" => crate::operation::decrypt::DecryptError::InvalidCiphertextException({
421                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
422                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
423                            e,
424                        ))
425                    })?;
426                    let mut tmp = <crate::types::error::builders::InvalidCiphertextExceptionBuilder>::default();
427                    tmp.deserialize_members(&mut *deser).map_err(|e| {
428                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
429                            e,
430                        ))
431                    })?;
432                    if tmp.message.is_none() {
433                        tmp.message = _error_message;
434                    }
435                    let tmp = tmp.meta(generic);
436                    tmp.build()
437                }),
438                "InvalidGrantTokenException" => crate::operation::decrypt::DecryptError::InvalidGrantTokenException({
439                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
440                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
441                            e,
442                        ))
443                    })?;
444                    let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
445                    tmp.deserialize_members(&mut *deser).map_err(|e| {
446                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
447                            e,
448                        ))
449                    })?;
450                    if tmp.message.is_none() {
451                        tmp.message = _error_message;
452                    }
453                    let tmp = tmp.meta(generic);
454                    tmp.build()
455                }),
456                "InvalidKeyUsageException" => crate::operation::decrypt::DecryptError::InvalidKeyUsageException({
457                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
458                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
459                            e,
460                        ))
461                    })?;
462                    let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
463                    tmp.deserialize_members(&mut *deser).map_err(|e| {
464                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
465                            e,
466                        ))
467                    })?;
468                    if tmp.message.is_none() {
469                        tmp.message = _error_message;
470                    }
471                    let tmp = tmp.meta(generic);
472                    tmp.build()
473                }),
474                "KeyUnavailableException" => crate::operation::decrypt::DecryptError::KeyUnavailableException({
475                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
476                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
477                            e,
478                        ))
479                    })?;
480                    let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
481                    tmp.deserialize_members(&mut *deser).map_err(|e| {
482                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
483                            e,
484                        ))
485                    })?;
486                    if tmp.message.is_none() {
487                        tmp.message = _error_message;
488                    }
489                    let tmp = tmp.meta(generic);
490                    tmp.build()
491                }),
492                "KMSInternalException" => crate::operation::decrypt::DecryptError::KmsInternalException({
493                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
494                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
495                            e,
496                        ))
497                    })?;
498                    let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
499                    tmp.deserialize_members(&mut *deser).map_err(|e| {
500                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
501                            e,
502                        ))
503                    })?;
504                    if tmp.message.is_none() {
505                        tmp.message = _error_message;
506                    }
507                    let tmp = tmp.meta(generic);
508                    tmp.build()
509                }),
510                "KMSInvalidStateException" => crate::operation::decrypt::DecryptError::KmsInvalidStateException({
511                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
512                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
513                            e,
514                        ))
515                    })?;
516                    let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
517                    tmp.deserialize_members(&mut *deser).map_err(|e| {
518                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
519                            e,
520                        ))
521                    })?;
522                    if tmp.message.is_none() {
523                        tmp.message = _error_message;
524                    }
525                    let tmp = tmp.meta(generic);
526                    tmp.build()
527                }),
528                "NotFoundException" => crate::operation::decrypt::DecryptError::NotFoundException({
529                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
530                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
531                            e,
532                        ))
533                    })?;
534                    let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
535                    tmp.deserialize_members(&mut *deser).map_err(|e| {
536                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
537                            e,
538                        ))
539                    })?;
540                    if tmp.message.is_none() {
541                        tmp.message = _error_message;
542                    }
543                    let tmp = tmp.meta(generic);
544                    tmp.build()
545                }),
546                _ => {
547                    // Registry-backed, operation-scoped reification of an error whose
548                    // code this operation does not model directly: the operation's own
549                    // error registry is consulted first, then the lookup widens to the
550                    // service-wide error registry. On a hit, the reified error is attached
551                    // as the source of the returned unhandled error while its metadata
552                    // (code, message, request id) is preserved; on a miss the generic
553                    // error is returned unchanged.
554                    match protocol
555                        .deserialize_error_response(response, _cfg)
556                        .ok()
557                        .and_then(|mut deser| {
558                            ::aws_smithy_schema::registry::reify_error(
559                                crate::operation::decrypt::error_registry::REGISTRY
560                                    .or(&crate::error_type_registry::REGISTRY),
561                                error_code,
562                                &mut *deser,
563                            )
564                        }) {
565                        ::std::option::Option::Some(source) => <crate::operation::decrypt::DecryptError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
566                        ::std::option::Option::None => crate::operation::decrypt::DecryptError::generic(generic),
567                    }
568                }
569            };
570            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
571                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
572            ))
573        } else {
574            let protocol = _cfg
575                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
576                .expect("a SharedClientProtocol is required");
577            let mut deser = protocol.deserialize_response(response, Decrypt::OUTPUT_SCHEMA, _cfg).map_err(|e| {
578                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
579            })?;
580            // `headers` is already in scope from the top of the function; alias it as
581            // `_response_headers` so MutateOutput customizations have a stable name to
582            // read from.
583            let _response_headers = headers;
584            // `mut` is required because `deserialize_members` and the `MutateOutput`
585            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
586            // empty output has no members and no customizations to run.
587            #[allow(unused_mut)]
588            let mut output = <crate::operation::decrypt::builders::DecryptOutputBuilder>::default();
589            output.deserialize_members(&mut *deser).map_err(|e| {
590                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
591            })?;
592            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
593            let output = output.build();
594            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
595        }
596    }
597}
598#[derive(Debug)]
599struct DecryptRequestSerializer;
600impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DecryptRequestSerializer {
601    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
602    fn serialize_input(
603        &self,
604        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
605        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
606    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
607        let input = input.downcast::<crate::operation::decrypt::DecryptInput>().expect("correct type");
608
609        let protocol = _cfg
610            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
611            .expect("a SharedClientProtocol is required");
612        let mut request = protocol
613            .serialize_request(&input, Decrypt::INPUT_SCHEMA, "/", _cfg)
614            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
615
616        return ::std::result::Result::Ok(request);
617    }
618}
619#[derive(Debug)]
620struct DecryptEndpointParamsInterceptor;
621
622#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
623impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DecryptEndpointParamsInterceptor {
624    fn name(&self) -> &'static str {
625        "DecryptEndpointParamsInterceptor"
626    }
627
628    fn read_before_execution(
629        &self,
630        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
631            '_,
632            ::aws_smithy_runtime_api::client::interceptors::context::Input,
633            ::aws_smithy_runtime_api::client::interceptors::context::Output,
634            ::aws_smithy_runtime_api::client::interceptors::context::Error,
635        >,
636        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
637    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
638        let _input = context
639            .input()
640            .downcast_ref::<DecryptInput>()
641            .ok_or("failed to downcast to DecryptInput")?;
642
643        let params = crate::config::endpoint::Params::builder()
644            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
645            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
646            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
647            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
648            .build()
649            .map_err(|err| {
650                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
651            })?;
652        cfg.interceptor_state()
653            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
654        ::std::result::Result::Ok(())
655    }
656}
657
658// The get_* functions below are generated from JMESPath expressions in the
659// operationContextParams trait. They target the operation's input shape.
660
661/// Error type for the `DecryptError` operation.
662#[non_exhaustive]
663#[derive(::std::fmt::Debug)]
664pub enum DecryptError {
665    /// <p>The system timed out while trying to fulfill the request. You can retry the request.</p>
666    DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
667    /// <p>The request was rejected because the specified KMS key is not enabled.</p>
668    DisabledException(crate::types::error::DisabledException),
669    /// <p>The request was rejected because the DryRun parameter was specified.</p>
670    DryRunOperationException(crate::types::error::DryRunOperationException),
671    /// <p>The request was rejected because the specified KMS key cannot decrypt the data. The <code>KeyId</code> in a <code>Decrypt</code> request and the <code>SourceKeyId</code> in a <code>ReEncrypt</code> request must identify the same KMS key that was used to encrypt the ciphertext.</p>
672    IncorrectKeyException(crate::types::error::IncorrectKeyException),
673    /// <p>From the <code>Decrypt</code> or <code>ReEncrypt</code> operation, the request was rejected because the specified ciphertext, or additional authenticated data incorporated into the ciphertext, such as the encryption context, is corrupted, missing, or otherwise invalid.</p>
674    /// <p>From the <code>ImportKeyMaterial</code> operation, the request was rejected because KMS could not decrypt the encrypted (wrapped) key material.</p>
675    /// <p>From the <code>Decapsulate</code> operation, the request was rejected because the length of the <code>SharedSecretCiphertextBlob</code> is inconsistent with the specified ML-KEM key spec.</p>
676    InvalidCiphertextException(crate::types::error::InvalidCiphertextException),
677    /// <p>The request was rejected because the specified grant token is not valid.</p>
678    InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
679    /// <p>The request was rejected for one of the following reasons:</p>
680    /// <ul>
681    /// <li>
682    /// <p>The <code>KeyUsage</code> value of the KMS key is incompatible with the API operation.</p></li>
683    /// <li>
684    /// <p>The encryption algorithm or signing algorithm specified for the operation is incompatible with the type of key material in the KMS key <code>(KeySpec</code>).</p></li>
685    /// </ul>
686    /// <p>For encrypting, decrypting, re-encrypting, and generating data keys, the <code>KeyUsage</code> must be <code>ENCRYPT_DECRYPT</code>. For signing and verifying messages, the <code>KeyUsage</code> must be <code>SIGN_VERIFY</code>. For generating and verifying message authentication codes (MACs), the <code>KeyUsage</code> must be <code>GENERATE_VERIFY_MAC</code>. For deriving key agreement secrets, the <code>KeyUsage</code> must be <code>KEY_AGREEMENT</code>. For encapsulating and decapsulating shared secrets, the <code>KeyUsage</code> must be <code>ENCAPSULATE_DECAPSULATE</code>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
687    /// <p>To find the encryption or signing algorithms supported for a particular KMS key, use the <code>DescribeKey</code> operation.</p>
688    InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
689    /// <p>The request was rejected because the specified KMS key was not available. You can retry the request.</p>
690    KeyUnavailableException(crate::types::error::KeyUnavailableException),
691    /// <p>The request was rejected because an internal exception occurred. The request can be retried.</p>
692    KmsInternalException(crate::types::error::KmsInternalException),
693    /// <p>The request was rejected because the state of the specified resource is not valid for this request.</p>
694    /// <p>This exceptions means one of the following:</p>
695    /// <ul>
696    /// <li>
697    /// <p>The key state of the KMS key is not compatible with the operation.</p>
698    /// <p>To find the key state, use the <code>DescribeKey</code> operation. For more information about which key states are compatible with each KMS operation, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key states of KMS keys</a> in the <i> <i>Key Management Service Developer Guide</i> </i>.</p></li>
699    /// <li>
700    /// <p>For cryptographic operations on KMS keys in custom key stores, this exception represents a general failure with many possible causes. To identify the cause, see the error message that accompanies the exception.</p></li>
701    /// </ul>
702    KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
703    /// <p>The request was rejected because the specified entity or resource could not be found.</p>
704    NotFoundException(crate::types::error::NotFoundException),
705    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
706    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
707    variable wildcard pattern and check `.code()`:
708     \
709    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
710     \
711    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DecryptError) for what information is available for the error.")]
712    Unhandled(crate::error::sealed_unhandled::Unhandled),
713}
714impl DecryptError {
715    /// Creates the `DecryptError::Unhandled` variant from any error type.
716    pub fn unhandled(
717        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
718    ) -> Self {
719        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
720            source: err.into(),
721            meta: ::std::default::Default::default(),
722        })
723    }
724
725    /// Creates the `DecryptError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
726    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
727        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
728            source: err.clone().into(),
729            meta: err,
730        })
731    }
732    ///
733    /// Returns error metadata, which includes the error code, message,
734    /// request ID, and potentially additional information.
735    ///
736    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
737        match self {
738            Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
739            Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
740            Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
741            Self::IncorrectKeyException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
742            Self::InvalidCiphertextException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
743            Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
744            Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
745            Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
746            Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
747            Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
748            Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
749            Self::Unhandled(e) => &e.meta,
750        }
751    }
752    /// Returns `true` if the error kind is `DecryptError::DependencyTimeoutException`.
753    pub fn is_dependency_timeout_exception(&self) -> bool {
754        matches!(self, Self::DependencyTimeoutException(_))
755    }
756    /// Returns `true` if the error kind is `DecryptError::DisabledException`.
757    pub fn is_disabled_exception(&self) -> bool {
758        matches!(self, Self::DisabledException(_))
759    }
760    /// Returns `true` if the error kind is `DecryptError::DryRunOperationException`.
761    pub fn is_dry_run_operation_exception(&self) -> bool {
762        matches!(self, Self::DryRunOperationException(_))
763    }
764    /// Returns `true` if the error kind is `DecryptError::IncorrectKeyException`.
765    pub fn is_incorrect_key_exception(&self) -> bool {
766        matches!(self, Self::IncorrectKeyException(_))
767    }
768    /// Returns `true` if the error kind is `DecryptError::InvalidCiphertextException`.
769    pub fn is_invalid_ciphertext_exception(&self) -> bool {
770        matches!(self, Self::InvalidCiphertextException(_))
771    }
772    /// Returns `true` if the error kind is `DecryptError::InvalidGrantTokenException`.
773    pub fn is_invalid_grant_token_exception(&self) -> bool {
774        matches!(self, Self::InvalidGrantTokenException(_))
775    }
776    /// Returns `true` if the error kind is `DecryptError::InvalidKeyUsageException`.
777    pub fn is_invalid_key_usage_exception(&self) -> bool {
778        matches!(self, Self::InvalidKeyUsageException(_))
779    }
780    /// Returns `true` if the error kind is `DecryptError::KeyUnavailableException`.
781    pub fn is_key_unavailable_exception(&self) -> bool {
782        matches!(self, Self::KeyUnavailableException(_))
783    }
784    /// Returns `true` if the error kind is `DecryptError::KmsInternalException`.
785    pub fn is_kms_internal_exception(&self) -> bool {
786        matches!(self, Self::KmsInternalException(_))
787    }
788    /// Returns `true` if the error kind is `DecryptError::KmsInvalidStateException`.
789    pub fn is_kms_invalid_state_exception(&self) -> bool {
790        matches!(self, Self::KmsInvalidStateException(_))
791    }
792    /// Returns `true` if the error kind is `DecryptError::NotFoundException`.
793    pub fn is_not_found_exception(&self) -> bool {
794        matches!(self, Self::NotFoundException(_))
795    }
796}
797impl ::std::error::Error for DecryptError {
798    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
799        match self {
800            Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
801            Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
802            Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
803            Self::IncorrectKeyException(_inner) => ::std::option::Option::Some(_inner),
804            Self::InvalidCiphertextException(_inner) => ::std::option::Option::Some(_inner),
805            Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
806            Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
807            Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
808            Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
809            Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
810            Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
811            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
812        }
813    }
814}
815impl ::std::fmt::Display for DecryptError {
816    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
817        match self {
818            Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
819            Self::DisabledException(_inner) => _inner.fmt(f),
820            Self::DryRunOperationException(_inner) => _inner.fmt(f),
821            Self::IncorrectKeyException(_inner) => _inner.fmt(f),
822            Self::InvalidCiphertextException(_inner) => _inner.fmt(f),
823            Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
824            Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
825            Self::KeyUnavailableException(_inner) => _inner.fmt(f),
826            Self::KmsInternalException(_inner) => _inner.fmt(f),
827            Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
828            Self::NotFoundException(_inner) => _inner.fmt(f),
829            Self::Unhandled(_inner) => {
830                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
831                    write!(f, "unhandled error ({code})")
832                } else {
833                    f.write_str("unhandled error")
834                }
835            }
836        }
837    }
838}
839impl ::aws_smithy_types::retry::ProvideErrorKind for DecryptError {
840    fn code(&self) -> ::std::option::Option<&str> {
841        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
842    }
843    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
844        ::std::option::Option::None
845    }
846}
847impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DecryptError {
848    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
849        match self {
850            Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
851            Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
852            Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
853            Self::IncorrectKeyException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
854            Self::InvalidCiphertextException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
855            Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
856            Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
857            Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
858            Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
859            Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
860            Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
861            Self::Unhandled(_inner) => &_inner.meta,
862        }
863    }
864}
865impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DecryptError {
866    fn create_unhandled_error(
867        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
868        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
869    ) -> Self {
870        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
871            source,
872            meta: meta.unwrap_or_default(),
873        })
874    }
875}
876impl ::aws_types::request_id::RequestId for crate::operation::decrypt::DecryptError {
877    fn request_id(&self) -> Option<&str> {
878        self.meta().request_id()
879    }
880}
881
882pub use crate::operation::decrypt::_decrypt_input::DecryptInput;
883
884pub use crate::operation::decrypt::_decrypt_output::DecryptOutput;
885
886mod _decrypt_input;
887
888mod _decrypt_output;
889
890/// Builders
891pub mod builders;