google_cloud_run_v2/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Cloud Run Admin API.
20///
21/// # Example
22/// ```
23/// # async fn sample() -> gax::client_builder::Result<()> {
24/// # use google_cloud_run_v2::client::Builds;
25/// let client = Builds::builder().build().await?;
26/// // use `client` to make requests to the Cloud Run Admin API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// Cloud Run Build Control Plane API
33///
34/// # Configuration
35///
36/// To configure `Builds` use the `with_*` methods in the type returned
37/// by [builder()][Builds::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41/// (`https://run.googleapis.com`). Applications using regional
42/// endpoints or running in restricted networks (e.g. a network configured
43// with [Private Google Access with VPC Service Controls]) may want to
44/// override this default.
45/// * [with_credentials()]: by default this client uses
46/// [Application Default Credentials]. Applications using custom
47/// authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::builds::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::builds::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `Builds` holds a connection pool internally, it is advised to
57/// create one and the reuse it. You do not need to wrap `Builds` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[derive(Clone, Debug)]
61pub struct Builds {
62 inner: std::sync::Arc<dyn super::stub::dynamic::Builds>,
63}
64
65impl Builds {
66 /// Returns a builder for [Builds].
67 ///
68 /// ```
69 /// # async fn sample() -> gax::client_builder::Result<()> {
70 /// # use google_cloud_run_v2::client::Builds;
71 /// let client = Builds::builder().build().await?;
72 /// # Ok(()) }
73 /// ```
74 pub fn builder() -> super::builder::builds::ClientBuilder {
75 gax::client_builder::internal::new_builder(super::builder::builds::client::Factory)
76 }
77
78 /// Creates a new client from the provided stub.
79 ///
80 /// The most common case for calling this function is in tests mocking the
81 /// client's behavior.
82 pub fn from_stub<T>(stub: T) -> Self
83 where
84 T: super::stub::Builds + 'static,
85 {
86 Self {
87 inner: std::sync::Arc::new(stub),
88 }
89 }
90
91 pub(crate) async fn new(
92 config: gaxi::options::ClientConfig,
93 ) -> gax::client_builder::Result<Self> {
94 let inner = Self::build_inner(config).await?;
95 Ok(Self { inner })
96 }
97
98 async fn build_inner(
99 conf: gaxi::options::ClientConfig,
100 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Builds>> {
101 if gaxi::options::tracing_enabled(&conf) {
102 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
103 }
104 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
105 }
106
107 async fn build_transport(
108 conf: gaxi::options::ClientConfig,
109 ) -> gax::client_builder::Result<impl super::stub::Builds> {
110 super::transport::Builds::new(conf).await
111 }
112
113 async fn build_with_tracing(
114 conf: gaxi::options::ClientConfig,
115 ) -> gax::client_builder::Result<impl super::stub::Builds> {
116 Self::build_transport(conf)
117 .await
118 .map(super::tracing::Builds::new)
119 }
120
121 /// Submits a build in a given project.
122 pub fn submit_build(&self) -> super::builder::builds::SubmitBuild {
123 super::builder::builds::SubmitBuild::new(self.inner.clone())
124 }
125
126 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
127 ///
128 /// [google.longrunning.Operations]: longrunning::client::Operations
129 pub fn list_operations(&self) -> super::builder::builds::ListOperations {
130 super::builder::builds::ListOperations::new(self.inner.clone())
131 }
132
133 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
134 ///
135 /// [google.longrunning.Operations]: longrunning::client::Operations
136 pub fn get_operation(&self) -> super::builder::builds::GetOperation {
137 super::builder::builds::GetOperation::new(self.inner.clone())
138 }
139
140 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
141 ///
142 /// [google.longrunning.Operations]: longrunning::client::Operations
143 pub fn delete_operation(&self) -> super::builder::builds::DeleteOperation {
144 super::builder::builds::DeleteOperation::new(self.inner.clone())
145 }
146
147 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
148 ///
149 /// [google.longrunning.Operations]: longrunning::client::Operations
150 pub fn wait_operation(&self) -> super::builder::builds::WaitOperation {
151 super::builder::builds::WaitOperation::new(self.inner.clone())
152 }
153}
154
155/// Implements a client for the Cloud Run Admin API.
156///
157/// # Example
158/// ```
159/// # async fn sample() -> gax::client_builder::Result<()> {
160/// # use google_cloud_run_v2::client::Executions;
161/// let client = Executions::builder().build().await?;
162/// // use `client` to make requests to the Cloud Run Admin API.
163/// # Ok(()) }
164/// ```
165///
166/// # Service Description
167///
168/// Cloud Run Execution Control Plane API.
169///
170/// # Configuration
171///
172/// To configure `Executions` use the `with_*` methods in the type returned
173/// by [builder()][Executions::builder]. The default configuration should
174/// work for most applications. Common configuration changes include
175///
176/// * [with_endpoint()]: by default this client uses the global default endpoint
177/// (`https://run.googleapis.com`). Applications using regional
178/// endpoints or running in restricted networks (e.g. a network configured
179// with [Private Google Access with VPC Service Controls]) may want to
180/// override this default.
181/// * [with_credentials()]: by default this client uses
182/// [Application Default Credentials]. Applications using custom
183/// authentication may need to override this default.
184///
185/// [with_endpoint()]: super::builder::executions::ClientBuilder::with_endpoint
186/// [with_credentials()]: super::builder::executions::ClientBuilder::credentials
187/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
188/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
189///
190/// # Pooling and Cloning
191///
192/// `Executions` holds a connection pool internally, it is advised to
193/// create one and the reuse it. You do not need to wrap `Executions` in
194/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
195/// already uses an `Arc` internally.
196#[derive(Clone, Debug)]
197pub struct Executions {
198 inner: std::sync::Arc<dyn super::stub::dynamic::Executions>,
199}
200
201impl Executions {
202 /// Returns a builder for [Executions].
203 ///
204 /// ```
205 /// # async fn sample() -> gax::client_builder::Result<()> {
206 /// # use google_cloud_run_v2::client::Executions;
207 /// let client = Executions::builder().build().await?;
208 /// # Ok(()) }
209 /// ```
210 pub fn builder() -> super::builder::executions::ClientBuilder {
211 gax::client_builder::internal::new_builder(super::builder::executions::client::Factory)
212 }
213
214 /// Creates a new client from the provided stub.
215 ///
216 /// The most common case for calling this function is in tests mocking the
217 /// client's behavior.
218 pub fn from_stub<T>(stub: T) -> Self
219 where
220 T: super::stub::Executions + 'static,
221 {
222 Self {
223 inner: std::sync::Arc::new(stub),
224 }
225 }
226
227 pub(crate) async fn new(
228 config: gaxi::options::ClientConfig,
229 ) -> gax::client_builder::Result<Self> {
230 let inner = Self::build_inner(config).await?;
231 Ok(Self { inner })
232 }
233
234 async fn build_inner(
235 conf: gaxi::options::ClientConfig,
236 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Executions>> {
237 if gaxi::options::tracing_enabled(&conf) {
238 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
239 }
240 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
241 }
242
243 async fn build_transport(
244 conf: gaxi::options::ClientConfig,
245 ) -> gax::client_builder::Result<impl super::stub::Executions> {
246 super::transport::Executions::new(conf).await
247 }
248
249 async fn build_with_tracing(
250 conf: gaxi::options::ClientConfig,
251 ) -> gax::client_builder::Result<impl super::stub::Executions> {
252 Self::build_transport(conf)
253 .await
254 .map(super::tracing::Executions::new)
255 }
256
257 /// Gets information about an Execution.
258 pub fn get_execution(&self) -> super::builder::executions::GetExecution {
259 super::builder::executions::GetExecution::new(self.inner.clone())
260 }
261
262 /// Lists Executions from a Job. Results are sorted by creation time,
263 /// descending.
264 pub fn list_executions(&self) -> super::builder::executions::ListExecutions {
265 super::builder::executions::ListExecutions::new(self.inner.clone())
266 }
267
268 /// Deletes an Execution.
269 ///
270 /// # Long running operations
271 ///
272 /// This method is used to start, and/or poll a [long-running Operation].
273 /// The [Working with long-running operations] chapter in the [user guide]
274 /// covers these operations in detail.
275 ///
276 /// [long-running operation]: https://google.aip.dev/151
277 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
278 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
279 pub fn delete_execution(&self) -> super::builder::executions::DeleteExecution {
280 super::builder::executions::DeleteExecution::new(self.inner.clone())
281 }
282
283 /// Cancels an Execution.
284 ///
285 /// # Long running operations
286 ///
287 /// This method is used to start, and/or poll a [long-running Operation].
288 /// The [Working with long-running operations] chapter in the [user guide]
289 /// covers these operations in detail.
290 ///
291 /// [long-running operation]: https://google.aip.dev/151
292 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
293 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
294 pub fn cancel_execution(&self) -> super::builder::executions::CancelExecution {
295 super::builder::executions::CancelExecution::new(self.inner.clone())
296 }
297
298 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
299 ///
300 /// [google.longrunning.Operations]: longrunning::client::Operations
301 pub fn list_operations(&self) -> super::builder::executions::ListOperations {
302 super::builder::executions::ListOperations::new(self.inner.clone())
303 }
304
305 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
306 ///
307 /// [google.longrunning.Operations]: longrunning::client::Operations
308 pub fn get_operation(&self) -> super::builder::executions::GetOperation {
309 super::builder::executions::GetOperation::new(self.inner.clone())
310 }
311
312 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
313 ///
314 /// [google.longrunning.Operations]: longrunning::client::Operations
315 pub fn delete_operation(&self) -> super::builder::executions::DeleteOperation {
316 super::builder::executions::DeleteOperation::new(self.inner.clone())
317 }
318
319 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
320 ///
321 /// [google.longrunning.Operations]: longrunning::client::Operations
322 pub fn wait_operation(&self) -> super::builder::executions::WaitOperation {
323 super::builder::executions::WaitOperation::new(self.inner.clone())
324 }
325}
326
327/// Implements a client for the Cloud Run Admin API.
328///
329/// # Example
330/// ```
331/// # async fn sample() -> gax::client_builder::Result<()> {
332/// # use google_cloud_run_v2::client::Instances;
333/// let client = Instances::builder().build().await?;
334/// // use `client` to make requests to the Cloud Run Admin API.
335/// # Ok(()) }
336/// ```
337///
338/// # Service Description
339///
340/// The Cloud Run Instances API allows you to manage Cloud Run Instances.
341///
342/// # Configuration
343///
344/// To configure `Instances` use the `with_*` methods in the type returned
345/// by [builder()][Instances::builder]. The default configuration should
346/// work for most applications. Common configuration changes include
347///
348/// * [with_endpoint()]: by default this client uses the global default endpoint
349/// (`https://run.googleapis.com`). Applications using regional
350/// endpoints or running in restricted networks (e.g. a network configured
351// with [Private Google Access with VPC Service Controls]) may want to
352/// override this default.
353/// * [with_credentials()]: by default this client uses
354/// [Application Default Credentials]. Applications using custom
355/// authentication may need to override this default.
356///
357/// [with_endpoint()]: super::builder::instances::ClientBuilder::with_endpoint
358/// [with_credentials()]: super::builder::instances::ClientBuilder::credentials
359/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
360/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
361///
362/// # Pooling and Cloning
363///
364/// `Instances` holds a connection pool internally, it is advised to
365/// create one and the reuse it. You do not need to wrap `Instances` in
366/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
367/// already uses an `Arc` internally.
368#[derive(Clone, Debug)]
369pub struct Instances {
370 inner: std::sync::Arc<dyn super::stub::dynamic::Instances>,
371}
372
373impl Instances {
374 /// Returns a builder for [Instances].
375 ///
376 /// ```
377 /// # async fn sample() -> gax::client_builder::Result<()> {
378 /// # use google_cloud_run_v2::client::Instances;
379 /// let client = Instances::builder().build().await?;
380 /// # Ok(()) }
381 /// ```
382 pub fn builder() -> super::builder::instances::ClientBuilder {
383 gax::client_builder::internal::new_builder(super::builder::instances::client::Factory)
384 }
385
386 /// Creates a new client from the provided stub.
387 ///
388 /// The most common case for calling this function is in tests mocking the
389 /// client's behavior.
390 pub fn from_stub<T>(stub: T) -> Self
391 where
392 T: super::stub::Instances + 'static,
393 {
394 Self {
395 inner: std::sync::Arc::new(stub),
396 }
397 }
398
399 pub(crate) async fn new(
400 config: gaxi::options::ClientConfig,
401 ) -> gax::client_builder::Result<Self> {
402 let inner = Self::build_inner(config).await?;
403 Ok(Self { inner })
404 }
405
406 async fn build_inner(
407 conf: gaxi::options::ClientConfig,
408 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Instances>> {
409 if gaxi::options::tracing_enabled(&conf) {
410 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
411 }
412 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
413 }
414
415 async fn build_transport(
416 conf: gaxi::options::ClientConfig,
417 ) -> gax::client_builder::Result<impl super::stub::Instances> {
418 super::transport::Instances::new(conf).await
419 }
420
421 async fn build_with_tracing(
422 conf: gaxi::options::ClientConfig,
423 ) -> gax::client_builder::Result<impl super::stub::Instances> {
424 Self::build_transport(conf)
425 .await
426 .map(super::tracing::Instances::new)
427 }
428
429 /// Creates an Instance.
430 ///
431 /// # Long running operations
432 ///
433 /// This method is used to start, and/or poll a [long-running Operation].
434 /// The [Working with long-running operations] chapter in the [user guide]
435 /// covers these operations in detail.
436 ///
437 /// [long-running operation]: https://google.aip.dev/151
438 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
439 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
440 pub fn create_instance(&self) -> super::builder::instances::CreateInstance {
441 super::builder::instances::CreateInstance::new(self.inner.clone())
442 }
443
444 /// Deletes a Instance
445 ///
446 /// # Long running operations
447 ///
448 /// This method is used to start, and/or poll a [long-running Operation].
449 /// The [Working with long-running operations] chapter in the [user guide]
450 /// covers these operations in detail.
451 ///
452 /// [long-running operation]: https://google.aip.dev/151
453 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
454 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
455 pub fn delete_instance(&self) -> super::builder::instances::DeleteInstance {
456 super::builder::instances::DeleteInstance::new(self.inner.clone())
457 }
458
459 /// Gets a Instance
460 pub fn get_instance(&self) -> super::builder::instances::GetInstance {
461 super::builder::instances::GetInstance::new(self.inner.clone())
462 }
463
464 /// Lists Instances. Results are sorted by creation time, descending.
465 pub fn list_instances(&self) -> super::builder::instances::ListInstances {
466 super::builder::instances::ListInstances::new(self.inner.clone())
467 }
468
469 /// Stops an Instance.
470 ///
471 /// # Long running operations
472 ///
473 /// This method is used to start, and/or poll a [long-running Operation].
474 /// The [Working with long-running operations] chapter in the [user guide]
475 /// covers these operations in detail.
476 ///
477 /// [long-running operation]: https://google.aip.dev/151
478 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
479 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
480 pub fn stop_instance(&self) -> super::builder::instances::StopInstance {
481 super::builder::instances::StopInstance::new(self.inner.clone())
482 }
483
484 /// Starts an Instance.
485 ///
486 /// # Long running operations
487 ///
488 /// This method is used to start, and/or poll a [long-running Operation].
489 /// The [Working with long-running operations] chapter in the [user guide]
490 /// covers these operations in detail.
491 ///
492 /// [long-running operation]: https://google.aip.dev/151
493 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
494 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
495 pub fn start_instance(&self) -> super::builder::instances::StartInstance {
496 super::builder::instances::StartInstance::new(self.inner.clone())
497 }
498
499 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
500 ///
501 /// [google.longrunning.Operations]: longrunning::client::Operations
502 pub fn list_operations(&self) -> super::builder::instances::ListOperations {
503 super::builder::instances::ListOperations::new(self.inner.clone())
504 }
505
506 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
507 ///
508 /// [google.longrunning.Operations]: longrunning::client::Operations
509 pub fn get_operation(&self) -> super::builder::instances::GetOperation {
510 super::builder::instances::GetOperation::new(self.inner.clone())
511 }
512
513 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
514 ///
515 /// [google.longrunning.Operations]: longrunning::client::Operations
516 pub fn delete_operation(&self) -> super::builder::instances::DeleteOperation {
517 super::builder::instances::DeleteOperation::new(self.inner.clone())
518 }
519
520 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
521 ///
522 /// [google.longrunning.Operations]: longrunning::client::Operations
523 pub fn wait_operation(&self) -> super::builder::instances::WaitOperation {
524 super::builder::instances::WaitOperation::new(self.inner.clone())
525 }
526}
527
528/// Implements a client for the Cloud Run Admin API.
529///
530/// # Example
531/// ```
532/// # async fn sample() -> gax::client_builder::Result<()> {
533/// # use google_cloud_run_v2::client::Jobs;
534/// let client = Jobs::builder().build().await?;
535/// // use `client` to make requests to the Cloud Run Admin API.
536/// # Ok(()) }
537/// ```
538///
539/// # Service Description
540///
541/// Cloud Run Job Control Plane API.
542///
543/// # Configuration
544///
545/// To configure `Jobs` use the `with_*` methods in the type returned
546/// by [builder()][Jobs::builder]. The default configuration should
547/// work for most applications. Common configuration changes include
548///
549/// * [with_endpoint()]: by default this client uses the global default endpoint
550/// (`https://run.googleapis.com`). Applications using regional
551/// endpoints or running in restricted networks (e.g. a network configured
552// with [Private Google Access with VPC Service Controls]) may want to
553/// override this default.
554/// * [with_credentials()]: by default this client uses
555/// [Application Default Credentials]. Applications using custom
556/// authentication may need to override this default.
557///
558/// [with_endpoint()]: super::builder::jobs::ClientBuilder::with_endpoint
559/// [with_credentials()]: super::builder::jobs::ClientBuilder::credentials
560/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
561/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
562///
563/// # Pooling and Cloning
564///
565/// `Jobs` holds a connection pool internally, it is advised to
566/// create one and the reuse it. You do not need to wrap `Jobs` in
567/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
568/// already uses an `Arc` internally.
569#[derive(Clone, Debug)]
570pub struct Jobs {
571 inner: std::sync::Arc<dyn super::stub::dynamic::Jobs>,
572}
573
574impl Jobs {
575 /// Returns a builder for [Jobs].
576 ///
577 /// ```
578 /// # async fn sample() -> gax::client_builder::Result<()> {
579 /// # use google_cloud_run_v2::client::Jobs;
580 /// let client = Jobs::builder().build().await?;
581 /// # Ok(()) }
582 /// ```
583 pub fn builder() -> super::builder::jobs::ClientBuilder {
584 gax::client_builder::internal::new_builder(super::builder::jobs::client::Factory)
585 }
586
587 /// Creates a new client from the provided stub.
588 ///
589 /// The most common case for calling this function is in tests mocking the
590 /// client's behavior.
591 pub fn from_stub<T>(stub: T) -> Self
592 where
593 T: super::stub::Jobs + 'static,
594 {
595 Self {
596 inner: std::sync::Arc::new(stub),
597 }
598 }
599
600 pub(crate) async fn new(
601 config: gaxi::options::ClientConfig,
602 ) -> gax::client_builder::Result<Self> {
603 let inner = Self::build_inner(config).await?;
604 Ok(Self { inner })
605 }
606
607 async fn build_inner(
608 conf: gaxi::options::ClientConfig,
609 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Jobs>> {
610 if gaxi::options::tracing_enabled(&conf) {
611 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
612 }
613 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
614 }
615
616 async fn build_transport(
617 conf: gaxi::options::ClientConfig,
618 ) -> gax::client_builder::Result<impl super::stub::Jobs> {
619 super::transport::Jobs::new(conf).await
620 }
621
622 async fn build_with_tracing(
623 conf: gaxi::options::ClientConfig,
624 ) -> gax::client_builder::Result<impl super::stub::Jobs> {
625 Self::build_transport(conf)
626 .await
627 .map(super::tracing::Jobs::new)
628 }
629
630 /// Creates a Job.
631 ///
632 /// # Long running operations
633 ///
634 /// This method is used to start, and/or poll a [long-running Operation].
635 /// The [Working with long-running operations] chapter in the [user guide]
636 /// covers these operations in detail.
637 ///
638 /// [long-running operation]: https://google.aip.dev/151
639 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
640 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
641 pub fn create_job(&self) -> super::builder::jobs::CreateJob {
642 super::builder::jobs::CreateJob::new(self.inner.clone())
643 }
644
645 /// Gets information about a Job.
646 pub fn get_job(&self) -> super::builder::jobs::GetJob {
647 super::builder::jobs::GetJob::new(self.inner.clone())
648 }
649
650 /// Lists Jobs. Results are sorted by creation time, descending.
651 pub fn list_jobs(&self) -> super::builder::jobs::ListJobs {
652 super::builder::jobs::ListJobs::new(self.inner.clone())
653 }
654
655 /// Updates a Job.
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 pub fn update_job(&self) -> super::builder::jobs::UpdateJob {
667 super::builder::jobs::UpdateJob::new(self.inner.clone())
668 }
669
670 /// Deletes a Job.
671 ///
672 /// # Long running operations
673 ///
674 /// This method is used to start, and/or poll a [long-running Operation].
675 /// The [Working with long-running operations] chapter in the [user guide]
676 /// covers these operations in detail.
677 ///
678 /// [long-running operation]: https://google.aip.dev/151
679 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
680 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
681 pub fn delete_job(&self) -> super::builder::jobs::DeleteJob {
682 super::builder::jobs::DeleteJob::new(self.inner.clone())
683 }
684
685 /// Triggers creation of a new Execution of this Job.
686 ///
687 /// # Long running operations
688 ///
689 /// This method is used to start, and/or poll a [long-running Operation].
690 /// The [Working with long-running operations] chapter in the [user guide]
691 /// covers these operations in detail.
692 ///
693 /// [long-running operation]: https://google.aip.dev/151
694 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
695 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
696 pub fn run_job(&self) -> super::builder::jobs::RunJob {
697 super::builder::jobs::RunJob::new(self.inner.clone())
698 }
699
700 /// Gets the IAM Access Control policy currently in effect for the given Job.
701 /// This result does not include any inherited policies.
702 pub fn get_iam_policy(&self) -> super::builder::jobs::GetIamPolicy {
703 super::builder::jobs::GetIamPolicy::new(self.inner.clone())
704 }
705
706 /// Sets the IAM Access control policy for the specified Job. Overwrites
707 /// any existing policy.
708 pub fn set_iam_policy(&self) -> super::builder::jobs::SetIamPolicy {
709 super::builder::jobs::SetIamPolicy::new(self.inner.clone())
710 }
711
712 /// Returns permissions that a caller has on the specified Project.
713 ///
714 /// There are no permissions required for making this API call.
715 pub fn test_iam_permissions(&self) -> super::builder::jobs::TestIamPermissions {
716 super::builder::jobs::TestIamPermissions::new(self.inner.clone())
717 }
718
719 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
720 ///
721 /// [google.longrunning.Operations]: longrunning::client::Operations
722 pub fn list_operations(&self) -> super::builder::jobs::ListOperations {
723 super::builder::jobs::ListOperations::new(self.inner.clone())
724 }
725
726 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
727 ///
728 /// [google.longrunning.Operations]: longrunning::client::Operations
729 pub fn get_operation(&self) -> super::builder::jobs::GetOperation {
730 super::builder::jobs::GetOperation::new(self.inner.clone())
731 }
732
733 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
734 ///
735 /// [google.longrunning.Operations]: longrunning::client::Operations
736 pub fn delete_operation(&self) -> super::builder::jobs::DeleteOperation {
737 super::builder::jobs::DeleteOperation::new(self.inner.clone())
738 }
739
740 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
741 ///
742 /// [google.longrunning.Operations]: longrunning::client::Operations
743 pub fn wait_operation(&self) -> super::builder::jobs::WaitOperation {
744 super::builder::jobs::WaitOperation::new(self.inner.clone())
745 }
746}
747
748/// Implements a client for the Cloud Run Admin API.
749///
750/// # Example
751/// ```
752/// # async fn sample() -> gax::client_builder::Result<()> {
753/// # use google_cloud_run_v2::client::Revisions;
754/// let client = Revisions::builder().build().await?;
755/// // use `client` to make requests to the Cloud Run Admin API.
756/// # Ok(()) }
757/// ```
758///
759/// # Service Description
760///
761/// Cloud Run Revision Control Plane API.
762///
763/// # Configuration
764///
765/// To configure `Revisions` use the `with_*` methods in the type returned
766/// by [builder()][Revisions::builder]. The default configuration should
767/// work for most applications. Common configuration changes include
768///
769/// * [with_endpoint()]: by default this client uses the global default endpoint
770/// (`https://run.googleapis.com`). Applications using regional
771/// endpoints or running in restricted networks (e.g. a network configured
772// with [Private Google Access with VPC Service Controls]) may want to
773/// override this default.
774/// * [with_credentials()]: by default this client uses
775/// [Application Default Credentials]. Applications using custom
776/// authentication may need to override this default.
777///
778/// [with_endpoint()]: super::builder::revisions::ClientBuilder::with_endpoint
779/// [with_credentials()]: super::builder::revisions::ClientBuilder::credentials
780/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
781/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
782///
783/// # Pooling and Cloning
784///
785/// `Revisions` holds a connection pool internally, it is advised to
786/// create one and the reuse it. You do not need to wrap `Revisions` in
787/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
788/// already uses an `Arc` internally.
789#[derive(Clone, Debug)]
790pub struct Revisions {
791 inner: std::sync::Arc<dyn super::stub::dynamic::Revisions>,
792}
793
794impl Revisions {
795 /// Returns a builder for [Revisions].
796 ///
797 /// ```
798 /// # async fn sample() -> gax::client_builder::Result<()> {
799 /// # use google_cloud_run_v2::client::Revisions;
800 /// let client = Revisions::builder().build().await?;
801 /// # Ok(()) }
802 /// ```
803 pub fn builder() -> super::builder::revisions::ClientBuilder {
804 gax::client_builder::internal::new_builder(super::builder::revisions::client::Factory)
805 }
806
807 /// Creates a new client from the provided stub.
808 ///
809 /// The most common case for calling this function is in tests mocking the
810 /// client's behavior.
811 pub fn from_stub<T>(stub: T) -> Self
812 where
813 T: super::stub::Revisions + 'static,
814 {
815 Self {
816 inner: std::sync::Arc::new(stub),
817 }
818 }
819
820 pub(crate) async fn new(
821 config: gaxi::options::ClientConfig,
822 ) -> gax::client_builder::Result<Self> {
823 let inner = Self::build_inner(config).await?;
824 Ok(Self { inner })
825 }
826
827 async fn build_inner(
828 conf: gaxi::options::ClientConfig,
829 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Revisions>> {
830 if gaxi::options::tracing_enabled(&conf) {
831 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
832 }
833 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
834 }
835
836 async fn build_transport(
837 conf: gaxi::options::ClientConfig,
838 ) -> gax::client_builder::Result<impl super::stub::Revisions> {
839 super::transport::Revisions::new(conf).await
840 }
841
842 async fn build_with_tracing(
843 conf: gaxi::options::ClientConfig,
844 ) -> gax::client_builder::Result<impl super::stub::Revisions> {
845 Self::build_transport(conf)
846 .await
847 .map(super::tracing::Revisions::new)
848 }
849
850 /// Gets information about a Revision.
851 pub fn get_revision(&self) -> super::builder::revisions::GetRevision {
852 super::builder::revisions::GetRevision::new(self.inner.clone())
853 }
854
855 /// Lists Revisions from a given Service, or from a given location. Results
856 /// are sorted by creation time, descending.
857 pub fn list_revisions(&self) -> super::builder::revisions::ListRevisions {
858 super::builder::revisions::ListRevisions::new(self.inner.clone())
859 }
860
861 /// Deletes a Revision.
862 ///
863 /// # Long running operations
864 ///
865 /// This method is used to start, and/or poll a [long-running Operation].
866 /// The [Working with long-running operations] chapter in the [user guide]
867 /// covers these operations in detail.
868 ///
869 /// [long-running operation]: https://google.aip.dev/151
870 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
871 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
872 pub fn delete_revision(&self) -> super::builder::revisions::DeleteRevision {
873 super::builder::revisions::DeleteRevision::new(self.inner.clone())
874 }
875
876 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
877 ///
878 /// [google.longrunning.Operations]: longrunning::client::Operations
879 pub fn list_operations(&self) -> super::builder::revisions::ListOperations {
880 super::builder::revisions::ListOperations::new(self.inner.clone())
881 }
882
883 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
884 ///
885 /// [google.longrunning.Operations]: longrunning::client::Operations
886 pub fn get_operation(&self) -> super::builder::revisions::GetOperation {
887 super::builder::revisions::GetOperation::new(self.inner.clone())
888 }
889
890 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
891 ///
892 /// [google.longrunning.Operations]: longrunning::client::Operations
893 pub fn delete_operation(&self) -> super::builder::revisions::DeleteOperation {
894 super::builder::revisions::DeleteOperation::new(self.inner.clone())
895 }
896
897 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
898 ///
899 /// [google.longrunning.Operations]: longrunning::client::Operations
900 pub fn wait_operation(&self) -> super::builder::revisions::WaitOperation {
901 super::builder::revisions::WaitOperation::new(self.inner.clone())
902 }
903}
904
905/// Implements a client for the Cloud Run Admin API.
906///
907/// # Example
908/// ```
909/// # async fn sample() -> gax::client_builder::Result<()> {
910/// # use google_cloud_run_v2::client::Services;
911/// let client = Services::builder().build().await?;
912/// // use `client` to make requests to the Cloud Run Admin API.
913/// # Ok(()) }
914/// ```
915///
916/// # Service Description
917///
918/// Cloud Run Service Control Plane API
919///
920/// # Configuration
921///
922/// To configure `Services` use the `with_*` methods in the type returned
923/// by [builder()][Services::builder]. The default configuration should
924/// work for most applications. Common configuration changes include
925///
926/// * [with_endpoint()]: by default this client uses the global default endpoint
927/// (`https://run.googleapis.com`). Applications using regional
928/// endpoints or running in restricted networks (e.g. a network configured
929// with [Private Google Access with VPC Service Controls]) may want to
930/// override this default.
931/// * [with_credentials()]: by default this client uses
932/// [Application Default Credentials]. Applications using custom
933/// authentication may need to override this default.
934///
935/// [with_endpoint()]: super::builder::services::ClientBuilder::with_endpoint
936/// [with_credentials()]: super::builder::services::ClientBuilder::credentials
937/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
938/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
939///
940/// # Pooling and Cloning
941///
942/// `Services` holds a connection pool internally, it is advised to
943/// create one and the reuse it. You do not need to wrap `Services` in
944/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
945/// already uses an `Arc` internally.
946#[derive(Clone, Debug)]
947pub struct Services {
948 inner: std::sync::Arc<dyn super::stub::dynamic::Services>,
949}
950
951impl Services {
952 /// Returns a builder for [Services].
953 ///
954 /// ```
955 /// # async fn sample() -> gax::client_builder::Result<()> {
956 /// # use google_cloud_run_v2::client::Services;
957 /// let client = Services::builder().build().await?;
958 /// # Ok(()) }
959 /// ```
960 pub fn builder() -> super::builder::services::ClientBuilder {
961 gax::client_builder::internal::new_builder(super::builder::services::client::Factory)
962 }
963
964 /// Creates a new client from the provided stub.
965 ///
966 /// The most common case for calling this function is in tests mocking the
967 /// client's behavior.
968 pub fn from_stub<T>(stub: T) -> Self
969 where
970 T: super::stub::Services + 'static,
971 {
972 Self {
973 inner: std::sync::Arc::new(stub),
974 }
975 }
976
977 pub(crate) async fn new(
978 config: gaxi::options::ClientConfig,
979 ) -> gax::client_builder::Result<Self> {
980 let inner = Self::build_inner(config).await?;
981 Ok(Self { inner })
982 }
983
984 async fn build_inner(
985 conf: gaxi::options::ClientConfig,
986 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Services>> {
987 if gaxi::options::tracing_enabled(&conf) {
988 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
989 }
990 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
991 }
992
993 async fn build_transport(
994 conf: gaxi::options::ClientConfig,
995 ) -> gax::client_builder::Result<impl super::stub::Services> {
996 super::transport::Services::new(conf).await
997 }
998
999 async fn build_with_tracing(
1000 conf: gaxi::options::ClientConfig,
1001 ) -> gax::client_builder::Result<impl super::stub::Services> {
1002 Self::build_transport(conf)
1003 .await
1004 .map(super::tracing::Services::new)
1005 }
1006
1007 /// Creates a new Service in a given project and location.
1008 ///
1009 /// # Long running operations
1010 ///
1011 /// This method is used to start, and/or poll a [long-running Operation].
1012 /// The [Working with long-running operations] chapter in the [user guide]
1013 /// covers these operations in detail.
1014 ///
1015 /// [long-running operation]: https://google.aip.dev/151
1016 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1017 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1018 pub fn create_service(&self) -> super::builder::services::CreateService {
1019 super::builder::services::CreateService::new(self.inner.clone())
1020 }
1021
1022 /// Gets information about a Service.
1023 pub fn get_service(&self) -> super::builder::services::GetService {
1024 super::builder::services::GetService::new(self.inner.clone())
1025 }
1026
1027 /// Lists Services. Results are sorted by creation time, descending.
1028 pub fn list_services(&self) -> super::builder::services::ListServices {
1029 super::builder::services::ListServices::new(self.inner.clone())
1030 }
1031
1032 /// Updates a Service.
1033 ///
1034 /// # Long running operations
1035 ///
1036 /// This method is used to start, and/or poll a [long-running Operation].
1037 /// The [Working with long-running operations] chapter in the [user guide]
1038 /// covers these operations in detail.
1039 ///
1040 /// [long-running operation]: https://google.aip.dev/151
1041 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1042 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1043 pub fn update_service(&self) -> super::builder::services::UpdateService {
1044 super::builder::services::UpdateService::new(self.inner.clone())
1045 }
1046
1047 /// Deletes a Service.
1048 /// This will cause the Service to stop serving traffic and will delete all
1049 /// revisions.
1050 ///
1051 /// # Long running operations
1052 ///
1053 /// This method is used to start, and/or poll a [long-running Operation].
1054 /// The [Working with long-running operations] chapter in the [user guide]
1055 /// covers these operations in detail.
1056 ///
1057 /// [long-running operation]: https://google.aip.dev/151
1058 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1059 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1060 pub fn delete_service(&self) -> super::builder::services::DeleteService {
1061 super::builder::services::DeleteService::new(self.inner.clone())
1062 }
1063
1064 /// Gets the IAM Access Control policy currently in effect for the given
1065 /// Cloud Run Service. This result does not include any inherited policies.
1066 pub fn get_iam_policy(&self) -> super::builder::services::GetIamPolicy {
1067 super::builder::services::GetIamPolicy::new(self.inner.clone())
1068 }
1069
1070 /// Sets the IAM Access control policy for the specified Service. Overwrites
1071 /// any existing policy.
1072 pub fn set_iam_policy(&self) -> super::builder::services::SetIamPolicy {
1073 super::builder::services::SetIamPolicy::new(self.inner.clone())
1074 }
1075
1076 /// Returns permissions that a caller has on the specified Project.
1077 ///
1078 /// There are no permissions required for making this API call.
1079 pub fn test_iam_permissions(&self) -> super::builder::services::TestIamPermissions {
1080 super::builder::services::TestIamPermissions::new(self.inner.clone())
1081 }
1082
1083 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1084 ///
1085 /// [google.longrunning.Operations]: longrunning::client::Operations
1086 pub fn list_operations(&self) -> super::builder::services::ListOperations {
1087 super::builder::services::ListOperations::new(self.inner.clone())
1088 }
1089
1090 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1091 ///
1092 /// [google.longrunning.Operations]: longrunning::client::Operations
1093 pub fn get_operation(&self) -> super::builder::services::GetOperation {
1094 super::builder::services::GetOperation::new(self.inner.clone())
1095 }
1096
1097 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1098 ///
1099 /// [google.longrunning.Operations]: longrunning::client::Operations
1100 pub fn delete_operation(&self) -> super::builder::services::DeleteOperation {
1101 super::builder::services::DeleteOperation::new(self.inner.clone())
1102 }
1103
1104 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1105 ///
1106 /// [google.longrunning.Operations]: longrunning::client::Operations
1107 pub fn wait_operation(&self) -> super::builder::services::WaitOperation {
1108 super::builder::services::WaitOperation::new(self.inner.clone())
1109 }
1110}
1111
1112/// Implements a client for the Cloud Run Admin API.
1113///
1114/// # Example
1115/// ```
1116/// # async fn sample() -> gax::client_builder::Result<()> {
1117/// # use google_cloud_run_v2::client::Tasks;
1118/// let client = Tasks::builder().build().await?;
1119/// // use `client` to make requests to the Cloud Run Admin API.
1120/// # Ok(()) }
1121/// ```
1122///
1123/// # Service Description
1124///
1125/// Cloud Run Task Control Plane API.
1126///
1127/// # Configuration
1128///
1129/// To configure `Tasks` use the `with_*` methods in the type returned
1130/// by [builder()][Tasks::builder]. The default configuration should
1131/// work for most applications. Common configuration changes include
1132///
1133/// * [with_endpoint()]: by default this client uses the global default endpoint
1134/// (`https://run.googleapis.com`). Applications using regional
1135/// endpoints or running in restricted networks (e.g. a network configured
1136// with [Private Google Access with VPC Service Controls]) may want to
1137/// override this default.
1138/// * [with_credentials()]: by default this client uses
1139/// [Application Default Credentials]. Applications using custom
1140/// authentication may need to override this default.
1141///
1142/// [with_endpoint()]: super::builder::tasks::ClientBuilder::with_endpoint
1143/// [with_credentials()]: super::builder::tasks::ClientBuilder::credentials
1144/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1145/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1146///
1147/// # Pooling and Cloning
1148///
1149/// `Tasks` holds a connection pool internally, it is advised to
1150/// create one and the reuse it. You do not need to wrap `Tasks` in
1151/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1152/// already uses an `Arc` internally.
1153#[derive(Clone, Debug)]
1154pub struct Tasks {
1155 inner: std::sync::Arc<dyn super::stub::dynamic::Tasks>,
1156}
1157
1158impl Tasks {
1159 /// Returns a builder for [Tasks].
1160 ///
1161 /// ```
1162 /// # async fn sample() -> gax::client_builder::Result<()> {
1163 /// # use google_cloud_run_v2::client::Tasks;
1164 /// let client = Tasks::builder().build().await?;
1165 /// # Ok(()) }
1166 /// ```
1167 pub fn builder() -> super::builder::tasks::ClientBuilder {
1168 gax::client_builder::internal::new_builder(super::builder::tasks::client::Factory)
1169 }
1170
1171 /// Creates a new client from the provided stub.
1172 ///
1173 /// The most common case for calling this function is in tests mocking the
1174 /// client's behavior.
1175 pub fn from_stub<T>(stub: T) -> Self
1176 where
1177 T: super::stub::Tasks + 'static,
1178 {
1179 Self {
1180 inner: std::sync::Arc::new(stub),
1181 }
1182 }
1183
1184 pub(crate) async fn new(
1185 config: gaxi::options::ClientConfig,
1186 ) -> gax::client_builder::Result<Self> {
1187 let inner = Self::build_inner(config).await?;
1188 Ok(Self { inner })
1189 }
1190
1191 async fn build_inner(
1192 conf: gaxi::options::ClientConfig,
1193 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Tasks>> {
1194 if gaxi::options::tracing_enabled(&conf) {
1195 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1196 }
1197 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1198 }
1199
1200 async fn build_transport(
1201 conf: gaxi::options::ClientConfig,
1202 ) -> gax::client_builder::Result<impl super::stub::Tasks> {
1203 super::transport::Tasks::new(conf).await
1204 }
1205
1206 async fn build_with_tracing(
1207 conf: gaxi::options::ClientConfig,
1208 ) -> gax::client_builder::Result<impl super::stub::Tasks> {
1209 Self::build_transport(conf)
1210 .await
1211 .map(super::tracing::Tasks::new)
1212 }
1213
1214 /// Gets information about a Task.
1215 pub fn get_task(&self) -> super::builder::tasks::GetTask {
1216 super::builder::tasks::GetTask::new(self.inner.clone())
1217 }
1218
1219 /// Lists Tasks from an Execution of a Job.
1220 pub fn list_tasks(&self) -> super::builder::tasks::ListTasks {
1221 super::builder::tasks::ListTasks::new(self.inner.clone())
1222 }
1223
1224 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1225 ///
1226 /// [google.longrunning.Operations]: longrunning::client::Operations
1227 pub fn list_operations(&self) -> super::builder::tasks::ListOperations {
1228 super::builder::tasks::ListOperations::new(self.inner.clone())
1229 }
1230
1231 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1232 ///
1233 /// [google.longrunning.Operations]: longrunning::client::Operations
1234 pub fn get_operation(&self) -> super::builder::tasks::GetOperation {
1235 super::builder::tasks::GetOperation::new(self.inner.clone())
1236 }
1237
1238 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1239 ///
1240 /// [google.longrunning.Operations]: longrunning::client::Operations
1241 pub fn delete_operation(&self) -> super::builder::tasks::DeleteOperation {
1242 super::builder::tasks::DeleteOperation::new(self.inner.clone())
1243 }
1244
1245 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1246 ///
1247 /// [google.longrunning.Operations]: longrunning::client::Operations
1248 pub fn wait_operation(&self) -> super::builder::tasks::WaitOperation {
1249 super::builder::tasks::WaitOperation::new(self.inner.clone())
1250 }
1251}
1252
1253/// Implements a client for the Cloud Run Admin API.
1254///
1255/// # Example
1256/// ```
1257/// # async fn sample() -> gax::client_builder::Result<()> {
1258/// # use google_cloud_run_v2::client::WorkerPools;
1259/// let client = WorkerPools::builder().build().await?;
1260/// // use `client` to make requests to the Cloud Run Admin API.
1261/// # Ok(()) }
1262/// ```
1263///
1264/// # Service Description
1265///
1266/// Cloud Run WorkerPool Control Plane API.
1267///
1268/// # Configuration
1269///
1270/// To configure `WorkerPools` use the `with_*` methods in the type returned
1271/// by [builder()][WorkerPools::builder]. The default configuration should
1272/// work for most applications. Common configuration changes include
1273///
1274/// * [with_endpoint()]: by default this client uses the global default endpoint
1275/// (`https://run.googleapis.com`). Applications using regional
1276/// endpoints or running in restricted networks (e.g. a network configured
1277// with [Private Google Access with VPC Service Controls]) may want to
1278/// override this default.
1279/// * [with_credentials()]: by default this client uses
1280/// [Application Default Credentials]. Applications using custom
1281/// authentication may need to override this default.
1282///
1283/// [with_endpoint()]: super::builder::worker_pools::ClientBuilder::with_endpoint
1284/// [with_credentials()]: super::builder::worker_pools::ClientBuilder::credentials
1285/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1286/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1287///
1288/// # Pooling and Cloning
1289///
1290/// `WorkerPools` holds a connection pool internally, it is advised to
1291/// create one and the reuse it. You do not need to wrap `WorkerPools` in
1292/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1293/// already uses an `Arc` internally.
1294#[derive(Clone, Debug)]
1295pub struct WorkerPools {
1296 inner: std::sync::Arc<dyn super::stub::dynamic::WorkerPools>,
1297}
1298
1299impl WorkerPools {
1300 /// Returns a builder for [WorkerPools].
1301 ///
1302 /// ```
1303 /// # async fn sample() -> gax::client_builder::Result<()> {
1304 /// # use google_cloud_run_v2::client::WorkerPools;
1305 /// let client = WorkerPools::builder().build().await?;
1306 /// # Ok(()) }
1307 /// ```
1308 pub fn builder() -> super::builder::worker_pools::ClientBuilder {
1309 gax::client_builder::internal::new_builder(super::builder::worker_pools::client::Factory)
1310 }
1311
1312 /// Creates a new client from the provided stub.
1313 ///
1314 /// The most common case for calling this function is in tests mocking the
1315 /// client's behavior.
1316 pub fn from_stub<T>(stub: T) -> Self
1317 where
1318 T: super::stub::WorkerPools + 'static,
1319 {
1320 Self {
1321 inner: std::sync::Arc::new(stub),
1322 }
1323 }
1324
1325 pub(crate) async fn new(
1326 config: gaxi::options::ClientConfig,
1327 ) -> gax::client_builder::Result<Self> {
1328 let inner = Self::build_inner(config).await?;
1329 Ok(Self { inner })
1330 }
1331
1332 async fn build_inner(
1333 conf: gaxi::options::ClientConfig,
1334 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::WorkerPools>> {
1335 if gaxi::options::tracing_enabled(&conf) {
1336 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1337 }
1338 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1339 }
1340
1341 async fn build_transport(
1342 conf: gaxi::options::ClientConfig,
1343 ) -> gax::client_builder::Result<impl super::stub::WorkerPools> {
1344 super::transport::WorkerPools::new(conf).await
1345 }
1346
1347 async fn build_with_tracing(
1348 conf: gaxi::options::ClientConfig,
1349 ) -> gax::client_builder::Result<impl super::stub::WorkerPools> {
1350 Self::build_transport(conf)
1351 .await
1352 .map(super::tracing::WorkerPools::new)
1353 }
1354
1355 /// Creates a new WorkerPool in a given project and location.
1356 ///
1357 /// # Long running operations
1358 ///
1359 /// This method is used to start, and/or poll a [long-running Operation].
1360 /// The [Working with long-running operations] chapter in the [user guide]
1361 /// covers these operations in detail.
1362 ///
1363 /// [long-running operation]: https://google.aip.dev/151
1364 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1365 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1366 pub fn create_worker_pool(&self) -> super::builder::worker_pools::CreateWorkerPool {
1367 super::builder::worker_pools::CreateWorkerPool::new(self.inner.clone())
1368 }
1369
1370 /// Gets information about a WorkerPool.
1371 pub fn get_worker_pool(&self) -> super::builder::worker_pools::GetWorkerPool {
1372 super::builder::worker_pools::GetWorkerPool::new(self.inner.clone())
1373 }
1374
1375 /// Lists WorkerPools. Results are sorted by creation time, descending.
1376 pub fn list_worker_pools(&self) -> super::builder::worker_pools::ListWorkerPools {
1377 super::builder::worker_pools::ListWorkerPools::new(self.inner.clone())
1378 }
1379
1380 /// Updates a WorkerPool.
1381 ///
1382 /// # Long running operations
1383 ///
1384 /// This method is used to start, and/or poll a [long-running Operation].
1385 /// The [Working with long-running operations] chapter in the [user guide]
1386 /// covers these operations in detail.
1387 ///
1388 /// [long-running operation]: https://google.aip.dev/151
1389 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1390 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1391 pub fn update_worker_pool(&self) -> super::builder::worker_pools::UpdateWorkerPool {
1392 super::builder::worker_pools::UpdateWorkerPool::new(self.inner.clone())
1393 }
1394
1395 /// Deletes a WorkerPool.
1396 ///
1397 /// # Long running operations
1398 ///
1399 /// This method is used to start, and/or poll a [long-running Operation].
1400 /// The [Working with long-running operations] chapter in the [user guide]
1401 /// covers these operations in detail.
1402 ///
1403 /// [long-running operation]: https://google.aip.dev/151
1404 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1405 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1406 pub fn delete_worker_pool(&self) -> super::builder::worker_pools::DeleteWorkerPool {
1407 super::builder::worker_pools::DeleteWorkerPool::new(self.inner.clone())
1408 }
1409
1410 /// Gets the IAM Access Control policy currently in effect for the given
1411 /// Cloud Run WorkerPool. This result does not include any inherited policies.
1412 pub fn get_iam_policy(&self) -> super::builder::worker_pools::GetIamPolicy {
1413 super::builder::worker_pools::GetIamPolicy::new(self.inner.clone())
1414 }
1415
1416 /// Sets the IAM Access control policy for the specified WorkerPool. Overwrites
1417 /// any existing policy.
1418 pub fn set_iam_policy(&self) -> super::builder::worker_pools::SetIamPolicy {
1419 super::builder::worker_pools::SetIamPolicy::new(self.inner.clone())
1420 }
1421
1422 /// Returns permissions that a caller has on the specified Project.
1423 ///
1424 /// There are no permissions required for making this API call.
1425 pub fn test_iam_permissions(&self) -> super::builder::worker_pools::TestIamPermissions {
1426 super::builder::worker_pools::TestIamPermissions::new(self.inner.clone())
1427 }
1428
1429 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1430 ///
1431 /// [google.longrunning.Operations]: longrunning::client::Operations
1432 pub fn list_operations(&self) -> super::builder::worker_pools::ListOperations {
1433 super::builder::worker_pools::ListOperations::new(self.inner.clone())
1434 }
1435
1436 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1437 ///
1438 /// [google.longrunning.Operations]: longrunning::client::Operations
1439 pub fn get_operation(&self) -> super::builder::worker_pools::GetOperation {
1440 super::builder::worker_pools::GetOperation::new(self.inner.clone())
1441 }
1442
1443 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1444 ///
1445 /// [google.longrunning.Operations]: longrunning::client::Operations
1446 pub fn delete_operation(&self) -> super::builder::worker_pools::DeleteOperation {
1447 super::builder::worker_pools::DeleteOperation::new(self.inner.clone())
1448 }
1449
1450 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1451 ///
1452 /// [google.longrunning.Operations]: longrunning::client::Operations
1453 pub fn wait_operation(&self) -> super::builder::worker_pools::WaitOperation {
1454 super::builder::worker_pools::WaitOperation::new(self.inner.clone())
1455 }
1456}