Skip to main content

aws_sdk_kms/operation/
schedule_key_deletion.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `ScheduleKeyDeletion`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ScheduleKeyDeletion;
6impl ScheduleKeyDeletion {
7    /// Creates a new `ScheduleKeyDeletion`
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::schedule_key_deletion::ScheduleKeyDeletionInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
15        crate::operation::schedule_key_deletion::ScheduleKeyDeletionOutput::SCHEMA;
16    pub(crate) async fn orchestrate(
17        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
18        input: crate::operation::schedule_key_deletion::ScheduleKeyDeletionInput,
19    ) -> ::std::result::Result<
20        crate::operation::schedule_key_deletion::ScheduleKeyDeletionOutput,
21        ::aws_smithy_runtime_api::client::result::SdkError<
22            crate::operation::schedule_key_deletion::ScheduleKeyDeletionError,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >,
25    > {
26        let map_err = |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        >| {
30            err.map_service_error(|err| {
31                err.downcast::<crate::operation::schedule_key_deletion::ScheduleKeyDeletionError>()
32                    .expect("correct error type")
33            })
34        };
35        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
36            .await
37            .map_err(map_err)?;
38        let output = context.finalize().map_err(map_err)?;
39        ::std::result::Result::Ok(
40            output
41                .downcast::<crate::operation::schedule_key_deletion::ScheduleKeyDeletionOutput>()
42                .expect("correct output type"),
43        )
44    }
45
46    pub(crate) async fn orchestrate_with_stop_point(
47        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
48        input: crate::operation::schedule_key_deletion::ScheduleKeyDeletionInput,
49        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
50    ) -> ::std::result::Result<
51        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
52        ::aws_smithy_runtime_api::client::result::SdkError<
53            ::aws_smithy_runtime_api::client::interceptors::context::Error,
54            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
55        >,
56    > {
57        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
58        use ::tracing::Instrument;
59        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "ScheduleKeyDeletion", input, runtime_plugins, stop_point)
60            // Create a parent span for the entire operation. Includes a random, internal-only,
61            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
62            .instrument(::tracing::debug_span!(
63                "KMS.ScheduleKeyDeletion",
64                "rpc.service" = "KMS",
65                "rpc.method" = "ScheduleKeyDeletion",
66                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
67                "rpc.system" = "aws-api",
68            ))
69            .await
70    }
71
72    pub(crate) fn operation_runtime_plugins(
73        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
74        client_config: &crate::config::Config,
75        config_override: ::std::option::Option<crate::config::Builder>,
76    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
77        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
78
79        if let ::std::option::Option::Some(config_override) = config_override {
80            for plugin in config_override.runtime_plugins.iter().cloned() {
81                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
82            }
83            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
84                config_override,
85                client_config.config.clone(),
86                &client_config.runtime_components,
87            ));
88        }
89        runtime_plugins
90    }
91}
92/// Per-operation error registry. Contains an entry for every modeled
93/// error this operation can throw.
94///
95/// Used by the schema-serde error path as the operation-scoped lookup
96/// for registry-backed error reification: an error code that does not
97/// match one of the operation's modeled errors directly is resolved
98/// against this registry first, then widened to the service-wide error
99/// registry.
100pub(crate) mod error_registry {
101    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
102        ::aws_smithy_schema::registry::TypeRegistry::builder()
103                            .insert_error_shape(
104                        crate::types::error::DependencyTimeoutException::SCHEMA,
105                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
106                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
107                        },
108                        |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> {
109                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
110                        },
111                    )
112.insert_error_shape(
113                        crate::types::error::InvalidArnException::SCHEMA,
114                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
115                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidArnException::deserialize(d)?))
116                        },
117                        |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> {
118                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidArnException::deserialize(d)?))
119                        },
120                    )
121.insert_error_shape(
122                        crate::types::error::KmsInternalException::SCHEMA,
123                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
124                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
125                        },
126                        |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> {
127                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
128                        },
129                    )
130.insert_error_shape(
131                        crate::types::error::KmsInvalidStateException::SCHEMA,
132                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
133                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
134                        },
135                        |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> {
136                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
137                        },
138                    )
139.insert_error_shape(
140                        crate::types::error::NotFoundException::SCHEMA,
141                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
142                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
143                        },
144                        |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> {
145                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
146                        },
147                    )
148                            .build()
149    });
150}
151impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ScheduleKeyDeletion {
152    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
153        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ScheduleKeyDeletion");
154
155        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
156            ScheduleKeyDeletionRequestSerializer,
157        ));
158        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
159            ScheduleKeyDeletionResponseDeserializer,
160        ));
161
162        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
163            crate::config::auth::Params::builder()
164                .operation_name("ScheduleKeyDeletion")
165                .build()
166                .expect("required fields set"),
167        ));
168
169        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
170            "ScheduleKeyDeletion",
171            "KMS",
172        ));
173        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
174        signing_options.double_uri_encode = true;
175        signing_options.content_sha256_header = false;
176        signing_options.normalize_uri_path = true;
177        signing_options.payload_override = None;
178
179        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
180            signing_options,
181            ..::std::default::Default::default()
182        });
183
184        ::std::option::Option::Some(cfg.freeze())
185    }
186
187    fn runtime_components(
188        &self,
189        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
190    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
191        #[allow(unused_mut)]
192        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ScheduleKeyDeletion")
193            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
194                ScheduleKeyDeletionTelemetryInputCaptureInterceptor,
195            ))
196            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
197                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
198            ))
199            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
200                ScheduleKeyDeletionEndpointParamsInterceptor,
201            ))
202            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
203                crate::operation::schedule_key_deletion::ScheduleKeyDeletionError,
204            >::new())
205            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
206                crate::operation::schedule_key_deletion::ScheduleKeyDeletionError,
207            >::new())
208            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
209                crate::operation::schedule_key_deletion::ScheduleKeyDeletionError,
210            >::new())
211            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
212                crate::operation::schedule_key_deletion::ScheduleKeyDeletionError,
213            >::new());
214
215        ::std::borrow::Cow::Owned(rcb)
216    }
217}
218
219#[derive(Debug)]
220struct ScheduleKeyDeletionTelemetryInputCaptureInterceptor;
221
222#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
223impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ScheduleKeyDeletionTelemetryInputCaptureInterceptor {
224    fn name(&self) -> &'static str {
225        "ScheduleKeyDeletionTelemetryInputCaptureInterceptor"
226    }
227
228    fn read_before_execution(
229        &self,
230        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
231            '_,
232            ::aws_smithy_runtime_api::client::interceptors::context::Input,
233            ::aws_smithy_runtime_api::client::interceptors::context::Output,
234            ::aws_smithy_runtime_api::client::interceptors::context::Error,
235        >,
236        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
237    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
238        // Nothing to do unless the customer opted in by naming members to record.
239        let ::std::option::Option::Some(requested) = cfg
240            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
241            .filter(|r| !r.is_empty())
242        else {
243            return ::std::result::Result::Ok(());
244        };
245
246        let ::std::option::Option::Some(input) = context.input().downcast_ref::<ScheduleKeyDeletionInput>() else {
247            // A mismatched input is not this interceptor's concern; skip quietly.
248            return ::std::result::Result::Ok(());
249        };
250
251        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
252        if requested.should_capture("KeyId") {
253            if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
254                captured.insert("KeyId", value);
255            }
256        }
257
258        cfg.interceptor_state().store_put(captured);
259        ::std::result::Result::Ok(())
260    }
261}
262#[derive(Debug)]
263struct ScheduleKeyDeletionResponseDeserializer;
264impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ScheduleKeyDeletionResponseDeserializer {
265    fn deserialize_nonstreaming_with_config(
266        &self,
267        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
268        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
269    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
270        let (success, status) = (response.status().is_success(), response.status().as_u16());
271        // Load body and headers BEFORE BeforeParseResponse so customizations
272        // (e.g., S3's `body_is_error` check that detects errors returned with
273        // HTTP 200) can inspect them. The legacy non-streaming path also
274        // loads `body` before firing this hook.
275        #[allow(unused_variables)]
276        let body = response.body().bytes().expect("body loaded");
277        let headers = response.headers();
278        #[allow(unused_mut)]
279        let mut force_error = false;
280        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
281        if !success && status != 200 || force_error {
282            let protocol = _cfg
283                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
284                .expect("a SharedClientProtocol is required");
285            #[allow(unused_mut)]
286            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
287                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
288            })?;
289            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
290            let generic = generic_builder.build();
291            let error_code = match generic.code() {
292                ::std::option::Option::Some(code) => code,
293                ::std::option::Option::None => {
294                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
295                        ::aws_smithy_runtime_api::box_error::BoxError::from(
296                            crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::unhandled(generic),
297                        ),
298                    ))
299                }
300            };
301            let _error_message = generic.message().map(|msg| msg.to_owned());
302            let err = match error_code {
303                "DependencyTimeoutException" => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::DependencyTimeoutException({
304                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
305                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
306                            e,
307                        ))
308                    })?;
309                    let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
310                    tmp.deserialize_members(&mut *deser).map_err(|e| {
311                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
312                            e,
313                        ))
314                    })?;
315                    if tmp.message.is_none() {
316                        tmp.message = _error_message;
317                    }
318                    let tmp = tmp.meta(generic);
319                    tmp.build()
320                }),
321                "InvalidArnException" => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::InvalidArnException({
322                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
323                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
324                            e,
325                        ))
326                    })?;
327                    let mut tmp = <crate::types::error::builders::InvalidArnExceptionBuilder>::default();
328                    tmp.deserialize_members(&mut *deser).map_err(|e| {
329                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
330                            e,
331                        ))
332                    })?;
333                    if tmp.message.is_none() {
334                        tmp.message = _error_message;
335                    }
336                    let tmp = tmp.meta(generic);
337                    tmp.build()
338                }),
339                "KMSInternalException" => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::KmsInternalException({
340                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
341                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
342                            e,
343                        ))
344                    })?;
345                    let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
346                    tmp.deserialize_members(&mut *deser).map_err(|e| {
347                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
348                            e,
349                        ))
350                    })?;
351                    if tmp.message.is_none() {
352                        tmp.message = _error_message;
353                    }
354                    let tmp = tmp.meta(generic);
355                    tmp.build()
356                }),
357                "KMSInvalidStateException" => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::KmsInvalidStateException({
358                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
359                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
360                            e,
361                        ))
362                    })?;
363                    let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
364                    tmp.deserialize_members(&mut *deser).map_err(|e| {
365                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
366                            e,
367                        ))
368                    })?;
369                    if tmp.message.is_none() {
370                        tmp.message = _error_message;
371                    }
372                    let tmp = tmp.meta(generic);
373                    tmp.build()
374                }),
375                "NotFoundException" => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::NotFoundException({
376                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
377                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
378                            e,
379                        ))
380                    })?;
381                    let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
382                    tmp.deserialize_members(&mut *deser).map_err(|e| {
383                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
384                            e,
385                        ))
386                    })?;
387                    if tmp.message.is_none() {
388                        tmp.message = _error_message;
389                    }
390                    let tmp = tmp.meta(generic);
391                    tmp.build()
392                }),
393                _ => {
394                    // Registry-backed, operation-scoped reification of an error whose
395                    // code this operation does not model directly: the operation's own
396                    // error registry is consulted first, then the lookup widens to the
397                    // service-wide error registry. On a hit, the reified error is attached
398                    // as the source of the returned unhandled error while its metadata
399                    // (code, message, request id) is preserved; on a miss the generic
400                    // error is returned unchanged.
401                    match protocol
402                        .deserialize_error_response(response, _cfg)
403                        .ok()
404                        .and_then(|mut deser| {
405                            ::aws_smithy_schema::registry::reify_error(
406                                crate::operation::schedule_key_deletion::error_registry::REGISTRY
407                                    .or(&crate::error_type_registry::REGISTRY),
408                                error_code,
409                                &mut *deser,
410                            )
411                        }) {
412                        ::std::option::Option::Some(source) => <crate::operation::schedule_key_deletion::ScheduleKeyDeletionError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
413                        ::std::option::Option::None => crate::operation::schedule_key_deletion::ScheduleKeyDeletionError::generic(generic),
414                    }
415                }
416            };
417            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
418                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
419            ))
420        } else {
421            let protocol = _cfg
422                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
423                .expect("a SharedClientProtocol is required");
424            let mut deser = protocol
425                .deserialize_response(response, ScheduleKeyDeletion::OUTPUT_SCHEMA, _cfg)
426                .map_err(|e| {
427                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
428                })?;
429            // `headers` is already in scope from the top of the function; alias it as
430            // `_response_headers` so MutateOutput customizations have a stable name to
431            // read from.
432            let _response_headers = headers;
433            // `mut` is required because `deserialize_members` and the `MutateOutput`
434            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
435            // empty output has no members and no customizations to run.
436            #[allow(unused_mut)]
437            let mut output = <crate::operation::schedule_key_deletion::builders::ScheduleKeyDeletionOutputBuilder>::default();
438            output.deserialize_members(&mut *deser).map_err(|e| {
439                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
440            })?;
441            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
442            let output = output.build();
443            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
444        }
445    }
446}
447#[derive(Debug)]
448struct ScheduleKeyDeletionRequestSerializer;
449impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ScheduleKeyDeletionRequestSerializer {
450    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
451    fn serialize_input(
452        &self,
453        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
454        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
455    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
456        let input = input
457            .downcast::<crate::operation::schedule_key_deletion::ScheduleKeyDeletionInput>()
458            .expect("correct type");
459
460        let protocol = _cfg
461            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
462            .expect("a SharedClientProtocol is required");
463        let mut request = protocol
464            .serialize_request(&input, ScheduleKeyDeletion::INPUT_SCHEMA, "/", _cfg)
465            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
466
467        return ::std::result::Result::Ok(request);
468    }
469}
470#[derive(Debug)]
471struct ScheduleKeyDeletionEndpointParamsInterceptor;
472
473#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
474impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ScheduleKeyDeletionEndpointParamsInterceptor {
475    fn name(&self) -> &'static str {
476        "ScheduleKeyDeletionEndpointParamsInterceptor"
477    }
478
479    fn read_before_execution(
480        &self,
481        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
482            '_,
483            ::aws_smithy_runtime_api::client::interceptors::context::Input,
484            ::aws_smithy_runtime_api::client::interceptors::context::Output,
485            ::aws_smithy_runtime_api::client::interceptors::context::Error,
486        >,
487        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
488    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
489        let _input = context
490            .input()
491            .downcast_ref::<ScheduleKeyDeletionInput>()
492            .ok_or("failed to downcast to ScheduleKeyDeletionInput")?;
493
494        let params = crate::config::endpoint::Params::builder()
495            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
496            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
497            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
498            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
499            .build()
500            .map_err(|err| {
501                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
502            })?;
503        cfg.interceptor_state()
504            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
505        ::std::result::Result::Ok(())
506    }
507}
508
509// The get_* functions below are generated from JMESPath expressions in the
510// operationContextParams trait. They target the operation's input shape.
511
512/// Error type for the `ScheduleKeyDeletionError` operation.
513#[non_exhaustive]
514#[derive(::std::fmt::Debug)]
515pub enum ScheduleKeyDeletionError {
516    /// <p>The system timed out while trying to fulfill the request. You can retry the request.</p>
517    DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
518    /// <p>The request was rejected because a specified ARN, or an ARN in a key policy, is not valid.</p>
519    InvalidArnException(crate::types::error::InvalidArnException),
520    /// <p>The request was rejected because an internal exception occurred. The request can be retried.</p>
521    KmsInternalException(crate::types::error::KmsInternalException),
522    /// <p>The request was rejected because the state of the specified resource is not valid for this request.</p>
523    /// <p>This exceptions means one of the following:</p>
524    /// <ul>
525    /// <li>
526    /// <p>The key state of the KMS key is not compatible with the operation.</p>
527    /// <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>
528    /// <li>
529    /// <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>
530    /// </ul>
531    KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
532    /// <p>The request was rejected because the specified entity or resource could not be found.</p>
533    NotFoundException(crate::types::error::NotFoundException),
534    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
535    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
536    variable wildcard pattern and check `.code()`:
537     \
538    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
539     \
540    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ScheduleKeyDeletionError) for what information is available for the error.")]
541    Unhandled(crate::error::sealed_unhandled::Unhandled),
542}
543impl ScheduleKeyDeletionError {
544    /// Creates the `ScheduleKeyDeletionError::Unhandled` variant from any error type.
545    pub fn unhandled(
546        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
547    ) -> Self {
548        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
549            source: err.into(),
550            meta: ::std::default::Default::default(),
551        })
552    }
553
554    /// Creates the `ScheduleKeyDeletionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
555    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
556        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
557            source: err.clone().into(),
558            meta: err,
559        })
560    }
561    ///
562    /// Returns error metadata, which includes the error code, message,
563    /// request ID, and potentially additional information.
564    ///
565    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
566        match self {
567            Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
568            Self::InvalidArnException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
569            Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
570            Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
571            Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
572            Self::Unhandled(e) => &e.meta,
573        }
574    }
575    /// Returns `true` if the error kind is `ScheduleKeyDeletionError::DependencyTimeoutException`.
576    pub fn is_dependency_timeout_exception(&self) -> bool {
577        matches!(self, Self::DependencyTimeoutException(_))
578    }
579    /// Returns `true` if the error kind is `ScheduleKeyDeletionError::InvalidArnException`.
580    pub fn is_invalid_arn_exception(&self) -> bool {
581        matches!(self, Self::InvalidArnException(_))
582    }
583    /// Returns `true` if the error kind is `ScheduleKeyDeletionError::KmsInternalException`.
584    pub fn is_kms_internal_exception(&self) -> bool {
585        matches!(self, Self::KmsInternalException(_))
586    }
587    /// Returns `true` if the error kind is `ScheduleKeyDeletionError::KmsInvalidStateException`.
588    pub fn is_kms_invalid_state_exception(&self) -> bool {
589        matches!(self, Self::KmsInvalidStateException(_))
590    }
591    /// Returns `true` if the error kind is `ScheduleKeyDeletionError::NotFoundException`.
592    pub fn is_not_found_exception(&self) -> bool {
593        matches!(self, Self::NotFoundException(_))
594    }
595}
596impl ::std::error::Error for ScheduleKeyDeletionError {
597    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
598        match self {
599            Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
600            Self::InvalidArnException(_inner) => ::std::option::Option::Some(_inner),
601            Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
602            Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
603            Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
604            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
605        }
606    }
607}
608impl ::std::fmt::Display for ScheduleKeyDeletionError {
609    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
610        match self {
611            Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
612            Self::InvalidArnException(_inner) => _inner.fmt(f),
613            Self::KmsInternalException(_inner) => _inner.fmt(f),
614            Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
615            Self::NotFoundException(_inner) => _inner.fmt(f),
616            Self::Unhandled(_inner) => {
617                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
618                    write!(f, "unhandled error ({code})")
619                } else {
620                    f.write_str("unhandled error")
621                }
622            }
623        }
624    }
625}
626impl ::aws_smithy_types::retry::ProvideErrorKind for ScheduleKeyDeletionError {
627    fn code(&self) -> ::std::option::Option<&str> {
628        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
629    }
630    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
631        ::std::option::Option::None
632    }
633}
634impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ScheduleKeyDeletionError {
635    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
636        match self {
637            Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
638            Self::InvalidArnException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
639            Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
640            Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
641            Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
642            Self::Unhandled(_inner) => &_inner.meta,
643        }
644    }
645}
646impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ScheduleKeyDeletionError {
647    fn create_unhandled_error(
648        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
649        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
650    ) -> Self {
651        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
652            source,
653            meta: meta.unwrap_or_default(),
654        })
655    }
656}
657impl ::aws_types::request_id::RequestId for crate::operation::schedule_key_deletion::ScheduleKeyDeletionError {
658    fn request_id(&self) -> Option<&str> {
659        self.meta().request_id()
660    }
661}
662
663pub use crate::operation::schedule_key_deletion::_schedule_key_deletion_input::ScheduleKeyDeletionInput;
664
665pub use crate::operation::schedule_key_deletion::_schedule_key_deletion_output::ScheduleKeyDeletionOutput;
666
667mod _schedule_key_deletion_input;
668
669mod _schedule_key_deletion_output;
670
671/// Builders
672pub mod builders;