Skip to main content

google_cloud_dataproc_v1/
client.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#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Dataproc API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = AutoscalingPolicyService::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_autoscaling_policies()
29///         .set_parent(parent)
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// The API interface for managing autoscaling policies in the
40/// Dataproc API.
41///
42/// # Configuration
43///
44/// To configure `AutoscalingPolicyService` use the `with_*` methods in the type returned
45/// by [builder()][AutoscalingPolicyService::builder]. The default configuration should
46/// work for most applications. Common configuration changes include
47///
48/// * [with_endpoint()]: by default this client uses the global default endpoint
49///   (`https://dataproc.googleapis.com`). Applications using regional
50///   endpoints or running in restricted networks (e.g. a network configured
51//    with [Private Google Access with VPC Service Controls]) may want to
52///   override this default.
53/// * [with_credentials()]: by default this client uses
54///   [Application Default Credentials]. Applications using custom
55///   authentication may need to override this default.
56///
57/// [with_endpoint()]: super::builder::autoscaling_policy_service::ClientBuilder::with_endpoint
58/// [with_credentials()]: super::builder::autoscaling_policy_service::ClientBuilder::with_credentials
59/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
60/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
61///
62/// # Pooling and Cloning
63///
64/// `AutoscalingPolicyService` holds a connection pool internally, it is advised to
65/// create one and reuse it. You do not need to wrap `AutoscalingPolicyService` in
66/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
67/// already uses an `Arc` internally.
68#[derive(Clone, Debug)]
69pub struct AutoscalingPolicyService {
70    inner: std::sync::Arc<dyn super::stub::dynamic::AutoscalingPolicyService>,
71}
72
73impl AutoscalingPolicyService {
74    /// Returns a builder for [AutoscalingPolicyService].
75    ///
76    /// ```
77    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
78    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
79    /// let client = AutoscalingPolicyService::builder().build().await?;
80    /// # Ok(()) }
81    /// ```
82    pub fn builder() -> super::builder::autoscaling_policy_service::ClientBuilder {
83        crate::new_client_builder(super::builder::autoscaling_policy_service::client::Factory)
84    }
85
86    /// Creates a new client from the provided stub.
87    ///
88    /// The most common case for calling this function is in tests mocking the
89    /// client's behavior.
90    pub fn from_stub<T>(stub: T) -> Self
91    where
92        T: super::stub::AutoscalingPolicyService + 'static,
93    {
94        Self {
95            inner: std::sync::Arc::new(stub),
96        }
97    }
98
99    pub(crate) async fn new(
100        config: gaxi::options::ClientConfig,
101    ) -> crate::ClientBuilderResult<Self> {
102        let inner = Self::build_inner(config).await?;
103        Ok(Self { inner })
104    }
105
106    async fn build_inner(
107        conf: gaxi::options::ClientConfig,
108    ) -> crate::ClientBuilderResult<
109        std::sync::Arc<dyn super::stub::dynamic::AutoscalingPolicyService>,
110    > {
111        if gaxi::options::tracing_enabled(&conf) {
112            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113        }
114        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115    }
116
117    async fn build_transport(
118        conf: gaxi::options::ClientConfig,
119    ) -> crate::ClientBuilderResult<impl super::stub::AutoscalingPolicyService> {
120        super::transport::AutoscalingPolicyService::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::AutoscalingPolicyService> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::AutoscalingPolicyService::new)
129    }
130
131    /// Creates new autoscaling policy.
132    ///
133    /// # Example
134    /// ```
135    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
136    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
137    /// use google_cloud_dataproc_v1::Result;
138    /// async fn sample(
139    ///    client: &AutoscalingPolicyService, parent: &str
140    /// ) -> Result<()> {
141    ///     let response = client.create_autoscaling_policy()
142    ///         .set_parent(parent)
143    ///         .set_policy(
144    ///             AutoscalingPolicy::new()/* set fields */
145    ///         )
146    ///         .send().await?;
147    ///     println!("response {:?}", response);
148    ///     Ok(())
149    /// }
150    /// ```
151    pub fn create_autoscaling_policy(
152        &self,
153    ) -> super::builder::autoscaling_policy_service::CreateAutoscalingPolicy {
154        super::builder::autoscaling_policy_service::CreateAutoscalingPolicy::new(self.inner.clone())
155    }
156
157    /// Updates (replaces) autoscaling policy.
158    ///
159    /// Disabled check for update_mask, because all updates will be full
160    /// replacements.
161    ///
162    /// # Example
163    /// ```
164    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
165    /// use google_cloud_dataproc_v1::model::AutoscalingPolicy;
166    /// use google_cloud_dataproc_v1::Result;
167    /// async fn sample(
168    ///    client: &AutoscalingPolicyService, name: &str
169    /// ) -> Result<()> {
170    ///     let response = client.update_autoscaling_policy()
171    ///         .set_policy(
172    ///             AutoscalingPolicy::new().set_name(name)/* set fields */
173    ///         )
174    ///         .send().await?;
175    ///     println!("response {:?}", response);
176    ///     Ok(())
177    /// }
178    /// ```
179    pub fn update_autoscaling_policy(
180        &self,
181    ) -> super::builder::autoscaling_policy_service::UpdateAutoscalingPolicy {
182        super::builder::autoscaling_policy_service::UpdateAutoscalingPolicy::new(self.inner.clone())
183    }
184
185    /// Retrieves autoscaling policy.
186    ///
187    /// # Example
188    /// ```
189    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
190    /// use google_cloud_dataproc_v1::Result;
191    /// async fn sample(
192    ///    client: &AutoscalingPolicyService, name: &str
193    /// ) -> Result<()> {
194    ///     let response = client.get_autoscaling_policy()
195    ///         .set_name(name)
196    ///         .send().await?;
197    ///     println!("response {:?}", response);
198    ///     Ok(())
199    /// }
200    /// ```
201    pub fn get_autoscaling_policy(
202        &self,
203    ) -> super::builder::autoscaling_policy_service::GetAutoscalingPolicy {
204        super::builder::autoscaling_policy_service::GetAutoscalingPolicy::new(self.inner.clone())
205    }
206
207    /// Lists autoscaling policies in the project.
208    ///
209    /// # Example
210    /// ```
211    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
212    /// use google_cloud_gax::paginator::ItemPaginator as _;
213    /// use google_cloud_dataproc_v1::Result;
214    /// async fn sample(
215    ///    client: &AutoscalingPolicyService, parent: &str
216    /// ) -> Result<()> {
217    ///     let mut list = client.list_autoscaling_policies()
218    ///         .set_parent(parent)
219    ///         .by_item();
220    ///     while let Some(item) = list.next().await.transpose()? {
221    ///         println!("{:?}", item);
222    ///     }
223    ///     Ok(())
224    /// }
225    /// ```
226    pub fn list_autoscaling_policies(
227        &self,
228    ) -> super::builder::autoscaling_policy_service::ListAutoscalingPolicies {
229        super::builder::autoscaling_policy_service::ListAutoscalingPolicies::new(self.inner.clone())
230    }
231
232    /// Deletes an autoscaling policy. It is an error to delete an autoscaling
233    /// policy that is in use by one or more clusters.
234    ///
235    /// # Example
236    /// ```
237    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
238    /// use google_cloud_dataproc_v1::Result;
239    /// async fn sample(
240    ///    client: &AutoscalingPolicyService, name: &str
241    /// ) -> Result<()> {
242    ///     client.delete_autoscaling_policy()
243    ///         .set_name(name)
244    ///         .send().await?;
245    ///     Ok(())
246    /// }
247    /// ```
248    pub fn delete_autoscaling_policy(
249        &self,
250    ) -> super::builder::autoscaling_policy_service::DeleteAutoscalingPolicy {
251        super::builder::autoscaling_policy_service::DeleteAutoscalingPolicy::new(self.inner.clone())
252    }
253
254    /// Sets the access control policy on the specified resource. Replaces
255    /// any existing policy.
256    ///
257    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
258    /// errors.
259    ///
260    /// # Example
261    /// ```
262    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
263    /// use google_cloud_dataproc_v1::Result;
264    /// async fn sample(
265    ///    client: &AutoscalingPolicyService
266    /// ) -> Result<()> {
267    ///     let response = client.set_iam_policy()
268    ///         /* set fields */
269    ///         .send().await?;
270    ///     println!("response {:?}", response);
271    ///     Ok(())
272    /// }
273    /// ```
274    pub fn set_iam_policy(&self) -> super::builder::autoscaling_policy_service::SetIamPolicy {
275        super::builder::autoscaling_policy_service::SetIamPolicy::new(self.inner.clone())
276    }
277
278    /// Gets the access control policy for a resource. Returns an empty policy
279    /// if the resource exists and does not have a policy set.
280    ///
281    /// # Example
282    /// ```
283    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
284    /// use google_cloud_dataproc_v1::Result;
285    /// async fn sample(
286    ///    client: &AutoscalingPolicyService
287    /// ) -> Result<()> {
288    ///     let response = client.get_iam_policy()
289    ///         /* set fields */
290    ///         .send().await?;
291    ///     println!("response {:?}", response);
292    ///     Ok(())
293    /// }
294    /// ```
295    pub fn get_iam_policy(&self) -> super::builder::autoscaling_policy_service::GetIamPolicy {
296        super::builder::autoscaling_policy_service::GetIamPolicy::new(self.inner.clone())
297    }
298
299    /// Returns permissions that a caller has on the specified resource. If the
300    /// resource does not exist, this will return an empty set of
301    /// permissions, not a `NOT_FOUND` error.
302    ///
303    /// Note: This operation is designed to be used for building
304    /// permission-aware UIs and command-line tools, not for authorization
305    /// checking. This operation may "fail open" without warning.
306    ///
307    /// # Example
308    /// ```
309    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
310    /// use google_cloud_dataproc_v1::Result;
311    /// async fn sample(
312    ///    client: &AutoscalingPolicyService
313    /// ) -> Result<()> {
314    ///     let response = client.test_iam_permissions()
315    ///         /* set fields */
316    ///         .send().await?;
317    ///     println!("response {:?}", response);
318    ///     Ok(())
319    /// }
320    /// ```
321    pub fn test_iam_permissions(
322        &self,
323    ) -> super::builder::autoscaling_policy_service::TestIamPermissions {
324        super::builder::autoscaling_policy_service::TestIamPermissions::new(self.inner.clone())
325    }
326
327    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
328    ///
329    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
330    ///
331    /// # Example
332    /// ```
333    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
334    /// use google_cloud_gax::paginator::ItemPaginator as _;
335    /// use google_cloud_dataproc_v1::Result;
336    /// async fn sample(
337    ///    client: &AutoscalingPolicyService
338    /// ) -> Result<()> {
339    ///     let mut list = client.list_operations()
340    ///         /* set fields */
341    ///         .by_item();
342    ///     while let Some(item) = list.next().await.transpose()? {
343    ///         println!("{:?}", item);
344    ///     }
345    ///     Ok(())
346    /// }
347    /// ```
348    pub fn list_operations(&self) -> super::builder::autoscaling_policy_service::ListOperations {
349        super::builder::autoscaling_policy_service::ListOperations::new(self.inner.clone())
350    }
351
352    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
353    ///
354    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
355    ///
356    /// # Example
357    /// ```
358    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
359    /// use google_cloud_dataproc_v1::Result;
360    /// async fn sample(
361    ///    client: &AutoscalingPolicyService
362    /// ) -> Result<()> {
363    ///     let response = client.get_operation()
364    ///         /* set fields */
365    ///         .send().await?;
366    ///     println!("response {:?}", response);
367    ///     Ok(())
368    /// }
369    /// ```
370    pub fn get_operation(&self) -> super::builder::autoscaling_policy_service::GetOperation {
371        super::builder::autoscaling_policy_service::GetOperation::new(self.inner.clone())
372    }
373
374    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
375    ///
376    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
377    ///
378    /// # Example
379    /// ```
380    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
381    /// use google_cloud_dataproc_v1::Result;
382    /// async fn sample(
383    ///    client: &AutoscalingPolicyService
384    /// ) -> Result<()> {
385    ///     client.delete_operation()
386    ///         /* set fields */
387    ///         .send().await?;
388    ///     Ok(())
389    /// }
390    /// ```
391    pub fn delete_operation(&self) -> super::builder::autoscaling_policy_service::DeleteOperation {
392        super::builder::autoscaling_policy_service::DeleteOperation::new(self.inner.clone())
393    }
394
395    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
396    ///
397    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
398    ///
399    /// # Example
400    /// ```
401    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
402    /// use google_cloud_dataproc_v1::Result;
403    /// async fn sample(
404    ///    client: &AutoscalingPolicyService
405    /// ) -> Result<()> {
406    ///     client.cancel_operation()
407    ///         /* set fields */
408    ///         .send().await?;
409    ///     Ok(())
410    /// }
411    /// ```
412    pub fn cancel_operation(&self) -> super::builder::autoscaling_policy_service::CancelOperation {
413        super::builder::autoscaling_policy_service::CancelOperation::new(self.inner.clone())
414    }
415}
416
417/// Implements a client for the Cloud Dataproc API.
418///
419/// # Example
420/// ```
421/// # use google_cloud_dataproc_v1::client::BatchController;
422/// use google_cloud_gax::paginator::ItemPaginator as _;
423/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
424///     let client = BatchController::builder().build().await?;
425///     let parent = "parent_value";
426///     let mut list = client.list_batches()
427///         .set_parent(parent)
428///         .by_item();
429///     while let Some(item) = list.next().await.transpose()? {
430///         println!("{:?}", item);
431///     }
432/// # Ok(()) }
433/// ```
434///
435/// # Service Description
436///
437/// The BatchController provides methods to manage batch workloads.
438///
439/// # Configuration
440///
441/// To configure `BatchController` use the `with_*` methods in the type returned
442/// by [builder()][BatchController::builder]. The default configuration should
443/// work for most applications. Common configuration changes include
444///
445/// * [with_endpoint()]: by default this client uses the global default endpoint
446///   (`https://dataproc.googleapis.com`). Applications using regional
447///   endpoints or running in restricted networks (e.g. a network configured
448//    with [Private Google Access with VPC Service Controls]) may want to
449///   override this default.
450/// * [with_credentials()]: by default this client uses
451///   [Application Default Credentials]. Applications using custom
452///   authentication may need to override this default.
453///
454/// [with_endpoint()]: super::builder::batch_controller::ClientBuilder::with_endpoint
455/// [with_credentials()]: super::builder::batch_controller::ClientBuilder::with_credentials
456/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
457/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
458///
459/// # Pooling and Cloning
460///
461/// `BatchController` holds a connection pool internally, it is advised to
462/// create one and reuse it. You do not need to wrap `BatchController` in
463/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
464/// already uses an `Arc` internally.
465#[derive(Clone, Debug)]
466pub struct BatchController {
467    inner: std::sync::Arc<dyn super::stub::dynamic::BatchController>,
468}
469
470impl BatchController {
471    /// Returns a builder for [BatchController].
472    ///
473    /// ```
474    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
475    /// # use google_cloud_dataproc_v1::client::BatchController;
476    /// let client = BatchController::builder().build().await?;
477    /// # Ok(()) }
478    /// ```
479    pub fn builder() -> super::builder::batch_controller::ClientBuilder {
480        crate::new_client_builder(super::builder::batch_controller::client::Factory)
481    }
482
483    /// Creates a new client from the provided stub.
484    ///
485    /// The most common case for calling this function is in tests mocking the
486    /// client's behavior.
487    pub fn from_stub<T>(stub: T) -> Self
488    where
489        T: super::stub::BatchController + 'static,
490    {
491        Self {
492            inner: std::sync::Arc::new(stub),
493        }
494    }
495
496    pub(crate) async fn new(
497        config: gaxi::options::ClientConfig,
498    ) -> crate::ClientBuilderResult<Self> {
499        let inner = Self::build_inner(config).await?;
500        Ok(Self { inner })
501    }
502
503    async fn build_inner(
504        conf: gaxi::options::ClientConfig,
505    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::BatchController>> {
506        if gaxi::options::tracing_enabled(&conf) {
507            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
508        }
509        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
510    }
511
512    async fn build_transport(
513        conf: gaxi::options::ClientConfig,
514    ) -> crate::ClientBuilderResult<impl super::stub::BatchController> {
515        super::transport::BatchController::new(conf).await
516    }
517
518    async fn build_with_tracing(
519        conf: gaxi::options::ClientConfig,
520    ) -> crate::ClientBuilderResult<impl super::stub::BatchController> {
521        Self::build_transport(conf)
522            .await
523            .map(super::tracing::BatchController::new)
524    }
525
526    /// Creates a batch workload that executes asynchronously.
527    ///
528    /// # Long running operations
529    ///
530    /// This method is used to start, and/or poll a [long-running Operation].
531    /// The [Working with long-running operations] chapter in the [user guide]
532    /// covers these operations in detail.
533    ///
534    /// [long-running operation]: https://google.aip.dev/151
535    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
536    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
537    ///
538    /// # Example
539    /// ```
540    /// # use google_cloud_dataproc_v1::client::BatchController;
541    /// use google_cloud_lro::Poller;
542    /// use google_cloud_dataproc_v1::model::Batch;
543    /// use google_cloud_dataproc_v1::Result;
544    /// async fn sample(
545    ///    client: &BatchController, parent: &str
546    /// ) -> Result<()> {
547    ///     let response = client.create_batch()
548    ///         .set_parent(parent)
549    ///         .set_batch_id("batch_id_value")
550    ///         .set_batch(
551    ///             Batch::new()/* set fields */
552    ///         )
553    ///         .poller().until_done().await?;
554    ///     println!("response {:?}", response);
555    ///     Ok(())
556    /// }
557    /// ```
558    pub fn create_batch(&self) -> super::builder::batch_controller::CreateBatch {
559        super::builder::batch_controller::CreateBatch::new(self.inner.clone())
560    }
561
562    /// Gets the batch workload resource representation.
563    ///
564    /// # Example
565    /// ```
566    /// # use google_cloud_dataproc_v1::client::BatchController;
567    /// use google_cloud_dataproc_v1::Result;
568    /// async fn sample(
569    ///    client: &BatchController, name: &str
570    /// ) -> Result<()> {
571    ///     let response = client.get_batch()
572    ///         .set_name(name)
573    ///         .send().await?;
574    ///     println!("response {:?}", response);
575    ///     Ok(())
576    /// }
577    /// ```
578    pub fn get_batch(&self) -> super::builder::batch_controller::GetBatch {
579        super::builder::batch_controller::GetBatch::new(self.inner.clone())
580    }
581
582    /// Lists batch workloads.
583    ///
584    /// # Example
585    /// ```
586    /// # use google_cloud_dataproc_v1::client::BatchController;
587    /// use google_cloud_gax::paginator::ItemPaginator as _;
588    /// use google_cloud_dataproc_v1::Result;
589    /// async fn sample(
590    ///    client: &BatchController, parent: &str
591    /// ) -> Result<()> {
592    ///     let mut list = client.list_batches()
593    ///         .set_parent(parent)
594    ///         .by_item();
595    ///     while let Some(item) = list.next().await.transpose()? {
596    ///         println!("{:?}", item);
597    ///     }
598    ///     Ok(())
599    /// }
600    /// ```
601    pub fn list_batches(&self) -> super::builder::batch_controller::ListBatches {
602        super::builder::batch_controller::ListBatches::new(self.inner.clone())
603    }
604
605    /// Deletes the batch workload resource. If the batch is not in terminal state,
606    /// the delete fails and the response returns `FAILED_PRECONDITION`.
607    ///
608    /// # Example
609    /// ```
610    /// # use google_cloud_dataproc_v1::client::BatchController;
611    /// use google_cloud_dataproc_v1::Result;
612    /// async fn sample(
613    ///    client: &BatchController, name: &str
614    /// ) -> Result<()> {
615    ///     client.delete_batch()
616    ///         .set_name(name)
617    ///         .send().await?;
618    ///     Ok(())
619    /// }
620    /// ```
621    pub fn delete_batch(&self) -> super::builder::batch_controller::DeleteBatch {
622        super::builder::batch_controller::DeleteBatch::new(self.inner.clone())
623    }
624
625    /// Sets the access control policy on the specified resource. Replaces
626    /// any existing policy.
627    ///
628    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
629    /// errors.
630    ///
631    /// # Example
632    /// ```
633    /// # use google_cloud_dataproc_v1::client::BatchController;
634    /// use google_cloud_dataproc_v1::Result;
635    /// async fn sample(
636    ///    client: &BatchController
637    /// ) -> Result<()> {
638    ///     let response = client.set_iam_policy()
639    ///         /* set fields */
640    ///         .send().await?;
641    ///     println!("response {:?}", response);
642    ///     Ok(())
643    /// }
644    /// ```
645    pub fn set_iam_policy(&self) -> super::builder::batch_controller::SetIamPolicy {
646        super::builder::batch_controller::SetIamPolicy::new(self.inner.clone())
647    }
648
649    /// Gets the access control policy for a resource. Returns an empty policy
650    /// if the resource exists and does not have a policy set.
651    ///
652    /// # Example
653    /// ```
654    /// # use google_cloud_dataproc_v1::client::BatchController;
655    /// use google_cloud_dataproc_v1::Result;
656    /// async fn sample(
657    ///    client: &BatchController
658    /// ) -> Result<()> {
659    ///     let response = client.get_iam_policy()
660    ///         /* set fields */
661    ///         .send().await?;
662    ///     println!("response {:?}", response);
663    ///     Ok(())
664    /// }
665    /// ```
666    pub fn get_iam_policy(&self) -> super::builder::batch_controller::GetIamPolicy {
667        super::builder::batch_controller::GetIamPolicy::new(self.inner.clone())
668    }
669
670    /// Returns permissions that a caller has on the specified resource. If the
671    /// resource does not exist, this will return an empty set of
672    /// permissions, not a `NOT_FOUND` error.
673    ///
674    /// Note: This operation is designed to be used for building
675    /// permission-aware UIs and command-line tools, not for authorization
676    /// checking. This operation may "fail open" without warning.
677    ///
678    /// # Example
679    /// ```
680    /// # use google_cloud_dataproc_v1::client::BatchController;
681    /// use google_cloud_dataproc_v1::Result;
682    /// async fn sample(
683    ///    client: &BatchController
684    /// ) -> Result<()> {
685    ///     let response = client.test_iam_permissions()
686    ///         /* set fields */
687    ///         .send().await?;
688    ///     println!("response {:?}", response);
689    ///     Ok(())
690    /// }
691    /// ```
692    pub fn test_iam_permissions(&self) -> super::builder::batch_controller::TestIamPermissions {
693        super::builder::batch_controller::TestIamPermissions::new(self.inner.clone())
694    }
695
696    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
697    ///
698    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
699    ///
700    /// # Example
701    /// ```
702    /// # use google_cloud_dataproc_v1::client::BatchController;
703    /// use google_cloud_gax::paginator::ItemPaginator as _;
704    /// use google_cloud_dataproc_v1::Result;
705    /// async fn sample(
706    ///    client: &BatchController
707    /// ) -> Result<()> {
708    ///     let mut list = client.list_operations()
709    ///         /* set fields */
710    ///         .by_item();
711    ///     while let Some(item) = list.next().await.transpose()? {
712    ///         println!("{:?}", item);
713    ///     }
714    ///     Ok(())
715    /// }
716    /// ```
717    pub fn list_operations(&self) -> super::builder::batch_controller::ListOperations {
718        super::builder::batch_controller::ListOperations::new(self.inner.clone())
719    }
720
721    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
722    ///
723    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
724    ///
725    /// # Example
726    /// ```
727    /// # use google_cloud_dataproc_v1::client::BatchController;
728    /// use google_cloud_dataproc_v1::Result;
729    /// async fn sample(
730    ///    client: &BatchController
731    /// ) -> Result<()> {
732    ///     let response = client.get_operation()
733    ///         /* set fields */
734    ///         .send().await?;
735    ///     println!("response {:?}", response);
736    ///     Ok(())
737    /// }
738    /// ```
739    pub fn get_operation(&self) -> super::builder::batch_controller::GetOperation {
740        super::builder::batch_controller::GetOperation::new(self.inner.clone())
741    }
742
743    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
744    ///
745    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
746    ///
747    /// # Example
748    /// ```
749    /// # use google_cloud_dataproc_v1::client::BatchController;
750    /// use google_cloud_dataproc_v1::Result;
751    /// async fn sample(
752    ///    client: &BatchController
753    /// ) -> Result<()> {
754    ///     client.delete_operation()
755    ///         /* set fields */
756    ///         .send().await?;
757    ///     Ok(())
758    /// }
759    /// ```
760    pub fn delete_operation(&self) -> super::builder::batch_controller::DeleteOperation {
761        super::builder::batch_controller::DeleteOperation::new(self.inner.clone())
762    }
763
764    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
765    ///
766    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
767    ///
768    /// # Example
769    /// ```
770    /// # use google_cloud_dataproc_v1::client::BatchController;
771    /// use google_cloud_dataproc_v1::Result;
772    /// async fn sample(
773    ///    client: &BatchController
774    /// ) -> Result<()> {
775    ///     client.cancel_operation()
776    ///         /* set fields */
777    ///         .send().await?;
778    ///     Ok(())
779    /// }
780    /// ```
781    pub fn cancel_operation(&self) -> super::builder::batch_controller::CancelOperation {
782        super::builder::batch_controller::CancelOperation::new(self.inner.clone())
783    }
784}
785
786/// Implements a client for the Cloud Dataproc API.
787///
788/// # Example
789/// ```
790/// # use google_cloud_dataproc_v1::client::ClusterController;
791/// use google_cloud_lro::Poller;
792/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
793///     let client = ClusterController::builder().build().await?;
794///     let response = client.create_cluster()
795///         /* set fields */
796///         .poller().until_done().await?;
797///     println!("response {:?}", response);
798/// # Ok(()) }
799/// ```
800///
801/// # Service Description
802///
803/// The ClusterControllerService provides methods to manage clusters
804/// of Compute Engine instances.
805///
806/// # Configuration
807///
808/// To configure `ClusterController` use the `with_*` methods in the type returned
809/// by [builder()][ClusterController::builder]. The default configuration should
810/// work for most applications. Common configuration changes include
811///
812/// * [with_endpoint()]: by default this client uses the global default endpoint
813///   (`https://dataproc.googleapis.com`). Applications using regional
814///   endpoints or running in restricted networks (e.g. a network configured
815//    with [Private Google Access with VPC Service Controls]) may want to
816///   override this default.
817/// * [with_credentials()]: by default this client uses
818///   [Application Default Credentials]. Applications using custom
819///   authentication may need to override this default.
820///
821/// [with_endpoint()]: super::builder::cluster_controller::ClientBuilder::with_endpoint
822/// [with_credentials()]: super::builder::cluster_controller::ClientBuilder::with_credentials
823/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
824/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
825///
826/// # Pooling and Cloning
827///
828/// `ClusterController` holds a connection pool internally, it is advised to
829/// create one and reuse it. You do not need to wrap `ClusterController` in
830/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
831/// already uses an `Arc` internally.
832#[derive(Clone, Debug)]
833pub struct ClusterController {
834    inner: std::sync::Arc<dyn super::stub::dynamic::ClusterController>,
835}
836
837impl ClusterController {
838    /// Returns a builder for [ClusterController].
839    ///
840    /// ```
841    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
842    /// # use google_cloud_dataproc_v1::client::ClusterController;
843    /// let client = ClusterController::builder().build().await?;
844    /// # Ok(()) }
845    /// ```
846    pub fn builder() -> super::builder::cluster_controller::ClientBuilder {
847        crate::new_client_builder(super::builder::cluster_controller::client::Factory)
848    }
849
850    /// Creates a new client from the provided stub.
851    ///
852    /// The most common case for calling this function is in tests mocking the
853    /// client's behavior.
854    pub fn from_stub<T>(stub: T) -> Self
855    where
856        T: super::stub::ClusterController + 'static,
857    {
858        Self {
859            inner: std::sync::Arc::new(stub),
860        }
861    }
862
863    pub(crate) async fn new(
864        config: gaxi::options::ClientConfig,
865    ) -> crate::ClientBuilderResult<Self> {
866        let inner = Self::build_inner(config).await?;
867        Ok(Self { inner })
868    }
869
870    async fn build_inner(
871        conf: gaxi::options::ClientConfig,
872    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ClusterController>>
873    {
874        if gaxi::options::tracing_enabled(&conf) {
875            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
876        }
877        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
878    }
879
880    async fn build_transport(
881        conf: gaxi::options::ClientConfig,
882    ) -> crate::ClientBuilderResult<impl super::stub::ClusterController> {
883        super::transport::ClusterController::new(conf).await
884    }
885
886    async fn build_with_tracing(
887        conf: gaxi::options::ClientConfig,
888    ) -> crate::ClientBuilderResult<impl super::stub::ClusterController> {
889        Self::build_transport(conf)
890            .await
891            .map(super::tracing::ClusterController::new)
892    }
893
894    /// Creates a cluster in a project. The returned
895    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
896    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
897    ///
898    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
899    ///
900    /// # Long running operations
901    ///
902    /// This method is used to start, and/or poll a [long-running Operation].
903    /// The [Working with long-running operations] chapter in the [user guide]
904    /// covers these operations in detail.
905    ///
906    /// [long-running operation]: https://google.aip.dev/151
907    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
908    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
909    ///
910    /// # Example
911    /// ```
912    /// # use google_cloud_dataproc_v1::client::ClusterController;
913    /// use google_cloud_lro::Poller;
914    /// use google_cloud_dataproc_v1::Result;
915    /// async fn sample(
916    ///    client: &ClusterController
917    /// ) -> Result<()> {
918    ///     let response = client.create_cluster()
919    ///         /* set fields */
920    ///         .poller().until_done().await?;
921    ///     println!("response {:?}", response);
922    ///     Ok(())
923    /// }
924    /// ```
925    pub fn create_cluster(&self) -> super::builder::cluster_controller::CreateCluster {
926        super::builder::cluster_controller::CreateCluster::new(self.inner.clone())
927    }
928
929    /// Updates a cluster in a project. The returned
930    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
931    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
932    /// The cluster must be in a
933    /// [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error
934    /// is returned.
935    ///
936    /// [google.cloud.dataproc.v1.ClusterStatus.State]: crate::model::cluster_status::State
937    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
938    ///
939    /// # Long running operations
940    ///
941    /// This method is used to start, and/or poll a [long-running Operation].
942    /// The [Working with long-running operations] chapter in the [user guide]
943    /// covers these operations in detail.
944    ///
945    /// [long-running operation]: https://google.aip.dev/151
946    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
947    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
948    ///
949    /// # Example
950    /// ```
951    /// # use google_cloud_dataproc_v1::client::ClusterController;
952    /// use google_cloud_lro::Poller;
953    /// use google_cloud_dataproc_v1::Result;
954    /// async fn sample(
955    ///    client: &ClusterController
956    /// ) -> Result<()> {
957    ///     let response = client.update_cluster()
958    ///         /* set fields */
959    ///         .poller().until_done().await?;
960    ///     println!("response {:?}", response);
961    ///     Ok(())
962    /// }
963    /// ```
964    pub fn update_cluster(&self) -> super::builder::cluster_controller::UpdateCluster {
965        super::builder::cluster_controller::UpdateCluster::new(self.inner.clone())
966    }
967
968    /// Stops a cluster in a project.
969    ///
970    /// # Long running operations
971    ///
972    /// This method is used to start, and/or poll a [long-running Operation].
973    /// The [Working with long-running operations] chapter in the [user guide]
974    /// covers these operations in detail.
975    ///
976    /// [long-running operation]: https://google.aip.dev/151
977    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
978    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
979    ///
980    /// # Example
981    /// ```
982    /// # use google_cloud_dataproc_v1::client::ClusterController;
983    /// use google_cloud_lro::Poller;
984    /// use google_cloud_dataproc_v1::Result;
985    /// async fn sample(
986    ///    client: &ClusterController
987    /// ) -> Result<()> {
988    ///     let response = client.stop_cluster()
989    ///         /* set fields */
990    ///         .poller().until_done().await?;
991    ///     println!("response {:?}", response);
992    ///     Ok(())
993    /// }
994    /// ```
995    pub fn stop_cluster(&self) -> super::builder::cluster_controller::StopCluster {
996        super::builder::cluster_controller::StopCluster::new(self.inner.clone())
997    }
998
999    /// Starts a cluster in a project.
1000    ///
1001    /// # Long running operations
1002    ///
1003    /// This method is used to start, and/or poll a [long-running Operation].
1004    /// The [Working with long-running operations] chapter in the [user guide]
1005    /// covers these operations in detail.
1006    ///
1007    /// [long-running operation]: https://google.aip.dev/151
1008    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1009    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1010    ///
1011    /// # Example
1012    /// ```
1013    /// # use google_cloud_dataproc_v1::client::ClusterController;
1014    /// use google_cloud_lro::Poller;
1015    /// use google_cloud_dataproc_v1::Result;
1016    /// async fn sample(
1017    ///    client: &ClusterController
1018    /// ) -> Result<()> {
1019    ///     let response = client.start_cluster()
1020    ///         /* set fields */
1021    ///         .poller().until_done().await?;
1022    ///     println!("response {:?}", response);
1023    ///     Ok(())
1024    /// }
1025    /// ```
1026    pub fn start_cluster(&self) -> super::builder::cluster_controller::StartCluster {
1027        super::builder::cluster_controller::StartCluster::new(self.inner.clone())
1028    }
1029
1030    /// Deletes a cluster in a project. The returned
1031    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
1032    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
1033    ///
1034    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1035    ///
1036    /// # Long running operations
1037    ///
1038    /// This method is used to start, and/or poll a [long-running Operation].
1039    /// The [Working with long-running operations] chapter in the [user guide]
1040    /// covers these operations in detail.
1041    ///
1042    /// [long-running operation]: https://google.aip.dev/151
1043    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1044    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1045    ///
1046    /// # Example
1047    /// ```
1048    /// # use google_cloud_dataproc_v1::client::ClusterController;
1049    /// use google_cloud_lro::Poller;
1050    /// use google_cloud_dataproc_v1::Result;
1051    /// async fn sample(
1052    ///    client: &ClusterController
1053    /// ) -> Result<()> {
1054    ///     client.delete_cluster()
1055    ///         /* set fields */
1056    ///         .poller().until_done().await?;
1057    ///     Ok(())
1058    /// }
1059    /// ```
1060    pub fn delete_cluster(&self) -> super::builder::cluster_controller::DeleteCluster {
1061        super::builder::cluster_controller::DeleteCluster::new(self.inner.clone())
1062    }
1063
1064    /// Gets the resource representation for a cluster in a project.
1065    ///
1066    /// # Example
1067    /// ```
1068    /// # use google_cloud_dataproc_v1::client::ClusterController;
1069    /// use google_cloud_dataproc_v1::Result;
1070    /// async fn sample(
1071    ///    client: &ClusterController
1072    /// ) -> Result<()> {
1073    ///     let response = client.get_cluster()
1074    ///         /* set fields */
1075    ///         .send().await?;
1076    ///     println!("response {:?}", response);
1077    ///     Ok(())
1078    /// }
1079    /// ```
1080    pub fn get_cluster(&self) -> super::builder::cluster_controller::GetCluster {
1081        super::builder::cluster_controller::GetCluster::new(self.inner.clone())
1082    }
1083
1084    /// Lists all regions/{region}/clusters in a project alphabetically.
1085    ///
1086    /// # Example
1087    /// ```
1088    /// # use google_cloud_dataproc_v1::client::ClusterController;
1089    /// use google_cloud_gax::paginator::ItemPaginator as _;
1090    /// use google_cloud_dataproc_v1::Result;
1091    /// async fn sample(
1092    ///    client: &ClusterController
1093    /// ) -> Result<()> {
1094    ///     let mut list = client.list_clusters()
1095    ///         /* set fields */
1096    ///         .by_item();
1097    ///     while let Some(item) = list.next().await.transpose()? {
1098    ///         println!("{:?}", item);
1099    ///     }
1100    ///     Ok(())
1101    /// }
1102    /// ```
1103    pub fn list_clusters(&self) -> super::builder::cluster_controller::ListClusters {
1104        super::builder::cluster_controller::ListClusters::new(self.inner.clone())
1105    }
1106
1107    /// Gets cluster diagnostic information. The returned
1108    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
1109    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
1110    /// After the operation completes,
1111    /// [Operation.response][google.longrunning.Operation.response]
1112    /// contains
1113    /// [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
1114    ///
1115    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1116    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
1117    ///
1118    /// # Long running operations
1119    ///
1120    /// This method is used to start, and/or poll a [long-running Operation].
1121    /// The [Working with long-running operations] chapter in the [user guide]
1122    /// covers these operations in detail.
1123    ///
1124    /// [long-running operation]: https://google.aip.dev/151
1125    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1126    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1127    ///
1128    /// # Example
1129    /// ```
1130    /// # use google_cloud_dataproc_v1::client::ClusterController;
1131    /// use google_cloud_lro::Poller;
1132    /// use google_cloud_dataproc_v1::Result;
1133    /// async fn sample(
1134    ///    client: &ClusterController
1135    /// ) -> Result<()> {
1136    ///     let response = client.diagnose_cluster()
1137    ///         /* set fields */
1138    ///         .poller().until_done().await?;
1139    ///     println!("response {:?}", response);
1140    ///     Ok(())
1141    /// }
1142    /// ```
1143    pub fn diagnose_cluster(&self) -> super::builder::cluster_controller::DiagnoseCluster {
1144        super::builder::cluster_controller::DiagnoseCluster::new(self.inner.clone())
1145    }
1146
1147    /// Sets the access control policy on the specified resource. Replaces
1148    /// any existing policy.
1149    ///
1150    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1151    /// errors.
1152    ///
1153    /// # Example
1154    /// ```
1155    /// # use google_cloud_dataproc_v1::client::ClusterController;
1156    /// use google_cloud_dataproc_v1::Result;
1157    /// async fn sample(
1158    ///    client: &ClusterController
1159    /// ) -> Result<()> {
1160    ///     let response = client.set_iam_policy()
1161    ///         /* set fields */
1162    ///         .send().await?;
1163    ///     println!("response {:?}", response);
1164    ///     Ok(())
1165    /// }
1166    /// ```
1167    pub fn set_iam_policy(&self) -> super::builder::cluster_controller::SetIamPolicy {
1168        super::builder::cluster_controller::SetIamPolicy::new(self.inner.clone())
1169    }
1170
1171    /// Gets the access control policy for a resource. Returns an empty policy
1172    /// if the resource exists and does not have a policy set.
1173    ///
1174    /// # Example
1175    /// ```
1176    /// # use google_cloud_dataproc_v1::client::ClusterController;
1177    /// use google_cloud_dataproc_v1::Result;
1178    /// async fn sample(
1179    ///    client: &ClusterController
1180    /// ) -> Result<()> {
1181    ///     let response = client.get_iam_policy()
1182    ///         /* set fields */
1183    ///         .send().await?;
1184    ///     println!("response {:?}", response);
1185    ///     Ok(())
1186    /// }
1187    /// ```
1188    pub fn get_iam_policy(&self) -> super::builder::cluster_controller::GetIamPolicy {
1189        super::builder::cluster_controller::GetIamPolicy::new(self.inner.clone())
1190    }
1191
1192    /// Returns permissions that a caller has on the specified resource. If the
1193    /// resource does not exist, this will return an empty set of
1194    /// permissions, not a `NOT_FOUND` error.
1195    ///
1196    /// Note: This operation is designed to be used for building
1197    /// permission-aware UIs and command-line tools, not for authorization
1198    /// checking. This operation may "fail open" without warning.
1199    ///
1200    /// # Example
1201    /// ```
1202    /// # use google_cloud_dataproc_v1::client::ClusterController;
1203    /// use google_cloud_dataproc_v1::Result;
1204    /// async fn sample(
1205    ///    client: &ClusterController
1206    /// ) -> Result<()> {
1207    ///     let response = client.test_iam_permissions()
1208    ///         /* set fields */
1209    ///         .send().await?;
1210    ///     println!("response {:?}", response);
1211    ///     Ok(())
1212    /// }
1213    /// ```
1214    pub fn test_iam_permissions(&self) -> super::builder::cluster_controller::TestIamPermissions {
1215        super::builder::cluster_controller::TestIamPermissions::new(self.inner.clone())
1216    }
1217
1218    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1219    ///
1220    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1221    ///
1222    /// # Example
1223    /// ```
1224    /// # use google_cloud_dataproc_v1::client::ClusterController;
1225    /// use google_cloud_gax::paginator::ItemPaginator as _;
1226    /// use google_cloud_dataproc_v1::Result;
1227    /// async fn sample(
1228    ///    client: &ClusterController
1229    /// ) -> Result<()> {
1230    ///     let mut list = client.list_operations()
1231    ///         /* set fields */
1232    ///         .by_item();
1233    ///     while let Some(item) = list.next().await.transpose()? {
1234    ///         println!("{:?}", item);
1235    ///     }
1236    ///     Ok(())
1237    /// }
1238    /// ```
1239    pub fn list_operations(&self) -> super::builder::cluster_controller::ListOperations {
1240        super::builder::cluster_controller::ListOperations::new(self.inner.clone())
1241    }
1242
1243    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1244    ///
1245    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1246    ///
1247    /// # Example
1248    /// ```
1249    /// # use google_cloud_dataproc_v1::client::ClusterController;
1250    /// use google_cloud_dataproc_v1::Result;
1251    /// async fn sample(
1252    ///    client: &ClusterController
1253    /// ) -> Result<()> {
1254    ///     let response = client.get_operation()
1255    ///         /* set fields */
1256    ///         .send().await?;
1257    ///     println!("response {:?}", response);
1258    ///     Ok(())
1259    /// }
1260    /// ```
1261    pub fn get_operation(&self) -> super::builder::cluster_controller::GetOperation {
1262        super::builder::cluster_controller::GetOperation::new(self.inner.clone())
1263    }
1264
1265    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1266    ///
1267    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1268    ///
1269    /// # Example
1270    /// ```
1271    /// # use google_cloud_dataproc_v1::client::ClusterController;
1272    /// use google_cloud_dataproc_v1::Result;
1273    /// async fn sample(
1274    ///    client: &ClusterController
1275    /// ) -> Result<()> {
1276    ///     client.delete_operation()
1277    ///         /* set fields */
1278    ///         .send().await?;
1279    ///     Ok(())
1280    /// }
1281    /// ```
1282    pub fn delete_operation(&self) -> super::builder::cluster_controller::DeleteOperation {
1283        super::builder::cluster_controller::DeleteOperation::new(self.inner.clone())
1284    }
1285
1286    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1287    ///
1288    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1289    ///
1290    /// # Example
1291    /// ```
1292    /// # use google_cloud_dataproc_v1::client::ClusterController;
1293    /// use google_cloud_dataproc_v1::Result;
1294    /// async fn sample(
1295    ///    client: &ClusterController
1296    /// ) -> Result<()> {
1297    ///     client.cancel_operation()
1298    ///         /* set fields */
1299    ///         .send().await?;
1300    ///     Ok(())
1301    /// }
1302    /// ```
1303    pub fn cancel_operation(&self) -> super::builder::cluster_controller::CancelOperation {
1304        super::builder::cluster_controller::CancelOperation::new(self.inner.clone())
1305    }
1306}
1307
1308/// Implements a client for the Cloud Dataproc API.
1309///
1310/// # Example
1311/// ```
1312/// # use google_cloud_dataproc_v1::client::JobController;
1313/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1314///     let client = JobController::builder().build().await?;
1315///     let response = client.submit_job()
1316///         /* set fields */
1317///         .send().await?;
1318///     println!("response {:?}", response);
1319/// # Ok(()) }
1320/// ```
1321///
1322/// # Service Description
1323///
1324/// The JobController provides methods to manage jobs.
1325///
1326/// # Configuration
1327///
1328/// To configure `JobController` use the `with_*` methods in the type returned
1329/// by [builder()][JobController::builder]. The default configuration should
1330/// work for most applications. Common configuration changes include
1331///
1332/// * [with_endpoint()]: by default this client uses the global default endpoint
1333///   (`https://dataproc.googleapis.com`). Applications using regional
1334///   endpoints or running in restricted networks (e.g. a network configured
1335//    with [Private Google Access with VPC Service Controls]) may want to
1336///   override this default.
1337/// * [with_credentials()]: by default this client uses
1338///   [Application Default Credentials]. Applications using custom
1339///   authentication may need to override this default.
1340///
1341/// [with_endpoint()]: super::builder::job_controller::ClientBuilder::with_endpoint
1342/// [with_credentials()]: super::builder::job_controller::ClientBuilder::with_credentials
1343/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1344/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1345///
1346/// # Pooling and Cloning
1347///
1348/// `JobController` holds a connection pool internally, it is advised to
1349/// create one and reuse it. You do not need to wrap `JobController` in
1350/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1351/// already uses an `Arc` internally.
1352#[derive(Clone, Debug)]
1353pub struct JobController {
1354    inner: std::sync::Arc<dyn super::stub::dynamic::JobController>,
1355}
1356
1357impl JobController {
1358    /// Returns a builder for [JobController].
1359    ///
1360    /// ```
1361    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1362    /// # use google_cloud_dataproc_v1::client::JobController;
1363    /// let client = JobController::builder().build().await?;
1364    /// # Ok(()) }
1365    /// ```
1366    pub fn builder() -> super::builder::job_controller::ClientBuilder {
1367        crate::new_client_builder(super::builder::job_controller::client::Factory)
1368    }
1369
1370    /// Creates a new client from the provided stub.
1371    ///
1372    /// The most common case for calling this function is in tests mocking the
1373    /// client's behavior.
1374    pub fn from_stub<T>(stub: T) -> Self
1375    where
1376        T: super::stub::JobController + 'static,
1377    {
1378        Self {
1379            inner: std::sync::Arc::new(stub),
1380        }
1381    }
1382
1383    pub(crate) async fn new(
1384        config: gaxi::options::ClientConfig,
1385    ) -> crate::ClientBuilderResult<Self> {
1386        let inner = Self::build_inner(config).await?;
1387        Ok(Self { inner })
1388    }
1389
1390    async fn build_inner(
1391        conf: gaxi::options::ClientConfig,
1392    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::JobController>> {
1393        if gaxi::options::tracing_enabled(&conf) {
1394            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1395        }
1396        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1397    }
1398
1399    async fn build_transport(
1400        conf: gaxi::options::ClientConfig,
1401    ) -> crate::ClientBuilderResult<impl super::stub::JobController> {
1402        super::transport::JobController::new(conf).await
1403    }
1404
1405    async fn build_with_tracing(
1406        conf: gaxi::options::ClientConfig,
1407    ) -> crate::ClientBuilderResult<impl super::stub::JobController> {
1408        Self::build_transport(conf)
1409            .await
1410            .map(super::tracing::JobController::new)
1411    }
1412
1413    /// Submits a job to a cluster.
1414    ///
1415    /// # Example
1416    /// ```
1417    /// # use google_cloud_dataproc_v1::client::JobController;
1418    /// use google_cloud_dataproc_v1::Result;
1419    /// async fn sample(
1420    ///    client: &JobController
1421    /// ) -> Result<()> {
1422    ///     let response = client.submit_job()
1423    ///         /* set fields */
1424    ///         .send().await?;
1425    ///     println!("response {:?}", response);
1426    ///     Ok(())
1427    /// }
1428    /// ```
1429    pub fn submit_job(&self) -> super::builder::job_controller::SubmitJob {
1430        super::builder::job_controller::SubmitJob::new(self.inner.clone())
1431    }
1432
1433    /// Submits job to a cluster.
1434    ///
1435    /// # Long running operations
1436    ///
1437    /// This method is used to start, and/or poll a [long-running Operation].
1438    /// The [Working with long-running operations] chapter in the [user guide]
1439    /// covers these operations in detail.
1440    ///
1441    /// [long-running operation]: https://google.aip.dev/151
1442    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1443    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1444    ///
1445    /// # Example
1446    /// ```
1447    /// # use google_cloud_dataproc_v1::client::JobController;
1448    /// use google_cloud_lro::Poller;
1449    /// use google_cloud_dataproc_v1::Result;
1450    /// async fn sample(
1451    ///    client: &JobController
1452    /// ) -> Result<()> {
1453    ///     let response = client.submit_job_as_operation()
1454    ///         /* set fields */
1455    ///         .poller().until_done().await?;
1456    ///     println!("response {:?}", response);
1457    ///     Ok(())
1458    /// }
1459    /// ```
1460    pub fn submit_job_as_operation(&self) -> super::builder::job_controller::SubmitJobAsOperation {
1461        super::builder::job_controller::SubmitJobAsOperation::new(self.inner.clone())
1462    }
1463
1464    /// Gets the resource representation for a job in a project.
1465    ///
1466    /// # Example
1467    /// ```
1468    /// # use google_cloud_dataproc_v1::client::JobController;
1469    /// use google_cloud_dataproc_v1::Result;
1470    /// async fn sample(
1471    ///    client: &JobController
1472    /// ) -> Result<()> {
1473    ///     let response = client.get_job()
1474    ///         /* set fields */
1475    ///         .send().await?;
1476    ///     println!("response {:?}", response);
1477    ///     Ok(())
1478    /// }
1479    /// ```
1480    pub fn get_job(&self) -> super::builder::job_controller::GetJob {
1481        super::builder::job_controller::GetJob::new(self.inner.clone())
1482    }
1483
1484    /// Lists regions/{region}/jobs in a project.
1485    ///
1486    /// # Example
1487    /// ```
1488    /// # use google_cloud_dataproc_v1::client::JobController;
1489    /// use google_cloud_gax::paginator::ItemPaginator as _;
1490    /// use google_cloud_dataproc_v1::Result;
1491    /// async fn sample(
1492    ///    client: &JobController
1493    /// ) -> Result<()> {
1494    ///     let mut list = client.list_jobs()
1495    ///         /* set fields */
1496    ///         .by_item();
1497    ///     while let Some(item) = list.next().await.transpose()? {
1498    ///         println!("{:?}", item);
1499    ///     }
1500    ///     Ok(())
1501    /// }
1502    /// ```
1503    pub fn list_jobs(&self) -> super::builder::job_controller::ListJobs {
1504        super::builder::job_controller::ListJobs::new(self.inner.clone())
1505    }
1506
1507    /// Updates a job in a project.
1508    ///
1509    /// # Example
1510    /// ```
1511    /// # use google_cloud_dataproc_v1::client::JobController;
1512    /// use google_cloud_dataproc_v1::Result;
1513    /// async fn sample(
1514    ///    client: &JobController
1515    /// ) -> Result<()> {
1516    ///     let response = client.update_job()
1517    ///         /* set fields */
1518    ///         .send().await?;
1519    ///     println!("response {:?}", response);
1520    ///     Ok(())
1521    /// }
1522    /// ```
1523    pub fn update_job(&self) -> super::builder::job_controller::UpdateJob {
1524        super::builder::job_controller::UpdateJob::new(self.inner.clone())
1525    }
1526
1527    /// Starts a job cancellation request. To access the job resource
1528    /// after cancellation, call
1529    /// [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list)
1530    /// or
1531    /// [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).
1532    ///
1533    /// # Example
1534    /// ```
1535    /// # use google_cloud_dataproc_v1::client::JobController;
1536    /// use google_cloud_dataproc_v1::Result;
1537    /// async fn sample(
1538    ///    client: &JobController
1539    /// ) -> Result<()> {
1540    ///     let response = client.cancel_job()
1541    ///         /* set fields */
1542    ///         .send().await?;
1543    ///     println!("response {:?}", response);
1544    ///     Ok(())
1545    /// }
1546    /// ```
1547    pub fn cancel_job(&self) -> super::builder::job_controller::CancelJob {
1548        super::builder::job_controller::CancelJob::new(self.inner.clone())
1549    }
1550
1551    /// Deletes the job from the project. If the job is active, the delete fails,
1552    /// and the response returns `FAILED_PRECONDITION`.
1553    ///
1554    /// # Example
1555    /// ```
1556    /// # use google_cloud_dataproc_v1::client::JobController;
1557    /// use google_cloud_dataproc_v1::Result;
1558    /// async fn sample(
1559    ///    client: &JobController
1560    /// ) -> Result<()> {
1561    ///     client.delete_job()
1562    ///         /* set fields */
1563    ///         .send().await?;
1564    ///     Ok(())
1565    /// }
1566    /// ```
1567    pub fn delete_job(&self) -> super::builder::job_controller::DeleteJob {
1568        super::builder::job_controller::DeleteJob::new(self.inner.clone())
1569    }
1570
1571    /// Sets the access control policy on the specified resource. Replaces
1572    /// any existing policy.
1573    ///
1574    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1575    /// errors.
1576    ///
1577    /// # Example
1578    /// ```
1579    /// # use google_cloud_dataproc_v1::client::JobController;
1580    /// use google_cloud_dataproc_v1::Result;
1581    /// async fn sample(
1582    ///    client: &JobController
1583    /// ) -> Result<()> {
1584    ///     let response = client.set_iam_policy()
1585    ///         /* set fields */
1586    ///         .send().await?;
1587    ///     println!("response {:?}", response);
1588    ///     Ok(())
1589    /// }
1590    /// ```
1591    pub fn set_iam_policy(&self) -> super::builder::job_controller::SetIamPolicy {
1592        super::builder::job_controller::SetIamPolicy::new(self.inner.clone())
1593    }
1594
1595    /// Gets the access control policy for a resource. Returns an empty policy
1596    /// if the resource exists and does not have a policy set.
1597    ///
1598    /// # Example
1599    /// ```
1600    /// # use google_cloud_dataproc_v1::client::JobController;
1601    /// use google_cloud_dataproc_v1::Result;
1602    /// async fn sample(
1603    ///    client: &JobController
1604    /// ) -> Result<()> {
1605    ///     let response = client.get_iam_policy()
1606    ///         /* set fields */
1607    ///         .send().await?;
1608    ///     println!("response {:?}", response);
1609    ///     Ok(())
1610    /// }
1611    /// ```
1612    pub fn get_iam_policy(&self) -> super::builder::job_controller::GetIamPolicy {
1613        super::builder::job_controller::GetIamPolicy::new(self.inner.clone())
1614    }
1615
1616    /// Returns permissions that a caller has on the specified resource. If the
1617    /// resource does not exist, this will return an empty set of
1618    /// permissions, not a `NOT_FOUND` error.
1619    ///
1620    /// Note: This operation is designed to be used for building
1621    /// permission-aware UIs and command-line tools, not for authorization
1622    /// checking. This operation may "fail open" without warning.
1623    ///
1624    /// # Example
1625    /// ```
1626    /// # use google_cloud_dataproc_v1::client::JobController;
1627    /// use google_cloud_dataproc_v1::Result;
1628    /// async fn sample(
1629    ///    client: &JobController
1630    /// ) -> Result<()> {
1631    ///     let response = client.test_iam_permissions()
1632    ///         /* set fields */
1633    ///         .send().await?;
1634    ///     println!("response {:?}", response);
1635    ///     Ok(())
1636    /// }
1637    /// ```
1638    pub fn test_iam_permissions(&self) -> super::builder::job_controller::TestIamPermissions {
1639        super::builder::job_controller::TestIamPermissions::new(self.inner.clone())
1640    }
1641
1642    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1643    ///
1644    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1645    ///
1646    /// # Example
1647    /// ```
1648    /// # use google_cloud_dataproc_v1::client::JobController;
1649    /// use google_cloud_gax::paginator::ItemPaginator as _;
1650    /// use google_cloud_dataproc_v1::Result;
1651    /// async fn sample(
1652    ///    client: &JobController
1653    /// ) -> Result<()> {
1654    ///     let mut list = client.list_operations()
1655    ///         /* set fields */
1656    ///         .by_item();
1657    ///     while let Some(item) = list.next().await.transpose()? {
1658    ///         println!("{:?}", item);
1659    ///     }
1660    ///     Ok(())
1661    /// }
1662    /// ```
1663    pub fn list_operations(&self) -> super::builder::job_controller::ListOperations {
1664        super::builder::job_controller::ListOperations::new(self.inner.clone())
1665    }
1666
1667    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1668    ///
1669    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1670    ///
1671    /// # Example
1672    /// ```
1673    /// # use google_cloud_dataproc_v1::client::JobController;
1674    /// use google_cloud_dataproc_v1::Result;
1675    /// async fn sample(
1676    ///    client: &JobController
1677    /// ) -> Result<()> {
1678    ///     let response = client.get_operation()
1679    ///         /* set fields */
1680    ///         .send().await?;
1681    ///     println!("response {:?}", response);
1682    ///     Ok(())
1683    /// }
1684    /// ```
1685    pub fn get_operation(&self) -> super::builder::job_controller::GetOperation {
1686        super::builder::job_controller::GetOperation::new(self.inner.clone())
1687    }
1688
1689    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1690    ///
1691    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1692    ///
1693    /// # Example
1694    /// ```
1695    /// # use google_cloud_dataproc_v1::client::JobController;
1696    /// use google_cloud_dataproc_v1::Result;
1697    /// async fn sample(
1698    ///    client: &JobController
1699    /// ) -> Result<()> {
1700    ///     client.delete_operation()
1701    ///         /* set fields */
1702    ///         .send().await?;
1703    ///     Ok(())
1704    /// }
1705    /// ```
1706    pub fn delete_operation(&self) -> super::builder::job_controller::DeleteOperation {
1707        super::builder::job_controller::DeleteOperation::new(self.inner.clone())
1708    }
1709
1710    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1711    ///
1712    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1713    ///
1714    /// # Example
1715    /// ```
1716    /// # use google_cloud_dataproc_v1::client::JobController;
1717    /// use google_cloud_dataproc_v1::Result;
1718    /// async fn sample(
1719    ///    client: &JobController
1720    /// ) -> Result<()> {
1721    ///     client.cancel_operation()
1722    ///         /* set fields */
1723    ///         .send().await?;
1724    ///     Ok(())
1725    /// }
1726    /// ```
1727    pub fn cancel_operation(&self) -> super::builder::job_controller::CancelOperation {
1728        super::builder::job_controller::CancelOperation::new(self.inner.clone())
1729    }
1730}
1731
1732/// Implements a client for the Cloud Dataproc API.
1733///
1734/// # Example
1735/// ```
1736/// # use google_cloud_dataproc_v1::client::NodeGroupController;
1737/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1738///     let client = NodeGroupController::builder().build().await?;
1739///     let name = "name_value";
1740///     let response = client.get_node_group()
1741///         .set_name(name)
1742///         .send().await?;
1743///     println!("response {:?}", response);
1744/// # Ok(()) }
1745/// ```
1746///
1747/// # Service Description
1748///
1749/// The `NodeGroupControllerService` provides methods to manage node groups
1750/// of Compute Engine managed instances.
1751///
1752/// # Configuration
1753///
1754/// To configure `NodeGroupController` use the `with_*` methods in the type returned
1755/// by [builder()][NodeGroupController::builder]. The default configuration should
1756/// work for most applications. Common configuration changes include
1757///
1758/// * [with_endpoint()]: by default this client uses the global default endpoint
1759///   (`https://dataproc.googleapis.com`). Applications using regional
1760///   endpoints or running in restricted networks (e.g. a network configured
1761//    with [Private Google Access with VPC Service Controls]) may want to
1762///   override this default.
1763/// * [with_credentials()]: by default this client uses
1764///   [Application Default Credentials]. Applications using custom
1765///   authentication may need to override this default.
1766///
1767/// [with_endpoint()]: super::builder::node_group_controller::ClientBuilder::with_endpoint
1768/// [with_credentials()]: super::builder::node_group_controller::ClientBuilder::with_credentials
1769/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1770/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1771///
1772/// # Pooling and Cloning
1773///
1774/// `NodeGroupController` holds a connection pool internally, it is advised to
1775/// create one and reuse it. You do not need to wrap `NodeGroupController` in
1776/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1777/// already uses an `Arc` internally.
1778#[derive(Clone, Debug)]
1779pub struct NodeGroupController {
1780    inner: std::sync::Arc<dyn super::stub::dynamic::NodeGroupController>,
1781}
1782
1783impl NodeGroupController {
1784    /// Returns a builder for [NodeGroupController].
1785    ///
1786    /// ```
1787    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1788    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1789    /// let client = NodeGroupController::builder().build().await?;
1790    /// # Ok(()) }
1791    /// ```
1792    pub fn builder() -> super::builder::node_group_controller::ClientBuilder {
1793        crate::new_client_builder(super::builder::node_group_controller::client::Factory)
1794    }
1795
1796    /// Creates a new client from the provided stub.
1797    ///
1798    /// The most common case for calling this function is in tests mocking the
1799    /// client's behavior.
1800    pub fn from_stub<T>(stub: T) -> Self
1801    where
1802        T: super::stub::NodeGroupController + 'static,
1803    {
1804        Self {
1805            inner: std::sync::Arc::new(stub),
1806        }
1807    }
1808
1809    pub(crate) async fn new(
1810        config: gaxi::options::ClientConfig,
1811    ) -> crate::ClientBuilderResult<Self> {
1812        let inner = Self::build_inner(config).await?;
1813        Ok(Self { inner })
1814    }
1815
1816    async fn build_inner(
1817        conf: gaxi::options::ClientConfig,
1818    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeGroupController>>
1819    {
1820        if gaxi::options::tracing_enabled(&conf) {
1821            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1822        }
1823        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1824    }
1825
1826    async fn build_transport(
1827        conf: gaxi::options::ClientConfig,
1828    ) -> crate::ClientBuilderResult<impl super::stub::NodeGroupController> {
1829        super::transport::NodeGroupController::new(conf).await
1830    }
1831
1832    async fn build_with_tracing(
1833        conf: gaxi::options::ClientConfig,
1834    ) -> crate::ClientBuilderResult<impl super::stub::NodeGroupController> {
1835        Self::build_transport(conf)
1836            .await
1837            .map(super::tracing::NodeGroupController::new)
1838    }
1839
1840    /// Creates a node group in a cluster. The returned
1841    /// [Operation.metadata][google.longrunning.Operation.metadata] is
1842    /// [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
1843    ///
1844    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1845    ///
1846    /// # Long running operations
1847    ///
1848    /// This method is used to start, and/or poll a [long-running Operation].
1849    /// The [Working with long-running operations] chapter in the [user guide]
1850    /// covers these operations in detail.
1851    ///
1852    /// [long-running operation]: https://google.aip.dev/151
1853    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1854    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1855    ///
1856    /// # Example
1857    /// ```
1858    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1859    /// use google_cloud_lro::Poller;
1860    /// use google_cloud_dataproc_v1::model::NodeGroup;
1861    /// use google_cloud_dataproc_v1::Result;
1862    /// async fn sample(
1863    ///    client: &NodeGroupController, parent: &str
1864    /// ) -> Result<()> {
1865    ///     let response = client.create_node_group()
1866    ///         .set_parent(parent)
1867    ///         .set_node_group(
1868    ///             NodeGroup::new()/* set fields */
1869    ///         )
1870    ///         .poller().until_done().await?;
1871    ///     println!("response {:?}", response);
1872    ///     Ok(())
1873    /// }
1874    /// ```
1875    pub fn create_node_group(&self) -> super::builder::node_group_controller::CreateNodeGroup {
1876        super::builder::node_group_controller::CreateNodeGroup::new(self.inner.clone())
1877    }
1878
1879    /// Resizes a node group in a cluster. The returned
1880    /// [Operation.metadata][google.longrunning.Operation.metadata] is
1881    /// [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
1882    ///
1883    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
1884    ///
1885    /// # Long running operations
1886    ///
1887    /// This method is used to start, and/or poll a [long-running Operation].
1888    /// The [Working with long-running operations] chapter in the [user guide]
1889    /// covers these operations in detail.
1890    ///
1891    /// [long-running operation]: https://google.aip.dev/151
1892    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1893    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1894    ///
1895    /// # Example
1896    /// ```
1897    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1898    /// use google_cloud_lro::Poller;
1899    /// use google_cloud_dataproc_v1::Result;
1900    /// async fn sample(
1901    ///    client: &NodeGroupController
1902    /// ) -> Result<()> {
1903    ///     let response = client.resize_node_group()
1904    ///         /* set fields */
1905    ///         .poller().until_done().await?;
1906    ///     println!("response {:?}", response);
1907    ///     Ok(())
1908    /// }
1909    /// ```
1910    pub fn resize_node_group(&self) -> super::builder::node_group_controller::ResizeNodeGroup {
1911        super::builder::node_group_controller::ResizeNodeGroup::new(self.inner.clone())
1912    }
1913
1914    /// Gets the resource representation for a node group in a
1915    /// cluster.
1916    ///
1917    /// # Example
1918    /// ```
1919    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1920    /// use google_cloud_dataproc_v1::Result;
1921    /// async fn sample(
1922    ///    client: &NodeGroupController, name: &str
1923    /// ) -> Result<()> {
1924    ///     let response = client.get_node_group()
1925    ///         .set_name(name)
1926    ///         .send().await?;
1927    ///     println!("response {:?}", response);
1928    ///     Ok(())
1929    /// }
1930    /// ```
1931    pub fn get_node_group(&self) -> super::builder::node_group_controller::GetNodeGroup {
1932        super::builder::node_group_controller::GetNodeGroup::new(self.inner.clone())
1933    }
1934
1935    /// Sets the access control policy on the specified resource. Replaces
1936    /// any existing policy.
1937    ///
1938    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1939    /// errors.
1940    ///
1941    /// # Example
1942    /// ```
1943    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1944    /// use google_cloud_dataproc_v1::Result;
1945    /// async fn sample(
1946    ///    client: &NodeGroupController
1947    /// ) -> Result<()> {
1948    ///     let response = client.set_iam_policy()
1949    ///         /* set fields */
1950    ///         .send().await?;
1951    ///     println!("response {:?}", response);
1952    ///     Ok(())
1953    /// }
1954    /// ```
1955    pub fn set_iam_policy(&self) -> super::builder::node_group_controller::SetIamPolicy {
1956        super::builder::node_group_controller::SetIamPolicy::new(self.inner.clone())
1957    }
1958
1959    /// Gets the access control policy for a resource. Returns an empty policy
1960    /// if the resource exists and does not have a policy set.
1961    ///
1962    /// # Example
1963    /// ```
1964    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1965    /// use google_cloud_dataproc_v1::Result;
1966    /// async fn sample(
1967    ///    client: &NodeGroupController
1968    /// ) -> Result<()> {
1969    ///     let response = client.get_iam_policy()
1970    ///         /* set fields */
1971    ///         .send().await?;
1972    ///     println!("response {:?}", response);
1973    ///     Ok(())
1974    /// }
1975    /// ```
1976    pub fn get_iam_policy(&self) -> super::builder::node_group_controller::GetIamPolicy {
1977        super::builder::node_group_controller::GetIamPolicy::new(self.inner.clone())
1978    }
1979
1980    /// Returns permissions that a caller has on the specified resource. If the
1981    /// resource does not exist, this will return an empty set of
1982    /// permissions, not a `NOT_FOUND` error.
1983    ///
1984    /// Note: This operation is designed to be used for building
1985    /// permission-aware UIs and command-line tools, not for authorization
1986    /// checking. This operation may "fail open" without warning.
1987    ///
1988    /// # Example
1989    /// ```
1990    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
1991    /// use google_cloud_dataproc_v1::Result;
1992    /// async fn sample(
1993    ///    client: &NodeGroupController
1994    /// ) -> Result<()> {
1995    ///     let response = client.test_iam_permissions()
1996    ///         /* set fields */
1997    ///         .send().await?;
1998    ///     println!("response {:?}", response);
1999    ///     Ok(())
2000    /// }
2001    /// ```
2002    pub fn test_iam_permissions(
2003        &self,
2004    ) -> super::builder::node_group_controller::TestIamPermissions {
2005        super::builder::node_group_controller::TestIamPermissions::new(self.inner.clone())
2006    }
2007
2008    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2009    ///
2010    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2011    ///
2012    /// # Example
2013    /// ```
2014    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
2015    /// use google_cloud_gax::paginator::ItemPaginator as _;
2016    /// use google_cloud_dataproc_v1::Result;
2017    /// async fn sample(
2018    ///    client: &NodeGroupController
2019    /// ) -> Result<()> {
2020    ///     let mut list = client.list_operations()
2021    ///         /* set fields */
2022    ///         .by_item();
2023    ///     while let Some(item) = list.next().await.transpose()? {
2024    ///         println!("{:?}", item);
2025    ///     }
2026    ///     Ok(())
2027    /// }
2028    /// ```
2029    pub fn list_operations(&self) -> super::builder::node_group_controller::ListOperations {
2030        super::builder::node_group_controller::ListOperations::new(self.inner.clone())
2031    }
2032
2033    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2034    ///
2035    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2036    ///
2037    /// # Example
2038    /// ```
2039    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
2040    /// use google_cloud_dataproc_v1::Result;
2041    /// async fn sample(
2042    ///    client: &NodeGroupController
2043    /// ) -> Result<()> {
2044    ///     let response = client.get_operation()
2045    ///         /* set fields */
2046    ///         .send().await?;
2047    ///     println!("response {:?}", response);
2048    ///     Ok(())
2049    /// }
2050    /// ```
2051    pub fn get_operation(&self) -> super::builder::node_group_controller::GetOperation {
2052        super::builder::node_group_controller::GetOperation::new(self.inner.clone())
2053    }
2054
2055    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2056    ///
2057    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2058    ///
2059    /// # Example
2060    /// ```
2061    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
2062    /// use google_cloud_dataproc_v1::Result;
2063    /// async fn sample(
2064    ///    client: &NodeGroupController
2065    /// ) -> Result<()> {
2066    ///     client.delete_operation()
2067    ///         /* set fields */
2068    ///         .send().await?;
2069    ///     Ok(())
2070    /// }
2071    /// ```
2072    pub fn delete_operation(&self) -> super::builder::node_group_controller::DeleteOperation {
2073        super::builder::node_group_controller::DeleteOperation::new(self.inner.clone())
2074    }
2075
2076    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2077    ///
2078    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2079    ///
2080    /// # Example
2081    /// ```
2082    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
2083    /// use google_cloud_dataproc_v1::Result;
2084    /// async fn sample(
2085    ///    client: &NodeGroupController
2086    /// ) -> Result<()> {
2087    ///     client.cancel_operation()
2088    ///         /* set fields */
2089    ///         .send().await?;
2090    ///     Ok(())
2091    /// }
2092    /// ```
2093    pub fn cancel_operation(&self) -> super::builder::node_group_controller::CancelOperation {
2094        super::builder::node_group_controller::CancelOperation::new(self.inner.clone())
2095    }
2096}
2097
2098/// Implements a client for the Cloud Dataproc API.
2099///
2100/// # Example
2101/// ```
2102/// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2103/// use google_cloud_gax::paginator::ItemPaginator as _;
2104/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2105///     let client = SessionTemplateController::builder().build().await?;
2106///     let parent = "parent_value";
2107///     let mut list = client.list_session_templates()
2108///         .set_parent(parent)
2109///         .by_item();
2110///     while let Some(item) = list.next().await.transpose()? {
2111///         println!("{:?}", item);
2112///     }
2113/// # Ok(()) }
2114/// ```
2115///
2116/// # Service Description
2117///
2118/// The SessionTemplateController provides methods to manage session templates.
2119///
2120/// # Configuration
2121///
2122/// To configure `SessionTemplateController` use the `with_*` methods in the type returned
2123/// by [builder()][SessionTemplateController::builder]. The default configuration should
2124/// work for most applications. Common configuration changes include
2125///
2126/// * [with_endpoint()]: by default this client uses the global default endpoint
2127///   (`https://dataproc.googleapis.com`). Applications using regional
2128///   endpoints or running in restricted networks (e.g. a network configured
2129//    with [Private Google Access with VPC Service Controls]) may want to
2130///   override this default.
2131/// * [with_credentials()]: by default this client uses
2132///   [Application Default Credentials]. Applications using custom
2133///   authentication may need to override this default.
2134///
2135/// [with_endpoint()]: super::builder::session_template_controller::ClientBuilder::with_endpoint
2136/// [with_credentials()]: super::builder::session_template_controller::ClientBuilder::with_credentials
2137/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2138/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2139///
2140/// # Pooling and Cloning
2141///
2142/// `SessionTemplateController` holds a connection pool internally, it is advised to
2143/// create one and reuse it. You do not need to wrap `SessionTemplateController` in
2144/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2145/// already uses an `Arc` internally.
2146#[derive(Clone, Debug)]
2147pub struct SessionTemplateController {
2148    inner: std::sync::Arc<dyn super::stub::dynamic::SessionTemplateController>,
2149}
2150
2151impl SessionTemplateController {
2152    /// Returns a builder for [SessionTemplateController].
2153    ///
2154    /// ```
2155    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2156    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2157    /// let client = SessionTemplateController::builder().build().await?;
2158    /// # Ok(()) }
2159    /// ```
2160    pub fn builder() -> super::builder::session_template_controller::ClientBuilder {
2161        crate::new_client_builder(super::builder::session_template_controller::client::Factory)
2162    }
2163
2164    /// Creates a new client from the provided stub.
2165    ///
2166    /// The most common case for calling this function is in tests mocking the
2167    /// client's behavior.
2168    pub fn from_stub<T>(stub: T) -> Self
2169    where
2170        T: super::stub::SessionTemplateController + 'static,
2171    {
2172        Self {
2173            inner: std::sync::Arc::new(stub),
2174        }
2175    }
2176
2177    pub(crate) async fn new(
2178        config: gaxi::options::ClientConfig,
2179    ) -> crate::ClientBuilderResult<Self> {
2180        let inner = Self::build_inner(config).await?;
2181        Ok(Self { inner })
2182    }
2183
2184    async fn build_inner(
2185        conf: gaxi::options::ClientConfig,
2186    ) -> crate::ClientBuilderResult<
2187        std::sync::Arc<dyn super::stub::dynamic::SessionTemplateController>,
2188    > {
2189        if gaxi::options::tracing_enabled(&conf) {
2190            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2191        }
2192        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2193    }
2194
2195    async fn build_transport(
2196        conf: gaxi::options::ClientConfig,
2197    ) -> crate::ClientBuilderResult<impl super::stub::SessionTemplateController> {
2198        super::transport::SessionTemplateController::new(conf).await
2199    }
2200
2201    async fn build_with_tracing(
2202        conf: gaxi::options::ClientConfig,
2203    ) -> crate::ClientBuilderResult<impl super::stub::SessionTemplateController> {
2204        Self::build_transport(conf)
2205            .await
2206            .map(super::tracing::SessionTemplateController::new)
2207    }
2208
2209    /// Create a session template synchronously.
2210    ///
2211    /// # Example
2212    /// ```
2213    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2214    /// use google_cloud_dataproc_v1::model::SessionTemplate;
2215    /// use google_cloud_dataproc_v1::Result;
2216    /// async fn sample(
2217    ///    client: &SessionTemplateController, parent: &str
2218    /// ) -> Result<()> {
2219    ///     let response = client.create_session_template()
2220    ///         .set_parent(parent)
2221    ///         .set_session_template(
2222    ///             SessionTemplate::new()/* set fields */
2223    ///         )
2224    ///         .send().await?;
2225    ///     println!("response {:?}", response);
2226    ///     Ok(())
2227    /// }
2228    /// ```
2229    pub fn create_session_template(
2230        &self,
2231    ) -> super::builder::session_template_controller::CreateSessionTemplate {
2232        super::builder::session_template_controller::CreateSessionTemplate::new(self.inner.clone())
2233    }
2234
2235    /// Updates the session template synchronously.
2236    ///
2237    /// # Example
2238    /// ```
2239    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2240    /// use google_cloud_dataproc_v1::model::SessionTemplate;
2241    /// use google_cloud_dataproc_v1::Result;
2242    /// async fn sample(
2243    ///    client: &SessionTemplateController, name: &str
2244    /// ) -> Result<()> {
2245    ///     let response = client.update_session_template()
2246    ///         .set_session_template(
2247    ///             SessionTemplate::new().set_name(name)/* set fields */
2248    ///         )
2249    ///         .send().await?;
2250    ///     println!("response {:?}", response);
2251    ///     Ok(())
2252    /// }
2253    /// ```
2254    pub fn update_session_template(
2255        &self,
2256    ) -> super::builder::session_template_controller::UpdateSessionTemplate {
2257        super::builder::session_template_controller::UpdateSessionTemplate::new(self.inner.clone())
2258    }
2259
2260    /// Gets the resource representation for a session template.
2261    ///
2262    /// # Example
2263    /// ```
2264    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2265    /// use google_cloud_dataproc_v1::Result;
2266    /// async fn sample(
2267    ///    client: &SessionTemplateController, name: &str
2268    /// ) -> Result<()> {
2269    ///     let response = client.get_session_template()
2270    ///         .set_name(name)
2271    ///         .send().await?;
2272    ///     println!("response {:?}", response);
2273    ///     Ok(())
2274    /// }
2275    /// ```
2276    pub fn get_session_template(
2277        &self,
2278    ) -> super::builder::session_template_controller::GetSessionTemplate {
2279        super::builder::session_template_controller::GetSessionTemplate::new(self.inner.clone())
2280    }
2281
2282    /// Lists session templates.
2283    ///
2284    /// # Example
2285    /// ```
2286    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2287    /// use google_cloud_gax::paginator::ItemPaginator as _;
2288    /// use google_cloud_dataproc_v1::Result;
2289    /// async fn sample(
2290    ///    client: &SessionTemplateController, parent: &str
2291    /// ) -> Result<()> {
2292    ///     let mut list = client.list_session_templates()
2293    ///         .set_parent(parent)
2294    ///         .by_item();
2295    ///     while let Some(item) = list.next().await.transpose()? {
2296    ///         println!("{:?}", item);
2297    ///     }
2298    ///     Ok(())
2299    /// }
2300    /// ```
2301    pub fn list_session_templates(
2302        &self,
2303    ) -> super::builder::session_template_controller::ListSessionTemplates {
2304        super::builder::session_template_controller::ListSessionTemplates::new(self.inner.clone())
2305    }
2306
2307    /// Deletes a session template.
2308    ///
2309    /// # Example
2310    /// ```
2311    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2312    /// use google_cloud_dataproc_v1::Result;
2313    /// async fn sample(
2314    ///    client: &SessionTemplateController, name: &str
2315    /// ) -> Result<()> {
2316    ///     client.delete_session_template()
2317    ///         .set_name(name)
2318    ///         .send().await?;
2319    ///     Ok(())
2320    /// }
2321    /// ```
2322    pub fn delete_session_template(
2323        &self,
2324    ) -> super::builder::session_template_controller::DeleteSessionTemplate {
2325        super::builder::session_template_controller::DeleteSessionTemplate::new(self.inner.clone())
2326    }
2327
2328    /// Sets the access control policy on the specified resource. Replaces
2329    /// any existing policy.
2330    ///
2331    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2332    /// errors.
2333    ///
2334    /// # Example
2335    /// ```
2336    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2337    /// use google_cloud_dataproc_v1::Result;
2338    /// async fn sample(
2339    ///    client: &SessionTemplateController
2340    /// ) -> Result<()> {
2341    ///     let response = client.set_iam_policy()
2342    ///         /* set fields */
2343    ///         .send().await?;
2344    ///     println!("response {:?}", response);
2345    ///     Ok(())
2346    /// }
2347    /// ```
2348    pub fn set_iam_policy(&self) -> super::builder::session_template_controller::SetIamPolicy {
2349        super::builder::session_template_controller::SetIamPolicy::new(self.inner.clone())
2350    }
2351
2352    /// Gets the access control policy for a resource. Returns an empty policy
2353    /// if the resource exists and does not have a policy set.
2354    ///
2355    /// # Example
2356    /// ```
2357    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2358    /// use google_cloud_dataproc_v1::Result;
2359    /// async fn sample(
2360    ///    client: &SessionTemplateController
2361    /// ) -> Result<()> {
2362    ///     let response = client.get_iam_policy()
2363    ///         /* set fields */
2364    ///         .send().await?;
2365    ///     println!("response {:?}", response);
2366    ///     Ok(())
2367    /// }
2368    /// ```
2369    pub fn get_iam_policy(&self) -> super::builder::session_template_controller::GetIamPolicy {
2370        super::builder::session_template_controller::GetIamPolicy::new(self.inner.clone())
2371    }
2372
2373    /// Returns permissions that a caller has on the specified resource. If the
2374    /// resource does not exist, this will return an empty set of
2375    /// permissions, not a `NOT_FOUND` error.
2376    ///
2377    /// Note: This operation is designed to be used for building
2378    /// permission-aware UIs and command-line tools, not for authorization
2379    /// checking. This operation may "fail open" without warning.
2380    ///
2381    /// # Example
2382    /// ```
2383    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2384    /// use google_cloud_dataproc_v1::Result;
2385    /// async fn sample(
2386    ///    client: &SessionTemplateController
2387    /// ) -> Result<()> {
2388    ///     let response = client.test_iam_permissions()
2389    ///         /* set fields */
2390    ///         .send().await?;
2391    ///     println!("response {:?}", response);
2392    ///     Ok(())
2393    /// }
2394    /// ```
2395    pub fn test_iam_permissions(
2396        &self,
2397    ) -> super::builder::session_template_controller::TestIamPermissions {
2398        super::builder::session_template_controller::TestIamPermissions::new(self.inner.clone())
2399    }
2400
2401    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2402    ///
2403    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2404    ///
2405    /// # Example
2406    /// ```
2407    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2408    /// use google_cloud_gax::paginator::ItemPaginator as _;
2409    /// use google_cloud_dataproc_v1::Result;
2410    /// async fn sample(
2411    ///    client: &SessionTemplateController
2412    /// ) -> Result<()> {
2413    ///     let mut list = client.list_operations()
2414    ///         /* set fields */
2415    ///         .by_item();
2416    ///     while let Some(item) = list.next().await.transpose()? {
2417    ///         println!("{:?}", item);
2418    ///     }
2419    ///     Ok(())
2420    /// }
2421    /// ```
2422    pub fn list_operations(&self) -> super::builder::session_template_controller::ListOperations {
2423        super::builder::session_template_controller::ListOperations::new(self.inner.clone())
2424    }
2425
2426    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2427    ///
2428    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2429    ///
2430    /// # Example
2431    /// ```
2432    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2433    /// use google_cloud_dataproc_v1::Result;
2434    /// async fn sample(
2435    ///    client: &SessionTemplateController
2436    /// ) -> Result<()> {
2437    ///     let response = client.get_operation()
2438    ///         /* set fields */
2439    ///         .send().await?;
2440    ///     println!("response {:?}", response);
2441    ///     Ok(())
2442    /// }
2443    /// ```
2444    pub fn get_operation(&self) -> super::builder::session_template_controller::GetOperation {
2445        super::builder::session_template_controller::GetOperation::new(self.inner.clone())
2446    }
2447
2448    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2449    ///
2450    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2451    ///
2452    /// # Example
2453    /// ```
2454    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2455    /// use google_cloud_dataproc_v1::Result;
2456    /// async fn sample(
2457    ///    client: &SessionTemplateController
2458    /// ) -> Result<()> {
2459    ///     client.delete_operation()
2460    ///         /* set fields */
2461    ///         .send().await?;
2462    ///     Ok(())
2463    /// }
2464    /// ```
2465    pub fn delete_operation(&self) -> super::builder::session_template_controller::DeleteOperation {
2466        super::builder::session_template_controller::DeleteOperation::new(self.inner.clone())
2467    }
2468
2469    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2470    ///
2471    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2472    ///
2473    /// # Example
2474    /// ```
2475    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
2476    /// use google_cloud_dataproc_v1::Result;
2477    /// async fn sample(
2478    ///    client: &SessionTemplateController
2479    /// ) -> Result<()> {
2480    ///     client.cancel_operation()
2481    ///         /* set fields */
2482    ///         .send().await?;
2483    ///     Ok(())
2484    /// }
2485    /// ```
2486    pub fn cancel_operation(&self) -> super::builder::session_template_controller::CancelOperation {
2487        super::builder::session_template_controller::CancelOperation::new(self.inner.clone())
2488    }
2489}
2490
2491/// Implements a client for the Cloud Dataproc API.
2492///
2493/// # Example
2494/// ```
2495/// # use google_cloud_dataproc_v1::client::SessionController;
2496/// use google_cloud_gax::paginator::ItemPaginator as _;
2497/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2498///     let client = SessionController::builder().build().await?;
2499///     let parent = "parent_value";
2500///     let mut list = client.list_sessions()
2501///         .set_parent(parent)
2502///         .by_item();
2503///     while let Some(item) = list.next().await.transpose()? {
2504///         println!("{:?}", item);
2505///     }
2506/// # Ok(()) }
2507/// ```
2508///
2509/// # Service Description
2510///
2511/// The `SessionController` provides methods to manage interactive sessions.
2512///
2513/// # Configuration
2514///
2515/// To configure `SessionController` use the `with_*` methods in the type returned
2516/// by [builder()][SessionController::builder]. The default configuration should
2517/// work for most applications. Common configuration changes include
2518///
2519/// * [with_endpoint()]: by default this client uses the global default endpoint
2520///   (`https://dataproc.googleapis.com`). Applications using regional
2521///   endpoints or running in restricted networks (e.g. a network configured
2522//    with [Private Google Access with VPC Service Controls]) may want to
2523///   override this default.
2524/// * [with_credentials()]: by default this client uses
2525///   [Application Default Credentials]. Applications using custom
2526///   authentication may need to override this default.
2527///
2528/// [with_endpoint()]: super::builder::session_controller::ClientBuilder::with_endpoint
2529/// [with_credentials()]: super::builder::session_controller::ClientBuilder::with_credentials
2530/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2531/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2532///
2533/// # Pooling and Cloning
2534///
2535/// `SessionController` holds a connection pool internally, it is advised to
2536/// create one and reuse it. You do not need to wrap `SessionController` in
2537/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2538/// already uses an `Arc` internally.
2539#[derive(Clone, Debug)]
2540pub struct SessionController {
2541    inner: std::sync::Arc<dyn super::stub::dynamic::SessionController>,
2542}
2543
2544impl SessionController {
2545    /// Returns a builder for [SessionController].
2546    ///
2547    /// ```
2548    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2549    /// # use google_cloud_dataproc_v1::client::SessionController;
2550    /// let client = SessionController::builder().build().await?;
2551    /// # Ok(()) }
2552    /// ```
2553    pub fn builder() -> super::builder::session_controller::ClientBuilder {
2554        crate::new_client_builder(super::builder::session_controller::client::Factory)
2555    }
2556
2557    /// Creates a new client from the provided stub.
2558    ///
2559    /// The most common case for calling this function is in tests mocking the
2560    /// client's behavior.
2561    pub fn from_stub<T>(stub: T) -> Self
2562    where
2563        T: super::stub::SessionController + 'static,
2564    {
2565        Self {
2566            inner: std::sync::Arc::new(stub),
2567        }
2568    }
2569
2570    pub(crate) async fn new(
2571        config: gaxi::options::ClientConfig,
2572    ) -> crate::ClientBuilderResult<Self> {
2573        let inner = Self::build_inner(config).await?;
2574        Ok(Self { inner })
2575    }
2576
2577    async fn build_inner(
2578        conf: gaxi::options::ClientConfig,
2579    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionController>>
2580    {
2581        if gaxi::options::tracing_enabled(&conf) {
2582            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2583        }
2584        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2585    }
2586
2587    async fn build_transport(
2588        conf: gaxi::options::ClientConfig,
2589    ) -> crate::ClientBuilderResult<impl super::stub::SessionController> {
2590        super::transport::SessionController::new(conf).await
2591    }
2592
2593    async fn build_with_tracing(
2594        conf: gaxi::options::ClientConfig,
2595    ) -> crate::ClientBuilderResult<impl super::stub::SessionController> {
2596        Self::build_transport(conf)
2597            .await
2598            .map(super::tracing::SessionController::new)
2599    }
2600
2601    /// Create an interactive session asynchronously.
2602    ///
2603    /// # Long running operations
2604    ///
2605    /// This method is used to start, and/or poll a [long-running Operation].
2606    /// The [Working with long-running operations] chapter in the [user guide]
2607    /// covers these operations in detail.
2608    ///
2609    /// [long-running operation]: https://google.aip.dev/151
2610    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2611    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2612    ///
2613    /// # Example
2614    /// ```
2615    /// # use google_cloud_dataproc_v1::client::SessionController;
2616    /// use google_cloud_lro::Poller;
2617    /// use google_cloud_dataproc_v1::model::Session;
2618    /// use google_cloud_dataproc_v1::Result;
2619    /// async fn sample(
2620    ///    client: &SessionController, parent: &str
2621    /// ) -> Result<()> {
2622    ///     let response = client.create_session()
2623    ///         .set_parent(parent)
2624    ///         .set_session_id("session_id_value")
2625    ///         .set_session(
2626    ///             Session::new()/* set fields */
2627    ///         )
2628    ///         .poller().until_done().await?;
2629    ///     println!("response {:?}", response);
2630    ///     Ok(())
2631    /// }
2632    /// ```
2633    pub fn create_session(&self) -> super::builder::session_controller::CreateSession {
2634        super::builder::session_controller::CreateSession::new(self.inner.clone())
2635    }
2636
2637    /// Gets the resource representation for an interactive session.
2638    ///
2639    /// # Example
2640    /// ```
2641    /// # use google_cloud_dataproc_v1::client::SessionController;
2642    /// use google_cloud_dataproc_v1::Result;
2643    /// async fn sample(
2644    ///    client: &SessionController, name: &str
2645    /// ) -> Result<()> {
2646    ///     let response = client.get_session()
2647    ///         .set_name(name)
2648    ///         .send().await?;
2649    ///     println!("response {:?}", response);
2650    ///     Ok(())
2651    /// }
2652    /// ```
2653    pub fn get_session(&self) -> super::builder::session_controller::GetSession {
2654        super::builder::session_controller::GetSession::new(self.inner.clone())
2655    }
2656
2657    /// Lists interactive sessions.
2658    ///
2659    /// # Example
2660    /// ```
2661    /// # use google_cloud_dataproc_v1::client::SessionController;
2662    /// use google_cloud_gax::paginator::ItemPaginator as _;
2663    /// use google_cloud_dataproc_v1::Result;
2664    /// async fn sample(
2665    ///    client: &SessionController, parent: &str
2666    /// ) -> Result<()> {
2667    ///     let mut list = client.list_sessions()
2668    ///         .set_parent(parent)
2669    ///         .by_item();
2670    ///     while let Some(item) = list.next().await.transpose()? {
2671    ///         println!("{:?}", item);
2672    ///     }
2673    ///     Ok(())
2674    /// }
2675    /// ```
2676    pub fn list_sessions(&self) -> super::builder::session_controller::ListSessions {
2677        super::builder::session_controller::ListSessions::new(self.inner.clone())
2678    }
2679
2680    /// Terminates the interactive session.
2681    ///
2682    /// # Long running operations
2683    ///
2684    /// This method is used to start, and/or poll a [long-running Operation].
2685    /// The [Working with long-running operations] chapter in the [user guide]
2686    /// covers these operations in detail.
2687    ///
2688    /// [long-running operation]: https://google.aip.dev/151
2689    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2690    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2691    ///
2692    /// # Example
2693    /// ```
2694    /// # use google_cloud_dataproc_v1::client::SessionController;
2695    /// use google_cloud_lro::Poller;
2696    /// use google_cloud_dataproc_v1::Result;
2697    /// async fn sample(
2698    ///    client: &SessionController
2699    /// ) -> Result<()> {
2700    ///     let response = client.terminate_session()
2701    ///         /* set fields */
2702    ///         .poller().until_done().await?;
2703    ///     println!("response {:?}", response);
2704    ///     Ok(())
2705    /// }
2706    /// ```
2707    pub fn terminate_session(&self) -> super::builder::session_controller::TerminateSession {
2708        super::builder::session_controller::TerminateSession::new(self.inner.clone())
2709    }
2710
2711    /// Deletes the interactive session resource. If the session is not in terminal
2712    /// state, it is terminated, and then deleted.
2713    ///
2714    /// # Long running operations
2715    ///
2716    /// This method is used to start, and/or poll a [long-running Operation].
2717    /// The [Working with long-running operations] chapter in the [user guide]
2718    /// covers these operations in detail.
2719    ///
2720    /// [long-running operation]: https://google.aip.dev/151
2721    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2722    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2723    ///
2724    /// # Example
2725    /// ```
2726    /// # use google_cloud_dataproc_v1::client::SessionController;
2727    /// use google_cloud_lro::Poller;
2728    /// use google_cloud_dataproc_v1::Result;
2729    /// async fn sample(
2730    ///    client: &SessionController, name: &str
2731    /// ) -> Result<()> {
2732    ///     let response = client.delete_session()
2733    ///         .set_name(name)
2734    ///         .poller().until_done().await?;
2735    ///     println!("response {:?}", response);
2736    ///     Ok(())
2737    /// }
2738    /// ```
2739    pub fn delete_session(&self) -> super::builder::session_controller::DeleteSession {
2740        super::builder::session_controller::DeleteSession::new(self.inner.clone())
2741    }
2742
2743    /// Sets the access control policy on the specified resource. Replaces
2744    /// any existing policy.
2745    ///
2746    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2747    /// errors.
2748    ///
2749    /// # Example
2750    /// ```
2751    /// # use google_cloud_dataproc_v1::client::SessionController;
2752    /// use google_cloud_dataproc_v1::Result;
2753    /// async fn sample(
2754    ///    client: &SessionController
2755    /// ) -> Result<()> {
2756    ///     let response = client.set_iam_policy()
2757    ///         /* set fields */
2758    ///         .send().await?;
2759    ///     println!("response {:?}", response);
2760    ///     Ok(())
2761    /// }
2762    /// ```
2763    pub fn set_iam_policy(&self) -> super::builder::session_controller::SetIamPolicy {
2764        super::builder::session_controller::SetIamPolicy::new(self.inner.clone())
2765    }
2766
2767    /// Gets the access control policy for a resource. Returns an empty policy
2768    /// if the resource exists and does not have a policy set.
2769    ///
2770    /// # Example
2771    /// ```
2772    /// # use google_cloud_dataproc_v1::client::SessionController;
2773    /// use google_cloud_dataproc_v1::Result;
2774    /// async fn sample(
2775    ///    client: &SessionController
2776    /// ) -> Result<()> {
2777    ///     let response = client.get_iam_policy()
2778    ///         /* set fields */
2779    ///         .send().await?;
2780    ///     println!("response {:?}", response);
2781    ///     Ok(())
2782    /// }
2783    /// ```
2784    pub fn get_iam_policy(&self) -> super::builder::session_controller::GetIamPolicy {
2785        super::builder::session_controller::GetIamPolicy::new(self.inner.clone())
2786    }
2787
2788    /// Returns permissions that a caller has on the specified resource. If the
2789    /// resource does not exist, this will return an empty set of
2790    /// permissions, not a `NOT_FOUND` error.
2791    ///
2792    /// Note: This operation is designed to be used for building
2793    /// permission-aware UIs and command-line tools, not for authorization
2794    /// checking. This operation may "fail open" without warning.
2795    ///
2796    /// # Example
2797    /// ```
2798    /// # use google_cloud_dataproc_v1::client::SessionController;
2799    /// use google_cloud_dataproc_v1::Result;
2800    /// async fn sample(
2801    ///    client: &SessionController
2802    /// ) -> Result<()> {
2803    ///     let response = client.test_iam_permissions()
2804    ///         /* set fields */
2805    ///         .send().await?;
2806    ///     println!("response {:?}", response);
2807    ///     Ok(())
2808    /// }
2809    /// ```
2810    pub fn test_iam_permissions(&self) -> super::builder::session_controller::TestIamPermissions {
2811        super::builder::session_controller::TestIamPermissions::new(self.inner.clone())
2812    }
2813
2814    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2815    ///
2816    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2817    ///
2818    /// # Example
2819    /// ```
2820    /// # use google_cloud_dataproc_v1::client::SessionController;
2821    /// use google_cloud_gax::paginator::ItemPaginator as _;
2822    /// use google_cloud_dataproc_v1::Result;
2823    /// async fn sample(
2824    ///    client: &SessionController
2825    /// ) -> Result<()> {
2826    ///     let mut list = client.list_operations()
2827    ///         /* set fields */
2828    ///         .by_item();
2829    ///     while let Some(item) = list.next().await.transpose()? {
2830    ///         println!("{:?}", item);
2831    ///     }
2832    ///     Ok(())
2833    /// }
2834    /// ```
2835    pub fn list_operations(&self) -> super::builder::session_controller::ListOperations {
2836        super::builder::session_controller::ListOperations::new(self.inner.clone())
2837    }
2838
2839    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2840    ///
2841    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2842    ///
2843    /// # Example
2844    /// ```
2845    /// # use google_cloud_dataproc_v1::client::SessionController;
2846    /// use google_cloud_dataproc_v1::Result;
2847    /// async fn sample(
2848    ///    client: &SessionController
2849    /// ) -> Result<()> {
2850    ///     let response = client.get_operation()
2851    ///         /* set fields */
2852    ///         .send().await?;
2853    ///     println!("response {:?}", response);
2854    ///     Ok(())
2855    /// }
2856    /// ```
2857    pub fn get_operation(&self) -> super::builder::session_controller::GetOperation {
2858        super::builder::session_controller::GetOperation::new(self.inner.clone())
2859    }
2860
2861    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2862    ///
2863    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2864    ///
2865    /// # Example
2866    /// ```
2867    /// # use google_cloud_dataproc_v1::client::SessionController;
2868    /// use google_cloud_dataproc_v1::Result;
2869    /// async fn sample(
2870    ///    client: &SessionController
2871    /// ) -> Result<()> {
2872    ///     client.delete_operation()
2873    ///         /* set fields */
2874    ///         .send().await?;
2875    ///     Ok(())
2876    /// }
2877    /// ```
2878    pub fn delete_operation(&self) -> super::builder::session_controller::DeleteOperation {
2879        super::builder::session_controller::DeleteOperation::new(self.inner.clone())
2880    }
2881
2882    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2883    ///
2884    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2885    ///
2886    /// # Example
2887    /// ```
2888    /// # use google_cloud_dataproc_v1::client::SessionController;
2889    /// use google_cloud_dataproc_v1::Result;
2890    /// async fn sample(
2891    ///    client: &SessionController
2892    /// ) -> Result<()> {
2893    ///     client.cancel_operation()
2894    ///         /* set fields */
2895    ///         .send().await?;
2896    ///     Ok(())
2897    /// }
2898    /// ```
2899    pub fn cancel_operation(&self) -> super::builder::session_controller::CancelOperation {
2900        super::builder::session_controller::CancelOperation::new(self.inner.clone())
2901    }
2902}
2903
2904/// Implements a client for the Cloud Dataproc API.
2905///
2906/// # Example
2907/// ```
2908/// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
2909/// use google_cloud_gax::paginator::ItemPaginator as _;
2910/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2911///     let client = WorkflowTemplateService::builder().build().await?;
2912///     let parent = "parent_value";
2913///     let mut list = client.list_workflow_templates()
2914///         .set_parent(parent)
2915///         .by_item();
2916///     while let Some(item) = list.next().await.transpose()? {
2917///         println!("{:?}", item);
2918///     }
2919/// # Ok(()) }
2920/// ```
2921///
2922/// # Service Description
2923///
2924/// The API interface for managing Workflow Templates in the
2925/// Dataproc API.
2926///
2927/// # Configuration
2928///
2929/// To configure `WorkflowTemplateService` use the `with_*` methods in the type returned
2930/// by [builder()][WorkflowTemplateService::builder]. The default configuration should
2931/// work for most applications. Common configuration changes include
2932///
2933/// * [with_endpoint()]: by default this client uses the global default endpoint
2934///   (`https://dataproc.googleapis.com`). Applications using regional
2935///   endpoints or running in restricted networks (e.g. a network configured
2936//    with [Private Google Access with VPC Service Controls]) may want to
2937///   override this default.
2938/// * [with_credentials()]: by default this client uses
2939///   [Application Default Credentials]. Applications using custom
2940///   authentication may need to override this default.
2941///
2942/// [with_endpoint()]: super::builder::workflow_template_service::ClientBuilder::with_endpoint
2943/// [with_credentials()]: super::builder::workflow_template_service::ClientBuilder::with_credentials
2944/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2945/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2946///
2947/// # Pooling and Cloning
2948///
2949/// `WorkflowTemplateService` holds a connection pool internally, it is advised to
2950/// create one and reuse it. You do not need to wrap `WorkflowTemplateService` in
2951/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2952/// already uses an `Arc` internally.
2953#[derive(Clone, Debug)]
2954pub struct WorkflowTemplateService {
2955    inner: std::sync::Arc<dyn super::stub::dynamic::WorkflowTemplateService>,
2956}
2957
2958impl WorkflowTemplateService {
2959    /// Returns a builder for [WorkflowTemplateService].
2960    ///
2961    /// ```
2962    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2963    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
2964    /// let client = WorkflowTemplateService::builder().build().await?;
2965    /// # Ok(()) }
2966    /// ```
2967    pub fn builder() -> super::builder::workflow_template_service::ClientBuilder {
2968        crate::new_client_builder(super::builder::workflow_template_service::client::Factory)
2969    }
2970
2971    /// Creates a new client from the provided stub.
2972    ///
2973    /// The most common case for calling this function is in tests mocking the
2974    /// client's behavior.
2975    pub fn from_stub<T>(stub: T) -> Self
2976    where
2977        T: super::stub::WorkflowTemplateService + 'static,
2978    {
2979        Self {
2980            inner: std::sync::Arc::new(stub),
2981        }
2982    }
2983
2984    pub(crate) async fn new(
2985        config: gaxi::options::ClientConfig,
2986    ) -> crate::ClientBuilderResult<Self> {
2987        let inner = Self::build_inner(config).await?;
2988        Ok(Self { inner })
2989    }
2990
2991    async fn build_inner(
2992        conf: gaxi::options::ClientConfig,
2993    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::WorkflowTemplateService>>
2994    {
2995        if gaxi::options::tracing_enabled(&conf) {
2996            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2997        }
2998        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2999    }
3000
3001    async fn build_transport(
3002        conf: gaxi::options::ClientConfig,
3003    ) -> crate::ClientBuilderResult<impl super::stub::WorkflowTemplateService> {
3004        super::transport::WorkflowTemplateService::new(conf).await
3005    }
3006
3007    async fn build_with_tracing(
3008        conf: gaxi::options::ClientConfig,
3009    ) -> crate::ClientBuilderResult<impl super::stub::WorkflowTemplateService> {
3010        Self::build_transport(conf)
3011            .await
3012            .map(super::tracing::WorkflowTemplateService::new)
3013    }
3014
3015    /// Creates new workflow template.
3016    ///
3017    /// # Example
3018    /// ```
3019    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3020    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
3021    /// use google_cloud_dataproc_v1::Result;
3022    /// async fn sample(
3023    ///    client: &WorkflowTemplateService, parent: &str
3024    /// ) -> Result<()> {
3025    ///     let response = client.create_workflow_template()
3026    ///         .set_parent(parent)
3027    ///         .set_template(
3028    ///             WorkflowTemplate::new()/* set fields */
3029    ///         )
3030    ///         .send().await?;
3031    ///     println!("response {:?}", response);
3032    ///     Ok(())
3033    /// }
3034    /// ```
3035    pub fn create_workflow_template(
3036        &self,
3037    ) -> super::builder::workflow_template_service::CreateWorkflowTemplate {
3038        super::builder::workflow_template_service::CreateWorkflowTemplate::new(self.inner.clone())
3039    }
3040
3041    /// Retrieves the latest workflow template.
3042    ///
3043    /// Can retrieve previously instantiated template by specifying optional
3044    /// version parameter.
3045    ///
3046    /// # Example
3047    /// ```
3048    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3049    /// use google_cloud_dataproc_v1::Result;
3050    /// async fn sample(
3051    ///    client: &WorkflowTemplateService, name: &str
3052    /// ) -> Result<()> {
3053    ///     let response = client.get_workflow_template()
3054    ///         .set_name(name)
3055    ///         .send().await?;
3056    ///     println!("response {:?}", response);
3057    ///     Ok(())
3058    /// }
3059    /// ```
3060    pub fn get_workflow_template(
3061        &self,
3062    ) -> super::builder::workflow_template_service::GetWorkflowTemplate {
3063        super::builder::workflow_template_service::GetWorkflowTemplate::new(self.inner.clone())
3064    }
3065
3066    /// Instantiates a template and begins execution.
3067    ///
3068    /// The returned Operation can be used to track execution of
3069    /// workflow by polling
3070    /// [operations.get][google.longrunning.Operations.GetOperation].
3071    /// The Operation will complete when entire workflow is finished.
3072    ///
3073    /// The running workflow can be aborted via
3074    /// [operations.cancel][google.longrunning.Operations.CancelOperation].
3075    /// This will cause any inflight jobs to be cancelled and workflow-owned
3076    /// clusters to be deleted.
3077    ///
3078    /// The [Operation.metadata][google.longrunning.Operation.metadata] will be
3079    /// [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
3080    /// Also see [Using
3081    /// WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
3082    ///
3083    /// On successful completion,
3084    /// [Operation.response][google.longrunning.Operation.response] will be
3085    /// [Empty][google.protobuf.Empty].
3086    ///
3087    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
3088    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
3089    /// [google.protobuf.Empty]: wkt::Empty
3090    ///
3091    /// # Long running operations
3092    ///
3093    /// This method is used to start, and/or poll a [long-running Operation].
3094    /// The [Working with long-running operations] chapter in the [user guide]
3095    /// covers these operations in detail.
3096    ///
3097    /// [long-running operation]: https://google.aip.dev/151
3098    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3099    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3100    ///
3101    /// # Example
3102    /// ```
3103    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3104    /// use google_cloud_lro::Poller;
3105    /// use google_cloud_dataproc_v1::Result;
3106    /// async fn sample(
3107    ///    client: &WorkflowTemplateService
3108    /// ) -> Result<()> {
3109    ///     client.instantiate_workflow_template()
3110    ///         /* set fields */
3111    ///         .poller().until_done().await?;
3112    ///     Ok(())
3113    /// }
3114    /// ```
3115    pub fn instantiate_workflow_template(
3116        &self,
3117    ) -> super::builder::workflow_template_service::InstantiateWorkflowTemplate {
3118        super::builder::workflow_template_service::InstantiateWorkflowTemplate::new(
3119            self.inner.clone(),
3120        )
3121    }
3122
3123    /// Instantiates a template and begins execution.
3124    ///
3125    /// This method is equivalent to executing the sequence
3126    /// [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate],
3127    /// [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate],
3128    /// [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
3129    ///
3130    /// The returned Operation can be used to track execution of
3131    /// workflow by polling
3132    /// [operations.get][google.longrunning.Operations.GetOperation].
3133    /// The Operation will complete when entire workflow is finished.
3134    ///
3135    /// The running workflow can be aborted via
3136    /// [operations.cancel][google.longrunning.Operations.CancelOperation].
3137    /// This will cause any inflight jobs to be cancelled and workflow-owned
3138    /// clusters to be deleted.
3139    ///
3140    /// The [Operation.metadata][google.longrunning.Operation.metadata] will be
3141    /// [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
3142    /// Also see [Using
3143    /// WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
3144    ///
3145    /// On successful completion,
3146    /// [Operation.response][google.longrunning.Operation.response] will be
3147    /// [Empty][google.protobuf.Empty].
3148    ///
3149    /// [google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate]: crate::client::WorkflowTemplateService::create_workflow_template
3150    /// [google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]: crate::client::WorkflowTemplateService::delete_workflow_template
3151    /// [google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate]: crate::client::WorkflowTemplateService::instantiate_workflow_template
3152    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
3153    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
3154    /// [google.protobuf.Empty]: wkt::Empty
3155    ///
3156    /// # Long running operations
3157    ///
3158    /// This method is used to start, and/or poll a [long-running Operation].
3159    /// The [Working with long-running operations] chapter in the [user guide]
3160    /// covers these operations in detail.
3161    ///
3162    /// [long-running operation]: https://google.aip.dev/151
3163    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3164    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3165    ///
3166    /// # Example
3167    /// ```
3168    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3169    /// use google_cloud_lro::Poller;
3170    /// use google_cloud_dataproc_v1::Result;
3171    /// async fn sample(
3172    ///    client: &WorkflowTemplateService
3173    /// ) -> Result<()> {
3174    ///     client.instantiate_inline_workflow_template()
3175    ///         /* set fields */
3176    ///         .poller().until_done().await?;
3177    ///     Ok(())
3178    /// }
3179    /// ```
3180    pub fn instantiate_inline_workflow_template(
3181        &self,
3182    ) -> super::builder::workflow_template_service::InstantiateInlineWorkflowTemplate {
3183        super::builder::workflow_template_service::InstantiateInlineWorkflowTemplate::new(
3184            self.inner.clone(),
3185        )
3186    }
3187
3188    /// Updates (replaces) workflow template. The updated template
3189    /// must contain version that matches the current server version.
3190    ///
3191    /// # Example
3192    /// ```
3193    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3194    /// use google_cloud_dataproc_v1::model::WorkflowTemplate;
3195    /// use google_cloud_dataproc_v1::Result;
3196    /// async fn sample(
3197    ///    client: &WorkflowTemplateService, name: &str
3198    /// ) -> Result<()> {
3199    ///     let response = client.update_workflow_template()
3200    ///         .set_template(
3201    ///             WorkflowTemplate::new().set_name(name)/* set fields */
3202    ///         )
3203    ///         .send().await?;
3204    ///     println!("response {:?}", response);
3205    ///     Ok(())
3206    /// }
3207    /// ```
3208    pub fn update_workflow_template(
3209        &self,
3210    ) -> super::builder::workflow_template_service::UpdateWorkflowTemplate {
3211        super::builder::workflow_template_service::UpdateWorkflowTemplate::new(self.inner.clone())
3212    }
3213
3214    /// Lists workflows that match the specified filter in the request.
3215    ///
3216    /// # Example
3217    /// ```
3218    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3219    /// use google_cloud_gax::paginator::ItemPaginator as _;
3220    /// use google_cloud_dataproc_v1::Result;
3221    /// async fn sample(
3222    ///    client: &WorkflowTemplateService, parent: &str
3223    /// ) -> Result<()> {
3224    ///     let mut list = client.list_workflow_templates()
3225    ///         .set_parent(parent)
3226    ///         .by_item();
3227    ///     while let Some(item) = list.next().await.transpose()? {
3228    ///         println!("{:?}", item);
3229    ///     }
3230    ///     Ok(())
3231    /// }
3232    /// ```
3233    pub fn list_workflow_templates(
3234        &self,
3235    ) -> super::builder::workflow_template_service::ListWorkflowTemplates {
3236        super::builder::workflow_template_service::ListWorkflowTemplates::new(self.inner.clone())
3237    }
3238
3239    /// Deletes a workflow template. It does not cancel in-progress workflows.
3240    ///
3241    /// # Example
3242    /// ```
3243    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3244    /// use google_cloud_dataproc_v1::Result;
3245    /// async fn sample(
3246    ///    client: &WorkflowTemplateService, name: &str
3247    /// ) -> Result<()> {
3248    ///     client.delete_workflow_template()
3249    ///         .set_name(name)
3250    ///         .send().await?;
3251    ///     Ok(())
3252    /// }
3253    /// ```
3254    pub fn delete_workflow_template(
3255        &self,
3256    ) -> super::builder::workflow_template_service::DeleteWorkflowTemplate {
3257        super::builder::workflow_template_service::DeleteWorkflowTemplate::new(self.inner.clone())
3258    }
3259
3260    /// Sets the access control policy on the specified resource. Replaces
3261    /// any existing policy.
3262    ///
3263    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3264    /// errors.
3265    ///
3266    /// # Example
3267    /// ```
3268    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3269    /// use google_cloud_dataproc_v1::Result;
3270    /// async fn sample(
3271    ///    client: &WorkflowTemplateService
3272    /// ) -> Result<()> {
3273    ///     let response = client.set_iam_policy()
3274    ///         /* set fields */
3275    ///         .send().await?;
3276    ///     println!("response {:?}", response);
3277    ///     Ok(())
3278    /// }
3279    /// ```
3280    pub fn set_iam_policy(&self) -> super::builder::workflow_template_service::SetIamPolicy {
3281        super::builder::workflow_template_service::SetIamPolicy::new(self.inner.clone())
3282    }
3283
3284    /// Gets the access control policy for a resource. Returns an empty policy
3285    /// if the resource exists and does not have a policy set.
3286    ///
3287    /// # Example
3288    /// ```
3289    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3290    /// use google_cloud_dataproc_v1::Result;
3291    /// async fn sample(
3292    ///    client: &WorkflowTemplateService
3293    /// ) -> Result<()> {
3294    ///     let response = client.get_iam_policy()
3295    ///         /* set fields */
3296    ///         .send().await?;
3297    ///     println!("response {:?}", response);
3298    ///     Ok(())
3299    /// }
3300    /// ```
3301    pub fn get_iam_policy(&self) -> super::builder::workflow_template_service::GetIamPolicy {
3302        super::builder::workflow_template_service::GetIamPolicy::new(self.inner.clone())
3303    }
3304
3305    /// Returns permissions that a caller has on the specified resource. If the
3306    /// resource does not exist, this will return an empty set of
3307    /// permissions, not a `NOT_FOUND` error.
3308    ///
3309    /// Note: This operation is designed to be used for building
3310    /// permission-aware UIs and command-line tools, not for authorization
3311    /// checking. This operation may "fail open" without warning.
3312    ///
3313    /// # Example
3314    /// ```
3315    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3316    /// use google_cloud_dataproc_v1::Result;
3317    /// async fn sample(
3318    ///    client: &WorkflowTemplateService
3319    /// ) -> Result<()> {
3320    ///     let response = client.test_iam_permissions()
3321    ///         /* set fields */
3322    ///         .send().await?;
3323    ///     println!("response {:?}", response);
3324    ///     Ok(())
3325    /// }
3326    /// ```
3327    pub fn test_iam_permissions(
3328        &self,
3329    ) -> super::builder::workflow_template_service::TestIamPermissions {
3330        super::builder::workflow_template_service::TestIamPermissions::new(self.inner.clone())
3331    }
3332
3333    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3334    ///
3335    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3336    ///
3337    /// # Example
3338    /// ```
3339    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3340    /// use google_cloud_gax::paginator::ItemPaginator as _;
3341    /// use google_cloud_dataproc_v1::Result;
3342    /// async fn sample(
3343    ///    client: &WorkflowTemplateService
3344    /// ) -> Result<()> {
3345    ///     let mut list = client.list_operations()
3346    ///         /* set fields */
3347    ///         .by_item();
3348    ///     while let Some(item) = list.next().await.transpose()? {
3349    ///         println!("{:?}", item);
3350    ///     }
3351    ///     Ok(())
3352    /// }
3353    /// ```
3354    pub fn list_operations(&self) -> super::builder::workflow_template_service::ListOperations {
3355        super::builder::workflow_template_service::ListOperations::new(self.inner.clone())
3356    }
3357
3358    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3359    ///
3360    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3361    ///
3362    /// # Example
3363    /// ```
3364    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3365    /// use google_cloud_dataproc_v1::Result;
3366    /// async fn sample(
3367    ///    client: &WorkflowTemplateService
3368    /// ) -> Result<()> {
3369    ///     let response = client.get_operation()
3370    ///         /* set fields */
3371    ///         .send().await?;
3372    ///     println!("response {:?}", response);
3373    ///     Ok(())
3374    /// }
3375    /// ```
3376    pub fn get_operation(&self) -> super::builder::workflow_template_service::GetOperation {
3377        super::builder::workflow_template_service::GetOperation::new(self.inner.clone())
3378    }
3379
3380    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3381    ///
3382    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3383    ///
3384    /// # Example
3385    /// ```
3386    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3387    /// use google_cloud_dataproc_v1::Result;
3388    /// async fn sample(
3389    ///    client: &WorkflowTemplateService
3390    /// ) -> Result<()> {
3391    ///     client.delete_operation()
3392    ///         /* set fields */
3393    ///         .send().await?;
3394    ///     Ok(())
3395    /// }
3396    /// ```
3397    pub fn delete_operation(&self) -> super::builder::workflow_template_service::DeleteOperation {
3398        super::builder::workflow_template_service::DeleteOperation::new(self.inner.clone())
3399    }
3400
3401    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3402    ///
3403    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3404    ///
3405    /// # Example
3406    /// ```
3407    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
3408    /// use google_cloud_dataproc_v1::Result;
3409    /// async fn sample(
3410    ///    client: &WorkflowTemplateService
3411    /// ) -> Result<()> {
3412    ///     client.cancel_operation()
3413    ///         /* set fields */
3414    ///         .send().await?;
3415    ///     Ok(())
3416    /// }
3417    /// ```
3418    pub fn cancel_operation(&self) -> super::builder::workflow_template_service::CancelOperation {
3419        super::builder::workflow_template_service::CancelOperation::new(self.inner.clone())
3420    }
3421}