Skip to main content

aws_sdk_secretsmanager/operation/
rotate_secret.rs

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