Skip to main content

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