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