1pub mod builds {
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::Builds;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = Builds;
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::Builds>,
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(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: crate::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
89 pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
90
91 impl SubmitBuild {
92 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
93 Self(RequestBuilder::new(stub))
94 }
95
96 pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
98 self.0.request = v.into();
99 self
100 }
101
102 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
104 self.0.options = v.into();
105 self
106 }
107
108 pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
110 (*self.0.stub)
111 .submit_build(self.0.request, self.0.options)
112 .await
113 .map(crate::Response::into_body)
114 }
115
116 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
120 self.0.request.parent = v.into();
121 self
122 }
123
124 pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.image_uri = v.into();
129 self
130 }
131
132 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.service_account = v.into();
135 self
136 }
137
138 pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
140 self.0.request.worker_pool = v.into();
141 self
142 }
143
144 pub fn set_tags<T, V>(mut self, v: T) -> Self
146 where
147 T: std::iter::IntoIterator<Item = V>,
148 V: std::convert::Into<std::string::String>,
149 {
150 use std::iter::Iterator;
151 self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
152 self
153 }
154
155 pub fn set_machine_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
157 self.0.request.machine_type = v.into();
158 self
159 }
160
161 pub fn set_release_track<T: Into<google_cloud_api::model::LaunchStage>>(
163 mut self,
164 v: T,
165 ) -> Self {
166 self.0.request.release_track = v.into();
167 self
168 }
169
170 pub fn set_client<T: Into<std::string::String>>(mut self, v: T) -> Self {
172 self.0.request.client = v.into();
173 self
174 }
175
176 pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
181 mut self,
182 v: T,
183 ) -> Self {
184 self.0.request.source = v.into();
185 self
186 }
187
188 pub fn set_storage_source<
194 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
195 >(
196 mut self,
197 v: T,
198 ) -> Self {
199 self.0.request = self.0.request.set_storage_source(v);
200 self
201 }
202
203 pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
208 mut self,
209 v: T,
210 ) -> Self {
211 self.0.request.build_type = v.into();
212 self
213 }
214
215 pub fn set_buildpack_build<
221 T: std::convert::Into<
222 std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
223 >,
224 >(
225 mut self,
226 v: T,
227 ) -> Self {
228 self.0.request = self.0.request.set_buildpack_build(v);
229 self
230 }
231
232 pub fn set_docker_build<
238 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
239 >(
240 mut self,
241 v: T,
242 ) -> Self {
243 self.0.request = self.0.request.set_docker_build(v);
244 self
245 }
246 }
247
248 #[doc(hidden)]
249 impl crate::RequestBuilder for SubmitBuild {
250 fn request_options(&mut self) -> &mut crate::RequestOptions {
251 &mut self.0.options
252 }
253 }
254
255 #[derive(Clone, Debug)]
276 pub struct ListOperations(
277 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
278 );
279
280 impl ListOperations {
281 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
282 Self(RequestBuilder::new(stub))
283 }
284
285 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
287 mut self,
288 v: V,
289 ) -> Self {
290 self.0.request = v.into();
291 self
292 }
293
294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
296 self.0.options = v.into();
297 self
298 }
299
300 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
302 (*self.0.stub)
303 .list_operations(self.0.request, self.0.options)
304 .await
305 .map(crate::Response::into_body)
306 }
307
308 pub fn by_page(
310 self,
311 ) -> impl google_cloud_gax::paginator::Paginator<
312 google_cloud_longrunning::model::ListOperationsResponse,
313 crate::Error,
314 > {
315 use std::clone::Clone;
316 let token = self.0.request.page_token.clone();
317 let execute = move |token: String| {
318 let mut builder = self.clone();
319 builder.0.request = builder.0.request.set_page_token(token);
320 builder.send()
321 };
322 google_cloud_gax::paginator::internal::new_paginator(token, execute)
323 }
324
325 pub fn by_item(
327 self,
328 ) -> impl google_cloud_gax::paginator::ItemPaginator<
329 google_cloud_longrunning::model::ListOperationsResponse,
330 crate::Error,
331 > {
332 use google_cloud_gax::paginator::Paginator;
333 self.by_page().items()
334 }
335
336 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
338 self.0.request.name = v.into();
339 self
340 }
341
342 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
344 self.0.request.filter = v.into();
345 self
346 }
347
348 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
350 self.0.request.page_size = v.into();
351 self
352 }
353
354 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
356 self.0.request.page_token = v.into();
357 self
358 }
359
360 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
362 self.0.request.return_partial_success = v.into();
363 self
364 }
365 }
366
367 #[doc(hidden)]
368 impl crate::RequestBuilder for ListOperations {
369 fn request_options(&mut self) -> &mut crate::RequestOptions {
370 &mut self.0.options
371 }
372 }
373
374 #[derive(Clone, Debug)]
391 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
392
393 impl GetOperation {
394 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
395 Self(RequestBuilder::new(stub))
396 }
397
398 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
400 mut self,
401 v: V,
402 ) -> Self {
403 self.0.request = v.into();
404 self
405 }
406
407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
409 self.0.options = v.into();
410 self
411 }
412
413 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
415 (*self.0.stub)
416 .get_operation(self.0.request, self.0.options)
417 .await
418 .map(crate::Response::into_body)
419 }
420
421 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
423 self.0.request.name = v.into();
424 self
425 }
426 }
427
428 #[doc(hidden)]
429 impl crate::RequestBuilder for GetOperation {
430 fn request_options(&mut self) -> &mut crate::RequestOptions {
431 &mut self.0.options
432 }
433 }
434
435 #[derive(Clone, Debug)]
452 pub struct DeleteOperation(
453 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
454 );
455
456 impl DeleteOperation {
457 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
458 Self(RequestBuilder::new(stub))
459 }
460
461 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
463 mut self,
464 v: V,
465 ) -> Self {
466 self.0.request = v.into();
467 self
468 }
469
470 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
472 self.0.options = v.into();
473 self
474 }
475
476 pub async fn send(self) -> Result<()> {
478 (*self.0.stub)
479 .delete_operation(self.0.request, self.0.options)
480 .await
481 .map(crate::Response::into_body)
482 }
483
484 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
486 self.0.request.name = v.into();
487 self
488 }
489 }
490
491 #[doc(hidden)]
492 impl crate::RequestBuilder for DeleteOperation {
493 fn request_options(&mut self) -> &mut crate::RequestOptions {
494 &mut self.0.options
495 }
496 }
497
498 #[derive(Clone, Debug)]
515 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
516
517 impl WaitOperation {
518 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
519 Self(RequestBuilder::new(stub))
520 }
521
522 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
524 mut self,
525 v: V,
526 ) -> Self {
527 self.0.request = v.into();
528 self
529 }
530
531 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
533 self.0.options = v.into();
534 self
535 }
536
537 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
539 (*self.0.stub)
540 .wait_operation(self.0.request, self.0.options)
541 .await
542 .map(crate::Response::into_body)
543 }
544
545 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
547 self.0.request.name = v.into();
548 self
549 }
550
551 pub fn set_timeout<T>(mut self, v: T) -> Self
553 where
554 T: std::convert::Into<wkt::Duration>,
555 {
556 self.0.request.timeout = std::option::Option::Some(v.into());
557 self
558 }
559
560 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
562 where
563 T: std::convert::Into<wkt::Duration>,
564 {
565 self.0.request.timeout = v.map(|x| x.into());
566 self
567 }
568 }
569
570 #[doc(hidden)]
571 impl crate::RequestBuilder for WaitOperation {
572 fn request_options(&mut self) -> &mut crate::RequestOptions {
573 &mut self.0.options
574 }
575 }
576}
577
578pub mod executions {
580 use crate::Result;
581
582 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
596
597 pub(crate) mod client {
598 use super::super::super::client::Executions;
599 pub struct Factory;
600 impl crate::ClientFactory for Factory {
601 type Client = Executions;
602 type Credentials = gaxi::options::Credentials;
603 async fn build(
604 self,
605 config: gaxi::options::ClientConfig,
606 ) -> crate::ClientBuilderResult<Self::Client> {
607 Self::Client::new(config).await
608 }
609 }
610 }
611
612 #[derive(Clone, Debug)]
614 pub(crate) struct RequestBuilder<R: std::default::Default> {
615 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
616 request: R,
617 options: crate::RequestOptions,
618 }
619
620 impl<R> RequestBuilder<R>
621 where
622 R: std::default::Default,
623 {
624 pub(crate) fn new(
625 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
626 ) -> Self {
627 Self {
628 stub,
629 request: R::default(),
630 options: crate::RequestOptions::default(),
631 }
632 }
633 }
634
635 #[derive(Clone, Debug)]
652 pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
653
654 impl GetExecution {
655 pub(crate) fn new(
656 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
657 ) -> Self {
658 Self(RequestBuilder::new(stub))
659 }
660
661 pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
663 self.0.request = v.into();
664 self
665 }
666
667 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
669 self.0.options = v.into();
670 self
671 }
672
673 pub async fn send(self) -> Result<crate::model::Execution> {
675 (*self.0.stub)
676 .get_execution(self.0.request, self.0.options)
677 .await
678 .map(crate::Response::into_body)
679 }
680
681 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
685 self.0.request.name = v.into();
686 self
687 }
688 }
689
690 #[doc(hidden)]
691 impl crate::RequestBuilder for GetExecution {
692 fn request_options(&mut self) -> &mut crate::RequestOptions {
693 &mut self.0.options
694 }
695 }
696
697 #[derive(Clone, Debug)]
718 pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
719
720 impl ListExecutions {
721 pub(crate) fn new(
722 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
723 ) -> Self {
724 Self(RequestBuilder::new(stub))
725 }
726
727 pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
729 self.0.request = v.into();
730 self
731 }
732
733 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
735 self.0.options = v.into();
736 self
737 }
738
739 pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
741 (*self.0.stub)
742 .list_executions(self.0.request, self.0.options)
743 .await
744 .map(crate::Response::into_body)
745 }
746
747 pub fn by_page(
749 self,
750 ) -> impl google_cloud_gax::paginator::Paginator<
751 crate::model::ListExecutionsResponse,
752 crate::Error,
753 > {
754 use std::clone::Clone;
755 let token = self.0.request.page_token.clone();
756 let execute = move |token: String| {
757 let mut builder = self.clone();
758 builder.0.request = builder.0.request.set_page_token(token);
759 builder.send()
760 };
761 google_cloud_gax::paginator::internal::new_paginator(token, execute)
762 }
763
764 pub fn by_item(
766 self,
767 ) -> impl google_cloud_gax::paginator::ItemPaginator<
768 crate::model::ListExecutionsResponse,
769 crate::Error,
770 > {
771 use google_cloud_gax::paginator::Paginator;
772 self.by_page().items()
773 }
774
775 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 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
785 self.0.request.page_size = v.into();
786 self
787 }
788
789 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
791 self.0.request.page_token = v.into();
792 self
793 }
794
795 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
797 self.0.request.show_deleted = v.into();
798 self
799 }
800 }
801
802 #[doc(hidden)]
803 impl crate::RequestBuilder for ListExecutions {
804 fn request_options(&mut self) -> &mut crate::RequestOptions {
805 &mut self.0.options
806 }
807 }
808
809 #[derive(Clone, Debug)]
827 pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
828
829 impl DeleteExecution {
830 pub(crate) fn new(
831 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
832 ) -> Self {
833 Self(RequestBuilder::new(stub))
834 }
835
836 pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
838 self.0.request = v.into();
839 self
840 }
841
842 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
844 self.0.options = v.into();
845 self
846 }
847
848 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
855 (*self.0.stub)
856 .delete_execution(self.0.request, self.0.options)
857 .await
858 .map(crate::Response::into_body)
859 }
860
861 pub fn poller(
863 self,
864 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
865 {
866 type Operation = google_cloud_lro::internal::Operation<
867 crate::model::Execution,
868 crate::model::Execution,
869 >;
870 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
871 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
872
873 let stub = self.0.stub.clone();
874 let mut options = self.0.options.clone();
875 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
876 let query = move |name| {
877 let stub = stub.clone();
878 let options = options.clone();
879 async {
880 let op = GetOperation::new(stub)
881 .set_name(name)
882 .with_options(options)
883 .send()
884 .await?;
885 Ok(Operation::new(op))
886 }
887 };
888
889 let start = move || async {
890 let op = self.send().await?;
891 Ok(Operation::new(op))
892 };
893
894 google_cloud_lro::internal::new_poller(
895 polling_error_policy,
896 polling_backoff_policy,
897 start,
898 query,
899 )
900 }
901
902 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
906 self.0.request.name = v.into();
907 self
908 }
909
910 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
912 self.0.request.validate_only = v.into();
913 self
914 }
915
916 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
918 self.0.request.etag = v.into();
919 self
920 }
921 }
922
923 #[doc(hidden)]
924 impl crate::RequestBuilder for DeleteExecution {
925 fn request_options(&mut self) -> &mut crate::RequestOptions {
926 &mut self.0.options
927 }
928 }
929
930 #[derive(Clone, Debug)]
948 pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
949
950 impl CancelExecution {
951 pub(crate) fn new(
952 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
953 ) -> Self {
954 Self(RequestBuilder::new(stub))
955 }
956
957 pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
959 self.0.request = v.into();
960 self
961 }
962
963 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
965 self.0.options = v.into();
966 self
967 }
968
969 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
976 (*self.0.stub)
977 .cancel_execution(self.0.request, self.0.options)
978 .await
979 .map(crate::Response::into_body)
980 }
981
982 pub fn poller(
984 self,
985 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
986 {
987 type Operation = google_cloud_lro::internal::Operation<
988 crate::model::Execution,
989 crate::model::Execution,
990 >;
991 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
992 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
993
994 let stub = self.0.stub.clone();
995 let mut options = self.0.options.clone();
996 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
997 let query = move |name| {
998 let stub = stub.clone();
999 let options = options.clone();
1000 async {
1001 let op = GetOperation::new(stub)
1002 .set_name(name)
1003 .with_options(options)
1004 .send()
1005 .await?;
1006 Ok(Operation::new(op))
1007 }
1008 };
1009
1010 let start = move || async {
1011 let op = self.send().await?;
1012 Ok(Operation::new(op))
1013 };
1014
1015 google_cloud_lro::internal::new_poller(
1016 polling_error_policy,
1017 polling_backoff_policy,
1018 start,
1019 query,
1020 )
1021 }
1022
1023 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1027 self.0.request.name = v.into();
1028 self
1029 }
1030
1031 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1033 self.0.request.validate_only = v.into();
1034 self
1035 }
1036
1037 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1039 self.0.request.etag = v.into();
1040 self
1041 }
1042 }
1043
1044 #[doc(hidden)]
1045 impl crate::RequestBuilder for CancelExecution {
1046 fn request_options(&mut self) -> &mut crate::RequestOptions {
1047 &mut self.0.options
1048 }
1049 }
1050
1051 #[derive(Clone, Debug)]
1072 pub struct ListOperations(
1073 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1074 );
1075
1076 impl ListOperations {
1077 pub(crate) fn new(
1078 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1079 ) -> Self {
1080 Self(RequestBuilder::new(stub))
1081 }
1082
1083 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1085 mut self,
1086 v: V,
1087 ) -> Self {
1088 self.0.request = v.into();
1089 self
1090 }
1091
1092 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1094 self.0.options = v.into();
1095 self
1096 }
1097
1098 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1100 (*self.0.stub)
1101 .list_operations(self.0.request, self.0.options)
1102 .await
1103 .map(crate::Response::into_body)
1104 }
1105
1106 pub fn by_page(
1108 self,
1109 ) -> impl google_cloud_gax::paginator::Paginator<
1110 google_cloud_longrunning::model::ListOperationsResponse,
1111 crate::Error,
1112 > {
1113 use std::clone::Clone;
1114 let token = self.0.request.page_token.clone();
1115 let execute = move |token: String| {
1116 let mut builder = self.clone();
1117 builder.0.request = builder.0.request.set_page_token(token);
1118 builder.send()
1119 };
1120 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1121 }
1122
1123 pub fn by_item(
1125 self,
1126 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1127 google_cloud_longrunning::model::ListOperationsResponse,
1128 crate::Error,
1129 > {
1130 use google_cloud_gax::paginator::Paginator;
1131 self.by_page().items()
1132 }
1133
1134 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.0.request.name = v.into();
1137 self
1138 }
1139
1140 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1142 self.0.request.filter = v.into();
1143 self
1144 }
1145
1146 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1148 self.0.request.page_size = v.into();
1149 self
1150 }
1151
1152 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1154 self.0.request.page_token = v.into();
1155 self
1156 }
1157
1158 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1160 self.0.request.return_partial_success = v.into();
1161 self
1162 }
1163 }
1164
1165 #[doc(hidden)]
1166 impl crate::RequestBuilder for ListOperations {
1167 fn request_options(&mut self) -> &mut crate::RequestOptions {
1168 &mut self.0.options
1169 }
1170 }
1171
1172 #[derive(Clone, Debug)]
1189 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1190
1191 impl GetOperation {
1192 pub(crate) fn new(
1193 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1194 ) -> Self {
1195 Self(RequestBuilder::new(stub))
1196 }
1197
1198 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1200 mut self,
1201 v: V,
1202 ) -> Self {
1203 self.0.request = v.into();
1204 self
1205 }
1206
1207 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1209 self.0.options = v.into();
1210 self
1211 }
1212
1213 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1215 (*self.0.stub)
1216 .get_operation(self.0.request, self.0.options)
1217 .await
1218 .map(crate::Response::into_body)
1219 }
1220
1221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1223 self.0.request.name = v.into();
1224 self
1225 }
1226 }
1227
1228 #[doc(hidden)]
1229 impl crate::RequestBuilder for GetOperation {
1230 fn request_options(&mut self) -> &mut crate::RequestOptions {
1231 &mut self.0.options
1232 }
1233 }
1234
1235 #[derive(Clone, Debug)]
1252 pub struct DeleteOperation(
1253 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1254 );
1255
1256 impl DeleteOperation {
1257 pub(crate) fn new(
1258 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1259 ) -> Self {
1260 Self(RequestBuilder::new(stub))
1261 }
1262
1263 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1265 mut self,
1266 v: V,
1267 ) -> Self {
1268 self.0.request = v.into();
1269 self
1270 }
1271
1272 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1274 self.0.options = v.into();
1275 self
1276 }
1277
1278 pub async fn send(self) -> Result<()> {
1280 (*self.0.stub)
1281 .delete_operation(self.0.request, self.0.options)
1282 .await
1283 .map(crate::Response::into_body)
1284 }
1285
1286 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1288 self.0.request.name = v.into();
1289 self
1290 }
1291 }
1292
1293 #[doc(hidden)]
1294 impl crate::RequestBuilder for DeleteOperation {
1295 fn request_options(&mut self) -> &mut crate::RequestOptions {
1296 &mut self.0.options
1297 }
1298 }
1299
1300 #[derive(Clone, Debug)]
1317 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
1318
1319 impl WaitOperation {
1320 pub(crate) fn new(
1321 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1322 ) -> Self {
1323 Self(RequestBuilder::new(stub))
1324 }
1325
1326 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
1328 mut self,
1329 v: V,
1330 ) -> Self {
1331 self.0.request = v.into();
1332 self
1333 }
1334
1335 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1337 self.0.options = v.into();
1338 self
1339 }
1340
1341 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1343 (*self.0.stub)
1344 .wait_operation(self.0.request, self.0.options)
1345 .await
1346 .map(crate::Response::into_body)
1347 }
1348
1349 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1351 self.0.request.name = v.into();
1352 self
1353 }
1354
1355 pub fn set_timeout<T>(mut self, v: T) -> Self
1357 where
1358 T: std::convert::Into<wkt::Duration>,
1359 {
1360 self.0.request.timeout = std::option::Option::Some(v.into());
1361 self
1362 }
1363
1364 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1366 where
1367 T: std::convert::Into<wkt::Duration>,
1368 {
1369 self.0.request.timeout = v.map(|x| x.into());
1370 self
1371 }
1372 }
1373
1374 #[doc(hidden)]
1375 impl crate::RequestBuilder for WaitOperation {
1376 fn request_options(&mut self) -> &mut crate::RequestOptions {
1377 &mut self.0.options
1378 }
1379 }
1380}
1381
1382pub mod instances {
1384 use crate::Result;
1385
1386 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1400
1401 pub(crate) mod client {
1402 use super::super::super::client::Instances;
1403 pub struct Factory;
1404 impl crate::ClientFactory for Factory {
1405 type Client = Instances;
1406 type Credentials = gaxi::options::Credentials;
1407 async fn build(
1408 self,
1409 config: gaxi::options::ClientConfig,
1410 ) -> crate::ClientBuilderResult<Self::Client> {
1411 Self::Client::new(config).await
1412 }
1413 }
1414 }
1415
1416 #[derive(Clone, Debug)]
1418 pub(crate) struct RequestBuilder<R: std::default::Default> {
1419 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1420 request: R,
1421 options: crate::RequestOptions,
1422 }
1423
1424 impl<R> RequestBuilder<R>
1425 where
1426 R: std::default::Default,
1427 {
1428 pub(crate) fn new(
1429 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1430 ) -> Self {
1431 Self {
1432 stub,
1433 request: R::default(),
1434 options: crate::RequestOptions::default(),
1435 }
1436 }
1437 }
1438
1439 #[derive(Clone, Debug)]
1457 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1458
1459 impl CreateInstance {
1460 pub(crate) fn new(
1461 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1462 ) -> Self {
1463 Self(RequestBuilder::new(stub))
1464 }
1465
1466 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1468 self.0.request = v.into();
1469 self
1470 }
1471
1472 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1474 self.0.options = v.into();
1475 self
1476 }
1477
1478 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1485 (*self.0.stub)
1486 .create_instance(self.0.request, self.0.options)
1487 .await
1488 .map(crate::Response::into_body)
1489 }
1490
1491 pub fn poller(
1493 self,
1494 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1495 type Operation = google_cloud_lro::internal::Operation<
1496 crate::model::Instance,
1497 crate::model::Instance,
1498 >;
1499 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1500 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1501
1502 let stub = self.0.stub.clone();
1503 let mut options = self.0.options.clone();
1504 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1505 let query = move |name| {
1506 let stub = stub.clone();
1507 let options = options.clone();
1508 async {
1509 let op = GetOperation::new(stub)
1510 .set_name(name)
1511 .with_options(options)
1512 .send()
1513 .await?;
1514 Ok(Operation::new(op))
1515 }
1516 };
1517
1518 let start = move || async {
1519 let op = self.send().await?;
1520 Ok(Operation::new(op))
1521 };
1522
1523 google_cloud_lro::internal::new_poller(
1524 polling_error_policy,
1525 polling_backoff_policy,
1526 start,
1527 query,
1528 )
1529 }
1530
1531 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1535 self.0.request.parent = v.into();
1536 self
1537 }
1538
1539 pub fn set_instance<T>(mut self, v: T) -> Self
1543 where
1544 T: std::convert::Into<crate::model::Instance>,
1545 {
1546 self.0.request.instance = std::option::Option::Some(v.into());
1547 self
1548 }
1549
1550 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1554 where
1555 T: std::convert::Into<crate::model::Instance>,
1556 {
1557 self.0.request.instance = v.map(|x| x.into());
1558 self
1559 }
1560
1561 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1565 self.0.request.instance_id = v.into();
1566 self
1567 }
1568
1569 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1571 self.0.request.validate_only = v.into();
1572 self
1573 }
1574 }
1575
1576 #[doc(hidden)]
1577 impl crate::RequestBuilder for CreateInstance {
1578 fn request_options(&mut self) -> &mut crate::RequestOptions {
1579 &mut self.0.options
1580 }
1581 }
1582
1583 #[derive(Clone, Debug)]
1601 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1602
1603 impl DeleteInstance {
1604 pub(crate) fn new(
1605 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1606 ) -> Self {
1607 Self(RequestBuilder::new(stub))
1608 }
1609
1610 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1612 self.0.request = v.into();
1613 self
1614 }
1615
1616 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1618 self.0.options = v.into();
1619 self
1620 }
1621
1622 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1629 (*self.0.stub)
1630 .delete_instance(self.0.request, self.0.options)
1631 .await
1632 .map(crate::Response::into_body)
1633 }
1634
1635 pub fn poller(
1637 self,
1638 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1639 type Operation = google_cloud_lro::internal::Operation<
1640 crate::model::Instance,
1641 crate::model::Instance,
1642 >;
1643 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1644 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1645
1646 let stub = self.0.stub.clone();
1647 let mut options = self.0.options.clone();
1648 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1649 let query = move |name| {
1650 let stub = stub.clone();
1651 let options = options.clone();
1652 async {
1653 let op = GetOperation::new(stub)
1654 .set_name(name)
1655 .with_options(options)
1656 .send()
1657 .await?;
1658 Ok(Operation::new(op))
1659 }
1660 };
1661
1662 let start = move || async {
1663 let op = self.send().await?;
1664 Ok(Operation::new(op))
1665 };
1666
1667 google_cloud_lro::internal::new_poller(
1668 polling_error_policy,
1669 polling_backoff_policy,
1670 start,
1671 query,
1672 )
1673 }
1674
1675 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1679 self.0.request.name = v.into();
1680 self
1681 }
1682
1683 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1685 self.0.request.validate_only = v.into();
1686 self
1687 }
1688
1689 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.0.request.etag = v.into();
1692 self
1693 }
1694 }
1695
1696 #[doc(hidden)]
1697 impl crate::RequestBuilder for DeleteInstance {
1698 fn request_options(&mut self) -> &mut crate::RequestOptions {
1699 &mut self.0.options
1700 }
1701 }
1702
1703 #[derive(Clone, Debug)]
1720 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1721
1722 impl GetInstance {
1723 pub(crate) fn new(
1724 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1725 ) -> Self {
1726 Self(RequestBuilder::new(stub))
1727 }
1728
1729 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1731 self.0.request = v.into();
1732 self
1733 }
1734
1735 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1737 self.0.options = v.into();
1738 self
1739 }
1740
1741 pub async fn send(self) -> Result<crate::model::Instance> {
1743 (*self.0.stub)
1744 .get_instance(self.0.request, self.0.options)
1745 .await
1746 .map(crate::Response::into_body)
1747 }
1748
1749 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1753 self.0.request.name = v.into();
1754 self
1755 }
1756 }
1757
1758 #[doc(hidden)]
1759 impl crate::RequestBuilder for GetInstance {
1760 fn request_options(&mut self) -> &mut crate::RequestOptions {
1761 &mut self.0.options
1762 }
1763 }
1764
1765 #[derive(Clone, Debug)]
1786 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
1787
1788 impl ListInstances {
1789 pub(crate) fn new(
1790 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1791 ) -> Self {
1792 Self(RequestBuilder::new(stub))
1793 }
1794
1795 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
1797 self.0.request = v.into();
1798 self
1799 }
1800
1801 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1803 self.0.options = v.into();
1804 self
1805 }
1806
1807 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
1809 (*self.0.stub)
1810 .list_instances(self.0.request, self.0.options)
1811 .await
1812 .map(crate::Response::into_body)
1813 }
1814
1815 pub fn by_page(
1817 self,
1818 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
1819 {
1820 use std::clone::Clone;
1821 let token = self.0.request.page_token.clone();
1822 let execute = move |token: String| {
1823 let mut builder = self.clone();
1824 builder.0.request = builder.0.request.set_page_token(token);
1825 builder.send()
1826 };
1827 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1828 }
1829
1830 pub fn by_item(
1832 self,
1833 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1834 crate::model::ListInstancesResponse,
1835 crate::Error,
1836 > {
1837 use google_cloud_gax::paginator::Paginator;
1838 self.by_page().items()
1839 }
1840
1841 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.0.request.parent = v.into();
1846 self
1847 }
1848
1849 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1851 self.0.request.page_size = v.into();
1852 self
1853 }
1854
1855 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1857 self.0.request.page_token = v.into();
1858 self
1859 }
1860
1861 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1863 self.0.request.show_deleted = v.into();
1864 self
1865 }
1866 }
1867
1868 #[doc(hidden)]
1869 impl crate::RequestBuilder for ListInstances {
1870 fn request_options(&mut self) -> &mut crate::RequestOptions {
1871 &mut self.0.options
1872 }
1873 }
1874
1875 #[derive(Clone, Debug)]
1893 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
1894
1895 impl StopInstance {
1896 pub(crate) fn new(
1897 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1898 ) -> Self {
1899 Self(RequestBuilder::new(stub))
1900 }
1901
1902 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
1904 self.0.request = v.into();
1905 self
1906 }
1907
1908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1910 self.0.options = v.into();
1911 self
1912 }
1913
1914 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1921 (*self.0.stub)
1922 .stop_instance(self.0.request, self.0.options)
1923 .await
1924 .map(crate::Response::into_body)
1925 }
1926
1927 pub fn poller(
1929 self,
1930 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1931 type Operation = google_cloud_lro::internal::Operation<
1932 crate::model::Instance,
1933 crate::model::Instance,
1934 >;
1935 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1936 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1937
1938 let stub = self.0.stub.clone();
1939 let mut options = self.0.options.clone();
1940 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1941 let query = move |name| {
1942 let stub = stub.clone();
1943 let options = options.clone();
1944 async {
1945 let op = GetOperation::new(stub)
1946 .set_name(name)
1947 .with_options(options)
1948 .send()
1949 .await?;
1950 Ok(Operation::new(op))
1951 }
1952 };
1953
1954 let start = move || async {
1955 let op = self.send().await?;
1956 Ok(Operation::new(op))
1957 };
1958
1959 google_cloud_lro::internal::new_poller(
1960 polling_error_policy,
1961 polling_backoff_policy,
1962 start,
1963 query,
1964 )
1965 }
1966
1967 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1971 self.0.request.name = v.into();
1972 self
1973 }
1974
1975 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1977 self.0.request.validate_only = v.into();
1978 self
1979 }
1980
1981 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.0.request.etag = v.into();
1984 self
1985 }
1986 }
1987
1988 #[doc(hidden)]
1989 impl crate::RequestBuilder for StopInstance {
1990 fn request_options(&mut self) -> &mut crate::RequestOptions {
1991 &mut self.0.options
1992 }
1993 }
1994
1995 #[derive(Clone, Debug)]
2013 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
2014
2015 impl StartInstance {
2016 pub(crate) fn new(
2017 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2018 ) -> Self {
2019 Self(RequestBuilder::new(stub))
2020 }
2021
2022 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
2024 self.0.request = v.into();
2025 self
2026 }
2027
2028 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2030 self.0.options = v.into();
2031 self
2032 }
2033
2034 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2041 (*self.0.stub)
2042 .start_instance(self.0.request, self.0.options)
2043 .await
2044 .map(crate::Response::into_body)
2045 }
2046
2047 pub fn poller(
2049 self,
2050 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
2051 type Operation = google_cloud_lro::internal::Operation<
2052 crate::model::Instance,
2053 crate::model::Instance,
2054 >;
2055 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2056 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2057
2058 let stub = self.0.stub.clone();
2059 let mut options = self.0.options.clone();
2060 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2061 let query = move |name| {
2062 let stub = stub.clone();
2063 let options = options.clone();
2064 async {
2065 let op = GetOperation::new(stub)
2066 .set_name(name)
2067 .with_options(options)
2068 .send()
2069 .await?;
2070 Ok(Operation::new(op))
2071 }
2072 };
2073
2074 let start = move || async {
2075 let op = self.send().await?;
2076 Ok(Operation::new(op))
2077 };
2078
2079 google_cloud_lro::internal::new_poller(
2080 polling_error_policy,
2081 polling_backoff_policy,
2082 start,
2083 query,
2084 )
2085 }
2086
2087 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2091 self.0.request.name = v.into();
2092 self
2093 }
2094
2095 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2097 self.0.request.validate_only = v.into();
2098 self
2099 }
2100
2101 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2103 self.0.request.etag = v.into();
2104 self
2105 }
2106 }
2107
2108 #[doc(hidden)]
2109 impl crate::RequestBuilder for StartInstance {
2110 fn request_options(&mut self) -> &mut crate::RequestOptions {
2111 &mut self.0.options
2112 }
2113 }
2114
2115 #[derive(Clone, Debug)]
2136 pub struct ListOperations(
2137 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2138 );
2139
2140 impl ListOperations {
2141 pub(crate) fn new(
2142 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2143 ) -> Self {
2144 Self(RequestBuilder::new(stub))
2145 }
2146
2147 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2149 mut self,
2150 v: V,
2151 ) -> Self {
2152 self.0.request = v.into();
2153 self
2154 }
2155
2156 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2158 self.0.options = v.into();
2159 self
2160 }
2161
2162 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2164 (*self.0.stub)
2165 .list_operations(self.0.request, self.0.options)
2166 .await
2167 .map(crate::Response::into_body)
2168 }
2169
2170 pub fn by_page(
2172 self,
2173 ) -> impl google_cloud_gax::paginator::Paginator<
2174 google_cloud_longrunning::model::ListOperationsResponse,
2175 crate::Error,
2176 > {
2177 use std::clone::Clone;
2178 let token = self.0.request.page_token.clone();
2179 let execute = move |token: String| {
2180 let mut builder = self.clone();
2181 builder.0.request = builder.0.request.set_page_token(token);
2182 builder.send()
2183 };
2184 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2185 }
2186
2187 pub fn by_item(
2189 self,
2190 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2191 google_cloud_longrunning::model::ListOperationsResponse,
2192 crate::Error,
2193 > {
2194 use google_cloud_gax::paginator::Paginator;
2195 self.by_page().items()
2196 }
2197
2198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2200 self.0.request.name = v.into();
2201 self
2202 }
2203
2204 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206 self.0.request.filter = v.into();
2207 self
2208 }
2209
2210 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2212 self.0.request.page_size = v.into();
2213 self
2214 }
2215
2216 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2218 self.0.request.page_token = v.into();
2219 self
2220 }
2221
2222 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2224 self.0.request.return_partial_success = v.into();
2225 self
2226 }
2227 }
2228
2229 #[doc(hidden)]
2230 impl crate::RequestBuilder for ListOperations {
2231 fn request_options(&mut self) -> &mut crate::RequestOptions {
2232 &mut self.0.options
2233 }
2234 }
2235
2236 #[derive(Clone, Debug)]
2253 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2254
2255 impl GetOperation {
2256 pub(crate) fn new(
2257 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2258 ) -> Self {
2259 Self(RequestBuilder::new(stub))
2260 }
2261
2262 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2264 mut self,
2265 v: V,
2266 ) -> Self {
2267 self.0.request = v.into();
2268 self
2269 }
2270
2271 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2273 self.0.options = v.into();
2274 self
2275 }
2276
2277 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2279 (*self.0.stub)
2280 .get_operation(self.0.request, self.0.options)
2281 .await
2282 .map(crate::Response::into_body)
2283 }
2284
2285 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2287 self.0.request.name = v.into();
2288 self
2289 }
2290 }
2291
2292 #[doc(hidden)]
2293 impl crate::RequestBuilder for GetOperation {
2294 fn request_options(&mut self) -> &mut crate::RequestOptions {
2295 &mut self.0.options
2296 }
2297 }
2298
2299 #[derive(Clone, Debug)]
2316 pub struct DeleteOperation(
2317 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2318 );
2319
2320 impl DeleteOperation {
2321 pub(crate) fn new(
2322 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2323 ) -> Self {
2324 Self(RequestBuilder::new(stub))
2325 }
2326
2327 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2329 mut self,
2330 v: V,
2331 ) -> Self {
2332 self.0.request = v.into();
2333 self
2334 }
2335
2336 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2338 self.0.options = v.into();
2339 self
2340 }
2341
2342 pub async fn send(self) -> Result<()> {
2344 (*self.0.stub)
2345 .delete_operation(self.0.request, self.0.options)
2346 .await
2347 .map(crate::Response::into_body)
2348 }
2349
2350 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2352 self.0.request.name = v.into();
2353 self
2354 }
2355 }
2356
2357 #[doc(hidden)]
2358 impl crate::RequestBuilder for DeleteOperation {
2359 fn request_options(&mut self) -> &mut crate::RequestOptions {
2360 &mut self.0.options
2361 }
2362 }
2363
2364 #[derive(Clone, Debug)]
2381 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
2382
2383 impl WaitOperation {
2384 pub(crate) fn new(
2385 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2386 ) -> Self {
2387 Self(RequestBuilder::new(stub))
2388 }
2389
2390 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
2392 mut self,
2393 v: V,
2394 ) -> Self {
2395 self.0.request = v.into();
2396 self
2397 }
2398
2399 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2401 self.0.options = v.into();
2402 self
2403 }
2404
2405 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2407 (*self.0.stub)
2408 .wait_operation(self.0.request, self.0.options)
2409 .await
2410 .map(crate::Response::into_body)
2411 }
2412
2413 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2415 self.0.request.name = v.into();
2416 self
2417 }
2418
2419 pub fn set_timeout<T>(mut self, v: T) -> Self
2421 where
2422 T: std::convert::Into<wkt::Duration>,
2423 {
2424 self.0.request.timeout = std::option::Option::Some(v.into());
2425 self
2426 }
2427
2428 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2430 where
2431 T: std::convert::Into<wkt::Duration>,
2432 {
2433 self.0.request.timeout = v.map(|x| x.into());
2434 self
2435 }
2436 }
2437
2438 #[doc(hidden)]
2439 impl crate::RequestBuilder for WaitOperation {
2440 fn request_options(&mut self) -> &mut crate::RequestOptions {
2441 &mut self.0.options
2442 }
2443 }
2444}
2445
2446pub mod jobs {
2448 use crate::Result;
2449
2450 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2464
2465 pub(crate) mod client {
2466 use super::super::super::client::Jobs;
2467 pub struct Factory;
2468 impl crate::ClientFactory for Factory {
2469 type Client = Jobs;
2470 type Credentials = gaxi::options::Credentials;
2471 async fn build(
2472 self,
2473 config: gaxi::options::ClientConfig,
2474 ) -> crate::ClientBuilderResult<Self::Client> {
2475 Self::Client::new(config).await
2476 }
2477 }
2478 }
2479
2480 #[derive(Clone, Debug)]
2482 pub(crate) struct RequestBuilder<R: std::default::Default> {
2483 stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
2484 request: R,
2485 options: crate::RequestOptions,
2486 }
2487
2488 impl<R> RequestBuilder<R>
2489 where
2490 R: std::default::Default,
2491 {
2492 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2493 Self {
2494 stub,
2495 request: R::default(),
2496 options: crate::RequestOptions::default(),
2497 }
2498 }
2499 }
2500
2501 #[derive(Clone, Debug)]
2519 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
2520
2521 impl CreateJob {
2522 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2523 Self(RequestBuilder::new(stub))
2524 }
2525
2526 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
2528 self.0.request = v.into();
2529 self
2530 }
2531
2532 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2534 self.0.options = v.into();
2535 self
2536 }
2537
2538 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2545 (*self.0.stub)
2546 .create_job(self.0.request, self.0.options)
2547 .await
2548 .map(crate::Response::into_body)
2549 }
2550
2551 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2553 type Operation =
2554 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2555 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2556 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2557
2558 let stub = self.0.stub.clone();
2559 let mut options = self.0.options.clone();
2560 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2561 let query = move |name| {
2562 let stub = stub.clone();
2563 let options = options.clone();
2564 async {
2565 let op = GetOperation::new(stub)
2566 .set_name(name)
2567 .with_options(options)
2568 .send()
2569 .await?;
2570 Ok(Operation::new(op))
2571 }
2572 };
2573
2574 let start = move || async {
2575 let op = self.send().await?;
2576 Ok(Operation::new(op))
2577 };
2578
2579 google_cloud_lro::internal::new_poller(
2580 polling_error_policy,
2581 polling_backoff_policy,
2582 start,
2583 query,
2584 )
2585 }
2586
2587 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2591 self.0.request.parent = v.into();
2592 self
2593 }
2594
2595 pub fn set_job<T>(mut self, v: T) -> Self
2599 where
2600 T: std::convert::Into<crate::model::Job>,
2601 {
2602 self.0.request.job = std::option::Option::Some(v.into());
2603 self
2604 }
2605
2606 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2610 where
2611 T: std::convert::Into<crate::model::Job>,
2612 {
2613 self.0.request.job = v.map(|x| x.into());
2614 self
2615 }
2616
2617 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2621 self.0.request.job_id = v.into();
2622 self
2623 }
2624
2625 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2627 self.0.request.validate_only = v.into();
2628 self
2629 }
2630 }
2631
2632 #[doc(hidden)]
2633 impl crate::RequestBuilder for CreateJob {
2634 fn request_options(&mut self) -> &mut crate::RequestOptions {
2635 &mut self.0.options
2636 }
2637 }
2638
2639 #[derive(Clone, Debug)]
2656 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
2657
2658 impl GetJob {
2659 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2660 Self(RequestBuilder::new(stub))
2661 }
2662
2663 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
2665 self.0.request = v.into();
2666 self
2667 }
2668
2669 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2671 self.0.options = v.into();
2672 self
2673 }
2674
2675 pub async fn send(self) -> Result<crate::model::Job> {
2677 (*self.0.stub)
2678 .get_job(self.0.request, self.0.options)
2679 .await
2680 .map(crate::Response::into_body)
2681 }
2682
2683 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2687 self.0.request.name = v.into();
2688 self
2689 }
2690 }
2691
2692 #[doc(hidden)]
2693 impl crate::RequestBuilder for GetJob {
2694 fn request_options(&mut self) -> &mut crate::RequestOptions {
2695 &mut self.0.options
2696 }
2697 }
2698
2699 #[derive(Clone, Debug)]
2720 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
2721
2722 impl ListJobs {
2723 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2724 Self(RequestBuilder::new(stub))
2725 }
2726
2727 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
2729 self.0.request = v.into();
2730 self
2731 }
2732
2733 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2735 self.0.options = v.into();
2736 self
2737 }
2738
2739 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
2741 (*self.0.stub)
2742 .list_jobs(self.0.request, self.0.options)
2743 .await
2744 .map(crate::Response::into_body)
2745 }
2746
2747 pub fn by_page(
2749 self,
2750 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
2751 {
2752 use std::clone::Clone;
2753 let token = self.0.request.page_token.clone();
2754 let execute = move |token: String| {
2755 let mut builder = self.clone();
2756 builder.0.request = builder.0.request.set_page_token(token);
2757 builder.send()
2758 };
2759 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2760 }
2761
2762 pub fn by_item(
2764 self,
2765 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
2766 {
2767 use google_cloud_gax::paginator::Paginator;
2768 self.by_page().items()
2769 }
2770
2771 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2775 self.0.request.parent = v.into();
2776 self
2777 }
2778
2779 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2781 self.0.request.page_size = v.into();
2782 self
2783 }
2784
2785 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2787 self.0.request.page_token = v.into();
2788 self
2789 }
2790
2791 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2793 self.0.request.show_deleted = v.into();
2794 self
2795 }
2796 }
2797
2798 #[doc(hidden)]
2799 impl crate::RequestBuilder for ListJobs {
2800 fn request_options(&mut self) -> &mut crate::RequestOptions {
2801 &mut self.0.options
2802 }
2803 }
2804
2805 #[derive(Clone, Debug)]
2823 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
2824
2825 impl UpdateJob {
2826 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2827 Self(RequestBuilder::new(stub))
2828 }
2829
2830 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
2832 self.0.request = v.into();
2833 self
2834 }
2835
2836 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2838 self.0.options = v.into();
2839 self
2840 }
2841
2842 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2849 (*self.0.stub)
2850 .update_job(self.0.request, self.0.options)
2851 .await
2852 .map(crate::Response::into_body)
2853 }
2854
2855 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2857 type Operation =
2858 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2859 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2860 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2861
2862 let stub = self.0.stub.clone();
2863 let mut options = self.0.options.clone();
2864 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2865 let query = move |name| {
2866 let stub = stub.clone();
2867 let options = options.clone();
2868 async {
2869 let op = GetOperation::new(stub)
2870 .set_name(name)
2871 .with_options(options)
2872 .send()
2873 .await?;
2874 Ok(Operation::new(op))
2875 }
2876 };
2877
2878 let start = move || async {
2879 let op = self.send().await?;
2880 Ok(Operation::new(op))
2881 };
2882
2883 google_cloud_lro::internal::new_poller(
2884 polling_error_policy,
2885 polling_backoff_policy,
2886 start,
2887 query,
2888 )
2889 }
2890
2891 pub fn set_job<T>(mut self, v: T) -> Self
2895 where
2896 T: std::convert::Into<crate::model::Job>,
2897 {
2898 self.0.request.job = std::option::Option::Some(v.into());
2899 self
2900 }
2901
2902 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2906 where
2907 T: std::convert::Into<crate::model::Job>,
2908 {
2909 self.0.request.job = v.map(|x| x.into());
2910 self
2911 }
2912
2913 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2915 self.0.request.validate_only = v.into();
2916 self
2917 }
2918
2919 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2921 self.0.request.allow_missing = v.into();
2922 self
2923 }
2924 }
2925
2926 #[doc(hidden)]
2927 impl crate::RequestBuilder for UpdateJob {
2928 fn request_options(&mut self) -> &mut crate::RequestOptions {
2929 &mut self.0.options
2930 }
2931 }
2932
2933 #[derive(Clone, Debug)]
2951 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
2952
2953 impl DeleteJob {
2954 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2955 Self(RequestBuilder::new(stub))
2956 }
2957
2958 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
2960 self.0.request = v.into();
2961 self
2962 }
2963
2964 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2966 self.0.options = v.into();
2967 self
2968 }
2969
2970 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2977 (*self.0.stub)
2978 .delete_job(self.0.request, self.0.options)
2979 .await
2980 .map(crate::Response::into_body)
2981 }
2982
2983 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2985 type Operation =
2986 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2987 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2988 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2989
2990 let stub = self.0.stub.clone();
2991 let mut options = self.0.options.clone();
2992 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2993 let query = move |name| {
2994 let stub = stub.clone();
2995 let options = options.clone();
2996 async {
2997 let op = GetOperation::new(stub)
2998 .set_name(name)
2999 .with_options(options)
3000 .send()
3001 .await?;
3002 Ok(Operation::new(op))
3003 }
3004 };
3005
3006 let start = move || async {
3007 let op = self.send().await?;
3008 Ok(Operation::new(op))
3009 };
3010
3011 google_cloud_lro::internal::new_poller(
3012 polling_error_policy,
3013 polling_backoff_policy,
3014 start,
3015 query,
3016 )
3017 }
3018
3019 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3023 self.0.request.name = v.into();
3024 self
3025 }
3026
3027 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3029 self.0.request.validate_only = v.into();
3030 self
3031 }
3032
3033 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3035 self.0.request.etag = v.into();
3036 self
3037 }
3038 }
3039
3040 #[doc(hidden)]
3041 impl crate::RequestBuilder for DeleteJob {
3042 fn request_options(&mut self) -> &mut crate::RequestOptions {
3043 &mut self.0.options
3044 }
3045 }
3046
3047 #[derive(Clone, Debug)]
3065 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
3066
3067 impl RunJob {
3068 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3069 Self(RequestBuilder::new(stub))
3070 }
3071
3072 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
3074 self.0.request = v.into();
3075 self
3076 }
3077
3078 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3080 self.0.options = v.into();
3081 self
3082 }
3083
3084 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3091 (*self.0.stub)
3092 .run_job(self.0.request, self.0.options)
3093 .await
3094 .map(crate::Response::into_body)
3095 }
3096
3097 pub fn poller(
3099 self,
3100 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
3101 {
3102 type Operation = google_cloud_lro::internal::Operation<
3103 crate::model::Execution,
3104 crate::model::Execution,
3105 >;
3106 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3107 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3108
3109 let stub = self.0.stub.clone();
3110 let mut options = self.0.options.clone();
3111 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3112 let query = move |name| {
3113 let stub = stub.clone();
3114 let options = options.clone();
3115 async {
3116 let op = GetOperation::new(stub)
3117 .set_name(name)
3118 .with_options(options)
3119 .send()
3120 .await?;
3121 Ok(Operation::new(op))
3122 }
3123 };
3124
3125 let start = move || async {
3126 let op = self.send().await?;
3127 Ok(Operation::new(op))
3128 };
3129
3130 google_cloud_lro::internal::new_poller(
3131 polling_error_policy,
3132 polling_backoff_policy,
3133 start,
3134 query,
3135 )
3136 }
3137
3138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3142 self.0.request.name = v.into();
3143 self
3144 }
3145
3146 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3148 self.0.request.validate_only = v.into();
3149 self
3150 }
3151
3152 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3154 self.0.request.etag = v.into();
3155 self
3156 }
3157
3158 pub fn set_overrides<T>(mut self, v: T) -> Self
3160 where
3161 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3162 {
3163 self.0.request.overrides = std::option::Option::Some(v.into());
3164 self
3165 }
3166
3167 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
3169 where
3170 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3171 {
3172 self.0.request.overrides = v.map(|x| x.into());
3173 self
3174 }
3175 }
3176
3177 #[doc(hidden)]
3178 impl crate::RequestBuilder for RunJob {
3179 fn request_options(&mut self) -> &mut crate::RequestOptions {
3180 &mut self.0.options
3181 }
3182 }
3183
3184 #[derive(Clone, Debug)]
3201 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3202
3203 impl GetIamPolicy {
3204 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3205 Self(RequestBuilder::new(stub))
3206 }
3207
3208 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3210 mut self,
3211 v: V,
3212 ) -> Self {
3213 self.0.request = v.into();
3214 self
3215 }
3216
3217 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3219 self.0.options = v.into();
3220 self
3221 }
3222
3223 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3225 (*self.0.stub)
3226 .get_iam_policy(self.0.request, self.0.options)
3227 .await
3228 .map(crate::Response::into_body)
3229 }
3230
3231 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3235 self.0.request.resource = v.into();
3236 self
3237 }
3238
3239 pub fn set_options<T>(mut self, v: T) -> Self
3241 where
3242 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3243 {
3244 self.0.request.options = std::option::Option::Some(v.into());
3245 self
3246 }
3247
3248 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3250 where
3251 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3252 {
3253 self.0.request.options = v.map(|x| x.into());
3254 self
3255 }
3256 }
3257
3258 #[doc(hidden)]
3259 impl crate::RequestBuilder for GetIamPolicy {
3260 fn request_options(&mut self) -> &mut crate::RequestOptions {
3261 &mut self.0.options
3262 }
3263 }
3264
3265 #[derive(Clone, Debug)]
3282 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3283
3284 impl SetIamPolicy {
3285 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3286 Self(RequestBuilder::new(stub))
3287 }
3288
3289 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3291 mut self,
3292 v: V,
3293 ) -> Self {
3294 self.0.request = v.into();
3295 self
3296 }
3297
3298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3300 self.0.options = v.into();
3301 self
3302 }
3303
3304 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3306 (*self.0.stub)
3307 .set_iam_policy(self.0.request, self.0.options)
3308 .await
3309 .map(crate::Response::into_body)
3310 }
3311
3312 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3316 self.0.request.resource = v.into();
3317 self
3318 }
3319
3320 pub fn set_policy<T>(mut self, v: T) -> Self
3324 where
3325 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3326 {
3327 self.0.request.policy = std::option::Option::Some(v.into());
3328 self
3329 }
3330
3331 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3335 where
3336 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3337 {
3338 self.0.request.policy = v.map(|x| x.into());
3339 self
3340 }
3341
3342 pub fn set_update_mask<T>(mut self, v: T) -> Self
3344 where
3345 T: std::convert::Into<wkt::FieldMask>,
3346 {
3347 self.0.request.update_mask = std::option::Option::Some(v.into());
3348 self
3349 }
3350
3351 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3353 where
3354 T: std::convert::Into<wkt::FieldMask>,
3355 {
3356 self.0.request.update_mask = v.map(|x| x.into());
3357 self
3358 }
3359 }
3360
3361 #[doc(hidden)]
3362 impl crate::RequestBuilder for SetIamPolicy {
3363 fn request_options(&mut self) -> &mut crate::RequestOptions {
3364 &mut self.0.options
3365 }
3366 }
3367
3368 #[derive(Clone, Debug)]
3385 pub struct TestIamPermissions(
3386 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3387 );
3388
3389 impl TestIamPermissions {
3390 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3391 Self(RequestBuilder::new(stub))
3392 }
3393
3394 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3396 mut self,
3397 v: V,
3398 ) -> Self {
3399 self.0.request = v.into();
3400 self
3401 }
3402
3403 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3405 self.0.options = v.into();
3406 self
3407 }
3408
3409 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3411 (*self.0.stub)
3412 .test_iam_permissions(self.0.request, self.0.options)
3413 .await
3414 .map(crate::Response::into_body)
3415 }
3416
3417 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3421 self.0.request.resource = v.into();
3422 self
3423 }
3424
3425 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3429 where
3430 T: std::iter::IntoIterator<Item = V>,
3431 V: std::convert::Into<std::string::String>,
3432 {
3433 use std::iter::Iterator;
3434 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3435 self
3436 }
3437 }
3438
3439 #[doc(hidden)]
3440 impl crate::RequestBuilder for TestIamPermissions {
3441 fn request_options(&mut self) -> &mut crate::RequestOptions {
3442 &mut self.0.options
3443 }
3444 }
3445
3446 #[derive(Clone, Debug)]
3467 pub struct ListOperations(
3468 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3469 );
3470
3471 impl ListOperations {
3472 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3473 Self(RequestBuilder::new(stub))
3474 }
3475
3476 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3478 mut self,
3479 v: V,
3480 ) -> Self {
3481 self.0.request = v.into();
3482 self
3483 }
3484
3485 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3487 self.0.options = v.into();
3488 self
3489 }
3490
3491 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3493 (*self.0.stub)
3494 .list_operations(self.0.request, self.0.options)
3495 .await
3496 .map(crate::Response::into_body)
3497 }
3498
3499 pub fn by_page(
3501 self,
3502 ) -> impl google_cloud_gax::paginator::Paginator<
3503 google_cloud_longrunning::model::ListOperationsResponse,
3504 crate::Error,
3505 > {
3506 use std::clone::Clone;
3507 let token = self.0.request.page_token.clone();
3508 let execute = move |token: String| {
3509 let mut builder = self.clone();
3510 builder.0.request = builder.0.request.set_page_token(token);
3511 builder.send()
3512 };
3513 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3514 }
3515
3516 pub fn by_item(
3518 self,
3519 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3520 google_cloud_longrunning::model::ListOperationsResponse,
3521 crate::Error,
3522 > {
3523 use google_cloud_gax::paginator::Paginator;
3524 self.by_page().items()
3525 }
3526
3527 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3529 self.0.request.name = v.into();
3530 self
3531 }
3532
3533 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3535 self.0.request.filter = v.into();
3536 self
3537 }
3538
3539 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3541 self.0.request.page_size = v.into();
3542 self
3543 }
3544
3545 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3547 self.0.request.page_token = v.into();
3548 self
3549 }
3550
3551 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3553 self.0.request.return_partial_success = v.into();
3554 self
3555 }
3556 }
3557
3558 #[doc(hidden)]
3559 impl crate::RequestBuilder for ListOperations {
3560 fn request_options(&mut self) -> &mut crate::RequestOptions {
3561 &mut self.0.options
3562 }
3563 }
3564
3565 #[derive(Clone, Debug)]
3582 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3583
3584 impl GetOperation {
3585 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3586 Self(RequestBuilder::new(stub))
3587 }
3588
3589 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3591 mut self,
3592 v: V,
3593 ) -> Self {
3594 self.0.request = v.into();
3595 self
3596 }
3597
3598 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3600 self.0.options = v.into();
3601 self
3602 }
3603
3604 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3606 (*self.0.stub)
3607 .get_operation(self.0.request, self.0.options)
3608 .await
3609 .map(crate::Response::into_body)
3610 }
3611
3612 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3614 self.0.request.name = v.into();
3615 self
3616 }
3617 }
3618
3619 #[doc(hidden)]
3620 impl crate::RequestBuilder for GetOperation {
3621 fn request_options(&mut self) -> &mut crate::RequestOptions {
3622 &mut self.0.options
3623 }
3624 }
3625
3626 #[derive(Clone, Debug)]
3643 pub struct DeleteOperation(
3644 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3645 );
3646
3647 impl DeleteOperation {
3648 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3649 Self(RequestBuilder::new(stub))
3650 }
3651
3652 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3654 mut self,
3655 v: V,
3656 ) -> Self {
3657 self.0.request = v.into();
3658 self
3659 }
3660
3661 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3663 self.0.options = v.into();
3664 self
3665 }
3666
3667 pub async fn send(self) -> Result<()> {
3669 (*self.0.stub)
3670 .delete_operation(self.0.request, self.0.options)
3671 .await
3672 .map(crate::Response::into_body)
3673 }
3674
3675 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3677 self.0.request.name = v.into();
3678 self
3679 }
3680 }
3681
3682 #[doc(hidden)]
3683 impl crate::RequestBuilder for DeleteOperation {
3684 fn request_options(&mut self) -> &mut crate::RequestOptions {
3685 &mut self.0.options
3686 }
3687 }
3688
3689 #[derive(Clone, Debug)]
3706 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
3707
3708 impl WaitOperation {
3709 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3710 Self(RequestBuilder::new(stub))
3711 }
3712
3713 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
3715 mut self,
3716 v: V,
3717 ) -> Self {
3718 self.0.request = v.into();
3719 self
3720 }
3721
3722 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3724 self.0.options = v.into();
3725 self
3726 }
3727
3728 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3730 (*self.0.stub)
3731 .wait_operation(self.0.request, self.0.options)
3732 .await
3733 .map(crate::Response::into_body)
3734 }
3735
3736 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3738 self.0.request.name = v.into();
3739 self
3740 }
3741
3742 pub fn set_timeout<T>(mut self, v: T) -> Self
3744 where
3745 T: std::convert::Into<wkt::Duration>,
3746 {
3747 self.0.request.timeout = std::option::Option::Some(v.into());
3748 self
3749 }
3750
3751 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3753 where
3754 T: std::convert::Into<wkt::Duration>,
3755 {
3756 self.0.request.timeout = v.map(|x| x.into());
3757 self
3758 }
3759 }
3760
3761 #[doc(hidden)]
3762 impl crate::RequestBuilder for WaitOperation {
3763 fn request_options(&mut self) -> &mut crate::RequestOptions {
3764 &mut self.0.options
3765 }
3766 }
3767}
3768
3769pub mod revisions {
3771 use crate::Result;
3772
3773 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3787
3788 pub(crate) mod client {
3789 use super::super::super::client::Revisions;
3790 pub struct Factory;
3791 impl crate::ClientFactory for Factory {
3792 type Client = Revisions;
3793 type Credentials = gaxi::options::Credentials;
3794 async fn build(
3795 self,
3796 config: gaxi::options::ClientConfig,
3797 ) -> crate::ClientBuilderResult<Self::Client> {
3798 Self::Client::new(config).await
3799 }
3800 }
3801 }
3802
3803 #[derive(Clone, Debug)]
3805 pub(crate) struct RequestBuilder<R: std::default::Default> {
3806 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3807 request: R,
3808 options: crate::RequestOptions,
3809 }
3810
3811 impl<R> RequestBuilder<R>
3812 where
3813 R: std::default::Default,
3814 {
3815 pub(crate) fn new(
3816 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3817 ) -> Self {
3818 Self {
3819 stub,
3820 request: R::default(),
3821 options: crate::RequestOptions::default(),
3822 }
3823 }
3824 }
3825
3826 #[derive(Clone, Debug)]
3843 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
3844
3845 impl GetRevision {
3846 pub(crate) fn new(
3847 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3848 ) -> Self {
3849 Self(RequestBuilder::new(stub))
3850 }
3851
3852 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
3854 self.0.request = v.into();
3855 self
3856 }
3857
3858 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3860 self.0.options = v.into();
3861 self
3862 }
3863
3864 pub async fn send(self) -> Result<crate::model::Revision> {
3866 (*self.0.stub)
3867 .get_revision(self.0.request, self.0.options)
3868 .await
3869 .map(crate::Response::into_body)
3870 }
3871
3872 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3876 self.0.request.name = v.into();
3877 self
3878 }
3879 }
3880
3881 #[doc(hidden)]
3882 impl crate::RequestBuilder for GetRevision {
3883 fn request_options(&mut self) -> &mut crate::RequestOptions {
3884 &mut self.0.options
3885 }
3886 }
3887
3888 #[derive(Clone, Debug)]
3909 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
3910
3911 impl ListRevisions {
3912 pub(crate) fn new(
3913 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3914 ) -> Self {
3915 Self(RequestBuilder::new(stub))
3916 }
3917
3918 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
3920 self.0.request = v.into();
3921 self
3922 }
3923
3924 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3926 self.0.options = v.into();
3927 self
3928 }
3929
3930 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
3932 (*self.0.stub)
3933 .list_revisions(self.0.request, self.0.options)
3934 .await
3935 .map(crate::Response::into_body)
3936 }
3937
3938 pub fn by_page(
3940 self,
3941 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRevisionsResponse, crate::Error>
3942 {
3943 use std::clone::Clone;
3944 let token = self.0.request.page_token.clone();
3945 let execute = move |token: String| {
3946 let mut builder = self.clone();
3947 builder.0.request = builder.0.request.set_page_token(token);
3948 builder.send()
3949 };
3950 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3951 }
3952
3953 pub fn by_item(
3955 self,
3956 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3957 crate::model::ListRevisionsResponse,
3958 crate::Error,
3959 > {
3960 use google_cloud_gax::paginator::Paginator;
3961 self.by_page().items()
3962 }
3963
3964 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3968 self.0.request.parent = v.into();
3969 self
3970 }
3971
3972 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3974 self.0.request.page_size = v.into();
3975 self
3976 }
3977
3978 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3980 self.0.request.page_token = v.into();
3981 self
3982 }
3983
3984 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3986 self.0.request.show_deleted = v.into();
3987 self
3988 }
3989 }
3990
3991 #[doc(hidden)]
3992 impl crate::RequestBuilder for ListRevisions {
3993 fn request_options(&mut self) -> &mut crate::RequestOptions {
3994 &mut self.0.options
3995 }
3996 }
3997
3998 #[derive(Clone, Debug)]
4016 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
4017
4018 impl DeleteRevision {
4019 pub(crate) fn new(
4020 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4021 ) -> Self {
4022 Self(RequestBuilder::new(stub))
4023 }
4024
4025 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
4027 self.0.request = v.into();
4028 self
4029 }
4030
4031 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4033 self.0.options = v.into();
4034 self
4035 }
4036
4037 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4044 (*self.0.stub)
4045 .delete_revision(self.0.request, self.0.options)
4046 .await
4047 .map(crate::Response::into_body)
4048 }
4049
4050 pub fn poller(
4052 self,
4053 ) -> impl google_cloud_lro::Poller<crate::model::Revision, crate::model::Revision> {
4054 type Operation = google_cloud_lro::internal::Operation<
4055 crate::model::Revision,
4056 crate::model::Revision,
4057 >;
4058 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4059 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4060
4061 let stub = self.0.stub.clone();
4062 let mut options = self.0.options.clone();
4063 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4064 let query = move |name| {
4065 let stub = stub.clone();
4066 let options = options.clone();
4067 async {
4068 let op = GetOperation::new(stub)
4069 .set_name(name)
4070 .with_options(options)
4071 .send()
4072 .await?;
4073 Ok(Operation::new(op))
4074 }
4075 };
4076
4077 let start = move || async {
4078 let op = self.send().await?;
4079 Ok(Operation::new(op))
4080 };
4081
4082 google_cloud_lro::internal::new_poller(
4083 polling_error_policy,
4084 polling_backoff_policy,
4085 start,
4086 query,
4087 )
4088 }
4089
4090 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4094 self.0.request.name = v.into();
4095 self
4096 }
4097
4098 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4100 self.0.request.validate_only = v.into();
4101 self
4102 }
4103
4104 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4106 self.0.request.etag = v.into();
4107 self
4108 }
4109 }
4110
4111 #[doc(hidden)]
4112 impl crate::RequestBuilder for DeleteRevision {
4113 fn request_options(&mut self) -> &mut crate::RequestOptions {
4114 &mut self.0.options
4115 }
4116 }
4117
4118 #[derive(Clone, Debug)]
4139 pub struct ListOperations(
4140 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4141 );
4142
4143 impl ListOperations {
4144 pub(crate) fn new(
4145 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4146 ) -> Self {
4147 Self(RequestBuilder::new(stub))
4148 }
4149
4150 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4152 mut self,
4153 v: V,
4154 ) -> Self {
4155 self.0.request = v.into();
4156 self
4157 }
4158
4159 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4161 self.0.options = v.into();
4162 self
4163 }
4164
4165 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4167 (*self.0.stub)
4168 .list_operations(self.0.request, self.0.options)
4169 .await
4170 .map(crate::Response::into_body)
4171 }
4172
4173 pub fn by_page(
4175 self,
4176 ) -> impl google_cloud_gax::paginator::Paginator<
4177 google_cloud_longrunning::model::ListOperationsResponse,
4178 crate::Error,
4179 > {
4180 use std::clone::Clone;
4181 let token = self.0.request.page_token.clone();
4182 let execute = move |token: String| {
4183 let mut builder = self.clone();
4184 builder.0.request = builder.0.request.set_page_token(token);
4185 builder.send()
4186 };
4187 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4188 }
4189
4190 pub fn by_item(
4192 self,
4193 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4194 google_cloud_longrunning::model::ListOperationsResponse,
4195 crate::Error,
4196 > {
4197 use google_cloud_gax::paginator::Paginator;
4198 self.by_page().items()
4199 }
4200
4201 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4203 self.0.request.name = v.into();
4204 self
4205 }
4206
4207 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4209 self.0.request.filter = v.into();
4210 self
4211 }
4212
4213 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4215 self.0.request.page_size = v.into();
4216 self
4217 }
4218
4219 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4221 self.0.request.page_token = v.into();
4222 self
4223 }
4224
4225 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4227 self.0.request.return_partial_success = v.into();
4228 self
4229 }
4230 }
4231
4232 #[doc(hidden)]
4233 impl crate::RequestBuilder for ListOperations {
4234 fn request_options(&mut self) -> &mut crate::RequestOptions {
4235 &mut self.0.options
4236 }
4237 }
4238
4239 #[derive(Clone, Debug)]
4256 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4257
4258 impl GetOperation {
4259 pub(crate) fn new(
4260 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4261 ) -> Self {
4262 Self(RequestBuilder::new(stub))
4263 }
4264
4265 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4267 mut self,
4268 v: V,
4269 ) -> Self {
4270 self.0.request = v.into();
4271 self
4272 }
4273
4274 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4276 self.0.options = v.into();
4277 self
4278 }
4279
4280 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4282 (*self.0.stub)
4283 .get_operation(self.0.request, self.0.options)
4284 .await
4285 .map(crate::Response::into_body)
4286 }
4287
4288 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4290 self.0.request.name = v.into();
4291 self
4292 }
4293 }
4294
4295 #[doc(hidden)]
4296 impl crate::RequestBuilder for GetOperation {
4297 fn request_options(&mut self) -> &mut crate::RequestOptions {
4298 &mut self.0.options
4299 }
4300 }
4301
4302 #[derive(Clone, Debug)]
4319 pub struct DeleteOperation(
4320 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
4321 );
4322
4323 impl DeleteOperation {
4324 pub(crate) fn new(
4325 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4326 ) -> Self {
4327 Self(RequestBuilder::new(stub))
4328 }
4329
4330 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
4332 mut self,
4333 v: V,
4334 ) -> Self {
4335 self.0.request = v.into();
4336 self
4337 }
4338
4339 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4341 self.0.options = v.into();
4342 self
4343 }
4344
4345 pub async fn send(self) -> Result<()> {
4347 (*self.0.stub)
4348 .delete_operation(self.0.request, self.0.options)
4349 .await
4350 .map(crate::Response::into_body)
4351 }
4352
4353 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4355 self.0.request.name = v.into();
4356 self
4357 }
4358 }
4359
4360 #[doc(hidden)]
4361 impl crate::RequestBuilder for DeleteOperation {
4362 fn request_options(&mut self) -> &mut crate::RequestOptions {
4363 &mut self.0.options
4364 }
4365 }
4366
4367 #[derive(Clone, Debug)]
4384 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
4385
4386 impl WaitOperation {
4387 pub(crate) fn new(
4388 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4389 ) -> Self {
4390 Self(RequestBuilder::new(stub))
4391 }
4392
4393 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
4395 mut self,
4396 v: V,
4397 ) -> Self {
4398 self.0.request = v.into();
4399 self
4400 }
4401
4402 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4404 self.0.options = v.into();
4405 self
4406 }
4407
4408 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4410 (*self.0.stub)
4411 .wait_operation(self.0.request, self.0.options)
4412 .await
4413 .map(crate::Response::into_body)
4414 }
4415
4416 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4418 self.0.request.name = v.into();
4419 self
4420 }
4421
4422 pub fn set_timeout<T>(mut self, v: T) -> Self
4424 where
4425 T: std::convert::Into<wkt::Duration>,
4426 {
4427 self.0.request.timeout = std::option::Option::Some(v.into());
4428 self
4429 }
4430
4431 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4433 where
4434 T: std::convert::Into<wkt::Duration>,
4435 {
4436 self.0.request.timeout = v.map(|x| x.into());
4437 self
4438 }
4439 }
4440
4441 #[doc(hidden)]
4442 impl crate::RequestBuilder for WaitOperation {
4443 fn request_options(&mut self) -> &mut crate::RequestOptions {
4444 &mut self.0.options
4445 }
4446 }
4447}
4448
4449pub mod services {
4451 use crate::Result;
4452
4453 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4467
4468 pub(crate) mod client {
4469 use super::super::super::client::Services;
4470 pub struct Factory;
4471 impl crate::ClientFactory for Factory {
4472 type Client = Services;
4473 type Credentials = gaxi::options::Credentials;
4474 async fn build(
4475 self,
4476 config: gaxi::options::ClientConfig,
4477 ) -> crate::ClientBuilderResult<Self::Client> {
4478 Self::Client::new(config).await
4479 }
4480 }
4481 }
4482
4483 #[derive(Clone, Debug)]
4485 pub(crate) struct RequestBuilder<R: std::default::Default> {
4486 stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
4487 request: R,
4488 options: crate::RequestOptions,
4489 }
4490
4491 impl<R> RequestBuilder<R>
4492 where
4493 R: std::default::Default,
4494 {
4495 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4496 Self {
4497 stub,
4498 request: R::default(),
4499 options: crate::RequestOptions::default(),
4500 }
4501 }
4502 }
4503
4504 #[derive(Clone, Debug)]
4522 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
4523
4524 impl CreateService {
4525 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4526 Self(RequestBuilder::new(stub))
4527 }
4528
4529 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
4531 self.0.request = v.into();
4532 self
4533 }
4534
4535 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4537 self.0.options = v.into();
4538 self
4539 }
4540
4541 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4548 (*self.0.stub)
4549 .create_service(self.0.request, self.0.options)
4550 .await
4551 .map(crate::Response::into_body)
4552 }
4553
4554 pub fn poller(
4556 self,
4557 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4558 type Operation =
4559 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4560 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4561 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4562
4563 let stub = self.0.stub.clone();
4564 let mut options = self.0.options.clone();
4565 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4566 let query = move |name| {
4567 let stub = stub.clone();
4568 let options = options.clone();
4569 async {
4570 let op = GetOperation::new(stub)
4571 .set_name(name)
4572 .with_options(options)
4573 .send()
4574 .await?;
4575 Ok(Operation::new(op))
4576 }
4577 };
4578
4579 let start = move || async {
4580 let op = self.send().await?;
4581 Ok(Operation::new(op))
4582 };
4583
4584 google_cloud_lro::internal::new_poller(
4585 polling_error_policy,
4586 polling_backoff_policy,
4587 start,
4588 query,
4589 )
4590 }
4591
4592 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4596 self.0.request.parent = v.into();
4597 self
4598 }
4599
4600 pub fn set_service<T>(mut self, v: T) -> Self
4604 where
4605 T: std::convert::Into<crate::model::Service>,
4606 {
4607 self.0.request.service = std::option::Option::Some(v.into());
4608 self
4609 }
4610
4611 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4615 where
4616 T: std::convert::Into<crate::model::Service>,
4617 {
4618 self.0.request.service = v.map(|x| x.into());
4619 self
4620 }
4621
4622 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4626 self.0.request.service_id = v.into();
4627 self
4628 }
4629
4630 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4632 self.0.request.validate_only = v.into();
4633 self
4634 }
4635 }
4636
4637 #[doc(hidden)]
4638 impl crate::RequestBuilder for CreateService {
4639 fn request_options(&mut self) -> &mut crate::RequestOptions {
4640 &mut self.0.options
4641 }
4642 }
4643
4644 #[derive(Clone, Debug)]
4661 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
4662
4663 impl GetService {
4664 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4665 Self(RequestBuilder::new(stub))
4666 }
4667
4668 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
4670 self.0.request = v.into();
4671 self
4672 }
4673
4674 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4676 self.0.options = v.into();
4677 self
4678 }
4679
4680 pub async fn send(self) -> Result<crate::model::Service> {
4682 (*self.0.stub)
4683 .get_service(self.0.request, self.0.options)
4684 .await
4685 .map(crate::Response::into_body)
4686 }
4687
4688 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4692 self.0.request.name = v.into();
4693 self
4694 }
4695 }
4696
4697 #[doc(hidden)]
4698 impl crate::RequestBuilder for GetService {
4699 fn request_options(&mut self) -> &mut crate::RequestOptions {
4700 &mut self.0.options
4701 }
4702 }
4703
4704 #[derive(Clone, Debug)]
4725 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
4726
4727 impl ListServices {
4728 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4729 Self(RequestBuilder::new(stub))
4730 }
4731
4732 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
4734 self.0.request = v.into();
4735 self
4736 }
4737
4738 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4740 self.0.options = v.into();
4741 self
4742 }
4743
4744 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
4746 (*self.0.stub)
4747 .list_services(self.0.request, self.0.options)
4748 .await
4749 .map(crate::Response::into_body)
4750 }
4751
4752 pub fn by_page(
4754 self,
4755 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListServicesResponse, crate::Error>
4756 {
4757 use std::clone::Clone;
4758 let token = self.0.request.page_token.clone();
4759 let execute = move |token: String| {
4760 let mut builder = self.clone();
4761 builder.0.request = builder.0.request.set_page_token(token);
4762 builder.send()
4763 };
4764 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4765 }
4766
4767 pub fn by_item(
4769 self,
4770 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4771 crate::model::ListServicesResponse,
4772 crate::Error,
4773 > {
4774 use google_cloud_gax::paginator::Paginator;
4775 self.by_page().items()
4776 }
4777
4778 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4782 self.0.request.parent = v.into();
4783 self
4784 }
4785
4786 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4788 self.0.request.page_size = v.into();
4789 self
4790 }
4791
4792 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4794 self.0.request.page_token = v.into();
4795 self
4796 }
4797
4798 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4800 self.0.request.show_deleted = v.into();
4801 self
4802 }
4803 }
4804
4805 #[doc(hidden)]
4806 impl crate::RequestBuilder for ListServices {
4807 fn request_options(&mut self) -> &mut crate::RequestOptions {
4808 &mut self.0.options
4809 }
4810 }
4811
4812 #[derive(Clone, Debug)]
4830 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
4831
4832 impl UpdateService {
4833 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4834 Self(RequestBuilder::new(stub))
4835 }
4836
4837 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
4839 self.0.request = v.into();
4840 self
4841 }
4842
4843 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4845 self.0.options = v.into();
4846 self
4847 }
4848
4849 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4856 (*self.0.stub)
4857 .update_service(self.0.request, self.0.options)
4858 .await
4859 .map(crate::Response::into_body)
4860 }
4861
4862 pub fn poller(
4864 self,
4865 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4866 type Operation =
4867 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4868 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4869 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4870
4871 let stub = self.0.stub.clone();
4872 let mut options = self.0.options.clone();
4873 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4874 let query = move |name| {
4875 let stub = stub.clone();
4876 let options = options.clone();
4877 async {
4878 let op = GetOperation::new(stub)
4879 .set_name(name)
4880 .with_options(options)
4881 .send()
4882 .await?;
4883 Ok(Operation::new(op))
4884 }
4885 };
4886
4887 let start = move || async {
4888 let op = self.send().await?;
4889 Ok(Operation::new(op))
4890 };
4891
4892 google_cloud_lro::internal::new_poller(
4893 polling_error_policy,
4894 polling_backoff_policy,
4895 start,
4896 query,
4897 )
4898 }
4899
4900 pub fn set_update_mask<T>(mut self, v: T) -> Self
4902 where
4903 T: std::convert::Into<wkt::FieldMask>,
4904 {
4905 self.0.request.update_mask = std::option::Option::Some(v.into());
4906 self
4907 }
4908
4909 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4911 where
4912 T: std::convert::Into<wkt::FieldMask>,
4913 {
4914 self.0.request.update_mask = v.map(|x| x.into());
4915 self
4916 }
4917
4918 pub fn set_service<T>(mut self, v: T) -> Self
4922 where
4923 T: std::convert::Into<crate::model::Service>,
4924 {
4925 self.0.request.service = std::option::Option::Some(v.into());
4926 self
4927 }
4928
4929 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4933 where
4934 T: std::convert::Into<crate::model::Service>,
4935 {
4936 self.0.request.service = v.map(|x| x.into());
4937 self
4938 }
4939
4940 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4942 self.0.request.validate_only = v.into();
4943 self
4944 }
4945
4946 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
4948 self.0.request.allow_missing = v.into();
4949 self
4950 }
4951 }
4952
4953 #[doc(hidden)]
4954 impl crate::RequestBuilder for UpdateService {
4955 fn request_options(&mut self) -> &mut crate::RequestOptions {
4956 &mut self.0.options
4957 }
4958 }
4959
4960 #[derive(Clone, Debug)]
4978 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
4979
4980 impl DeleteService {
4981 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4982 Self(RequestBuilder::new(stub))
4983 }
4984
4985 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
4987 self.0.request = v.into();
4988 self
4989 }
4990
4991 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4993 self.0.options = v.into();
4994 self
4995 }
4996
4997 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5004 (*self.0.stub)
5005 .delete_service(self.0.request, self.0.options)
5006 .await
5007 .map(crate::Response::into_body)
5008 }
5009
5010 pub fn poller(
5012 self,
5013 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
5014 type Operation =
5015 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
5016 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5017 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5018
5019 let stub = self.0.stub.clone();
5020 let mut options = self.0.options.clone();
5021 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5022 let query = move |name| {
5023 let stub = stub.clone();
5024 let options = options.clone();
5025 async {
5026 let op = GetOperation::new(stub)
5027 .set_name(name)
5028 .with_options(options)
5029 .send()
5030 .await?;
5031 Ok(Operation::new(op))
5032 }
5033 };
5034
5035 let start = move || async {
5036 let op = self.send().await?;
5037 Ok(Operation::new(op))
5038 };
5039
5040 google_cloud_lro::internal::new_poller(
5041 polling_error_policy,
5042 polling_backoff_policy,
5043 start,
5044 query,
5045 )
5046 }
5047
5048 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5052 self.0.request.name = v.into();
5053 self
5054 }
5055
5056 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5058 self.0.request.validate_only = v.into();
5059 self
5060 }
5061
5062 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5064 self.0.request.etag = v.into();
5065 self
5066 }
5067 }
5068
5069 #[doc(hidden)]
5070 impl crate::RequestBuilder for DeleteService {
5071 fn request_options(&mut self) -> &mut crate::RequestOptions {
5072 &mut self.0.options
5073 }
5074 }
5075
5076 #[derive(Clone, Debug)]
5093 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5094
5095 impl GetIamPolicy {
5096 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5097 Self(RequestBuilder::new(stub))
5098 }
5099
5100 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5102 mut self,
5103 v: V,
5104 ) -> Self {
5105 self.0.request = v.into();
5106 self
5107 }
5108
5109 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5111 self.0.options = v.into();
5112 self
5113 }
5114
5115 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5117 (*self.0.stub)
5118 .get_iam_policy(self.0.request, self.0.options)
5119 .await
5120 .map(crate::Response::into_body)
5121 }
5122
5123 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5127 self.0.request.resource = v.into();
5128 self
5129 }
5130
5131 pub fn set_options<T>(mut self, v: T) -> Self
5133 where
5134 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5135 {
5136 self.0.request.options = std::option::Option::Some(v.into());
5137 self
5138 }
5139
5140 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5142 where
5143 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5144 {
5145 self.0.request.options = v.map(|x| x.into());
5146 self
5147 }
5148 }
5149
5150 #[doc(hidden)]
5151 impl crate::RequestBuilder for GetIamPolicy {
5152 fn request_options(&mut self) -> &mut crate::RequestOptions {
5153 &mut self.0.options
5154 }
5155 }
5156
5157 #[derive(Clone, Debug)]
5174 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5175
5176 impl SetIamPolicy {
5177 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5178 Self(RequestBuilder::new(stub))
5179 }
5180
5181 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5183 mut self,
5184 v: V,
5185 ) -> Self {
5186 self.0.request = v.into();
5187 self
5188 }
5189
5190 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5192 self.0.options = v.into();
5193 self
5194 }
5195
5196 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5198 (*self.0.stub)
5199 .set_iam_policy(self.0.request, self.0.options)
5200 .await
5201 .map(crate::Response::into_body)
5202 }
5203
5204 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5208 self.0.request.resource = v.into();
5209 self
5210 }
5211
5212 pub fn set_policy<T>(mut self, v: T) -> Self
5216 where
5217 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5218 {
5219 self.0.request.policy = std::option::Option::Some(v.into());
5220 self
5221 }
5222
5223 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5227 where
5228 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5229 {
5230 self.0.request.policy = v.map(|x| x.into());
5231 self
5232 }
5233
5234 pub fn set_update_mask<T>(mut self, v: T) -> Self
5236 where
5237 T: std::convert::Into<wkt::FieldMask>,
5238 {
5239 self.0.request.update_mask = std::option::Option::Some(v.into());
5240 self
5241 }
5242
5243 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5245 where
5246 T: std::convert::Into<wkt::FieldMask>,
5247 {
5248 self.0.request.update_mask = v.map(|x| x.into());
5249 self
5250 }
5251 }
5252
5253 #[doc(hidden)]
5254 impl crate::RequestBuilder for SetIamPolicy {
5255 fn request_options(&mut self) -> &mut crate::RequestOptions {
5256 &mut self.0.options
5257 }
5258 }
5259
5260 #[derive(Clone, Debug)]
5277 pub struct TestIamPermissions(
5278 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5279 );
5280
5281 impl TestIamPermissions {
5282 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5283 Self(RequestBuilder::new(stub))
5284 }
5285
5286 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5288 mut self,
5289 v: V,
5290 ) -> Self {
5291 self.0.request = v.into();
5292 self
5293 }
5294
5295 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5297 self.0.options = v.into();
5298 self
5299 }
5300
5301 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5303 (*self.0.stub)
5304 .test_iam_permissions(self.0.request, self.0.options)
5305 .await
5306 .map(crate::Response::into_body)
5307 }
5308
5309 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5313 self.0.request.resource = v.into();
5314 self
5315 }
5316
5317 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5321 where
5322 T: std::iter::IntoIterator<Item = V>,
5323 V: std::convert::Into<std::string::String>,
5324 {
5325 use std::iter::Iterator;
5326 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5327 self
5328 }
5329 }
5330
5331 #[doc(hidden)]
5332 impl crate::RequestBuilder for TestIamPermissions {
5333 fn request_options(&mut self) -> &mut crate::RequestOptions {
5334 &mut self.0.options
5335 }
5336 }
5337
5338 #[derive(Clone, Debug)]
5359 pub struct ListOperations(
5360 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5361 );
5362
5363 impl ListOperations {
5364 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5365 Self(RequestBuilder::new(stub))
5366 }
5367
5368 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5370 mut self,
5371 v: V,
5372 ) -> Self {
5373 self.0.request = v.into();
5374 self
5375 }
5376
5377 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5379 self.0.options = v.into();
5380 self
5381 }
5382
5383 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5385 (*self.0.stub)
5386 .list_operations(self.0.request, self.0.options)
5387 .await
5388 .map(crate::Response::into_body)
5389 }
5390
5391 pub fn by_page(
5393 self,
5394 ) -> impl google_cloud_gax::paginator::Paginator<
5395 google_cloud_longrunning::model::ListOperationsResponse,
5396 crate::Error,
5397 > {
5398 use std::clone::Clone;
5399 let token = self.0.request.page_token.clone();
5400 let execute = move |token: String| {
5401 let mut builder = self.clone();
5402 builder.0.request = builder.0.request.set_page_token(token);
5403 builder.send()
5404 };
5405 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5406 }
5407
5408 pub fn by_item(
5410 self,
5411 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5412 google_cloud_longrunning::model::ListOperationsResponse,
5413 crate::Error,
5414 > {
5415 use google_cloud_gax::paginator::Paginator;
5416 self.by_page().items()
5417 }
5418
5419 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5421 self.0.request.name = v.into();
5422 self
5423 }
5424
5425 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5427 self.0.request.filter = v.into();
5428 self
5429 }
5430
5431 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5433 self.0.request.page_size = v.into();
5434 self
5435 }
5436
5437 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5439 self.0.request.page_token = v.into();
5440 self
5441 }
5442
5443 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5445 self.0.request.return_partial_success = v.into();
5446 self
5447 }
5448 }
5449
5450 #[doc(hidden)]
5451 impl crate::RequestBuilder for ListOperations {
5452 fn request_options(&mut self) -> &mut crate::RequestOptions {
5453 &mut self.0.options
5454 }
5455 }
5456
5457 #[derive(Clone, Debug)]
5474 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5475
5476 impl GetOperation {
5477 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5478 Self(RequestBuilder::new(stub))
5479 }
5480
5481 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5483 mut self,
5484 v: V,
5485 ) -> Self {
5486 self.0.request = v.into();
5487 self
5488 }
5489
5490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5492 self.0.options = v.into();
5493 self
5494 }
5495
5496 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5498 (*self.0.stub)
5499 .get_operation(self.0.request, self.0.options)
5500 .await
5501 .map(crate::Response::into_body)
5502 }
5503
5504 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5506 self.0.request.name = v.into();
5507 self
5508 }
5509 }
5510
5511 #[doc(hidden)]
5512 impl crate::RequestBuilder for GetOperation {
5513 fn request_options(&mut self) -> &mut crate::RequestOptions {
5514 &mut self.0.options
5515 }
5516 }
5517
5518 #[derive(Clone, Debug)]
5535 pub struct DeleteOperation(
5536 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
5537 );
5538
5539 impl DeleteOperation {
5540 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5541 Self(RequestBuilder::new(stub))
5542 }
5543
5544 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
5546 mut self,
5547 v: V,
5548 ) -> Self {
5549 self.0.request = v.into();
5550 self
5551 }
5552
5553 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5555 self.0.options = v.into();
5556 self
5557 }
5558
5559 pub async fn send(self) -> Result<()> {
5561 (*self.0.stub)
5562 .delete_operation(self.0.request, self.0.options)
5563 .await
5564 .map(crate::Response::into_body)
5565 }
5566
5567 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5569 self.0.request.name = v.into();
5570 self
5571 }
5572 }
5573
5574 #[doc(hidden)]
5575 impl crate::RequestBuilder for DeleteOperation {
5576 fn request_options(&mut self) -> &mut crate::RequestOptions {
5577 &mut self.0.options
5578 }
5579 }
5580
5581 #[derive(Clone, Debug)]
5598 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
5599
5600 impl WaitOperation {
5601 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5602 Self(RequestBuilder::new(stub))
5603 }
5604
5605 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
5607 mut self,
5608 v: V,
5609 ) -> Self {
5610 self.0.request = v.into();
5611 self
5612 }
5613
5614 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5616 self.0.options = v.into();
5617 self
5618 }
5619
5620 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5622 (*self.0.stub)
5623 .wait_operation(self.0.request, self.0.options)
5624 .await
5625 .map(crate::Response::into_body)
5626 }
5627
5628 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5630 self.0.request.name = v.into();
5631 self
5632 }
5633
5634 pub fn set_timeout<T>(mut self, v: T) -> Self
5636 where
5637 T: std::convert::Into<wkt::Duration>,
5638 {
5639 self.0.request.timeout = std::option::Option::Some(v.into());
5640 self
5641 }
5642
5643 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5645 where
5646 T: std::convert::Into<wkt::Duration>,
5647 {
5648 self.0.request.timeout = v.map(|x| x.into());
5649 self
5650 }
5651 }
5652
5653 #[doc(hidden)]
5654 impl crate::RequestBuilder for WaitOperation {
5655 fn request_options(&mut self) -> &mut crate::RequestOptions {
5656 &mut self.0.options
5657 }
5658 }
5659}
5660
5661pub mod tasks {
5663 use crate::Result;
5664
5665 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5679
5680 pub(crate) mod client {
5681 use super::super::super::client::Tasks;
5682 pub struct Factory;
5683 impl crate::ClientFactory for Factory {
5684 type Client = Tasks;
5685 type Credentials = gaxi::options::Credentials;
5686 async fn build(
5687 self,
5688 config: gaxi::options::ClientConfig,
5689 ) -> crate::ClientBuilderResult<Self::Client> {
5690 Self::Client::new(config).await
5691 }
5692 }
5693 }
5694
5695 #[derive(Clone, Debug)]
5697 pub(crate) struct RequestBuilder<R: std::default::Default> {
5698 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
5699 request: R,
5700 options: crate::RequestOptions,
5701 }
5702
5703 impl<R> RequestBuilder<R>
5704 where
5705 R: std::default::Default,
5706 {
5707 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5708 Self {
5709 stub,
5710 request: R::default(),
5711 options: crate::RequestOptions::default(),
5712 }
5713 }
5714 }
5715
5716 #[derive(Clone, Debug)]
5733 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
5734
5735 impl GetTask {
5736 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5737 Self(RequestBuilder::new(stub))
5738 }
5739
5740 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
5742 self.0.request = v.into();
5743 self
5744 }
5745
5746 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5748 self.0.options = v.into();
5749 self
5750 }
5751
5752 pub async fn send(self) -> Result<crate::model::Task> {
5754 (*self.0.stub)
5755 .get_task(self.0.request, self.0.options)
5756 .await
5757 .map(crate::Response::into_body)
5758 }
5759
5760 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5764 self.0.request.name = v.into();
5765 self
5766 }
5767 }
5768
5769 #[doc(hidden)]
5770 impl crate::RequestBuilder for GetTask {
5771 fn request_options(&mut self) -> &mut crate::RequestOptions {
5772 &mut self.0.options
5773 }
5774 }
5775
5776 #[derive(Clone, Debug)]
5797 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
5798
5799 impl ListTasks {
5800 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5801 Self(RequestBuilder::new(stub))
5802 }
5803
5804 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
5806 self.0.request = v.into();
5807 self
5808 }
5809
5810 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5812 self.0.options = v.into();
5813 self
5814 }
5815
5816 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
5818 (*self.0.stub)
5819 .list_tasks(self.0.request, self.0.options)
5820 .await
5821 .map(crate::Response::into_body)
5822 }
5823
5824 pub fn by_page(
5826 self,
5827 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTasksResponse, crate::Error>
5828 {
5829 use std::clone::Clone;
5830 let token = self.0.request.page_token.clone();
5831 let execute = move |token: String| {
5832 let mut builder = self.clone();
5833 builder.0.request = builder.0.request.set_page_token(token);
5834 builder.send()
5835 };
5836 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5837 }
5838
5839 pub fn by_item(
5841 self,
5842 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListTasksResponse, crate::Error>
5843 {
5844 use google_cloud_gax::paginator::Paginator;
5845 self.by_page().items()
5846 }
5847
5848 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5852 self.0.request.parent = v.into();
5853 self
5854 }
5855
5856 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5858 self.0.request.page_size = v.into();
5859 self
5860 }
5861
5862 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5864 self.0.request.page_token = v.into();
5865 self
5866 }
5867
5868 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5870 self.0.request.show_deleted = v.into();
5871 self
5872 }
5873 }
5874
5875 #[doc(hidden)]
5876 impl crate::RequestBuilder for ListTasks {
5877 fn request_options(&mut self) -> &mut crate::RequestOptions {
5878 &mut self.0.options
5879 }
5880 }
5881
5882 #[derive(Clone, Debug)]
5903 pub struct ListOperations(
5904 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5905 );
5906
5907 impl ListOperations {
5908 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5909 Self(RequestBuilder::new(stub))
5910 }
5911
5912 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5914 mut self,
5915 v: V,
5916 ) -> Self {
5917 self.0.request = v.into();
5918 self
5919 }
5920
5921 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5923 self.0.options = v.into();
5924 self
5925 }
5926
5927 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5929 (*self.0.stub)
5930 .list_operations(self.0.request, self.0.options)
5931 .await
5932 .map(crate::Response::into_body)
5933 }
5934
5935 pub fn by_page(
5937 self,
5938 ) -> impl google_cloud_gax::paginator::Paginator<
5939 google_cloud_longrunning::model::ListOperationsResponse,
5940 crate::Error,
5941 > {
5942 use std::clone::Clone;
5943 let token = self.0.request.page_token.clone();
5944 let execute = move |token: String| {
5945 let mut builder = self.clone();
5946 builder.0.request = builder.0.request.set_page_token(token);
5947 builder.send()
5948 };
5949 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5950 }
5951
5952 pub fn by_item(
5954 self,
5955 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5956 google_cloud_longrunning::model::ListOperationsResponse,
5957 crate::Error,
5958 > {
5959 use google_cloud_gax::paginator::Paginator;
5960 self.by_page().items()
5961 }
5962
5963 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5965 self.0.request.name = v.into();
5966 self
5967 }
5968
5969 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5971 self.0.request.filter = v.into();
5972 self
5973 }
5974
5975 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5977 self.0.request.page_size = v.into();
5978 self
5979 }
5980
5981 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5983 self.0.request.page_token = v.into();
5984 self
5985 }
5986
5987 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5989 self.0.request.return_partial_success = v.into();
5990 self
5991 }
5992 }
5993
5994 #[doc(hidden)]
5995 impl crate::RequestBuilder for ListOperations {
5996 fn request_options(&mut self) -> &mut crate::RequestOptions {
5997 &mut self.0.options
5998 }
5999 }
6000
6001 #[derive(Clone, Debug)]
6018 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6019
6020 impl GetOperation {
6021 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6022 Self(RequestBuilder::new(stub))
6023 }
6024
6025 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6027 mut self,
6028 v: V,
6029 ) -> Self {
6030 self.0.request = v.into();
6031 self
6032 }
6033
6034 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6036 self.0.options = v.into();
6037 self
6038 }
6039
6040 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6042 (*self.0.stub)
6043 .get_operation(self.0.request, self.0.options)
6044 .await
6045 .map(crate::Response::into_body)
6046 }
6047
6048 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6050 self.0.request.name = v.into();
6051 self
6052 }
6053 }
6054
6055 #[doc(hidden)]
6056 impl crate::RequestBuilder for GetOperation {
6057 fn request_options(&mut self) -> &mut crate::RequestOptions {
6058 &mut self.0.options
6059 }
6060 }
6061
6062 #[derive(Clone, Debug)]
6079 pub struct DeleteOperation(
6080 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
6081 );
6082
6083 impl DeleteOperation {
6084 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6085 Self(RequestBuilder::new(stub))
6086 }
6087
6088 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
6090 mut self,
6091 v: V,
6092 ) -> Self {
6093 self.0.request = v.into();
6094 self
6095 }
6096
6097 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6099 self.0.options = v.into();
6100 self
6101 }
6102
6103 pub async fn send(self) -> Result<()> {
6105 (*self.0.stub)
6106 .delete_operation(self.0.request, self.0.options)
6107 .await
6108 .map(crate::Response::into_body)
6109 }
6110
6111 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6113 self.0.request.name = v.into();
6114 self
6115 }
6116 }
6117
6118 #[doc(hidden)]
6119 impl crate::RequestBuilder for DeleteOperation {
6120 fn request_options(&mut self) -> &mut crate::RequestOptions {
6121 &mut self.0.options
6122 }
6123 }
6124
6125 #[derive(Clone, Debug)]
6142 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
6143
6144 impl WaitOperation {
6145 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6146 Self(RequestBuilder::new(stub))
6147 }
6148
6149 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
6151 mut self,
6152 v: V,
6153 ) -> Self {
6154 self.0.request = v.into();
6155 self
6156 }
6157
6158 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6160 self.0.options = v.into();
6161 self
6162 }
6163
6164 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6166 (*self.0.stub)
6167 .wait_operation(self.0.request, self.0.options)
6168 .await
6169 .map(crate::Response::into_body)
6170 }
6171
6172 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6174 self.0.request.name = v.into();
6175 self
6176 }
6177
6178 pub fn set_timeout<T>(mut self, v: T) -> Self
6180 where
6181 T: std::convert::Into<wkt::Duration>,
6182 {
6183 self.0.request.timeout = std::option::Option::Some(v.into());
6184 self
6185 }
6186
6187 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6189 where
6190 T: std::convert::Into<wkt::Duration>,
6191 {
6192 self.0.request.timeout = v.map(|x| x.into());
6193 self
6194 }
6195 }
6196
6197 #[doc(hidden)]
6198 impl crate::RequestBuilder for WaitOperation {
6199 fn request_options(&mut self) -> &mut crate::RequestOptions {
6200 &mut self.0.options
6201 }
6202 }
6203}
6204
6205pub mod worker_pools {
6207 use crate::Result;
6208
6209 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6223
6224 pub(crate) mod client {
6225 use super::super::super::client::WorkerPools;
6226 pub struct Factory;
6227 impl crate::ClientFactory for Factory {
6228 type Client = WorkerPools;
6229 type Credentials = gaxi::options::Credentials;
6230 async fn build(
6231 self,
6232 config: gaxi::options::ClientConfig,
6233 ) -> crate::ClientBuilderResult<Self::Client> {
6234 Self::Client::new(config).await
6235 }
6236 }
6237 }
6238
6239 #[derive(Clone, Debug)]
6241 pub(crate) struct RequestBuilder<R: std::default::Default> {
6242 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6243 request: R,
6244 options: crate::RequestOptions,
6245 }
6246
6247 impl<R> RequestBuilder<R>
6248 where
6249 R: std::default::Default,
6250 {
6251 pub(crate) fn new(
6252 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6253 ) -> Self {
6254 Self {
6255 stub,
6256 request: R::default(),
6257 options: crate::RequestOptions::default(),
6258 }
6259 }
6260 }
6261
6262 #[derive(Clone, Debug)]
6280 pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
6281
6282 impl CreateWorkerPool {
6283 pub(crate) fn new(
6284 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6285 ) -> Self {
6286 Self(RequestBuilder::new(stub))
6287 }
6288
6289 pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
6291 mut self,
6292 v: V,
6293 ) -> Self {
6294 self.0.request = v.into();
6295 self
6296 }
6297
6298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6300 self.0.options = v.into();
6301 self
6302 }
6303
6304 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6311 (*self.0.stub)
6312 .create_worker_pool(self.0.request, self.0.options)
6313 .await
6314 .map(crate::Response::into_body)
6315 }
6316
6317 pub fn poller(
6319 self,
6320 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6321 {
6322 type Operation = google_cloud_lro::internal::Operation<
6323 crate::model::WorkerPool,
6324 crate::model::WorkerPool,
6325 >;
6326 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6327 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6328
6329 let stub = self.0.stub.clone();
6330 let mut options = self.0.options.clone();
6331 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6332 let query = move |name| {
6333 let stub = stub.clone();
6334 let options = options.clone();
6335 async {
6336 let op = GetOperation::new(stub)
6337 .set_name(name)
6338 .with_options(options)
6339 .send()
6340 .await?;
6341 Ok(Operation::new(op))
6342 }
6343 };
6344
6345 let start = move || async {
6346 let op = self.send().await?;
6347 Ok(Operation::new(op))
6348 };
6349
6350 google_cloud_lro::internal::new_poller(
6351 polling_error_policy,
6352 polling_backoff_policy,
6353 start,
6354 query,
6355 )
6356 }
6357
6358 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6362 self.0.request.parent = v.into();
6363 self
6364 }
6365
6366 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6370 where
6371 T: std::convert::Into<crate::model::WorkerPool>,
6372 {
6373 self.0.request.worker_pool = std::option::Option::Some(v.into());
6374 self
6375 }
6376
6377 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6381 where
6382 T: std::convert::Into<crate::model::WorkerPool>,
6383 {
6384 self.0.request.worker_pool = v.map(|x| x.into());
6385 self
6386 }
6387
6388 pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6392 self.0.request.worker_pool_id = v.into();
6393 self
6394 }
6395
6396 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6398 self.0.request.validate_only = v.into();
6399 self
6400 }
6401 }
6402
6403 #[doc(hidden)]
6404 impl crate::RequestBuilder for CreateWorkerPool {
6405 fn request_options(&mut self) -> &mut crate::RequestOptions {
6406 &mut self.0.options
6407 }
6408 }
6409
6410 #[derive(Clone, Debug)]
6427 pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
6428
6429 impl GetWorkerPool {
6430 pub(crate) fn new(
6431 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6432 ) -> Self {
6433 Self(RequestBuilder::new(stub))
6434 }
6435
6436 pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
6438 self.0.request = v.into();
6439 self
6440 }
6441
6442 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6444 self.0.options = v.into();
6445 self
6446 }
6447
6448 pub async fn send(self) -> Result<crate::model::WorkerPool> {
6450 (*self.0.stub)
6451 .get_worker_pool(self.0.request, self.0.options)
6452 .await
6453 .map(crate::Response::into_body)
6454 }
6455
6456 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6460 self.0.request.name = v.into();
6461 self
6462 }
6463 }
6464
6465 #[doc(hidden)]
6466 impl crate::RequestBuilder for GetWorkerPool {
6467 fn request_options(&mut self) -> &mut crate::RequestOptions {
6468 &mut self.0.options
6469 }
6470 }
6471
6472 #[derive(Clone, Debug)]
6493 pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
6494
6495 impl ListWorkerPools {
6496 pub(crate) fn new(
6497 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6498 ) -> Self {
6499 Self(RequestBuilder::new(stub))
6500 }
6501
6502 pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
6504 self.0.request = v.into();
6505 self
6506 }
6507
6508 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6510 self.0.options = v.into();
6511 self
6512 }
6513
6514 pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
6516 (*self.0.stub)
6517 .list_worker_pools(self.0.request, self.0.options)
6518 .await
6519 .map(crate::Response::into_body)
6520 }
6521
6522 pub fn by_page(
6524 self,
6525 ) -> impl google_cloud_gax::paginator::Paginator<
6526 crate::model::ListWorkerPoolsResponse,
6527 crate::Error,
6528 > {
6529 use std::clone::Clone;
6530 let token = self.0.request.page_token.clone();
6531 let execute = move |token: String| {
6532 let mut builder = self.clone();
6533 builder.0.request = builder.0.request.set_page_token(token);
6534 builder.send()
6535 };
6536 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6537 }
6538
6539 pub fn by_item(
6541 self,
6542 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6543 crate::model::ListWorkerPoolsResponse,
6544 crate::Error,
6545 > {
6546 use google_cloud_gax::paginator::Paginator;
6547 self.by_page().items()
6548 }
6549
6550 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6554 self.0.request.parent = v.into();
6555 self
6556 }
6557
6558 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6560 self.0.request.page_size = v.into();
6561 self
6562 }
6563
6564 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6566 self.0.request.page_token = v.into();
6567 self
6568 }
6569
6570 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
6572 self.0.request.show_deleted = v.into();
6573 self
6574 }
6575 }
6576
6577 #[doc(hidden)]
6578 impl crate::RequestBuilder for ListWorkerPools {
6579 fn request_options(&mut self) -> &mut crate::RequestOptions {
6580 &mut self.0.options
6581 }
6582 }
6583
6584 #[derive(Clone, Debug)]
6602 pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
6603
6604 impl UpdateWorkerPool {
6605 pub(crate) fn new(
6606 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6607 ) -> Self {
6608 Self(RequestBuilder::new(stub))
6609 }
6610
6611 pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
6613 mut self,
6614 v: V,
6615 ) -> Self {
6616 self.0.request = v.into();
6617 self
6618 }
6619
6620 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6622 self.0.options = v.into();
6623 self
6624 }
6625
6626 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6633 (*self.0.stub)
6634 .update_worker_pool(self.0.request, self.0.options)
6635 .await
6636 .map(crate::Response::into_body)
6637 }
6638
6639 pub fn poller(
6641 self,
6642 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6643 {
6644 type Operation = google_cloud_lro::internal::Operation<
6645 crate::model::WorkerPool,
6646 crate::model::WorkerPool,
6647 >;
6648 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6649 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6650
6651 let stub = self.0.stub.clone();
6652 let mut options = self.0.options.clone();
6653 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6654 let query = move |name| {
6655 let stub = stub.clone();
6656 let options = options.clone();
6657 async {
6658 let op = GetOperation::new(stub)
6659 .set_name(name)
6660 .with_options(options)
6661 .send()
6662 .await?;
6663 Ok(Operation::new(op))
6664 }
6665 };
6666
6667 let start = move || async {
6668 let op = self.send().await?;
6669 Ok(Operation::new(op))
6670 };
6671
6672 google_cloud_lro::internal::new_poller(
6673 polling_error_policy,
6674 polling_backoff_policy,
6675 start,
6676 query,
6677 )
6678 }
6679
6680 pub fn set_update_mask<T>(mut self, v: T) -> Self
6682 where
6683 T: std::convert::Into<wkt::FieldMask>,
6684 {
6685 self.0.request.update_mask = std::option::Option::Some(v.into());
6686 self
6687 }
6688
6689 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6691 where
6692 T: std::convert::Into<wkt::FieldMask>,
6693 {
6694 self.0.request.update_mask = v.map(|x| x.into());
6695 self
6696 }
6697
6698 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6702 where
6703 T: std::convert::Into<crate::model::WorkerPool>,
6704 {
6705 self.0.request.worker_pool = std::option::Option::Some(v.into());
6706 self
6707 }
6708
6709 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6713 where
6714 T: std::convert::Into<crate::model::WorkerPool>,
6715 {
6716 self.0.request.worker_pool = v.map(|x| x.into());
6717 self
6718 }
6719
6720 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6722 self.0.request.validate_only = v.into();
6723 self
6724 }
6725
6726 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6728 self.0.request.allow_missing = v.into();
6729 self
6730 }
6731
6732 pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
6734 self.0.request.force_new_revision = v.into();
6735 self
6736 }
6737 }
6738
6739 #[doc(hidden)]
6740 impl crate::RequestBuilder for UpdateWorkerPool {
6741 fn request_options(&mut self) -> &mut crate::RequestOptions {
6742 &mut self.0.options
6743 }
6744 }
6745
6746 #[derive(Clone, Debug)]
6764 pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
6765
6766 impl DeleteWorkerPool {
6767 pub(crate) fn new(
6768 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6769 ) -> Self {
6770 Self(RequestBuilder::new(stub))
6771 }
6772
6773 pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
6775 mut self,
6776 v: V,
6777 ) -> Self {
6778 self.0.request = v.into();
6779 self
6780 }
6781
6782 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6784 self.0.options = v.into();
6785 self
6786 }
6787
6788 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6795 (*self.0.stub)
6796 .delete_worker_pool(self.0.request, self.0.options)
6797 .await
6798 .map(crate::Response::into_body)
6799 }
6800
6801 pub fn poller(
6803 self,
6804 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6805 {
6806 type Operation = google_cloud_lro::internal::Operation<
6807 crate::model::WorkerPool,
6808 crate::model::WorkerPool,
6809 >;
6810 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6811 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6812
6813 let stub = self.0.stub.clone();
6814 let mut options = self.0.options.clone();
6815 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6816 let query = move |name| {
6817 let stub = stub.clone();
6818 let options = options.clone();
6819 async {
6820 let op = GetOperation::new(stub)
6821 .set_name(name)
6822 .with_options(options)
6823 .send()
6824 .await?;
6825 Ok(Operation::new(op))
6826 }
6827 };
6828
6829 let start = move || async {
6830 let op = self.send().await?;
6831 Ok(Operation::new(op))
6832 };
6833
6834 google_cloud_lro::internal::new_poller(
6835 polling_error_policy,
6836 polling_backoff_policy,
6837 start,
6838 query,
6839 )
6840 }
6841
6842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6846 self.0.request.name = v.into();
6847 self
6848 }
6849
6850 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6852 self.0.request.validate_only = v.into();
6853 self
6854 }
6855
6856 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
6858 self.0.request.etag = v.into();
6859 self
6860 }
6861 }
6862
6863 #[doc(hidden)]
6864 impl crate::RequestBuilder for DeleteWorkerPool {
6865 fn request_options(&mut self) -> &mut crate::RequestOptions {
6866 &mut self.0.options
6867 }
6868 }
6869
6870 #[derive(Clone, Debug)]
6887 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
6888
6889 impl GetIamPolicy {
6890 pub(crate) fn new(
6891 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6892 ) -> Self {
6893 Self(RequestBuilder::new(stub))
6894 }
6895
6896 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
6898 mut self,
6899 v: V,
6900 ) -> Self {
6901 self.0.request = v.into();
6902 self
6903 }
6904
6905 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6907 self.0.options = v.into();
6908 self
6909 }
6910
6911 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6913 (*self.0.stub)
6914 .get_iam_policy(self.0.request, self.0.options)
6915 .await
6916 .map(crate::Response::into_body)
6917 }
6918
6919 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6923 self.0.request.resource = v.into();
6924 self
6925 }
6926
6927 pub fn set_options<T>(mut self, v: T) -> Self
6929 where
6930 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6931 {
6932 self.0.request.options = std::option::Option::Some(v.into());
6933 self
6934 }
6935
6936 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6938 where
6939 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6940 {
6941 self.0.request.options = v.map(|x| x.into());
6942 self
6943 }
6944 }
6945
6946 #[doc(hidden)]
6947 impl crate::RequestBuilder for GetIamPolicy {
6948 fn request_options(&mut self) -> &mut crate::RequestOptions {
6949 &mut self.0.options
6950 }
6951 }
6952
6953 #[derive(Clone, Debug)]
6970 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
6971
6972 impl SetIamPolicy {
6973 pub(crate) fn new(
6974 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6975 ) -> Self {
6976 Self(RequestBuilder::new(stub))
6977 }
6978
6979 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
6981 mut self,
6982 v: V,
6983 ) -> Self {
6984 self.0.request = v.into();
6985 self
6986 }
6987
6988 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6990 self.0.options = v.into();
6991 self
6992 }
6993
6994 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6996 (*self.0.stub)
6997 .set_iam_policy(self.0.request, self.0.options)
6998 .await
6999 .map(crate::Response::into_body)
7000 }
7001
7002 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7006 self.0.request.resource = v.into();
7007 self
7008 }
7009
7010 pub fn set_policy<T>(mut self, v: T) -> Self
7014 where
7015 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7016 {
7017 self.0.request.policy = std::option::Option::Some(v.into());
7018 self
7019 }
7020
7021 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7025 where
7026 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7027 {
7028 self.0.request.policy = v.map(|x| x.into());
7029 self
7030 }
7031
7032 pub fn set_update_mask<T>(mut self, v: T) -> Self
7034 where
7035 T: std::convert::Into<wkt::FieldMask>,
7036 {
7037 self.0.request.update_mask = std::option::Option::Some(v.into());
7038 self
7039 }
7040
7041 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7043 where
7044 T: std::convert::Into<wkt::FieldMask>,
7045 {
7046 self.0.request.update_mask = v.map(|x| x.into());
7047 self
7048 }
7049 }
7050
7051 #[doc(hidden)]
7052 impl crate::RequestBuilder for SetIamPolicy {
7053 fn request_options(&mut self) -> &mut crate::RequestOptions {
7054 &mut self.0.options
7055 }
7056 }
7057
7058 #[derive(Clone, Debug)]
7075 pub struct TestIamPermissions(
7076 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
7077 );
7078
7079 impl TestIamPermissions {
7080 pub(crate) fn new(
7081 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7082 ) -> Self {
7083 Self(RequestBuilder::new(stub))
7084 }
7085
7086 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
7088 mut self,
7089 v: V,
7090 ) -> Self {
7091 self.0.request = v.into();
7092 self
7093 }
7094
7095 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7097 self.0.options = v.into();
7098 self
7099 }
7100
7101 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
7103 (*self.0.stub)
7104 .test_iam_permissions(self.0.request, self.0.options)
7105 .await
7106 .map(crate::Response::into_body)
7107 }
7108
7109 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7113 self.0.request.resource = v.into();
7114 self
7115 }
7116
7117 pub fn set_permissions<T, V>(mut self, v: T) -> Self
7121 where
7122 T: std::iter::IntoIterator<Item = V>,
7123 V: std::convert::Into<std::string::String>,
7124 {
7125 use std::iter::Iterator;
7126 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7127 self
7128 }
7129 }
7130
7131 #[doc(hidden)]
7132 impl crate::RequestBuilder for TestIamPermissions {
7133 fn request_options(&mut self) -> &mut crate::RequestOptions {
7134 &mut self.0.options
7135 }
7136 }
7137
7138 #[derive(Clone, Debug)]
7159 pub struct ListOperations(
7160 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7161 );
7162
7163 impl ListOperations {
7164 pub(crate) fn new(
7165 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7166 ) -> Self {
7167 Self(RequestBuilder::new(stub))
7168 }
7169
7170 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7172 mut self,
7173 v: V,
7174 ) -> Self {
7175 self.0.request = v.into();
7176 self
7177 }
7178
7179 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7181 self.0.options = v.into();
7182 self
7183 }
7184
7185 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7187 (*self.0.stub)
7188 .list_operations(self.0.request, self.0.options)
7189 .await
7190 .map(crate::Response::into_body)
7191 }
7192
7193 pub fn by_page(
7195 self,
7196 ) -> impl google_cloud_gax::paginator::Paginator<
7197 google_cloud_longrunning::model::ListOperationsResponse,
7198 crate::Error,
7199 > {
7200 use std::clone::Clone;
7201 let token = self.0.request.page_token.clone();
7202 let execute = move |token: String| {
7203 let mut builder = self.clone();
7204 builder.0.request = builder.0.request.set_page_token(token);
7205 builder.send()
7206 };
7207 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7208 }
7209
7210 pub fn by_item(
7212 self,
7213 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7214 google_cloud_longrunning::model::ListOperationsResponse,
7215 crate::Error,
7216 > {
7217 use google_cloud_gax::paginator::Paginator;
7218 self.by_page().items()
7219 }
7220
7221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7223 self.0.request.name = v.into();
7224 self
7225 }
7226
7227 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7229 self.0.request.filter = v.into();
7230 self
7231 }
7232
7233 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7235 self.0.request.page_size = v.into();
7236 self
7237 }
7238
7239 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7241 self.0.request.page_token = v.into();
7242 self
7243 }
7244
7245 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7247 self.0.request.return_partial_success = v.into();
7248 self
7249 }
7250 }
7251
7252 #[doc(hidden)]
7253 impl crate::RequestBuilder for ListOperations {
7254 fn request_options(&mut self) -> &mut crate::RequestOptions {
7255 &mut self.0.options
7256 }
7257 }
7258
7259 #[derive(Clone, Debug)]
7276 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7277
7278 impl GetOperation {
7279 pub(crate) fn new(
7280 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7281 ) -> Self {
7282 Self(RequestBuilder::new(stub))
7283 }
7284
7285 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7287 mut self,
7288 v: V,
7289 ) -> Self {
7290 self.0.request = v.into();
7291 self
7292 }
7293
7294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7296 self.0.options = v.into();
7297 self
7298 }
7299
7300 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7302 (*self.0.stub)
7303 .get_operation(self.0.request, self.0.options)
7304 .await
7305 .map(crate::Response::into_body)
7306 }
7307
7308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7310 self.0.request.name = v.into();
7311 self
7312 }
7313 }
7314
7315 #[doc(hidden)]
7316 impl crate::RequestBuilder for GetOperation {
7317 fn request_options(&mut self) -> &mut crate::RequestOptions {
7318 &mut self.0.options
7319 }
7320 }
7321
7322 #[derive(Clone, Debug)]
7339 pub struct DeleteOperation(
7340 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
7341 );
7342
7343 impl DeleteOperation {
7344 pub(crate) fn new(
7345 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7346 ) -> Self {
7347 Self(RequestBuilder::new(stub))
7348 }
7349
7350 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
7352 mut self,
7353 v: V,
7354 ) -> Self {
7355 self.0.request = v.into();
7356 self
7357 }
7358
7359 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7361 self.0.options = v.into();
7362 self
7363 }
7364
7365 pub async fn send(self) -> Result<()> {
7367 (*self.0.stub)
7368 .delete_operation(self.0.request, self.0.options)
7369 .await
7370 .map(crate::Response::into_body)
7371 }
7372
7373 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7375 self.0.request.name = v.into();
7376 self
7377 }
7378 }
7379
7380 #[doc(hidden)]
7381 impl crate::RequestBuilder for DeleteOperation {
7382 fn request_options(&mut self) -> &mut crate::RequestOptions {
7383 &mut self.0.options
7384 }
7385 }
7386
7387 #[derive(Clone, Debug)]
7404 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
7405
7406 impl WaitOperation {
7407 pub(crate) fn new(
7408 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7409 ) -> Self {
7410 Self(RequestBuilder::new(stub))
7411 }
7412
7413 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
7415 mut self,
7416 v: V,
7417 ) -> Self {
7418 self.0.request = v.into();
7419 self
7420 }
7421
7422 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7424 self.0.options = v.into();
7425 self
7426 }
7427
7428 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7430 (*self.0.stub)
7431 .wait_operation(self.0.request, self.0.options)
7432 .await
7433 .map(crate::Response::into_body)
7434 }
7435
7436 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7438 self.0.request.name = v.into();
7439 self
7440 }
7441
7442 pub fn set_timeout<T>(mut self, v: T) -> Self
7444 where
7445 T: std::convert::Into<wkt::Duration>,
7446 {
7447 self.0.request.timeout = std::option::Option::Some(v.into());
7448 self
7449 }
7450
7451 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7453 where
7454 T: std::convert::Into<wkt::Duration>,
7455 {
7456 self.0.request.timeout = v.map(|x| x.into());
7457 self
7458 }
7459 }
7460
7461 #[doc(hidden)]
7462 impl crate::RequestBuilder for WaitOperation {
7463 fn request_options(&mut self) -> &mut crate::RequestOptions {
7464 &mut self.0.options
7465 }
7466 }
7467}