aws_sdk_workspaces/operation/
start_workspaces.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct StartWorkspaces;
6impl StartWorkspaces {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::start_workspaces::StartWorkspacesInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::start_workspaces::StartWorkspacesOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::start_workspaces::StartWorkspacesInput,
18 ) -> ::std::result::Result<
19 crate::operation::start_workspaces::StartWorkspacesOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::start_workspaces::StartWorkspacesError,
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::start_workspaces::StartWorkspacesError>()
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::start_workspaces::StartWorkspacesOutput>()
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::start_workspaces::StartWorkspacesInput,
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", "StartWorkspaces", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "WorkSpaces.StartWorkspaces",
63 "rpc.service" = "WorkSpaces",
64 "rpc.method" = "StartWorkspaces",
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}
91impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for StartWorkspaces {
92 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
93 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("StartWorkspaces");
94
95 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
96 StartWorkspacesRequestSerializer,
97 ));
98 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
99 StartWorkspacesResponseDeserializer,
100 ));
101
102 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
103 crate::config::auth::Params::builder()
104 .operation_name("StartWorkspaces")
105 .build()
106 .expect("required fields set"),
107 ));
108
109 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
110 "StartWorkspaces",
111 "WorkSpaces",
112 ));
113 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
114 signing_options.double_uri_encode = true;
115 signing_options.content_sha256_header = false;
116 signing_options.normalize_uri_path = true;
117 signing_options.payload_override = None;
118
119 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
120 signing_options,
121 ..::std::default::Default::default()
122 });
123
124 ::std::option::Option::Some(cfg.freeze())
125 }
126
127 fn runtime_components(
128 &self,
129 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
130 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
131 #[allow(unused_mut)]
132 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("StartWorkspaces")
133 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
135 ))
136 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
137 StartWorkspacesEndpointParamsInterceptor,
138 ))
139 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
140 crate::operation::start_workspaces::StartWorkspacesError,
141 >::new())
142 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
143 crate::operation::start_workspaces::StartWorkspacesError,
144 >::new())
145 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
146 crate::operation::start_workspaces::StartWorkspacesError,
147 >::new())
148 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
149 crate::operation::start_workspaces::StartWorkspacesError,
150 >::new());
151
152 ::std::borrow::Cow::Owned(rcb)
153 }
154}
155
156#[derive(Debug)]
157struct StartWorkspacesResponseDeserializer;
158impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StartWorkspacesResponseDeserializer {
159 fn deserialize_nonstreaming_with_config(
160 &self,
161 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
162 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
163 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
164 let (success, status) = (response.status().is_success(), response.status().as_u16());
165 #[allow(unused_variables)]
170 let body = response.body().bytes().expect("body loaded");
171 let headers = response.headers();
172 #[allow(unused_mut)]
173 let mut force_error = false;
174 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
175 if !success && status != 200 || force_error {
176 let protocol = _cfg
177 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
178 .expect("a SharedClientProtocol is required");
179 #[allow(unused_mut)]
180 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
181 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
182 })?;
183 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
184 let generic = generic_builder.build();
185 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
186 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
187 crate::operation::start_workspaces::StartWorkspacesError::generic(generic),
188 ),
189 ))
190 } else {
191 let protocol = _cfg
192 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
193 .expect("a SharedClientProtocol is required");
194 let mut deser = protocol
195 .deserialize_response(response, StartWorkspaces::OUTPUT_SCHEMA, _cfg)
196 .map_err(|e| {
197 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
198 })?;
199 let _response_headers = headers;
203 #[allow(unused_mut)]
207 let mut output = <crate::operation::start_workspaces::builders::StartWorkspacesOutputBuilder>::default();
208 output.deserialize_members(&mut *deser).map_err(|e| {
209 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
210 })?;
211 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
212 let output = output.build();
213 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
214 }
215 }
216}
217#[derive(Debug)]
218struct StartWorkspacesRequestSerializer;
219impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StartWorkspacesRequestSerializer {
220 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
221 fn serialize_input(
222 &self,
223 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
224 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
225 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
226 let input = input
227 .downcast::<crate::operation::start_workspaces::StartWorkspacesInput>()
228 .expect("correct type");
229
230 let protocol = _cfg
231 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
232 .expect("a SharedClientProtocol is required");
233 let mut request = protocol
234 .serialize_request(
235 &input,
236 StartWorkspaces::INPUT_SCHEMA,
237 "/service/WorkspacesService/operation/StartWorkspaces",
238 _cfg,
239 )
240 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
241
242 return ::std::result::Result::Ok(request);
243 }
244}
245#[derive(Debug)]
246struct StartWorkspacesEndpointParamsInterceptor;
247
248#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
249impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartWorkspacesEndpointParamsInterceptor {
250 fn name(&self) -> &'static str {
251 "StartWorkspacesEndpointParamsInterceptor"
252 }
253
254 fn read_before_execution(
255 &self,
256 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
257 '_,
258 ::aws_smithy_runtime_api::client::interceptors::context::Input,
259 ::aws_smithy_runtime_api::client::interceptors::context::Output,
260 ::aws_smithy_runtime_api::client::interceptors::context::Error,
261 >,
262 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
263 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
264 let _input = context
265 .input()
266 .downcast_ref::<StartWorkspacesInput>()
267 .ok_or("failed to downcast to StartWorkspacesInput")?;
268
269 let params = crate::config::endpoint::Params::builder()
270 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
271 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
272 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
273 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
274 .build()
275 .map_err(|err| {
276 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
277 })?;
278 cfg.interceptor_state()
279 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
280 ::std::result::Result::Ok(())
281 }
282}
283
284#[non_exhaustive]
289#[derive(::std::fmt::Debug)]
290pub enum StartWorkspacesError {
291 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
293 variable wildcard pattern and check `.code()`:
294 \
295 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
296 \
297 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-StartWorkspacesError) for what information is available for the error.")]
298 Unhandled(crate::error::sealed_unhandled::Unhandled),
299}
300impl StartWorkspacesError {
301 pub fn unhandled(
303 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
304 ) -> Self {
305 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
306 source: err.into(),
307 meta: ::std::default::Default::default(),
308 })
309 }
310
311 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
313 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
314 source: err.clone().into(),
315 meta: err,
316 })
317 }
318 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
323 match self {
324 Self::Unhandled(e) => &e.meta,
325 }
326 }
327}
328impl ::std::error::Error for StartWorkspacesError {
329 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
330 match self {
331 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
332 }
333 }
334}
335impl ::std::fmt::Display for StartWorkspacesError {
336 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
337 match self {
338 Self::Unhandled(_inner) => {
339 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
340 write!(f, "unhandled error ({code})")
341 } else {
342 f.write_str("unhandled error")
343 }
344 }
345 }
346 }
347}
348impl ::aws_smithy_types::retry::ProvideErrorKind for StartWorkspacesError {
349 fn code(&self) -> ::std::option::Option<&str> {
350 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
351 }
352 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
353 ::std::option::Option::None
354 }
355}
356impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for StartWorkspacesError {
357 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
358 match self {
359 Self::Unhandled(_inner) => &_inner.meta,
360 }
361 }
362}
363impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for StartWorkspacesError {
364 fn create_unhandled_error(
365 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
366 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
367 ) -> Self {
368 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
369 source,
370 meta: meta.unwrap_or_default(),
371 })
372 }
373}
374impl ::aws_types::request_id::RequestId for crate::operation::start_workspaces::StartWorkspacesError {
375 fn request_id(&self) -> Option<&str> {
376 self.meta().request_id()
377 }
378}
379
380pub use crate::operation::start_workspaces::_start_workspaces_input::StartWorkspacesInput;
381
382pub use crate::operation::start_workspaces::_start_workspaces_output::StartWorkspacesOutput;
383
384mod _start_workspaces_input;
385
386mod _start_workspaces_output;
387
388pub mod builders;