google_cloud_workstations_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Workstations API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_workstations_v1::client::Workstations;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = Workstations::builder().build().await?;
27/// let parent = "parent_value";
28/// let mut list = client.list_workstations()
29/// .set_parent(parent)
30/// .by_item();
31/// while let Some(item) = list.next().await.transpose()? {
32/// println!("{:?}", item);
33/// }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// Service for interacting with Cloud Workstations.
40///
41/// # Configuration
42///
43/// To configure `Workstations` use the `with_*` methods in the type returned
44/// by [builder()][Workstations::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48/// (`https://workstations.googleapis.com`). Applications using regional
49/// endpoints or running in restricted networks (e.g. a network configured
50// with [Private Google Access with VPC Service Controls]) may want to
51/// override this default.
52/// * [with_credentials()]: by default this client uses
53/// [Application Default Credentials]. Applications using custom
54/// authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::workstations::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::workstations::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `Workstations` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `Workstations` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct Workstations {
69 inner: std::sync::Arc<dyn super::stub::dynamic::Workstations>,
70}
71
72impl Workstations {
73 /// Returns a builder for [Workstations].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_workstations_v1::client::Workstations;
78 /// let client = Workstations::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::workstations::ClientBuilder {
82 crate::new_client_builder(super::builder::workstations::client::Factory)
83 }
84
85 /// Creates a new client from the provided stub.
86 ///
87 /// The most common case for calling this function is in tests mocking the
88 /// client's behavior.
89 pub fn from_stub<T>(stub: T) -> Self
90 where
91 T: super::stub::Workstations + 'static,
92 {
93 Self {
94 inner: std::sync::Arc::new(stub),
95 }
96 }
97
98 pub(crate) async fn new(
99 config: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<Self> {
101 let inner = Self::build_inner(config).await?;
102 Ok(Self { inner })
103 }
104
105 async fn build_inner(
106 conf: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Workstations>> {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> crate::ClientBuilderResult<impl super::stub::Workstations> {
117 super::transport::Workstations::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> crate::ClientBuilderResult<impl super::stub::Workstations> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::Workstations::new)
126 }
127
128 /// Returns the requested workstation cluster.
129 ///
130 /// # Example
131 /// ```
132 /// # use google_cloud_workstations_v1::client::Workstations;
133 /// use google_cloud_workstations_v1::Result;
134 /// async fn sample(
135 /// client: &Workstations, name: &str
136 /// ) -> Result<()> {
137 /// let response = client.get_workstation_cluster()
138 /// .set_name(name)
139 /// .send().await?;
140 /// println!("response {:?}", response);
141 /// Ok(())
142 /// }
143 /// ```
144 pub fn get_workstation_cluster(&self) -> super::builder::workstations::GetWorkstationCluster {
145 super::builder::workstations::GetWorkstationCluster::new(self.inner.clone())
146 }
147
148 /// Returns all workstation clusters in the specified location.
149 ///
150 /// # Example
151 /// ```
152 /// # use google_cloud_workstations_v1::client::Workstations;
153 /// use google_cloud_gax::paginator::ItemPaginator as _;
154 /// use google_cloud_workstations_v1::Result;
155 /// async fn sample(
156 /// client: &Workstations, parent: &str
157 /// ) -> Result<()> {
158 /// let mut list = client.list_workstation_clusters()
159 /// .set_parent(parent)
160 /// .by_item();
161 /// while let Some(item) = list.next().await.transpose()? {
162 /// println!("{:?}", item);
163 /// }
164 /// Ok(())
165 /// }
166 /// ```
167 pub fn list_workstation_clusters(
168 &self,
169 ) -> super::builder::workstations::ListWorkstationClusters {
170 super::builder::workstations::ListWorkstationClusters::new(self.inner.clone())
171 }
172
173 /// Creates a new workstation cluster.
174 ///
175 /// # Long running operations
176 ///
177 /// This method is used to start, and/or poll a [long-running Operation].
178 /// The [Working with long-running operations] chapter in the [user guide]
179 /// covers these operations in detail.
180 ///
181 /// [long-running operation]: https://google.aip.dev/151
182 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
183 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
184 ///
185 /// # Example
186 /// ```
187 /// # use google_cloud_workstations_v1::client::Workstations;
188 /// use google_cloud_lro::Poller;
189 /// use google_cloud_workstations_v1::model::WorkstationCluster;
190 /// use google_cloud_workstations_v1::Result;
191 /// async fn sample(
192 /// client: &Workstations, parent: &str
193 /// ) -> Result<()> {
194 /// let response = client.create_workstation_cluster()
195 /// .set_parent(parent)
196 /// .set_workstation_cluster(
197 /// WorkstationCluster::new()/* set fields */
198 /// )
199 /// .poller().until_done().await?;
200 /// println!("response {:?}", response);
201 /// Ok(())
202 /// }
203 /// ```
204 pub fn create_workstation_cluster(
205 &self,
206 ) -> super::builder::workstations::CreateWorkstationCluster {
207 super::builder::workstations::CreateWorkstationCluster::new(self.inner.clone())
208 }
209
210 /// Updates an existing workstation cluster.
211 ///
212 /// # Long running operations
213 ///
214 /// This method is used to start, and/or poll a [long-running Operation].
215 /// The [Working with long-running operations] chapter in the [user guide]
216 /// covers these operations in detail.
217 ///
218 /// [long-running operation]: https://google.aip.dev/151
219 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
220 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
221 ///
222 /// # Example
223 /// ```
224 /// # use google_cloud_workstations_v1::client::Workstations;
225 /// use google_cloud_lro::Poller;
226 /// # extern crate wkt as google_cloud_wkt;
227 /// use google_cloud_wkt::FieldMask;
228 /// use google_cloud_workstations_v1::model::WorkstationCluster;
229 /// use google_cloud_workstations_v1::Result;
230 /// async fn sample(
231 /// client: &Workstations, name: &str
232 /// ) -> Result<()> {
233 /// let response = client.update_workstation_cluster()
234 /// .set_workstation_cluster(
235 /// WorkstationCluster::new().set_name(name)/* set fields */
236 /// )
237 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
238 /// .poller().until_done().await?;
239 /// println!("response {:?}", response);
240 /// Ok(())
241 /// }
242 /// ```
243 pub fn update_workstation_cluster(
244 &self,
245 ) -> super::builder::workstations::UpdateWorkstationCluster {
246 super::builder::workstations::UpdateWorkstationCluster::new(self.inner.clone())
247 }
248
249 /// Deletes the specified workstation cluster.
250 ///
251 /// # Long running operations
252 ///
253 /// This method is used to start, and/or poll a [long-running Operation].
254 /// The [Working with long-running operations] chapter in the [user guide]
255 /// covers these operations in detail.
256 ///
257 /// [long-running operation]: https://google.aip.dev/151
258 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
259 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
260 ///
261 /// # Example
262 /// ```
263 /// # use google_cloud_workstations_v1::client::Workstations;
264 /// use google_cloud_lro::Poller;
265 /// use google_cloud_workstations_v1::Result;
266 /// async fn sample(
267 /// client: &Workstations, name: &str
268 /// ) -> Result<()> {
269 /// let response = client.delete_workstation_cluster()
270 /// .set_name(name)
271 /// .poller().until_done().await?;
272 /// println!("response {:?}", response);
273 /// Ok(())
274 /// }
275 /// ```
276 pub fn delete_workstation_cluster(
277 &self,
278 ) -> super::builder::workstations::DeleteWorkstationCluster {
279 super::builder::workstations::DeleteWorkstationCluster::new(self.inner.clone())
280 }
281
282 /// Returns the requested workstation configuration.
283 ///
284 /// # Example
285 /// ```
286 /// # use google_cloud_workstations_v1::client::Workstations;
287 /// use google_cloud_workstations_v1::Result;
288 /// async fn sample(
289 /// client: &Workstations, name: &str
290 /// ) -> Result<()> {
291 /// let response = client.get_workstation_config()
292 /// .set_name(name)
293 /// .send().await?;
294 /// println!("response {:?}", response);
295 /// Ok(())
296 /// }
297 /// ```
298 pub fn get_workstation_config(&self) -> super::builder::workstations::GetWorkstationConfig {
299 super::builder::workstations::GetWorkstationConfig::new(self.inner.clone())
300 }
301
302 /// Returns all workstation configurations in the specified cluster.
303 ///
304 /// # Example
305 /// ```
306 /// # use google_cloud_workstations_v1::client::Workstations;
307 /// use google_cloud_gax::paginator::ItemPaginator as _;
308 /// use google_cloud_workstations_v1::Result;
309 /// async fn sample(
310 /// client: &Workstations, parent: &str
311 /// ) -> Result<()> {
312 /// let mut list = client.list_workstation_configs()
313 /// .set_parent(parent)
314 /// .by_item();
315 /// while let Some(item) = list.next().await.transpose()? {
316 /// println!("{:?}", item);
317 /// }
318 /// Ok(())
319 /// }
320 /// ```
321 pub fn list_workstation_configs(&self) -> super::builder::workstations::ListWorkstationConfigs {
322 super::builder::workstations::ListWorkstationConfigs::new(self.inner.clone())
323 }
324
325 /// Returns all workstation configurations in the specified cluster on which
326 /// the caller has the "workstations.workstation.create" permission.
327 ///
328 /// # Example
329 /// ```
330 /// # use google_cloud_workstations_v1::client::Workstations;
331 /// use google_cloud_gax::paginator::ItemPaginator as _;
332 /// use google_cloud_workstations_v1::Result;
333 /// async fn sample(
334 /// client: &Workstations, parent: &str
335 /// ) -> Result<()> {
336 /// let mut list = client.list_usable_workstation_configs()
337 /// .set_parent(parent)
338 /// .by_item();
339 /// while let Some(item) = list.next().await.transpose()? {
340 /// println!("{:?}", item);
341 /// }
342 /// Ok(())
343 /// }
344 /// ```
345 pub fn list_usable_workstation_configs(
346 &self,
347 ) -> super::builder::workstations::ListUsableWorkstationConfigs {
348 super::builder::workstations::ListUsableWorkstationConfigs::new(self.inner.clone())
349 }
350
351 /// Creates a new workstation configuration.
352 ///
353 /// # Long running operations
354 ///
355 /// This method is used to start, and/or poll a [long-running Operation].
356 /// The [Working with long-running operations] chapter in the [user guide]
357 /// covers these operations in detail.
358 ///
359 /// [long-running operation]: https://google.aip.dev/151
360 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
361 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
362 ///
363 /// # Example
364 /// ```
365 /// # use google_cloud_workstations_v1::client::Workstations;
366 /// use google_cloud_lro::Poller;
367 /// use google_cloud_workstations_v1::model::WorkstationConfig;
368 /// use google_cloud_workstations_v1::Result;
369 /// async fn sample(
370 /// client: &Workstations, parent: &str
371 /// ) -> Result<()> {
372 /// let response = client.create_workstation_config()
373 /// .set_parent(parent)
374 /// .set_workstation_config(
375 /// WorkstationConfig::new()/* set fields */
376 /// )
377 /// .poller().until_done().await?;
378 /// println!("response {:?}", response);
379 /// Ok(())
380 /// }
381 /// ```
382 pub fn create_workstation_config(
383 &self,
384 ) -> super::builder::workstations::CreateWorkstationConfig {
385 super::builder::workstations::CreateWorkstationConfig::new(self.inner.clone())
386 }
387
388 /// Updates an existing workstation configuration.
389 ///
390 /// # Long running operations
391 ///
392 /// This method is used to start, and/or poll a [long-running Operation].
393 /// The [Working with long-running operations] chapter in the [user guide]
394 /// covers these operations in detail.
395 ///
396 /// [long-running operation]: https://google.aip.dev/151
397 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
398 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
399 ///
400 /// # Example
401 /// ```
402 /// # use google_cloud_workstations_v1::client::Workstations;
403 /// use google_cloud_lro::Poller;
404 /// # extern crate wkt as google_cloud_wkt;
405 /// use google_cloud_wkt::FieldMask;
406 /// use google_cloud_workstations_v1::model::WorkstationConfig;
407 /// use google_cloud_workstations_v1::Result;
408 /// async fn sample(
409 /// client: &Workstations, name: &str
410 /// ) -> Result<()> {
411 /// let response = client.update_workstation_config()
412 /// .set_workstation_config(
413 /// WorkstationConfig::new().set_name(name)/* set fields */
414 /// )
415 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
416 /// .poller().until_done().await?;
417 /// println!("response {:?}", response);
418 /// Ok(())
419 /// }
420 /// ```
421 pub fn update_workstation_config(
422 &self,
423 ) -> super::builder::workstations::UpdateWorkstationConfig {
424 super::builder::workstations::UpdateWorkstationConfig::new(self.inner.clone())
425 }
426
427 /// Deletes the specified workstation configuration.
428 ///
429 /// # Long running operations
430 ///
431 /// This method is used to start, and/or poll a [long-running Operation].
432 /// The [Working with long-running operations] chapter in the [user guide]
433 /// covers these operations in detail.
434 ///
435 /// [long-running operation]: https://google.aip.dev/151
436 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
437 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
438 ///
439 /// # Example
440 /// ```
441 /// # use google_cloud_workstations_v1::client::Workstations;
442 /// use google_cloud_lro::Poller;
443 /// use google_cloud_workstations_v1::Result;
444 /// async fn sample(
445 /// client: &Workstations, name: &str
446 /// ) -> Result<()> {
447 /// let response = client.delete_workstation_config()
448 /// .set_name(name)
449 /// .poller().until_done().await?;
450 /// println!("response {:?}", response);
451 /// Ok(())
452 /// }
453 /// ```
454 pub fn delete_workstation_config(
455 &self,
456 ) -> super::builder::workstations::DeleteWorkstationConfig {
457 super::builder::workstations::DeleteWorkstationConfig::new(self.inner.clone())
458 }
459
460 /// Returns the requested workstation.
461 ///
462 /// # Example
463 /// ```
464 /// # use google_cloud_workstations_v1::client::Workstations;
465 /// use google_cloud_workstations_v1::Result;
466 /// async fn sample(
467 /// client: &Workstations, name: &str
468 /// ) -> Result<()> {
469 /// let response = client.get_workstation()
470 /// .set_name(name)
471 /// .send().await?;
472 /// println!("response {:?}", response);
473 /// Ok(())
474 /// }
475 /// ```
476 pub fn get_workstation(&self) -> super::builder::workstations::GetWorkstation {
477 super::builder::workstations::GetWorkstation::new(self.inner.clone())
478 }
479
480 /// Returns all Workstations using the specified workstation configuration.
481 ///
482 /// # Example
483 /// ```
484 /// # use google_cloud_workstations_v1::client::Workstations;
485 /// use google_cloud_gax::paginator::ItemPaginator as _;
486 /// use google_cloud_workstations_v1::Result;
487 /// async fn sample(
488 /// client: &Workstations, parent: &str
489 /// ) -> Result<()> {
490 /// let mut list = client.list_workstations()
491 /// .set_parent(parent)
492 /// .by_item();
493 /// while let Some(item) = list.next().await.transpose()? {
494 /// println!("{:?}", item);
495 /// }
496 /// Ok(())
497 /// }
498 /// ```
499 pub fn list_workstations(&self) -> super::builder::workstations::ListWorkstations {
500 super::builder::workstations::ListWorkstations::new(self.inner.clone())
501 }
502
503 /// Returns all workstations using the specified workstation configuration
504 /// on which the caller has the "workstations.workstations.use" permission.
505 ///
506 /// # Example
507 /// ```
508 /// # use google_cloud_workstations_v1::client::Workstations;
509 /// use google_cloud_gax::paginator::ItemPaginator as _;
510 /// use google_cloud_workstations_v1::Result;
511 /// async fn sample(
512 /// client: &Workstations, parent: &str
513 /// ) -> Result<()> {
514 /// let mut list = client.list_usable_workstations()
515 /// .set_parent(parent)
516 /// .by_item();
517 /// while let Some(item) = list.next().await.transpose()? {
518 /// println!("{:?}", item);
519 /// }
520 /// Ok(())
521 /// }
522 /// ```
523 pub fn list_usable_workstations(&self) -> super::builder::workstations::ListUsableWorkstations {
524 super::builder::workstations::ListUsableWorkstations::new(self.inner.clone())
525 }
526
527 /// Creates a new workstation.
528 ///
529 /// # Long running operations
530 ///
531 /// This method is used to start, and/or poll a [long-running Operation].
532 /// The [Working with long-running operations] chapter in the [user guide]
533 /// covers these operations in detail.
534 ///
535 /// [long-running operation]: https://google.aip.dev/151
536 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
537 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
538 ///
539 /// # Example
540 /// ```
541 /// # use google_cloud_workstations_v1::client::Workstations;
542 /// use google_cloud_lro::Poller;
543 /// use google_cloud_workstations_v1::model::Workstation;
544 /// use google_cloud_workstations_v1::Result;
545 /// async fn sample(
546 /// client: &Workstations, parent: &str
547 /// ) -> Result<()> {
548 /// let response = client.create_workstation()
549 /// .set_parent(parent)
550 /// .set_workstation_id("workstation_id_value")
551 /// .set_workstation(
552 /// Workstation::new()/* set fields */
553 /// )
554 /// .poller().until_done().await?;
555 /// println!("response {:?}", response);
556 /// Ok(())
557 /// }
558 /// ```
559 pub fn create_workstation(&self) -> super::builder::workstations::CreateWorkstation {
560 super::builder::workstations::CreateWorkstation::new(self.inner.clone())
561 }
562
563 /// Updates an existing workstation.
564 ///
565 /// # Long running operations
566 ///
567 /// This method is used to start, and/or poll a [long-running Operation].
568 /// The [Working with long-running operations] chapter in the [user guide]
569 /// covers these operations in detail.
570 ///
571 /// [long-running operation]: https://google.aip.dev/151
572 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
573 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
574 ///
575 /// # Example
576 /// ```
577 /// # use google_cloud_workstations_v1::client::Workstations;
578 /// use google_cloud_lro::Poller;
579 /// # extern crate wkt as google_cloud_wkt;
580 /// use google_cloud_wkt::FieldMask;
581 /// use google_cloud_workstations_v1::model::Workstation;
582 /// use google_cloud_workstations_v1::Result;
583 /// async fn sample(
584 /// client: &Workstations, name: &str
585 /// ) -> Result<()> {
586 /// let response = client.update_workstation()
587 /// .set_workstation(
588 /// Workstation::new().set_name(name)/* set fields */
589 /// )
590 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
591 /// .poller().until_done().await?;
592 /// println!("response {:?}", response);
593 /// Ok(())
594 /// }
595 /// ```
596 pub fn update_workstation(&self) -> super::builder::workstations::UpdateWorkstation {
597 super::builder::workstations::UpdateWorkstation::new(self.inner.clone())
598 }
599
600 /// Deletes the specified workstation.
601 ///
602 /// # Long running operations
603 ///
604 /// This method is used to start, and/or poll a [long-running Operation].
605 /// The [Working with long-running operations] chapter in the [user guide]
606 /// covers these operations in detail.
607 ///
608 /// [long-running operation]: https://google.aip.dev/151
609 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
610 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
611 ///
612 /// # Example
613 /// ```
614 /// # use google_cloud_workstations_v1::client::Workstations;
615 /// use google_cloud_lro::Poller;
616 /// use google_cloud_workstations_v1::Result;
617 /// async fn sample(
618 /// client: &Workstations, name: &str
619 /// ) -> Result<()> {
620 /// let response = client.delete_workstation()
621 /// .set_name(name)
622 /// .poller().until_done().await?;
623 /// println!("response {:?}", response);
624 /// Ok(())
625 /// }
626 /// ```
627 pub fn delete_workstation(&self) -> super::builder::workstations::DeleteWorkstation {
628 super::builder::workstations::DeleteWorkstation::new(self.inner.clone())
629 }
630
631 /// Starts running a workstation so that users can connect to it.
632 ///
633 /// # Long running operations
634 ///
635 /// This method is used to start, and/or poll a [long-running Operation].
636 /// The [Working with long-running operations] chapter in the [user guide]
637 /// covers these operations in detail.
638 ///
639 /// [long-running operation]: https://google.aip.dev/151
640 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
641 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
642 ///
643 /// # Example
644 /// ```
645 /// # use google_cloud_workstations_v1::client::Workstations;
646 /// use google_cloud_lro::Poller;
647 /// use google_cloud_workstations_v1::Result;
648 /// async fn sample(
649 /// client: &Workstations
650 /// ) -> Result<()> {
651 /// let response = client.start_workstation()
652 /// /* set fields */
653 /// .poller().until_done().await?;
654 /// println!("response {:?}", response);
655 /// Ok(())
656 /// }
657 /// ```
658 pub fn start_workstation(&self) -> super::builder::workstations::StartWorkstation {
659 super::builder::workstations::StartWorkstation::new(self.inner.clone())
660 }
661
662 /// Stops running a workstation, reducing costs.
663 ///
664 /// # Long running operations
665 ///
666 /// This method is used to start, and/or poll a [long-running Operation].
667 /// The [Working with long-running operations] chapter in the [user guide]
668 /// covers these operations in detail.
669 ///
670 /// [long-running operation]: https://google.aip.dev/151
671 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
672 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
673 ///
674 /// # Example
675 /// ```
676 /// # use google_cloud_workstations_v1::client::Workstations;
677 /// use google_cloud_lro::Poller;
678 /// use google_cloud_workstations_v1::Result;
679 /// async fn sample(
680 /// client: &Workstations
681 /// ) -> Result<()> {
682 /// let response = client.stop_workstation()
683 /// /* set fields */
684 /// .poller().until_done().await?;
685 /// println!("response {:?}", response);
686 /// Ok(())
687 /// }
688 /// ```
689 pub fn stop_workstation(&self) -> super::builder::workstations::StopWorkstation {
690 super::builder::workstations::StopWorkstation::new(self.inner.clone())
691 }
692
693 /// Returns a short-lived credential that can be used to send authenticated and
694 /// authorized traffic to a workstation.
695 ///
696 /// # Example
697 /// ```
698 /// # use google_cloud_workstations_v1::client::Workstations;
699 /// use google_cloud_workstations_v1::Result;
700 /// async fn sample(
701 /// client: &Workstations
702 /// ) -> Result<()> {
703 /// let response = client.generate_access_token()
704 /// /* set fields */
705 /// .send().await?;
706 /// println!("response {:?}", response);
707 /// Ok(())
708 /// }
709 /// ```
710 pub fn generate_access_token(&self) -> super::builder::workstations::GenerateAccessToken {
711 super::builder::workstations::GenerateAccessToken::new(self.inner.clone())
712 }
713
714 /// Sets the access control policy on the specified resource. Replaces
715 /// any existing policy.
716 ///
717 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
718 /// errors.
719 ///
720 /// # Example
721 /// ```
722 /// # use google_cloud_workstations_v1::client::Workstations;
723 /// use google_cloud_workstations_v1::Result;
724 /// async fn sample(
725 /// client: &Workstations
726 /// ) -> Result<()> {
727 /// let response = client.set_iam_policy()
728 /// /* set fields */
729 /// .send().await?;
730 /// println!("response {:?}", response);
731 /// Ok(())
732 /// }
733 /// ```
734 pub fn set_iam_policy(&self) -> super::builder::workstations::SetIamPolicy {
735 super::builder::workstations::SetIamPolicy::new(self.inner.clone())
736 }
737
738 /// Gets the access control policy for a resource. Returns an empty policy
739 /// if the resource exists and does not have a policy set.
740 ///
741 /// # Example
742 /// ```
743 /// # use google_cloud_workstations_v1::client::Workstations;
744 /// use google_cloud_workstations_v1::Result;
745 /// async fn sample(
746 /// client: &Workstations
747 /// ) -> Result<()> {
748 /// let response = client.get_iam_policy()
749 /// /* set fields */
750 /// .send().await?;
751 /// println!("response {:?}", response);
752 /// Ok(())
753 /// }
754 /// ```
755 pub fn get_iam_policy(&self) -> super::builder::workstations::GetIamPolicy {
756 super::builder::workstations::GetIamPolicy::new(self.inner.clone())
757 }
758
759 /// Returns permissions that a caller has on the specified resource. If the
760 /// resource does not exist, this will return an empty set of
761 /// permissions, not a `NOT_FOUND` error.
762 ///
763 /// Note: This operation is designed to be used for building
764 /// permission-aware UIs and command-line tools, not for authorization
765 /// checking. This operation may "fail open" without warning.
766 ///
767 /// # Example
768 /// ```
769 /// # use google_cloud_workstations_v1::client::Workstations;
770 /// use google_cloud_workstations_v1::Result;
771 /// async fn sample(
772 /// client: &Workstations
773 /// ) -> Result<()> {
774 /// let response = client.test_iam_permissions()
775 /// /* set fields */
776 /// .send().await?;
777 /// println!("response {:?}", response);
778 /// Ok(())
779 /// }
780 /// ```
781 pub fn test_iam_permissions(&self) -> super::builder::workstations::TestIamPermissions {
782 super::builder::workstations::TestIamPermissions::new(self.inner.clone())
783 }
784
785 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
786 ///
787 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
788 ///
789 /// # Example
790 /// ```
791 /// # use google_cloud_workstations_v1::client::Workstations;
792 /// use google_cloud_gax::paginator::ItemPaginator as _;
793 /// use google_cloud_workstations_v1::Result;
794 /// async fn sample(
795 /// client: &Workstations
796 /// ) -> Result<()> {
797 /// let mut list = client.list_operations()
798 /// /* set fields */
799 /// .by_item();
800 /// while let Some(item) = list.next().await.transpose()? {
801 /// println!("{:?}", item);
802 /// }
803 /// Ok(())
804 /// }
805 /// ```
806 pub fn list_operations(&self) -> super::builder::workstations::ListOperations {
807 super::builder::workstations::ListOperations::new(self.inner.clone())
808 }
809
810 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
811 ///
812 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
813 ///
814 /// # Example
815 /// ```
816 /// # use google_cloud_workstations_v1::client::Workstations;
817 /// use google_cloud_workstations_v1::Result;
818 /// async fn sample(
819 /// client: &Workstations
820 /// ) -> Result<()> {
821 /// let response = client.get_operation()
822 /// /* set fields */
823 /// .send().await?;
824 /// println!("response {:?}", response);
825 /// Ok(())
826 /// }
827 /// ```
828 pub fn get_operation(&self) -> super::builder::workstations::GetOperation {
829 super::builder::workstations::GetOperation::new(self.inner.clone())
830 }
831
832 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
833 ///
834 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
835 ///
836 /// # Example
837 /// ```
838 /// # use google_cloud_workstations_v1::client::Workstations;
839 /// use google_cloud_workstations_v1::Result;
840 /// async fn sample(
841 /// client: &Workstations
842 /// ) -> Result<()> {
843 /// client.delete_operation()
844 /// /* set fields */
845 /// .send().await?;
846 /// Ok(())
847 /// }
848 /// ```
849 pub fn delete_operation(&self) -> super::builder::workstations::DeleteOperation {
850 super::builder::workstations::DeleteOperation::new(self.inner.clone())
851 }
852
853 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
854 ///
855 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
856 ///
857 /// # Example
858 /// ```
859 /// # use google_cloud_workstations_v1::client::Workstations;
860 /// use google_cloud_workstations_v1::Result;
861 /// async fn sample(
862 /// client: &Workstations
863 /// ) -> Result<()> {
864 /// client.cancel_operation()
865 /// /* set fields */
866 /// .send().await?;
867 /// Ok(())
868 /// }
869 /// ```
870 pub fn cancel_operation(&self) -> super::builder::workstations::CancelOperation {
871 super::builder::workstations::CancelOperation::new(self.inner.clone())
872 }
873}