1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateSecret;
6impl CreateSecret {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_secret::CreateSecretInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_secret::CreateSecretOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::create_secret::CreateSecretInput,
18 ) -> ::std::result::Result<
19 crate::operation::create_secret::CreateSecretOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::create_secret::CreateSecretError,
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::create_secret::CreateSecretError>()
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::create_secret::CreateSecretOutput>()
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::create_secret::CreateSecretInput,
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", "CreateSecret", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "Secrets Manager.CreateSecret",
63 "rpc.service" = "Secrets Manager",
64 "rpc.method" = "CreateSecret",
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::create_secret::CreateSecretInput = 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}
98pub(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::MalformedPolicyDocumentException::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::MalformedPolicyDocumentException::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::MalformedPolicyDocumentException::deserialize(d)?))
170 },
171 )
172.insert_error_shape(
173 crate::types::error::PreconditionNotMetException::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::PreconditionNotMetException::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::PreconditionNotMetException::deserialize(d)?))
179 },
180 )
181.insert_error_shape(
182 crate::types::error::ResourceExistsException::SCHEMA,
183 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
184 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceExistsException::deserialize(d)?))
185 },
186 |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> {
187 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceExistsException::deserialize(d)?))
188 },
189 )
190.insert_error_shape(
191 crate::types::error::ResourceNotFoundException::SCHEMA,
192 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
193 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
194 },
195 |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> {
196 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
197 },
198 )
199 .build()
200 });
201}
202impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateSecret {
203 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
204 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateSecret");
205
206 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
207 CreateSecretRequestSerializer,
208 ));
209 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
210 CreateSecretResponseDeserializer,
211 ));
212
213 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
214 crate::config::auth::Params::builder()
215 .operation_name("CreateSecret")
216 .build()
217 .expect("required fields set"),
218 ));
219
220 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
221 "CreateSecret",
222 "Secrets Manager",
223 ));
224 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
225 signing_options.double_uri_encode = true;
226 signing_options.content_sha256_header = false;
227 signing_options.normalize_uri_path = true;
228 signing_options.payload_override = None;
229
230 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
231 signing_options,
232 ..::std::default::Default::default()
233 });
234
235 ::std::option::Option::Some(cfg.freeze())
236 }
237
238 fn runtime_components(
239 &self,
240 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
241 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
242 #[allow(unused_mut)]
243 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateSecret")
244 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
245 CreateSecretTelemetryInputCaptureInterceptor,
246 ))
247 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
248 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
249 ))
250 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
251 CreateSecretEndpointParamsInterceptor,
252 ))
253 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
254 crate::operation::create_secret::CreateSecretError,
255 >::new())
256 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
257 crate::operation::create_secret::CreateSecretError,
258 >::new())
259 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
260 crate::operation::create_secret::CreateSecretError,
261 >::new())
262 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
263 crate::operation::create_secret::CreateSecretError,
264 >::new());
265
266 ::std::borrow::Cow::Owned(rcb)
267 }
268}
269
270#[derive(Debug)]
271struct CreateSecretTelemetryInputCaptureInterceptor;
272
273#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
274impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateSecretTelemetryInputCaptureInterceptor {
275 fn name(&self) -> &'static str {
276 "CreateSecretTelemetryInputCaptureInterceptor"
277 }
278
279 fn read_before_execution(
280 &self,
281 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
282 '_,
283 ::aws_smithy_runtime_api::client::interceptors::context::Input,
284 ::aws_smithy_runtime_api::client::interceptors::context::Output,
285 ::aws_smithy_runtime_api::client::interceptors::context::Error,
286 >,
287 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
288 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
289 let ::std::option::Option::Some(requested) = cfg
291 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
292 .filter(|r| !r.is_empty())
293 else {
294 return ::std::result::Result::Ok(());
295 };
296
297 let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateSecretInput>() else {
298 return ::std::result::Result::Ok(());
300 };
301
302 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
303 if requested.should_capture("Name") {
304 if let ::std::option::Option::Some(value) = input.name.as_deref() {
305 captured.insert("Name", value);
306 }
307 }
308 if requested.should_capture("ClientRequestToken") {
309 if let ::std::option::Option::Some(value) = input.client_request_token.as_deref() {
310 captured.insert("ClientRequestToken", value);
311 }
312 }
313 if requested.should_capture("Description") {
314 if let ::std::option::Option::Some(value) = input.description.as_deref() {
315 captured.insert("Description", value);
316 }
317 }
318 if requested.should_capture("KmsKeyId") {
319 if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
320 captured.insert("KmsKeyId", value);
321 }
322 }
323 if requested.should_capture("Type") {
324 if let ::std::option::Option::Some(value) = input.r#type.as_deref() {
325 captured.insert("Type", value);
326 }
327 }
328 if requested.should_capture("CrossAccountPrimaryARN") {
329 if let ::std::option::Option::Some(value) = input.cross_account_primary_arn.as_deref() {
330 captured.insert("CrossAccountPrimaryARN", value);
331 }
332 }
333
334 cfg.interceptor_state().store_put(captured);
335 ::std::result::Result::Ok(())
336 }
337}
338#[derive(Debug)]
339struct CreateSecretResponseDeserializer;
340impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateSecretResponseDeserializer {
341 fn deserialize_nonstreaming_with_config(
342 &self,
343 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
344 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
345 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
346 let (success, status) = (response.status().is_success(), response.status().as_u16());
347 #[allow(unused_variables)]
352 let body = response.body().bytes().expect("body loaded");
353 let headers = response.headers();
354 #[allow(unused_mut)]
355 let mut force_error = false;
356 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
357 if !success && status != 200 || force_error {
358 let protocol = _cfg
359 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
360 .expect("a SharedClientProtocol is required");
361 #[allow(unused_mut)]
362 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
363 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
364 })?;
365 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
366 let generic = generic_builder.build();
367 let error_code = match generic.code() {
368 ::std::option::Option::Some(code) => code,
369 ::std::option::Option::None => {
370 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
371 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::create_secret::CreateSecretError::unhandled(generic)),
372 ))
373 }
374 };
375 let _error_message = generic.message().map(|msg| msg.to_owned());
376 let err = match error_code {
377 "DecryptionFailure" => crate::operation::create_secret::CreateSecretError::DecryptionFailure({
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::DecryptionFailureBuilder>::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 "EncryptionFailure" => crate::operation::create_secret::CreateSecretError::EncryptionFailure({
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::EncryptionFailureBuilder>::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 "InternalServiceError" => crate::operation::create_secret::CreateSecretError::InternalServiceError({
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::InternalServiceErrorBuilder>::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 "InvalidParameterException" => crate::operation::create_secret::CreateSecretError::InvalidParameterException({
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::InvalidParameterExceptionBuilder>::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 "InvalidRequestException" => crate::operation::create_secret::CreateSecretError::InvalidRequestException({
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::InvalidRequestExceptionBuilder>::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 "LimitExceededException" => crate::operation::create_secret::CreateSecretError::LimitExceededException({
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::LimitExceededExceptionBuilder>::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 "MalformedPolicyDocumentException" => crate::operation::create_secret::CreateSecretError::MalformedPolicyDocumentException({
486 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
487 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
488 e,
489 ))
490 })?;
491 let mut tmp = <crate::types::error::builders::MalformedPolicyDocumentExceptionBuilder>::default();
492 tmp.deserialize_members(&mut *deser).map_err(|e| {
493 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
494 e,
495 ))
496 })?;
497 if tmp.message.is_none() {
498 tmp.message = _error_message;
499 }
500 let tmp = tmp.meta(generic);
501 tmp.build()
502 }),
503 "PreconditionNotMetException" => crate::operation::create_secret::CreateSecretError::PreconditionNotMetException({
504 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
505 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
506 e,
507 ))
508 })?;
509 let mut tmp = <crate::types::error::builders::PreconditionNotMetExceptionBuilder>::default();
510 tmp.deserialize_members(&mut *deser).map_err(|e| {
511 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
512 e,
513 ))
514 })?;
515 if tmp.message.is_none() {
516 tmp.message = _error_message;
517 }
518 let tmp = tmp.meta(generic);
519 tmp.build()
520 }),
521 "ResourceExistsException" => crate::operation::create_secret::CreateSecretError::ResourceExistsException({
522 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
523 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
524 e,
525 ))
526 })?;
527 let mut tmp = <crate::types::error::builders::ResourceExistsExceptionBuilder>::default();
528 tmp.deserialize_members(&mut *deser).map_err(|e| {
529 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
530 e,
531 ))
532 })?;
533 if tmp.message.is_none() {
534 tmp.message = _error_message;
535 }
536 let tmp = tmp.meta(generic);
537 tmp.build()
538 }),
539 "ResourceNotFoundException" => crate::operation::create_secret::CreateSecretError::ResourceNotFoundException({
540 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
541 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
542 e,
543 ))
544 })?;
545 let mut tmp = <crate::types::error::builders::ResourceNotFoundExceptionBuilder>::default();
546 tmp.deserialize_members(&mut *deser).map_err(|e| {
547 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
548 e,
549 ))
550 })?;
551 if tmp.message.is_none() {
552 tmp.message = _error_message;
553 }
554 let tmp = tmp.meta(generic);
555 tmp.build()
556 }),
557 _ => {
558 match protocol
566 .deserialize_error_response(response, _cfg)
567 .ok()
568 .and_then(|mut deser| {
569 ::aws_smithy_schema::registry::reify_error(
570 crate::operation::create_secret::error_registry::REGISTRY
571 .or(&crate::error_type_registry::REGISTRY),
572 error_code,
573 &mut *deser,
574 )
575 }) {
576 ::std::option::Option::Some(source) => <crate::operation::create_secret::CreateSecretError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
577 ::std::option::Option::None => crate::operation::create_secret::CreateSecretError::generic(generic),
578 }
579 }
580 };
581 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
582 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
583 ))
584 } else {
585 let protocol = _cfg
586 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
587 .expect("a SharedClientProtocol is required");
588 let mut deser = protocol.deserialize_response(response, CreateSecret::OUTPUT_SCHEMA, _cfg).map_err(|e| {
589 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
590 })?;
591 let _response_headers = headers;
595 #[allow(unused_mut)]
599 let mut output = <crate::operation::create_secret::builders::CreateSecretOutputBuilder>::default();
600 output.deserialize_members(&mut *deser).map_err(|e| {
601 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
602 })?;
603 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
604 let output = output.build();
605 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
606 }
607 }
608}
609#[derive(Debug)]
610struct CreateSecretRequestSerializer;
611impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateSecretRequestSerializer {
612 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
613 fn serialize_input(
614 &self,
615 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
616 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
617 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
618 let input = input
619 .downcast::<crate::operation::create_secret::CreateSecretInput>()
620 .expect("correct type");
621
622 let protocol = _cfg
623 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
624 .expect("a SharedClientProtocol is required");
625 let mut request = protocol
626 .serialize_request(&input, CreateSecret::INPUT_SCHEMA, "/", _cfg)
627 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
628
629 return ::std::result::Result::Ok(request);
630 }
631}
632#[derive(Debug)]
633struct CreateSecretEndpointParamsInterceptor;
634
635#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
636impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateSecretEndpointParamsInterceptor {
637 fn name(&self) -> &'static str {
638 "CreateSecretEndpointParamsInterceptor"
639 }
640
641 fn read_before_execution(
642 &self,
643 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
644 '_,
645 ::aws_smithy_runtime_api::client::interceptors::context::Input,
646 ::aws_smithy_runtime_api::client::interceptors::context::Output,
647 ::aws_smithy_runtime_api::client::interceptors::context::Error,
648 >,
649 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
650 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
651 let _input = context
652 .input()
653 .downcast_ref::<CreateSecretInput>()
654 .ok_or("failed to downcast to CreateSecretInput")?;
655
656 let params = crate::config::endpoint::Params::builder()
657 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
658 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
659 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
660 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
661 .build()
662 .map_err(|err| {
663 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
664 })?;
665 cfg.interceptor_state()
666 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
667 ::std::result::Result::Ok(())
668 }
669}
670
671#[non_exhaustive]
676#[derive(::std::fmt::Debug)]
677pub enum CreateSecretError {
678 DecryptionFailure(crate::types::error::DecryptionFailure),
680 EncryptionFailure(crate::types::error::EncryptionFailure),
682 InternalServiceError(crate::types::error::InternalServiceError),
684 InvalidParameterException(crate::types::error::InvalidParameterException),
686 InvalidRequestException(crate::types::error::InvalidRequestException),
697 LimitExceededException(crate::types::error::LimitExceededException),
699 MalformedPolicyDocumentException(crate::types::error::MalformedPolicyDocumentException),
701 PreconditionNotMetException(crate::types::error::PreconditionNotMetException),
703 ResourceExistsException(crate::types::error::ResourceExistsException),
705 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
707 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
709 variable wildcard pattern and check `.code()`:
710 \
711 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
712 \
713 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateSecretError) for what information is available for the error.")]
714 Unhandled(crate::error::sealed_unhandled::Unhandled),
715}
716impl CreateSecretError {
717 pub fn unhandled(
719 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
720 ) -> Self {
721 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
722 source: err.into(),
723 meta: ::std::default::Default::default(),
724 })
725 }
726
727 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
729 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
730 source: err.clone().into(),
731 meta: err,
732 })
733 }
734 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
739 match self {
740 Self::DecryptionFailure(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
741 Self::EncryptionFailure(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
742 Self::InternalServiceError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
743 Self::InvalidParameterException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
744 Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
745 Self::LimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
746 Self::MalformedPolicyDocumentException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
747 Self::PreconditionNotMetException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
748 Self::ResourceExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
749 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
750 Self::Unhandled(e) => &e.meta,
751 }
752 }
753 pub fn is_decryption_failure(&self) -> bool {
755 matches!(self, Self::DecryptionFailure(_))
756 }
757 pub fn is_encryption_failure(&self) -> bool {
759 matches!(self, Self::EncryptionFailure(_))
760 }
761 pub fn is_internal_service_error(&self) -> bool {
763 matches!(self, Self::InternalServiceError(_))
764 }
765 pub fn is_invalid_parameter_exception(&self) -> bool {
767 matches!(self, Self::InvalidParameterException(_))
768 }
769 pub fn is_invalid_request_exception(&self) -> bool {
771 matches!(self, Self::InvalidRequestException(_))
772 }
773 pub fn is_limit_exceeded_exception(&self) -> bool {
775 matches!(self, Self::LimitExceededException(_))
776 }
777 pub fn is_malformed_policy_document_exception(&self) -> bool {
779 matches!(self, Self::MalformedPolicyDocumentException(_))
780 }
781 pub fn is_precondition_not_met_exception(&self) -> bool {
783 matches!(self, Self::PreconditionNotMetException(_))
784 }
785 pub fn is_resource_exists_exception(&self) -> bool {
787 matches!(self, Self::ResourceExistsException(_))
788 }
789 pub fn is_resource_not_found_exception(&self) -> bool {
791 matches!(self, Self::ResourceNotFoundException(_))
792 }
793}
794impl ::std::error::Error for CreateSecretError {
795 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
796 match self {
797 Self::DecryptionFailure(_inner) => ::std::option::Option::Some(_inner),
798 Self::EncryptionFailure(_inner) => ::std::option::Option::Some(_inner),
799 Self::InternalServiceError(_inner) => ::std::option::Option::Some(_inner),
800 Self::InvalidParameterException(_inner) => ::std::option::Option::Some(_inner),
801 Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
802 Self::LimitExceededException(_inner) => ::std::option::Option::Some(_inner),
803 Self::MalformedPolicyDocumentException(_inner) => ::std::option::Option::Some(_inner),
804 Self::PreconditionNotMetException(_inner) => ::std::option::Option::Some(_inner),
805 Self::ResourceExistsException(_inner) => ::std::option::Option::Some(_inner),
806 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
807 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
808 }
809 }
810}
811impl ::std::fmt::Display for CreateSecretError {
812 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
813 match self {
814 Self::DecryptionFailure(_inner) => _inner.fmt(f),
815 Self::EncryptionFailure(_inner) => _inner.fmt(f),
816 Self::InternalServiceError(_inner) => _inner.fmt(f),
817 Self::InvalidParameterException(_inner) => _inner.fmt(f),
818 Self::InvalidRequestException(_inner) => _inner.fmt(f),
819 Self::LimitExceededException(_inner) => _inner.fmt(f),
820 Self::MalformedPolicyDocumentException(_inner) => _inner.fmt(f),
821 Self::PreconditionNotMetException(_inner) => _inner.fmt(f),
822 Self::ResourceExistsException(_inner) => _inner.fmt(f),
823 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
824 Self::Unhandled(_inner) => {
825 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
826 write!(f, "unhandled error ({code})")
827 } else {
828 f.write_str("unhandled error")
829 }
830 }
831 }
832 }
833}
834impl ::aws_smithy_types::retry::ProvideErrorKind for CreateSecretError {
835 fn code(&self) -> ::std::option::Option<&str> {
836 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
837 }
838 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
839 ::std::option::Option::None
840 }
841}
842impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateSecretError {
843 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
844 match self {
845 Self::DecryptionFailure(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
846 Self::EncryptionFailure(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
847 Self::InternalServiceError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
848 Self::InvalidParameterException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
849 Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
850 Self::LimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
851 Self::MalformedPolicyDocumentException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
852 Self::PreconditionNotMetException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
853 Self::ResourceExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
854 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
855 Self::Unhandled(_inner) => &_inner.meta,
856 }
857 }
858}
859impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateSecretError {
860 fn create_unhandled_error(
861 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
862 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
863 ) -> Self {
864 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
865 source,
866 meta: meta.unwrap_or_default(),
867 })
868 }
869}
870impl ::aws_types::request_id::RequestId for crate::operation::create_secret::CreateSecretError {
871 fn request_id(&self) -> Option<&str> {
872 self.meta().request_id()
873 }
874}
875
876pub use crate::operation::create_secret::_create_secret_input::CreateSecretInput;
877
878pub use crate::operation::create_secret::_create_secret_output::CreateSecretOutput;
879
880mod _create_secret_input;
881
882mod _create_secret_output;
883
884pub mod builders;