1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct ReEncrypt;
6impl ReEncrypt {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::re_encrypt::ReEncryptInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::re_encrypt::ReEncryptOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::re_encrypt::ReEncryptInput,
18 ) -> ::std::result::Result<
19 crate::operation::re_encrypt::ReEncryptOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::re_encrypt::ReEncryptError,
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::re_encrypt::ReEncryptError>()
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::re_encrypt::ReEncryptOutput>()
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::re_encrypt::ReEncryptInput,
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", "ReEncrypt", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "KMS.ReEncrypt",
63 "rpc.service" = "KMS",
64 "rpc.method" = "ReEncrypt",
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::DependencyTimeoutException::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::DependencyTimeoutException::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::DependencyTimeoutException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::DisabledException::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::DisabledException::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::DisabledException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::DryRunOperationException::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::DryRunOperationException::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::DryRunOperationException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::IncorrectKeyException::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::IncorrectKeyException::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::IncorrectKeyException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::InvalidCiphertextException::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::InvalidCiphertextException::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::InvalidCiphertextException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::InvalidGrantTokenException::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::InvalidGrantTokenException::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::InvalidGrantTokenException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::InvalidKeyUsageException::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::InvalidKeyUsageException::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::InvalidKeyUsageException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::KmsInternalException::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::KmsInternalException::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::KmsInternalException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::KmsInvalidStateException::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::KmsInvalidStateException::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::KmsInvalidStateException::deserialize(d)?))
181 },
182 )
183.insert_error_shape(
184 crate::types::error::KeyUnavailableException::SCHEMA,
185 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
186 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
187 },
188 |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> {
189 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
190 },
191 )
192.insert_error_shape(
193 crate::types::error::NotFoundException::SCHEMA,
194 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
195 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
196 },
197 |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> {
198 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
199 },
200 )
201 .build()
202 });
203}
204impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ReEncrypt {
205 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
206 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ReEncrypt");
207
208 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
209 ReEncryptRequestSerializer,
210 ));
211 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
212 ReEncryptResponseDeserializer,
213 ));
214
215 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
216 crate::config::auth::Params::builder()
217 .operation_name("ReEncrypt")
218 .build()
219 .expect("required fields set"),
220 ));
221
222 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("ReEncrypt", "KMS"));
223 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
224 signing_options.double_uri_encode = true;
225 signing_options.content_sha256_header = false;
226 signing_options.normalize_uri_path = true;
227 signing_options.payload_override = None;
228
229 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
230 signing_options,
231 ..::std::default::Default::default()
232 });
233
234 ::std::option::Option::Some(cfg.freeze())
235 }
236
237 fn runtime_components(
238 &self,
239 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
240 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
241 #[allow(unused_mut)]
242 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ReEncrypt")
243 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
244 ReEncryptTelemetryInputCaptureInterceptor,
245 ))
246 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
247 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
248 ))
249 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
250 ReEncryptEndpointParamsInterceptor,
251 ))
252 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
253 crate::operation::re_encrypt::ReEncryptError,
254 >::new())
255 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
256 crate::operation::re_encrypt::ReEncryptError,
257 >::new())
258 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
259 crate::operation::re_encrypt::ReEncryptError,
260 >::new())
261 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
262 crate::operation::re_encrypt::ReEncryptError,
263 >::new());
264
265 ::std::borrow::Cow::Owned(rcb)
266 }
267}
268
269#[derive(Debug)]
270struct ReEncryptTelemetryInputCaptureInterceptor;
271
272#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
273impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ReEncryptTelemetryInputCaptureInterceptor {
274 fn name(&self) -> &'static str {
275 "ReEncryptTelemetryInputCaptureInterceptor"
276 }
277
278 fn read_before_execution(
279 &self,
280 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
281 '_,
282 ::aws_smithy_runtime_api::client::interceptors::context::Input,
283 ::aws_smithy_runtime_api::client::interceptors::context::Output,
284 ::aws_smithy_runtime_api::client::interceptors::context::Error,
285 >,
286 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
287 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
288 let ::std::option::Option::Some(requested) = cfg
290 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
291 .filter(|r| !r.is_empty())
292 else {
293 return ::std::result::Result::Ok(());
294 };
295
296 let ::std::option::Option::Some(input) = context.input().downcast_ref::<ReEncryptInput>() else {
297 return ::std::result::Result::Ok(());
299 };
300
301 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
302 if requested.should_capture("SourceKeyId") {
303 if let ::std::option::Option::Some(value) = input.source_key_id.as_deref() {
304 captured.insert("SourceKeyId", value);
305 }
306 }
307 if requested.should_capture("DestinationKeyId") {
308 if let ::std::option::Option::Some(value) = input.destination_key_id.as_deref() {
309 captured.insert("DestinationKeyId", value);
310 }
311 }
312
313 cfg.interceptor_state().store_put(captured);
314 ::std::result::Result::Ok(())
315 }
316}
317#[derive(Debug)]
318struct ReEncryptResponseDeserializer;
319impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ReEncryptResponseDeserializer {
320 fn deserialize_nonstreaming_with_config(
321 &self,
322 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
323 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
324 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
325 let (success, status) = (response.status().is_success(), response.status().as_u16());
326 #[allow(unused_variables)]
331 let body = response.body().bytes().expect("body loaded");
332 let headers = response.headers();
333 #[allow(unused_mut)]
334 let mut force_error = false;
335 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
336 if !success && status != 200 || force_error {
337 let protocol = _cfg
338 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
339 .expect("a SharedClientProtocol is required");
340 #[allow(unused_mut)]
341 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
342 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
343 })?;
344 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
345 let generic = generic_builder.build();
346 let error_code = match generic.code() {
347 ::std::option::Option::Some(code) => code,
348 ::std::option::Option::None => {
349 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
350 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::re_encrypt::ReEncryptError::unhandled(generic)),
351 ))
352 }
353 };
354 let _error_message = generic.message().map(|msg| msg.to_owned());
355 let err = match error_code {
356 "DependencyTimeoutException" => crate::operation::re_encrypt::ReEncryptError::DependencyTimeoutException({
357 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
358 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
359 e,
360 ))
361 })?;
362 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
363 tmp.deserialize_members(&mut *deser).map_err(|e| {
364 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
365 e,
366 ))
367 })?;
368 if tmp.message.is_none() {
369 tmp.message = _error_message;
370 }
371 let tmp = tmp.meta(generic);
372 tmp.build()
373 }),
374 "DisabledException" => crate::operation::re_encrypt::ReEncryptError::DisabledException({
375 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
376 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
377 e,
378 ))
379 })?;
380 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
381 tmp.deserialize_members(&mut *deser).map_err(|e| {
382 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
383 e,
384 ))
385 })?;
386 if tmp.message.is_none() {
387 tmp.message = _error_message;
388 }
389 let tmp = tmp.meta(generic);
390 tmp.build()
391 }),
392 "DryRunOperationException" => crate::operation::re_encrypt::ReEncryptError::DryRunOperationException({
393 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
394 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
395 e,
396 ))
397 })?;
398 let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
399 tmp.deserialize_members(&mut *deser).map_err(|e| {
400 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
401 e,
402 ))
403 })?;
404 if tmp.message.is_none() {
405 tmp.message = _error_message;
406 }
407 let tmp = tmp.meta(generic);
408 tmp.build()
409 }),
410 "IncorrectKeyException" => crate::operation::re_encrypt::ReEncryptError::IncorrectKeyException({
411 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
412 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
413 e,
414 ))
415 })?;
416 let mut tmp = <crate::types::error::builders::IncorrectKeyExceptionBuilder>::default();
417 tmp.deserialize_members(&mut *deser).map_err(|e| {
418 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
419 e,
420 ))
421 })?;
422 if tmp.message.is_none() {
423 tmp.message = _error_message;
424 }
425 let tmp = tmp.meta(generic);
426 tmp.build()
427 }),
428 "InvalidCiphertextException" => crate::operation::re_encrypt::ReEncryptError::InvalidCiphertextException({
429 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
430 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
431 e,
432 ))
433 })?;
434 let mut tmp = <crate::types::error::builders::InvalidCiphertextExceptionBuilder>::default();
435 tmp.deserialize_members(&mut *deser).map_err(|e| {
436 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
437 e,
438 ))
439 })?;
440 if tmp.message.is_none() {
441 tmp.message = _error_message;
442 }
443 let tmp = tmp.meta(generic);
444 tmp.build()
445 }),
446 "InvalidGrantTokenException" => crate::operation::re_encrypt::ReEncryptError::InvalidGrantTokenException({
447 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
448 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
449 e,
450 ))
451 })?;
452 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
453 tmp.deserialize_members(&mut *deser).map_err(|e| {
454 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
455 e,
456 ))
457 })?;
458 if tmp.message.is_none() {
459 tmp.message = _error_message;
460 }
461 let tmp = tmp.meta(generic);
462 tmp.build()
463 }),
464 "InvalidKeyUsageException" => crate::operation::re_encrypt::ReEncryptError::InvalidKeyUsageException({
465 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
466 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
467 e,
468 ))
469 })?;
470 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
471 tmp.deserialize_members(&mut *deser).map_err(|e| {
472 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
473 e,
474 ))
475 })?;
476 if tmp.message.is_none() {
477 tmp.message = _error_message;
478 }
479 let tmp = tmp.meta(generic);
480 tmp.build()
481 }),
482 "KeyUnavailableException" => crate::operation::re_encrypt::ReEncryptError::KeyUnavailableException({
483 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
484 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
485 e,
486 ))
487 })?;
488 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
489 tmp.deserialize_members(&mut *deser).map_err(|e| {
490 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
491 e,
492 ))
493 })?;
494 if tmp.message.is_none() {
495 tmp.message = _error_message;
496 }
497 let tmp = tmp.meta(generic);
498 tmp.build()
499 }),
500 "KMSInternalException" => crate::operation::re_encrypt::ReEncryptError::KmsInternalException({
501 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
502 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
503 e,
504 ))
505 })?;
506 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
507 tmp.deserialize_members(&mut *deser).map_err(|e| {
508 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
509 e,
510 ))
511 })?;
512 if tmp.message.is_none() {
513 tmp.message = _error_message;
514 }
515 let tmp = tmp.meta(generic);
516 tmp.build()
517 }),
518 "KMSInvalidStateException" => crate::operation::re_encrypt::ReEncryptError::KmsInvalidStateException({
519 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
520 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
521 e,
522 ))
523 })?;
524 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
525 tmp.deserialize_members(&mut *deser).map_err(|e| {
526 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
527 e,
528 ))
529 })?;
530 if tmp.message.is_none() {
531 tmp.message = _error_message;
532 }
533 let tmp = tmp.meta(generic);
534 tmp.build()
535 }),
536 "NotFoundException" => crate::operation::re_encrypt::ReEncryptError::NotFoundException({
537 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
538 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
539 e,
540 ))
541 })?;
542 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
543 tmp.deserialize_members(&mut *deser).map_err(|e| {
544 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
545 e,
546 ))
547 })?;
548 if tmp.message.is_none() {
549 tmp.message = _error_message;
550 }
551 let tmp = tmp.meta(generic);
552 tmp.build()
553 }),
554 _ => {
555 match protocol
563 .deserialize_error_response(response, _cfg)
564 .ok()
565 .and_then(|mut deser| {
566 ::aws_smithy_schema::registry::reify_error(
567 crate::operation::re_encrypt::error_registry::REGISTRY
568 .or(&crate::error_type_registry::REGISTRY),
569 error_code,
570 &mut *deser,
571 )
572 }) {
573 ::std::option::Option::Some(source) => <crate::operation::re_encrypt::ReEncryptError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
574 ::std::option::Option::None => crate::operation::re_encrypt::ReEncryptError::generic(generic),
575 }
576 }
577 };
578 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
579 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
580 ))
581 } else {
582 let protocol = _cfg
583 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
584 .expect("a SharedClientProtocol is required");
585 let mut deser = protocol.deserialize_response(response, ReEncrypt::OUTPUT_SCHEMA, _cfg).map_err(|e| {
586 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
587 })?;
588 let _response_headers = headers;
592 #[allow(unused_mut)]
596 let mut output = <crate::operation::re_encrypt::builders::ReEncryptOutputBuilder>::default();
597 output.deserialize_members(&mut *deser).map_err(|e| {
598 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
599 })?;
600 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
601 let output = output.build();
602 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
603 }
604 }
605}
606#[derive(Debug)]
607struct ReEncryptRequestSerializer;
608impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ReEncryptRequestSerializer {
609 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
610 fn serialize_input(
611 &self,
612 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
613 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
614 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
615 let input = input.downcast::<crate::operation::re_encrypt::ReEncryptInput>().expect("correct type");
616
617 let protocol = _cfg
618 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
619 .expect("a SharedClientProtocol is required");
620 let mut request = protocol
621 .serialize_request(&input, ReEncrypt::INPUT_SCHEMA, "/", _cfg)
622 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
623
624 return ::std::result::Result::Ok(request);
625 }
626}
627#[derive(Debug)]
628struct ReEncryptEndpointParamsInterceptor;
629
630#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
631impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ReEncryptEndpointParamsInterceptor {
632 fn name(&self) -> &'static str {
633 "ReEncryptEndpointParamsInterceptor"
634 }
635
636 fn read_before_execution(
637 &self,
638 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
639 '_,
640 ::aws_smithy_runtime_api::client::interceptors::context::Input,
641 ::aws_smithy_runtime_api::client::interceptors::context::Output,
642 ::aws_smithy_runtime_api::client::interceptors::context::Error,
643 >,
644 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
645 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
646 let _input = context
647 .input()
648 .downcast_ref::<ReEncryptInput>()
649 .ok_or("failed to downcast to ReEncryptInput")?;
650
651 let params = crate::config::endpoint::Params::builder()
652 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
653 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
654 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
655 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
656 .build()
657 .map_err(|err| {
658 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
659 })?;
660 cfg.interceptor_state()
661 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
662 ::std::result::Result::Ok(())
663 }
664}
665
666#[non_exhaustive]
671#[derive(::std::fmt::Debug)]
672pub enum ReEncryptError {
673 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
675 DisabledException(crate::types::error::DisabledException),
677 DryRunOperationException(crate::types::error::DryRunOperationException),
679 IncorrectKeyException(crate::types::error::IncorrectKeyException),
681 InvalidCiphertextException(crate::types::error::InvalidCiphertextException),
685 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
687 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
697 KeyUnavailableException(crate::types::error::KeyUnavailableException),
699 KmsInternalException(crate::types::error::KmsInternalException),
701 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
711 NotFoundException(crate::types::error::NotFoundException),
713 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
715 variable wildcard pattern and check `.code()`:
716 \
717 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
718 \
719 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ReEncryptError) for what information is available for the error.")]
720 Unhandled(crate::error::sealed_unhandled::Unhandled),
721}
722impl ReEncryptError {
723 pub fn unhandled(
725 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
726 ) -> Self {
727 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
728 source: err.into(),
729 meta: ::std::default::Default::default(),
730 })
731 }
732
733 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
735 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
736 source: err.clone().into(),
737 meta: err,
738 })
739 }
740 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
745 match self {
746 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
747 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
748 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
749 Self::IncorrectKeyException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
750 Self::InvalidCiphertextException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
751 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
752 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
753 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
754 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
755 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
756 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
757 Self::Unhandled(e) => &e.meta,
758 }
759 }
760 pub fn is_dependency_timeout_exception(&self) -> bool {
762 matches!(self, Self::DependencyTimeoutException(_))
763 }
764 pub fn is_disabled_exception(&self) -> bool {
766 matches!(self, Self::DisabledException(_))
767 }
768 pub fn is_dry_run_operation_exception(&self) -> bool {
770 matches!(self, Self::DryRunOperationException(_))
771 }
772 pub fn is_incorrect_key_exception(&self) -> bool {
774 matches!(self, Self::IncorrectKeyException(_))
775 }
776 pub fn is_invalid_ciphertext_exception(&self) -> bool {
778 matches!(self, Self::InvalidCiphertextException(_))
779 }
780 pub fn is_invalid_grant_token_exception(&self) -> bool {
782 matches!(self, Self::InvalidGrantTokenException(_))
783 }
784 pub fn is_invalid_key_usage_exception(&self) -> bool {
786 matches!(self, Self::InvalidKeyUsageException(_))
787 }
788 pub fn is_key_unavailable_exception(&self) -> bool {
790 matches!(self, Self::KeyUnavailableException(_))
791 }
792 pub fn is_kms_internal_exception(&self) -> bool {
794 matches!(self, Self::KmsInternalException(_))
795 }
796 pub fn is_kms_invalid_state_exception(&self) -> bool {
798 matches!(self, Self::KmsInvalidStateException(_))
799 }
800 pub fn is_not_found_exception(&self) -> bool {
802 matches!(self, Self::NotFoundException(_))
803 }
804}
805impl ::std::error::Error for ReEncryptError {
806 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
807 match self {
808 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
809 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
810 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
811 Self::IncorrectKeyException(_inner) => ::std::option::Option::Some(_inner),
812 Self::InvalidCiphertextException(_inner) => ::std::option::Option::Some(_inner),
813 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
814 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
815 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
816 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
817 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
818 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
819 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
820 }
821 }
822}
823impl ::std::fmt::Display for ReEncryptError {
824 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
825 match self {
826 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
827 Self::DisabledException(_inner) => _inner.fmt(f),
828 Self::DryRunOperationException(_inner) => _inner.fmt(f),
829 Self::IncorrectKeyException(_inner) => _inner.fmt(f),
830 Self::InvalidCiphertextException(_inner) => _inner.fmt(f),
831 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
832 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
833 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
834 Self::KmsInternalException(_inner) => _inner.fmt(f),
835 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
836 Self::NotFoundException(_inner) => _inner.fmt(f),
837 Self::Unhandled(_inner) => {
838 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
839 write!(f, "unhandled error ({code})")
840 } else {
841 f.write_str("unhandled error")
842 }
843 }
844 }
845 }
846}
847impl ::aws_smithy_types::retry::ProvideErrorKind for ReEncryptError {
848 fn code(&self) -> ::std::option::Option<&str> {
849 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
850 }
851 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
852 ::std::option::Option::None
853 }
854}
855impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ReEncryptError {
856 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
857 match self {
858 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
859 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
860 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
861 Self::IncorrectKeyException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
862 Self::InvalidCiphertextException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
863 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
864 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
865 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
866 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
867 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
868 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
869 Self::Unhandled(_inner) => &_inner.meta,
870 }
871 }
872}
873impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ReEncryptError {
874 fn create_unhandled_error(
875 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
876 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
877 ) -> Self {
878 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
879 source,
880 meta: meta.unwrap_or_default(),
881 })
882 }
883}
884impl ::aws_types::request_id::RequestId for crate::operation::re_encrypt::ReEncryptError {
885 fn request_id(&self) -> Option<&str> {
886 self.meta().request_id()
887 }
888}
889
890pub use crate::operation::re_encrypt::_re_encrypt_input::ReEncryptInput;
891
892pub use crate::operation::re_encrypt::_re_encrypt_output::ReEncryptOutput;
893
894mod _re_encrypt_input;
895
896mod _re_encrypt_output;
897
898pub mod builders;