Skip to main content

google_cloud_workstations_v1/
builder.rs

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