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