google_cloud_run_v2/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 Run Admin API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_run_v2::client::Builds;
24/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
25/// let client = Builds::builder().build().await?;
26/// let response = client.submit_build()
27/// /* set fields */
28/// .send().await?;
29/// println!("response {:?}", response);
30/// # Ok(()) }
31/// ```
32///
33/// # Service Description
34///
35/// Cloud Run Build Control Plane API
36///
37/// # Configuration
38///
39/// To configure `Builds` use the `with_*` methods in the type returned
40/// by [builder()][Builds::builder]. The default configuration should
41/// work for most applications. Common configuration changes include
42///
43/// * [with_endpoint()]: by default this client uses the global default endpoint
44/// (`https://run.googleapis.com`). Applications using regional
45/// endpoints or running in restricted networks (e.g. a network configured
46// with [Private Google Access with VPC Service Controls]) may want to
47/// override this default.
48/// * [with_credentials()]: by default this client uses
49/// [Application Default Credentials]. Applications using custom
50/// authentication may need to override this default.
51///
52/// [with_endpoint()]: super::builder::builds::ClientBuilder::with_endpoint
53/// [with_credentials()]: super::builder::builds::ClientBuilder::with_credentials
54/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
55/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
56///
57/// # Pooling and Cloning
58///
59/// `Builds` holds a connection pool internally, it is advised to
60/// create one and reuse it. You do not need to wrap `Builds` in
61/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
62/// already uses an `Arc` internally.
63#[derive(Clone, Debug)]
64pub struct Builds {
65 inner: std::sync::Arc<dyn super::stub::dynamic::Builds>,
66}
67
68impl Builds {
69 /// Returns a builder for [Builds].
70 ///
71 /// ```
72 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
73 /// # use google_cloud_run_v2::client::Builds;
74 /// let client = Builds::builder().build().await?;
75 /// # Ok(()) }
76 /// ```
77 pub fn builder() -> super::builder::builds::ClientBuilder {
78 crate::new_client_builder(super::builder::builds::client::Factory)
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::Builds + '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 ) -> crate::ClientBuilderResult<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 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Builds>> {
104 if gaxi::options::tracing_enabled(&conf) {
105 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
106 }
107 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
108 }
109
110 async fn build_transport(
111 conf: gaxi::options::ClientConfig,
112 ) -> crate::ClientBuilderResult<impl super::stub::Builds> {
113 super::transport::Builds::new(conf).await
114 }
115
116 async fn build_with_tracing(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::Builds> {
119 Self::build_transport(conf)
120 .await
121 .map(super::tracing::Builds::new)
122 }
123
124 /// Submits a build in a given project.
125 ///
126 /// # Example
127 /// ```
128 /// # use google_cloud_run_v2::client::Builds;
129 /// use google_cloud_run_v2::Result;
130 /// async fn sample(
131 /// client: &Builds
132 /// ) -> Result<()> {
133 /// let response = client.submit_build()
134 /// /* set fields */
135 /// .send().await?;
136 /// println!("response {:?}", response);
137 /// Ok(())
138 /// }
139 /// ```
140 pub fn submit_build(&self) -> super::builder::builds::SubmitBuild {
141 super::builder::builds::SubmitBuild::new(self.inner.clone())
142 }
143
144 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
145 ///
146 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
147 ///
148 /// # Example
149 /// ```
150 /// # use google_cloud_run_v2::client::Builds;
151 /// use google_cloud_gax::paginator::ItemPaginator as _;
152 /// use google_cloud_run_v2::Result;
153 /// async fn sample(
154 /// client: &Builds
155 /// ) -> Result<()> {
156 /// let mut list = client.list_operations()
157 /// /* set fields */
158 /// .by_item();
159 /// while let Some(item) = list.next().await.transpose()? {
160 /// println!("{:?}", item);
161 /// }
162 /// Ok(())
163 /// }
164 /// ```
165 pub fn list_operations(&self) -> super::builder::builds::ListOperations {
166 super::builder::builds::ListOperations::new(self.inner.clone())
167 }
168
169 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
170 ///
171 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
172 ///
173 /// # Example
174 /// ```
175 /// # use google_cloud_run_v2::client::Builds;
176 /// use google_cloud_run_v2::Result;
177 /// async fn sample(
178 /// client: &Builds
179 /// ) -> Result<()> {
180 /// let response = client.get_operation()
181 /// /* set fields */
182 /// .send().await?;
183 /// println!("response {:?}", response);
184 /// Ok(())
185 /// }
186 /// ```
187 pub fn get_operation(&self) -> super::builder::builds::GetOperation {
188 super::builder::builds::GetOperation::new(self.inner.clone())
189 }
190
191 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
192 ///
193 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
194 ///
195 /// # Example
196 /// ```
197 /// # use google_cloud_run_v2::client::Builds;
198 /// use google_cloud_run_v2::Result;
199 /// async fn sample(
200 /// client: &Builds
201 /// ) -> Result<()> {
202 /// client.delete_operation()
203 /// /* set fields */
204 /// .send().await?;
205 /// Ok(())
206 /// }
207 /// ```
208 pub fn delete_operation(&self) -> super::builder::builds::DeleteOperation {
209 super::builder::builds::DeleteOperation::new(self.inner.clone())
210 }
211
212 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
213 ///
214 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
215 ///
216 /// # Example
217 /// ```
218 /// # use google_cloud_run_v2::client::Builds;
219 /// use google_cloud_run_v2::Result;
220 /// async fn sample(
221 /// client: &Builds
222 /// ) -> Result<()> {
223 /// let response = client.wait_operation()
224 /// /* set fields */
225 /// .send().await?;
226 /// println!("response {:?}", response);
227 /// Ok(())
228 /// }
229 /// ```
230 pub fn wait_operation(&self) -> super::builder::builds::WaitOperation {
231 super::builder::builds::WaitOperation::new(self.inner.clone())
232 }
233}
234
235/// Implements a client for the Cloud Run Admin API.
236///
237/// # Example
238/// ```
239/// # use google_cloud_run_v2::client::Executions;
240/// use google_cloud_gax::paginator::ItemPaginator as _;
241/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
242/// let client = Executions::builder().build().await?;
243/// let parent = "parent_value";
244/// let mut list = client.list_executions()
245/// .set_parent(parent)
246/// .by_item();
247/// while let Some(item) = list.next().await.transpose()? {
248/// println!("{:?}", item);
249/// }
250/// # Ok(()) }
251/// ```
252///
253/// # Service Description
254///
255/// Cloud Run Execution Control Plane API.
256///
257/// # Configuration
258///
259/// To configure `Executions` use the `with_*` methods in the type returned
260/// by [builder()][Executions::builder]. The default configuration should
261/// work for most applications. Common configuration changes include
262///
263/// * [with_endpoint()]: by default this client uses the global default endpoint
264/// (`https://run.googleapis.com`). Applications using regional
265/// endpoints or running in restricted networks (e.g. a network configured
266// with [Private Google Access with VPC Service Controls]) may want to
267/// override this default.
268/// * [with_credentials()]: by default this client uses
269/// [Application Default Credentials]. Applications using custom
270/// authentication may need to override this default.
271///
272/// [with_endpoint()]: super::builder::executions::ClientBuilder::with_endpoint
273/// [with_credentials()]: super::builder::executions::ClientBuilder::with_credentials
274/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
275/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
276///
277/// # Pooling and Cloning
278///
279/// `Executions` holds a connection pool internally, it is advised to
280/// create one and reuse it. You do not need to wrap `Executions` in
281/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
282/// already uses an `Arc` internally.
283#[derive(Clone, Debug)]
284pub struct Executions {
285 inner: std::sync::Arc<dyn super::stub::dynamic::Executions>,
286}
287
288impl Executions {
289 /// Returns a builder for [Executions].
290 ///
291 /// ```
292 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
293 /// # use google_cloud_run_v2::client::Executions;
294 /// let client = Executions::builder().build().await?;
295 /// # Ok(()) }
296 /// ```
297 pub fn builder() -> super::builder::executions::ClientBuilder {
298 crate::new_client_builder(super::builder::executions::client::Factory)
299 }
300
301 /// Creates a new client from the provided stub.
302 ///
303 /// The most common case for calling this function is in tests mocking the
304 /// client's behavior.
305 pub fn from_stub<T>(stub: T) -> Self
306 where
307 T: super::stub::Executions + 'static,
308 {
309 Self {
310 inner: std::sync::Arc::new(stub),
311 }
312 }
313
314 pub(crate) async fn new(
315 config: gaxi::options::ClientConfig,
316 ) -> crate::ClientBuilderResult<Self> {
317 let inner = Self::build_inner(config).await?;
318 Ok(Self { inner })
319 }
320
321 async fn build_inner(
322 conf: gaxi::options::ClientConfig,
323 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Executions>> {
324 if gaxi::options::tracing_enabled(&conf) {
325 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
326 }
327 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
328 }
329
330 async fn build_transport(
331 conf: gaxi::options::ClientConfig,
332 ) -> crate::ClientBuilderResult<impl super::stub::Executions> {
333 super::transport::Executions::new(conf).await
334 }
335
336 async fn build_with_tracing(
337 conf: gaxi::options::ClientConfig,
338 ) -> crate::ClientBuilderResult<impl super::stub::Executions> {
339 Self::build_transport(conf)
340 .await
341 .map(super::tracing::Executions::new)
342 }
343
344 /// Gets information about an Execution.
345 ///
346 /// # Example
347 /// ```
348 /// # use google_cloud_run_v2::client::Executions;
349 /// use google_cloud_run_v2::Result;
350 /// async fn sample(
351 /// client: &Executions, name: &str
352 /// ) -> Result<()> {
353 /// let response = client.get_execution()
354 /// .set_name(name)
355 /// .send().await?;
356 /// println!("response {:?}", response);
357 /// Ok(())
358 /// }
359 /// ```
360 pub fn get_execution(&self) -> super::builder::executions::GetExecution {
361 super::builder::executions::GetExecution::new(self.inner.clone())
362 }
363
364 /// Lists Executions from a Job. Results are sorted by creation time,
365 /// descending.
366 ///
367 /// # Example
368 /// ```
369 /// # use google_cloud_run_v2::client::Executions;
370 /// use google_cloud_gax::paginator::ItemPaginator as _;
371 /// use google_cloud_run_v2::Result;
372 /// async fn sample(
373 /// client: &Executions, parent: &str
374 /// ) -> Result<()> {
375 /// let mut list = client.list_executions()
376 /// .set_parent(parent)
377 /// .by_item();
378 /// while let Some(item) = list.next().await.transpose()? {
379 /// println!("{:?}", item);
380 /// }
381 /// Ok(())
382 /// }
383 /// ```
384 pub fn list_executions(&self) -> super::builder::executions::ListExecutions {
385 super::builder::executions::ListExecutions::new(self.inner.clone())
386 }
387
388 /// Deletes an Execution.
389 ///
390 /// # Long running operations
391 ///
392 /// This method is used to start, and/or poll a [long-running Operation].
393 /// The [Working with long-running operations] chapter in the [user guide]
394 /// covers these operations in detail.
395 ///
396 /// [long-running operation]: https://google.aip.dev/151
397 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
398 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
399 ///
400 /// # Example
401 /// ```
402 /// # use google_cloud_run_v2::client::Executions;
403 /// use google_cloud_lro::Poller;
404 /// use google_cloud_run_v2::Result;
405 /// async fn sample(
406 /// client: &Executions, name: &str
407 /// ) -> Result<()> {
408 /// let response = client.delete_execution()
409 /// .set_name(name)
410 /// .poller().until_done().await?;
411 /// println!("response {:?}", response);
412 /// Ok(())
413 /// }
414 /// ```
415 pub fn delete_execution(&self) -> super::builder::executions::DeleteExecution {
416 super::builder::executions::DeleteExecution::new(self.inner.clone())
417 }
418
419 /// Cancels an Execution.
420 ///
421 /// # Long running operations
422 ///
423 /// This method is used to start, and/or poll a [long-running Operation].
424 /// The [Working with long-running operations] chapter in the [user guide]
425 /// covers these operations in detail.
426 ///
427 /// [long-running operation]: https://google.aip.dev/151
428 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
429 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
430 ///
431 /// # Example
432 /// ```
433 /// # use google_cloud_run_v2::client::Executions;
434 /// use google_cloud_lro::Poller;
435 /// use google_cloud_run_v2::Result;
436 /// async fn sample(
437 /// client: &Executions
438 /// ) -> Result<()> {
439 /// let response = client.cancel_execution()
440 /// /* set fields */
441 /// .poller().until_done().await?;
442 /// println!("response {:?}", response);
443 /// Ok(())
444 /// }
445 /// ```
446 pub fn cancel_execution(&self) -> super::builder::executions::CancelExecution {
447 super::builder::executions::CancelExecution::new(self.inner.clone())
448 }
449
450 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
451 ///
452 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
453 ///
454 /// # Example
455 /// ```
456 /// # use google_cloud_run_v2::client::Executions;
457 /// use google_cloud_gax::paginator::ItemPaginator as _;
458 /// use google_cloud_run_v2::Result;
459 /// async fn sample(
460 /// client: &Executions
461 /// ) -> Result<()> {
462 /// let mut list = client.list_operations()
463 /// /* set fields */
464 /// .by_item();
465 /// while let Some(item) = list.next().await.transpose()? {
466 /// println!("{:?}", item);
467 /// }
468 /// Ok(())
469 /// }
470 /// ```
471 pub fn list_operations(&self) -> super::builder::executions::ListOperations {
472 super::builder::executions::ListOperations::new(self.inner.clone())
473 }
474
475 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
476 ///
477 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
478 ///
479 /// # Example
480 /// ```
481 /// # use google_cloud_run_v2::client::Executions;
482 /// use google_cloud_run_v2::Result;
483 /// async fn sample(
484 /// client: &Executions
485 /// ) -> Result<()> {
486 /// let response = client.get_operation()
487 /// /* set fields */
488 /// .send().await?;
489 /// println!("response {:?}", response);
490 /// Ok(())
491 /// }
492 /// ```
493 pub fn get_operation(&self) -> super::builder::executions::GetOperation {
494 super::builder::executions::GetOperation::new(self.inner.clone())
495 }
496
497 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
498 ///
499 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
500 ///
501 /// # Example
502 /// ```
503 /// # use google_cloud_run_v2::client::Executions;
504 /// use google_cloud_run_v2::Result;
505 /// async fn sample(
506 /// client: &Executions
507 /// ) -> Result<()> {
508 /// client.delete_operation()
509 /// /* set fields */
510 /// .send().await?;
511 /// Ok(())
512 /// }
513 /// ```
514 pub fn delete_operation(&self) -> super::builder::executions::DeleteOperation {
515 super::builder::executions::DeleteOperation::new(self.inner.clone())
516 }
517
518 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
519 ///
520 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
521 ///
522 /// # Example
523 /// ```
524 /// # use google_cloud_run_v2::client::Executions;
525 /// use google_cloud_run_v2::Result;
526 /// async fn sample(
527 /// client: &Executions
528 /// ) -> Result<()> {
529 /// let response = client.wait_operation()
530 /// /* set fields */
531 /// .send().await?;
532 /// println!("response {:?}", response);
533 /// Ok(())
534 /// }
535 /// ```
536 pub fn wait_operation(&self) -> super::builder::executions::WaitOperation {
537 super::builder::executions::WaitOperation::new(self.inner.clone())
538 }
539}
540
541/// Implements a client for the Cloud Run Admin API.
542///
543/// # Example
544/// ```
545/// # use google_cloud_run_v2::client::Instances;
546/// use google_cloud_gax::paginator::ItemPaginator as _;
547/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
548/// let client = Instances::builder().build().await?;
549/// let parent = "parent_value";
550/// let mut list = client.list_instances()
551/// .set_parent(parent)
552/// .by_item();
553/// while let Some(item) = list.next().await.transpose()? {
554/// println!("{:?}", item);
555/// }
556/// # Ok(()) }
557/// ```
558///
559/// # Service Description
560///
561/// The Cloud Run Instances API allows you to manage Cloud Run Instances.
562///
563/// # Configuration
564///
565/// To configure `Instances` use the `with_*` methods in the type returned
566/// by [builder()][Instances::builder]. The default configuration should
567/// work for most applications. Common configuration changes include
568///
569/// * [with_endpoint()]: by default this client uses the global default endpoint
570/// (`https://run.googleapis.com`). Applications using regional
571/// endpoints or running in restricted networks (e.g. a network configured
572// with [Private Google Access with VPC Service Controls]) may want to
573/// override this default.
574/// * [with_credentials()]: by default this client uses
575/// [Application Default Credentials]. Applications using custom
576/// authentication may need to override this default.
577///
578/// [with_endpoint()]: super::builder::instances::ClientBuilder::with_endpoint
579/// [with_credentials()]: super::builder::instances::ClientBuilder::with_credentials
580/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
581/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
582///
583/// # Pooling and Cloning
584///
585/// `Instances` holds a connection pool internally, it is advised to
586/// create one and reuse it. You do not need to wrap `Instances` in
587/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
588/// already uses an `Arc` internally.
589#[derive(Clone, Debug)]
590pub struct Instances {
591 inner: std::sync::Arc<dyn super::stub::dynamic::Instances>,
592}
593
594impl Instances {
595 /// Returns a builder for [Instances].
596 ///
597 /// ```
598 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
599 /// # use google_cloud_run_v2::client::Instances;
600 /// let client = Instances::builder().build().await?;
601 /// # Ok(()) }
602 /// ```
603 pub fn builder() -> super::builder::instances::ClientBuilder {
604 crate::new_client_builder(super::builder::instances::client::Factory)
605 }
606
607 /// Creates a new client from the provided stub.
608 ///
609 /// The most common case for calling this function is in tests mocking the
610 /// client's behavior.
611 pub fn from_stub<T>(stub: T) -> Self
612 where
613 T: super::stub::Instances + 'static,
614 {
615 Self {
616 inner: std::sync::Arc::new(stub),
617 }
618 }
619
620 pub(crate) async fn new(
621 config: gaxi::options::ClientConfig,
622 ) -> crate::ClientBuilderResult<Self> {
623 let inner = Self::build_inner(config).await?;
624 Ok(Self { inner })
625 }
626
627 async fn build_inner(
628 conf: gaxi::options::ClientConfig,
629 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Instances>> {
630 if gaxi::options::tracing_enabled(&conf) {
631 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
632 }
633 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
634 }
635
636 async fn build_transport(
637 conf: gaxi::options::ClientConfig,
638 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
639 super::transport::Instances::new(conf).await
640 }
641
642 async fn build_with_tracing(
643 conf: gaxi::options::ClientConfig,
644 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
645 Self::build_transport(conf)
646 .await
647 .map(super::tracing::Instances::new)
648 }
649
650 /// Creates an Instance.
651 ///
652 /// # Long running operations
653 ///
654 /// This method is used to start, and/or poll a [long-running Operation].
655 /// The [Working with long-running operations] chapter in the [user guide]
656 /// covers these operations in detail.
657 ///
658 /// [long-running operation]: https://google.aip.dev/151
659 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
660 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
661 ///
662 /// # Example
663 /// ```
664 /// # use google_cloud_run_v2::client::Instances;
665 /// use google_cloud_lro::Poller;
666 /// use google_cloud_run_v2::model::Instance;
667 /// use google_cloud_run_v2::Result;
668 /// async fn sample(
669 /// client: &Instances, parent: &str
670 /// ) -> Result<()> {
671 /// let response = client.create_instance()
672 /// .set_parent(parent)
673 /// .set_instance_id("instance_id_value")
674 /// .set_instance(
675 /// Instance::new()/* set fields */
676 /// )
677 /// .poller().until_done().await?;
678 /// println!("response {:?}", response);
679 /// Ok(())
680 /// }
681 /// ```
682 pub fn create_instance(&self) -> super::builder::instances::CreateInstance {
683 super::builder::instances::CreateInstance::new(self.inner.clone())
684 }
685
686 /// Deletes a Instance
687 ///
688 /// # Long running operations
689 ///
690 /// This method is used to start, and/or poll a [long-running Operation].
691 /// The [Working with long-running operations] chapter in the [user guide]
692 /// covers these operations in detail.
693 ///
694 /// [long-running operation]: https://google.aip.dev/151
695 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
696 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
697 ///
698 /// # Example
699 /// ```
700 /// # use google_cloud_run_v2::client::Instances;
701 /// use google_cloud_lro::Poller;
702 /// use google_cloud_run_v2::Result;
703 /// async fn sample(
704 /// client: &Instances, name: &str
705 /// ) -> Result<()> {
706 /// let response = client.delete_instance()
707 /// .set_name(name)
708 /// .poller().until_done().await?;
709 /// println!("response {:?}", response);
710 /// Ok(())
711 /// }
712 /// ```
713 pub fn delete_instance(&self) -> super::builder::instances::DeleteInstance {
714 super::builder::instances::DeleteInstance::new(self.inner.clone())
715 }
716
717 /// Gets a Instance
718 ///
719 /// # Example
720 /// ```
721 /// # use google_cloud_run_v2::client::Instances;
722 /// use google_cloud_run_v2::Result;
723 /// async fn sample(
724 /// client: &Instances, name: &str
725 /// ) -> Result<()> {
726 /// let response = client.get_instance()
727 /// .set_name(name)
728 /// .send().await?;
729 /// println!("response {:?}", response);
730 /// Ok(())
731 /// }
732 /// ```
733 pub fn get_instance(&self) -> super::builder::instances::GetInstance {
734 super::builder::instances::GetInstance::new(self.inner.clone())
735 }
736
737 /// Lists Instances. Results are sorted by creation time, descending.
738 ///
739 /// # Example
740 /// ```
741 /// # use google_cloud_run_v2::client::Instances;
742 /// use google_cloud_gax::paginator::ItemPaginator as _;
743 /// use google_cloud_run_v2::Result;
744 /// async fn sample(
745 /// client: &Instances, parent: &str
746 /// ) -> Result<()> {
747 /// let mut list = client.list_instances()
748 /// .set_parent(parent)
749 /// .by_item();
750 /// while let Some(item) = list.next().await.transpose()? {
751 /// println!("{:?}", item);
752 /// }
753 /// Ok(())
754 /// }
755 /// ```
756 pub fn list_instances(&self) -> super::builder::instances::ListInstances {
757 super::builder::instances::ListInstances::new(self.inner.clone())
758 }
759
760 /// Stops an Instance.
761 ///
762 /// # Long running operations
763 ///
764 /// This method is used to start, and/or poll a [long-running Operation].
765 /// The [Working with long-running operations] chapter in the [user guide]
766 /// covers these operations in detail.
767 ///
768 /// [long-running operation]: https://google.aip.dev/151
769 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
770 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
771 ///
772 /// # Example
773 /// ```
774 /// # use google_cloud_run_v2::client::Instances;
775 /// use google_cloud_lro::Poller;
776 /// use google_cloud_run_v2::Result;
777 /// async fn sample(
778 /// client: &Instances
779 /// ) -> Result<()> {
780 /// let response = client.stop_instance()
781 /// /* set fields */
782 /// .poller().until_done().await?;
783 /// println!("response {:?}", response);
784 /// Ok(())
785 /// }
786 /// ```
787 pub fn stop_instance(&self) -> super::builder::instances::StopInstance {
788 super::builder::instances::StopInstance::new(self.inner.clone())
789 }
790
791 /// Starts an Instance.
792 ///
793 /// # Long running operations
794 ///
795 /// This method is used to start, and/or poll a [long-running Operation].
796 /// The [Working with long-running operations] chapter in the [user guide]
797 /// covers these operations in detail.
798 ///
799 /// [long-running operation]: https://google.aip.dev/151
800 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
801 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
802 ///
803 /// # Example
804 /// ```
805 /// # use google_cloud_run_v2::client::Instances;
806 /// use google_cloud_lro::Poller;
807 /// use google_cloud_run_v2::Result;
808 /// async fn sample(
809 /// client: &Instances
810 /// ) -> Result<()> {
811 /// let response = client.start_instance()
812 /// /* set fields */
813 /// .poller().until_done().await?;
814 /// println!("response {:?}", response);
815 /// Ok(())
816 /// }
817 /// ```
818 pub fn start_instance(&self) -> super::builder::instances::StartInstance {
819 super::builder::instances::StartInstance::new(self.inner.clone())
820 }
821
822 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
823 ///
824 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
825 ///
826 /// # Example
827 /// ```
828 /// # use google_cloud_run_v2::client::Instances;
829 /// use google_cloud_gax::paginator::ItemPaginator as _;
830 /// use google_cloud_run_v2::Result;
831 /// async fn sample(
832 /// client: &Instances
833 /// ) -> Result<()> {
834 /// let mut list = client.list_operations()
835 /// /* set fields */
836 /// .by_item();
837 /// while let Some(item) = list.next().await.transpose()? {
838 /// println!("{:?}", item);
839 /// }
840 /// Ok(())
841 /// }
842 /// ```
843 pub fn list_operations(&self) -> super::builder::instances::ListOperations {
844 super::builder::instances::ListOperations::new(self.inner.clone())
845 }
846
847 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
848 ///
849 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
850 ///
851 /// # Example
852 /// ```
853 /// # use google_cloud_run_v2::client::Instances;
854 /// use google_cloud_run_v2::Result;
855 /// async fn sample(
856 /// client: &Instances
857 /// ) -> Result<()> {
858 /// let response = client.get_operation()
859 /// /* set fields */
860 /// .send().await?;
861 /// println!("response {:?}", response);
862 /// Ok(())
863 /// }
864 /// ```
865 pub fn get_operation(&self) -> super::builder::instances::GetOperation {
866 super::builder::instances::GetOperation::new(self.inner.clone())
867 }
868
869 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
870 ///
871 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
872 ///
873 /// # Example
874 /// ```
875 /// # use google_cloud_run_v2::client::Instances;
876 /// use google_cloud_run_v2::Result;
877 /// async fn sample(
878 /// client: &Instances
879 /// ) -> Result<()> {
880 /// client.delete_operation()
881 /// /* set fields */
882 /// .send().await?;
883 /// Ok(())
884 /// }
885 /// ```
886 pub fn delete_operation(&self) -> super::builder::instances::DeleteOperation {
887 super::builder::instances::DeleteOperation::new(self.inner.clone())
888 }
889
890 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
891 ///
892 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
893 ///
894 /// # Example
895 /// ```
896 /// # use google_cloud_run_v2::client::Instances;
897 /// use google_cloud_run_v2::Result;
898 /// async fn sample(
899 /// client: &Instances
900 /// ) -> Result<()> {
901 /// let response = client.wait_operation()
902 /// /* set fields */
903 /// .send().await?;
904 /// println!("response {:?}", response);
905 /// Ok(())
906 /// }
907 /// ```
908 pub fn wait_operation(&self) -> super::builder::instances::WaitOperation {
909 super::builder::instances::WaitOperation::new(self.inner.clone())
910 }
911}
912
913/// Implements a client for the Cloud Run Admin API.
914///
915/// # Example
916/// ```
917/// # use google_cloud_run_v2::client::Jobs;
918/// use google_cloud_gax::paginator::ItemPaginator as _;
919/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
920/// let client = Jobs::builder().build().await?;
921/// let parent = "parent_value";
922/// let mut list = client.list_jobs()
923/// .set_parent(parent)
924/// .by_item();
925/// while let Some(item) = list.next().await.transpose()? {
926/// println!("{:?}", item);
927/// }
928/// # Ok(()) }
929/// ```
930///
931/// # Service Description
932///
933/// Cloud Run Job Control Plane API.
934///
935/// # Configuration
936///
937/// To configure `Jobs` use the `with_*` methods in the type returned
938/// by [builder()][Jobs::builder]. The default configuration should
939/// work for most applications. Common configuration changes include
940///
941/// * [with_endpoint()]: by default this client uses the global default endpoint
942/// (`https://run.googleapis.com`). Applications using regional
943/// endpoints or running in restricted networks (e.g. a network configured
944// with [Private Google Access with VPC Service Controls]) may want to
945/// override this default.
946/// * [with_credentials()]: by default this client uses
947/// [Application Default Credentials]. Applications using custom
948/// authentication may need to override this default.
949///
950/// [with_endpoint()]: super::builder::jobs::ClientBuilder::with_endpoint
951/// [with_credentials()]: super::builder::jobs::ClientBuilder::with_credentials
952/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
953/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
954///
955/// # Pooling and Cloning
956///
957/// `Jobs` holds a connection pool internally, it is advised to
958/// create one and reuse it. You do not need to wrap `Jobs` in
959/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
960/// already uses an `Arc` internally.
961#[derive(Clone, Debug)]
962pub struct Jobs {
963 inner: std::sync::Arc<dyn super::stub::dynamic::Jobs>,
964}
965
966impl Jobs {
967 /// Returns a builder for [Jobs].
968 ///
969 /// ```
970 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
971 /// # use google_cloud_run_v2::client::Jobs;
972 /// let client = Jobs::builder().build().await?;
973 /// # Ok(()) }
974 /// ```
975 pub fn builder() -> super::builder::jobs::ClientBuilder {
976 crate::new_client_builder(super::builder::jobs::client::Factory)
977 }
978
979 /// Creates a new client from the provided stub.
980 ///
981 /// The most common case for calling this function is in tests mocking the
982 /// client's behavior.
983 pub fn from_stub<T>(stub: T) -> Self
984 where
985 T: super::stub::Jobs + 'static,
986 {
987 Self {
988 inner: std::sync::Arc::new(stub),
989 }
990 }
991
992 pub(crate) async fn new(
993 config: gaxi::options::ClientConfig,
994 ) -> crate::ClientBuilderResult<Self> {
995 let inner = Self::build_inner(config).await?;
996 Ok(Self { inner })
997 }
998
999 async fn build_inner(
1000 conf: gaxi::options::ClientConfig,
1001 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Jobs>> {
1002 if gaxi::options::tracing_enabled(&conf) {
1003 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1004 }
1005 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1006 }
1007
1008 async fn build_transport(
1009 conf: gaxi::options::ClientConfig,
1010 ) -> crate::ClientBuilderResult<impl super::stub::Jobs> {
1011 super::transport::Jobs::new(conf).await
1012 }
1013
1014 async fn build_with_tracing(
1015 conf: gaxi::options::ClientConfig,
1016 ) -> crate::ClientBuilderResult<impl super::stub::Jobs> {
1017 Self::build_transport(conf)
1018 .await
1019 .map(super::tracing::Jobs::new)
1020 }
1021
1022 /// Creates a Job.
1023 ///
1024 /// # Long running operations
1025 ///
1026 /// This method is used to start, and/or poll a [long-running Operation].
1027 /// The [Working with long-running operations] chapter in the [user guide]
1028 /// covers these operations in detail.
1029 ///
1030 /// [long-running operation]: https://google.aip.dev/151
1031 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1032 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1033 ///
1034 /// # Example
1035 /// ```
1036 /// # use google_cloud_run_v2::client::Jobs;
1037 /// use google_cloud_lro::Poller;
1038 /// use google_cloud_run_v2::model::Job;
1039 /// use google_cloud_run_v2::Result;
1040 /// async fn sample(
1041 /// client: &Jobs, parent: &str
1042 /// ) -> Result<()> {
1043 /// let response = client.create_job()
1044 /// .set_parent(parent)
1045 /// .set_job_id("job_id_value")
1046 /// .set_job(
1047 /// Job::new()/* set fields */
1048 /// )
1049 /// .poller().until_done().await?;
1050 /// println!("response {:?}", response);
1051 /// Ok(())
1052 /// }
1053 /// ```
1054 pub fn create_job(&self) -> super::builder::jobs::CreateJob {
1055 super::builder::jobs::CreateJob::new(self.inner.clone())
1056 }
1057
1058 /// Gets information about a Job.
1059 ///
1060 /// # Example
1061 /// ```
1062 /// # use google_cloud_run_v2::client::Jobs;
1063 /// use google_cloud_run_v2::Result;
1064 /// async fn sample(
1065 /// client: &Jobs, name: &str
1066 /// ) -> Result<()> {
1067 /// let response = client.get_job()
1068 /// .set_name(name)
1069 /// .send().await?;
1070 /// println!("response {:?}", response);
1071 /// Ok(())
1072 /// }
1073 /// ```
1074 pub fn get_job(&self) -> super::builder::jobs::GetJob {
1075 super::builder::jobs::GetJob::new(self.inner.clone())
1076 }
1077
1078 /// Lists Jobs. Results are sorted by creation time, descending.
1079 ///
1080 /// # Example
1081 /// ```
1082 /// # use google_cloud_run_v2::client::Jobs;
1083 /// use google_cloud_gax::paginator::ItemPaginator as _;
1084 /// use google_cloud_run_v2::Result;
1085 /// async fn sample(
1086 /// client: &Jobs, parent: &str
1087 /// ) -> Result<()> {
1088 /// let mut list = client.list_jobs()
1089 /// .set_parent(parent)
1090 /// .by_item();
1091 /// while let Some(item) = list.next().await.transpose()? {
1092 /// println!("{:?}", item);
1093 /// }
1094 /// Ok(())
1095 /// }
1096 /// ```
1097 pub fn list_jobs(&self) -> super::builder::jobs::ListJobs {
1098 super::builder::jobs::ListJobs::new(self.inner.clone())
1099 }
1100
1101 /// Updates a Job.
1102 ///
1103 /// # Long running operations
1104 ///
1105 /// This method is used to start, and/or poll a [long-running Operation].
1106 /// The [Working with long-running operations] chapter in the [user guide]
1107 /// covers these operations in detail.
1108 ///
1109 /// [long-running operation]: https://google.aip.dev/151
1110 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1111 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1112 ///
1113 /// # Example
1114 /// ```
1115 /// # use google_cloud_run_v2::client::Jobs;
1116 /// use google_cloud_lro::Poller;
1117 /// use google_cloud_run_v2::model::Job;
1118 /// use google_cloud_run_v2::Result;
1119 /// async fn sample(
1120 /// client: &Jobs, name: &str
1121 /// ) -> Result<()> {
1122 /// let response = client.update_job()
1123 /// .set_job(
1124 /// Job::new().set_name(name)/* set fields */
1125 /// )
1126 /// .poller().until_done().await?;
1127 /// println!("response {:?}", response);
1128 /// Ok(())
1129 /// }
1130 /// ```
1131 pub fn update_job(&self) -> super::builder::jobs::UpdateJob {
1132 super::builder::jobs::UpdateJob::new(self.inner.clone())
1133 }
1134
1135 /// Deletes a Job.
1136 ///
1137 /// # Long running operations
1138 ///
1139 /// This method is used to start, and/or poll a [long-running Operation].
1140 /// The [Working with long-running operations] chapter in the [user guide]
1141 /// covers these operations in detail.
1142 ///
1143 /// [long-running operation]: https://google.aip.dev/151
1144 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1145 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1146 ///
1147 /// # Example
1148 /// ```
1149 /// # use google_cloud_run_v2::client::Jobs;
1150 /// use google_cloud_lro::Poller;
1151 /// use google_cloud_run_v2::Result;
1152 /// async fn sample(
1153 /// client: &Jobs, name: &str
1154 /// ) -> Result<()> {
1155 /// let response = client.delete_job()
1156 /// .set_name(name)
1157 /// .poller().until_done().await?;
1158 /// println!("response {:?}", response);
1159 /// Ok(())
1160 /// }
1161 /// ```
1162 pub fn delete_job(&self) -> super::builder::jobs::DeleteJob {
1163 super::builder::jobs::DeleteJob::new(self.inner.clone())
1164 }
1165
1166 /// Triggers creation of a new Execution of this Job.
1167 ///
1168 /// # Long running operations
1169 ///
1170 /// This method is used to start, and/or poll a [long-running Operation].
1171 /// The [Working with long-running operations] chapter in the [user guide]
1172 /// covers these operations in detail.
1173 ///
1174 /// [long-running operation]: https://google.aip.dev/151
1175 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1176 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1177 ///
1178 /// # Example
1179 /// ```
1180 /// # use google_cloud_run_v2::client::Jobs;
1181 /// use google_cloud_lro::Poller;
1182 /// use google_cloud_run_v2::Result;
1183 /// async fn sample(
1184 /// client: &Jobs
1185 /// ) -> Result<()> {
1186 /// let response = client.run_job()
1187 /// /* set fields */
1188 /// .poller().until_done().await?;
1189 /// println!("response {:?}", response);
1190 /// Ok(())
1191 /// }
1192 /// ```
1193 pub fn run_job(&self) -> super::builder::jobs::RunJob {
1194 super::builder::jobs::RunJob::new(self.inner.clone())
1195 }
1196
1197 /// Gets the IAM Access Control policy currently in effect for the given Job.
1198 /// This result does not include any inherited policies.
1199 ///
1200 /// # Example
1201 /// ```
1202 /// # use google_cloud_run_v2::client::Jobs;
1203 /// use google_cloud_run_v2::Result;
1204 /// async fn sample(
1205 /// client: &Jobs
1206 /// ) -> Result<()> {
1207 /// let response = client.get_iam_policy()
1208 /// /* set fields */
1209 /// .send().await?;
1210 /// println!("response {:?}", response);
1211 /// Ok(())
1212 /// }
1213 /// ```
1214 pub fn get_iam_policy(&self) -> super::builder::jobs::GetIamPolicy {
1215 super::builder::jobs::GetIamPolicy::new(self.inner.clone())
1216 }
1217
1218 /// Sets the IAM Access control policy for the specified Job. Overwrites
1219 /// any existing policy.
1220 ///
1221 /// # Example
1222 /// ```
1223 /// # use google_cloud_run_v2::client::Jobs;
1224 /// use google_cloud_run_v2::Result;
1225 /// async fn sample(
1226 /// client: &Jobs
1227 /// ) -> Result<()> {
1228 /// let response = client.set_iam_policy()
1229 /// /* set fields */
1230 /// .send().await?;
1231 /// println!("response {:?}", response);
1232 /// Ok(())
1233 /// }
1234 /// ```
1235 pub fn set_iam_policy(&self) -> super::builder::jobs::SetIamPolicy {
1236 super::builder::jobs::SetIamPolicy::new(self.inner.clone())
1237 }
1238
1239 /// Returns permissions that a caller has on the specified Project.
1240 ///
1241 /// There are no permissions required for making this API call.
1242 ///
1243 /// # Example
1244 /// ```
1245 /// # use google_cloud_run_v2::client::Jobs;
1246 /// use google_cloud_run_v2::Result;
1247 /// async fn sample(
1248 /// client: &Jobs
1249 /// ) -> Result<()> {
1250 /// let response = client.test_iam_permissions()
1251 /// /* set fields */
1252 /// .send().await?;
1253 /// println!("response {:?}", response);
1254 /// Ok(())
1255 /// }
1256 /// ```
1257 pub fn test_iam_permissions(&self) -> super::builder::jobs::TestIamPermissions {
1258 super::builder::jobs::TestIamPermissions::new(self.inner.clone())
1259 }
1260
1261 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1262 ///
1263 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1264 ///
1265 /// # Example
1266 /// ```
1267 /// # use google_cloud_run_v2::client::Jobs;
1268 /// use google_cloud_gax::paginator::ItemPaginator as _;
1269 /// use google_cloud_run_v2::Result;
1270 /// async fn sample(
1271 /// client: &Jobs
1272 /// ) -> Result<()> {
1273 /// let mut list = client.list_operations()
1274 /// /* set fields */
1275 /// .by_item();
1276 /// while let Some(item) = list.next().await.transpose()? {
1277 /// println!("{:?}", item);
1278 /// }
1279 /// Ok(())
1280 /// }
1281 /// ```
1282 pub fn list_operations(&self) -> super::builder::jobs::ListOperations {
1283 super::builder::jobs::ListOperations::new(self.inner.clone())
1284 }
1285
1286 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1287 ///
1288 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1289 ///
1290 /// # Example
1291 /// ```
1292 /// # use google_cloud_run_v2::client::Jobs;
1293 /// use google_cloud_run_v2::Result;
1294 /// async fn sample(
1295 /// client: &Jobs
1296 /// ) -> Result<()> {
1297 /// let response = client.get_operation()
1298 /// /* set fields */
1299 /// .send().await?;
1300 /// println!("response {:?}", response);
1301 /// Ok(())
1302 /// }
1303 /// ```
1304 pub fn get_operation(&self) -> super::builder::jobs::GetOperation {
1305 super::builder::jobs::GetOperation::new(self.inner.clone())
1306 }
1307
1308 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1309 ///
1310 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1311 ///
1312 /// # Example
1313 /// ```
1314 /// # use google_cloud_run_v2::client::Jobs;
1315 /// use google_cloud_run_v2::Result;
1316 /// async fn sample(
1317 /// client: &Jobs
1318 /// ) -> Result<()> {
1319 /// client.delete_operation()
1320 /// /* set fields */
1321 /// .send().await?;
1322 /// Ok(())
1323 /// }
1324 /// ```
1325 pub fn delete_operation(&self) -> super::builder::jobs::DeleteOperation {
1326 super::builder::jobs::DeleteOperation::new(self.inner.clone())
1327 }
1328
1329 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1330 ///
1331 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1332 ///
1333 /// # Example
1334 /// ```
1335 /// # use google_cloud_run_v2::client::Jobs;
1336 /// use google_cloud_run_v2::Result;
1337 /// async fn sample(
1338 /// client: &Jobs
1339 /// ) -> Result<()> {
1340 /// let response = client.wait_operation()
1341 /// /* set fields */
1342 /// .send().await?;
1343 /// println!("response {:?}", response);
1344 /// Ok(())
1345 /// }
1346 /// ```
1347 pub fn wait_operation(&self) -> super::builder::jobs::WaitOperation {
1348 super::builder::jobs::WaitOperation::new(self.inner.clone())
1349 }
1350}
1351
1352/// Implements a client for the Cloud Run Admin API.
1353///
1354/// # Example
1355/// ```
1356/// # use google_cloud_run_v2::client::Revisions;
1357/// use google_cloud_gax::paginator::ItemPaginator as _;
1358/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1359/// let client = Revisions::builder().build().await?;
1360/// let parent = "parent_value";
1361/// let mut list = client.list_revisions()
1362/// .set_parent(parent)
1363/// .by_item();
1364/// while let Some(item) = list.next().await.transpose()? {
1365/// println!("{:?}", item);
1366/// }
1367/// # Ok(()) }
1368/// ```
1369///
1370/// # Service Description
1371///
1372/// Cloud Run Revision Control Plane API.
1373///
1374/// # Configuration
1375///
1376/// To configure `Revisions` use the `with_*` methods in the type returned
1377/// by [builder()][Revisions::builder]. The default configuration should
1378/// work for most applications. Common configuration changes include
1379///
1380/// * [with_endpoint()]: by default this client uses the global default endpoint
1381/// (`https://run.googleapis.com`). Applications using regional
1382/// endpoints or running in restricted networks (e.g. a network configured
1383// with [Private Google Access with VPC Service Controls]) may want to
1384/// override this default.
1385/// * [with_credentials()]: by default this client uses
1386/// [Application Default Credentials]. Applications using custom
1387/// authentication may need to override this default.
1388///
1389/// [with_endpoint()]: super::builder::revisions::ClientBuilder::with_endpoint
1390/// [with_credentials()]: super::builder::revisions::ClientBuilder::with_credentials
1391/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1392/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1393///
1394/// # Pooling and Cloning
1395///
1396/// `Revisions` holds a connection pool internally, it is advised to
1397/// create one and reuse it. You do not need to wrap `Revisions` in
1398/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1399/// already uses an `Arc` internally.
1400#[derive(Clone, Debug)]
1401pub struct Revisions {
1402 inner: std::sync::Arc<dyn super::stub::dynamic::Revisions>,
1403}
1404
1405impl Revisions {
1406 /// Returns a builder for [Revisions].
1407 ///
1408 /// ```
1409 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1410 /// # use google_cloud_run_v2::client::Revisions;
1411 /// let client = Revisions::builder().build().await?;
1412 /// # Ok(()) }
1413 /// ```
1414 pub fn builder() -> super::builder::revisions::ClientBuilder {
1415 crate::new_client_builder(super::builder::revisions::client::Factory)
1416 }
1417
1418 /// Creates a new client from the provided stub.
1419 ///
1420 /// The most common case for calling this function is in tests mocking the
1421 /// client's behavior.
1422 pub fn from_stub<T>(stub: T) -> Self
1423 where
1424 T: super::stub::Revisions + 'static,
1425 {
1426 Self {
1427 inner: std::sync::Arc::new(stub),
1428 }
1429 }
1430
1431 pub(crate) async fn new(
1432 config: gaxi::options::ClientConfig,
1433 ) -> crate::ClientBuilderResult<Self> {
1434 let inner = Self::build_inner(config).await?;
1435 Ok(Self { inner })
1436 }
1437
1438 async fn build_inner(
1439 conf: gaxi::options::ClientConfig,
1440 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Revisions>> {
1441 if gaxi::options::tracing_enabled(&conf) {
1442 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1443 }
1444 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1445 }
1446
1447 async fn build_transport(
1448 conf: gaxi::options::ClientConfig,
1449 ) -> crate::ClientBuilderResult<impl super::stub::Revisions> {
1450 super::transport::Revisions::new(conf).await
1451 }
1452
1453 async fn build_with_tracing(
1454 conf: gaxi::options::ClientConfig,
1455 ) -> crate::ClientBuilderResult<impl super::stub::Revisions> {
1456 Self::build_transport(conf)
1457 .await
1458 .map(super::tracing::Revisions::new)
1459 }
1460
1461 /// Gets information about a Revision.
1462 ///
1463 /// # Example
1464 /// ```
1465 /// # use google_cloud_run_v2::client::Revisions;
1466 /// use google_cloud_run_v2::Result;
1467 /// async fn sample(
1468 /// client: &Revisions, name: &str
1469 /// ) -> Result<()> {
1470 /// let response = client.get_revision()
1471 /// .set_name(name)
1472 /// .send().await?;
1473 /// println!("response {:?}", response);
1474 /// Ok(())
1475 /// }
1476 /// ```
1477 pub fn get_revision(&self) -> super::builder::revisions::GetRevision {
1478 super::builder::revisions::GetRevision::new(self.inner.clone())
1479 }
1480
1481 /// Lists Revisions from a given Service, or from a given location. Results
1482 /// are sorted by creation time, descending.
1483 ///
1484 /// # Example
1485 /// ```
1486 /// # use google_cloud_run_v2::client::Revisions;
1487 /// use google_cloud_gax::paginator::ItemPaginator as _;
1488 /// use google_cloud_run_v2::Result;
1489 /// async fn sample(
1490 /// client: &Revisions, parent: &str
1491 /// ) -> Result<()> {
1492 /// let mut list = client.list_revisions()
1493 /// .set_parent(parent)
1494 /// .by_item();
1495 /// while let Some(item) = list.next().await.transpose()? {
1496 /// println!("{:?}", item);
1497 /// }
1498 /// Ok(())
1499 /// }
1500 /// ```
1501 pub fn list_revisions(&self) -> super::builder::revisions::ListRevisions {
1502 super::builder::revisions::ListRevisions::new(self.inner.clone())
1503 }
1504
1505 /// Deletes a Revision.
1506 ///
1507 /// # Long running operations
1508 ///
1509 /// This method is used to start, and/or poll a [long-running Operation].
1510 /// The [Working with long-running operations] chapter in the [user guide]
1511 /// covers these operations in detail.
1512 ///
1513 /// [long-running operation]: https://google.aip.dev/151
1514 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1515 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1516 ///
1517 /// # Example
1518 /// ```
1519 /// # use google_cloud_run_v2::client::Revisions;
1520 /// use google_cloud_lro::Poller;
1521 /// use google_cloud_run_v2::Result;
1522 /// async fn sample(
1523 /// client: &Revisions, name: &str
1524 /// ) -> Result<()> {
1525 /// let response = client.delete_revision()
1526 /// .set_name(name)
1527 /// .poller().until_done().await?;
1528 /// println!("response {:?}", response);
1529 /// Ok(())
1530 /// }
1531 /// ```
1532 pub fn delete_revision(&self) -> super::builder::revisions::DeleteRevision {
1533 super::builder::revisions::DeleteRevision::new(self.inner.clone())
1534 }
1535
1536 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1537 ///
1538 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1539 ///
1540 /// # Example
1541 /// ```
1542 /// # use google_cloud_run_v2::client::Revisions;
1543 /// use google_cloud_gax::paginator::ItemPaginator as _;
1544 /// use google_cloud_run_v2::Result;
1545 /// async fn sample(
1546 /// client: &Revisions
1547 /// ) -> Result<()> {
1548 /// let mut list = client.list_operations()
1549 /// /* set fields */
1550 /// .by_item();
1551 /// while let Some(item) = list.next().await.transpose()? {
1552 /// println!("{:?}", item);
1553 /// }
1554 /// Ok(())
1555 /// }
1556 /// ```
1557 pub fn list_operations(&self) -> super::builder::revisions::ListOperations {
1558 super::builder::revisions::ListOperations::new(self.inner.clone())
1559 }
1560
1561 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1562 ///
1563 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1564 ///
1565 /// # Example
1566 /// ```
1567 /// # use google_cloud_run_v2::client::Revisions;
1568 /// use google_cloud_run_v2::Result;
1569 /// async fn sample(
1570 /// client: &Revisions
1571 /// ) -> Result<()> {
1572 /// let response = client.get_operation()
1573 /// /* set fields */
1574 /// .send().await?;
1575 /// println!("response {:?}", response);
1576 /// Ok(())
1577 /// }
1578 /// ```
1579 pub fn get_operation(&self) -> super::builder::revisions::GetOperation {
1580 super::builder::revisions::GetOperation::new(self.inner.clone())
1581 }
1582
1583 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1584 ///
1585 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1586 ///
1587 /// # Example
1588 /// ```
1589 /// # use google_cloud_run_v2::client::Revisions;
1590 /// use google_cloud_run_v2::Result;
1591 /// async fn sample(
1592 /// client: &Revisions
1593 /// ) -> Result<()> {
1594 /// client.delete_operation()
1595 /// /* set fields */
1596 /// .send().await?;
1597 /// Ok(())
1598 /// }
1599 /// ```
1600 pub fn delete_operation(&self) -> super::builder::revisions::DeleteOperation {
1601 super::builder::revisions::DeleteOperation::new(self.inner.clone())
1602 }
1603
1604 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1605 ///
1606 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1607 ///
1608 /// # Example
1609 /// ```
1610 /// # use google_cloud_run_v2::client::Revisions;
1611 /// use google_cloud_run_v2::Result;
1612 /// async fn sample(
1613 /// client: &Revisions
1614 /// ) -> Result<()> {
1615 /// let response = client.wait_operation()
1616 /// /* set fields */
1617 /// .send().await?;
1618 /// println!("response {:?}", response);
1619 /// Ok(())
1620 /// }
1621 /// ```
1622 pub fn wait_operation(&self) -> super::builder::revisions::WaitOperation {
1623 super::builder::revisions::WaitOperation::new(self.inner.clone())
1624 }
1625}
1626
1627/// Implements a client for the Cloud Run Admin API.
1628///
1629/// # Example
1630/// ```
1631/// # use google_cloud_run_v2::client::Services;
1632/// use google_cloud_gax::paginator::ItemPaginator as _;
1633/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1634/// let client = Services::builder().build().await?;
1635/// let parent = "parent_value";
1636/// let mut list = client.list_services()
1637/// .set_parent(parent)
1638/// .by_item();
1639/// while let Some(item) = list.next().await.transpose()? {
1640/// println!("{:?}", item);
1641/// }
1642/// # Ok(()) }
1643/// ```
1644///
1645/// # Service Description
1646///
1647/// Cloud Run Service Control Plane API
1648///
1649/// # Configuration
1650///
1651/// To configure `Services` use the `with_*` methods in the type returned
1652/// by [builder()][Services::builder]. The default configuration should
1653/// work for most applications. Common configuration changes include
1654///
1655/// * [with_endpoint()]: by default this client uses the global default endpoint
1656/// (`https://run.googleapis.com`). Applications using regional
1657/// endpoints or running in restricted networks (e.g. a network configured
1658// with [Private Google Access with VPC Service Controls]) may want to
1659/// override this default.
1660/// * [with_credentials()]: by default this client uses
1661/// [Application Default Credentials]. Applications using custom
1662/// authentication may need to override this default.
1663///
1664/// [with_endpoint()]: super::builder::services::ClientBuilder::with_endpoint
1665/// [with_credentials()]: super::builder::services::ClientBuilder::with_credentials
1666/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1667/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1668///
1669/// # Pooling and Cloning
1670///
1671/// `Services` holds a connection pool internally, it is advised to
1672/// create one and reuse it. You do not need to wrap `Services` in
1673/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1674/// already uses an `Arc` internally.
1675#[derive(Clone, Debug)]
1676pub struct Services {
1677 inner: std::sync::Arc<dyn super::stub::dynamic::Services>,
1678}
1679
1680impl Services {
1681 /// Returns a builder for [Services].
1682 ///
1683 /// ```
1684 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1685 /// # use google_cloud_run_v2::client::Services;
1686 /// let client = Services::builder().build().await?;
1687 /// # Ok(()) }
1688 /// ```
1689 pub fn builder() -> super::builder::services::ClientBuilder {
1690 crate::new_client_builder(super::builder::services::client::Factory)
1691 }
1692
1693 /// Creates a new client from the provided stub.
1694 ///
1695 /// The most common case for calling this function is in tests mocking the
1696 /// client's behavior.
1697 pub fn from_stub<T>(stub: T) -> Self
1698 where
1699 T: super::stub::Services + 'static,
1700 {
1701 Self {
1702 inner: std::sync::Arc::new(stub),
1703 }
1704 }
1705
1706 pub(crate) async fn new(
1707 config: gaxi::options::ClientConfig,
1708 ) -> crate::ClientBuilderResult<Self> {
1709 let inner = Self::build_inner(config).await?;
1710 Ok(Self { inner })
1711 }
1712
1713 async fn build_inner(
1714 conf: gaxi::options::ClientConfig,
1715 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Services>> {
1716 if gaxi::options::tracing_enabled(&conf) {
1717 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1718 }
1719 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1720 }
1721
1722 async fn build_transport(
1723 conf: gaxi::options::ClientConfig,
1724 ) -> crate::ClientBuilderResult<impl super::stub::Services> {
1725 super::transport::Services::new(conf).await
1726 }
1727
1728 async fn build_with_tracing(
1729 conf: gaxi::options::ClientConfig,
1730 ) -> crate::ClientBuilderResult<impl super::stub::Services> {
1731 Self::build_transport(conf)
1732 .await
1733 .map(super::tracing::Services::new)
1734 }
1735
1736 /// Creates a new Service in a given project and location.
1737 ///
1738 /// # Long running operations
1739 ///
1740 /// This method is used to start, and/or poll a [long-running Operation].
1741 /// The [Working with long-running operations] chapter in the [user guide]
1742 /// covers these operations in detail.
1743 ///
1744 /// [long-running operation]: https://google.aip.dev/151
1745 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1746 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1747 ///
1748 /// # Example
1749 /// ```
1750 /// # use google_cloud_run_v2::client::Services;
1751 /// use google_cloud_lro::Poller;
1752 /// use google_cloud_run_v2::model::Service;
1753 /// use google_cloud_run_v2::Result;
1754 /// async fn sample(
1755 /// client: &Services, parent: &str
1756 /// ) -> Result<()> {
1757 /// let response = client.create_service()
1758 /// .set_parent(parent)
1759 /// .set_service_id("service_id_value")
1760 /// .set_service(
1761 /// Service::new()/* set fields */
1762 /// )
1763 /// .poller().until_done().await?;
1764 /// println!("response {:?}", response);
1765 /// Ok(())
1766 /// }
1767 /// ```
1768 pub fn create_service(&self) -> super::builder::services::CreateService {
1769 super::builder::services::CreateService::new(self.inner.clone())
1770 }
1771
1772 /// Gets information about a Service.
1773 ///
1774 /// # Example
1775 /// ```
1776 /// # use google_cloud_run_v2::client::Services;
1777 /// use google_cloud_run_v2::Result;
1778 /// async fn sample(
1779 /// client: &Services, name: &str
1780 /// ) -> Result<()> {
1781 /// let response = client.get_service()
1782 /// .set_name(name)
1783 /// .send().await?;
1784 /// println!("response {:?}", response);
1785 /// Ok(())
1786 /// }
1787 /// ```
1788 pub fn get_service(&self) -> super::builder::services::GetService {
1789 super::builder::services::GetService::new(self.inner.clone())
1790 }
1791
1792 /// Lists Services. Results are sorted by creation time, descending.
1793 ///
1794 /// # Example
1795 /// ```
1796 /// # use google_cloud_run_v2::client::Services;
1797 /// use google_cloud_gax::paginator::ItemPaginator as _;
1798 /// use google_cloud_run_v2::Result;
1799 /// async fn sample(
1800 /// client: &Services, parent: &str
1801 /// ) -> Result<()> {
1802 /// let mut list = client.list_services()
1803 /// .set_parent(parent)
1804 /// .by_item();
1805 /// while let Some(item) = list.next().await.transpose()? {
1806 /// println!("{:?}", item);
1807 /// }
1808 /// Ok(())
1809 /// }
1810 /// ```
1811 pub fn list_services(&self) -> super::builder::services::ListServices {
1812 super::builder::services::ListServices::new(self.inner.clone())
1813 }
1814
1815 /// Updates a Service.
1816 ///
1817 /// # Long running operations
1818 ///
1819 /// This method is used to start, and/or poll a [long-running Operation].
1820 /// The [Working with long-running operations] chapter in the [user guide]
1821 /// covers these operations in detail.
1822 ///
1823 /// [long-running operation]: https://google.aip.dev/151
1824 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1825 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1826 ///
1827 /// # Example
1828 /// ```
1829 /// # use google_cloud_run_v2::client::Services;
1830 /// use google_cloud_lro::Poller;
1831 /// # extern crate wkt as google_cloud_wkt;
1832 /// use google_cloud_wkt::FieldMask;
1833 /// use google_cloud_run_v2::model::Service;
1834 /// use google_cloud_run_v2::Result;
1835 /// async fn sample(
1836 /// client: &Services, name: &str
1837 /// ) -> Result<()> {
1838 /// let response = client.update_service()
1839 /// .set_service(
1840 /// Service::new().set_name(name)/* set fields */
1841 /// )
1842 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1843 /// .poller().until_done().await?;
1844 /// println!("response {:?}", response);
1845 /// Ok(())
1846 /// }
1847 /// ```
1848 pub fn update_service(&self) -> super::builder::services::UpdateService {
1849 super::builder::services::UpdateService::new(self.inner.clone())
1850 }
1851
1852 /// Deletes a Service.
1853 /// This will cause the Service to stop serving traffic and will delete all
1854 /// revisions.
1855 ///
1856 /// # Long running operations
1857 ///
1858 /// This method is used to start, and/or poll a [long-running Operation].
1859 /// The [Working with long-running operations] chapter in the [user guide]
1860 /// covers these operations in detail.
1861 ///
1862 /// [long-running operation]: https://google.aip.dev/151
1863 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1864 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1865 ///
1866 /// # Example
1867 /// ```
1868 /// # use google_cloud_run_v2::client::Services;
1869 /// use google_cloud_lro::Poller;
1870 /// use google_cloud_run_v2::Result;
1871 /// async fn sample(
1872 /// client: &Services, name: &str
1873 /// ) -> Result<()> {
1874 /// let response = client.delete_service()
1875 /// .set_name(name)
1876 /// .poller().until_done().await?;
1877 /// println!("response {:?}", response);
1878 /// Ok(())
1879 /// }
1880 /// ```
1881 pub fn delete_service(&self) -> super::builder::services::DeleteService {
1882 super::builder::services::DeleteService::new(self.inner.clone())
1883 }
1884
1885 /// Gets the IAM Access Control policy currently in effect for the given
1886 /// Cloud Run Service. This result does not include any inherited policies.
1887 ///
1888 /// # Example
1889 /// ```
1890 /// # use google_cloud_run_v2::client::Services;
1891 /// use google_cloud_run_v2::Result;
1892 /// async fn sample(
1893 /// client: &Services
1894 /// ) -> Result<()> {
1895 /// let response = client.get_iam_policy()
1896 /// /* set fields */
1897 /// .send().await?;
1898 /// println!("response {:?}", response);
1899 /// Ok(())
1900 /// }
1901 /// ```
1902 pub fn get_iam_policy(&self) -> super::builder::services::GetIamPolicy {
1903 super::builder::services::GetIamPolicy::new(self.inner.clone())
1904 }
1905
1906 /// Sets the IAM Access control policy for the specified Service. Overwrites
1907 /// any existing policy.
1908 ///
1909 /// # Example
1910 /// ```
1911 /// # use google_cloud_run_v2::client::Services;
1912 /// use google_cloud_run_v2::Result;
1913 /// async fn sample(
1914 /// client: &Services
1915 /// ) -> Result<()> {
1916 /// let response = client.set_iam_policy()
1917 /// /* set fields */
1918 /// .send().await?;
1919 /// println!("response {:?}", response);
1920 /// Ok(())
1921 /// }
1922 /// ```
1923 pub fn set_iam_policy(&self) -> super::builder::services::SetIamPolicy {
1924 super::builder::services::SetIamPolicy::new(self.inner.clone())
1925 }
1926
1927 /// Returns permissions that a caller has on the specified Project.
1928 ///
1929 /// There are no permissions required for making this API call.
1930 ///
1931 /// # Example
1932 /// ```
1933 /// # use google_cloud_run_v2::client::Services;
1934 /// use google_cloud_run_v2::Result;
1935 /// async fn sample(
1936 /// client: &Services
1937 /// ) -> Result<()> {
1938 /// let response = client.test_iam_permissions()
1939 /// /* set fields */
1940 /// .send().await?;
1941 /// println!("response {:?}", response);
1942 /// Ok(())
1943 /// }
1944 /// ```
1945 pub fn test_iam_permissions(&self) -> super::builder::services::TestIamPermissions {
1946 super::builder::services::TestIamPermissions::new(self.inner.clone())
1947 }
1948
1949 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1950 ///
1951 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1952 ///
1953 /// # Example
1954 /// ```
1955 /// # use google_cloud_run_v2::client::Services;
1956 /// use google_cloud_gax::paginator::ItemPaginator as _;
1957 /// use google_cloud_run_v2::Result;
1958 /// async fn sample(
1959 /// client: &Services
1960 /// ) -> Result<()> {
1961 /// let mut list = client.list_operations()
1962 /// /* set fields */
1963 /// .by_item();
1964 /// while let Some(item) = list.next().await.transpose()? {
1965 /// println!("{:?}", item);
1966 /// }
1967 /// Ok(())
1968 /// }
1969 /// ```
1970 pub fn list_operations(&self) -> super::builder::services::ListOperations {
1971 super::builder::services::ListOperations::new(self.inner.clone())
1972 }
1973
1974 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1975 ///
1976 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1977 ///
1978 /// # Example
1979 /// ```
1980 /// # use google_cloud_run_v2::client::Services;
1981 /// use google_cloud_run_v2::Result;
1982 /// async fn sample(
1983 /// client: &Services
1984 /// ) -> Result<()> {
1985 /// let response = client.get_operation()
1986 /// /* set fields */
1987 /// .send().await?;
1988 /// println!("response {:?}", response);
1989 /// Ok(())
1990 /// }
1991 /// ```
1992 pub fn get_operation(&self) -> super::builder::services::GetOperation {
1993 super::builder::services::GetOperation::new(self.inner.clone())
1994 }
1995
1996 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1997 ///
1998 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1999 ///
2000 /// # Example
2001 /// ```
2002 /// # use google_cloud_run_v2::client::Services;
2003 /// use google_cloud_run_v2::Result;
2004 /// async fn sample(
2005 /// client: &Services
2006 /// ) -> Result<()> {
2007 /// client.delete_operation()
2008 /// /* set fields */
2009 /// .send().await?;
2010 /// Ok(())
2011 /// }
2012 /// ```
2013 pub fn delete_operation(&self) -> super::builder::services::DeleteOperation {
2014 super::builder::services::DeleteOperation::new(self.inner.clone())
2015 }
2016
2017 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2018 ///
2019 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2020 ///
2021 /// # Example
2022 /// ```
2023 /// # use google_cloud_run_v2::client::Services;
2024 /// use google_cloud_run_v2::Result;
2025 /// async fn sample(
2026 /// client: &Services
2027 /// ) -> Result<()> {
2028 /// let response = client.wait_operation()
2029 /// /* set fields */
2030 /// .send().await?;
2031 /// println!("response {:?}", response);
2032 /// Ok(())
2033 /// }
2034 /// ```
2035 pub fn wait_operation(&self) -> super::builder::services::WaitOperation {
2036 super::builder::services::WaitOperation::new(self.inner.clone())
2037 }
2038}
2039
2040/// Implements a client for the Cloud Run Admin API.
2041///
2042/// # Example
2043/// ```
2044/// # use google_cloud_run_v2::client::Tasks;
2045/// use google_cloud_gax::paginator::ItemPaginator as _;
2046/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2047/// let client = Tasks::builder().build().await?;
2048/// let parent = "parent_value";
2049/// let mut list = client.list_tasks()
2050/// .set_parent(parent)
2051/// .by_item();
2052/// while let Some(item) = list.next().await.transpose()? {
2053/// println!("{:?}", item);
2054/// }
2055/// # Ok(()) }
2056/// ```
2057///
2058/// # Service Description
2059///
2060/// Cloud Run Task Control Plane API.
2061///
2062/// # Configuration
2063///
2064/// To configure `Tasks` use the `with_*` methods in the type returned
2065/// by [builder()][Tasks::builder]. The default configuration should
2066/// work for most applications. Common configuration changes include
2067///
2068/// * [with_endpoint()]: by default this client uses the global default endpoint
2069/// (`https://run.googleapis.com`). Applications using regional
2070/// endpoints or running in restricted networks (e.g. a network configured
2071// with [Private Google Access with VPC Service Controls]) may want to
2072/// override this default.
2073/// * [with_credentials()]: by default this client uses
2074/// [Application Default Credentials]. Applications using custom
2075/// authentication may need to override this default.
2076///
2077/// [with_endpoint()]: super::builder::tasks::ClientBuilder::with_endpoint
2078/// [with_credentials()]: super::builder::tasks::ClientBuilder::with_credentials
2079/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2080/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2081///
2082/// # Pooling and Cloning
2083///
2084/// `Tasks` holds a connection pool internally, it is advised to
2085/// create one and reuse it. You do not need to wrap `Tasks` in
2086/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2087/// already uses an `Arc` internally.
2088#[derive(Clone, Debug)]
2089pub struct Tasks {
2090 inner: std::sync::Arc<dyn super::stub::dynamic::Tasks>,
2091}
2092
2093impl Tasks {
2094 /// Returns a builder for [Tasks].
2095 ///
2096 /// ```
2097 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2098 /// # use google_cloud_run_v2::client::Tasks;
2099 /// let client = Tasks::builder().build().await?;
2100 /// # Ok(()) }
2101 /// ```
2102 pub fn builder() -> super::builder::tasks::ClientBuilder {
2103 crate::new_client_builder(super::builder::tasks::client::Factory)
2104 }
2105
2106 /// Creates a new client from the provided stub.
2107 ///
2108 /// The most common case for calling this function is in tests mocking the
2109 /// client's behavior.
2110 pub fn from_stub<T>(stub: T) -> Self
2111 where
2112 T: super::stub::Tasks + 'static,
2113 {
2114 Self {
2115 inner: std::sync::Arc::new(stub),
2116 }
2117 }
2118
2119 pub(crate) async fn new(
2120 config: gaxi::options::ClientConfig,
2121 ) -> crate::ClientBuilderResult<Self> {
2122 let inner = Self::build_inner(config).await?;
2123 Ok(Self { inner })
2124 }
2125
2126 async fn build_inner(
2127 conf: gaxi::options::ClientConfig,
2128 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Tasks>> {
2129 if gaxi::options::tracing_enabled(&conf) {
2130 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2131 }
2132 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2133 }
2134
2135 async fn build_transport(
2136 conf: gaxi::options::ClientConfig,
2137 ) -> crate::ClientBuilderResult<impl super::stub::Tasks> {
2138 super::transport::Tasks::new(conf).await
2139 }
2140
2141 async fn build_with_tracing(
2142 conf: gaxi::options::ClientConfig,
2143 ) -> crate::ClientBuilderResult<impl super::stub::Tasks> {
2144 Self::build_transport(conf)
2145 .await
2146 .map(super::tracing::Tasks::new)
2147 }
2148
2149 /// Gets information about a Task.
2150 ///
2151 /// # Example
2152 /// ```
2153 /// # use google_cloud_run_v2::client::Tasks;
2154 /// use google_cloud_run_v2::Result;
2155 /// async fn sample(
2156 /// client: &Tasks, name: &str
2157 /// ) -> Result<()> {
2158 /// let response = client.get_task()
2159 /// .set_name(name)
2160 /// .send().await?;
2161 /// println!("response {:?}", response);
2162 /// Ok(())
2163 /// }
2164 /// ```
2165 pub fn get_task(&self) -> super::builder::tasks::GetTask {
2166 super::builder::tasks::GetTask::new(self.inner.clone())
2167 }
2168
2169 /// Lists Tasks from an Execution of a Job.
2170 ///
2171 /// # Example
2172 /// ```
2173 /// # use google_cloud_run_v2::client::Tasks;
2174 /// use google_cloud_gax::paginator::ItemPaginator as _;
2175 /// use google_cloud_run_v2::Result;
2176 /// async fn sample(
2177 /// client: &Tasks, parent: &str
2178 /// ) -> Result<()> {
2179 /// let mut list = client.list_tasks()
2180 /// .set_parent(parent)
2181 /// .by_item();
2182 /// while let Some(item) = list.next().await.transpose()? {
2183 /// println!("{:?}", item);
2184 /// }
2185 /// Ok(())
2186 /// }
2187 /// ```
2188 pub fn list_tasks(&self) -> super::builder::tasks::ListTasks {
2189 super::builder::tasks::ListTasks::new(self.inner.clone())
2190 }
2191
2192 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2193 ///
2194 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2195 ///
2196 /// # Example
2197 /// ```
2198 /// # use google_cloud_run_v2::client::Tasks;
2199 /// use google_cloud_gax::paginator::ItemPaginator as _;
2200 /// use google_cloud_run_v2::Result;
2201 /// async fn sample(
2202 /// client: &Tasks
2203 /// ) -> Result<()> {
2204 /// let mut list = client.list_operations()
2205 /// /* set fields */
2206 /// .by_item();
2207 /// while let Some(item) = list.next().await.transpose()? {
2208 /// println!("{:?}", item);
2209 /// }
2210 /// Ok(())
2211 /// }
2212 /// ```
2213 pub fn list_operations(&self) -> super::builder::tasks::ListOperations {
2214 super::builder::tasks::ListOperations::new(self.inner.clone())
2215 }
2216
2217 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2218 ///
2219 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2220 ///
2221 /// # Example
2222 /// ```
2223 /// # use google_cloud_run_v2::client::Tasks;
2224 /// use google_cloud_run_v2::Result;
2225 /// async fn sample(
2226 /// client: &Tasks
2227 /// ) -> Result<()> {
2228 /// let response = client.get_operation()
2229 /// /* set fields */
2230 /// .send().await?;
2231 /// println!("response {:?}", response);
2232 /// Ok(())
2233 /// }
2234 /// ```
2235 pub fn get_operation(&self) -> super::builder::tasks::GetOperation {
2236 super::builder::tasks::GetOperation::new(self.inner.clone())
2237 }
2238
2239 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2240 ///
2241 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2242 ///
2243 /// # Example
2244 /// ```
2245 /// # use google_cloud_run_v2::client::Tasks;
2246 /// use google_cloud_run_v2::Result;
2247 /// async fn sample(
2248 /// client: &Tasks
2249 /// ) -> Result<()> {
2250 /// client.delete_operation()
2251 /// /* set fields */
2252 /// .send().await?;
2253 /// Ok(())
2254 /// }
2255 /// ```
2256 pub fn delete_operation(&self) -> super::builder::tasks::DeleteOperation {
2257 super::builder::tasks::DeleteOperation::new(self.inner.clone())
2258 }
2259
2260 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2261 ///
2262 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2263 ///
2264 /// # Example
2265 /// ```
2266 /// # use google_cloud_run_v2::client::Tasks;
2267 /// use google_cloud_run_v2::Result;
2268 /// async fn sample(
2269 /// client: &Tasks
2270 /// ) -> Result<()> {
2271 /// let response = client.wait_operation()
2272 /// /* set fields */
2273 /// .send().await?;
2274 /// println!("response {:?}", response);
2275 /// Ok(())
2276 /// }
2277 /// ```
2278 pub fn wait_operation(&self) -> super::builder::tasks::WaitOperation {
2279 super::builder::tasks::WaitOperation::new(self.inner.clone())
2280 }
2281}
2282
2283/// Implements a client for the Cloud Run Admin API.
2284///
2285/// # Example
2286/// ```
2287/// # use google_cloud_run_v2::client::WorkerPools;
2288/// use google_cloud_gax::paginator::ItemPaginator as _;
2289/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2290/// let client = WorkerPools::builder().build().await?;
2291/// let parent = "parent_value";
2292/// let mut list = client.list_worker_pools()
2293/// .set_parent(parent)
2294/// .by_item();
2295/// while let Some(item) = list.next().await.transpose()? {
2296/// println!("{:?}", item);
2297/// }
2298/// # Ok(()) }
2299/// ```
2300///
2301/// # Service Description
2302///
2303/// Cloud Run WorkerPool Control Plane API.
2304///
2305/// # Configuration
2306///
2307/// To configure `WorkerPools` use the `with_*` methods in the type returned
2308/// by [builder()][WorkerPools::builder]. The default configuration should
2309/// work for most applications. Common configuration changes include
2310///
2311/// * [with_endpoint()]: by default this client uses the global default endpoint
2312/// (`https://run.googleapis.com`). Applications using regional
2313/// endpoints or running in restricted networks (e.g. a network configured
2314// with [Private Google Access with VPC Service Controls]) may want to
2315/// override this default.
2316/// * [with_credentials()]: by default this client uses
2317/// [Application Default Credentials]. Applications using custom
2318/// authentication may need to override this default.
2319///
2320/// [with_endpoint()]: super::builder::worker_pools::ClientBuilder::with_endpoint
2321/// [with_credentials()]: super::builder::worker_pools::ClientBuilder::with_credentials
2322/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2323/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2324///
2325/// # Pooling and Cloning
2326///
2327/// `WorkerPools` holds a connection pool internally, it is advised to
2328/// create one and reuse it. You do not need to wrap `WorkerPools` in
2329/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2330/// already uses an `Arc` internally.
2331#[derive(Clone, Debug)]
2332pub struct WorkerPools {
2333 inner: std::sync::Arc<dyn super::stub::dynamic::WorkerPools>,
2334}
2335
2336impl WorkerPools {
2337 /// Returns a builder for [WorkerPools].
2338 ///
2339 /// ```
2340 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2341 /// # use google_cloud_run_v2::client::WorkerPools;
2342 /// let client = WorkerPools::builder().build().await?;
2343 /// # Ok(()) }
2344 /// ```
2345 pub fn builder() -> super::builder::worker_pools::ClientBuilder {
2346 crate::new_client_builder(super::builder::worker_pools::client::Factory)
2347 }
2348
2349 /// Creates a new client from the provided stub.
2350 ///
2351 /// The most common case for calling this function is in tests mocking the
2352 /// client's behavior.
2353 pub fn from_stub<T>(stub: T) -> Self
2354 where
2355 T: super::stub::WorkerPools + 'static,
2356 {
2357 Self {
2358 inner: std::sync::Arc::new(stub),
2359 }
2360 }
2361
2362 pub(crate) async fn new(
2363 config: gaxi::options::ClientConfig,
2364 ) -> crate::ClientBuilderResult<Self> {
2365 let inner = Self::build_inner(config).await?;
2366 Ok(Self { inner })
2367 }
2368
2369 async fn build_inner(
2370 conf: gaxi::options::ClientConfig,
2371 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::WorkerPools>> {
2372 if gaxi::options::tracing_enabled(&conf) {
2373 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2374 }
2375 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2376 }
2377
2378 async fn build_transport(
2379 conf: gaxi::options::ClientConfig,
2380 ) -> crate::ClientBuilderResult<impl super::stub::WorkerPools> {
2381 super::transport::WorkerPools::new(conf).await
2382 }
2383
2384 async fn build_with_tracing(
2385 conf: gaxi::options::ClientConfig,
2386 ) -> crate::ClientBuilderResult<impl super::stub::WorkerPools> {
2387 Self::build_transport(conf)
2388 .await
2389 .map(super::tracing::WorkerPools::new)
2390 }
2391
2392 /// Creates a new WorkerPool in a given project and location.
2393 ///
2394 /// # Long running operations
2395 ///
2396 /// This method is used to start, and/or poll a [long-running Operation].
2397 /// The [Working with long-running operations] chapter in the [user guide]
2398 /// covers these operations in detail.
2399 ///
2400 /// [long-running operation]: https://google.aip.dev/151
2401 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2402 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2403 ///
2404 /// # Example
2405 /// ```
2406 /// # use google_cloud_run_v2::client::WorkerPools;
2407 /// use google_cloud_lro::Poller;
2408 /// use google_cloud_run_v2::model::WorkerPool;
2409 /// use google_cloud_run_v2::Result;
2410 /// async fn sample(
2411 /// client: &WorkerPools, parent: &str
2412 /// ) -> Result<()> {
2413 /// let response = client.create_worker_pool()
2414 /// .set_parent(parent)
2415 /// .set_worker_pool(
2416 /// WorkerPool::new()/* set fields */
2417 /// )
2418 /// .poller().until_done().await?;
2419 /// println!("response {:?}", response);
2420 /// Ok(())
2421 /// }
2422 /// ```
2423 pub fn create_worker_pool(&self) -> super::builder::worker_pools::CreateWorkerPool {
2424 super::builder::worker_pools::CreateWorkerPool::new(self.inner.clone())
2425 }
2426
2427 /// Gets information about a WorkerPool.
2428 ///
2429 /// # Example
2430 /// ```
2431 /// # use google_cloud_run_v2::client::WorkerPools;
2432 /// use google_cloud_run_v2::Result;
2433 /// async fn sample(
2434 /// client: &WorkerPools, name: &str
2435 /// ) -> Result<()> {
2436 /// let response = client.get_worker_pool()
2437 /// .set_name(name)
2438 /// .send().await?;
2439 /// println!("response {:?}", response);
2440 /// Ok(())
2441 /// }
2442 /// ```
2443 pub fn get_worker_pool(&self) -> super::builder::worker_pools::GetWorkerPool {
2444 super::builder::worker_pools::GetWorkerPool::new(self.inner.clone())
2445 }
2446
2447 /// Lists WorkerPools. Results are sorted by creation time, descending.
2448 ///
2449 /// # Example
2450 /// ```
2451 /// # use google_cloud_run_v2::client::WorkerPools;
2452 /// use google_cloud_gax::paginator::ItemPaginator as _;
2453 /// use google_cloud_run_v2::Result;
2454 /// async fn sample(
2455 /// client: &WorkerPools, parent: &str
2456 /// ) -> Result<()> {
2457 /// let mut list = client.list_worker_pools()
2458 /// .set_parent(parent)
2459 /// .by_item();
2460 /// while let Some(item) = list.next().await.transpose()? {
2461 /// println!("{:?}", item);
2462 /// }
2463 /// Ok(())
2464 /// }
2465 /// ```
2466 pub fn list_worker_pools(&self) -> super::builder::worker_pools::ListWorkerPools {
2467 super::builder::worker_pools::ListWorkerPools::new(self.inner.clone())
2468 }
2469
2470 /// Updates a WorkerPool.
2471 ///
2472 /// # Long running operations
2473 ///
2474 /// This method is used to start, and/or poll a [long-running Operation].
2475 /// The [Working with long-running operations] chapter in the [user guide]
2476 /// covers these operations in detail.
2477 ///
2478 /// [long-running operation]: https://google.aip.dev/151
2479 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2480 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2481 ///
2482 /// # Example
2483 /// ```
2484 /// # use google_cloud_run_v2::client::WorkerPools;
2485 /// use google_cloud_lro::Poller;
2486 /// # extern crate wkt as google_cloud_wkt;
2487 /// use google_cloud_wkt::FieldMask;
2488 /// use google_cloud_run_v2::model::WorkerPool;
2489 /// use google_cloud_run_v2::Result;
2490 /// async fn sample(
2491 /// client: &WorkerPools, name: &str
2492 /// ) -> Result<()> {
2493 /// let response = client.update_worker_pool()
2494 /// .set_worker_pool(
2495 /// WorkerPool::new().set_name(name)/* set fields */
2496 /// )
2497 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2498 /// .poller().until_done().await?;
2499 /// println!("response {:?}", response);
2500 /// Ok(())
2501 /// }
2502 /// ```
2503 pub fn update_worker_pool(&self) -> super::builder::worker_pools::UpdateWorkerPool {
2504 super::builder::worker_pools::UpdateWorkerPool::new(self.inner.clone())
2505 }
2506
2507 /// Deletes a WorkerPool.
2508 ///
2509 /// # Long running operations
2510 ///
2511 /// This method is used to start, and/or poll a [long-running Operation].
2512 /// The [Working with long-running operations] chapter in the [user guide]
2513 /// covers these operations in detail.
2514 ///
2515 /// [long-running operation]: https://google.aip.dev/151
2516 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2517 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2518 ///
2519 /// # Example
2520 /// ```
2521 /// # use google_cloud_run_v2::client::WorkerPools;
2522 /// use google_cloud_lro::Poller;
2523 /// use google_cloud_run_v2::Result;
2524 /// async fn sample(
2525 /// client: &WorkerPools, name: &str
2526 /// ) -> Result<()> {
2527 /// let response = client.delete_worker_pool()
2528 /// .set_name(name)
2529 /// .poller().until_done().await?;
2530 /// println!("response {:?}", response);
2531 /// Ok(())
2532 /// }
2533 /// ```
2534 pub fn delete_worker_pool(&self) -> super::builder::worker_pools::DeleteWorkerPool {
2535 super::builder::worker_pools::DeleteWorkerPool::new(self.inner.clone())
2536 }
2537
2538 /// Gets the IAM Access Control policy currently in effect for the given
2539 /// Cloud Run WorkerPool. This result does not include any inherited policies.
2540 ///
2541 /// # Example
2542 /// ```
2543 /// # use google_cloud_run_v2::client::WorkerPools;
2544 /// use google_cloud_run_v2::Result;
2545 /// async fn sample(
2546 /// client: &WorkerPools
2547 /// ) -> Result<()> {
2548 /// let response = client.get_iam_policy()
2549 /// /* set fields */
2550 /// .send().await?;
2551 /// println!("response {:?}", response);
2552 /// Ok(())
2553 /// }
2554 /// ```
2555 pub fn get_iam_policy(&self) -> super::builder::worker_pools::GetIamPolicy {
2556 super::builder::worker_pools::GetIamPolicy::new(self.inner.clone())
2557 }
2558
2559 /// Sets the IAM Access control policy for the specified WorkerPool. Overwrites
2560 /// any existing policy.
2561 ///
2562 /// # Example
2563 /// ```
2564 /// # use google_cloud_run_v2::client::WorkerPools;
2565 /// use google_cloud_run_v2::Result;
2566 /// async fn sample(
2567 /// client: &WorkerPools
2568 /// ) -> Result<()> {
2569 /// let response = client.set_iam_policy()
2570 /// /* set fields */
2571 /// .send().await?;
2572 /// println!("response {:?}", response);
2573 /// Ok(())
2574 /// }
2575 /// ```
2576 pub fn set_iam_policy(&self) -> super::builder::worker_pools::SetIamPolicy {
2577 super::builder::worker_pools::SetIamPolicy::new(self.inner.clone())
2578 }
2579
2580 /// Returns permissions that a caller has on the specified Project.
2581 ///
2582 /// There are no permissions required for making this API call.
2583 ///
2584 /// # Example
2585 /// ```
2586 /// # use google_cloud_run_v2::client::WorkerPools;
2587 /// use google_cloud_run_v2::Result;
2588 /// async fn sample(
2589 /// client: &WorkerPools
2590 /// ) -> Result<()> {
2591 /// let response = client.test_iam_permissions()
2592 /// /* set fields */
2593 /// .send().await?;
2594 /// println!("response {:?}", response);
2595 /// Ok(())
2596 /// }
2597 /// ```
2598 pub fn test_iam_permissions(&self) -> super::builder::worker_pools::TestIamPermissions {
2599 super::builder::worker_pools::TestIamPermissions::new(self.inner.clone())
2600 }
2601
2602 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2603 ///
2604 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2605 ///
2606 /// # Example
2607 /// ```
2608 /// # use google_cloud_run_v2::client::WorkerPools;
2609 /// use google_cloud_gax::paginator::ItemPaginator as _;
2610 /// use google_cloud_run_v2::Result;
2611 /// async fn sample(
2612 /// client: &WorkerPools
2613 /// ) -> Result<()> {
2614 /// let mut list = client.list_operations()
2615 /// /* set fields */
2616 /// .by_item();
2617 /// while let Some(item) = list.next().await.transpose()? {
2618 /// println!("{:?}", item);
2619 /// }
2620 /// Ok(())
2621 /// }
2622 /// ```
2623 pub fn list_operations(&self) -> super::builder::worker_pools::ListOperations {
2624 super::builder::worker_pools::ListOperations::new(self.inner.clone())
2625 }
2626
2627 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2628 ///
2629 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2630 ///
2631 /// # Example
2632 /// ```
2633 /// # use google_cloud_run_v2::client::WorkerPools;
2634 /// use google_cloud_run_v2::Result;
2635 /// async fn sample(
2636 /// client: &WorkerPools
2637 /// ) -> Result<()> {
2638 /// let response = client.get_operation()
2639 /// /* set fields */
2640 /// .send().await?;
2641 /// println!("response {:?}", response);
2642 /// Ok(())
2643 /// }
2644 /// ```
2645 pub fn get_operation(&self) -> super::builder::worker_pools::GetOperation {
2646 super::builder::worker_pools::GetOperation::new(self.inner.clone())
2647 }
2648
2649 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2650 ///
2651 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2652 ///
2653 /// # Example
2654 /// ```
2655 /// # use google_cloud_run_v2::client::WorkerPools;
2656 /// use google_cloud_run_v2::Result;
2657 /// async fn sample(
2658 /// client: &WorkerPools
2659 /// ) -> Result<()> {
2660 /// client.delete_operation()
2661 /// /* set fields */
2662 /// .send().await?;
2663 /// Ok(())
2664 /// }
2665 /// ```
2666 pub fn delete_operation(&self) -> super::builder::worker_pools::DeleteOperation {
2667 super::builder::worker_pools::DeleteOperation::new(self.inner.clone())
2668 }
2669
2670 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2671 ///
2672 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2673 ///
2674 /// # Example
2675 /// ```
2676 /// # use google_cloud_run_v2::client::WorkerPools;
2677 /// use google_cloud_run_v2::Result;
2678 /// async fn sample(
2679 /// client: &WorkerPools
2680 /// ) -> Result<()> {
2681 /// let response = client.wait_operation()
2682 /// /* set fields */
2683 /// .send().await?;
2684 /// println!("response {:?}", response);
2685 /// Ok(())
2686 /// }
2687 /// ```
2688 pub fn wait_operation(&self) -> super::builder::worker_pools::WaitOperation {
2689 super::builder::worker_pools::WaitOperation::new(self.inner.clone())
2690 }
2691}