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/// # tokio_test::block_on(async {
24/// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
25/// let client = AutoscalingPolicyService::builder().build().await?;
26/// // use `client` to make requests to the Cloud Dataproc API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// The API interface for managing autoscaling policies in the
33/// Dataproc API.
34///
35/// # Configuration
36///
37/// To configure `AutoscalingPolicyService` use the `with_*` methods in the type returned
38/// by [builder()][AutoscalingPolicyService::builder]. The default configuration should
39/// work for most applications. Common configuration changes include
40///
41/// * [with_endpoint()]: by default this client uses the global default endpoint
42///   (`https://dataproc.googleapis.com`). Applications using regional
43///   endpoints or running in restricted networks (e.g. a network configured
44//    with [Private Google Access with VPC Service Controls]) may want to
45///   override this default.
46/// * [with_credentials()]: by default this client uses
47///   [Application Default Credentials]. Applications using custom
48///   authentication may need to override this default.
49///
50/// [with_endpoint()]: super::builder::autoscaling_policy_service::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::autoscaling_policy_service::ClientBuilder::credentials
52/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
53/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
54///
55/// # Pooling and Cloning
56///
57/// `AutoscalingPolicyService` holds a connection pool internally, it is advised to
58/// create one and the reuse it.  You do not need to wrap `AutoscalingPolicyService` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[derive(Clone, Debug)]
62pub struct AutoscalingPolicyService {
63    inner: std::sync::Arc<dyn super::stub::dynamic::AutoscalingPolicyService>,
64}
65
66impl AutoscalingPolicyService {
67    /// Returns a builder for [AutoscalingPolicyService].
68    ///
69    /// ```
70    /// # tokio_test::block_on(async {
71    /// # use google_cloud_dataproc_v1::client::AutoscalingPolicyService;
72    /// let client = AutoscalingPolicyService::builder().build().await?;
73    /// # gax::client_builder::Result::<()>::Ok(()) });
74    /// ```
75    pub fn builder() -> super::builder::autoscaling_policy_service::ClientBuilder {
76        gax::client_builder::internal::new_builder(
77            super::builder::autoscaling_policy_service::client::Factory,
78        )
79    }
80
81    /// Creates a new client from the provided stub.
82    ///
83    /// The most common case for calling this function is in tests mocking the
84    /// client's behavior.
85    pub fn from_stub<T>(stub: T) -> Self
86    where
87        T: super::stub::AutoscalingPolicyService + 'static,
88    {
89        Self {
90            inner: std::sync::Arc::new(stub),
91        }
92    }
93
94    pub(crate) async fn new(
95        config: gaxi::options::ClientConfig,
96    ) -> gax::client_builder::Result<Self> {
97        let inner = Self::build_inner(config).await?;
98        Ok(Self { inner })
99    }
100
101    async fn build_inner(
102        conf: gaxi::options::ClientConfig,
103    ) -> gax::client_builder::Result<
104        std::sync::Arc<dyn super::stub::dynamic::AutoscalingPolicyService>,
105    > {
106        if gaxi::options::tracing_enabled(&conf) {
107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108        }
109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110    }
111
112    async fn build_transport(
113        conf: gaxi::options::ClientConfig,
114    ) -> gax::client_builder::Result<impl super::stub::AutoscalingPolicyService> {
115        super::transport::AutoscalingPolicyService::new(conf).await
116    }
117
118    async fn build_with_tracing(
119        conf: gaxi::options::ClientConfig,
120    ) -> gax::client_builder::Result<impl super::stub::AutoscalingPolicyService> {
121        Self::build_transport(conf)
122            .await
123            .map(super::tracing::AutoscalingPolicyService::new)
124    }
125
126    /// Creates new autoscaling policy.
127    pub fn create_autoscaling_policy(
128        &self,
129    ) -> super::builder::autoscaling_policy_service::CreateAutoscalingPolicy {
130        super::builder::autoscaling_policy_service::CreateAutoscalingPolicy::new(self.inner.clone())
131    }
132
133    /// Updates (replaces) autoscaling policy.
134    ///
135    /// Disabled check for update_mask, because all updates will be full
136    /// replacements.
137    pub fn update_autoscaling_policy(
138        &self,
139    ) -> super::builder::autoscaling_policy_service::UpdateAutoscalingPolicy {
140        super::builder::autoscaling_policy_service::UpdateAutoscalingPolicy::new(self.inner.clone())
141    }
142
143    /// Retrieves autoscaling policy.
144    pub fn get_autoscaling_policy(
145        &self,
146    ) -> super::builder::autoscaling_policy_service::GetAutoscalingPolicy {
147        super::builder::autoscaling_policy_service::GetAutoscalingPolicy::new(self.inner.clone())
148    }
149
150    /// Lists autoscaling policies in the project.
151    pub fn list_autoscaling_policies(
152        &self,
153    ) -> super::builder::autoscaling_policy_service::ListAutoscalingPolicies {
154        super::builder::autoscaling_policy_service::ListAutoscalingPolicies::new(self.inner.clone())
155    }
156
157    /// Deletes an autoscaling policy. It is an error to delete an autoscaling
158    /// policy that is in use by one or more clusters.
159    pub fn delete_autoscaling_policy(
160        &self,
161    ) -> super::builder::autoscaling_policy_service::DeleteAutoscalingPolicy {
162        super::builder::autoscaling_policy_service::DeleteAutoscalingPolicy::new(self.inner.clone())
163    }
164
165    /// Sets the access control policy on the specified resource. Replaces
166    /// any existing policy.
167    ///
168    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
169    /// errors.
170    pub fn set_iam_policy(&self) -> super::builder::autoscaling_policy_service::SetIamPolicy {
171        super::builder::autoscaling_policy_service::SetIamPolicy::new(self.inner.clone())
172    }
173
174    /// Gets the access control policy for a resource. Returns an empty policy
175    /// if the resource exists and does not have a policy set.
176    pub fn get_iam_policy(&self) -> super::builder::autoscaling_policy_service::GetIamPolicy {
177        super::builder::autoscaling_policy_service::GetIamPolicy::new(self.inner.clone())
178    }
179
180    /// Returns permissions that a caller has on the specified resource. If the
181    /// resource does not exist, this will return an empty set of
182    /// permissions, not a `NOT_FOUND` error.
183    ///
184    /// Note: This operation is designed to be used for building
185    /// permission-aware UIs and command-line tools, not for authorization
186    /// checking. This operation may "fail open" without warning.
187    pub fn test_iam_permissions(
188        &self,
189    ) -> super::builder::autoscaling_policy_service::TestIamPermissions {
190        super::builder::autoscaling_policy_service::TestIamPermissions::new(self.inner.clone())
191    }
192
193    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
194    ///
195    /// [google.longrunning.Operations]: longrunning::client::Operations
196    pub fn list_operations(&self) -> super::builder::autoscaling_policy_service::ListOperations {
197        super::builder::autoscaling_policy_service::ListOperations::new(self.inner.clone())
198    }
199
200    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
201    ///
202    /// [google.longrunning.Operations]: longrunning::client::Operations
203    pub fn get_operation(&self) -> super::builder::autoscaling_policy_service::GetOperation {
204        super::builder::autoscaling_policy_service::GetOperation::new(self.inner.clone())
205    }
206
207    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
208    ///
209    /// [google.longrunning.Operations]: longrunning::client::Operations
210    pub fn delete_operation(&self) -> super::builder::autoscaling_policy_service::DeleteOperation {
211        super::builder::autoscaling_policy_service::DeleteOperation::new(self.inner.clone())
212    }
213
214    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
215    ///
216    /// [google.longrunning.Operations]: longrunning::client::Operations
217    pub fn cancel_operation(&self) -> super::builder::autoscaling_policy_service::CancelOperation {
218        super::builder::autoscaling_policy_service::CancelOperation::new(self.inner.clone())
219    }
220}
221
222/// Implements a client for the Cloud Dataproc API.
223///
224/// # Example
225/// ```
226/// # tokio_test::block_on(async {
227/// # use google_cloud_dataproc_v1::client::BatchController;
228/// let client = BatchController::builder().build().await?;
229/// // use `client` to make requests to the Cloud Dataproc API.
230/// # gax::client_builder::Result::<()>::Ok(()) });
231/// ```
232///
233/// # Service Description
234///
235/// The BatchController provides methods to manage batch workloads.
236///
237/// # Configuration
238///
239/// To configure `BatchController` use the `with_*` methods in the type returned
240/// by [builder()][BatchController::builder]. The default configuration should
241/// work for most applications. Common configuration changes include
242///
243/// * [with_endpoint()]: by default this client uses the global default endpoint
244///   (`https://dataproc.googleapis.com`). Applications using regional
245///   endpoints or running in restricted networks (e.g. a network configured
246//    with [Private Google Access with VPC Service Controls]) may want to
247///   override this default.
248/// * [with_credentials()]: by default this client uses
249///   [Application Default Credentials]. Applications using custom
250///   authentication may need to override this default.
251///
252/// [with_endpoint()]: super::builder::batch_controller::ClientBuilder::with_endpoint
253/// [with_credentials()]: super::builder::batch_controller::ClientBuilder::credentials
254/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
255/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
256///
257/// # Pooling and Cloning
258///
259/// `BatchController` holds a connection pool internally, it is advised to
260/// create one and the reuse it.  You do not need to wrap `BatchController` in
261/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
262/// already uses an `Arc` internally.
263#[derive(Clone, Debug)]
264pub struct BatchController {
265    inner: std::sync::Arc<dyn super::stub::dynamic::BatchController>,
266}
267
268impl BatchController {
269    /// Returns a builder for [BatchController].
270    ///
271    /// ```
272    /// # tokio_test::block_on(async {
273    /// # use google_cloud_dataproc_v1::client::BatchController;
274    /// let client = BatchController::builder().build().await?;
275    /// # gax::client_builder::Result::<()>::Ok(()) });
276    /// ```
277    pub fn builder() -> super::builder::batch_controller::ClientBuilder {
278        gax::client_builder::internal::new_builder(
279            super::builder::batch_controller::client::Factory,
280        )
281    }
282
283    /// Creates a new client from the provided stub.
284    ///
285    /// The most common case for calling this function is in tests mocking the
286    /// client's behavior.
287    pub fn from_stub<T>(stub: T) -> Self
288    where
289        T: super::stub::BatchController + 'static,
290    {
291        Self {
292            inner: std::sync::Arc::new(stub),
293        }
294    }
295
296    pub(crate) async fn new(
297        config: gaxi::options::ClientConfig,
298    ) -> gax::client_builder::Result<Self> {
299        let inner = Self::build_inner(config).await?;
300        Ok(Self { inner })
301    }
302
303    async fn build_inner(
304        conf: gaxi::options::ClientConfig,
305    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BatchController>>
306    {
307        if gaxi::options::tracing_enabled(&conf) {
308            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
309        }
310        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
311    }
312
313    async fn build_transport(
314        conf: gaxi::options::ClientConfig,
315    ) -> gax::client_builder::Result<impl super::stub::BatchController> {
316        super::transport::BatchController::new(conf).await
317    }
318
319    async fn build_with_tracing(
320        conf: gaxi::options::ClientConfig,
321    ) -> gax::client_builder::Result<impl super::stub::BatchController> {
322        Self::build_transport(conf)
323            .await
324            .map(super::tracing::BatchController::new)
325    }
326
327    /// Creates a batch workload that executes asynchronously.
328    ///
329    /// # Long running operations
330    ///
331    /// This method is used to start, and/or poll a [long-running Operation].
332    /// The [Working with long-running operations] chapter in the [user guide]
333    /// covers these operations in detail.
334    ///
335    /// [long-running operation]: https://google.aip.dev/151
336    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
337    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
338    pub fn create_batch(&self) -> super::builder::batch_controller::CreateBatch {
339        super::builder::batch_controller::CreateBatch::new(self.inner.clone())
340    }
341
342    /// Gets the batch workload resource representation.
343    pub fn get_batch(&self) -> super::builder::batch_controller::GetBatch {
344        super::builder::batch_controller::GetBatch::new(self.inner.clone())
345    }
346
347    /// Lists batch workloads.
348    pub fn list_batches(&self) -> super::builder::batch_controller::ListBatches {
349        super::builder::batch_controller::ListBatches::new(self.inner.clone())
350    }
351
352    /// Deletes the batch workload resource. If the batch is not in terminal state,
353    /// the delete fails and the response returns `FAILED_PRECONDITION`.
354    pub fn delete_batch(&self) -> super::builder::batch_controller::DeleteBatch {
355        super::builder::batch_controller::DeleteBatch::new(self.inner.clone())
356    }
357
358    /// Sets the access control policy on the specified resource. Replaces
359    /// any existing policy.
360    ///
361    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
362    /// errors.
363    pub fn set_iam_policy(&self) -> super::builder::batch_controller::SetIamPolicy {
364        super::builder::batch_controller::SetIamPolicy::new(self.inner.clone())
365    }
366
367    /// Gets the access control policy for a resource. Returns an empty policy
368    /// if the resource exists and does not have a policy set.
369    pub fn get_iam_policy(&self) -> super::builder::batch_controller::GetIamPolicy {
370        super::builder::batch_controller::GetIamPolicy::new(self.inner.clone())
371    }
372
373    /// Returns permissions that a caller has on the specified resource. If the
374    /// resource does not exist, this will return an empty set of
375    /// permissions, not a `NOT_FOUND` error.
376    ///
377    /// Note: This operation is designed to be used for building
378    /// permission-aware UIs and command-line tools, not for authorization
379    /// checking. This operation may "fail open" without warning.
380    pub fn test_iam_permissions(&self) -> super::builder::batch_controller::TestIamPermissions {
381        super::builder::batch_controller::TestIamPermissions::new(self.inner.clone())
382    }
383
384    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
385    ///
386    /// [google.longrunning.Operations]: longrunning::client::Operations
387    pub fn list_operations(&self) -> super::builder::batch_controller::ListOperations {
388        super::builder::batch_controller::ListOperations::new(self.inner.clone())
389    }
390
391    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
392    ///
393    /// [google.longrunning.Operations]: longrunning::client::Operations
394    pub fn get_operation(&self) -> super::builder::batch_controller::GetOperation {
395        super::builder::batch_controller::GetOperation::new(self.inner.clone())
396    }
397
398    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
399    ///
400    /// [google.longrunning.Operations]: longrunning::client::Operations
401    pub fn delete_operation(&self) -> super::builder::batch_controller::DeleteOperation {
402        super::builder::batch_controller::DeleteOperation::new(self.inner.clone())
403    }
404
405    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
406    ///
407    /// [google.longrunning.Operations]: longrunning::client::Operations
408    pub fn cancel_operation(&self) -> super::builder::batch_controller::CancelOperation {
409        super::builder::batch_controller::CancelOperation::new(self.inner.clone())
410    }
411}
412
413/// Implements a client for the Cloud Dataproc API.
414///
415/// # Example
416/// ```
417/// # tokio_test::block_on(async {
418/// # use google_cloud_dataproc_v1::client::ClusterController;
419/// let client = ClusterController::builder().build().await?;
420/// // use `client` to make requests to the Cloud Dataproc API.
421/// # gax::client_builder::Result::<()>::Ok(()) });
422/// ```
423///
424/// # Service Description
425///
426/// The ClusterControllerService provides methods to manage clusters
427/// of Compute Engine instances.
428///
429/// # Configuration
430///
431/// To configure `ClusterController` use the `with_*` methods in the type returned
432/// by [builder()][ClusterController::builder]. The default configuration should
433/// work for most applications. Common configuration changes include
434///
435/// * [with_endpoint()]: by default this client uses the global default endpoint
436///   (`https://dataproc.googleapis.com`). Applications using regional
437///   endpoints or running in restricted networks (e.g. a network configured
438//    with [Private Google Access with VPC Service Controls]) may want to
439///   override this default.
440/// * [with_credentials()]: by default this client uses
441///   [Application Default Credentials]. Applications using custom
442///   authentication may need to override this default.
443///
444/// [with_endpoint()]: super::builder::cluster_controller::ClientBuilder::with_endpoint
445/// [with_credentials()]: super::builder::cluster_controller::ClientBuilder::credentials
446/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
447/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
448///
449/// # Pooling and Cloning
450///
451/// `ClusterController` holds a connection pool internally, it is advised to
452/// create one and the reuse it.  You do not need to wrap `ClusterController` in
453/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
454/// already uses an `Arc` internally.
455#[derive(Clone, Debug)]
456pub struct ClusterController {
457    inner: std::sync::Arc<dyn super::stub::dynamic::ClusterController>,
458}
459
460impl ClusterController {
461    /// Returns a builder for [ClusterController].
462    ///
463    /// ```
464    /// # tokio_test::block_on(async {
465    /// # use google_cloud_dataproc_v1::client::ClusterController;
466    /// let client = ClusterController::builder().build().await?;
467    /// # gax::client_builder::Result::<()>::Ok(()) });
468    /// ```
469    pub fn builder() -> super::builder::cluster_controller::ClientBuilder {
470        gax::client_builder::internal::new_builder(
471            super::builder::cluster_controller::client::Factory,
472        )
473    }
474
475    /// Creates a new client from the provided stub.
476    ///
477    /// The most common case for calling this function is in tests mocking the
478    /// client's behavior.
479    pub fn from_stub<T>(stub: T) -> Self
480    where
481        T: super::stub::ClusterController + 'static,
482    {
483        Self {
484            inner: std::sync::Arc::new(stub),
485        }
486    }
487
488    pub(crate) async fn new(
489        config: gaxi::options::ClientConfig,
490    ) -> gax::client_builder::Result<Self> {
491        let inner = Self::build_inner(config).await?;
492        Ok(Self { inner })
493    }
494
495    async fn build_inner(
496        conf: gaxi::options::ClientConfig,
497    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ClusterController>>
498    {
499        if gaxi::options::tracing_enabled(&conf) {
500            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
501        }
502        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
503    }
504
505    async fn build_transport(
506        conf: gaxi::options::ClientConfig,
507    ) -> gax::client_builder::Result<impl super::stub::ClusterController> {
508        super::transport::ClusterController::new(conf).await
509    }
510
511    async fn build_with_tracing(
512        conf: gaxi::options::ClientConfig,
513    ) -> gax::client_builder::Result<impl super::stub::ClusterController> {
514        Self::build_transport(conf)
515            .await
516            .map(super::tracing::ClusterController::new)
517    }
518
519    /// Creates a cluster in a project. The returned
520    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
521    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
522    ///
523    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
524    ///
525    /// # Long running operations
526    ///
527    /// This method is used to start, and/or poll a [long-running Operation].
528    /// The [Working with long-running operations] chapter in the [user guide]
529    /// covers these operations in detail.
530    ///
531    /// [long-running operation]: https://google.aip.dev/151
532    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
533    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
534    pub fn create_cluster(&self) -> super::builder::cluster_controller::CreateCluster {
535        super::builder::cluster_controller::CreateCluster::new(self.inner.clone())
536    }
537
538    /// Updates a cluster in a project. The returned
539    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
540    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
541    /// The cluster must be in a
542    /// [`RUNNING`][google.cloud.dataproc.v1.ClusterStatus.State] state or an error
543    /// is returned.
544    ///
545    /// [google.cloud.dataproc.v1.ClusterStatus.State]: crate::model::cluster_status::State
546    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
547    ///
548    /// # Long running operations
549    ///
550    /// This method is used to start, and/or poll a [long-running Operation].
551    /// The [Working with long-running operations] chapter in the [user guide]
552    /// covers these operations in detail.
553    ///
554    /// [long-running operation]: https://google.aip.dev/151
555    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
556    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
557    pub fn update_cluster(&self) -> super::builder::cluster_controller::UpdateCluster {
558        super::builder::cluster_controller::UpdateCluster::new(self.inner.clone())
559    }
560
561    /// Stops a cluster in a project.
562    ///
563    /// # Long running operations
564    ///
565    /// This method is used to start, and/or poll a [long-running Operation].
566    /// The [Working with long-running operations] chapter in the [user guide]
567    /// covers these operations in detail.
568    ///
569    /// [long-running operation]: https://google.aip.dev/151
570    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
571    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
572    pub fn stop_cluster(&self) -> super::builder::cluster_controller::StopCluster {
573        super::builder::cluster_controller::StopCluster::new(self.inner.clone())
574    }
575
576    /// Starts a cluster in a project.
577    ///
578    /// # Long running operations
579    ///
580    /// This method is used to start, and/or poll a [long-running Operation].
581    /// The [Working with long-running operations] chapter in the [user guide]
582    /// covers these operations in detail.
583    ///
584    /// [long-running operation]: https://google.aip.dev/151
585    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
586    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
587    pub fn start_cluster(&self) -> super::builder::cluster_controller::StartCluster {
588        super::builder::cluster_controller::StartCluster::new(self.inner.clone())
589    }
590
591    /// Deletes a cluster in a project. The returned
592    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
593    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
594    ///
595    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
596    ///
597    /// # Long running operations
598    ///
599    /// This method is used to start, and/or poll a [long-running Operation].
600    /// The [Working with long-running operations] chapter in the [user guide]
601    /// covers these operations in detail.
602    ///
603    /// [long-running operation]: https://google.aip.dev/151
604    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
605    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
606    pub fn delete_cluster(&self) -> super::builder::cluster_controller::DeleteCluster {
607        super::builder::cluster_controller::DeleteCluster::new(self.inner.clone())
608    }
609
610    /// Gets the resource representation for a cluster in a project.
611    pub fn get_cluster(&self) -> super::builder::cluster_controller::GetCluster {
612        super::builder::cluster_controller::GetCluster::new(self.inner.clone())
613    }
614
615    /// Lists all regions/{region}/clusters in a project alphabetically.
616    pub fn list_clusters(&self) -> super::builder::cluster_controller::ListClusters {
617        super::builder::cluster_controller::ListClusters::new(self.inner.clone())
618    }
619
620    /// Gets cluster diagnostic information. The returned
621    /// [Operation.metadata][google.longrunning.Operation.metadata] will be
622    /// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
623    /// After the operation completes,
624    /// [Operation.response][google.longrunning.Operation.response]
625    /// contains
626    /// [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
627    ///
628    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
629    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
630    ///
631    /// # Long running operations
632    ///
633    /// This method is used to start, and/or poll a [long-running Operation].
634    /// The [Working with long-running operations] chapter in the [user guide]
635    /// covers these operations in detail.
636    ///
637    /// [long-running operation]: https://google.aip.dev/151
638    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
639    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
640    pub fn diagnose_cluster(&self) -> super::builder::cluster_controller::DiagnoseCluster {
641        super::builder::cluster_controller::DiagnoseCluster::new(self.inner.clone())
642    }
643
644    /// Sets the access control policy on the specified resource. Replaces
645    /// any existing policy.
646    ///
647    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
648    /// errors.
649    pub fn set_iam_policy(&self) -> super::builder::cluster_controller::SetIamPolicy {
650        super::builder::cluster_controller::SetIamPolicy::new(self.inner.clone())
651    }
652
653    /// Gets the access control policy for a resource. Returns an empty policy
654    /// if the resource exists and does not have a policy set.
655    pub fn get_iam_policy(&self) -> super::builder::cluster_controller::GetIamPolicy {
656        super::builder::cluster_controller::GetIamPolicy::new(self.inner.clone())
657    }
658
659    /// Returns permissions that a caller has on the specified resource. If the
660    /// resource does not exist, this will return an empty set of
661    /// permissions, not a `NOT_FOUND` error.
662    ///
663    /// Note: This operation is designed to be used for building
664    /// permission-aware UIs and command-line tools, not for authorization
665    /// checking. This operation may "fail open" without warning.
666    pub fn test_iam_permissions(&self) -> super::builder::cluster_controller::TestIamPermissions {
667        super::builder::cluster_controller::TestIamPermissions::new(self.inner.clone())
668    }
669
670    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
671    ///
672    /// [google.longrunning.Operations]: longrunning::client::Operations
673    pub fn list_operations(&self) -> super::builder::cluster_controller::ListOperations {
674        super::builder::cluster_controller::ListOperations::new(self.inner.clone())
675    }
676
677    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
678    ///
679    /// [google.longrunning.Operations]: longrunning::client::Operations
680    pub fn get_operation(&self) -> super::builder::cluster_controller::GetOperation {
681        super::builder::cluster_controller::GetOperation::new(self.inner.clone())
682    }
683
684    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
685    ///
686    /// [google.longrunning.Operations]: longrunning::client::Operations
687    pub fn delete_operation(&self) -> super::builder::cluster_controller::DeleteOperation {
688        super::builder::cluster_controller::DeleteOperation::new(self.inner.clone())
689    }
690
691    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
692    ///
693    /// [google.longrunning.Operations]: longrunning::client::Operations
694    pub fn cancel_operation(&self) -> super::builder::cluster_controller::CancelOperation {
695        super::builder::cluster_controller::CancelOperation::new(self.inner.clone())
696    }
697}
698
699/// Implements a client for the Cloud Dataproc API.
700///
701/// # Example
702/// ```
703/// # tokio_test::block_on(async {
704/// # use google_cloud_dataproc_v1::client::JobController;
705/// let client = JobController::builder().build().await?;
706/// // use `client` to make requests to the Cloud Dataproc API.
707/// # gax::client_builder::Result::<()>::Ok(()) });
708/// ```
709///
710/// # Service Description
711///
712/// The JobController provides methods to manage jobs.
713///
714/// # Configuration
715///
716/// To configure `JobController` use the `with_*` methods in the type returned
717/// by [builder()][JobController::builder]. The default configuration should
718/// work for most applications. Common configuration changes include
719///
720/// * [with_endpoint()]: by default this client uses the global default endpoint
721///   (`https://dataproc.googleapis.com`). Applications using regional
722///   endpoints or running in restricted networks (e.g. a network configured
723//    with [Private Google Access with VPC Service Controls]) may want to
724///   override this default.
725/// * [with_credentials()]: by default this client uses
726///   [Application Default Credentials]. Applications using custom
727///   authentication may need to override this default.
728///
729/// [with_endpoint()]: super::builder::job_controller::ClientBuilder::with_endpoint
730/// [with_credentials()]: super::builder::job_controller::ClientBuilder::credentials
731/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
732/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
733///
734/// # Pooling and Cloning
735///
736/// `JobController` holds a connection pool internally, it is advised to
737/// create one and the reuse it.  You do not need to wrap `JobController` in
738/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
739/// already uses an `Arc` internally.
740#[derive(Clone, Debug)]
741pub struct JobController {
742    inner: std::sync::Arc<dyn super::stub::dynamic::JobController>,
743}
744
745impl JobController {
746    /// Returns a builder for [JobController].
747    ///
748    /// ```
749    /// # tokio_test::block_on(async {
750    /// # use google_cloud_dataproc_v1::client::JobController;
751    /// let client = JobController::builder().build().await?;
752    /// # gax::client_builder::Result::<()>::Ok(()) });
753    /// ```
754    pub fn builder() -> super::builder::job_controller::ClientBuilder {
755        gax::client_builder::internal::new_builder(super::builder::job_controller::client::Factory)
756    }
757
758    /// Creates a new client from the provided stub.
759    ///
760    /// The most common case for calling this function is in tests mocking the
761    /// client's behavior.
762    pub fn from_stub<T>(stub: T) -> Self
763    where
764        T: super::stub::JobController + 'static,
765    {
766        Self {
767            inner: std::sync::Arc::new(stub),
768        }
769    }
770
771    pub(crate) async fn new(
772        config: gaxi::options::ClientConfig,
773    ) -> gax::client_builder::Result<Self> {
774        let inner = Self::build_inner(config).await?;
775        Ok(Self { inner })
776    }
777
778    async fn build_inner(
779        conf: gaxi::options::ClientConfig,
780    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::JobController>> {
781        if gaxi::options::tracing_enabled(&conf) {
782            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
783        }
784        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
785    }
786
787    async fn build_transport(
788        conf: gaxi::options::ClientConfig,
789    ) -> gax::client_builder::Result<impl super::stub::JobController> {
790        super::transport::JobController::new(conf).await
791    }
792
793    async fn build_with_tracing(
794        conf: gaxi::options::ClientConfig,
795    ) -> gax::client_builder::Result<impl super::stub::JobController> {
796        Self::build_transport(conf)
797            .await
798            .map(super::tracing::JobController::new)
799    }
800
801    /// Submits a job to a cluster.
802    pub fn submit_job(&self) -> super::builder::job_controller::SubmitJob {
803        super::builder::job_controller::SubmitJob::new(self.inner.clone())
804    }
805
806    /// Submits job to a cluster.
807    ///
808    /// # Long running operations
809    ///
810    /// This method is used to start, and/or poll a [long-running Operation].
811    /// The [Working with long-running operations] chapter in the [user guide]
812    /// covers these operations in detail.
813    ///
814    /// [long-running operation]: https://google.aip.dev/151
815    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
816    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
817    pub fn submit_job_as_operation(&self) -> super::builder::job_controller::SubmitJobAsOperation {
818        super::builder::job_controller::SubmitJobAsOperation::new(self.inner.clone())
819    }
820
821    /// Gets the resource representation for a job in a project.
822    pub fn get_job(&self) -> super::builder::job_controller::GetJob {
823        super::builder::job_controller::GetJob::new(self.inner.clone())
824    }
825
826    /// Lists regions/{region}/jobs in a project.
827    pub fn list_jobs(&self) -> super::builder::job_controller::ListJobs {
828        super::builder::job_controller::ListJobs::new(self.inner.clone())
829    }
830
831    /// Updates a job in a project.
832    pub fn update_job(&self) -> super::builder::job_controller::UpdateJob {
833        super::builder::job_controller::UpdateJob::new(self.inner.clone())
834    }
835
836    /// Starts a job cancellation request. To access the job resource
837    /// after cancellation, call
838    /// [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list)
839    /// or
840    /// [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).
841    pub fn cancel_job(&self) -> super::builder::job_controller::CancelJob {
842        super::builder::job_controller::CancelJob::new(self.inner.clone())
843    }
844
845    /// Deletes the job from the project. If the job is active, the delete fails,
846    /// and the response returns `FAILED_PRECONDITION`.
847    pub fn delete_job(&self) -> super::builder::job_controller::DeleteJob {
848        super::builder::job_controller::DeleteJob::new(self.inner.clone())
849    }
850
851    /// Sets the access control policy on the specified resource. Replaces
852    /// any existing policy.
853    ///
854    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
855    /// errors.
856    pub fn set_iam_policy(&self) -> super::builder::job_controller::SetIamPolicy {
857        super::builder::job_controller::SetIamPolicy::new(self.inner.clone())
858    }
859
860    /// Gets the access control policy for a resource. Returns an empty policy
861    /// if the resource exists and does not have a policy set.
862    pub fn get_iam_policy(&self) -> super::builder::job_controller::GetIamPolicy {
863        super::builder::job_controller::GetIamPolicy::new(self.inner.clone())
864    }
865
866    /// Returns permissions that a caller has on the specified resource. If the
867    /// resource does not exist, this will return an empty set of
868    /// permissions, not a `NOT_FOUND` error.
869    ///
870    /// Note: This operation is designed to be used for building
871    /// permission-aware UIs and command-line tools, not for authorization
872    /// checking. This operation may "fail open" without warning.
873    pub fn test_iam_permissions(&self) -> super::builder::job_controller::TestIamPermissions {
874        super::builder::job_controller::TestIamPermissions::new(self.inner.clone())
875    }
876
877    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
878    ///
879    /// [google.longrunning.Operations]: longrunning::client::Operations
880    pub fn list_operations(&self) -> super::builder::job_controller::ListOperations {
881        super::builder::job_controller::ListOperations::new(self.inner.clone())
882    }
883
884    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
885    ///
886    /// [google.longrunning.Operations]: longrunning::client::Operations
887    pub fn get_operation(&self) -> super::builder::job_controller::GetOperation {
888        super::builder::job_controller::GetOperation::new(self.inner.clone())
889    }
890
891    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
892    ///
893    /// [google.longrunning.Operations]: longrunning::client::Operations
894    pub fn delete_operation(&self) -> super::builder::job_controller::DeleteOperation {
895        super::builder::job_controller::DeleteOperation::new(self.inner.clone())
896    }
897
898    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
899    ///
900    /// [google.longrunning.Operations]: longrunning::client::Operations
901    pub fn cancel_operation(&self) -> super::builder::job_controller::CancelOperation {
902        super::builder::job_controller::CancelOperation::new(self.inner.clone())
903    }
904}
905
906/// Implements a client for the Cloud Dataproc API.
907///
908/// # Example
909/// ```
910/// # tokio_test::block_on(async {
911/// # use google_cloud_dataproc_v1::client::NodeGroupController;
912/// let client = NodeGroupController::builder().build().await?;
913/// // use `client` to make requests to the Cloud Dataproc API.
914/// # gax::client_builder::Result::<()>::Ok(()) });
915/// ```
916///
917/// # Service Description
918///
919/// The `NodeGroupControllerService` provides methods to manage node groups
920/// of Compute Engine managed instances.
921///
922/// # Configuration
923///
924/// To configure `NodeGroupController` use the `with_*` methods in the type returned
925/// by [builder()][NodeGroupController::builder]. The default configuration should
926/// work for most applications. Common configuration changes include
927///
928/// * [with_endpoint()]: by default this client uses the global default endpoint
929///   (`https://dataproc.googleapis.com`). Applications using regional
930///   endpoints or running in restricted networks (e.g. a network configured
931//    with [Private Google Access with VPC Service Controls]) may want to
932///   override this default.
933/// * [with_credentials()]: by default this client uses
934///   [Application Default Credentials]. Applications using custom
935///   authentication may need to override this default.
936///
937/// [with_endpoint()]: super::builder::node_group_controller::ClientBuilder::with_endpoint
938/// [with_credentials()]: super::builder::node_group_controller::ClientBuilder::credentials
939/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
940/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
941///
942/// # Pooling and Cloning
943///
944/// `NodeGroupController` holds a connection pool internally, it is advised to
945/// create one and the reuse it.  You do not need to wrap `NodeGroupController` in
946/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
947/// already uses an `Arc` internally.
948#[derive(Clone, Debug)]
949pub struct NodeGroupController {
950    inner: std::sync::Arc<dyn super::stub::dynamic::NodeGroupController>,
951}
952
953impl NodeGroupController {
954    /// Returns a builder for [NodeGroupController].
955    ///
956    /// ```
957    /// # tokio_test::block_on(async {
958    /// # use google_cloud_dataproc_v1::client::NodeGroupController;
959    /// let client = NodeGroupController::builder().build().await?;
960    /// # gax::client_builder::Result::<()>::Ok(()) });
961    /// ```
962    pub fn builder() -> super::builder::node_group_controller::ClientBuilder {
963        gax::client_builder::internal::new_builder(
964            super::builder::node_group_controller::client::Factory,
965        )
966    }
967
968    /// Creates a new client from the provided stub.
969    ///
970    /// The most common case for calling this function is in tests mocking the
971    /// client's behavior.
972    pub fn from_stub<T>(stub: T) -> Self
973    where
974        T: super::stub::NodeGroupController + 'static,
975    {
976        Self {
977            inner: std::sync::Arc::new(stub),
978        }
979    }
980
981    pub(crate) async fn new(
982        config: gaxi::options::ClientConfig,
983    ) -> gax::client_builder::Result<Self> {
984        let inner = Self::build_inner(config).await?;
985        Ok(Self { inner })
986    }
987
988    async fn build_inner(
989        conf: gaxi::options::ClientConfig,
990    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NodeGroupController>>
991    {
992        if gaxi::options::tracing_enabled(&conf) {
993            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
994        }
995        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
996    }
997
998    async fn build_transport(
999        conf: gaxi::options::ClientConfig,
1000    ) -> gax::client_builder::Result<impl super::stub::NodeGroupController> {
1001        super::transport::NodeGroupController::new(conf).await
1002    }
1003
1004    async fn build_with_tracing(
1005        conf: gaxi::options::ClientConfig,
1006    ) -> gax::client_builder::Result<impl super::stub::NodeGroupController> {
1007        Self::build_transport(conf)
1008            .await
1009            .map(super::tracing::NodeGroupController::new)
1010    }
1011
1012    /// Creates a node group in a cluster. The returned
1013    /// [Operation.metadata][google.longrunning.Operation.metadata] is
1014    /// [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
1015    ///
1016    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
1017    ///
1018    /// # Long running operations
1019    ///
1020    /// This method is used to start, and/or poll a [long-running Operation].
1021    /// The [Working with long-running operations] chapter in the [user guide]
1022    /// covers these operations in detail.
1023    ///
1024    /// [long-running operation]: https://google.aip.dev/151
1025    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1026    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1027    pub fn create_node_group(&self) -> super::builder::node_group_controller::CreateNodeGroup {
1028        super::builder::node_group_controller::CreateNodeGroup::new(self.inner.clone())
1029    }
1030
1031    /// Resizes a node group in a cluster. The returned
1032    /// [Operation.metadata][google.longrunning.Operation.metadata] is
1033    /// [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
1034    ///
1035    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
1036    ///
1037    /// # Long running operations
1038    ///
1039    /// This method is used to start, and/or poll a [long-running Operation].
1040    /// The [Working with long-running operations] chapter in the [user guide]
1041    /// covers these operations in detail.
1042    ///
1043    /// [long-running operation]: https://google.aip.dev/151
1044    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1045    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1046    pub fn resize_node_group(&self) -> super::builder::node_group_controller::ResizeNodeGroup {
1047        super::builder::node_group_controller::ResizeNodeGroup::new(self.inner.clone())
1048    }
1049
1050    /// Gets the resource representation for a node group in a
1051    /// cluster.
1052    pub fn get_node_group(&self) -> super::builder::node_group_controller::GetNodeGroup {
1053        super::builder::node_group_controller::GetNodeGroup::new(self.inner.clone())
1054    }
1055
1056    /// Sets the access control policy on the specified resource. Replaces
1057    /// any existing policy.
1058    ///
1059    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1060    /// errors.
1061    pub fn set_iam_policy(&self) -> super::builder::node_group_controller::SetIamPolicy {
1062        super::builder::node_group_controller::SetIamPolicy::new(self.inner.clone())
1063    }
1064
1065    /// Gets the access control policy for a resource. Returns an empty policy
1066    /// if the resource exists and does not have a policy set.
1067    pub fn get_iam_policy(&self) -> super::builder::node_group_controller::GetIamPolicy {
1068        super::builder::node_group_controller::GetIamPolicy::new(self.inner.clone())
1069    }
1070
1071    /// Returns permissions that a caller has on the specified resource. If the
1072    /// resource does not exist, this will return an empty set of
1073    /// permissions, not a `NOT_FOUND` error.
1074    ///
1075    /// Note: This operation is designed to be used for building
1076    /// permission-aware UIs and command-line tools, not for authorization
1077    /// checking. This operation may "fail open" without warning.
1078    pub fn test_iam_permissions(
1079        &self,
1080    ) -> super::builder::node_group_controller::TestIamPermissions {
1081        super::builder::node_group_controller::TestIamPermissions::new(self.inner.clone())
1082    }
1083
1084    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1085    ///
1086    /// [google.longrunning.Operations]: longrunning::client::Operations
1087    pub fn list_operations(&self) -> super::builder::node_group_controller::ListOperations {
1088        super::builder::node_group_controller::ListOperations::new(self.inner.clone())
1089    }
1090
1091    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1092    ///
1093    /// [google.longrunning.Operations]: longrunning::client::Operations
1094    pub fn get_operation(&self) -> super::builder::node_group_controller::GetOperation {
1095        super::builder::node_group_controller::GetOperation::new(self.inner.clone())
1096    }
1097
1098    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1099    ///
1100    /// [google.longrunning.Operations]: longrunning::client::Operations
1101    pub fn delete_operation(&self) -> super::builder::node_group_controller::DeleteOperation {
1102        super::builder::node_group_controller::DeleteOperation::new(self.inner.clone())
1103    }
1104
1105    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1106    ///
1107    /// [google.longrunning.Operations]: longrunning::client::Operations
1108    pub fn cancel_operation(&self) -> super::builder::node_group_controller::CancelOperation {
1109        super::builder::node_group_controller::CancelOperation::new(self.inner.clone())
1110    }
1111}
1112
1113/// Implements a client for the Cloud Dataproc API.
1114///
1115/// # Example
1116/// ```
1117/// # tokio_test::block_on(async {
1118/// # use google_cloud_dataproc_v1::client::SessionTemplateController;
1119/// let client = SessionTemplateController::builder().build().await?;
1120/// // use `client` to make requests to the Cloud Dataproc API.
1121/// # gax::client_builder::Result::<()>::Ok(()) });
1122/// ```
1123///
1124/// # Service Description
1125///
1126/// The SessionTemplateController provides methods to manage session templates.
1127///
1128/// # Configuration
1129///
1130/// To configure `SessionTemplateController` use the `with_*` methods in the type returned
1131/// by [builder()][SessionTemplateController::builder]. The default configuration should
1132/// work for most applications. Common configuration changes include
1133///
1134/// * [with_endpoint()]: by default this client uses the global default endpoint
1135///   (`https://dataproc.googleapis.com`). Applications using regional
1136///   endpoints or running in restricted networks (e.g. a network configured
1137//    with [Private Google Access with VPC Service Controls]) may want to
1138///   override this default.
1139/// * [with_credentials()]: by default this client uses
1140///   [Application Default Credentials]. Applications using custom
1141///   authentication may need to override this default.
1142///
1143/// [with_endpoint()]: super::builder::session_template_controller::ClientBuilder::with_endpoint
1144/// [with_credentials()]: super::builder::session_template_controller::ClientBuilder::credentials
1145/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1146/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1147///
1148/// # Pooling and Cloning
1149///
1150/// `SessionTemplateController` holds a connection pool internally, it is advised to
1151/// create one and the reuse it.  You do not need to wrap `SessionTemplateController` in
1152/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1153/// already uses an `Arc` internally.
1154#[derive(Clone, Debug)]
1155pub struct SessionTemplateController {
1156    inner: std::sync::Arc<dyn super::stub::dynamic::SessionTemplateController>,
1157}
1158
1159impl SessionTemplateController {
1160    /// Returns a builder for [SessionTemplateController].
1161    ///
1162    /// ```
1163    /// # tokio_test::block_on(async {
1164    /// # use google_cloud_dataproc_v1::client::SessionTemplateController;
1165    /// let client = SessionTemplateController::builder().build().await?;
1166    /// # gax::client_builder::Result::<()>::Ok(()) });
1167    /// ```
1168    pub fn builder() -> super::builder::session_template_controller::ClientBuilder {
1169        gax::client_builder::internal::new_builder(
1170            super::builder::session_template_controller::client::Factory,
1171        )
1172    }
1173
1174    /// Creates a new client from the provided stub.
1175    ///
1176    /// The most common case for calling this function is in tests mocking the
1177    /// client's behavior.
1178    pub fn from_stub<T>(stub: T) -> Self
1179    where
1180        T: super::stub::SessionTemplateController + 'static,
1181    {
1182        Self {
1183            inner: std::sync::Arc::new(stub),
1184        }
1185    }
1186
1187    pub(crate) async fn new(
1188        config: gaxi::options::ClientConfig,
1189    ) -> gax::client_builder::Result<Self> {
1190        let inner = Self::build_inner(config).await?;
1191        Ok(Self { inner })
1192    }
1193
1194    async fn build_inner(
1195        conf: gaxi::options::ClientConfig,
1196    ) -> gax::client_builder::Result<
1197        std::sync::Arc<dyn super::stub::dynamic::SessionTemplateController>,
1198    > {
1199        if gaxi::options::tracing_enabled(&conf) {
1200            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1201        }
1202        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1203    }
1204
1205    async fn build_transport(
1206        conf: gaxi::options::ClientConfig,
1207    ) -> gax::client_builder::Result<impl super::stub::SessionTemplateController> {
1208        super::transport::SessionTemplateController::new(conf).await
1209    }
1210
1211    async fn build_with_tracing(
1212        conf: gaxi::options::ClientConfig,
1213    ) -> gax::client_builder::Result<impl super::stub::SessionTemplateController> {
1214        Self::build_transport(conf)
1215            .await
1216            .map(super::tracing::SessionTemplateController::new)
1217    }
1218
1219    /// Create a session template synchronously.
1220    pub fn create_session_template(
1221        &self,
1222    ) -> super::builder::session_template_controller::CreateSessionTemplate {
1223        super::builder::session_template_controller::CreateSessionTemplate::new(self.inner.clone())
1224    }
1225
1226    /// Updates the session template synchronously.
1227    pub fn update_session_template(
1228        &self,
1229    ) -> super::builder::session_template_controller::UpdateSessionTemplate {
1230        super::builder::session_template_controller::UpdateSessionTemplate::new(self.inner.clone())
1231    }
1232
1233    /// Gets the resource representation for a session template.
1234    pub fn get_session_template(
1235        &self,
1236    ) -> super::builder::session_template_controller::GetSessionTemplate {
1237        super::builder::session_template_controller::GetSessionTemplate::new(self.inner.clone())
1238    }
1239
1240    /// Lists session templates.
1241    pub fn list_session_templates(
1242        &self,
1243    ) -> super::builder::session_template_controller::ListSessionTemplates {
1244        super::builder::session_template_controller::ListSessionTemplates::new(self.inner.clone())
1245    }
1246
1247    /// Deletes a session template.
1248    pub fn delete_session_template(
1249        &self,
1250    ) -> super::builder::session_template_controller::DeleteSessionTemplate {
1251        super::builder::session_template_controller::DeleteSessionTemplate::new(self.inner.clone())
1252    }
1253
1254    /// Sets the access control policy on the specified resource. Replaces
1255    /// any existing policy.
1256    ///
1257    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1258    /// errors.
1259    pub fn set_iam_policy(&self) -> super::builder::session_template_controller::SetIamPolicy {
1260        super::builder::session_template_controller::SetIamPolicy::new(self.inner.clone())
1261    }
1262
1263    /// Gets the access control policy for a resource. Returns an empty policy
1264    /// if the resource exists and does not have a policy set.
1265    pub fn get_iam_policy(&self) -> super::builder::session_template_controller::GetIamPolicy {
1266        super::builder::session_template_controller::GetIamPolicy::new(self.inner.clone())
1267    }
1268
1269    /// Returns permissions that a caller has on the specified resource. If the
1270    /// resource does not exist, this will return an empty set of
1271    /// permissions, not a `NOT_FOUND` error.
1272    ///
1273    /// Note: This operation is designed to be used for building
1274    /// permission-aware UIs and command-line tools, not for authorization
1275    /// checking. This operation may "fail open" without warning.
1276    pub fn test_iam_permissions(
1277        &self,
1278    ) -> super::builder::session_template_controller::TestIamPermissions {
1279        super::builder::session_template_controller::TestIamPermissions::new(self.inner.clone())
1280    }
1281
1282    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1283    ///
1284    /// [google.longrunning.Operations]: longrunning::client::Operations
1285    pub fn list_operations(&self) -> super::builder::session_template_controller::ListOperations {
1286        super::builder::session_template_controller::ListOperations::new(self.inner.clone())
1287    }
1288
1289    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1290    ///
1291    /// [google.longrunning.Operations]: longrunning::client::Operations
1292    pub fn get_operation(&self) -> super::builder::session_template_controller::GetOperation {
1293        super::builder::session_template_controller::GetOperation::new(self.inner.clone())
1294    }
1295
1296    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1297    ///
1298    /// [google.longrunning.Operations]: longrunning::client::Operations
1299    pub fn delete_operation(&self) -> super::builder::session_template_controller::DeleteOperation {
1300        super::builder::session_template_controller::DeleteOperation::new(self.inner.clone())
1301    }
1302
1303    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1304    ///
1305    /// [google.longrunning.Operations]: longrunning::client::Operations
1306    pub fn cancel_operation(&self) -> super::builder::session_template_controller::CancelOperation {
1307        super::builder::session_template_controller::CancelOperation::new(self.inner.clone())
1308    }
1309}
1310
1311/// Implements a client for the Cloud Dataproc API.
1312///
1313/// # Example
1314/// ```
1315/// # tokio_test::block_on(async {
1316/// # use google_cloud_dataproc_v1::client::SessionController;
1317/// let client = SessionController::builder().build().await?;
1318/// // use `client` to make requests to the Cloud Dataproc API.
1319/// # gax::client_builder::Result::<()>::Ok(()) });
1320/// ```
1321///
1322/// # Service Description
1323///
1324/// The `SessionController` provides methods to manage interactive sessions.
1325///
1326/// # Configuration
1327///
1328/// To configure `SessionController` use the `with_*` methods in the type returned
1329/// by [builder()][SessionController::builder]. The default configuration should
1330/// work for most applications. Common configuration changes include
1331///
1332/// * [with_endpoint()]: by default this client uses the global default endpoint
1333///   (`https://dataproc.googleapis.com`). Applications using regional
1334///   endpoints or running in restricted networks (e.g. a network configured
1335//    with [Private Google Access with VPC Service Controls]) may want to
1336///   override this default.
1337/// * [with_credentials()]: by default this client uses
1338///   [Application Default Credentials]. Applications using custom
1339///   authentication may need to override this default.
1340///
1341/// [with_endpoint()]: super::builder::session_controller::ClientBuilder::with_endpoint
1342/// [with_credentials()]: super::builder::session_controller::ClientBuilder::credentials
1343/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1344/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1345///
1346/// # Pooling and Cloning
1347///
1348/// `SessionController` holds a connection pool internally, it is advised to
1349/// create one and the reuse it.  You do not need to wrap `SessionController` in
1350/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1351/// already uses an `Arc` internally.
1352#[derive(Clone, Debug)]
1353pub struct SessionController {
1354    inner: std::sync::Arc<dyn super::stub::dynamic::SessionController>,
1355}
1356
1357impl SessionController {
1358    /// Returns a builder for [SessionController].
1359    ///
1360    /// ```
1361    /// # tokio_test::block_on(async {
1362    /// # use google_cloud_dataproc_v1::client::SessionController;
1363    /// let client = SessionController::builder().build().await?;
1364    /// # gax::client_builder::Result::<()>::Ok(()) });
1365    /// ```
1366    pub fn builder() -> super::builder::session_controller::ClientBuilder {
1367        gax::client_builder::internal::new_builder(
1368            super::builder::session_controller::client::Factory,
1369        )
1370    }
1371
1372    /// Creates a new client from the provided stub.
1373    ///
1374    /// The most common case for calling this function is in tests mocking the
1375    /// client's behavior.
1376    pub fn from_stub<T>(stub: T) -> Self
1377    where
1378        T: super::stub::SessionController + 'static,
1379    {
1380        Self {
1381            inner: std::sync::Arc::new(stub),
1382        }
1383    }
1384
1385    pub(crate) async fn new(
1386        config: gaxi::options::ClientConfig,
1387    ) -> gax::client_builder::Result<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    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionController>>
1395    {
1396        if gaxi::options::tracing_enabled(&conf) {
1397            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1398        }
1399        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1400    }
1401
1402    async fn build_transport(
1403        conf: gaxi::options::ClientConfig,
1404    ) -> gax::client_builder::Result<impl super::stub::SessionController> {
1405        super::transport::SessionController::new(conf).await
1406    }
1407
1408    async fn build_with_tracing(
1409        conf: gaxi::options::ClientConfig,
1410    ) -> gax::client_builder::Result<impl super::stub::SessionController> {
1411        Self::build_transport(conf)
1412            .await
1413            .map(super::tracing::SessionController::new)
1414    }
1415
1416    /// Create an interactive session asynchronously.
1417    ///
1418    /// # Long running operations
1419    ///
1420    /// This method is used to start, and/or poll a [long-running Operation].
1421    /// The [Working with long-running operations] chapter in the [user guide]
1422    /// covers these operations in detail.
1423    ///
1424    /// [long-running operation]: https://google.aip.dev/151
1425    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1426    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1427    pub fn create_session(&self) -> super::builder::session_controller::CreateSession {
1428        super::builder::session_controller::CreateSession::new(self.inner.clone())
1429    }
1430
1431    /// Gets the resource representation for an interactive session.
1432    pub fn get_session(&self) -> super::builder::session_controller::GetSession {
1433        super::builder::session_controller::GetSession::new(self.inner.clone())
1434    }
1435
1436    /// Lists interactive sessions.
1437    pub fn list_sessions(&self) -> super::builder::session_controller::ListSessions {
1438        super::builder::session_controller::ListSessions::new(self.inner.clone())
1439    }
1440
1441    /// Terminates the interactive session.
1442    ///
1443    /// # Long running operations
1444    ///
1445    /// This method is used to start, and/or poll a [long-running Operation].
1446    /// The [Working with long-running operations] chapter in the [user guide]
1447    /// covers these operations in detail.
1448    ///
1449    /// [long-running operation]: https://google.aip.dev/151
1450    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1451    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1452    pub fn terminate_session(&self) -> super::builder::session_controller::TerminateSession {
1453        super::builder::session_controller::TerminateSession::new(self.inner.clone())
1454    }
1455
1456    /// Deletes the interactive session resource. If the session is not in terminal
1457    /// state, it is terminated, and then deleted.
1458    ///
1459    /// # Long running operations
1460    ///
1461    /// This method is used to start, and/or poll a [long-running Operation].
1462    /// The [Working with long-running operations] chapter in the [user guide]
1463    /// covers these operations in detail.
1464    ///
1465    /// [long-running operation]: https://google.aip.dev/151
1466    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1467    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1468    pub fn delete_session(&self) -> super::builder::session_controller::DeleteSession {
1469        super::builder::session_controller::DeleteSession::new(self.inner.clone())
1470    }
1471
1472    /// Sets the access control policy on the specified resource. Replaces
1473    /// any existing policy.
1474    ///
1475    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1476    /// errors.
1477    pub fn set_iam_policy(&self) -> super::builder::session_controller::SetIamPolicy {
1478        super::builder::session_controller::SetIamPolicy::new(self.inner.clone())
1479    }
1480
1481    /// Gets the access control policy for a resource. Returns an empty policy
1482    /// if the resource exists and does not have a policy set.
1483    pub fn get_iam_policy(&self) -> super::builder::session_controller::GetIamPolicy {
1484        super::builder::session_controller::GetIamPolicy::new(self.inner.clone())
1485    }
1486
1487    /// Returns permissions that a caller has on the specified resource. If the
1488    /// resource does not exist, this will return an empty set of
1489    /// permissions, not a `NOT_FOUND` error.
1490    ///
1491    /// Note: This operation is designed to be used for building
1492    /// permission-aware UIs and command-line tools, not for authorization
1493    /// checking. This operation may "fail open" without warning.
1494    pub fn test_iam_permissions(&self) -> super::builder::session_controller::TestIamPermissions {
1495        super::builder::session_controller::TestIamPermissions::new(self.inner.clone())
1496    }
1497
1498    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1499    ///
1500    /// [google.longrunning.Operations]: longrunning::client::Operations
1501    pub fn list_operations(&self) -> super::builder::session_controller::ListOperations {
1502        super::builder::session_controller::ListOperations::new(self.inner.clone())
1503    }
1504
1505    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1506    ///
1507    /// [google.longrunning.Operations]: longrunning::client::Operations
1508    pub fn get_operation(&self) -> super::builder::session_controller::GetOperation {
1509        super::builder::session_controller::GetOperation::new(self.inner.clone())
1510    }
1511
1512    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1513    ///
1514    /// [google.longrunning.Operations]: longrunning::client::Operations
1515    pub fn delete_operation(&self) -> super::builder::session_controller::DeleteOperation {
1516        super::builder::session_controller::DeleteOperation::new(self.inner.clone())
1517    }
1518
1519    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1520    ///
1521    /// [google.longrunning.Operations]: longrunning::client::Operations
1522    pub fn cancel_operation(&self) -> super::builder::session_controller::CancelOperation {
1523        super::builder::session_controller::CancelOperation::new(self.inner.clone())
1524    }
1525}
1526
1527/// Implements a client for the Cloud Dataproc API.
1528///
1529/// # Example
1530/// ```
1531/// # tokio_test::block_on(async {
1532/// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
1533/// let client = WorkflowTemplateService::builder().build().await?;
1534/// // use `client` to make requests to the Cloud Dataproc API.
1535/// # gax::client_builder::Result::<()>::Ok(()) });
1536/// ```
1537///
1538/// # Service Description
1539///
1540/// The API interface for managing Workflow Templates in the
1541/// Dataproc API.
1542///
1543/// # Configuration
1544///
1545/// To configure `WorkflowTemplateService` use the `with_*` methods in the type returned
1546/// by [builder()][WorkflowTemplateService::builder]. The default configuration should
1547/// work for most applications. Common configuration changes include
1548///
1549/// * [with_endpoint()]: by default this client uses the global default endpoint
1550///   (`https://dataproc.googleapis.com`). Applications using regional
1551///   endpoints or running in restricted networks (e.g. a network configured
1552//    with [Private Google Access with VPC Service Controls]) may want to
1553///   override this default.
1554/// * [with_credentials()]: by default this client uses
1555///   [Application Default Credentials]. Applications using custom
1556///   authentication may need to override this default.
1557///
1558/// [with_endpoint()]: super::builder::workflow_template_service::ClientBuilder::with_endpoint
1559/// [with_credentials()]: super::builder::workflow_template_service::ClientBuilder::credentials
1560/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1561/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1562///
1563/// # Pooling and Cloning
1564///
1565/// `WorkflowTemplateService` holds a connection pool internally, it is advised to
1566/// create one and the reuse it.  You do not need to wrap `WorkflowTemplateService` in
1567/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1568/// already uses an `Arc` internally.
1569#[derive(Clone, Debug)]
1570pub struct WorkflowTemplateService {
1571    inner: std::sync::Arc<dyn super::stub::dynamic::WorkflowTemplateService>,
1572}
1573
1574impl WorkflowTemplateService {
1575    /// Returns a builder for [WorkflowTemplateService].
1576    ///
1577    /// ```
1578    /// # tokio_test::block_on(async {
1579    /// # use google_cloud_dataproc_v1::client::WorkflowTemplateService;
1580    /// let client = WorkflowTemplateService::builder().build().await?;
1581    /// # gax::client_builder::Result::<()>::Ok(()) });
1582    /// ```
1583    pub fn builder() -> super::builder::workflow_template_service::ClientBuilder {
1584        gax::client_builder::internal::new_builder(
1585            super::builder::workflow_template_service::client::Factory,
1586        )
1587    }
1588
1589    /// Creates a new client from the provided stub.
1590    ///
1591    /// The most common case for calling this function is in tests mocking the
1592    /// client's behavior.
1593    pub fn from_stub<T>(stub: T) -> Self
1594    where
1595        T: super::stub::WorkflowTemplateService + 'static,
1596    {
1597        Self {
1598            inner: std::sync::Arc::new(stub),
1599        }
1600    }
1601
1602    pub(crate) async fn new(
1603        config: gaxi::options::ClientConfig,
1604    ) -> gax::client_builder::Result<Self> {
1605        let inner = Self::build_inner(config).await?;
1606        Ok(Self { inner })
1607    }
1608
1609    async fn build_inner(
1610        conf: gaxi::options::ClientConfig,
1611    ) -> gax::client_builder::Result<
1612        std::sync::Arc<dyn super::stub::dynamic::WorkflowTemplateService>,
1613    > {
1614        if gaxi::options::tracing_enabled(&conf) {
1615            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1616        }
1617        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1618    }
1619
1620    async fn build_transport(
1621        conf: gaxi::options::ClientConfig,
1622    ) -> gax::client_builder::Result<impl super::stub::WorkflowTemplateService> {
1623        super::transport::WorkflowTemplateService::new(conf).await
1624    }
1625
1626    async fn build_with_tracing(
1627        conf: gaxi::options::ClientConfig,
1628    ) -> gax::client_builder::Result<impl super::stub::WorkflowTemplateService> {
1629        Self::build_transport(conf)
1630            .await
1631            .map(super::tracing::WorkflowTemplateService::new)
1632    }
1633
1634    /// Creates new workflow template.
1635    pub fn create_workflow_template(
1636        &self,
1637    ) -> super::builder::workflow_template_service::CreateWorkflowTemplate {
1638        super::builder::workflow_template_service::CreateWorkflowTemplate::new(self.inner.clone())
1639    }
1640
1641    /// Retrieves the latest workflow template.
1642    ///
1643    /// Can retrieve previously instantiated template by specifying optional
1644    /// version parameter.
1645    pub fn get_workflow_template(
1646        &self,
1647    ) -> super::builder::workflow_template_service::GetWorkflowTemplate {
1648        super::builder::workflow_template_service::GetWorkflowTemplate::new(self.inner.clone())
1649    }
1650
1651    /// Instantiates a template and begins execution.
1652    ///
1653    /// The returned Operation can be used to track execution of
1654    /// workflow by polling
1655    /// [operations.get][google.longrunning.Operations.GetOperation].
1656    /// The Operation will complete when entire workflow is finished.
1657    ///
1658    /// The running workflow can be aborted via
1659    /// [operations.cancel][google.longrunning.Operations.CancelOperation].
1660    /// This will cause any inflight jobs to be cancelled and workflow-owned
1661    /// clusters to be deleted.
1662    ///
1663    /// The [Operation.metadata][google.longrunning.Operation.metadata] will be
1664    /// [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
1665    /// Also see [Using
1666    /// WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
1667    ///
1668    /// On successful completion,
1669    /// [Operation.response][google.longrunning.Operation.response] will be
1670    /// [Empty][google.protobuf.Empty].
1671    ///
1672    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
1673    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
1674    /// [google.protobuf.Empty]: wkt::Empty
1675    ///
1676    /// # Long running operations
1677    ///
1678    /// This method is used to start, and/or poll a [long-running Operation].
1679    /// The [Working with long-running operations] chapter in the [user guide]
1680    /// covers these operations in detail.
1681    ///
1682    /// [long-running operation]: https://google.aip.dev/151
1683    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1684    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1685    pub fn instantiate_workflow_template(
1686        &self,
1687    ) -> super::builder::workflow_template_service::InstantiateWorkflowTemplate {
1688        super::builder::workflow_template_service::InstantiateWorkflowTemplate::new(
1689            self.inner.clone(),
1690        )
1691    }
1692
1693    /// Instantiates a template and begins execution.
1694    ///
1695    /// This method is equivalent to executing the sequence
1696    /// [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate],
1697    /// [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate],
1698    /// [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate].
1699    ///
1700    /// The returned Operation can be used to track execution of
1701    /// workflow by polling
1702    /// [operations.get][google.longrunning.Operations.GetOperation].
1703    /// The Operation will complete when entire workflow is finished.
1704    ///
1705    /// The running workflow can be aborted via
1706    /// [operations.cancel][google.longrunning.Operations.CancelOperation].
1707    /// This will cause any inflight jobs to be cancelled and workflow-owned
1708    /// clusters to be deleted.
1709    ///
1710    /// The [Operation.metadata][google.longrunning.Operation.metadata] will be
1711    /// [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata).
1712    /// Also see [Using
1713    /// WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).
1714    ///
1715    /// On successful completion,
1716    /// [Operation.response][google.longrunning.Operation.response] will be
1717    /// [Empty][google.protobuf.Empty].
1718    ///
1719    /// [google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate]: crate::client::WorkflowTemplateService::create_workflow_template
1720    /// [google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]: crate::client::WorkflowTemplateService::delete_workflow_template
1721    /// [google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate]: crate::client::WorkflowTemplateService::instantiate_workflow_template
1722    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
1723    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
1724    /// [google.protobuf.Empty]: wkt::Empty
1725    ///
1726    /// # Long running operations
1727    ///
1728    /// This method is used to start, and/or poll a [long-running Operation].
1729    /// The [Working with long-running operations] chapter in the [user guide]
1730    /// covers these operations in detail.
1731    ///
1732    /// [long-running operation]: https://google.aip.dev/151
1733    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1734    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1735    pub fn instantiate_inline_workflow_template(
1736        &self,
1737    ) -> super::builder::workflow_template_service::InstantiateInlineWorkflowTemplate {
1738        super::builder::workflow_template_service::InstantiateInlineWorkflowTemplate::new(
1739            self.inner.clone(),
1740        )
1741    }
1742
1743    /// Updates (replaces) workflow template. The updated template
1744    /// must contain version that matches the current server version.
1745    pub fn update_workflow_template(
1746        &self,
1747    ) -> super::builder::workflow_template_service::UpdateWorkflowTemplate {
1748        super::builder::workflow_template_service::UpdateWorkflowTemplate::new(self.inner.clone())
1749    }
1750
1751    /// Lists workflows that match the specified filter in the request.
1752    pub fn list_workflow_templates(
1753        &self,
1754    ) -> super::builder::workflow_template_service::ListWorkflowTemplates {
1755        super::builder::workflow_template_service::ListWorkflowTemplates::new(self.inner.clone())
1756    }
1757
1758    /// Deletes a workflow template. It does not cancel in-progress workflows.
1759    pub fn delete_workflow_template(
1760        &self,
1761    ) -> super::builder::workflow_template_service::DeleteWorkflowTemplate {
1762        super::builder::workflow_template_service::DeleteWorkflowTemplate::new(self.inner.clone())
1763    }
1764
1765    /// Sets the access control policy on the specified resource. Replaces
1766    /// any existing policy.
1767    ///
1768    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1769    /// errors.
1770    pub fn set_iam_policy(&self) -> super::builder::workflow_template_service::SetIamPolicy {
1771        super::builder::workflow_template_service::SetIamPolicy::new(self.inner.clone())
1772    }
1773
1774    /// Gets the access control policy for a resource. Returns an empty policy
1775    /// if the resource exists and does not have a policy set.
1776    pub fn get_iam_policy(&self) -> super::builder::workflow_template_service::GetIamPolicy {
1777        super::builder::workflow_template_service::GetIamPolicy::new(self.inner.clone())
1778    }
1779
1780    /// Returns permissions that a caller has on the specified resource. If the
1781    /// resource does not exist, this will return an empty set of
1782    /// permissions, not a `NOT_FOUND` error.
1783    ///
1784    /// Note: This operation is designed to be used for building
1785    /// permission-aware UIs and command-line tools, not for authorization
1786    /// checking. This operation may "fail open" without warning.
1787    pub fn test_iam_permissions(
1788        &self,
1789    ) -> super::builder::workflow_template_service::TestIamPermissions {
1790        super::builder::workflow_template_service::TestIamPermissions::new(self.inner.clone())
1791    }
1792
1793    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1794    ///
1795    /// [google.longrunning.Operations]: longrunning::client::Operations
1796    pub fn list_operations(&self) -> super::builder::workflow_template_service::ListOperations {
1797        super::builder::workflow_template_service::ListOperations::new(self.inner.clone())
1798    }
1799
1800    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1801    ///
1802    /// [google.longrunning.Operations]: longrunning::client::Operations
1803    pub fn get_operation(&self) -> super::builder::workflow_template_service::GetOperation {
1804        super::builder::workflow_template_service::GetOperation::new(self.inner.clone())
1805    }
1806
1807    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1808    ///
1809    /// [google.longrunning.Operations]: longrunning::client::Operations
1810    pub fn delete_operation(&self) -> super::builder::workflow_template_service::DeleteOperation {
1811        super::builder::workflow_template_service::DeleteOperation::new(self.inner.clone())
1812    }
1813
1814    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1815    ///
1816    /// [google.longrunning.Operations]: longrunning::client::Operations
1817    pub fn cancel_operation(&self) -> super::builder::workflow_template_service::CancelOperation {
1818        super::builder::workflow_template_service::CancelOperation::new(self.inner.clone())
1819    }
1820}