google_cloud_build_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::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 Build API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_build_v1::client::CloudBuild;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28/// project_id: &str,
29/// ) -> anyhow::Result<()> {
30/// let client = CloudBuild::builder().build().await?;
31/// let mut list = client.list_builds()
32/// .set_parent(format!("projects/{project_id}"))
33/// .by_item();
34/// while let Some(item) = list.next().await.transpose()? {
35/// println!("{:?}", item);
36/// }
37/// Ok(())
38/// }
39/// ```
40///
41/// # Service Description
42///
43/// Creates and manages builds on Google Cloud Platform.
44///
45/// The main concept used by this API is a `Build`, which describes the location
46/// of the source to build, how to build the source, and where to store the
47/// built artifacts, if any.
48///
49/// A user can list previously-requested builds or get builds by their ID to
50/// determine the status of the build.
51///
52/// # Configuration
53///
54/// To configure `CloudBuild` use the `with_*` methods in the type returned
55/// by [builder()][CloudBuild::builder]. The default configuration should
56/// work for most applications. Common configuration changes include
57///
58/// * [with_endpoint()]: by default this client uses the global default endpoint
59/// (`https://cloudbuild.googleapis.com`). Applications using regional
60/// endpoints or running in restricted networks (e.g. a network configured
61/// with [Private Google Access with VPC Service Controls]) may want to
62/// override this default.
63/// * [with_credentials()]: by default this client uses
64/// [Application Default Credentials]. Applications using custom
65/// authentication may need to override this default.
66///
67/// [with_endpoint()]: super::builder::cloud_build::ClientBuilder::with_endpoint
68/// [with_credentials()]: super::builder::cloud_build::ClientBuilder::with_credentials
69/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
70/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
71///
72/// # Pooling and Cloning
73///
74/// `CloudBuild` holds a connection pool internally, it is advised to
75/// create one and reuse it. You do not need to wrap `CloudBuild` in
76/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
77/// already uses an `Arc` internally.
78#[derive(Clone, Debug)]
79pub struct CloudBuild {
80 inner: std::sync::Arc<dyn super::stub::dynamic::CloudBuild>,
81}
82
83impl CloudBuild {
84 /// Returns a builder for [CloudBuild].
85 ///
86 /// ```
87 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
88 /// # use google_cloud_build_v1::client::CloudBuild;
89 /// let client = CloudBuild::builder().build().await?;
90 /// # Ok(()) }
91 /// ```
92 pub fn builder() -> super::builder::cloud_build::ClientBuilder {
93 crate::new_client_builder(super::builder::cloud_build::client::Factory)
94 }
95
96 /// Creates a new client from the provided stub.
97 ///
98 /// The most common case for calling this function is in tests mocking the
99 /// client's behavior.
100 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
101 where
102 T: super::stub::CloudBuild + 'static,
103 {
104 Self { inner: stub.into() }
105 }
106
107 pub(crate) async fn new(
108 config: gaxi::options::ClientConfig,
109 ) -> crate::ClientBuilderResult<Self> {
110 let inner = Self::build_inner(config).await?;
111 Ok(Self { inner })
112 }
113
114 async fn build_inner(
115 conf: gaxi::options::ClientConfig,
116 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CloudBuild>> {
117 if gaxi::options::tracing_enabled(&conf) {
118 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
119 }
120 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
121 }
122
123 async fn build_transport(
124 conf: gaxi::options::ClientConfig,
125 ) -> crate::ClientBuilderResult<impl super::stub::CloudBuild> {
126 super::transport::CloudBuild::new(conf).await
127 }
128
129 async fn build_with_tracing(
130 conf: gaxi::options::ClientConfig,
131 ) -> crate::ClientBuilderResult<impl super::stub::CloudBuild> {
132 Self::build_transport(conf)
133 .await
134 .map(super::tracing::CloudBuild::new)
135 }
136
137 /// Starts a build with the specified configuration.
138 ///
139 /// This method returns a long-running `Operation`, which includes the build
140 /// ID. Pass the build ID to `GetBuild` to determine the build status (such as
141 /// `SUCCESS` or `FAILURE`).
142 ///
143 /// # Long running operations
144 ///
145 /// This method is used to start, and/or poll a [long-running Operation].
146 /// The [Working with long-running operations] chapter in the [user guide]
147 /// covers these operations in detail.
148 ///
149 /// [long-running operation]: https://google.aip.dev/151
150 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
151 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
152 ///
153 /// # Example
154 /// ```
155 /// # use google_cloud_build_v1::client::CloudBuild;
156 /// use google_cloud_lro::Poller;
157 /// use google_cloud_build_v1::model::Build;
158 /// use google_cloud_build_v1::Result;
159 /// async fn sample(
160 /// client: &CloudBuild, project_id: &str
161 /// ) -> Result<()> {
162 /// let response = client.create_build()
163 /// .set_parent(format!("projects/{project_id}"))
164 /// .set_build(
165 /// Build::new()/* set fields */
166 /// )
167 /// .poller().until_done().await?;
168 /// println!("response {:?}", response);
169 /// Ok(())
170 /// }
171 /// ```
172 pub fn create_build(&self) -> super::builder::cloud_build::CreateBuild {
173 super::builder::cloud_build::CreateBuild::new(self.inner.clone())
174 }
175
176 /// Returns information about a previously requested build.
177 ///
178 /// The `Build` that is returned includes its status (such as `SUCCESS`,
179 /// `FAILURE`, or `WORKING`), and timing information.
180 ///
181 /// # Example
182 /// ```
183 /// # use google_cloud_build_v1::client::CloudBuild;
184 /// use google_cloud_build_v1::Result;
185 /// async fn sample(
186 /// client: &CloudBuild, project_id: &str, build_id: &str
187 /// ) -> Result<()> {
188 /// let response = client.get_build()
189 /// .set_name(format!("projects/{project_id}/builds/{build_id}"))
190 /// .send().await?;
191 /// println!("response {:?}", response);
192 /// Ok(())
193 /// }
194 /// ```
195 pub fn get_build(&self) -> super::builder::cloud_build::GetBuild {
196 super::builder::cloud_build::GetBuild::new(self.inner.clone())
197 }
198
199 /// Lists previously requested builds.
200 ///
201 /// Previously requested builds may still be in-progress, or may have finished
202 /// successfully or unsuccessfully.
203 ///
204 /// # Example
205 /// ```
206 /// # use google_cloud_build_v1::client::CloudBuild;
207 /// use google_cloud_gax::paginator::ItemPaginator as _;
208 /// use google_cloud_build_v1::Result;
209 /// async fn sample(
210 /// client: &CloudBuild, project_id: &str
211 /// ) -> Result<()> {
212 /// let mut list = client.list_builds()
213 /// .set_parent(format!("projects/{project_id}"))
214 /// .by_item();
215 /// while let Some(item) = list.next().await.transpose()? {
216 /// println!("{:?}", item);
217 /// }
218 /// Ok(())
219 /// }
220 /// ```
221 pub fn list_builds(&self) -> super::builder::cloud_build::ListBuilds {
222 super::builder::cloud_build::ListBuilds::new(self.inner.clone())
223 }
224
225 /// Cancels a build in progress.
226 ///
227 /// # Example
228 /// ```
229 /// # use google_cloud_build_v1::client::CloudBuild;
230 /// use google_cloud_build_v1::Result;
231 /// async fn sample(
232 /// client: &CloudBuild
233 /// ) -> Result<()> {
234 /// let response = client.cancel_build()
235 /// /* set fields */
236 /// .send().await?;
237 /// println!("response {:?}", response);
238 /// Ok(())
239 /// }
240 /// ```
241 pub fn cancel_build(&self) -> super::builder::cloud_build::CancelBuild {
242 super::builder::cloud_build::CancelBuild::new(self.inner.clone())
243 }
244
245 /// Creates a new build based on the specified build.
246 ///
247 /// This method creates a new build using the original build request, which may
248 /// or may not result in an identical build.
249 ///
250 /// For triggered builds:
251 ///
252 /// * Triggered builds resolve to a precise revision; therefore a retry of a
253 /// triggered build will result in a build that uses the same revision.
254 ///
255 /// For non-triggered builds that specify `RepoSource`:
256 ///
257 /// * If the original build built from the tip of a branch, the retried build
258 /// will build from the tip of that branch, which may not be the same revision
259 /// as the original build.
260 /// * If the original build specified a commit sha or revision ID, the retried
261 /// build will use the identical source.
262 ///
263 /// For builds that specify `StorageSource`:
264 ///
265 /// * If the original build pulled source from Cloud Storage without
266 /// specifying the generation of the object, the new build will use the current
267 /// object, which may be different from the original build source.
268 /// * If the original build pulled source from Cloud Storage and specified the
269 /// generation of the object, the new build will attempt to use the same
270 /// object, which may or may not be available depending on the bucket's
271 /// lifecycle management settings.
272 ///
273 /// # Long running operations
274 ///
275 /// This method is used to start, and/or poll a [long-running Operation].
276 /// The [Working with long-running operations] chapter in the [user guide]
277 /// covers these operations in detail.
278 ///
279 /// [long-running operation]: https://google.aip.dev/151
280 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
281 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
282 ///
283 /// # Example
284 /// ```
285 /// # use google_cloud_build_v1::client::CloudBuild;
286 /// use google_cloud_lro::Poller;
287 /// use google_cloud_build_v1::Result;
288 /// async fn sample(
289 /// client: &CloudBuild
290 /// ) -> Result<()> {
291 /// let response = client.retry_build()
292 /// /* set fields */
293 /// .poller().until_done().await?;
294 /// println!("response {:?}", response);
295 /// Ok(())
296 /// }
297 /// ```
298 pub fn retry_build(&self) -> super::builder::cloud_build::RetryBuild {
299 super::builder::cloud_build::RetryBuild::new(self.inner.clone())
300 }
301
302 /// Approves or rejects a pending build.
303 ///
304 /// If approved, the returned long-running operation (LRO) will be analogous to
305 /// the LRO returned from a CreateBuild call.
306 ///
307 /// If rejected, the returned LRO will be immediately done.
308 ///
309 /// # Long running operations
310 ///
311 /// This method is used to start, and/or poll a [long-running Operation].
312 /// The [Working with long-running operations] chapter in the [user guide]
313 /// covers these operations in detail.
314 ///
315 /// [long-running operation]: https://google.aip.dev/151
316 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
317 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
318 ///
319 /// # Example
320 /// ```
321 /// # use google_cloud_build_v1::client::CloudBuild;
322 /// use google_cloud_lro::Poller;
323 /// use google_cloud_build_v1::Result;
324 /// async fn sample(
325 /// client: &CloudBuild
326 /// ) -> Result<()> {
327 /// let response = client.approve_build()
328 /// /* set fields */
329 /// .poller().until_done().await?;
330 /// println!("response {:?}", response);
331 /// Ok(())
332 /// }
333 /// ```
334 pub fn approve_build(&self) -> super::builder::cloud_build::ApproveBuild {
335 super::builder::cloud_build::ApproveBuild::new(self.inner.clone())
336 }
337
338 /// Creates a new `BuildTrigger`.
339 ///
340 /// # Example
341 /// ```
342 /// # use google_cloud_build_v1::client::CloudBuild;
343 /// use google_cloud_build_v1::Result;
344 /// async fn sample(
345 /// client: &CloudBuild
346 /// ) -> Result<()> {
347 /// let response = client.create_build_trigger()
348 /// /* set fields */
349 /// .send().await?;
350 /// println!("response {:?}", response);
351 /// Ok(())
352 /// }
353 /// ```
354 pub fn create_build_trigger(&self) -> super::builder::cloud_build::CreateBuildTrigger {
355 super::builder::cloud_build::CreateBuildTrigger::new(self.inner.clone())
356 }
357
358 /// Returns information about a `BuildTrigger`.
359 ///
360 /// # Example
361 /// ```
362 /// # use google_cloud_build_v1::client::CloudBuild;
363 /// use google_cloud_build_v1::Result;
364 /// async fn sample(
365 /// client: &CloudBuild
366 /// ) -> Result<()> {
367 /// let response = client.get_build_trigger()
368 /// /* set fields */
369 /// .send().await?;
370 /// println!("response {:?}", response);
371 /// Ok(())
372 /// }
373 /// ```
374 pub fn get_build_trigger(&self) -> super::builder::cloud_build::GetBuildTrigger {
375 super::builder::cloud_build::GetBuildTrigger::new(self.inner.clone())
376 }
377
378 /// Lists existing `BuildTrigger`s.
379 ///
380 /// # Example
381 /// ```
382 /// # use google_cloud_build_v1::client::CloudBuild;
383 /// use google_cloud_gax::paginator::ItemPaginator as _;
384 /// use google_cloud_build_v1::Result;
385 /// async fn sample(
386 /// client: &CloudBuild, project_id: &str
387 /// ) -> Result<()> {
388 /// let mut list = client.list_build_triggers()
389 /// .set_parent(format!("projects/{project_id}"))
390 /// .by_item();
391 /// while let Some(item) = list.next().await.transpose()? {
392 /// println!("{:?}", item);
393 /// }
394 /// Ok(())
395 /// }
396 /// ```
397 pub fn list_build_triggers(&self) -> super::builder::cloud_build::ListBuildTriggers {
398 super::builder::cloud_build::ListBuildTriggers::new(self.inner.clone())
399 }
400
401 /// Deletes a `BuildTrigger` by its project ID and trigger ID.
402 ///
403 /// # Example
404 /// ```
405 /// # use google_cloud_build_v1::client::CloudBuild;
406 /// use google_cloud_build_v1::Result;
407 /// async fn sample(
408 /// client: &CloudBuild
409 /// ) -> Result<()> {
410 /// client.delete_build_trigger()
411 /// /* set fields */
412 /// .send().await?;
413 /// Ok(())
414 /// }
415 /// ```
416 pub fn delete_build_trigger(&self) -> super::builder::cloud_build::DeleteBuildTrigger {
417 super::builder::cloud_build::DeleteBuildTrigger::new(self.inner.clone())
418 }
419
420 /// Updates a `BuildTrigger` by its project ID and trigger ID.
421 ///
422 /// # Example
423 /// ```
424 /// # use google_cloud_build_v1::client::CloudBuild;
425 /// use google_cloud_build_v1::Result;
426 /// async fn sample(
427 /// client: &CloudBuild
428 /// ) -> Result<()> {
429 /// let response = client.update_build_trigger()
430 /// /* set fields */
431 /// .send().await?;
432 /// println!("response {:?}", response);
433 /// Ok(())
434 /// }
435 /// ```
436 pub fn update_build_trigger(&self) -> super::builder::cloud_build::UpdateBuildTrigger {
437 super::builder::cloud_build::UpdateBuildTrigger::new(self.inner.clone())
438 }
439
440 /// Runs a `BuildTrigger` at a particular source revision.
441 ///
442 /// To run a regional or global trigger, use the POST request
443 /// that includes the location endpoint in the path (ex.
444 /// v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The
445 /// POST request that does not include the location endpoint in the path can
446 /// only be used when running global triggers.
447 ///
448 /// # Long running operations
449 ///
450 /// This method is used to start, and/or poll a [long-running Operation].
451 /// The [Working with long-running operations] chapter in the [user guide]
452 /// covers these operations in detail.
453 ///
454 /// [long-running operation]: https://google.aip.dev/151
455 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
456 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
457 ///
458 /// # Example
459 /// ```
460 /// # use google_cloud_build_v1::client::CloudBuild;
461 /// use google_cloud_lro::Poller;
462 /// use google_cloud_build_v1::Result;
463 /// async fn sample(
464 /// client: &CloudBuild
465 /// ) -> Result<()> {
466 /// let response = client.run_build_trigger()
467 /// /* set fields */
468 /// .poller().until_done().await?;
469 /// println!("response {:?}", response);
470 /// Ok(())
471 /// }
472 /// ```
473 pub fn run_build_trigger(&self) -> super::builder::cloud_build::RunBuildTrigger {
474 super::builder::cloud_build::RunBuildTrigger::new(self.inner.clone())
475 }
476
477 /// ReceiveTriggerWebhook [Experimental] is called when the API receives a
478 /// webhook request targeted at a specific trigger.
479 ///
480 /// # Example
481 /// ```
482 /// # use google_cloud_build_v1::client::CloudBuild;
483 /// use google_cloud_build_v1::Result;
484 /// async fn sample(
485 /// client: &CloudBuild
486 /// ) -> Result<()> {
487 /// let response = client.receive_trigger_webhook()
488 /// /* set fields */
489 /// .send().await?;
490 /// println!("response {:?}", response);
491 /// Ok(())
492 /// }
493 /// ```
494 pub fn receive_trigger_webhook(&self) -> super::builder::cloud_build::ReceiveTriggerWebhook {
495 super::builder::cloud_build::ReceiveTriggerWebhook::new(self.inner.clone())
496 }
497
498 /// Creates a `WorkerPool`.
499 ///
500 /// # Long running operations
501 ///
502 /// This method is used to start, and/or poll a [long-running Operation].
503 /// The [Working with long-running operations] chapter in the [user guide]
504 /// covers these operations in detail.
505 ///
506 /// [long-running operation]: https://google.aip.dev/151
507 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
508 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
509 ///
510 /// # Example
511 /// ```
512 /// # use google_cloud_build_v1::client::CloudBuild;
513 /// use google_cloud_lro::Poller;
514 /// use google_cloud_build_v1::model::WorkerPool;
515 /// use google_cloud_build_v1::Result;
516 /// async fn sample(
517 /// client: &CloudBuild, parent: &str
518 /// ) -> Result<()> {
519 /// let response = client.create_worker_pool()
520 /// .set_parent(parent)
521 /// .set_worker_pool(
522 /// WorkerPool::new()/* set fields */
523 /// )
524 /// .poller().until_done().await?;
525 /// println!("response {:?}", response);
526 /// Ok(())
527 /// }
528 /// ```
529 pub fn create_worker_pool(&self) -> super::builder::cloud_build::CreateWorkerPool {
530 super::builder::cloud_build::CreateWorkerPool::new(self.inner.clone())
531 }
532
533 /// Returns details of a `WorkerPool`.
534 ///
535 /// # Example
536 /// ```
537 /// # use google_cloud_build_v1::client::CloudBuild;
538 /// use google_cloud_build_v1::Result;
539 /// async fn sample(
540 /// client: &CloudBuild, project_id: &str, location_id: &str, worker_pool_id: &str
541 /// ) -> Result<()> {
542 /// let response = client.get_worker_pool()
543 /// .set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"))
544 /// .send().await?;
545 /// println!("response {:?}", response);
546 /// Ok(())
547 /// }
548 /// ```
549 pub fn get_worker_pool(&self) -> super::builder::cloud_build::GetWorkerPool {
550 super::builder::cloud_build::GetWorkerPool::new(self.inner.clone())
551 }
552
553 /// Deletes a `WorkerPool`.
554 ///
555 /// # Long running operations
556 ///
557 /// This method is used to start, and/or poll a [long-running Operation].
558 /// The [Working with long-running operations] chapter in the [user guide]
559 /// covers these operations in detail.
560 ///
561 /// [long-running operation]: https://google.aip.dev/151
562 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
563 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
564 ///
565 /// # Example
566 /// ```
567 /// # use google_cloud_build_v1::client::CloudBuild;
568 /// use google_cloud_lro::Poller;
569 /// use google_cloud_build_v1::Result;
570 /// async fn sample(
571 /// client: &CloudBuild, project_id: &str, location_id: &str, worker_pool_id: &str
572 /// ) -> Result<()> {
573 /// client.delete_worker_pool()
574 /// .set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"))
575 /// .poller().until_done().await?;
576 /// Ok(())
577 /// }
578 /// ```
579 pub fn delete_worker_pool(&self) -> super::builder::cloud_build::DeleteWorkerPool {
580 super::builder::cloud_build::DeleteWorkerPool::new(self.inner.clone())
581 }
582
583 /// Updates a `WorkerPool`.
584 ///
585 /// # Long running operations
586 ///
587 /// This method is used to start, and/or poll a [long-running Operation].
588 /// The [Working with long-running operations] chapter in the [user guide]
589 /// covers these operations in detail.
590 ///
591 /// [long-running operation]: https://google.aip.dev/151
592 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
593 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
594 ///
595 /// # Example
596 /// ```
597 /// # use google_cloud_build_v1::client::CloudBuild;
598 /// use google_cloud_lro::Poller;
599 /// # extern crate wkt as google_cloud_wkt;
600 /// use google_cloud_wkt::FieldMask;
601 /// use google_cloud_build_v1::model::WorkerPool;
602 /// use google_cloud_build_v1::Result;
603 /// async fn sample(
604 /// client: &CloudBuild, project_id: &str, location_id: &str, worker_pool_id: &str
605 /// ) -> Result<()> {
606 /// let response = client.update_worker_pool()
607 /// .set_worker_pool(
608 /// WorkerPool::new().set_name(format!("projects/{project_id}/locations/{location_id}/workerPools/{worker_pool_id}"))/* set fields */
609 /// )
610 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
611 /// .poller().until_done().await?;
612 /// println!("response {:?}", response);
613 /// Ok(())
614 /// }
615 /// ```
616 pub fn update_worker_pool(&self) -> super::builder::cloud_build::UpdateWorkerPool {
617 super::builder::cloud_build::UpdateWorkerPool::new(self.inner.clone())
618 }
619
620 /// Lists `WorkerPool`s.
621 ///
622 /// # Example
623 /// ```
624 /// # use google_cloud_build_v1::client::CloudBuild;
625 /// use google_cloud_gax::paginator::ItemPaginator as _;
626 /// use google_cloud_build_v1::Result;
627 /// async fn sample(
628 /// client: &CloudBuild, parent: &str
629 /// ) -> Result<()> {
630 /// let mut list = client.list_worker_pools()
631 /// .set_parent(parent)
632 /// .by_item();
633 /// while let Some(item) = list.next().await.transpose()? {
634 /// println!("{:?}", item);
635 /// }
636 /// Ok(())
637 /// }
638 /// ```
639 pub fn list_worker_pools(&self) -> super::builder::cloud_build::ListWorkerPools {
640 super::builder::cloud_build::ListWorkerPools::new(self.inner.clone())
641 }
642
643 /// Returns the `DefaultServiceAccount` used by the project.
644 ///
645 /// # Example
646 /// ```
647 /// # use google_cloud_build_v1::client::CloudBuild;
648 /// use google_cloud_build_v1::Result;
649 /// async fn sample(
650 /// client: &CloudBuild, project_id: &str, location_id: &str
651 /// ) -> Result<()> {
652 /// let response = client.get_default_service_account()
653 /// .set_name(format!("projects/{project_id}/locations/{location_id}/defaultServiceAccount"))
654 /// .send().await?;
655 /// println!("response {:?}", response);
656 /// Ok(())
657 /// }
658 /// ```
659 pub fn get_default_service_account(
660 &self,
661 ) -> super::builder::cloud_build::GetDefaultServiceAccount {
662 super::builder::cloud_build::GetDefaultServiceAccount::new(self.inner.clone())
663 }
664
665 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
666 ///
667 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
668 ///
669 /// # Example
670 /// ```
671 /// # use google_cloud_build_v1::client::CloudBuild;
672 /// use google_cloud_build_v1::Result;
673 /// async fn sample(
674 /// client: &CloudBuild
675 /// ) -> Result<()> {
676 /// let response = client.get_operation()
677 /// /* set fields */
678 /// .send().await?;
679 /// println!("response {:?}", response);
680 /// Ok(())
681 /// }
682 /// ```
683 pub fn get_operation(&self) -> super::builder::cloud_build::GetOperation {
684 super::builder::cloud_build::GetOperation::new(self.inner.clone())
685 }
686
687 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
688 ///
689 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
690 ///
691 /// # Example
692 /// ```
693 /// # use google_cloud_build_v1::client::CloudBuild;
694 /// use google_cloud_build_v1::Result;
695 /// async fn sample(
696 /// client: &CloudBuild
697 /// ) -> Result<()> {
698 /// client.cancel_operation()
699 /// /* set fields */
700 /// .send().await?;
701 /// Ok(())
702 /// }
703 /// ```
704 pub fn cancel_operation(&self) -> super::builder::cloud_build::CancelOperation {
705 super::builder::cloud_build::CancelOperation::new(self.inner.clone())
706 }
707}