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