1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GenerateDataKeyWithoutPlaintext;
6impl GenerateDataKeyWithoutPlaintext {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
13 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput::SCHEMA;
14 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput::SCHEMA;
17 pub(crate) async fn orchestrate(
18 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19 input: crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput,
20 ) -> ::std::result::Result<
21 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput,
22 ::aws_smithy_runtime_api::client::result::SdkError<
23 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
24 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25 >,
26 > {
27 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
28 ::aws_smithy_runtime_api::client::interceptors::context::Error,
29 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
30 >| {
31 err.map_service_error(|err| {
32 err.downcast::<crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError>()
33 .expect("correct error type")
34 })
35 };
36 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
37 .await
38 .map_err(map_err)?;
39 let output = context.finalize().map_err(map_err)?;
40 ::std::result::Result::Ok(
41 output
42 .downcast::<crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextOutput>()
43 .expect("correct output type"),
44 )
45 }
46
47 pub(crate) async fn orchestrate_with_stop_point(
48 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
49 input: crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput,
50 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
51 ) -> ::std::result::Result<
52 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
53 ::aws_smithy_runtime_api::client::result::SdkError<
54 ::aws_smithy_runtime_api::client::interceptors::context::Error,
55 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
56 >,
57 > {
58 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
59 use ::tracing::Instrument;
60 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
61 "KMS",
62 "GenerateDataKeyWithoutPlaintext",
63 input,
64 runtime_plugins,
65 stop_point,
66 )
67 .instrument(::tracing::debug_span!(
70 "KMS.GenerateDataKeyWithoutPlaintext",
71 "rpc.service" = "KMS",
72 "rpc.method" = "GenerateDataKeyWithoutPlaintext",
73 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
74 "rpc.system" = "aws-api",
75 ))
76 .await
77 }
78
79 pub(crate) fn operation_runtime_plugins(
80 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
81 client_config: &crate::config::Config,
82 config_override: ::std::option::Option<crate::config::Builder>,
83 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
84 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
85
86 if let ::std::option::Option::Some(config_override) = config_override {
87 for plugin in config_override.runtime_plugins.iter().cloned() {
88 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
89 }
90 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
91 config_override,
92 client_config.config.clone(),
93 &client_config.runtime_components,
94 ));
95 }
96 runtime_plugins
97 }
98}
99pub(crate) mod error_registry {
108 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
109 ::aws_smithy_schema::registry::TypeRegistry::builder()
110 .insert_error_shape(
111 crate::types::error::DependencyTimeoutException::SCHEMA,
112 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
113 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
114 },
115 |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> {
116 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DependencyTimeoutException::deserialize(d)?))
117 },
118 )
119.insert_error_shape(
120 crate::types::error::DisabledException::SCHEMA,
121 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
122 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DisabledException::deserialize(d)?))
123 },
124 |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> {
125 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DisabledException::deserialize(d)?))
126 },
127 )
128.insert_error_shape(
129 crate::types::error::DryRunOperationException::SCHEMA,
130 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
131 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DryRunOperationException::deserialize(d)?))
132 },
133 |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> {
134 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DryRunOperationException::deserialize(d)?))
135 },
136 )
137.insert_error_shape(
138 crate::types::error::InvalidGrantTokenException::SCHEMA,
139 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
140 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
141 },
142 |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> {
143 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidGrantTokenException::deserialize(d)?))
144 },
145 )
146.insert_error_shape(
147 crate::types::error::InvalidKeyUsageException::SCHEMA,
148 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
149 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
150 },
151 |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> {
152 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidKeyUsageException::deserialize(d)?))
153 },
154 )
155.insert_error_shape(
156 crate::types::error::KmsInternalException::SCHEMA,
157 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
158 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
159 },
160 |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> {
161 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
162 },
163 )
164.insert_error_shape(
165 crate::types::error::KmsInvalidStateException::SCHEMA,
166 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
167 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
168 },
169 |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> {
170 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
171 },
172 )
173.insert_error_shape(
174 crate::types::error::KeyUnavailableException::SCHEMA,
175 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
176 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
177 },
178 |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> {
179 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KeyUnavailableException::deserialize(d)?))
180 },
181 )
182.insert_error_shape(
183 crate::types::error::NotFoundException::SCHEMA,
184 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
185 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
186 },
187 |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> {
188 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
189 },
190 )
191 .build()
192 });
193}
194impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GenerateDataKeyWithoutPlaintext {
195 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
196 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GenerateDataKeyWithoutPlaintext");
197
198 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
199 GenerateDataKeyWithoutPlaintextRequestSerializer,
200 ));
201 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
202 GenerateDataKeyWithoutPlaintextResponseDeserializer,
203 ));
204
205 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
206 crate::config::auth::Params::builder()
207 .operation_name("GenerateDataKeyWithoutPlaintext")
208 .build()
209 .expect("required fields set"),
210 ));
211
212 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
213 "GenerateDataKeyWithoutPlaintext",
214 "KMS",
215 ));
216 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
217 signing_options.double_uri_encode = true;
218 signing_options.content_sha256_header = false;
219 signing_options.normalize_uri_path = true;
220 signing_options.payload_override = None;
221
222 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
223 signing_options,
224 ..::std::default::Default::default()
225 });
226
227 ::std::option::Option::Some(cfg.freeze())
228 }
229
230 fn runtime_components(
231 &self,
232 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
233 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
234 #[allow(unused_mut)]
235 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GenerateDataKeyWithoutPlaintext")
236 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
237 GenerateDataKeyWithoutPlaintextTelemetryInputCaptureInterceptor,
238 ))
239 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
240 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
241 ))
242 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
243 GenerateDataKeyWithoutPlaintextEndpointParamsInterceptor,
244 ))
245 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
246 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
247 >::new())
248 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
249 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
250 >::new())
251 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
252 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
253 >::new())
254 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
255 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError,
256 >::new());
257
258 ::std::borrow::Cow::Owned(rcb)
259 }
260}
261
262#[derive(Debug)]
263struct GenerateDataKeyWithoutPlaintextTelemetryInputCaptureInterceptor;
264
265#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
266impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GenerateDataKeyWithoutPlaintextTelemetryInputCaptureInterceptor {
267 fn name(&self) -> &'static str {
268 "GenerateDataKeyWithoutPlaintextTelemetryInputCaptureInterceptor"
269 }
270
271 fn read_before_execution(
272 &self,
273 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
274 '_,
275 ::aws_smithy_runtime_api::client::interceptors::context::Input,
276 ::aws_smithy_runtime_api::client::interceptors::context::Output,
277 ::aws_smithy_runtime_api::client::interceptors::context::Error,
278 >,
279 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
280 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
281 let ::std::option::Option::Some(requested) = cfg
283 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
284 .filter(|r| !r.is_empty())
285 else {
286 return ::std::result::Result::Ok(());
287 };
288
289 let ::std::option::Option::Some(input) = context.input().downcast_ref::<GenerateDataKeyWithoutPlaintextInput>() else {
290 return ::std::result::Result::Ok(());
292 };
293
294 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
295 if requested.should_capture("KeyId") {
296 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
297 captured.insert("KeyId", value);
298 }
299 }
300
301 cfg.interceptor_state().store_put(captured);
302 ::std::result::Result::Ok(())
303 }
304}
305#[derive(Debug)]
306struct GenerateDataKeyWithoutPlaintextResponseDeserializer;
307impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GenerateDataKeyWithoutPlaintextResponseDeserializer {
308 fn deserialize_nonstreaming_with_config(
309 &self,
310 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
311 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
312 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
313 let (success, status) = (response.status().is_success(), response.status().as_u16());
314 #[allow(unused_variables)]
319 let body = response.body().bytes().expect("body loaded");
320 let headers = response.headers();
321 #[allow(unused_mut)]
322 let mut force_error = false;
323 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
324 if !success && status != 200 || force_error {
325 let protocol = _cfg
326 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
327 .expect("a SharedClientProtocol is required");
328 #[allow(unused_mut)]
329 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
330 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
331 })?;
332 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
333 let generic = generic_builder.build();
334 let error_code = match generic.code() {
335 ::std::option::Option::Some(code) => code,
336 ::std::option::Option::None => {
337 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
338 ::aws_smithy_runtime_api::box_error::BoxError::from(
339 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::unhandled(generic),
340 ),
341 ))
342 }
343 };
344 let _error_message = generic.message().map(|msg| msg.to_owned());
345 let err = match error_code {
346 "DependencyTimeoutException" => {
347 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DependencyTimeoutException({
348 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
349 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
350 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
351 )
352 })?;
353 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
354 tmp.deserialize_members(&mut *deser).map_err(|e| {
355 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
356 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
357 )
358 })?;
359 if tmp.message.is_none() {
360 tmp.message = _error_message;
361 }
362 let tmp = tmp.meta(generic);
363 tmp.build()
364 })
365 }
366 "DisabledException" => {
367 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DisabledException({
368 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
369 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
370 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
371 )
372 })?;
373 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
374 tmp.deserialize_members(&mut *deser).map_err(|e| {
375 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
376 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
377 )
378 })?;
379 if tmp.message.is_none() {
380 tmp.message = _error_message;
381 }
382 let tmp = tmp.meta(generic);
383 tmp.build()
384 })
385 }
386 "DryRunOperationException" => {
387 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::DryRunOperationException({
388 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
389 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
390 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
391 )
392 })?;
393 let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
394 tmp.deserialize_members(&mut *deser).map_err(|e| {
395 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
396 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
397 )
398 })?;
399 if tmp.message.is_none() {
400 tmp.message = _error_message;
401 }
402 let tmp = tmp.meta(generic);
403 tmp.build()
404 })
405 }
406 "InvalidGrantTokenException" => {
407 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidGrantTokenException({
408 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
409 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
410 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
411 )
412 })?;
413 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
414 tmp.deserialize_members(&mut *deser).map_err(|e| {
415 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
416 ::aws_smithy_runtime_api::box_error::BoxError::from(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 }
426 "InvalidKeyUsageException" => {
427 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::InvalidKeyUsageException({
428 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
429 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
430 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
431 )
432 })?;
433 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
434 tmp.deserialize_members(&mut *deser).map_err(|e| {
435 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
436 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
437 )
438 })?;
439 if tmp.message.is_none() {
440 tmp.message = _error_message;
441 }
442 let tmp = tmp.meta(generic);
443 tmp.build()
444 })
445 }
446 "KeyUnavailableException" => {
447 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KeyUnavailableException({
448 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
449 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
450 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
451 )
452 })?;
453 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
454 tmp.deserialize_members(&mut *deser).map_err(|e| {
455 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
456 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
457 )
458 })?;
459 if tmp.message.is_none() {
460 tmp.message = _error_message;
461 }
462 let tmp = tmp.meta(generic);
463 tmp.build()
464 })
465 }
466 "KMSInternalException" => {
467 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInternalException({
468 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
469 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
470 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
471 )
472 })?;
473 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
474 tmp.deserialize_members(&mut *deser).map_err(|e| {
475 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
476 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
477 )
478 })?;
479 if tmp.message.is_none() {
480 tmp.message = _error_message;
481 }
482 let tmp = tmp.meta(generic);
483 tmp.build()
484 })
485 }
486 "KMSInvalidStateException" => {
487 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::KmsInvalidStateException({
488 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
489 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
490 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
491 )
492 })?;
493 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
494 tmp.deserialize_members(&mut *deser).map_err(|e| {
495 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
496 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
497 )
498 })?;
499 if tmp.message.is_none() {
500 tmp.message = _error_message;
501 }
502 let tmp = tmp.meta(generic);
503 tmp.build()
504 })
505 }
506 "NotFoundException" => {
507 crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::NotFoundException({
508 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
509 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
510 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
511 )
512 })?;
513 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
514 tmp.deserialize_members(&mut *deser).map_err(|e| {
515 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
516 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
517 )
518 })?;
519 if tmp.message.is_none() {
520 tmp.message = _error_message;
521 }
522 let tmp = tmp.meta(generic);
523 tmp.build()
524 })
525 }
526 _ => {
527 match protocol
535 .deserialize_error_response(response, _cfg)
536 .ok()
537 .and_then(|mut deser| {
538 ::aws_smithy_schema::registry::reify_error(
539 crate::operation::generate_data_key_without_plaintext::error_registry::REGISTRY
540 .or(&crate::error_type_registry::REGISTRY),
541 error_code,
542 &mut *deser,
543 )
544 }) {
545 ::std::option::Option::Some(source) => <crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
546 ::std::option::Option::None => crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError::generic(generic),
547 }
548 }
549 };
550 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
551 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
552 ))
553 } else {
554 let protocol = _cfg
555 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
556 .expect("a SharedClientProtocol is required");
557 let mut deser = protocol
558 .deserialize_response(response, GenerateDataKeyWithoutPlaintext::OUTPUT_SCHEMA, _cfg)
559 .map_err(|e| {
560 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
561 })?;
562 let _response_headers = headers;
566 #[allow(unused_mut)]
570 let mut output =
571 <crate::operation::generate_data_key_without_plaintext::builders::GenerateDataKeyWithoutPlaintextOutputBuilder>::default();
572 output.deserialize_members(&mut *deser).map_err(|e| {
573 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
574 })?;
575 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
576 let output = output.build();
577 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
578 }
579 }
580}
581#[derive(Debug)]
582struct GenerateDataKeyWithoutPlaintextRequestSerializer;
583impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GenerateDataKeyWithoutPlaintextRequestSerializer {
584 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
585 fn serialize_input(
586 &self,
587 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
588 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
589 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
590 let input = input
591 .downcast::<crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextInput>()
592 .expect("correct type");
593
594 let protocol = _cfg
595 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
596 .expect("a SharedClientProtocol is required");
597 let mut request = protocol
598 .serialize_request(&input, GenerateDataKeyWithoutPlaintext::INPUT_SCHEMA, "/", _cfg)
599 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
600
601 return ::std::result::Result::Ok(request);
602 }
603}
604#[derive(Debug)]
605struct GenerateDataKeyWithoutPlaintextEndpointParamsInterceptor;
606
607#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
608impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GenerateDataKeyWithoutPlaintextEndpointParamsInterceptor {
609 fn name(&self) -> &'static str {
610 "GenerateDataKeyWithoutPlaintextEndpointParamsInterceptor"
611 }
612
613 fn read_before_execution(
614 &self,
615 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
616 '_,
617 ::aws_smithy_runtime_api::client::interceptors::context::Input,
618 ::aws_smithy_runtime_api::client::interceptors::context::Output,
619 ::aws_smithy_runtime_api::client::interceptors::context::Error,
620 >,
621 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
622 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
623 let _input = context
624 .input()
625 .downcast_ref::<GenerateDataKeyWithoutPlaintextInput>()
626 .ok_or("failed to downcast to GenerateDataKeyWithoutPlaintextInput")?;
627
628 let params = crate::config::endpoint::Params::builder()
629 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
630 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
631 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
632 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
633 .build()
634 .map_err(|err| {
635 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
636 })?;
637 cfg.interceptor_state()
638 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
639 ::std::result::Result::Ok(())
640 }
641}
642
643#[non_exhaustive]
648#[derive(::std::fmt::Debug)]
649pub enum GenerateDataKeyWithoutPlaintextError {
650 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
652 DisabledException(crate::types::error::DisabledException),
654 DryRunOperationException(crate::types::error::DryRunOperationException),
656 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
658 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
668 KeyUnavailableException(crate::types::error::KeyUnavailableException),
670 KmsInternalException(crate::types::error::KmsInternalException),
672 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
682 NotFoundException(crate::types::error::NotFoundException),
684 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
686 variable wildcard pattern and check `.code()`:
687 \
688 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
689 \
690 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GenerateDataKeyWithoutPlaintextError) for what information is available for the error.")]
691 Unhandled(crate::error::sealed_unhandled::Unhandled),
692}
693impl GenerateDataKeyWithoutPlaintextError {
694 pub fn unhandled(
696 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
697 ) -> Self {
698 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
699 source: err.into(),
700 meta: ::std::default::Default::default(),
701 })
702 }
703
704 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
706 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
707 source: err.clone().into(),
708 meta: err,
709 })
710 }
711 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
716 match self {
717 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
718 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
719 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
720 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
721 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
722 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
723 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
724 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
725 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
726 Self::Unhandled(e) => &e.meta,
727 }
728 }
729 pub fn is_dependency_timeout_exception(&self) -> bool {
731 matches!(self, Self::DependencyTimeoutException(_))
732 }
733 pub fn is_disabled_exception(&self) -> bool {
735 matches!(self, Self::DisabledException(_))
736 }
737 pub fn is_dry_run_operation_exception(&self) -> bool {
739 matches!(self, Self::DryRunOperationException(_))
740 }
741 pub fn is_invalid_grant_token_exception(&self) -> bool {
743 matches!(self, Self::InvalidGrantTokenException(_))
744 }
745 pub fn is_invalid_key_usage_exception(&self) -> bool {
747 matches!(self, Self::InvalidKeyUsageException(_))
748 }
749 pub fn is_key_unavailable_exception(&self) -> bool {
751 matches!(self, Self::KeyUnavailableException(_))
752 }
753 pub fn is_kms_internal_exception(&self) -> bool {
755 matches!(self, Self::KmsInternalException(_))
756 }
757 pub fn is_kms_invalid_state_exception(&self) -> bool {
759 matches!(self, Self::KmsInvalidStateException(_))
760 }
761 pub fn is_not_found_exception(&self) -> bool {
763 matches!(self, Self::NotFoundException(_))
764 }
765}
766impl ::std::error::Error for GenerateDataKeyWithoutPlaintextError {
767 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
768 match self {
769 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
770 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
771 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
772 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
773 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
774 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
775 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
776 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
777 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
778 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
779 }
780 }
781}
782impl ::std::fmt::Display for GenerateDataKeyWithoutPlaintextError {
783 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
784 match self {
785 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
786 Self::DisabledException(_inner) => _inner.fmt(f),
787 Self::DryRunOperationException(_inner) => _inner.fmt(f),
788 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
789 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
790 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
791 Self::KmsInternalException(_inner) => _inner.fmt(f),
792 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
793 Self::NotFoundException(_inner) => _inner.fmt(f),
794 Self::Unhandled(_inner) => {
795 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
796 write!(f, "unhandled error ({code})")
797 } else {
798 f.write_str("unhandled error")
799 }
800 }
801 }
802 }
803}
804impl ::aws_smithy_types::retry::ProvideErrorKind for GenerateDataKeyWithoutPlaintextError {
805 fn code(&self) -> ::std::option::Option<&str> {
806 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
807 }
808 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
809 ::std::option::Option::None
810 }
811}
812impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GenerateDataKeyWithoutPlaintextError {
813 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
814 match self {
815 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
816 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
817 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
818 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
819 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
820 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
821 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
822 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
823 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
824 Self::Unhandled(_inner) => &_inner.meta,
825 }
826 }
827}
828impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GenerateDataKeyWithoutPlaintextError {
829 fn create_unhandled_error(
830 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
831 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
832 ) -> Self {
833 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
834 source,
835 meta: meta.unwrap_or_default(),
836 })
837 }
838}
839impl ::aws_types::request_id::RequestId for crate::operation::generate_data_key_without_plaintext::GenerateDataKeyWithoutPlaintextError {
840 fn request_id(&self) -> Option<&str> {
841 self.meta().request_id()
842 }
843}
844
845pub use crate::operation::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_input::GenerateDataKeyWithoutPlaintextInput;
846
847pub use crate::operation::generate_data_key_without_plaintext::_generate_data_key_without_plaintext_output::GenerateDataKeyWithoutPlaintextOutput;
848
849mod _generate_data_key_without_plaintext_input;
850
851mod _generate_data_key_without_plaintext_output;
852
853pub mod builders;