1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct UpdatePrimaryRegion;
6impl UpdatePrimaryRegion {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::update_primary_region::UpdatePrimaryRegionInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
15 crate::operation::update_primary_region::UpdatePrimaryRegionOutput::SCHEMA;
16 pub(crate) async fn orchestrate(
17 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
18 input: crate::operation::update_primary_region::UpdatePrimaryRegionInput,
19 ) -> ::std::result::Result<
20 crate::operation::update_primary_region::UpdatePrimaryRegionOutput,
21 ::aws_smithy_runtime_api::client::result::SdkError<
22 crate::operation::update_primary_region::UpdatePrimaryRegionError,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >,
25 > {
26 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
27 ::aws_smithy_runtime_api::client::interceptors::context::Error,
28 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
29 >| {
30 err.map_service_error(|err| {
31 err.downcast::<crate::operation::update_primary_region::UpdatePrimaryRegionError>()
32 .expect("correct error type")
33 })
34 };
35 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
36 .await
37 .map_err(map_err)?;
38 let output = context.finalize().map_err(map_err)?;
39 ::std::result::Result::Ok(
40 output
41 .downcast::<crate::operation::update_primary_region::UpdatePrimaryRegionOutput>()
42 .expect("correct output type"),
43 )
44 }
45
46 pub(crate) async fn orchestrate_with_stop_point(
47 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
48 input: crate::operation::update_primary_region::UpdatePrimaryRegionInput,
49 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
50 ) -> ::std::result::Result<
51 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
52 ::aws_smithy_runtime_api::client::result::SdkError<
53 ::aws_smithy_runtime_api::client::interceptors::context::Error,
54 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
55 >,
56 > {
57 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
58 use ::tracing::Instrument;
59 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("KMS", "UpdatePrimaryRegion", input, runtime_plugins, stop_point)
60 .instrument(::tracing::debug_span!(
63 "KMS.UpdatePrimaryRegion",
64 "rpc.service" = "KMS",
65 "rpc.method" = "UpdatePrimaryRegion",
66 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
67 "rpc.system" = "aws-api",
68 ))
69 .await
70 }
71
72 pub(crate) fn operation_runtime_plugins(
73 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
74 client_config: &crate::config::Config,
75 config_override: ::std::option::Option<crate::config::Builder>,
76 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
77 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
78
79 if let ::std::option::Option::Some(config_override) = config_override {
80 for plugin in config_override.runtime_plugins.iter().cloned() {
81 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
82 }
83 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
84 config_override,
85 client_config.config.clone(),
86 &client_config.runtime_components,
87 ));
88 }
89 runtime_plugins
90 }
91}
92pub(crate) mod error_registry {
101 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
102 ::aws_smithy_schema::registry::TypeRegistry::builder()
103 .insert_error_shape(
104 crate::types::error::DisabledException::SCHEMA,
105 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
106 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::DisabledException::deserialize(d)?))
107 },
108 |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> {
109 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::DisabledException::deserialize(d)?))
110 },
111 )
112.insert_error_shape(
113 crate::types::error::InvalidArnException::SCHEMA,
114 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
115 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidArnException::deserialize(d)?))
116 },
117 |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> {
118 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidArnException::deserialize(d)?))
119 },
120 )
121.insert_error_shape(
122 crate::types::error::KmsInternalException::SCHEMA,
123 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
124 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInternalException::deserialize(d)?))
125 },
126 |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> {
127 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInternalException::deserialize(d)?))
128 },
129 )
130.insert_error_shape(
131 crate::types::error::KmsInvalidStateException::SCHEMA,
132 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
133 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
134 },
135 |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> {
136 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::KmsInvalidStateException::deserialize(d)?))
137 },
138 )
139.insert_error_shape(
140 crate::types::error::NotFoundException::SCHEMA,
141 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
142 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::NotFoundException::deserialize(d)?))
143 },
144 |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> {
145 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::NotFoundException::deserialize(d)?))
146 },
147 )
148.insert_error_shape(
149 crate::types::error::UnsupportedOperationException::SCHEMA,
150 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
151 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
152 },
153 |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> {
154 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::UnsupportedOperationException::deserialize(d)?))
155 },
156 )
157 .build()
158 });
159}
160impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UpdatePrimaryRegion {
161 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
162 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UpdatePrimaryRegion");
163
164 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
165 UpdatePrimaryRegionRequestSerializer,
166 ));
167 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
168 UpdatePrimaryRegionResponseDeserializer,
169 ));
170
171 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
172 crate::config::auth::Params::builder()
173 .operation_name("UpdatePrimaryRegion")
174 .build()
175 .expect("required fields set"),
176 ));
177
178 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
179 "UpdatePrimaryRegion",
180 "KMS",
181 ));
182 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
183 signing_options.double_uri_encode = true;
184 signing_options.content_sha256_header = false;
185 signing_options.normalize_uri_path = true;
186 signing_options.payload_override = None;
187
188 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
189 signing_options,
190 ..::std::default::Default::default()
191 });
192
193 ::std::option::Option::Some(cfg.freeze())
194 }
195
196 fn runtime_components(
197 &self,
198 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
199 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
200 #[allow(unused_mut)]
201 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UpdatePrimaryRegion")
202 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
203 UpdatePrimaryRegionTelemetryInputCaptureInterceptor,
204 ))
205 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
206 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
207 ))
208 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
209 UpdatePrimaryRegionEndpointParamsInterceptor,
210 ))
211 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
212 crate::operation::update_primary_region::UpdatePrimaryRegionError,
213 >::new())
214 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
215 crate::operation::update_primary_region::UpdatePrimaryRegionError,
216 >::new())
217 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
218 crate::operation::update_primary_region::UpdatePrimaryRegionError,
219 >::new())
220 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
221 crate::operation::update_primary_region::UpdatePrimaryRegionError,
222 >::new());
223
224 ::std::borrow::Cow::Owned(rcb)
225 }
226}
227
228#[derive(Debug)]
229struct UpdatePrimaryRegionTelemetryInputCaptureInterceptor;
230
231#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
232impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdatePrimaryRegionTelemetryInputCaptureInterceptor {
233 fn name(&self) -> &'static str {
234 "UpdatePrimaryRegionTelemetryInputCaptureInterceptor"
235 }
236
237 fn read_before_execution(
238 &self,
239 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
240 '_,
241 ::aws_smithy_runtime_api::client::interceptors::context::Input,
242 ::aws_smithy_runtime_api::client::interceptors::context::Output,
243 ::aws_smithy_runtime_api::client::interceptors::context::Error,
244 >,
245 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
246 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
247 let ::std::option::Option::Some(requested) = cfg
249 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
250 .filter(|r| !r.is_empty())
251 else {
252 return ::std::result::Result::Ok(());
253 };
254
255 let ::std::option::Option::Some(input) = context.input().downcast_ref::<UpdatePrimaryRegionInput>() else {
256 return ::std::result::Result::Ok(());
258 };
259
260 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
261 if requested.should_capture("KeyId") {
262 if let ::std::option::Option::Some(value) = input.key_id.as_deref() {
263 captured.insert("KeyId", value);
264 }
265 }
266 if requested.should_capture("PrimaryRegion") {
267 if let ::std::option::Option::Some(value) = input.primary_region.as_deref() {
268 captured.insert("PrimaryRegion", value);
269 }
270 }
271
272 cfg.interceptor_state().store_put(captured);
273 ::std::result::Result::Ok(())
274 }
275}
276#[derive(Debug)]
277struct UpdatePrimaryRegionResponseDeserializer;
278impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UpdatePrimaryRegionResponseDeserializer {
279 fn deserialize_nonstreaming_with_config(
280 &self,
281 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
282 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
283 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
284 let (success, status) = (response.status().is_success(), response.status().as_u16());
285 #[allow(unused_variables)]
290 let body = response.body().bytes().expect("body loaded");
291 let headers = response.headers();
292 #[allow(unused_mut)]
293 let mut force_error = false;
294 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
295 if !success && status != 200 || force_error {
296 let protocol = _cfg
297 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
298 .expect("a SharedClientProtocol is required");
299 #[allow(unused_mut)]
300 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
301 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
302 })?;
303 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
304 let generic = generic_builder.build();
305 let error_code = match generic.code() {
306 ::std::option::Option::Some(code) => code,
307 ::std::option::Option::None => {
308 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
309 ::aws_smithy_runtime_api::box_error::BoxError::from(
310 crate::operation::update_primary_region::UpdatePrimaryRegionError::unhandled(generic),
311 ),
312 ))
313 }
314 };
315 let _error_message = generic.message().map(|msg| msg.to_owned());
316 let err = match error_code {
317 "DisabledException" => crate::operation::update_primary_region::UpdatePrimaryRegionError::DisabledException({
318 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
319 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
320 e,
321 ))
322 })?;
323 let mut tmp = <crate::types::error::builders::DisabledExceptionBuilder>::default();
324 tmp.deserialize_members(&mut *deser).map_err(|e| {
325 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
326 e,
327 ))
328 })?;
329 if tmp.message.is_none() {
330 tmp.message = _error_message;
331 }
332 let tmp = tmp.meta(generic);
333 tmp.build()
334 }),
335 "InvalidArnException" => crate::operation::update_primary_region::UpdatePrimaryRegionError::InvalidArnException({
336 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
337 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
338 e,
339 ))
340 })?;
341 let mut tmp = <crate::types::error::builders::InvalidArnExceptionBuilder>::default();
342 tmp.deserialize_members(&mut *deser).map_err(|e| {
343 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
344 e,
345 ))
346 })?;
347 if tmp.message.is_none() {
348 tmp.message = _error_message;
349 }
350 let tmp = tmp.meta(generic);
351 tmp.build()
352 }),
353 "KMSInternalException" => crate::operation::update_primary_region::UpdatePrimaryRegionError::KmsInternalException({
354 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
355 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
356 e,
357 ))
358 })?;
359 let mut tmp = <crate::types::error::builders::KmsInternalExceptionBuilder>::default();
360 tmp.deserialize_members(&mut *deser).map_err(|e| {
361 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
362 e,
363 ))
364 })?;
365 if tmp.message.is_none() {
366 tmp.message = _error_message;
367 }
368 let tmp = tmp.meta(generic);
369 tmp.build()
370 }),
371 "KMSInvalidStateException" => crate::operation::update_primary_region::UpdatePrimaryRegionError::KmsInvalidStateException({
372 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
373 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
374 e,
375 ))
376 })?;
377 let mut tmp = <crate::types::error::builders::KmsInvalidStateExceptionBuilder>::default();
378 tmp.deserialize_members(&mut *deser).map_err(|e| {
379 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
380 e,
381 ))
382 })?;
383 if tmp.message.is_none() {
384 tmp.message = _error_message;
385 }
386 let tmp = tmp.meta(generic);
387 tmp.build()
388 }),
389 "NotFoundException" => crate::operation::update_primary_region::UpdatePrimaryRegionError::NotFoundException({
390 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
391 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
392 e,
393 ))
394 })?;
395 let mut tmp = <crate::types::error::builders::NotFoundExceptionBuilder>::default();
396 tmp.deserialize_members(&mut *deser).map_err(|e| {
397 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
398 e,
399 ))
400 })?;
401 if tmp.message.is_none() {
402 tmp.message = _error_message;
403 }
404 let tmp = tmp.meta(generic);
405 tmp.build()
406 }),
407 "UnsupportedOperationException" => {
408 crate::operation::update_primary_region::UpdatePrimaryRegionError::UnsupportedOperationException({
409 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
410 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
411 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
412 )
413 })?;
414 let mut tmp = <crate::types::error::builders::UnsupportedOperationExceptionBuilder>::default();
415 tmp.deserialize_members(&mut *deser).map_err(|e| {
416 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
417 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
418 )
419 })?;
420 if tmp.message.is_none() {
421 tmp.message = _error_message;
422 }
423 let tmp = tmp.meta(generic);
424 tmp.build()
425 })
426 }
427 _ => {
428 match protocol
436 .deserialize_error_response(response, _cfg)
437 .ok()
438 .and_then(|mut deser| {
439 ::aws_smithy_schema::registry::reify_error(
440 crate::operation::update_primary_region::error_registry::REGISTRY
441 .or(&crate::error_type_registry::REGISTRY),
442 error_code,
443 &mut *deser,
444 )
445 }) {
446 ::std::option::Option::Some(source) => <crate::operation::update_primary_region::UpdatePrimaryRegionError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
447 ::std::option::Option::None => crate::operation::update_primary_region::UpdatePrimaryRegionError::generic(generic),
448 }
449 }
450 };
451 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
452 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
453 ))
454 } else {
455 let protocol = _cfg
456 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
457 .expect("a SharedClientProtocol is required");
458 let mut deser = protocol
459 .deserialize_response(response, UpdatePrimaryRegion::OUTPUT_SCHEMA, _cfg)
460 .map_err(|e| {
461 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
462 })?;
463 let _response_headers = headers;
467 #[allow(unused_mut)]
471 let mut output = <crate::operation::update_primary_region::builders::UpdatePrimaryRegionOutputBuilder>::default();
472 output.deserialize_members(&mut *deser).map_err(|e| {
473 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
474 })?;
475 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
476 let output = output.build();
477 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
478 }
479 }
480}
481#[derive(Debug)]
482struct UpdatePrimaryRegionRequestSerializer;
483impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UpdatePrimaryRegionRequestSerializer {
484 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
485 fn serialize_input(
486 &self,
487 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
488 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
489 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
490 let input = input
491 .downcast::<crate::operation::update_primary_region::UpdatePrimaryRegionInput>()
492 .expect("correct type");
493
494 let protocol = _cfg
495 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
496 .expect("a SharedClientProtocol is required");
497 let mut request = protocol
498 .serialize_request(&input, UpdatePrimaryRegion::INPUT_SCHEMA, "/", _cfg)
499 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
500
501 return ::std::result::Result::Ok(request);
502 }
503}
504#[derive(Debug)]
505struct UpdatePrimaryRegionEndpointParamsInterceptor;
506
507#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
508impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdatePrimaryRegionEndpointParamsInterceptor {
509 fn name(&self) -> &'static str {
510 "UpdatePrimaryRegionEndpointParamsInterceptor"
511 }
512
513 fn read_before_execution(
514 &self,
515 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
516 '_,
517 ::aws_smithy_runtime_api::client::interceptors::context::Input,
518 ::aws_smithy_runtime_api::client::interceptors::context::Output,
519 ::aws_smithy_runtime_api::client::interceptors::context::Error,
520 >,
521 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
522 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
523 let _input = context
524 .input()
525 .downcast_ref::<UpdatePrimaryRegionInput>()
526 .ok_or("failed to downcast to UpdatePrimaryRegionInput")?;
527
528 let params = crate::config::endpoint::Params::builder()
529 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
530 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
531 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
532 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
533 .build()
534 .map_err(|err| {
535 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
536 })?;
537 cfg.interceptor_state()
538 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
539 ::std::result::Result::Ok(())
540 }
541}
542
543#[non_exhaustive]
548#[derive(::std::fmt::Debug)]
549pub enum UpdatePrimaryRegionError {
550 DisabledException(crate::types::error::DisabledException),
552 InvalidArnException(crate::types::error::InvalidArnException),
554 KmsInternalException(crate::types::error::KmsInternalException),
556 KmsInvalidStateException(crate::types::error::KmsInvalidStateException),
566 NotFoundException(crate::types::error::NotFoundException),
568 UnsupportedOperationException(crate::types::error::UnsupportedOperationException),
570 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
572 variable wildcard pattern and check `.code()`:
573 \
574 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
575 \
576 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UpdatePrimaryRegionError) for what information is available for the error.")]
577 Unhandled(crate::error::sealed_unhandled::Unhandled),
578}
579impl UpdatePrimaryRegionError {
580 pub fn unhandled(
582 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
583 ) -> Self {
584 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
585 source: err.into(),
586 meta: ::std::default::Default::default(),
587 })
588 }
589
590 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
592 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
593 source: err.clone().into(),
594 meta: err,
595 })
596 }
597 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
602 match self {
603 Self::DisabledException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
604 Self::InvalidArnException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
605 Self::KmsInternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
606 Self::KmsInvalidStateException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
607 Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
608 Self::UnsupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
609 Self::Unhandled(e) => &e.meta,
610 }
611 }
612 pub fn is_disabled_exception(&self) -> bool {
614 matches!(self, Self::DisabledException(_))
615 }
616 pub fn is_invalid_arn_exception(&self) -> bool {
618 matches!(self, Self::InvalidArnException(_))
619 }
620 pub fn is_kms_internal_exception(&self) -> bool {
622 matches!(self, Self::KmsInternalException(_))
623 }
624 pub fn is_kms_invalid_state_exception(&self) -> bool {
626 matches!(self, Self::KmsInvalidStateException(_))
627 }
628 pub fn is_not_found_exception(&self) -> bool {
630 matches!(self, Self::NotFoundException(_))
631 }
632 pub fn is_unsupported_operation_exception(&self) -> bool {
634 matches!(self, Self::UnsupportedOperationException(_))
635 }
636}
637impl ::std::error::Error for UpdatePrimaryRegionError {
638 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
639 match self {
640 Self::DisabledException(_inner) => ::std::option::Option::Some(_inner),
641 Self::InvalidArnException(_inner) => ::std::option::Option::Some(_inner),
642 Self::KmsInternalException(_inner) => ::std::option::Option::Some(_inner),
643 Self::KmsInvalidStateException(_inner) => ::std::option::Option::Some(_inner),
644 Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
645 Self::UnsupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
646 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
647 }
648 }
649}
650impl ::std::fmt::Display for UpdatePrimaryRegionError {
651 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
652 match self {
653 Self::DisabledException(_inner) => _inner.fmt(f),
654 Self::InvalidArnException(_inner) => _inner.fmt(f),
655 Self::KmsInternalException(_inner) => _inner.fmt(f),
656 Self::KmsInvalidStateException(_inner) => _inner.fmt(f),
657 Self::NotFoundException(_inner) => _inner.fmt(f),
658 Self::UnsupportedOperationException(_inner) => _inner.fmt(f),
659 Self::Unhandled(_inner) => {
660 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
661 write!(f, "unhandled error ({code})")
662 } else {
663 f.write_str("unhandled error")
664 }
665 }
666 }
667 }
668}
669impl ::aws_smithy_types::retry::ProvideErrorKind for UpdatePrimaryRegionError {
670 fn code(&self) -> ::std::option::Option<&str> {
671 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
672 }
673 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
674 ::std::option::Option::None
675 }
676}
677impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UpdatePrimaryRegionError {
678 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
679 match self {
680 Self::DisabledException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
681 Self::InvalidArnException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
682 Self::KmsInternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
683 Self::KmsInvalidStateException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
684 Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
685 Self::UnsupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
686 Self::Unhandled(_inner) => &_inner.meta,
687 }
688 }
689}
690impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UpdatePrimaryRegionError {
691 fn create_unhandled_error(
692 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
693 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
694 ) -> Self {
695 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
696 source,
697 meta: meta.unwrap_or_default(),
698 })
699 }
700}
701impl ::aws_types::request_id::RequestId for crate::operation::update_primary_region::UpdatePrimaryRegionError {
702 fn request_id(&self) -> Option<&str> {
703 self.meta().request_id()
704 }
705}
706
707pub use crate::operation::update_primary_region::_update_primary_region_input::UpdatePrimaryRegionInput;
708
709pub use crate::operation::update_primary_region::_update_primary_region_output::UpdatePrimaryRegionOutput;
710
711mod _update_primary_region_input;
712
713mod _update_primary_region_output;
714
715pub mod builders;