1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct RotateKeyOnDemand;
6impl RotateKeyOnDemand {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::rotate_key_on_demand::RotateKeyOnDemandInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::rotate_key_on_demand::RotateKeyOnDemandOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::rotate_key_on_demand::RotateKeyOnDemandInput,
18 ) -> ::std::result::Result<
19 crate::operation::rotate_key_on_demand::RotateKeyOnDemandOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::rotate_key_on_demand::RotateKeyOnDemandError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::rotate_key_on_demand::RotateKeyOnDemandOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::rotate_key_on_demand::RotateKeyOnDemandInput,
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("KMS", "RotateKeyOnDemand", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "KMS.RotateKeyOnDemand",
63 "rpc.service" = "KMS",
64 "rpc.method" = "RotateKeyOnDemand",
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}
91pub(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::ConflictException::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::ConflictException::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::ConflictException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::DependencyTimeoutException::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::DependencyTimeoutException::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::DependencyTimeoutException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::DisabledException::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::DisabledException::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::DisabledException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::InvalidArnException::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::InvalidArnException::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::InvalidArnException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::KmsInternalException::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::KmsInternalException::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::KmsInternalException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::KmsInvalidStateException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
151 },
152 |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> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::LimitExceededException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::LimitExceededException::deserialize(d)?))
160 },
161 |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> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::LimitExceededException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::NotFoundException::SCHEMA,
167 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
168 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
169 },
170 |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> {
171 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::UnsupportedOperationException::SCHEMA,
176 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
177 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
178 },
179 |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> {
180 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
181 },
182 )
183 .build()
184 });
185}
186impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for RotateKeyOnDemand {
187 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
188 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("RotateKeyOnDemand");
189
190 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
191 RotateKeyOnDemandRequestSerializer,
192 ));
193 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
194 RotateKeyOnDemandResponseDeserializer,
195 ));
196
197 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
198 crate::config::auth::Params::builder()
199 .operation_name("RotateKeyOnDemand")
200 .build()
201 .expect("required fields set"),
202 ));
203
204 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("RotateKeyOnDemand", "KMS"));
205 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
206 signing_options.double_uri_encode = true;
207 signing_options.content_sha256_header = false;
208 signing_options.normalize_uri_path = true;
209 signing_options.payload_override = None;
210
211 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
212 signing_options,
213 ..::std::default::Default::default()
214 });
215
216 ::std::option::Option::Some(cfg.freeze())
217 }
218
219 fn runtime_components(
220 &self,
221 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
222 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
223 #[allow(unused_mut)]
224 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("RotateKeyOnDemand")
225 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
226 RotateKeyOnDemandTelemetryInputCaptureInterceptor,
227 ))
228 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
229 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
230 ))
231 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
232 RotateKeyOnDemandEndpointParamsInterceptor,
233 ))
234 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
235 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError,
236 >::new())
237 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
238 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError,
239 >::new())
240 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
241 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError,
242 >::new())
243 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
244 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError,
245 >::new());
246
247 ::std::borrow::Cow::Owned(rcb)
248 }
249}
250
251#[derive(Debug)]
252struct RotateKeyOnDemandTelemetryInputCaptureInterceptor;
253
254#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
255impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RotateKeyOnDemandTelemetryInputCaptureInterceptor {
256 fn name(&self) -> &'static str {
257 "RotateKeyOnDemandTelemetryInputCaptureInterceptor"
258 }
259
260 fn read_before_execution(
261 &self,
262 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
263 '_,
264 ::aws_smithy_runtime_api::client::interceptors::context::Input,
265 ::aws_smithy_runtime_api::client::interceptors::context::Output,
266 ::aws_smithy_runtime_api::client::interceptors::context::Error,
267 >,
268 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
269 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
270 let ::std::option::Option::Some(requested) = cfg
272 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
273 .filter(|r| !r.is_empty())
274 else {
275 return ::std::result::Result::Ok(());
276 };
277
278 let ::std::option::Option::Some(input) = context.input().downcast_ref::<RotateKeyOnDemandInput>() else {
279 return ::std::result::Result::Ok(());
281 };
282
283 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
284 if requested.should_capture("KeyId") {
285 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
286 captured.insert("KeyId", value);
287 }
288 }
289
290 cfg.interceptor_state().store_put(captured);
291 ::std::result::Result::Ok(())
292 }
293}
294#[derive(Debug)]
295struct RotateKeyOnDemandResponseDeserializer;
296impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for RotateKeyOnDemandResponseDeserializer {
297 fn deserialize_nonstreaming_with_config(
298 &self,
299 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
300 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
301 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
302 let (success, status) = (response.status().is_success(), response.status().as_u16());
303 #[allow(unused_variables)]
308 let body = response.body().bytes().expect("body loaded");
309 let headers = response.headers();
310 #[allow(unused_mut)]
311 let mut force_error = false;
312 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
313 if !success && status != 200 || force_error {
314 let protocol = _cfg
315 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
316 .expect("a SharedClientProtocol is required");
317 #[allow(unused_mut)]
318 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
319 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
320 })?;
321 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
322 let generic = generic_builder.build();
323 let error_code = match generic.code() {
324 ::std::option::Option::Some(code) => code,
325 ::std::option::Option::None => {
326 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
327 ::aws_smithy_runtime_api::box_error::BoxError::from(
328 crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::unhandled(generic),
329 ),
330 ))
331 }
332 };
333 let _error_message = generic.message().map(|msg| msg.to_owned());
334 let err = match error_code {
335 "ConflictException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::ConflictException({
336 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
337 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
338 e,
339 ))
340 })?;
341 let mut tmp = <crate::types::error::builders::ConflictExceptionBuilder>::default();
342 tmp.deserialize_members(&mut *deser).map_err(|e| {
343 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
344 e,
345 ))
346 })?;
347 if tmp.message.is_none() {
348 tmp.message = _error_message;
349 }
350 let tmp = tmp.meta(generic);
351 tmp.build()
352 }),
353 "DependencyTimeoutException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::DependencyTimeoutException({
354 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
355 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
356 e,
357 ))
358 })?;
359 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
360 tmp.deserialize_members(&mut *deser).map_err(|e| {
361 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
362 e,
363 ))
364 })?;
365 if tmp.message.is_none() {
366 tmp.message = _error_message;
367 }
368 let tmp = tmp.meta(generic);
369 tmp.build()
370 }),
371 "DisabledException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::DisabledException({
372 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
373 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
374 e,
375 ))
376 })?;
377 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
378 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
384 tmp.message = _error_message;
385 }
386 let tmp = tmp.meta(generic);
387 tmp.build()
388 }),
389 "InvalidArnException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::InvalidArnException({
390 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
391 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
392 e,
393 ))
394 })?;
395 let mut tmp = <crate::types::error::builders::InvalidArnExceptionBuilder>::default();
396 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
402 tmp.message = _error_message;
403 }
404 let tmp = tmp.meta(generic);
405 tmp.build()
406 }),
407 "KMSInternalException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::KmsInternalException({
408 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
409 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
410 e,
411 ))
412 })?;
413 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
414 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
420 tmp.message = _error_message;
421 }
422 let tmp = tmp.meta(generic);
423 tmp.build()
424 }),
425 "KMSInvalidStateException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::KmsInvalidStateException({
426 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
427 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
428 e,
429 ))
430 })?;
431 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
432 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
438 tmp.message = _error_message;
439 }
440 let tmp = tmp.meta(generic);
441 tmp.build()
442 }),
443 "LimitExceededException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::LimitExceededException({
444 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
445 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
446 e,
447 ))
448 })?;
449 let mut tmp = <crate::types::error::builders::LimitExceededExceptionBuilder>::default();
450 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
456 tmp.message = _error_message;
457 }
458 let tmp = tmp.meta(generic);
459 tmp.build()
460 }),
461 "NotFoundException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::NotFoundException({
462 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
463 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
464 e,
465 ))
466 })?;
467 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
468 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
474 tmp.message = _error_message;
475 }
476 let tmp = tmp.meta(generic);
477 tmp.build()
478 }),
479 "UnsupportedOperationException" => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::UnsupportedOperationException({
480 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
481 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
482 e,
483 ))
484 })?;
485 let mut tmp = <crate::types::error::builders::UnsupportedOperationExceptionBuilder>::default();
486 tmp.deserialize_members(&mut *deser).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 if tmp.message.is_none() {
492 tmp.message = _error_message;
493 }
494 let tmp = tmp.meta(generic);
495 tmp.build()
496 }),
497 _ => {
498 match protocol
506 .deserialize_error_response(response, _cfg)
507 .ok()
508 .and_then(|mut deser| {
509 ::aws_smithy_schema::registry::reify_error(
510 crate::operation::rotate_key_on_demand::error_registry::REGISTRY
511 .or(&crate::error_type_registry::REGISTRY),
512 error_code,
513 &mut *deser,
514 )
515 }) {
516 ::std::option::Option::Some(source) => <crate::operation::rotate_key_on_demand::RotateKeyOnDemandError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
517 ::std::option::Option::None => crate::operation::rotate_key_on_demand::RotateKeyOnDemandError::generic(generic),
518 }
519 }
520 };
521 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
522 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
523 ))
524 } else {
525 let protocol = _cfg
526 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
527 .expect("a SharedClientProtocol is required");
528 let mut deser = protocol
529 .deserialize_response(response, RotateKeyOnDemand::OUTPUT_SCHEMA, _cfg)
530 .map_err(|e| {
531 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
532 })?;
533 let _response_headers = headers;
537 #[allow(unused_mut)]
541 let mut output = <crate::operation::rotate_key_on_demand::builders::RotateKeyOnDemandOutputBuilder>::default();
542 output.deserialize_members(&mut *deser).map_err(|e| {
543 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
544 })?;
545 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
546 let output = output.build();
547 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
548 }
549 }
550}
551#[derive(Debug)]
552struct RotateKeyOnDemandRequestSerializer;
553impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for RotateKeyOnDemandRequestSerializer {
554 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
555 fn serialize_input(
556 &self,
557 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
558 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
559 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
560 let input = input
561 .downcast::<crate::operation::rotate_key_on_demand::RotateKeyOnDemandInput>()
562 .expect("correct type");
563
564 let protocol = _cfg
565 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
566 .expect("a SharedClientProtocol is required");
567 let mut request = protocol
568 .serialize_request(&input, RotateKeyOnDemand::INPUT_SCHEMA, "/", _cfg)
569 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
570
571 return ::std::result::Result::Ok(request);
572 }
573}
574#[derive(Debug)]
575struct RotateKeyOnDemandEndpointParamsInterceptor;
576
577#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
578impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RotateKeyOnDemandEndpointParamsInterceptor {
579 fn name(&self) -> &'static str {
580 "RotateKeyOnDemandEndpointParamsInterceptor"
581 }
582
583 fn read_before_execution(
584 &self,
585 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
586 '_,
587 ::aws_smithy_runtime_api::client::interceptors::context::Input,
588 ::aws_smithy_runtime_api::client::interceptors::context::Output,
589 ::aws_smithy_runtime_api::client::interceptors::context::Error,
590 >,
591 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
592 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
593 let _input = context
594 .input()
595 .downcast_ref::<RotateKeyOnDemandInput>()
596 .ok_or("failed to downcast to RotateKeyOnDemandInput")?;
597
598 let params = crate::config::endpoint::Params::builder()
599 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
600 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
601 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
602 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
603 .build()
604 .map_err(|err| {
605 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
606 })?;
607 cfg.interceptor_state()
608 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
609 ::std::result::Result::Ok(())
610 }
611}
612
613#[non_exhaustive]
618#[derive(::std::fmt::Debug)]
619pub enum RotateKeyOnDemandError {
620 ConflictException(crate::types::error::ConflictException),
622 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
624 DisabledException(crate::types::error::DisabledException),
626 InvalidArnException(crate::types::error::InvalidArnException),
628 KmsInternalException(crate::types::error::KmsInternalException),
630 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
640 LimitExceededException(crate::types::error::LimitExceededException),
642 NotFoundException(crate::types::error::NotFoundException),
644 UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
646 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
648 variable wildcard pattern and check `.code()`:
649 \
650 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
651 \
652 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-RotateKeyOnDemandError) for what information is available for the error.")]
653 Unhandled(crate::error::sealed_unhandled::Unhandled),
654}
655impl RotateKeyOnDemandError {
656 pub fn unhandled(
658 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
659 ) -> Self {
660 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
661 source: err.into(),
662 meta: ::std::default::Default::default(),
663 })
664 }
665
666 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
668 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
669 source: err.clone().into(),
670 meta: err,
671 })
672 }
673 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
678 match self {
679 Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
680 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
681 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
682 Self::InvalidArnException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
683 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
684 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
685 Self::LimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
686 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
687 Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
688 Self::Unhandled(e) => &e.meta,
689 }
690 }
691 pub fn is_conflict_exception(&self) -> bool {
693 matches!(self, Self::ConflictException(_))
694 }
695 pub fn is_dependency_timeout_exception(&self) -> bool {
697 matches!(self, Self::DependencyTimeoutException(_))
698 }
699 pub fn is_disabled_exception(&self) -> bool {
701 matches!(self, Self::DisabledException(_))
702 }
703 pub fn is_invalid_arn_exception(&self) -> bool {
705 matches!(self, Self::InvalidArnException(_))
706 }
707 pub fn is_kms_internal_exception(&self) -> bool {
709 matches!(self, Self::KmsInternalException(_))
710 }
711 pub fn is_kms_invalid_state_exception(&self) -> bool {
713 matches!(self, Self::KmsInvalidStateException(_))
714 }
715 pub fn is_limit_exceeded_exception(&self) -> bool {
717 matches!(self, Self::LimitExceededException(_))
718 }
719 pub fn is_not_found_exception(&self) -> bool {
721 matches!(self, Self::NotFoundException(_))
722 }
723 pub fn is_unsupported_operation_exception(&self) -> bool {
725 matches!(self, Self::UnsupportedOperationException(_))
726 }
727}
728impl ::std::error::Error for RotateKeyOnDemandError {
729 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
730 match self {
731 Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
732 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
733 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
734 Self::InvalidArnException(_inner) => ::std::option::Option::Some(_inner),
735 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
736 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
737 Self::LimitExceededException(_inner) => ::std::option::Option::Some(_inner),
738 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
739 Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
740 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
741 }
742 }
743}
744impl ::std::fmt::Display for RotateKeyOnDemandError {
745 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
746 match self {
747 Self::ConflictException(_inner) => _inner.fmt(f),
748 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
749 Self::DisabledException(_inner) => _inner.fmt(f),
750 Self::InvalidArnException(_inner) => _inner.fmt(f),
751 Self::KmsInternalException(_inner) => _inner.fmt(f),
752 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
753 Self::LimitExceededException(_inner) => _inner.fmt(f),
754 Self::NotFoundException(_inner) => _inner.fmt(f),
755 Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
756 Self::Unhandled(_inner) => {
757 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
758 write!(f, "unhandled error ({code})")
759 } else {
760 f.write_str("unhandled error")
761 }
762 }
763 }
764 }
765}
766impl ::aws_smithy_types::retry::ProvideErrorKind for RotateKeyOnDemandError {
767 fn code(&self) -> ::std::option::Option<&str> {
768 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
769 }
770 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
771 ::std::option::Option::None
772 }
773}
774impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for RotateKeyOnDemandError {
775 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
776 match self {
777 Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
778 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
779 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
780 Self::InvalidArnException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
781 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
782 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
783 Self::LimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
784 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
785 Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
786 Self::Unhandled(_inner) => &_inner.meta,
787 }
788 }
789}
790impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for RotateKeyOnDemandError {
791 fn create_unhandled_error(
792 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
793 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
794 ) -> Self {
795 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
796 source,
797 meta: meta.unwrap_or_default(),
798 })
799 }
800}
801impl ::aws_types::request_id::RequestId for crate::operation::rotate_key_on_demand::RotateKeyOnDemandError {
802 fn request_id(&self) -> Option<&str> {
803 self.meta().request_id()
804 }
805}
806
807pub use crate::operation::rotate_key_on_demand::_rotate_key_on_demand_input::RotateKeyOnDemandInput;
808
809pub use crate::operation::rotate_key_on_demand::_rotate_key_on_demand_output::RotateKeyOnDemandOutput;
810
811mod _rotate_key_on_demand_input;
812
813mod _rotate_key_on_demand_output;
814
815pub mod builders;