aws_sdk_workspaces/operation/
rebuild_workspaces.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct RebuildWorkspaces;
6impl RebuildWorkspaces {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::rebuild_workspaces::RebuildWorkspacesInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::rebuild_workspaces::RebuildWorkspacesOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::rebuild_workspaces::RebuildWorkspacesInput,
18 ) -> ::std::result::Result<
19 crate::operation::rebuild_workspaces::RebuildWorkspacesOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::rebuild_workspaces::RebuildWorkspacesError,
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::rebuild_workspaces::RebuildWorkspacesError>()
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::rebuild_workspaces::RebuildWorkspacesOutput>()
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::rebuild_workspaces::RebuildWorkspacesInput,
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("WorkSpaces", "RebuildWorkspaces", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "WorkSpaces.RebuildWorkspaces",
63 "rpc.service" = "WorkSpaces",
64 "rpc.method" = "RebuildWorkspaces",
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::OperationNotSupportedException::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::OperationNotSupportedException::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::OperationNotSupportedException::deserialize(d)?))
109 },
110 )
111 .build()
112 });
113}
114impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for RebuildWorkspaces {
115 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
116 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("RebuildWorkspaces");
117
118 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
119 RebuildWorkspacesRequestSerializer,
120 ));
121 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
122 RebuildWorkspacesResponseDeserializer,
123 ));
124
125 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
126 crate::config::auth::Params::builder()
127 .operation_name("RebuildWorkspaces")
128 .build()
129 .expect("required fields set"),
130 ));
131
132 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
133 "RebuildWorkspaces",
134 "WorkSpaces",
135 ));
136 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
137 signing_options.double_uri_encode = true;
138 signing_options.content_sha256_header = false;
139 signing_options.normalize_uri_path = true;
140 signing_options.payload_override = None;
141
142 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
143 signing_options,
144 ..::std::default::Default::default()
145 });
146
147 ::std::option::Option::Some(cfg.freeze())
148 }
149
150 fn runtime_components(
151 &self,
152 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
153 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
154 #[allow(unused_mut)]
155 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("RebuildWorkspaces")
156 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
157 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
158 ))
159 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
160 RebuildWorkspacesEndpointParamsInterceptor,
161 ))
162 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
163 crate::operation::rebuild_workspaces::RebuildWorkspacesError,
164 >::new())
165 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
166 crate::operation::rebuild_workspaces::RebuildWorkspacesError,
167 >::new())
168 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
169 crate::operation::rebuild_workspaces::RebuildWorkspacesError,
170 >::new())
171 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
172 crate::operation::rebuild_workspaces::RebuildWorkspacesError,
173 >::new());
174
175 ::std::borrow::Cow::Owned(rcb)
176 }
177}
178
179#[derive(Debug)]
180struct RebuildWorkspacesResponseDeserializer;
181impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for RebuildWorkspacesResponseDeserializer {
182 fn deserialize_nonstreaming_with_config(
183 &self,
184 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
185 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
186 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
187 let (success, status) = (response.status().is_success(), response.status().as_u16());
188 #[allow(unused_variables)]
193 let body = response.body().bytes().expect("body loaded");
194 let headers = response.headers();
195 #[allow(unused_mut)]
196 let mut force_error = false;
197 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
198 if !success && status != 200 || force_error {
199 let protocol = _cfg
200 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
201 .expect("a SharedClientProtocol is required");
202 #[allow(unused_mut)]
203 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
204 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
205 })?;
206 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
207 let generic = generic_builder.build();
208 let error_code = match generic.code() {
209 ::std::option::Option::Some(code) => code,
210 ::std::option::Option::None => {
211 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
212 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::rebuild_workspaces::RebuildWorkspacesError::unhandled(
213 generic,
214 )),
215 ))
216 }
217 };
218 let _error_message = generic.message().map(|msg| msg.to_owned());
219 let err = match error_code {
220 "OperationNotSupportedException" => crate::operation::rebuild_workspaces::RebuildWorkspacesError::OperationNotSupportedException({
221 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
222 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
223 e,
224 ))
225 })?;
226 let mut tmp = <crate::types::error::builders::OperationNotSupportedExceptionBuilder>::default();
227 tmp.deserialize_members(&mut *deser).map_err(|e| {
228 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
229 e,
230 ))
231 })?;
232 if tmp.message.is_none() {
233 tmp.message = _error_message;
234 }
235 let tmp = tmp.meta(generic);
236 tmp.build()
237 }),
238 _ => {
239 match protocol
247 .deserialize_error_response(response, _cfg)
248 .ok()
249 .and_then(|mut deser| {
250 ::aws_smithy_schema::registry::reify_error(
251 crate::operation::rebuild_workspaces::error_registry::REGISTRY
252 .or(&crate::error_type_registry::REGISTRY),
253 error_code,
254 &mut *deser,
255 )
256 }) {
257 ::std::option::Option::Some(source) => <crate::operation::rebuild_workspaces::RebuildWorkspacesError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
258 ::std::option::Option::None => crate::operation::rebuild_workspaces::RebuildWorkspacesError::generic(generic),
259 }
260 }
261 };
262 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
263 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
264 ))
265 } else {
266 let protocol = _cfg
267 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
268 .expect("a SharedClientProtocol is required");
269 let mut deser = protocol
270 .deserialize_response(response, RebuildWorkspaces::OUTPUT_SCHEMA, _cfg)
271 .map_err(|e| {
272 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
273 })?;
274 let _response_headers = headers;
278 #[allow(unused_mut)]
282 let mut output = <crate::operation::rebuild_workspaces::builders::RebuildWorkspacesOutputBuilder>::default();
283 output.deserialize_members(&mut *deser).map_err(|e| {
284 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
285 })?;
286 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
287 let output = output.build();
288 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
289 }
290 }
291}
292#[derive(Debug)]
293struct RebuildWorkspacesRequestSerializer;
294impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for RebuildWorkspacesRequestSerializer {
295 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
296 fn serialize_input(
297 &self,
298 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
299 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
300 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
301 let input = input
302 .downcast::<crate::operation::rebuild_workspaces::RebuildWorkspacesInput>()
303 .expect("correct type");
304
305 let protocol = _cfg
306 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
307 .expect("a SharedClientProtocol is required");
308 let mut request = protocol
309 .serialize_request(&input, RebuildWorkspaces::INPUT_SCHEMA, "/", _cfg)
310 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
311
312 return ::std::result::Result::Ok(request);
313 }
314}
315#[derive(Debug)]
316struct RebuildWorkspacesEndpointParamsInterceptor;
317
318#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
319impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RebuildWorkspacesEndpointParamsInterceptor {
320 fn name(&self) -> &'static str {
321 "RebuildWorkspacesEndpointParamsInterceptor"
322 }
323
324 fn read_before_execution(
325 &self,
326 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
327 '_,
328 ::aws_smithy_runtime_api::client::interceptors::context::Input,
329 ::aws_smithy_runtime_api::client::interceptors::context::Output,
330 ::aws_smithy_runtime_api::client::interceptors::context::Error,
331 >,
332 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
333 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
334 let _input = context
335 .input()
336 .downcast_ref::<RebuildWorkspacesInput>()
337 .ok_or("failed to downcast to RebuildWorkspacesInput")?;
338
339 let params = crate::config::endpoint::Params::builder()
340 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
341 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
342 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
343 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
344 .build()
345 .map_err(|err| {
346 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
347 })?;
348 cfg.interceptor_state()
349 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
350 ::std::result::Result::Ok(())
351 }
352}
353
354#[non_exhaustive]
359#[derive(::std::fmt::Debug)]
360pub enum RebuildWorkspacesError {
361 OperationNotSupportedException(crate::types::error::OperationNotSupportedException),
363 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
365 variable wildcard pattern and check `.code()`:
366 \
367 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
368 \
369 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-RebuildWorkspacesError) for what information is available for the error.")]
370 Unhandled(crate::error::sealed_unhandled::Unhandled),
371}
372impl RebuildWorkspacesError {
373 pub fn unhandled(
375 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
376 ) -> Self {
377 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
378 source: err.into(),
379 meta: ::std::default::Default::default(),
380 })
381 }
382
383 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
385 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
386 source: err.clone().into(),
387 meta: err,
388 })
389 }
390 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
395 match self {
396 Self::OperationNotSupportedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
397 Self::Unhandled(e) => &e.meta,
398 }
399 }
400 pub fn is_operation_not_supported_exception(&self) -> bool {
402 matches!(self, Self::OperationNotSupportedException(_))
403 }
404}
405impl ::std::error::Error for RebuildWorkspacesError {
406 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
407 match self {
408 Self::OperationNotSupportedException(_inner) => ::std::option::Option::Some(_inner),
409 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
410 }
411 }
412}
413impl ::std::fmt::Display for RebuildWorkspacesError {
414 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
415 match self {
416 Self::OperationNotSupportedException(_inner) => _inner.fmt(f),
417 Self::Unhandled(_inner) => {
418 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
419 write!(f, "unhandled error ({code})")
420 } else {
421 f.write_str("unhandled error")
422 }
423 }
424 }
425 }
426}
427impl ::aws_smithy_types::retry::ProvideErrorKind for RebuildWorkspacesError {
428 fn code(&self) -> ::std::option::Option<&str> {
429 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
430 }
431 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
432 ::std::option::Option::None
433 }
434}
435impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for RebuildWorkspacesError {
436 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
437 match self {
438 Self::OperationNotSupportedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
439 Self::Unhandled(_inner) => &_inner.meta,
440 }
441 }
442}
443impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for RebuildWorkspacesError {
444 fn create_unhandled_error(
445 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
446 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
447 ) -> Self {
448 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
449 source,
450 meta: meta.unwrap_or_default(),
451 })
452 }
453}
454impl ::aws_types::request_id::RequestId for crate::operation::rebuild_workspaces::RebuildWorkspacesError {
455 fn request_id(&self) -> Option<&str> {
456 self.meta().request_id()
457 }
458}
459
460pub use crate::operation::rebuild_workspaces::_rebuild_workspaces_input::RebuildWorkspacesInput;
461
462pub use crate::operation::rebuild_workspaces::_rebuild_workspaces_output::RebuildWorkspacesOutput;
463
464mod _rebuild_workspaces_input;
465
466mod _rebuild_workspaces_output;
467
468pub mod builders;