Skip to main content

aws_sdk_secretsmanager/operation/
get_secret_value.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `GetSecretValue`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetSecretValue;
6impl GetSecretValue {
7    /// Creates a new `GetSecretValue`
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::get_secret_value::GetSecretValueInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::get_secret_value::GetSecretValueOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17        input: crate::operation::get_secret_value::GetSecretValueInput,
18    ) -> ::std::result::Result<
19        crate::operation::get_secret_value::GetSecretValueOutput,
20        ::aws_smithy_runtime_api::client::result::SdkError<
21            crate::operation::get_secret_value::GetSecretValueError,
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::get_secret_value::GetSecretValueError>()
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::get_secret_value::GetSecretValueOutput>()
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::get_secret_value::GetSecretValueInput,
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", "GetSecretValue", 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.GetSecretValue",
63                "rpc.service" = "Secrets Manager",
64                "rpc.method" = "GetSecretValue",
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
78        if let ::std::option::Option::Some(config_override) = config_override {
79            for plugin in config_override.runtime_plugins.iter().cloned() {
80                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81            }
82            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83                config_override,
84                client_config.config.clone(),
85                &client_config.runtime_components,
86            ));
87        }
88        runtime_plugins
89    }
90}
91/// Per-operation error registry. Contains an entry for every modeled
92/// error this operation can throw.
93///
94/// Used by the schema-serde error path as the operation-scoped lookup
95/// for registry-backed error reification: an error code that does not
96/// match one of the operation's modeled errors directly is resolved
97/// against this registry first, then widened to the service-wide error
98/// registry.
99pub(crate) mod error_registry {
100    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101        ::aws_smithy_schema::registry::TypeRegistry::builder()
102                            .insert_error_shape(
103                        crate::types::error::DecryptionFailure::SCHEMA,
104                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DecryptionFailure::deserialize(d)?))
106                        },
107                        |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> {
108                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DecryptionFailure::deserialize(d)?))
109                        },
110                    )
111.insert_error_shape(
112                        crate::types::error::InternalServiceError::SCHEMA,
113                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServiceError::deserialize(d)?))
115                        },
116                        |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> {
117                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServiceError::deserialize(d)?))
118                        },
119                    )
120.insert_error_shape(
121                        crate::types::error::InvalidParameterException::SCHEMA,
122                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidParameterException::deserialize(d)?))
124                        },
125                        |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> {
126                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidParameterException::deserialize(d)?))
127                        },
128                    )
129.insert_error_shape(
130                        crate::types::error::InvalidRequestException::SCHEMA,
131                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestException::deserialize(d)?))
133                        },
134                        |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> {
135                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestException::deserialize(d)?))
136                        },
137                    )
138.insert_error_shape(
139                        crate::types::error::ResourceNotFoundException::SCHEMA,
140                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
142                        },
143                        |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> {
144                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
145                        },
146                    )
147                            .build()
148    });
149}
150impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetSecretValue {
151    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
152        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetSecretValue");
153
154        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
155            GetSecretValueRequestSerializer,
156        ));
157        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
158            GetSecretValueResponseDeserializer,
159        ));
160
161        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
162            crate::config::auth::Params::builder()
163                .operation_name("GetSecretValue")
164                .build()
165                .expect("required fields set"),
166        ));
167
168        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
169        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
170            "GetSecretValue",
171            "Secrets Manager",
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("GetSecretValue")
193            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
194                GetSecretValueTelemetryInputCaptureInterceptor,
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                GetSecretValueEndpointParamsInterceptor,
201            ))
202            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
203                crate::operation::get_secret_value::GetSecretValueError,
204            >::new())
205            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
206                crate::operation::get_secret_value::GetSecretValueError,
207            >::new())
208            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
209                crate::operation::get_secret_value::GetSecretValueError,
210            >::new())
211            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
212                crate::operation::get_secret_value::GetSecretValueError,
213            >::new());
214
215        ::std::borrow::Cow::Owned(rcb)
216    }
217}
218
219#[derive(Debug)]
220struct GetSecretValueTelemetryInputCaptureInterceptor;
221
222#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
223impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSecretValueTelemetryInputCaptureInterceptor {
224    fn name(&self) -> &'static str {
225        "GetSecretValueTelemetryInputCaptureInterceptor"
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::<GetSecretValueInput>() 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("SecretId") {
253            if let ::std::option::Option::Some(value) = input.secret_id.as_deref() {
254                captured.insert("SecretId", value);
255            }
256        }
257        if requested.should_capture("VersionId") {
258            if let ::std::option::Option::Some(value) = input.version_id.as_deref() {
259                captured.insert("VersionId", value);
260            }
261        }
262        if requested.should_capture("VersionStage") {
263            if let ::std::option::Option::Some(value) = input.version_stage.as_deref() {
264                captured.insert("VersionStage", value);
265            }
266        }
267
268        cfg.interceptor_state().store_put(captured);
269        ::std::result::Result::Ok(())
270    }
271}
272#[derive(Debug)]
273struct GetSecretValueResponseDeserializer;
274impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetSecretValueResponseDeserializer {
275    fn deserialize_nonstreaming_with_config(
276        &self,
277        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
278        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
279    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
280        let (success, status) = (response.status().is_success(), response.status().as_u16());
281        // Load body and headers BEFORE BeforeParseResponse so customizations
282        // (e.g., S3's `body_is_error` check that detects errors returned with
283        // HTTP 200) can inspect them. The legacy non-streaming path also
284        // loads `body` before firing this hook.
285        #[allow(unused_variables)]
286        let body = response.body().bytes().expect("body loaded");
287        let headers = response.headers();
288        #[allow(unused_mut)]
289        let mut force_error = false;
290        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
291        if !success && status != 200 || force_error {
292            let protocol = _cfg
293                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
294                .expect("a SharedClientProtocol is required");
295            #[allow(unused_mut)]
296            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
297                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
298            })?;
299            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
300            let generic = generic_builder.build();
301            let error_code = match generic.code() {
302                ::std::option::Option::Some(code) => code,
303                ::std::option::Option::None => {
304                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
305                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::get_secret_value::GetSecretValueError::unhandled(
306                            generic,
307                        )),
308                    ))
309                }
310            };
311            let _error_message = generic.message().map(|msg| msg.to_owned());
312            let err = match error_code {
313                "DecryptionFailure" => crate::operation::get_secret_value::GetSecretValueError::DecryptionFailure({
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::DecryptionFailureBuilder>::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                "InternalServiceError" => crate::operation::get_secret_value::GetSecretValueError::InternalServiceError({
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::InternalServiceErrorBuilder>::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                "InvalidParameterException" => crate::operation::get_secret_value::GetSecretValueError::InvalidParameterException({
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::InvalidParameterExceptionBuilder>::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                "InvalidRequestException" => crate::operation::get_secret_value::GetSecretValueError::InvalidRequestException({
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::InvalidRequestExceptionBuilder>::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                "ResourceNotFoundException" => crate::operation::get_secret_value::GetSecretValueError::ResourceNotFoundException({
386                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
387                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
388                            e,
389                        ))
390                    })?;
391                    let mut tmp = <crate::types::error::builders::ResourceNotFoundExceptionBuilder>::default();
392                    tmp.deserialize_members(&mut *deser).map_err(|e| {
393                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
394                            e,
395                        ))
396                    })?;
397                    if tmp.message.is_none() {
398                        tmp.message = _error_message;
399                    }
400                    let tmp = tmp.meta(generic);
401                    tmp.build()
402                }),
403                _ => {
404                    // Registry-backed, operation-scoped reification of an error whose
405                    // code this operation does not model directly: the operation's own
406                    // error registry is consulted first, then the lookup widens to the
407                    // service-wide error registry. On a hit, the reified error is attached
408                    // as the source of the returned unhandled error while its metadata
409                    // (code, message, request id) is preserved; on a miss the generic
410                    // error is returned unchanged.
411                    match protocol
412                        .deserialize_error_response(response, _cfg)
413                        .ok()
414                        .and_then(|mut deser| {
415                            ::aws_smithy_schema::registry::reify_error(
416                                crate::operation::get_secret_value::error_registry::REGISTRY
417                                    .or(&crate::error_type_registry::REGISTRY),
418                                error_code,
419                                &mut *deser,
420                            )
421                        }) {
422                        ::std::option::Option::Some(source) => <crate::operation::get_secret_value::GetSecretValueError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
423                        ::std::option::Option::None => crate::operation::get_secret_value::GetSecretValueError::generic(generic),
424                    }
425                }
426            };
427            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
428                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
429            ))
430        } else {
431            let protocol = _cfg
432                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
433                .expect("a SharedClientProtocol is required");
434            let mut deser = protocol
435                .deserialize_response(response, GetSecretValue::OUTPUT_SCHEMA, _cfg)
436                .map_err(|e| {
437                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
438                })?;
439            // `headers` is already in scope from the top of the function; alias it as
440            // `_response_headers` so MutateOutput customizations have a stable name to
441            // read from.
442            let _response_headers = headers;
443            // `mut` is required because `deserialize_members` and the `MutateOutput`
444            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
445            // empty output has no members and no customizations to run.
446            #[allow(unused_mut)]
447            let mut output = <crate::operation::get_secret_value::builders::GetSecretValueOutputBuilder>::default();
448            output.deserialize_members(&mut *deser).map_err(|e| {
449                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
450            })?;
451            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
452            let output = output.build();
453            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
454        }
455    }
456}
457#[derive(Debug)]
458struct GetSecretValueRequestSerializer;
459impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetSecretValueRequestSerializer {
460    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
461    fn serialize_input(
462        &self,
463        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
464        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
465    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
466        let input = input
467            .downcast::<crate::operation::get_secret_value::GetSecretValueInput>()
468            .expect("correct type");
469
470        let protocol = _cfg
471            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
472            .expect("a SharedClientProtocol is required");
473        let mut request = protocol
474            .serialize_request(&input, GetSecretValue::INPUT_SCHEMA, "/", _cfg)
475            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
476
477        return ::std::result::Result::Ok(request);
478    }
479}
480#[derive(Debug)]
481struct GetSecretValueEndpointParamsInterceptor;
482
483#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
484impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSecretValueEndpointParamsInterceptor {
485    fn name(&self) -> &'static str {
486        "GetSecretValueEndpointParamsInterceptor"
487    }
488
489    fn read_before_execution(
490        &self,
491        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
492            '_,
493            ::aws_smithy_runtime_api::client::interceptors::context::Input,
494            ::aws_smithy_runtime_api::client::interceptors::context::Output,
495            ::aws_smithy_runtime_api::client::interceptors::context::Error,
496        >,
497        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
498    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
499        let _input = context
500            .input()
501            .downcast_ref::<GetSecretValueInput>()
502            .ok_or("failed to downcast to GetSecretValueInput")?;
503
504        let params = crate::config::endpoint::Params::builder()
505            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
506            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
507            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
508            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
509            .build()
510            .map_err(|err| {
511                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
512            })?;
513        cfg.interceptor_state()
514            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
515        ::std::result::Result::Ok(())
516    }
517}
518
519// The get_* functions below are generated from JMESPath expressions in the
520// operationContextParams trait. They target the operation's input shape.
521
522/// Error type for the `GetSecretValueError` operation.
523#[non_exhaustive]
524#[derive(::std::fmt::Debug)]
525pub enum GetSecretValueError {
526    /// <p>Secrets Manager can't decrypt the protected secret text using the provided KMS key.</p>
527    DecryptionFailure(crate::types::error::DecryptionFailure),
528    /// <p>An error occurred on the server side.</p>
529    InternalServiceError(crate::types::error::InternalServiceError),
530    /// <p>The parameter name or value is invalid.</p>
531    InvalidParameterException(crate::types::error::InvalidParameterException),
532    /// <p>A parameter value is not valid for the current state of the resource.</p>
533    /// <p>Possible causes:</p>
534    /// <ul>
535    /// <li>
536    /// <p>The secret is scheduled for deletion.</p></li>
537    /// <li>
538    /// <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>
539    /// <li>
540    /// <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>
541    /// </ul>
542    InvalidRequestException(crate::types::error::InvalidRequestException),
543    /// <p>Secrets Manager can't find the resource that you asked for.</p>
544    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
545    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
546    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
547    variable wildcard pattern and check `.code()`:
548     \
549    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
550     \
551    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSecretValueError) for what information is available for the error.")]
552    Unhandled(crate::error::sealed_unhandled::Unhandled),
553}
554impl GetSecretValueError {
555    /// Creates the `GetSecretValueError::Unhandled` variant from any error type.
556    pub fn unhandled(
557        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
558    ) -> Self {
559        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
560            source: err.into(),
561            meta: ::std::default::Default::default(),
562        })
563    }
564
565    /// Creates the `GetSecretValueError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
566    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
567        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
568            source: err.clone().into(),
569            meta: err,
570        })
571    }
572    ///
573    /// Returns error metadata, which includes the error code, message,
574    /// request ID, and potentially additional information.
575    ///
576    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
577        match self {
578            Self::DecryptionFailure(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
579            Self::InternalServiceError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
580            Self::InvalidParameterException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
581            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
582            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
583            Self::Unhandled(e) => &e.meta,
584        }
585    }
586    /// Returns `true` if the error kind is `GetSecretValueError::DecryptionFailure`.
587    pub fn is_decryption_failure(&self) -> bool {
588        matches!(self, Self::DecryptionFailure(_))
589    }
590    /// Returns `true` if the error kind is `GetSecretValueError::InternalServiceError`.
591    pub fn is_internal_service_error(&self) -> bool {
592        matches!(self, Self::InternalServiceError(_))
593    }
594    /// Returns `true` if the error kind is `GetSecretValueError::InvalidParameterException`.
595    pub fn is_invalid_parameter_exception(&self) -> bool {
596        matches!(self, Self::InvalidParameterException(_))
597    }
598    /// Returns `true` if the error kind is `GetSecretValueError::InvalidRequestException`.
599    pub fn is_invalid_request_exception(&self) -> bool {
600        matches!(self, Self::InvalidRequestException(_))
601    }
602    /// Returns `true` if the error kind is `GetSecretValueError::ResourceNotFoundException`.
603    pub fn is_resource_not_found_exception(&self) -> bool {
604        matches!(self, Self::ResourceNotFoundException(_))
605    }
606}
607impl ::std::error::Error for GetSecretValueError {
608    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
609        match self {
610            Self::DecryptionFailure(_inner) => ::std::option::Option::Some(_inner),
611            Self::InternalServiceError(_inner) => ::std::option::Option::Some(_inner),
612            Self::InvalidParameterException(_inner) => ::std::option::Option::Some(_inner),
613            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
614            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
615            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
616        }
617    }
618}
619impl ::std::fmt::Display for GetSecretValueError {
620    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
621        match self {
622            Self::DecryptionFailure(_inner) => _inner.fmt(f),
623            Self::InternalServiceError(_inner) => _inner.fmt(f),
624            Self::InvalidParameterException(_inner) => _inner.fmt(f),
625            Self::InvalidRequestException(_inner) => _inner.fmt(f),
626            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
627            Self::Unhandled(_inner) => {
628                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
629                    write!(f, "unhandled error ({code})")
630                } else {
631                    f.write_str("unhandled error")
632                }
633            }
634        }
635    }
636}
637impl ::aws_smithy_types::retry::ProvideErrorKind for GetSecretValueError {
638    fn code(&self) -> ::std::option::Option<&str> {
639        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
640    }
641    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
642        ::std::option::Option::None
643    }
644}
645impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSecretValueError {
646    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
647        match self {
648            Self::DecryptionFailure(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
649            Self::InternalServiceError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
650            Self::InvalidParameterException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
651            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
652            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
653            Self::Unhandled(_inner) => &_inner.meta,
654        }
655    }
656}
657impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSecretValueError {
658    fn create_unhandled_error(
659        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
660        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
661    ) -> Self {
662        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
663            source,
664            meta: meta.unwrap_or_default(),
665        })
666    }
667}
668impl ::aws_types::request_id::RequestId for crate::operation::get_secret_value::GetSecretValueError {
669    fn request_id(&self) -> Option<&str> {
670        self.meta().request_id()
671    }
672}
673
674pub use crate::operation::get_secret_value::_get_secret_value_input::GetSecretValueInput;
675
676pub use crate::operation::get_secret_value::_get_secret_value_output::GetSecretValueOutput;
677
678mod _get_secret_value_input;
679
680mod _get_secret_value_output;
681
682/// Builders
683pub mod builders;