Skip to main content

aws_sdk_secretsmanager/operation/
cancel_rotate_secret.rs

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