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