aws_sdk_kms/operation/
generate_data_key_pair_without_plaintext.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `GenerateDataKeyPairWithoutPlaintext`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GenerateDataKeyPairWithoutPlaintext;
6impl GenerateDataKeyPairWithoutPlaintext {
7    /// Creates a new `GenerateDataKeyPairWithoutPlaintext`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
14    ) -> ::std::result::Result<
15        crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22            ::aws_smithy_runtime_api::client::interceptors::context::Error,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >| {
25            err.map_service_error(|err| {
26                err.downcast::<crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError>()
27                    .expect("correct error type")
28            })
29        };
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::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput>()
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::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
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        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
54            "kms",
55            "GenerateDataKeyPairWithoutPlaintext",
56            input,
57            runtime_plugins,
58            stop_point,
59        )
60        .await
61    }
62
63    pub(crate) fn operation_runtime_plugins(
64        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
65        client_config: &crate::config::Config,
66        config_override: ::std::option::Option<crate::config::Builder>,
67    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
68        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
69        runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
70            ::aws_runtime::auth::sigv4::SCHEME_ID,
71        ]));
72        if let ::std::option::Option::Some(config_override) = config_override {
73            for plugin in config_override.runtime_plugins.iter().cloned() {
74                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
75            }
76            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
77                config_override,
78                client_config.config.clone(),
79                &client_config.runtime_components,
80            ));
81        }
82        runtime_plugins
83    }
84}
85impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GenerateDataKeyPairWithoutPlaintext {
86    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
87        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GenerateDataKeyPairWithoutPlaintext");
88
89        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
90            GenerateDataKeyPairWithoutPlaintextRequestSerializer,
91        ));
92        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
93            GenerateDataKeyPairWithoutPlaintextResponseDeserializer,
94        ));
95
96        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
97            ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
98        ));
99
100        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
101            "GenerateDataKeyPairWithoutPlaintext",
102            "kms",
103        ));
104        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
105        signing_options.double_uri_encode = true;
106        signing_options.content_sha256_header = false;
107        signing_options.normalize_uri_path = true;
108        signing_options.payload_override = None;
109
110        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
111            signing_options,
112            ..::std::default::Default::default()
113        });
114
115        ::std::option::Option::Some(cfg.freeze())
116    }
117
118    fn runtime_components(
119        &self,
120        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
121    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
122        #[allow(unused_mut)]
123        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GenerateDataKeyPairWithoutPlaintext")
124            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
125            .with_interceptor(GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor)
126            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
127                crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
128            >::new())
129            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
130                crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
131            >::new())
132            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
133                crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
134            >::new());
135
136        ::std::borrow::Cow::Owned(rcb)
137    }
138}
139
140#[derive(Debug)]
141struct GenerateDataKeyPairWithoutPlaintextResponseDeserializer;
142impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GenerateDataKeyPairWithoutPlaintextResponseDeserializer {
143    fn deserialize_nonstreaming(
144        &self,
145        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
146    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
147        let (success, status) = (response.status().is_success(), response.status().as_u16());
148        let headers = response.headers();
149        let body = response.body().bytes().expect("body loaded");
150        #[allow(unused_mut)]
151        let mut force_error = false;
152        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
153        let parse_result = if !success && status != 200 || force_error {
154            crate::protocol_serde::shape_generate_data_key_pair_without_plaintext::de_generate_data_key_pair_without_plaintext_http_error(
155                status, headers, body,
156            )
157        } else {
158            crate::protocol_serde::shape_generate_data_key_pair_without_plaintext::de_generate_data_key_pair_without_plaintext_http_response(
159                status, headers, body,
160            )
161        };
162        crate::protocol_serde::type_erase_result(parse_result)
163    }
164}
165#[derive(Debug)]
166struct GenerateDataKeyPairWithoutPlaintextRequestSerializer;
167impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GenerateDataKeyPairWithoutPlaintextRequestSerializer {
168    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
169    fn serialize_input(
170        &self,
171        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
172        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
173    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
174        let input = input
175            .downcast::<crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput>()
176            .expect("correct type");
177        let _header_serialization_settings = _cfg
178            .load::<crate::serialization_settings::HeaderSerializationSettings>()
179            .cloned()
180            .unwrap_or_default();
181        let mut request_builder = {
182            fn uri_base(
183                _input: &crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
184                output: &mut ::std::string::String,
185            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
186                use ::std::fmt::Write as _;
187                ::std::write!(output, "/").expect("formatting should succeed");
188                ::std::result::Result::Ok(())
189            }
190            #[allow(clippy::unnecessary_wraps)]
191            fn update_http_builder(
192                input: &crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
193                builder: ::http::request::Builder,
194            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
195                let mut uri = ::std::string::String::new();
196                uri_base(input, &mut uri)?;
197                ::std::result::Result::Ok(builder.method("POST").uri(uri))
198            }
199            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
200            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.1");
201            builder = _header_serialization_settings.set_default_header(
202                builder,
203                ::http::header::HeaderName::from_static("x-amz-target"),
204                "TrentService.GenerateDataKeyPairWithoutPlaintext",
205            );
206            builder
207        };
208        let body = ::aws_smithy_types::body::SdkBody::from(
209            crate::protocol_serde::shape_generate_data_key_pair_without_plaintext::ser_generate_data_key_pair_without_plaintext_input(&input)?,
210        );
211        if let Some(content_length) = body.content_length() {
212            let content_length = content_length.to_string();
213            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
214        }
215        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
216    }
217}
218#[derive(Debug)]
219struct GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor;
220
221impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor {
222    fn name(&self) -> &'static str {
223        "GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor"
224    }
225
226    fn read_before_execution(
227        &self,
228        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
229            '_,
230            ::aws_smithy_runtime_api::client::interceptors::context::Input,
231            ::aws_smithy_runtime_api::client::interceptors::context::Output,
232            ::aws_smithy_runtime_api::client::interceptors::context::Error,
233        >,
234        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
235    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
236        let _input = context
237            .input()
238            .downcast_ref::<GenerateDataKeyPairWithoutPlaintextInput>()
239            .ok_or("failed to downcast to GenerateDataKeyPairWithoutPlaintextInput")?;
240
241        let params = crate::config::endpoint::Params::builder()
242            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
243            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
244            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
245            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
246            .build()
247            .map_err(|err| {
248                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
249            })?;
250        cfg.interceptor_state()
251            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
252        ::std::result::Result::Ok(())
253    }
254}
255
256// The get_* functions below are generated from JMESPath expressions in the
257// operationContextParams trait. They target the operation's input shape.
258
259/// Error type for the `GenerateDataKeyPairWithoutPlaintextError` operation.
260#[non_exhaustive]
261#[derive(::std::fmt::Debug)]
262pub enum GenerateDataKeyPairWithoutPlaintextError {
263    /// <p>The system timed out while trying to fulfill the request. You can retry the request.</p>
264    DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
265    /// <p>The request was rejected because the specified KMS key is not enabled.</p>
266    DisabledException(crate::types::error::DisabledException),
267    /// <p>The request was rejected because the DryRun parameter was specified.</p>
268    DryRunOperationException(crate::types::error::DryRunOperationException),
269    /// <p>The request was rejected because the specified grant token is not valid.</p>
270    InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
271    /// <p>The request was rejected for one of the following reasons:</p>
272    /// <ul>
273    /// <li>
274    /// <p>The <code>KeyUsage</code> value of the KMS key is incompatible with the API operation.</p></li>
275    /// <li>
276    /// <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>
277    /// </ul>
278    /// <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>. To find the <code>KeyUsage</code> of a KMS key, use the <code>DescribeKey</code> operation.</p>
279    /// <p>To find the encryption or signing algorithms supported for a particular KMS key, use the <code>DescribeKey</code> operation.</p>
280    InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
281    /// <p>The request was rejected because the specified KMS key was not available. You can retry the request.</p>
282    KeyUnavailableException(crate::types::error::KeyUnavailableException),
283    /// <p>The request was rejected because an internal exception occurred. The request can be retried.</p>
284    KmsInternalException(crate::types::error::KmsInternalException),
285    /// <p>The request was rejected because the state of the specified resource is not valid for this request.</p>
286    /// <p>This exceptions means one of the following:</p>
287    /// <ul>
288    /// <li>
289    /// <p>The key state of the KMS key is not compatible with the operation.</p>
290    /// <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>
291    /// <li>
292    /// <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>
293    /// </ul>
294    KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
295    /// <p>The request was rejected because the specified entity or resource could not be found.</p>
296    NotFoundException(crate::types::error::NotFoundException),
297    /// <p>The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.</p>
298    UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
299    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
300    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
301    variable wildcard pattern and check `.code()`:
302     \
303    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
304     \
305    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GenerateDataKeyPairWithoutPlaintextError) for what information is available for the error.")]
306    Unhandled(crate::error::sealed_unhandled::Unhandled),
307}
308impl GenerateDataKeyPairWithoutPlaintextError {
309    /// Creates the `GenerateDataKeyPairWithoutPlaintextError::Unhandled` variant from any error type.
310    pub fn unhandled(
311        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
312    ) -> Self {
313        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
314            source: err.into(),
315            meta: ::std::default::Default::default(),
316        })
317    }
318
319    /// Creates the `GenerateDataKeyPairWithoutPlaintextError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
320    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
321        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
322            source: err.clone().into(),
323            meta: err,
324        })
325    }
326    ///
327    /// Returns error metadata, which includes the error code, message,
328    /// request ID, and potentially additional information.
329    ///
330    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
331        match self {
332            Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
333            Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
334            Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
335            Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
336            Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
337            Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
338            Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
339            Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
340            Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341            Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342            Self::Unhandled(e) => &e.meta,
343        }
344    }
345    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::DependencyTimeoutException`.
346    pub fn is_dependency_timeout_exception(&self) -> bool {
347        matches!(self, Self::DependencyTimeoutException(_))
348    }
349    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::DisabledException`.
350    pub fn is_disabled_exception(&self) -> bool {
351        matches!(self, Self::DisabledException(_))
352    }
353    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::DryRunOperationException`.
354    pub fn is_dry_run_operation_exception(&self) -> bool {
355        matches!(self, Self::DryRunOperationException(_))
356    }
357    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::InvalidGrantTokenException`.
358    pub fn is_invalid_grant_token_exception(&self) -> bool {
359        matches!(self, Self::InvalidGrantTokenException(_))
360    }
361    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::InvalidKeyUsageException`.
362    pub fn is_invalid_key_usage_exception(&self) -> bool {
363        matches!(self, Self::InvalidKeyUsageException(_))
364    }
365    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::KeyUnavailableException`.
366    pub fn is_key_unavailable_exception(&self) -> bool {
367        matches!(self, Self::KeyUnavailableException(_))
368    }
369    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::KmsInternalException`.
370    pub fn is_kms_internal_exception(&self) -> bool {
371        matches!(self, Self::KmsInternalException(_))
372    }
373    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::KmsInvalidStateException`.
374    pub fn is_kms_invalid_state_exception(&self) -> bool {
375        matches!(self, Self::KmsInvalidStateException(_))
376    }
377    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::NotFoundException`.
378    pub fn is_not_found_exception(&self) -> bool {
379        matches!(self, Self::NotFoundException(_))
380    }
381    /// Returns `true` if the error kind is `GenerateDataKeyPairWithoutPlaintextError::UnsupportedOperationException`.
382    pub fn is_unsupported_operation_exception(&self) -> bool {
383        matches!(self, Self::UnsupportedOperationException(_))
384    }
385}
386impl ::std::error::Error for GenerateDataKeyPairWithoutPlaintextError {
387    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
388        match self {
389            Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
390            Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
391            Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
392            Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
393            Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
394            Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
395            Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
396            Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
397            Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
398            Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
399            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
400        }
401    }
402}
403impl ::std::fmt::Display for GenerateDataKeyPairWithoutPlaintextError {
404    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
405        match self {
406            Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
407            Self::DisabledException(_inner) => _inner.fmt(f),
408            Self::DryRunOperationException(_inner) => _inner.fmt(f),
409            Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
410            Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
411            Self::KeyUnavailableException(_inner) => _inner.fmt(f),
412            Self::KmsInternalException(_inner) => _inner.fmt(f),
413            Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
414            Self::NotFoundException(_inner) => _inner.fmt(f),
415            Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
416            Self::Unhandled(_inner) => {
417                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
418                    write!(f, "unhandled error ({code})")
419                } else {
420                    f.write_str("unhandled error")
421                }
422            }
423        }
424    }
425}
426impl ::aws_smithy_types::retry::ProvideErrorKind for GenerateDataKeyPairWithoutPlaintextError {
427    fn code(&self) -> ::std::option::Option<&str> {
428        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
429    }
430    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
431        ::std::option::Option::None
432    }
433}
434impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GenerateDataKeyPairWithoutPlaintextError {
435    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
436        match self {
437            Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
438            Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
439            Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
440            Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
441            Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
442            Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
443            Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
444            Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
445            Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
446            Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
447            Self::Unhandled(_inner) => &_inner.meta,
448        }
449    }
450}
451impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GenerateDataKeyPairWithoutPlaintextError {
452    fn create_unhandled_error(
453        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
454        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
455    ) -> Self {
456        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
457            source,
458            meta: meta.unwrap_or_default(),
459        })
460    }
461}
462impl ::aws_types::request_id::RequestId for crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError {
463    fn request_id(&self) -> Option<&str> {
464        self.meta().request_id()
465    }
466}
467
468pub use crate::operation::generate_data_key_pair_without_plaintext::_generate_data_key_pair_without_plaintext_output::GenerateDataKeyPairWithoutPlaintextOutput;
469
470pub use crate::operation::generate_data_key_pair_without_plaintext::_generate_data_key_pair_without_plaintext_input::GenerateDataKeyPairWithoutPlaintextInput;
471
472mod _generate_data_key_pair_without_plaintext_input;
473
474mod _generate_data_key_pair_without_plaintext_output;
475
476/// Builders
477pub mod builders;