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