Skip to main content

google_cloud_workstations_v1/
builder.rs

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