1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GenerateDataKeyPairWithoutPlaintext;
6impl GenerateDataKeyPairWithoutPlaintext {
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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput::SCHEMA;
14 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput::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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
20 ) -> ::std::result::Result<
21 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput,
22 ::aws_smithy_runtime_api::client::result::SdkError<
23 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError>()
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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextOutput>()
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_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput,
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 "GenerateDataKeyPairWithoutPlaintext",
63 input,
64 runtime_plugins,
65 stop_point,
66 )
67 .instrument(::tracing::debug_span!(
70 "KMS.GenerateDataKeyPairWithoutPlaintext",
71 "rpc.service" = "KMS",
72 "rpc.method" = "GenerateDataKeyPairWithoutPlaintext",
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.insert_error_shape(
192 crate::types::error::UnsupportedOperationException::SCHEMA,
193 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
194 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
195 },
196 |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> {
197 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
198 },
199 )
200 .build()
201 });
202}
203impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GenerateDataKeyPairWithoutPlaintext {
204 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
205 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GenerateDataKeyPairWithoutPlaintext");
206
207 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
208 GenerateDataKeyPairWithoutPlaintextRequestSerializer,
209 ));
210 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
211 GenerateDataKeyPairWithoutPlaintextResponseDeserializer,
212 ));
213
214 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
215 crate::config::auth::Params::builder()
216 .operation_name("GenerateDataKeyPairWithoutPlaintext")
217 .build()
218 .expect("required fields set"),
219 ));
220
221 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
222 "GenerateDataKeyPairWithoutPlaintext",
223 "KMS",
224 ));
225 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
226 signing_options.double_uri_encode = true;
227 signing_options.content_sha256_header = false;
228 signing_options.normalize_uri_path = true;
229 signing_options.payload_override = None;
230
231 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
232 signing_options,
233 ..::std::default::Default::default()
234 });
235
236 ::std::option::Option::Some(cfg.freeze())
237 }
238
239 fn runtime_components(
240 &self,
241 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
242 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
243 #[allow(unused_mut)]
244 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GenerateDataKeyPairWithoutPlaintext")
245 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
246 GenerateDataKeyPairWithoutPlaintextTelemetryInputCaptureInterceptor,
247 ))
248 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
249 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
250 ))
251 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
252 GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor,
253 ))
254 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
255 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
256 >::new())
257 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
258 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
259 >::new())
260 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
261 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
262 >::new())
263 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
264 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError,
265 >::new());
266
267 ::std::borrow::Cow::Owned(rcb)
268 }
269}
270
271#[derive(Debug)]
272struct GenerateDataKeyPairWithoutPlaintextTelemetryInputCaptureInterceptor;
273
274#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
275impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GenerateDataKeyPairWithoutPlaintextTelemetryInputCaptureInterceptor {
276 fn name(&self) -> &'static str {
277 "GenerateDataKeyPairWithoutPlaintextTelemetryInputCaptureInterceptor"
278 }
279
280 fn read_before_execution(
281 &self,
282 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
283 '_,
284 ::aws_smithy_runtime_api::client::interceptors::context::Input,
285 ::aws_smithy_runtime_api::client::interceptors::context::Output,
286 ::aws_smithy_runtime_api::client::interceptors::context::Error,
287 >,
288 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
289 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
290 let ::std::option::Option::Some(requested) = cfg
292 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
293 .filter(|r| !r.is_empty())
294 else {
295 return ::std::result::Result::Ok(());
296 };
297
298 let ::std::option::Option::Some(input) = context.input().downcast_ref::<GenerateDataKeyPairWithoutPlaintextInput>() else {
299 return ::std::result::Result::Ok(());
301 };
302
303 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
304 if requested.should_capture("KeyId") {
305 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
306 captured.insert("KeyId", value);
307 }
308 }
309
310 cfg.interceptor_state().store_put(captured);
311 ::std::result::Result::Ok(())
312 }
313}
314#[derive(Debug)]
315struct GenerateDataKeyPairWithoutPlaintextResponseDeserializer;
316impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GenerateDataKeyPairWithoutPlaintextResponseDeserializer {
317 fn deserialize_nonstreaming_with_config(
318 &self,
319 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
320 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
321 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
322 let (success, status) = (response.status().is_success(), response.status().as_u16());
323 #[allow(unused_variables)]
328 let body = response.body().bytes().expect("body loaded");
329 let headers = response.headers();
330 #[allow(unused_mut)]
331 let mut force_error = false;
332 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
333 if !success && status != 200 || force_error {
334 let protocol = _cfg
335 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
336 .expect("a SharedClientProtocol is required");
337 #[allow(unused_mut)]
338 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
339 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
340 })?;
341 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
342 let generic = generic_builder.build();
343 let error_code = match generic.code() {
344 ::std::option::Option::Some(code) => code,
345 ::std::option::Option::None => {
346 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
347 ::aws_smithy_runtime_api::box_error::BoxError::from(
348 crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::unhandled(generic),
349 ),
350 ))
351 }
352 };
353 let _error_message = generic.message().map(|msg| msg.to_owned());
354 let err = match error_code {
355"DependencyTimeoutException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::DependencyTimeoutException({
356let mut deser = protocol.deserialize_error_response(response, _cfg)
357 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
358 let mut tmp = <crate::types::error::builders::DependencyTimeoutExceptionBuilder>::default();
359 tmp.deserialize_members(&mut *deser)
360 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
361if tmp.message.is_none() {
362 tmp.message = _error_message;
363 }
364let tmp = tmp.meta(generic);
365tmp.build()
366}),
367"DisabledException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::DisabledException({
368let mut deser = protocol.deserialize_error_response(response, _cfg)
369 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
370 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
371 tmp.deserialize_members(&mut *deser)
372 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
373if tmp.message.is_none() {
374 tmp.message = _error_message;
375 }
376let tmp = tmp.meta(generic);
377tmp.build()
378}),
379"DryRunOperationException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::DryRunOperationException({
380let mut deser = protocol.deserialize_error_response(response, _cfg)
381 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
382 let mut tmp = <crate::types::error::builders::DryRunOperationExceptionBuilder>::default();
383 tmp.deserialize_members(&mut *deser)
384 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
385if tmp.message.is_none() {
386 tmp.message = _error_message;
387 }
388let tmp = tmp.meta(generic);
389tmp.build()
390}),
391"InvalidGrantTokenException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::InvalidGrantTokenException({
392let mut deser = protocol.deserialize_error_response(response, _cfg)
393 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
394 let mut tmp = <crate::types::error::builders::InvalidGrantTokenExceptionBuilder>::default();
395 tmp.deserialize_members(&mut *deser)
396 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
397if tmp.message.is_none() {
398 tmp.message = _error_message;
399 }
400let tmp = tmp.meta(generic);
401tmp.build()
402}),
403"InvalidKeyUsageException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::InvalidKeyUsageException({
404let mut deser = protocol.deserialize_error_response(response, _cfg)
405 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
406 let mut tmp = <crate::types::error::builders::InvalidKeyUsageExceptionBuilder>::default();
407 tmp.deserialize_members(&mut *deser)
408 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
409if tmp.message.is_none() {
410 tmp.message = _error_message;
411 }
412let tmp = tmp.meta(generic);
413tmp.build()
414}),
415"KeyUnavailableException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KeyUnavailableException({
416let mut deser = protocol.deserialize_error_response(response, _cfg)
417 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
418 let mut tmp = <crate::types::error::builders::KeyUnavailableExceptionBuilder>::default();
419 tmp.deserialize_members(&mut *deser)
420 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
421if tmp.message.is_none() {
422 tmp.message = _error_message;
423 }
424let tmp = tmp.meta(generic);
425tmp.build()
426}),
427"KMSInternalException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KmsInternalException({
428let mut deser = protocol.deserialize_error_response(response, _cfg)
429 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
430 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
431 tmp.deserialize_members(&mut *deser)
432 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
433if tmp.message.is_none() {
434 tmp.message = _error_message;
435 }
436let tmp = tmp.meta(generic);
437tmp.build()
438}),
439"KMSInvalidStateException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::KmsInvalidStateException({
440let mut deser = protocol.deserialize_error_response(response, _cfg)
441 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
442 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
443 tmp.deserialize_members(&mut *deser)
444 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
445if tmp.message.is_none() {
446 tmp.message = _error_message;
447 }
448let tmp = tmp.meta(generic);
449tmp.build()
450}),
451"NotFoundException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::NotFoundException({
452let mut deser = protocol.deserialize_error_response(response, _cfg)
453 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
454 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
455 tmp.deserialize_members(&mut *deser)
456 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
457if tmp.message.is_none() {
458 tmp.message = _error_message;
459 }
460let tmp = tmp.meta(generic);
461tmp.build()
462}),
463"UnsupportedOperationException" => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::UnsupportedOperationException({
464let mut deser = protocol.deserialize_error_response(response, _cfg)
465 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
466 let mut tmp = <crate::types::error::builders::UnsupportedOperationExceptionBuilder>::default();
467 tmp.deserialize_members(&mut *deser)
468 .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
469if tmp.message.is_none() {
470 tmp.message = _error_message;
471 }
472let tmp = tmp.meta(generic);
473tmp.build()
474}),
475_ => {
476 match protocol
484 .deserialize_error_response(response, _cfg)
485 .ok()
486 .and_then(|mut deser| {
487 ::aws_smithy_schema::registry::reify_error(
488 crate::operation::generate_data_key_pair_without_plaintext::error_registry::REGISTRY
489 .or(&crate::error_type_registry::REGISTRY),
490 error_code,
491 &mut *deser,
492 )
493 }) {
494 ::std::option::Option::Some(source) => <crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
495 ::std::option::Option::None => crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError::generic(generic),
496 }
497 }
498};
499 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
500 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
501 ))
502 } else {
503 let protocol = _cfg
504 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
505 .expect("a SharedClientProtocol is required");
506 let mut deser = protocol
507 .deserialize_response(response, GenerateDataKeyPairWithoutPlaintext::OUTPUT_SCHEMA, _cfg)
508 .map_err(|e| {
509 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
510 })?;
511 let _response_headers = headers;
515 #[allow(unused_mut)]
519 let mut output =
520 <crate::operation::generate_data_key_pair_without_plaintext::builders::GenerateDataKeyPairWithoutPlaintextOutputBuilder>::default();
521 output.deserialize_members(&mut *deser).map_err(|e| {
522 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
523 })?;
524 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
525 let output = output.build();
526 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
527 }
528 }
529}
530#[derive(Debug)]
531struct GenerateDataKeyPairWithoutPlaintextRequestSerializer;
532impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GenerateDataKeyPairWithoutPlaintextRequestSerializer {
533 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
534 fn serialize_input(
535 &self,
536 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
537 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
538 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
539 let input = input
540 .downcast::<crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextInput>()
541 .expect("correct type");
542
543 let protocol = _cfg
544 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
545 .expect("a SharedClientProtocol is required");
546 let mut request = protocol
547 .serialize_request(&input, GenerateDataKeyPairWithoutPlaintext::INPUT_SCHEMA, "/", _cfg)
548 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
549
550 return ::std::result::Result::Ok(request);
551 }
552}
553#[derive(Debug)]
554struct GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor;
555
556#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
557impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor {
558 fn name(&self) -> &'static str {
559 "GenerateDataKeyPairWithoutPlaintextEndpointParamsInterceptor"
560 }
561
562 fn read_before_execution(
563 &self,
564 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
565 '_,
566 ::aws_smithy_runtime_api::client::interceptors::context::Input,
567 ::aws_smithy_runtime_api::client::interceptors::context::Output,
568 ::aws_smithy_runtime_api::client::interceptors::context::Error,
569 >,
570 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
571 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
572 let _input = context
573 .input()
574 .downcast_ref::<GenerateDataKeyPairWithoutPlaintextInput>()
575 .ok_or("failed to downcast to GenerateDataKeyPairWithoutPlaintextInput")?;
576
577 let params = crate::config::endpoint::Params::builder()
578 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
579 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
580 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
581 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
582 .build()
583 .map_err(|err| {
584 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
585 })?;
586 cfg.interceptor_state()
587 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
588 ::std::result::Result::Ok(())
589 }
590}
591
592#[non_exhaustive]
597#[derive(::std::fmt::Debug)]
598pub enum GenerateDataKeyPairWithoutPlaintextError {
599 DependencyTimeoutException(crate::types::error::DependencyTimeoutException),
601 DisabledException(crate::types::error::DisabledException),
603 DryRunOperationException(crate::types::error::DryRunOperationException),
605 InvalidGrantTokenException(crate::types::error::InvalidGrantTokenException),
607 InvalidKeyUsageException(crate::types::error::InvalidKeyUsageException),
617 KeyUnavailableException(crate::types::error::KeyUnavailableException),
619 KmsInternalException(crate::types::error::KmsInternalException),
621 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
631 NotFoundException(crate::types::error::NotFoundException),
633 UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
635 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
637 variable wildcard pattern and check `.code()`:
638 \
639 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
640 \
641 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GenerateDataKeyPairWithoutPlaintextError) for what information is available for the error.")]
642 Unhandled(crate::error::sealed_unhandled::Unhandled),
643}
644impl GenerateDataKeyPairWithoutPlaintextError {
645 pub fn unhandled(
647 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
648 ) -> Self {
649 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
650 source: err.into(),
651 meta: ::std::default::Default::default(),
652 })
653 }
654
655 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
657 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
658 source: err.clone().into(),
659 meta: err,
660 })
661 }
662 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
667 match self {
668 Self::DependencyTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
669 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
670 Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
671 Self::InvalidGrantTokenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
672 Self::InvalidKeyUsageException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
673 Self::KeyUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
674 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
675 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
676 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
677 Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
678 Self::Unhandled(e) => &e.meta,
679 }
680 }
681 pub fn is_dependency_timeout_exception(&self) -> bool {
683 matches!(self, Self::DependencyTimeoutException(_))
684 }
685 pub fn is_disabled_exception(&self) -> bool {
687 matches!(self, Self::DisabledException(_))
688 }
689 pub fn is_dry_run_operation_exception(&self) -> bool {
691 matches!(self, Self::DryRunOperationException(_))
692 }
693 pub fn is_invalid_grant_token_exception(&self) -> bool {
695 matches!(self, Self::InvalidGrantTokenException(_))
696 }
697 pub fn is_invalid_key_usage_exception(&self) -> bool {
699 matches!(self, Self::InvalidKeyUsageException(_))
700 }
701 pub fn is_key_unavailable_exception(&self) -> bool {
703 matches!(self, Self::KeyUnavailableException(_))
704 }
705 pub fn is_kms_internal_exception(&self) -> bool {
707 matches!(self, Self::KmsInternalException(_))
708 }
709 pub fn is_kms_invalid_state_exception(&self) -> bool {
711 matches!(self, Self::KmsInvalidStateException(_))
712 }
713 pub fn is_not_found_exception(&self) -> bool {
715 matches!(self, Self::NotFoundException(_))
716 }
717 pub fn is_unsupported_operation_exception(&self) -> bool {
719 matches!(self, Self::UnsupportedOperationException(_))
720 }
721}
722impl ::std::error::Error for GenerateDataKeyPairWithoutPlaintextError {
723 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
724 match self {
725 Self::DependencyTimeoutException(_inner) => ::std::option::Option::Some(_inner),
726 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
727 Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
728 Self::InvalidGrantTokenException(_inner) => ::std::option::Option::Some(_inner),
729 Self::InvalidKeyUsageException(_inner) => ::std::option::Option::Some(_inner),
730 Self::KeyUnavailableException(_inner) => ::std::option::Option::Some(_inner),
731 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
732 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
733 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
734 Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
735 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
736 }
737 }
738}
739impl ::std::fmt::Display for GenerateDataKeyPairWithoutPlaintextError {
740 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
741 match self {
742 Self::DependencyTimeoutException(_inner) => _inner.fmt(f),
743 Self::DisabledException(_inner) => _inner.fmt(f),
744 Self::DryRunOperationException(_inner) => _inner.fmt(f),
745 Self::InvalidGrantTokenException(_inner) => _inner.fmt(f),
746 Self::InvalidKeyUsageException(_inner) => _inner.fmt(f),
747 Self::KeyUnavailableException(_inner) => _inner.fmt(f),
748 Self::KmsInternalException(_inner) => _inner.fmt(f),
749 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
750 Self::NotFoundException(_inner) => _inner.fmt(f),
751 Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
752 Self::Unhandled(_inner) => {
753 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
754 write!(f, "unhandled error ({code})")
755 } else {
756 f.write_str("unhandled error")
757 }
758 }
759 }
760 }
761}
762impl ::aws_smithy_types::retry::ProvideErrorKind for GenerateDataKeyPairWithoutPlaintextError {
763 fn code(&self) -> ::std::option::Option<&str> {
764 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
765 }
766 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
767 ::std::option::Option::None
768 }
769}
770impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GenerateDataKeyPairWithoutPlaintextError {
771 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
772 match self {
773 Self::DependencyTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
774 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
775 Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
776 Self::InvalidGrantTokenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
777 Self::InvalidKeyUsageException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
778 Self::KeyUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
779 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
780 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
781 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
782 Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
783 Self::Unhandled(_inner) => &_inner.meta,
784 }
785 }
786}
787impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GenerateDataKeyPairWithoutPlaintextError {
788 fn create_unhandled_error(
789 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
790 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
791 ) -> Self {
792 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
793 source,
794 meta: meta.unwrap_or_default(),
795 })
796 }
797}
798impl ::aws_types::request_id::RequestId for crate::operation::generate_data_key_pair_without_plaintext::GenerateDataKeyPairWithoutPlaintextError {
799 fn request_id(&self) -> Option<&str> {
800 self.meta().request_id()
801 }
802}
803
804pub use crate::operation::generate_data_key_pair_without_plaintext::_generate_data_key_pair_without_plaintext_input::GenerateDataKeyPairWithoutPlaintextInput;
805
806pub use crate::operation::generate_data_key_pair_without_plaintext::_generate_data_key_pair_without_plaintext_output::GenerateDataKeyPairWithoutPlaintextOutput;
807
808mod _generate_data_key_pair_without_plaintext_input;
809
810mod _generate_data_key_pair_without_plaintext_output;
811
812pub mod builders;