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(&input, StartWorkspaces::INPUT_SCHEMA, "/", _cfg)
235 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
236
237 return ::std::result::Result::Ok(request);
238 }
239}
240#[derive(Debug)]
241struct StartWorkspacesEndpointParamsInterceptor;
242
243#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
244impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartWorkspacesEndpointParamsInterceptor {
245 fn name(&self) -> &'static str {
246 "StartWorkspacesEndpointParamsInterceptor"
247 }
248
249 fn read_before_execution(
250 &self,
251 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
252 '_,
253 ::aws_smithy_runtime_api::client::interceptors::context::Input,
254 ::aws_smithy_runtime_api::client::interceptors::context::Output,
255 ::aws_smithy_runtime_api::client::interceptors::context::Error,
256 >,
257 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
258 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
259 let _input = context
260 .input()
261 .downcast_ref::<StartWorkspacesInput>()
262 .ok_or("failed to downcast to StartWorkspacesInput")?;
263
264 let params = crate::config::endpoint::Params::builder()
265 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
266 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
267 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
268 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
269 .build()
270 .map_err(|err| {
271 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
272 })?;
273 cfg.interceptor_state()
274 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
275 ::std::result::Result::Ok(())
276 }
277}
278
279#[non_exhaustive]
284#[derive(::std::fmt::Debug)]
285pub enum StartWorkspacesError {
286 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
288 variable wildcard pattern and check `.code()`:
289 \
290 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
291 \
292 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-StartWorkspacesError) for what information is available for the error.")]
293 Unhandled(crate::error::sealed_unhandled::Unhandled),
294}
295impl StartWorkspacesError {
296 pub fn unhandled(
298 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
299 ) -> Self {
300 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
301 source: err.into(),
302 meta: ::std::default::Default::default(),
303 })
304 }
305
306 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
308 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
309 source: err.clone().into(),
310 meta: err,
311 })
312 }
313 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
318 match self {
319 Self::Unhandled(e) => &e.meta,
320 }
321 }
322}
323impl ::std::error::Error for StartWorkspacesError {
324 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
325 match self {
326 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
327 }
328 }
329}
330impl ::std::fmt::Display for StartWorkspacesError {
331 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
332 match self {
333 Self::Unhandled(_inner) => {
334 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
335 write!(f, "unhandled error ({code})")
336 } else {
337 f.write_str("unhandled error")
338 }
339 }
340 }
341 }
342}
343impl ::aws_smithy_types::retry::ProvideErrorKind for StartWorkspacesError {
344 fn code(&self) -> ::std::option::Option<&str> {
345 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
346 }
347 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
348 ::std::option::Option::None
349 }
350}
351impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for StartWorkspacesError {
352 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
353 match self {
354 Self::Unhandled(_inner) => &_inner.meta,
355 }
356 }
357}
358impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for StartWorkspacesError {
359 fn create_unhandled_error(
360 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
361 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
362 ) -> Self {
363 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
364 source,
365 meta: meta.unwrap_or_default(),
366 })
367 }
368}
369impl ::aws_types::request_id::RequestId for crate::operation::start_workspaces::StartWorkspacesError {
370 fn request_id(&self) -> Option<&str> {
371 self.meta().request_id()
372 }
373}
374
375pub use crate::operation::start_workspaces::_start_workspaces_input::StartWorkspacesInput;
376
377pub use crate::operation::start_workspaces::_start_workspaces_output::StartWorkspacesOutput;
378
379mod _start_workspaces_input;
380
381mod _start_workspaces_output;
382
383pub mod builders;