1pub mod cloud_build {
19 use crate::Result;
20
21 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 #[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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
109 self.0.options = v.into();
110 self
111 }
112
113 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
254 self.0.options = v.into();
255 self
256 }
257
258 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
334 self.0.options = v.into();
335 self
336 }
337
338 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
446 self.0.options = v.into();
447 self
448 }
449
450 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
523 self.0.options = v.into();
524 self
525 }
526
527 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
655 self.0.options = v.into();
656 self
657 }
658
659 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
793 self.0.options = v.into();
794 self
795 }
796
797 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
883 self.0.options = v.into();
884 self
885 }
886
887 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
966 self.0.options = v.into();
967 self
968 }
969
970 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1077 self.0.options = v.into();
1078 self
1079 }
1080
1081 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1156 self.0.options = v.into();
1157 self
1158 }
1159
1160 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1267 self.0.options = v.into();
1268 self
1269 }
1270
1271 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1419 self.0.options = v.into();
1420 self
1421 }
1422
1423 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1519 self.0.options = v.into();
1520 self
1521 }
1522
1523 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1674 self.0.options = v.into();
1675 self
1676 }
1677
1678 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1740 self.0.options = v.into();
1741 self
1742 }
1743
1744 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1879 self.0.options = v.into();
1880 self
1881 }
1882
1883 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2040 self.0.options = v.into();
2041 self
2042 }
2043
2044 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2147 self.0.options = v.into();
2148 self
2149 }
2150
2151 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2212 self.0.options = v.into();
2213 self
2214 }
2215
2216 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2277 self.0.options = v.into();
2278 self
2279 }
2280
2281 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 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}