Skip to main content

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