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