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