Skip to main content

google_cloud_build_v1/
builder.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
17/// Request and client builders for [CloudBuild][crate::client::CloudBuild].
18pub mod cloud_build {
19    use crate::Result;
20
21    /// A builder for [CloudBuild][crate::client::CloudBuild].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_build_v1::*;
26    /// # use builder::cloud_build::ClientBuilder;
27    /// # use client::CloudBuild;
28    /// let builder : ClientBuilder = CloudBuild::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://cloudbuild.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::CloudBuild;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = CloudBuild;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::CloudBuild] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
55        request: R,
56        options: crate::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [CloudBuild::create_build][crate::client::CloudBuild::create_build] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_build_v1::builder::cloud_build::CreateBuild;
79    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
80    /// use google_cloud_lro::Poller;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let response = builder.poller().until_done().await?;
84    /// # Ok(()) }
85    ///
86    /// fn prepare_request_builder() -> CreateBuild {
87    ///   # panic!();
88    ///   // ... details omitted ...
89    /// }
90    /// ```
91    #[derive(Clone, Debug)]
92    pub struct CreateBuild(RequestBuilder<crate::model::CreateBuildRequest>);
93
94    impl CreateBuild {
95        pub(crate) fn new(
96            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
97        ) -> Self {
98            Self(RequestBuilder::new(stub))
99        }
100
101        /// Sets the full request, replacing any prior values.
102        pub fn with_request<V: Into<crate::model::CreateBuildRequest>>(mut self, v: V) -> Self {
103            self.0.request = v.into();
104            self
105        }
106
107        /// Sets all the options, replacing any prior values.
108        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
109            self.0.options = v.into();
110            self
111        }
112
113        /// Sends the request.
114        ///
115        /// # Long running operations
116        ///
117        /// This starts, but does not poll, a longrunning operation. More information
118        /// on [create_build][crate::client::CloudBuild::create_build].
119        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
120            (*self.0.stub)
121                .create_build(self.0.request, self.0.options)
122                .await
123                .map(crate::Response::into_body)
124        }
125
126        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_build`.
127        pub fn poller(
128            self,
129        ) -> impl google_cloud_lro::Poller<crate::model::Build, crate::model::BuildOperationMetadata>
130        {
131            type Operation = google_cloud_lro::internal::Operation<
132                crate::model::Build,
133                crate::model::BuildOperationMetadata,
134            >;
135            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
136            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
137            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
138            if let Some(ref mut details) = poller_options.tracing {
139                details.method_name =
140                    "google_cloud_build_v1::client::CloudBuild::create_build::until_done";
141            }
142
143            let stub = self.0.stub.clone();
144            let mut options = self.0.options.clone();
145            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
146            let query = move |name| {
147                let stub = stub.clone();
148                let options = options.clone();
149                async {
150                    let op = GetOperation::new(stub)
151                        .set_name(name)
152                        .with_options(options)
153                        .send()
154                        .await?;
155                    Ok(Operation::new(op))
156                }
157            };
158
159            let start = move || async {
160                let op = self.send().await?;
161                Ok(Operation::new(op))
162            };
163
164            use google_cloud_lro::internal::PollerExt;
165            {
166                google_cloud_lro::internal::new_poller(
167                    polling_error_policy,
168                    polling_backoff_policy,
169                    start,
170                    query,
171                )
172            }
173            .with_options(poller_options)
174        }
175
176        /// Sets the value of [parent][crate::model::CreateBuildRequest::parent].
177        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
178            self.0.request.parent = v.into();
179            self
180        }
181
182        /// Sets the value of [project_id][crate::model::CreateBuildRequest::project_id].
183        ///
184        /// This is a **required** field for requests.
185        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
186            self.0.request.project_id = v.into();
187            self
188        }
189
190        /// Sets the value of [build][crate::model::CreateBuildRequest::build].
191        ///
192        /// This is a **required** field for requests.
193        pub fn set_build<T>(mut self, v: T) -> Self
194        where
195            T: std::convert::Into<crate::model::Build>,
196        {
197            self.0.request.build = std::option::Option::Some(v.into());
198            self
199        }
200
201        /// Sets or clears the value of [build][crate::model::CreateBuildRequest::build].
202        ///
203        /// This is a **required** field for requests.
204        pub fn set_or_clear_build<T>(mut self, v: std::option::Option<T>) -> Self
205        where
206            T: std::convert::Into<crate::model::Build>,
207        {
208            self.0.request.build = v.map(|x| x.into());
209            self
210        }
211    }
212
213    #[doc(hidden)]
214    impl crate::RequestBuilder for CreateBuild {
215        fn request_options(&mut self) -> &mut crate::RequestOptions {
216            &mut self.0.options
217        }
218    }
219
220    /// The request builder for [CloudBuild::get_build][crate::client::CloudBuild::get_build] calls.
221    ///
222    /// # Example
223    /// ```
224    /// # use google_cloud_build_v1::builder::cloud_build::GetBuild;
225    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
226    ///
227    /// let builder = prepare_request_builder();
228    /// let response = builder.send().await?;
229    /// # Ok(()) }
230    ///
231    /// fn prepare_request_builder() -> GetBuild {
232    ///   # panic!();
233    ///   // ... details omitted ...
234    /// }
235    /// ```
236    #[derive(Clone, Debug)]
237    pub struct GetBuild(RequestBuilder<crate::model::GetBuildRequest>);
238
239    impl GetBuild {
240        pub(crate) fn new(
241            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
242        ) -> Self {
243            Self(RequestBuilder::new(stub))
244        }
245
246        /// Sets the full request, replacing any prior values.
247        pub fn with_request<V: Into<crate::model::GetBuildRequest>>(mut self, v: V) -> Self {
248            self.0.request = v.into();
249            self
250        }
251
252        /// Sets all the options, replacing any prior values.
253        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
254            self.0.options = v.into();
255            self
256        }
257
258        /// Sends the request.
259        pub async fn send(self) -> Result<crate::model::Build> {
260            (*self.0.stub)
261                .get_build(self.0.request, self.0.options)
262                .await
263                .map(crate::Response::into_body)
264        }
265
266        /// Sets the value of [name][crate::model::GetBuildRequest::name].
267        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
268            self.0.request.name = v.into();
269            self
270        }
271
272        /// Sets the value of [project_id][crate::model::GetBuildRequest::project_id].
273        ///
274        /// This is a **required** field for requests.
275        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
276            self.0.request.project_id = v.into();
277            self
278        }
279
280        /// Sets the value of [id][crate::model::GetBuildRequest::id].
281        ///
282        /// This is a **required** field for requests.
283        pub fn set_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
284            self.0.request.id = v.into();
285            self
286        }
287    }
288
289    #[doc(hidden)]
290    impl crate::RequestBuilder for GetBuild {
291        fn request_options(&mut self) -> &mut crate::RequestOptions {
292            &mut self.0.options
293        }
294    }
295
296    /// The request builder for [CloudBuild::list_builds][crate::client::CloudBuild::list_builds] calls.
297    ///
298    /// # Example
299    /// ```
300    /// # use google_cloud_build_v1::builder::cloud_build::ListBuilds;
301    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
302    /// use google_cloud_gax::paginator::ItemPaginator;
303    ///
304    /// let builder = prepare_request_builder();
305    /// let mut items = builder.by_item();
306    /// while let Some(result) = items.next().await {
307    ///   let item = result?;
308    /// }
309    /// # Ok(()) }
310    ///
311    /// fn prepare_request_builder() -> ListBuilds {
312    ///   # panic!();
313    ///   // ... details omitted ...
314    /// }
315    /// ```
316    #[derive(Clone, Debug)]
317    pub struct ListBuilds(RequestBuilder<crate::model::ListBuildsRequest>);
318
319    impl ListBuilds {
320        pub(crate) fn new(
321            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
322        ) -> Self {
323            Self(RequestBuilder::new(stub))
324        }
325
326        /// Sets the full request, replacing any prior values.
327        pub fn with_request<V: Into<crate::model::ListBuildsRequest>>(mut self, v: V) -> Self {
328            self.0.request = v.into();
329            self
330        }
331
332        /// Sets all the options, replacing any prior values.
333        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
334            self.0.options = v.into();
335            self
336        }
337
338        /// Sends the request.
339        pub async fn send(self) -> Result<crate::model::ListBuildsResponse> {
340            (*self.0.stub)
341                .list_builds(self.0.request, self.0.options)
342                .await
343                .map(crate::Response::into_body)
344        }
345
346        /// Streams each page in the collection.
347        pub fn by_page(
348            self,
349        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListBuildsResponse, crate::Error>
350        {
351            use std::clone::Clone;
352            let token = self.0.request.page_token.clone();
353            let execute = move |token: String| {
354                let mut builder = self.clone();
355                builder.0.request = builder.0.request.set_page_token(token);
356                builder.send()
357            };
358            google_cloud_gax::paginator::internal::new_paginator(token, execute)
359        }
360
361        /// Streams each item in the collection.
362        pub fn by_item(
363            self,
364        ) -> impl google_cloud_gax::paginator::ItemPaginator<
365            crate::model::ListBuildsResponse,
366            crate::Error,
367        > {
368            use google_cloud_gax::paginator::Paginator;
369            self.by_page().items()
370        }
371
372        /// Sets the value of [parent][crate::model::ListBuildsRequest::parent].
373        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
374            self.0.request.parent = v.into();
375            self
376        }
377
378        /// Sets the value of [project_id][crate::model::ListBuildsRequest::project_id].
379        ///
380        /// This is a **required** field for requests.
381        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
382            self.0.request.project_id = v.into();
383            self
384        }
385
386        /// Sets the value of [page_size][crate::model::ListBuildsRequest::page_size].
387        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
388            self.0.request.page_size = v.into();
389            self
390        }
391
392        /// Sets the value of [page_token][crate::model::ListBuildsRequest::page_token].
393        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
394            self.0.request.page_token = v.into();
395            self
396        }
397
398        /// Sets the value of [filter][crate::model::ListBuildsRequest::filter].
399        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
400            self.0.request.filter = v.into();
401            self
402        }
403    }
404
405    #[doc(hidden)]
406    impl crate::RequestBuilder for ListBuilds {
407        fn request_options(&mut self) -> &mut crate::RequestOptions {
408            &mut self.0.options
409        }
410    }
411
412    /// The request builder for [CloudBuild::cancel_build][crate::client::CloudBuild::cancel_build] calls.
413    ///
414    /// # Example
415    /// ```
416    /// # use google_cloud_build_v1::builder::cloud_build::CancelBuild;
417    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
418    ///
419    /// let builder = prepare_request_builder();
420    /// let response = builder.send().await?;
421    /// # Ok(()) }
422    ///
423    /// fn prepare_request_builder() -> CancelBuild {
424    ///   # panic!();
425    ///   // ... details omitted ...
426    /// }
427    /// ```
428    #[derive(Clone, Debug)]
429    pub struct CancelBuild(RequestBuilder<crate::model::CancelBuildRequest>);
430
431    impl CancelBuild {
432        pub(crate) fn new(
433            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
434        ) -> Self {
435            Self(RequestBuilder::new(stub))
436        }
437
438        /// Sets the full request, replacing any prior values.
439        pub fn with_request<V: Into<crate::model::CancelBuildRequest>>(mut self, v: V) -> Self {
440            self.0.request = v.into();
441            self
442        }
443
444        /// Sets all the options, replacing any prior values.
445        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
446            self.0.options = v.into();
447            self
448        }
449
450        /// Sends the request.
451        pub async fn send(self) -> Result<crate::model::Build> {
452            (*self.0.stub)
453                .cancel_build(self.0.request, self.0.options)
454                .await
455                .map(crate::Response::into_body)
456        }
457
458        /// Sets the value of [name][crate::model::CancelBuildRequest::name].
459        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
460            self.0.request.name = v.into();
461            self
462        }
463
464        /// Sets the value of [project_id][crate::model::CancelBuildRequest::project_id].
465        ///
466        /// This is a **required** field for requests.
467        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
468            self.0.request.project_id = v.into();
469            self
470        }
471
472        /// Sets the value of [id][crate::model::CancelBuildRequest::id].
473        ///
474        /// This is a **required** field for requests.
475        pub fn set_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
476            self.0.request.id = v.into();
477            self
478        }
479    }
480
481    #[doc(hidden)]
482    impl crate::RequestBuilder for CancelBuild {
483        fn request_options(&mut self) -> &mut crate::RequestOptions {
484            &mut self.0.options
485        }
486    }
487
488    /// The request builder for [CloudBuild::retry_build][crate::client::CloudBuild::retry_build] calls.
489    ///
490    /// # Example
491    /// ```
492    /// # use google_cloud_build_v1::builder::cloud_build::RetryBuild;
493    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
494    /// use google_cloud_lro::Poller;
495    ///
496    /// let builder = prepare_request_builder();
497    /// let response = builder.poller().until_done().await?;
498    /// # Ok(()) }
499    ///
500    /// fn prepare_request_builder() -> RetryBuild {
501    ///   # panic!();
502    ///   // ... details omitted ...
503    /// }
504    /// ```
505    #[derive(Clone, Debug)]
506    pub struct RetryBuild(RequestBuilder<crate::model::RetryBuildRequest>);
507
508    impl RetryBuild {
509        pub(crate) fn new(
510            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
511        ) -> Self {
512            Self(RequestBuilder::new(stub))
513        }
514
515        /// Sets the full request, replacing any prior values.
516        pub fn with_request<V: Into<crate::model::RetryBuildRequest>>(mut self, v: V) -> Self {
517            self.0.request = v.into();
518            self
519        }
520
521        /// Sets all the options, replacing any prior values.
522        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
523            self.0.options = v.into();
524            self
525        }
526
527        /// Sends the request.
528        ///
529        /// # Long running operations
530        ///
531        /// This starts, but does not poll, a longrunning operation. More information
532        /// on [retry_build][crate::client::CloudBuild::retry_build].
533        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
534            (*self.0.stub)
535                .retry_build(self.0.request, self.0.options)
536                .await
537                .map(crate::Response::into_body)
538        }
539
540        /// Creates a [Poller][google_cloud_lro::Poller] to work with `retry_build`.
541        pub fn poller(
542            self,
543        ) -> impl google_cloud_lro::Poller<crate::model::Build, crate::model::BuildOperationMetadata>
544        {
545            type Operation = google_cloud_lro::internal::Operation<
546                crate::model::Build,
547                crate::model::BuildOperationMetadata,
548            >;
549            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
550            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
551            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
552            if let Some(ref mut details) = poller_options.tracing {
553                details.method_name =
554                    "google_cloud_build_v1::client::CloudBuild::retry_build::until_done";
555            }
556
557            let stub = self.0.stub.clone();
558            let mut options = self.0.options.clone();
559            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
560            let query = move |name| {
561                let stub = stub.clone();
562                let options = options.clone();
563                async {
564                    let op = GetOperation::new(stub)
565                        .set_name(name)
566                        .with_options(options)
567                        .send()
568                        .await?;
569                    Ok(Operation::new(op))
570                }
571            };
572
573            let start = move || async {
574                let op = self.send().await?;
575                Ok(Operation::new(op))
576            };
577
578            use google_cloud_lro::internal::PollerExt;
579            {
580                google_cloud_lro::internal::new_poller(
581                    polling_error_policy,
582                    polling_backoff_policy,
583                    start,
584                    query,
585                )
586            }
587            .with_options(poller_options)
588        }
589
590        /// Sets the value of [name][crate::model::RetryBuildRequest::name].
591        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
592            self.0.request.name = v.into();
593            self
594        }
595
596        /// Sets the value of [project_id][crate::model::RetryBuildRequest::project_id].
597        ///
598        /// This is a **required** field for requests.
599        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
600            self.0.request.project_id = v.into();
601            self
602        }
603
604        /// Sets the value of [id][crate::model::RetryBuildRequest::id].
605        ///
606        /// This is a **required** field for requests.
607        pub fn set_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
608            self.0.request.id = v.into();
609            self
610        }
611    }
612
613    #[doc(hidden)]
614    impl crate::RequestBuilder for RetryBuild {
615        fn request_options(&mut self) -> &mut crate::RequestOptions {
616            &mut self.0.options
617        }
618    }
619
620    /// The request builder for [CloudBuild::approve_build][crate::client::CloudBuild::approve_build] calls.
621    ///
622    /// # Example
623    /// ```
624    /// # use google_cloud_build_v1::builder::cloud_build::ApproveBuild;
625    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
626    /// use google_cloud_lro::Poller;
627    ///
628    /// let builder = prepare_request_builder();
629    /// let response = builder.poller().until_done().await?;
630    /// # Ok(()) }
631    ///
632    /// fn prepare_request_builder() -> ApproveBuild {
633    ///   # panic!();
634    ///   // ... details omitted ...
635    /// }
636    /// ```
637    #[derive(Clone, Debug)]
638    pub struct ApproveBuild(RequestBuilder<crate::model::ApproveBuildRequest>);
639
640    impl ApproveBuild {
641        pub(crate) fn new(
642            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
643        ) -> Self {
644            Self(RequestBuilder::new(stub))
645        }
646
647        /// Sets the full request, replacing any prior values.
648        pub fn with_request<V: Into<crate::model::ApproveBuildRequest>>(mut self, v: V) -> Self {
649            self.0.request = v.into();
650            self
651        }
652
653        /// Sets all the options, replacing any prior values.
654        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
655            self.0.options = v.into();
656            self
657        }
658
659        /// Sends the request.
660        ///
661        /// # Long running operations
662        ///
663        /// This starts, but does not poll, a longrunning operation. More information
664        /// on [approve_build][crate::client::CloudBuild::approve_build].
665        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
666            (*self.0.stub)
667                .approve_build(self.0.request, self.0.options)
668                .await
669                .map(crate::Response::into_body)
670        }
671
672        /// Creates a [Poller][google_cloud_lro::Poller] to work with `approve_build`.
673        pub fn poller(
674            self,
675        ) -> impl google_cloud_lro::Poller<crate::model::Build, crate::model::BuildOperationMetadata>
676        {
677            type Operation = google_cloud_lro::internal::Operation<
678                crate::model::Build,
679                crate::model::BuildOperationMetadata,
680            >;
681            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
682            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
683            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
684            if let Some(ref mut details) = poller_options.tracing {
685                details.method_name =
686                    "google_cloud_build_v1::client::CloudBuild::approve_build::until_done";
687            }
688
689            let stub = self.0.stub.clone();
690            let mut options = self.0.options.clone();
691            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
692            let query = move |name| {
693                let stub = stub.clone();
694                let options = options.clone();
695                async {
696                    let op = GetOperation::new(stub)
697                        .set_name(name)
698                        .with_options(options)
699                        .send()
700                        .await?;
701                    Ok(Operation::new(op))
702                }
703            };
704
705            let start = move || async {
706                let op = self.send().await?;
707                Ok(Operation::new(op))
708            };
709
710            use google_cloud_lro::internal::PollerExt;
711            {
712                google_cloud_lro::internal::new_poller(
713                    polling_error_policy,
714                    polling_backoff_policy,
715                    start,
716                    query,
717                )
718            }
719            .with_options(poller_options)
720        }
721
722        /// Sets the value of [name][crate::model::ApproveBuildRequest::name].
723        ///
724        /// This is a **required** field for requests.
725        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
726            self.0.request.name = v.into();
727            self
728        }
729
730        /// Sets the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
731        pub fn set_approval_result<T>(mut self, v: T) -> Self
732        where
733            T: std::convert::Into<crate::model::ApprovalResult>,
734        {
735            self.0.request.approval_result = std::option::Option::Some(v.into());
736            self
737        }
738
739        /// Sets or clears the value of [approval_result][crate::model::ApproveBuildRequest::approval_result].
740        pub fn set_or_clear_approval_result<T>(mut self, v: std::option::Option<T>) -> Self
741        where
742            T: std::convert::Into<crate::model::ApprovalResult>,
743        {
744            self.0.request.approval_result = v.map(|x| x.into());
745            self
746        }
747    }
748
749    #[doc(hidden)]
750    impl crate::RequestBuilder for ApproveBuild {
751        fn request_options(&mut self) -> &mut crate::RequestOptions {
752            &mut self.0.options
753        }
754    }
755
756    /// The request builder for [CloudBuild::create_build_trigger][crate::client::CloudBuild::create_build_trigger] calls.
757    ///
758    /// # Example
759    /// ```
760    /// # use google_cloud_build_v1::builder::cloud_build::CreateBuildTrigger;
761    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
762    ///
763    /// let builder = prepare_request_builder();
764    /// let response = builder.send().await?;
765    /// # Ok(()) }
766    ///
767    /// fn prepare_request_builder() -> CreateBuildTrigger {
768    ///   # panic!();
769    ///   // ... details omitted ...
770    /// }
771    /// ```
772    #[derive(Clone, Debug)]
773    pub struct CreateBuildTrigger(RequestBuilder<crate::model::CreateBuildTriggerRequest>);
774
775    impl CreateBuildTrigger {
776        pub(crate) fn new(
777            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
778        ) -> Self {
779            Self(RequestBuilder::new(stub))
780        }
781
782        /// Sets the full request, replacing any prior values.
783        pub fn with_request<V: Into<crate::model::CreateBuildTriggerRequest>>(
784            mut self,
785            v: V,
786        ) -> Self {
787            self.0.request = v.into();
788            self
789        }
790
791        /// Sets all the options, replacing any prior values.
792        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
793            self.0.options = v.into();
794            self
795        }
796
797        /// Sends the request.
798        pub async fn send(self) -> Result<crate::model::BuildTrigger> {
799            (*self.0.stub)
800                .create_build_trigger(self.0.request, self.0.options)
801                .await
802                .map(crate::Response::into_body)
803        }
804
805        /// Sets the value of [parent][crate::model::CreateBuildTriggerRequest::parent].
806        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
807            self.0.request.parent = v.into();
808            self
809        }
810
811        /// Sets the value of [project_id][crate::model::CreateBuildTriggerRequest::project_id].
812        ///
813        /// This is a **required** field for requests.
814        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
815            self.0.request.project_id = v.into();
816            self
817        }
818
819        /// Sets the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
820        ///
821        /// This is a **required** field for requests.
822        pub fn set_trigger<T>(mut self, v: T) -> Self
823        where
824            T: std::convert::Into<crate::model::BuildTrigger>,
825        {
826            self.0.request.trigger = std::option::Option::Some(v.into());
827            self
828        }
829
830        /// Sets or clears the value of [trigger][crate::model::CreateBuildTriggerRequest::trigger].
831        ///
832        /// This is a **required** field for requests.
833        pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
834        where
835            T: std::convert::Into<crate::model::BuildTrigger>,
836        {
837            self.0.request.trigger = v.map(|x| x.into());
838            self
839        }
840    }
841
842    #[doc(hidden)]
843    impl crate::RequestBuilder for CreateBuildTrigger {
844        fn request_options(&mut self) -> &mut crate::RequestOptions {
845            &mut self.0.options
846        }
847    }
848
849    /// The request builder for [CloudBuild::get_build_trigger][crate::client::CloudBuild::get_build_trigger] calls.
850    ///
851    /// # Example
852    /// ```
853    /// # use google_cloud_build_v1::builder::cloud_build::GetBuildTrigger;
854    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
855    ///
856    /// let builder = prepare_request_builder();
857    /// let response = builder.send().await?;
858    /// # Ok(()) }
859    ///
860    /// fn prepare_request_builder() -> GetBuildTrigger {
861    ///   # panic!();
862    ///   // ... details omitted ...
863    /// }
864    /// ```
865    #[derive(Clone, Debug)]
866    pub struct GetBuildTrigger(RequestBuilder<crate::model::GetBuildTriggerRequest>);
867
868    impl GetBuildTrigger {
869        pub(crate) fn new(
870            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
871        ) -> Self {
872            Self(RequestBuilder::new(stub))
873        }
874
875        /// Sets the full request, replacing any prior values.
876        pub fn with_request<V: Into<crate::model::GetBuildTriggerRequest>>(mut self, v: V) -> Self {
877            self.0.request = v.into();
878            self
879        }
880
881        /// Sets all the options, replacing any prior values.
882        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
883            self.0.options = v.into();
884            self
885        }
886
887        /// Sends the request.
888        pub async fn send(self) -> Result<crate::model::BuildTrigger> {
889            (*self.0.stub)
890                .get_build_trigger(self.0.request, self.0.options)
891                .await
892                .map(crate::Response::into_body)
893        }
894
895        /// Sets the value of [name][crate::model::GetBuildTriggerRequest::name].
896        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
897            self.0.request.name = v.into();
898            self
899        }
900
901        /// Sets the value of [project_id][crate::model::GetBuildTriggerRequest::project_id].
902        ///
903        /// This is a **required** field for requests.
904        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
905            self.0.request.project_id = v.into();
906            self
907        }
908
909        /// Sets the value of [trigger_id][crate::model::GetBuildTriggerRequest::trigger_id].
910        ///
911        /// This is a **required** field for requests.
912        pub fn set_trigger_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
913            self.0.request.trigger_id = v.into();
914            self
915        }
916    }
917
918    #[doc(hidden)]
919    impl crate::RequestBuilder for GetBuildTrigger {
920        fn request_options(&mut self) -> &mut crate::RequestOptions {
921            &mut self.0.options
922        }
923    }
924
925    /// The request builder for [CloudBuild::list_build_triggers][crate::client::CloudBuild::list_build_triggers] calls.
926    ///
927    /// # Example
928    /// ```
929    /// # use google_cloud_build_v1::builder::cloud_build::ListBuildTriggers;
930    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
931    /// use google_cloud_gax::paginator::ItemPaginator;
932    ///
933    /// let builder = prepare_request_builder();
934    /// let mut items = builder.by_item();
935    /// while let Some(result) = items.next().await {
936    ///   let item = result?;
937    /// }
938    /// # Ok(()) }
939    ///
940    /// fn prepare_request_builder() -> ListBuildTriggers {
941    ///   # panic!();
942    ///   // ... details omitted ...
943    /// }
944    /// ```
945    #[derive(Clone, Debug)]
946    pub struct ListBuildTriggers(RequestBuilder<crate::model::ListBuildTriggersRequest>);
947
948    impl ListBuildTriggers {
949        pub(crate) fn new(
950            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
951        ) -> Self {
952            Self(RequestBuilder::new(stub))
953        }
954
955        /// Sets the full request, replacing any prior values.
956        pub fn with_request<V: Into<crate::model::ListBuildTriggersRequest>>(
957            mut self,
958            v: V,
959        ) -> Self {
960            self.0.request = v.into();
961            self
962        }
963
964        /// Sets all the options, replacing any prior values.
965        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
966            self.0.options = v.into();
967            self
968        }
969
970        /// Sends the request.
971        pub async fn send(self) -> Result<crate::model::ListBuildTriggersResponse> {
972            (*self.0.stub)
973                .list_build_triggers(self.0.request, self.0.options)
974                .await
975                .map(crate::Response::into_body)
976        }
977
978        /// Streams each page in the collection.
979        pub fn by_page(
980            self,
981        ) -> impl google_cloud_gax::paginator::Paginator<
982            crate::model::ListBuildTriggersResponse,
983            crate::Error,
984        > {
985            use std::clone::Clone;
986            let token = self.0.request.page_token.clone();
987            let execute = move |token: String| {
988                let mut builder = self.clone();
989                builder.0.request = builder.0.request.set_page_token(token);
990                builder.send()
991            };
992            google_cloud_gax::paginator::internal::new_paginator(token, execute)
993        }
994
995        /// Streams each item in the collection.
996        pub fn by_item(
997            self,
998        ) -> impl google_cloud_gax::paginator::ItemPaginator<
999            crate::model::ListBuildTriggersResponse,
1000            crate::Error,
1001        > {
1002            use google_cloud_gax::paginator::Paginator;
1003            self.by_page().items()
1004        }
1005
1006        /// Sets the value of [parent][crate::model::ListBuildTriggersRequest::parent].
1007        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1008            self.0.request.parent = v.into();
1009            self
1010        }
1011
1012        /// Sets the value of [project_id][crate::model::ListBuildTriggersRequest::project_id].
1013        ///
1014        /// This is a **required** field for requests.
1015        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1016            self.0.request.project_id = v.into();
1017            self
1018        }
1019
1020        /// Sets the value of [page_size][crate::model::ListBuildTriggersRequest::page_size].
1021        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1022            self.0.request.page_size = v.into();
1023            self
1024        }
1025
1026        /// Sets the value of [page_token][crate::model::ListBuildTriggersRequest::page_token].
1027        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1028            self.0.request.page_token = v.into();
1029            self
1030        }
1031    }
1032
1033    #[doc(hidden)]
1034    impl crate::RequestBuilder for ListBuildTriggers {
1035        fn request_options(&mut self) -> &mut crate::RequestOptions {
1036            &mut self.0.options
1037        }
1038    }
1039
1040    /// The request builder for [CloudBuild::delete_build_trigger][crate::client::CloudBuild::delete_build_trigger] calls.
1041    ///
1042    /// # Example
1043    /// ```
1044    /// # use google_cloud_build_v1::builder::cloud_build::DeleteBuildTrigger;
1045    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1046    ///
1047    /// let builder = prepare_request_builder();
1048    /// let response = builder.send().await?;
1049    /// # Ok(()) }
1050    ///
1051    /// fn prepare_request_builder() -> DeleteBuildTrigger {
1052    ///   # panic!();
1053    ///   // ... details omitted ...
1054    /// }
1055    /// ```
1056    #[derive(Clone, Debug)]
1057    pub struct DeleteBuildTrigger(RequestBuilder<crate::model::DeleteBuildTriggerRequest>);
1058
1059    impl DeleteBuildTrigger {
1060        pub(crate) fn new(
1061            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1062        ) -> Self {
1063            Self(RequestBuilder::new(stub))
1064        }
1065
1066        /// Sets the full request, replacing any prior values.
1067        pub fn with_request<V: Into<crate::model::DeleteBuildTriggerRequest>>(
1068            mut self,
1069            v: V,
1070        ) -> Self {
1071            self.0.request = v.into();
1072            self
1073        }
1074
1075        /// Sets all the options, replacing any prior values.
1076        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1077            self.0.options = v.into();
1078            self
1079        }
1080
1081        /// Sends the request.
1082        pub async fn send(self) -> Result<()> {
1083            (*self.0.stub)
1084                .delete_build_trigger(self.0.request, self.0.options)
1085                .await
1086                .map(crate::Response::into_body)
1087        }
1088
1089        /// Sets the value of [name][crate::model::DeleteBuildTriggerRequest::name].
1090        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1091            self.0.request.name = v.into();
1092            self
1093        }
1094
1095        /// Sets the value of [project_id][crate::model::DeleteBuildTriggerRequest::project_id].
1096        ///
1097        /// This is a **required** field for requests.
1098        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1099            self.0.request.project_id = v.into();
1100            self
1101        }
1102
1103        /// Sets the value of [trigger_id][crate::model::DeleteBuildTriggerRequest::trigger_id].
1104        ///
1105        /// This is a **required** field for requests.
1106        pub fn set_trigger_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1107            self.0.request.trigger_id = v.into();
1108            self
1109        }
1110    }
1111
1112    #[doc(hidden)]
1113    impl crate::RequestBuilder for DeleteBuildTrigger {
1114        fn request_options(&mut self) -> &mut crate::RequestOptions {
1115            &mut self.0.options
1116        }
1117    }
1118
1119    /// The request builder for [CloudBuild::update_build_trigger][crate::client::CloudBuild::update_build_trigger] calls.
1120    ///
1121    /// # Example
1122    /// ```
1123    /// # use google_cloud_build_v1::builder::cloud_build::UpdateBuildTrigger;
1124    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1125    ///
1126    /// let builder = prepare_request_builder();
1127    /// let response = builder.send().await?;
1128    /// # Ok(()) }
1129    ///
1130    /// fn prepare_request_builder() -> UpdateBuildTrigger {
1131    ///   # panic!();
1132    ///   // ... details omitted ...
1133    /// }
1134    /// ```
1135    #[derive(Clone, Debug)]
1136    pub struct UpdateBuildTrigger(RequestBuilder<crate::model::UpdateBuildTriggerRequest>);
1137
1138    impl UpdateBuildTrigger {
1139        pub(crate) fn new(
1140            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1141        ) -> Self {
1142            Self(RequestBuilder::new(stub))
1143        }
1144
1145        /// Sets the full request, replacing any prior values.
1146        pub fn with_request<V: Into<crate::model::UpdateBuildTriggerRequest>>(
1147            mut self,
1148            v: V,
1149        ) -> Self {
1150            self.0.request = v.into();
1151            self
1152        }
1153
1154        /// Sets all the options, replacing any prior values.
1155        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1156            self.0.options = v.into();
1157            self
1158        }
1159
1160        /// Sends the request.
1161        pub async fn send(self) -> Result<crate::model::BuildTrigger> {
1162            (*self.0.stub)
1163                .update_build_trigger(self.0.request, self.0.options)
1164                .await
1165                .map(crate::Response::into_body)
1166        }
1167
1168        /// Sets the value of [project_id][crate::model::UpdateBuildTriggerRequest::project_id].
1169        ///
1170        /// This is a **required** field for requests.
1171        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1172            self.0.request.project_id = v.into();
1173            self
1174        }
1175
1176        /// Sets the value of [trigger_id][crate::model::UpdateBuildTriggerRequest::trigger_id].
1177        ///
1178        /// This is a **required** field for requests.
1179        pub fn set_trigger_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1180            self.0.request.trigger_id = v.into();
1181            self
1182        }
1183
1184        /// Sets the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
1185        ///
1186        /// This is a **required** field for requests.
1187        pub fn set_trigger<T>(mut self, v: T) -> Self
1188        where
1189            T: std::convert::Into<crate::model::BuildTrigger>,
1190        {
1191            self.0.request.trigger = std::option::Option::Some(v.into());
1192            self
1193        }
1194
1195        /// Sets or clears the value of [trigger][crate::model::UpdateBuildTriggerRequest::trigger].
1196        ///
1197        /// This is a **required** field for requests.
1198        pub fn set_or_clear_trigger<T>(mut self, v: std::option::Option<T>) -> Self
1199        where
1200            T: std::convert::Into<crate::model::BuildTrigger>,
1201        {
1202            self.0.request.trigger = v.map(|x| x.into());
1203            self
1204        }
1205
1206        /// Sets the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
1207        pub fn set_update_mask<T>(mut self, v: T) -> Self
1208        where
1209            T: std::convert::Into<wkt::FieldMask>,
1210        {
1211            self.0.request.update_mask = std::option::Option::Some(v.into());
1212            self
1213        }
1214
1215        /// Sets or clears the value of [update_mask][crate::model::UpdateBuildTriggerRequest::update_mask].
1216        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1217        where
1218            T: std::convert::Into<wkt::FieldMask>,
1219        {
1220            self.0.request.update_mask = v.map(|x| x.into());
1221            self
1222        }
1223    }
1224
1225    #[doc(hidden)]
1226    impl crate::RequestBuilder for UpdateBuildTrigger {
1227        fn request_options(&mut self) -> &mut crate::RequestOptions {
1228            &mut self.0.options
1229        }
1230    }
1231
1232    /// The request builder for [CloudBuild::run_build_trigger][crate::client::CloudBuild::run_build_trigger] calls.
1233    ///
1234    /// # Example
1235    /// ```
1236    /// # use google_cloud_build_v1::builder::cloud_build::RunBuildTrigger;
1237    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1238    /// use google_cloud_lro::Poller;
1239    ///
1240    /// let builder = prepare_request_builder();
1241    /// let response = builder.poller().until_done().await?;
1242    /// # Ok(()) }
1243    ///
1244    /// fn prepare_request_builder() -> RunBuildTrigger {
1245    ///   # panic!();
1246    ///   // ... details omitted ...
1247    /// }
1248    /// ```
1249    #[derive(Clone, Debug)]
1250    pub struct RunBuildTrigger(RequestBuilder<crate::model::RunBuildTriggerRequest>);
1251
1252    impl RunBuildTrigger {
1253        pub(crate) fn new(
1254            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1255        ) -> Self {
1256            Self(RequestBuilder::new(stub))
1257        }
1258
1259        /// Sets the full request, replacing any prior values.
1260        pub fn with_request<V: Into<crate::model::RunBuildTriggerRequest>>(mut self, v: V) -> Self {
1261            self.0.request = v.into();
1262            self
1263        }
1264
1265        /// Sets all the options, replacing any prior values.
1266        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1267            self.0.options = v.into();
1268            self
1269        }
1270
1271        /// Sends the request.
1272        ///
1273        /// # Long running operations
1274        ///
1275        /// This starts, but does not poll, a longrunning operation. More information
1276        /// on [run_build_trigger][crate::client::CloudBuild::run_build_trigger].
1277        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1278            (*self.0.stub)
1279                .run_build_trigger(self.0.request, self.0.options)
1280                .await
1281                .map(crate::Response::into_body)
1282        }
1283
1284        /// Creates a [Poller][google_cloud_lro::Poller] to work with `run_build_trigger`.
1285        pub fn poller(
1286            self,
1287        ) -> impl google_cloud_lro::Poller<crate::model::Build, crate::model::BuildOperationMetadata>
1288        {
1289            type Operation = google_cloud_lro::internal::Operation<
1290                crate::model::Build,
1291                crate::model::BuildOperationMetadata,
1292            >;
1293            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1294            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1295            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1296            if let Some(ref mut details) = poller_options.tracing {
1297                details.method_name =
1298                    "google_cloud_build_v1::client::CloudBuild::run_build_trigger::until_done";
1299            }
1300
1301            let stub = self.0.stub.clone();
1302            let mut options = self.0.options.clone();
1303            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1304            let query = move |name| {
1305                let stub = stub.clone();
1306                let options = options.clone();
1307                async {
1308                    let op = GetOperation::new(stub)
1309                        .set_name(name)
1310                        .with_options(options)
1311                        .send()
1312                        .await?;
1313                    Ok(Operation::new(op))
1314                }
1315            };
1316
1317            let start = move || async {
1318                let op = self.send().await?;
1319                Ok(Operation::new(op))
1320            };
1321
1322            use google_cloud_lro::internal::PollerExt;
1323            {
1324                google_cloud_lro::internal::new_poller(
1325                    polling_error_policy,
1326                    polling_backoff_policy,
1327                    start,
1328                    query,
1329                )
1330            }
1331            .with_options(poller_options)
1332        }
1333
1334        /// Sets the value of [name][crate::model::RunBuildTriggerRequest::name].
1335        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1336            self.0.request.name = v.into();
1337            self
1338        }
1339
1340        /// Sets the value of [project_id][crate::model::RunBuildTriggerRequest::project_id].
1341        ///
1342        /// This is a **required** field for requests.
1343        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1344            self.0.request.project_id = v.into();
1345            self
1346        }
1347
1348        /// Sets the value of [trigger_id][crate::model::RunBuildTriggerRequest::trigger_id].
1349        ///
1350        /// This is a **required** field for requests.
1351        pub fn set_trigger_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1352            self.0.request.trigger_id = v.into();
1353            self
1354        }
1355
1356        /// Sets the value of [source][crate::model::RunBuildTriggerRequest::source].
1357        pub fn set_source<T>(mut self, v: T) -> Self
1358        where
1359            T: std::convert::Into<crate::model::RepoSource>,
1360        {
1361            self.0.request.source = std::option::Option::Some(v.into());
1362            self
1363        }
1364
1365        /// Sets or clears the value of [source][crate::model::RunBuildTriggerRequest::source].
1366        pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
1367        where
1368            T: std::convert::Into<crate::model::RepoSource>,
1369        {
1370            self.0.request.source = v.map(|x| x.into());
1371            self
1372        }
1373    }
1374
1375    #[doc(hidden)]
1376    impl crate::RequestBuilder for RunBuildTrigger {
1377        fn request_options(&mut self) -> &mut crate::RequestOptions {
1378            &mut self.0.options
1379        }
1380    }
1381
1382    /// The request builder for [CloudBuild::receive_trigger_webhook][crate::client::CloudBuild::receive_trigger_webhook] calls.
1383    ///
1384    /// # Example
1385    /// ```
1386    /// # use google_cloud_build_v1::builder::cloud_build::ReceiveTriggerWebhook;
1387    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1388    ///
1389    /// let builder = prepare_request_builder();
1390    /// let response = builder.send().await?;
1391    /// # Ok(()) }
1392    ///
1393    /// fn prepare_request_builder() -> ReceiveTriggerWebhook {
1394    ///   # panic!();
1395    ///   // ... details omitted ...
1396    /// }
1397    /// ```
1398    #[derive(Clone, Debug)]
1399    pub struct ReceiveTriggerWebhook(RequestBuilder<crate::model::ReceiveTriggerWebhookRequest>);
1400
1401    impl ReceiveTriggerWebhook {
1402        pub(crate) fn new(
1403            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1404        ) -> Self {
1405            Self(RequestBuilder::new(stub))
1406        }
1407
1408        /// Sets the full request, replacing any prior values.
1409        pub fn with_request<V: Into<crate::model::ReceiveTriggerWebhookRequest>>(
1410            mut self,
1411            v: V,
1412        ) -> Self {
1413            self.0.request = v.into();
1414            self
1415        }
1416
1417        /// Sets all the options, replacing any prior values.
1418        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1419            self.0.options = v.into();
1420            self
1421        }
1422
1423        /// Sends the request.
1424        pub async fn send(self) -> Result<crate::model::ReceiveTriggerWebhookResponse> {
1425            (*self.0.stub)
1426                .receive_trigger_webhook(self.0.request, self.0.options)
1427                .await
1428                .map(crate::Response::into_body)
1429        }
1430
1431        /// Sets the value of [name][crate::model::ReceiveTriggerWebhookRequest::name].
1432        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1433            self.0.request.name = v.into();
1434            self
1435        }
1436
1437        /// Sets the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
1438        pub fn set_body<T>(mut self, v: T) -> Self
1439        where
1440            T: std::convert::Into<google_cloud_api::model::HttpBody>,
1441        {
1442            self.0.request.body = std::option::Option::Some(v.into());
1443            self
1444        }
1445
1446        /// Sets or clears the value of [body][crate::model::ReceiveTriggerWebhookRequest::body].
1447        pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
1448        where
1449            T: std::convert::Into<google_cloud_api::model::HttpBody>,
1450        {
1451            self.0.request.body = v.map(|x| x.into());
1452            self
1453        }
1454
1455        /// Sets the value of [project_id][crate::model::ReceiveTriggerWebhookRequest::project_id].
1456        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1457            self.0.request.project_id = v.into();
1458            self
1459        }
1460
1461        /// Sets the value of [trigger][crate::model::ReceiveTriggerWebhookRequest::trigger].
1462        pub fn set_trigger<T: Into<std::string::String>>(mut self, v: T) -> Self {
1463            self.0.request.trigger = v.into();
1464            self
1465        }
1466
1467        /// Sets the value of [secret][crate::model::ReceiveTriggerWebhookRequest::secret].
1468        pub fn set_secret<T: Into<std::string::String>>(mut self, v: T) -> Self {
1469            self.0.request.secret = v.into();
1470            self
1471        }
1472    }
1473
1474    #[doc(hidden)]
1475    impl crate::RequestBuilder for ReceiveTriggerWebhook {
1476        fn request_options(&mut self) -> &mut crate::RequestOptions {
1477            &mut self.0.options
1478        }
1479    }
1480
1481    /// The request builder for [CloudBuild::create_worker_pool][crate::client::CloudBuild::create_worker_pool] calls.
1482    ///
1483    /// # Example
1484    /// ```
1485    /// # use google_cloud_build_v1::builder::cloud_build::CreateWorkerPool;
1486    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1487    /// use google_cloud_lro::Poller;
1488    ///
1489    /// let builder = prepare_request_builder();
1490    /// let response = builder.poller().until_done().await?;
1491    /// # Ok(()) }
1492    ///
1493    /// fn prepare_request_builder() -> CreateWorkerPool {
1494    ///   # panic!();
1495    ///   // ... details omitted ...
1496    /// }
1497    /// ```
1498    #[derive(Clone, Debug)]
1499    pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
1500
1501    impl CreateWorkerPool {
1502        pub(crate) fn new(
1503            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1504        ) -> Self {
1505            Self(RequestBuilder::new(stub))
1506        }
1507
1508        /// Sets the full request, replacing any prior values.
1509        pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
1510            mut self,
1511            v: V,
1512        ) -> Self {
1513            self.0.request = v.into();
1514            self
1515        }
1516
1517        /// Sets all the options, replacing any prior values.
1518        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1519            self.0.options = v.into();
1520            self
1521        }
1522
1523        /// Sends the request.
1524        ///
1525        /// # Long running operations
1526        ///
1527        /// This starts, but does not poll, a longrunning operation. More information
1528        /// on [create_worker_pool][crate::client::CloudBuild::create_worker_pool].
1529        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1530            (*self.0.stub)
1531                .create_worker_pool(self.0.request, self.0.options)
1532                .await
1533                .map(crate::Response::into_body)
1534        }
1535
1536        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_worker_pool`.
1537        pub fn poller(
1538            self,
1539        ) -> impl google_cloud_lro::Poller<
1540            crate::model::WorkerPool,
1541            crate::model::CreateWorkerPoolOperationMetadata,
1542        > {
1543            type Operation = google_cloud_lro::internal::Operation<
1544                crate::model::WorkerPool,
1545                crate::model::CreateWorkerPoolOperationMetadata,
1546            >;
1547            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1548            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1549            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1550            if let Some(ref mut details) = poller_options.tracing {
1551                details.method_name =
1552                    "google_cloud_build_v1::client::CloudBuild::create_worker_pool::until_done";
1553            }
1554
1555            let stub = self.0.stub.clone();
1556            let mut options = self.0.options.clone();
1557            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1558            let query = move |name| {
1559                let stub = stub.clone();
1560                let options = options.clone();
1561                async {
1562                    let op = GetOperation::new(stub)
1563                        .set_name(name)
1564                        .with_options(options)
1565                        .send()
1566                        .await?;
1567                    Ok(Operation::new(op))
1568                }
1569            };
1570
1571            let start = move || async {
1572                let op = self.send().await?;
1573                Ok(Operation::new(op))
1574            };
1575
1576            use google_cloud_lro::internal::PollerExt;
1577            {
1578                google_cloud_lro::internal::new_poller(
1579                    polling_error_policy,
1580                    polling_backoff_policy,
1581                    start,
1582                    query,
1583                )
1584            }
1585            .with_options(poller_options)
1586        }
1587
1588        /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
1589        ///
1590        /// This is a **required** field for requests.
1591        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1592            self.0.request.parent = v.into();
1593            self
1594        }
1595
1596        /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
1597        ///
1598        /// This is a **required** field for requests.
1599        pub fn set_worker_pool<T>(mut self, v: T) -> Self
1600        where
1601            T: std::convert::Into<crate::model::WorkerPool>,
1602        {
1603            self.0.request.worker_pool = std::option::Option::Some(v.into());
1604            self
1605        }
1606
1607        /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
1608        ///
1609        /// This is a **required** field for requests.
1610        pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
1611        where
1612            T: std::convert::Into<crate::model::WorkerPool>,
1613        {
1614            self.0.request.worker_pool = v.map(|x| x.into());
1615            self
1616        }
1617
1618        /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
1619        ///
1620        /// This is a **required** field for requests.
1621        pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1622            self.0.request.worker_pool_id = v.into();
1623            self
1624        }
1625
1626        /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
1627        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1628            self.0.request.validate_only = v.into();
1629            self
1630        }
1631    }
1632
1633    #[doc(hidden)]
1634    impl crate::RequestBuilder for CreateWorkerPool {
1635        fn request_options(&mut self) -> &mut crate::RequestOptions {
1636            &mut self.0.options
1637        }
1638    }
1639
1640    /// The request builder for [CloudBuild::get_worker_pool][crate::client::CloudBuild::get_worker_pool] calls.
1641    ///
1642    /// # Example
1643    /// ```
1644    /// # use google_cloud_build_v1::builder::cloud_build::GetWorkerPool;
1645    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1646    ///
1647    /// let builder = prepare_request_builder();
1648    /// let response = builder.send().await?;
1649    /// # Ok(()) }
1650    ///
1651    /// fn prepare_request_builder() -> GetWorkerPool {
1652    ///   # panic!();
1653    ///   // ... details omitted ...
1654    /// }
1655    /// ```
1656    #[derive(Clone, Debug)]
1657    pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
1658
1659    impl GetWorkerPool {
1660        pub(crate) fn new(
1661            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1662        ) -> Self {
1663            Self(RequestBuilder::new(stub))
1664        }
1665
1666        /// Sets the full request, replacing any prior values.
1667        pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
1668            self.0.request = v.into();
1669            self
1670        }
1671
1672        /// Sets all the options, replacing any prior values.
1673        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1674            self.0.options = v.into();
1675            self
1676        }
1677
1678        /// Sends the request.
1679        pub async fn send(self) -> Result<crate::model::WorkerPool> {
1680            (*self.0.stub)
1681                .get_worker_pool(self.0.request, self.0.options)
1682                .await
1683                .map(crate::Response::into_body)
1684        }
1685
1686        /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
1687        ///
1688        /// This is a **required** field for requests.
1689        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1690            self.0.request.name = v.into();
1691            self
1692        }
1693    }
1694
1695    #[doc(hidden)]
1696    impl crate::RequestBuilder for GetWorkerPool {
1697        fn request_options(&mut self) -> &mut crate::RequestOptions {
1698            &mut self.0.options
1699        }
1700    }
1701
1702    /// The request builder for [CloudBuild::delete_worker_pool][crate::client::CloudBuild::delete_worker_pool] calls.
1703    ///
1704    /// # Example
1705    /// ```
1706    /// # use google_cloud_build_v1::builder::cloud_build::DeleteWorkerPool;
1707    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1708    /// use google_cloud_lro::Poller;
1709    ///
1710    /// let builder = prepare_request_builder();
1711    /// let response = builder.poller().until_done().await?;
1712    /// # Ok(()) }
1713    ///
1714    /// fn prepare_request_builder() -> DeleteWorkerPool {
1715    ///   # panic!();
1716    ///   // ... details omitted ...
1717    /// }
1718    /// ```
1719    #[derive(Clone, Debug)]
1720    pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
1721
1722    impl DeleteWorkerPool {
1723        pub(crate) fn new(
1724            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1725        ) -> Self {
1726            Self(RequestBuilder::new(stub))
1727        }
1728
1729        /// Sets the full request, replacing any prior values.
1730        pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
1731            mut self,
1732            v: V,
1733        ) -> Self {
1734            self.0.request = v.into();
1735            self
1736        }
1737
1738        /// Sets all the options, replacing any prior values.
1739        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1740            self.0.options = v.into();
1741            self
1742        }
1743
1744        /// Sends the request.
1745        ///
1746        /// # Long running operations
1747        ///
1748        /// This starts, but does not poll, a longrunning operation. More information
1749        /// on [delete_worker_pool][crate::client::CloudBuild::delete_worker_pool].
1750        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1751            (*self.0.stub)
1752                .delete_worker_pool(self.0.request, self.0.options)
1753                .await
1754                .map(crate::Response::into_body)
1755        }
1756
1757        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_worker_pool`.
1758        pub fn poller(
1759            self,
1760        ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteWorkerPoolOperationMetadata>
1761        {
1762            type Operation = google_cloud_lro::internal::Operation<
1763                wkt::Empty,
1764                crate::model::DeleteWorkerPoolOperationMetadata,
1765            >;
1766            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1767            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1768            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1769            if let Some(ref mut details) = poller_options.tracing {
1770                details.method_name =
1771                    "google_cloud_build_v1::client::CloudBuild::delete_worker_pool::until_done";
1772            }
1773
1774            let stub = self.0.stub.clone();
1775            let mut options = self.0.options.clone();
1776            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1777            let query = move |name| {
1778                let stub = stub.clone();
1779                let options = options.clone();
1780                async {
1781                    let op = GetOperation::new(stub)
1782                        .set_name(name)
1783                        .with_options(options)
1784                        .send()
1785                        .await?;
1786                    Ok(Operation::new(op))
1787                }
1788            };
1789
1790            let start = move || async {
1791                let op = self.send().await?;
1792                Ok(Operation::new(op))
1793            };
1794
1795            use google_cloud_lro::internal::PollerExt;
1796            {
1797                google_cloud_lro::internal::new_unit_response_poller(
1798                    polling_error_policy,
1799                    polling_backoff_policy,
1800                    start,
1801                    query,
1802                )
1803            }
1804            .with_options(poller_options)
1805        }
1806
1807        /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
1808        ///
1809        /// This is a **required** field for requests.
1810        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1811            self.0.request.name = v.into();
1812            self
1813        }
1814
1815        /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
1816        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1817            self.0.request.etag = v.into();
1818            self
1819        }
1820
1821        /// Sets the value of [allow_missing][crate::model::DeleteWorkerPoolRequest::allow_missing].
1822        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1823            self.0.request.allow_missing = v.into();
1824            self
1825        }
1826
1827        /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
1828        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1829            self.0.request.validate_only = v.into();
1830            self
1831        }
1832    }
1833
1834    #[doc(hidden)]
1835    impl crate::RequestBuilder for DeleteWorkerPool {
1836        fn request_options(&mut self) -> &mut crate::RequestOptions {
1837            &mut self.0.options
1838        }
1839    }
1840
1841    /// The request builder for [CloudBuild::update_worker_pool][crate::client::CloudBuild::update_worker_pool] calls.
1842    ///
1843    /// # Example
1844    /// ```
1845    /// # use google_cloud_build_v1::builder::cloud_build::UpdateWorkerPool;
1846    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
1847    /// use google_cloud_lro::Poller;
1848    ///
1849    /// let builder = prepare_request_builder();
1850    /// let response = builder.poller().until_done().await?;
1851    /// # Ok(()) }
1852    ///
1853    /// fn prepare_request_builder() -> UpdateWorkerPool {
1854    ///   # panic!();
1855    ///   // ... details omitted ...
1856    /// }
1857    /// ```
1858    #[derive(Clone, Debug)]
1859    pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
1860
1861    impl UpdateWorkerPool {
1862        pub(crate) fn new(
1863            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
1864        ) -> Self {
1865            Self(RequestBuilder::new(stub))
1866        }
1867
1868        /// Sets the full request, replacing any prior values.
1869        pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
1870            mut self,
1871            v: V,
1872        ) -> Self {
1873            self.0.request = v.into();
1874            self
1875        }
1876
1877        /// Sets all the options, replacing any prior values.
1878        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1879            self.0.options = v.into();
1880            self
1881        }
1882
1883        /// Sends the request.
1884        ///
1885        /// # Long running operations
1886        ///
1887        /// This starts, but does not poll, a longrunning operation. More information
1888        /// on [update_worker_pool][crate::client::CloudBuild::update_worker_pool].
1889        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1890            (*self.0.stub)
1891                .update_worker_pool(self.0.request, self.0.options)
1892                .await
1893                .map(crate::Response::into_body)
1894        }
1895
1896        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_worker_pool`.
1897        pub fn poller(
1898            self,
1899        ) -> impl google_cloud_lro::Poller<
1900            crate::model::WorkerPool,
1901            crate::model::UpdateWorkerPoolOperationMetadata,
1902        > {
1903            type Operation = google_cloud_lro::internal::Operation<
1904                crate::model::WorkerPool,
1905                crate::model::UpdateWorkerPoolOperationMetadata,
1906            >;
1907            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1908            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1909            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1910            if let Some(ref mut details) = poller_options.tracing {
1911                details.method_name =
1912                    "google_cloud_build_v1::client::CloudBuild::update_worker_pool::until_done";
1913            }
1914
1915            let stub = self.0.stub.clone();
1916            let mut options = self.0.options.clone();
1917            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1918            let query = move |name| {
1919                let stub = stub.clone();
1920                let options = options.clone();
1921                async {
1922                    let op = GetOperation::new(stub)
1923                        .set_name(name)
1924                        .with_options(options)
1925                        .send()
1926                        .await?;
1927                    Ok(Operation::new(op))
1928                }
1929            };
1930
1931            let start = move || async {
1932                let op = self.send().await?;
1933                Ok(Operation::new(op))
1934            };
1935
1936            use google_cloud_lro::internal::PollerExt;
1937            {
1938                google_cloud_lro::internal::new_poller(
1939                    polling_error_policy,
1940                    polling_backoff_policy,
1941                    start,
1942                    query,
1943                )
1944            }
1945            .with_options(poller_options)
1946        }
1947
1948        /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
1949        ///
1950        /// This is a **required** field for requests.
1951        pub fn set_worker_pool<T>(mut self, v: T) -> Self
1952        where
1953            T: std::convert::Into<crate::model::WorkerPool>,
1954        {
1955            self.0.request.worker_pool = std::option::Option::Some(v.into());
1956            self
1957        }
1958
1959        /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
1960        ///
1961        /// This is a **required** field for requests.
1962        pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
1963        where
1964            T: std::convert::Into<crate::model::WorkerPool>,
1965        {
1966            self.0.request.worker_pool = v.map(|x| x.into());
1967            self
1968        }
1969
1970        /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
1971        pub fn set_update_mask<T>(mut self, v: T) -> Self
1972        where
1973            T: std::convert::Into<wkt::FieldMask>,
1974        {
1975            self.0.request.update_mask = std::option::Option::Some(v.into());
1976            self
1977        }
1978
1979        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
1980        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1981        where
1982            T: std::convert::Into<wkt::FieldMask>,
1983        {
1984            self.0.request.update_mask = v.map(|x| x.into());
1985            self
1986        }
1987
1988        /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
1989        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1990            self.0.request.validate_only = v.into();
1991            self
1992        }
1993    }
1994
1995    #[doc(hidden)]
1996    impl crate::RequestBuilder for UpdateWorkerPool {
1997        fn request_options(&mut self) -> &mut crate::RequestOptions {
1998            &mut self.0.options
1999        }
2000    }
2001
2002    /// The request builder for [CloudBuild::list_worker_pools][crate::client::CloudBuild::list_worker_pools] calls.
2003    ///
2004    /// # Example
2005    /// ```
2006    /// # use google_cloud_build_v1::builder::cloud_build::ListWorkerPools;
2007    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
2008    /// use google_cloud_gax::paginator::ItemPaginator;
2009    ///
2010    /// let builder = prepare_request_builder();
2011    /// let mut items = builder.by_item();
2012    /// while let Some(result) = items.next().await {
2013    ///   let item = result?;
2014    /// }
2015    /// # Ok(()) }
2016    ///
2017    /// fn prepare_request_builder() -> ListWorkerPools {
2018    ///   # panic!();
2019    ///   // ... details omitted ...
2020    /// }
2021    /// ```
2022    #[derive(Clone, Debug)]
2023    pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
2024
2025    impl ListWorkerPools {
2026        pub(crate) fn new(
2027            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
2028        ) -> Self {
2029            Self(RequestBuilder::new(stub))
2030        }
2031
2032        /// Sets the full request, replacing any prior values.
2033        pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
2034            self.0.request = v.into();
2035            self
2036        }
2037
2038        /// Sets all the options, replacing any prior values.
2039        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2040            self.0.options = v.into();
2041            self
2042        }
2043
2044        /// Sends the request.
2045        pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
2046            (*self.0.stub)
2047                .list_worker_pools(self.0.request, self.0.options)
2048                .await
2049                .map(crate::Response::into_body)
2050        }
2051
2052        /// Streams each page in the collection.
2053        pub fn by_page(
2054            self,
2055        ) -> impl google_cloud_gax::paginator::Paginator<
2056            crate::model::ListWorkerPoolsResponse,
2057            crate::Error,
2058        > {
2059            use std::clone::Clone;
2060            let token = self.0.request.page_token.clone();
2061            let execute = move |token: String| {
2062                let mut builder = self.clone();
2063                builder.0.request = builder.0.request.set_page_token(token);
2064                builder.send()
2065            };
2066            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2067        }
2068
2069        /// Streams each item in the collection.
2070        pub fn by_item(
2071            self,
2072        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2073            crate::model::ListWorkerPoolsResponse,
2074            crate::Error,
2075        > {
2076            use google_cloud_gax::paginator::Paginator;
2077            self.by_page().items()
2078        }
2079
2080        /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
2081        ///
2082        /// This is a **required** field for requests.
2083        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2084            self.0.request.parent = v.into();
2085            self
2086        }
2087
2088        /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
2089        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2090            self.0.request.page_size = v.into();
2091            self
2092        }
2093
2094        /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
2095        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2096            self.0.request.page_token = v.into();
2097            self
2098        }
2099    }
2100
2101    #[doc(hidden)]
2102    impl crate::RequestBuilder for ListWorkerPools {
2103        fn request_options(&mut self) -> &mut crate::RequestOptions {
2104            &mut self.0.options
2105        }
2106    }
2107
2108    /// The request builder for [CloudBuild::get_default_service_account][crate::client::CloudBuild::get_default_service_account] calls.
2109    ///
2110    /// # Example
2111    /// ```
2112    /// # use google_cloud_build_v1::builder::cloud_build::GetDefaultServiceAccount;
2113    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
2114    ///
2115    /// let builder = prepare_request_builder();
2116    /// let response = builder.send().await?;
2117    /// # Ok(()) }
2118    ///
2119    /// fn prepare_request_builder() -> GetDefaultServiceAccount {
2120    ///   # panic!();
2121    ///   // ... details omitted ...
2122    /// }
2123    /// ```
2124    #[derive(Clone, Debug)]
2125    pub struct GetDefaultServiceAccount(
2126        RequestBuilder<crate::model::GetDefaultServiceAccountRequest>,
2127    );
2128
2129    impl GetDefaultServiceAccount {
2130        pub(crate) fn new(
2131            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
2132        ) -> Self {
2133            Self(RequestBuilder::new(stub))
2134        }
2135
2136        /// Sets the full request, replacing any prior values.
2137        pub fn with_request<V: Into<crate::model::GetDefaultServiceAccountRequest>>(
2138            mut self,
2139            v: V,
2140        ) -> Self {
2141            self.0.request = v.into();
2142            self
2143        }
2144
2145        /// Sets all the options, replacing any prior values.
2146        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2147            self.0.options = v.into();
2148            self
2149        }
2150
2151        /// Sends the request.
2152        pub async fn send(self) -> Result<crate::model::DefaultServiceAccount> {
2153            (*self.0.stub)
2154                .get_default_service_account(self.0.request, self.0.options)
2155                .await
2156                .map(crate::Response::into_body)
2157        }
2158
2159        /// Sets the value of [name][crate::model::GetDefaultServiceAccountRequest::name].
2160        ///
2161        /// This is a **required** field for requests.
2162        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2163            self.0.request.name = v.into();
2164            self
2165        }
2166    }
2167
2168    #[doc(hidden)]
2169    impl crate::RequestBuilder for GetDefaultServiceAccount {
2170        fn request_options(&mut self) -> &mut crate::RequestOptions {
2171            &mut self.0.options
2172        }
2173    }
2174
2175    /// The request builder for [CloudBuild::get_operation][crate::client::CloudBuild::get_operation] calls.
2176    ///
2177    /// # Example
2178    /// ```
2179    /// # use google_cloud_build_v1::builder::cloud_build::GetOperation;
2180    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
2181    ///
2182    /// let builder = prepare_request_builder();
2183    /// let response = builder.send().await?;
2184    /// # Ok(()) }
2185    ///
2186    /// fn prepare_request_builder() -> GetOperation {
2187    ///   # panic!();
2188    ///   // ... details omitted ...
2189    /// }
2190    /// ```
2191    #[derive(Clone, Debug)]
2192    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2193
2194    impl GetOperation {
2195        pub(crate) fn new(
2196            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
2197        ) -> Self {
2198            Self(RequestBuilder::new(stub))
2199        }
2200
2201        /// Sets the full request, replacing any prior values.
2202        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2203            mut self,
2204            v: V,
2205        ) -> Self {
2206            self.0.request = v.into();
2207            self
2208        }
2209
2210        /// Sets all the options, replacing any prior values.
2211        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2212            self.0.options = v.into();
2213            self
2214        }
2215
2216        /// Sends the request.
2217        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2218            (*self.0.stub)
2219                .get_operation(self.0.request, self.0.options)
2220                .await
2221                .map(crate::Response::into_body)
2222        }
2223
2224        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
2225        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2226            self.0.request.name = v.into();
2227            self
2228        }
2229    }
2230
2231    #[doc(hidden)]
2232    impl crate::RequestBuilder for GetOperation {
2233        fn request_options(&mut self) -> &mut crate::RequestOptions {
2234            &mut self.0.options
2235        }
2236    }
2237
2238    /// The request builder for [CloudBuild::cancel_operation][crate::client::CloudBuild::cancel_operation] calls.
2239    ///
2240    /// # Example
2241    /// ```
2242    /// # use google_cloud_build_v1::builder::cloud_build::CancelOperation;
2243    /// # async fn sample() -> google_cloud_build_v1::Result<()> {
2244    ///
2245    /// let builder = prepare_request_builder();
2246    /// let response = builder.send().await?;
2247    /// # Ok(()) }
2248    ///
2249    /// fn prepare_request_builder() -> CancelOperation {
2250    ///   # panic!();
2251    ///   // ... details omitted ...
2252    /// }
2253    /// ```
2254    #[derive(Clone, Debug)]
2255    pub struct CancelOperation(
2256        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2257    );
2258
2259    impl CancelOperation {
2260        pub(crate) fn new(
2261            stub: std::sync::Arc<dyn super::super::stub::dynamic::CloudBuild>,
2262        ) -> Self {
2263            Self(RequestBuilder::new(stub))
2264        }
2265
2266        /// Sets the full request, replacing any prior values.
2267        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2268            mut self,
2269            v: V,
2270        ) -> Self {
2271            self.0.request = v.into();
2272            self
2273        }
2274
2275        /// Sets all the options, replacing any prior values.
2276        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2277            self.0.options = v.into();
2278            self
2279        }
2280
2281        /// Sends the request.
2282        pub async fn send(self) -> Result<()> {
2283            (*self.0.stub)
2284                .cancel_operation(self.0.request, self.0.options)
2285                .await
2286                .map(crate::Response::into_body)
2287        }
2288
2289        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
2290        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2291            self.0.request.name = v.into();
2292            self
2293        }
2294    }
2295
2296    #[doc(hidden)]
2297    impl crate::RequestBuilder for CancelOperation {
2298        fn request_options(&mut self) -> &mut crate::RequestOptions {
2299            &mut self.0.options
2300        }
2301    }
2302}