1pub mod builds {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::Builds;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = Builds;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: gax::options::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
89 pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
90
91 impl SubmitBuild {
92 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
93 Self(RequestBuilder::new(stub))
94 }
95
96 pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
98 self.0.request = v.into();
99 self
100 }
101
102 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
104 self.0.options = v.into();
105 self
106 }
107
108 pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
110 (*self.0.stub)
111 .submit_build(self.0.request, self.0.options)
112 .await
113 .map(gax::response::Response::into_body)
114 }
115
116 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
120 self.0.request.parent = v.into();
121 self
122 }
123
124 pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.image_uri = v.into();
129 self
130 }
131
132 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.service_account = v.into();
135 self
136 }
137
138 pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
140 self.0.request.worker_pool = v.into();
141 self
142 }
143
144 pub fn set_tags<T, V>(mut self, v: T) -> Self
146 where
147 T: std::iter::IntoIterator<Item = V>,
148 V: std::convert::Into<std::string::String>,
149 {
150 use std::iter::Iterator;
151 self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
152 self
153 }
154
155 pub fn set_machine_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
157 self.0.request.machine_type = v.into();
158 self
159 }
160
161 pub fn set_release_track<T: Into<api::model::LaunchStage>>(mut self, v: T) -> Self {
163 self.0.request.release_track = v.into();
164 self
165 }
166
167 pub fn set_client<T: Into<std::string::String>>(mut self, v: T) -> Self {
169 self.0.request.client = v.into();
170 self
171 }
172
173 pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
178 mut self,
179 v: T,
180 ) -> Self {
181 self.0.request.source = v.into();
182 self
183 }
184
185 pub fn set_storage_source<
191 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
192 >(
193 mut self,
194 v: T,
195 ) -> Self {
196 self.0.request = self.0.request.set_storage_source(v);
197 self
198 }
199
200 pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
205 mut self,
206 v: T,
207 ) -> Self {
208 self.0.request.build_type = v.into();
209 self
210 }
211
212 pub fn set_buildpack_build<
218 T: std::convert::Into<
219 std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
220 >,
221 >(
222 mut self,
223 v: T,
224 ) -> Self {
225 self.0.request = self.0.request.set_buildpack_build(v);
226 self
227 }
228
229 pub fn set_docker_build<
235 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
236 >(
237 mut self,
238 v: T,
239 ) -> Self {
240 self.0.request = self.0.request.set_docker_build(v);
241 self
242 }
243 }
244
245 #[doc(hidden)]
246 impl gax::options::internal::RequestBuilder for SubmitBuild {
247 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 #[derive(Clone, Debug)]
273 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
274
275 impl ListOperations {
276 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
277 Self(RequestBuilder::new(stub))
278 }
279
280 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
282 mut self,
283 v: V,
284 ) -> Self {
285 self.0.request = v.into();
286 self
287 }
288
289 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
291 self.0.options = v.into();
292 self
293 }
294
295 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
297 (*self.0.stub)
298 .list_operations(self.0.request, self.0.options)
299 .await
300 .map(gax::response::Response::into_body)
301 }
302
303 pub fn by_page(
305 self,
306 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
307 {
308 use std::clone::Clone;
309 let token = self.0.request.page_token.clone();
310 let execute = move |token: String| {
311 let mut builder = self.clone();
312 builder.0.request = builder.0.request.set_page_token(token);
313 builder.send()
314 };
315 gax::paginator::internal::new_paginator(token, execute)
316 }
317
318 pub fn by_item(
320 self,
321 ) -> impl gax::paginator::ItemPaginator<
322 longrunning::model::ListOperationsResponse,
323 gax::error::Error,
324 > {
325 use gax::paginator::Paginator;
326 self.by_page().items()
327 }
328
329 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
331 self.0.request.name = v.into();
332 self
333 }
334
335 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
337 self.0.request.filter = v.into();
338 self
339 }
340
341 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
343 self.0.request.page_size = v.into();
344 self
345 }
346
347 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
349 self.0.request.page_token = v.into();
350 self
351 }
352
353 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
355 self.0.request.return_partial_success = v.into();
356 self
357 }
358 }
359
360 #[doc(hidden)]
361 impl gax::options::internal::RequestBuilder for ListOperations {
362 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
363 &mut self.0.options
364 }
365 }
366
367 #[derive(Clone, Debug)]
384 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
385
386 impl GetOperation {
387 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
388 Self(RequestBuilder::new(stub))
389 }
390
391 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
393 mut self,
394 v: V,
395 ) -> Self {
396 self.0.request = v.into();
397 self
398 }
399
400 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
402 self.0.options = v.into();
403 self
404 }
405
406 pub async fn send(self) -> Result<longrunning::model::Operation> {
408 (*self.0.stub)
409 .get_operation(self.0.request, self.0.options)
410 .await
411 .map(gax::response::Response::into_body)
412 }
413
414 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
416 self.0.request.name = v.into();
417 self
418 }
419 }
420
421 #[doc(hidden)]
422 impl gax::options::internal::RequestBuilder for GetOperation {
423 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
424 &mut self.0.options
425 }
426 }
427
428 #[derive(Clone, Debug)]
445 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
446
447 impl DeleteOperation {
448 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
449 Self(RequestBuilder::new(stub))
450 }
451
452 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
454 mut self,
455 v: V,
456 ) -> Self {
457 self.0.request = v.into();
458 self
459 }
460
461 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
463 self.0.options = v.into();
464 self
465 }
466
467 pub async fn send(self) -> Result<()> {
469 (*self.0.stub)
470 .delete_operation(self.0.request, self.0.options)
471 .await
472 .map(gax::response::Response::into_body)
473 }
474
475 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
477 self.0.request.name = v.into();
478 self
479 }
480 }
481
482 #[doc(hidden)]
483 impl gax::options::internal::RequestBuilder for DeleteOperation {
484 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
485 &mut self.0.options
486 }
487 }
488
489 #[derive(Clone, Debug)]
506 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
507
508 impl WaitOperation {
509 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
510 Self(RequestBuilder::new(stub))
511 }
512
513 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
515 mut self,
516 v: V,
517 ) -> Self {
518 self.0.request = v.into();
519 self
520 }
521
522 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
524 self.0.options = v.into();
525 self
526 }
527
528 pub async fn send(self) -> Result<longrunning::model::Operation> {
530 (*self.0.stub)
531 .wait_operation(self.0.request, self.0.options)
532 .await
533 .map(gax::response::Response::into_body)
534 }
535
536 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
538 self.0.request.name = v.into();
539 self
540 }
541
542 pub fn set_timeout<T>(mut self, v: T) -> Self
544 where
545 T: std::convert::Into<wkt::Duration>,
546 {
547 self.0.request.timeout = std::option::Option::Some(v.into());
548 self
549 }
550
551 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
553 where
554 T: std::convert::Into<wkt::Duration>,
555 {
556 self.0.request.timeout = v.map(|x| x.into());
557 self
558 }
559 }
560
561 #[doc(hidden)]
562 impl gax::options::internal::RequestBuilder for WaitOperation {
563 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
564 &mut self.0.options
565 }
566 }
567}
568
569pub mod executions {
570 use crate::Result;
571
572 pub type ClientBuilder =
586 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
587
588 pub(crate) mod client {
589 use super::super::super::client::Executions;
590 pub struct Factory;
591 impl gax::client_builder::internal::ClientFactory for Factory {
592 type Client = Executions;
593 type Credentials = gaxi::options::Credentials;
594 async fn build(
595 self,
596 config: gaxi::options::ClientConfig,
597 ) -> gax::client_builder::Result<Self::Client> {
598 Self::Client::new(config).await
599 }
600 }
601 }
602
603 #[derive(Clone, Debug)]
605 pub(crate) struct RequestBuilder<R: std::default::Default> {
606 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
607 request: R,
608 options: gax::options::RequestOptions,
609 }
610
611 impl<R> RequestBuilder<R>
612 where
613 R: std::default::Default,
614 {
615 pub(crate) fn new(
616 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
617 ) -> Self {
618 Self {
619 stub,
620 request: R::default(),
621 options: gax::options::RequestOptions::default(),
622 }
623 }
624 }
625
626 #[derive(Clone, Debug)]
643 pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
644
645 impl GetExecution {
646 pub(crate) fn new(
647 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
648 ) -> Self {
649 Self(RequestBuilder::new(stub))
650 }
651
652 pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
654 self.0.request = v.into();
655 self
656 }
657
658 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
660 self.0.options = v.into();
661 self
662 }
663
664 pub async fn send(self) -> Result<crate::model::Execution> {
666 (*self.0.stub)
667 .get_execution(self.0.request, self.0.options)
668 .await
669 .map(gax::response::Response::into_body)
670 }
671
672 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
676 self.0.request.name = v.into();
677 self
678 }
679 }
680
681 #[doc(hidden)]
682 impl gax::options::internal::RequestBuilder for GetExecution {
683 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
684 &mut self.0.options
685 }
686 }
687
688 #[derive(Clone, Debug)]
709 pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
710
711 impl ListExecutions {
712 pub(crate) fn new(
713 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
714 ) -> Self {
715 Self(RequestBuilder::new(stub))
716 }
717
718 pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
720 self.0.request = v.into();
721 self
722 }
723
724 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
726 self.0.options = v.into();
727 self
728 }
729
730 pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
732 (*self.0.stub)
733 .list_executions(self.0.request, self.0.options)
734 .await
735 .map(gax::response::Response::into_body)
736 }
737
738 pub fn by_page(
740 self,
741 ) -> impl gax::paginator::Paginator<crate::model::ListExecutionsResponse, gax::error::Error>
742 {
743 use std::clone::Clone;
744 let token = self.0.request.page_token.clone();
745 let execute = move |token: String| {
746 let mut builder = self.clone();
747 builder.0.request = builder.0.request.set_page_token(token);
748 builder.send()
749 };
750 gax::paginator::internal::new_paginator(token, execute)
751 }
752
753 pub fn by_item(
755 self,
756 ) -> impl gax::paginator::ItemPaginator<crate::model::ListExecutionsResponse, gax::error::Error>
757 {
758 use gax::paginator::Paginator;
759 self.by_page().items()
760 }
761
762 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
766 self.0.request.parent = v.into();
767 self
768 }
769
770 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
772 self.0.request.page_size = v.into();
773 self
774 }
775
776 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
778 self.0.request.page_token = v.into();
779 self
780 }
781
782 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
784 self.0.request.show_deleted = v.into();
785 self
786 }
787 }
788
789 #[doc(hidden)]
790 impl gax::options::internal::RequestBuilder for ListExecutions {
791 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
792 &mut self.0.options
793 }
794 }
795
796 #[derive(Clone, Debug)]
814 pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
815
816 impl DeleteExecution {
817 pub(crate) fn new(
818 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
819 ) -> Self {
820 Self(RequestBuilder::new(stub))
821 }
822
823 pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
825 self.0.request = v.into();
826 self
827 }
828
829 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
831 self.0.options = v.into();
832 self
833 }
834
835 pub async fn send(self) -> Result<longrunning::model::Operation> {
842 (*self.0.stub)
843 .delete_execution(self.0.request, self.0.options)
844 .await
845 .map(gax::response::Response::into_body)
846 }
847
848 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
850 type Operation =
851 lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
852 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
853 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
854
855 let stub = self.0.stub.clone();
856 let mut options = self.0.options.clone();
857 options.set_retry_policy(gax::retry_policy::NeverRetry);
858 let query = move |name| {
859 let stub = stub.clone();
860 let options = options.clone();
861 async {
862 let op = GetOperation::new(stub)
863 .set_name(name)
864 .with_options(options)
865 .send()
866 .await?;
867 Ok(Operation::new(op))
868 }
869 };
870
871 let start = move || async {
872 let op = self.send().await?;
873 Ok(Operation::new(op))
874 };
875
876 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
877 }
878
879 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
883 self.0.request.name = v.into();
884 self
885 }
886
887 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
889 self.0.request.validate_only = v.into();
890 self
891 }
892
893 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
895 self.0.request.etag = v.into();
896 self
897 }
898 }
899
900 #[doc(hidden)]
901 impl gax::options::internal::RequestBuilder for DeleteExecution {
902 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
903 &mut self.0.options
904 }
905 }
906
907 #[derive(Clone, Debug)]
925 pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
926
927 impl CancelExecution {
928 pub(crate) fn new(
929 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
930 ) -> Self {
931 Self(RequestBuilder::new(stub))
932 }
933
934 pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
936 self.0.request = v.into();
937 self
938 }
939
940 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
942 self.0.options = v.into();
943 self
944 }
945
946 pub async fn send(self) -> Result<longrunning::model::Operation> {
953 (*self.0.stub)
954 .cancel_execution(self.0.request, self.0.options)
955 .await
956 .map(gax::response::Response::into_body)
957 }
958
959 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
961 type Operation =
962 lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
963 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
964 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
965
966 let stub = self.0.stub.clone();
967 let mut options = self.0.options.clone();
968 options.set_retry_policy(gax::retry_policy::NeverRetry);
969 let query = move |name| {
970 let stub = stub.clone();
971 let options = options.clone();
972 async {
973 let op = GetOperation::new(stub)
974 .set_name(name)
975 .with_options(options)
976 .send()
977 .await?;
978 Ok(Operation::new(op))
979 }
980 };
981
982 let start = move || async {
983 let op = self.send().await?;
984 Ok(Operation::new(op))
985 };
986
987 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
988 }
989
990 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
994 self.0.request.name = v.into();
995 self
996 }
997
998 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1000 self.0.request.validate_only = v.into();
1001 self
1002 }
1003
1004 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1006 self.0.request.etag = v.into();
1007 self
1008 }
1009 }
1010
1011 #[doc(hidden)]
1012 impl gax::options::internal::RequestBuilder for CancelExecution {
1013 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1014 &mut self.0.options
1015 }
1016 }
1017
1018 #[derive(Clone, Debug)]
1039 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1040
1041 impl ListOperations {
1042 pub(crate) fn new(
1043 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1044 ) -> Self {
1045 Self(RequestBuilder::new(stub))
1046 }
1047
1048 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1050 mut self,
1051 v: V,
1052 ) -> Self {
1053 self.0.request = v.into();
1054 self
1055 }
1056
1057 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1059 self.0.options = v.into();
1060 self
1061 }
1062
1063 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1065 (*self.0.stub)
1066 .list_operations(self.0.request, self.0.options)
1067 .await
1068 .map(gax::response::Response::into_body)
1069 }
1070
1071 pub fn by_page(
1073 self,
1074 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1075 {
1076 use std::clone::Clone;
1077 let token = self.0.request.page_token.clone();
1078 let execute = move |token: String| {
1079 let mut builder = self.clone();
1080 builder.0.request = builder.0.request.set_page_token(token);
1081 builder.send()
1082 };
1083 gax::paginator::internal::new_paginator(token, execute)
1084 }
1085
1086 pub fn by_item(
1088 self,
1089 ) -> impl gax::paginator::ItemPaginator<
1090 longrunning::model::ListOperationsResponse,
1091 gax::error::Error,
1092 > {
1093 use gax::paginator::Paginator;
1094 self.by_page().items()
1095 }
1096
1097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1099 self.0.request.name = v.into();
1100 self
1101 }
1102
1103 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1105 self.0.request.filter = v.into();
1106 self
1107 }
1108
1109 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1111 self.0.request.page_size = v.into();
1112 self
1113 }
1114
1115 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1117 self.0.request.page_token = v.into();
1118 self
1119 }
1120
1121 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1123 self.0.request.return_partial_success = v.into();
1124 self
1125 }
1126 }
1127
1128 #[doc(hidden)]
1129 impl gax::options::internal::RequestBuilder for ListOperations {
1130 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1131 &mut self.0.options
1132 }
1133 }
1134
1135 #[derive(Clone, Debug)]
1152 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1153
1154 impl GetOperation {
1155 pub(crate) fn new(
1156 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1157 ) -> Self {
1158 Self(RequestBuilder::new(stub))
1159 }
1160
1161 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1163 mut self,
1164 v: V,
1165 ) -> Self {
1166 self.0.request = v.into();
1167 self
1168 }
1169
1170 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1172 self.0.options = v.into();
1173 self
1174 }
1175
1176 pub async fn send(self) -> Result<longrunning::model::Operation> {
1178 (*self.0.stub)
1179 .get_operation(self.0.request, self.0.options)
1180 .await
1181 .map(gax::response::Response::into_body)
1182 }
1183
1184 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1186 self.0.request.name = v.into();
1187 self
1188 }
1189 }
1190
1191 #[doc(hidden)]
1192 impl gax::options::internal::RequestBuilder for GetOperation {
1193 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1194 &mut self.0.options
1195 }
1196 }
1197
1198 #[derive(Clone, Debug)]
1215 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1216
1217 impl DeleteOperation {
1218 pub(crate) fn new(
1219 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1220 ) -> Self {
1221 Self(RequestBuilder::new(stub))
1222 }
1223
1224 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1226 mut self,
1227 v: V,
1228 ) -> Self {
1229 self.0.request = v.into();
1230 self
1231 }
1232
1233 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1235 self.0.options = v.into();
1236 self
1237 }
1238
1239 pub async fn send(self) -> Result<()> {
1241 (*self.0.stub)
1242 .delete_operation(self.0.request, self.0.options)
1243 .await
1244 .map(gax::response::Response::into_body)
1245 }
1246
1247 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1249 self.0.request.name = v.into();
1250 self
1251 }
1252 }
1253
1254 #[doc(hidden)]
1255 impl gax::options::internal::RequestBuilder for DeleteOperation {
1256 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1257 &mut self.0.options
1258 }
1259 }
1260
1261 #[derive(Clone, Debug)]
1278 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
1279
1280 impl WaitOperation {
1281 pub(crate) fn new(
1282 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1283 ) -> Self {
1284 Self(RequestBuilder::new(stub))
1285 }
1286
1287 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
1289 mut self,
1290 v: V,
1291 ) -> Self {
1292 self.0.request = v.into();
1293 self
1294 }
1295
1296 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1298 self.0.options = v.into();
1299 self
1300 }
1301
1302 pub async fn send(self) -> Result<longrunning::model::Operation> {
1304 (*self.0.stub)
1305 .wait_operation(self.0.request, self.0.options)
1306 .await
1307 .map(gax::response::Response::into_body)
1308 }
1309
1310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.0.request.name = v.into();
1313 self
1314 }
1315
1316 pub fn set_timeout<T>(mut self, v: T) -> Self
1318 where
1319 T: std::convert::Into<wkt::Duration>,
1320 {
1321 self.0.request.timeout = std::option::Option::Some(v.into());
1322 self
1323 }
1324
1325 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1327 where
1328 T: std::convert::Into<wkt::Duration>,
1329 {
1330 self.0.request.timeout = v.map(|x| x.into());
1331 self
1332 }
1333 }
1334
1335 #[doc(hidden)]
1336 impl gax::options::internal::RequestBuilder for WaitOperation {
1337 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1338 &mut self.0.options
1339 }
1340 }
1341}
1342
1343pub mod jobs {
1344 use crate::Result;
1345
1346 pub type ClientBuilder =
1360 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1361
1362 pub(crate) mod client {
1363 use super::super::super::client::Jobs;
1364 pub struct Factory;
1365 impl gax::client_builder::internal::ClientFactory for Factory {
1366 type Client = Jobs;
1367 type Credentials = gaxi::options::Credentials;
1368 async fn build(
1369 self,
1370 config: gaxi::options::ClientConfig,
1371 ) -> gax::client_builder::Result<Self::Client> {
1372 Self::Client::new(config).await
1373 }
1374 }
1375 }
1376
1377 #[derive(Clone, Debug)]
1379 pub(crate) struct RequestBuilder<R: std::default::Default> {
1380 stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
1381 request: R,
1382 options: gax::options::RequestOptions,
1383 }
1384
1385 impl<R> RequestBuilder<R>
1386 where
1387 R: std::default::Default,
1388 {
1389 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1390 Self {
1391 stub,
1392 request: R::default(),
1393 options: gax::options::RequestOptions::default(),
1394 }
1395 }
1396 }
1397
1398 #[derive(Clone, Debug)]
1416 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
1417
1418 impl CreateJob {
1419 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1420 Self(RequestBuilder::new(stub))
1421 }
1422
1423 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
1425 self.0.request = v.into();
1426 self
1427 }
1428
1429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1431 self.0.options = v.into();
1432 self
1433 }
1434
1435 pub async fn send(self) -> Result<longrunning::model::Operation> {
1442 (*self.0.stub)
1443 .create_job(self.0.request, self.0.options)
1444 .await
1445 .map(gax::response::Response::into_body)
1446 }
1447
1448 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1450 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1451 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1452 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1453
1454 let stub = self.0.stub.clone();
1455 let mut options = self.0.options.clone();
1456 options.set_retry_policy(gax::retry_policy::NeverRetry);
1457 let query = move |name| {
1458 let stub = stub.clone();
1459 let options = options.clone();
1460 async {
1461 let op = GetOperation::new(stub)
1462 .set_name(name)
1463 .with_options(options)
1464 .send()
1465 .await?;
1466 Ok(Operation::new(op))
1467 }
1468 };
1469
1470 let start = move || async {
1471 let op = self.send().await?;
1472 Ok(Operation::new(op))
1473 };
1474
1475 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1476 }
1477
1478 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.parent = v.into();
1483 self
1484 }
1485
1486 pub fn set_job<T>(mut self, v: T) -> Self
1490 where
1491 T: std::convert::Into<crate::model::Job>,
1492 {
1493 self.0.request.job = std::option::Option::Some(v.into());
1494 self
1495 }
1496
1497 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1501 where
1502 T: std::convert::Into<crate::model::Job>,
1503 {
1504 self.0.request.job = v.map(|x| x.into());
1505 self
1506 }
1507
1508 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1512 self.0.request.job_id = v.into();
1513 self
1514 }
1515
1516 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1518 self.0.request.validate_only = v.into();
1519 self
1520 }
1521 }
1522
1523 #[doc(hidden)]
1524 impl gax::options::internal::RequestBuilder for CreateJob {
1525 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1526 &mut self.0.options
1527 }
1528 }
1529
1530 #[derive(Clone, Debug)]
1547 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
1548
1549 impl GetJob {
1550 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1551 Self(RequestBuilder::new(stub))
1552 }
1553
1554 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
1556 self.0.request = v.into();
1557 self
1558 }
1559
1560 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1562 self.0.options = v.into();
1563 self
1564 }
1565
1566 pub async fn send(self) -> Result<crate::model::Job> {
1568 (*self.0.stub)
1569 .get_job(self.0.request, self.0.options)
1570 .await
1571 .map(gax::response::Response::into_body)
1572 }
1573
1574 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1578 self.0.request.name = v.into();
1579 self
1580 }
1581 }
1582
1583 #[doc(hidden)]
1584 impl gax::options::internal::RequestBuilder for GetJob {
1585 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1586 &mut self.0.options
1587 }
1588 }
1589
1590 #[derive(Clone, Debug)]
1611 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1612
1613 impl ListJobs {
1614 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1615 Self(RequestBuilder::new(stub))
1616 }
1617
1618 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1620 self.0.request = v.into();
1621 self
1622 }
1623
1624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1626 self.0.options = v.into();
1627 self
1628 }
1629
1630 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
1632 (*self.0.stub)
1633 .list_jobs(self.0.request, self.0.options)
1634 .await
1635 .map(gax::response::Response::into_body)
1636 }
1637
1638 pub fn by_page(
1640 self,
1641 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
1642 {
1643 use std::clone::Clone;
1644 let token = self.0.request.page_token.clone();
1645 let execute = move |token: String| {
1646 let mut builder = self.clone();
1647 builder.0.request = builder.0.request.set_page_token(token);
1648 builder.send()
1649 };
1650 gax::paginator::internal::new_paginator(token, execute)
1651 }
1652
1653 pub fn by_item(
1655 self,
1656 ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
1657 {
1658 use gax::paginator::Paginator;
1659 self.by_page().items()
1660 }
1661
1662 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1666 self.0.request.parent = v.into();
1667 self
1668 }
1669
1670 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1672 self.0.request.page_size = v.into();
1673 self
1674 }
1675
1676 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1678 self.0.request.page_token = v.into();
1679 self
1680 }
1681
1682 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1684 self.0.request.show_deleted = v.into();
1685 self
1686 }
1687 }
1688
1689 #[doc(hidden)]
1690 impl gax::options::internal::RequestBuilder for ListJobs {
1691 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1692 &mut self.0.options
1693 }
1694 }
1695
1696 #[derive(Clone, Debug)]
1714 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
1715
1716 impl UpdateJob {
1717 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1718 Self(RequestBuilder::new(stub))
1719 }
1720
1721 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
1723 self.0.request = v.into();
1724 self
1725 }
1726
1727 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1729 self.0.options = v.into();
1730 self
1731 }
1732
1733 pub async fn send(self) -> Result<longrunning::model::Operation> {
1740 (*self.0.stub)
1741 .update_job(self.0.request, self.0.options)
1742 .await
1743 .map(gax::response::Response::into_body)
1744 }
1745
1746 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1748 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1749 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1750 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1751
1752 let stub = self.0.stub.clone();
1753 let mut options = self.0.options.clone();
1754 options.set_retry_policy(gax::retry_policy::NeverRetry);
1755 let query = move |name| {
1756 let stub = stub.clone();
1757 let options = options.clone();
1758 async {
1759 let op = GetOperation::new(stub)
1760 .set_name(name)
1761 .with_options(options)
1762 .send()
1763 .await?;
1764 Ok(Operation::new(op))
1765 }
1766 };
1767
1768 let start = move || async {
1769 let op = self.send().await?;
1770 Ok(Operation::new(op))
1771 };
1772
1773 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1774 }
1775
1776 pub fn set_job<T>(mut self, v: T) -> Self
1780 where
1781 T: std::convert::Into<crate::model::Job>,
1782 {
1783 self.0.request.job = std::option::Option::Some(v.into());
1784 self
1785 }
1786
1787 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1791 where
1792 T: std::convert::Into<crate::model::Job>,
1793 {
1794 self.0.request.job = v.map(|x| x.into());
1795 self
1796 }
1797
1798 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1800 self.0.request.validate_only = v.into();
1801 self
1802 }
1803
1804 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1806 self.0.request.allow_missing = v.into();
1807 self
1808 }
1809 }
1810
1811 #[doc(hidden)]
1812 impl gax::options::internal::RequestBuilder for UpdateJob {
1813 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1814 &mut self.0.options
1815 }
1816 }
1817
1818 #[derive(Clone, Debug)]
1836 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1837
1838 impl DeleteJob {
1839 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1840 Self(RequestBuilder::new(stub))
1841 }
1842
1843 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1845 self.0.request = v.into();
1846 self
1847 }
1848
1849 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1851 self.0.options = v.into();
1852 self
1853 }
1854
1855 pub async fn send(self) -> Result<longrunning::model::Operation> {
1862 (*self.0.stub)
1863 .delete_job(self.0.request, self.0.options)
1864 .await
1865 .map(gax::response::Response::into_body)
1866 }
1867
1868 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1870 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1871 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1872 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1873
1874 let stub = self.0.stub.clone();
1875 let mut options = self.0.options.clone();
1876 options.set_retry_policy(gax::retry_policy::NeverRetry);
1877 let query = move |name| {
1878 let stub = stub.clone();
1879 let options = options.clone();
1880 async {
1881 let op = GetOperation::new(stub)
1882 .set_name(name)
1883 .with_options(options)
1884 .send()
1885 .await?;
1886 Ok(Operation::new(op))
1887 }
1888 };
1889
1890 let start = move || async {
1891 let op = self.send().await?;
1892 Ok(Operation::new(op))
1893 };
1894
1895 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1896 }
1897
1898 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1902 self.0.request.name = v.into();
1903 self
1904 }
1905
1906 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1908 self.0.request.validate_only = v.into();
1909 self
1910 }
1911
1912 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1914 self.0.request.etag = v.into();
1915 self
1916 }
1917 }
1918
1919 #[doc(hidden)]
1920 impl gax::options::internal::RequestBuilder for DeleteJob {
1921 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1922 &mut self.0.options
1923 }
1924 }
1925
1926 #[derive(Clone, Debug)]
1944 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
1945
1946 impl RunJob {
1947 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1948 Self(RequestBuilder::new(stub))
1949 }
1950
1951 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
1953 self.0.request = v.into();
1954 self
1955 }
1956
1957 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1959 self.0.options = v.into();
1960 self
1961 }
1962
1963 pub async fn send(self) -> Result<longrunning::model::Operation> {
1970 (*self.0.stub)
1971 .run_job(self.0.request, self.0.options)
1972 .await
1973 .map(gax::response::Response::into_body)
1974 }
1975
1976 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
1978 type Operation =
1979 lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
1980 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1981 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1982
1983 let stub = self.0.stub.clone();
1984 let mut options = self.0.options.clone();
1985 options.set_retry_policy(gax::retry_policy::NeverRetry);
1986 let query = move |name| {
1987 let stub = stub.clone();
1988 let options = options.clone();
1989 async {
1990 let op = GetOperation::new(stub)
1991 .set_name(name)
1992 .with_options(options)
1993 .send()
1994 .await?;
1995 Ok(Operation::new(op))
1996 }
1997 };
1998
1999 let start = move || async {
2000 let op = self.send().await?;
2001 Ok(Operation::new(op))
2002 };
2003
2004 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2005 }
2006
2007 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2011 self.0.request.name = v.into();
2012 self
2013 }
2014
2015 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2017 self.0.request.validate_only = v.into();
2018 self
2019 }
2020
2021 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2023 self.0.request.etag = v.into();
2024 self
2025 }
2026
2027 pub fn set_overrides<T>(mut self, v: T) -> Self
2029 where
2030 T: std::convert::Into<crate::model::run_job_request::Overrides>,
2031 {
2032 self.0.request.overrides = std::option::Option::Some(v.into());
2033 self
2034 }
2035
2036 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
2038 where
2039 T: std::convert::Into<crate::model::run_job_request::Overrides>,
2040 {
2041 self.0.request.overrides = v.map(|x| x.into());
2042 self
2043 }
2044 }
2045
2046 #[doc(hidden)]
2047 impl gax::options::internal::RequestBuilder for RunJob {
2048 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2049 &mut self.0.options
2050 }
2051 }
2052
2053 #[derive(Clone, Debug)]
2070 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2071
2072 impl GetIamPolicy {
2073 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2074 Self(RequestBuilder::new(stub))
2075 }
2076
2077 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2079 self.0.request = v.into();
2080 self
2081 }
2082
2083 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2085 self.0.options = v.into();
2086 self
2087 }
2088
2089 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2091 (*self.0.stub)
2092 .get_iam_policy(self.0.request, self.0.options)
2093 .await
2094 .map(gax::response::Response::into_body)
2095 }
2096
2097 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2101 self.0.request.resource = v.into();
2102 self
2103 }
2104
2105 pub fn set_options<T>(mut self, v: T) -> Self
2107 where
2108 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2109 {
2110 self.0.request.options = std::option::Option::Some(v.into());
2111 self
2112 }
2113
2114 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2116 where
2117 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2118 {
2119 self.0.request.options = v.map(|x| x.into());
2120 self
2121 }
2122 }
2123
2124 #[doc(hidden)]
2125 impl gax::options::internal::RequestBuilder for GetIamPolicy {
2126 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2127 &mut self.0.options
2128 }
2129 }
2130
2131 #[derive(Clone, Debug)]
2148 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2149
2150 impl SetIamPolicy {
2151 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2152 Self(RequestBuilder::new(stub))
2153 }
2154
2155 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2157 self.0.request = v.into();
2158 self
2159 }
2160
2161 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2163 self.0.options = v.into();
2164 self
2165 }
2166
2167 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2169 (*self.0.stub)
2170 .set_iam_policy(self.0.request, self.0.options)
2171 .await
2172 .map(gax::response::Response::into_body)
2173 }
2174
2175 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2179 self.0.request.resource = v.into();
2180 self
2181 }
2182
2183 pub fn set_policy<T>(mut self, v: T) -> Self
2187 where
2188 T: std::convert::Into<iam_v1::model::Policy>,
2189 {
2190 self.0.request.policy = std::option::Option::Some(v.into());
2191 self
2192 }
2193
2194 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2198 where
2199 T: std::convert::Into<iam_v1::model::Policy>,
2200 {
2201 self.0.request.policy = v.map(|x| x.into());
2202 self
2203 }
2204
2205 pub fn set_update_mask<T>(mut self, v: T) -> Self
2207 where
2208 T: std::convert::Into<wkt::FieldMask>,
2209 {
2210 self.0.request.update_mask = std::option::Option::Some(v.into());
2211 self
2212 }
2213
2214 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2216 where
2217 T: std::convert::Into<wkt::FieldMask>,
2218 {
2219 self.0.request.update_mask = v.map(|x| x.into());
2220 self
2221 }
2222 }
2223
2224 #[doc(hidden)]
2225 impl gax::options::internal::RequestBuilder for SetIamPolicy {
2226 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2227 &mut self.0.options
2228 }
2229 }
2230
2231 #[derive(Clone, Debug)]
2248 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2249
2250 impl TestIamPermissions {
2251 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2252 Self(RequestBuilder::new(stub))
2253 }
2254
2255 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2257 mut self,
2258 v: V,
2259 ) -> Self {
2260 self.0.request = v.into();
2261 self
2262 }
2263
2264 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2266 self.0.options = v.into();
2267 self
2268 }
2269
2270 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2272 (*self.0.stub)
2273 .test_iam_permissions(self.0.request, self.0.options)
2274 .await
2275 .map(gax::response::Response::into_body)
2276 }
2277
2278 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2282 self.0.request.resource = v.into();
2283 self
2284 }
2285
2286 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2290 where
2291 T: std::iter::IntoIterator<Item = V>,
2292 V: std::convert::Into<std::string::String>,
2293 {
2294 use std::iter::Iterator;
2295 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2296 self
2297 }
2298 }
2299
2300 #[doc(hidden)]
2301 impl gax::options::internal::RequestBuilder for TestIamPermissions {
2302 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2303 &mut self.0.options
2304 }
2305 }
2306
2307 #[derive(Clone, Debug)]
2328 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2329
2330 impl ListOperations {
2331 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2332 Self(RequestBuilder::new(stub))
2333 }
2334
2335 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2337 mut self,
2338 v: V,
2339 ) -> Self {
2340 self.0.request = v.into();
2341 self
2342 }
2343
2344 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2346 self.0.options = v.into();
2347 self
2348 }
2349
2350 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2352 (*self.0.stub)
2353 .list_operations(self.0.request, self.0.options)
2354 .await
2355 .map(gax::response::Response::into_body)
2356 }
2357
2358 pub fn by_page(
2360 self,
2361 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2362 {
2363 use std::clone::Clone;
2364 let token = self.0.request.page_token.clone();
2365 let execute = move |token: String| {
2366 let mut builder = self.clone();
2367 builder.0.request = builder.0.request.set_page_token(token);
2368 builder.send()
2369 };
2370 gax::paginator::internal::new_paginator(token, execute)
2371 }
2372
2373 pub fn by_item(
2375 self,
2376 ) -> impl gax::paginator::ItemPaginator<
2377 longrunning::model::ListOperationsResponse,
2378 gax::error::Error,
2379 > {
2380 use gax::paginator::Paginator;
2381 self.by_page().items()
2382 }
2383
2384 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2386 self.0.request.name = v.into();
2387 self
2388 }
2389
2390 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2392 self.0.request.filter = v.into();
2393 self
2394 }
2395
2396 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2398 self.0.request.page_size = v.into();
2399 self
2400 }
2401
2402 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2404 self.0.request.page_token = v.into();
2405 self
2406 }
2407
2408 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2410 self.0.request.return_partial_success = v.into();
2411 self
2412 }
2413 }
2414
2415 #[doc(hidden)]
2416 impl gax::options::internal::RequestBuilder for ListOperations {
2417 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2418 &mut self.0.options
2419 }
2420 }
2421
2422 #[derive(Clone, Debug)]
2439 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2440
2441 impl GetOperation {
2442 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2443 Self(RequestBuilder::new(stub))
2444 }
2445
2446 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2448 mut self,
2449 v: V,
2450 ) -> Self {
2451 self.0.request = v.into();
2452 self
2453 }
2454
2455 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2457 self.0.options = v.into();
2458 self
2459 }
2460
2461 pub async fn send(self) -> Result<longrunning::model::Operation> {
2463 (*self.0.stub)
2464 .get_operation(self.0.request, self.0.options)
2465 .await
2466 .map(gax::response::Response::into_body)
2467 }
2468
2469 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2471 self.0.request.name = v.into();
2472 self
2473 }
2474 }
2475
2476 #[doc(hidden)]
2477 impl gax::options::internal::RequestBuilder for GetOperation {
2478 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2479 &mut self.0.options
2480 }
2481 }
2482
2483 #[derive(Clone, Debug)]
2500 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2501
2502 impl DeleteOperation {
2503 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2504 Self(RequestBuilder::new(stub))
2505 }
2506
2507 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2509 mut self,
2510 v: V,
2511 ) -> Self {
2512 self.0.request = v.into();
2513 self
2514 }
2515
2516 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2518 self.0.options = v.into();
2519 self
2520 }
2521
2522 pub async fn send(self) -> Result<()> {
2524 (*self.0.stub)
2525 .delete_operation(self.0.request, self.0.options)
2526 .await
2527 .map(gax::response::Response::into_body)
2528 }
2529
2530 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2532 self.0.request.name = v.into();
2533 self
2534 }
2535 }
2536
2537 #[doc(hidden)]
2538 impl gax::options::internal::RequestBuilder for DeleteOperation {
2539 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2540 &mut self.0.options
2541 }
2542 }
2543
2544 #[derive(Clone, Debug)]
2561 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
2562
2563 impl WaitOperation {
2564 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2565 Self(RequestBuilder::new(stub))
2566 }
2567
2568 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
2570 mut self,
2571 v: V,
2572 ) -> Self {
2573 self.0.request = v.into();
2574 self
2575 }
2576
2577 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2579 self.0.options = v.into();
2580 self
2581 }
2582
2583 pub async fn send(self) -> Result<longrunning::model::Operation> {
2585 (*self.0.stub)
2586 .wait_operation(self.0.request, self.0.options)
2587 .await
2588 .map(gax::response::Response::into_body)
2589 }
2590
2591 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2593 self.0.request.name = v.into();
2594 self
2595 }
2596
2597 pub fn set_timeout<T>(mut self, v: T) -> Self
2599 where
2600 T: std::convert::Into<wkt::Duration>,
2601 {
2602 self.0.request.timeout = std::option::Option::Some(v.into());
2603 self
2604 }
2605
2606 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2608 where
2609 T: std::convert::Into<wkt::Duration>,
2610 {
2611 self.0.request.timeout = v.map(|x| x.into());
2612 self
2613 }
2614 }
2615
2616 #[doc(hidden)]
2617 impl gax::options::internal::RequestBuilder for WaitOperation {
2618 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2619 &mut self.0.options
2620 }
2621 }
2622}
2623
2624pub mod revisions {
2625 use crate::Result;
2626
2627 pub type ClientBuilder =
2641 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2642
2643 pub(crate) mod client {
2644 use super::super::super::client::Revisions;
2645 pub struct Factory;
2646 impl gax::client_builder::internal::ClientFactory for Factory {
2647 type Client = Revisions;
2648 type Credentials = gaxi::options::Credentials;
2649 async fn build(
2650 self,
2651 config: gaxi::options::ClientConfig,
2652 ) -> gax::client_builder::Result<Self::Client> {
2653 Self::Client::new(config).await
2654 }
2655 }
2656 }
2657
2658 #[derive(Clone, Debug)]
2660 pub(crate) struct RequestBuilder<R: std::default::Default> {
2661 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2662 request: R,
2663 options: gax::options::RequestOptions,
2664 }
2665
2666 impl<R> RequestBuilder<R>
2667 where
2668 R: std::default::Default,
2669 {
2670 pub(crate) fn new(
2671 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2672 ) -> Self {
2673 Self {
2674 stub,
2675 request: R::default(),
2676 options: gax::options::RequestOptions::default(),
2677 }
2678 }
2679 }
2680
2681 #[derive(Clone, Debug)]
2698 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
2699
2700 impl GetRevision {
2701 pub(crate) fn new(
2702 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2703 ) -> Self {
2704 Self(RequestBuilder::new(stub))
2705 }
2706
2707 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
2709 self.0.request = v.into();
2710 self
2711 }
2712
2713 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2715 self.0.options = v.into();
2716 self
2717 }
2718
2719 pub async fn send(self) -> Result<crate::model::Revision> {
2721 (*self.0.stub)
2722 .get_revision(self.0.request, self.0.options)
2723 .await
2724 .map(gax::response::Response::into_body)
2725 }
2726
2727 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2731 self.0.request.name = v.into();
2732 self
2733 }
2734 }
2735
2736 #[doc(hidden)]
2737 impl gax::options::internal::RequestBuilder for GetRevision {
2738 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2739 &mut self.0.options
2740 }
2741 }
2742
2743 #[derive(Clone, Debug)]
2764 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
2765
2766 impl ListRevisions {
2767 pub(crate) fn new(
2768 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2769 ) -> Self {
2770 Self(RequestBuilder::new(stub))
2771 }
2772
2773 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
2775 self.0.request = v.into();
2776 self
2777 }
2778
2779 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2781 self.0.options = v.into();
2782 self
2783 }
2784
2785 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
2787 (*self.0.stub)
2788 .list_revisions(self.0.request, self.0.options)
2789 .await
2790 .map(gax::response::Response::into_body)
2791 }
2792
2793 pub fn by_page(
2795 self,
2796 ) -> impl gax::paginator::Paginator<crate::model::ListRevisionsResponse, gax::error::Error>
2797 {
2798 use std::clone::Clone;
2799 let token = self.0.request.page_token.clone();
2800 let execute = move |token: String| {
2801 let mut builder = self.clone();
2802 builder.0.request = builder.0.request.set_page_token(token);
2803 builder.send()
2804 };
2805 gax::paginator::internal::new_paginator(token, execute)
2806 }
2807
2808 pub fn by_item(
2810 self,
2811 ) -> impl gax::paginator::ItemPaginator<crate::model::ListRevisionsResponse, gax::error::Error>
2812 {
2813 use gax::paginator::Paginator;
2814 self.by_page().items()
2815 }
2816
2817 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2821 self.0.request.parent = v.into();
2822 self
2823 }
2824
2825 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2827 self.0.request.page_size = v.into();
2828 self
2829 }
2830
2831 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2833 self.0.request.page_token = v.into();
2834 self
2835 }
2836
2837 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2839 self.0.request.show_deleted = v.into();
2840 self
2841 }
2842 }
2843
2844 #[doc(hidden)]
2845 impl gax::options::internal::RequestBuilder for ListRevisions {
2846 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2847 &mut self.0.options
2848 }
2849 }
2850
2851 #[derive(Clone, Debug)]
2869 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
2870
2871 impl DeleteRevision {
2872 pub(crate) fn new(
2873 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2874 ) -> Self {
2875 Self(RequestBuilder::new(stub))
2876 }
2877
2878 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
2880 self.0.request = v.into();
2881 self
2882 }
2883
2884 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2886 self.0.options = v.into();
2887 self
2888 }
2889
2890 pub async fn send(self) -> Result<longrunning::model::Operation> {
2897 (*self.0.stub)
2898 .delete_revision(self.0.request, self.0.options)
2899 .await
2900 .map(gax::response::Response::into_body)
2901 }
2902
2903 pub fn poller(self) -> impl lro::Poller<crate::model::Revision, crate::model::Revision> {
2905 type Operation =
2906 lro::internal::Operation<crate::model::Revision, crate::model::Revision>;
2907 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2908 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2909
2910 let stub = self.0.stub.clone();
2911 let mut options = self.0.options.clone();
2912 options.set_retry_policy(gax::retry_policy::NeverRetry);
2913 let query = move |name| {
2914 let stub = stub.clone();
2915 let options = options.clone();
2916 async {
2917 let op = GetOperation::new(stub)
2918 .set_name(name)
2919 .with_options(options)
2920 .send()
2921 .await?;
2922 Ok(Operation::new(op))
2923 }
2924 };
2925
2926 let start = move || async {
2927 let op = self.send().await?;
2928 Ok(Operation::new(op))
2929 };
2930
2931 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2932 }
2933
2934 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2938 self.0.request.name = v.into();
2939 self
2940 }
2941
2942 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2944 self.0.request.validate_only = v.into();
2945 self
2946 }
2947
2948 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2950 self.0.request.etag = v.into();
2951 self
2952 }
2953 }
2954
2955 #[doc(hidden)]
2956 impl gax::options::internal::RequestBuilder for DeleteRevision {
2957 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2958 &mut self.0.options
2959 }
2960 }
2961
2962 #[derive(Clone, Debug)]
2983 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2984
2985 impl ListOperations {
2986 pub(crate) fn new(
2987 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2988 ) -> Self {
2989 Self(RequestBuilder::new(stub))
2990 }
2991
2992 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2994 mut self,
2995 v: V,
2996 ) -> Self {
2997 self.0.request = v.into();
2998 self
2999 }
3000
3001 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3003 self.0.options = v.into();
3004 self
3005 }
3006
3007 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3009 (*self.0.stub)
3010 .list_operations(self.0.request, self.0.options)
3011 .await
3012 .map(gax::response::Response::into_body)
3013 }
3014
3015 pub fn by_page(
3017 self,
3018 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3019 {
3020 use std::clone::Clone;
3021 let token = self.0.request.page_token.clone();
3022 let execute = move |token: String| {
3023 let mut builder = self.clone();
3024 builder.0.request = builder.0.request.set_page_token(token);
3025 builder.send()
3026 };
3027 gax::paginator::internal::new_paginator(token, execute)
3028 }
3029
3030 pub fn by_item(
3032 self,
3033 ) -> impl gax::paginator::ItemPaginator<
3034 longrunning::model::ListOperationsResponse,
3035 gax::error::Error,
3036 > {
3037 use gax::paginator::Paginator;
3038 self.by_page().items()
3039 }
3040
3041 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3043 self.0.request.name = v.into();
3044 self
3045 }
3046
3047 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3049 self.0.request.filter = v.into();
3050 self
3051 }
3052
3053 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3055 self.0.request.page_size = v.into();
3056 self
3057 }
3058
3059 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3061 self.0.request.page_token = v.into();
3062 self
3063 }
3064
3065 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3067 self.0.request.return_partial_success = v.into();
3068 self
3069 }
3070 }
3071
3072 #[doc(hidden)]
3073 impl gax::options::internal::RequestBuilder for ListOperations {
3074 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3075 &mut self.0.options
3076 }
3077 }
3078
3079 #[derive(Clone, Debug)]
3096 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3097
3098 impl GetOperation {
3099 pub(crate) fn new(
3100 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3101 ) -> Self {
3102 Self(RequestBuilder::new(stub))
3103 }
3104
3105 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3107 mut self,
3108 v: V,
3109 ) -> Self {
3110 self.0.request = v.into();
3111 self
3112 }
3113
3114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3116 self.0.options = v.into();
3117 self
3118 }
3119
3120 pub async fn send(self) -> Result<longrunning::model::Operation> {
3122 (*self.0.stub)
3123 .get_operation(self.0.request, self.0.options)
3124 .await
3125 .map(gax::response::Response::into_body)
3126 }
3127
3128 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3130 self.0.request.name = v.into();
3131 self
3132 }
3133 }
3134
3135 #[doc(hidden)]
3136 impl gax::options::internal::RequestBuilder for GetOperation {
3137 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3138 &mut self.0.options
3139 }
3140 }
3141
3142 #[derive(Clone, Debug)]
3159 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3160
3161 impl DeleteOperation {
3162 pub(crate) fn new(
3163 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3164 ) -> Self {
3165 Self(RequestBuilder::new(stub))
3166 }
3167
3168 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3170 mut self,
3171 v: V,
3172 ) -> Self {
3173 self.0.request = v.into();
3174 self
3175 }
3176
3177 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3179 self.0.options = v.into();
3180 self
3181 }
3182
3183 pub async fn send(self) -> Result<()> {
3185 (*self.0.stub)
3186 .delete_operation(self.0.request, self.0.options)
3187 .await
3188 .map(gax::response::Response::into_body)
3189 }
3190
3191 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3193 self.0.request.name = v.into();
3194 self
3195 }
3196 }
3197
3198 #[doc(hidden)]
3199 impl gax::options::internal::RequestBuilder for DeleteOperation {
3200 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3201 &mut self.0.options
3202 }
3203 }
3204
3205 #[derive(Clone, Debug)]
3222 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3223
3224 impl WaitOperation {
3225 pub(crate) fn new(
3226 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3227 ) -> Self {
3228 Self(RequestBuilder::new(stub))
3229 }
3230
3231 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3233 mut self,
3234 v: V,
3235 ) -> Self {
3236 self.0.request = v.into();
3237 self
3238 }
3239
3240 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3242 self.0.options = v.into();
3243 self
3244 }
3245
3246 pub async fn send(self) -> Result<longrunning::model::Operation> {
3248 (*self.0.stub)
3249 .wait_operation(self.0.request, self.0.options)
3250 .await
3251 .map(gax::response::Response::into_body)
3252 }
3253
3254 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3256 self.0.request.name = v.into();
3257 self
3258 }
3259
3260 pub fn set_timeout<T>(mut self, v: T) -> Self
3262 where
3263 T: std::convert::Into<wkt::Duration>,
3264 {
3265 self.0.request.timeout = std::option::Option::Some(v.into());
3266 self
3267 }
3268
3269 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3271 where
3272 T: std::convert::Into<wkt::Duration>,
3273 {
3274 self.0.request.timeout = v.map(|x| x.into());
3275 self
3276 }
3277 }
3278
3279 #[doc(hidden)]
3280 impl gax::options::internal::RequestBuilder for WaitOperation {
3281 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3282 &mut self.0.options
3283 }
3284 }
3285}
3286
3287pub mod services {
3288 use crate::Result;
3289
3290 pub type ClientBuilder =
3304 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3305
3306 pub(crate) mod client {
3307 use super::super::super::client::Services;
3308 pub struct Factory;
3309 impl gax::client_builder::internal::ClientFactory for Factory {
3310 type Client = Services;
3311 type Credentials = gaxi::options::Credentials;
3312 async fn build(
3313 self,
3314 config: gaxi::options::ClientConfig,
3315 ) -> gax::client_builder::Result<Self::Client> {
3316 Self::Client::new(config).await
3317 }
3318 }
3319 }
3320
3321 #[derive(Clone, Debug)]
3323 pub(crate) struct RequestBuilder<R: std::default::Default> {
3324 stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
3325 request: R,
3326 options: gax::options::RequestOptions,
3327 }
3328
3329 impl<R> RequestBuilder<R>
3330 where
3331 R: std::default::Default,
3332 {
3333 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3334 Self {
3335 stub,
3336 request: R::default(),
3337 options: gax::options::RequestOptions::default(),
3338 }
3339 }
3340 }
3341
3342 #[derive(Clone, Debug)]
3360 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
3361
3362 impl CreateService {
3363 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3364 Self(RequestBuilder::new(stub))
3365 }
3366
3367 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
3369 self.0.request = v.into();
3370 self
3371 }
3372
3373 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3375 self.0.options = v.into();
3376 self
3377 }
3378
3379 pub async fn send(self) -> Result<longrunning::model::Operation> {
3386 (*self.0.stub)
3387 .create_service(self.0.request, self.0.options)
3388 .await
3389 .map(gax::response::Response::into_body)
3390 }
3391
3392 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3394 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3395 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3396 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3397
3398 let stub = self.0.stub.clone();
3399 let mut options = self.0.options.clone();
3400 options.set_retry_policy(gax::retry_policy::NeverRetry);
3401 let query = move |name| {
3402 let stub = stub.clone();
3403 let options = options.clone();
3404 async {
3405 let op = GetOperation::new(stub)
3406 .set_name(name)
3407 .with_options(options)
3408 .send()
3409 .await?;
3410 Ok(Operation::new(op))
3411 }
3412 };
3413
3414 let start = move || async {
3415 let op = self.send().await?;
3416 Ok(Operation::new(op))
3417 };
3418
3419 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3420 }
3421
3422 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3426 self.0.request.parent = v.into();
3427 self
3428 }
3429
3430 pub fn set_service<T>(mut self, v: T) -> Self
3434 where
3435 T: std::convert::Into<crate::model::Service>,
3436 {
3437 self.0.request.service = std::option::Option::Some(v.into());
3438 self
3439 }
3440
3441 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3445 where
3446 T: std::convert::Into<crate::model::Service>,
3447 {
3448 self.0.request.service = v.map(|x| x.into());
3449 self
3450 }
3451
3452 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3456 self.0.request.service_id = v.into();
3457 self
3458 }
3459
3460 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3462 self.0.request.validate_only = v.into();
3463 self
3464 }
3465 }
3466
3467 #[doc(hidden)]
3468 impl gax::options::internal::RequestBuilder for CreateService {
3469 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3470 &mut self.0.options
3471 }
3472 }
3473
3474 #[derive(Clone, Debug)]
3491 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
3492
3493 impl GetService {
3494 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3495 Self(RequestBuilder::new(stub))
3496 }
3497
3498 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
3500 self.0.request = v.into();
3501 self
3502 }
3503
3504 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3506 self.0.options = v.into();
3507 self
3508 }
3509
3510 pub async fn send(self) -> Result<crate::model::Service> {
3512 (*self.0.stub)
3513 .get_service(self.0.request, self.0.options)
3514 .await
3515 .map(gax::response::Response::into_body)
3516 }
3517
3518 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3522 self.0.request.name = v.into();
3523 self
3524 }
3525 }
3526
3527 #[doc(hidden)]
3528 impl gax::options::internal::RequestBuilder for GetService {
3529 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3530 &mut self.0.options
3531 }
3532 }
3533
3534 #[derive(Clone, Debug)]
3555 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
3556
3557 impl ListServices {
3558 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3559 Self(RequestBuilder::new(stub))
3560 }
3561
3562 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
3564 self.0.request = v.into();
3565 self
3566 }
3567
3568 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3570 self.0.options = v.into();
3571 self
3572 }
3573
3574 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
3576 (*self.0.stub)
3577 .list_services(self.0.request, self.0.options)
3578 .await
3579 .map(gax::response::Response::into_body)
3580 }
3581
3582 pub fn by_page(
3584 self,
3585 ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
3586 {
3587 use std::clone::Clone;
3588 let token = self.0.request.page_token.clone();
3589 let execute = move |token: String| {
3590 let mut builder = self.clone();
3591 builder.0.request = builder.0.request.set_page_token(token);
3592 builder.send()
3593 };
3594 gax::paginator::internal::new_paginator(token, execute)
3595 }
3596
3597 pub fn by_item(
3599 self,
3600 ) -> impl gax::paginator::ItemPaginator<crate::model::ListServicesResponse, gax::error::Error>
3601 {
3602 use gax::paginator::Paginator;
3603 self.by_page().items()
3604 }
3605
3606 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3610 self.0.request.parent = v.into();
3611 self
3612 }
3613
3614 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3616 self.0.request.page_size = v.into();
3617 self
3618 }
3619
3620 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3622 self.0.request.page_token = v.into();
3623 self
3624 }
3625
3626 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3628 self.0.request.show_deleted = v.into();
3629 self
3630 }
3631 }
3632
3633 #[doc(hidden)]
3634 impl gax::options::internal::RequestBuilder for ListServices {
3635 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3636 &mut self.0.options
3637 }
3638 }
3639
3640 #[derive(Clone, Debug)]
3658 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
3659
3660 impl UpdateService {
3661 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3662 Self(RequestBuilder::new(stub))
3663 }
3664
3665 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
3667 self.0.request = v.into();
3668 self
3669 }
3670
3671 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3673 self.0.options = v.into();
3674 self
3675 }
3676
3677 pub async fn send(self) -> Result<longrunning::model::Operation> {
3684 (*self.0.stub)
3685 .update_service(self.0.request, self.0.options)
3686 .await
3687 .map(gax::response::Response::into_body)
3688 }
3689
3690 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3692 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3693 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3694 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3695
3696 let stub = self.0.stub.clone();
3697 let mut options = self.0.options.clone();
3698 options.set_retry_policy(gax::retry_policy::NeverRetry);
3699 let query = move |name| {
3700 let stub = stub.clone();
3701 let options = options.clone();
3702 async {
3703 let op = GetOperation::new(stub)
3704 .set_name(name)
3705 .with_options(options)
3706 .send()
3707 .await?;
3708 Ok(Operation::new(op))
3709 }
3710 };
3711
3712 let start = move || async {
3713 let op = self.send().await?;
3714 Ok(Operation::new(op))
3715 };
3716
3717 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3718 }
3719
3720 pub fn set_update_mask<T>(mut self, v: T) -> Self
3722 where
3723 T: std::convert::Into<wkt::FieldMask>,
3724 {
3725 self.0.request.update_mask = std::option::Option::Some(v.into());
3726 self
3727 }
3728
3729 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3731 where
3732 T: std::convert::Into<wkt::FieldMask>,
3733 {
3734 self.0.request.update_mask = v.map(|x| x.into());
3735 self
3736 }
3737
3738 pub fn set_service<T>(mut self, v: T) -> Self
3742 where
3743 T: std::convert::Into<crate::model::Service>,
3744 {
3745 self.0.request.service = std::option::Option::Some(v.into());
3746 self
3747 }
3748
3749 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3753 where
3754 T: std::convert::Into<crate::model::Service>,
3755 {
3756 self.0.request.service = v.map(|x| x.into());
3757 self
3758 }
3759
3760 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3762 self.0.request.validate_only = v.into();
3763 self
3764 }
3765
3766 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
3768 self.0.request.allow_missing = v.into();
3769 self
3770 }
3771 }
3772
3773 #[doc(hidden)]
3774 impl gax::options::internal::RequestBuilder for UpdateService {
3775 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3776 &mut self.0.options
3777 }
3778 }
3779
3780 #[derive(Clone, Debug)]
3798 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
3799
3800 impl DeleteService {
3801 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3802 Self(RequestBuilder::new(stub))
3803 }
3804
3805 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
3807 self.0.request = v.into();
3808 self
3809 }
3810
3811 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3813 self.0.options = v.into();
3814 self
3815 }
3816
3817 pub async fn send(self) -> Result<longrunning::model::Operation> {
3824 (*self.0.stub)
3825 .delete_service(self.0.request, self.0.options)
3826 .await
3827 .map(gax::response::Response::into_body)
3828 }
3829
3830 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3832 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3833 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3834 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3835
3836 let stub = self.0.stub.clone();
3837 let mut options = self.0.options.clone();
3838 options.set_retry_policy(gax::retry_policy::NeverRetry);
3839 let query = move |name| {
3840 let stub = stub.clone();
3841 let options = options.clone();
3842 async {
3843 let op = GetOperation::new(stub)
3844 .set_name(name)
3845 .with_options(options)
3846 .send()
3847 .await?;
3848 Ok(Operation::new(op))
3849 }
3850 };
3851
3852 let start = move || async {
3853 let op = self.send().await?;
3854 Ok(Operation::new(op))
3855 };
3856
3857 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3858 }
3859
3860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3864 self.0.request.name = v.into();
3865 self
3866 }
3867
3868 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3870 self.0.request.validate_only = v.into();
3871 self
3872 }
3873
3874 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3876 self.0.request.etag = v.into();
3877 self
3878 }
3879 }
3880
3881 #[doc(hidden)]
3882 impl gax::options::internal::RequestBuilder for DeleteService {
3883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3884 &mut self.0.options
3885 }
3886 }
3887
3888 #[derive(Clone, Debug)]
3905 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3906
3907 impl GetIamPolicy {
3908 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3909 Self(RequestBuilder::new(stub))
3910 }
3911
3912 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3914 self.0.request = v.into();
3915 self
3916 }
3917
3918 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3920 self.0.options = v.into();
3921 self
3922 }
3923
3924 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3926 (*self.0.stub)
3927 .get_iam_policy(self.0.request, self.0.options)
3928 .await
3929 .map(gax::response::Response::into_body)
3930 }
3931
3932 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3936 self.0.request.resource = v.into();
3937 self
3938 }
3939
3940 pub fn set_options<T>(mut self, v: T) -> Self
3942 where
3943 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3944 {
3945 self.0.request.options = std::option::Option::Some(v.into());
3946 self
3947 }
3948
3949 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3951 where
3952 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3953 {
3954 self.0.request.options = v.map(|x| x.into());
3955 self
3956 }
3957 }
3958
3959 #[doc(hidden)]
3960 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3961 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3962 &mut self.0.options
3963 }
3964 }
3965
3966 #[derive(Clone, Debug)]
3983 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3984
3985 impl SetIamPolicy {
3986 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3987 Self(RequestBuilder::new(stub))
3988 }
3989
3990 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3992 self.0.request = v.into();
3993 self
3994 }
3995
3996 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3998 self.0.options = v.into();
3999 self
4000 }
4001
4002 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4004 (*self.0.stub)
4005 .set_iam_policy(self.0.request, self.0.options)
4006 .await
4007 .map(gax::response::Response::into_body)
4008 }
4009
4010 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4014 self.0.request.resource = v.into();
4015 self
4016 }
4017
4018 pub fn set_policy<T>(mut self, v: T) -> Self
4022 where
4023 T: std::convert::Into<iam_v1::model::Policy>,
4024 {
4025 self.0.request.policy = std::option::Option::Some(v.into());
4026 self
4027 }
4028
4029 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4033 where
4034 T: std::convert::Into<iam_v1::model::Policy>,
4035 {
4036 self.0.request.policy = v.map(|x| x.into());
4037 self
4038 }
4039
4040 pub fn set_update_mask<T>(mut self, v: T) -> Self
4042 where
4043 T: std::convert::Into<wkt::FieldMask>,
4044 {
4045 self.0.request.update_mask = std::option::Option::Some(v.into());
4046 self
4047 }
4048
4049 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4051 where
4052 T: std::convert::Into<wkt::FieldMask>,
4053 {
4054 self.0.request.update_mask = v.map(|x| x.into());
4055 self
4056 }
4057 }
4058
4059 #[doc(hidden)]
4060 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4061 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4062 &mut self.0.options
4063 }
4064 }
4065
4066 #[derive(Clone, Debug)]
4083 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4084
4085 impl TestIamPermissions {
4086 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4087 Self(RequestBuilder::new(stub))
4088 }
4089
4090 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4092 mut self,
4093 v: V,
4094 ) -> Self {
4095 self.0.request = v.into();
4096 self
4097 }
4098
4099 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4101 self.0.options = v.into();
4102 self
4103 }
4104
4105 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4107 (*self.0.stub)
4108 .test_iam_permissions(self.0.request, self.0.options)
4109 .await
4110 .map(gax::response::Response::into_body)
4111 }
4112
4113 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4117 self.0.request.resource = v.into();
4118 self
4119 }
4120
4121 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4125 where
4126 T: std::iter::IntoIterator<Item = V>,
4127 V: std::convert::Into<std::string::String>,
4128 {
4129 use std::iter::Iterator;
4130 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4131 self
4132 }
4133 }
4134
4135 #[doc(hidden)]
4136 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4137 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4138 &mut self.0.options
4139 }
4140 }
4141
4142 #[derive(Clone, Debug)]
4163 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4164
4165 impl ListOperations {
4166 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4167 Self(RequestBuilder::new(stub))
4168 }
4169
4170 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4172 mut self,
4173 v: V,
4174 ) -> Self {
4175 self.0.request = v.into();
4176 self
4177 }
4178
4179 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4181 self.0.options = v.into();
4182 self
4183 }
4184
4185 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4187 (*self.0.stub)
4188 .list_operations(self.0.request, self.0.options)
4189 .await
4190 .map(gax::response::Response::into_body)
4191 }
4192
4193 pub fn by_page(
4195 self,
4196 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4197 {
4198 use std::clone::Clone;
4199 let token = self.0.request.page_token.clone();
4200 let execute = move |token: String| {
4201 let mut builder = self.clone();
4202 builder.0.request = builder.0.request.set_page_token(token);
4203 builder.send()
4204 };
4205 gax::paginator::internal::new_paginator(token, execute)
4206 }
4207
4208 pub fn by_item(
4210 self,
4211 ) -> impl gax::paginator::ItemPaginator<
4212 longrunning::model::ListOperationsResponse,
4213 gax::error::Error,
4214 > {
4215 use gax::paginator::Paginator;
4216 self.by_page().items()
4217 }
4218
4219 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4221 self.0.request.name = v.into();
4222 self
4223 }
4224
4225 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4227 self.0.request.filter = v.into();
4228 self
4229 }
4230
4231 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4233 self.0.request.page_size = v.into();
4234 self
4235 }
4236
4237 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4239 self.0.request.page_token = v.into();
4240 self
4241 }
4242
4243 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4245 self.0.request.return_partial_success = v.into();
4246 self
4247 }
4248 }
4249
4250 #[doc(hidden)]
4251 impl gax::options::internal::RequestBuilder for ListOperations {
4252 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4253 &mut self.0.options
4254 }
4255 }
4256
4257 #[derive(Clone, Debug)]
4274 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4275
4276 impl GetOperation {
4277 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4278 Self(RequestBuilder::new(stub))
4279 }
4280
4281 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4283 mut self,
4284 v: V,
4285 ) -> Self {
4286 self.0.request = v.into();
4287 self
4288 }
4289
4290 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4292 self.0.options = v.into();
4293 self
4294 }
4295
4296 pub async fn send(self) -> Result<longrunning::model::Operation> {
4298 (*self.0.stub)
4299 .get_operation(self.0.request, self.0.options)
4300 .await
4301 .map(gax::response::Response::into_body)
4302 }
4303
4304 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4306 self.0.request.name = v.into();
4307 self
4308 }
4309 }
4310
4311 #[doc(hidden)]
4312 impl gax::options::internal::RequestBuilder for GetOperation {
4313 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4314 &mut self.0.options
4315 }
4316 }
4317
4318 #[derive(Clone, Debug)]
4335 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4336
4337 impl DeleteOperation {
4338 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4339 Self(RequestBuilder::new(stub))
4340 }
4341
4342 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4344 mut self,
4345 v: V,
4346 ) -> Self {
4347 self.0.request = v.into();
4348 self
4349 }
4350
4351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4353 self.0.options = v.into();
4354 self
4355 }
4356
4357 pub async fn send(self) -> Result<()> {
4359 (*self.0.stub)
4360 .delete_operation(self.0.request, self.0.options)
4361 .await
4362 .map(gax::response::Response::into_body)
4363 }
4364
4365 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4367 self.0.request.name = v.into();
4368 self
4369 }
4370 }
4371
4372 #[doc(hidden)]
4373 impl gax::options::internal::RequestBuilder for DeleteOperation {
4374 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4375 &mut self.0.options
4376 }
4377 }
4378
4379 #[derive(Clone, Debug)]
4396 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
4397
4398 impl WaitOperation {
4399 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4400 Self(RequestBuilder::new(stub))
4401 }
4402
4403 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
4405 mut self,
4406 v: V,
4407 ) -> Self {
4408 self.0.request = v.into();
4409 self
4410 }
4411
4412 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4414 self.0.options = v.into();
4415 self
4416 }
4417
4418 pub async fn send(self) -> Result<longrunning::model::Operation> {
4420 (*self.0.stub)
4421 .wait_operation(self.0.request, self.0.options)
4422 .await
4423 .map(gax::response::Response::into_body)
4424 }
4425
4426 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4428 self.0.request.name = v.into();
4429 self
4430 }
4431
4432 pub fn set_timeout<T>(mut self, v: T) -> Self
4434 where
4435 T: std::convert::Into<wkt::Duration>,
4436 {
4437 self.0.request.timeout = std::option::Option::Some(v.into());
4438 self
4439 }
4440
4441 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4443 where
4444 T: std::convert::Into<wkt::Duration>,
4445 {
4446 self.0.request.timeout = v.map(|x| x.into());
4447 self
4448 }
4449 }
4450
4451 #[doc(hidden)]
4452 impl gax::options::internal::RequestBuilder for WaitOperation {
4453 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4454 &mut self.0.options
4455 }
4456 }
4457}
4458
4459pub mod tasks {
4460 use crate::Result;
4461
4462 pub type ClientBuilder =
4476 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4477
4478 pub(crate) mod client {
4479 use super::super::super::client::Tasks;
4480 pub struct Factory;
4481 impl gax::client_builder::internal::ClientFactory for Factory {
4482 type Client = Tasks;
4483 type Credentials = gaxi::options::Credentials;
4484 async fn build(
4485 self,
4486 config: gaxi::options::ClientConfig,
4487 ) -> gax::client_builder::Result<Self::Client> {
4488 Self::Client::new(config).await
4489 }
4490 }
4491 }
4492
4493 #[derive(Clone, Debug)]
4495 pub(crate) struct RequestBuilder<R: std::default::Default> {
4496 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
4497 request: R,
4498 options: gax::options::RequestOptions,
4499 }
4500
4501 impl<R> RequestBuilder<R>
4502 where
4503 R: std::default::Default,
4504 {
4505 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4506 Self {
4507 stub,
4508 request: R::default(),
4509 options: gax::options::RequestOptions::default(),
4510 }
4511 }
4512 }
4513
4514 #[derive(Clone, Debug)]
4531 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
4532
4533 impl GetTask {
4534 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4535 Self(RequestBuilder::new(stub))
4536 }
4537
4538 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
4540 self.0.request = v.into();
4541 self
4542 }
4543
4544 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4546 self.0.options = v.into();
4547 self
4548 }
4549
4550 pub async fn send(self) -> Result<crate::model::Task> {
4552 (*self.0.stub)
4553 .get_task(self.0.request, self.0.options)
4554 .await
4555 .map(gax::response::Response::into_body)
4556 }
4557
4558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4562 self.0.request.name = v.into();
4563 self
4564 }
4565 }
4566
4567 #[doc(hidden)]
4568 impl gax::options::internal::RequestBuilder for GetTask {
4569 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4570 &mut self.0.options
4571 }
4572 }
4573
4574 #[derive(Clone, Debug)]
4595 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
4596
4597 impl ListTasks {
4598 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4599 Self(RequestBuilder::new(stub))
4600 }
4601
4602 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
4604 self.0.request = v.into();
4605 self
4606 }
4607
4608 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4610 self.0.options = v.into();
4611 self
4612 }
4613
4614 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
4616 (*self.0.stub)
4617 .list_tasks(self.0.request, self.0.options)
4618 .await
4619 .map(gax::response::Response::into_body)
4620 }
4621
4622 pub fn by_page(
4624 self,
4625 ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
4626 {
4627 use std::clone::Clone;
4628 let token = self.0.request.page_token.clone();
4629 let execute = move |token: String| {
4630 let mut builder = self.clone();
4631 builder.0.request = builder.0.request.set_page_token(token);
4632 builder.send()
4633 };
4634 gax::paginator::internal::new_paginator(token, execute)
4635 }
4636
4637 pub fn by_item(
4639 self,
4640 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTasksResponse, gax::error::Error>
4641 {
4642 use gax::paginator::Paginator;
4643 self.by_page().items()
4644 }
4645
4646 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4650 self.0.request.parent = v.into();
4651 self
4652 }
4653
4654 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4656 self.0.request.page_size = v.into();
4657 self
4658 }
4659
4660 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4662 self.0.request.page_token = v.into();
4663 self
4664 }
4665
4666 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4668 self.0.request.show_deleted = v.into();
4669 self
4670 }
4671 }
4672
4673 #[doc(hidden)]
4674 impl gax::options::internal::RequestBuilder for ListTasks {
4675 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4676 &mut self.0.options
4677 }
4678 }
4679
4680 #[derive(Clone, Debug)]
4701 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4702
4703 impl ListOperations {
4704 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4705 Self(RequestBuilder::new(stub))
4706 }
4707
4708 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4710 mut self,
4711 v: V,
4712 ) -> Self {
4713 self.0.request = v.into();
4714 self
4715 }
4716
4717 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4719 self.0.options = v.into();
4720 self
4721 }
4722
4723 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4725 (*self.0.stub)
4726 .list_operations(self.0.request, self.0.options)
4727 .await
4728 .map(gax::response::Response::into_body)
4729 }
4730
4731 pub fn by_page(
4733 self,
4734 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4735 {
4736 use std::clone::Clone;
4737 let token = self.0.request.page_token.clone();
4738 let execute = move |token: String| {
4739 let mut builder = self.clone();
4740 builder.0.request = builder.0.request.set_page_token(token);
4741 builder.send()
4742 };
4743 gax::paginator::internal::new_paginator(token, execute)
4744 }
4745
4746 pub fn by_item(
4748 self,
4749 ) -> impl gax::paginator::ItemPaginator<
4750 longrunning::model::ListOperationsResponse,
4751 gax::error::Error,
4752 > {
4753 use gax::paginator::Paginator;
4754 self.by_page().items()
4755 }
4756
4757 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759 self.0.request.name = v.into();
4760 self
4761 }
4762
4763 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4765 self.0.request.filter = v.into();
4766 self
4767 }
4768
4769 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4771 self.0.request.page_size = v.into();
4772 self
4773 }
4774
4775 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4777 self.0.request.page_token = v.into();
4778 self
4779 }
4780
4781 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4783 self.0.request.return_partial_success = v.into();
4784 self
4785 }
4786 }
4787
4788 #[doc(hidden)]
4789 impl gax::options::internal::RequestBuilder for ListOperations {
4790 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4791 &mut self.0.options
4792 }
4793 }
4794
4795 #[derive(Clone, Debug)]
4812 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4813
4814 impl GetOperation {
4815 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4816 Self(RequestBuilder::new(stub))
4817 }
4818
4819 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4821 mut self,
4822 v: V,
4823 ) -> Self {
4824 self.0.request = v.into();
4825 self
4826 }
4827
4828 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4830 self.0.options = v.into();
4831 self
4832 }
4833
4834 pub async fn send(self) -> Result<longrunning::model::Operation> {
4836 (*self.0.stub)
4837 .get_operation(self.0.request, self.0.options)
4838 .await
4839 .map(gax::response::Response::into_body)
4840 }
4841
4842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4844 self.0.request.name = v.into();
4845 self
4846 }
4847 }
4848
4849 #[doc(hidden)]
4850 impl gax::options::internal::RequestBuilder for GetOperation {
4851 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4852 &mut self.0.options
4853 }
4854 }
4855
4856 #[derive(Clone, Debug)]
4873 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4874
4875 impl DeleteOperation {
4876 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4877 Self(RequestBuilder::new(stub))
4878 }
4879
4880 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4882 mut self,
4883 v: V,
4884 ) -> Self {
4885 self.0.request = v.into();
4886 self
4887 }
4888
4889 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4891 self.0.options = v.into();
4892 self
4893 }
4894
4895 pub async fn send(self) -> Result<()> {
4897 (*self.0.stub)
4898 .delete_operation(self.0.request, self.0.options)
4899 .await
4900 .map(gax::response::Response::into_body)
4901 }
4902
4903 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4905 self.0.request.name = v.into();
4906 self
4907 }
4908 }
4909
4910 #[doc(hidden)]
4911 impl gax::options::internal::RequestBuilder for DeleteOperation {
4912 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4913 &mut self.0.options
4914 }
4915 }
4916
4917 #[derive(Clone, Debug)]
4934 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
4935
4936 impl WaitOperation {
4937 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4938 Self(RequestBuilder::new(stub))
4939 }
4940
4941 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
4943 mut self,
4944 v: V,
4945 ) -> Self {
4946 self.0.request = v.into();
4947 self
4948 }
4949
4950 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4952 self.0.options = v.into();
4953 self
4954 }
4955
4956 pub async fn send(self) -> Result<longrunning::model::Operation> {
4958 (*self.0.stub)
4959 .wait_operation(self.0.request, self.0.options)
4960 .await
4961 .map(gax::response::Response::into_body)
4962 }
4963
4964 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4966 self.0.request.name = v.into();
4967 self
4968 }
4969
4970 pub fn set_timeout<T>(mut self, v: T) -> Self
4972 where
4973 T: std::convert::Into<wkt::Duration>,
4974 {
4975 self.0.request.timeout = std::option::Option::Some(v.into());
4976 self
4977 }
4978
4979 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4981 where
4982 T: std::convert::Into<wkt::Duration>,
4983 {
4984 self.0.request.timeout = v.map(|x| x.into());
4985 self
4986 }
4987 }
4988
4989 #[doc(hidden)]
4990 impl gax::options::internal::RequestBuilder for WaitOperation {
4991 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4992 &mut self.0.options
4993 }
4994 }
4995}
4996
4997pub mod worker_pools {
4998 use crate::Result;
4999
5000 pub type ClientBuilder =
5014 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5015
5016 pub(crate) mod client {
5017 use super::super::super::client::WorkerPools;
5018 pub struct Factory;
5019 impl gax::client_builder::internal::ClientFactory for Factory {
5020 type Client = WorkerPools;
5021 type Credentials = gaxi::options::Credentials;
5022 async fn build(
5023 self,
5024 config: gaxi::options::ClientConfig,
5025 ) -> gax::client_builder::Result<Self::Client> {
5026 Self::Client::new(config).await
5027 }
5028 }
5029 }
5030
5031 #[derive(Clone, Debug)]
5033 pub(crate) struct RequestBuilder<R: std::default::Default> {
5034 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5035 request: R,
5036 options: gax::options::RequestOptions,
5037 }
5038
5039 impl<R> RequestBuilder<R>
5040 where
5041 R: std::default::Default,
5042 {
5043 pub(crate) fn new(
5044 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5045 ) -> Self {
5046 Self {
5047 stub,
5048 request: R::default(),
5049 options: gax::options::RequestOptions::default(),
5050 }
5051 }
5052 }
5053
5054 #[derive(Clone, Debug)]
5072 pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
5073
5074 impl CreateWorkerPool {
5075 pub(crate) fn new(
5076 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5077 ) -> Self {
5078 Self(RequestBuilder::new(stub))
5079 }
5080
5081 pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
5083 mut self,
5084 v: V,
5085 ) -> Self {
5086 self.0.request = v.into();
5087 self
5088 }
5089
5090 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5092 self.0.options = v.into();
5093 self
5094 }
5095
5096 pub async fn send(self) -> Result<longrunning::model::Operation> {
5103 (*self.0.stub)
5104 .create_worker_pool(self.0.request, self.0.options)
5105 .await
5106 .map(gax::response::Response::into_body)
5107 }
5108
5109 pub fn poller(
5111 self,
5112 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5113 type Operation =
5114 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5115 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5116 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5117
5118 let stub = self.0.stub.clone();
5119 let mut options = self.0.options.clone();
5120 options.set_retry_policy(gax::retry_policy::NeverRetry);
5121 let query = move |name| {
5122 let stub = stub.clone();
5123 let options = options.clone();
5124 async {
5125 let op = GetOperation::new(stub)
5126 .set_name(name)
5127 .with_options(options)
5128 .send()
5129 .await?;
5130 Ok(Operation::new(op))
5131 }
5132 };
5133
5134 let start = move || async {
5135 let op = self.send().await?;
5136 Ok(Operation::new(op))
5137 };
5138
5139 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5140 }
5141
5142 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5146 self.0.request.parent = v.into();
5147 self
5148 }
5149
5150 pub fn set_worker_pool<T>(mut self, v: T) -> Self
5154 where
5155 T: std::convert::Into<crate::model::WorkerPool>,
5156 {
5157 self.0.request.worker_pool = std::option::Option::Some(v.into());
5158 self
5159 }
5160
5161 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
5165 where
5166 T: std::convert::Into<crate::model::WorkerPool>,
5167 {
5168 self.0.request.worker_pool = v.map(|x| x.into());
5169 self
5170 }
5171
5172 pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5176 self.0.request.worker_pool_id = v.into();
5177 self
5178 }
5179
5180 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5182 self.0.request.validate_only = v.into();
5183 self
5184 }
5185 }
5186
5187 #[doc(hidden)]
5188 impl gax::options::internal::RequestBuilder for CreateWorkerPool {
5189 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5190 &mut self.0.options
5191 }
5192 }
5193
5194 #[derive(Clone, Debug)]
5211 pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
5212
5213 impl GetWorkerPool {
5214 pub(crate) fn new(
5215 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5216 ) -> Self {
5217 Self(RequestBuilder::new(stub))
5218 }
5219
5220 pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
5222 self.0.request = v.into();
5223 self
5224 }
5225
5226 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5228 self.0.options = v.into();
5229 self
5230 }
5231
5232 pub async fn send(self) -> Result<crate::model::WorkerPool> {
5234 (*self.0.stub)
5235 .get_worker_pool(self.0.request, self.0.options)
5236 .await
5237 .map(gax::response::Response::into_body)
5238 }
5239
5240 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5244 self.0.request.name = v.into();
5245 self
5246 }
5247 }
5248
5249 #[doc(hidden)]
5250 impl gax::options::internal::RequestBuilder for GetWorkerPool {
5251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5252 &mut self.0.options
5253 }
5254 }
5255
5256 #[derive(Clone, Debug)]
5277 pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
5278
5279 impl ListWorkerPools {
5280 pub(crate) fn new(
5281 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5282 ) -> Self {
5283 Self(RequestBuilder::new(stub))
5284 }
5285
5286 pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
5288 self.0.request = v.into();
5289 self
5290 }
5291
5292 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5294 self.0.options = v.into();
5295 self
5296 }
5297
5298 pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
5300 (*self.0.stub)
5301 .list_worker_pools(self.0.request, self.0.options)
5302 .await
5303 .map(gax::response::Response::into_body)
5304 }
5305
5306 pub fn by_page(
5308 self,
5309 ) -> impl gax::paginator::Paginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
5310 {
5311 use std::clone::Clone;
5312 let token = self.0.request.page_token.clone();
5313 let execute = move |token: String| {
5314 let mut builder = self.clone();
5315 builder.0.request = builder.0.request.set_page_token(token);
5316 builder.send()
5317 };
5318 gax::paginator::internal::new_paginator(token, execute)
5319 }
5320
5321 pub fn by_item(
5323 self,
5324 ) -> impl gax::paginator::ItemPaginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
5325 {
5326 use gax::paginator::Paginator;
5327 self.by_page().items()
5328 }
5329
5330 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5334 self.0.request.parent = v.into();
5335 self
5336 }
5337
5338 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5340 self.0.request.page_size = v.into();
5341 self
5342 }
5343
5344 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5346 self.0.request.page_token = v.into();
5347 self
5348 }
5349
5350 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5352 self.0.request.show_deleted = v.into();
5353 self
5354 }
5355 }
5356
5357 #[doc(hidden)]
5358 impl gax::options::internal::RequestBuilder for ListWorkerPools {
5359 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5360 &mut self.0.options
5361 }
5362 }
5363
5364 #[derive(Clone, Debug)]
5382 pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
5383
5384 impl UpdateWorkerPool {
5385 pub(crate) fn new(
5386 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5387 ) -> Self {
5388 Self(RequestBuilder::new(stub))
5389 }
5390
5391 pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
5393 mut self,
5394 v: V,
5395 ) -> Self {
5396 self.0.request = v.into();
5397 self
5398 }
5399
5400 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5402 self.0.options = v.into();
5403 self
5404 }
5405
5406 pub async fn send(self) -> Result<longrunning::model::Operation> {
5413 (*self.0.stub)
5414 .update_worker_pool(self.0.request, self.0.options)
5415 .await
5416 .map(gax::response::Response::into_body)
5417 }
5418
5419 pub fn poller(
5421 self,
5422 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5423 type Operation =
5424 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5425 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5426 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5427
5428 let stub = self.0.stub.clone();
5429 let mut options = self.0.options.clone();
5430 options.set_retry_policy(gax::retry_policy::NeverRetry);
5431 let query = move |name| {
5432 let stub = stub.clone();
5433 let options = options.clone();
5434 async {
5435 let op = GetOperation::new(stub)
5436 .set_name(name)
5437 .with_options(options)
5438 .send()
5439 .await?;
5440 Ok(Operation::new(op))
5441 }
5442 };
5443
5444 let start = move || async {
5445 let op = self.send().await?;
5446 Ok(Operation::new(op))
5447 };
5448
5449 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5450 }
5451
5452 pub fn set_update_mask<T>(mut self, v: T) -> Self
5454 where
5455 T: std::convert::Into<wkt::FieldMask>,
5456 {
5457 self.0.request.update_mask = std::option::Option::Some(v.into());
5458 self
5459 }
5460
5461 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5463 where
5464 T: std::convert::Into<wkt::FieldMask>,
5465 {
5466 self.0.request.update_mask = v.map(|x| x.into());
5467 self
5468 }
5469
5470 pub fn set_worker_pool<T>(mut self, v: T) -> Self
5474 where
5475 T: std::convert::Into<crate::model::WorkerPool>,
5476 {
5477 self.0.request.worker_pool = std::option::Option::Some(v.into());
5478 self
5479 }
5480
5481 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
5485 where
5486 T: std::convert::Into<crate::model::WorkerPool>,
5487 {
5488 self.0.request.worker_pool = v.map(|x| x.into());
5489 self
5490 }
5491
5492 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5494 self.0.request.validate_only = v.into();
5495 self
5496 }
5497
5498 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5500 self.0.request.allow_missing = v.into();
5501 self
5502 }
5503
5504 pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
5506 self.0.request.force_new_revision = v.into();
5507 self
5508 }
5509 }
5510
5511 #[doc(hidden)]
5512 impl gax::options::internal::RequestBuilder for UpdateWorkerPool {
5513 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5514 &mut self.0.options
5515 }
5516 }
5517
5518 #[derive(Clone, Debug)]
5536 pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
5537
5538 impl DeleteWorkerPool {
5539 pub(crate) fn new(
5540 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5541 ) -> Self {
5542 Self(RequestBuilder::new(stub))
5543 }
5544
5545 pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
5547 mut self,
5548 v: V,
5549 ) -> Self {
5550 self.0.request = v.into();
5551 self
5552 }
5553
5554 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5556 self.0.options = v.into();
5557 self
5558 }
5559
5560 pub async fn send(self) -> Result<longrunning::model::Operation> {
5567 (*self.0.stub)
5568 .delete_worker_pool(self.0.request, self.0.options)
5569 .await
5570 .map(gax::response::Response::into_body)
5571 }
5572
5573 pub fn poller(
5575 self,
5576 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5577 type Operation =
5578 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5579 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5580 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5581
5582 let stub = self.0.stub.clone();
5583 let mut options = self.0.options.clone();
5584 options.set_retry_policy(gax::retry_policy::NeverRetry);
5585 let query = move |name| {
5586 let stub = stub.clone();
5587 let options = options.clone();
5588 async {
5589 let op = GetOperation::new(stub)
5590 .set_name(name)
5591 .with_options(options)
5592 .send()
5593 .await?;
5594 Ok(Operation::new(op))
5595 }
5596 };
5597
5598 let start = move || async {
5599 let op = self.send().await?;
5600 Ok(Operation::new(op))
5601 };
5602
5603 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5604 }
5605
5606 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5610 self.0.request.name = v.into();
5611 self
5612 }
5613
5614 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5616 self.0.request.validate_only = v.into();
5617 self
5618 }
5619
5620 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5622 self.0.request.etag = v.into();
5623 self
5624 }
5625 }
5626
5627 #[doc(hidden)]
5628 impl gax::options::internal::RequestBuilder for DeleteWorkerPool {
5629 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5630 &mut self.0.options
5631 }
5632 }
5633
5634 #[derive(Clone, Debug)]
5651 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5652
5653 impl GetIamPolicy {
5654 pub(crate) fn new(
5655 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5656 ) -> Self {
5657 Self(RequestBuilder::new(stub))
5658 }
5659
5660 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5662 self.0.request = v.into();
5663 self
5664 }
5665
5666 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5668 self.0.options = v.into();
5669 self
5670 }
5671
5672 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5674 (*self.0.stub)
5675 .get_iam_policy(self.0.request, self.0.options)
5676 .await
5677 .map(gax::response::Response::into_body)
5678 }
5679
5680 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5684 self.0.request.resource = v.into();
5685 self
5686 }
5687
5688 pub fn set_options<T>(mut self, v: T) -> Self
5690 where
5691 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5692 {
5693 self.0.request.options = std::option::Option::Some(v.into());
5694 self
5695 }
5696
5697 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5699 where
5700 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5701 {
5702 self.0.request.options = v.map(|x| x.into());
5703 self
5704 }
5705 }
5706
5707 #[doc(hidden)]
5708 impl gax::options::internal::RequestBuilder for GetIamPolicy {
5709 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5710 &mut self.0.options
5711 }
5712 }
5713
5714 #[derive(Clone, Debug)]
5731 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5732
5733 impl SetIamPolicy {
5734 pub(crate) fn new(
5735 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5736 ) -> Self {
5737 Self(RequestBuilder::new(stub))
5738 }
5739
5740 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5742 self.0.request = v.into();
5743 self
5744 }
5745
5746 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5748 self.0.options = v.into();
5749 self
5750 }
5751
5752 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5754 (*self.0.stub)
5755 .set_iam_policy(self.0.request, self.0.options)
5756 .await
5757 .map(gax::response::Response::into_body)
5758 }
5759
5760 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5764 self.0.request.resource = v.into();
5765 self
5766 }
5767
5768 pub fn set_policy<T>(mut self, v: T) -> Self
5772 where
5773 T: std::convert::Into<iam_v1::model::Policy>,
5774 {
5775 self.0.request.policy = std::option::Option::Some(v.into());
5776 self
5777 }
5778
5779 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5783 where
5784 T: std::convert::Into<iam_v1::model::Policy>,
5785 {
5786 self.0.request.policy = v.map(|x| x.into());
5787 self
5788 }
5789
5790 pub fn set_update_mask<T>(mut self, v: T) -> Self
5792 where
5793 T: std::convert::Into<wkt::FieldMask>,
5794 {
5795 self.0.request.update_mask = std::option::Option::Some(v.into());
5796 self
5797 }
5798
5799 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5801 where
5802 T: std::convert::Into<wkt::FieldMask>,
5803 {
5804 self.0.request.update_mask = v.map(|x| x.into());
5805 self
5806 }
5807 }
5808
5809 #[doc(hidden)]
5810 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5811 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5812 &mut self.0.options
5813 }
5814 }
5815
5816 #[derive(Clone, Debug)]
5833 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5834
5835 impl TestIamPermissions {
5836 pub(crate) fn new(
5837 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5838 ) -> Self {
5839 Self(RequestBuilder::new(stub))
5840 }
5841
5842 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5844 mut self,
5845 v: V,
5846 ) -> Self {
5847 self.0.request = v.into();
5848 self
5849 }
5850
5851 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5853 self.0.options = v.into();
5854 self
5855 }
5856
5857 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5859 (*self.0.stub)
5860 .test_iam_permissions(self.0.request, self.0.options)
5861 .await
5862 .map(gax::response::Response::into_body)
5863 }
5864
5865 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5869 self.0.request.resource = v.into();
5870 self
5871 }
5872
5873 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5877 where
5878 T: std::iter::IntoIterator<Item = V>,
5879 V: std::convert::Into<std::string::String>,
5880 {
5881 use std::iter::Iterator;
5882 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5883 self
5884 }
5885 }
5886
5887 #[doc(hidden)]
5888 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5889 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5890 &mut self.0.options
5891 }
5892 }
5893
5894 #[derive(Clone, Debug)]
5915 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5916
5917 impl ListOperations {
5918 pub(crate) fn new(
5919 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5920 ) -> Self {
5921 Self(RequestBuilder::new(stub))
5922 }
5923
5924 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5926 mut self,
5927 v: V,
5928 ) -> Self {
5929 self.0.request = v.into();
5930 self
5931 }
5932
5933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5935 self.0.options = v.into();
5936 self
5937 }
5938
5939 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5941 (*self.0.stub)
5942 .list_operations(self.0.request, self.0.options)
5943 .await
5944 .map(gax::response::Response::into_body)
5945 }
5946
5947 pub fn by_page(
5949 self,
5950 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5951 {
5952 use std::clone::Clone;
5953 let token = self.0.request.page_token.clone();
5954 let execute = move |token: String| {
5955 let mut builder = self.clone();
5956 builder.0.request = builder.0.request.set_page_token(token);
5957 builder.send()
5958 };
5959 gax::paginator::internal::new_paginator(token, execute)
5960 }
5961
5962 pub fn by_item(
5964 self,
5965 ) -> impl gax::paginator::ItemPaginator<
5966 longrunning::model::ListOperationsResponse,
5967 gax::error::Error,
5968 > {
5969 use gax::paginator::Paginator;
5970 self.by_page().items()
5971 }
5972
5973 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5975 self.0.request.name = v.into();
5976 self
5977 }
5978
5979 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5981 self.0.request.filter = v.into();
5982 self
5983 }
5984
5985 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5987 self.0.request.page_size = v.into();
5988 self
5989 }
5990
5991 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5993 self.0.request.page_token = v.into();
5994 self
5995 }
5996
5997 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5999 self.0.request.return_partial_success = v.into();
6000 self
6001 }
6002 }
6003
6004 #[doc(hidden)]
6005 impl gax::options::internal::RequestBuilder for ListOperations {
6006 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6007 &mut self.0.options
6008 }
6009 }
6010
6011 #[derive(Clone, Debug)]
6028 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6029
6030 impl GetOperation {
6031 pub(crate) fn new(
6032 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6033 ) -> Self {
6034 Self(RequestBuilder::new(stub))
6035 }
6036
6037 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6039 mut self,
6040 v: V,
6041 ) -> Self {
6042 self.0.request = v.into();
6043 self
6044 }
6045
6046 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6048 self.0.options = v.into();
6049 self
6050 }
6051
6052 pub async fn send(self) -> Result<longrunning::model::Operation> {
6054 (*self.0.stub)
6055 .get_operation(self.0.request, self.0.options)
6056 .await
6057 .map(gax::response::Response::into_body)
6058 }
6059
6060 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6062 self.0.request.name = v.into();
6063 self
6064 }
6065 }
6066
6067 #[doc(hidden)]
6068 impl gax::options::internal::RequestBuilder for GetOperation {
6069 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6070 &mut self.0.options
6071 }
6072 }
6073
6074 #[derive(Clone, Debug)]
6091 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6092
6093 impl DeleteOperation {
6094 pub(crate) fn new(
6095 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6096 ) -> Self {
6097 Self(RequestBuilder::new(stub))
6098 }
6099
6100 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6102 mut self,
6103 v: V,
6104 ) -> Self {
6105 self.0.request = v.into();
6106 self
6107 }
6108
6109 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6111 self.0.options = v.into();
6112 self
6113 }
6114
6115 pub async fn send(self) -> Result<()> {
6117 (*self.0.stub)
6118 .delete_operation(self.0.request, self.0.options)
6119 .await
6120 .map(gax::response::Response::into_body)
6121 }
6122
6123 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6125 self.0.request.name = v.into();
6126 self
6127 }
6128 }
6129
6130 #[doc(hidden)]
6131 impl gax::options::internal::RequestBuilder for DeleteOperation {
6132 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6133 &mut self.0.options
6134 }
6135 }
6136
6137 #[derive(Clone, Debug)]
6154 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
6155
6156 impl WaitOperation {
6157 pub(crate) fn new(
6158 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6159 ) -> Self {
6160 Self(RequestBuilder::new(stub))
6161 }
6162
6163 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
6165 mut self,
6166 v: V,
6167 ) -> Self {
6168 self.0.request = v.into();
6169 self
6170 }
6171
6172 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6174 self.0.options = v.into();
6175 self
6176 }
6177
6178 pub async fn send(self) -> Result<longrunning::model::Operation> {
6180 (*self.0.stub)
6181 .wait_operation(self.0.request, self.0.options)
6182 .await
6183 .map(gax::response::Response::into_body)
6184 }
6185
6186 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6188 self.0.request.name = v.into();
6189 self
6190 }
6191
6192 pub fn set_timeout<T>(mut self, v: T) -> Self
6194 where
6195 T: std::convert::Into<wkt::Duration>,
6196 {
6197 self.0.request.timeout = std::option::Option::Some(v.into());
6198 self
6199 }
6200
6201 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6203 where
6204 T: std::convert::Into<wkt::Duration>,
6205 {
6206 self.0.request.timeout = v.map(|x| x.into());
6207 self
6208 }
6209 }
6210
6211 #[doc(hidden)]
6212 impl gax::options::internal::RequestBuilder for WaitOperation {
6213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6214 &mut self.0.options
6215 }
6216 }
6217}