Skip to main content

google_cloud_workstations_v1/
builder.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
17/// Request and client builders for [Workstations][crate::client::Workstations].
18pub mod workstations {
19    use crate::Result;
20
21    /// A builder for [Workstations][crate::client::Workstations].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_workstations_v1::*;
26    /// # use builder::workstations::ClientBuilder;
27    /// # use client::Workstations;
28    /// let builder : ClientBuilder = Workstations::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://workstations.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::Workstations;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = Workstations;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::Workstations] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
55        request: R,
56        options: crate::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [Workstations::get_workstation_cluster][crate::client::Workstations::get_workstation_cluster] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_workstations_v1::builder::workstations::GetWorkstationCluster;
79    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> GetWorkstationCluster {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct GetWorkstationCluster(RequestBuilder<crate::model::GetWorkstationClusterRequest>);
92
93    impl GetWorkstationCluster {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
96        ) -> Self {
97            Self(RequestBuilder::new(stub))
98        }
99
100        /// Sets the full request, replacing any prior values.
101        pub fn with_request<V: Into<crate::model::GetWorkstationClusterRequest>>(
102            mut self,
103            v: V,
104        ) -> Self {
105            self.0.request = v.into();
106            self
107        }
108
109        /// Sets all the options, replacing any prior values.
110        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111            self.0.options = v.into();
112            self
113        }
114
115        /// Sends the request.
116        pub async fn send(self) -> Result<crate::model::WorkstationCluster> {
117            (*self.0.stub)
118                .get_workstation_cluster(self.0.request, self.0.options)
119                .await
120                .map(crate::Response::into_body)
121        }
122
123        /// Sets the value of [name][crate::model::GetWorkstationClusterRequest::name].
124        ///
125        /// This is a **required** field for requests.
126        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
127            self.0.request.name = v.into();
128            self
129        }
130    }
131
132    #[doc(hidden)]
133    impl crate::RequestBuilder for GetWorkstationCluster {
134        fn request_options(&mut self) -> &mut crate::RequestOptions {
135            &mut self.0.options
136        }
137    }
138
139    /// The request builder for [Workstations::list_workstation_clusters][crate::client::Workstations::list_workstation_clusters] calls.
140    ///
141    /// # Example
142    /// ```
143    /// # use google_cloud_workstations_v1::builder::workstations::ListWorkstationClusters;
144    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
145    /// use google_cloud_gax::paginator::ItemPaginator;
146    ///
147    /// let builder = prepare_request_builder();
148    /// let mut items = builder.by_item();
149    /// while let Some(result) = items.next().await {
150    ///   let item = result?;
151    /// }
152    /// # Ok(()) }
153    ///
154    /// fn prepare_request_builder() -> ListWorkstationClusters {
155    ///   # panic!();
156    ///   // ... details omitted ...
157    /// }
158    /// ```
159    #[derive(Clone, Debug)]
160    pub struct ListWorkstationClusters(
161        RequestBuilder<crate::model::ListWorkstationClustersRequest>,
162    );
163
164    impl ListWorkstationClusters {
165        pub(crate) fn new(
166            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
167        ) -> Self {
168            Self(RequestBuilder::new(stub))
169        }
170
171        /// Sets the full request, replacing any prior values.
172        pub fn with_request<V: Into<crate::model::ListWorkstationClustersRequest>>(
173            mut self,
174            v: V,
175        ) -> Self {
176            self.0.request = v.into();
177            self
178        }
179
180        /// Sets all the options, replacing any prior values.
181        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
182            self.0.options = v.into();
183            self
184        }
185
186        /// Sends the request.
187        pub async fn send(self) -> Result<crate::model::ListWorkstationClustersResponse> {
188            (*self.0.stub)
189                .list_workstation_clusters(self.0.request, self.0.options)
190                .await
191                .map(crate::Response::into_body)
192        }
193
194        /// Streams each page in the collection.
195        pub fn by_page(
196            self,
197        ) -> impl google_cloud_gax::paginator::Paginator<
198            crate::model::ListWorkstationClustersResponse,
199            crate::Error,
200        > {
201            use std::clone::Clone;
202            let token = self.0.request.page_token.clone();
203            let execute = move |token: String| {
204                let mut builder = self.clone();
205                builder.0.request = builder.0.request.set_page_token(token);
206                builder.send()
207            };
208            google_cloud_gax::paginator::internal::new_paginator(token, execute)
209        }
210
211        /// Streams each item in the collection.
212        pub fn by_item(
213            self,
214        ) -> impl google_cloud_gax::paginator::ItemPaginator<
215            crate::model::ListWorkstationClustersResponse,
216            crate::Error,
217        > {
218            use google_cloud_gax::paginator::Paginator;
219            self.by_page().items()
220        }
221
222        /// Sets the value of [parent][crate::model::ListWorkstationClustersRequest::parent].
223        ///
224        /// This is a **required** field for requests.
225        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
226            self.0.request.parent = v.into();
227            self
228        }
229
230        /// Sets the value of [page_size][crate::model::ListWorkstationClustersRequest::page_size].
231        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
232            self.0.request.page_size = v.into();
233            self
234        }
235
236        /// Sets the value of [page_token][crate::model::ListWorkstationClustersRequest::page_token].
237        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.page_token = v.into();
239            self
240        }
241
242        /// Sets the value of [filter][crate::model::ListWorkstationClustersRequest::filter].
243        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.filter = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl crate::RequestBuilder for ListWorkstationClusters {
251        fn request_options(&mut self) -> &mut crate::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [Workstations::create_workstation_cluster][crate::client::Workstations::create_workstation_cluster] calls.
257    ///
258    /// # Example
259    /// ```
260    /// # use google_cloud_workstations_v1::builder::workstations::CreateWorkstationCluster;
261    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
262    /// use google_cloud_lro::Poller;
263    ///
264    /// let builder = prepare_request_builder();
265    /// let response = builder.poller().until_done().await?;
266    /// # Ok(()) }
267    ///
268    /// fn prepare_request_builder() -> CreateWorkstationCluster {
269    ///   # panic!();
270    ///   // ... details omitted ...
271    /// }
272    /// ```
273    #[derive(Clone, Debug)]
274    pub struct CreateWorkstationCluster(
275        RequestBuilder<crate::model::CreateWorkstationClusterRequest>,
276    );
277
278    impl CreateWorkstationCluster {
279        pub(crate) fn new(
280            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
281        ) -> Self {
282            Self(RequestBuilder::new(stub))
283        }
284
285        /// Sets the full request, replacing any prior values.
286        pub fn with_request<V: Into<crate::model::CreateWorkstationClusterRequest>>(
287            mut self,
288            v: V,
289        ) -> Self {
290            self.0.request = v.into();
291            self
292        }
293
294        /// Sets all the options, replacing any prior values.
295        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
296            self.0.options = v.into();
297            self
298        }
299
300        /// Sends the request.
301        ///
302        /// # Long running operations
303        ///
304        /// This starts, but does not poll, a longrunning operation. More information
305        /// on [create_workstation_cluster][crate::client::Workstations::create_workstation_cluster].
306        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
307            (*self.0.stub)
308                .create_workstation_cluster(self.0.request, self.0.options)
309                .await
310                .map(crate::Response::into_body)
311        }
312
313        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_workstation_cluster`.
314        pub fn poller(
315            self,
316        ) -> impl google_cloud_lro::Poller<
317            crate::model::WorkstationCluster,
318            crate::model::OperationMetadata,
319        > {
320            type Operation = google_cloud_lro::internal::Operation<
321                crate::model::WorkstationCluster,
322                crate::model::OperationMetadata,
323            >;
324            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
325            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
326            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
327            if let Some(ref mut details) = poller_options.tracing {
328                details.method_name = "google_cloud_workstations_v1::client::Workstations::create_workstation_cluster::until_done";
329            }
330
331            let stub = self.0.stub.clone();
332            let mut options = self.0.options.clone();
333            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
334            let query = move |name| {
335                let stub = stub.clone();
336                let options = options.clone();
337                async {
338                    let op = GetOperation::new(stub)
339                        .set_name(name)
340                        .with_options(options)
341                        .send()
342                        .await?;
343                    Ok(Operation::new(op))
344                }
345            };
346
347            let start = move || async {
348                let op = self.send().await?;
349                Ok(Operation::new(op))
350            };
351
352            use google_cloud_lro::internal::PollerExt;
353            {
354                google_cloud_lro::internal::new_poller(
355                    polling_error_policy,
356                    polling_backoff_policy,
357                    start,
358                    query,
359                )
360            }
361            .with_options(poller_options)
362        }
363
364        /// Sets the value of [parent][crate::model::CreateWorkstationClusterRequest::parent].
365        ///
366        /// This is a **required** field for requests.
367        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
368            self.0.request.parent = v.into();
369            self
370        }
371
372        /// Sets the value of [workstation_cluster_id][crate::model::CreateWorkstationClusterRequest::workstation_cluster_id].
373        ///
374        /// This is a **required** field for requests.
375        pub fn set_workstation_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
376            self.0.request.workstation_cluster_id = v.into();
377            self
378        }
379
380        /// Sets the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
381        ///
382        /// This is a **required** field for requests.
383        pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
384        where
385            T: std::convert::Into<crate::model::WorkstationCluster>,
386        {
387            self.0.request.workstation_cluster = std::option::Option::Some(v.into());
388            self
389        }
390
391        /// Sets or clears the value of [workstation_cluster][crate::model::CreateWorkstationClusterRequest::workstation_cluster].
392        ///
393        /// This is a **required** field for requests.
394        pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
395        where
396            T: std::convert::Into<crate::model::WorkstationCluster>,
397        {
398            self.0.request.workstation_cluster = v.map(|x| x.into());
399            self
400        }
401
402        /// Sets the value of [validate_only][crate::model::CreateWorkstationClusterRequest::validate_only].
403        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
404            self.0.request.validate_only = v.into();
405            self
406        }
407    }
408
409    #[doc(hidden)]
410    impl crate::RequestBuilder for CreateWorkstationCluster {
411        fn request_options(&mut self) -> &mut crate::RequestOptions {
412            &mut self.0.options
413        }
414    }
415
416    /// The request builder for [Workstations::update_workstation_cluster][crate::client::Workstations::update_workstation_cluster] calls.
417    ///
418    /// # Example
419    /// ```
420    /// # use google_cloud_workstations_v1::builder::workstations::UpdateWorkstationCluster;
421    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
422    /// use google_cloud_lro::Poller;
423    ///
424    /// let builder = prepare_request_builder();
425    /// let response = builder.poller().until_done().await?;
426    /// # Ok(()) }
427    ///
428    /// fn prepare_request_builder() -> UpdateWorkstationCluster {
429    ///   # panic!();
430    ///   // ... details omitted ...
431    /// }
432    /// ```
433    #[derive(Clone, Debug)]
434    pub struct UpdateWorkstationCluster(
435        RequestBuilder<crate::model::UpdateWorkstationClusterRequest>,
436    );
437
438    impl UpdateWorkstationCluster {
439        pub(crate) fn new(
440            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
441        ) -> Self {
442            Self(RequestBuilder::new(stub))
443        }
444
445        /// Sets the full request, replacing any prior values.
446        pub fn with_request<V: Into<crate::model::UpdateWorkstationClusterRequest>>(
447            mut self,
448            v: V,
449        ) -> Self {
450            self.0.request = v.into();
451            self
452        }
453
454        /// Sets all the options, replacing any prior values.
455        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
456            self.0.options = v.into();
457            self
458        }
459
460        /// Sends the request.
461        ///
462        /// # Long running operations
463        ///
464        /// This starts, but does not poll, a longrunning operation. More information
465        /// on [update_workstation_cluster][crate::client::Workstations::update_workstation_cluster].
466        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
467            (*self.0.stub)
468                .update_workstation_cluster(self.0.request, self.0.options)
469                .await
470                .map(crate::Response::into_body)
471        }
472
473        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_workstation_cluster`.
474        pub fn poller(
475            self,
476        ) -> impl google_cloud_lro::Poller<
477            crate::model::WorkstationCluster,
478            crate::model::OperationMetadata,
479        > {
480            type Operation = google_cloud_lro::internal::Operation<
481                crate::model::WorkstationCluster,
482                crate::model::OperationMetadata,
483            >;
484            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
485            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
486            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
487            if let Some(ref mut details) = poller_options.tracing {
488                details.method_name = "google_cloud_workstations_v1::client::Workstations::update_workstation_cluster::until_done";
489            }
490
491            let stub = self.0.stub.clone();
492            let mut options = self.0.options.clone();
493            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
494            let query = move |name| {
495                let stub = stub.clone();
496                let options = options.clone();
497                async {
498                    let op = GetOperation::new(stub)
499                        .set_name(name)
500                        .with_options(options)
501                        .send()
502                        .await?;
503                    Ok(Operation::new(op))
504                }
505            };
506
507            let start = move || async {
508                let op = self.send().await?;
509                Ok(Operation::new(op))
510            };
511
512            use google_cloud_lro::internal::PollerExt;
513            {
514                google_cloud_lro::internal::new_poller(
515                    polling_error_policy,
516                    polling_backoff_policy,
517                    start,
518                    query,
519                )
520            }
521            .with_options(poller_options)
522        }
523
524        /// Sets the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
525        ///
526        /// This is a **required** field for requests.
527        pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
528        where
529            T: std::convert::Into<crate::model::WorkstationCluster>,
530        {
531            self.0.request.workstation_cluster = std::option::Option::Some(v.into());
532            self
533        }
534
535        /// Sets or clears the value of [workstation_cluster][crate::model::UpdateWorkstationClusterRequest::workstation_cluster].
536        ///
537        /// This is a **required** field for requests.
538        pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
539        where
540            T: std::convert::Into<crate::model::WorkstationCluster>,
541        {
542            self.0.request.workstation_cluster = v.map(|x| x.into());
543            self
544        }
545
546        /// Sets the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
547        ///
548        /// This is a **required** field for requests.
549        pub fn set_update_mask<T>(mut self, v: T) -> Self
550        where
551            T: std::convert::Into<wkt::FieldMask>,
552        {
553            self.0.request.update_mask = std::option::Option::Some(v.into());
554            self
555        }
556
557        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationClusterRequest::update_mask].
558        ///
559        /// This is a **required** field for requests.
560        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
561        where
562            T: std::convert::Into<wkt::FieldMask>,
563        {
564            self.0.request.update_mask = v.map(|x| x.into());
565            self
566        }
567
568        /// Sets the value of [validate_only][crate::model::UpdateWorkstationClusterRequest::validate_only].
569        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
570            self.0.request.validate_only = v.into();
571            self
572        }
573
574        /// Sets the value of [allow_missing][crate::model::UpdateWorkstationClusterRequest::allow_missing].
575        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
576            self.0.request.allow_missing = v.into();
577            self
578        }
579    }
580
581    #[doc(hidden)]
582    impl crate::RequestBuilder for UpdateWorkstationCluster {
583        fn request_options(&mut self) -> &mut crate::RequestOptions {
584            &mut self.0.options
585        }
586    }
587
588    /// The request builder for [Workstations::delete_workstation_cluster][crate::client::Workstations::delete_workstation_cluster] calls.
589    ///
590    /// # Example
591    /// ```
592    /// # use google_cloud_workstations_v1::builder::workstations::DeleteWorkstationCluster;
593    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
594    /// use google_cloud_lro::Poller;
595    ///
596    /// let builder = prepare_request_builder();
597    /// let response = builder.poller().until_done().await?;
598    /// # Ok(()) }
599    ///
600    /// fn prepare_request_builder() -> DeleteWorkstationCluster {
601    ///   # panic!();
602    ///   // ... details omitted ...
603    /// }
604    /// ```
605    #[derive(Clone, Debug)]
606    pub struct DeleteWorkstationCluster(
607        RequestBuilder<crate::model::DeleteWorkstationClusterRequest>,
608    );
609
610    impl DeleteWorkstationCluster {
611        pub(crate) fn new(
612            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
613        ) -> Self {
614            Self(RequestBuilder::new(stub))
615        }
616
617        /// Sets the full request, replacing any prior values.
618        pub fn with_request<V: Into<crate::model::DeleteWorkstationClusterRequest>>(
619            mut self,
620            v: V,
621        ) -> Self {
622            self.0.request = v.into();
623            self
624        }
625
626        /// Sets all the options, replacing any prior values.
627        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
628            self.0.options = v.into();
629            self
630        }
631
632        /// Sends the request.
633        ///
634        /// # Long running operations
635        ///
636        /// This starts, but does not poll, a longrunning operation. More information
637        /// on [delete_workstation_cluster][crate::client::Workstations::delete_workstation_cluster].
638        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
639            (*self.0.stub)
640                .delete_workstation_cluster(self.0.request, self.0.options)
641                .await
642                .map(crate::Response::into_body)
643        }
644
645        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_workstation_cluster`.
646        pub fn poller(
647            self,
648        ) -> impl google_cloud_lro::Poller<
649            crate::model::WorkstationCluster,
650            crate::model::OperationMetadata,
651        > {
652            type Operation = google_cloud_lro::internal::Operation<
653                crate::model::WorkstationCluster,
654                crate::model::OperationMetadata,
655            >;
656            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
657            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
658            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
659            if let Some(ref mut details) = poller_options.tracing {
660                details.method_name = "google_cloud_workstations_v1::client::Workstations::delete_workstation_cluster::until_done";
661            }
662
663            let stub = self.0.stub.clone();
664            let mut options = self.0.options.clone();
665            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
666            let query = move |name| {
667                let stub = stub.clone();
668                let options = options.clone();
669                async {
670                    let op = GetOperation::new(stub)
671                        .set_name(name)
672                        .with_options(options)
673                        .send()
674                        .await?;
675                    Ok(Operation::new(op))
676                }
677            };
678
679            let start = move || async {
680                let op = self.send().await?;
681                Ok(Operation::new(op))
682            };
683
684            use google_cloud_lro::internal::PollerExt;
685            {
686                google_cloud_lro::internal::new_poller(
687                    polling_error_policy,
688                    polling_backoff_policy,
689                    start,
690                    query,
691                )
692            }
693            .with_options(poller_options)
694        }
695
696        /// Sets the value of [name][crate::model::DeleteWorkstationClusterRequest::name].
697        ///
698        /// This is a **required** field for requests.
699        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
700            self.0.request.name = v.into();
701            self
702        }
703
704        /// Sets the value of [validate_only][crate::model::DeleteWorkstationClusterRequest::validate_only].
705        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
706            self.0.request.validate_only = v.into();
707            self
708        }
709
710        /// Sets the value of [etag][crate::model::DeleteWorkstationClusterRequest::etag].
711        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
712            self.0.request.etag = v.into();
713            self
714        }
715
716        /// Sets the value of [force][crate::model::DeleteWorkstationClusterRequest::force].
717        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
718            self.0.request.force = v.into();
719            self
720        }
721    }
722
723    #[doc(hidden)]
724    impl crate::RequestBuilder for DeleteWorkstationCluster {
725        fn request_options(&mut self) -> &mut crate::RequestOptions {
726            &mut self.0.options
727        }
728    }
729
730    /// The request builder for [Workstations::get_workstation_config][crate::client::Workstations::get_workstation_config] calls.
731    ///
732    /// # Example
733    /// ```
734    /// # use google_cloud_workstations_v1::builder::workstations::GetWorkstationConfig;
735    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
736    ///
737    /// let builder = prepare_request_builder();
738    /// let response = builder.send().await?;
739    /// # Ok(()) }
740    ///
741    /// fn prepare_request_builder() -> GetWorkstationConfig {
742    ///   # panic!();
743    ///   // ... details omitted ...
744    /// }
745    /// ```
746    #[derive(Clone, Debug)]
747    pub struct GetWorkstationConfig(RequestBuilder<crate::model::GetWorkstationConfigRequest>);
748
749    impl GetWorkstationConfig {
750        pub(crate) fn new(
751            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
752        ) -> Self {
753            Self(RequestBuilder::new(stub))
754        }
755
756        /// Sets the full request, replacing any prior values.
757        pub fn with_request<V: Into<crate::model::GetWorkstationConfigRequest>>(
758            mut self,
759            v: V,
760        ) -> Self {
761            self.0.request = v.into();
762            self
763        }
764
765        /// Sets all the options, replacing any prior values.
766        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
767            self.0.options = v.into();
768            self
769        }
770
771        /// Sends the request.
772        pub async fn send(self) -> Result<crate::model::WorkstationConfig> {
773            (*self.0.stub)
774                .get_workstation_config(self.0.request, self.0.options)
775                .await
776                .map(crate::Response::into_body)
777        }
778
779        /// Sets the value of [name][crate::model::GetWorkstationConfigRequest::name].
780        ///
781        /// This is a **required** field for requests.
782        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
783            self.0.request.name = v.into();
784            self
785        }
786    }
787
788    #[doc(hidden)]
789    impl crate::RequestBuilder for GetWorkstationConfig {
790        fn request_options(&mut self) -> &mut crate::RequestOptions {
791            &mut self.0.options
792        }
793    }
794
795    /// The request builder for [Workstations::list_workstation_configs][crate::client::Workstations::list_workstation_configs] calls.
796    ///
797    /// # Example
798    /// ```
799    /// # use google_cloud_workstations_v1::builder::workstations::ListWorkstationConfigs;
800    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
801    /// use google_cloud_gax::paginator::ItemPaginator;
802    ///
803    /// let builder = prepare_request_builder();
804    /// let mut items = builder.by_item();
805    /// while let Some(result) = items.next().await {
806    ///   let item = result?;
807    /// }
808    /// # Ok(()) }
809    ///
810    /// fn prepare_request_builder() -> ListWorkstationConfigs {
811    ///   # panic!();
812    ///   // ... details omitted ...
813    /// }
814    /// ```
815    #[derive(Clone, Debug)]
816    pub struct ListWorkstationConfigs(RequestBuilder<crate::model::ListWorkstationConfigsRequest>);
817
818    impl ListWorkstationConfigs {
819        pub(crate) fn new(
820            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
821        ) -> Self {
822            Self(RequestBuilder::new(stub))
823        }
824
825        /// Sets the full request, replacing any prior values.
826        pub fn with_request<V: Into<crate::model::ListWorkstationConfigsRequest>>(
827            mut self,
828            v: V,
829        ) -> Self {
830            self.0.request = v.into();
831            self
832        }
833
834        /// Sets all the options, replacing any prior values.
835        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
836            self.0.options = v.into();
837            self
838        }
839
840        /// Sends the request.
841        pub async fn send(self) -> Result<crate::model::ListWorkstationConfigsResponse> {
842            (*self.0.stub)
843                .list_workstation_configs(self.0.request, self.0.options)
844                .await
845                .map(crate::Response::into_body)
846        }
847
848        /// Streams each page in the collection.
849        pub fn by_page(
850            self,
851        ) -> impl google_cloud_gax::paginator::Paginator<
852            crate::model::ListWorkstationConfigsResponse,
853            crate::Error,
854        > {
855            use std::clone::Clone;
856            let token = self.0.request.page_token.clone();
857            let execute = move |token: String| {
858                let mut builder = self.clone();
859                builder.0.request = builder.0.request.set_page_token(token);
860                builder.send()
861            };
862            google_cloud_gax::paginator::internal::new_paginator(token, execute)
863        }
864
865        /// Streams each item in the collection.
866        pub fn by_item(
867            self,
868        ) -> impl google_cloud_gax::paginator::ItemPaginator<
869            crate::model::ListWorkstationConfigsResponse,
870            crate::Error,
871        > {
872            use google_cloud_gax::paginator::Paginator;
873            self.by_page().items()
874        }
875
876        /// Sets the value of [parent][crate::model::ListWorkstationConfigsRequest::parent].
877        ///
878        /// This is a **required** field for requests.
879        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
880            self.0.request.parent = v.into();
881            self
882        }
883
884        /// Sets the value of [page_size][crate::model::ListWorkstationConfigsRequest::page_size].
885        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
886            self.0.request.page_size = v.into();
887            self
888        }
889
890        /// Sets the value of [page_token][crate::model::ListWorkstationConfigsRequest::page_token].
891        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
892            self.0.request.page_token = v.into();
893            self
894        }
895
896        /// Sets the value of [filter][crate::model::ListWorkstationConfigsRequest::filter].
897        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
898            self.0.request.filter = v.into();
899            self
900        }
901    }
902
903    #[doc(hidden)]
904    impl crate::RequestBuilder for ListWorkstationConfigs {
905        fn request_options(&mut self) -> &mut crate::RequestOptions {
906            &mut self.0.options
907        }
908    }
909
910    /// The request builder for [Workstations::list_usable_workstation_configs][crate::client::Workstations::list_usable_workstation_configs] calls.
911    ///
912    /// # Example
913    /// ```
914    /// # use google_cloud_workstations_v1::builder::workstations::ListUsableWorkstationConfigs;
915    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
916    /// use google_cloud_gax::paginator::ItemPaginator;
917    ///
918    /// let builder = prepare_request_builder();
919    /// let mut items = builder.by_item();
920    /// while let Some(result) = items.next().await {
921    ///   let item = result?;
922    /// }
923    /// # Ok(()) }
924    ///
925    /// fn prepare_request_builder() -> ListUsableWorkstationConfigs {
926    ///   # panic!();
927    ///   // ... details omitted ...
928    /// }
929    /// ```
930    #[derive(Clone, Debug)]
931    pub struct ListUsableWorkstationConfigs(
932        RequestBuilder<crate::model::ListUsableWorkstationConfigsRequest>,
933    );
934
935    impl ListUsableWorkstationConfigs {
936        pub(crate) fn new(
937            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
938        ) -> Self {
939            Self(RequestBuilder::new(stub))
940        }
941
942        /// Sets the full request, replacing any prior values.
943        pub fn with_request<V: Into<crate::model::ListUsableWorkstationConfigsRequest>>(
944            mut self,
945            v: V,
946        ) -> Self {
947            self.0.request = v.into();
948            self
949        }
950
951        /// Sets all the options, replacing any prior values.
952        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
953            self.0.options = v.into();
954            self
955        }
956
957        /// Sends the request.
958        pub async fn send(self) -> Result<crate::model::ListUsableWorkstationConfigsResponse> {
959            (*self.0.stub)
960                .list_usable_workstation_configs(self.0.request, self.0.options)
961                .await
962                .map(crate::Response::into_body)
963        }
964
965        /// Streams each page in the collection.
966        pub fn by_page(
967            self,
968        ) -> impl google_cloud_gax::paginator::Paginator<
969            crate::model::ListUsableWorkstationConfigsResponse,
970            crate::Error,
971        > {
972            use std::clone::Clone;
973            let token = self.0.request.page_token.clone();
974            let execute = move |token: String| {
975                let mut builder = self.clone();
976                builder.0.request = builder.0.request.set_page_token(token);
977                builder.send()
978            };
979            google_cloud_gax::paginator::internal::new_paginator(token, execute)
980        }
981
982        /// Streams each item in the collection.
983        pub fn by_item(
984            self,
985        ) -> impl google_cloud_gax::paginator::ItemPaginator<
986            crate::model::ListUsableWorkstationConfigsResponse,
987            crate::Error,
988        > {
989            use google_cloud_gax::paginator::Paginator;
990            self.by_page().items()
991        }
992
993        /// Sets the value of [parent][crate::model::ListUsableWorkstationConfigsRequest::parent].
994        ///
995        /// This is a **required** field for requests.
996        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
997            self.0.request.parent = v.into();
998            self
999        }
1000
1001        /// Sets the value of [page_size][crate::model::ListUsableWorkstationConfigsRequest::page_size].
1002        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1003            self.0.request.page_size = v.into();
1004            self
1005        }
1006
1007        /// Sets the value of [page_token][crate::model::ListUsableWorkstationConfigsRequest::page_token].
1008        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1009            self.0.request.page_token = v.into();
1010            self
1011        }
1012    }
1013
1014    #[doc(hidden)]
1015    impl crate::RequestBuilder for ListUsableWorkstationConfigs {
1016        fn request_options(&mut self) -> &mut crate::RequestOptions {
1017            &mut self.0.options
1018        }
1019    }
1020
1021    /// The request builder for [Workstations::create_workstation_config][crate::client::Workstations::create_workstation_config] calls.
1022    ///
1023    /// # Example
1024    /// ```
1025    /// # use google_cloud_workstations_v1::builder::workstations::CreateWorkstationConfig;
1026    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1027    /// use google_cloud_lro::Poller;
1028    ///
1029    /// let builder = prepare_request_builder();
1030    /// let response = builder.poller().until_done().await?;
1031    /// # Ok(()) }
1032    ///
1033    /// fn prepare_request_builder() -> CreateWorkstationConfig {
1034    ///   # panic!();
1035    ///   // ... details omitted ...
1036    /// }
1037    /// ```
1038    #[derive(Clone, Debug)]
1039    pub struct CreateWorkstationConfig(
1040        RequestBuilder<crate::model::CreateWorkstationConfigRequest>,
1041    );
1042
1043    impl CreateWorkstationConfig {
1044        pub(crate) fn new(
1045            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1046        ) -> Self {
1047            Self(RequestBuilder::new(stub))
1048        }
1049
1050        /// Sets the full request, replacing any prior values.
1051        pub fn with_request<V: Into<crate::model::CreateWorkstationConfigRequest>>(
1052            mut self,
1053            v: V,
1054        ) -> Self {
1055            self.0.request = v.into();
1056            self
1057        }
1058
1059        /// Sets all the options, replacing any prior values.
1060        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1061            self.0.options = v.into();
1062            self
1063        }
1064
1065        /// Sends the request.
1066        ///
1067        /// # Long running operations
1068        ///
1069        /// This starts, but does not poll, a longrunning operation. More information
1070        /// on [create_workstation_config][crate::client::Workstations::create_workstation_config].
1071        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1072            (*self.0.stub)
1073                .create_workstation_config(self.0.request, self.0.options)
1074                .await
1075                .map(crate::Response::into_body)
1076        }
1077
1078        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_workstation_config`.
1079        pub fn poller(
1080            self,
1081        ) -> impl google_cloud_lro::Poller<
1082            crate::model::WorkstationConfig,
1083            crate::model::OperationMetadata,
1084        > {
1085            type Operation = google_cloud_lro::internal::Operation<
1086                crate::model::WorkstationConfig,
1087                crate::model::OperationMetadata,
1088            >;
1089            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1090            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1091            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1092            if let Some(ref mut details) = poller_options.tracing {
1093                details.method_name = "google_cloud_workstations_v1::client::Workstations::create_workstation_config::until_done";
1094            }
1095
1096            let stub = self.0.stub.clone();
1097            let mut options = self.0.options.clone();
1098            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1099            let query = move |name| {
1100                let stub = stub.clone();
1101                let options = options.clone();
1102                async {
1103                    let op = GetOperation::new(stub)
1104                        .set_name(name)
1105                        .with_options(options)
1106                        .send()
1107                        .await?;
1108                    Ok(Operation::new(op))
1109                }
1110            };
1111
1112            let start = move || async {
1113                let op = self.send().await?;
1114                Ok(Operation::new(op))
1115            };
1116
1117            use google_cloud_lro::internal::PollerExt;
1118            {
1119                google_cloud_lro::internal::new_poller(
1120                    polling_error_policy,
1121                    polling_backoff_policy,
1122                    start,
1123                    query,
1124                )
1125            }
1126            .with_options(poller_options)
1127        }
1128
1129        /// Sets the value of [parent][crate::model::CreateWorkstationConfigRequest::parent].
1130        ///
1131        /// This is a **required** field for requests.
1132        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1133            self.0.request.parent = v.into();
1134            self
1135        }
1136
1137        /// Sets the value of [workstation_config_id][crate::model::CreateWorkstationConfigRequest::workstation_config_id].
1138        ///
1139        /// This is a **required** field for requests.
1140        pub fn set_workstation_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1141            self.0.request.workstation_config_id = v.into();
1142            self
1143        }
1144
1145        /// Sets the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
1146        ///
1147        /// This is a **required** field for requests.
1148        pub fn set_workstation_config<T>(mut self, v: T) -> Self
1149        where
1150            T: std::convert::Into<crate::model::WorkstationConfig>,
1151        {
1152            self.0.request.workstation_config = std::option::Option::Some(v.into());
1153            self
1154        }
1155
1156        /// Sets or clears the value of [workstation_config][crate::model::CreateWorkstationConfigRequest::workstation_config].
1157        ///
1158        /// This is a **required** field for requests.
1159        pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1160        where
1161            T: std::convert::Into<crate::model::WorkstationConfig>,
1162        {
1163            self.0.request.workstation_config = v.map(|x| x.into());
1164            self
1165        }
1166
1167        /// Sets the value of [validate_only][crate::model::CreateWorkstationConfigRequest::validate_only].
1168        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1169            self.0.request.validate_only = v.into();
1170            self
1171        }
1172    }
1173
1174    #[doc(hidden)]
1175    impl crate::RequestBuilder for CreateWorkstationConfig {
1176        fn request_options(&mut self) -> &mut crate::RequestOptions {
1177            &mut self.0.options
1178        }
1179    }
1180
1181    /// The request builder for [Workstations::update_workstation_config][crate::client::Workstations::update_workstation_config] calls.
1182    ///
1183    /// # Example
1184    /// ```
1185    /// # use google_cloud_workstations_v1::builder::workstations::UpdateWorkstationConfig;
1186    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1187    /// use google_cloud_lro::Poller;
1188    ///
1189    /// let builder = prepare_request_builder();
1190    /// let response = builder.poller().until_done().await?;
1191    /// # Ok(()) }
1192    ///
1193    /// fn prepare_request_builder() -> UpdateWorkstationConfig {
1194    ///   # panic!();
1195    ///   // ... details omitted ...
1196    /// }
1197    /// ```
1198    #[derive(Clone, Debug)]
1199    pub struct UpdateWorkstationConfig(
1200        RequestBuilder<crate::model::UpdateWorkstationConfigRequest>,
1201    );
1202
1203    impl UpdateWorkstationConfig {
1204        pub(crate) fn new(
1205            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1206        ) -> Self {
1207            Self(RequestBuilder::new(stub))
1208        }
1209
1210        /// Sets the full request, replacing any prior values.
1211        pub fn with_request<V: Into<crate::model::UpdateWorkstationConfigRequest>>(
1212            mut self,
1213            v: V,
1214        ) -> Self {
1215            self.0.request = v.into();
1216            self
1217        }
1218
1219        /// Sets all the options, replacing any prior values.
1220        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1221            self.0.options = v.into();
1222            self
1223        }
1224
1225        /// Sends the request.
1226        ///
1227        /// # Long running operations
1228        ///
1229        /// This starts, but does not poll, a longrunning operation. More information
1230        /// on [update_workstation_config][crate::client::Workstations::update_workstation_config].
1231        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1232            (*self.0.stub)
1233                .update_workstation_config(self.0.request, self.0.options)
1234                .await
1235                .map(crate::Response::into_body)
1236        }
1237
1238        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_workstation_config`.
1239        pub fn poller(
1240            self,
1241        ) -> impl google_cloud_lro::Poller<
1242            crate::model::WorkstationConfig,
1243            crate::model::OperationMetadata,
1244        > {
1245            type Operation = google_cloud_lro::internal::Operation<
1246                crate::model::WorkstationConfig,
1247                crate::model::OperationMetadata,
1248            >;
1249            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1250            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1251            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1252            if let Some(ref mut details) = poller_options.tracing {
1253                details.method_name = "google_cloud_workstations_v1::client::Workstations::update_workstation_config::until_done";
1254            }
1255
1256            let stub = self.0.stub.clone();
1257            let mut options = self.0.options.clone();
1258            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1259            let query = move |name| {
1260                let stub = stub.clone();
1261                let options = options.clone();
1262                async {
1263                    let op = GetOperation::new(stub)
1264                        .set_name(name)
1265                        .with_options(options)
1266                        .send()
1267                        .await?;
1268                    Ok(Operation::new(op))
1269                }
1270            };
1271
1272            let start = move || async {
1273                let op = self.send().await?;
1274                Ok(Operation::new(op))
1275            };
1276
1277            use google_cloud_lro::internal::PollerExt;
1278            {
1279                google_cloud_lro::internal::new_poller(
1280                    polling_error_policy,
1281                    polling_backoff_policy,
1282                    start,
1283                    query,
1284                )
1285            }
1286            .with_options(poller_options)
1287        }
1288
1289        /// Sets the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
1290        ///
1291        /// This is a **required** field for requests.
1292        pub fn set_workstation_config<T>(mut self, v: T) -> Self
1293        where
1294            T: std::convert::Into<crate::model::WorkstationConfig>,
1295        {
1296            self.0.request.workstation_config = std::option::Option::Some(v.into());
1297            self
1298        }
1299
1300        /// Sets or clears the value of [workstation_config][crate::model::UpdateWorkstationConfigRequest::workstation_config].
1301        ///
1302        /// This is a **required** field for requests.
1303        pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1304        where
1305            T: std::convert::Into<crate::model::WorkstationConfig>,
1306        {
1307            self.0.request.workstation_config = v.map(|x| x.into());
1308            self
1309        }
1310
1311        /// Sets the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
1312        ///
1313        /// This is a **required** field for requests.
1314        pub fn set_update_mask<T>(mut self, v: T) -> Self
1315        where
1316            T: std::convert::Into<wkt::FieldMask>,
1317        {
1318            self.0.request.update_mask = std::option::Option::Some(v.into());
1319            self
1320        }
1321
1322        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationConfigRequest::update_mask].
1323        ///
1324        /// This is a **required** field for requests.
1325        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1326        where
1327            T: std::convert::Into<wkt::FieldMask>,
1328        {
1329            self.0.request.update_mask = v.map(|x| x.into());
1330            self
1331        }
1332
1333        /// Sets the value of [validate_only][crate::model::UpdateWorkstationConfigRequest::validate_only].
1334        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1335            self.0.request.validate_only = v.into();
1336            self
1337        }
1338
1339        /// Sets the value of [allow_missing][crate::model::UpdateWorkstationConfigRequest::allow_missing].
1340        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1341            self.0.request.allow_missing = v.into();
1342            self
1343        }
1344    }
1345
1346    #[doc(hidden)]
1347    impl crate::RequestBuilder for UpdateWorkstationConfig {
1348        fn request_options(&mut self) -> &mut crate::RequestOptions {
1349            &mut self.0.options
1350        }
1351    }
1352
1353    /// The request builder for [Workstations::delete_workstation_config][crate::client::Workstations::delete_workstation_config] calls.
1354    ///
1355    /// # Example
1356    /// ```
1357    /// # use google_cloud_workstations_v1::builder::workstations::DeleteWorkstationConfig;
1358    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1359    /// use google_cloud_lro::Poller;
1360    ///
1361    /// let builder = prepare_request_builder();
1362    /// let response = builder.poller().until_done().await?;
1363    /// # Ok(()) }
1364    ///
1365    /// fn prepare_request_builder() -> DeleteWorkstationConfig {
1366    ///   # panic!();
1367    ///   // ... details omitted ...
1368    /// }
1369    /// ```
1370    #[derive(Clone, Debug)]
1371    pub struct DeleteWorkstationConfig(
1372        RequestBuilder<crate::model::DeleteWorkstationConfigRequest>,
1373    );
1374
1375    impl DeleteWorkstationConfig {
1376        pub(crate) fn new(
1377            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1378        ) -> Self {
1379            Self(RequestBuilder::new(stub))
1380        }
1381
1382        /// Sets the full request, replacing any prior values.
1383        pub fn with_request<V: Into<crate::model::DeleteWorkstationConfigRequest>>(
1384            mut self,
1385            v: V,
1386        ) -> Self {
1387            self.0.request = v.into();
1388            self
1389        }
1390
1391        /// Sets all the options, replacing any prior values.
1392        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1393            self.0.options = v.into();
1394            self
1395        }
1396
1397        /// Sends the request.
1398        ///
1399        /// # Long running operations
1400        ///
1401        /// This starts, but does not poll, a longrunning operation. More information
1402        /// on [delete_workstation_config][crate::client::Workstations::delete_workstation_config].
1403        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1404            (*self.0.stub)
1405                .delete_workstation_config(self.0.request, self.0.options)
1406                .await
1407                .map(crate::Response::into_body)
1408        }
1409
1410        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_workstation_config`.
1411        pub fn poller(
1412            self,
1413        ) -> impl google_cloud_lro::Poller<
1414            crate::model::WorkstationConfig,
1415            crate::model::OperationMetadata,
1416        > {
1417            type Operation = google_cloud_lro::internal::Operation<
1418                crate::model::WorkstationConfig,
1419                crate::model::OperationMetadata,
1420            >;
1421            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1422            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1423            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1424            if let Some(ref mut details) = poller_options.tracing {
1425                details.method_name = "google_cloud_workstations_v1::client::Workstations::delete_workstation_config::until_done";
1426            }
1427
1428            let stub = self.0.stub.clone();
1429            let mut options = self.0.options.clone();
1430            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1431            let query = move |name| {
1432                let stub = stub.clone();
1433                let options = options.clone();
1434                async {
1435                    let op = GetOperation::new(stub)
1436                        .set_name(name)
1437                        .with_options(options)
1438                        .send()
1439                        .await?;
1440                    Ok(Operation::new(op))
1441                }
1442            };
1443
1444            let start = move || async {
1445                let op = self.send().await?;
1446                Ok(Operation::new(op))
1447            };
1448
1449            use google_cloud_lro::internal::PollerExt;
1450            {
1451                google_cloud_lro::internal::new_poller(
1452                    polling_error_policy,
1453                    polling_backoff_policy,
1454                    start,
1455                    query,
1456                )
1457            }
1458            .with_options(poller_options)
1459        }
1460
1461        /// Sets the value of [name][crate::model::DeleteWorkstationConfigRequest::name].
1462        ///
1463        /// This is a **required** field for requests.
1464        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1465            self.0.request.name = v.into();
1466            self
1467        }
1468
1469        /// Sets the value of [validate_only][crate::model::DeleteWorkstationConfigRequest::validate_only].
1470        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1471            self.0.request.validate_only = v.into();
1472            self
1473        }
1474
1475        /// Sets the value of [etag][crate::model::DeleteWorkstationConfigRequest::etag].
1476        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1477            self.0.request.etag = v.into();
1478            self
1479        }
1480
1481        /// Sets the value of [force][crate::model::DeleteWorkstationConfigRequest::force].
1482        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1483            self.0.request.force = v.into();
1484            self
1485        }
1486    }
1487
1488    #[doc(hidden)]
1489    impl crate::RequestBuilder for DeleteWorkstationConfig {
1490        fn request_options(&mut self) -> &mut crate::RequestOptions {
1491            &mut self.0.options
1492        }
1493    }
1494
1495    /// The request builder for [Workstations::get_workstation][crate::client::Workstations::get_workstation] calls.
1496    ///
1497    /// # Example
1498    /// ```
1499    /// # use google_cloud_workstations_v1::builder::workstations::GetWorkstation;
1500    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1501    ///
1502    /// let builder = prepare_request_builder();
1503    /// let response = builder.send().await?;
1504    /// # Ok(()) }
1505    ///
1506    /// fn prepare_request_builder() -> GetWorkstation {
1507    ///   # panic!();
1508    ///   // ... details omitted ...
1509    /// }
1510    /// ```
1511    #[derive(Clone, Debug)]
1512    pub struct GetWorkstation(RequestBuilder<crate::model::GetWorkstationRequest>);
1513
1514    impl GetWorkstation {
1515        pub(crate) fn new(
1516            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1517        ) -> Self {
1518            Self(RequestBuilder::new(stub))
1519        }
1520
1521        /// Sets the full request, replacing any prior values.
1522        pub fn with_request<V: Into<crate::model::GetWorkstationRequest>>(mut self, v: V) -> Self {
1523            self.0.request = v.into();
1524            self
1525        }
1526
1527        /// Sets all the options, replacing any prior values.
1528        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1529            self.0.options = v.into();
1530            self
1531        }
1532
1533        /// Sends the request.
1534        pub async fn send(self) -> Result<crate::model::Workstation> {
1535            (*self.0.stub)
1536                .get_workstation(self.0.request, self.0.options)
1537                .await
1538                .map(crate::Response::into_body)
1539        }
1540
1541        /// Sets the value of [name][crate::model::GetWorkstationRequest::name].
1542        ///
1543        /// This is a **required** field for requests.
1544        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545            self.0.request.name = v.into();
1546            self
1547        }
1548    }
1549
1550    #[doc(hidden)]
1551    impl crate::RequestBuilder for GetWorkstation {
1552        fn request_options(&mut self) -> &mut crate::RequestOptions {
1553            &mut self.0.options
1554        }
1555    }
1556
1557    /// The request builder for [Workstations::list_workstations][crate::client::Workstations::list_workstations] calls.
1558    ///
1559    /// # Example
1560    /// ```
1561    /// # use google_cloud_workstations_v1::builder::workstations::ListWorkstations;
1562    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1563    /// use google_cloud_gax::paginator::ItemPaginator;
1564    ///
1565    /// let builder = prepare_request_builder();
1566    /// let mut items = builder.by_item();
1567    /// while let Some(result) = items.next().await {
1568    ///   let item = result?;
1569    /// }
1570    /// # Ok(()) }
1571    ///
1572    /// fn prepare_request_builder() -> ListWorkstations {
1573    ///   # panic!();
1574    ///   // ... details omitted ...
1575    /// }
1576    /// ```
1577    #[derive(Clone, Debug)]
1578    pub struct ListWorkstations(RequestBuilder<crate::model::ListWorkstationsRequest>);
1579
1580    impl ListWorkstations {
1581        pub(crate) fn new(
1582            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1583        ) -> Self {
1584            Self(RequestBuilder::new(stub))
1585        }
1586
1587        /// Sets the full request, replacing any prior values.
1588        pub fn with_request<V: Into<crate::model::ListWorkstationsRequest>>(
1589            mut self,
1590            v: V,
1591        ) -> Self {
1592            self.0.request = v.into();
1593            self
1594        }
1595
1596        /// Sets all the options, replacing any prior values.
1597        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1598            self.0.options = v.into();
1599            self
1600        }
1601
1602        /// Sends the request.
1603        pub async fn send(self) -> Result<crate::model::ListWorkstationsResponse> {
1604            (*self.0.stub)
1605                .list_workstations(self.0.request, self.0.options)
1606                .await
1607                .map(crate::Response::into_body)
1608        }
1609
1610        /// Streams each page in the collection.
1611        pub fn by_page(
1612            self,
1613        ) -> impl google_cloud_gax::paginator::Paginator<
1614            crate::model::ListWorkstationsResponse,
1615            crate::Error,
1616        > {
1617            use std::clone::Clone;
1618            let token = self.0.request.page_token.clone();
1619            let execute = move |token: String| {
1620                let mut builder = self.clone();
1621                builder.0.request = builder.0.request.set_page_token(token);
1622                builder.send()
1623            };
1624            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1625        }
1626
1627        /// Streams each item in the collection.
1628        pub fn by_item(
1629            self,
1630        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1631            crate::model::ListWorkstationsResponse,
1632            crate::Error,
1633        > {
1634            use google_cloud_gax::paginator::Paginator;
1635            self.by_page().items()
1636        }
1637
1638        /// Sets the value of [parent][crate::model::ListWorkstationsRequest::parent].
1639        ///
1640        /// This is a **required** field for requests.
1641        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1642            self.0.request.parent = v.into();
1643            self
1644        }
1645
1646        /// Sets the value of [page_size][crate::model::ListWorkstationsRequest::page_size].
1647        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1648            self.0.request.page_size = v.into();
1649            self
1650        }
1651
1652        /// Sets the value of [page_token][crate::model::ListWorkstationsRequest::page_token].
1653        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654            self.0.request.page_token = v.into();
1655            self
1656        }
1657
1658        /// Sets the value of [filter][crate::model::ListWorkstationsRequest::filter].
1659        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1660            self.0.request.filter = v.into();
1661            self
1662        }
1663    }
1664
1665    #[doc(hidden)]
1666    impl crate::RequestBuilder for ListWorkstations {
1667        fn request_options(&mut self) -> &mut crate::RequestOptions {
1668            &mut self.0.options
1669        }
1670    }
1671
1672    /// The request builder for [Workstations::list_usable_workstations][crate::client::Workstations::list_usable_workstations] calls.
1673    ///
1674    /// # Example
1675    /// ```
1676    /// # use google_cloud_workstations_v1::builder::workstations::ListUsableWorkstations;
1677    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1678    /// use google_cloud_gax::paginator::ItemPaginator;
1679    ///
1680    /// let builder = prepare_request_builder();
1681    /// let mut items = builder.by_item();
1682    /// while let Some(result) = items.next().await {
1683    ///   let item = result?;
1684    /// }
1685    /// # Ok(()) }
1686    ///
1687    /// fn prepare_request_builder() -> ListUsableWorkstations {
1688    ///   # panic!();
1689    ///   // ... details omitted ...
1690    /// }
1691    /// ```
1692    #[derive(Clone, Debug)]
1693    pub struct ListUsableWorkstations(RequestBuilder<crate::model::ListUsableWorkstationsRequest>);
1694
1695    impl ListUsableWorkstations {
1696        pub(crate) fn new(
1697            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1698        ) -> Self {
1699            Self(RequestBuilder::new(stub))
1700        }
1701
1702        /// Sets the full request, replacing any prior values.
1703        pub fn with_request<V: Into<crate::model::ListUsableWorkstationsRequest>>(
1704            mut self,
1705            v: V,
1706        ) -> Self {
1707            self.0.request = v.into();
1708            self
1709        }
1710
1711        /// Sets all the options, replacing any prior values.
1712        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1713            self.0.options = v.into();
1714            self
1715        }
1716
1717        /// Sends the request.
1718        pub async fn send(self) -> Result<crate::model::ListUsableWorkstationsResponse> {
1719            (*self.0.stub)
1720                .list_usable_workstations(self.0.request, self.0.options)
1721                .await
1722                .map(crate::Response::into_body)
1723        }
1724
1725        /// Streams each page in the collection.
1726        pub fn by_page(
1727            self,
1728        ) -> impl google_cloud_gax::paginator::Paginator<
1729            crate::model::ListUsableWorkstationsResponse,
1730            crate::Error,
1731        > {
1732            use std::clone::Clone;
1733            let token = self.0.request.page_token.clone();
1734            let execute = move |token: String| {
1735                let mut builder = self.clone();
1736                builder.0.request = builder.0.request.set_page_token(token);
1737                builder.send()
1738            };
1739            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1740        }
1741
1742        /// Streams each item in the collection.
1743        pub fn by_item(
1744            self,
1745        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1746            crate::model::ListUsableWorkstationsResponse,
1747            crate::Error,
1748        > {
1749            use google_cloud_gax::paginator::Paginator;
1750            self.by_page().items()
1751        }
1752
1753        /// Sets the value of [parent][crate::model::ListUsableWorkstationsRequest::parent].
1754        ///
1755        /// This is a **required** field for requests.
1756        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1757            self.0.request.parent = v.into();
1758            self
1759        }
1760
1761        /// Sets the value of [page_size][crate::model::ListUsableWorkstationsRequest::page_size].
1762        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1763            self.0.request.page_size = v.into();
1764            self
1765        }
1766
1767        /// Sets the value of [page_token][crate::model::ListUsableWorkstationsRequest::page_token].
1768        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1769            self.0.request.page_token = v.into();
1770            self
1771        }
1772    }
1773
1774    #[doc(hidden)]
1775    impl crate::RequestBuilder for ListUsableWorkstations {
1776        fn request_options(&mut self) -> &mut crate::RequestOptions {
1777            &mut self.0.options
1778        }
1779    }
1780
1781    /// The request builder for [Workstations::create_workstation][crate::client::Workstations::create_workstation] calls.
1782    ///
1783    /// # Example
1784    /// ```
1785    /// # use google_cloud_workstations_v1::builder::workstations::CreateWorkstation;
1786    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1787    /// use google_cloud_lro::Poller;
1788    ///
1789    /// let builder = prepare_request_builder();
1790    /// let response = builder.poller().until_done().await?;
1791    /// # Ok(()) }
1792    ///
1793    /// fn prepare_request_builder() -> CreateWorkstation {
1794    ///   # panic!();
1795    ///   // ... details omitted ...
1796    /// }
1797    /// ```
1798    #[derive(Clone, Debug)]
1799    pub struct CreateWorkstation(RequestBuilder<crate::model::CreateWorkstationRequest>);
1800
1801    impl CreateWorkstation {
1802        pub(crate) fn new(
1803            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1804        ) -> Self {
1805            Self(RequestBuilder::new(stub))
1806        }
1807
1808        /// Sets the full request, replacing any prior values.
1809        pub fn with_request<V: Into<crate::model::CreateWorkstationRequest>>(
1810            mut self,
1811            v: V,
1812        ) -> Self {
1813            self.0.request = v.into();
1814            self
1815        }
1816
1817        /// Sets all the options, replacing any prior values.
1818        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1819            self.0.options = v.into();
1820            self
1821        }
1822
1823        /// Sends the request.
1824        ///
1825        /// # Long running operations
1826        ///
1827        /// This starts, but does not poll, a longrunning operation. More information
1828        /// on [create_workstation][crate::client::Workstations::create_workstation].
1829        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1830            (*self.0.stub)
1831                .create_workstation(self.0.request, self.0.options)
1832                .await
1833                .map(crate::Response::into_body)
1834        }
1835
1836        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_workstation`.
1837        pub fn poller(
1838            self,
1839        ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
1840        {
1841            type Operation = google_cloud_lro::internal::Operation<
1842                crate::model::Workstation,
1843                crate::model::OperationMetadata,
1844            >;
1845            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1846            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1847            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1848            if let Some(ref mut details) = poller_options.tracing {
1849                details.method_name = "google_cloud_workstations_v1::client::Workstations::create_workstation::until_done";
1850            }
1851
1852            let stub = self.0.stub.clone();
1853            let mut options = self.0.options.clone();
1854            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1855            let query = move |name| {
1856                let stub = stub.clone();
1857                let options = options.clone();
1858                async {
1859                    let op = GetOperation::new(stub)
1860                        .set_name(name)
1861                        .with_options(options)
1862                        .send()
1863                        .await?;
1864                    Ok(Operation::new(op))
1865                }
1866            };
1867
1868            let start = move || async {
1869                let op = self.send().await?;
1870                Ok(Operation::new(op))
1871            };
1872
1873            use google_cloud_lro::internal::PollerExt;
1874            {
1875                google_cloud_lro::internal::new_poller(
1876                    polling_error_policy,
1877                    polling_backoff_policy,
1878                    start,
1879                    query,
1880                )
1881            }
1882            .with_options(poller_options)
1883        }
1884
1885        /// Sets the value of [parent][crate::model::CreateWorkstationRequest::parent].
1886        ///
1887        /// This is a **required** field for requests.
1888        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1889            self.0.request.parent = v.into();
1890            self
1891        }
1892
1893        /// Sets the value of [workstation_id][crate::model::CreateWorkstationRequest::workstation_id].
1894        ///
1895        /// This is a **required** field for requests.
1896        pub fn set_workstation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1897            self.0.request.workstation_id = v.into();
1898            self
1899        }
1900
1901        /// Sets the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
1902        ///
1903        /// This is a **required** field for requests.
1904        pub fn set_workstation<T>(mut self, v: T) -> Self
1905        where
1906            T: std::convert::Into<crate::model::Workstation>,
1907        {
1908            self.0.request.workstation = std::option::Option::Some(v.into());
1909            self
1910        }
1911
1912        /// Sets or clears the value of [workstation][crate::model::CreateWorkstationRequest::workstation].
1913        ///
1914        /// This is a **required** field for requests.
1915        pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
1916        where
1917            T: std::convert::Into<crate::model::Workstation>,
1918        {
1919            self.0.request.workstation = v.map(|x| x.into());
1920            self
1921        }
1922
1923        /// Sets the value of [validate_only][crate::model::CreateWorkstationRequest::validate_only].
1924        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1925            self.0.request.validate_only = v.into();
1926            self
1927        }
1928    }
1929
1930    #[doc(hidden)]
1931    impl crate::RequestBuilder for CreateWorkstation {
1932        fn request_options(&mut self) -> &mut crate::RequestOptions {
1933            &mut self.0.options
1934        }
1935    }
1936
1937    /// The request builder for [Workstations::update_workstation][crate::client::Workstations::update_workstation] calls.
1938    ///
1939    /// # Example
1940    /// ```
1941    /// # use google_cloud_workstations_v1::builder::workstations::UpdateWorkstation;
1942    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
1943    /// use google_cloud_lro::Poller;
1944    ///
1945    /// let builder = prepare_request_builder();
1946    /// let response = builder.poller().until_done().await?;
1947    /// # Ok(()) }
1948    ///
1949    /// fn prepare_request_builder() -> UpdateWorkstation {
1950    ///   # panic!();
1951    ///   // ... details omitted ...
1952    /// }
1953    /// ```
1954    #[derive(Clone, Debug)]
1955    pub struct UpdateWorkstation(RequestBuilder<crate::model::UpdateWorkstationRequest>);
1956
1957    impl UpdateWorkstation {
1958        pub(crate) fn new(
1959            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1960        ) -> Self {
1961            Self(RequestBuilder::new(stub))
1962        }
1963
1964        /// Sets the full request, replacing any prior values.
1965        pub fn with_request<V: Into<crate::model::UpdateWorkstationRequest>>(
1966            mut self,
1967            v: V,
1968        ) -> Self {
1969            self.0.request = v.into();
1970            self
1971        }
1972
1973        /// Sets all the options, replacing any prior values.
1974        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1975            self.0.options = v.into();
1976            self
1977        }
1978
1979        /// Sends the request.
1980        ///
1981        /// # Long running operations
1982        ///
1983        /// This starts, but does not poll, a longrunning operation. More information
1984        /// on [update_workstation][crate::client::Workstations::update_workstation].
1985        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1986            (*self.0.stub)
1987                .update_workstation(self.0.request, self.0.options)
1988                .await
1989                .map(crate::Response::into_body)
1990        }
1991
1992        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_workstation`.
1993        pub fn poller(
1994            self,
1995        ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
1996        {
1997            type Operation = google_cloud_lro::internal::Operation<
1998                crate::model::Workstation,
1999                crate::model::OperationMetadata,
2000            >;
2001            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2002            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2003            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2004            if let Some(ref mut details) = poller_options.tracing {
2005                details.method_name = "google_cloud_workstations_v1::client::Workstations::update_workstation::until_done";
2006            }
2007
2008            let stub = self.0.stub.clone();
2009            let mut options = self.0.options.clone();
2010            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2011            let query = move |name| {
2012                let stub = stub.clone();
2013                let options = options.clone();
2014                async {
2015                    let op = GetOperation::new(stub)
2016                        .set_name(name)
2017                        .with_options(options)
2018                        .send()
2019                        .await?;
2020                    Ok(Operation::new(op))
2021                }
2022            };
2023
2024            let start = move || async {
2025                let op = self.send().await?;
2026                Ok(Operation::new(op))
2027            };
2028
2029            use google_cloud_lro::internal::PollerExt;
2030            {
2031                google_cloud_lro::internal::new_poller(
2032                    polling_error_policy,
2033                    polling_backoff_policy,
2034                    start,
2035                    query,
2036                )
2037            }
2038            .with_options(poller_options)
2039        }
2040
2041        /// Sets the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
2042        ///
2043        /// This is a **required** field for requests.
2044        pub fn set_workstation<T>(mut self, v: T) -> Self
2045        where
2046            T: std::convert::Into<crate::model::Workstation>,
2047        {
2048            self.0.request.workstation = std::option::Option::Some(v.into());
2049            self
2050        }
2051
2052        /// Sets or clears the value of [workstation][crate::model::UpdateWorkstationRequest::workstation].
2053        ///
2054        /// This is a **required** field for requests.
2055        pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
2056        where
2057            T: std::convert::Into<crate::model::Workstation>,
2058        {
2059            self.0.request.workstation = v.map(|x| x.into());
2060            self
2061        }
2062
2063        /// Sets the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
2064        ///
2065        /// This is a **required** field for requests.
2066        pub fn set_update_mask<T>(mut self, v: T) -> Self
2067        where
2068            T: std::convert::Into<wkt::FieldMask>,
2069        {
2070            self.0.request.update_mask = std::option::Option::Some(v.into());
2071            self
2072        }
2073
2074        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkstationRequest::update_mask].
2075        ///
2076        /// This is a **required** field for requests.
2077        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2078        where
2079            T: std::convert::Into<wkt::FieldMask>,
2080        {
2081            self.0.request.update_mask = v.map(|x| x.into());
2082            self
2083        }
2084
2085        /// Sets the value of [validate_only][crate::model::UpdateWorkstationRequest::validate_only].
2086        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2087            self.0.request.validate_only = v.into();
2088            self
2089        }
2090
2091        /// Sets the value of [allow_missing][crate::model::UpdateWorkstationRequest::allow_missing].
2092        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2093            self.0.request.allow_missing = v.into();
2094            self
2095        }
2096    }
2097
2098    #[doc(hidden)]
2099    impl crate::RequestBuilder for UpdateWorkstation {
2100        fn request_options(&mut self) -> &mut crate::RequestOptions {
2101            &mut self.0.options
2102        }
2103    }
2104
2105    /// The request builder for [Workstations::delete_workstation][crate::client::Workstations::delete_workstation] calls.
2106    ///
2107    /// # Example
2108    /// ```
2109    /// # use google_cloud_workstations_v1::builder::workstations::DeleteWorkstation;
2110    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2111    /// use google_cloud_lro::Poller;
2112    ///
2113    /// let builder = prepare_request_builder();
2114    /// let response = builder.poller().until_done().await?;
2115    /// # Ok(()) }
2116    ///
2117    /// fn prepare_request_builder() -> DeleteWorkstation {
2118    ///   # panic!();
2119    ///   // ... details omitted ...
2120    /// }
2121    /// ```
2122    #[derive(Clone, Debug)]
2123    pub struct DeleteWorkstation(RequestBuilder<crate::model::DeleteWorkstationRequest>);
2124
2125    impl DeleteWorkstation {
2126        pub(crate) fn new(
2127            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2128        ) -> Self {
2129            Self(RequestBuilder::new(stub))
2130        }
2131
2132        /// Sets the full request, replacing any prior values.
2133        pub fn with_request<V: Into<crate::model::DeleteWorkstationRequest>>(
2134            mut self,
2135            v: V,
2136        ) -> Self {
2137            self.0.request = v.into();
2138            self
2139        }
2140
2141        /// Sets all the options, replacing any prior values.
2142        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2143            self.0.options = v.into();
2144            self
2145        }
2146
2147        /// Sends the request.
2148        ///
2149        /// # Long running operations
2150        ///
2151        /// This starts, but does not poll, a longrunning operation. More information
2152        /// on [delete_workstation][crate::client::Workstations::delete_workstation].
2153        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2154            (*self.0.stub)
2155                .delete_workstation(self.0.request, self.0.options)
2156                .await
2157                .map(crate::Response::into_body)
2158        }
2159
2160        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_workstation`.
2161        pub fn poller(
2162            self,
2163        ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2164        {
2165            type Operation = google_cloud_lro::internal::Operation<
2166                crate::model::Workstation,
2167                crate::model::OperationMetadata,
2168            >;
2169            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2170            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2171            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2172            if let Some(ref mut details) = poller_options.tracing {
2173                details.method_name = "google_cloud_workstations_v1::client::Workstations::delete_workstation::until_done";
2174            }
2175
2176            let stub = self.0.stub.clone();
2177            let mut options = self.0.options.clone();
2178            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2179            let query = move |name| {
2180                let stub = stub.clone();
2181                let options = options.clone();
2182                async {
2183                    let op = GetOperation::new(stub)
2184                        .set_name(name)
2185                        .with_options(options)
2186                        .send()
2187                        .await?;
2188                    Ok(Operation::new(op))
2189                }
2190            };
2191
2192            let start = move || async {
2193                let op = self.send().await?;
2194                Ok(Operation::new(op))
2195            };
2196
2197            use google_cloud_lro::internal::PollerExt;
2198            {
2199                google_cloud_lro::internal::new_poller(
2200                    polling_error_policy,
2201                    polling_backoff_policy,
2202                    start,
2203                    query,
2204                )
2205            }
2206            .with_options(poller_options)
2207        }
2208
2209        /// Sets the value of [name][crate::model::DeleteWorkstationRequest::name].
2210        ///
2211        /// This is a **required** field for requests.
2212        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2213            self.0.request.name = v.into();
2214            self
2215        }
2216
2217        /// Sets the value of [validate_only][crate::model::DeleteWorkstationRequest::validate_only].
2218        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2219            self.0.request.validate_only = v.into();
2220            self
2221        }
2222
2223        /// Sets the value of [etag][crate::model::DeleteWorkstationRequest::etag].
2224        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2225            self.0.request.etag = v.into();
2226            self
2227        }
2228    }
2229
2230    #[doc(hidden)]
2231    impl crate::RequestBuilder for DeleteWorkstation {
2232        fn request_options(&mut self) -> &mut crate::RequestOptions {
2233            &mut self.0.options
2234        }
2235    }
2236
2237    /// The request builder for [Workstations::start_workstation][crate::client::Workstations::start_workstation] calls.
2238    ///
2239    /// # Example
2240    /// ```
2241    /// # use google_cloud_workstations_v1::builder::workstations::StartWorkstation;
2242    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2243    /// use google_cloud_lro::Poller;
2244    ///
2245    /// let builder = prepare_request_builder();
2246    /// let response = builder.poller().until_done().await?;
2247    /// # Ok(()) }
2248    ///
2249    /// fn prepare_request_builder() -> StartWorkstation {
2250    ///   # panic!();
2251    ///   // ... details omitted ...
2252    /// }
2253    /// ```
2254    #[derive(Clone, Debug)]
2255    pub struct StartWorkstation(RequestBuilder<crate::model::StartWorkstationRequest>);
2256
2257    impl StartWorkstation {
2258        pub(crate) fn new(
2259            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2260        ) -> Self {
2261            Self(RequestBuilder::new(stub))
2262        }
2263
2264        /// Sets the full request, replacing any prior values.
2265        pub fn with_request<V: Into<crate::model::StartWorkstationRequest>>(
2266            mut self,
2267            v: V,
2268        ) -> Self {
2269            self.0.request = v.into();
2270            self
2271        }
2272
2273        /// Sets all the options, replacing any prior values.
2274        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2275            self.0.options = v.into();
2276            self
2277        }
2278
2279        /// Sends the request.
2280        ///
2281        /// # Long running operations
2282        ///
2283        /// This starts, but does not poll, a longrunning operation. More information
2284        /// on [start_workstation][crate::client::Workstations::start_workstation].
2285        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2286            (*self.0.stub)
2287                .start_workstation(self.0.request, self.0.options)
2288                .await
2289                .map(crate::Response::into_body)
2290        }
2291
2292        /// Creates a [Poller][google_cloud_lro::Poller] to work with `start_workstation`.
2293        pub fn poller(
2294            self,
2295        ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2296        {
2297            type Operation = google_cloud_lro::internal::Operation<
2298                crate::model::Workstation,
2299                crate::model::OperationMetadata,
2300            >;
2301            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2302            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2303            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2304            if let Some(ref mut details) = poller_options.tracing {
2305                details.method_name = "google_cloud_workstations_v1::client::Workstations::start_workstation::until_done";
2306            }
2307
2308            let stub = self.0.stub.clone();
2309            let mut options = self.0.options.clone();
2310            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2311            let query = move |name| {
2312                let stub = stub.clone();
2313                let options = options.clone();
2314                async {
2315                    let op = GetOperation::new(stub)
2316                        .set_name(name)
2317                        .with_options(options)
2318                        .send()
2319                        .await?;
2320                    Ok(Operation::new(op))
2321                }
2322            };
2323
2324            let start = move || async {
2325                let op = self.send().await?;
2326                Ok(Operation::new(op))
2327            };
2328
2329            use google_cloud_lro::internal::PollerExt;
2330            {
2331                google_cloud_lro::internal::new_poller(
2332                    polling_error_policy,
2333                    polling_backoff_policy,
2334                    start,
2335                    query,
2336                )
2337            }
2338            .with_options(poller_options)
2339        }
2340
2341        /// Sets the value of [name][crate::model::StartWorkstationRequest::name].
2342        ///
2343        /// This is a **required** field for requests.
2344        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2345            self.0.request.name = v.into();
2346            self
2347        }
2348
2349        /// Sets the value of [validate_only][crate::model::StartWorkstationRequest::validate_only].
2350        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2351            self.0.request.validate_only = v.into();
2352            self
2353        }
2354
2355        /// Sets the value of [etag][crate::model::StartWorkstationRequest::etag].
2356        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2357            self.0.request.etag = v.into();
2358            self
2359        }
2360
2361        /// Sets the value of [boost_config][crate::model::StartWorkstationRequest::boost_config].
2362        pub fn set_boost_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2363            self.0.request.boost_config = v.into();
2364            self
2365        }
2366    }
2367
2368    #[doc(hidden)]
2369    impl crate::RequestBuilder for StartWorkstation {
2370        fn request_options(&mut self) -> &mut crate::RequestOptions {
2371            &mut self.0.options
2372        }
2373    }
2374
2375    /// The request builder for [Workstations::stop_workstation][crate::client::Workstations::stop_workstation] calls.
2376    ///
2377    /// # Example
2378    /// ```
2379    /// # use google_cloud_workstations_v1::builder::workstations::StopWorkstation;
2380    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2381    /// use google_cloud_lro::Poller;
2382    ///
2383    /// let builder = prepare_request_builder();
2384    /// let response = builder.poller().until_done().await?;
2385    /// # Ok(()) }
2386    ///
2387    /// fn prepare_request_builder() -> StopWorkstation {
2388    ///   # panic!();
2389    ///   // ... details omitted ...
2390    /// }
2391    /// ```
2392    #[derive(Clone, Debug)]
2393    pub struct StopWorkstation(RequestBuilder<crate::model::StopWorkstationRequest>);
2394
2395    impl StopWorkstation {
2396        pub(crate) fn new(
2397            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2398        ) -> Self {
2399            Self(RequestBuilder::new(stub))
2400        }
2401
2402        /// Sets the full request, replacing any prior values.
2403        pub fn with_request<V: Into<crate::model::StopWorkstationRequest>>(mut self, v: V) -> Self {
2404            self.0.request = v.into();
2405            self
2406        }
2407
2408        /// Sets all the options, replacing any prior values.
2409        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2410            self.0.options = v.into();
2411            self
2412        }
2413
2414        /// Sends the request.
2415        ///
2416        /// # Long running operations
2417        ///
2418        /// This starts, but does not poll, a longrunning operation. More information
2419        /// on [stop_workstation][crate::client::Workstations::stop_workstation].
2420        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2421            (*self.0.stub)
2422                .stop_workstation(self.0.request, self.0.options)
2423                .await
2424                .map(crate::Response::into_body)
2425        }
2426
2427        /// Creates a [Poller][google_cloud_lro::Poller] to work with `stop_workstation`.
2428        pub fn poller(
2429            self,
2430        ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2431        {
2432            type Operation = google_cloud_lro::internal::Operation<
2433                crate::model::Workstation,
2434                crate::model::OperationMetadata,
2435            >;
2436            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2437            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2438            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2439            if let Some(ref mut details) = poller_options.tracing {
2440                details.method_name = "google_cloud_workstations_v1::client::Workstations::stop_workstation::until_done";
2441            }
2442
2443            let stub = self.0.stub.clone();
2444            let mut options = self.0.options.clone();
2445            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2446            let query = move |name| {
2447                let stub = stub.clone();
2448                let options = options.clone();
2449                async {
2450                    let op = GetOperation::new(stub)
2451                        .set_name(name)
2452                        .with_options(options)
2453                        .send()
2454                        .await?;
2455                    Ok(Operation::new(op))
2456                }
2457            };
2458
2459            let start = move || async {
2460                let op = self.send().await?;
2461                Ok(Operation::new(op))
2462            };
2463
2464            use google_cloud_lro::internal::PollerExt;
2465            {
2466                google_cloud_lro::internal::new_poller(
2467                    polling_error_policy,
2468                    polling_backoff_policy,
2469                    start,
2470                    query,
2471                )
2472            }
2473            .with_options(poller_options)
2474        }
2475
2476        /// Sets the value of [name][crate::model::StopWorkstationRequest::name].
2477        ///
2478        /// This is a **required** field for requests.
2479        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2480            self.0.request.name = v.into();
2481            self
2482        }
2483
2484        /// Sets the value of [validate_only][crate::model::StopWorkstationRequest::validate_only].
2485        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2486            self.0.request.validate_only = v.into();
2487            self
2488        }
2489
2490        /// Sets the value of [etag][crate::model::StopWorkstationRequest::etag].
2491        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2492            self.0.request.etag = v.into();
2493            self
2494        }
2495    }
2496
2497    #[doc(hidden)]
2498    impl crate::RequestBuilder for StopWorkstation {
2499        fn request_options(&mut self) -> &mut crate::RequestOptions {
2500            &mut self.0.options
2501        }
2502    }
2503
2504    /// The request builder for [Workstations::generate_access_token][crate::client::Workstations::generate_access_token] calls.
2505    ///
2506    /// # Example
2507    /// ```
2508    /// # use google_cloud_workstations_v1::builder::workstations::GenerateAccessToken;
2509    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2510    ///
2511    /// let builder = prepare_request_builder();
2512    /// let response = builder.send().await?;
2513    /// # Ok(()) }
2514    ///
2515    /// fn prepare_request_builder() -> GenerateAccessToken {
2516    ///   # panic!();
2517    ///   // ... details omitted ...
2518    /// }
2519    /// ```
2520    #[derive(Clone, Debug)]
2521    pub struct GenerateAccessToken(RequestBuilder<crate::model::GenerateAccessTokenRequest>);
2522
2523    impl GenerateAccessToken {
2524        pub(crate) fn new(
2525            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2526        ) -> Self {
2527            Self(RequestBuilder::new(stub))
2528        }
2529
2530        /// Sets the full request, replacing any prior values.
2531        pub fn with_request<V: Into<crate::model::GenerateAccessTokenRequest>>(
2532            mut self,
2533            v: V,
2534        ) -> Self {
2535            self.0.request = v.into();
2536            self
2537        }
2538
2539        /// Sets all the options, replacing any prior values.
2540        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2541            self.0.options = v.into();
2542            self
2543        }
2544
2545        /// Sends the request.
2546        pub async fn send(self) -> Result<crate::model::GenerateAccessTokenResponse> {
2547            (*self.0.stub)
2548                .generate_access_token(self.0.request, self.0.options)
2549                .await
2550                .map(crate::Response::into_body)
2551        }
2552
2553        /// Sets the value of [workstation][crate::model::GenerateAccessTokenRequest::workstation].
2554        ///
2555        /// This is a **required** field for requests.
2556        pub fn set_workstation<T: Into<std::string::String>>(mut self, v: T) -> Self {
2557            self.0.request.workstation = v.into();
2558            self
2559        }
2560
2561        /// Sets the value of [port][crate::model::GenerateAccessTokenRequest::port].
2562        pub fn set_port<T: Into<i32>>(mut self, v: T) -> Self {
2563            self.0.request.port = v.into();
2564            self
2565        }
2566
2567        /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration].
2568        ///
2569        /// Note that all the setters affecting `expiration` are
2570        /// mutually exclusive.
2571        pub fn set_expiration<
2572            T: Into<Option<crate::model::generate_access_token_request::Expiration>>,
2573        >(
2574            mut self,
2575            v: T,
2576        ) -> Self {
2577            self.0.request.expiration = v.into();
2578            self
2579        }
2580
2581        /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
2582        /// to hold a `ExpireTime`.
2583        ///
2584        /// Note that all the setters affecting `expiration` are
2585        /// mutually exclusive.
2586        pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2587            mut self,
2588            v: T,
2589        ) -> Self {
2590            self.0.request = self.0.request.set_expire_time(v);
2591            self
2592        }
2593
2594        /// Sets the value of [expiration][crate::model::GenerateAccessTokenRequest::expiration]
2595        /// to hold a `Ttl`.
2596        ///
2597        /// Note that all the setters affecting `expiration` are
2598        /// mutually exclusive.
2599        pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2600            mut self,
2601            v: T,
2602        ) -> Self {
2603            self.0.request = self.0.request.set_ttl(v);
2604            self
2605        }
2606    }
2607
2608    #[doc(hidden)]
2609    impl crate::RequestBuilder for GenerateAccessToken {
2610        fn request_options(&mut self) -> &mut crate::RequestOptions {
2611            &mut self.0.options
2612        }
2613    }
2614
2615    /// The request builder for [Workstations::set_iam_policy][crate::client::Workstations::set_iam_policy] calls.
2616    ///
2617    /// # Example
2618    /// ```
2619    /// # use google_cloud_workstations_v1::builder::workstations::SetIamPolicy;
2620    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2621    ///
2622    /// let builder = prepare_request_builder();
2623    /// let response = builder.send().await?;
2624    /// # Ok(()) }
2625    ///
2626    /// fn prepare_request_builder() -> SetIamPolicy {
2627    ///   # panic!();
2628    ///   // ... details omitted ...
2629    /// }
2630    /// ```
2631    #[derive(Clone, Debug)]
2632    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2633
2634    impl SetIamPolicy {
2635        pub(crate) fn new(
2636            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2637        ) -> Self {
2638            Self(RequestBuilder::new(stub))
2639        }
2640
2641        /// Sets the full request, replacing any prior values.
2642        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2643            mut self,
2644            v: V,
2645        ) -> Self {
2646            self.0.request = v.into();
2647            self
2648        }
2649
2650        /// Sets all the options, replacing any prior values.
2651        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2652            self.0.options = v.into();
2653            self
2654        }
2655
2656        /// Sends the request.
2657        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2658            (*self.0.stub)
2659                .set_iam_policy(self.0.request, self.0.options)
2660                .await
2661                .map(crate::Response::into_body)
2662        }
2663
2664        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
2665        ///
2666        /// This is a **required** field for requests.
2667        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2668            self.0.request.resource = v.into();
2669            self
2670        }
2671
2672        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2673        ///
2674        /// This is a **required** field for requests.
2675        pub fn set_policy<T>(mut self, v: T) -> Self
2676        where
2677            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2678        {
2679            self.0.request.policy = std::option::Option::Some(v.into());
2680            self
2681        }
2682
2683        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
2684        ///
2685        /// This is a **required** field for requests.
2686        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2687        where
2688            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2689        {
2690            self.0.request.policy = v.map(|x| x.into());
2691            self
2692        }
2693
2694        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2695        pub fn set_update_mask<T>(mut self, v: T) -> Self
2696        where
2697            T: std::convert::Into<wkt::FieldMask>,
2698        {
2699            self.0.request.update_mask = std::option::Option::Some(v.into());
2700            self
2701        }
2702
2703        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
2704        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2705        where
2706            T: std::convert::Into<wkt::FieldMask>,
2707        {
2708            self.0.request.update_mask = v.map(|x| x.into());
2709            self
2710        }
2711    }
2712
2713    #[doc(hidden)]
2714    impl crate::RequestBuilder for SetIamPolicy {
2715        fn request_options(&mut self) -> &mut crate::RequestOptions {
2716            &mut self.0.options
2717        }
2718    }
2719
2720    /// The request builder for [Workstations::get_iam_policy][crate::client::Workstations::get_iam_policy] calls.
2721    ///
2722    /// # Example
2723    /// ```
2724    /// # use google_cloud_workstations_v1::builder::workstations::GetIamPolicy;
2725    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2726    ///
2727    /// let builder = prepare_request_builder();
2728    /// let response = builder.send().await?;
2729    /// # Ok(()) }
2730    ///
2731    /// fn prepare_request_builder() -> GetIamPolicy {
2732    ///   # panic!();
2733    ///   // ... details omitted ...
2734    /// }
2735    /// ```
2736    #[derive(Clone, Debug)]
2737    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
2738
2739    impl GetIamPolicy {
2740        pub(crate) fn new(
2741            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2742        ) -> Self {
2743            Self(RequestBuilder::new(stub))
2744        }
2745
2746        /// Sets the full request, replacing any prior values.
2747        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2748            mut self,
2749            v: V,
2750        ) -> Self {
2751            self.0.request = v.into();
2752            self
2753        }
2754
2755        /// Sets all the options, replacing any prior values.
2756        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2757            self.0.options = v.into();
2758            self
2759        }
2760
2761        /// Sends the request.
2762        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2763            (*self.0.stub)
2764                .get_iam_policy(self.0.request, self.0.options)
2765                .await
2766                .map(crate::Response::into_body)
2767        }
2768
2769        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
2770        ///
2771        /// This is a **required** field for requests.
2772        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2773            self.0.request.resource = v.into();
2774            self
2775        }
2776
2777        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2778        pub fn set_options<T>(mut self, v: T) -> Self
2779        where
2780            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2781        {
2782            self.0.request.options = std::option::Option::Some(v.into());
2783            self
2784        }
2785
2786        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
2787        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2788        where
2789            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2790        {
2791            self.0.request.options = v.map(|x| x.into());
2792            self
2793        }
2794    }
2795
2796    #[doc(hidden)]
2797    impl crate::RequestBuilder for GetIamPolicy {
2798        fn request_options(&mut self) -> &mut crate::RequestOptions {
2799            &mut self.0.options
2800        }
2801    }
2802
2803    /// The request builder for [Workstations::test_iam_permissions][crate::client::Workstations::test_iam_permissions] calls.
2804    ///
2805    /// # Example
2806    /// ```
2807    /// # use google_cloud_workstations_v1::builder::workstations::TestIamPermissions;
2808    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2809    ///
2810    /// let builder = prepare_request_builder();
2811    /// let response = builder.send().await?;
2812    /// # Ok(()) }
2813    ///
2814    /// fn prepare_request_builder() -> TestIamPermissions {
2815    ///   # panic!();
2816    ///   // ... details omitted ...
2817    /// }
2818    /// ```
2819    #[derive(Clone, Debug)]
2820    pub struct TestIamPermissions(
2821        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2822    );
2823
2824    impl TestIamPermissions {
2825        pub(crate) fn new(
2826            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2827        ) -> Self {
2828            Self(RequestBuilder::new(stub))
2829        }
2830
2831        /// Sets the full request, replacing any prior values.
2832        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2833            mut self,
2834            v: V,
2835        ) -> Self {
2836            self.0.request = v.into();
2837            self
2838        }
2839
2840        /// Sets all the options, replacing any prior values.
2841        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2842            self.0.options = v.into();
2843            self
2844        }
2845
2846        /// Sends the request.
2847        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2848            (*self.0.stub)
2849                .test_iam_permissions(self.0.request, self.0.options)
2850                .await
2851                .map(crate::Response::into_body)
2852        }
2853
2854        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
2855        ///
2856        /// This is a **required** field for requests.
2857        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2858            self.0.request.resource = v.into();
2859            self
2860        }
2861
2862        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
2863        ///
2864        /// This is a **required** field for requests.
2865        pub fn set_permissions<T, V>(mut self, v: T) -> Self
2866        where
2867            T: std::iter::IntoIterator<Item = V>,
2868            V: std::convert::Into<std::string::String>,
2869        {
2870            use std::iter::Iterator;
2871            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2872            self
2873        }
2874    }
2875
2876    #[doc(hidden)]
2877    impl crate::RequestBuilder for TestIamPermissions {
2878        fn request_options(&mut self) -> &mut crate::RequestOptions {
2879            &mut self.0.options
2880        }
2881    }
2882
2883    /// The request builder for [Workstations::list_operations][crate::client::Workstations::list_operations] calls.
2884    ///
2885    /// # Example
2886    /// ```
2887    /// # use google_cloud_workstations_v1::builder::workstations::ListOperations;
2888    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
2889    /// use google_cloud_gax::paginator::ItemPaginator;
2890    ///
2891    /// let builder = prepare_request_builder();
2892    /// let mut items = builder.by_item();
2893    /// while let Some(result) = items.next().await {
2894    ///   let item = result?;
2895    /// }
2896    /// # Ok(()) }
2897    ///
2898    /// fn prepare_request_builder() -> ListOperations {
2899    ///   # panic!();
2900    ///   // ... details omitted ...
2901    /// }
2902    /// ```
2903    #[derive(Clone, Debug)]
2904    pub struct ListOperations(
2905        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2906    );
2907
2908    impl ListOperations {
2909        pub(crate) fn new(
2910            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2911        ) -> Self {
2912            Self(RequestBuilder::new(stub))
2913        }
2914
2915        /// Sets the full request, replacing any prior values.
2916        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2917            mut self,
2918            v: V,
2919        ) -> Self {
2920            self.0.request = v.into();
2921            self
2922        }
2923
2924        /// Sets all the options, replacing any prior values.
2925        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2926            self.0.options = v.into();
2927            self
2928        }
2929
2930        /// Sends the request.
2931        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2932            (*self.0.stub)
2933                .list_operations(self.0.request, self.0.options)
2934                .await
2935                .map(crate::Response::into_body)
2936        }
2937
2938        /// Streams each page in the collection.
2939        pub fn by_page(
2940            self,
2941        ) -> impl google_cloud_gax::paginator::Paginator<
2942            google_cloud_longrunning::model::ListOperationsResponse,
2943            crate::Error,
2944        > {
2945            use std::clone::Clone;
2946            let token = self.0.request.page_token.clone();
2947            let execute = move |token: String| {
2948                let mut builder = self.clone();
2949                builder.0.request = builder.0.request.set_page_token(token);
2950                builder.send()
2951            };
2952            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2953        }
2954
2955        /// Streams each item in the collection.
2956        pub fn by_item(
2957            self,
2958        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2959            google_cloud_longrunning::model::ListOperationsResponse,
2960            crate::Error,
2961        > {
2962            use google_cloud_gax::paginator::Paginator;
2963            self.by_page().items()
2964        }
2965
2966        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
2967        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2968            self.0.request.name = v.into();
2969            self
2970        }
2971
2972        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
2973        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2974            self.0.request.filter = v.into();
2975            self
2976        }
2977
2978        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
2979        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2980            self.0.request.page_size = v.into();
2981            self
2982        }
2983
2984        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
2985        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2986            self.0.request.page_token = v.into();
2987            self
2988        }
2989
2990        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
2991        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2992            self.0.request.return_partial_success = v.into();
2993            self
2994        }
2995    }
2996
2997    #[doc(hidden)]
2998    impl crate::RequestBuilder for ListOperations {
2999        fn request_options(&mut self) -> &mut crate::RequestOptions {
3000            &mut self.0.options
3001        }
3002    }
3003
3004    /// The request builder for [Workstations::get_operation][crate::client::Workstations::get_operation] calls.
3005    ///
3006    /// # Example
3007    /// ```
3008    /// # use google_cloud_workstations_v1::builder::workstations::GetOperation;
3009    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
3010    ///
3011    /// let builder = prepare_request_builder();
3012    /// let response = builder.send().await?;
3013    /// # Ok(()) }
3014    ///
3015    /// fn prepare_request_builder() -> GetOperation {
3016    ///   # panic!();
3017    ///   // ... details omitted ...
3018    /// }
3019    /// ```
3020    #[derive(Clone, Debug)]
3021    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3022
3023    impl GetOperation {
3024        pub(crate) fn new(
3025            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
3026        ) -> Self {
3027            Self(RequestBuilder::new(stub))
3028        }
3029
3030        /// Sets the full request, replacing any prior values.
3031        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3032            mut self,
3033            v: V,
3034        ) -> Self {
3035            self.0.request = v.into();
3036            self
3037        }
3038
3039        /// Sets all the options, replacing any prior values.
3040        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3041            self.0.options = v.into();
3042            self
3043        }
3044
3045        /// Sends the request.
3046        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3047            (*self.0.stub)
3048                .get_operation(self.0.request, self.0.options)
3049                .await
3050                .map(crate::Response::into_body)
3051        }
3052
3053        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
3054        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3055            self.0.request.name = v.into();
3056            self
3057        }
3058    }
3059
3060    #[doc(hidden)]
3061    impl crate::RequestBuilder for GetOperation {
3062        fn request_options(&mut self) -> &mut crate::RequestOptions {
3063            &mut self.0.options
3064        }
3065    }
3066
3067    /// The request builder for [Workstations::delete_operation][crate::client::Workstations::delete_operation] calls.
3068    ///
3069    /// # Example
3070    /// ```
3071    /// # use google_cloud_workstations_v1::builder::workstations::DeleteOperation;
3072    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
3073    ///
3074    /// let builder = prepare_request_builder();
3075    /// let response = builder.send().await?;
3076    /// # Ok(()) }
3077    ///
3078    /// fn prepare_request_builder() -> DeleteOperation {
3079    ///   # panic!();
3080    ///   // ... details omitted ...
3081    /// }
3082    /// ```
3083    #[derive(Clone, Debug)]
3084    pub struct DeleteOperation(
3085        RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3086    );
3087
3088    impl DeleteOperation {
3089        pub(crate) fn new(
3090            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
3091        ) -> Self {
3092            Self(RequestBuilder::new(stub))
3093        }
3094
3095        /// Sets the full request, replacing any prior values.
3096        pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3097            mut self,
3098            v: V,
3099        ) -> Self {
3100            self.0.request = v.into();
3101            self
3102        }
3103
3104        /// Sets all the options, replacing any prior values.
3105        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3106            self.0.options = v.into();
3107            self
3108        }
3109
3110        /// Sends the request.
3111        pub async fn send(self) -> Result<()> {
3112            (*self.0.stub)
3113                .delete_operation(self.0.request, self.0.options)
3114                .await
3115                .map(crate::Response::into_body)
3116        }
3117
3118        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
3119        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3120            self.0.request.name = v.into();
3121            self
3122        }
3123    }
3124
3125    #[doc(hidden)]
3126    impl crate::RequestBuilder for DeleteOperation {
3127        fn request_options(&mut self) -> &mut crate::RequestOptions {
3128            &mut self.0.options
3129        }
3130    }
3131
3132    /// The request builder for [Workstations::cancel_operation][crate::client::Workstations::cancel_operation] calls.
3133    ///
3134    /// # Example
3135    /// ```
3136    /// # use google_cloud_workstations_v1::builder::workstations::CancelOperation;
3137    /// # async fn sample() -> google_cloud_workstations_v1::Result<()> {
3138    ///
3139    /// let builder = prepare_request_builder();
3140    /// let response = builder.send().await?;
3141    /// # Ok(()) }
3142    ///
3143    /// fn prepare_request_builder() -> CancelOperation {
3144    ///   # panic!();
3145    ///   // ... details omitted ...
3146    /// }
3147    /// ```
3148    #[derive(Clone, Debug)]
3149    pub struct CancelOperation(
3150        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3151    );
3152
3153    impl CancelOperation {
3154        pub(crate) fn new(
3155            stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
3156        ) -> Self {
3157            Self(RequestBuilder::new(stub))
3158        }
3159
3160        /// Sets the full request, replacing any prior values.
3161        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3162            mut self,
3163            v: V,
3164        ) -> Self {
3165            self.0.request = v.into();
3166            self
3167        }
3168
3169        /// Sets all the options, replacing any prior values.
3170        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3171            self.0.options = v.into();
3172            self
3173        }
3174
3175        /// Sends the request.
3176        pub async fn send(self) -> Result<()> {
3177            (*self.0.stub)
3178                .cancel_operation(self.0.request, self.0.options)
3179                .await
3180                .map(crate::Response::into_body)
3181        }
3182
3183        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
3184        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3185            self.0.request.name = v.into();
3186            self
3187        }
3188    }
3189
3190    #[doc(hidden)]
3191    impl crate::RequestBuilder for CancelOperation {
3192        fn request_options(&mut self) -> &mut crate::RequestOptions {
3193            &mut self.0.options
3194        }
3195    }
3196}