Skip to main content

aws_sdk_kms/operation/
generate_data_key_pair.rs

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