1pub mod builds {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::Builds;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Builds;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
63 Self {
64 stub,
65 request: R::default(),
66 options: crate::RequestOptions::default(),
67 }
68 }
69 }
70
71 #[derive(Clone, Debug)]
88 pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
89
90 impl SubmitBuild {
91 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
92 Self(RequestBuilder::new(stub))
93 }
94
95 pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
97 self.0.request = v.into();
98 self
99 }
100
101 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
103 self.0.options = v.into();
104 self
105 }
106
107 pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
109 (*self.0.stub)
110 .submit_build(self.0.request, self.0.options)
111 .await
112 .map(crate::Response::into_body)
113 }
114
115 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
119 self.0.request.parent = v.into();
120 self
121 }
122
123 pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
127 self.0.request.image_uri = v.into();
128 self
129 }
130
131 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
133 self.0.request.service_account = v.into();
134 self
135 }
136
137 pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
139 self.0.request.worker_pool = v.into();
140 self
141 }
142
143 pub fn set_tags<T, V>(mut self, v: T) -> Self
145 where
146 T: std::iter::IntoIterator<Item = V>,
147 V: std::convert::Into<std::string::String>,
148 {
149 use std::iter::Iterator;
150 self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
151 self
152 }
153
154 pub fn set_machine_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
156 self.0.request.machine_type = v.into();
157 self
158 }
159
160 pub fn set_release_track<T: Into<google_cloud_api::model::LaunchStage>>(
162 mut self,
163 v: T,
164 ) -> Self {
165 self.0.request.release_track = v.into();
166 self
167 }
168
169 pub fn set_client<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.client = v.into();
172 self
173 }
174
175 pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
180 mut self,
181 v: T,
182 ) -> Self {
183 self.0.request.source = v.into();
184 self
185 }
186
187 pub fn set_storage_source<
193 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
194 >(
195 mut self,
196 v: T,
197 ) -> Self {
198 self.0.request = self.0.request.set_storage_source(v);
199 self
200 }
201
202 pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
207 mut self,
208 v: T,
209 ) -> Self {
210 self.0.request.build_type = v.into();
211 self
212 }
213
214 pub fn set_buildpack_build<
220 T: std::convert::Into<
221 std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
222 >,
223 >(
224 mut self,
225 v: T,
226 ) -> Self {
227 self.0.request = self.0.request.set_buildpack_build(v);
228 self
229 }
230
231 pub fn set_docker_build<
237 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
238 >(
239 mut self,
240 v: T,
241 ) -> Self {
242 self.0.request = self.0.request.set_docker_build(v);
243 self
244 }
245 }
246
247 #[doc(hidden)]
248 impl crate::RequestBuilder for SubmitBuild {
249 fn request_options(&mut self) -> &mut crate::RequestOptions {
250 &mut self.0.options
251 }
252 }
253
254 #[derive(Clone, Debug)]
275 pub struct ListOperations(
276 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
277 );
278
279 impl ListOperations {
280 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
281 Self(RequestBuilder::new(stub))
282 }
283
284 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
286 mut self,
287 v: V,
288 ) -> Self {
289 self.0.request = v.into();
290 self
291 }
292
293 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
295 self.0.options = v.into();
296 self
297 }
298
299 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
301 (*self.0.stub)
302 .list_operations(self.0.request, self.0.options)
303 .await
304 .map(crate::Response::into_body)
305 }
306
307 pub fn by_page(
309 self,
310 ) -> impl google_cloud_gax::paginator::Paginator<
311 google_cloud_longrunning::model::ListOperationsResponse,
312 crate::Error,
313 > {
314 use std::clone::Clone;
315 let token = self.0.request.page_token.clone();
316 let execute = move |token: String| {
317 let mut builder = self.clone();
318 builder.0.request = builder.0.request.set_page_token(token);
319 builder.send()
320 };
321 google_cloud_gax::paginator::internal::new_paginator(token, execute)
322 }
323
324 pub fn by_item(
326 self,
327 ) -> impl google_cloud_gax::paginator::ItemPaginator<
328 google_cloud_longrunning::model::ListOperationsResponse,
329 crate::Error,
330 > {
331 use google_cloud_gax::paginator::Paginator;
332 self.by_page().items()
333 }
334
335 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
337 self.0.request.name = v.into();
338 self
339 }
340
341 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
343 self.0.request.filter = v.into();
344 self
345 }
346
347 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
349 self.0.request.page_size = v.into();
350 self
351 }
352
353 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
355 self.0.request.page_token = v.into();
356 self
357 }
358
359 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
361 self.0.request.return_partial_success = v.into();
362 self
363 }
364 }
365
366 #[doc(hidden)]
367 impl crate::RequestBuilder for ListOperations {
368 fn request_options(&mut self) -> &mut crate::RequestOptions {
369 &mut self.0.options
370 }
371 }
372
373 #[derive(Clone, Debug)]
390 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
391
392 impl GetOperation {
393 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
394 Self(RequestBuilder::new(stub))
395 }
396
397 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
399 mut self,
400 v: V,
401 ) -> Self {
402 self.0.request = v.into();
403 self
404 }
405
406 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
408 self.0.options = v.into();
409 self
410 }
411
412 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
414 (*self.0.stub)
415 .get_operation(self.0.request, self.0.options)
416 .await
417 .map(crate::Response::into_body)
418 }
419
420 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
422 self.0.request.name = v.into();
423 self
424 }
425 }
426
427 #[doc(hidden)]
428 impl crate::RequestBuilder for GetOperation {
429 fn request_options(&mut self) -> &mut crate::RequestOptions {
430 &mut self.0.options
431 }
432 }
433
434 #[derive(Clone, Debug)]
451 pub struct DeleteOperation(
452 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
453 );
454
455 impl DeleteOperation {
456 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
457 Self(RequestBuilder::new(stub))
458 }
459
460 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
462 mut self,
463 v: V,
464 ) -> Self {
465 self.0.request = v.into();
466 self
467 }
468
469 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
471 self.0.options = v.into();
472 self
473 }
474
475 pub async fn send(self) -> Result<()> {
477 (*self.0.stub)
478 .delete_operation(self.0.request, self.0.options)
479 .await
480 .map(crate::Response::into_body)
481 }
482
483 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
485 self.0.request.name = v.into();
486 self
487 }
488 }
489
490 #[doc(hidden)]
491 impl crate::RequestBuilder for DeleteOperation {
492 fn request_options(&mut self) -> &mut crate::RequestOptions {
493 &mut self.0.options
494 }
495 }
496
497 #[derive(Clone, Debug)]
514 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
515
516 impl WaitOperation {
517 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
518 Self(RequestBuilder::new(stub))
519 }
520
521 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
523 mut self,
524 v: V,
525 ) -> Self {
526 self.0.request = v.into();
527 self
528 }
529
530 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
532 self.0.options = v.into();
533 self
534 }
535
536 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
538 (*self.0.stub)
539 .wait_operation(self.0.request, self.0.options)
540 .await
541 .map(crate::Response::into_body)
542 }
543
544 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
546 self.0.request.name = v.into();
547 self
548 }
549
550 pub fn set_timeout<T>(mut self, v: T) -> Self
552 where
553 T: std::convert::Into<wkt::Duration>,
554 {
555 self.0.request.timeout = std::option::Option::Some(v.into());
556 self
557 }
558
559 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
561 where
562 T: std::convert::Into<wkt::Duration>,
563 {
564 self.0.request.timeout = v.map(|x| x.into());
565 self
566 }
567 }
568
569 #[doc(hidden)]
570 impl crate::RequestBuilder for WaitOperation {
571 fn request_options(&mut self) -> &mut crate::RequestOptions {
572 &mut self.0.options
573 }
574 }
575}
576
577pub mod executions {
578 use crate::Result;
579
580 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
594
595 pub(crate) mod client {
596 use super::super::super::client::Executions;
597 pub struct Factory;
598 impl crate::ClientFactory for Factory {
599 type Client = Executions;
600 type Credentials = gaxi::options::Credentials;
601 async fn build(
602 self,
603 config: gaxi::options::ClientConfig,
604 ) -> crate::ClientBuilderResult<Self::Client> {
605 Self::Client::new(config).await
606 }
607 }
608 }
609
610 #[derive(Clone, Debug)]
612 pub(crate) struct RequestBuilder<R: std::default::Default> {
613 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
614 request: R,
615 options: crate::RequestOptions,
616 }
617
618 impl<R> RequestBuilder<R>
619 where
620 R: std::default::Default,
621 {
622 pub(crate) fn new(
623 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
624 ) -> Self {
625 Self {
626 stub,
627 request: R::default(),
628 options: crate::RequestOptions::default(),
629 }
630 }
631 }
632
633 #[derive(Clone, Debug)]
650 pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
651
652 impl GetExecution {
653 pub(crate) fn new(
654 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
655 ) -> Self {
656 Self(RequestBuilder::new(stub))
657 }
658
659 pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
661 self.0.request = v.into();
662 self
663 }
664
665 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
667 self.0.options = v.into();
668 self
669 }
670
671 pub async fn send(self) -> Result<crate::model::Execution> {
673 (*self.0.stub)
674 .get_execution(self.0.request, self.0.options)
675 .await
676 .map(crate::Response::into_body)
677 }
678
679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
683 self.0.request.name = v.into();
684 self
685 }
686 }
687
688 #[doc(hidden)]
689 impl crate::RequestBuilder for GetExecution {
690 fn request_options(&mut self) -> &mut crate::RequestOptions {
691 &mut self.0.options
692 }
693 }
694
695 #[derive(Clone, Debug)]
716 pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
717
718 impl ListExecutions {
719 pub(crate) fn new(
720 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
721 ) -> Self {
722 Self(RequestBuilder::new(stub))
723 }
724
725 pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
727 self.0.request = v.into();
728 self
729 }
730
731 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
733 self.0.options = v.into();
734 self
735 }
736
737 pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
739 (*self.0.stub)
740 .list_executions(self.0.request, self.0.options)
741 .await
742 .map(crate::Response::into_body)
743 }
744
745 pub fn by_page(
747 self,
748 ) -> impl google_cloud_gax::paginator::Paginator<
749 crate::model::ListExecutionsResponse,
750 crate::Error,
751 > {
752 use std::clone::Clone;
753 let token = self.0.request.page_token.clone();
754 let execute = move |token: String| {
755 let mut builder = self.clone();
756 builder.0.request = builder.0.request.set_page_token(token);
757 builder.send()
758 };
759 google_cloud_gax::paginator::internal::new_paginator(token, execute)
760 }
761
762 pub fn by_item(
764 self,
765 ) -> impl google_cloud_gax::paginator::ItemPaginator<
766 crate::model::ListExecutionsResponse,
767 crate::Error,
768 > {
769 use google_cloud_gax::paginator::Paginator;
770 self.by_page().items()
771 }
772
773 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
777 self.0.request.parent = v.into();
778 self
779 }
780
781 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
783 self.0.request.page_size = v.into();
784 self
785 }
786
787 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
789 self.0.request.page_token = v.into();
790 self
791 }
792
793 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
795 self.0.request.show_deleted = v.into();
796 self
797 }
798 }
799
800 #[doc(hidden)]
801 impl crate::RequestBuilder for ListExecutions {
802 fn request_options(&mut self) -> &mut crate::RequestOptions {
803 &mut self.0.options
804 }
805 }
806
807 #[derive(Clone, Debug)]
825 pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
826
827 impl DeleteExecution {
828 pub(crate) fn new(
829 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
830 ) -> Self {
831 Self(RequestBuilder::new(stub))
832 }
833
834 pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
836 self.0.request = v.into();
837 self
838 }
839
840 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
842 self.0.options = v.into();
843 self
844 }
845
846 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
853 (*self.0.stub)
854 .delete_execution(self.0.request, self.0.options)
855 .await
856 .map(crate::Response::into_body)
857 }
858
859 pub fn poller(
861 self,
862 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
863 {
864 type Operation = google_cloud_lro::internal::Operation<
865 crate::model::Execution,
866 crate::model::Execution,
867 >;
868 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
869 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
870
871 let stub = self.0.stub.clone();
872 let mut options = self.0.options.clone();
873 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
874 let query = move |name| {
875 let stub = stub.clone();
876 let options = options.clone();
877 async {
878 let op = GetOperation::new(stub)
879 .set_name(name)
880 .with_options(options)
881 .send()
882 .await?;
883 Ok(Operation::new(op))
884 }
885 };
886
887 let start = move || async {
888 let op = self.send().await?;
889 Ok(Operation::new(op))
890 };
891
892 google_cloud_lro::internal::new_poller(
893 polling_error_policy,
894 polling_backoff_policy,
895 start,
896 query,
897 )
898 }
899
900 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
904 self.0.request.name = v.into();
905 self
906 }
907
908 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
910 self.0.request.validate_only = v.into();
911 self
912 }
913
914 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
916 self.0.request.etag = v.into();
917 self
918 }
919 }
920
921 #[doc(hidden)]
922 impl crate::RequestBuilder for DeleteExecution {
923 fn request_options(&mut self) -> &mut crate::RequestOptions {
924 &mut self.0.options
925 }
926 }
927
928 #[derive(Clone, Debug)]
946 pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
947
948 impl CancelExecution {
949 pub(crate) fn new(
950 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
951 ) -> Self {
952 Self(RequestBuilder::new(stub))
953 }
954
955 pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
957 self.0.request = v.into();
958 self
959 }
960
961 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
963 self.0.options = v.into();
964 self
965 }
966
967 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
974 (*self.0.stub)
975 .cancel_execution(self.0.request, self.0.options)
976 .await
977 .map(crate::Response::into_body)
978 }
979
980 pub fn poller(
982 self,
983 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
984 {
985 type Operation = google_cloud_lro::internal::Operation<
986 crate::model::Execution,
987 crate::model::Execution,
988 >;
989 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
990 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
991
992 let stub = self.0.stub.clone();
993 let mut options = self.0.options.clone();
994 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
995 let query = move |name| {
996 let stub = stub.clone();
997 let options = options.clone();
998 async {
999 let op = GetOperation::new(stub)
1000 .set_name(name)
1001 .with_options(options)
1002 .send()
1003 .await?;
1004 Ok(Operation::new(op))
1005 }
1006 };
1007
1008 let start = move || async {
1009 let op = self.send().await?;
1010 Ok(Operation::new(op))
1011 };
1012
1013 google_cloud_lro::internal::new_poller(
1014 polling_error_policy,
1015 polling_backoff_policy,
1016 start,
1017 query,
1018 )
1019 }
1020
1021 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1025 self.0.request.name = v.into();
1026 self
1027 }
1028
1029 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1031 self.0.request.validate_only = v.into();
1032 self
1033 }
1034
1035 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1037 self.0.request.etag = v.into();
1038 self
1039 }
1040 }
1041
1042 #[doc(hidden)]
1043 impl crate::RequestBuilder for CancelExecution {
1044 fn request_options(&mut self) -> &mut crate::RequestOptions {
1045 &mut self.0.options
1046 }
1047 }
1048
1049 #[derive(Clone, Debug)]
1070 pub struct ListOperations(
1071 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1072 );
1073
1074 impl ListOperations {
1075 pub(crate) fn new(
1076 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1077 ) -> Self {
1078 Self(RequestBuilder::new(stub))
1079 }
1080
1081 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1083 mut self,
1084 v: V,
1085 ) -> Self {
1086 self.0.request = v.into();
1087 self
1088 }
1089
1090 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1092 self.0.options = v.into();
1093 self
1094 }
1095
1096 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1098 (*self.0.stub)
1099 .list_operations(self.0.request, self.0.options)
1100 .await
1101 .map(crate::Response::into_body)
1102 }
1103
1104 pub fn by_page(
1106 self,
1107 ) -> impl google_cloud_gax::paginator::Paginator<
1108 google_cloud_longrunning::model::ListOperationsResponse,
1109 crate::Error,
1110 > {
1111 use std::clone::Clone;
1112 let token = self.0.request.page_token.clone();
1113 let execute = move |token: String| {
1114 let mut builder = self.clone();
1115 builder.0.request = builder.0.request.set_page_token(token);
1116 builder.send()
1117 };
1118 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1119 }
1120
1121 pub fn by_item(
1123 self,
1124 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1125 google_cloud_longrunning::model::ListOperationsResponse,
1126 crate::Error,
1127 > {
1128 use google_cloud_gax::paginator::Paginator;
1129 self.by_page().items()
1130 }
1131
1132 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1134 self.0.request.name = v.into();
1135 self
1136 }
1137
1138 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1140 self.0.request.filter = v.into();
1141 self
1142 }
1143
1144 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1146 self.0.request.page_size = v.into();
1147 self
1148 }
1149
1150 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1152 self.0.request.page_token = v.into();
1153 self
1154 }
1155
1156 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1158 self.0.request.return_partial_success = v.into();
1159 self
1160 }
1161 }
1162
1163 #[doc(hidden)]
1164 impl crate::RequestBuilder for ListOperations {
1165 fn request_options(&mut self) -> &mut crate::RequestOptions {
1166 &mut self.0.options
1167 }
1168 }
1169
1170 #[derive(Clone, Debug)]
1187 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1188
1189 impl GetOperation {
1190 pub(crate) fn new(
1191 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1192 ) -> Self {
1193 Self(RequestBuilder::new(stub))
1194 }
1195
1196 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1198 mut self,
1199 v: V,
1200 ) -> Self {
1201 self.0.request = v.into();
1202 self
1203 }
1204
1205 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1207 self.0.options = v.into();
1208 self
1209 }
1210
1211 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1213 (*self.0.stub)
1214 .get_operation(self.0.request, self.0.options)
1215 .await
1216 .map(crate::Response::into_body)
1217 }
1218
1219 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1221 self.0.request.name = v.into();
1222 self
1223 }
1224 }
1225
1226 #[doc(hidden)]
1227 impl crate::RequestBuilder for GetOperation {
1228 fn request_options(&mut self) -> &mut crate::RequestOptions {
1229 &mut self.0.options
1230 }
1231 }
1232
1233 #[derive(Clone, Debug)]
1250 pub struct DeleteOperation(
1251 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1252 );
1253
1254 impl DeleteOperation {
1255 pub(crate) fn new(
1256 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1257 ) -> Self {
1258 Self(RequestBuilder::new(stub))
1259 }
1260
1261 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1263 mut self,
1264 v: V,
1265 ) -> Self {
1266 self.0.request = v.into();
1267 self
1268 }
1269
1270 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1272 self.0.options = v.into();
1273 self
1274 }
1275
1276 pub async fn send(self) -> Result<()> {
1278 (*self.0.stub)
1279 .delete_operation(self.0.request, self.0.options)
1280 .await
1281 .map(crate::Response::into_body)
1282 }
1283
1284 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1286 self.0.request.name = v.into();
1287 self
1288 }
1289 }
1290
1291 #[doc(hidden)]
1292 impl crate::RequestBuilder for DeleteOperation {
1293 fn request_options(&mut self) -> &mut crate::RequestOptions {
1294 &mut self.0.options
1295 }
1296 }
1297
1298 #[derive(Clone, Debug)]
1315 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
1316
1317 impl WaitOperation {
1318 pub(crate) fn new(
1319 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1320 ) -> Self {
1321 Self(RequestBuilder::new(stub))
1322 }
1323
1324 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
1326 mut self,
1327 v: V,
1328 ) -> Self {
1329 self.0.request = v.into();
1330 self
1331 }
1332
1333 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1335 self.0.options = v.into();
1336 self
1337 }
1338
1339 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1341 (*self.0.stub)
1342 .wait_operation(self.0.request, self.0.options)
1343 .await
1344 .map(crate::Response::into_body)
1345 }
1346
1347 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1349 self.0.request.name = v.into();
1350 self
1351 }
1352
1353 pub fn set_timeout<T>(mut self, v: T) -> Self
1355 where
1356 T: std::convert::Into<wkt::Duration>,
1357 {
1358 self.0.request.timeout = std::option::Option::Some(v.into());
1359 self
1360 }
1361
1362 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1364 where
1365 T: std::convert::Into<wkt::Duration>,
1366 {
1367 self.0.request.timeout = v.map(|x| x.into());
1368 self
1369 }
1370 }
1371
1372 #[doc(hidden)]
1373 impl crate::RequestBuilder for WaitOperation {
1374 fn request_options(&mut self) -> &mut crate::RequestOptions {
1375 &mut self.0.options
1376 }
1377 }
1378}
1379
1380pub mod instances {
1381 use crate::Result;
1382
1383 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1397
1398 pub(crate) mod client {
1399 use super::super::super::client::Instances;
1400 pub struct Factory;
1401 impl crate::ClientFactory for Factory {
1402 type Client = Instances;
1403 type Credentials = gaxi::options::Credentials;
1404 async fn build(
1405 self,
1406 config: gaxi::options::ClientConfig,
1407 ) -> crate::ClientBuilderResult<Self::Client> {
1408 Self::Client::new(config).await
1409 }
1410 }
1411 }
1412
1413 #[derive(Clone, Debug)]
1415 pub(crate) struct RequestBuilder<R: std::default::Default> {
1416 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1417 request: R,
1418 options: crate::RequestOptions,
1419 }
1420
1421 impl<R> RequestBuilder<R>
1422 where
1423 R: std::default::Default,
1424 {
1425 pub(crate) fn new(
1426 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1427 ) -> Self {
1428 Self {
1429 stub,
1430 request: R::default(),
1431 options: crate::RequestOptions::default(),
1432 }
1433 }
1434 }
1435
1436 #[derive(Clone, Debug)]
1454 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1455
1456 impl CreateInstance {
1457 pub(crate) fn new(
1458 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1459 ) -> Self {
1460 Self(RequestBuilder::new(stub))
1461 }
1462
1463 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1465 self.0.request = v.into();
1466 self
1467 }
1468
1469 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1471 self.0.options = v.into();
1472 self
1473 }
1474
1475 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1482 (*self.0.stub)
1483 .create_instance(self.0.request, self.0.options)
1484 .await
1485 .map(crate::Response::into_body)
1486 }
1487
1488 pub fn poller(
1490 self,
1491 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1492 type Operation = google_cloud_lro::internal::Operation<
1493 crate::model::Instance,
1494 crate::model::Instance,
1495 >;
1496 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1497 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1498
1499 let stub = self.0.stub.clone();
1500 let mut options = self.0.options.clone();
1501 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1502 let query = move |name| {
1503 let stub = stub.clone();
1504 let options = options.clone();
1505 async {
1506 let op = GetOperation::new(stub)
1507 .set_name(name)
1508 .with_options(options)
1509 .send()
1510 .await?;
1511 Ok(Operation::new(op))
1512 }
1513 };
1514
1515 let start = move || async {
1516 let op = self.send().await?;
1517 Ok(Operation::new(op))
1518 };
1519
1520 google_cloud_lro::internal::new_poller(
1521 polling_error_policy,
1522 polling_backoff_policy,
1523 start,
1524 query,
1525 )
1526 }
1527
1528 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1532 self.0.request.parent = v.into();
1533 self
1534 }
1535
1536 pub fn set_instance<T>(mut self, v: T) -> Self
1540 where
1541 T: std::convert::Into<crate::model::Instance>,
1542 {
1543 self.0.request.instance = std::option::Option::Some(v.into());
1544 self
1545 }
1546
1547 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1551 where
1552 T: std::convert::Into<crate::model::Instance>,
1553 {
1554 self.0.request.instance = v.map(|x| x.into());
1555 self
1556 }
1557
1558 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.0.request.instance_id = v.into();
1563 self
1564 }
1565
1566 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1568 self.0.request.validate_only = v.into();
1569 self
1570 }
1571 }
1572
1573 #[doc(hidden)]
1574 impl crate::RequestBuilder for CreateInstance {
1575 fn request_options(&mut self) -> &mut crate::RequestOptions {
1576 &mut self.0.options
1577 }
1578 }
1579
1580 #[derive(Clone, Debug)]
1598 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1599
1600 impl DeleteInstance {
1601 pub(crate) fn new(
1602 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1603 ) -> Self {
1604 Self(RequestBuilder::new(stub))
1605 }
1606
1607 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1609 self.0.request = v.into();
1610 self
1611 }
1612
1613 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1615 self.0.options = v.into();
1616 self
1617 }
1618
1619 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1626 (*self.0.stub)
1627 .delete_instance(self.0.request, self.0.options)
1628 .await
1629 .map(crate::Response::into_body)
1630 }
1631
1632 pub fn poller(
1634 self,
1635 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1636 type Operation = google_cloud_lro::internal::Operation<
1637 crate::model::Instance,
1638 crate::model::Instance,
1639 >;
1640 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1641 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1642
1643 let stub = self.0.stub.clone();
1644 let mut options = self.0.options.clone();
1645 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1646 let query = move |name| {
1647 let stub = stub.clone();
1648 let options = options.clone();
1649 async {
1650 let op = GetOperation::new(stub)
1651 .set_name(name)
1652 .with_options(options)
1653 .send()
1654 .await?;
1655 Ok(Operation::new(op))
1656 }
1657 };
1658
1659 let start = move || async {
1660 let op = self.send().await?;
1661 Ok(Operation::new(op))
1662 };
1663
1664 google_cloud_lro::internal::new_poller(
1665 polling_error_policy,
1666 polling_backoff_policy,
1667 start,
1668 query,
1669 )
1670 }
1671
1672 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1676 self.0.request.name = v.into();
1677 self
1678 }
1679
1680 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1682 self.0.request.validate_only = v.into();
1683 self
1684 }
1685
1686 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1688 self.0.request.etag = v.into();
1689 self
1690 }
1691 }
1692
1693 #[doc(hidden)]
1694 impl crate::RequestBuilder for DeleteInstance {
1695 fn request_options(&mut self) -> &mut crate::RequestOptions {
1696 &mut self.0.options
1697 }
1698 }
1699
1700 #[derive(Clone, Debug)]
1717 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1718
1719 impl GetInstance {
1720 pub(crate) fn new(
1721 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1722 ) -> Self {
1723 Self(RequestBuilder::new(stub))
1724 }
1725
1726 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1728 self.0.request = v.into();
1729 self
1730 }
1731
1732 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1734 self.0.options = v.into();
1735 self
1736 }
1737
1738 pub async fn send(self) -> Result<crate::model::Instance> {
1740 (*self.0.stub)
1741 .get_instance(self.0.request, self.0.options)
1742 .await
1743 .map(crate::Response::into_body)
1744 }
1745
1746 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1750 self.0.request.name = v.into();
1751 self
1752 }
1753 }
1754
1755 #[doc(hidden)]
1756 impl crate::RequestBuilder for GetInstance {
1757 fn request_options(&mut self) -> &mut crate::RequestOptions {
1758 &mut self.0.options
1759 }
1760 }
1761
1762 #[derive(Clone, Debug)]
1783 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
1784
1785 impl ListInstances {
1786 pub(crate) fn new(
1787 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1788 ) -> Self {
1789 Self(RequestBuilder::new(stub))
1790 }
1791
1792 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
1794 self.0.request = v.into();
1795 self
1796 }
1797
1798 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1800 self.0.options = v.into();
1801 self
1802 }
1803
1804 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
1806 (*self.0.stub)
1807 .list_instances(self.0.request, self.0.options)
1808 .await
1809 .map(crate::Response::into_body)
1810 }
1811
1812 pub fn by_page(
1814 self,
1815 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
1816 {
1817 use std::clone::Clone;
1818 let token = self.0.request.page_token.clone();
1819 let execute = move |token: String| {
1820 let mut builder = self.clone();
1821 builder.0.request = builder.0.request.set_page_token(token);
1822 builder.send()
1823 };
1824 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1825 }
1826
1827 pub fn by_item(
1829 self,
1830 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1831 crate::model::ListInstancesResponse,
1832 crate::Error,
1833 > {
1834 use google_cloud_gax::paginator::Paginator;
1835 self.by_page().items()
1836 }
1837
1838 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1842 self.0.request.parent = v.into();
1843 self
1844 }
1845
1846 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1848 self.0.request.page_size = v.into();
1849 self
1850 }
1851
1852 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1854 self.0.request.page_token = v.into();
1855 self
1856 }
1857
1858 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1860 self.0.request.show_deleted = v.into();
1861 self
1862 }
1863 }
1864
1865 #[doc(hidden)]
1866 impl crate::RequestBuilder for ListInstances {
1867 fn request_options(&mut self) -> &mut crate::RequestOptions {
1868 &mut self.0.options
1869 }
1870 }
1871
1872 #[derive(Clone, Debug)]
1890 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
1891
1892 impl StopInstance {
1893 pub(crate) fn new(
1894 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1895 ) -> Self {
1896 Self(RequestBuilder::new(stub))
1897 }
1898
1899 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
1901 self.0.request = v.into();
1902 self
1903 }
1904
1905 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1907 self.0.options = v.into();
1908 self
1909 }
1910
1911 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1918 (*self.0.stub)
1919 .stop_instance(self.0.request, self.0.options)
1920 .await
1921 .map(crate::Response::into_body)
1922 }
1923
1924 pub fn poller(
1926 self,
1927 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1928 type Operation = google_cloud_lro::internal::Operation<
1929 crate::model::Instance,
1930 crate::model::Instance,
1931 >;
1932 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1933 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1934
1935 let stub = self.0.stub.clone();
1936 let mut options = self.0.options.clone();
1937 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1938 let query = move |name| {
1939 let stub = stub.clone();
1940 let options = options.clone();
1941 async {
1942 let op = GetOperation::new(stub)
1943 .set_name(name)
1944 .with_options(options)
1945 .send()
1946 .await?;
1947 Ok(Operation::new(op))
1948 }
1949 };
1950
1951 let start = move || async {
1952 let op = self.send().await?;
1953 Ok(Operation::new(op))
1954 };
1955
1956 google_cloud_lro::internal::new_poller(
1957 polling_error_policy,
1958 polling_backoff_policy,
1959 start,
1960 query,
1961 )
1962 }
1963
1964 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1968 self.0.request.name = v.into();
1969 self
1970 }
1971
1972 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1974 self.0.request.validate_only = v.into();
1975 self
1976 }
1977
1978 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1980 self.0.request.etag = v.into();
1981 self
1982 }
1983 }
1984
1985 #[doc(hidden)]
1986 impl crate::RequestBuilder for StopInstance {
1987 fn request_options(&mut self) -> &mut crate::RequestOptions {
1988 &mut self.0.options
1989 }
1990 }
1991
1992 #[derive(Clone, Debug)]
2010 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
2011
2012 impl StartInstance {
2013 pub(crate) fn new(
2014 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2015 ) -> Self {
2016 Self(RequestBuilder::new(stub))
2017 }
2018
2019 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
2021 self.0.request = v.into();
2022 self
2023 }
2024
2025 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2027 self.0.options = v.into();
2028 self
2029 }
2030
2031 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2038 (*self.0.stub)
2039 .start_instance(self.0.request, self.0.options)
2040 .await
2041 .map(crate::Response::into_body)
2042 }
2043
2044 pub fn poller(
2046 self,
2047 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
2048 type Operation = google_cloud_lro::internal::Operation<
2049 crate::model::Instance,
2050 crate::model::Instance,
2051 >;
2052 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2053 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2054
2055 let stub = self.0.stub.clone();
2056 let mut options = self.0.options.clone();
2057 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2058 let query = move |name| {
2059 let stub = stub.clone();
2060 let options = options.clone();
2061 async {
2062 let op = GetOperation::new(stub)
2063 .set_name(name)
2064 .with_options(options)
2065 .send()
2066 .await?;
2067 Ok(Operation::new(op))
2068 }
2069 };
2070
2071 let start = move || async {
2072 let op = self.send().await?;
2073 Ok(Operation::new(op))
2074 };
2075
2076 google_cloud_lro::internal::new_poller(
2077 polling_error_policy,
2078 polling_backoff_policy,
2079 start,
2080 query,
2081 )
2082 }
2083
2084 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2088 self.0.request.name = v.into();
2089 self
2090 }
2091
2092 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2094 self.0.request.validate_only = v.into();
2095 self
2096 }
2097
2098 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2100 self.0.request.etag = v.into();
2101 self
2102 }
2103 }
2104
2105 #[doc(hidden)]
2106 impl crate::RequestBuilder for StartInstance {
2107 fn request_options(&mut self) -> &mut crate::RequestOptions {
2108 &mut self.0.options
2109 }
2110 }
2111
2112 #[derive(Clone, Debug)]
2133 pub struct ListOperations(
2134 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2135 );
2136
2137 impl ListOperations {
2138 pub(crate) fn new(
2139 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2140 ) -> Self {
2141 Self(RequestBuilder::new(stub))
2142 }
2143
2144 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2146 mut self,
2147 v: V,
2148 ) -> Self {
2149 self.0.request = v.into();
2150 self
2151 }
2152
2153 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2155 self.0.options = v.into();
2156 self
2157 }
2158
2159 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2161 (*self.0.stub)
2162 .list_operations(self.0.request, self.0.options)
2163 .await
2164 .map(crate::Response::into_body)
2165 }
2166
2167 pub fn by_page(
2169 self,
2170 ) -> impl google_cloud_gax::paginator::Paginator<
2171 google_cloud_longrunning::model::ListOperationsResponse,
2172 crate::Error,
2173 > {
2174 use std::clone::Clone;
2175 let token = self.0.request.page_token.clone();
2176 let execute = move |token: String| {
2177 let mut builder = self.clone();
2178 builder.0.request = builder.0.request.set_page_token(token);
2179 builder.send()
2180 };
2181 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2182 }
2183
2184 pub fn by_item(
2186 self,
2187 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2188 google_cloud_longrunning::model::ListOperationsResponse,
2189 crate::Error,
2190 > {
2191 use google_cloud_gax::paginator::Paginator;
2192 self.by_page().items()
2193 }
2194
2195 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2197 self.0.request.name = v.into();
2198 self
2199 }
2200
2201 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2203 self.0.request.filter = v.into();
2204 self
2205 }
2206
2207 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2209 self.0.request.page_size = v.into();
2210 self
2211 }
2212
2213 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2215 self.0.request.page_token = v.into();
2216 self
2217 }
2218
2219 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2221 self.0.request.return_partial_success = v.into();
2222 self
2223 }
2224 }
2225
2226 #[doc(hidden)]
2227 impl crate::RequestBuilder for ListOperations {
2228 fn request_options(&mut self) -> &mut crate::RequestOptions {
2229 &mut self.0.options
2230 }
2231 }
2232
2233 #[derive(Clone, Debug)]
2250 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2251
2252 impl GetOperation {
2253 pub(crate) fn new(
2254 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2255 ) -> Self {
2256 Self(RequestBuilder::new(stub))
2257 }
2258
2259 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2261 mut self,
2262 v: V,
2263 ) -> Self {
2264 self.0.request = v.into();
2265 self
2266 }
2267
2268 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2270 self.0.options = v.into();
2271 self
2272 }
2273
2274 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2276 (*self.0.stub)
2277 .get_operation(self.0.request, self.0.options)
2278 .await
2279 .map(crate::Response::into_body)
2280 }
2281
2282 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2284 self.0.request.name = v.into();
2285 self
2286 }
2287 }
2288
2289 #[doc(hidden)]
2290 impl crate::RequestBuilder for GetOperation {
2291 fn request_options(&mut self) -> &mut crate::RequestOptions {
2292 &mut self.0.options
2293 }
2294 }
2295
2296 #[derive(Clone, Debug)]
2313 pub struct DeleteOperation(
2314 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2315 );
2316
2317 impl DeleteOperation {
2318 pub(crate) fn new(
2319 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2320 ) -> Self {
2321 Self(RequestBuilder::new(stub))
2322 }
2323
2324 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2326 mut self,
2327 v: V,
2328 ) -> Self {
2329 self.0.request = v.into();
2330 self
2331 }
2332
2333 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2335 self.0.options = v.into();
2336 self
2337 }
2338
2339 pub async fn send(self) -> Result<()> {
2341 (*self.0.stub)
2342 .delete_operation(self.0.request, self.0.options)
2343 .await
2344 .map(crate::Response::into_body)
2345 }
2346
2347 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2349 self.0.request.name = v.into();
2350 self
2351 }
2352 }
2353
2354 #[doc(hidden)]
2355 impl crate::RequestBuilder for DeleteOperation {
2356 fn request_options(&mut self) -> &mut crate::RequestOptions {
2357 &mut self.0.options
2358 }
2359 }
2360
2361 #[derive(Clone, Debug)]
2378 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
2379
2380 impl WaitOperation {
2381 pub(crate) fn new(
2382 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2383 ) -> Self {
2384 Self(RequestBuilder::new(stub))
2385 }
2386
2387 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
2389 mut self,
2390 v: V,
2391 ) -> Self {
2392 self.0.request = v.into();
2393 self
2394 }
2395
2396 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2398 self.0.options = v.into();
2399 self
2400 }
2401
2402 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2404 (*self.0.stub)
2405 .wait_operation(self.0.request, self.0.options)
2406 .await
2407 .map(crate::Response::into_body)
2408 }
2409
2410 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2412 self.0.request.name = v.into();
2413 self
2414 }
2415
2416 pub fn set_timeout<T>(mut self, v: T) -> Self
2418 where
2419 T: std::convert::Into<wkt::Duration>,
2420 {
2421 self.0.request.timeout = std::option::Option::Some(v.into());
2422 self
2423 }
2424
2425 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2427 where
2428 T: std::convert::Into<wkt::Duration>,
2429 {
2430 self.0.request.timeout = v.map(|x| x.into());
2431 self
2432 }
2433 }
2434
2435 #[doc(hidden)]
2436 impl crate::RequestBuilder for WaitOperation {
2437 fn request_options(&mut self) -> &mut crate::RequestOptions {
2438 &mut self.0.options
2439 }
2440 }
2441}
2442
2443pub mod jobs {
2444 use crate::Result;
2445
2446 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2460
2461 pub(crate) mod client {
2462 use super::super::super::client::Jobs;
2463 pub struct Factory;
2464 impl crate::ClientFactory for Factory {
2465 type Client = Jobs;
2466 type Credentials = gaxi::options::Credentials;
2467 async fn build(
2468 self,
2469 config: gaxi::options::ClientConfig,
2470 ) -> crate::ClientBuilderResult<Self::Client> {
2471 Self::Client::new(config).await
2472 }
2473 }
2474 }
2475
2476 #[derive(Clone, Debug)]
2478 pub(crate) struct RequestBuilder<R: std::default::Default> {
2479 stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
2480 request: R,
2481 options: crate::RequestOptions,
2482 }
2483
2484 impl<R> RequestBuilder<R>
2485 where
2486 R: std::default::Default,
2487 {
2488 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2489 Self {
2490 stub,
2491 request: R::default(),
2492 options: crate::RequestOptions::default(),
2493 }
2494 }
2495 }
2496
2497 #[derive(Clone, Debug)]
2515 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
2516
2517 impl CreateJob {
2518 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2519 Self(RequestBuilder::new(stub))
2520 }
2521
2522 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
2524 self.0.request = v.into();
2525 self
2526 }
2527
2528 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2530 self.0.options = v.into();
2531 self
2532 }
2533
2534 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2541 (*self.0.stub)
2542 .create_job(self.0.request, self.0.options)
2543 .await
2544 .map(crate::Response::into_body)
2545 }
2546
2547 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2549 type Operation =
2550 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2551 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2552 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2553
2554 let stub = self.0.stub.clone();
2555 let mut options = self.0.options.clone();
2556 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2557 let query = move |name| {
2558 let stub = stub.clone();
2559 let options = options.clone();
2560 async {
2561 let op = GetOperation::new(stub)
2562 .set_name(name)
2563 .with_options(options)
2564 .send()
2565 .await?;
2566 Ok(Operation::new(op))
2567 }
2568 };
2569
2570 let start = move || async {
2571 let op = self.send().await?;
2572 Ok(Operation::new(op))
2573 };
2574
2575 google_cloud_lro::internal::new_poller(
2576 polling_error_policy,
2577 polling_backoff_policy,
2578 start,
2579 query,
2580 )
2581 }
2582
2583 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2587 self.0.request.parent = v.into();
2588 self
2589 }
2590
2591 pub fn set_job<T>(mut self, v: T) -> Self
2595 where
2596 T: std::convert::Into<crate::model::Job>,
2597 {
2598 self.0.request.job = std::option::Option::Some(v.into());
2599 self
2600 }
2601
2602 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2606 where
2607 T: std::convert::Into<crate::model::Job>,
2608 {
2609 self.0.request.job = v.map(|x| x.into());
2610 self
2611 }
2612
2613 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2617 self.0.request.job_id = v.into();
2618 self
2619 }
2620
2621 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2623 self.0.request.validate_only = v.into();
2624 self
2625 }
2626 }
2627
2628 #[doc(hidden)]
2629 impl crate::RequestBuilder for CreateJob {
2630 fn request_options(&mut self) -> &mut crate::RequestOptions {
2631 &mut self.0.options
2632 }
2633 }
2634
2635 #[derive(Clone, Debug)]
2652 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
2653
2654 impl GetJob {
2655 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2656 Self(RequestBuilder::new(stub))
2657 }
2658
2659 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
2661 self.0.request = v.into();
2662 self
2663 }
2664
2665 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2667 self.0.options = v.into();
2668 self
2669 }
2670
2671 pub async fn send(self) -> Result<crate::model::Job> {
2673 (*self.0.stub)
2674 .get_job(self.0.request, self.0.options)
2675 .await
2676 .map(crate::Response::into_body)
2677 }
2678
2679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.0.request.name = v.into();
2684 self
2685 }
2686 }
2687
2688 #[doc(hidden)]
2689 impl crate::RequestBuilder for GetJob {
2690 fn request_options(&mut self) -> &mut crate::RequestOptions {
2691 &mut self.0.options
2692 }
2693 }
2694
2695 #[derive(Clone, Debug)]
2716 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
2717
2718 impl ListJobs {
2719 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2720 Self(RequestBuilder::new(stub))
2721 }
2722
2723 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
2725 self.0.request = v.into();
2726 self
2727 }
2728
2729 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2731 self.0.options = v.into();
2732 self
2733 }
2734
2735 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
2737 (*self.0.stub)
2738 .list_jobs(self.0.request, self.0.options)
2739 .await
2740 .map(crate::Response::into_body)
2741 }
2742
2743 pub fn by_page(
2745 self,
2746 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
2747 {
2748 use std::clone::Clone;
2749 let token = self.0.request.page_token.clone();
2750 let execute = move |token: String| {
2751 let mut builder = self.clone();
2752 builder.0.request = builder.0.request.set_page_token(token);
2753 builder.send()
2754 };
2755 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2756 }
2757
2758 pub fn by_item(
2760 self,
2761 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
2762 {
2763 use google_cloud_gax::paginator::Paginator;
2764 self.by_page().items()
2765 }
2766
2767 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2771 self.0.request.parent = v.into();
2772 self
2773 }
2774
2775 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2777 self.0.request.page_size = v.into();
2778 self
2779 }
2780
2781 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2783 self.0.request.page_token = v.into();
2784 self
2785 }
2786
2787 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2789 self.0.request.show_deleted = v.into();
2790 self
2791 }
2792 }
2793
2794 #[doc(hidden)]
2795 impl crate::RequestBuilder for ListJobs {
2796 fn request_options(&mut self) -> &mut crate::RequestOptions {
2797 &mut self.0.options
2798 }
2799 }
2800
2801 #[derive(Clone, Debug)]
2819 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
2820
2821 impl UpdateJob {
2822 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2823 Self(RequestBuilder::new(stub))
2824 }
2825
2826 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
2828 self.0.request = v.into();
2829 self
2830 }
2831
2832 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2834 self.0.options = v.into();
2835 self
2836 }
2837
2838 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2845 (*self.0.stub)
2846 .update_job(self.0.request, self.0.options)
2847 .await
2848 .map(crate::Response::into_body)
2849 }
2850
2851 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2853 type Operation =
2854 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2855 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2856 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2857
2858 let stub = self.0.stub.clone();
2859 let mut options = self.0.options.clone();
2860 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2861 let query = move |name| {
2862 let stub = stub.clone();
2863 let options = options.clone();
2864 async {
2865 let op = GetOperation::new(stub)
2866 .set_name(name)
2867 .with_options(options)
2868 .send()
2869 .await?;
2870 Ok(Operation::new(op))
2871 }
2872 };
2873
2874 let start = move || async {
2875 let op = self.send().await?;
2876 Ok(Operation::new(op))
2877 };
2878
2879 google_cloud_lro::internal::new_poller(
2880 polling_error_policy,
2881 polling_backoff_policy,
2882 start,
2883 query,
2884 )
2885 }
2886
2887 pub fn set_job<T>(mut self, v: T) -> Self
2891 where
2892 T: std::convert::Into<crate::model::Job>,
2893 {
2894 self.0.request.job = std::option::Option::Some(v.into());
2895 self
2896 }
2897
2898 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2902 where
2903 T: std::convert::Into<crate::model::Job>,
2904 {
2905 self.0.request.job = v.map(|x| x.into());
2906 self
2907 }
2908
2909 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2911 self.0.request.validate_only = v.into();
2912 self
2913 }
2914
2915 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2917 self.0.request.allow_missing = v.into();
2918 self
2919 }
2920 }
2921
2922 #[doc(hidden)]
2923 impl crate::RequestBuilder for UpdateJob {
2924 fn request_options(&mut self) -> &mut crate::RequestOptions {
2925 &mut self.0.options
2926 }
2927 }
2928
2929 #[derive(Clone, Debug)]
2947 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
2948
2949 impl DeleteJob {
2950 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2951 Self(RequestBuilder::new(stub))
2952 }
2953
2954 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
2956 self.0.request = v.into();
2957 self
2958 }
2959
2960 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2962 self.0.options = v.into();
2963 self
2964 }
2965
2966 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2973 (*self.0.stub)
2974 .delete_job(self.0.request, self.0.options)
2975 .await
2976 .map(crate::Response::into_body)
2977 }
2978
2979 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2981 type Operation =
2982 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2983 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2984 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2985
2986 let stub = self.0.stub.clone();
2987 let mut options = self.0.options.clone();
2988 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2989 let query = move |name| {
2990 let stub = stub.clone();
2991 let options = options.clone();
2992 async {
2993 let op = GetOperation::new(stub)
2994 .set_name(name)
2995 .with_options(options)
2996 .send()
2997 .await?;
2998 Ok(Operation::new(op))
2999 }
3000 };
3001
3002 let start = move || async {
3003 let op = self.send().await?;
3004 Ok(Operation::new(op))
3005 };
3006
3007 google_cloud_lro::internal::new_poller(
3008 polling_error_policy,
3009 polling_backoff_policy,
3010 start,
3011 query,
3012 )
3013 }
3014
3015 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3019 self.0.request.name = v.into();
3020 self
3021 }
3022
3023 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3025 self.0.request.validate_only = v.into();
3026 self
3027 }
3028
3029 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031 self.0.request.etag = v.into();
3032 self
3033 }
3034 }
3035
3036 #[doc(hidden)]
3037 impl crate::RequestBuilder for DeleteJob {
3038 fn request_options(&mut self) -> &mut crate::RequestOptions {
3039 &mut self.0.options
3040 }
3041 }
3042
3043 #[derive(Clone, Debug)]
3061 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
3062
3063 impl RunJob {
3064 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3065 Self(RequestBuilder::new(stub))
3066 }
3067
3068 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
3070 self.0.request = v.into();
3071 self
3072 }
3073
3074 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3076 self.0.options = v.into();
3077 self
3078 }
3079
3080 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3087 (*self.0.stub)
3088 .run_job(self.0.request, self.0.options)
3089 .await
3090 .map(crate::Response::into_body)
3091 }
3092
3093 pub fn poller(
3095 self,
3096 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
3097 {
3098 type Operation = google_cloud_lro::internal::Operation<
3099 crate::model::Execution,
3100 crate::model::Execution,
3101 >;
3102 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3103 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3104
3105 let stub = self.0.stub.clone();
3106 let mut options = self.0.options.clone();
3107 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3108 let query = move |name| {
3109 let stub = stub.clone();
3110 let options = options.clone();
3111 async {
3112 let op = GetOperation::new(stub)
3113 .set_name(name)
3114 .with_options(options)
3115 .send()
3116 .await?;
3117 Ok(Operation::new(op))
3118 }
3119 };
3120
3121 let start = move || async {
3122 let op = self.send().await?;
3123 Ok(Operation::new(op))
3124 };
3125
3126 google_cloud_lro::internal::new_poller(
3127 polling_error_policy,
3128 polling_backoff_policy,
3129 start,
3130 query,
3131 )
3132 }
3133
3134 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3138 self.0.request.name = v.into();
3139 self
3140 }
3141
3142 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3144 self.0.request.validate_only = v.into();
3145 self
3146 }
3147
3148 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150 self.0.request.etag = v.into();
3151 self
3152 }
3153
3154 pub fn set_overrides<T>(mut self, v: T) -> Self
3156 where
3157 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3158 {
3159 self.0.request.overrides = std::option::Option::Some(v.into());
3160 self
3161 }
3162
3163 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
3165 where
3166 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3167 {
3168 self.0.request.overrides = v.map(|x| x.into());
3169 self
3170 }
3171 }
3172
3173 #[doc(hidden)]
3174 impl crate::RequestBuilder for RunJob {
3175 fn request_options(&mut self) -> &mut crate::RequestOptions {
3176 &mut self.0.options
3177 }
3178 }
3179
3180 #[derive(Clone, Debug)]
3197 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3198
3199 impl GetIamPolicy {
3200 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3201 Self(RequestBuilder::new(stub))
3202 }
3203
3204 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3206 mut self,
3207 v: V,
3208 ) -> Self {
3209 self.0.request = v.into();
3210 self
3211 }
3212
3213 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3215 self.0.options = v.into();
3216 self
3217 }
3218
3219 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3221 (*self.0.stub)
3222 .get_iam_policy(self.0.request, self.0.options)
3223 .await
3224 .map(crate::Response::into_body)
3225 }
3226
3227 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3231 self.0.request.resource = v.into();
3232 self
3233 }
3234
3235 pub fn set_options<T>(mut self, v: T) -> Self
3237 where
3238 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3239 {
3240 self.0.request.options = std::option::Option::Some(v.into());
3241 self
3242 }
3243
3244 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3246 where
3247 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3248 {
3249 self.0.request.options = v.map(|x| x.into());
3250 self
3251 }
3252 }
3253
3254 #[doc(hidden)]
3255 impl crate::RequestBuilder for GetIamPolicy {
3256 fn request_options(&mut self) -> &mut crate::RequestOptions {
3257 &mut self.0.options
3258 }
3259 }
3260
3261 #[derive(Clone, Debug)]
3278 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3279
3280 impl SetIamPolicy {
3281 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3282 Self(RequestBuilder::new(stub))
3283 }
3284
3285 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3287 mut self,
3288 v: V,
3289 ) -> Self {
3290 self.0.request = v.into();
3291 self
3292 }
3293
3294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3296 self.0.options = v.into();
3297 self
3298 }
3299
3300 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3302 (*self.0.stub)
3303 .set_iam_policy(self.0.request, self.0.options)
3304 .await
3305 .map(crate::Response::into_body)
3306 }
3307
3308 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3312 self.0.request.resource = v.into();
3313 self
3314 }
3315
3316 pub fn set_policy<T>(mut self, v: T) -> Self
3320 where
3321 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3322 {
3323 self.0.request.policy = std::option::Option::Some(v.into());
3324 self
3325 }
3326
3327 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3331 where
3332 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3333 {
3334 self.0.request.policy = v.map(|x| x.into());
3335 self
3336 }
3337
3338 pub fn set_update_mask<T>(mut self, v: T) -> Self
3340 where
3341 T: std::convert::Into<wkt::FieldMask>,
3342 {
3343 self.0.request.update_mask = std::option::Option::Some(v.into());
3344 self
3345 }
3346
3347 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3349 where
3350 T: std::convert::Into<wkt::FieldMask>,
3351 {
3352 self.0.request.update_mask = v.map(|x| x.into());
3353 self
3354 }
3355 }
3356
3357 #[doc(hidden)]
3358 impl crate::RequestBuilder for SetIamPolicy {
3359 fn request_options(&mut self) -> &mut crate::RequestOptions {
3360 &mut self.0.options
3361 }
3362 }
3363
3364 #[derive(Clone, Debug)]
3381 pub struct TestIamPermissions(
3382 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3383 );
3384
3385 impl TestIamPermissions {
3386 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3387 Self(RequestBuilder::new(stub))
3388 }
3389
3390 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3392 mut self,
3393 v: V,
3394 ) -> Self {
3395 self.0.request = v.into();
3396 self
3397 }
3398
3399 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3401 self.0.options = v.into();
3402 self
3403 }
3404
3405 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3407 (*self.0.stub)
3408 .test_iam_permissions(self.0.request, self.0.options)
3409 .await
3410 .map(crate::Response::into_body)
3411 }
3412
3413 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3417 self.0.request.resource = v.into();
3418 self
3419 }
3420
3421 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3425 where
3426 T: std::iter::IntoIterator<Item = V>,
3427 V: std::convert::Into<std::string::String>,
3428 {
3429 use std::iter::Iterator;
3430 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3431 self
3432 }
3433 }
3434
3435 #[doc(hidden)]
3436 impl crate::RequestBuilder for TestIamPermissions {
3437 fn request_options(&mut self) -> &mut crate::RequestOptions {
3438 &mut self.0.options
3439 }
3440 }
3441
3442 #[derive(Clone, Debug)]
3463 pub struct ListOperations(
3464 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3465 );
3466
3467 impl ListOperations {
3468 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3469 Self(RequestBuilder::new(stub))
3470 }
3471
3472 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3474 mut self,
3475 v: V,
3476 ) -> Self {
3477 self.0.request = v.into();
3478 self
3479 }
3480
3481 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3483 self.0.options = v.into();
3484 self
3485 }
3486
3487 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3489 (*self.0.stub)
3490 .list_operations(self.0.request, self.0.options)
3491 .await
3492 .map(crate::Response::into_body)
3493 }
3494
3495 pub fn by_page(
3497 self,
3498 ) -> impl google_cloud_gax::paginator::Paginator<
3499 google_cloud_longrunning::model::ListOperationsResponse,
3500 crate::Error,
3501 > {
3502 use std::clone::Clone;
3503 let token = self.0.request.page_token.clone();
3504 let execute = move |token: String| {
3505 let mut builder = self.clone();
3506 builder.0.request = builder.0.request.set_page_token(token);
3507 builder.send()
3508 };
3509 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3510 }
3511
3512 pub fn by_item(
3514 self,
3515 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3516 google_cloud_longrunning::model::ListOperationsResponse,
3517 crate::Error,
3518 > {
3519 use google_cloud_gax::paginator::Paginator;
3520 self.by_page().items()
3521 }
3522
3523 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3525 self.0.request.name = v.into();
3526 self
3527 }
3528
3529 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3531 self.0.request.filter = v.into();
3532 self
3533 }
3534
3535 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3537 self.0.request.page_size = v.into();
3538 self
3539 }
3540
3541 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3543 self.0.request.page_token = v.into();
3544 self
3545 }
3546
3547 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3549 self.0.request.return_partial_success = v.into();
3550 self
3551 }
3552 }
3553
3554 #[doc(hidden)]
3555 impl crate::RequestBuilder for ListOperations {
3556 fn request_options(&mut self) -> &mut crate::RequestOptions {
3557 &mut self.0.options
3558 }
3559 }
3560
3561 #[derive(Clone, Debug)]
3578 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3579
3580 impl GetOperation {
3581 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3582 Self(RequestBuilder::new(stub))
3583 }
3584
3585 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3587 mut self,
3588 v: V,
3589 ) -> Self {
3590 self.0.request = v.into();
3591 self
3592 }
3593
3594 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3596 self.0.options = v.into();
3597 self
3598 }
3599
3600 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3602 (*self.0.stub)
3603 .get_operation(self.0.request, self.0.options)
3604 .await
3605 .map(crate::Response::into_body)
3606 }
3607
3608 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3610 self.0.request.name = v.into();
3611 self
3612 }
3613 }
3614
3615 #[doc(hidden)]
3616 impl crate::RequestBuilder for GetOperation {
3617 fn request_options(&mut self) -> &mut crate::RequestOptions {
3618 &mut self.0.options
3619 }
3620 }
3621
3622 #[derive(Clone, Debug)]
3639 pub struct DeleteOperation(
3640 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3641 );
3642
3643 impl DeleteOperation {
3644 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3645 Self(RequestBuilder::new(stub))
3646 }
3647
3648 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3650 mut self,
3651 v: V,
3652 ) -> Self {
3653 self.0.request = v.into();
3654 self
3655 }
3656
3657 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3659 self.0.options = v.into();
3660 self
3661 }
3662
3663 pub async fn send(self) -> Result<()> {
3665 (*self.0.stub)
3666 .delete_operation(self.0.request, self.0.options)
3667 .await
3668 .map(crate::Response::into_body)
3669 }
3670
3671 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3673 self.0.request.name = v.into();
3674 self
3675 }
3676 }
3677
3678 #[doc(hidden)]
3679 impl crate::RequestBuilder for DeleteOperation {
3680 fn request_options(&mut self) -> &mut crate::RequestOptions {
3681 &mut self.0.options
3682 }
3683 }
3684
3685 #[derive(Clone, Debug)]
3702 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
3703
3704 impl WaitOperation {
3705 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3706 Self(RequestBuilder::new(stub))
3707 }
3708
3709 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
3711 mut self,
3712 v: V,
3713 ) -> Self {
3714 self.0.request = v.into();
3715 self
3716 }
3717
3718 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3720 self.0.options = v.into();
3721 self
3722 }
3723
3724 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3726 (*self.0.stub)
3727 .wait_operation(self.0.request, self.0.options)
3728 .await
3729 .map(crate::Response::into_body)
3730 }
3731
3732 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3734 self.0.request.name = v.into();
3735 self
3736 }
3737
3738 pub fn set_timeout<T>(mut self, v: T) -> Self
3740 where
3741 T: std::convert::Into<wkt::Duration>,
3742 {
3743 self.0.request.timeout = std::option::Option::Some(v.into());
3744 self
3745 }
3746
3747 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3749 where
3750 T: std::convert::Into<wkt::Duration>,
3751 {
3752 self.0.request.timeout = v.map(|x| x.into());
3753 self
3754 }
3755 }
3756
3757 #[doc(hidden)]
3758 impl crate::RequestBuilder for WaitOperation {
3759 fn request_options(&mut self) -> &mut crate::RequestOptions {
3760 &mut self.0.options
3761 }
3762 }
3763}
3764
3765pub mod revisions {
3766 use crate::Result;
3767
3768 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3782
3783 pub(crate) mod client {
3784 use super::super::super::client::Revisions;
3785 pub struct Factory;
3786 impl crate::ClientFactory for Factory {
3787 type Client = Revisions;
3788 type Credentials = gaxi::options::Credentials;
3789 async fn build(
3790 self,
3791 config: gaxi::options::ClientConfig,
3792 ) -> crate::ClientBuilderResult<Self::Client> {
3793 Self::Client::new(config).await
3794 }
3795 }
3796 }
3797
3798 #[derive(Clone, Debug)]
3800 pub(crate) struct RequestBuilder<R: std::default::Default> {
3801 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3802 request: R,
3803 options: crate::RequestOptions,
3804 }
3805
3806 impl<R> RequestBuilder<R>
3807 where
3808 R: std::default::Default,
3809 {
3810 pub(crate) fn new(
3811 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3812 ) -> Self {
3813 Self {
3814 stub,
3815 request: R::default(),
3816 options: crate::RequestOptions::default(),
3817 }
3818 }
3819 }
3820
3821 #[derive(Clone, Debug)]
3838 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
3839
3840 impl GetRevision {
3841 pub(crate) fn new(
3842 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3843 ) -> Self {
3844 Self(RequestBuilder::new(stub))
3845 }
3846
3847 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
3849 self.0.request = v.into();
3850 self
3851 }
3852
3853 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3855 self.0.options = v.into();
3856 self
3857 }
3858
3859 pub async fn send(self) -> Result<crate::model::Revision> {
3861 (*self.0.stub)
3862 .get_revision(self.0.request, self.0.options)
3863 .await
3864 .map(crate::Response::into_body)
3865 }
3866
3867 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3871 self.0.request.name = v.into();
3872 self
3873 }
3874 }
3875
3876 #[doc(hidden)]
3877 impl crate::RequestBuilder for GetRevision {
3878 fn request_options(&mut self) -> &mut crate::RequestOptions {
3879 &mut self.0.options
3880 }
3881 }
3882
3883 #[derive(Clone, Debug)]
3904 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
3905
3906 impl ListRevisions {
3907 pub(crate) fn new(
3908 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3909 ) -> Self {
3910 Self(RequestBuilder::new(stub))
3911 }
3912
3913 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
3915 self.0.request = v.into();
3916 self
3917 }
3918
3919 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3921 self.0.options = v.into();
3922 self
3923 }
3924
3925 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
3927 (*self.0.stub)
3928 .list_revisions(self.0.request, self.0.options)
3929 .await
3930 .map(crate::Response::into_body)
3931 }
3932
3933 pub fn by_page(
3935 self,
3936 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRevisionsResponse, crate::Error>
3937 {
3938 use std::clone::Clone;
3939 let token = self.0.request.page_token.clone();
3940 let execute = move |token: String| {
3941 let mut builder = self.clone();
3942 builder.0.request = builder.0.request.set_page_token(token);
3943 builder.send()
3944 };
3945 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3946 }
3947
3948 pub fn by_item(
3950 self,
3951 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3952 crate::model::ListRevisionsResponse,
3953 crate::Error,
3954 > {
3955 use google_cloud_gax::paginator::Paginator;
3956 self.by_page().items()
3957 }
3958
3959 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3963 self.0.request.parent = v.into();
3964 self
3965 }
3966
3967 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3969 self.0.request.page_size = v.into();
3970 self
3971 }
3972
3973 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3975 self.0.request.page_token = v.into();
3976 self
3977 }
3978
3979 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3981 self.0.request.show_deleted = v.into();
3982 self
3983 }
3984 }
3985
3986 #[doc(hidden)]
3987 impl crate::RequestBuilder for ListRevisions {
3988 fn request_options(&mut self) -> &mut crate::RequestOptions {
3989 &mut self.0.options
3990 }
3991 }
3992
3993 #[derive(Clone, Debug)]
4011 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
4012
4013 impl DeleteRevision {
4014 pub(crate) fn new(
4015 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4016 ) -> Self {
4017 Self(RequestBuilder::new(stub))
4018 }
4019
4020 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
4022 self.0.request = v.into();
4023 self
4024 }
4025
4026 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4028 self.0.options = v.into();
4029 self
4030 }
4031
4032 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4039 (*self.0.stub)
4040 .delete_revision(self.0.request, self.0.options)
4041 .await
4042 .map(crate::Response::into_body)
4043 }
4044
4045 pub fn poller(
4047 self,
4048 ) -> impl google_cloud_lro::Poller<crate::model::Revision, crate::model::Revision> {
4049 type Operation = google_cloud_lro::internal::Operation<
4050 crate::model::Revision,
4051 crate::model::Revision,
4052 >;
4053 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4054 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4055
4056 let stub = self.0.stub.clone();
4057 let mut options = self.0.options.clone();
4058 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4059 let query = move |name| {
4060 let stub = stub.clone();
4061 let options = options.clone();
4062 async {
4063 let op = GetOperation::new(stub)
4064 .set_name(name)
4065 .with_options(options)
4066 .send()
4067 .await?;
4068 Ok(Operation::new(op))
4069 }
4070 };
4071
4072 let start = move || async {
4073 let op = self.send().await?;
4074 Ok(Operation::new(op))
4075 };
4076
4077 google_cloud_lro::internal::new_poller(
4078 polling_error_policy,
4079 polling_backoff_policy,
4080 start,
4081 query,
4082 )
4083 }
4084
4085 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4089 self.0.request.name = v.into();
4090 self
4091 }
4092
4093 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4095 self.0.request.validate_only = v.into();
4096 self
4097 }
4098
4099 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4101 self.0.request.etag = v.into();
4102 self
4103 }
4104 }
4105
4106 #[doc(hidden)]
4107 impl crate::RequestBuilder for DeleteRevision {
4108 fn request_options(&mut self) -> &mut crate::RequestOptions {
4109 &mut self.0.options
4110 }
4111 }
4112
4113 #[derive(Clone, Debug)]
4134 pub struct ListOperations(
4135 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4136 );
4137
4138 impl ListOperations {
4139 pub(crate) fn new(
4140 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4141 ) -> Self {
4142 Self(RequestBuilder::new(stub))
4143 }
4144
4145 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4147 mut self,
4148 v: V,
4149 ) -> Self {
4150 self.0.request = v.into();
4151 self
4152 }
4153
4154 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4156 self.0.options = v.into();
4157 self
4158 }
4159
4160 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4162 (*self.0.stub)
4163 .list_operations(self.0.request, self.0.options)
4164 .await
4165 .map(crate::Response::into_body)
4166 }
4167
4168 pub fn by_page(
4170 self,
4171 ) -> impl google_cloud_gax::paginator::Paginator<
4172 google_cloud_longrunning::model::ListOperationsResponse,
4173 crate::Error,
4174 > {
4175 use std::clone::Clone;
4176 let token = self.0.request.page_token.clone();
4177 let execute = move |token: String| {
4178 let mut builder = self.clone();
4179 builder.0.request = builder.0.request.set_page_token(token);
4180 builder.send()
4181 };
4182 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4183 }
4184
4185 pub fn by_item(
4187 self,
4188 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4189 google_cloud_longrunning::model::ListOperationsResponse,
4190 crate::Error,
4191 > {
4192 use google_cloud_gax::paginator::Paginator;
4193 self.by_page().items()
4194 }
4195
4196 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4198 self.0.request.name = v.into();
4199 self
4200 }
4201
4202 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4204 self.0.request.filter = v.into();
4205 self
4206 }
4207
4208 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4210 self.0.request.page_size = v.into();
4211 self
4212 }
4213
4214 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4216 self.0.request.page_token = v.into();
4217 self
4218 }
4219
4220 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4222 self.0.request.return_partial_success = v.into();
4223 self
4224 }
4225 }
4226
4227 #[doc(hidden)]
4228 impl crate::RequestBuilder for ListOperations {
4229 fn request_options(&mut self) -> &mut crate::RequestOptions {
4230 &mut self.0.options
4231 }
4232 }
4233
4234 #[derive(Clone, Debug)]
4251 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4252
4253 impl GetOperation {
4254 pub(crate) fn new(
4255 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4256 ) -> Self {
4257 Self(RequestBuilder::new(stub))
4258 }
4259
4260 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4262 mut self,
4263 v: V,
4264 ) -> Self {
4265 self.0.request = v.into();
4266 self
4267 }
4268
4269 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4271 self.0.options = v.into();
4272 self
4273 }
4274
4275 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4277 (*self.0.stub)
4278 .get_operation(self.0.request, self.0.options)
4279 .await
4280 .map(crate::Response::into_body)
4281 }
4282
4283 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4285 self.0.request.name = v.into();
4286 self
4287 }
4288 }
4289
4290 #[doc(hidden)]
4291 impl crate::RequestBuilder for GetOperation {
4292 fn request_options(&mut self) -> &mut crate::RequestOptions {
4293 &mut self.0.options
4294 }
4295 }
4296
4297 #[derive(Clone, Debug)]
4314 pub struct DeleteOperation(
4315 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
4316 );
4317
4318 impl DeleteOperation {
4319 pub(crate) fn new(
4320 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4321 ) -> Self {
4322 Self(RequestBuilder::new(stub))
4323 }
4324
4325 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
4327 mut self,
4328 v: V,
4329 ) -> Self {
4330 self.0.request = v.into();
4331 self
4332 }
4333
4334 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4336 self.0.options = v.into();
4337 self
4338 }
4339
4340 pub async fn send(self) -> Result<()> {
4342 (*self.0.stub)
4343 .delete_operation(self.0.request, self.0.options)
4344 .await
4345 .map(crate::Response::into_body)
4346 }
4347
4348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4350 self.0.request.name = v.into();
4351 self
4352 }
4353 }
4354
4355 #[doc(hidden)]
4356 impl crate::RequestBuilder for DeleteOperation {
4357 fn request_options(&mut self) -> &mut crate::RequestOptions {
4358 &mut self.0.options
4359 }
4360 }
4361
4362 #[derive(Clone, Debug)]
4379 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
4380
4381 impl WaitOperation {
4382 pub(crate) fn new(
4383 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4384 ) -> Self {
4385 Self(RequestBuilder::new(stub))
4386 }
4387
4388 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
4390 mut self,
4391 v: V,
4392 ) -> Self {
4393 self.0.request = v.into();
4394 self
4395 }
4396
4397 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4399 self.0.options = v.into();
4400 self
4401 }
4402
4403 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4405 (*self.0.stub)
4406 .wait_operation(self.0.request, self.0.options)
4407 .await
4408 .map(crate::Response::into_body)
4409 }
4410
4411 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4413 self.0.request.name = v.into();
4414 self
4415 }
4416
4417 pub fn set_timeout<T>(mut self, v: T) -> Self
4419 where
4420 T: std::convert::Into<wkt::Duration>,
4421 {
4422 self.0.request.timeout = std::option::Option::Some(v.into());
4423 self
4424 }
4425
4426 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4428 where
4429 T: std::convert::Into<wkt::Duration>,
4430 {
4431 self.0.request.timeout = v.map(|x| x.into());
4432 self
4433 }
4434 }
4435
4436 #[doc(hidden)]
4437 impl crate::RequestBuilder for WaitOperation {
4438 fn request_options(&mut self) -> &mut crate::RequestOptions {
4439 &mut self.0.options
4440 }
4441 }
4442}
4443
4444pub mod services {
4445 use crate::Result;
4446
4447 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4461
4462 pub(crate) mod client {
4463 use super::super::super::client::Services;
4464 pub struct Factory;
4465 impl crate::ClientFactory for Factory {
4466 type Client = Services;
4467 type Credentials = gaxi::options::Credentials;
4468 async fn build(
4469 self,
4470 config: gaxi::options::ClientConfig,
4471 ) -> crate::ClientBuilderResult<Self::Client> {
4472 Self::Client::new(config).await
4473 }
4474 }
4475 }
4476
4477 #[derive(Clone, Debug)]
4479 pub(crate) struct RequestBuilder<R: std::default::Default> {
4480 stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
4481 request: R,
4482 options: crate::RequestOptions,
4483 }
4484
4485 impl<R> RequestBuilder<R>
4486 where
4487 R: std::default::Default,
4488 {
4489 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4490 Self {
4491 stub,
4492 request: R::default(),
4493 options: crate::RequestOptions::default(),
4494 }
4495 }
4496 }
4497
4498 #[derive(Clone, Debug)]
4516 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
4517
4518 impl CreateService {
4519 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4520 Self(RequestBuilder::new(stub))
4521 }
4522
4523 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
4525 self.0.request = v.into();
4526 self
4527 }
4528
4529 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4531 self.0.options = v.into();
4532 self
4533 }
4534
4535 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4542 (*self.0.stub)
4543 .create_service(self.0.request, self.0.options)
4544 .await
4545 .map(crate::Response::into_body)
4546 }
4547
4548 pub fn poller(
4550 self,
4551 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4552 type Operation =
4553 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4554 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4555 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4556
4557 let stub = self.0.stub.clone();
4558 let mut options = self.0.options.clone();
4559 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4560 let query = move |name| {
4561 let stub = stub.clone();
4562 let options = options.clone();
4563 async {
4564 let op = GetOperation::new(stub)
4565 .set_name(name)
4566 .with_options(options)
4567 .send()
4568 .await?;
4569 Ok(Operation::new(op))
4570 }
4571 };
4572
4573 let start = move || async {
4574 let op = self.send().await?;
4575 Ok(Operation::new(op))
4576 };
4577
4578 google_cloud_lro::internal::new_poller(
4579 polling_error_policy,
4580 polling_backoff_policy,
4581 start,
4582 query,
4583 )
4584 }
4585
4586 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4590 self.0.request.parent = v.into();
4591 self
4592 }
4593
4594 pub fn set_service<T>(mut self, v: T) -> Self
4598 where
4599 T: std::convert::Into<crate::model::Service>,
4600 {
4601 self.0.request.service = std::option::Option::Some(v.into());
4602 self
4603 }
4604
4605 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4609 where
4610 T: std::convert::Into<crate::model::Service>,
4611 {
4612 self.0.request.service = v.map(|x| x.into());
4613 self
4614 }
4615
4616 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4620 self.0.request.service_id = v.into();
4621 self
4622 }
4623
4624 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4626 self.0.request.validate_only = v.into();
4627 self
4628 }
4629 }
4630
4631 #[doc(hidden)]
4632 impl crate::RequestBuilder for CreateService {
4633 fn request_options(&mut self) -> &mut crate::RequestOptions {
4634 &mut self.0.options
4635 }
4636 }
4637
4638 #[derive(Clone, Debug)]
4655 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
4656
4657 impl GetService {
4658 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4659 Self(RequestBuilder::new(stub))
4660 }
4661
4662 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
4664 self.0.request = v.into();
4665 self
4666 }
4667
4668 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4670 self.0.options = v.into();
4671 self
4672 }
4673
4674 pub async fn send(self) -> Result<crate::model::Service> {
4676 (*self.0.stub)
4677 .get_service(self.0.request, self.0.options)
4678 .await
4679 .map(crate::Response::into_body)
4680 }
4681
4682 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4686 self.0.request.name = v.into();
4687 self
4688 }
4689 }
4690
4691 #[doc(hidden)]
4692 impl crate::RequestBuilder for GetService {
4693 fn request_options(&mut self) -> &mut crate::RequestOptions {
4694 &mut self.0.options
4695 }
4696 }
4697
4698 #[derive(Clone, Debug)]
4719 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
4720
4721 impl ListServices {
4722 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4723 Self(RequestBuilder::new(stub))
4724 }
4725
4726 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
4728 self.0.request = v.into();
4729 self
4730 }
4731
4732 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4734 self.0.options = v.into();
4735 self
4736 }
4737
4738 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
4740 (*self.0.stub)
4741 .list_services(self.0.request, self.0.options)
4742 .await
4743 .map(crate::Response::into_body)
4744 }
4745
4746 pub fn by_page(
4748 self,
4749 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListServicesResponse, crate::Error>
4750 {
4751 use std::clone::Clone;
4752 let token = self.0.request.page_token.clone();
4753 let execute = move |token: String| {
4754 let mut builder = self.clone();
4755 builder.0.request = builder.0.request.set_page_token(token);
4756 builder.send()
4757 };
4758 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4759 }
4760
4761 pub fn by_item(
4763 self,
4764 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4765 crate::model::ListServicesResponse,
4766 crate::Error,
4767 > {
4768 use google_cloud_gax::paginator::Paginator;
4769 self.by_page().items()
4770 }
4771
4772 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4776 self.0.request.parent = v.into();
4777 self
4778 }
4779
4780 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4782 self.0.request.page_size = v.into();
4783 self
4784 }
4785
4786 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4788 self.0.request.page_token = v.into();
4789 self
4790 }
4791
4792 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4794 self.0.request.show_deleted = v.into();
4795 self
4796 }
4797 }
4798
4799 #[doc(hidden)]
4800 impl crate::RequestBuilder for ListServices {
4801 fn request_options(&mut self) -> &mut crate::RequestOptions {
4802 &mut self.0.options
4803 }
4804 }
4805
4806 #[derive(Clone, Debug)]
4824 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
4825
4826 impl UpdateService {
4827 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4828 Self(RequestBuilder::new(stub))
4829 }
4830
4831 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
4833 self.0.request = v.into();
4834 self
4835 }
4836
4837 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4839 self.0.options = v.into();
4840 self
4841 }
4842
4843 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4850 (*self.0.stub)
4851 .update_service(self.0.request, self.0.options)
4852 .await
4853 .map(crate::Response::into_body)
4854 }
4855
4856 pub fn poller(
4858 self,
4859 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4860 type Operation =
4861 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4862 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4863 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4864
4865 let stub = self.0.stub.clone();
4866 let mut options = self.0.options.clone();
4867 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4868 let query = move |name| {
4869 let stub = stub.clone();
4870 let options = options.clone();
4871 async {
4872 let op = GetOperation::new(stub)
4873 .set_name(name)
4874 .with_options(options)
4875 .send()
4876 .await?;
4877 Ok(Operation::new(op))
4878 }
4879 };
4880
4881 let start = move || async {
4882 let op = self.send().await?;
4883 Ok(Operation::new(op))
4884 };
4885
4886 google_cloud_lro::internal::new_poller(
4887 polling_error_policy,
4888 polling_backoff_policy,
4889 start,
4890 query,
4891 )
4892 }
4893
4894 pub fn set_update_mask<T>(mut self, v: T) -> Self
4896 where
4897 T: std::convert::Into<wkt::FieldMask>,
4898 {
4899 self.0.request.update_mask = std::option::Option::Some(v.into());
4900 self
4901 }
4902
4903 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4905 where
4906 T: std::convert::Into<wkt::FieldMask>,
4907 {
4908 self.0.request.update_mask = v.map(|x| x.into());
4909 self
4910 }
4911
4912 pub fn set_service<T>(mut self, v: T) -> Self
4916 where
4917 T: std::convert::Into<crate::model::Service>,
4918 {
4919 self.0.request.service = std::option::Option::Some(v.into());
4920 self
4921 }
4922
4923 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4927 where
4928 T: std::convert::Into<crate::model::Service>,
4929 {
4930 self.0.request.service = v.map(|x| x.into());
4931 self
4932 }
4933
4934 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4936 self.0.request.validate_only = v.into();
4937 self
4938 }
4939
4940 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
4942 self.0.request.allow_missing = v.into();
4943 self
4944 }
4945 }
4946
4947 #[doc(hidden)]
4948 impl crate::RequestBuilder for UpdateService {
4949 fn request_options(&mut self) -> &mut crate::RequestOptions {
4950 &mut self.0.options
4951 }
4952 }
4953
4954 #[derive(Clone, Debug)]
4972 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
4973
4974 impl DeleteService {
4975 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4976 Self(RequestBuilder::new(stub))
4977 }
4978
4979 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
4981 self.0.request = v.into();
4982 self
4983 }
4984
4985 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4987 self.0.options = v.into();
4988 self
4989 }
4990
4991 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4998 (*self.0.stub)
4999 .delete_service(self.0.request, self.0.options)
5000 .await
5001 .map(crate::Response::into_body)
5002 }
5003
5004 pub fn poller(
5006 self,
5007 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
5008 type Operation =
5009 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
5010 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5011 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5012
5013 let stub = self.0.stub.clone();
5014 let mut options = self.0.options.clone();
5015 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5016 let query = move |name| {
5017 let stub = stub.clone();
5018 let options = options.clone();
5019 async {
5020 let op = GetOperation::new(stub)
5021 .set_name(name)
5022 .with_options(options)
5023 .send()
5024 .await?;
5025 Ok(Operation::new(op))
5026 }
5027 };
5028
5029 let start = move || async {
5030 let op = self.send().await?;
5031 Ok(Operation::new(op))
5032 };
5033
5034 google_cloud_lro::internal::new_poller(
5035 polling_error_policy,
5036 polling_backoff_policy,
5037 start,
5038 query,
5039 )
5040 }
5041
5042 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5046 self.0.request.name = v.into();
5047 self
5048 }
5049
5050 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5052 self.0.request.validate_only = v.into();
5053 self
5054 }
5055
5056 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5058 self.0.request.etag = v.into();
5059 self
5060 }
5061 }
5062
5063 #[doc(hidden)]
5064 impl crate::RequestBuilder for DeleteService {
5065 fn request_options(&mut self) -> &mut crate::RequestOptions {
5066 &mut self.0.options
5067 }
5068 }
5069
5070 #[derive(Clone, Debug)]
5087 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5088
5089 impl GetIamPolicy {
5090 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5091 Self(RequestBuilder::new(stub))
5092 }
5093
5094 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5096 mut self,
5097 v: V,
5098 ) -> Self {
5099 self.0.request = v.into();
5100 self
5101 }
5102
5103 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5105 self.0.options = v.into();
5106 self
5107 }
5108
5109 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5111 (*self.0.stub)
5112 .get_iam_policy(self.0.request, self.0.options)
5113 .await
5114 .map(crate::Response::into_body)
5115 }
5116
5117 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5121 self.0.request.resource = v.into();
5122 self
5123 }
5124
5125 pub fn set_options<T>(mut self, v: T) -> Self
5127 where
5128 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5129 {
5130 self.0.request.options = std::option::Option::Some(v.into());
5131 self
5132 }
5133
5134 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5136 where
5137 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5138 {
5139 self.0.request.options = v.map(|x| x.into());
5140 self
5141 }
5142 }
5143
5144 #[doc(hidden)]
5145 impl crate::RequestBuilder for GetIamPolicy {
5146 fn request_options(&mut self) -> &mut crate::RequestOptions {
5147 &mut self.0.options
5148 }
5149 }
5150
5151 #[derive(Clone, Debug)]
5168 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5169
5170 impl SetIamPolicy {
5171 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5172 Self(RequestBuilder::new(stub))
5173 }
5174
5175 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5177 mut self,
5178 v: V,
5179 ) -> Self {
5180 self.0.request = v.into();
5181 self
5182 }
5183
5184 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5186 self.0.options = v.into();
5187 self
5188 }
5189
5190 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5192 (*self.0.stub)
5193 .set_iam_policy(self.0.request, self.0.options)
5194 .await
5195 .map(crate::Response::into_body)
5196 }
5197
5198 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5202 self.0.request.resource = v.into();
5203 self
5204 }
5205
5206 pub fn set_policy<T>(mut self, v: T) -> Self
5210 where
5211 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5212 {
5213 self.0.request.policy = std::option::Option::Some(v.into());
5214 self
5215 }
5216
5217 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5221 where
5222 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5223 {
5224 self.0.request.policy = v.map(|x| x.into());
5225 self
5226 }
5227
5228 pub fn set_update_mask<T>(mut self, v: T) -> Self
5230 where
5231 T: std::convert::Into<wkt::FieldMask>,
5232 {
5233 self.0.request.update_mask = std::option::Option::Some(v.into());
5234 self
5235 }
5236
5237 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5239 where
5240 T: std::convert::Into<wkt::FieldMask>,
5241 {
5242 self.0.request.update_mask = v.map(|x| x.into());
5243 self
5244 }
5245 }
5246
5247 #[doc(hidden)]
5248 impl crate::RequestBuilder for SetIamPolicy {
5249 fn request_options(&mut self) -> &mut crate::RequestOptions {
5250 &mut self.0.options
5251 }
5252 }
5253
5254 #[derive(Clone, Debug)]
5271 pub struct TestIamPermissions(
5272 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5273 );
5274
5275 impl TestIamPermissions {
5276 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5277 Self(RequestBuilder::new(stub))
5278 }
5279
5280 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5282 mut self,
5283 v: V,
5284 ) -> Self {
5285 self.0.request = v.into();
5286 self
5287 }
5288
5289 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5291 self.0.options = v.into();
5292 self
5293 }
5294
5295 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5297 (*self.0.stub)
5298 .test_iam_permissions(self.0.request, self.0.options)
5299 .await
5300 .map(crate::Response::into_body)
5301 }
5302
5303 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5307 self.0.request.resource = v.into();
5308 self
5309 }
5310
5311 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5315 where
5316 T: std::iter::IntoIterator<Item = V>,
5317 V: std::convert::Into<std::string::String>,
5318 {
5319 use std::iter::Iterator;
5320 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5321 self
5322 }
5323 }
5324
5325 #[doc(hidden)]
5326 impl crate::RequestBuilder for TestIamPermissions {
5327 fn request_options(&mut self) -> &mut crate::RequestOptions {
5328 &mut self.0.options
5329 }
5330 }
5331
5332 #[derive(Clone, Debug)]
5353 pub struct ListOperations(
5354 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5355 );
5356
5357 impl ListOperations {
5358 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5359 Self(RequestBuilder::new(stub))
5360 }
5361
5362 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5364 mut self,
5365 v: V,
5366 ) -> Self {
5367 self.0.request = v.into();
5368 self
5369 }
5370
5371 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5373 self.0.options = v.into();
5374 self
5375 }
5376
5377 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5379 (*self.0.stub)
5380 .list_operations(self.0.request, self.0.options)
5381 .await
5382 .map(crate::Response::into_body)
5383 }
5384
5385 pub fn by_page(
5387 self,
5388 ) -> impl google_cloud_gax::paginator::Paginator<
5389 google_cloud_longrunning::model::ListOperationsResponse,
5390 crate::Error,
5391 > {
5392 use std::clone::Clone;
5393 let token = self.0.request.page_token.clone();
5394 let execute = move |token: String| {
5395 let mut builder = self.clone();
5396 builder.0.request = builder.0.request.set_page_token(token);
5397 builder.send()
5398 };
5399 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5400 }
5401
5402 pub fn by_item(
5404 self,
5405 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5406 google_cloud_longrunning::model::ListOperationsResponse,
5407 crate::Error,
5408 > {
5409 use google_cloud_gax::paginator::Paginator;
5410 self.by_page().items()
5411 }
5412
5413 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5415 self.0.request.name = v.into();
5416 self
5417 }
5418
5419 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5421 self.0.request.filter = v.into();
5422 self
5423 }
5424
5425 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5427 self.0.request.page_size = v.into();
5428 self
5429 }
5430
5431 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5433 self.0.request.page_token = v.into();
5434 self
5435 }
5436
5437 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5439 self.0.request.return_partial_success = v.into();
5440 self
5441 }
5442 }
5443
5444 #[doc(hidden)]
5445 impl crate::RequestBuilder for ListOperations {
5446 fn request_options(&mut self) -> &mut crate::RequestOptions {
5447 &mut self.0.options
5448 }
5449 }
5450
5451 #[derive(Clone, Debug)]
5468 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5469
5470 impl GetOperation {
5471 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5472 Self(RequestBuilder::new(stub))
5473 }
5474
5475 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5477 mut self,
5478 v: V,
5479 ) -> Self {
5480 self.0.request = v.into();
5481 self
5482 }
5483
5484 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5486 self.0.options = v.into();
5487 self
5488 }
5489
5490 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5492 (*self.0.stub)
5493 .get_operation(self.0.request, self.0.options)
5494 .await
5495 .map(crate::Response::into_body)
5496 }
5497
5498 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5500 self.0.request.name = v.into();
5501 self
5502 }
5503 }
5504
5505 #[doc(hidden)]
5506 impl crate::RequestBuilder for GetOperation {
5507 fn request_options(&mut self) -> &mut crate::RequestOptions {
5508 &mut self.0.options
5509 }
5510 }
5511
5512 #[derive(Clone, Debug)]
5529 pub struct DeleteOperation(
5530 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
5531 );
5532
5533 impl DeleteOperation {
5534 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5535 Self(RequestBuilder::new(stub))
5536 }
5537
5538 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
5540 mut self,
5541 v: V,
5542 ) -> Self {
5543 self.0.request = v.into();
5544 self
5545 }
5546
5547 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5549 self.0.options = v.into();
5550 self
5551 }
5552
5553 pub async fn send(self) -> Result<()> {
5555 (*self.0.stub)
5556 .delete_operation(self.0.request, self.0.options)
5557 .await
5558 .map(crate::Response::into_body)
5559 }
5560
5561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5563 self.0.request.name = v.into();
5564 self
5565 }
5566 }
5567
5568 #[doc(hidden)]
5569 impl crate::RequestBuilder for DeleteOperation {
5570 fn request_options(&mut self) -> &mut crate::RequestOptions {
5571 &mut self.0.options
5572 }
5573 }
5574
5575 #[derive(Clone, Debug)]
5592 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
5593
5594 impl WaitOperation {
5595 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5596 Self(RequestBuilder::new(stub))
5597 }
5598
5599 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
5601 mut self,
5602 v: V,
5603 ) -> Self {
5604 self.0.request = v.into();
5605 self
5606 }
5607
5608 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5610 self.0.options = v.into();
5611 self
5612 }
5613
5614 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5616 (*self.0.stub)
5617 .wait_operation(self.0.request, self.0.options)
5618 .await
5619 .map(crate::Response::into_body)
5620 }
5621
5622 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5624 self.0.request.name = v.into();
5625 self
5626 }
5627
5628 pub fn set_timeout<T>(mut self, v: T) -> Self
5630 where
5631 T: std::convert::Into<wkt::Duration>,
5632 {
5633 self.0.request.timeout = std::option::Option::Some(v.into());
5634 self
5635 }
5636
5637 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5639 where
5640 T: std::convert::Into<wkt::Duration>,
5641 {
5642 self.0.request.timeout = v.map(|x| x.into());
5643 self
5644 }
5645 }
5646
5647 #[doc(hidden)]
5648 impl crate::RequestBuilder for WaitOperation {
5649 fn request_options(&mut self) -> &mut crate::RequestOptions {
5650 &mut self.0.options
5651 }
5652 }
5653}
5654
5655pub mod tasks {
5656 use crate::Result;
5657
5658 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5672
5673 pub(crate) mod client {
5674 use super::super::super::client::Tasks;
5675 pub struct Factory;
5676 impl crate::ClientFactory for Factory {
5677 type Client = Tasks;
5678 type Credentials = gaxi::options::Credentials;
5679 async fn build(
5680 self,
5681 config: gaxi::options::ClientConfig,
5682 ) -> crate::ClientBuilderResult<Self::Client> {
5683 Self::Client::new(config).await
5684 }
5685 }
5686 }
5687
5688 #[derive(Clone, Debug)]
5690 pub(crate) struct RequestBuilder<R: std::default::Default> {
5691 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
5692 request: R,
5693 options: crate::RequestOptions,
5694 }
5695
5696 impl<R> RequestBuilder<R>
5697 where
5698 R: std::default::Default,
5699 {
5700 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5701 Self {
5702 stub,
5703 request: R::default(),
5704 options: crate::RequestOptions::default(),
5705 }
5706 }
5707 }
5708
5709 #[derive(Clone, Debug)]
5726 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
5727
5728 impl GetTask {
5729 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5730 Self(RequestBuilder::new(stub))
5731 }
5732
5733 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
5735 self.0.request = v.into();
5736 self
5737 }
5738
5739 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5741 self.0.options = v.into();
5742 self
5743 }
5744
5745 pub async fn send(self) -> Result<crate::model::Task> {
5747 (*self.0.stub)
5748 .get_task(self.0.request, self.0.options)
5749 .await
5750 .map(crate::Response::into_body)
5751 }
5752
5753 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5757 self.0.request.name = v.into();
5758 self
5759 }
5760 }
5761
5762 #[doc(hidden)]
5763 impl crate::RequestBuilder for GetTask {
5764 fn request_options(&mut self) -> &mut crate::RequestOptions {
5765 &mut self.0.options
5766 }
5767 }
5768
5769 #[derive(Clone, Debug)]
5790 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
5791
5792 impl ListTasks {
5793 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5794 Self(RequestBuilder::new(stub))
5795 }
5796
5797 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
5799 self.0.request = v.into();
5800 self
5801 }
5802
5803 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5805 self.0.options = v.into();
5806 self
5807 }
5808
5809 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
5811 (*self.0.stub)
5812 .list_tasks(self.0.request, self.0.options)
5813 .await
5814 .map(crate::Response::into_body)
5815 }
5816
5817 pub fn by_page(
5819 self,
5820 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTasksResponse, crate::Error>
5821 {
5822 use std::clone::Clone;
5823 let token = self.0.request.page_token.clone();
5824 let execute = move |token: String| {
5825 let mut builder = self.clone();
5826 builder.0.request = builder.0.request.set_page_token(token);
5827 builder.send()
5828 };
5829 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5830 }
5831
5832 pub fn by_item(
5834 self,
5835 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListTasksResponse, crate::Error>
5836 {
5837 use google_cloud_gax::paginator::Paginator;
5838 self.by_page().items()
5839 }
5840
5841 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5845 self.0.request.parent = v.into();
5846 self
5847 }
5848
5849 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5851 self.0.request.page_size = v.into();
5852 self
5853 }
5854
5855 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5857 self.0.request.page_token = v.into();
5858 self
5859 }
5860
5861 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5863 self.0.request.show_deleted = v.into();
5864 self
5865 }
5866 }
5867
5868 #[doc(hidden)]
5869 impl crate::RequestBuilder for ListTasks {
5870 fn request_options(&mut self) -> &mut crate::RequestOptions {
5871 &mut self.0.options
5872 }
5873 }
5874
5875 #[derive(Clone, Debug)]
5896 pub struct ListOperations(
5897 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5898 );
5899
5900 impl ListOperations {
5901 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5902 Self(RequestBuilder::new(stub))
5903 }
5904
5905 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5907 mut self,
5908 v: V,
5909 ) -> Self {
5910 self.0.request = v.into();
5911 self
5912 }
5913
5914 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5916 self.0.options = v.into();
5917 self
5918 }
5919
5920 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5922 (*self.0.stub)
5923 .list_operations(self.0.request, self.0.options)
5924 .await
5925 .map(crate::Response::into_body)
5926 }
5927
5928 pub fn by_page(
5930 self,
5931 ) -> impl google_cloud_gax::paginator::Paginator<
5932 google_cloud_longrunning::model::ListOperationsResponse,
5933 crate::Error,
5934 > {
5935 use std::clone::Clone;
5936 let token = self.0.request.page_token.clone();
5937 let execute = move |token: String| {
5938 let mut builder = self.clone();
5939 builder.0.request = builder.0.request.set_page_token(token);
5940 builder.send()
5941 };
5942 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5943 }
5944
5945 pub fn by_item(
5947 self,
5948 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5949 google_cloud_longrunning::model::ListOperationsResponse,
5950 crate::Error,
5951 > {
5952 use google_cloud_gax::paginator::Paginator;
5953 self.by_page().items()
5954 }
5955
5956 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5958 self.0.request.name = v.into();
5959 self
5960 }
5961
5962 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5964 self.0.request.filter = v.into();
5965 self
5966 }
5967
5968 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5970 self.0.request.page_size = v.into();
5971 self
5972 }
5973
5974 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5976 self.0.request.page_token = v.into();
5977 self
5978 }
5979
5980 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5982 self.0.request.return_partial_success = v.into();
5983 self
5984 }
5985 }
5986
5987 #[doc(hidden)]
5988 impl crate::RequestBuilder for ListOperations {
5989 fn request_options(&mut self) -> &mut crate::RequestOptions {
5990 &mut self.0.options
5991 }
5992 }
5993
5994 #[derive(Clone, Debug)]
6011 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6012
6013 impl GetOperation {
6014 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6015 Self(RequestBuilder::new(stub))
6016 }
6017
6018 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6020 mut self,
6021 v: V,
6022 ) -> Self {
6023 self.0.request = v.into();
6024 self
6025 }
6026
6027 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6029 self.0.options = v.into();
6030 self
6031 }
6032
6033 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6035 (*self.0.stub)
6036 .get_operation(self.0.request, self.0.options)
6037 .await
6038 .map(crate::Response::into_body)
6039 }
6040
6041 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6043 self.0.request.name = v.into();
6044 self
6045 }
6046 }
6047
6048 #[doc(hidden)]
6049 impl crate::RequestBuilder for GetOperation {
6050 fn request_options(&mut self) -> &mut crate::RequestOptions {
6051 &mut self.0.options
6052 }
6053 }
6054
6055 #[derive(Clone, Debug)]
6072 pub struct DeleteOperation(
6073 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
6074 );
6075
6076 impl DeleteOperation {
6077 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6078 Self(RequestBuilder::new(stub))
6079 }
6080
6081 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
6083 mut self,
6084 v: V,
6085 ) -> Self {
6086 self.0.request = v.into();
6087 self
6088 }
6089
6090 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6092 self.0.options = v.into();
6093 self
6094 }
6095
6096 pub async fn send(self) -> Result<()> {
6098 (*self.0.stub)
6099 .delete_operation(self.0.request, self.0.options)
6100 .await
6101 .map(crate::Response::into_body)
6102 }
6103
6104 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6106 self.0.request.name = v.into();
6107 self
6108 }
6109 }
6110
6111 #[doc(hidden)]
6112 impl crate::RequestBuilder for DeleteOperation {
6113 fn request_options(&mut self) -> &mut crate::RequestOptions {
6114 &mut self.0.options
6115 }
6116 }
6117
6118 #[derive(Clone, Debug)]
6135 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
6136
6137 impl WaitOperation {
6138 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6139 Self(RequestBuilder::new(stub))
6140 }
6141
6142 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
6144 mut self,
6145 v: V,
6146 ) -> Self {
6147 self.0.request = v.into();
6148 self
6149 }
6150
6151 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6153 self.0.options = v.into();
6154 self
6155 }
6156
6157 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6159 (*self.0.stub)
6160 .wait_operation(self.0.request, self.0.options)
6161 .await
6162 .map(crate::Response::into_body)
6163 }
6164
6165 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6167 self.0.request.name = v.into();
6168 self
6169 }
6170
6171 pub fn set_timeout<T>(mut self, v: T) -> Self
6173 where
6174 T: std::convert::Into<wkt::Duration>,
6175 {
6176 self.0.request.timeout = std::option::Option::Some(v.into());
6177 self
6178 }
6179
6180 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6182 where
6183 T: std::convert::Into<wkt::Duration>,
6184 {
6185 self.0.request.timeout = v.map(|x| x.into());
6186 self
6187 }
6188 }
6189
6190 #[doc(hidden)]
6191 impl crate::RequestBuilder for WaitOperation {
6192 fn request_options(&mut self) -> &mut crate::RequestOptions {
6193 &mut self.0.options
6194 }
6195 }
6196}
6197
6198pub mod worker_pools {
6199 use crate::Result;
6200
6201 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6215
6216 pub(crate) mod client {
6217 use super::super::super::client::WorkerPools;
6218 pub struct Factory;
6219 impl crate::ClientFactory for Factory {
6220 type Client = WorkerPools;
6221 type Credentials = gaxi::options::Credentials;
6222 async fn build(
6223 self,
6224 config: gaxi::options::ClientConfig,
6225 ) -> crate::ClientBuilderResult<Self::Client> {
6226 Self::Client::new(config).await
6227 }
6228 }
6229 }
6230
6231 #[derive(Clone, Debug)]
6233 pub(crate) struct RequestBuilder<R: std::default::Default> {
6234 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6235 request: R,
6236 options: crate::RequestOptions,
6237 }
6238
6239 impl<R> RequestBuilder<R>
6240 where
6241 R: std::default::Default,
6242 {
6243 pub(crate) fn new(
6244 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6245 ) -> Self {
6246 Self {
6247 stub,
6248 request: R::default(),
6249 options: crate::RequestOptions::default(),
6250 }
6251 }
6252 }
6253
6254 #[derive(Clone, Debug)]
6272 pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
6273
6274 impl CreateWorkerPool {
6275 pub(crate) fn new(
6276 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6277 ) -> Self {
6278 Self(RequestBuilder::new(stub))
6279 }
6280
6281 pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
6283 mut self,
6284 v: V,
6285 ) -> Self {
6286 self.0.request = v.into();
6287 self
6288 }
6289
6290 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6292 self.0.options = v.into();
6293 self
6294 }
6295
6296 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6303 (*self.0.stub)
6304 .create_worker_pool(self.0.request, self.0.options)
6305 .await
6306 .map(crate::Response::into_body)
6307 }
6308
6309 pub fn poller(
6311 self,
6312 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6313 {
6314 type Operation = google_cloud_lro::internal::Operation<
6315 crate::model::WorkerPool,
6316 crate::model::WorkerPool,
6317 >;
6318 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6319 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6320
6321 let stub = self.0.stub.clone();
6322 let mut options = self.0.options.clone();
6323 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6324 let query = move |name| {
6325 let stub = stub.clone();
6326 let options = options.clone();
6327 async {
6328 let op = GetOperation::new(stub)
6329 .set_name(name)
6330 .with_options(options)
6331 .send()
6332 .await?;
6333 Ok(Operation::new(op))
6334 }
6335 };
6336
6337 let start = move || async {
6338 let op = self.send().await?;
6339 Ok(Operation::new(op))
6340 };
6341
6342 google_cloud_lro::internal::new_poller(
6343 polling_error_policy,
6344 polling_backoff_policy,
6345 start,
6346 query,
6347 )
6348 }
6349
6350 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6354 self.0.request.parent = v.into();
6355 self
6356 }
6357
6358 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6362 where
6363 T: std::convert::Into<crate::model::WorkerPool>,
6364 {
6365 self.0.request.worker_pool = std::option::Option::Some(v.into());
6366 self
6367 }
6368
6369 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6373 where
6374 T: std::convert::Into<crate::model::WorkerPool>,
6375 {
6376 self.0.request.worker_pool = v.map(|x| x.into());
6377 self
6378 }
6379
6380 pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6384 self.0.request.worker_pool_id = v.into();
6385 self
6386 }
6387
6388 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6390 self.0.request.validate_only = v.into();
6391 self
6392 }
6393 }
6394
6395 #[doc(hidden)]
6396 impl crate::RequestBuilder for CreateWorkerPool {
6397 fn request_options(&mut self) -> &mut crate::RequestOptions {
6398 &mut self.0.options
6399 }
6400 }
6401
6402 #[derive(Clone, Debug)]
6419 pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
6420
6421 impl GetWorkerPool {
6422 pub(crate) fn new(
6423 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6424 ) -> Self {
6425 Self(RequestBuilder::new(stub))
6426 }
6427
6428 pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
6430 self.0.request = v.into();
6431 self
6432 }
6433
6434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6436 self.0.options = v.into();
6437 self
6438 }
6439
6440 pub async fn send(self) -> Result<crate::model::WorkerPool> {
6442 (*self.0.stub)
6443 .get_worker_pool(self.0.request, self.0.options)
6444 .await
6445 .map(crate::Response::into_body)
6446 }
6447
6448 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6452 self.0.request.name = v.into();
6453 self
6454 }
6455 }
6456
6457 #[doc(hidden)]
6458 impl crate::RequestBuilder for GetWorkerPool {
6459 fn request_options(&mut self) -> &mut crate::RequestOptions {
6460 &mut self.0.options
6461 }
6462 }
6463
6464 #[derive(Clone, Debug)]
6485 pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
6486
6487 impl ListWorkerPools {
6488 pub(crate) fn new(
6489 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6490 ) -> Self {
6491 Self(RequestBuilder::new(stub))
6492 }
6493
6494 pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
6496 self.0.request = v.into();
6497 self
6498 }
6499
6500 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6502 self.0.options = v.into();
6503 self
6504 }
6505
6506 pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
6508 (*self.0.stub)
6509 .list_worker_pools(self.0.request, self.0.options)
6510 .await
6511 .map(crate::Response::into_body)
6512 }
6513
6514 pub fn by_page(
6516 self,
6517 ) -> impl google_cloud_gax::paginator::Paginator<
6518 crate::model::ListWorkerPoolsResponse,
6519 crate::Error,
6520 > {
6521 use std::clone::Clone;
6522 let token = self.0.request.page_token.clone();
6523 let execute = move |token: String| {
6524 let mut builder = self.clone();
6525 builder.0.request = builder.0.request.set_page_token(token);
6526 builder.send()
6527 };
6528 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6529 }
6530
6531 pub fn by_item(
6533 self,
6534 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6535 crate::model::ListWorkerPoolsResponse,
6536 crate::Error,
6537 > {
6538 use google_cloud_gax::paginator::Paginator;
6539 self.by_page().items()
6540 }
6541
6542 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6546 self.0.request.parent = v.into();
6547 self
6548 }
6549
6550 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6552 self.0.request.page_size = v.into();
6553 self
6554 }
6555
6556 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6558 self.0.request.page_token = v.into();
6559 self
6560 }
6561
6562 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
6564 self.0.request.show_deleted = v.into();
6565 self
6566 }
6567 }
6568
6569 #[doc(hidden)]
6570 impl crate::RequestBuilder for ListWorkerPools {
6571 fn request_options(&mut self) -> &mut crate::RequestOptions {
6572 &mut self.0.options
6573 }
6574 }
6575
6576 #[derive(Clone, Debug)]
6594 pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
6595
6596 impl UpdateWorkerPool {
6597 pub(crate) fn new(
6598 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6599 ) -> Self {
6600 Self(RequestBuilder::new(stub))
6601 }
6602
6603 pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
6605 mut self,
6606 v: V,
6607 ) -> Self {
6608 self.0.request = v.into();
6609 self
6610 }
6611
6612 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6614 self.0.options = v.into();
6615 self
6616 }
6617
6618 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6625 (*self.0.stub)
6626 .update_worker_pool(self.0.request, self.0.options)
6627 .await
6628 .map(crate::Response::into_body)
6629 }
6630
6631 pub fn poller(
6633 self,
6634 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6635 {
6636 type Operation = google_cloud_lro::internal::Operation<
6637 crate::model::WorkerPool,
6638 crate::model::WorkerPool,
6639 >;
6640 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6641 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6642
6643 let stub = self.0.stub.clone();
6644 let mut options = self.0.options.clone();
6645 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6646 let query = move |name| {
6647 let stub = stub.clone();
6648 let options = options.clone();
6649 async {
6650 let op = GetOperation::new(stub)
6651 .set_name(name)
6652 .with_options(options)
6653 .send()
6654 .await?;
6655 Ok(Operation::new(op))
6656 }
6657 };
6658
6659 let start = move || async {
6660 let op = self.send().await?;
6661 Ok(Operation::new(op))
6662 };
6663
6664 google_cloud_lro::internal::new_poller(
6665 polling_error_policy,
6666 polling_backoff_policy,
6667 start,
6668 query,
6669 )
6670 }
6671
6672 pub fn set_update_mask<T>(mut self, v: T) -> Self
6674 where
6675 T: std::convert::Into<wkt::FieldMask>,
6676 {
6677 self.0.request.update_mask = std::option::Option::Some(v.into());
6678 self
6679 }
6680
6681 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6683 where
6684 T: std::convert::Into<wkt::FieldMask>,
6685 {
6686 self.0.request.update_mask = v.map(|x| x.into());
6687 self
6688 }
6689
6690 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6694 where
6695 T: std::convert::Into<crate::model::WorkerPool>,
6696 {
6697 self.0.request.worker_pool = std::option::Option::Some(v.into());
6698 self
6699 }
6700
6701 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6705 where
6706 T: std::convert::Into<crate::model::WorkerPool>,
6707 {
6708 self.0.request.worker_pool = v.map(|x| x.into());
6709 self
6710 }
6711
6712 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6714 self.0.request.validate_only = v.into();
6715 self
6716 }
6717
6718 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6720 self.0.request.allow_missing = v.into();
6721 self
6722 }
6723
6724 pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
6726 self.0.request.force_new_revision = v.into();
6727 self
6728 }
6729 }
6730
6731 #[doc(hidden)]
6732 impl crate::RequestBuilder for UpdateWorkerPool {
6733 fn request_options(&mut self) -> &mut crate::RequestOptions {
6734 &mut self.0.options
6735 }
6736 }
6737
6738 #[derive(Clone, Debug)]
6756 pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
6757
6758 impl DeleteWorkerPool {
6759 pub(crate) fn new(
6760 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6761 ) -> Self {
6762 Self(RequestBuilder::new(stub))
6763 }
6764
6765 pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
6767 mut self,
6768 v: V,
6769 ) -> Self {
6770 self.0.request = v.into();
6771 self
6772 }
6773
6774 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6776 self.0.options = v.into();
6777 self
6778 }
6779
6780 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6787 (*self.0.stub)
6788 .delete_worker_pool(self.0.request, self.0.options)
6789 .await
6790 .map(crate::Response::into_body)
6791 }
6792
6793 pub fn poller(
6795 self,
6796 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6797 {
6798 type Operation = google_cloud_lro::internal::Operation<
6799 crate::model::WorkerPool,
6800 crate::model::WorkerPool,
6801 >;
6802 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6803 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6804
6805 let stub = self.0.stub.clone();
6806 let mut options = self.0.options.clone();
6807 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6808 let query = move |name| {
6809 let stub = stub.clone();
6810 let options = options.clone();
6811 async {
6812 let op = GetOperation::new(stub)
6813 .set_name(name)
6814 .with_options(options)
6815 .send()
6816 .await?;
6817 Ok(Operation::new(op))
6818 }
6819 };
6820
6821 let start = move || async {
6822 let op = self.send().await?;
6823 Ok(Operation::new(op))
6824 };
6825
6826 google_cloud_lro::internal::new_poller(
6827 polling_error_policy,
6828 polling_backoff_policy,
6829 start,
6830 query,
6831 )
6832 }
6833
6834 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6838 self.0.request.name = v.into();
6839 self
6840 }
6841
6842 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6844 self.0.request.validate_only = v.into();
6845 self
6846 }
6847
6848 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
6850 self.0.request.etag = v.into();
6851 self
6852 }
6853 }
6854
6855 #[doc(hidden)]
6856 impl crate::RequestBuilder for DeleteWorkerPool {
6857 fn request_options(&mut self) -> &mut crate::RequestOptions {
6858 &mut self.0.options
6859 }
6860 }
6861
6862 #[derive(Clone, Debug)]
6879 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
6880
6881 impl GetIamPolicy {
6882 pub(crate) fn new(
6883 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6884 ) -> Self {
6885 Self(RequestBuilder::new(stub))
6886 }
6887
6888 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
6890 mut self,
6891 v: V,
6892 ) -> Self {
6893 self.0.request = v.into();
6894 self
6895 }
6896
6897 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6899 self.0.options = v.into();
6900 self
6901 }
6902
6903 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6905 (*self.0.stub)
6906 .get_iam_policy(self.0.request, self.0.options)
6907 .await
6908 .map(crate::Response::into_body)
6909 }
6910
6911 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6915 self.0.request.resource = v.into();
6916 self
6917 }
6918
6919 pub fn set_options<T>(mut self, v: T) -> Self
6921 where
6922 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6923 {
6924 self.0.request.options = std::option::Option::Some(v.into());
6925 self
6926 }
6927
6928 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6930 where
6931 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6932 {
6933 self.0.request.options = v.map(|x| x.into());
6934 self
6935 }
6936 }
6937
6938 #[doc(hidden)]
6939 impl crate::RequestBuilder for GetIamPolicy {
6940 fn request_options(&mut self) -> &mut crate::RequestOptions {
6941 &mut self.0.options
6942 }
6943 }
6944
6945 #[derive(Clone, Debug)]
6962 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
6963
6964 impl SetIamPolicy {
6965 pub(crate) fn new(
6966 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6967 ) -> Self {
6968 Self(RequestBuilder::new(stub))
6969 }
6970
6971 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
6973 mut self,
6974 v: V,
6975 ) -> Self {
6976 self.0.request = v.into();
6977 self
6978 }
6979
6980 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6982 self.0.options = v.into();
6983 self
6984 }
6985
6986 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6988 (*self.0.stub)
6989 .set_iam_policy(self.0.request, self.0.options)
6990 .await
6991 .map(crate::Response::into_body)
6992 }
6993
6994 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6998 self.0.request.resource = v.into();
6999 self
7000 }
7001
7002 pub fn set_policy<T>(mut self, v: T) -> Self
7006 where
7007 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7008 {
7009 self.0.request.policy = std::option::Option::Some(v.into());
7010 self
7011 }
7012
7013 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7017 where
7018 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7019 {
7020 self.0.request.policy = v.map(|x| x.into());
7021 self
7022 }
7023
7024 pub fn set_update_mask<T>(mut self, v: T) -> Self
7026 where
7027 T: std::convert::Into<wkt::FieldMask>,
7028 {
7029 self.0.request.update_mask = std::option::Option::Some(v.into());
7030 self
7031 }
7032
7033 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7035 where
7036 T: std::convert::Into<wkt::FieldMask>,
7037 {
7038 self.0.request.update_mask = v.map(|x| x.into());
7039 self
7040 }
7041 }
7042
7043 #[doc(hidden)]
7044 impl crate::RequestBuilder for SetIamPolicy {
7045 fn request_options(&mut self) -> &mut crate::RequestOptions {
7046 &mut self.0.options
7047 }
7048 }
7049
7050 #[derive(Clone, Debug)]
7067 pub struct TestIamPermissions(
7068 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
7069 );
7070
7071 impl TestIamPermissions {
7072 pub(crate) fn new(
7073 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7074 ) -> Self {
7075 Self(RequestBuilder::new(stub))
7076 }
7077
7078 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
7080 mut self,
7081 v: V,
7082 ) -> Self {
7083 self.0.request = v.into();
7084 self
7085 }
7086
7087 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7089 self.0.options = v.into();
7090 self
7091 }
7092
7093 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
7095 (*self.0.stub)
7096 .test_iam_permissions(self.0.request, self.0.options)
7097 .await
7098 .map(crate::Response::into_body)
7099 }
7100
7101 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7105 self.0.request.resource = v.into();
7106 self
7107 }
7108
7109 pub fn set_permissions<T, V>(mut self, v: T) -> Self
7113 where
7114 T: std::iter::IntoIterator<Item = V>,
7115 V: std::convert::Into<std::string::String>,
7116 {
7117 use std::iter::Iterator;
7118 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7119 self
7120 }
7121 }
7122
7123 #[doc(hidden)]
7124 impl crate::RequestBuilder for TestIamPermissions {
7125 fn request_options(&mut self) -> &mut crate::RequestOptions {
7126 &mut self.0.options
7127 }
7128 }
7129
7130 #[derive(Clone, Debug)]
7151 pub struct ListOperations(
7152 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7153 );
7154
7155 impl ListOperations {
7156 pub(crate) fn new(
7157 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7158 ) -> Self {
7159 Self(RequestBuilder::new(stub))
7160 }
7161
7162 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7164 mut self,
7165 v: V,
7166 ) -> Self {
7167 self.0.request = v.into();
7168 self
7169 }
7170
7171 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7173 self.0.options = v.into();
7174 self
7175 }
7176
7177 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7179 (*self.0.stub)
7180 .list_operations(self.0.request, self.0.options)
7181 .await
7182 .map(crate::Response::into_body)
7183 }
7184
7185 pub fn by_page(
7187 self,
7188 ) -> impl google_cloud_gax::paginator::Paginator<
7189 google_cloud_longrunning::model::ListOperationsResponse,
7190 crate::Error,
7191 > {
7192 use std::clone::Clone;
7193 let token = self.0.request.page_token.clone();
7194 let execute = move |token: String| {
7195 let mut builder = self.clone();
7196 builder.0.request = builder.0.request.set_page_token(token);
7197 builder.send()
7198 };
7199 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7200 }
7201
7202 pub fn by_item(
7204 self,
7205 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7206 google_cloud_longrunning::model::ListOperationsResponse,
7207 crate::Error,
7208 > {
7209 use google_cloud_gax::paginator::Paginator;
7210 self.by_page().items()
7211 }
7212
7213 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7215 self.0.request.name = v.into();
7216 self
7217 }
7218
7219 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7221 self.0.request.filter = v.into();
7222 self
7223 }
7224
7225 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7227 self.0.request.page_size = v.into();
7228 self
7229 }
7230
7231 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7233 self.0.request.page_token = v.into();
7234 self
7235 }
7236
7237 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7239 self.0.request.return_partial_success = v.into();
7240 self
7241 }
7242 }
7243
7244 #[doc(hidden)]
7245 impl crate::RequestBuilder for ListOperations {
7246 fn request_options(&mut self) -> &mut crate::RequestOptions {
7247 &mut self.0.options
7248 }
7249 }
7250
7251 #[derive(Clone, Debug)]
7268 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7269
7270 impl GetOperation {
7271 pub(crate) fn new(
7272 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7273 ) -> Self {
7274 Self(RequestBuilder::new(stub))
7275 }
7276
7277 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7279 mut self,
7280 v: V,
7281 ) -> Self {
7282 self.0.request = v.into();
7283 self
7284 }
7285
7286 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7288 self.0.options = v.into();
7289 self
7290 }
7291
7292 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7294 (*self.0.stub)
7295 .get_operation(self.0.request, self.0.options)
7296 .await
7297 .map(crate::Response::into_body)
7298 }
7299
7300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7302 self.0.request.name = v.into();
7303 self
7304 }
7305 }
7306
7307 #[doc(hidden)]
7308 impl crate::RequestBuilder for GetOperation {
7309 fn request_options(&mut self) -> &mut crate::RequestOptions {
7310 &mut self.0.options
7311 }
7312 }
7313
7314 #[derive(Clone, Debug)]
7331 pub struct DeleteOperation(
7332 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
7333 );
7334
7335 impl DeleteOperation {
7336 pub(crate) fn new(
7337 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7338 ) -> Self {
7339 Self(RequestBuilder::new(stub))
7340 }
7341
7342 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
7344 mut self,
7345 v: V,
7346 ) -> Self {
7347 self.0.request = v.into();
7348 self
7349 }
7350
7351 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7353 self.0.options = v.into();
7354 self
7355 }
7356
7357 pub async fn send(self) -> Result<()> {
7359 (*self.0.stub)
7360 .delete_operation(self.0.request, self.0.options)
7361 .await
7362 .map(crate::Response::into_body)
7363 }
7364
7365 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7367 self.0.request.name = v.into();
7368 self
7369 }
7370 }
7371
7372 #[doc(hidden)]
7373 impl crate::RequestBuilder for DeleteOperation {
7374 fn request_options(&mut self) -> &mut crate::RequestOptions {
7375 &mut self.0.options
7376 }
7377 }
7378
7379 #[derive(Clone, Debug)]
7396 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
7397
7398 impl WaitOperation {
7399 pub(crate) fn new(
7400 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7401 ) -> Self {
7402 Self(RequestBuilder::new(stub))
7403 }
7404
7405 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
7407 mut self,
7408 v: V,
7409 ) -> Self {
7410 self.0.request = v.into();
7411 self
7412 }
7413
7414 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7416 self.0.options = v.into();
7417 self
7418 }
7419
7420 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7422 (*self.0.stub)
7423 .wait_operation(self.0.request, self.0.options)
7424 .await
7425 .map(crate::Response::into_body)
7426 }
7427
7428 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7430 self.0.request.name = v.into();
7431 self
7432 }
7433
7434 pub fn set_timeout<T>(mut self, v: T) -> Self
7436 where
7437 T: std::convert::Into<wkt::Duration>,
7438 {
7439 self.0.request.timeout = std::option::Option::Some(v.into());
7440 self
7441 }
7442
7443 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7445 where
7446 T: std::convert::Into<wkt::Duration>,
7447 {
7448 self.0.request.timeout = v.map(|x| x.into());
7449 self
7450 }
7451 }
7452
7453 #[doc(hidden)]
7454 impl crate::RequestBuilder for WaitOperation {
7455 fn request_options(&mut self) -> &mut crate::RequestOptions {
7456 &mut self.0.options
7457 }
7458 }
7459}