google_cloud_dataproc_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod autoscaling_policy_service {
18    use crate::Result;
19
20    /// A builder for [AutoscalingPolicyService][crate::client::AutoscalingPolicyService].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_dataproc_v1::*;
25    /// # use builder::autoscaling_policy_service::ClientBuilder;
26    /// # use client::AutoscalingPolicyService;
27    /// let builder : ClientBuilder = AutoscalingPolicyService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://dataproc.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::Ok(()) });
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::AutoscalingPolicyService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = AutoscalingPolicyService;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::AutoscalingPolicyService] 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::AutoscalingPolicyService>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [AutoscalingPolicyService::create_autoscaling_policy][crate::client::AutoscalingPolicyService::create_autoscaling_policy] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_dataproc_v1::builder;
79    /// use builder::autoscaling_policy_service::CreateAutoscalingPolicy;
80    /// # tokio_test::block_on(async {
81    ///
82    /// let builder = prepare_request_builder();
83    /// let response = builder.send().await?;
84    /// # gax::Result::<()>::Ok(()) });
85    ///
86    /// fn prepare_request_builder() -> CreateAutoscalingPolicy {
87    ///   # panic!();
88    ///   // ... details omitted ...
89    /// }
90    /// ```
91    #[derive(Clone, Debug)]
92    pub struct CreateAutoscalingPolicy(
93        RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
94    );
95
96    impl CreateAutoscalingPolicy {
97        pub(crate) fn new(
98            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
99        ) -> Self {
100            Self(RequestBuilder::new(stub))
101        }
102
103        /// Sets the full request, replacing any prior values.
104        pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
105            mut self,
106            v: V,
107        ) -> Self {
108            self.0.request = v.into();
109            self
110        }
111
112        /// Sets all the options, replacing any prior values.
113        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
114            self.0.options = v.into();
115            self
116        }
117
118        /// Sends the request.
119        pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
120            (*self.0.stub)
121                .create_autoscaling_policy(self.0.request, self.0.options)
122                .await
123                .map(gax::response::Response::into_body)
124        }
125
126        /// Sets the value of [parent][crate::model::CreateAutoscalingPolicyRequest::parent].
127        ///
128        /// This is a **required** field for requests.
129        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
130            self.0.request.parent = v.into();
131            self
132        }
133
134        /// Sets the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
135        ///
136        /// This is a **required** field for requests.
137        pub fn set_policy<T>(mut self, v: T) -> Self
138        where
139            T: std::convert::Into<crate::model::AutoscalingPolicy>,
140        {
141            self.0.request.policy = std::option::Option::Some(v.into());
142            self
143        }
144
145        /// Sets or clears the value of [policy][crate::model::CreateAutoscalingPolicyRequest::policy].
146        ///
147        /// This is a **required** field for requests.
148        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
149        where
150            T: std::convert::Into<crate::model::AutoscalingPolicy>,
151        {
152            self.0.request.policy = v.map(|x| x.into());
153            self
154        }
155    }
156
157    #[doc(hidden)]
158    impl gax::options::internal::RequestBuilder for CreateAutoscalingPolicy {
159        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
160            &mut self.0.options
161        }
162    }
163
164    /// The request builder for [AutoscalingPolicyService::update_autoscaling_policy][crate::client::AutoscalingPolicyService::update_autoscaling_policy] calls.
165    ///
166    /// # Example
167    /// ```no_run
168    /// # use google_cloud_dataproc_v1::builder;
169    /// use builder::autoscaling_policy_service::UpdateAutoscalingPolicy;
170    /// # tokio_test::block_on(async {
171    ///
172    /// let builder = prepare_request_builder();
173    /// let response = builder.send().await?;
174    /// # gax::Result::<()>::Ok(()) });
175    ///
176    /// fn prepare_request_builder() -> UpdateAutoscalingPolicy {
177    ///   # panic!();
178    ///   // ... details omitted ...
179    /// }
180    /// ```
181    #[derive(Clone, Debug)]
182    pub struct UpdateAutoscalingPolicy(
183        RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
184    );
185
186    impl UpdateAutoscalingPolicy {
187        pub(crate) fn new(
188            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
189        ) -> Self {
190            Self(RequestBuilder::new(stub))
191        }
192
193        /// Sets the full request, replacing any prior values.
194        pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
195            mut self,
196            v: V,
197        ) -> Self {
198            self.0.request = v.into();
199            self
200        }
201
202        /// Sets all the options, replacing any prior values.
203        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
204            self.0.options = v.into();
205            self
206        }
207
208        /// Sends the request.
209        pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
210            (*self.0.stub)
211                .update_autoscaling_policy(self.0.request, self.0.options)
212                .await
213                .map(gax::response::Response::into_body)
214        }
215
216        /// Sets the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
217        ///
218        /// This is a **required** field for requests.
219        pub fn set_policy<T>(mut self, v: T) -> Self
220        where
221            T: std::convert::Into<crate::model::AutoscalingPolicy>,
222        {
223            self.0.request.policy = std::option::Option::Some(v.into());
224            self
225        }
226
227        /// Sets or clears the value of [policy][crate::model::UpdateAutoscalingPolicyRequest::policy].
228        ///
229        /// This is a **required** field for requests.
230        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
231        where
232            T: std::convert::Into<crate::model::AutoscalingPolicy>,
233        {
234            self.0.request.policy = v.map(|x| x.into());
235            self
236        }
237    }
238
239    #[doc(hidden)]
240    impl gax::options::internal::RequestBuilder for UpdateAutoscalingPolicy {
241        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
242            &mut self.0.options
243        }
244    }
245
246    /// The request builder for [AutoscalingPolicyService::get_autoscaling_policy][crate::client::AutoscalingPolicyService::get_autoscaling_policy] calls.
247    ///
248    /// # Example
249    /// ```no_run
250    /// # use google_cloud_dataproc_v1::builder;
251    /// use builder::autoscaling_policy_service::GetAutoscalingPolicy;
252    /// # tokio_test::block_on(async {
253    ///
254    /// let builder = prepare_request_builder();
255    /// let response = builder.send().await?;
256    /// # gax::Result::<()>::Ok(()) });
257    ///
258    /// fn prepare_request_builder() -> GetAutoscalingPolicy {
259    ///   # panic!();
260    ///   // ... details omitted ...
261    /// }
262    /// ```
263    #[derive(Clone, Debug)]
264    pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
265
266    impl GetAutoscalingPolicy {
267        pub(crate) fn new(
268            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
269        ) -> Self {
270            Self(RequestBuilder::new(stub))
271        }
272
273        /// Sets the full request, replacing any prior values.
274        pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
275            mut self,
276            v: V,
277        ) -> Self {
278            self.0.request = v.into();
279            self
280        }
281
282        /// Sets all the options, replacing any prior values.
283        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
284            self.0.options = v.into();
285            self
286        }
287
288        /// Sends the request.
289        pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
290            (*self.0.stub)
291                .get_autoscaling_policy(self.0.request, self.0.options)
292                .await
293                .map(gax::response::Response::into_body)
294        }
295
296        /// Sets the value of [name][crate::model::GetAutoscalingPolicyRequest::name].
297        ///
298        /// This is a **required** field for requests.
299        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
300            self.0.request.name = v.into();
301            self
302        }
303    }
304
305    #[doc(hidden)]
306    impl gax::options::internal::RequestBuilder for GetAutoscalingPolicy {
307        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
308            &mut self.0.options
309        }
310    }
311
312    /// The request builder for [AutoscalingPolicyService::list_autoscaling_policies][crate::client::AutoscalingPolicyService::list_autoscaling_policies] calls.
313    ///
314    /// # Example
315    /// ```no_run
316    /// # use google_cloud_dataproc_v1::builder;
317    /// use builder::autoscaling_policy_service::ListAutoscalingPolicies;
318    /// # tokio_test::block_on(async {
319    /// use gax::paginator::ItemPaginator;
320    ///
321    /// let builder = prepare_request_builder();
322    /// let mut items = builder.by_item();
323    /// while let Some(result) = items.next().await {
324    ///   let item = result?;
325    /// }
326    /// # gax::Result::<()>::Ok(()) });
327    ///
328    /// fn prepare_request_builder() -> ListAutoscalingPolicies {
329    ///   # panic!();
330    ///   // ... details omitted ...
331    /// }
332    /// ```
333    #[derive(Clone, Debug)]
334    pub struct ListAutoscalingPolicies(
335        RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
336    );
337
338    impl ListAutoscalingPolicies {
339        pub(crate) fn new(
340            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
341        ) -> Self {
342            Self(RequestBuilder::new(stub))
343        }
344
345        /// Sets the full request, replacing any prior values.
346        pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
347            mut self,
348            v: V,
349        ) -> Self {
350            self.0.request = v.into();
351            self
352        }
353
354        /// Sets all the options, replacing any prior values.
355        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
356            self.0.options = v.into();
357            self
358        }
359
360        /// Sends the request.
361        pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
362            (*self.0.stub)
363                .list_autoscaling_policies(self.0.request, self.0.options)
364                .await
365                .map(gax::response::Response::into_body)
366        }
367
368        /// Streams each page in the collection.
369        pub fn by_page(
370            self,
371        ) -> impl gax::paginator::Paginator<
372            crate::model::ListAutoscalingPoliciesResponse,
373            gax::error::Error,
374        > {
375            use std::clone::Clone;
376            let token = self.0.request.page_token.clone();
377            let execute = move |token: String| {
378                let mut builder = self.clone();
379                builder.0.request = builder.0.request.set_page_token(token);
380                builder.send()
381            };
382            gax::paginator::internal::new_paginator(token, execute)
383        }
384
385        /// Streams each item in the collection.
386        pub fn by_item(
387            self,
388        ) -> impl gax::paginator::ItemPaginator<
389            crate::model::ListAutoscalingPoliciesResponse,
390            gax::error::Error,
391        > {
392            use gax::paginator::Paginator;
393            self.by_page().items()
394        }
395
396        /// Sets the value of [parent][crate::model::ListAutoscalingPoliciesRequest::parent].
397        ///
398        /// This is a **required** field for requests.
399        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
400            self.0.request.parent = v.into();
401            self
402        }
403
404        /// Sets the value of [page_size][crate::model::ListAutoscalingPoliciesRequest::page_size].
405        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
406            self.0.request.page_size = v.into();
407            self
408        }
409
410        /// Sets the value of [page_token][crate::model::ListAutoscalingPoliciesRequest::page_token].
411        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
412            self.0.request.page_token = v.into();
413            self
414        }
415    }
416
417    #[doc(hidden)]
418    impl gax::options::internal::RequestBuilder for ListAutoscalingPolicies {
419        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
420            &mut self.0.options
421        }
422    }
423
424    /// The request builder for [AutoscalingPolicyService::delete_autoscaling_policy][crate::client::AutoscalingPolicyService::delete_autoscaling_policy] calls.
425    ///
426    /// # Example
427    /// ```no_run
428    /// # use google_cloud_dataproc_v1::builder;
429    /// use builder::autoscaling_policy_service::DeleteAutoscalingPolicy;
430    /// # tokio_test::block_on(async {
431    ///
432    /// let builder = prepare_request_builder();
433    /// let response = builder.send().await?;
434    /// # gax::Result::<()>::Ok(()) });
435    ///
436    /// fn prepare_request_builder() -> DeleteAutoscalingPolicy {
437    ///   # panic!();
438    ///   // ... details omitted ...
439    /// }
440    /// ```
441    #[derive(Clone, Debug)]
442    pub struct DeleteAutoscalingPolicy(
443        RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
444    );
445
446    impl DeleteAutoscalingPolicy {
447        pub(crate) fn new(
448            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
449        ) -> Self {
450            Self(RequestBuilder::new(stub))
451        }
452
453        /// Sets the full request, replacing any prior values.
454        pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
455            mut self,
456            v: V,
457        ) -> Self {
458            self.0.request = v.into();
459            self
460        }
461
462        /// Sets all the options, replacing any prior values.
463        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
464            self.0.options = v.into();
465            self
466        }
467
468        /// Sends the request.
469        pub async fn send(self) -> Result<()> {
470            (*self.0.stub)
471                .delete_autoscaling_policy(self.0.request, self.0.options)
472                .await
473                .map(gax::response::Response::into_body)
474        }
475
476        /// Sets the value of [name][crate::model::DeleteAutoscalingPolicyRequest::name].
477        ///
478        /// This is a **required** field for requests.
479        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
480            self.0.request.name = v.into();
481            self
482        }
483    }
484
485    #[doc(hidden)]
486    impl gax::options::internal::RequestBuilder for DeleteAutoscalingPolicy {
487        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
488            &mut self.0.options
489        }
490    }
491
492    /// The request builder for [AutoscalingPolicyService::set_iam_policy][crate::client::AutoscalingPolicyService::set_iam_policy] calls.
493    ///
494    /// # Example
495    /// ```no_run
496    /// # use google_cloud_dataproc_v1::builder;
497    /// use builder::autoscaling_policy_service::SetIamPolicy;
498    /// # tokio_test::block_on(async {
499    ///
500    /// let builder = prepare_request_builder();
501    /// let response = builder.send().await?;
502    /// # gax::Result::<()>::Ok(()) });
503    ///
504    /// fn prepare_request_builder() -> SetIamPolicy {
505    ///   # panic!();
506    ///   // ... details omitted ...
507    /// }
508    /// ```
509    #[derive(Clone, Debug)]
510    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
511
512    impl SetIamPolicy {
513        pub(crate) fn new(
514            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
515        ) -> Self {
516            Self(RequestBuilder::new(stub))
517        }
518
519        /// Sets the full request, replacing any prior values.
520        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
521            self.0.request = v.into();
522            self
523        }
524
525        /// Sets all the options, replacing any prior values.
526        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
527            self.0.options = v.into();
528            self
529        }
530
531        /// Sends the request.
532        pub async fn send(self) -> Result<iam_v1::model::Policy> {
533            (*self.0.stub)
534                .set_iam_policy(self.0.request, self.0.options)
535                .await
536                .map(gax::response::Response::into_body)
537        }
538
539        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
540        ///
541        /// This is a **required** field for requests.
542        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
543            self.0.request.resource = v.into();
544            self
545        }
546
547        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
548        ///
549        /// This is a **required** field for requests.
550        pub fn set_policy<T>(mut self, v: T) -> Self
551        where
552            T: std::convert::Into<iam_v1::model::Policy>,
553        {
554            self.0.request.policy = std::option::Option::Some(v.into());
555            self
556        }
557
558        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
559        ///
560        /// This is a **required** field for requests.
561        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
562        where
563            T: std::convert::Into<iam_v1::model::Policy>,
564        {
565            self.0.request.policy = v.map(|x| x.into());
566            self
567        }
568
569        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
570        pub fn set_update_mask<T>(mut self, v: T) -> Self
571        where
572            T: std::convert::Into<wkt::FieldMask>,
573        {
574            self.0.request.update_mask = std::option::Option::Some(v.into());
575            self
576        }
577
578        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
579        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
580        where
581            T: std::convert::Into<wkt::FieldMask>,
582        {
583            self.0.request.update_mask = v.map(|x| x.into());
584            self
585        }
586    }
587
588    #[doc(hidden)]
589    impl gax::options::internal::RequestBuilder for SetIamPolicy {
590        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
591            &mut self.0.options
592        }
593    }
594
595    /// The request builder for [AutoscalingPolicyService::get_iam_policy][crate::client::AutoscalingPolicyService::get_iam_policy] calls.
596    ///
597    /// # Example
598    /// ```no_run
599    /// # use google_cloud_dataproc_v1::builder;
600    /// use builder::autoscaling_policy_service::GetIamPolicy;
601    /// # tokio_test::block_on(async {
602    ///
603    /// let builder = prepare_request_builder();
604    /// let response = builder.send().await?;
605    /// # gax::Result::<()>::Ok(()) });
606    ///
607    /// fn prepare_request_builder() -> GetIamPolicy {
608    ///   # panic!();
609    ///   // ... details omitted ...
610    /// }
611    /// ```
612    #[derive(Clone, Debug)]
613    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
614
615    impl GetIamPolicy {
616        pub(crate) fn new(
617            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
618        ) -> Self {
619            Self(RequestBuilder::new(stub))
620        }
621
622        /// Sets the full request, replacing any prior values.
623        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
624            self.0.request = v.into();
625            self
626        }
627
628        /// Sets all the options, replacing any prior values.
629        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
630            self.0.options = v.into();
631            self
632        }
633
634        /// Sends the request.
635        pub async fn send(self) -> Result<iam_v1::model::Policy> {
636            (*self.0.stub)
637                .get_iam_policy(self.0.request, self.0.options)
638                .await
639                .map(gax::response::Response::into_body)
640        }
641
642        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
643        ///
644        /// This is a **required** field for requests.
645        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
646            self.0.request.resource = v.into();
647            self
648        }
649
650        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
651        pub fn set_options<T>(mut self, v: T) -> Self
652        where
653            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
654        {
655            self.0.request.options = std::option::Option::Some(v.into());
656            self
657        }
658
659        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
660        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
661        where
662            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
663        {
664            self.0.request.options = v.map(|x| x.into());
665            self
666        }
667    }
668
669    #[doc(hidden)]
670    impl gax::options::internal::RequestBuilder for GetIamPolicy {
671        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
672            &mut self.0.options
673        }
674    }
675
676    /// The request builder for [AutoscalingPolicyService::test_iam_permissions][crate::client::AutoscalingPolicyService::test_iam_permissions] calls.
677    ///
678    /// # Example
679    /// ```no_run
680    /// # use google_cloud_dataproc_v1::builder;
681    /// use builder::autoscaling_policy_service::TestIamPermissions;
682    /// # tokio_test::block_on(async {
683    ///
684    /// let builder = prepare_request_builder();
685    /// let response = builder.send().await?;
686    /// # gax::Result::<()>::Ok(()) });
687    ///
688    /// fn prepare_request_builder() -> TestIamPermissions {
689    ///   # panic!();
690    ///   // ... details omitted ...
691    /// }
692    /// ```
693    #[derive(Clone, Debug)]
694    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
695
696    impl TestIamPermissions {
697        pub(crate) fn new(
698            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
699        ) -> Self {
700            Self(RequestBuilder::new(stub))
701        }
702
703        /// Sets the full request, replacing any prior values.
704        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
705            mut self,
706            v: V,
707        ) -> Self {
708            self.0.request = v.into();
709            self
710        }
711
712        /// Sets all the options, replacing any prior values.
713        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
714            self.0.options = v.into();
715            self
716        }
717
718        /// Sends the request.
719        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
720            (*self.0.stub)
721                .test_iam_permissions(self.0.request, self.0.options)
722                .await
723                .map(gax::response::Response::into_body)
724        }
725
726        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
727        ///
728        /// This is a **required** field for requests.
729        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
730            self.0.request.resource = v.into();
731            self
732        }
733
734        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
735        ///
736        /// This is a **required** field for requests.
737        pub fn set_permissions<T, V>(mut self, v: T) -> Self
738        where
739            T: std::iter::IntoIterator<Item = V>,
740            V: std::convert::Into<std::string::String>,
741        {
742            use std::iter::Iterator;
743            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
744            self
745        }
746    }
747
748    #[doc(hidden)]
749    impl gax::options::internal::RequestBuilder for TestIamPermissions {
750        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
751            &mut self.0.options
752        }
753    }
754
755    /// The request builder for [AutoscalingPolicyService::list_operations][crate::client::AutoscalingPolicyService::list_operations] calls.
756    ///
757    /// # Example
758    /// ```no_run
759    /// # use google_cloud_dataproc_v1::builder;
760    /// use builder::autoscaling_policy_service::ListOperations;
761    /// # tokio_test::block_on(async {
762    /// use gax::paginator::ItemPaginator;
763    ///
764    /// let builder = prepare_request_builder();
765    /// let mut items = builder.by_item();
766    /// while let Some(result) = items.next().await {
767    ///   let item = result?;
768    /// }
769    /// # gax::Result::<()>::Ok(()) });
770    ///
771    /// fn prepare_request_builder() -> ListOperations {
772    ///   # panic!();
773    ///   // ... details omitted ...
774    /// }
775    /// ```
776    #[derive(Clone, Debug)]
777    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
778
779    impl ListOperations {
780        pub(crate) fn new(
781            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
782        ) -> Self {
783            Self(RequestBuilder::new(stub))
784        }
785
786        /// Sets the full request, replacing any prior values.
787        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
788            mut self,
789            v: V,
790        ) -> Self {
791            self.0.request = v.into();
792            self
793        }
794
795        /// Sets all the options, replacing any prior values.
796        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
797            self.0.options = v.into();
798            self
799        }
800
801        /// Sends the request.
802        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
803            (*self.0.stub)
804                .list_operations(self.0.request, self.0.options)
805                .await
806                .map(gax::response::Response::into_body)
807        }
808
809        /// Streams each page in the collection.
810        pub fn by_page(
811            self,
812        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
813        {
814            use std::clone::Clone;
815            let token = self.0.request.page_token.clone();
816            let execute = move |token: String| {
817                let mut builder = self.clone();
818                builder.0.request = builder.0.request.set_page_token(token);
819                builder.send()
820            };
821            gax::paginator::internal::new_paginator(token, execute)
822        }
823
824        /// Streams each item in the collection.
825        pub fn by_item(
826            self,
827        ) -> impl gax::paginator::ItemPaginator<
828            longrunning::model::ListOperationsResponse,
829            gax::error::Error,
830        > {
831            use gax::paginator::Paginator;
832            self.by_page().items()
833        }
834
835        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
836        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
837            self.0.request.name = v.into();
838            self
839        }
840
841        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
842        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
843            self.0.request.filter = v.into();
844            self
845        }
846
847        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
848        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
849            self.0.request.page_size = v.into();
850            self
851        }
852
853        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
854        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
855            self.0.request.page_token = v.into();
856            self
857        }
858    }
859
860    #[doc(hidden)]
861    impl gax::options::internal::RequestBuilder for ListOperations {
862        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
863            &mut self.0.options
864        }
865    }
866
867    /// The request builder for [AutoscalingPolicyService::get_operation][crate::client::AutoscalingPolicyService::get_operation] calls.
868    ///
869    /// # Example
870    /// ```no_run
871    /// # use google_cloud_dataproc_v1::builder;
872    /// use builder::autoscaling_policy_service::GetOperation;
873    /// # tokio_test::block_on(async {
874    ///
875    /// let builder = prepare_request_builder();
876    /// let response = builder.send().await?;
877    /// # gax::Result::<()>::Ok(()) });
878    ///
879    /// fn prepare_request_builder() -> GetOperation {
880    ///   # panic!();
881    ///   // ... details omitted ...
882    /// }
883    /// ```
884    #[derive(Clone, Debug)]
885    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
886
887    impl GetOperation {
888        pub(crate) fn new(
889            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
890        ) -> Self {
891            Self(RequestBuilder::new(stub))
892        }
893
894        /// Sets the full request, replacing any prior values.
895        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
896            mut self,
897            v: V,
898        ) -> Self {
899            self.0.request = v.into();
900            self
901        }
902
903        /// Sets all the options, replacing any prior values.
904        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
905            self.0.options = v.into();
906            self
907        }
908
909        /// Sends the request.
910        pub async fn send(self) -> Result<longrunning::model::Operation> {
911            (*self.0.stub)
912                .get_operation(self.0.request, self.0.options)
913                .await
914                .map(gax::response::Response::into_body)
915        }
916
917        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
918        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
919            self.0.request.name = v.into();
920            self
921        }
922    }
923
924    #[doc(hidden)]
925    impl gax::options::internal::RequestBuilder for GetOperation {
926        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
927            &mut self.0.options
928        }
929    }
930
931    /// The request builder for [AutoscalingPolicyService::delete_operation][crate::client::AutoscalingPolicyService::delete_operation] calls.
932    ///
933    /// # Example
934    /// ```no_run
935    /// # use google_cloud_dataproc_v1::builder;
936    /// use builder::autoscaling_policy_service::DeleteOperation;
937    /// # tokio_test::block_on(async {
938    ///
939    /// let builder = prepare_request_builder();
940    /// let response = builder.send().await?;
941    /// # gax::Result::<()>::Ok(()) });
942    ///
943    /// fn prepare_request_builder() -> DeleteOperation {
944    ///   # panic!();
945    ///   // ... details omitted ...
946    /// }
947    /// ```
948    #[derive(Clone, Debug)]
949    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
950
951    impl DeleteOperation {
952        pub(crate) fn new(
953            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
954        ) -> Self {
955            Self(RequestBuilder::new(stub))
956        }
957
958        /// Sets the full request, replacing any prior values.
959        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
960            mut self,
961            v: V,
962        ) -> Self {
963            self.0.request = v.into();
964            self
965        }
966
967        /// Sets all the options, replacing any prior values.
968        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
969            self.0.options = v.into();
970            self
971        }
972
973        /// Sends the request.
974        pub async fn send(self) -> Result<()> {
975            (*self.0.stub)
976                .delete_operation(self.0.request, self.0.options)
977                .await
978                .map(gax::response::Response::into_body)
979        }
980
981        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
982        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
983            self.0.request.name = v.into();
984            self
985        }
986    }
987
988    #[doc(hidden)]
989    impl gax::options::internal::RequestBuilder for DeleteOperation {
990        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
991            &mut self.0.options
992        }
993    }
994
995    /// The request builder for [AutoscalingPolicyService::cancel_operation][crate::client::AutoscalingPolicyService::cancel_operation] calls.
996    ///
997    /// # Example
998    /// ```no_run
999    /// # use google_cloud_dataproc_v1::builder;
1000    /// use builder::autoscaling_policy_service::CancelOperation;
1001    /// # tokio_test::block_on(async {
1002    ///
1003    /// let builder = prepare_request_builder();
1004    /// let response = builder.send().await?;
1005    /// # gax::Result::<()>::Ok(()) });
1006    ///
1007    /// fn prepare_request_builder() -> CancelOperation {
1008    ///   # panic!();
1009    ///   // ... details omitted ...
1010    /// }
1011    /// ```
1012    #[derive(Clone, Debug)]
1013    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1014
1015    impl CancelOperation {
1016        pub(crate) fn new(
1017            stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1018        ) -> Self {
1019            Self(RequestBuilder::new(stub))
1020        }
1021
1022        /// Sets the full request, replacing any prior values.
1023        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1024            mut self,
1025            v: V,
1026        ) -> Self {
1027            self.0.request = v.into();
1028            self
1029        }
1030
1031        /// Sets all the options, replacing any prior values.
1032        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1033            self.0.options = v.into();
1034            self
1035        }
1036
1037        /// Sends the request.
1038        pub async fn send(self) -> Result<()> {
1039            (*self.0.stub)
1040                .cancel_operation(self.0.request, self.0.options)
1041                .await
1042                .map(gax::response::Response::into_body)
1043        }
1044
1045        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1046        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047            self.0.request.name = v.into();
1048            self
1049        }
1050    }
1051
1052    #[doc(hidden)]
1053    impl gax::options::internal::RequestBuilder for CancelOperation {
1054        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1055            &mut self.0.options
1056        }
1057    }
1058}
1059
1060pub mod batch_controller {
1061    use crate::Result;
1062
1063    /// A builder for [BatchController][crate::client::BatchController].
1064    ///
1065    /// ```
1066    /// # tokio_test::block_on(async {
1067    /// # use google_cloud_dataproc_v1::*;
1068    /// # use builder::batch_controller::ClientBuilder;
1069    /// # use client::BatchController;
1070    /// let builder : ClientBuilder = BatchController::builder();
1071    /// let client = builder
1072    ///     .with_endpoint("https://dataproc.googleapis.com")
1073    ///     .build().await?;
1074    /// # gax::client_builder::Result::<()>::Ok(()) });
1075    /// ```
1076    pub type ClientBuilder =
1077        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1078
1079    pub(crate) mod client {
1080        use super::super::super::client::BatchController;
1081        pub struct Factory;
1082        impl gax::client_builder::internal::ClientFactory for Factory {
1083            type Client = BatchController;
1084            type Credentials = gaxi::options::Credentials;
1085            async fn build(
1086                self,
1087                config: gaxi::options::ClientConfig,
1088            ) -> gax::client_builder::Result<Self::Client> {
1089                Self::Client::new(config).await
1090            }
1091        }
1092    }
1093
1094    /// Common implementation for [crate::client::BatchController] request builders.
1095    #[derive(Clone, Debug)]
1096    pub(crate) struct RequestBuilder<R: std::default::Default> {
1097        stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1098        request: R,
1099        options: gax::options::RequestOptions,
1100    }
1101
1102    impl<R> RequestBuilder<R>
1103    where
1104        R: std::default::Default,
1105    {
1106        pub(crate) fn new(
1107            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1108        ) -> Self {
1109            Self {
1110                stub,
1111                request: R::default(),
1112                options: gax::options::RequestOptions::default(),
1113            }
1114        }
1115    }
1116
1117    /// The request builder for [BatchController::create_batch][crate::client::BatchController::create_batch] calls.
1118    ///
1119    /// # Example
1120    /// ```no_run
1121    /// # use google_cloud_dataproc_v1::builder;
1122    /// use builder::batch_controller::CreateBatch;
1123    /// # tokio_test::block_on(async {
1124    /// use lro::Poller;
1125    ///
1126    /// let builder = prepare_request_builder();
1127    /// let response = builder.poller().until_done().await?;
1128    /// # gax::Result::<()>::Ok(()) });
1129    ///
1130    /// fn prepare_request_builder() -> CreateBatch {
1131    ///   # panic!();
1132    ///   // ... details omitted ...
1133    /// }
1134    /// ```
1135    #[derive(Clone, Debug)]
1136    pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1137
1138    impl CreateBatch {
1139        pub(crate) fn new(
1140            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1141        ) -> Self {
1142            Self(RequestBuilder::new(stub))
1143        }
1144
1145        /// Sets the full request, replacing any prior values.
1146        pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1147            self.0.request = v.into();
1148            self
1149        }
1150
1151        /// Sets all the options, replacing any prior values.
1152        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1153            self.0.options = v.into();
1154            self
1155        }
1156
1157        /// Sends the request.
1158        ///
1159        /// # Long running operations
1160        ///
1161        /// This starts, but does not poll, a longrunning operation. More information
1162        /// on [create_batch][crate::client::BatchController::create_batch].
1163        pub async fn send(self) -> Result<longrunning::model::Operation> {
1164            (*self.0.stub)
1165                .create_batch(self.0.request, self.0.options)
1166                .await
1167                .map(gax::response::Response::into_body)
1168        }
1169
1170        /// Creates a [Poller][lro::Poller] to work with `create_batch`.
1171        pub fn poller(
1172            self,
1173        ) -> impl lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata> {
1174            type Operation =
1175                lro::internal::Operation<crate::model::Batch, crate::model::BatchOperationMetadata>;
1176            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1177            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1178
1179            let stub = self.0.stub.clone();
1180            let mut options = self.0.options.clone();
1181            options.set_retry_policy(gax::retry_policy::NeverRetry);
1182            let query = move |name| {
1183                let stub = stub.clone();
1184                let options = options.clone();
1185                async {
1186                    let op = GetOperation::new(stub)
1187                        .set_name(name)
1188                        .with_options(options)
1189                        .send()
1190                        .await?;
1191                    Ok(Operation::new(op))
1192                }
1193            };
1194
1195            let start = move || async {
1196                let op = self.send().await?;
1197                Ok(Operation::new(op))
1198            };
1199
1200            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1201        }
1202
1203        /// Sets the value of [parent][crate::model::CreateBatchRequest::parent].
1204        ///
1205        /// This is a **required** field for requests.
1206        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1207            self.0.request.parent = v.into();
1208            self
1209        }
1210
1211        /// Sets the value of [batch][crate::model::CreateBatchRequest::batch].
1212        ///
1213        /// This is a **required** field for requests.
1214        pub fn set_batch<T>(mut self, v: T) -> Self
1215        where
1216            T: std::convert::Into<crate::model::Batch>,
1217        {
1218            self.0.request.batch = std::option::Option::Some(v.into());
1219            self
1220        }
1221
1222        /// Sets or clears the value of [batch][crate::model::CreateBatchRequest::batch].
1223        ///
1224        /// This is a **required** field for requests.
1225        pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1226        where
1227            T: std::convert::Into<crate::model::Batch>,
1228        {
1229            self.0.request.batch = v.map(|x| x.into());
1230            self
1231        }
1232
1233        /// Sets the value of [batch_id][crate::model::CreateBatchRequest::batch_id].
1234        pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1235            self.0.request.batch_id = v.into();
1236            self
1237        }
1238
1239        /// Sets the value of [request_id][crate::model::CreateBatchRequest::request_id].
1240        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1241            self.0.request.request_id = v.into();
1242            self
1243        }
1244    }
1245
1246    #[doc(hidden)]
1247    impl gax::options::internal::RequestBuilder for CreateBatch {
1248        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1249            &mut self.0.options
1250        }
1251    }
1252
1253    /// The request builder for [BatchController::get_batch][crate::client::BatchController::get_batch] calls.
1254    ///
1255    /// # Example
1256    /// ```no_run
1257    /// # use google_cloud_dataproc_v1::builder;
1258    /// use builder::batch_controller::GetBatch;
1259    /// # tokio_test::block_on(async {
1260    ///
1261    /// let builder = prepare_request_builder();
1262    /// let response = builder.send().await?;
1263    /// # gax::Result::<()>::Ok(()) });
1264    ///
1265    /// fn prepare_request_builder() -> GetBatch {
1266    ///   # panic!();
1267    ///   // ... details omitted ...
1268    /// }
1269    /// ```
1270    #[derive(Clone, Debug)]
1271    pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1272
1273    impl GetBatch {
1274        pub(crate) fn new(
1275            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1276        ) -> Self {
1277            Self(RequestBuilder::new(stub))
1278        }
1279
1280        /// Sets the full request, replacing any prior values.
1281        pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1282            self.0.request = v.into();
1283            self
1284        }
1285
1286        /// Sets all the options, replacing any prior values.
1287        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1288            self.0.options = v.into();
1289            self
1290        }
1291
1292        /// Sends the request.
1293        pub async fn send(self) -> Result<crate::model::Batch> {
1294            (*self.0.stub)
1295                .get_batch(self.0.request, self.0.options)
1296                .await
1297                .map(gax::response::Response::into_body)
1298        }
1299
1300        /// Sets the value of [name][crate::model::GetBatchRequest::name].
1301        ///
1302        /// This is a **required** field for requests.
1303        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1304            self.0.request.name = v.into();
1305            self
1306        }
1307    }
1308
1309    #[doc(hidden)]
1310    impl gax::options::internal::RequestBuilder for GetBatch {
1311        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1312            &mut self.0.options
1313        }
1314    }
1315
1316    /// The request builder for [BatchController::list_batches][crate::client::BatchController::list_batches] calls.
1317    ///
1318    /// # Example
1319    /// ```no_run
1320    /// # use google_cloud_dataproc_v1::builder;
1321    /// use builder::batch_controller::ListBatches;
1322    /// # tokio_test::block_on(async {
1323    /// use gax::paginator::ItemPaginator;
1324    ///
1325    /// let builder = prepare_request_builder();
1326    /// let mut items = builder.by_item();
1327    /// while let Some(result) = items.next().await {
1328    ///   let item = result?;
1329    /// }
1330    /// # gax::Result::<()>::Ok(()) });
1331    ///
1332    /// fn prepare_request_builder() -> ListBatches {
1333    ///   # panic!();
1334    ///   // ... details omitted ...
1335    /// }
1336    /// ```
1337    #[derive(Clone, Debug)]
1338    pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1339
1340    impl ListBatches {
1341        pub(crate) fn new(
1342            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1343        ) -> Self {
1344            Self(RequestBuilder::new(stub))
1345        }
1346
1347        /// Sets the full request, replacing any prior values.
1348        pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1349            self.0.request = v.into();
1350            self
1351        }
1352
1353        /// Sets all the options, replacing any prior values.
1354        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1355            self.0.options = v.into();
1356            self
1357        }
1358
1359        /// Sends the request.
1360        pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1361            (*self.0.stub)
1362                .list_batches(self.0.request, self.0.options)
1363                .await
1364                .map(gax::response::Response::into_body)
1365        }
1366
1367        /// Streams each page in the collection.
1368        pub fn by_page(
1369            self,
1370        ) -> impl gax::paginator::Paginator<crate::model::ListBatchesResponse, gax::error::Error>
1371        {
1372            use std::clone::Clone;
1373            let token = self.0.request.page_token.clone();
1374            let execute = move |token: String| {
1375                let mut builder = self.clone();
1376                builder.0.request = builder.0.request.set_page_token(token);
1377                builder.send()
1378            };
1379            gax::paginator::internal::new_paginator(token, execute)
1380        }
1381
1382        /// Streams each item in the collection.
1383        pub fn by_item(
1384            self,
1385        ) -> impl gax::paginator::ItemPaginator<crate::model::ListBatchesResponse, gax::error::Error>
1386        {
1387            use gax::paginator::Paginator;
1388            self.by_page().items()
1389        }
1390
1391        /// Sets the value of [parent][crate::model::ListBatchesRequest::parent].
1392        ///
1393        /// This is a **required** field for requests.
1394        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1395            self.0.request.parent = v.into();
1396            self
1397        }
1398
1399        /// Sets the value of [page_size][crate::model::ListBatchesRequest::page_size].
1400        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1401            self.0.request.page_size = v.into();
1402            self
1403        }
1404
1405        /// Sets the value of [page_token][crate::model::ListBatchesRequest::page_token].
1406        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1407            self.0.request.page_token = v.into();
1408            self
1409        }
1410
1411        /// Sets the value of [filter][crate::model::ListBatchesRequest::filter].
1412        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413            self.0.request.filter = v.into();
1414            self
1415        }
1416
1417        /// Sets the value of [order_by][crate::model::ListBatchesRequest::order_by].
1418        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419            self.0.request.order_by = v.into();
1420            self
1421        }
1422    }
1423
1424    #[doc(hidden)]
1425    impl gax::options::internal::RequestBuilder for ListBatches {
1426        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1427            &mut self.0.options
1428        }
1429    }
1430
1431    /// The request builder for [BatchController::delete_batch][crate::client::BatchController::delete_batch] calls.
1432    ///
1433    /// # Example
1434    /// ```no_run
1435    /// # use google_cloud_dataproc_v1::builder;
1436    /// use builder::batch_controller::DeleteBatch;
1437    /// # tokio_test::block_on(async {
1438    ///
1439    /// let builder = prepare_request_builder();
1440    /// let response = builder.send().await?;
1441    /// # gax::Result::<()>::Ok(()) });
1442    ///
1443    /// fn prepare_request_builder() -> DeleteBatch {
1444    ///   # panic!();
1445    ///   // ... details omitted ...
1446    /// }
1447    /// ```
1448    #[derive(Clone, Debug)]
1449    pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1450
1451    impl DeleteBatch {
1452        pub(crate) fn new(
1453            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1454        ) -> Self {
1455            Self(RequestBuilder::new(stub))
1456        }
1457
1458        /// Sets the full request, replacing any prior values.
1459        pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1460            self.0.request = v.into();
1461            self
1462        }
1463
1464        /// Sets all the options, replacing any prior values.
1465        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1466            self.0.options = v.into();
1467            self
1468        }
1469
1470        /// Sends the request.
1471        pub async fn send(self) -> Result<()> {
1472            (*self.0.stub)
1473                .delete_batch(self.0.request, self.0.options)
1474                .await
1475                .map(gax::response::Response::into_body)
1476        }
1477
1478        /// Sets the value of [name][crate::model::DeleteBatchRequest::name].
1479        ///
1480        /// This is a **required** field for requests.
1481        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482            self.0.request.name = v.into();
1483            self
1484        }
1485    }
1486
1487    #[doc(hidden)]
1488    impl gax::options::internal::RequestBuilder for DeleteBatch {
1489        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1490            &mut self.0.options
1491        }
1492    }
1493
1494    /// The request builder for [BatchController::set_iam_policy][crate::client::BatchController::set_iam_policy] calls.
1495    ///
1496    /// # Example
1497    /// ```no_run
1498    /// # use google_cloud_dataproc_v1::builder;
1499    /// use builder::batch_controller::SetIamPolicy;
1500    /// # tokio_test::block_on(async {
1501    ///
1502    /// let builder = prepare_request_builder();
1503    /// let response = builder.send().await?;
1504    /// # gax::Result::<()>::Ok(()) });
1505    ///
1506    /// fn prepare_request_builder() -> SetIamPolicy {
1507    ///   # panic!();
1508    ///   // ... details omitted ...
1509    /// }
1510    /// ```
1511    #[derive(Clone, Debug)]
1512    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1513
1514    impl SetIamPolicy {
1515        pub(crate) fn new(
1516            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1517        ) -> Self {
1518            Self(RequestBuilder::new(stub))
1519        }
1520
1521        /// Sets the full request, replacing any prior values.
1522        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1523            self.0.request = v.into();
1524            self
1525        }
1526
1527        /// Sets all the options, replacing any prior values.
1528        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1529            self.0.options = v.into();
1530            self
1531        }
1532
1533        /// Sends the request.
1534        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1535            (*self.0.stub)
1536                .set_iam_policy(self.0.request, self.0.options)
1537                .await
1538                .map(gax::response::Response::into_body)
1539        }
1540
1541        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1542        ///
1543        /// This is a **required** field for requests.
1544        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545            self.0.request.resource = v.into();
1546            self
1547        }
1548
1549        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1550        ///
1551        /// This is a **required** field for requests.
1552        pub fn set_policy<T>(mut self, v: T) -> Self
1553        where
1554            T: std::convert::Into<iam_v1::model::Policy>,
1555        {
1556            self.0.request.policy = std::option::Option::Some(v.into());
1557            self
1558        }
1559
1560        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1561        ///
1562        /// This is a **required** field for requests.
1563        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1564        where
1565            T: std::convert::Into<iam_v1::model::Policy>,
1566        {
1567            self.0.request.policy = v.map(|x| x.into());
1568            self
1569        }
1570
1571        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1572        pub fn set_update_mask<T>(mut self, v: T) -> Self
1573        where
1574            T: std::convert::Into<wkt::FieldMask>,
1575        {
1576            self.0.request.update_mask = std::option::Option::Some(v.into());
1577            self
1578        }
1579
1580        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1581        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1582        where
1583            T: std::convert::Into<wkt::FieldMask>,
1584        {
1585            self.0.request.update_mask = v.map(|x| x.into());
1586            self
1587        }
1588    }
1589
1590    #[doc(hidden)]
1591    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1592        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1593            &mut self.0.options
1594        }
1595    }
1596
1597    /// The request builder for [BatchController::get_iam_policy][crate::client::BatchController::get_iam_policy] calls.
1598    ///
1599    /// # Example
1600    /// ```no_run
1601    /// # use google_cloud_dataproc_v1::builder;
1602    /// use builder::batch_controller::GetIamPolicy;
1603    /// # tokio_test::block_on(async {
1604    ///
1605    /// let builder = prepare_request_builder();
1606    /// let response = builder.send().await?;
1607    /// # gax::Result::<()>::Ok(()) });
1608    ///
1609    /// fn prepare_request_builder() -> GetIamPolicy {
1610    ///   # panic!();
1611    ///   // ... details omitted ...
1612    /// }
1613    /// ```
1614    #[derive(Clone, Debug)]
1615    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1616
1617    impl GetIamPolicy {
1618        pub(crate) fn new(
1619            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1620        ) -> Self {
1621            Self(RequestBuilder::new(stub))
1622        }
1623
1624        /// Sets the full request, replacing any prior values.
1625        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1626            self.0.request = v.into();
1627            self
1628        }
1629
1630        /// Sets all the options, replacing any prior values.
1631        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1632            self.0.options = v.into();
1633            self
1634        }
1635
1636        /// Sends the request.
1637        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1638            (*self.0.stub)
1639                .get_iam_policy(self.0.request, self.0.options)
1640                .await
1641                .map(gax::response::Response::into_body)
1642        }
1643
1644        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1645        ///
1646        /// This is a **required** field for requests.
1647        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1648            self.0.request.resource = v.into();
1649            self
1650        }
1651
1652        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1653        pub fn set_options<T>(mut self, v: T) -> Self
1654        where
1655            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1656        {
1657            self.0.request.options = std::option::Option::Some(v.into());
1658            self
1659        }
1660
1661        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1662        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1663        where
1664            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1665        {
1666            self.0.request.options = v.map(|x| x.into());
1667            self
1668        }
1669    }
1670
1671    #[doc(hidden)]
1672    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1673        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1674            &mut self.0.options
1675        }
1676    }
1677
1678    /// The request builder for [BatchController::test_iam_permissions][crate::client::BatchController::test_iam_permissions] calls.
1679    ///
1680    /// # Example
1681    /// ```no_run
1682    /// # use google_cloud_dataproc_v1::builder;
1683    /// use builder::batch_controller::TestIamPermissions;
1684    /// # tokio_test::block_on(async {
1685    ///
1686    /// let builder = prepare_request_builder();
1687    /// let response = builder.send().await?;
1688    /// # gax::Result::<()>::Ok(()) });
1689    ///
1690    /// fn prepare_request_builder() -> TestIamPermissions {
1691    ///   # panic!();
1692    ///   // ... details omitted ...
1693    /// }
1694    /// ```
1695    #[derive(Clone, Debug)]
1696    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1697
1698    impl TestIamPermissions {
1699        pub(crate) fn new(
1700            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1701        ) -> Self {
1702            Self(RequestBuilder::new(stub))
1703        }
1704
1705        /// Sets the full request, replacing any prior values.
1706        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1707            mut self,
1708            v: V,
1709        ) -> Self {
1710            self.0.request = v.into();
1711            self
1712        }
1713
1714        /// Sets all the options, replacing any prior values.
1715        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1716            self.0.options = v.into();
1717            self
1718        }
1719
1720        /// Sends the request.
1721        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1722            (*self.0.stub)
1723                .test_iam_permissions(self.0.request, self.0.options)
1724                .await
1725                .map(gax::response::Response::into_body)
1726        }
1727
1728        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1729        ///
1730        /// This is a **required** field for requests.
1731        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1732            self.0.request.resource = v.into();
1733            self
1734        }
1735
1736        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1737        ///
1738        /// This is a **required** field for requests.
1739        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1740        where
1741            T: std::iter::IntoIterator<Item = V>,
1742            V: std::convert::Into<std::string::String>,
1743        {
1744            use std::iter::Iterator;
1745            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1746            self
1747        }
1748    }
1749
1750    #[doc(hidden)]
1751    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1752        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1753            &mut self.0.options
1754        }
1755    }
1756
1757    /// The request builder for [BatchController::list_operations][crate::client::BatchController::list_operations] calls.
1758    ///
1759    /// # Example
1760    /// ```no_run
1761    /// # use google_cloud_dataproc_v1::builder;
1762    /// use builder::batch_controller::ListOperations;
1763    /// # tokio_test::block_on(async {
1764    /// use gax::paginator::ItemPaginator;
1765    ///
1766    /// let builder = prepare_request_builder();
1767    /// let mut items = builder.by_item();
1768    /// while let Some(result) = items.next().await {
1769    ///   let item = result?;
1770    /// }
1771    /// # gax::Result::<()>::Ok(()) });
1772    ///
1773    /// fn prepare_request_builder() -> ListOperations {
1774    ///   # panic!();
1775    ///   // ... details omitted ...
1776    /// }
1777    /// ```
1778    #[derive(Clone, Debug)]
1779    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1780
1781    impl ListOperations {
1782        pub(crate) fn new(
1783            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1784        ) -> Self {
1785            Self(RequestBuilder::new(stub))
1786        }
1787
1788        /// Sets the full request, replacing any prior values.
1789        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1790            mut self,
1791            v: V,
1792        ) -> Self {
1793            self.0.request = v.into();
1794            self
1795        }
1796
1797        /// Sets all the options, replacing any prior values.
1798        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1799            self.0.options = v.into();
1800            self
1801        }
1802
1803        /// Sends the request.
1804        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1805            (*self.0.stub)
1806                .list_operations(self.0.request, self.0.options)
1807                .await
1808                .map(gax::response::Response::into_body)
1809        }
1810
1811        /// Streams each page in the collection.
1812        pub fn by_page(
1813            self,
1814        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1815        {
1816            use std::clone::Clone;
1817            let token = self.0.request.page_token.clone();
1818            let execute = move |token: String| {
1819                let mut builder = self.clone();
1820                builder.0.request = builder.0.request.set_page_token(token);
1821                builder.send()
1822            };
1823            gax::paginator::internal::new_paginator(token, execute)
1824        }
1825
1826        /// Streams each item in the collection.
1827        pub fn by_item(
1828            self,
1829        ) -> impl gax::paginator::ItemPaginator<
1830            longrunning::model::ListOperationsResponse,
1831            gax::error::Error,
1832        > {
1833            use gax::paginator::Paginator;
1834            self.by_page().items()
1835        }
1836
1837        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1838        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1839            self.0.request.name = v.into();
1840            self
1841        }
1842
1843        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1844        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845            self.0.request.filter = v.into();
1846            self
1847        }
1848
1849        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1850        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1851            self.0.request.page_size = v.into();
1852            self
1853        }
1854
1855        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1856        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1857            self.0.request.page_token = v.into();
1858            self
1859        }
1860    }
1861
1862    #[doc(hidden)]
1863    impl gax::options::internal::RequestBuilder for ListOperations {
1864        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1865            &mut self.0.options
1866        }
1867    }
1868
1869    /// The request builder for [BatchController::get_operation][crate::client::BatchController::get_operation] calls.
1870    ///
1871    /// # Example
1872    /// ```no_run
1873    /// # use google_cloud_dataproc_v1::builder;
1874    /// use builder::batch_controller::GetOperation;
1875    /// # tokio_test::block_on(async {
1876    ///
1877    /// let builder = prepare_request_builder();
1878    /// let response = builder.send().await?;
1879    /// # gax::Result::<()>::Ok(()) });
1880    ///
1881    /// fn prepare_request_builder() -> GetOperation {
1882    ///   # panic!();
1883    ///   // ... details omitted ...
1884    /// }
1885    /// ```
1886    #[derive(Clone, Debug)]
1887    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1888
1889    impl GetOperation {
1890        pub(crate) fn new(
1891            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1892        ) -> Self {
1893            Self(RequestBuilder::new(stub))
1894        }
1895
1896        /// Sets the full request, replacing any prior values.
1897        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1898            mut self,
1899            v: V,
1900        ) -> Self {
1901            self.0.request = v.into();
1902            self
1903        }
1904
1905        /// Sets all the options, replacing any prior values.
1906        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1907            self.0.options = v.into();
1908            self
1909        }
1910
1911        /// Sends the request.
1912        pub async fn send(self) -> Result<longrunning::model::Operation> {
1913            (*self.0.stub)
1914                .get_operation(self.0.request, self.0.options)
1915                .await
1916                .map(gax::response::Response::into_body)
1917        }
1918
1919        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1920        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1921            self.0.request.name = v.into();
1922            self
1923        }
1924    }
1925
1926    #[doc(hidden)]
1927    impl gax::options::internal::RequestBuilder for GetOperation {
1928        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1929            &mut self.0.options
1930        }
1931    }
1932
1933    /// The request builder for [BatchController::delete_operation][crate::client::BatchController::delete_operation] calls.
1934    ///
1935    /// # Example
1936    /// ```no_run
1937    /// # use google_cloud_dataproc_v1::builder;
1938    /// use builder::batch_controller::DeleteOperation;
1939    /// # tokio_test::block_on(async {
1940    ///
1941    /// let builder = prepare_request_builder();
1942    /// let response = builder.send().await?;
1943    /// # gax::Result::<()>::Ok(()) });
1944    ///
1945    /// fn prepare_request_builder() -> DeleteOperation {
1946    ///   # panic!();
1947    ///   // ... details omitted ...
1948    /// }
1949    /// ```
1950    #[derive(Clone, Debug)]
1951    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1952
1953    impl DeleteOperation {
1954        pub(crate) fn new(
1955            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1956        ) -> Self {
1957            Self(RequestBuilder::new(stub))
1958        }
1959
1960        /// Sets the full request, replacing any prior values.
1961        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1962            mut self,
1963            v: V,
1964        ) -> Self {
1965            self.0.request = v.into();
1966            self
1967        }
1968
1969        /// Sets all the options, replacing any prior values.
1970        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1971            self.0.options = v.into();
1972            self
1973        }
1974
1975        /// Sends the request.
1976        pub async fn send(self) -> Result<()> {
1977            (*self.0.stub)
1978                .delete_operation(self.0.request, self.0.options)
1979                .await
1980                .map(gax::response::Response::into_body)
1981        }
1982
1983        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1984        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1985            self.0.request.name = v.into();
1986            self
1987        }
1988    }
1989
1990    #[doc(hidden)]
1991    impl gax::options::internal::RequestBuilder for DeleteOperation {
1992        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1993            &mut self.0.options
1994        }
1995    }
1996
1997    /// The request builder for [BatchController::cancel_operation][crate::client::BatchController::cancel_operation] calls.
1998    ///
1999    /// # Example
2000    /// ```no_run
2001    /// # use google_cloud_dataproc_v1::builder;
2002    /// use builder::batch_controller::CancelOperation;
2003    /// # tokio_test::block_on(async {
2004    ///
2005    /// let builder = prepare_request_builder();
2006    /// let response = builder.send().await?;
2007    /// # gax::Result::<()>::Ok(()) });
2008    ///
2009    /// fn prepare_request_builder() -> CancelOperation {
2010    ///   # panic!();
2011    ///   // ... details omitted ...
2012    /// }
2013    /// ```
2014    #[derive(Clone, Debug)]
2015    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2016
2017    impl CancelOperation {
2018        pub(crate) fn new(
2019            stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2020        ) -> Self {
2021            Self(RequestBuilder::new(stub))
2022        }
2023
2024        /// Sets the full request, replacing any prior values.
2025        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2026            mut self,
2027            v: V,
2028        ) -> Self {
2029            self.0.request = v.into();
2030            self
2031        }
2032
2033        /// Sets all the options, replacing any prior values.
2034        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2035            self.0.options = v.into();
2036            self
2037        }
2038
2039        /// Sends the request.
2040        pub async fn send(self) -> Result<()> {
2041            (*self.0.stub)
2042                .cancel_operation(self.0.request, self.0.options)
2043                .await
2044                .map(gax::response::Response::into_body)
2045        }
2046
2047        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2048        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2049            self.0.request.name = v.into();
2050            self
2051        }
2052    }
2053
2054    #[doc(hidden)]
2055    impl gax::options::internal::RequestBuilder for CancelOperation {
2056        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2057            &mut self.0.options
2058        }
2059    }
2060}
2061
2062pub mod cluster_controller {
2063    use crate::Result;
2064
2065    /// A builder for [ClusterController][crate::client::ClusterController].
2066    ///
2067    /// ```
2068    /// # tokio_test::block_on(async {
2069    /// # use google_cloud_dataproc_v1::*;
2070    /// # use builder::cluster_controller::ClientBuilder;
2071    /// # use client::ClusterController;
2072    /// let builder : ClientBuilder = ClusterController::builder();
2073    /// let client = builder
2074    ///     .with_endpoint("https://dataproc.googleapis.com")
2075    ///     .build().await?;
2076    /// # gax::client_builder::Result::<()>::Ok(()) });
2077    /// ```
2078    pub type ClientBuilder =
2079        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2080
2081    pub(crate) mod client {
2082        use super::super::super::client::ClusterController;
2083        pub struct Factory;
2084        impl gax::client_builder::internal::ClientFactory for Factory {
2085            type Client = ClusterController;
2086            type Credentials = gaxi::options::Credentials;
2087            async fn build(
2088                self,
2089                config: gaxi::options::ClientConfig,
2090            ) -> gax::client_builder::Result<Self::Client> {
2091                Self::Client::new(config).await
2092            }
2093        }
2094    }
2095
2096    /// Common implementation for [crate::client::ClusterController] request builders.
2097    #[derive(Clone, Debug)]
2098    pub(crate) struct RequestBuilder<R: std::default::Default> {
2099        stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2100        request: R,
2101        options: gax::options::RequestOptions,
2102    }
2103
2104    impl<R> RequestBuilder<R>
2105    where
2106        R: std::default::Default,
2107    {
2108        pub(crate) fn new(
2109            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2110        ) -> Self {
2111            Self {
2112                stub,
2113                request: R::default(),
2114                options: gax::options::RequestOptions::default(),
2115            }
2116        }
2117    }
2118
2119    /// The request builder for [ClusterController::create_cluster][crate::client::ClusterController::create_cluster] calls.
2120    ///
2121    /// # Example
2122    /// ```no_run
2123    /// # use google_cloud_dataproc_v1::builder;
2124    /// use builder::cluster_controller::CreateCluster;
2125    /// # tokio_test::block_on(async {
2126    /// use lro::Poller;
2127    ///
2128    /// let builder = prepare_request_builder();
2129    /// let response = builder.poller().until_done().await?;
2130    /// # gax::Result::<()>::Ok(()) });
2131    ///
2132    /// fn prepare_request_builder() -> CreateCluster {
2133    ///   # panic!();
2134    ///   // ... details omitted ...
2135    /// }
2136    /// ```
2137    #[derive(Clone, Debug)]
2138    pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2139
2140    impl CreateCluster {
2141        pub(crate) fn new(
2142            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2143        ) -> Self {
2144            Self(RequestBuilder::new(stub))
2145        }
2146
2147        /// Sets the full request, replacing any prior values.
2148        pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2149            self.0.request = v.into();
2150            self
2151        }
2152
2153        /// Sets all the options, replacing any prior values.
2154        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2155            self.0.options = v.into();
2156            self
2157        }
2158
2159        /// Sends the request.
2160        ///
2161        /// # Long running operations
2162        ///
2163        /// This starts, but does not poll, a longrunning operation. More information
2164        /// on [create_cluster][crate::client::ClusterController::create_cluster].
2165        pub async fn send(self) -> Result<longrunning::model::Operation> {
2166            (*self.0.stub)
2167                .create_cluster(self.0.request, self.0.options)
2168                .await
2169                .map(gax::response::Response::into_body)
2170        }
2171
2172        /// Creates a [Poller][lro::Poller] to work with `create_cluster`.
2173        pub fn poller(
2174            self,
2175        ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2176        {
2177            type Operation = lro::internal::Operation<
2178                crate::model::Cluster,
2179                crate::model::ClusterOperationMetadata,
2180            >;
2181            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2182            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2183
2184            let stub = self.0.stub.clone();
2185            let mut options = self.0.options.clone();
2186            options.set_retry_policy(gax::retry_policy::NeverRetry);
2187            let query = move |name| {
2188                let stub = stub.clone();
2189                let options = options.clone();
2190                async {
2191                    let op = GetOperation::new(stub)
2192                        .set_name(name)
2193                        .with_options(options)
2194                        .send()
2195                        .await?;
2196                    Ok(Operation::new(op))
2197                }
2198            };
2199
2200            let start = move || async {
2201                let op = self.send().await?;
2202                Ok(Operation::new(op))
2203            };
2204
2205            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2206        }
2207
2208        /// Sets the value of [project_id][crate::model::CreateClusterRequest::project_id].
2209        ///
2210        /// This is a **required** field for requests.
2211        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2212            self.0.request.project_id = v.into();
2213            self
2214        }
2215
2216        /// Sets the value of [region][crate::model::CreateClusterRequest::region].
2217        ///
2218        /// This is a **required** field for requests.
2219        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2220            self.0.request.region = v.into();
2221            self
2222        }
2223
2224        /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
2225        ///
2226        /// This is a **required** field for requests.
2227        pub fn set_cluster<T>(mut self, v: T) -> Self
2228        where
2229            T: std::convert::Into<crate::model::Cluster>,
2230        {
2231            self.0.request.cluster = std::option::Option::Some(v.into());
2232            self
2233        }
2234
2235        /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
2236        ///
2237        /// This is a **required** field for requests.
2238        pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2239        where
2240            T: std::convert::Into<crate::model::Cluster>,
2241        {
2242            self.0.request.cluster = v.map(|x| x.into());
2243            self
2244        }
2245
2246        /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
2247        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2248            self.0.request.request_id = v.into();
2249            self
2250        }
2251
2252        /// Sets the value of [action_on_failed_primary_workers][crate::model::CreateClusterRequest::action_on_failed_primary_workers].
2253        pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2254            mut self,
2255            v: T,
2256        ) -> Self {
2257            self.0.request.action_on_failed_primary_workers = v.into();
2258            self
2259        }
2260    }
2261
2262    #[doc(hidden)]
2263    impl gax::options::internal::RequestBuilder for CreateCluster {
2264        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2265            &mut self.0.options
2266        }
2267    }
2268
2269    /// The request builder for [ClusterController::update_cluster][crate::client::ClusterController::update_cluster] calls.
2270    ///
2271    /// # Example
2272    /// ```no_run
2273    /// # use google_cloud_dataproc_v1::builder;
2274    /// use builder::cluster_controller::UpdateCluster;
2275    /// # tokio_test::block_on(async {
2276    /// use lro::Poller;
2277    ///
2278    /// let builder = prepare_request_builder();
2279    /// let response = builder.poller().until_done().await?;
2280    /// # gax::Result::<()>::Ok(()) });
2281    ///
2282    /// fn prepare_request_builder() -> UpdateCluster {
2283    ///   # panic!();
2284    ///   // ... details omitted ...
2285    /// }
2286    /// ```
2287    #[derive(Clone, Debug)]
2288    pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2289
2290    impl UpdateCluster {
2291        pub(crate) fn new(
2292            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2293        ) -> Self {
2294            Self(RequestBuilder::new(stub))
2295        }
2296
2297        /// Sets the full request, replacing any prior values.
2298        pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2299            self.0.request = v.into();
2300            self
2301        }
2302
2303        /// Sets all the options, replacing any prior values.
2304        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2305            self.0.options = v.into();
2306            self
2307        }
2308
2309        /// Sends the request.
2310        ///
2311        /// # Long running operations
2312        ///
2313        /// This starts, but does not poll, a longrunning operation. More information
2314        /// on [update_cluster][crate::client::ClusterController::update_cluster].
2315        pub async fn send(self) -> Result<longrunning::model::Operation> {
2316            (*self.0.stub)
2317                .update_cluster(self.0.request, self.0.options)
2318                .await
2319                .map(gax::response::Response::into_body)
2320        }
2321
2322        /// Creates a [Poller][lro::Poller] to work with `update_cluster`.
2323        pub fn poller(
2324            self,
2325        ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2326        {
2327            type Operation = lro::internal::Operation<
2328                crate::model::Cluster,
2329                crate::model::ClusterOperationMetadata,
2330            >;
2331            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2332            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2333
2334            let stub = self.0.stub.clone();
2335            let mut options = self.0.options.clone();
2336            options.set_retry_policy(gax::retry_policy::NeverRetry);
2337            let query = move |name| {
2338                let stub = stub.clone();
2339                let options = options.clone();
2340                async {
2341                    let op = GetOperation::new(stub)
2342                        .set_name(name)
2343                        .with_options(options)
2344                        .send()
2345                        .await?;
2346                    Ok(Operation::new(op))
2347                }
2348            };
2349
2350            let start = move || async {
2351                let op = self.send().await?;
2352                Ok(Operation::new(op))
2353            };
2354
2355            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2356        }
2357
2358        /// Sets the value of [project_id][crate::model::UpdateClusterRequest::project_id].
2359        ///
2360        /// This is a **required** field for requests.
2361        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2362            self.0.request.project_id = v.into();
2363            self
2364        }
2365
2366        /// Sets the value of [region][crate::model::UpdateClusterRequest::region].
2367        ///
2368        /// This is a **required** field for requests.
2369        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2370            self.0.request.region = v.into();
2371            self
2372        }
2373
2374        /// Sets the value of [cluster_name][crate::model::UpdateClusterRequest::cluster_name].
2375        ///
2376        /// This is a **required** field for requests.
2377        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2378            self.0.request.cluster_name = v.into();
2379            self
2380        }
2381
2382        /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
2383        ///
2384        /// This is a **required** field for requests.
2385        pub fn set_cluster<T>(mut self, v: T) -> Self
2386        where
2387            T: std::convert::Into<crate::model::Cluster>,
2388        {
2389            self.0.request.cluster = std::option::Option::Some(v.into());
2390            self
2391        }
2392
2393        /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
2394        ///
2395        /// This is a **required** field for requests.
2396        pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2397        where
2398            T: std::convert::Into<crate::model::Cluster>,
2399        {
2400            self.0.request.cluster = v.map(|x| x.into());
2401            self
2402        }
2403
2404        /// Sets the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
2405        pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2406        where
2407            T: std::convert::Into<wkt::Duration>,
2408        {
2409            self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2410            self
2411        }
2412
2413        /// Sets or clears the value of [graceful_decommission_timeout][crate::model::UpdateClusterRequest::graceful_decommission_timeout].
2414        pub fn set_or_clear_graceful_decommission_timeout<T>(
2415            mut self,
2416            v: std::option::Option<T>,
2417        ) -> Self
2418        where
2419            T: std::convert::Into<wkt::Duration>,
2420        {
2421            self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2422            self
2423        }
2424
2425        /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
2426        ///
2427        /// This is a **required** field for requests.
2428        pub fn set_update_mask<T>(mut self, v: T) -> Self
2429        where
2430            T: std::convert::Into<wkt::FieldMask>,
2431        {
2432            self.0.request.update_mask = std::option::Option::Some(v.into());
2433            self
2434        }
2435
2436        /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
2437        ///
2438        /// This is a **required** field for requests.
2439        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2440        where
2441            T: std::convert::Into<wkt::FieldMask>,
2442        {
2443            self.0.request.update_mask = v.map(|x| x.into());
2444            self
2445        }
2446
2447        /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
2448        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2449            self.0.request.request_id = v.into();
2450            self
2451        }
2452    }
2453
2454    #[doc(hidden)]
2455    impl gax::options::internal::RequestBuilder for UpdateCluster {
2456        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2457            &mut self.0.options
2458        }
2459    }
2460
2461    /// The request builder for [ClusterController::stop_cluster][crate::client::ClusterController::stop_cluster] calls.
2462    ///
2463    /// # Example
2464    /// ```no_run
2465    /// # use google_cloud_dataproc_v1::builder;
2466    /// use builder::cluster_controller::StopCluster;
2467    /// # tokio_test::block_on(async {
2468    /// use lro::Poller;
2469    ///
2470    /// let builder = prepare_request_builder();
2471    /// let response = builder.poller().until_done().await?;
2472    /// # gax::Result::<()>::Ok(()) });
2473    ///
2474    /// fn prepare_request_builder() -> StopCluster {
2475    ///   # panic!();
2476    ///   // ... details omitted ...
2477    /// }
2478    /// ```
2479    #[derive(Clone, Debug)]
2480    pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2481
2482    impl StopCluster {
2483        pub(crate) fn new(
2484            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2485        ) -> Self {
2486            Self(RequestBuilder::new(stub))
2487        }
2488
2489        /// Sets the full request, replacing any prior values.
2490        pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2491            self.0.request = v.into();
2492            self
2493        }
2494
2495        /// Sets all the options, replacing any prior values.
2496        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2497            self.0.options = v.into();
2498            self
2499        }
2500
2501        /// Sends the request.
2502        ///
2503        /// # Long running operations
2504        ///
2505        /// This starts, but does not poll, a longrunning operation. More information
2506        /// on [stop_cluster][crate::client::ClusterController::stop_cluster].
2507        pub async fn send(self) -> Result<longrunning::model::Operation> {
2508            (*self.0.stub)
2509                .stop_cluster(self.0.request, self.0.options)
2510                .await
2511                .map(gax::response::Response::into_body)
2512        }
2513
2514        /// Creates a [Poller][lro::Poller] to work with `stop_cluster`.
2515        pub fn poller(
2516            self,
2517        ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2518        {
2519            type Operation = lro::internal::Operation<
2520                crate::model::Cluster,
2521                crate::model::ClusterOperationMetadata,
2522            >;
2523            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2524            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2525
2526            let stub = self.0.stub.clone();
2527            let mut options = self.0.options.clone();
2528            options.set_retry_policy(gax::retry_policy::NeverRetry);
2529            let query = move |name| {
2530                let stub = stub.clone();
2531                let options = options.clone();
2532                async {
2533                    let op = GetOperation::new(stub)
2534                        .set_name(name)
2535                        .with_options(options)
2536                        .send()
2537                        .await?;
2538                    Ok(Operation::new(op))
2539                }
2540            };
2541
2542            let start = move || async {
2543                let op = self.send().await?;
2544                Ok(Operation::new(op))
2545            };
2546
2547            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2548        }
2549
2550        /// Sets the value of [project_id][crate::model::StopClusterRequest::project_id].
2551        ///
2552        /// This is a **required** field for requests.
2553        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2554            self.0.request.project_id = v.into();
2555            self
2556        }
2557
2558        /// Sets the value of [region][crate::model::StopClusterRequest::region].
2559        ///
2560        /// This is a **required** field for requests.
2561        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2562            self.0.request.region = v.into();
2563            self
2564        }
2565
2566        /// Sets the value of [cluster_name][crate::model::StopClusterRequest::cluster_name].
2567        ///
2568        /// This is a **required** field for requests.
2569        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2570            self.0.request.cluster_name = v.into();
2571            self
2572        }
2573
2574        /// Sets the value of [cluster_uuid][crate::model::StopClusterRequest::cluster_uuid].
2575        pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2576            self.0.request.cluster_uuid = v.into();
2577            self
2578        }
2579
2580        /// Sets the value of [request_id][crate::model::StopClusterRequest::request_id].
2581        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2582            self.0.request.request_id = v.into();
2583            self
2584        }
2585    }
2586
2587    #[doc(hidden)]
2588    impl gax::options::internal::RequestBuilder for StopCluster {
2589        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2590            &mut self.0.options
2591        }
2592    }
2593
2594    /// The request builder for [ClusterController::start_cluster][crate::client::ClusterController::start_cluster] calls.
2595    ///
2596    /// # Example
2597    /// ```no_run
2598    /// # use google_cloud_dataproc_v1::builder;
2599    /// use builder::cluster_controller::StartCluster;
2600    /// # tokio_test::block_on(async {
2601    /// use lro::Poller;
2602    ///
2603    /// let builder = prepare_request_builder();
2604    /// let response = builder.poller().until_done().await?;
2605    /// # gax::Result::<()>::Ok(()) });
2606    ///
2607    /// fn prepare_request_builder() -> StartCluster {
2608    ///   # panic!();
2609    ///   // ... details omitted ...
2610    /// }
2611    /// ```
2612    #[derive(Clone, Debug)]
2613    pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2614
2615    impl StartCluster {
2616        pub(crate) fn new(
2617            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2618        ) -> Self {
2619            Self(RequestBuilder::new(stub))
2620        }
2621
2622        /// Sets the full request, replacing any prior values.
2623        pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2624            self.0.request = v.into();
2625            self
2626        }
2627
2628        /// Sets all the options, replacing any prior values.
2629        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2630            self.0.options = v.into();
2631            self
2632        }
2633
2634        /// Sends the request.
2635        ///
2636        /// # Long running operations
2637        ///
2638        /// This starts, but does not poll, a longrunning operation. More information
2639        /// on [start_cluster][crate::client::ClusterController::start_cluster].
2640        pub async fn send(self) -> Result<longrunning::model::Operation> {
2641            (*self.0.stub)
2642                .start_cluster(self.0.request, self.0.options)
2643                .await
2644                .map(gax::response::Response::into_body)
2645        }
2646
2647        /// Creates a [Poller][lro::Poller] to work with `start_cluster`.
2648        pub fn poller(
2649            self,
2650        ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2651        {
2652            type Operation = lro::internal::Operation<
2653                crate::model::Cluster,
2654                crate::model::ClusterOperationMetadata,
2655            >;
2656            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2657            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2658
2659            let stub = self.0.stub.clone();
2660            let mut options = self.0.options.clone();
2661            options.set_retry_policy(gax::retry_policy::NeverRetry);
2662            let query = move |name| {
2663                let stub = stub.clone();
2664                let options = options.clone();
2665                async {
2666                    let op = GetOperation::new(stub)
2667                        .set_name(name)
2668                        .with_options(options)
2669                        .send()
2670                        .await?;
2671                    Ok(Operation::new(op))
2672                }
2673            };
2674
2675            let start = move || async {
2676                let op = self.send().await?;
2677                Ok(Operation::new(op))
2678            };
2679
2680            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2681        }
2682
2683        /// Sets the value of [project_id][crate::model::StartClusterRequest::project_id].
2684        ///
2685        /// This is a **required** field for requests.
2686        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2687            self.0.request.project_id = v.into();
2688            self
2689        }
2690
2691        /// Sets the value of [region][crate::model::StartClusterRequest::region].
2692        ///
2693        /// This is a **required** field for requests.
2694        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2695            self.0.request.region = v.into();
2696            self
2697        }
2698
2699        /// Sets the value of [cluster_name][crate::model::StartClusterRequest::cluster_name].
2700        ///
2701        /// This is a **required** field for requests.
2702        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2703            self.0.request.cluster_name = v.into();
2704            self
2705        }
2706
2707        /// Sets the value of [cluster_uuid][crate::model::StartClusterRequest::cluster_uuid].
2708        pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2709            self.0.request.cluster_uuid = v.into();
2710            self
2711        }
2712
2713        /// Sets the value of [request_id][crate::model::StartClusterRequest::request_id].
2714        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2715            self.0.request.request_id = v.into();
2716            self
2717        }
2718    }
2719
2720    #[doc(hidden)]
2721    impl gax::options::internal::RequestBuilder for StartCluster {
2722        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2723            &mut self.0.options
2724        }
2725    }
2726
2727    /// The request builder for [ClusterController::delete_cluster][crate::client::ClusterController::delete_cluster] calls.
2728    ///
2729    /// # Example
2730    /// ```no_run
2731    /// # use google_cloud_dataproc_v1::builder;
2732    /// use builder::cluster_controller::DeleteCluster;
2733    /// # tokio_test::block_on(async {
2734    /// use lro::Poller;
2735    ///
2736    /// let builder = prepare_request_builder();
2737    /// let response = builder.poller().until_done().await?;
2738    /// # gax::Result::<()>::Ok(()) });
2739    ///
2740    /// fn prepare_request_builder() -> DeleteCluster {
2741    ///   # panic!();
2742    ///   // ... details omitted ...
2743    /// }
2744    /// ```
2745    #[derive(Clone, Debug)]
2746    pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2747
2748    impl DeleteCluster {
2749        pub(crate) fn new(
2750            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2751        ) -> Self {
2752            Self(RequestBuilder::new(stub))
2753        }
2754
2755        /// Sets the full request, replacing any prior values.
2756        pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2757            self.0.request = v.into();
2758            self
2759        }
2760
2761        /// Sets all the options, replacing any prior values.
2762        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2763            self.0.options = v.into();
2764            self
2765        }
2766
2767        /// Sends the request.
2768        ///
2769        /// # Long running operations
2770        ///
2771        /// This starts, but does not poll, a longrunning operation. More information
2772        /// on [delete_cluster][crate::client::ClusterController::delete_cluster].
2773        pub async fn send(self) -> Result<longrunning::model::Operation> {
2774            (*self.0.stub)
2775                .delete_cluster(self.0.request, self.0.options)
2776                .await
2777                .map(gax::response::Response::into_body)
2778        }
2779
2780        /// Creates a [Poller][lro::Poller] to work with `delete_cluster`.
2781        pub fn poller(self) -> impl lro::Poller<(), crate::model::ClusterOperationMetadata> {
2782            type Operation =
2783                lro::internal::Operation<wkt::Empty, crate::model::ClusterOperationMetadata>;
2784            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2785            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2786
2787            let stub = self.0.stub.clone();
2788            let mut options = self.0.options.clone();
2789            options.set_retry_policy(gax::retry_policy::NeverRetry);
2790            let query = move |name| {
2791                let stub = stub.clone();
2792                let options = options.clone();
2793                async {
2794                    let op = GetOperation::new(stub)
2795                        .set_name(name)
2796                        .with_options(options)
2797                        .send()
2798                        .await?;
2799                    Ok(Operation::new(op))
2800                }
2801            };
2802
2803            let start = move || async {
2804                let op = self.send().await?;
2805                Ok(Operation::new(op))
2806            };
2807
2808            lro::internal::new_unit_response_poller(
2809                polling_error_policy,
2810                polling_backoff_policy,
2811                start,
2812                query,
2813            )
2814        }
2815
2816        /// Sets the value of [project_id][crate::model::DeleteClusterRequest::project_id].
2817        ///
2818        /// This is a **required** field for requests.
2819        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2820            self.0.request.project_id = v.into();
2821            self
2822        }
2823
2824        /// Sets the value of [region][crate::model::DeleteClusterRequest::region].
2825        ///
2826        /// This is a **required** field for requests.
2827        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2828            self.0.request.region = v.into();
2829            self
2830        }
2831
2832        /// Sets the value of [cluster_name][crate::model::DeleteClusterRequest::cluster_name].
2833        ///
2834        /// This is a **required** field for requests.
2835        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2836            self.0.request.cluster_name = v.into();
2837            self
2838        }
2839
2840        /// Sets the value of [cluster_uuid][crate::model::DeleteClusterRequest::cluster_uuid].
2841        pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2842            self.0.request.cluster_uuid = v.into();
2843            self
2844        }
2845
2846        /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
2847        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2848            self.0.request.request_id = v.into();
2849            self
2850        }
2851    }
2852
2853    #[doc(hidden)]
2854    impl gax::options::internal::RequestBuilder for DeleteCluster {
2855        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2856            &mut self.0.options
2857        }
2858    }
2859
2860    /// The request builder for [ClusterController::get_cluster][crate::client::ClusterController::get_cluster] calls.
2861    ///
2862    /// # Example
2863    /// ```no_run
2864    /// # use google_cloud_dataproc_v1::builder;
2865    /// use builder::cluster_controller::GetCluster;
2866    /// # tokio_test::block_on(async {
2867    ///
2868    /// let builder = prepare_request_builder();
2869    /// let response = builder.send().await?;
2870    /// # gax::Result::<()>::Ok(()) });
2871    ///
2872    /// fn prepare_request_builder() -> GetCluster {
2873    ///   # panic!();
2874    ///   // ... details omitted ...
2875    /// }
2876    /// ```
2877    #[derive(Clone, Debug)]
2878    pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2879
2880    impl GetCluster {
2881        pub(crate) fn new(
2882            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2883        ) -> Self {
2884            Self(RequestBuilder::new(stub))
2885        }
2886
2887        /// Sets the full request, replacing any prior values.
2888        pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2889            self.0.request = v.into();
2890            self
2891        }
2892
2893        /// Sets all the options, replacing any prior values.
2894        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2895            self.0.options = v.into();
2896            self
2897        }
2898
2899        /// Sends the request.
2900        pub async fn send(self) -> Result<crate::model::Cluster> {
2901            (*self.0.stub)
2902                .get_cluster(self.0.request, self.0.options)
2903                .await
2904                .map(gax::response::Response::into_body)
2905        }
2906
2907        /// Sets the value of [project_id][crate::model::GetClusterRequest::project_id].
2908        ///
2909        /// This is a **required** field for requests.
2910        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2911            self.0.request.project_id = v.into();
2912            self
2913        }
2914
2915        /// Sets the value of [region][crate::model::GetClusterRequest::region].
2916        ///
2917        /// This is a **required** field for requests.
2918        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2919            self.0.request.region = v.into();
2920            self
2921        }
2922
2923        /// Sets the value of [cluster_name][crate::model::GetClusterRequest::cluster_name].
2924        ///
2925        /// This is a **required** field for requests.
2926        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2927            self.0.request.cluster_name = v.into();
2928            self
2929        }
2930    }
2931
2932    #[doc(hidden)]
2933    impl gax::options::internal::RequestBuilder for GetCluster {
2934        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2935            &mut self.0.options
2936        }
2937    }
2938
2939    /// The request builder for [ClusterController::list_clusters][crate::client::ClusterController::list_clusters] calls.
2940    ///
2941    /// # Example
2942    /// ```no_run
2943    /// # use google_cloud_dataproc_v1::builder;
2944    /// use builder::cluster_controller::ListClusters;
2945    /// # tokio_test::block_on(async {
2946    /// use gax::paginator::ItemPaginator;
2947    ///
2948    /// let builder = prepare_request_builder();
2949    /// let mut items = builder.by_item();
2950    /// while let Some(result) = items.next().await {
2951    ///   let item = result?;
2952    /// }
2953    /// # gax::Result::<()>::Ok(()) });
2954    ///
2955    /// fn prepare_request_builder() -> ListClusters {
2956    ///   # panic!();
2957    ///   // ... details omitted ...
2958    /// }
2959    /// ```
2960    #[derive(Clone, Debug)]
2961    pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
2962
2963    impl ListClusters {
2964        pub(crate) fn new(
2965            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2966        ) -> Self {
2967            Self(RequestBuilder::new(stub))
2968        }
2969
2970        /// Sets the full request, replacing any prior values.
2971        pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
2972            self.0.request = v.into();
2973            self
2974        }
2975
2976        /// Sets all the options, replacing any prior values.
2977        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2978            self.0.options = v.into();
2979            self
2980        }
2981
2982        /// Sends the request.
2983        pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
2984            (*self.0.stub)
2985                .list_clusters(self.0.request, self.0.options)
2986                .await
2987                .map(gax::response::Response::into_body)
2988        }
2989
2990        /// Streams each page in the collection.
2991        pub fn by_page(
2992            self,
2993        ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
2994        {
2995            use std::clone::Clone;
2996            let token = self.0.request.page_token.clone();
2997            let execute = move |token: String| {
2998                let mut builder = self.clone();
2999                builder.0.request = builder.0.request.set_page_token(token);
3000                builder.send()
3001            };
3002            gax::paginator::internal::new_paginator(token, execute)
3003        }
3004
3005        /// Streams each item in the collection.
3006        pub fn by_item(
3007            self,
3008        ) -> impl gax::paginator::ItemPaginator<crate::model::ListClustersResponse, gax::error::Error>
3009        {
3010            use gax::paginator::Paginator;
3011            self.by_page().items()
3012        }
3013
3014        /// Sets the value of [project_id][crate::model::ListClustersRequest::project_id].
3015        ///
3016        /// This is a **required** field for requests.
3017        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3018            self.0.request.project_id = v.into();
3019            self
3020        }
3021
3022        /// Sets the value of [region][crate::model::ListClustersRequest::region].
3023        ///
3024        /// This is a **required** field for requests.
3025        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3026            self.0.request.region = v.into();
3027            self
3028        }
3029
3030        /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
3031        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3032            self.0.request.filter = v.into();
3033            self
3034        }
3035
3036        /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
3037        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3038            self.0.request.page_size = v.into();
3039            self
3040        }
3041
3042        /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
3043        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3044            self.0.request.page_token = v.into();
3045            self
3046        }
3047    }
3048
3049    #[doc(hidden)]
3050    impl gax::options::internal::RequestBuilder for ListClusters {
3051        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3052            &mut self.0.options
3053        }
3054    }
3055
3056    /// The request builder for [ClusterController::diagnose_cluster][crate::client::ClusterController::diagnose_cluster] calls.
3057    ///
3058    /// # Example
3059    /// ```no_run
3060    /// # use google_cloud_dataproc_v1::builder;
3061    /// use builder::cluster_controller::DiagnoseCluster;
3062    /// # tokio_test::block_on(async {
3063    /// use lro::Poller;
3064    ///
3065    /// let builder = prepare_request_builder();
3066    /// let response = builder.poller().until_done().await?;
3067    /// # gax::Result::<()>::Ok(()) });
3068    ///
3069    /// fn prepare_request_builder() -> DiagnoseCluster {
3070    ///   # panic!();
3071    ///   // ... details omitted ...
3072    /// }
3073    /// ```
3074    #[derive(Clone, Debug)]
3075    pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3076
3077    impl DiagnoseCluster {
3078        pub(crate) fn new(
3079            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3080        ) -> Self {
3081            Self(RequestBuilder::new(stub))
3082        }
3083
3084        /// Sets the full request, replacing any prior values.
3085        pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3086            self.0.request = v.into();
3087            self
3088        }
3089
3090        /// Sets all the options, replacing any prior values.
3091        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3092            self.0.options = v.into();
3093            self
3094        }
3095
3096        /// Sends the request.
3097        ///
3098        /// # Long running operations
3099        ///
3100        /// This starts, but does not poll, a longrunning operation. More information
3101        /// on [diagnose_cluster][crate::client::ClusterController::diagnose_cluster].
3102        pub async fn send(self) -> Result<longrunning::model::Operation> {
3103            (*self.0.stub)
3104                .diagnose_cluster(self.0.request, self.0.options)
3105                .await
3106                .map(gax::response::Response::into_body)
3107        }
3108
3109        /// Creates a [Poller][lro::Poller] to work with `diagnose_cluster`.
3110        pub fn poller(
3111            self,
3112        ) -> impl lro::Poller<crate::model::DiagnoseClusterResults, crate::model::ClusterOperationMetadata>
3113        {
3114            type Operation = lro::internal::Operation<
3115                crate::model::DiagnoseClusterResults,
3116                crate::model::ClusterOperationMetadata,
3117            >;
3118            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3119            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3120
3121            let stub = self.0.stub.clone();
3122            let mut options = self.0.options.clone();
3123            options.set_retry_policy(gax::retry_policy::NeverRetry);
3124            let query = move |name| {
3125                let stub = stub.clone();
3126                let options = options.clone();
3127                async {
3128                    let op = GetOperation::new(stub)
3129                        .set_name(name)
3130                        .with_options(options)
3131                        .send()
3132                        .await?;
3133                    Ok(Operation::new(op))
3134                }
3135            };
3136
3137            let start = move || async {
3138                let op = self.send().await?;
3139                Ok(Operation::new(op))
3140            };
3141
3142            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3143        }
3144
3145        /// Sets the value of [project_id][crate::model::DiagnoseClusterRequest::project_id].
3146        ///
3147        /// This is a **required** field for requests.
3148        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3149            self.0.request.project_id = v.into();
3150            self
3151        }
3152
3153        /// Sets the value of [region][crate::model::DiagnoseClusterRequest::region].
3154        ///
3155        /// This is a **required** field for requests.
3156        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3157            self.0.request.region = v.into();
3158            self
3159        }
3160
3161        /// Sets the value of [cluster_name][crate::model::DiagnoseClusterRequest::cluster_name].
3162        ///
3163        /// This is a **required** field for requests.
3164        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3165            self.0.request.cluster_name = v.into();
3166            self
3167        }
3168
3169        /// Sets the value of [tarball_gcs_dir][crate::model::DiagnoseClusterRequest::tarball_gcs_dir].
3170        pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3171            self.0.request.tarball_gcs_dir = v.into();
3172            self
3173        }
3174
3175        /// Sets the value of [tarball_access][crate::model::DiagnoseClusterRequest::tarball_access].
3176        pub fn set_tarball_access<
3177            T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3178        >(
3179            mut self,
3180            v: T,
3181        ) -> Self {
3182            self.0.request.tarball_access = v.into();
3183            self
3184        }
3185
3186        /// Sets the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
3187        pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3188        where
3189            T: std::convert::Into<gtype::model::Interval>,
3190        {
3191            self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3192            self
3193        }
3194
3195        /// Sets or clears the value of [diagnosis_interval][crate::model::DiagnoseClusterRequest::diagnosis_interval].
3196        pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3197        where
3198            T: std::convert::Into<gtype::model::Interval>,
3199        {
3200            self.0.request.diagnosis_interval = v.map(|x| x.into());
3201            self
3202        }
3203
3204        /// Sets the value of [jobs][crate::model::DiagnoseClusterRequest::jobs].
3205        pub fn set_jobs<T, V>(mut self, v: T) -> Self
3206        where
3207            T: std::iter::IntoIterator<Item = V>,
3208            V: std::convert::Into<std::string::String>,
3209        {
3210            use std::iter::Iterator;
3211            self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3212            self
3213        }
3214
3215        /// Sets the value of [yarn_application_ids][crate::model::DiagnoseClusterRequest::yarn_application_ids].
3216        pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3217        where
3218            T: std::iter::IntoIterator<Item = V>,
3219            V: std::convert::Into<std::string::String>,
3220        {
3221            use std::iter::Iterator;
3222            self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3223            self
3224        }
3225    }
3226
3227    #[doc(hidden)]
3228    impl gax::options::internal::RequestBuilder for DiagnoseCluster {
3229        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3230            &mut self.0.options
3231        }
3232    }
3233
3234    /// The request builder for [ClusterController::set_iam_policy][crate::client::ClusterController::set_iam_policy] calls.
3235    ///
3236    /// # Example
3237    /// ```no_run
3238    /// # use google_cloud_dataproc_v1::builder;
3239    /// use builder::cluster_controller::SetIamPolicy;
3240    /// # tokio_test::block_on(async {
3241    ///
3242    /// let builder = prepare_request_builder();
3243    /// let response = builder.send().await?;
3244    /// # gax::Result::<()>::Ok(()) });
3245    ///
3246    /// fn prepare_request_builder() -> SetIamPolicy {
3247    ///   # panic!();
3248    ///   // ... details omitted ...
3249    /// }
3250    /// ```
3251    #[derive(Clone, Debug)]
3252    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3253
3254    impl SetIamPolicy {
3255        pub(crate) fn new(
3256            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3257        ) -> Self {
3258            Self(RequestBuilder::new(stub))
3259        }
3260
3261        /// Sets the full request, replacing any prior values.
3262        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3263            self.0.request = v.into();
3264            self
3265        }
3266
3267        /// Sets all the options, replacing any prior values.
3268        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3269            self.0.options = v.into();
3270            self
3271        }
3272
3273        /// Sends the request.
3274        pub async fn send(self) -> Result<iam_v1::model::Policy> {
3275            (*self.0.stub)
3276                .set_iam_policy(self.0.request, self.0.options)
3277                .await
3278                .map(gax::response::Response::into_body)
3279        }
3280
3281        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
3282        ///
3283        /// This is a **required** field for requests.
3284        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3285            self.0.request.resource = v.into();
3286            self
3287        }
3288
3289        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
3290        ///
3291        /// This is a **required** field for requests.
3292        pub fn set_policy<T>(mut self, v: T) -> Self
3293        where
3294            T: std::convert::Into<iam_v1::model::Policy>,
3295        {
3296            self.0.request.policy = std::option::Option::Some(v.into());
3297            self
3298        }
3299
3300        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
3301        ///
3302        /// This is a **required** field for requests.
3303        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3304        where
3305            T: std::convert::Into<iam_v1::model::Policy>,
3306        {
3307            self.0.request.policy = v.map(|x| x.into());
3308            self
3309        }
3310
3311        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
3312        pub fn set_update_mask<T>(mut self, v: T) -> Self
3313        where
3314            T: std::convert::Into<wkt::FieldMask>,
3315        {
3316            self.0.request.update_mask = std::option::Option::Some(v.into());
3317            self
3318        }
3319
3320        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
3321        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3322        where
3323            T: std::convert::Into<wkt::FieldMask>,
3324        {
3325            self.0.request.update_mask = v.map(|x| x.into());
3326            self
3327        }
3328    }
3329
3330    #[doc(hidden)]
3331    impl gax::options::internal::RequestBuilder for SetIamPolicy {
3332        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3333            &mut self.0.options
3334        }
3335    }
3336
3337    /// The request builder for [ClusterController::get_iam_policy][crate::client::ClusterController::get_iam_policy] calls.
3338    ///
3339    /// # Example
3340    /// ```no_run
3341    /// # use google_cloud_dataproc_v1::builder;
3342    /// use builder::cluster_controller::GetIamPolicy;
3343    /// # tokio_test::block_on(async {
3344    ///
3345    /// let builder = prepare_request_builder();
3346    /// let response = builder.send().await?;
3347    /// # gax::Result::<()>::Ok(()) });
3348    ///
3349    /// fn prepare_request_builder() -> GetIamPolicy {
3350    ///   # panic!();
3351    ///   // ... details omitted ...
3352    /// }
3353    /// ```
3354    #[derive(Clone, Debug)]
3355    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3356
3357    impl GetIamPolicy {
3358        pub(crate) fn new(
3359            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3360        ) -> Self {
3361            Self(RequestBuilder::new(stub))
3362        }
3363
3364        /// Sets the full request, replacing any prior values.
3365        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3366            self.0.request = v.into();
3367            self
3368        }
3369
3370        /// Sets all the options, replacing any prior values.
3371        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3372            self.0.options = v.into();
3373            self
3374        }
3375
3376        /// Sends the request.
3377        pub async fn send(self) -> Result<iam_v1::model::Policy> {
3378            (*self.0.stub)
3379                .get_iam_policy(self.0.request, self.0.options)
3380                .await
3381                .map(gax::response::Response::into_body)
3382        }
3383
3384        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
3385        ///
3386        /// This is a **required** field for requests.
3387        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3388            self.0.request.resource = v.into();
3389            self
3390        }
3391
3392        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3393        pub fn set_options<T>(mut self, v: T) -> Self
3394        where
3395            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3396        {
3397            self.0.request.options = std::option::Option::Some(v.into());
3398            self
3399        }
3400
3401        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3402        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3403        where
3404            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3405        {
3406            self.0.request.options = v.map(|x| x.into());
3407            self
3408        }
3409    }
3410
3411    #[doc(hidden)]
3412    impl gax::options::internal::RequestBuilder for GetIamPolicy {
3413        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3414            &mut self.0.options
3415        }
3416    }
3417
3418    /// The request builder for [ClusterController::test_iam_permissions][crate::client::ClusterController::test_iam_permissions] calls.
3419    ///
3420    /// # Example
3421    /// ```no_run
3422    /// # use google_cloud_dataproc_v1::builder;
3423    /// use builder::cluster_controller::TestIamPermissions;
3424    /// # tokio_test::block_on(async {
3425    ///
3426    /// let builder = prepare_request_builder();
3427    /// let response = builder.send().await?;
3428    /// # gax::Result::<()>::Ok(()) });
3429    ///
3430    /// fn prepare_request_builder() -> TestIamPermissions {
3431    ///   # panic!();
3432    ///   // ... details omitted ...
3433    /// }
3434    /// ```
3435    #[derive(Clone, Debug)]
3436    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3437
3438    impl TestIamPermissions {
3439        pub(crate) fn new(
3440            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3441        ) -> Self {
3442            Self(RequestBuilder::new(stub))
3443        }
3444
3445        /// Sets the full request, replacing any prior values.
3446        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3447            mut self,
3448            v: V,
3449        ) -> Self {
3450            self.0.request = v.into();
3451            self
3452        }
3453
3454        /// Sets all the options, replacing any prior values.
3455        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3456            self.0.options = v.into();
3457            self
3458        }
3459
3460        /// Sends the request.
3461        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3462            (*self.0.stub)
3463                .test_iam_permissions(self.0.request, self.0.options)
3464                .await
3465                .map(gax::response::Response::into_body)
3466        }
3467
3468        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
3469        ///
3470        /// This is a **required** field for requests.
3471        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3472            self.0.request.resource = v.into();
3473            self
3474        }
3475
3476        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
3477        ///
3478        /// This is a **required** field for requests.
3479        pub fn set_permissions<T, V>(mut self, v: T) -> Self
3480        where
3481            T: std::iter::IntoIterator<Item = V>,
3482            V: std::convert::Into<std::string::String>,
3483        {
3484            use std::iter::Iterator;
3485            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3486            self
3487        }
3488    }
3489
3490    #[doc(hidden)]
3491    impl gax::options::internal::RequestBuilder for TestIamPermissions {
3492        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3493            &mut self.0.options
3494        }
3495    }
3496
3497    /// The request builder for [ClusterController::list_operations][crate::client::ClusterController::list_operations] calls.
3498    ///
3499    /// # Example
3500    /// ```no_run
3501    /// # use google_cloud_dataproc_v1::builder;
3502    /// use builder::cluster_controller::ListOperations;
3503    /// # tokio_test::block_on(async {
3504    /// use gax::paginator::ItemPaginator;
3505    ///
3506    /// let builder = prepare_request_builder();
3507    /// let mut items = builder.by_item();
3508    /// while let Some(result) = items.next().await {
3509    ///   let item = result?;
3510    /// }
3511    /// # gax::Result::<()>::Ok(()) });
3512    ///
3513    /// fn prepare_request_builder() -> ListOperations {
3514    ///   # panic!();
3515    ///   // ... details omitted ...
3516    /// }
3517    /// ```
3518    #[derive(Clone, Debug)]
3519    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3520
3521    impl ListOperations {
3522        pub(crate) fn new(
3523            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3524        ) -> Self {
3525            Self(RequestBuilder::new(stub))
3526        }
3527
3528        /// Sets the full request, replacing any prior values.
3529        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3530            mut self,
3531            v: V,
3532        ) -> Self {
3533            self.0.request = v.into();
3534            self
3535        }
3536
3537        /// Sets all the options, replacing any prior values.
3538        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3539            self.0.options = v.into();
3540            self
3541        }
3542
3543        /// Sends the request.
3544        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3545            (*self.0.stub)
3546                .list_operations(self.0.request, self.0.options)
3547                .await
3548                .map(gax::response::Response::into_body)
3549        }
3550
3551        /// Streams each page in the collection.
3552        pub fn by_page(
3553            self,
3554        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3555        {
3556            use std::clone::Clone;
3557            let token = self.0.request.page_token.clone();
3558            let execute = move |token: String| {
3559                let mut builder = self.clone();
3560                builder.0.request = builder.0.request.set_page_token(token);
3561                builder.send()
3562            };
3563            gax::paginator::internal::new_paginator(token, execute)
3564        }
3565
3566        /// Streams each item in the collection.
3567        pub fn by_item(
3568            self,
3569        ) -> impl gax::paginator::ItemPaginator<
3570            longrunning::model::ListOperationsResponse,
3571            gax::error::Error,
3572        > {
3573            use gax::paginator::Paginator;
3574            self.by_page().items()
3575        }
3576
3577        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3578        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579            self.0.request.name = v.into();
3580            self
3581        }
3582
3583        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3584        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3585            self.0.request.filter = v.into();
3586            self
3587        }
3588
3589        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3590        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3591            self.0.request.page_size = v.into();
3592            self
3593        }
3594
3595        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3596        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3597            self.0.request.page_token = v.into();
3598            self
3599        }
3600    }
3601
3602    #[doc(hidden)]
3603    impl gax::options::internal::RequestBuilder for ListOperations {
3604        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3605            &mut self.0.options
3606        }
3607    }
3608
3609    /// The request builder for [ClusterController::get_operation][crate::client::ClusterController::get_operation] calls.
3610    ///
3611    /// # Example
3612    /// ```no_run
3613    /// # use google_cloud_dataproc_v1::builder;
3614    /// use builder::cluster_controller::GetOperation;
3615    /// # tokio_test::block_on(async {
3616    ///
3617    /// let builder = prepare_request_builder();
3618    /// let response = builder.send().await?;
3619    /// # gax::Result::<()>::Ok(()) });
3620    ///
3621    /// fn prepare_request_builder() -> GetOperation {
3622    ///   # panic!();
3623    ///   // ... details omitted ...
3624    /// }
3625    /// ```
3626    #[derive(Clone, Debug)]
3627    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3628
3629    impl GetOperation {
3630        pub(crate) fn new(
3631            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3632        ) -> Self {
3633            Self(RequestBuilder::new(stub))
3634        }
3635
3636        /// Sets the full request, replacing any prior values.
3637        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3638            mut self,
3639            v: V,
3640        ) -> Self {
3641            self.0.request = v.into();
3642            self
3643        }
3644
3645        /// Sets all the options, replacing any prior values.
3646        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3647            self.0.options = v.into();
3648            self
3649        }
3650
3651        /// Sends the request.
3652        pub async fn send(self) -> Result<longrunning::model::Operation> {
3653            (*self.0.stub)
3654                .get_operation(self.0.request, self.0.options)
3655                .await
3656                .map(gax::response::Response::into_body)
3657        }
3658
3659        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3660        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3661            self.0.request.name = v.into();
3662            self
3663        }
3664    }
3665
3666    #[doc(hidden)]
3667    impl gax::options::internal::RequestBuilder for GetOperation {
3668        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3669            &mut self.0.options
3670        }
3671    }
3672
3673    /// The request builder for [ClusterController::delete_operation][crate::client::ClusterController::delete_operation] calls.
3674    ///
3675    /// # Example
3676    /// ```no_run
3677    /// # use google_cloud_dataproc_v1::builder;
3678    /// use builder::cluster_controller::DeleteOperation;
3679    /// # tokio_test::block_on(async {
3680    ///
3681    /// let builder = prepare_request_builder();
3682    /// let response = builder.send().await?;
3683    /// # gax::Result::<()>::Ok(()) });
3684    ///
3685    /// fn prepare_request_builder() -> DeleteOperation {
3686    ///   # panic!();
3687    ///   // ... details omitted ...
3688    /// }
3689    /// ```
3690    #[derive(Clone, Debug)]
3691    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3692
3693    impl DeleteOperation {
3694        pub(crate) fn new(
3695            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3696        ) -> Self {
3697            Self(RequestBuilder::new(stub))
3698        }
3699
3700        /// Sets the full request, replacing any prior values.
3701        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3702            mut self,
3703            v: V,
3704        ) -> Self {
3705            self.0.request = v.into();
3706            self
3707        }
3708
3709        /// Sets all the options, replacing any prior values.
3710        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3711            self.0.options = v.into();
3712            self
3713        }
3714
3715        /// Sends the request.
3716        pub async fn send(self) -> Result<()> {
3717            (*self.0.stub)
3718                .delete_operation(self.0.request, self.0.options)
3719                .await
3720                .map(gax::response::Response::into_body)
3721        }
3722
3723        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
3724        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3725            self.0.request.name = v.into();
3726            self
3727        }
3728    }
3729
3730    #[doc(hidden)]
3731    impl gax::options::internal::RequestBuilder for DeleteOperation {
3732        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3733            &mut self.0.options
3734        }
3735    }
3736
3737    /// The request builder for [ClusterController::cancel_operation][crate::client::ClusterController::cancel_operation] calls.
3738    ///
3739    /// # Example
3740    /// ```no_run
3741    /// # use google_cloud_dataproc_v1::builder;
3742    /// use builder::cluster_controller::CancelOperation;
3743    /// # tokio_test::block_on(async {
3744    ///
3745    /// let builder = prepare_request_builder();
3746    /// let response = builder.send().await?;
3747    /// # gax::Result::<()>::Ok(()) });
3748    ///
3749    /// fn prepare_request_builder() -> CancelOperation {
3750    ///   # panic!();
3751    ///   // ... details omitted ...
3752    /// }
3753    /// ```
3754    #[derive(Clone, Debug)]
3755    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3756
3757    impl CancelOperation {
3758        pub(crate) fn new(
3759            stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3760        ) -> Self {
3761            Self(RequestBuilder::new(stub))
3762        }
3763
3764        /// Sets the full request, replacing any prior values.
3765        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3766            mut self,
3767            v: V,
3768        ) -> Self {
3769            self.0.request = v.into();
3770            self
3771        }
3772
3773        /// Sets all the options, replacing any prior values.
3774        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3775            self.0.options = v.into();
3776            self
3777        }
3778
3779        /// Sends the request.
3780        pub async fn send(self) -> Result<()> {
3781            (*self.0.stub)
3782                .cancel_operation(self.0.request, self.0.options)
3783                .await
3784                .map(gax::response::Response::into_body)
3785        }
3786
3787        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
3788        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3789            self.0.request.name = v.into();
3790            self
3791        }
3792    }
3793
3794    #[doc(hidden)]
3795    impl gax::options::internal::RequestBuilder for CancelOperation {
3796        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3797            &mut self.0.options
3798        }
3799    }
3800}
3801
3802pub mod job_controller {
3803    use crate::Result;
3804
3805    /// A builder for [JobController][crate::client::JobController].
3806    ///
3807    /// ```
3808    /// # tokio_test::block_on(async {
3809    /// # use google_cloud_dataproc_v1::*;
3810    /// # use builder::job_controller::ClientBuilder;
3811    /// # use client::JobController;
3812    /// let builder : ClientBuilder = JobController::builder();
3813    /// let client = builder
3814    ///     .with_endpoint("https://dataproc.googleapis.com")
3815    ///     .build().await?;
3816    /// # gax::client_builder::Result::<()>::Ok(()) });
3817    /// ```
3818    pub type ClientBuilder =
3819        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3820
3821    pub(crate) mod client {
3822        use super::super::super::client::JobController;
3823        pub struct Factory;
3824        impl gax::client_builder::internal::ClientFactory for Factory {
3825            type Client = JobController;
3826            type Credentials = gaxi::options::Credentials;
3827            async fn build(
3828                self,
3829                config: gaxi::options::ClientConfig,
3830            ) -> gax::client_builder::Result<Self::Client> {
3831                Self::Client::new(config).await
3832            }
3833        }
3834    }
3835
3836    /// Common implementation for [crate::client::JobController] request builders.
3837    #[derive(Clone, Debug)]
3838    pub(crate) struct RequestBuilder<R: std::default::Default> {
3839        stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3840        request: R,
3841        options: gax::options::RequestOptions,
3842    }
3843
3844    impl<R> RequestBuilder<R>
3845    where
3846        R: std::default::Default,
3847    {
3848        pub(crate) fn new(
3849            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3850        ) -> Self {
3851            Self {
3852                stub,
3853                request: R::default(),
3854                options: gax::options::RequestOptions::default(),
3855            }
3856        }
3857    }
3858
3859    /// The request builder for [JobController::submit_job][crate::client::JobController::submit_job] calls.
3860    ///
3861    /// # Example
3862    /// ```no_run
3863    /// # use google_cloud_dataproc_v1::builder;
3864    /// use builder::job_controller::SubmitJob;
3865    /// # tokio_test::block_on(async {
3866    ///
3867    /// let builder = prepare_request_builder();
3868    /// let response = builder.send().await?;
3869    /// # gax::Result::<()>::Ok(()) });
3870    ///
3871    /// fn prepare_request_builder() -> SubmitJob {
3872    ///   # panic!();
3873    ///   // ... details omitted ...
3874    /// }
3875    /// ```
3876    #[derive(Clone, Debug)]
3877    pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
3878
3879    impl SubmitJob {
3880        pub(crate) fn new(
3881            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3882        ) -> Self {
3883            Self(RequestBuilder::new(stub))
3884        }
3885
3886        /// Sets the full request, replacing any prior values.
3887        pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3888            self.0.request = v.into();
3889            self
3890        }
3891
3892        /// Sets all the options, replacing any prior values.
3893        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3894            self.0.options = v.into();
3895            self
3896        }
3897
3898        /// Sends the request.
3899        pub async fn send(self) -> Result<crate::model::Job> {
3900            (*self.0.stub)
3901                .submit_job(self.0.request, self.0.options)
3902                .await
3903                .map(gax::response::Response::into_body)
3904        }
3905
3906        /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
3907        ///
3908        /// This is a **required** field for requests.
3909        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3910            self.0.request.project_id = v.into();
3911            self
3912        }
3913
3914        /// Sets the value of [region][crate::model::SubmitJobRequest::region].
3915        ///
3916        /// This is a **required** field for requests.
3917        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3918            self.0.request.region = v.into();
3919            self
3920        }
3921
3922        /// Sets the value of [job][crate::model::SubmitJobRequest::job].
3923        ///
3924        /// This is a **required** field for requests.
3925        pub fn set_job<T>(mut self, v: T) -> Self
3926        where
3927            T: std::convert::Into<crate::model::Job>,
3928        {
3929            self.0.request.job = std::option::Option::Some(v.into());
3930            self
3931        }
3932
3933        /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
3934        ///
3935        /// This is a **required** field for requests.
3936        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3937        where
3938            T: std::convert::Into<crate::model::Job>,
3939        {
3940            self.0.request.job = v.map(|x| x.into());
3941            self
3942        }
3943
3944        /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
3945        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3946            self.0.request.request_id = v.into();
3947            self
3948        }
3949    }
3950
3951    #[doc(hidden)]
3952    impl gax::options::internal::RequestBuilder for SubmitJob {
3953        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3954            &mut self.0.options
3955        }
3956    }
3957
3958    /// The request builder for [JobController::submit_job_as_operation][crate::client::JobController::submit_job_as_operation] calls.
3959    ///
3960    /// # Example
3961    /// ```no_run
3962    /// # use google_cloud_dataproc_v1::builder;
3963    /// use builder::job_controller::SubmitJobAsOperation;
3964    /// # tokio_test::block_on(async {
3965    /// use lro::Poller;
3966    ///
3967    /// let builder = prepare_request_builder();
3968    /// let response = builder.poller().until_done().await?;
3969    /// # gax::Result::<()>::Ok(()) });
3970    ///
3971    /// fn prepare_request_builder() -> SubmitJobAsOperation {
3972    ///   # panic!();
3973    ///   // ... details omitted ...
3974    /// }
3975    /// ```
3976    #[derive(Clone, Debug)]
3977    pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
3978
3979    impl SubmitJobAsOperation {
3980        pub(crate) fn new(
3981            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3982        ) -> Self {
3983            Self(RequestBuilder::new(stub))
3984        }
3985
3986        /// Sets the full request, replacing any prior values.
3987        pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3988            self.0.request = v.into();
3989            self
3990        }
3991
3992        /// Sets all the options, replacing any prior values.
3993        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3994            self.0.options = v.into();
3995            self
3996        }
3997
3998        /// Sends the request.
3999        ///
4000        /// # Long running operations
4001        ///
4002        /// This starts, but does not poll, a longrunning operation. More information
4003        /// on [submit_job_as_operation][crate::client::JobController::submit_job_as_operation].
4004        pub async fn send(self) -> Result<longrunning::model::Operation> {
4005            (*self.0.stub)
4006                .submit_job_as_operation(self.0.request, self.0.options)
4007                .await
4008                .map(gax::response::Response::into_body)
4009        }
4010
4011        /// Creates a [Poller][lro::Poller] to work with `submit_job_as_operation`.
4012        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::JobMetadata> {
4013            type Operation = lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
4014            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4015            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4016
4017            let stub = self.0.stub.clone();
4018            let mut options = self.0.options.clone();
4019            options.set_retry_policy(gax::retry_policy::NeverRetry);
4020            let query = move |name| {
4021                let stub = stub.clone();
4022                let options = options.clone();
4023                async {
4024                    let op = GetOperation::new(stub)
4025                        .set_name(name)
4026                        .with_options(options)
4027                        .send()
4028                        .await?;
4029                    Ok(Operation::new(op))
4030                }
4031            };
4032
4033            let start = move || async {
4034                let op = self.send().await?;
4035                Ok(Operation::new(op))
4036            };
4037
4038            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4039        }
4040
4041        /// Sets the value of [project_id][crate::model::SubmitJobRequest::project_id].
4042        ///
4043        /// This is a **required** field for requests.
4044        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4045            self.0.request.project_id = v.into();
4046            self
4047        }
4048
4049        /// Sets the value of [region][crate::model::SubmitJobRequest::region].
4050        ///
4051        /// This is a **required** field for requests.
4052        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4053            self.0.request.region = v.into();
4054            self
4055        }
4056
4057        /// Sets the value of [job][crate::model::SubmitJobRequest::job].
4058        ///
4059        /// This is a **required** field for requests.
4060        pub fn set_job<T>(mut self, v: T) -> Self
4061        where
4062            T: std::convert::Into<crate::model::Job>,
4063        {
4064            self.0.request.job = std::option::Option::Some(v.into());
4065            self
4066        }
4067
4068        /// Sets or clears the value of [job][crate::model::SubmitJobRequest::job].
4069        ///
4070        /// This is a **required** field for requests.
4071        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4072        where
4073            T: std::convert::Into<crate::model::Job>,
4074        {
4075            self.0.request.job = v.map(|x| x.into());
4076            self
4077        }
4078
4079        /// Sets the value of [request_id][crate::model::SubmitJobRequest::request_id].
4080        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4081            self.0.request.request_id = v.into();
4082            self
4083        }
4084    }
4085
4086    #[doc(hidden)]
4087    impl gax::options::internal::RequestBuilder for SubmitJobAsOperation {
4088        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4089            &mut self.0.options
4090        }
4091    }
4092
4093    /// The request builder for [JobController::get_job][crate::client::JobController::get_job] calls.
4094    ///
4095    /// # Example
4096    /// ```no_run
4097    /// # use google_cloud_dataproc_v1::builder;
4098    /// use builder::job_controller::GetJob;
4099    /// # tokio_test::block_on(async {
4100    ///
4101    /// let builder = prepare_request_builder();
4102    /// let response = builder.send().await?;
4103    /// # gax::Result::<()>::Ok(()) });
4104    ///
4105    /// fn prepare_request_builder() -> GetJob {
4106    ///   # panic!();
4107    ///   // ... details omitted ...
4108    /// }
4109    /// ```
4110    #[derive(Clone, Debug)]
4111    pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4112
4113    impl GetJob {
4114        pub(crate) fn new(
4115            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4116        ) -> Self {
4117            Self(RequestBuilder::new(stub))
4118        }
4119
4120        /// Sets the full request, replacing any prior values.
4121        pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4122            self.0.request = v.into();
4123            self
4124        }
4125
4126        /// Sets all the options, replacing any prior values.
4127        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4128            self.0.options = v.into();
4129            self
4130        }
4131
4132        /// Sends the request.
4133        pub async fn send(self) -> Result<crate::model::Job> {
4134            (*self.0.stub)
4135                .get_job(self.0.request, self.0.options)
4136                .await
4137                .map(gax::response::Response::into_body)
4138        }
4139
4140        /// Sets the value of [project_id][crate::model::GetJobRequest::project_id].
4141        ///
4142        /// This is a **required** field for requests.
4143        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4144            self.0.request.project_id = v.into();
4145            self
4146        }
4147
4148        /// Sets the value of [region][crate::model::GetJobRequest::region].
4149        ///
4150        /// This is a **required** field for requests.
4151        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4152            self.0.request.region = v.into();
4153            self
4154        }
4155
4156        /// Sets the value of [job_id][crate::model::GetJobRequest::job_id].
4157        ///
4158        /// This is a **required** field for requests.
4159        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4160            self.0.request.job_id = v.into();
4161            self
4162        }
4163    }
4164
4165    #[doc(hidden)]
4166    impl gax::options::internal::RequestBuilder for GetJob {
4167        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4168            &mut self.0.options
4169        }
4170    }
4171
4172    /// The request builder for [JobController::list_jobs][crate::client::JobController::list_jobs] calls.
4173    ///
4174    /// # Example
4175    /// ```no_run
4176    /// # use google_cloud_dataproc_v1::builder;
4177    /// use builder::job_controller::ListJobs;
4178    /// # tokio_test::block_on(async {
4179    /// use gax::paginator::ItemPaginator;
4180    ///
4181    /// let builder = prepare_request_builder();
4182    /// let mut items = builder.by_item();
4183    /// while let Some(result) = items.next().await {
4184    ///   let item = result?;
4185    /// }
4186    /// # gax::Result::<()>::Ok(()) });
4187    ///
4188    /// fn prepare_request_builder() -> ListJobs {
4189    ///   # panic!();
4190    ///   // ... details omitted ...
4191    /// }
4192    /// ```
4193    #[derive(Clone, Debug)]
4194    pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4195
4196    impl ListJobs {
4197        pub(crate) fn new(
4198            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4199        ) -> Self {
4200            Self(RequestBuilder::new(stub))
4201        }
4202
4203        /// Sets the full request, replacing any prior values.
4204        pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4205            self.0.request = v.into();
4206            self
4207        }
4208
4209        /// Sets all the options, replacing any prior values.
4210        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4211            self.0.options = v.into();
4212            self
4213        }
4214
4215        /// Sends the request.
4216        pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4217            (*self.0.stub)
4218                .list_jobs(self.0.request, self.0.options)
4219                .await
4220                .map(gax::response::Response::into_body)
4221        }
4222
4223        /// Streams each page in the collection.
4224        pub fn by_page(
4225            self,
4226        ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
4227        {
4228            use std::clone::Clone;
4229            let token = self.0.request.page_token.clone();
4230            let execute = move |token: String| {
4231                let mut builder = self.clone();
4232                builder.0.request = builder.0.request.set_page_token(token);
4233                builder.send()
4234            };
4235            gax::paginator::internal::new_paginator(token, execute)
4236        }
4237
4238        /// Streams each item in the collection.
4239        pub fn by_item(
4240            self,
4241        ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
4242        {
4243            use gax::paginator::Paginator;
4244            self.by_page().items()
4245        }
4246
4247        /// Sets the value of [project_id][crate::model::ListJobsRequest::project_id].
4248        ///
4249        /// This is a **required** field for requests.
4250        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4251            self.0.request.project_id = v.into();
4252            self
4253        }
4254
4255        /// Sets the value of [region][crate::model::ListJobsRequest::region].
4256        ///
4257        /// This is a **required** field for requests.
4258        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4259            self.0.request.region = v.into();
4260            self
4261        }
4262
4263        /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
4264        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4265            self.0.request.page_size = v.into();
4266            self
4267        }
4268
4269        /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
4270        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4271            self.0.request.page_token = v.into();
4272            self
4273        }
4274
4275        /// Sets the value of [cluster_name][crate::model::ListJobsRequest::cluster_name].
4276        pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4277            self.0.request.cluster_name = v.into();
4278            self
4279        }
4280
4281        /// Sets the value of [job_state_matcher][crate::model::ListJobsRequest::job_state_matcher].
4282        pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4283            mut self,
4284            v: T,
4285        ) -> Self {
4286            self.0.request.job_state_matcher = v.into();
4287            self
4288        }
4289
4290        /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
4291        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4292            self.0.request.filter = v.into();
4293            self
4294        }
4295    }
4296
4297    #[doc(hidden)]
4298    impl gax::options::internal::RequestBuilder for ListJobs {
4299        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4300            &mut self.0.options
4301        }
4302    }
4303
4304    /// The request builder for [JobController::update_job][crate::client::JobController::update_job] calls.
4305    ///
4306    /// # Example
4307    /// ```no_run
4308    /// # use google_cloud_dataproc_v1::builder;
4309    /// use builder::job_controller::UpdateJob;
4310    /// # tokio_test::block_on(async {
4311    ///
4312    /// let builder = prepare_request_builder();
4313    /// let response = builder.send().await?;
4314    /// # gax::Result::<()>::Ok(()) });
4315    ///
4316    /// fn prepare_request_builder() -> UpdateJob {
4317    ///   # panic!();
4318    ///   // ... details omitted ...
4319    /// }
4320    /// ```
4321    #[derive(Clone, Debug)]
4322    pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4323
4324    impl UpdateJob {
4325        pub(crate) fn new(
4326            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4327        ) -> Self {
4328            Self(RequestBuilder::new(stub))
4329        }
4330
4331        /// Sets the full request, replacing any prior values.
4332        pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4333            self.0.request = v.into();
4334            self
4335        }
4336
4337        /// Sets all the options, replacing any prior values.
4338        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4339            self.0.options = v.into();
4340            self
4341        }
4342
4343        /// Sends the request.
4344        pub async fn send(self) -> Result<crate::model::Job> {
4345            (*self.0.stub)
4346                .update_job(self.0.request, self.0.options)
4347                .await
4348                .map(gax::response::Response::into_body)
4349        }
4350
4351        /// Sets the value of [project_id][crate::model::UpdateJobRequest::project_id].
4352        ///
4353        /// This is a **required** field for requests.
4354        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4355            self.0.request.project_id = v.into();
4356            self
4357        }
4358
4359        /// Sets the value of [region][crate::model::UpdateJobRequest::region].
4360        ///
4361        /// This is a **required** field for requests.
4362        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4363            self.0.request.region = v.into();
4364            self
4365        }
4366
4367        /// Sets the value of [job_id][crate::model::UpdateJobRequest::job_id].
4368        ///
4369        /// This is a **required** field for requests.
4370        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4371            self.0.request.job_id = v.into();
4372            self
4373        }
4374
4375        /// Sets the value of [job][crate::model::UpdateJobRequest::job].
4376        ///
4377        /// This is a **required** field for requests.
4378        pub fn set_job<T>(mut self, v: T) -> Self
4379        where
4380            T: std::convert::Into<crate::model::Job>,
4381        {
4382            self.0.request.job = std::option::Option::Some(v.into());
4383            self
4384        }
4385
4386        /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
4387        ///
4388        /// This is a **required** field for requests.
4389        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4390        where
4391            T: std::convert::Into<crate::model::Job>,
4392        {
4393            self.0.request.job = v.map(|x| x.into());
4394            self
4395        }
4396
4397        /// Sets the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
4398        ///
4399        /// This is a **required** field for requests.
4400        pub fn set_update_mask<T>(mut self, v: T) -> Self
4401        where
4402            T: std::convert::Into<wkt::FieldMask>,
4403        {
4404            self.0.request.update_mask = std::option::Option::Some(v.into());
4405            self
4406        }
4407
4408        /// Sets or clears the value of [update_mask][crate::model::UpdateJobRequest::update_mask].
4409        ///
4410        /// This is a **required** field for requests.
4411        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4412        where
4413            T: std::convert::Into<wkt::FieldMask>,
4414        {
4415            self.0.request.update_mask = v.map(|x| x.into());
4416            self
4417        }
4418    }
4419
4420    #[doc(hidden)]
4421    impl gax::options::internal::RequestBuilder for UpdateJob {
4422        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4423            &mut self.0.options
4424        }
4425    }
4426
4427    /// The request builder for [JobController::cancel_job][crate::client::JobController::cancel_job] calls.
4428    ///
4429    /// # Example
4430    /// ```no_run
4431    /// # use google_cloud_dataproc_v1::builder;
4432    /// use builder::job_controller::CancelJob;
4433    /// # tokio_test::block_on(async {
4434    ///
4435    /// let builder = prepare_request_builder();
4436    /// let response = builder.send().await?;
4437    /// # gax::Result::<()>::Ok(()) });
4438    ///
4439    /// fn prepare_request_builder() -> CancelJob {
4440    ///   # panic!();
4441    ///   // ... details omitted ...
4442    /// }
4443    /// ```
4444    #[derive(Clone, Debug)]
4445    pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4446
4447    impl CancelJob {
4448        pub(crate) fn new(
4449            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4450        ) -> Self {
4451            Self(RequestBuilder::new(stub))
4452        }
4453
4454        /// Sets the full request, replacing any prior values.
4455        pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4456            self.0.request = v.into();
4457            self
4458        }
4459
4460        /// Sets all the options, replacing any prior values.
4461        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4462            self.0.options = v.into();
4463            self
4464        }
4465
4466        /// Sends the request.
4467        pub async fn send(self) -> Result<crate::model::Job> {
4468            (*self.0.stub)
4469                .cancel_job(self.0.request, self.0.options)
4470                .await
4471                .map(gax::response::Response::into_body)
4472        }
4473
4474        /// Sets the value of [project_id][crate::model::CancelJobRequest::project_id].
4475        ///
4476        /// This is a **required** field for requests.
4477        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4478            self.0.request.project_id = v.into();
4479            self
4480        }
4481
4482        /// Sets the value of [region][crate::model::CancelJobRequest::region].
4483        ///
4484        /// This is a **required** field for requests.
4485        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4486            self.0.request.region = v.into();
4487            self
4488        }
4489
4490        /// Sets the value of [job_id][crate::model::CancelJobRequest::job_id].
4491        ///
4492        /// This is a **required** field for requests.
4493        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4494            self.0.request.job_id = v.into();
4495            self
4496        }
4497    }
4498
4499    #[doc(hidden)]
4500    impl gax::options::internal::RequestBuilder for CancelJob {
4501        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4502            &mut self.0.options
4503        }
4504    }
4505
4506    /// The request builder for [JobController::delete_job][crate::client::JobController::delete_job] calls.
4507    ///
4508    /// # Example
4509    /// ```no_run
4510    /// # use google_cloud_dataproc_v1::builder;
4511    /// use builder::job_controller::DeleteJob;
4512    /// # tokio_test::block_on(async {
4513    ///
4514    /// let builder = prepare_request_builder();
4515    /// let response = builder.send().await?;
4516    /// # gax::Result::<()>::Ok(()) });
4517    ///
4518    /// fn prepare_request_builder() -> DeleteJob {
4519    ///   # panic!();
4520    ///   // ... details omitted ...
4521    /// }
4522    /// ```
4523    #[derive(Clone, Debug)]
4524    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4525
4526    impl DeleteJob {
4527        pub(crate) fn new(
4528            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4529        ) -> Self {
4530            Self(RequestBuilder::new(stub))
4531        }
4532
4533        /// Sets the full request, replacing any prior values.
4534        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4535            self.0.request = v.into();
4536            self
4537        }
4538
4539        /// Sets all the options, replacing any prior values.
4540        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4541            self.0.options = v.into();
4542            self
4543        }
4544
4545        /// Sends the request.
4546        pub async fn send(self) -> Result<()> {
4547            (*self.0.stub)
4548                .delete_job(self.0.request, self.0.options)
4549                .await
4550                .map(gax::response::Response::into_body)
4551        }
4552
4553        /// Sets the value of [project_id][crate::model::DeleteJobRequest::project_id].
4554        ///
4555        /// This is a **required** field for requests.
4556        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4557            self.0.request.project_id = v.into();
4558            self
4559        }
4560
4561        /// Sets the value of [region][crate::model::DeleteJobRequest::region].
4562        ///
4563        /// This is a **required** field for requests.
4564        pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4565            self.0.request.region = v.into();
4566            self
4567        }
4568
4569        /// Sets the value of [job_id][crate::model::DeleteJobRequest::job_id].
4570        ///
4571        /// This is a **required** field for requests.
4572        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4573            self.0.request.job_id = v.into();
4574            self
4575        }
4576    }
4577
4578    #[doc(hidden)]
4579    impl gax::options::internal::RequestBuilder for DeleteJob {
4580        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4581            &mut self.0.options
4582        }
4583    }
4584
4585    /// The request builder for [JobController::set_iam_policy][crate::client::JobController::set_iam_policy] calls.
4586    ///
4587    /// # Example
4588    /// ```no_run
4589    /// # use google_cloud_dataproc_v1::builder;
4590    /// use builder::job_controller::SetIamPolicy;
4591    /// # tokio_test::block_on(async {
4592    ///
4593    /// let builder = prepare_request_builder();
4594    /// let response = builder.send().await?;
4595    /// # gax::Result::<()>::Ok(()) });
4596    ///
4597    /// fn prepare_request_builder() -> SetIamPolicy {
4598    ///   # panic!();
4599    ///   // ... details omitted ...
4600    /// }
4601    /// ```
4602    #[derive(Clone, Debug)]
4603    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4604
4605    impl SetIamPolicy {
4606        pub(crate) fn new(
4607            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4608        ) -> Self {
4609            Self(RequestBuilder::new(stub))
4610        }
4611
4612        /// Sets the full request, replacing any prior values.
4613        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4614            self.0.request = v.into();
4615            self
4616        }
4617
4618        /// Sets all the options, replacing any prior values.
4619        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4620            self.0.options = v.into();
4621            self
4622        }
4623
4624        /// Sends the request.
4625        pub async fn send(self) -> Result<iam_v1::model::Policy> {
4626            (*self.0.stub)
4627                .set_iam_policy(self.0.request, self.0.options)
4628                .await
4629                .map(gax::response::Response::into_body)
4630        }
4631
4632        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
4633        ///
4634        /// This is a **required** field for requests.
4635        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4636            self.0.request.resource = v.into();
4637            self
4638        }
4639
4640        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4641        ///
4642        /// This is a **required** field for requests.
4643        pub fn set_policy<T>(mut self, v: T) -> Self
4644        where
4645            T: std::convert::Into<iam_v1::model::Policy>,
4646        {
4647            self.0.request.policy = std::option::Option::Some(v.into());
4648            self
4649        }
4650
4651        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4652        ///
4653        /// This is a **required** field for requests.
4654        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4655        where
4656            T: std::convert::Into<iam_v1::model::Policy>,
4657        {
4658            self.0.request.policy = v.map(|x| x.into());
4659            self
4660        }
4661
4662        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4663        pub fn set_update_mask<T>(mut self, v: T) -> Self
4664        where
4665            T: std::convert::Into<wkt::FieldMask>,
4666        {
4667            self.0.request.update_mask = std::option::Option::Some(v.into());
4668            self
4669        }
4670
4671        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4672        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4673        where
4674            T: std::convert::Into<wkt::FieldMask>,
4675        {
4676            self.0.request.update_mask = v.map(|x| x.into());
4677            self
4678        }
4679    }
4680
4681    #[doc(hidden)]
4682    impl gax::options::internal::RequestBuilder for SetIamPolicy {
4683        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4684            &mut self.0.options
4685        }
4686    }
4687
4688    /// The request builder for [JobController::get_iam_policy][crate::client::JobController::get_iam_policy] calls.
4689    ///
4690    /// # Example
4691    /// ```no_run
4692    /// # use google_cloud_dataproc_v1::builder;
4693    /// use builder::job_controller::GetIamPolicy;
4694    /// # tokio_test::block_on(async {
4695    ///
4696    /// let builder = prepare_request_builder();
4697    /// let response = builder.send().await?;
4698    /// # gax::Result::<()>::Ok(()) });
4699    ///
4700    /// fn prepare_request_builder() -> GetIamPolicy {
4701    ///   # panic!();
4702    ///   // ... details omitted ...
4703    /// }
4704    /// ```
4705    #[derive(Clone, Debug)]
4706    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4707
4708    impl GetIamPolicy {
4709        pub(crate) fn new(
4710            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4711        ) -> Self {
4712            Self(RequestBuilder::new(stub))
4713        }
4714
4715        /// Sets the full request, replacing any prior values.
4716        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4717            self.0.request = v.into();
4718            self
4719        }
4720
4721        /// Sets all the options, replacing any prior values.
4722        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4723            self.0.options = v.into();
4724            self
4725        }
4726
4727        /// Sends the request.
4728        pub async fn send(self) -> Result<iam_v1::model::Policy> {
4729            (*self.0.stub)
4730                .get_iam_policy(self.0.request, self.0.options)
4731                .await
4732                .map(gax::response::Response::into_body)
4733        }
4734
4735        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
4736        ///
4737        /// This is a **required** field for requests.
4738        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4739            self.0.request.resource = v.into();
4740            self
4741        }
4742
4743        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
4744        pub fn set_options<T>(mut self, v: T) -> Self
4745        where
4746            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4747        {
4748            self.0.request.options = std::option::Option::Some(v.into());
4749            self
4750        }
4751
4752        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
4753        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4754        where
4755            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4756        {
4757            self.0.request.options = v.map(|x| x.into());
4758            self
4759        }
4760    }
4761
4762    #[doc(hidden)]
4763    impl gax::options::internal::RequestBuilder for GetIamPolicy {
4764        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4765            &mut self.0.options
4766        }
4767    }
4768
4769    /// The request builder for [JobController::test_iam_permissions][crate::client::JobController::test_iam_permissions] calls.
4770    ///
4771    /// # Example
4772    /// ```no_run
4773    /// # use google_cloud_dataproc_v1::builder;
4774    /// use builder::job_controller::TestIamPermissions;
4775    /// # tokio_test::block_on(async {
4776    ///
4777    /// let builder = prepare_request_builder();
4778    /// let response = builder.send().await?;
4779    /// # gax::Result::<()>::Ok(()) });
4780    ///
4781    /// fn prepare_request_builder() -> TestIamPermissions {
4782    ///   # panic!();
4783    ///   // ... details omitted ...
4784    /// }
4785    /// ```
4786    #[derive(Clone, Debug)]
4787    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4788
4789    impl TestIamPermissions {
4790        pub(crate) fn new(
4791            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4792        ) -> Self {
4793            Self(RequestBuilder::new(stub))
4794        }
4795
4796        /// Sets the full request, replacing any prior values.
4797        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4798            mut self,
4799            v: V,
4800        ) -> Self {
4801            self.0.request = v.into();
4802            self
4803        }
4804
4805        /// Sets all the options, replacing any prior values.
4806        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4807            self.0.options = v.into();
4808            self
4809        }
4810
4811        /// Sends the request.
4812        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4813            (*self.0.stub)
4814                .test_iam_permissions(self.0.request, self.0.options)
4815                .await
4816                .map(gax::response::Response::into_body)
4817        }
4818
4819        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
4820        ///
4821        /// This is a **required** field for requests.
4822        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4823            self.0.request.resource = v.into();
4824            self
4825        }
4826
4827        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
4828        ///
4829        /// This is a **required** field for requests.
4830        pub fn set_permissions<T, V>(mut self, v: T) -> Self
4831        where
4832            T: std::iter::IntoIterator<Item = V>,
4833            V: std::convert::Into<std::string::String>,
4834        {
4835            use std::iter::Iterator;
4836            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4837            self
4838        }
4839    }
4840
4841    #[doc(hidden)]
4842    impl gax::options::internal::RequestBuilder for TestIamPermissions {
4843        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4844            &mut self.0.options
4845        }
4846    }
4847
4848    /// The request builder for [JobController::list_operations][crate::client::JobController::list_operations] calls.
4849    ///
4850    /// # Example
4851    /// ```no_run
4852    /// # use google_cloud_dataproc_v1::builder;
4853    /// use builder::job_controller::ListOperations;
4854    /// # tokio_test::block_on(async {
4855    /// use gax::paginator::ItemPaginator;
4856    ///
4857    /// let builder = prepare_request_builder();
4858    /// let mut items = builder.by_item();
4859    /// while let Some(result) = items.next().await {
4860    ///   let item = result?;
4861    /// }
4862    /// # gax::Result::<()>::Ok(()) });
4863    ///
4864    /// fn prepare_request_builder() -> ListOperations {
4865    ///   # panic!();
4866    ///   // ... details omitted ...
4867    /// }
4868    /// ```
4869    #[derive(Clone, Debug)]
4870    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4871
4872    impl ListOperations {
4873        pub(crate) fn new(
4874            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4875        ) -> Self {
4876            Self(RequestBuilder::new(stub))
4877        }
4878
4879        /// Sets the full request, replacing any prior values.
4880        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4881            mut self,
4882            v: V,
4883        ) -> Self {
4884            self.0.request = v.into();
4885            self
4886        }
4887
4888        /// Sets all the options, replacing any prior values.
4889        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4890            self.0.options = v.into();
4891            self
4892        }
4893
4894        /// Sends the request.
4895        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4896            (*self.0.stub)
4897                .list_operations(self.0.request, self.0.options)
4898                .await
4899                .map(gax::response::Response::into_body)
4900        }
4901
4902        /// Streams each page in the collection.
4903        pub fn by_page(
4904            self,
4905        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4906        {
4907            use std::clone::Clone;
4908            let token = self.0.request.page_token.clone();
4909            let execute = move |token: String| {
4910                let mut builder = self.clone();
4911                builder.0.request = builder.0.request.set_page_token(token);
4912                builder.send()
4913            };
4914            gax::paginator::internal::new_paginator(token, execute)
4915        }
4916
4917        /// Streams each item in the collection.
4918        pub fn by_item(
4919            self,
4920        ) -> impl gax::paginator::ItemPaginator<
4921            longrunning::model::ListOperationsResponse,
4922            gax::error::Error,
4923        > {
4924            use gax::paginator::Paginator;
4925            self.by_page().items()
4926        }
4927
4928        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4929        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4930            self.0.request.name = v.into();
4931            self
4932        }
4933
4934        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4935        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4936            self.0.request.filter = v.into();
4937            self
4938        }
4939
4940        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4941        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4942            self.0.request.page_size = v.into();
4943            self
4944        }
4945
4946        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4947        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4948            self.0.request.page_token = v.into();
4949            self
4950        }
4951    }
4952
4953    #[doc(hidden)]
4954    impl gax::options::internal::RequestBuilder for ListOperations {
4955        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4956            &mut self.0.options
4957        }
4958    }
4959
4960    /// The request builder for [JobController::get_operation][crate::client::JobController::get_operation] calls.
4961    ///
4962    /// # Example
4963    /// ```no_run
4964    /// # use google_cloud_dataproc_v1::builder;
4965    /// use builder::job_controller::GetOperation;
4966    /// # tokio_test::block_on(async {
4967    ///
4968    /// let builder = prepare_request_builder();
4969    /// let response = builder.send().await?;
4970    /// # gax::Result::<()>::Ok(()) });
4971    ///
4972    /// fn prepare_request_builder() -> GetOperation {
4973    ///   # panic!();
4974    ///   // ... details omitted ...
4975    /// }
4976    /// ```
4977    #[derive(Clone, Debug)]
4978    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4979
4980    impl GetOperation {
4981        pub(crate) fn new(
4982            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4983        ) -> Self {
4984            Self(RequestBuilder::new(stub))
4985        }
4986
4987        /// Sets the full request, replacing any prior values.
4988        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4989            mut self,
4990            v: V,
4991        ) -> Self {
4992            self.0.request = v.into();
4993            self
4994        }
4995
4996        /// Sets all the options, replacing any prior values.
4997        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4998            self.0.options = v.into();
4999            self
5000        }
5001
5002        /// Sends the request.
5003        pub async fn send(self) -> Result<longrunning::model::Operation> {
5004            (*self.0.stub)
5005                .get_operation(self.0.request, self.0.options)
5006                .await
5007                .map(gax::response::Response::into_body)
5008        }
5009
5010        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5011        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5012            self.0.request.name = v.into();
5013            self
5014        }
5015    }
5016
5017    #[doc(hidden)]
5018    impl gax::options::internal::RequestBuilder for GetOperation {
5019        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5020            &mut self.0.options
5021        }
5022    }
5023
5024    /// The request builder for [JobController::delete_operation][crate::client::JobController::delete_operation] calls.
5025    ///
5026    /// # Example
5027    /// ```no_run
5028    /// # use google_cloud_dataproc_v1::builder;
5029    /// use builder::job_controller::DeleteOperation;
5030    /// # tokio_test::block_on(async {
5031    ///
5032    /// let builder = prepare_request_builder();
5033    /// let response = builder.send().await?;
5034    /// # gax::Result::<()>::Ok(()) });
5035    ///
5036    /// fn prepare_request_builder() -> DeleteOperation {
5037    ///   # panic!();
5038    ///   // ... details omitted ...
5039    /// }
5040    /// ```
5041    #[derive(Clone, Debug)]
5042    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5043
5044    impl DeleteOperation {
5045        pub(crate) fn new(
5046            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5047        ) -> Self {
5048            Self(RequestBuilder::new(stub))
5049        }
5050
5051        /// Sets the full request, replacing any prior values.
5052        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5053            mut self,
5054            v: V,
5055        ) -> Self {
5056            self.0.request = v.into();
5057            self
5058        }
5059
5060        /// Sets all the options, replacing any prior values.
5061        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5062            self.0.options = v.into();
5063            self
5064        }
5065
5066        /// Sends the request.
5067        pub async fn send(self) -> Result<()> {
5068            (*self.0.stub)
5069                .delete_operation(self.0.request, self.0.options)
5070                .await
5071                .map(gax::response::Response::into_body)
5072        }
5073
5074        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
5075        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5076            self.0.request.name = v.into();
5077            self
5078        }
5079    }
5080
5081    #[doc(hidden)]
5082    impl gax::options::internal::RequestBuilder for DeleteOperation {
5083        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5084            &mut self.0.options
5085        }
5086    }
5087
5088    /// The request builder for [JobController::cancel_operation][crate::client::JobController::cancel_operation] calls.
5089    ///
5090    /// # Example
5091    /// ```no_run
5092    /// # use google_cloud_dataproc_v1::builder;
5093    /// use builder::job_controller::CancelOperation;
5094    /// # tokio_test::block_on(async {
5095    ///
5096    /// let builder = prepare_request_builder();
5097    /// let response = builder.send().await?;
5098    /// # gax::Result::<()>::Ok(()) });
5099    ///
5100    /// fn prepare_request_builder() -> CancelOperation {
5101    ///   # panic!();
5102    ///   // ... details omitted ...
5103    /// }
5104    /// ```
5105    #[derive(Clone, Debug)]
5106    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5107
5108    impl CancelOperation {
5109        pub(crate) fn new(
5110            stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5111        ) -> Self {
5112            Self(RequestBuilder::new(stub))
5113        }
5114
5115        /// Sets the full request, replacing any prior values.
5116        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5117            mut self,
5118            v: V,
5119        ) -> Self {
5120            self.0.request = v.into();
5121            self
5122        }
5123
5124        /// Sets all the options, replacing any prior values.
5125        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5126            self.0.options = v.into();
5127            self
5128        }
5129
5130        /// Sends the request.
5131        pub async fn send(self) -> Result<()> {
5132            (*self.0.stub)
5133                .cancel_operation(self.0.request, self.0.options)
5134                .await
5135                .map(gax::response::Response::into_body)
5136        }
5137
5138        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
5139        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5140            self.0.request.name = v.into();
5141            self
5142        }
5143    }
5144
5145    #[doc(hidden)]
5146    impl gax::options::internal::RequestBuilder for CancelOperation {
5147        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5148            &mut self.0.options
5149        }
5150    }
5151}
5152
5153pub mod node_group_controller {
5154    use crate::Result;
5155
5156    /// A builder for [NodeGroupController][crate::client::NodeGroupController].
5157    ///
5158    /// ```
5159    /// # tokio_test::block_on(async {
5160    /// # use google_cloud_dataproc_v1::*;
5161    /// # use builder::node_group_controller::ClientBuilder;
5162    /// # use client::NodeGroupController;
5163    /// let builder : ClientBuilder = NodeGroupController::builder();
5164    /// let client = builder
5165    ///     .with_endpoint("https://dataproc.googleapis.com")
5166    ///     .build().await?;
5167    /// # gax::client_builder::Result::<()>::Ok(()) });
5168    /// ```
5169    pub type ClientBuilder =
5170        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5171
5172    pub(crate) mod client {
5173        use super::super::super::client::NodeGroupController;
5174        pub struct Factory;
5175        impl gax::client_builder::internal::ClientFactory for Factory {
5176            type Client = NodeGroupController;
5177            type Credentials = gaxi::options::Credentials;
5178            async fn build(
5179                self,
5180                config: gaxi::options::ClientConfig,
5181            ) -> gax::client_builder::Result<Self::Client> {
5182                Self::Client::new(config).await
5183            }
5184        }
5185    }
5186
5187    /// Common implementation for [crate::client::NodeGroupController] request builders.
5188    #[derive(Clone, Debug)]
5189    pub(crate) struct RequestBuilder<R: std::default::Default> {
5190        stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5191        request: R,
5192        options: gax::options::RequestOptions,
5193    }
5194
5195    impl<R> RequestBuilder<R>
5196    where
5197        R: std::default::Default,
5198    {
5199        pub(crate) fn new(
5200            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5201        ) -> Self {
5202            Self {
5203                stub,
5204                request: R::default(),
5205                options: gax::options::RequestOptions::default(),
5206            }
5207        }
5208    }
5209
5210    /// The request builder for [NodeGroupController::create_node_group][crate::client::NodeGroupController::create_node_group] calls.
5211    ///
5212    /// # Example
5213    /// ```no_run
5214    /// # use google_cloud_dataproc_v1::builder;
5215    /// use builder::node_group_controller::CreateNodeGroup;
5216    /// # tokio_test::block_on(async {
5217    /// use lro::Poller;
5218    ///
5219    /// let builder = prepare_request_builder();
5220    /// let response = builder.poller().until_done().await?;
5221    /// # gax::Result::<()>::Ok(()) });
5222    ///
5223    /// fn prepare_request_builder() -> CreateNodeGroup {
5224    ///   # panic!();
5225    ///   // ... details omitted ...
5226    /// }
5227    /// ```
5228    #[derive(Clone, Debug)]
5229    pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5230
5231    impl CreateNodeGroup {
5232        pub(crate) fn new(
5233            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5234        ) -> Self {
5235            Self(RequestBuilder::new(stub))
5236        }
5237
5238        /// Sets the full request, replacing any prior values.
5239        pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5240            self.0.request = v.into();
5241            self
5242        }
5243
5244        /// Sets all the options, replacing any prior values.
5245        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5246            self.0.options = v.into();
5247            self
5248        }
5249
5250        /// Sends the request.
5251        ///
5252        /// # Long running operations
5253        ///
5254        /// This starts, but does not poll, a longrunning operation. More information
5255        /// on [create_node_group][crate::client::NodeGroupController::create_node_group].
5256        pub async fn send(self) -> Result<longrunning::model::Operation> {
5257            (*self.0.stub)
5258                .create_node_group(self.0.request, self.0.options)
5259                .await
5260                .map(gax::response::Response::into_body)
5261        }
5262
5263        /// Creates a [Poller][lro::Poller] to work with `create_node_group`.
5264        pub fn poller(
5265            self,
5266        ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5267        {
5268            type Operation = lro::internal::Operation<
5269                crate::model::NodeGroup,
5270                crate::model::NodeGroupOperationMetadata,
5271            >;
5272            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5273            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5274
5275            let stub = self.0.stub.clone();
5276            let mut options = self.0.options.clone();
5277            options.set_retry_policy(gax::retry_policy::NeverRetry);
5278            let query = move |name| {
5279                let stub = stub.clone();
5280                let options = options.clone();
5281                async {
5282                    let op = GetOperation::new(stub)
5283                        .set_name(name)
5284                        .with_options(options)
5285                        .send()
5286                        .await?;
5287                    Ok(Operation::new(op))
5288                }
5289            };
5290
5291            let start = move || async {
5292                let op = self.send().await?;
5293                Ok(Operation::new(op))
5294            };
5295
5296            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5297        }
5298
5299        /// Sets the value of [parent][crate::model::CreateNodeGroupRequest::parent].
5300        ///
5301        /// This is a **required** field for requests.
5302        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5303            self.0.request.parent = v.into();
5304            self
5305        }
5306
5307        /// Sets the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
5308        ///
5309        /// This is a **required** field for requests.
5310        pub fn set_node_group<T>(mut self, v: T) -> Self
5311        where
5312            T: std::convert::Into<crate::model::NodeGroup>,
5313        {
5314            self.0.request.node_group = std::option::Option::Some(v.into());
5315            self
5316        }
5317
5318        /// Sets or clears the value of [node_group][crate::model::CreateNodeGroupRequest::node_group].
5319        ///
5320        /// This is a **required** field for requests.
5321        pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5322        where
5323            T: std::convert::Into<crate::model::NodeGroup>,
5324        {
5325            self.0.request.node_group = v.map(|x| x.into());
5326            self
5327        }
5328
5329        /// Sets the value of [node_group_id][crate::model::CreateNodeGroupRequest::node_group_id].
5330        pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5331            self.0.request.node_group_id = v.into();
5332            self
5333        }
5334
5335        /// Sets the value of [request_id][crate::model::CreateNodeGroupRequest::request_id].
5336        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5337            self.0.request.request_id = v.into();
5338            self
5339        }
5340    }
5341
5342    #[doc(hidden)]
5343    impl gax::options::internal::RequestBuilder for CreateNodeGroup {
5344        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5345            &mut self.0.options
5346        }
5347    }
5348
5349    /// The request builder for [NodeGroupController::resize_node_group][crate::client::NodeGroupController::resize_node_group] calls.
5350    ///
5351    /// # Example
5352    /// ```no_run
5353    /// # use google_cloud_dataproc_v1::builder;
5354    /// use builder::node_group_controller::ResizeNodeGroup;
5355    /// # tokio_test::block_on(async {
5356    /// use lro::Poller;
5357    ///
5358    /// let builder = prepare_request_builder();
5359    /// let response = builder.poller().until_done().await?;
5360    /// # gax::Result::<()>::Ok(()) });
5361    ///
5362    /// fn prepare_request_builder() -> ResizeNodeGroup {
5363    ///   # panic!();
5364    ///   // ... details omitted ...
5365    /// }
5366    /// ```
5367    #[derive(Clone, Debug)]
5368    pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5369
5370    impl ResizeNodeGroup {
5371        pub(crate) fn new(
5372            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5373        ) -> Self {
5374            Self(RequestBuilder::new(stub))
5375        }
5376
5377        /// Sets the full request, replacing any prior values.
5378        pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5379            self.0.request = v.into();
5380            self
5381        }
5382
5383        /// Sets all the options, replacing any prior values.
5384        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5385            self.0.options = v.into();
5386            self
5387        }
5388
5389        /// Sends the request.
5390        ///
5391        /// # Long running operations
5392        ///
5393        /// This starts, but does not poll, a longrunning operation. More information
5394        /// on [resize_node_group][crate::client::NodeGroupController::resize_node_group].
5395        pub async fn send(self) -> Result<longrunning::model::Operation> {
5396            (*self.0.stub)
5397                .resize_node_group(self.0.request, self.0.options)
5398                .await
5399                .map(gax::response::Response::into_body)
5400        }
5401
5402        /// Creates a [Poller][lro::Poller] to work with `resize_node_group`.
5403        pub fn poller(
5404            self,
5405        ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5406        {
5407            type Operation = lro::internal::Operation<
5408                crate::model::NodeGroup,
5409                crate::model::NodeGroupOperationMetadata,
5410            >;
5411            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5412            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5413
5414            let stub = self.0.stub.clone();
5415            let mut options = self.0.options.clone();
5416            options.set_retry_policy(gax::retry_policy::NeverRetry);
5417            let query = move |name| {
5418                let stub = stub.clone();
5419                let options = options.clone();
5420                async {
5421                    let op = GetOperation::new(stub)
5422                        .set_name(name)
5423                        .with_options(options)
5424                        .send()
5425                        .await?;
5426                    Ok(Operation::new(op))
5427                }
5428            };
5429
5430            let start = move || async {
5431                let op = self.send().await?;
5432                Ok(Operation::new(op))
5433            };
5434
5435            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5436        }
5437
5438        /// Sets the value of [name][crate::model::ResizeNodeGroupRequest::name].
5439        ///
5440        /// This is a **required** field for requests.
5441        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5442            self.0.request.name = v.into();
5443            self
5444        }
5445
5446        /// Sets the value of [size][crate::model::ResizeNodeGroupRequest::size].
5447        ///
5448        /// This is a **required** field for requests.
5449        pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5450            self.0.request.size = v.into();
5451            self
5452        }
5453
5454        /// Sets the value of [request_id][crate::model::ResizeNodeGroupRequest::request_id].
5455        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5456            self.0.request.request_id = v.into();
5457            self
5458        }
5459
5460        /// Sets the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
5461        pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5462        where
5463            T: std::convert::Into<wkt::Duration>,
5464        {
5465            self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5466            self
5467        }
5468
5469        /// Sets or clears the value of [graceful_decommission_timeout][crate::model::ResizeNodeGroupRequest::graceful_decommission_timeout].
5470        pub fn set_or_clear_graceful_decommission_timeout<T>(
5471            mut self,
5472            v: std::option::Option<T>,
5473        ) -> Self
5474        where
5475            T: std::convert::Into<wkt::Duration>,
5476        {
5477            self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5478            self
5479        }
5480    }
5481
5482    #[doc(hidden)]
5483    impl gax::options::internal::RequestBuilder for ResizeNodeGroup {
5484        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5485            &mut self.0.options
5486        }
5487    }
5488
5489    /// The request builder for [NodeGroupController::get_node_group][crate::client::NodeGroupController::get_node_group] calls.
5490    ///
5491    /// # Example
5492    /// ```no_run
5493    /// # use google_cloud_dataproc_v1::builder;
5494    /// use builder::node_group_controller::GetNodeGroup;
5495    /// # tokio_test::block_on(async {
5496    ///
5497    /// let builder = prepare_request_builder();
5498    /// let response = builder.send().await?;
5499    /// # gax::Result::<()>::Ok(()) });
5500    ///
5501    /// fn prepare_request_builder() -> GetNodeGroup {
5502    ///   # panic!();
5503    ///   // ... details omitted ...
5504    /// }
5505    /// ```
5506    #[derive(Clone, Debug)]
5507    pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5508
5509    impl GetNodeGroup {
5510        pub(crate) fn new(
5511            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5512        ) -> Self {
5513            Self(RequestBuilder::new(stub))
5514        }
5515
5516        /// Sets the full request, replacing any prior values.
5517        pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5518            self.0.request = v.into();
5519            self
5520        }
5521
5522        /// Sets all the options, replacing any prior values.
5523        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5524            self.0.options = v.into();
5525            self
5526        }
5527
5528        /// Sends the request.
5529        pub async fn send(self) -> Result<crate::model::NodeGroup> {
5530            (*self.0.stub)
5531                .get_node_group(self.0.request, self.0.options)
5532                .await
5533                .map(gax::response::Response::into_body)
5534        }
5535
5536        /// Sets the value of [name][crate::model::GetNodeGroupRequest::name].
5537        ///
5538        /// This is a **required** field for requests.
5539        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5540            self.0.request.name = v.into();
5541            self
5542        }
5543    }
5544
5545    #[doc(hidden)]
5546    impl gax::options::internal::RequestBuilder for GetNodeGroup {
5547        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5548            &mut self.0.options
5549        }
5550    }
5551
5552    /// The request builder for [NodeGroupController::set_iam_policy][crate::client::NodeGroupController::set_iam_policy] calls.
5553    ///
5554    /// # Example
5555    /// ```no_run
5556    /// # use google_cloud_dataproc_v1::builder;
5557    /// use builder::node_group_controller::SetIamPolicy;
5558    /// # tokio_test::block_on(async {
5559    ///
5560    /// let builder = prepare_request_builder();
5561    /// let response = builder.send().await?;
5562    /// # gax::Result::<()>::Ok(()) });
5563    ///
5564    /// fn prepare_request_builder() -> SetIamPolicy {
5565    ///   # panic!();
5566    ///   // ... details omitted ...
5567    /// }
5568    /// ```
5569    #[derive(Clone, Debug)]
5570    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5571
5572    impl SetIamPolicy {
5573        pub(crate) fn new(
5574            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5575        ) -> Self {
5576            Self(RequestBuilder::new(stub))
5577        }
5578
5579        /// Sets the full request, replacing any prior values.
5580        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5581            self.0.request = v.into();
5582            self
5583        }
5584
5585        /// Sets all the options, replacing any prior values.
5586        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5587            self.0.options = v.into();
5588            self
5589        }
5590
5591        /// Sends the request.
5592        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5593            (*self.0.stub)
5594                .set_iam_policy(self.0.request, self.0.options)
5595                .await
5596                .map(gax::response::Response::into_body)
5597        }
5598
5599        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
5600        ///
5601        /// This is a **required** field for requests.
5602        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5603            self.0.request.resource = v.into();
5604            self
5605        }
5606
5607        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5608        ///
5609        /// This is a **required** field for requests.
5610        pub fn set_policy<T>(mut self, v: T) -> Self
5611        where
5612            T: std::convert::Into<iam_v1::model::Policy>,
5613        {
5614            self.0.request.policy = std::option::Option::Some(v.into());
5615            self
5616        }
5617
5618        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5619        ///
5620        /// This is a **required** field for requests.
5621        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5622        where
5623            T: std::convert::Into<iam_v1::model::Policy>,
5624        {
5625            self.0.request.policy = v.map(|x| x.into());
5626            self
5627        }
5628
5629        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5630        pub fn set_update_mask<T>(mut self, v: T) -> Self
5631        where
5632            T: std::convert::Into<wkt::FieldMask>,
5633        {
5634            self.0.request.update_mask = std::option::Option::Some(v.into());
5635            self
5636        }
5637
5638        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5639        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5640        where
5641            T: std::convert::Into<wkt::FieldMask>,
5642        {
5643            self.0.request.update_mask = v.map(|x| x.into());
5644            self
5645        }
5646    }
5647
5648    #[doc(hidden)]
5649    impl gax::options::internal::RequestBuilder for SetIamPolicy {
5650        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5651            &mut self.0.options
5652        }
5653    }
5654
5655    /// The request builder for [NodeGroupController::get_iam_policy][crate::client::NodeGroupController::get_iam_policy] calls.
5656    ///
5657    /// # Example
5658    /// ```no_run
5659    /// # use google_cloud_dataproc_v1::builder;
5660    /// use builder::node_group_controller::GetIamPolicy;
5661    /// # tokio_test::block_on(async {
5662    ///
5663    /// let builder = prepare_request_builder();
5664    /// let response = builder.send().await?;
5665    /// # gax::Result::<()>::Ok(()) });
5666    ///
5667    /// fn prepare_request_builder() -> GetIamPolicy {
5668    ///   # panic!();
5669    ///   // ... details omitted ...
5670    /// }
5671    /// ```
5672    #[derive(Clone, Debug)]
5673    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5674
5675    impl GetIamPolicy {
5676        pub(crate) fn new(
5677            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5678        ) -> Self {
5679            Self(RequestBuilder::new(stub))
5680        }
5681
5682        /// Sets the full request, replacing any prior values.
5683        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5684            self.0.request = v.into();
5685            self
5686        }
5687
5688        /// Sets all the options, replacing any prior values.
5689        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5690            self.0.options = v.into();
5691            self
5692        }
5693
5694        /// Sends the request.
5695        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5696            (*self.0.stub)
5697                .get_iam_policy(self.0.request, self.0.options)
5698                .await
5699                .map(gax::response::Response::into_body)
5700        }
5701
5702        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
5703        ///
5704        /// This is a **required** field for requests.
5705        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5706            self.0.request.resource = v.into();
5707            self
5708        }
5709
5710        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5711        pub fn set_options<T>(mut self, v: T) -> Self
5712        where
5713            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5714        {
5715            self.0.request.options = std::option::Option::Some(v.into());
5716            self
5717        }
5718
5719        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5720        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5721        where
5722            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5723        {
5724            self.0.request.options = v.map(|x| x.into());
5725            self
5726        }
5727    }
5728
5729    #[doc(hidden)]
5730    impl gax::options::internal::RequestBuilder for GetIamPolicy {
5731        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5732            &mut self.0.options
5733        }
5734    }
5735
5736    /// The request builder for [NodeGroupController::test_iam_permissions][crate::client::NodeGroupController::test_iam_permissions] calls.
5737    ///
5738    /// # Example
5739    /// ```no_run
5740    /// # use google_cloud_dataproc_v1::builder;
5741    /// use builder::node_group_controller::TestIamPermissions;
5742    /// # tokio_test::block_on(async {
5743    ///
5744    /// let builder = prepare_request_builder();
5745    /// let response = builder.send().await?;
5746    /// # gax::Result::<()>::Ok(()) });
5747    ///
5748    /// fn prepare_request_builder() -> TestIamPermissions {
5749    ///   # panic!();
5750    ///   // ... details omitted ...
5751    /// }
5752    /// ```
5753    #[derive(Clone, Debug)]
5754    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5755
5756    impl TestIamPermissions {
5757        pub(crate) fn new(
5758            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5759        ) -> Self {
5760            Self(RequestBuilder::new(stub))
5761        }
5762
5763        /// Sets the full request, replacing any prior values.
5764        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5765            mut self,
5766            v: V,
5767        ) -> Self {
5768            self.0.request = v.into();
5769            self
5770        }
5771
5772        /// Sets all the options, replacing any prior values.
5773        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5774            self.0.options = v.into();
5775            self
5776        }
5777
5778        /// Sends the request.
5779        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5780            (*self.0.stub)
5781                .test_iam_permissions(self.0.request, self.0.options)
5782                .await
5783                .map(gax::response::Response::into_body)
5784        }
5785
5786        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
5787        ///
5788        /// This is a **required** field for requests.
5789        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5790            self.0.request.resource = v.into();
5791            self
5792        }
5793
5794        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
5795        ///
5796        /// This is a **required** field for requests.
5797        pub fn set_permissions<T, V>(mut self, v: T) -> Self
5798        where
5799            T: std::iter::IntoIterator<Item = V>,
5800            V: std::convert::Into<std::string::String>,
5801        {
5802            use std::iter::Iterator;
5803            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5804            self
5805        }
5806    }
5807
5808    #[doc(hidden)]
5809    impl gax::options::internal::RequestBuilder for TestIamPermissions {
5810        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5811            &mut self.0.options
5812        }
5813    }
5814
5815    /// The request builder for [NodeGroupController::list_operations][crate::client::NodeGroupController::list_operations] calls.
5816    ///
5817    /// # Example
5818    /// ```no_run
5819    /// # use google_cloud_dataproc_v1::builder;
5820    /// use builder::node_group_controller::ListOperations;
5821    /// # tokio_test::block_on(async {
5822    /// use gax::paginator::ItemPaginator;
5823    ///
5824    /// let builder = prepare_request_builder();
5825    /// let mut items = builder.by_item();
5826    /// while let Some(result) = items.next().await {
5827    ///   let item = result?;
5828    /// }
5829    /// # gax::Result::<()>::Ok(()) });
5830    ///
5831    /// fn prepare_request_builder() -> ListOperations {
5832    ///   # panic!();
5833    ///   // ... details omitted ...
5834    /// }
5835    /// ```
5836    #[derive(Clone, Debug)]
5837    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5838
5839    impl ListOperations {
5840        pub(crate) fn new(
5841            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5842        ) -> Self {
5843            Self(RequestBuilder::new(stub))
5844        }
5845
5846        /// Sets the full request, replacing any prior values.
5847        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5848            mut self,
5849            v: V,
5850        ) -> Self {
5851            self.0.request = v.into();
5852            self
5853        }
5854
5855        /// Sets all the options, replacing any prior values.
5856        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5857            self.0.options = v.into();
5858            self
5859        }
5860
5861        /// Sends the request.
5862        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5863            (*self.0.stub)
5864                .list_operations(self.0.request, self.0.options)
5865                .await
5866                .map(gax::response::Response::into_body)
5867        }
5868
5869        /// Streams each page in the collection.
5870        pub fn by_page(
5871            self,
5872        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5873        {
5874            use std::clone::Clone;
5875            let token = self.0.request.page_token.clone();
5876            let execute = move |token: String| {
5877                let mut builder = self.clone();
5878                builder.0.request = builder.0.request.set_page_token(token);
5879                builder.send()
5880            };
5881            gax::paginator::internal::new_paginator(token, execute)
5882        }
5883
5884        /// Streams each item in the collection.
5885        pub fn by_item(
5886            self,
5887        ) -> impl gax::paginator::ItemPaginator<
5888            longrunning::model::ListOperationsResponse,
5889            gax::error::Error,
5890        > {
5891            use gax::paginator::Paginator;
5892            self.by_page().items()
5893        }
5894
5895        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
5896        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5897            self.0.request.name = v.into();
5898            self
5899        }
5900
5901        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
5902        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5903            self.0.request.filter = v.into();
5904            self
5905        }
5906
5907        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
5908        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5909            self.0.request.page_size = v.into();
5910            self
5911        }
5912
5913        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
5914        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5915            self.0.request.page_token = v.into();
5916            self
5917        }
5918    }
5919
5920    #[doc(hidden)]
5921    impl gax::options::internal::RequestBuilder for ListOperations {
5922        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5923            &mut self.0.options
5924        }
5925    }
5926
5927    /// The request builder for [NodeGroupController::get_operation][crate::client::NodeGroupController::get_operation] calls.
5928    ///
5929    /// # Example
5930    /// ```no_run
5931    /// # use google_cloud_dataproc_v1::builder;
5932    /// use builder::node_group_controller::GetOperation;
5933    /// # tokio_test::block_on(async {
5934    ///
5935    /// let builder = prepare_request_builder();
5936    /// let response = builder.send().await?;
5937    /// # gax::Result::<()>::Ok(()) });
5938    ///
5939    /// fn prepare_request_builder() -> GetOperation {
5940    ///   # panic!();
5941    ///   // ... details omitted ...
5942    /// }
5943    /// ```
5944    #[derive(Clone, Debug)]
5945    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5946
5947    impl GetOperation {
5948        pub(crate) fn new(
5949            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5950        ) -> Self {
5951            Self(RequestBuilder::new(stub))
5952        }
5953
5954        /// Sets the full request, replacing any prior values.
5955        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5956            mut self,
5957            v: V,
5958        ) -> Self {
5959            self.0.request = v.into();
5960            self
5961        }
5962
5963        /// Sets all the options, replacing any prior values.
5964        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5965            self.0.options = v.into();
5966            self
5967        }
5968
5969        /// Sends the request.
5970        pub async fn send(self) -> Result<longrunning::model::Operation> {
5971            (*self.0.stub)
5972                .get_operation(self.0.request, self.0.options)
5973                .await
5974                .map(gax::response::Response::into_body)
5975        }
5976
5977        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
5978        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5979            self.0.request.name = v.into();
5980            self
5981        }
5982    }
5983
5984    #[doc(hidden)]
5985    impl gax::options::internal::RequestBuilder for GetOperation {
5986        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5987            &mut self.0.options
5988        }
5989    }
5990
5991    /// The request builder for [NodeGroupController::delete_operation][crate::client::NodeGroupController::delete_operation] calls.
5992    ///
5993    /// # Example
5994    /// ```no_run
5995    /// # use google_cloud_dataproc_v1::builder;
5996    /// use builder::node_group_controller::DeleteOperation;
5997    /// # tokio_test::block_on(async {
5998    ///
5999    /// let builder = prepare_request_builder();
6000    /// let response = builder.send().await?;
6001    /// # gax::Result::<()>::Ok(()) });
6002    ///
6003    /// fn prepare_request_builder() -> DeleteOperation {
6004    ///   # panic!();
6005    ///   // ... details omitted ...
6006    /// }
6007    /// ```
6008    #[derive(Clone, Debug)]
6009    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6010
6011    impl DeleteOperation {
6012        pub(crate) fn new(
6013            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6014        ) -> Self {
6015            Self(RequestBuilder::new(stub))
6016        }
6017
6018        /// Sets the full request, replacing any prior values.
6019        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6020            mut self,
6021            v: V,
6022        ) -> Self {
6023            self.0.request = v.into();
6024            self
6025        }
6026
6027        /// Sets all the options, replacing any prior values.
6028        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6029            self.0.options = v.into();
6030            self
6031        }
6032
6033        /// Sends the request.
6034        pub async fn send(self) -> Result<()> {
6035            (*self.0.stub)
6036                .delete_operation(self.0.request, self.0.options)
6037                .await
6038                .map(gax::response::Response::into_body)
6039        }
6040
6041        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
6042        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6043            self.0.request.name = v.into();
6044            self
6045        }
6046    }
6047
6048    #[doc(hidden)]
6049    impl gax::options::internal::RequestBuilder for DeleteOperation {
6050        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6051            &mut self.0.options
6052        }
6053    }
6054
6055    /// The request builder for [NodeGroupController::cancel_operation][crate::client::NodeGroupController::cancel_operation] calls.
6056    ///
6057    /// # Example
6058    /// ```no_run
6059    /// # use google_cloud_dataproc_v1::builder;
6060    /// use builder::node_group_controller::CancelOperation;
6061    /// # tokio_test::block_on(async {
6062    ///
6063    /// let builder = prepare_request_builder();
6064    /// let response = builder.send().await?;
6065    /// # gax::Result::<()>::Ok(()) });
6066    ///
6067    /// fn prepare_request_builder() -> CancelOperation {
6068    ///   # panic!();
6069    ///   // ... details omitted ...
6070    /// }
6071    /// ```
6072    #[derive(Clone, Debug)]
6073    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6074
6075    impl CancelOperation {
6076        pub(crate) fn new(
6077            stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6078        ) -> Self {
6079            Self(RequestBuilder::new(stub))
6080        }
6081
6082        /// Sets the full request, replacing any prior values.
6083        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6084            mut self,
6085            v: V,
6086        ) -> Self {
6087            self.0.request = v.into();
6088            self
6089        }
6090
6091        /// Sets all the options, replacing any prior values.
6092        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6093            self.0.options = v.into();
6094            self
6095        }
6096
6097        /// Sends the request.
6098        pub async fn send(self) -> Result<()> {
6099            (*self.0.stub)
6100                .cancel_operation(self.0.request, self.0.options)
6101                .await
6102                .map(gax::response::Response::into_body)
6103        }
6104
6105        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
6106        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6107            self.0.request.name = v.into();
6108            self
6109        }
6110    }
6111
6112    #[doc(hidden)]
6113    impl gax::options::internal::RequestBuilder for CancelOperation {
6114        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6115            &mut self.0.options
6116        }
6117    }
6118}
6119
6120pub mod session_template_controller {
6121    use crate::Result;
6122
6123    /// A builder for [SessionTemplateController][crate::client::SessionTemplateController].
6124    ///
6125    /// ```
6126    /// # tokio_test::block_on(async {
6127    /// # use google_cloud_dataproc_v1::*;
6128    /// # use builder::session_template_controller::ClientBuilder;
6129    /// # use client::SessionTemplateController;
6130    /// let builder : ClientBuilder = SessionTemplateController::builder();
6131    /// let client = builder
6132    ///     .with_endpoint("https://dataproc.googleapis.com")
6133    ///     .build().await?;
6134    /// # gax::client_builder::Result::<()>::Ok(()) });
6135    /// ```
6136    pub type ClientBuilder =
6137        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6138
6139    pub(crate) mod client {
6140        use super::super::super::client::SessionTemplateController;
6141        pub struct Factory;
6142        impl gax::client_builder::internal::ClientFactory for Factory {
6143            type Client = SessionTemplateController;
6144            type Credentials = gaxi::options::Credentials;
6145            async fn build(
6146                self,
6147                config: gaxi::options::ClientConfig,
6148            ) -> gax::client_builder::Result<Self::Client> {
6149                Self::Client::new(config).await
6150            }
6151        }
6152    }
6153
6154    /// Common implementation for [crate::client::SessionTemplateController] request builders.
6155    #[derive(Clone, Debug)]
6156    pub(crate) struct RequestBuilder<R: std::default::Default> {
6157        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6158        request: R,
6159        options: gax::options::RequestOptions,
6160    }
6161
6162    impl<R> RequestBuilder<R>
6163    where
6164        R: std::default::Default,
6165    {
6166        pub(crate) fn new(
6167            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6168        ) -> Self {
6169            Self {
6170                stub,
6171                request: R::default(),
6172                options: gax::options::RequestOptions::default(),
6173            }
6174        }
6175    }
6176
6177    /// The request builder for [SessionTemplateController::create_session_template][crate::client::SessionTemplateController::create_session_template] calls.
6178    ///
6179    /// # Example
6180    /// ```no_run
6181    /// # use google_cloud_dataproc_v1::builder;
6182    /// use builder::session_template_controller::CreateSessionTemplate;
6183    /// # tokio_test::block_on(async {
6184    ///
6185    /// let builder = prepare_request_builder();
6186    /// let response = builder.send().await?;
6187    /// # gax::Result::<()>::Ok(()) });
6188    ///
6189    /// fn prepare_request_builder() -> CreateSessionTemplate {
6190    ///   # panic!();
6191    ///   // ... details omitted ...
6192    /// }
6193    /// ```
6194    #[derive(Clone, Debug)]
6195    pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6196
6197    impl CreateSessionTemplate {
6198        pub(crate) fn new(
6199            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6200        ) -> Self {
6201            Self(RequestBuilder::new(stub))
6202        }
6203
6204        /// Sets the full request, replacing any prior values.
6205        pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6206            mut self,
6207            v: V,
6208        ) -> Self {
6209            self.0.request = v.into();
6210            self
6211        }
6212
6213        /// Sets all the options, replacing any prior values.
6214        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6215            self.0.options = v.into();
6216            self
6217        }
6218
6219        /// Sends the request.
6220        pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6221            (*self.0.stub)
6222                .create_session_template(self.0.request, self.0.options)
6223                .await
6224                .map(gax::response::Response::into_body)
6225        }
6226
6227        /// Sets the value of [parent][crate::model::CreateSessionTemplateRequest::parent].
6228        ///
6229        /// This is a **required** field for requests.
6230        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6231            self.0.request.parent = v.into();
6232            self
6233        }
6234
6235        /// Sets the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
6236        ///
6237        /// This is a **required** field for requests.
6238        pub fn set_session_template<T>(mut self, v: T) -> Self
6239        where
6240            T: std::convert::Into<crate::model::SessionTemplate>,
6241        {
6242            self.0.request.session_template = std::option::Option::Some(v.into());
6243            self
6244        }
6245
6246        /// Sets or clears the value of [session_template][crate::model::CreateSessionTemplateRequest::session_template].
6247        ///
6248        /// This is a **required** field for requests.
6249        pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6250        where
6251            T: std::convert::Into<crate::model::SessionTemplate>,
6252        {
6253            self.0.request.session_template = v.map(|x| x.into());
6254            self
6255        }
6256    }
6257
6258    #[doc(hidden)]
6259    impl gax::options::internal::RequestBuilder for CreateSessionTemplate {
6260        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6261            &mut self.0.options
6262        }
6263    }
6264
6265    /// The request builder for [SessionTemplateController::update_session_template][crate::client::SessionTemplateController::update_session_template] calls.
6266    ///
6267    /// # Example
6268    /// ```no_run
6269    /// # use google_cloud_dataproc_v1::builder;
6270    /// use builder::session_template_controller::UpdateSessionTemplate;
6271    /// # tokio_test::block_on(async {
6272    ///
6273    /// let builder = prepare_request_builder();
6274    /// let response = builder.send().await?;
6275    /// # gax::Result::<()>::Ok(()) });
6276    ///
6277    /// fn prepare_request_builder() -> UpdateSessionTemplate {
6278    ///   # panic!();
6279    ///   // ... details omitted ...
6280    /// }
6281    /// ```
6282    #[derive(Clone, Debug)]
6283    pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6284
6285    impl UpdateSessionTemplate {
6286        pub(crate) fn new(
6287            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6288        ) -> Self {
6289            Self(RequestBuilder::new(stub))
6290        }
6291
6292        /// Sets the full request, replacing any prior values.
6293        pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6294            mut self,
6295            v: V,
6296        ) -> Self {
6297            self.0.request = v.into();
6298            self
6299        }
6300
6301        /// Sets all the options, replacing any prior values.
6302        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6303            self.0.options = v.into();
6304            self
6305        }
6306
6307        /// Sends the request.
6308        pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6309            (*self.0.stub)
6310                .update_session_template(self.0.request, self.0.options)
6311                .await
6312                .map(gax::response::Response::into_body)
6313        }
6314
6315        /// Sets the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
6316        ///
6317        /// This is a **required** field for requests.
6318        pub fn set_session_template<T>(mut self, v: T) -> Self
6319        where
6320            T: std::convert::Into<crate::model::SessionTemplate>,
6321        {
6322            self.0.request.session_template = std::option::Option::Some(v.into());
6323            self
6324        }
6325
6326        /// Sets or clears the value of [session_template][crate::model::UpdateSessionTemplateRequest::session_template].
6327        ///
6328        /// This is a **required** field for requests.
6329        pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6330        where
6331            T: std::convert::Into<crate::model::SessionTemplate>,
6332        {
6333            self.0.request.session_template = v.map(|x| x.into());
6334            self
6335        }
6336    }
6337
6338    #[doc(hidden)]
6339    impl gax::options::internal::RequestBuilder for UpdateSessionTemplate {
6340        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6341            &mut self.0.options
6342        }
6343    }
6344
6345    /// The request builder for [SessionTemplateController::get_session_template][crate::client::SessionTemplateController::get_session_template] calls.
6346    ///
6347    /// # Example
6348    /// ```no_run
6349    /// # use google_cloud_dataproc_v1::builder;
6350    /// use builder::session_template_controller::GetSessionTemplate;
6351    /// # tokio_test::block_on(async {
6352    ///
6353    /// let builder = prepare_request_builder();
6354    /// let response = builder.send().await?;
6355    /// # gax::Result::<()>::Ok(()) });
6356    ///
6357    /// fn prepare_request_builder() -> GetSessionTemplate {
6358    ///   # panic!();
6359    ///   // ... details omitted ...
6360    /// }
6361    /// ```
6362    #[derive(Clone, Debug)]
6363    pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6364
6365    impl GetSessionTemplate {
6366        pub(crate) fn new(
6367            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6368        ) -> Self {
6369            Self(RequestBuilder::new(stub))
6370        }
6371
6372        /// Sets the full request, replacing any prior values.
6373        pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6374            mut self,
6375            v: V,
6376        ) -> Self {
6377            self.0.request = v.into();
6378            self
6379        }
6380
6381        /// Sets all the options, replacing any prior values.
6382        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6383            self.0.options = v.into();
6384            self
6385        }
6386
6387        /// Sends the request.
6388        pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6389            (*self.0.stub)
6390                .get_session_template(self.0.request, self.0.options)
6391                .await
6392                .map(gax::response::Response::into_body)
6393        }
6394
6395        /// Sets the value of [name][crate::model::GetSessionTemplateRequest::name].
6396        ///
6397        /// This is a **required** field for requests.
6398        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6399            self.0.request.name = v.into();
6400            self
6401        }
6402    }
6403
6404    #[doc(hidden)]
6405    impl gax::options::internal::RequestBuilder for GetSessionTemplate {
6406        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6407            &mut self.0.options
6408        }
6409    }
6410
6411    /// The request builder for [SessionTemplateController::list_session_templates][crate::client::SessionTemplateController::list_session_templates] calls.
6412    ///
6413    /// # Example
6414    /// ```no_run
6415    /// # use google_cloud_dataproc_v1::builder;
6416    /// use builder::session_template_controller::ListSessionTemplates;
6417    /// # tokio_test::block_on(async {
6418    /// use gax::paginator::ItemPaginator;
6419    ///
6420    /// let builder = prepare_request_builder();
6421    /// let mut items = builder.by_item();
6422    /// while let Some(result) = items.next().await {
6423    ///   let item = result?;
6424    /// }
6425    /// # gax::Result::<()>::Ok(()) });
6426    ///
6427    /// fn prepare_request_builder() -> ListSessionTemplates {
6428    ///   # panic!();
6429    ///   // ... details omitted ...
6430    /// }
6431    /// ```
6432    #[derive(Clone, Debug)]
6433    pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6434
6435    impl ListSessionTemplates {
6436        pub(crate) fn new(
6437            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6438        ) -> Self {
6439            Self(RequestBuilder::new(stub))
6440        }
6441
6442        /// Sets the full request, replacing any prior values.
6443        pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6444            mut self,
6445            v: V,
6446        ) -> Self {
6447            self.0.request = v.into();
6448            self
6449        }
6450
6451        /// Sets all the options, replacing any prior values.
6452        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6453            self.0.options = v.into();
6454            self
6455        }
6456
6457        /// Sends the request.
6458        pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6459            (*self.0.stub)
6460                .list_session_templates(self.0.request, self.0.options)
6461                .await
6462                .map(gax::response::Response::into_body)
6463        }
6464
6465        /// Streams each page in the collection.
6466        pub fn by_page(
6467            self,
6468        ) -> impl gax::paginator::Paginator<crate::model::ListSessionTemplatesResponse, gax::error::Error>
6469        {
6470            use std::clone::Clone;
6471            let token = self.0.request.page_token.clone();
6472            let execute = move |token: String| {
6473                let mut builder = self.clone();
6474                builder.0.request = builder.0.request.set_page_token(token);
6475                builder.send()
6476            };
6477            gax::paginator::internal::new_paginator(token, execute)
6478        }
6479
6480        /// Streams each item in the collection.
6481        pub fn by_item(
6482            self,
6483        ) -> impl gax::paginator::ItemPaginator<
6484            crate::model::ListSessionTemplatesResponse,
6485            gax::error::Error,
6486        > {
6487            use gax::paginator::Paginator;
6488            self.by_page().items()
6489        }
6490
6491        /// Sets the value of [parent][crate::model::ListSessionTemplatesRequest::parent].
6492        ///
6493        /// This is a **required** field for requests.
6494        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6495            self.0.request.parent = v.into();
6496            self
6497        }
6498
6499        /// Sets the value of [page_size][crate::model::ListSessionTemplatesRequest::page_size].
6500        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6501            self.0.request.page_size = v.into();
6502            self
6503        }
6504
6505        /// Sets the value of [page_token][crate::model::ListSessionTemplatesRequest::page_token].
6506        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6507            self.0.request.page_token = v.into();
6508            self
6509        }
6510
6511        /// Sets the value of [filter][crate::model::ListSessionTemplatesRequest::filter].
6512        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6513            self.0.request.filter = v.into();
6514            self
6515        }
6516    }
6517
6518    #[doc(hidden)]
6519    impl gax::options::internal::RequestBuilder for ListSessionTemplates {
6520        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6521            &mut self.0.options
6522        }
6523    }
6524
6525    /// The request builder for [SessionTemplateController::delete_session_template][crate::client::SessionTemplateController::delete_session_template] calls.
6526    ///
6527    /// # Example
6528    /// ```no_run
6529    /// # use google_cloud_dataproc_v1::builder;
6530    /// use builder::session_template_controller::DeleteSessionTemplate;
6531    /// # tokio_test::block_on(async {
6532    ///
6533    /// let builder = prepare_request_builder();
6534    /// let response = builder.send().await?;
6535    /// # gax::Result::<()>::Ok(()) });
6536    ///
6537    /// fn prepare_request_builder() -> DeleteSessionTemplate {
6538    ///   # panic!();
6539    ///   // ... details omitted ...
6540    /// }
6541    /// ```
6542    #[derive(Clone, Debug)]
6543    pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6544
6545    impl DeleteSessionTemplate {
6546        pub(crate) fn new(
6547            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6548        ) -> Self {
6549            Self(RequestBuilder::new(stub))
6550        }
6551
6552        /// Sets the full request, replacing any prior values.
6553        pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6554            mut self,
6555            v: V,
6556        ) -> Self {
6557            self.0.request = v.into();
6558            self
6559        }
6560
6561        /// Sets all the options, replacing any prior values.
6562        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6563            self.0.options = v.into();
6564            self
6565        }
6566
6567        /// Sends the request.
6568        pub async fn send(self) -> Result<()> {
6569            (*self.0.stub)
6570                .delete_session_template(self.0.request, self.0.options)
6571                .await
6572                .map(gax::response::Response::into_body)
6573        }
6574
6575        /// Sets the value of [name][crate::model::DeleteSessionTemplateRequest::name].
6576        ///
6577        /// This is a **required** field for requests.
6578        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6579            self.0.request.name = v.into();
6580            self
6581        }
6582    }
6583
6584    #[doc(hidden)]
6585    impl gax::options::internal::RequestBuilder for DeleteSessionTemplate {
6586        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6587            &mut self.0.options
6588        }
6589    }
6590
6591    /// The request builder for [SessionTemplateController::set_iam_policy][crate::client::SessionTemplateController::set_iam_policy] calls.
6592    ///
6593    /// # Example
6594    /// ```no_run
6595    /// # use google_cloud_dataproc_v1::builder;
6596    /// use builder::session_template_controller::SetIamPolicy;
6597    /// # tokio_test::block_on(async {
6598    ///
6599    /// let builder = prepare_request_builder();
6600    /// let response = builder.send().await?;
6601    /// # gax::Result::<()>::Ok(()) });
6602    ///
6603    /// fn prepare_request_builder() -> SetIamPolicy {
6604    ///   # panic!();
6605    ///   // ... details omitted ...
6606    /// }
6607    /// ```
6608    #[derive(Clone, Debug)]
6609    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6610
6611    impl SetIamPolicy {
6612        pub(crate) fn new(
6613            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6614        ) -> Self {
6615            Self(RequestBuilder::new(stub))
6616        }
6617
6618        /// Sets the full request, replacing any prior values.
6619        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6620            self.0.request = v.into();
6621            self
6622        }
6623
6624        /// Sets all the options, replacing any prior values.
6625        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6626            self.0.options = v.into();
6627            self
6628        }
6629
6630        /// Sends the request.
6631        pub async fn send(self) -> Result<iam_v1::model::Policy> {
6632            (*self.0.stub)
6633                .set_iam_policy(self.0.request, self.0.options)
6634                .await
6635                .map(gax::response::Response::into_body)
6636        }
6637
6638        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
6639        ///
6640        /// This is a **required** field for requests.
6641        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6642            self.0.request.resource = v.into();
6643            self
6644        }
6645
6646        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
6647        ///
6648        /// This is a **required** field for requests.
6649        pub fn set_policy<T>(mut self, v: T) -> Self
6650        where
6651            T: std::convert::Into<iam_v1::model::Policy>,
6652        {
6653            self.0.request.policy = std::option::Option::Some(v.into());
6654            self
6655        }
6656
6657        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
6658        ///
6659        /// This is a **required** field for requests.
6660        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6661        where
6662            T: std::convert::Into<iam_v1::model::Policy>,
6663        {
6664            self.0.request.policy = v.map(|x| x.into());
6665            self
6666        }
6667
6668        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
6669        pub fn set_update_mask<T>(mut self, v: T) -> Self
6670        where
6671            T: std::convert::Into<wkt::FieldMask>,
6672        {
6673            self.0.request.update_mask = std::option::Option::Some(v.into());
6674            self
6675        }
6676
6677        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
6678        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6679        where
6680            T: std::convert::Into<wkt::FieldMask>,
6681        {
6682            self.0.request.update_mask = v.map(|x| x.into());
6683            self
6684        }
6685    }
6686
6687    #[doc(hidden)]
6688    impl gax::options::internal::RequestBuilder for SetIamPolicy {
6689        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6690            &mut self.0.options
6691        }
6692    }
6693
6694    /// The request builder for [SessionTemplateController::get_iam_policy][crate::client::SessionTemplateController::get_iam_policy] calls.
6695    ///
6696    /// # Example
6697    /// ```no_run
6698    /// # use google_cloud_dataproc_v1::builder;
6699    /// use builder::session_template_controller::GetIamPolicy;
6700    /// # tokio_test::block_on(async {
6701    ///
6702    /// let builder = prepare_request_builder();
6703    /// let response = builder.send().await?;
6704    /// # gax::Result::<()>::Ok(()) });
6705    ///
6706    /// fn prepare_request_builder() -> GetIamPolicy {
6707    ///   # panic!();
6708    ///   // ... details omitted ...
6709    /// }
6710    /// ```
6711    #[derive(Clone, Debug)]
6712    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6713
6714    impl GetIamPolicy {
6715        pub(crate) fn new(
6716            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6717        ) -> Self {
6718            Self(RequestBuilder::new(stub))
6719        }
6720
6721        /// Sets the full request, replacing any prior values.
6722        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6723            self.0.request = v.into();
6724            self
6725        }
6726
6727        /// Sets all the options, replacing any prior values.
6728        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6729            self.0.options = v.into();
6730            self
6731        }
6732
6733        /// Sends the request.
6734        pub async fn send(self) -> Result<iam_v1::model::Policy> {
6735            (*self.0.stub)
6736                .get_iam_policy(self.0.request, self.0.options)
6737                .await
6738                .map(gax::response::Response::into_body)
6739        }
6740
6741        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
6742        ///
6743        /// This is a **required** field for requests.
6744        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6745            self.0.request.resource = v.into();
6746            self
6747        }
6748
6749        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
6750        pub fn set_options<T>(mut self, v: T) -> Self
6751        where
6752            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6753        {
6754            self.0.request.options = std::option::Option::Some(v.into());
6755            self
6756        }
6757
6758        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
6759        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6760        where
6761            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6762        {
6763            self.0.request.options = v.map(|x| x.into());
6764            self
6765        }
6766    }
6767
6768    #[doc(hidden)]
6769    impl gax::options::internal::RequestBuilder for GetIamPolicy {
6770        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6771            &mut self.0.options
6772        }
6773    }
6774
6775    /// The request builder for [SessionTemplateController::test_iam_permissions][crate::client::SessionTemplateController::test_iam_permissions] calls.
6776    ///
6777    /// # Example
6778    /// ```no_run
6779    /// # use google_cloud_dataproc_v1::builder;
6780    /// use builder::session_template_controller::TestIamPermissions;
6781    /// # tokio_test::block_on(async {
6782    ///
6783    /// let builder = prepare_request_builder();
6784    /// let response = builder.send().await?;
6785    /// # gax::Result::<()>::Ok(()) });
6786    ///
6787    /// fn prepare_request_builder() -> TestIamPermissions {
6788    ///   # panic!();
6789    ///   // ... details omitted ...
6790    /// }
6791    /// ```
6792    #[derive(Clone, Debug)]
6793    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6794
6795    impl TestIamPermissions {
6796        pub(crate) fn new(
6797            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6798        ) -> Self {
6799            Self(RequestBuilder::new(stub))
6800        }
6801
6802        /// Sets the full request, replacing any prior values.
6803        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6804            mut self,
6805            v: V,
6806        ) -> Self {
6807            self.0.request = v.into();
6808            self
6809        }
6810
6811        /// Sets all the options, replacing any prior values.
6812        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6813            self.0.options = v.into();
6814            self
6815        }
6816
6817        /// Sends the request.
6818        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6819            (*self.0.stub)
6820                .test_iam_permissions(self.0.request, self.0.options)
6821                .await
6822                .map(gax::response::Response::into_body)
6823        }
6824
6825        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
6826        ///
6827        /// This is a **required** field for requests.
6828        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6829            self.0.request.resource = v.into();
6830            self
6831        }
6832
6833        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
6834        ///
6835        /// This is a **required** field for requests.
6836        pub fn set_permissions<T, V>(mut self, v: T) -> Self
6837        where
6838            T: std::iter::IntoIterator<Item = V>,
6839            V: std::convert::Into<std::string::String>,
6840        {
6841            use std::iter::Iterator;
6842            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6843            self
6844        }
6845    }
6846
6847    #[doc(hidden)]
6848    impl gax::options::internal::RequestBuilder for TestIamPermissions {
6849        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6850            &mut self.0.options
6851        }
6852    }
6853
6854    /// The request builder for [SessionTemplateController::list_operations][crate::client::SessionTemplateController::list_operations] calls.
6855    ///
6856    /// # Example
6857    /// ```no_run
6858    /// # use google_cloud_dataproc_v1::builder;
6859    /// use builder::session_template_controller::ListOperations;
6860    /// # tokio_test::block_on(async {
6861    /// use gax::paginator::ItemPaginator;
6862    ///
6863    /// let builder = prepare_request_builder();
6864    /// let mut items = builder.by_item();
6865    /// while let Some(result) = items.next().await {
6866    ///   let item = result?;
6867    /// }
6868    /// # gax::Result::<()>::Ok(()) });
6869    ///
6870    /// fn prepare_request_builder() -> ListOperations {
6871    ///   # panic!();
6872    ///   // ... details omitted ...
6873    /// }
6874    /// ```
6875    #[derive(Clone, Debug)]
6876    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6877
6878    impl ListOperations {
6879        pub(crate) fn new(
6880            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6881        ) -> Self {
6882            Self(RequestBuilder::new(stub))
6883        }
6884
6885        /// Sets the full request, replacing any prior values.
6886        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6887            mut self,
6888            v: V,
6889        ) -> Self {
6890            self.0.request = v.into();
6891            self
6892        }
6893
6894        /// Sets all the options, replacing any prior values.
6895        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6896            self.0.options = v.into();
6897            self
6898        }
6899
6900        /// Sends the request.
6901        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6902            (*self.0.stub)
6903                .list_operations(self.0.request, self.0.options)
6904                .await
6905                .map(gax::response::Response::into_body)
6906        }
6907
6908        /// Streams each page in the collection.
6909        pub fn by_page(
6910            self,
6911        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6912        {
6913            use std::clone::Clone;
6914            let token = self.0.request.page_token.clone();
6915            let execute = move |token: String| {
6916                let mut builder = self.clone();
6917                builder.0.request = builder.0.request.set_page_token(token);
6918                builder.send()
6919            };
6920            gax::paginator::internal::new_paginator(token, execute)
6921        }
6922
6923        /// Streams each item in the collection.
6924        pub fn by_item(
6925            self,
6926        ) -> impl gax::paginator::ItemPaginator<
6927            longrunning::model::ListOperationsResponse,
6928            gax::error::Error,
6929        > {
6930            use gax::paginator::Paginator;
6931            self.by_page().items()
6932        }
6933
6934        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6935        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6936            self.0.request.name = v.into();
6937            self
6938        }
6939
6940        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6941        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6942            self.0.request.filter = v.into();
6943            self
6944        }
6945
6946        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6947        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6948            self.0.request.page_size = v.into();
6949            self
6950        }
6951
6952        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6953        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6954            self.0.request.page_token = v.into();
6955            self
6956        }
6957    }
6958
6959    #[doc(hidden)]
6960    impl gax::options::internal::RequestBuilder for ListOperations {
6961        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6962            &mut self.0.options
6963        }
6964    }
6965
6966    /// The request builder for [SessionTemplateController::get_operation][crate::client::SessionTemplateController::get_operation] calls.
6967    ///
6968    /// # Example
6969    /// ```no_run
6970    /// # use google_cloud_dataproc_v1::builder;
6971    /// use builder::session_template_controller::GetOperation;
6972    /// # tokio_test::block_on(async {
6973    ///
6974    /// let builder = prepare_request_builder();
6975    /// let response = builder.send().await?;
6976    /// # gax::Result::<()>::Ok(()) });
6977    ///
6978    /// fn prepare_request_builder() -> GetOperation {
6979    ///   # panic!();
6980    ///   // ... details omitted ...
6981    /// }
6982    /// ```
6983    #[derive(Clone, Debug)]
6984    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6985
6986    impl GetOperation {
6987        pub(crate) fn new(
6988            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6989        ) -> Self {
6990            Self(RequestBuilder::new(stub))
6991        }
6992
6993        /// Sets the full request, replacing any prior values.
6994        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6995            mut self,
6996            v: V,
6997        ) -> Self {
6998            self.0.request = v.into();
6999            self
7000        }
7001
7002        /// Sets all the options, replacing any prior values.
7003        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7004            self.0.options = v.into();
7005            self
7006        }
7007
7008        /// Sends the request.
7009        pub async fn send(self) -> Result<longrunning::model::Operation> {
7010            (*self.0.stub)
7011                .get_operation(self.0.request, self.0.options)
7012                .await
7013                .map(gax::response::Response::into_body)
7014        }
7015
7016        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7017        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7018            self.0.request.name = v.into();
7019            self
7020        }
7021    }
7022
7023    #[doc(hidden)]
7024    impl gax::options::internal::RequestBuilder for GetOperation {
7025        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7026            &mut self.0.options
7027        }
7028    }
7029
7030    /// The request builder for [SessionTemplateController::delete_operation][crate::client::SessionTemplateController::delete_operation] calls.
7031    ///
7032    /// # Example
7033    /// ```no_run
7034    /// # use google_cloud_dataproc_v1::builder;
7035    /// use builder::session_template_controller::DeleteOperation;
7036    /// # tokio_test::block_on(async {
7037    ///
7038    /// let builder = prepare_request_builder();
7039    /// let response = builder.send().await?;
7040    /// # gax::Result::<()>::Ok(()) });
7041    ///
7042    /// fn prepare_request_builder() -> DeleteOperation {
7043    ///   # panic!();
7044    ///   // ... details omitted ...
7045    /// }
7046    /// ```
7047    #[derive(Clone, Debug)]
7048    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7049
7050    impl DeleteOperation {
7051        pub(crate) fn new(
7052            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7053        ) -> Self {
7054            Self(RequestBuilder::new(stub))
7055        }
7056
7057        /// Sets the full request, replacing any prior values.
7058        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7059            mut self,
7060            v: V,
7061        ) -> Self {
7062            self.0.request = v.into();
7063            self
7064        }
7065
7066        /// Sets all the options, replacing any prior values.
7067        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7068            self.0.options = v.into();
7069            self
7070        }
7071
7072        /// Sends the request.
7073        pub async fn send(self) -> Result<()> {
7074            (*self.0.stub)
7075                .delete_operation(self.0.request, self.0.options)
7076                .await
7077                .map(gax::response::Response::into_body)
7078        }
7079
7080        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
7081        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7082            self.0.request.name = v.into();
7083            self
7084        }
7085    }
7086
7087    #[doc(hidden)]
7088    impl gax::options::internal::RequestBuilder for DeleteOperation {
7089        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7090            &mut self.0.options
7091        }
7092    }
7093
7094    /// The request builder for [SessionTemplateController::cancel_operation][crate::client::SessionTemplateController::cancel_operation] calls.
7095    ///
7096    /// # Example
7097    /// ```no_run
7098    /// # use google_cloud_dataproc_v1::builder;
7099    /// use builder::session_template_controller::CancelOperation;
7100    /// # tokio_test::block_on(async {
7101    ///
7102    /// let builder = prepare_request_builder();
7103    /// let response = builder.send().await?;
7104    /// # gax::Result::<()>::Ok(()) });
7105    ///
7106    /// fn prepare_request_builder() -> CancelOperation {
7107    ///   # panic!();
7108    ///   // ... details omitted ...
7109    /// }
7110    /// ```
7111    #[derive(Clone, Debug)]
7112    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7113
7114    impl CancelOperation {
7115        pub(crate) fn new(
7116            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7117        ) -> Self {
7118            Self(RequestBuilder::new(stub))
7119        }
7120
7121        /// Sets the full request, replacing any prior values.
7122        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7123            mut self,
7124            v: V,
7125        ) -> Self {
7126            self.0.request = v.into();
7127            self
7128        }
7129
7130        /// Sets all the options, replacing any prior values.
7131        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7132            self.0.options = v.into();
7133            self
7134        }
7135
7136        /// Sends the request.
7137        pub async fn send(self) -> Result<()> {
7138            (*self.0.stub)
7139                .cancel_operation(self.0.request, self.0.options)
7140                .await
7141                .map(gax::response::Response::into_body)
7142        }
7143
7144        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7145        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7146            self.0.request.name = v.into();
7147            self
7148        }
7149    }
7150
7151    #[doc(hidden)]
7152    impl gax::options::internal::RequestBuilder for CancelOperation {
7153        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7154            &mut self.0.options
7155        }
7156    }
7157}
7158
7159pub mod session_controller {
7160    use crate::Result;
7161
7162    /// A builder for [SessionController][crate::client::SessionController].
7163    ///
7164    /// ```
7165    /// # tokio_test::block_on(async {
7166    /// # use google_cloud_dataproc_v1::*;
7167    /// # use builder::session_controller::ClientBuilder;
7168    /// # use client::SessionController;
7169    /// let builder : ClientBuilder = SessionController::builder();
7170    /// let client = builder
7171    ///     .with_endpoint("https://dataproc.googleapis.com")
7172    ///     .build().await?;
7173    /// # gax::client_builder::Result::<()>::Ok(()) });
7174    /// ```
7175    pub type ClientBuilder =
7176        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7177
7178    pub(crate) mod client {
7179        use super::super::super::client::SessionController;
7180        pub struct Factory;
7181        impl gax::client_builder::internal::ClientFactory for Factory {
7182            type Client = SessionController;
7183            type Credentials = gaxi::options::Credentials;
7184            async fn build(
7185                self,
7186                config: gaxi::options::ClientConfig,
7187            ) -> gax::client_builder::Result<Self::Client> {
7188                Self::Client::new(config).await
7189            }
7190        }
7191    }
7192
7193    /// Common implementation for [crate::client::SessionController] request builders.
7194    #[derive(Clone, Debug)]
7195    pub(crate) struct RequestBuilder<R: std::default::Default> {
7196        stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7197        request: R,
7198        options: gax::options::RequestOptions,
7199    }
7200
7201    impl<R> RequestBuilder<R>
7202    where
7203        R: std::default::Default,
7204    {
7205        pub(crate) fn new(
7206            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7207        ) -> Self {
7208            Self {
7209                stub,
7210                request: R::default(),
7211                options: gax::options::RequestOptions::default(),
7212            }
7213        }
7214    }
7215
7216    /// The request builder for [SessionController::create_session][crate::client::SessionController::create_session] calls.
7217    ///
7218    /// # Example
7219    /// ```no_run
7220    /// # use google_cloud_dataproc_v1::builder;
7221    /// use builder::session_controller::CreateSession;
7222    /// # tokio_test::block_on(async {
7223    /// use lro::Poller;
7224    ///
7225    /// let builder = prepare_request_builder();
7226    /// let response = builder.poller().until_done().await?;
7227    /// # gax::Result::<()>::Ok(()) });
7228    ///
7229    /// fn prepare_request_builder() -> CreateSession {
7230    ///   # panic!();
7231    ///   // ... details omitted ...
7232    /// }
7233    /// ```
7234    #[derive(Clone, Debug)]
7235    pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7236
7237    impl CreateSession {
7238        pub(crate) fn new(
7239            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7240        ) -> Self {
7241            Self(RequestBuilder::new(stub))
7242        }
7243
7244        /// Sets the full request, replacing any prior values.
7245        pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7246            self.0.request = v.into();
7247            self
7248        }
7249
7250        /// Sets all the options, replacing any prior values.
7251        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7252            self.0.options = v.into();
7253            self
7254        }
7255
7256        /// Sends the request.
7257        ///
7258        /// # Long running operations
7259        ///
7260        /// This starts, but does not poll, a longrunning operation. More information
7261        /// on [create_session][crate::client::SessionController::create_session].
7262        pub async fn send(self) -> Result<longrunning::model::Operation> {
7263            (*self.0.stub)
7264                .create_session(self.0.request, self.0.options)
7265                .await
7266                .map(gax::response::Response::into_body)
7267        }
7268
7269        /// Creates a [Poller][lro::Poller] to work with `create_session`.
7270        pub fn poller(
7271            self,
7272        ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7273        {
7274            type Operation = lro::internal::Operation<
7275                crate::model::Session,
7276                crate::model::SessionOperationMetadata,
7277            >;
7278            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7279            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7280
7281            let stub = self.0.stub.clone();
7282            let mut options = self.0.options.clone();
7283            options.set_retry_policy(gax::retry_policy::NeverRetry);
7284            let query = move |name| {
7285                let stub = stub.clone();
7286                let options = options.clone();
7287                async {
7288                    let op = GetOperation::new(stub)
7289                        .set_name(name)
7290                        .with_options(options)
7291                        .send()
7292                        .await?;
7293                    Ok(Operation::new(op))
7294                }
7295            };
7296
7297            let start = move || async {
7298                let op = self.send().await?;
7299                Ok(Operation::new(op))
7300            };
7301
7302            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7303        }
7304
7305        /// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
7306        ///
7307        /// This is a **required** field for requests.
7308        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7309            self.0.request.parent = v.into();
7310            self
7311        }
7312
7313        /// Sets the value of [session][crate::model::CreateSessionRequest::session].
7314        ///
7315        /// This is a **required** field for requests.
7316        pub fn set_session<T>(mut self, v: T) -> Self
7317        where
7318            T: std::convert::Into<crate::model::Session>,
7319        {
7320            self.0.request.session = std::option::Option::Some(v.into());
7321            self
7322        }
7323
7324        /// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
7325        ///
7326        /// This is a **required** field for requests.
7327        pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7328        where
7329            T: std::convert::Into<crate::model::Session>,
7330        {
7331            self.0.request.session = v.map(|x| x.into());
7332            self
7333        }
7334
7335        /// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
7336        ///
7337        /// This is a **required** field for requests.
7338        pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7339            self.0.request.session_id = v.into();
7340            self
7341        }
7342
7343        /// Sets the value of [request_id][crate::model::CreateSessionRequest::request_id].
7344        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7345            self.0.request.request_id = v.into();
7346            self
7347        }
7348    }
7349
7350    #[doc(hidden)]
7351    impl gax::options::internal::RequestBuilder for CreateSession {
7352        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7353            &mut self.0.options
7354        }
7355    }
7356
7357    /// The request builder for [SessionController::get_session][crate::client::SessionController::get_session] calls.
7358    ///
7359    /// # Example
7360    /// ```no_run
7361    /// # use google_cloud_dataproc_v1::builder;
7362    /// use builder::session_controller::GetSession;
7363    /// # tokio_test::block_on(async {
7364    ///
7365    /// let builder = prepare_request_builder();
7366    /// let response = builder.send().await?;
7367    /// # gax::Result::<()>::Ok(()) });
7368    ///
7369    /// fn prepare_request_builder() -> GetSession {
7370    ///   # panic!();
7371    ///   // ... details omitted ...
7372    /// }
7373    /// ```
7374    #[derive(Clone, Debug)]
7375    pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7376
7377    impl GetSession {
7378        pub(crate) fn new(
7379            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7380        ) -> Self {
7381            Self(RequestBuilder::new(stub))
7382        }
7383
7384        /// Sets the full request, replacing any prior values.
7385        pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7386            self.0.request = v.into();
7387            self
7388        }
7389
7390        /// Sets all the options, replacing any prior values.
7391        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7392            self.0.options = v.into();
7393            self
7394        }
7395
7396        /// Sends the request.
7397        pub async fn send(self) -> Result<crate::model::Session> {
7398            (*self.0.stub)
7399                .get_session(self.0.request, self.0.options)
7400                .await
7401                .map(gax::response::Response::into_body)
7402        }
7403
7404        /// Sets the value of [name][crate::model::GetSessionRequest::name].
7405        ///
7406        /// This is a **required** field for requests.
7407        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7408            self.0.request.name = v.into();
7409            self
7410        }
7411    }
7412
7413    #[doc(hidden)]
7414    impl gax::options::internal::RequestBuilder for GetSession {
7415        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7416            &mut self.0.options
7417        }
7418    }
7419
7420    /// The request builder for [SessionController::list_sessions][crate::client::SessionController::list_sessions] calls.
7421    ///
7422    /// # Example
7423    /// ```no_run
7424    /// # use google_cloud_dataproc_v1::builder;
7425    /// use builder::session_controller::ListSessions;
7426    /// # tokio_test::block_on(async {
7427    /// use gax::paginator::ItemPaginator;
7428    ///
7429    /// let builder = prepare_request_builder();
7430    /// let mut items = builder.by_item();
7431    /// while let Some(result) = items.next().await {
7432    ///   let item = result?;
7433    /// }
7434    /// # gax::Result::<()>::Ok(()) });
7435    ///
7436    /// fn prepare_request_builder() -> ListSessions {
7437    ///   # panic!();
7438    ///   // ... details omitted ...
7439    /// }
7440    /// ```
7441    #[derive(Clone, Debug)]
7442    pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7443
7444    impl ListSessions {
7445        pub(crate) fn new(
7446            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7447        ) -> Self {
7448            Self(RequestBuilder::new(stub))
7449        }
7450
7451        /// Sets the full request, replacing any prior values.
7452        pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7453            self.0.request = v.into();
7454            self
7455        }
7456
7457        /// Sets all the options, replacing any prior values.
7458        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7459            self.0.options = v.into();
7460            self
7461        }
7462
7463        /// Sends the request.
7464        pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7465            (*self.0.stub)
7466                .list_sessions(self.0.request, self.0.options)
7467                .await
7468                .map(gax::response::Response::into_body)
7469        }
7470
7471        /// Streams each page in the collection.
7472        pub fn by_page(
7473            self,
7474        ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
7475        {
7476            use std::clone::Clone;
7477            let token = self.0.request.page_token.clone();
7478            let execute = move |token: String| {
7479                let mut builder = self.clone();
7480                builder.0.request = builder.0.request.set_page_token(token);
7481                builder.send()
7482            };
7483            gax::paginator::internal::new_paginator(token, execute)
7484        }
7485
7486        /// Streams each item in the collection.
7487        pub fn by_item(
7488            self,
7489        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
7490        {
7491            use gax::paginator::Paginator;
7492            self.by_page().items()
7493        }
7494
7495        /// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
7496        ///
7497        /// This is a **required** field for requests.
7498        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7499            self.0.request.parent = v.into();
7500            self
7501        }
7502
7503        /// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
7504        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7505            self.0.request.page_size = v.into();
7506            self
7507        }
7508
7509        /// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
7510        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7511            self.0.request.page_token = v.into();
7512            self
7513        }
7514
7515        /// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
7516        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7517            self.0.request.filter = v.into();
7518            self
7519        }
7520    }
7521
7522    #[doc(hidden)]
7523    impl gax::options::internal::RequestBuilder for ListSessions {
7524        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7525            &mut self.0.options
7526        }
7527    }
7528
7529    /// The request builder for [SessionController::terminate_session][crate::client::SessionController::terminate_session] calls.
7530    ///
7531    /// # Example
7532    /// ```no_run
7533    /// # use google_cloud_dataproc_v1::builder;
7534    /// use builder::session_controller::TerminateSession;
7535    /// # tokio_test::block_on(async {
7536    /// use lro::Poller;
7537    ///
7538    /// let builder = prepare_request_builder();
7539    /// let response = builder.poller().until_done().await?;
7540    /// # gax::Result::<()>::Ok(()) });
7541    ///
7542    /// fn prepare_request_builder() -> TerminateSession {
7543    ///   # panic!();
7544    ///   // ... details omitted ...
7545    /// }
7546    /// ```
7547    #[derive(Clone, Debug)]
7548    pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7549
7550    impl TerminateSession {
7551        pub(crate) fn new(
7552            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7553        ) -> Self {
7554            Self(RequestBuilder::new(stub))
7555        }
7556
7557        /// Sets the full request, replacing any prior values.
7558        pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7559            mut self,
7560            v: V,
7561        ) -> Self {
7562            self.0.request = v.into();
7563            self
7564        }
7565
7566        /// Sets all the options, replacing any prior values.
7567        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7568            self.0.options = v.into();
7569            self
7570        }
7571
7572        /// Sends the request.
7573        ///
7574        /// # Long running operations
7575        ///
7576        /// This starts, but does not poll, a longrunning operation. More information
7577        /// on [terminate_session][crate::client::SessionController::terminate_session].
7578        pub async fn send(self) -> Result<longrunning::model::Operation> {
7579            (*self.0.stub)
7580                .terminate_session(self.0.request, self.0.options)
7581                .await
7582                .map(gax::response::Response::into_body)
7583        }
7584
7585        /// Creates a [Poller][lro::Poller] to work with `terminate_session`.
7586        pub fn poller(
7587            self,
7588        ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7589        {
7590            type Operation = lro::internal::Operation<
7591                crate::model::Session,
7592                crate::model::SessionOperationMetadata,
7593            >;
7594            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7595            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7596
7597            let stub = self.0.stub.clone();
7598            let mut options = self.0.options.clone();
7599            options.set_retry_policy(gax::retry_policy::NeverRetry);
7600            let query = move |name| {
7601                let stub = stub.clone();
7602                let options = options.clone();
7603                async {
7604                    let op = GetOperation::new(stub)
7605                        .set_name(name)
7606                        .with_options(options)
7607                        .send()
7608                        .await?;
7609                    Ok(Operation::new(op))
7610                }
7611            };
7612
7613            let start = move || async {
7614                let op = self.send().await?;
7615                Ok(Operation::new(op))
7616            };
7617
7618            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7619        }
7620
7621        /// Sets the value of [name][crate::model::TerminateSessionRequest::name].
7622        ///
7623        /// This is a **required** field for requests.
7624        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7625            self.0.request.name = v.into();
7626            self
7627        }
7628
7629        /// Sets the value of [request_id][crate::model::TerminateSessionRequest::request_id].
7630        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7631            self.0.request.request_id = v.into();
7632            self
7633        }
7634    }
7635
7636    #[doc(hidden)]
7637    impl gax::options::internal::RequestBuilder for TerminateSession {
7638        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7639            &mut self.0.options
7640        }
7641    }
7642
7643    /// The request builder for [SessionController::delete_session][crate::client::SessionController::delete_session] calls.
7644    ///
7645    /// # Example
7646    /// ```no_run
7647    /// # use google_cloud_dataproc_v1::builder;
7648    /// use builder::session_controller::DeleteSession;
7649    /// # tokio_test::block_on(async {
7650    /// use lro::Poller;
7651    ///
7652    /// let builder = prepare_request_builder();
7653    /// let response = builder.poller().until_done().await?;
7654    /// # gax::Result::<()>::Ok(()) });
7655    ///
7656    /// fn prepare_request_builder() -> DeleteSession {
7657    ///   # panic!();
7658    ///   // ... details omitted ...
7659    /// }
7660    /// ```
7661    #[derive(Clone, Debug)]
7662    pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7663
7664    impl DeleteSession {
7665        pub(crate) fn new(
7666            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7667        ) -> Self {
7668            Self(RequestBuilder::new(stub))
7669        }
7670
7671        /// Sets the full request, replacing any prior values.
7672        pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7673            self.0.request = v.into();
7674            self
7675        }
7676
7677        /// Sets all the options, replacing any prior values.
7678        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7679            self.0.options = v.into();
7680            self
7681        }
7682
7683        /// Sends the request.
7684        ///
7685        /// # Long running operations
7686        ///
7687        /// This starts, but does not poll, a longrunning operation. More information
7688        /// on [delete_session][crate::client::SessionController::delete_session].
7689        pub async fn send(self) -> Result<longrunning::model::Operation> {
7690            (*self.0.stub)
7691                .delete_session(self.0.request, self.0.options)
7692                .await
7693                .map(gax::response::Response::into_body)
7694        }
7695
7696        /// Creates a [Poller][lro::Poller] to work with `delete_session`.
7697        pub fn poller(
7698            self,
7699        ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7700        {
7701            type Operation = lro::internal::Operation<
7702                crate::model::Session,
7703                crate::model::SessionOperationMetadata,
7704            >;
7705            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7706            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7707
7708            let stub = self.0.stub.clone();
7709            let mut options = self.0.options.clone();
7710            options.set_retry_policy(gax::retry_policy::NeverRetry);
7711            let query = move |name| {
7712                let stub = stub.clone();
7713                let options = options.clone();
7714                async {
7715                    let op = GetOperation::new(stub)
7716                        .set_name(name)
7717                        .with_options(options)
7718                        .send()
7719                        .await?;
7720                    Ok(Operation::new(op))
7721                }
7722            };
7723
7724            let start = move || async {
7725                let op = self.send().await?;
7726                Ok(Operation::new(op))
7727            };
7728
7729            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7730        }
7731
7732        /// Sets the value of [name][crate::model::DeleteSessionRequest::name].
7733        ///
7734        /// This is a **required** field for requests.
7735        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7736            self.0.request.name = v.into();
7737            self
7738        }
7739
7740        /// Sets the value of [request_id][crate::model::DeleteSessionRequest::request_id].
7741        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7742            self.0.request.request_id = v.into();
7743            self
7744        }
7745    }
7746
7747    #[doc(hidden)]
7748    impl gax::options::internal::RequestBuilder for DeleteSession {
7749        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7750            &mut self.0.options
7751        }
7752    }
7753
7754    /// The request builder for [SessionController::set_iam_policy][crate::client::SessionController::set_iam_policy] calls.
7755    ///
7756    /// # Example
7757    /// ```no_run
7758    /// # use google_cloud_dataproc_v1::builder;
7759    /// use builder::session_controller::SetIamPolicy;
7760    /// # tokio_test::block_on(async {
7761    ///
7762    /// let builder = prepare_request_builder();
7763    /// let response = builder.send().await?;
7764    /// # gax::Result::<()>::Ok(()) });
7765    ///
7766    /// fn prepare_request_builder() -> SetIamPolicy {
7767    ///   # panic!();
7768    ///   // ... details omitted ...
7769    /// }
7770    /// ```
7771    #[derive(Clone, Debug)]
7772    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
7773
7774    impl SetIamPolicy {
7775        pub(crate) fn new(
7776            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7777        ) -> Self {
7778            Self(RequestBuilder::new(stub))
7779        }
7780
7781        /// Sets the full request, replacing any prior values.
7782        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
7783            self.0.request = v.into();
7784            self
7785        }
7786
7787        /// Sets all the options, replacing any prior values.
7788        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7789            self.0.options = v.into();
7790            self
7791        }
7792
7793        /// Sends the request.
7794        pub async fn send(self) -> Result<iam_v1::model::Policy> {
7795            (*self.0.stub)
7796                .set_iam_policy(self.0.request, self.0.options)
7797                .await
7798                .map(gax::response::Response::into_body)
7799        }
7800
7801        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
7802        ///
7803        /// This is a **required** field for requests.
7804        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7805            self.0.request.resource = v.into();
7806            self
7807        }
7808
7809        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
7810        ///
7811        /// This is a **required** field for requests.
7812        pub fn set_policy<T>(mut self, v: T) -> Self
7813        where
7814            T: std::convert::Into<iam_v1::model::Policy>,
7815        {
7816            self.0.request.policy = std::option::Option::Some(v.into());
7817            self
7818        }
7819
7820        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
7821        ///
7822        /// This is a **required** field for requests.
7823        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7824        where
7825            T: std::convert::Into<iam_v1::model::Policy>,
7826        {
7827            self.0.request.policy = v.map(|x| x.into());
7828            self
7829        }
7830
7831        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
7832        pub fn set_update_mask<T>(mut self, v: T) -> Self
7833        where
7834            T: std::convert::Into<wkt::FieldMask>,
7835        {
7836            self.0.request.update_mask = std::option::Option::Some(v.into());
7837            self
7838        }
7839
7840        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
7841        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7842        where
7843            T: std::convert::Into<wkt::FieldMask>,
7844        {
7845            self.0.request.update_mask = v.map(|x| x.into());
7846            self
7847        }
7848    }
7849
7850    #[doc(hidden)]
7851    impl gax::options::internal::RequestBuilder for SetIamPolicy {
7852        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7853            &mut self.0.options
7854        }
7855    }
7856
7857    /// The request builder for [SessionController::get_iam_policy][crate::client::SessionController::get_iam_policy] calls.
7858    ///
7859    /// # Example
7860    /// ```no_run
7861    /// # use google_cloud_dataproc_v1::builder;
7862    /// use builder::session_controller::GetIamPolicy;
7863    /// # tokio_test::block_on(async {
7864    ///
7865    /// let builder = prepare_request_builder();
7866    /// let response = builder.send().await?;
7867    /// # gax::Result::<()>::Ok(()) });
7868    ///
7869    /// fn prepare_request_builder() -> GetIamPolicy {
7870    ///   # panic!();
7871    ///   // ... details omitted ...
7872    /// }
7873    /// ```
7874    #[derive(Clone, Debug)]
7875    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
7876
7877    impl GetIamPolicy {
7878        pub(crate) fn new(
7879            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7880        ) -> Self {
7881            Self(RequestBuilder::new(stub))
7882        }
7883
7884        /// Sets the full request, replacing any prior values.
7885        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
7886            self.0.request = v.into();
7887            self
7888        }
7889
7890        /// Sets all the options, replacing any prior values.
7891        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7892            self.0.options = v.into();
7893            self
7894        }
7895
7896        /// Sends the request.
7897        pub async fn send(self) -> Result<iam_v1::model::Policy> {
7898            (*self.0.stub)
7899                .get_iam_policy(self.0.request, self.0.options)
7900                .await
7901                .map(gax::response::Response::into_body)
7902        }
7903
7904        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
7905        ///
7906        /// This is a **required** field for requests.
7907        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7908            self.0.request.resource = v.into();
7909            self
7910        }
7911
7912        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
7913        pub fn set_options<T>(mut self, v: T) -> Self
7914        where
7915            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7916        {
7917            self.0.request.options = std::option::Option::Some(v.into());
7918            self
7919        }
7920
7921        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
7922        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7923        where
7924            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7925        {
7926            self.0.request.options = v.map(|x| x.into());
7927            self
7928        }
7929    }
7930
7931    #[doc(hidden)]
7932    impl gax::options::internal::RequestBuilder for GetIamPolicy {
7933        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7934            &mut self.0.options
7935        }
7936    }
7937
7938    /// The request builder for [SessionController::test_iam_permissions][crate::client::SessionController::test_iam_permissions] calls.
7939    ///
7940    /// # Example
7941    /// ```no_run
7942    /// # use google_cloud_dataproc_v1::builder;
7943    /// use builder::session_controller::TestIamPermissions;
7944    /// # tokio_test::block_on(async {
7945    ///
7946    /// let builder = prepare_request_builder();
7947    /// let response = builder.send().await?;
7948    /// # gax::Result::<()>::Ok(()) });
7949    ///
7950    /// fn prepare_request_builder() -> TestIamPermissions {
7951    ///   # panic!();
7952    ///   // ... details omitted ...
7953    /// }
7954    /// ```
7955    #[derive(Clone, Debug)]
7956    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
7957
7958    impl TestIamPermissions {
7959        pub(crate) fn new(
7960            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7961        ) -> Self {
7962            Self(RequestBuilder::new(stub))
7963        }
7964
7965        /// Sets the full request, replacing any prior values.
7966        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
7967            mut self,
7968            v: V,
7969        ) -> Self {
7970            self.0.request = v.into();
7971            self
7972        }
7973
7974        /// Sets all the options, replacing any prior values.
7975        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7976            self.0.options = v.into();
7977            self
7978        }
7979
7980        /// Sends the request.
7981        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
7982            (*self.0.stub)
7983                .test_iam_permissions(self.0.request, self.0.options)
7984                .await
7985                .map(gax::response::Response::into_body)
7986        }
7987
7988        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
7989        ///
7990        /// This is a **required** field for requests.
7991        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7992            self.0.request.resource = v.into();
7993            self
7994        }
7995
7996        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
7997        ///
7998        /// This is a **required** field for requests.
7999        pub fn set_permissions<T, V>(mut self, v: T) -> Self
8000        where
8001            T: std::iter::IntoIterator<Item = V>,
8002            V: std::convert::Into<std::string::String>,
8003        {
8004            use std::iter::Iterator;
8005            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8006            self
8007        }
8008    }
8009
8010    #[doc(hidden)]
8011    impl gax::options::internal::RequestBuilder for TestIamPermissions {
8012        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8013            &mut self.0.options
8014        }
8015    }
8016
8017    /// The request builder for [SessionController::list_operations][crate::client::SessionController::list_operations] calls.
8018    ///
8019    /// # Example
8020    /// ```no_run
8021    /// # use google_cloud_dataproc_v1::builder;
8022    /// use builder::session_controller::ListOperations;
8023    /// # tokio_test::block_on(async {
8024    /// use gax::paginator::ItemPaginator;
8025    ///
8026    /// let builder = prepare_request_builder();
8027    /// let mut items = builder.by_item();
8028    /// while let Some(result) = items.next().await {
8029    ///   let item = result?;
8030    /// }
8031    /// # gax::Result::<()>::Ok(()) });
8032    ///
8033    /// fn prepare_request_builder() -> ListOperations {
8034    ///   # panic!();
8035    ///   // ... details omitted ...
8036    /// }
8037    /// ```
8038    #[derive(Clone, Debug)]
8039    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8040
8041    impl ListOperations {
8042        pub(crate) fn new(
8043            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8044        ) -> Self {
8045            Self(RequestBuilder::new(stub))
8046        }
8047
8048        /// Sets the full request, replacing any prior values.
8049        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8050            mut self,
8051            v: V,
8052        ) -> Self {
8053            self.0.request = v.into();
8054            self
8055        }
8056
8057        /// Sets all the options, replacing any prior values.
8058        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8059            self.0.options = v.into();
8060            self
8061        }
8062
8063        /// Sends the request.
8064        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8065            (*self.0.stub)
8066                .list_operations(self.0.request, self.0.options)
8067                .await
8068                .map(gax::response::Response::into_body)
8069        }
8070
8071        /// Streams each page in the collection.
8072        pub fn by_page(
8073            self,
8074        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8075        {
8076            use std::clone::Clone;
8077            let token = self.0.request.page_token.clone();
8078            let execute = move |token: String| {
8079                let mut builder = self.clone();
8080                builder.0.request = builder.0.request.set_page_token(token);
8081                builder.send()
8082            };
8083            gax::paginator::internal::new_paginator(token, execute)
8084        }
8085
8086        /// Streams each item in the collection.
8087        pub fn by_item(
8088            self,
8089        ) -> impl gax::paginator::ItemPaginator<
8090            longrunning::model::ListOperationsResponse,
8091            gax::error::Error,
8092        > {
8093            use gax::paginator::Paginator;
8094            self.by_page().items()
8095        }
8096
8097        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
8098        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8099            self.0.request.name = v.into();
8100            self
8101        }
8102
8103        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
8104        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8105            self.0.request.filter = v.into();
8106            self
8107        }
8108
8109        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
8110        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8111            self.0.request.page_size = v.into();
8112            self
8113        }
8114
8115        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
8116        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8117            self.0.request.page_token = v.into();
8118            self
8119        }
8120    }
8121
8122    #[doc(hidden)]
8123    impl gax::options::internal::RequestBuilder for ListOperations {
8124        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8125            &mut self.0.options
8126        }
8127    }
8128
8129    /// The request builder for [SessionController::get_operation][crate::client::SessionController::get_operation] calls.
8130    ///
8131    /// # Example
8132    /// ```no_run
8133    /// # use google_cloud_dataproc_v1::builder;
8134    /// use builder::session_controller::GetOperation;
8135    /// # tokio_test::block_on(async {
8136    ///
8137    /// let builder = prepare_request_builder();
8138    /// let response = builder.send().await?;
8139    /// # gax::Result::<()>::Ok(()) });
8140    ///
8141    /// fn prepare_request_builder() -> GetOperation {
8142    ///   # panic!();
8143    ///   // ... details omitted ...
8144    /// }
8145    /// ```
8146    #[derive(Clone, Debug)]
8147    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8148
8149    impl GetOperation {
8150        pub(crate) fn new(
8151            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8152        ) -> Self {
8153            Self(RequestBuilder::new(stub))
8154        }
8155
8156        /// Sets the full request, replacing any prior values.
8157        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8158            mut self,
8159            v: V,
8160        ) -> Self {
8161            self.0.request = v.into();
8162            self
8163        }
8164
8165        /// Sets all the options, replacing any prior values.
8166        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8167            self.0.options = v.into();
8168            self
8169        }
8170
8171        /// Sends the request.
8172        pub async fn send(self) -> Result<longrunning::model::Operation> {
8173            (*self.0.stub)
8174                .get_operation(self.0.request, self.0.options)
8175                .await
8176                .map(gax::response::Response::into_body)
8177        }
8178
8179        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
8180        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8181            self.0.request.name = v.into();
8182            self
8183        }
8184    }
8185
8186    #[doc(hidden)]
8187    impl gax::options::internal::RequestBuilder for GetOperation {
8188        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8189            &mut self.0.options
8190        }
8191    }
8192
8193    /// The request builder for [SessionController::delete_operation][crate::client::SessionController::delete_operation] calls.
8194    ///
8195    /// # Example
8196    /// ```no_run
8197    /// # use google_cloud_dataproc_v1::builder;
8198    /// use builder::session_controller::DeleteOperation;
8199    /// # tokio_test::block_on(async {
8200    ///
8201    /// let builder = prepare_request_builder();
8202    /// let response = builder.send().await?;
8203    /// # gax::Result::<()>::Ok(()) });
8204    ///
8205    /// fn prepare_request_builder() -> DeleteOperation {
8206    ///   # panic!();
8207    ///   // ... details omitted ...
8208    /// }
8209    /// ```
8210    #[derive(Clone, Debug)]
8211    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
8212
8213    impl DeleteOperation {
8214        pub(crate) fn new(
8215            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8216        ) -> Self {
8217            Self(RequestBuilder::new(stub))
8218        }
8219
8220        /// Sets the full request, replacing any prior values.
8221        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
8222            mut self,
8223            v: V,
8224        ) -> Self {
8225            self.0.request = v.into();
8226            self
8227        }
8228
8229        /// Sets all the options, replacing any prior values.
8230        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8231            self.0.options = v.into();
8232            self
8233        }
8234
8235        /// Sends the request.
8236        pub async fn send(self) -> Result<()> {
8237            (*self.0.stub)
8238                .delete_operation(self.0.request, self.0.options)
8239                .await
8240                .map(gax::response::Response::into_body)
8241        }
8242
8243        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
8244        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8245            self.0.request.name = v.into();
8246            self
8247        }
8248    }
8249
8250    #[doc(hidden)]
8251    impl gax::options::internal::RequestBuilder for DeleteOperation {
8252        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8253            &mut self.0.options
8254        }
8255    }
8256
8257    /// The request builder for [SessionController::cancel_operation][crate::client::SessionController::cancel_operation] calls.
8258    ///
8259    /// # Example
8260    /// ```no_run
8261    /// # use google_cloud_dataproc_v1::builder;
8262    /// use builder::session_controller::CancelOperation;
8263    /// # tokio_test::block_on(async {
8264    ///
8265    /// let builder = prepare_request_builder();
8266    /// let response = builder.send().await?;
8267    /// # gax::Result::<()>::Ok(()) });
8268    ///
8269    /// fn prepare_request_builder() -> CancelOperation {
8270    ///   # panic!();
8271    ///   // ... details omitted ...
8272    /// }
8273    /// ```
8274    #[derive(Clone, Debug)]
8275    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8276
8277    impl CancelOperation {
8278        pub(crate) fn new(
8279            stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8280        ) -> Self {
8281            Self(RequestBuilder::new(stub))
8282        }
8283
8284        /// Sets the full request, replacing any prior values.
8285        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8286            mut self,
8287            v: V,
8288        ) -> Self {
8289            self.0.request = v.into();
8290            self
8291        }
8292
8293        /// Sets all the options, replacing any prior values.
8294        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8295            self.0.options = v.into();
8296            self
8297        }
8298
8299        /// Sends the request.
8300        pub async fn send(self) -> Result<()> {
8301            (*self.0.stub)
8302                .cancel_operation(self.0.request, self.0.options)
8303                .await
8304                .map(gax::response::Response::into_body)
8305        }
8306
8307        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
8308        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8309            self.0.request.name = v.into();
8310            self
8311        }
8312    }
8313
8314    #[doc(hidden)]
8315    impl gax::options::internal::RequestBuilder for CancelOperation {
8316        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8317            &mut self.0.options
8318        }
8319    }
8320}
8321
8322pub mod workflow_template_service {
8323    use crate::Result;
8324
8325    /// A builder for [WorkflowTemplateService][crate::client::WorkflowTemplateService].
8326    ///
8327    /// ```
8328    /// # tokio_test::block_on(async {
8329    /// # use google_cloud_dataproc_v1::*;
8330    /// # use builder::workflow_template_service::ClientBuilder;
8331    /// # use client::WorkflowTemplateService;
8332    /// let builder : ClientBuilder = WorkflowTemplateService::builder();
8333    /// let client = builder
8334    ///     .with_endpoint("https://dataproc.googleapis.com")
8335    ///     .build().await?;
8336    /// # gax::client_builder::Result::<()>::Ok(()) });
8337    /// ```
8338    pub type ClientBuilder =
8339        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8340
8341    pub(crate) mod client {
8342        use super::super::super::client::WorkflowTemplateService;
8343        pub struct Factory;
8344        impl gax::client_builder::internal::ClientFactory for Factory {
8345            type Client = WorkflowTemplateService;
8346            type Credentials = gaxi::options::Credentials;
8347            async fn build(
8348                self,
8349                config: gaxi::options::ClientConfig,
8350            ) -> gax::client_builder::Result<Self::Client> {
8351                Self::Client::new(config).await
8352            }
8353        }
8354    }
8355
8356    /// Common implementation for [crate::client::WorkflowTemplateService] request builders.
8357    #[derive(Clone, Debug)]
8358    pub(crate) struct RequestBuilder<R: std::default::Default> {
8359        stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8360        request: R,
8361        options: gax::options::RequestOptions,
8362    }
8363
8364    impl<R> RequestBuilder<R>
8365    where
8366        R: std::default::Default,
8367    {
8368        pub(crate) fn new(
8369            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8370        ) -> Self {
8371            Self {
8372                stub,
8373                request: R::default(),
8374                options: gax::options::RequestOptions::default(),
8375            }
8376        }
8377    }
8378
8379    /// The request builder for [WorkflowTemplateService::create_workflow_template][crate::client::WorkflowTemplateService::create_workflow_template] calls.
8380    ///
8381    /// # Example
8382    /// ```no_run
8383    /// # use google_cloud_dataproc_v1::builder;
8384    /// use builder::workflow_template_service::CreateWorkflowTemplate;
8385    /// # tokio_test::block_on(async {
8386    ///
8387    /// let builder = prepare_request_builder();
8388    /// let response = builder.send().await?;
8389    /// # gax::Result::<()>::Ok(()) });
8390    ///
8391    /// fn prepare_request_builder() -> CreateWorkflowTemplate {
8392    ///   # panic!();
8393    ///   // ... details omitted ...
8394    /// }
8395    /// ```
8396    #[derive(Clone, Debug)]
8397    pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8398
8399    impl CreateWorkflowTemplate {
8400        pub(crate) fn new(
8401            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8402        ) -> Self {
8403            Self(RequestBuilder::new(stub))
8404        }
8405
8406        /// Sets the full request, replacing any prior values.
8407        pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8408            mut self,
8409            v: V,
8410        ) -> Self {
8411            self.0.request = v.into();
8412            self
8413        }
8414
8415        /// Sets all the options, replacing any prior values.
8416        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8417            self.0.options = v.into();
8418            self
8419        }
8420
8421        /// Sends the request.
8422        pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8423            (*self.0.stub)
8424                .create_workflow_template(self.0.request, self.0.options)
8425                .await
8426                .map(gax::response::Response::into_body)
8427        }
8428
8429        /// Sets the value of [parent][crate::model::CreateWorkflowTemplateRequest::parent].
8430        ///
8431        /// This is a **required** field for requests.
8432        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8433            self.0.request.parent = v.into();
8434            self
8435        }
8436
8437        /// Sets the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
8438        ///
8439        /// This is a **required** field for requests.
8440        pub fn set_template<T>(mut self, v: T) -> Self
8441        where
8442            T: std::convert::Into<crate::model::WorkflowTemplate>,
8443        {
8444            self.0.request.template = std::option::Option::Some(v.into());
8445            self
8446        }
8447
8448        /// Sets or clears the value of [template][crate::model::CreateWorkflowTemplateRequest::template].
8449        ///
8450        /// This is a **required** field for requests.
8451        pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8452        where
8453            T: std::convert::Into<crate::model::WorkflowTemplate>,
8454        {
8455            self.0.request.template = v.map(|x| x.into());
8456            self
8457        }
8458    }
8459
8460    #[doc(hidden)]
8461    impl gax::options::internal::RequestBuilder for CreateWorkflowTemplate {
8462        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8463            &mut self.0.options
8464        }
8465    }
8466
8467    /// The request builder for [WorkflowTemplateService::get_workflow_template][crate::client::WorkflowTemplateService::get_workflow_template] calls.
8468    ///
8469    /// # Example
8470    /// ```no_run
8471    /// # use google_cloud_dataproc_v1::builder;
8472    /// use builder::workflow_template_service::GetWorkflowTemplate;
8473    /// # tokio_test::block_on(async {
8474    ///
8475    /// let builder = prepare_request_builder();
8476    /// let response = builder.send().await?;
8477    /// # gax::Result::<()>::Ok(()) });
8478    ///
8479    /// fn prepare_request_builder() -> GetWorkflowTemplate {
8480    ///   # panic!();
8481    ///   // ... details omitted ...
8482    /// }
8483    /// ```
8484    #[derive(Clone, Debug)]
8485    pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8486
8487    impl GetWorkflowTemplate {
8488        pub(crate) fn new(
8489            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8490        ) -> Self {
8491            Self(RequestBuilder::new(stub))
8492        }
8493
8494        /// Sets the full request, replacing any prior values.
8495        pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
8496            mut self,
8497            v: V,
8498        ) -> Self {
8499            self.0.request = v.into();
8500            self
8501        }
8502
8503        /// Sets all the options, replacing any prior values.
8504        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8505            self.0.options = v.into();
8506            self
8507        }
8508
8509        /// Sends the request.
8510        pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8511            (*self.0.stub)
8512                .get_workflow_template(self.0.request, self.0.options)
8513                .await
8514                .map(gax::response::Response::into_body)
8515        }
8516
8517        /// Sets the value of [name][crate::model::GetWorkflowTemplateRequest::name].
8518        ///
8519        /// This is a **required** field for requests.
8520        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8521            self.0.request.name = v.into();
8522            self
8523        }
8524
8525        /// Sets the value of [version][crate::model::GetWorkflowTemplateRequest::version].
8526        pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8527            self.0.request.version = v.into();
8528            self
8529        }
8530    }
8531
8532    #[doc(hidden)]
8533    impl gax::options::internal::RequestBuilder for GetWorkflowTemplate {
8534        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8535            &mut self.0.options
8536        }
8537    }
8538
8539    /// The request builder for [WorkflowTemplateService::instantiate_workflow_template][crate::client::WorkflowTemplateService::instantiate_workflow_template] calls.
8540    ///
8541    /// # Example
8542    /// ```no_run
8543    /// # use google_cloud_dataproc_v1::builder;
8544    /// use builder::workflow_template_service::InstantiateWorkflowTemplate;
8545    /// # tokio_test::block_on(async {
8546    /// use lro::Poller;
8547    ///
8548    /// let builder = prepare_request_builder();
8549    /// let response = builder.poller().until_done().await?;
8550    /// # gax::Result::<()>::Ok(()) });
8551    ///
8552    /// fn prepare_request_builder() -> InstantiateWorkflowTemplate {
8553    ///   # panic!();
8554    ///   // ... details omitted ...
8555    /// }
8556    /// ```
8557    #[derive(Clone, Debug)]
8558    pub struct InstantiateWorkflowTemplate(
8559        RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8560    );
8561
8562    impl InstantiateWorkflowTemplate {
8563        pub(crate) fn new(
8564            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8565        ) -> Self {
8566            Self(RequestBuilder::new(stub))
8567        }
8568
8569        /// Sets the full request, replacing any prior values.
8570        pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8571            mut self,
8572            v: V,
8573        ) -> Self {
8574            self.0.request = v.into();
8575            self
8576        }
8577
8578        /// Sets all the options, replacing any prior values.
8579        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8580            self.0.options = v.into();
8581            self
8582        }
8583
8584        /// Sends the request.
8585        ///
8586        /// # Long running operations
8587        ///
8588        /// This starts, but does not poll, a longrunning operation. More information
8589        /// on [instantiate_workflow_template][crate::client::WorkflowTemplateService::instantiate_workflow_template].
8590        pub async fn send(self) -> Result<longrunning::model::Operation> {
8591            (*self.0.stub)
8592                .instantiate_workflow_template(self.0.request, self.0.options)
8593                .await
8594                .map(gax::response::Response::into_body)
8595        }
8596
8597        /// Creates a [Poller][lro::Poller] to work with `instantiate_workflow_template`.
8598        pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8599            type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8600            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8601            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8602
8603            let stub = self.0.stub.clone();
8604            let mut options = self.0.options.clone();
8605            options.set_retry_policy(gax::retry_policy::NeverRetry);
8606            let query = move |name| {
8607                let stub = stub.clone();
8608                let options = options.clone();
8609                async {
8610                    let op = GetOperation::new(stub)
8611                        .set_name(name)
8612                        .with_options(options)
8613                        .send()
8614                        .await?;
8615                    Ok(Operation::new(op))
8616                }
8617            };
8618
8619            let start = move || async {
8620                let op = self.send().await?;
8621                Ok(Operation::new(op))
8622            };
8623
8624            lro::internal::new_unit_response_poller(
8625                polling_error_policy,
8626                polling_backoff_policy,
8627                start,
8628                query,
8629            )
8630        }
8631
8632        /// Sets the value of [name][crate::model::InstantiateWorkflowTemplateRequest::name].
8633        ///
8634        /// This is a **required** field for requests.
8635        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8636            self.0.request.name = v.into();
8637            self
8638        }
8639
8640        /// Sets the value of [version][crate::model::InstantiateWorkflowTemplateRequest::version].
8641        pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8642            self.0.request.version = v.into();
8643            self
8644        }
8645
8646        /// Sets the value of [request_id][crate::model::InstantiateWorkflowTemplateRequest::request_id].
8647        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8648            self.0.request.request_id = v.into();
8649            self
8650        }
8651
8652        /// Sets the value of [parameters][crate::model::InstantiateWorkflowTemplateRequest::parameters].
8653        pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8654        where
8655            T: std::iter::IntoIterator<Item = (K, V)>,
8656            K: std::convert::Into<std::string::String>,
8657            V: std::convert::Into<std::string::String>,
8658        {
8659            self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8660            self
8661        }
8662    }
8663
8664    #[doc(hidden)]
8665    impl gax::options::internal::RequestBuilder for InstantiateWorkflowTemplate {
8666        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8667            &mut self.0.options
8668        }
8669    }
8670
8671    /// The request builder for [WorkflowTemplateService::instantiate_inline_workflow_template][crate::client::WorkflowTemplateService::instantiate_inline_workflow_template] calls.
8672    ///
8673    /// # Example
8674    /// ```no_run
8675    /// # use google_cloud_dataproc_v1::builder;
8676    /// use builder::workflow_template_service::InstantiateInlineWorkflowTemplate;
8677    /// # tokio_test::block_on(async {
8678    /// use lro::Poller;
8679    ///
8680    /// let builder = prepare_request_builder();
8681    /// let response = builder.poller().until_done().await?;
8682    /// # gax::Result::<()>::Ok(()) });
8683    ///
8684    /// fn prepare_request_builder() -> InstantiateInlineWorkflowTemplate {
8685    ///   # panic!();
8686    ///   // ... details omitted ...
8687    /// }
8688    /// ```
8689    #[derive(Clone, Debug)]
8690    pub struct InstantiateInlineWorkflowTemplate(
8691        RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8692    );
8693
8694    impl InstantiateInlineWorkflowTemplate {
8695        pub(crate) fn new(
8696            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8697        ) -> Self {
8698            Self(RequestBuilder::new(stub))
8699        }
8700
8701        /// Sets the full request, replacing any prior values.
8702        pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8703            mut self,
8704            v: V,
8705        ) -> Self {
8706            self.0.request = v.into();
8707            self
8708        }
8709
8710        /// Sets all the options, replacing any prior values.
8711        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8712            self.0.options = v.into();
8713            self
8714        }
8715
8716        /// Sends the request.
8717        ///
8718        /// # Long running operations
8719        ///
8720        /// This starts, but does not poll, a longrunning operation. More information
8721        /// on [instantiate_inline_workflow_template][crate::client::WorkflowTemplateService::instantiate_inline_workflow_template].
8722        pub async fn send(self) -> Result<longrunning::model::Operation> {
8723            (*self.0.stub)
8724                .instantiate_inline_workflow_template(self.0.request, self.0.options)
8725                .await
8726                .map(gax::response::Response::into_body)
8727        }
8728
8729        /// Creates a [Poller][lro::Poller] to work with `instantiate_inline_workflow_template`.
8730        pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8731            type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8732            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8733            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8734
8735            let stub = self.0.stub.clone();
8736            let mut options = self.0.options.clone();
8737            options.set_retry_policy(gax::retry_policy::NeverRetry);
8738            let query = move |name| {
8739                let stub = stub.clone();
8740                let options = options.clone();
8741                async {
8742                    let op = GetOperation::new(stub)
8743                        .set_name(name)
8744                        .with_options(options)
8745                        .send()
8746                        .await?;
8747                    Ok(Operation::new(op))
8748                }
8749            };
8750
8751            let start = move || async {
8752                let op = self.send().await?;
8753                Ok(Operation::new(op))
8754            };
8755
8756            lro::internal::new_unit_response_poller(
8757                polling_error_policy,
8758                polling_backoff_policy,
8759                start,
8760                query,
8761            )
8762        }
8763
8764        /// Sets the value of [parent][crate::model::InstantiateInlineWorkflowTemplateRequest::parent].
8765        ///
8766        /// This is a **required** field for requests.
8767        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8768            self.0.request.parent = v.into();
8769            self
8770        }
8771
8772        /// Sets the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
8773        ///
8774        /// This is a **required** field for requests.
8775        pub fn set_template<T>(mut self, v: T) -> Self
8776        where
8777            T: std::convert::Into<crate::model::WorkflowTemplate>,
8778        {
8779            self.0.request.template = std::option::Option::Some(v.into());
8780            self
8781        }
8782
8783        /// Sets or clears the value of [template][crate::model::InstantiateInlineWorkflowTemplateRequest::template].
8784        ///
8785        /// This is a **required** field for requests.
8786        pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8787        where
8788            T: std::convert::Into<crate::model::WorkflowTemplate>,
8789        {
8790            self.0.request.template = v.map(|x| x.into());
8791            self
8792        }
8793
8794        /// Sets the value of [request_id][crate::model::InstantiateInlineWorkflowTemplateRequest::request_id].
8795        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8796            self.0.request.request_id = v.into();
8797            self
8798        }
8799    }
8800
8801    #[doc(hidden)]
8802    impl gax::options::internal::RequestBuilder for InstantiateInlineWorkflowTemplate {
8803        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8804            &mut self.0.options
8805        }
8806    }
8807
8808    /// The request builder for [WorkflowTemplateService::update_workflow_template][crate::client::WorkflowTemplateService::update_workflow_template] calls.
8809    ///
8810    /// # Example
8811    /// ```no_run
8812    /// # use google_cloud_dataproc_v1::builder;
8813    /// use builder::workflow_template_service::UpdateWorkflowTemplate;
8814    /// # tokio_test::block_on(async {
8815    ///
8816    /// let builder = prepare_request_builder();
8817    /// let response = builder.send().await?;
8818    /// # gax::Result::<()>::Ok(()) });
8819    ///
8820    /// fn prepare_request_builder() -> UpdateWorkflowTemplate {
8821    ///   # panic!();
8822    ///   // ... details omitted ...
8823    /// }
8824    /// ```
8825    #[derive(Clone, Debug)]
8826    pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
8827
8828    impl UpdateWorkflowTemplate {
8829        pub(crate) fn new(
8830            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8831        ) -> Self {
8832            Self(RequestBuilder::new(stub))
8833        }
8834
8835        /// Sets the full request, replacing any prior values.
8836        pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
8837            mut self,
8838            v: V,
8839        ) -> Self {
8840            self.0.request = v.into();
8841            self
8842        }
8843
8844        /// Sets all the options, replacing any prior values.
8845        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8846            self.0.options = v.into();
8847            self
8848        }
8849
8850        /// Sends the request.
8851        pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8852            (*self.0.stub)
8853                .update_workflow_template(self.0.request, self.0.options)
8854                .await
8855                .map(gax::response::Response::into_body)
8856        }
8857
8858        /// Sets the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
8859        ///
8860        /// This is a **required** field for requests.
8861        pub fn set_template<T>(mut self, v: T) -> Self
8862        where
8863            T: std::convert::Into<crate::model::WorkflowTemplate>,
8864        {
8865            self.0.request.template = std::option::Option::Some(v.into());
8866            self
8867        }
8868
8869        /// Sets or clears the value of [template][crate::model::UpdateWorkflowTemplateRequest::template].
8870        ///
8871        /// This is a **required** field for requests.
8872        pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8873        where
8874            T: std::convert::Into<crate::model::WorkflowTemplate>,
8875        {
8876            self.0.request.template = v.map(|x| x.into());
8877            self
8878        }
8879    }
8880
8881    #[doc(hidden)]
8882    impl gax::options::internal::RequestBuilder for UpdateWorkflowTemplate {
8883        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8884            &mut self.0.options
8885        }
8886    }
8887
8888    /// The request builder for [WorkflowTemplateService::list_workflow_templates][crate::client::WorkflowTemplateService::list_workflow_templates] calls.
8889    ///
8890    /// # Example
8891    /// ```no_run
8892    /// # use google_cloud_dataproc_v1::builder;
8893    /// use builder::workflow_template_service::ListWorkflowTemplates;
8894    /// # tokio_test::block_on(async {
8895    /// use gax::paginator::ItemPaginator;
8896    ///
8897    /// let builder = prepare_request_builder();
8898    /// let mut items = builder.by_item();
8899    /// while let Some(result) = items.next().await {
8900    ///   let item = result?;
8901    /// }
8902    /// # gax::Result::<()>::Ok(()) });
8903    ///
8904    /// fn prepare_request_builder() -> ListWorkflowTemplates {
8905    ///   # panic!();
8906    ///   // ... details omitted ...
8907    /// }
8908    /// ```
8909    #[derive(Clone, Debug)]
8910    pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
8911
8912    impl ListWorkflowTemplates {
8913        pub(crate) fn new(
8914            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8915        ) -> Self {
8916            Self(RequestBuilder::new(stub))
8917        }
8918
8919        /// Sets the full request, replacing any prior values.
8920        pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
8921            mut self,
8922            v: V,
8923        ) -> Self {
8924            self.0.request = v.into();
8925            self
8926        }
8927
8928        /// Sets all the options, replacing any prior values.
8929        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8930            self.0.options = v.into();
8931            self
8932        }
8933
8934        /// Sends the request.
8935        pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
8936            (*self.0.stub)
8937                .list_workflow_templates(self.0.request, self.0.options)
8938                .await
8939                .map(gax::response::Response::into_body)
8940        }
8941
8942        /// Streams each page in the collection.
8943        pub fn by_page(
8944            self,
8945        ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowTemplatesResponse, gax::error::Error>
8946        {
8947            use std::clone::Clone;
8948            let token = self.0.request.page_token.clone();
8949            let execute = move |token: String| {
8950                let mut builder = self.clone();
8951                builder.0.request = builder.0.request.set_page_token(token);
8952                builder.send()
8953            };
8954            gax::paginator::internal::new_paginator(token, execute)
8955        }
8956
8957        /// Streams each item in the collection.
8958        pub fn by_item(
8959            self,
8960        ) -> impl gax::paginator::ItemPaginator<
8961            crate::model::ListWorkflowTemplatesResponse,
8962            gax::error::Error,
8963        > {
8964            use gax::paginator::Paginator;
8965            self.by_page().items()
8966        }
8967
8968        /// Sets the value of [parent][crate::model::ListWorkflowTemplatesRequest::parent].
8969        ///
8970        /// This is a **required** field for requests.
8971        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8972            self.0.request.parent = v.into();
8973            self
8974        }
8975
8976        /// Sets the value of [page_size][crate::model::ListWorkflowTemplatesRequest::page_size].
8977        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8978            self.0.request.page_size = v.into();
8979            self
8980        }
8981
8982        /// Sets the value of [page_token][crate::model::ListWorkflowTemplatesRequest::page_token].
8983        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8984            self.0.request.page_token = v.into();
8985            self
8986        }
8987    }
8988
8989    #[doc(hidden)]
8990    impl gax::options::internal::RequestBuilder for ListWorkflowTemplates {
8991        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8992            &mut self.0.options
8993        }
8994    }
8995
8996    /// The request builder for [WorkflowTemplateService::delete_workflow_template][crate::client::WorkflowTemplateService::delete_workflow_template] calls.
8997    ///
8998    /// # Example
8999    /// ```no_run
9000    /// # use google_cloud_dataproc_v1::builder;
9001    /// use builder::workflow_template_service::DeleteWorkflowTemplate;
9002    /// # tokio_test::block_on(async {
9003    ///
9004    /// let builder = prepare_request_builder();
9005    /// let response = builder.send().await?;
9006    /// # gax::Result::<()>::Ok(()) });
9007    ///
9008    /// fn prepare_request_builder() -> DeleteWorkflowTemplate {
9009    ///   # panic!();
9010    ///   // ... details omitted ...
9011    /// }
9012    /// ```
9013    #[derive(Clone, Debug)]
9014    pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
9015
9016    impl DeleteWorkflowTemplate {
9017        pub(crate) fn new(
9018            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9019        ) -> Self {
9020            Self(RequestBuilder::new(stub))
9021        }
9022
9023        /// Sets the full request, replacing any prior values.
9024        pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
9025            mut self,
9026            v: V,
9027        ) -> Self {
9028            self.0.request = v.into();
9029            self
9030        }
9031
9032        /// Sets all the options, replacing any prior values.
9033        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9034            self.0.options = v.into();
9035            self
9036        }
9037
9038        /// Sends the request.
9039        pub async fn send(self) -> Result<()> {
9040            (*self.0.stub)
9041                .delete_workflow_template(self.0.request, self.0.options)
9042                .await
9043                .map(gax::response::Response::into_body)
9044        }
9045
9046        /// Sets the value of [name][crate::model::DeleteWorkflowTemplateRequest::name].
9047        ///
9048        /// This is a **required** field for requests.
9049        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9050            self.0.request.name = v.into();
9051            self
9052        }
9053
9054        /// Sets the value of [version][crate::model::DeleteWorkflowTemplateRequest::version].
9055        pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9056            self.0.request.version = v.into();
9057            self
9058        }
9059    }
9060
9061    #[doc(hidden)]
9062    impl gax::options::internal::RequestBuilder for DeleteWorkflowTemplate {
9063        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9064            &mut self.0.options
9065        }
9066    }
9067
9068    /// The request builder for [WorkflowTemplateService::set_iam_policy][crate::client::WorkflowTemplateService::set_iam_policy] calls.
9069    ///
9070    /// # Example
9071    /// ```no_run
9072    /// # use google_cloud_dataproc_v1::builder;
9073    /// use builder::workflow_template_service::SetIamPolicy;
9074    /// # tokio_test::block_on(async {
9075    ///
9076    /// let builder = prepare_request_builder();
9077    /// let response = builder.send().await?;
9078    /// # gax::Result::<()>::Ok(()) });
9079    ///
9080    /// fn prepare_request_builder() -> SetIamPolicy {
9081    ///   # panic!();
9082    ///   // ... details omitted ...
9083    /// }
9084    /// ```
9085    #[derive(Clone, Debug)]
9086    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
9087
9088    impl SetIamPolicy {
9089        pub(crate) fn new(
9090            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9091        ) -> Self {
9092            Self(RequestBuilder::new(stub))
9093        }
9094
9095        /// Sets the full request, replacing any prior values.
9096        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
9097            self.0.request = v.into();
9098            self
9099        }
9100
9101        /// Sets all the options, replacing any prior values.
9102        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9103            self.0.options = v.into();
9104            self
9105        }
9106
9107        /// Sends the request.
9108        pub async fn send(self) -> Result<iam_v1::model::Policy> {
9109            (*self.0.stub)
9110                .set_iam_policy(self.0.request, self.0.options)
9111                .await
9112                .map(gax::response::Response::into_body)
9113        }
9114
9115        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
9116        ///
9117        /// This is a **required** field for requests.
9118        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9119            self.0.request.resource = v.into();
9120            self
9121        }
9122
9123        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
9124        ///
9125        /// This is a **required** field for requests.
9126        pub fn set_policy<T>(mut self, v: T) -> Self
9127        where
9128            T: std::convert::Into<iam_v1::model::Policy>,
9129        {
9130            self.0.request.policy = std::option::Option::Some(v.into());
9131            self
9132        }
9133
9134        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
9135        ///
9136        /// This is a **required** field for requests.
9137        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9138        where
9139            T: std::convert::Into<iam_v1::model::Policy>,
9140        {
9141            self.0.request.policy = v.map(|x| x.into());
9142            self
9143        }
9144
9145        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
9146        pub fn set_update_mask<T>(mut self, v: T) -> Self
9147        where
9148            T: std::convert::Into<wkt::FieldMask>,
9149        {
9150            self.0.request.update_mask = std::option::Option::Some(v.into());
9151            self
9152        }
9153
9154        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
9155        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9156        where
9157            T: std::convert::Into<wkt::FieldMask>,
9158        {
9159            self.0.request.update_mask = v.map(|x| x.into());
9160            self
9161        }
9162    }
9163
9164    #[doc(hidden)]
9165    impl gax::options::internal::RequestBuilder for SetIamPolicy {
9166        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9167            &mut self.0.options
9168        }
9169    }
9170
9171    /// The request builder for [WorkflowTemplateService::get_iam_policy][crate::client::WorkflowTemplateService::get_iam_policy] calls.
9172    ///
9173    /// # Example
9174    /// ```no_run
9175    /// # use google_cloud_dataproc_v1::builder;
9176    /// use builder::workflow_template_service::GetIamPolicy;
9177    /// # tokio_test::block_on(async {
9178    ///
9179    /// let builder = prepare_request_builder();
9180    /// let response = builder.send().await?;
9181    /// # gax::Result::<()>::Ok(()) });
9182    ///
9183    /// fn prepare_request_builder() -> GetIamPolicy {
9184    ///   # panic!();
9185    ///   // ... details omitted ...
9186    /// }
9187    /// ```
9188    #[derive(Clone, Debug)]
9189    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
9190
9191    impl GetIamPolicy {
9192        pub(crate) fn new(
9193            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9194        ) -> Self {
9195            Self(RequestBuilder::new(stub))
9196        }
9197
9198        /// Sets the full request, replacing any prior values.
9199        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
9200            self.0.request = v.into();
9201            self
9202        }
9203
9204        /// Sets all the options, replacing any prior values.
9205        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9206            self.0.options = v.into();
9207            self
9208        }
9209
9210        /// Sends the request.
9211        pub async fn send(self) -> Result<iam_v1::model::Policy> {
9212            (*self.0.stub)
9213                .get_iam_policy(self.0.request, self.0.options)
9214                .await
9215                .map(gax::response::Response::into_body)
9216        }
9217
9218        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
9219        ///
9220        /// This is a **required** field for requests.
9221        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9222            self.0.request.resource = v.into();
9223            self
9224        }
9225
9226        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
9227        pub fn set_options<T>(mut self, v: T) -> Self
9228        where
9229            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9230        {
9231            self.0.request.options = std::option::Option::Some(v.into());
9232            self
9233        }
9234
9235        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
9236        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9237        where
9238            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9239        {
9240            self.0.request.options = v.map(|x| x.into());
9241            self
9242        }
9243    }
9244
9245    #[doc(hidden)]
9246    impl gax::options::internal::RequestBuilder for GetIamPolicy {
9247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9248            &mut self.0.options
9249        }
9250    }
9251
9252    /// The request builder for [WorkflowTemplateService::test_iam_permissions][crate::client::WorkflowTemplateService::test_iam_permissions] calls.
9253    ///
9254    /// # Example
9255    /// ```no_run
9256    /// # use google_cloud_dataproc_v1::builder;
9257    /// use builder::workflow_template_service::TestIamPermissions;
9258    /// # tokio_test::block_on(async {
9259    ///
9260    /// let builder = prepare_request_builder();
9261    /// let response = builder.send().await?;
9262    /// # gax::Result::<()>::Ok(()) });
9263    ///
9264    /// fn prepare_request_builder() -> TestIamPermissions {
9265    ///   # panic!();
9266    ///   // ... details omitted ...
9267    /// }
9268    /// ```
9269    #[derive(Clone, Debug)]
9270    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
9271
9272    impl TestIamPermissions {
9273        pub(crate) fn new(
9274            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9275        ) -> Self {
9276            Self(RequestBuilder::new(stub))
9277        }
9278
9279        /// Sets the full request, replacing any prior values.
9280        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
9281            mut self,
9282            v: V,
9283        ) -> Self {
9284            self.0.request = v.into();
9285            self
9286        }
9287
9288        /// Sets all the options, replacing any prior values.
9289        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9290            self.0.options = v.into();
9291            self
9292        }
9293
9294        /// Sends the request.
9295        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
9296            (*self.0.stub)
9297                .test_iam_permissions(self.0.request, self.0.options)
9298                .await
9299                .map(gax::response::Response::into_body)
9300        }
9301
9302        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
9303        ///
9304        /// This is a **required** field for requests.
9305        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9306            self.0.request.resource = v.into();
9307            self
9308        }
9309
9310        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
9311        ///
9312        /// This is a **required** field for requests.
9313        pub fn set_permissions<T, V>(mut self, v: T) -> Self
9314        where
9315            T: std::iter::IntoIterator<Item = V>,
9316            V: std::convert::Into<std::string::String>,
9317        {
9318            use std::iter::Iterator;
9319            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9320            self
9321        }
9322    }
9323
9324    #[doc(hidden)]
9325    impl gax::options::internal::RequestBuilder for TestIamPermissions {
9326        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9327            &mut self.0.options
9328        }
9329    }
9330
9331    /// The request builder for [WorkflowTemplateService::list_operations][crate::client::WorkflowTemplateService::list_operations] calls.
9332    ///
9333    /// # Example
9334    /// ```no_run
9335    /// # use google_cloud_dataproc_v1::builder;
9336    /// use builder::workflow_template_service::ListOperations;
9337    /// # tokio_test::block_on(async {
9338    /// use gax::paginator::ItemPaginator;
9339    ///
9340    /// let builder = prepare_request_builder();
9341    /// let mut items = builder.by_item();
9342    /// while let Some(result) = items.next().await {
9343    ///   let item = result?;
9344    /// }
9345    /// # gax::Result::<()>::Ok(()) });
9346    ///
9347    /// fn prepare_request_builder() -> ListOperations {
9348    ///   # panic!();
9349    ///   // ... details omitted ...
9350    /// }
9351    /// ```
9352    #[derive(Clone, Debug)]
9353    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9354
9355    impl ListOperations {
9356        pub(crate) fn new(
9357            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9358        ) -> Self {
9359            Self(RequestBuilder::new(stub))
9360        }
9361
9362        /// Sets the full request, replacing any prior values.
9363        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9364            mut self,
9365            v: V,
9366        ) -> Self {
9367            self.0.request = v.into();
9368            self
9369        }
9370
9371        /// Sets all the options, replacing any prior values.
9372        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9373            self.0.options = v.into();
9374            self
9375        }
9376
9377        /// Sends the request.
9378        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9379            (*self.0.stub)
9380                .list_operations(self.0.request, self.0.options)
9381                .await
9382                .map(gax::response::Response::into_body)
9383        }
9384
9385        /// Streams each page in the collection.
9386        pub fn by_page(
9387            self,
9388        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9389        {
9390            use std::clone::Clone;
9391            let token = self.0.request.page_token.clone();
9392            let execute = move |token: String| {
9393                let mut builder = self.clone();
9394                builder.0.request = builder.0.request.set_page_token(token);
9395                builder.send()
9396            };
9397            gax::paginator::internal::new_paginator(token, execute)
9398        }
9399
9400        /// Streams each item in the collection.
9401        pub fn by_item(
9402            self,
9403        ) -> impl gax::paginator::ItemPaginator<
9404            longrunning::model::ListOperationsResponse,
9405            gax::error::Error,
9406        > {
9407            use gax::paginator::Paginator;
9408            self.by_page().items()
9409        }
9410
9411        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
9412        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9413            self.0.request.name = v.into();
9414            self
9415        }
9416
9417        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
9418        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9419            self.0.request.filter = v.into();
9420            self
9421        }
9422
9423        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
9424        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9425            self.0.request.page_size = v.into();
9426            self
9427        }
9428
9429        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
9430        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9431            self.0.request.page_token = v.into();
9432            self
9433        }
9434    }
9435
9436    #[doc(hidden)]
9437    impl gax::options::internal::RequestBuilder for ListOperations {
9438        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9439            &mut self.0.options
9440        }
9441    }
9442
9443    /// The request builder for [WorkflowTemplateService::get_operation][crate::client::WorkflowTemplateService::get_operation] calls.
9444    ///
9445    /// # Example
9446    /// ```no_run
9447    /// # use google_cloud_dataproc_v1::builder;
9448    /// use builder::workflow_template_service::GetOperation;
9449    /// # tokio_test::block_on(async {
9450    ///
9451    /// let builder = prepare_request_builder();
9452    /// let response = builder.send().await?;
9453    /// # gax::Result::<()>::Ok(()) });
9454    ///
9455    /// fn prepare_request_builder() -> GetOperation {
9456    ///   # panic!();
9457    ///   // ... details omitted ...
9458    /// }
9459    /// ```
9460    #[derive(Clone, Debug)]
9461    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9462
9463    impl GetOperation {
9464        pub(crate) fn new(
9465            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9466        ) -> Self {
9467            Self(RequestBuilder::new(stub))
9468        }
9469
9470        /// Sets the full request, replacing any prior values.
9471        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9472            mut self,
9473            v: V,
9474        ) -> Self {
9475            self.0.request = v.into();
9476            self
9477        }
9478
9479        /// Sets all the options, replacing any prior values.
9480        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9481            self.0.options = v.into();
9482            self
9483        }
9484
9485        /// Sends the request.
9486        pub async fn send(self) -> Result<longrunning::model::Operation> {
9487            (*self.0.stub)
9488                .get_operation(self.0.request, self.0.options)
9489                .await
9490                .map(gax::response::Response::into_body)
9491        }
9492
9493        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
9494        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9495            self.0.request.name = v.into();
9496            self
9497        }
9498    }
9499
9500    #[doc(hidden)]
9501    impl gax::options::internal::RequestBuilder for GetOperation {
9502        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9503            &mut self.0.options
9504        }
9505    }
9506
9507    /// The request builder for [WorkflowTemplateService::delete_operation][crate::client::WorkflowTemplateService::delete_operation] calls.
9508    ///
9509    /// # Example
9510    /// ```no_run
9511    /// # use google_cloud_dataproc_v1::builder;
9512    /// use builder::workflow_template_service::DeleteOperation;
9513    /// # tokio_test::block_on(async {
9514    ///
9515    /// let builder = prepare_request_builder();
9516    /// let response = builder.send().await?;
9517    /// # gax::Result::<()>::Ok(()) });
9518    ///
9519    /// fn prepare_request_builder() -> DeleteOperation {
9520    ///   # panic!();
9521    ///   // ... details omitted ...
9522    /// }
9523    /// ```
9524    #[derive(Clone, Debug)]
9525    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
9526
9527    impl DeleteOperation {
9528        pub(crate) fn new(
9529            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9530        ) -> Self {
9531            Self(RequestBuilder::new(stub))
9532        }
9533
9534        /// Sets the full request, replacing any prior values.
9535        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
9536            mut self,
9537            v: V,
9538        ) -> Self {
9539            self.0.request = v.into();
9540            self
9541        }
9542
9543        /// Sets all the options, replacing any prior values.
9544        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9545            self.0.options = v.into();
9546            self
9547        }
9548
9549        /// Sends the request.
9550        pub async fn send(self) -> Result<()> {
9551            (*self.0.stub)
9552                .delete_operation(self.0.request, self.0.options)
9553                .await
9554                .map(gax::response::Response::into_body)
9555        }
9556
9557        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
9558        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9559            self.0.request.name = v.into();
9560            self
9561        }
9562    }
9563
9564    #[doc(hidden)]
9565    impl gax::options::internal::RequestBuilder for DeleteOperation {
9566        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9567            &mut self.0.options
9568        }
9569    }
9570
9571    /// The request builder for [WorkflowTemplateService::cancel_operation][crate::client::WorkflowTemplateService::cancel_operation] calls.
9572    ///
9573    /// # Example
9574    /// ```no_run
9575    /// # use google_cloud_dataproc_v1::builder;
9576    /// use builder::workflow_template_service::CancelOperation;
9577    /// # tokio_test::block_on(async {
9578    ///
9579    /// let builder = prepare_request_builder();
9580    /// let response = builder.send().await?;
9581    /// # gax::Result::<()>::Ok(()) });
9582    ///
9583    /// fn prepare_request_builder() -> CancelOperation {
9584    ///   # panic!();
9585    ///   // ... details omitted ...
9586    /// }
9587    /// ```
9588    #[derive(Clone, Debug)]
9589    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9590
9591    impl CancelOperation {
9592        pub(crate) fn new(
9593            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9594        ) -> Self {
9595            Self(RequestBuilder::new(stub))
9596        }
9597
9598        /// Sets the full request, replacing any prior values.
9599        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9600            mut self,
9601            v: V,
9602        ) -> Self {
9603            self.0.request = v.into();
9604            self
9605        }
9606
9607        /// Sets all the options, replacing any prior values.
9608        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9609            self.0.options = v.into();
9610            self
9611        }
9612
9613        /// Sends the request.
9614        pub async fn send(self) -> Result<()> {
9615            (*self.0.stub)
9616                .cancel_operation(self.0.request, self.0.options)
9617                .await
9618                .map(gax::response::Response::into_body)
9619        }
9620
9621        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
9622        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9623            self.0.request.name = v.into();
9624            self
9625        }
9626    }
9627
9628    #[doc(hidden)]
9629    impl gax::options::internal::RequestBuilder for CancelOperation {
9630        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9631            &mut self.0.options
9632        }
9633    }
9634}