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