Skip to main content

aws_sdk_secretsmanager/operation/
put_secret_value.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `PutSecretValue`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct PutSecretValue;
6impl PutSecretValue {
7    /// Creates a new `PutSecretValue`
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::put_secret_value::PutSecretValueInput::SCHEMA;
13    /// The schema for this operation's output shape.
14    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::put_secret_value::PutSecretValueOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17        input: crate::operation::put_secret_value::PutSecretValueInput,
18    ) -> ::std::result::Result<
19        crate::operation::put_secret_value::PutSecretValueOutput,
20        ::aws_smithy_runtime_api::client::result::SdkError<
21            crate::operation::put_secret_value::PutSecretValueError,
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::put_secret_value::PutSecretValueError>()
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::put_secret_value::PutSecretValueOutput>()
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::put_secret_value::PutSecretValueInput,
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", "PutSecretValue", 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.PutSecretValue",
63                "rpc.service" = "Secrets Manager",
64                "rpc.method" = "PutSecretValue",
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::put_secret_value::PutSecretValueInput = 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::DecryptionFailure::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::DecryptionFailure::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::DecryptionFailure::deserialize(d)?))
116                        },
117                    )
118.insert_error_shape(
119                        crate::types::error::EncryptionFailure::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::EncryptionFailure::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::EncryptionFailure::deserialize(d)?))
125                        },
126                    )
127.insert_error_shape(
128                        crate::types::error::InternalServiceError::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::InternalServiceError::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::InternalServiceError::deserialize(d)?))
134                        },
135                    )
136.insert_error_shape(
137                        crate::types::error::InvalidParameterException::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::InvalidParameterException::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::InvalidParameterException::deserialize(d)?))
143                        },
144                    )
145.insert_error_shape(
146                        crate::types::error::InvalidRequestException::SCHEMA,
147                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
148                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestException::deserialize(d)?))
149                        },
150                        |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> {
151                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestException::deserialize(d)?))
152                        },
153                    )
154.insert_error_shape(
155                        crate::types::error::LimitExceededException::SCHEMA,
156                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
157                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::LimitExceededException::deserialize(d)?))
158                        },
159                        |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> {
160                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::LimitExceededException::deserialize(d)?))
161                        },
162                    )
163.insert_error_shape(
164                        crate::types::error::ResourceExistsException::SCHEMA,
165                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
166                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceExistsException::deserialize(d)?))
167                        },
168                        |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> {
169                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceExistsException::deserialize(d)?))
170                        },
171                    )
172.insert_error_shape(
173                        crate::types::error::ResourceNotFoundException::SCHEMA,
174                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
175                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
176                        },
177                        |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> {
178                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
179                        },
180                    )
181                            .build()
182    });
183}
184impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for PutSecretValue {
185    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
186        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("PutSecretValue");
187
188        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
189            PutSecretValueRequestSerializer,
190        ));
191        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
192            PutSecretValueResponseDeserializer,
193        ));
194
195        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
196            crate::config::auth::Params::builder()
197                .operation_name("PutSecretValue")
198                .build()
199                .expect("required fields set"),
200        ));
201
202        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
203            "PutSecretValue",
204            "Secrets Manager",
205        ));
206        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
207        signing_options.double_uri_encode = true;
208        signing_options.content_sha256_header = false;
209        signing_options.normalize_uri_path = true;
210        signing_options.payload_override = None;
211
212        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
213            signing_options,
214            ..::std::default::Default::default()
215        });
216
217        ::std::option::Option::Some(cfg.freeze())
218    }
219
220    fn runtime_components(
221        &self,
222        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
223    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
224        #[allow(unused_mut)]
225        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("PutSecretValue")
226            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
227                PutSecretValueTelemetryInputCaptureInterceptor,
228            ))
229            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
230                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
231            ))
232            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
233                PutSecretValueEndpointParamsInterceptor,
234            ))
235            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
236                crate::operation::put_secret_value::PutSecretValueError,
237            >::new())
238            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
239                crate::operation::put_secret_value::PutSecretValueError,
240            >::new())
241            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
242                crate::operation::put_secret_value::PutSecretValueError,
243            >::new())
244            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
245                crate::operation::put_secret_value::PutSecretValueError,
246            >::new());
247
248        ::std::borrow::Cow::Owned(rcb)
249    }
250}
251
252#[derive(Debug)]
253struct PutSecretValueTelemetryInputCaptureInterceptor;
254
255#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
256impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutSecretValueTelemetryInputCaptureInterceptor {
257    fn name(&self) -> &'static str {
258        "PutSecretValueTelemetryInputCaptureInterceptor"
259    }
260
261    fn read_before_execution(
262        &self,
263        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
264            '_,
265            ::aws_smithy_runtime_api::client::interceptors::context::Input,
266            ::aws_smithy_runtime_api::client::interceptors::context::Output,
267            ::aws_smithy_runtime_api::client::interceptors::context::Error,
268        >,
269        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
270    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
271        // Nothing to do unless the customer opted in by naming members to record.
272        let ::std::option::Option::Some(requested) = cfg
273            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
274            .filter(|r| !r.is_empty())
275        else {
276            return ::std::result::Result::Ok(());
277        };
278
279        let ::std::option::Option::Some(input) = context.input().downcast_ref::<PutSecretValueInput>() else {
280            // A mismatched input is not this interceptor's concern; skip quietly.
281            return ::std::result::Result::Ok(());
282        };
283
284        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
285        if requested.should_capture("SecretId") {
286            if let ::std::option::Option::Some(value) = input.secret_id.as_deref() {
287                captured.insert("SecretId", value);
288            }
289        }
290        if requested.should_capture("ClientRequestToken") {
291            if let ::std::option::Option::Some(value) = input.client_request_token.as_deref() {
292                captured.insert("ClientRequestToken", value);
293            }
294        }
295
296        cfg.interceptor_state().store_put(captured);
297        ::std::result::Result::Ok(())
298    }
299}
300#[derive(Debug)]
301struct PutSecretValueResponseDeserializer;
302impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutSecretValueResponseDeserializer {
303    fn deserialize_nonstreaming_with_config(
304        &self,
305        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
306        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
307    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
308        let (success, status) = (response.status().is_success(), response.status().as_u16());
309        // Load body and headers BEFORE BeforeParseResponse so customizations
310        // (e.g., S3's `body_is_error` check that detects errors returned with
311        // HTTP 200) can inspect them. The legacy non-streaming path also
312        // loads `body` before firing this hook.
313        #[allow(unused_variables)]
314        let body = response.body().bytes().expect("body loaded");
315        let headers = response.headers();
316        #[allow(unused_mut)]
317        let mut force_error = false;
318        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
319        if !success && status != 200 || force_error {
320            let protocol = _cfg
321                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
322                .expect("a SharedClientProtocol is required");
323            #[allow(unused_mut)]
324            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
325                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
326            })?;
327            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
328            let generic = generic_builder.build();
329            let error_code = match generic.code() {
330                ::std::option::Option::Some(code) => code,
331                ::std::option::Option::None => {
332                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
333                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::put_secret_value::PutSecretValueError::unhandled(
334                            generic,
335                        )),
336                    ))
337                }
338            };
339            let _error_message = generic.message().map(|msg| msg.to_owned());
340            let err = match error_code {
341                "DecryptionFailure" => crate::operation::put_secret_value::PutSecretValueError::DecryptionFailure({
342                    let mut deser = protocol.deserialize_error_response(response, _cfg).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                    let mut tmp = <crate::types::error::builders::DecryptionFailureBuilder>::default();
348                    tmp.deserialize_members(&mut *deser).map_err(|e| {
349                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
350                            e,
351                        ))
352                    })?;
353                    if tmp.message.is_none() {
354                        tmp.message = _error_message;
355                    }
356                    let tmp = tmp.meta(generic);
357                    tmp.build()
358                }),
359                "EncryptionFailure" => crate::operation::put_secret_value::PutSecretValueError::EncryptionFailure({
360                    let mut deser = protocol.deserialize_error_response(response, _cfg).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                    let mut tmp = <crate::types::error::builders::EncryptionFailureBuilder>::default();
366                    tmp.deserialize_members(&mut *deser).map_err(|e| {
367                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
368                            e,
369                        ))
370                    })?;
371                    if tmp.message.is_none() {
372                        tmp.message = _error_message;
373                    }
374                    let tmp = tmp.meta(generic);
375                    tmp.build()
376                }),
377                "InternalServiceError" => crate::operation::put_secret_value::PutSecretValueError::InternalServiceError({
378                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
379                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
380                            e,
381                        ))
382                    })?;
383                    let mut tmp = <crate::types::error::builders::InternalServiceErrorBuilder>::default();
384                    tmp.deserialize_members(&mut *deser).map_err(|e| {
385                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
386                            e,
387                        ))
388                    })?;
389                    if tmp.message.is_none() {
390                        tmp.message = _error_message;
391                    }
392                    let tmp = tmp.meta(generic);
393                    tmp.build()
394                }),
395                "InvalidParameterException" => crate::operation::put_secret_value::PutSecretValueError::InvalidParameterException({
396                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
397                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
398                            e,
399                        ))
400                    })?;
401                    let mut tmp = <crate::types::error::builders::InvalidParameterExceptionBuilder>::default();
402                    tmp.deserialize_members(&mut *deser).map_err(|e| {
403                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
404                            e,
405                        ))
406                    })?;
407                    if tmp.message.is_none() {
408                        tmp.message = _error_message;
409                    }
410                    let tmp = tmp.meta(generic);
411                    tmp.build()
412                }),
413                "InvalidRequestException" => crate::operation::put_secret_value::PutSecretValueError::InvalidRequestException({
414                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
415                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
416                            e,
417                        ))
418                    })?;
419                    let mut tmp = <crate::types::error::builders::InvalidRequestExceptionBuilder>::default();
420                    tmp.deserialize_members(&mut *deser).map_err(|e| {
421                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
422                            e,
423                        ))
424                    })?;
425                    if tmp.message.is_none() {
426                        tmp.message = _error_message;
427                    }
428                    let tmp = tmp.meta(generic);
429                    tmp.build()
430                }),
431                "LimitExceededException" => crate::operation::put_secret_value::PutSecretValueError::LimitExceededException({
432                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
433                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
434                            e,
435                        ))
436                    })?;
437                    let mut tmp = <crate::types::error::builders::LimitExceededExceptionBuilder>::default();
438                    tmp.deserialize_members(&mut *deser).map_err(|e| {
439                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
440                            e,
441                        ))
442                    })?;
443                    if tmp.message.is_none() {
444                        tmp.message = _error_message;
445                    }
446                    let tmp = tmp.meta(generic);
447                    tmp.build()
448                }),
449                "ResourceExistsException" => crate::operation::put_secret_value::PutSecretValueError::ResourceExistsException({
450                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
451                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
452                            e,
453                        ))
454                    })?;
455                    let mut tmp = <crate::types::error::builders::ResourceExistsExceptionBuilder>::default();
456                    tmp.deserialize_members(&mut *deser).map_err(|e| {
457                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
458                            e,
459                        ))
460                    })?;
461                    if tmp.message.is_none() {
462                        tmp.message = _error_message;
463                    }
464                    let tmp = tmp.meta(generic);
465                    tmp.build()
466                }),
467                "ResourceNotFoundException" => crate::operation::put_secret_value::PutSecretValueError::ResourceNotFoundException({
468                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
469                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
470                            e,
471                        ))
472                    })?;
473                    let mut tmp = <crate::types::error::builders::ResourceNotFoundExceptionBuilder>::default();
474                    tmp.deserialize_members(&mut *deser).map_err(|e| {
475                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
476                            e,
477                        ))
478                    })?;
479                    if tmp.message.is_none() {
480                        tmp.message = _error_message;
481                    }
482                    let tmp = tmp.meta(generic);
483                    tmp.build()
484                }),
485                _ => {
486                    // Registry-backed, operation-scoped reification of an error whose
487                    // code this operation does not model directly: the operation's own
488                    // error registry is consulted first, then the lookup widens to the
489                    // service-wide error registry. On a hit, the reified error is attached
490                    // as the source of the returned unhandled error while its metadata
491                    // (code, message, request id) is preserved; on a miss the generic
492                    // error is returned unchanged.
493                    match protocol
494                        .deserialize_error_response(response, _cfg)
495                        .ok()
496                        .and_then(|mut deser| {
497                            ::aws_smithy_schema::registry::reify_error(
498                                crate::operation::put_secret_value::error_registry::REGISTRY
499                                    .or(&crate::error_type_registry::REGISTRY),
500                                error_code,
501                                &mut *deser,
502                            )
503                        }) {
504                        ::std::option::Option::Some(source) => <crate::operation::put_secret_value::PutSecretValueError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
505                        ::std::option::Option::None => crate::operation::put_secret_value::PutSecretValueError::generic(generic),
506                    }
507                }
508            };
509            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
510                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
511            ))
512        } else {
513            let protocol = _cfg
514                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
515                .expect("a SharedClientProtocol is required");
516            let mut deser = protocol
517                .deserialize_response(response, PutSecretValue::OUTPUT_SCHEMA, _cfg)
518                .map_err(|e| {
519                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
520                })?;
521            // `headers` is already in scope from the top of the function; alias it as
522            // `_response_headers` so MutateOutput customizations have a stable name to
523            // read from.
524            let _response_headers = headers;
525            // `mut` is required because `deserialize_members` and the `MutateOutput`
526            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
527            // empty output has no members and no customizations to run.
528            #[allow(unused_mut)]
529            let mut output = <crate::operation::put_secret_value::builders::PutSecretValueOutputBuilder>::default();
530            output.deserialize_members(&mut *deser).map_err(|e| {
531                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
532            })?;
533            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
534            let output = output.build();
535            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
536        }
537    }
538}
539#[derive(Debug)]
540struct PutSecretValueRequestSerializer;
541impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutSecretValueRequestSerializer {
542    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
543    fn serialize_input(
544        &self,
545        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
546        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
547    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
548        let input = input
549            .downcast::<crate::operation::put_secret_value::PutSecretValueInput>()
550            .expect("correct type");
551
552        let protocol = _cfg
553            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
554            .expect("a SharedClientProtocol is required");
555        let mut request = protocol
556            .serialize_request(&input, PutSecretValue::INPUT_SCHEMA, "/", _cfg)
557            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
558
559        return ::std::result::Result::Ok(request);
560    }
561}
562#[derive(Debug)]
563struct PutSecretValueEndpointParamsInterceptor;
564
565#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
566impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutSecretValueEndpointParamsInterceptor {
567    fn name(&self) -> &'static str {
568        "PutSecretValueEndpointParamsInterceptor"
569    }
570
571    fn read_before_execution(
572        &self,
573        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
574            '_,
575            ::aws_smithy_runtime_api::client::interceptors::context::Input,
576            ::aws_smithy_runtime_api::client::interceptors::context::Output,
577            ::aws_smithy_runtime_api::client::interceptors::context::Error,
578        >,
579        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
580    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
581        let _input = context
582            .input()
583            .downcast_ref::<PutSecretValueInput>()
584            .ok_or("failed to downcast to PutSecretValueInput")?;
585
586        let params = crate::config::endpoint::Params::builder()
587            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
588            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
589            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
590            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
591            .build()
592            .map_err(|err| {
593                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
594            })?;
595        cfg.interceptor_state()
596            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
597        ::std::result::Result::Ok(())
598    }
599}
600
601// The get_* functions below are generated from JMESPath expressions in the
602// operationContextParams trait. They target the operation's input shape.
603
604/// Error type for the `PutSecretValueError` operation.
605#[non_exhaustive]
606#[derive(::std::fmt::Debug)]
607pub enum PutSecretValueError {
608    /// <p>Secrets Manager can't decrypt the protected secret text using the provided KMS key.</p>
609    DecryptionFailure(crate::types::error::DecryptionFailure),
610    /// <p>Secrets Manager can't encrypt the protected secret text using the provided KMS key. Check that the KMS key is available, enabled, and not in an invalid state. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">Key state: Effect on your KMS key</a>.</p>
611    EncryptionFailure(crate::types::error::EncryptionFailure),
612    /// <p>An error occurred on the server side.</p>
613    InternalServiceError(crate::types::error::InternalServiceError),
614    /// <p>The parameter name or value is invalid.</p>
615    InvalidParameterException(crate::types::error::InvalidParameterException),
616    /// <p>A parameter value is not valid for the current state of the resource.</p>
617    /// <p>Possible causes:</p>
618    /// <ul>
619    /// <li>
620    /// <p>The secret is scheduled for deletion.</p></li>
621    /// <li>
622    /// <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>
623    /// <li>
624    /// <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>
625    /// </ul>
626    InvalidRequestException(crate::types::error::InvalidRequestException),
627    /// <p>The request failed because it would exceed one of the Secrets Manager quotas.</p>
628    LimitExceededException(crate::types::error::LimitExceededException),
629    /// <p>A resource with the ID you requested already exists.</p>
630    ResourceExistsException(crate::types::error::ResourceExistsException),
631    /// <p>Secrets Manager can't find the resource that you asked for.</p>
632    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
633    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
634    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
635    variable wildcard pattern and check `.code()`:
636     \
637    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
638     \
639    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PutSecretValueError) for what information is available for the error.")]
640    Unhandled(crate::error::sealed_unhandled::Unhandled),
641}
642impl PutSecretValueError {
643    /// Creates the `PutSecretValueError::Unhandled` variant from any error type.
644    pub fn unhandled(
645        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
646    ) -> Self {
647        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
648            source: err.into(),
649            meta: ::std::default::Default::default(),
650        })
651    }
652
653    /// Creates the `PutSecretValueError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
654    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
655        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
656            source: err.clone().into(),
657            meta: err,
658        })
659    }
660    ///
661    /// Returns error metadata, which includes the error code, message,
662    /// request ID, and potentially additional information.
663    ///
664    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
665        match self {
666            Self::DecryptionFailure(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
667            Self::EncryptionFailure(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
668            Self::InternalServiceError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
669            Self::InvalidParameterException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
670            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
671            Self::LimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
672            Self::ResourceExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
673            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
674            Self::Unhandled(e) => &e.meta,
675        }
676    }
677    /// Returns `true` if the error kind is `PutSecretValueError::DecryptionFailure`.
678    pub fn is_decryption_failure(&self) -> bool {
679        matches!(self, Self::DecryptionFailure(_))
680    }
681    /// Returns `true` if the error kind is `PutSecretValueError::EncryptionFailure`.
682    pub fn is_encryption_failure(&self) -> bool {
683        matches!(self, Self::EncryptionFailure(_))
684    }
685    /// Returns `true` if the error kind is `PutSecretValueError::InternalServiceError`.
686    pub fn is_internal_service_error(&self) -> bool {
687        matches!(self, Self::InternalServiceError(_))
688    }
689    /// Returns `true` if the error kind is `PutSecretValueError::InvalidParameterException`.
690    pub fn is_invalid_parameter_exception(&self) -> bool {
691        matches!(self, Self::InvalidParameterException(_))
692    }
693    /// Returns `true` if the error kind is `PutSecretValueError::InvalidRequestException`.
694    pub fn is_invalid_request_exception(&self) -> bool {
695        matches!(self, Self::InvalidRequestException(_))
696    }
697    /// Returns `true` if the error kind is `PutSecretValueError::LimitExceededException`.
698    pub fn is_limit_exceeded_exception(&self) -> bool {
699        matches!(self, Self::LimitExceededException(_))
700    }
701    /// Returns `true` if the error kind is `PutSecretValueError::ResourceExistsException`.
702    pub fn is_resource_exists_exception(&self) -> bool {
703        matches!(self, Self::ResourceExistsException(_))
704    }
705    /// Returns `true` if the error kind is `PutSecretValueError::ResourceNotFoundException`.
706    pub fn is_resource_not_found_exception(&self) -> bool {
707        matches!(self, Self::ResourceNotFoundException(_))
708    }
709}
710impl ::std::error::Error for PutSecretValueError {
711    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
712        match self {
713            Self::DecryptionFailure(_inner) => ::std::option::Option::Some(_inner),
714            Self::EncryptionFailure(_inner) => ::std::option::Option::Some(_inner),
715            Self::InternalServiceError(_inner) => ::std::option::Option::Some(_inner),
716            Self::InvalidParameterException(_inner) => ::std::option::Option::Some(_inner),
717            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
718            Self::LimitExceededException(_inner) => ::std::option::Option::Some(_inner),
719            Self::ResourceExistsException(_inner) => ::std::option::Option::Some(_inner),
720            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
721            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
722        }
723    }
724}
725impl ::std::fmt::Display for PutSecretValueError {
726    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
727        match self {
728            Self::DecryptionFailure(_inner) => _inner.fmt(f),
729            Self::EncryptionFailure(_inner) => _inner.fmt(f),
730            Self::InternalServiceError(_inner) => _inner.fmt(f),
731            Self::InvalidParameterException(_inner) => _inner.fmt(f),
732            Self::InvalidRequestException(_inner) => _inner.fmt(f),
733            Self::LimitExceededException(_inner) => _inner.fmt(f),
734            Self::ResourceExistsException(_inner) => _inner.fmt(f),
735            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
736            Self::Unhandled(_inner) => {
737                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
738                    write!(f, "unhandled error ({code})")
739                } else {
740                    f.write_str("unhandled error")
741                }
742            }
743        }
744    }
745}
746impl ::aws_smithy_types::retry::ProvideErrorKind for PutSecretValueError {
747    fn code(&self) -> ::std::option::Option<&str> {
748        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
749    }
750    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
751        ::std::option::Option::None
752    }
753}
754impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PutSecretValueError {
755    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
756        match self {
757            Self::DecryptionFailure(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
758            Self::EncryptionFailure(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
759            Self::InternalServiceError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
760            Self::InvalidParameterException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
761            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
762            Self::LimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
763            Self::ResourceExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
764            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
765            Self::Unhandled(_inner) => &_inner.meta,
766        }
767    }
768}
769impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PutSecretValueError {
770    fn create_unhandled_error(
771        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
772        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
773    ) -> Self {
774        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
775            source,
776            meta: meta.unwrap_or_default(),
777        })
778    }
779}
780impl ::aws_types::request_id::RequestId for crate::operation::put_secret_value::PutSecretValueError {
781    fn request_id(&self) -> Option<&str> {
782        self.meta().request_id()
783    }
784}
785
786pub use crate::operation::put_secret_value::_put_secret_value_input::PutSecretValueInput;
787
788pub use crate::operation::put_secret_value::_put_secret_value_output::PutSecretValueOutput;
789
790mod _put_secret_value_input;
791
792mod _put_secret_value_output;
793
794/// Builders
795pub mod builders;