aws_sdk_workspaces/operation/
describe_account_modifications.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct DescribeAccountModifications;
6impl DescribeAccountModifications {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
13 crate::operation::describe_account_modifications::DescribeAccountModificationsInput::SCHEMA;
14 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16 crate::operation::describe_account_modifications::DescribeAccountModificationsOutput::SCHEMA;
17 pub(crate) async fn orchestrate(
18 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19 input: crate::operation::describe_account_modifications::DescribeAccountModificationsInput,
20 ) -> ::std::result::Result<
21 crate::operation::describe_account_modifications::DescribeAccountModificationsOutput,
22 ::aws_smithy_runtime_api::client::result::SdkError<
23 crate::operation::describe_account_modifications::DescribeAccountModificationsError,
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::describe_account_modifications::DescribeAccountModificationsError>()
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::describe_account_modifications::DescribeAccountModificationsOutput>()
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::describe_account_modifications::DescribeAccountModificationsInput,
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 "WorkSpaces",
62 "DescribeAccountModifications",
63 input,
64 runtime_plugins,
65 stop_point,
66 )
67 .instrument(::tracing::debug_span!(
70 "WorkSpaces.DescribeAccountModifications",
71 "rpc.service" = "WorkSpaces",
72 "rpc.method" = "DescribeAccountModifications",
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::AccessDeniedException::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::AccessDeniedException::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::AccessDeniedException::deserialize(d)?))
117 },
118 )
119 .build()
120 });
121}
122impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DescribeAccountModifications {
123 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
124 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DescribeAccountModifications");
125
126 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
127 DescribeAccountModificationsRequestSerializer,
128 ));
129 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
130 DescribeAccountModificationsResponseDeserializer,
131 ));
132
133 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
134 crate::config::auth::Params::builder()
135 .operation_name("DescribeAccountModifications")
136 .build()
137 .expect("required fields set"),
138 ));
139
140 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
141 "DescribeAccountModifications",
142 "WorkSpaces",
143 ));
144 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
145 signing_options.double_uri_encode = true;
146 signing_options.content_sha256_header = false;
147 signing_options.normalize_uri_path = true;
148 signing_options.payload_override = None;
149
150 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
151 signing_options,
152 ..::std::default::Default::default()
153 });
154
155 ::std::option::Option::Some(cfg.freeze())
156 }
157
158 fn runtime_components(
159 &self,
160 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
161 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
162 #[allow(unused_mut)]
163 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DescribeAccountModifications")
164 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
165 DescribeAccountModificationsTelemetryInputCaptureInterceptor,
166 ))
167 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
168 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
169 ))
170 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
171 DescribeAccountModificationsEndpointParamsInterceptor,
172 ))
173 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
174 crate::operation::describe_account_modifications::DescribeAccountModificationsError,
175 >::new())
176 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
177 crate::operation::describe_account_modifications::DescribeAccountModificationsError,
178 >::new())
179 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
180 crate::operation::describe_account_modifications::DescribeAccountModificationsError,
181 >::new())
182 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
183 crate::operation::describe_account_modifications::DescribeAccountModificationsError,
184 >::new());
185
186 ::std::borrow::Cow::Owned(rcb)
187 }
188}
189
190#[derive(Debug)]
191struct DescribeAccountModificationsTelemetryInputCaptureInterceptor;
192
193#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
194impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeAccountModificationsTelemetryInputCaptureInterceptor {
195 fn name(&self) -> &'static str {
196 "DescribeAccountModificationsTelemetryInputCaptureInterceptor"
197 }
198
199 fn read_before_execution(
200 &self,
201 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
202 '_,
203 ::aws_smithy_runtime_api::client::interceptors::context::Input,
204 ::aws_smithy_runtime_api::client::interceptors::context::Output,
205 ::aws_smithy_runtime_api::client::interceptors::context::Error,
206 >,
207 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
208 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
209 let ::std::option::Option::Some(requested) = cfg
211 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
212 .filter(|r| !r.is_empty())
213 else {
214 return ::std::result::Result::Ok(());
215 };
216
217 let ::std::option::Option::Some(input) = context.input().downcast_ref::<DescribeAccountModificationsInput>() else {
218 return ::std::result::Result::Ok(());
220 };
221
222 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
223 if requested.should_capture("NextToken") {
224 if let ::std::option::Option::Some(value) = input.next_token.as_deref() {
225 captured.insert("NextToken", value);
226 }
227 }
228
229 cfg.interceptor_state().store_put(captured);
230 ::std::result::Result::Ok(())
231 }
232}
233#[derive(Debug)]
234struct DescribeAccountModificationsResponseDeserializer;
235impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DescribeAccountModificationsResponseDeserializer {
236 fn deserialize_nonstreaming_with_config(
237 &self,
238 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
239 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
240 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
241 let (success, status) = (response.status().is_success(), response.status().as_u16());
242 #[allow(unused_variables)]
247 let body = response.body().bytes().expect("body loaded");
248 let headers = response.headers();
249 #[allow(unused_mut)]
250 let mut force_error = false;
251 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
252 if !success && status != 200 || force_error {
253 let protocol = _cfg
254 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
255 .expect("a SharedClientProtocol is required");
256 #[allow(unused_mut)]
257 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
258 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
259 })?;
260 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
261 let generic = generic_builder.build();
262 let error_code = match generic.code() {
263 ::std::option::Option::Some(code) => code,
264 ::std::option::Option::None => {
265 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
266 ::aws_smithy_runtime_api::box_error::BoxError::from(
267 crate::operation::describe_account_modifications::DescribeAccountModificationsError::unhandled(generic),
268 ),
269 ))
270 }
271 };
272 let _error_message = generic.message().map(|msg| msg.to_owned());
273 let err = match error_code {
274 "AccessDeniedException" => {
275 crate::operation::describe_account_modifications::DescribeAccountModificationsError::AccessDeniedException({
276 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
277 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
278 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
279 )
280 })?;
281 let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
282 tmp.deserialize_members(&mut *deser).map_err(|e| {
283 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
284 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
285 )
286 })?;
287 if tmp.message.is_none() {
288 tmp.message = _error_message;
289 }
290 let tmp = tmp.meta(generic);
291 tmp.build()
292 })
293 }
294 _ => {
295 match protocol
303 .deserialize_error_response(response, _cfg)
304 .ok()
305 .and_then(|mut deser| {
306 ::aws_smithy_schema::registry::reify_error(
307 crate::operation::describe_account_modifications::error_registry::REGISTRY
308 .or(&crate::error_type_registry::REGISTRY),
309 error_code,
310 &mut *deser,
311 )
312 }) {
313 ::std::option::Option::Some(source) => <crate::operation::describe_account_modifications::DescribeAccountModificationsError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
314 ::std::option::Option::None => crate::operation::describe_account_modifications::DescribeAccountModificationsError::generic(generic),
315 }
316 }
317 };
318 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
319 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
320 ))
321 } else {
322 let protocol = _cfg
323 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
324 .expect("a SharedClientProtocol is required");
325 let mut deser = protocol
326 .deserialize_response(response, DescribeAccountModifications::OUTPUT_SCHEMA, _cfg)
327 .map_err(|e| {
328 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
329 })?;
330 let _response_headers = headers;
334 #[allow(unused_mut)]
338 let mut output = <crate::operation::describe_account_modifications::builders::DescribeAccountModificationsOutputBuilder>::default();
339 output.deserialize_members(&mut *deser).map_err(|e| {
340 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
341 })?;
342 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
343 let output = output.build();
344 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
345 }
346 }
347}
348#[derive(Debug)]
349struct DescribeAccountModificationsRequestSerializer;
350impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DescribeAccountModificationsRequestSerializer {
351 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
352 fn serialize_input(
353 &self,
354 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
355 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
356 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
357 let input = input
358 .downcast::<crate::operation::describe_account_modifications::DescribeAccountModificationsInput>()
359 .expect("correct type");
360
361 let protocol = _cfg
362 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
363 .expect("a SharedClientProtocol is required");
364 let mut request = protocol
365 .serialize_request(&input, DescribeAccountModifications::INPUT_SCHEMA, "/", _cfg)
366 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
367
368 return ::std::result::Result::Ok(request);
369 }
370}
371#[derive(Debug)]
372struct DescribeAccountModificationsEndpointParamsInterceptor;
373
374#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
375impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeAccountModificationsEndpointParamsInterceptor {
376 fn name(&self) -> &'static str {
377 "DescribeAccountModificationsEndpointParamsInterceptor"
378 }
379
380 fn read_before_execution(
381 &self,
382 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
383 '_,
384 ::aws_smithy_runtime_api::client::interceptors::context::Input,
385 ::aws_smithy_runtime_api::client::interceptors::context::Output,
386 ::aws_smithy_runtime_api::client::interceptors::context::Error,
387 >,
388 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
389 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
390 let _input = context
391 .input()
392 .downcast_ref::<DescribeAccountModificationsInput>()
393 .ok_or("failed to downcast to DescribeAccountModificationsInput")?;
394
395 let params = crate::config::endpoint::Params::builder()
396 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
397 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
398 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
399 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
400 .build()
401 .map_err(|err| {
402 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
403 })?;
404 cfg.interceptor_state()
405 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
406 ::std::result::Result::Ok(())
407 }
408}
409
410#[non_exhaustive]
415#[derive(::std::fmt::Debug)]
416pub enum DescribeAccountModificationsError {
417 AccessDeniedException(crate::types::error::AccessDeniedException),
419 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
421 variable wildcard pattern and check `.code()`:
422 \
423 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
424 \
425 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DescribeAccountModificationsError) for what information is available for the error.")]
426 Unhandled(crate::error::sealed_unhandled::Unhandled),
427}
428impl DescribeAccountModificationsError {
429 pub fn unhandled(
431 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
432 ) -> Self {
433 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
434 source: err.into(),
435 meta: ::std::default::Default::default(),
436 })
437 }
438
439 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
441 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
442 source: err.clone().into(),
443 meta: err,
444 })
445 }
446 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
451 match self {
452 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453 Self::Unhandled(e) => &e.meta,
454 }
455 }
456 pub fn is_access_denied_exception(&self) -> bool {
458 matches!(self, Self::AccessDeniedException(_))
459 }
460}
461impl ::std::error::Error for DescribeAccountModificationsError {
462 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
463 match self {
464 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
465 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
466 }
467 }
468}
469impl ::std::fmt::Display for DescribeAccountModificationsError {
470 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
471 match self {
472 Self::AccessDeniedException(_inner) => _inner.fmt(f),
473 Self::Unhandled(_inner) => {
474 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
475 write!(f, "unhandled error ({code})")
476 } else {
477 f.write_str("unhandled error")
478 }
479 }
480 }
481 }
482}
483impl ::aws_smithy_types::retry::ProvideErrorKind for DescribeAccountModificationsError {
484 fn code(&self) -> ::std::option::Option<&str> {
485 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
486 }
487 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
488 ::std::option::Option::None
489 }
490}
491impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DescribeAccountModificationsError {
492 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
493 match self {
494 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
495 Self::Unhandled(_inner) => &_inner.meta,
496 }
497 }
498}
499impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DescribeAccountModificationsError {
500 fn create_unhandled_error(
501 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
502 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
503 ) -> Self {
504 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
505 source,
506 meta: meta.unwrap_or_default(),
507 })
508 }
509}
510impl ::aws_types::request_id::RequestId for crate::operation::describe_account_modifications::DescribeAccountModificationsError {
511 fn request_id(&self) -> Option<&str> {
512 self.meta().request_id()
513 }
514}
515
516pub use crate::operation::describe_account_modifications::_describe_account_modifications_input::DescribeAccountModificationsInput;
517
518pub use crate::operation::describe_account_modifications::_describe_account_modifications_output::DescribeAccountModificationsOutput;
519
520mod _describe_account_modifications_input;
521
522mod _describe_account_modifications_output;
523
524pub mod builders;