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 instances {
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::Instances;
1364 pub struct Factory;
1365 impl gax::client_builder::internal::ClientFactory for Factory {
1366 type Client = Instances;
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::Instances>,
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(
1390 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1391 ) -> Self {
1392 Self {
1393 stub,
1394 request: R::default(),
1395 options: gax::options::RequestOptions::default(),
1396 }
1397 }
1398 }
1399
1400 #[derive(Clone, Debug)]
1418 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1419
1420 impl CreateInstance {
1421 pub(crate) fn new(
1422 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1423 ) -> Self {
1424 Self(RequestBuilder::new(stub))
1425 }
1426
1427 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1429 self.0.request = v.into();
1430 self
1431 }
1432
1433 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1435 self.0.options = v.into();
1436 self
1437 }
1438
1439 pub async fn send(self) -> Result<longrunning::model::Operation> {
1446 (*self.0.stub)
1447 .create_instance(self.0.request, self.0.options)
1448 .await
1449 .map(gax::response::Response::into_body)
1450 }
1451
1452 pub fn poller(self) -> impl lro::Poller<crate::model::Instance, crate::model::Instance> {
1454 type Operation =
1455 lro::internal::Operation<crate::model::Instance, crate::model::Instance>;
1456 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1457 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1458
1459 let stub = self.0.stub.clone();
1460 let mut options = self.0.options.clone();
1461 options.set_retry_policy(gax::retry_policy::NeverRetry);
1462 let query = move |name| {
1463 let stub = stub.clone();
1464 let options = options.clone();
1465 async {
1466 let op = GetOperation::new(stub)
1467 .set_name(name)
1468 .with_options(options)
1469 .send()
1470 .await?;
1471 Ok(Operation::new(op))
1472 }
1473 };
1474
1475 let start = move || async {
1476 let op = self.send().await?;
1477 Ok(Operation::new(op))
1478 };
1479
1480 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1481 }
1482
1483 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1487 self.0.request.parent = v.into();
1488 self
1489 }
1490
1491 pub fn set_instance<T>(mut self, v: T) -> Self
1495 where
1496 T: std::convert::Into<crate::model::Instance>,
1497 {
1498 self.0.request.instance = std::option::Option::Some(v.into());
1499 self
1500 }
1501
1502 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1506 where
1507 T: std::convert::Into<crate::model::Instance>,
1508 {
1509 self.0.request.instance = v.map(|x| x.into());
1510 self
1511 }
1512
1513 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1517 self.0.request.instance_id = v.into();
1518 self
1519 }
1520
1521 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1523 self.0.request.validate_only = v.into();
1524 self
1525 }
1526 }
1527
1528 #[doc(hidden)]
1529 impl gax::options::internal::RequestBuilder for CreateInstance {
1530 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1531 &mut self.0.options
1532 }
1533 }
1534
1535 #[derive(Clone, Debug)]
1553 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1554
1555 impl DeleteInstance {
1556 pub(crate) fn new(
1557 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1558 ) -> Self {
1559 Self(RequestBuilder::new(stub))
1560 }
1561
1562 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1564 self.0.request = v.into();
1565 self
1566 }
1567
1568 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1570 self.0.options = v.into();
1571 self
1572 }
1573
1574 pub async fn send(self) -> Result<longrunning::model::Operation> {
1581 (*self.0.stub)
1582 .delete_instance(self.0.request, self.0.options)
1583 .await
1584 .map(gax::response::Response::into_body)
1585 }
1586
1587 pub fn poller(self) -> impl lro::Poller<crate::model::Instance, crate::model::Instance> {
1589 type Operation =
1590 lro::internal::Operation<crate::model::Instance, crate::model::Instance>;
1591 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1592 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1593
1594 let stub = self.0.stub.clone();
1595 let mut options = self.0.options.clone();
1596 options.set_retry_policy(gax::retry_policy::NeverRetry);
1597 let query = move |name| {
1598 let stub = stub.clone();
1599 let options = options.clone();
1600 async {
1601 let op = GetOperation::new(stub)
1602 .set_name(name)
1603 .with_options(options)
1604 .send()
1605 .await?;
1606 Ok(Operation::new(op))
1607 }
1608 };
1609
1610 let start = move || async {
1611 let op = self.send().await?;
1612 Ok(Operation::new(op))
1613 };
1614
1615 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1616 }
1617
1618 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.0.request.name = v.into();
1623 self
1624 }
1625
1626 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1628 self.0.request.validate_only = v.into();
1629 self
1630 }
1631
1632 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1634 self.0.request.etag = v.into();
1635 self
1636 }
1637 }
1638
1639 #[doc(hidden)]
1640 impl gax::options::internal::RequestBuilder for DeleteInstance {
1641 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1642 &mut self.0.options
1643 }
1644 }
1645
1646 #[derive(Clone, Debug)]
1663 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1664
1665 impl GetInstance {
1666 pub(crate) fn new(
1667 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1668 ) -> Self {
1669 Self(RequestBuilder::new(stub))
1670 }
1671
1672 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1674 self.0.request = v.into();
1675 self
1676 }
1677
1678 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1680 self.0.options = v.into();
1681 self
1682 }
1683
1684 pub async fn send(self) -> Result<crate::model::Instance> {
1686 (*self.0.stub)
1687 .get_instance(self.0.request, self.0.options)
1688 .await
1689 .map(gax::response::Response::into_body)
1690 }
1691
1692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1696 self.0.request.name = v.into();
1697 self
1698 }
1699 }
1700
1701 #[doc(hidden)]
1702 impl gax::options::internal::RequestBuilder for GetInstance {
1703 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1704 &mut self.0.options
1705 }
1706 }
1707
1708 #[derive(Clone, Debug)]
1729 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
1730
1731 impl ListInstances {
1732 pub(crate) fn new(
1733 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1734 ) -> Self {
1735 Self(RequestBuilder::new(stub))
1736 }
1737
1738 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
1740 self.0.request = v.into();
1741 self
1742 }
1743
1744 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1746 self.0.options = v.into();
1747 self
1748 }
1749
1750 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
1752 (*self.0.stub)
1753 .list_instances(self.0.request, self.0.options)
1754 .await
1755 .map(gax::response::Response::into_body)
1756 }
1757
1758 pub fn by_page(
1760 self,
1761 ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
1762 {
1763 use std::clone::Clone;
1764 let token = self.0.request.page_token.clone();
1765 let execute = move |token: String| {
1766 let mut builder = self.clone();
1767 builder.0.request = builder.0.request.set_page_token(token);
1768 builder.send()
1769 };
1770 gax::paginator::internal::new_paginator(token, execute)
1771 }
1772
1773 pub fn by_item(
1775 self,
1776 ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
1777 {
1778 use gax::paginator::Paginator;
1779 self.by_page().items()
1780 }
1781
1782 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1786 self.0.request.parent = v.into();
1787 self
1788 }
1789
1790 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1792 self.0.request.page_size = v.into();
1793 self
1794 }
1795
1796 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1798 self.0.request.page_token = v.into();
1799 self
1800 }
1801
1802 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1804 self.0.request.show_deleted = v.into();
1805 self
1806 }
1807 }
1808
1809 #[doc(hidden)]
1810 impl gax::options::internal::RequestBuilder for ListInstances {
1811 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1812 &mut self.0.options
1813 }
1814 }
1815
1816 #[derive(Clone, Debug)]
1834 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
1835
1836 impl StopInstance {
1837 pub(crate) fn new(
1838 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1839 ) -> Self {
1840 Self(RequestBuilder::new(stub))
1841 }
1842
1843 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(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 .stop_instance(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::Instance, crate::model::Instance> {
1870 type Operation =
1871 lro::internal::Operation<crate::model::Instance, crate::model::Instance>;
1872 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1873 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1874
1875 let stub = self.0.stub.clone();
1876 let mut options = self.0.options.clone();
1877 options.set_retry_policy(gax::retry_policy::NeverRetry);
1878 let query = move |name| {
1879 let stub = stub.clone();
1880 let options = options.clone();
1881 async {
1882 let op = GetOperation::new(stub)
1883 .set_name(name)
1884 .with_options(options)
1885 .send()
1886 .await?;
1887 Ok(Operation::new(op))
1888 }
1889 };
1890
1891 let start = move || async {
1892 let op = self.send().await?;
1893 Ok(Operation::new(op))
1894 };
1895
1896 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1897 }
1898
1899 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1903 self.0.request.name = v.into();
1904 self
1905 }
1906
1907 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1909 self.0.request.validate_only = v.into();
1910 self
1911 }
1912
1913 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1915 self.0.request.etag = v.into();
1916 self
1917 }
1918 }
1919
1920 #[doc(hidden)]
1921 impl gax::options::internal::RequestBuilder for StopInstance {
1922 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1923 &mut self.0.options
1924 }
1925 }
1926
1927 #[derive(Clone, Debug)]
1945 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
1946
1947 impl StartInstance {
1948 pub(crate) fn new(
1949 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1950 ) -> Self {
1951 Self(RequestBuilder::new(stub))
1952 }
1953
1954 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
1956 self.0.request = v.into();
1957 self
1958 }
1959
1960 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1962 self.0.options = v.into();
1963 self
1964 }
1965
1966 pub async fn send(self) -> Result<longrunning::model::Operation> {
1973 (*self.0.stub)
1974 .start_instance(self.0.request, self.0.options)
1975 .await
1976 .map(gax::response::Response::into_body)
1977 }
1978
1979 pub fn poller(self) -> impl lro::Poller<crate::model::Instance, crate::model::Instance> {
1981 type Operation =
1982 lro::internal::Operation<crate::model::Instance, crate::model::Instance>;
1983 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1984 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1985
1986 let stub = self.0.stub.clone();
1987 let mut options = self.0.options.clone();
1988 options.set_retry_policy(gax::retry_policy::NeverRetry);
1989 let query = move |name| {
1990 let stub = stub.clone();
1991 let options = options.clone();
1992 async {
1993 let op = GetOperation::new(stub)
1994 .set_name(name)
1995 .with_options(options)
1996 .send()
1997 .await?;
1998 Ok(Operation::new(op))
1999 }
2000 };
2001
2002 let start = move || async {
2003 let op = self.send().await?;
2004 Ok(Operation::new(op))
2005 };
2006
2007 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2008 }
2009
2010 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2014 self.0.request.name = v.into();
2015 self
2016 }
2017
2018 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2020 self.0.request.validate_only = v.into();
2021 self
2022 }
2023
2024 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2026 self.0.request.etag = v.into();
2027 self
2028 }
2029 }
2030
2031 #[doc(hidden)]
2032 impl gax::options::internal::RequestBuilder for StartInstance {
2033 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2034 &mut self.0.options
2035 }
2036 }
2037
2038 #[derive(Clone, Debug)]
2059 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2060
2061 impl ListOperations {
2062 pub(crate) fn new(
2063 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2064 ) -> Self {
2065 Self(RequestBuilder::new(stub))
2066 }
2067
2068 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2070 mut self,
2071 v: V,
2072 ) -> Self {
2073 self.0.request = v.into();
2074 self
2075 }
2076
2077 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2079 self.0.options = v.into();
2080 self
2081 }
2082
2083 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2085 (*self.0.stub)
2086 .list_operations(self.0.request, self.0.options)
2087 .await
2088 .map(gax::response::Response::into_body)
2089 }
2090
2091 pub fn by_page(
2093 self,
2094 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2095 {
2096 use std::clone::Clone;
2097 let token = self.0.request.page_token.clone();
2098 let execute = move |token: String| {
2099 let mut builder = self.clone();
2100 builder.0.request = builder.0.request.set_page_token(token);
2101 builder.send()
2102 };
2103 gax::paginator::internal::new_paginator(token, execute)
2104 }
2105
2106 pub fn by_item(
2108 self,
2109 ) -> impl gax::paginator::ItemPaginator<
2110 longrunning::model::ListOperationsResponse,
2111 gax::error::Error,
2112 > {
2113 use gax::paginator::Paginator;
2114 self.by_page().items()
2115 }
2116
2117 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2119 self.0.request.name = v.into();
2120 self
2121 }
2122
2123 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2125 self.0.request.filter = v.into();
2126 self
2127 }
2128
2129 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2131 self.0.request.page_size = v.into();
2132 self
2133 }
2134
2135 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2137 self.0.request.page_token = v.into();
2138 self
2139 }
2140
2141 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2143 self.0.request.return_partial_success = v.into();
2144 self
2145 }
2146 }
2147
2148 #[doc(hidden)]
2149 impl gax::options::internal::RequestBuilder for ListOperations {
2150 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2151 &mut self.0.options
2152 }
2153 }
2154
2155 #[derive(Clone, Debug)]
2172 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2173
2174 impl GetOperation {
2175 pub(crate) fn new(
2176 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2177 ) -> Self {
2178 Self(RequestBuilder::new(stub))
2179 }
2180
2181 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2183 mut self,
2184 v: V,
2185 ) -> Self {
2186 self.0.request = v.into();
2187 self
2188 }
2189
2190 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2192 self.0.options = v.into();
2193 self
2194 }
2195
2196 pub async fn send(self) -> Result<longrunning::model::Operation> {
2198 (*self.0.stub)
2199 .get_operation(self.0.request, self.0.options)
2200 .await
2201 .map(gax::response::Response::into_body)
2202 }
2203
2204 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206 self.0.request.name = v.into();
2207 self
2208 }
2209 }
2210
2211 #[doc(hidden)]
2212 impl gax::options::internal::RequestBuilder for GetOperation {
2213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2214 &mut self.0.options
2215 }
2216 }
2217
2218 #[derive(Clone, Debug)]
2235 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2236
2237 impl DeleteOperation {
2238 pub(crate) fn new(
2239 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2240 ) -> Self {
2241 Self(RequestBuilder::new(stub))
2242 }
2243
2244 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2246 mut self,
2247 v: V,
2248 ) -> Self {
2249 self.0.request = v.into();
2250 self
2251 }
2252
2253 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2255 self.0.options = v.into();
2256 self
2257 }
2258
2259 pub async fn send(self) -> Result<()> {
2261 (*self.0.stub)
2262 .delete_operation(self.0.request, self.0.options)
2263 .await
2264 .map(gax::response::Response::into_body)
2265 }
2266
2267 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2269 self.0.request.name = v.into();
2270 self
2271 }
2272 }
2273
2274 #[doc(hidden)]
2275 impl gax::options::internal::RequestBuilder for DeleteOperation {
2276 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2277 &mut self.0.options
2278 }
2279 }
2280
2281 #[derive(Clone, Debug)]
2298 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
2299
2300 impl WaitOperation {
2301 pub(crate) fn new(
2302 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2303 ) -> Self {
2304 Self(RequestBuilder::new(stub))
2305 }
2306
2307 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
2309 mut self,
2310 v: V,
2311 ) -> Self {
2312 self.0.request = v.into();
2313 self
2314 }
2315
2316 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2318 self.0.options = v.into();
2319 self
2320 }
2321
2322 pub async fn send(self) -> Result<longrunning::model::Operation> {
2324 (*self.0.stub)
2325 .wait_operation(self.0.request, self.0.options)
2326 .await
2327 .map(gax::response::Response::into_body)
2328 }
2329
2330 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2332 self.0.request.name = v.into();
2333 self
2334 }
2335
2336 pub fn set_timeout<T>(mut self, v: T) -> Self
2338 where
2339 T: std::convert::Into<wkt::Duration>,
2340 {
2341 self.0.request.timeout = std::option::Option::Some(v.into());
2342 self
2343 }
2344
2345 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2347 where
2348 T: std::convert::Into<wkt::Duration>,
2349 {
2350 self.0.request.timeout = v.map(|x| x.into());
2351 self
2352 }
2353 }
2354
2355 #[doc(hidden)]
2356 impl gax::options::internal::RequestBuilder for WaitOperation {
2357 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2358 &mut self.0.options
2359 }
2360 }
2361}
2362
2363pub mod jobs {
2364 use crate::Result;
2365
2366 pub type ClientBuilder =
2380 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2381
2382 pub(crate) mod client {
2383 use super::super::super::client::Jobs;
2384 pub struct Factory;
2385 impl gax::client_builder::internal::ClientFactory for Factory {
2386 type Client = Jobs;
2387 type Credentials = gaxi::options::Credentials;
2388 async fn build(
2389 self,
2390 config: gaxi::options::ClientConfig,
2391 ) -> gax::client_builder::Result<Self::Client> {
2392 Self::Client::new(config).await
2393 }
2394 }
2395 }
2396
2397 #[derive(Clone, Debug)]
2399 pub(crate) struct RequestBuilder<R: std::default::Default> {
2400 stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
2401 request: R,
2402 options: gax::options::RequestOptions,
2403 }
2404
2405 impl<R> RequestBuilder<R>
2406 where
2407 R: std::default::Default,
2408 {
2409 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2410 Self {
2411 stub,
2412 request: R::default(),
2413 options: gax::options::RequestOptions::default(),
2414 }
2415 }
2416 }
2417
2418 #[derive(Clone, Debug)]
2436 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
2437
2438 impl CreateJob {
2439 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2440 Self(RequestBuilder::new(stub))
2441 }
2442
2443 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
2445 self.0.request = v.into();
2446 self
2447 }
2448
2449 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2451 self.0.options = v.into();
2452 self
2453 }
2454
2455 pub async fn send(self) -> Result<longrunning::model::Operation> {
2462 (*self.0.stub)
2463 .create_job(self.0.request, self.0.options)
2464 .await
2465 .map(gax::response::Response::into_body)
2466 }
2467
2468 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
2470 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
2471 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2472 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2473
2474 let stub = self.0.stub.clone();
2475 let mut options = self.0.options.clone();
2476 options.set_retry_policy(gax::retry_policy::NeverRetry);
2477 let query = move |name| {
2478 let stub = stub.clone();
2479 let options = options.clone();
2480 async {
2481 let op = GetOperation::new(stub)
2482 .set_name(name)
2483 .with_options(options)
2484 .send()
2485 .await?;
2486 Ok(Operation::new(op))
2487 }
2488 };
2489
2490 let start = move || async {
2491 let op = self.send().await?;
2492 Ok(Operation::new(op))
2493 };
2494
2495 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2496 }
2497
2498 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2502 self.0.request.parent = v.into();
2503 self
2504 }
2505
2506 pub fn set_job<T>(mut self, v: T) -> Self
2510 where
2511 T: std::convert::Into<crate::model::Job>,
2512 {
2513 self.0.request.job = std::option::Option::Some(v.into());
2514 self
2515 }
2516
2517 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2521 where
2522 T: std::convert::Into<crate::model::Job>,
2523 {
2524 self.0.request.job = v.map(|x| x.into());
2525 self
2526 }
2527
2528 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2532 self.0.request.job_id = v.into();
2533 self
2534 }
2535
2536 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2538 self.0.request.validate_only = v.into();
2539 self
2540 }
2541 }
2542
2543 #[doc(hidden)]
2544 impl gax::options::internal::RequestBuilder for CreateJob {
2545 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2546 &mut self.0.options
2547 }
2548 }
2549
2550 #[derive(Clone, Debug)]
2567 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
2568
2569 impl GetJob {
2570 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2571 Self(RequestBuilder::new(stub))
2572 }
2573
2574 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
2576 self.0.request = v.into();
2577 self
2578 }
2579
2580 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2582 self.0.options = v.into();
2583 self
2584 }
2585
2586 pub async fn send(self) -> Result<crate::model::Job> {
2588 (*self.0.stub)
2589 .get_job(self.0.request, self.0.options)
2590 .await
2591 .map(gax::response::Response::into_body)
2592 }
2593
2594 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2598 self.0.request.name = v.into();
2599 self
2600 }
2601 }
2602
2603 #[doc(hidden)]
2604 impl gax::options::internal::RequestBuilder for GetJob {
2605 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2606 &mut self.0.options
2607 }
2608 }
2609
2610 #[derive(Clone, Debug)]
2631 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
2632
2633 impl ListJobs {
2634 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2635 Self(RequestBuilder::new(stub))
2636 }
2637
2638 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
2640 self.0.request = v.into();
2641 self
2642 }
2643
2644 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2646 self.0.options = v.into();
2647 self
2648 }
2649
2650 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
2652 (*self.0.stub)
2653 .list_jobs(self.0.request, self.0.options)
2654 .await
2655 .map(gax::response::Response::into_body)
2656 }
2657
2658 pub fn by_page(
2660 self,
2661 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
2662 {
2663 use std::clone::Clone;
2664 let token = self.0.request.page_token.clone();
2665 let execute = move |token: String| {
2666 let mut builder = self.clone();
2667 builder.0.request = builder.0.request.set_page_token(token);
2668 builder.send()
2669 };
2670 gax::paginator::internal::new_paginator(token, execute)
2671 }
2672
2673 pub fn by_item(
2675 self,
2676 ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
2677 {
2678 use gax::paginator::Paginator;
2679 self.by_page().items()
2680 }
2681
2682 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2686 self.0.request.parent = v.into();
2687 self
2688 }
2689
2690 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2692 self.0.request.page_size = v.into();
2693 self
2694 }
2695
2696 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2698 self.0.request.page_token = v.into();
2699 self
2700 }
2701
2702 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2704 self.0.request.show_deleted = v.into();
2705 self
2706 }
2707 }
2708
2709 #[doc(hidden)]
2710 impl gax::options::internal::RequestBuilder for ListJobs {
2711 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2712 &mut self.0.options
2713 }
2714 }
2715
2716 #[derive(Clone, Debug)]
2734 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
2735
2736 impl UpdateJob {
2737 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2738 Self(RequestBuilder::new(stub))
2739 }
2740
2741 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
2743 self.0.request = v.into();
2744 self
2745 }
2746
2747 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2749 self.0.options = v.into();
2750 self
2751 }
2752
2753 pub async fn send(self) -> Result<longrunning::model::Operation> {
2760 (*self.0.stub)
2761 .update_job(self.0.request, self.0.options)
2762 .await
2763 .map(gax::response::Response::into_body)
2764 }
2765
2766 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
2768 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
2769 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2770 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2771
2772 let stub = self.0.stub.clone();
2773 let mut options = self.0.options.clone();
2774 options.set_retry_policy(gax::retry_policy::NeverRetry);
2775 let query = move |name| {
2776 let stub = stub.clone();
2777 let options = options.clone();
2778 async {
2779 let op = GetOperation::new(stub)
2780 .set_name(name)
2781 .with_options(options)
2782 .send()
2783 .await?;
2784 Ok(Operation::new(op))
2785 }
2786 };
2787
2788 let start = move || async {
2789 let op = self.send().await?;
2790 Ok(Operation::new(op))
2791 };
2792
2793 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2794 }
2795
2796 pub fn set_job<T>(mut self, v: T) -> Self
2800 where
2801 T: std::convert::Into<crate::model::Job>,
2802 {
2803 self.0.request.job = std::option::Option::Some(v.into());
2804 self
2805 }
2806
2807 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2811 where
2812 T: std::convert::Into<crate::model::Job>,
2813 {
2814 self.0.request.job = v.map(|x| x.into());
2815 self
2816 }
2817
2818 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2820 self.0.request.validate_only = v.into();
2821 self
2822 }
2823
2824 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2826 self.0.request.allow_missing = v.into();
2827 self
2828 }
2829 }
2830
2831 #[doc(hidden)]
2832 impl gax::options::internal::RequestBuilder for UpdateJob {
2833 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2834 &mut self.0.options
2835 }
2836 }
2837
2838 #[derive(Clone, Debug)]
2856 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
2857
2858 impl DeleteJob {
2859 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2860 Self(RequestBuilder::new(stub))
2861 }
2862
2863 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
2865 self.0.request = v.into();
2866 self
2867 }
2868
2869 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2871 self.0.options = v.into();
2872 self
2873 }
2874
2875 pub async fn send(self) -> Result<longrunning::model::Operation> {
2882 (*self.0.stub)
2883 .delete_job(self.0.request, self.0.options)
2884 .await
2885 .map(gax::response::Response::into_body)
2886 }
2887
2888 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
2890 type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
2891 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2892 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2893
2894 let stub = self.0.stub.clone();
2895 let mut options = self.0.options.clone();
2896 options.set_retry_policy(gax::retry_policy::NeverRetry);
2897 let query = move |name| {
2898 let stub = stub.clone();
2899 let options = options.clone();
2900 async {
2901 let op = GetOperation::new(stub)
2902 .set_name(name)
2903 .with_options(options)
2904 .send()
2905 .await?;
2906 Ok(Operation::new(op))
2907 }
2908 };
2909
2910 let start = move || async {
2911 let op = self.send().await?;
2912 Ok(Operation::new(op))
2913 };
2914
2915 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2916 }
2917
2918 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2922 self.0.request.name = v.into();
2923 self
2924 }
2925
2926 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2928 self.0.request.validate_only = v.into();
2929 self
2930 }
2931
2932 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2934 self.0.request.etag = v.into();
2935 self
2936 }
2937 }
2938
2939 #[doc(hidden)]
2940 impl gax::options::internal::RequestBuilder for DeleteJob {
2941 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2942 &mut self.0.options
2943 }
2944 }
2945
2946 #[derive(Clone, Debug)]
2964 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
2965
2966 impl RunJob {
2967 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2968 Self(RequestBuilder::new(stub))
2969 }
2970
2971 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
2973 self.0.request = v.into();
2974 self
2975 }
2976
2977 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2979 self.0.options = v.into();
2980 self
2981 }
2982
2983 pub async fn send(self) -> Result<longrunning::model::Operation> {
2990 (*self.0.stub)
2991 .run_job(self.0.request, self.0.options)
2992 .await
2993 .map(gax::response::Response::into_body)
2994 }
2995
2996 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
2998 type Operation =
2999 lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
3000 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3001 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3002
3003 let stub = self.0.stub.clone();
3004 let mut options = self.0.options.clone();
3005 options.set_retry_policy(gax::retry_policy::NeverRetry);
3006 let query = move |name| {
3007 let stub = stub.clone();
3008 let options = options.clone();
3009 async {
3010 let op = GetOperation::new(stub)
3011 .set_name(name)
3012 .with_options(options)
3013 .send()
3014 .await?;
3015 Ok(Operation::new(op))
3016 }
3017 };
3018
3019 let start = move || async {
3020 let op = self.send().await?;
3021 Ok(Operation::new(op))
3022 };
3023
3024 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3025 }
3026
3027 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031 self.0.request.name = v.into();
3032 self
3033 }
3034
3035 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3037 self.0.request.validate_only = v.into();
3038 self
3039 }
3040
3041 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3043 self.0.request.etag = v.into();
3044 self
3045 }
3046
3047 pub fn set_overrides<T>(mut self, v: T) -> Self
3049 where
3050 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3051 {
3052 self.0.request.overrides = std::option::Option::Some(v.into());
3053 self
3054 }
3055
3056 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
3058 where
3059 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3060 {
3061 self.0.request.overrides = v.map(|x| x.into());
3062 self
3063 }
3064 }
3065
3066 #[doc(hidden)]
3067 impl gax::options::internal::RequestBuilder for RunJob {
3068 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3069 &mut self.0.options
3070 }
3071 }
3072
3073 #[derive(Clone, Debug)]
3090 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3091
3092 impl GetIamPolicy {
3093 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3094 Self(RequestBuilder::new(stub))
3095 }
3096
3097 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3099 self.0.request = v.into();
3100 self
3101 }
3102
3103 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3105 self.0.options = v.into();
3106 self
3107 }
3108
3109 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3111 (*self.0.stub)
3112 .get_iam_policy(self.0.request, self.0.options)
3113 .await
3114 .map(gax::response::Response::into_body)
3115 }
3116
3117 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3121 self.0.request.resource = v.into();
3122 self
3123 }
3124
3125 pub fn set_options<T>(mut self, v: T) -> Self
3127 where
3128 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3129 {
3130 self.0.request.options = std::option::Option::Some(v.into());
3131 self
3132 }
3133
3134 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3136 where
3137 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3138 {
3139 self.0.request.options = v.map(|x| x.into());
3140 self
3141 }
3142 }
3143
3144 #[doc(hidden)]
3145 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3146 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3147 &mut self.0.options
3148 }
3149 }
3150
3151 #[derive(Clone, Debug)]
3168 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3169
3170 impl SetIamPolicy {
3171 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3172 Self(RequestBuilder::new(stub))
3173 }
3174
3175 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3177 self.0.request = v.into();
3178 self
3179 }
3180
3181 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3183 self.0.options = v.into();
3184 self
3185 }
3186
3187 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3189 (*self.0.stub)
3190 .set_iam_policy(self.0.request, self.0.options)
3191 .await
3192 .map(gax::response::Response::into_body)
3193 }
3194
3195 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3199 self.0.request.resource = v.into();
3200 self
3201 }
3202
3203 pub fn set_policy<T>(mut self, v: T) -> Self
3207 where
3208 T: std::convert::Into<iam_v1::model::Policy>,
3209 {
3210 self.0.request.policy = std::option::Option::Some(v.into());
3211 self
3212 }
3213
3214 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3218 where
3219 T: std::convert::Into<iam_v1::model::Policy>,
3220 {
3221 self.0.request.policy = v.map(|x| x.into());
3222 self
3223 }
3224
3225 pub fn set_update_mask<T>(mut self, v: T) -> Self
3227 where
3228 T: std::convert::Into<wkt::FieldMask>,
3229 {
3230 self.0.request.update_mask = std::option::Option::Some(v.into());
3231 self
3232 }
3233
3234 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3236 where
3237 T: std::convert::Into<wkt::FieldMask>,
3238 {
3239 self.0.request.update_mask = v.map(|x| x.into());
3240 self
3241 }
3242 }
3243
3244 #[doc(hidden)]
3245 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3246 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3247 &mut self.0.options
3248 }
3249 }
3250
3251 #[derive(Clone, Debug)]
3268 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3269
3270 impl TestIamPermissions {
3271 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3272 Self(RequestBuilder::new(stub))
3273 }
3274
3275 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3277 mut self,
3278 v: V,
3279 ) -> Self {
3280 self.0.request = v.into();
3281 self
3282 }
3283
3284 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3286 self.0.options = v.into();
3287 self
3288 }
3289
3290 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3292 (*self.0.stub)
3293 .test_iam_permissions(self.0.request, self.0.options)
3294 .await
3295 .map(gax::response::Response::into_body)
3296 }
3297
3298 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3302 self.0.request.resource = v.into();
3303 self
3304 }
3305
3306 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3310 where
3311 T: std::iter::IntoIterator<Item = V>,
3312 V: std::convert::Into<std::string::String>,
3313 {
3314 use std::iter::Iterator;
3315 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3316 self
3317 }
3318 }
3319
3320 #[doc(hidden)]
3321 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3322 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3323 &mut self.0.options
3324 }
3325 }
3326
3327 #[derive(Clone, Debug)]
3348 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3349
3350 impl ListOperations {
3351 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3352 Self(RequestBuilder::new(stub))
3353 }
3354
3355 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3357 mut self,
3358 v: V,
3359 ) -> Self {
3360 self.0.request = v.into();
3361 self
3362 }
3363
3364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3366 self.0.options = v.into();
3367 self
3368 }
3369
3370 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3372 (*self.0.stub)
3373 .list_operations(self.0.request, self.0.options)
3374 .await
3375 .map(gax::response::Response::into_body)
3376 }
3377
3378 pub fn by_page(
3380 self,
3381 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3382 {
3383 use std::clone::Clone;
3384 let token = self.0.request.page_token.clone();
3385 let execute = move |token: String| {
3386 let mut builder = self.clone();
3387 builder.0.request = builder.0.request.set_page_token(token);
3388 builder.send()
3389 };
3390 gax::paginator::internal::new_paginator(token, execute)
3391 }
3392
3393 pub fn by_item(
3395 self,
3396 ) -> impl gax::paginator::ItemPaginator<
3397 longrunning::model::ListOperationsResponse,
3398 gax::error::Error,
3399 > {
3400 use gax::paginator::Paginator;
3401 self.by_page().items()
3402 }
3403
3404 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3406 self.0.request.name = v.into();
3407 self
3408 }
3409
3410 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3412 self.0.request.filter = v.into();
3413 self
3414 }
3415
3416 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3418 self.0.request.page_size = v.into();
3419 self
3420 }
3421
3422 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3424 self.0.request.page_token = v.into();
3425 self
3426 }
3427
3428 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3430 self.0.request.return_partial_success = v.into();
3431 self
3432 }
3433 }
3434
3435 #[doc(hidden)]
3436 impl gax::options::internal::RequestBuilder for ListOperations {
3437 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3438 &mut self.0.options
3439 }
3440 }
3441
3442 #[derive(Clone, Debug)]
3459 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3460
3461 impl GetOperation {
3462 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3463 Self(RequestBuilder::new(stub))
3464 }
3465
3466 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3468 mut self,
3469 v: V,
3470 ) -> Self {
3471 self.0.request = v.into();
3472 self
3473 }
3474
3475 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3477 self.0.options = v.into();
3478 self
3479 }
3480
3481 pub async fn send(self) -> Result<longrunning::model::Operation> {
3483 (*self.0.stub)
3484 .get_operation(self.0.request, self.0.options)
3485 .await
3486 .map(gax::response::Response::into_body)
3487 }
3488
3489 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3491 self.0.request.name = v.into();
3492 self
3493 }
3494 }
3495
3496 #[doc(hidden)]
3497 impl gax::options::internal::RequestBuilder for GetOperation {
3498 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3499 &mut self.0.options
3500 }
3501 }
3502
3503 #[derive(Clone, Debug)]
3520 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3521
3522 impl DeleteOperation {
3523 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3524 Self(RequestBuilder::new(stub))
3525 }
3526
3527 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3529 mut self,
3530 v: V,
3531 ) -> Self {
3532 self.0.request = v.into();
3533 self
3534 }
3535
3536 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3538 self.0.options = v.into();
3539 self
3540 }
3541
3542 pub async fn send(self) -> Result<()> {
3544 (*self.0.stub)
3545 .delete_operation(self.0.request, self.0.options)
3546 .await
3547 .map(gax::response::Response::into_body)
3548 }
3549
3550 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3552 self.0.request.name = v.into();
3553 self
3554 }
3555 }
3556
3557 #[doc(hidden)]
3558 impl gax::options::internal::RequestBuilder for DeleteOperation {
3559 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3560 &mut self.0.options
3561 }
3562 }
3563
3564 #[derive(Clone, Debug)]
3581 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3582
3583 impl WaitOperation {
3584 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3585 Self(RequestBuilder::new(stub))
3586 }
3587
3588 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3590 mut self,
3591 v: V,
3592 ) -> Self {
3593 self.0.request = v.into();
3594 self
3595 }
3596
3597 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3599 self.0.options = v.into();
3600 self
3601 }
3602
3603 pub async fn send(self) -> Result<longrunning::model::Operation> {
3605 (*self.0.stub)
3606 .wait_operation(self.0.request, self.0.options)
3607 .await
3608 .map(gax::response::Response::into_body)
3609 }
3610
3611 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3613 self.0.request.name = v.into();
3614 self
3615 }
3616
3617 pub fn set_timeout<T>(mut self, v: T) -> Self
3619 where
3620 T: std::convert::Into<wkt::Duration>,
3621 {
3622 self.0.request.timeout = std::option::Option::Some(v.into());
3623 self
3624 }
3625
3626 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3628 where
3629 T: std::convert::Into<wkt::Duration>,
3630 {
3631 self.0.request.timeout = v.map(|x| x.into());
3632 self
3633 }
3634 }
3635
3636 #[doc(hidden)]
3637 impl gax::options::internal::RequestBuilder for WaitOperation {
3638 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3639 &mut self.0.options
3640 }
3641 }
3642}
3643
3644pub mod revisions {
3645 use crate::Result;
3646
3647 pub type ClientBuilder =
3661 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3662
3663 pub(crate) mod client {
3664 use super::super::super::client::Revisions;
3665 pub struct Factory;
3666 impl gax::client_builder::internal::ClientFactory for Factory {
3667 type Client = Revisions;
3668 type Credentials = gaxi::options::Credentials;
3669 async fn build(
3670 self,
3671 config: gaxi::options::ClientConfig,
3672 ) -> gax::client_builder::Result<Self::Client> {
3673 Self::Client::new(config).await
3674 }
3675 }
3676 }
3677
3678 #[derive(Clone, Debug)]
3680 pub(crate) struct RequestBuilder<R: std::default::Default> {
3681 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3682 request: R,
3683 options: gax::options::RequestOptions,
3684 }
3685
3686 impl<R> RequestBuilder<R>
3687 where
3688 R: std::default::Default,
3689 {
3690 pub(crate) fn new(
3691 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3692 ) -> Self {
3693 Self {
3694 stub,
3695 request: R::default(),
3696 options: gax::options::RequestOptions::default(),
3697 }
3698 }
3699 }
3700
3701 #[derive(Clone, Debug)]
3718 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
3719
3720 impl GetRevision {
3721 pub(crate) fn new(
3722 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3723 ) -> Self {
3724 Self(RequestBuilder::new(stub))
3725 }
3726
3727 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
3729 self.0.request = v.into();
3730 self
3731 }
3732
3733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3735 self.0.options = v.into();
3736 self
3737 }
3738
3739 pub async fn send(self) -> Result<crate::model::Revision> {
3741 (*self.0.stub)
3742 .get_revision(self.0.request, self.0.options)
3743 .await
3744 .map(gax::response::Response::into_body)
3745 }
3746
3747 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3751 self.0.request.name = v.into();
3752 self
3753 }
3754 }
3755
3756 #[doc(hidden)]
3757 impl gax::options::internal::RequestBuilder for GetRevision {
3758 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3759 &mut self.0.options
3760 }
3761 }
3762
3763 #[derive(Clone, Debug)]
3784 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
3785
3786 impl ListRevisions {
3787 pub(crate) fn new(
3788 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3789 ) -> Self {
3790 Self(RequestBuilder::new(stub))
3791 }
3792
3793 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
3795 self.0.request = v.into();
3796 self
3797 }
3798
3799 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3801 self.0.options = v.into();
3802 self
3803 }
3804
3805 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
3807 (*self.0.stub)
3808 .list_revisions(self.0.request, self.0.options)
3809 .await
3810 .map(gax::response::Response::into_body)
3811 }
3812
3813 pub fn by_page(
3815 self,
3816 ) -> impl gax::paginator::Paginator<crate::model::ListRevisionsResponse, gax::error::Error>
3817 {
3818 use std::clone::Clone;
3819 let token = self.0.request.page_token.clone();
3820 let execute = move |token: String| {
3821 let mut builder = self.clone();
3822 builder.0.request = builder.0.request.set_page_token(token);
3823 builder.send()
3824 };
3825 gax::paginator::internal::new_paginator(token, execute)
3826 }
3827
3828 pub fn by_item(
3830 self,
3831 ) -> impl gax::paginator::ItemPaginator<crate::model::ListRevisionsResponse, gax::error::Error>
3832 {
3833 use gax::paginator::Paginator;
3834 self.by_page().items()
3835 }
3836
3837 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3841 self.0.request.parent = v.into();
3842 self
3843 }
3844
3845 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3847 self.0.request.page_size = v.into();
3848 self
3849 }
3850
3851 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3853 self.0.request.page_token = v.into();
3854 self
3855 }
3856
3857 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3859 self.0.request.show_deleted = v.into();
3860 self
3861 }
3862 }
3863
3864 #[doc(hidden)]
3865 impl gax::options::internal::RequestBuilder for ListRevisions {
3866 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3867 &mut self.0.options
3868 }
3869 }
3870
3871 #[derive(Clone, Debug)]
3889 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
3890
3891 impl DeleteRevision {
3892 pub(crate) fn new(
3893 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3894 ) -> Self {
3895 Self(RequestBuilder::new(stub))
3896 }
3897
3898 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
3900 self.0.request = v.into();
3901 self
3902 }
3903
3904 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3906 self.0.options = v.into();
3907 self
3908 }
3909
3910 pub async fn send(self) -> Result<longrunning::model::Operation> {
3917 (*self.0.stub)
3918 .delete_revision(self.0.request, self.0.options)
3919 .await
3920 .map(gax::response::Response::into_body)
3921 }
3922
3923 pub fn poller(self) -> impl lro::Poller<crate::model::Revision, crate::model::Revision> {
3925 type Operation =
3926 lro::internal::Operation<crate::model::Revision, crate::model::Revision>;
3927 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3928 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3929
3930 let stub = self.0.stub.clone();
3931 let mut options = self.0.options.clone();
3932 options.set_retry_policy(gax::retry_policy::NeverRetry);
3933 let query = move |name| {
3934 let stub = stub.clone();
3935 let options = options.clone();
3936 async {
3937 let op = GetOperation::new(stub)
3938 .set_name(name)
3939 .with_options(options)
3940 .send()
3941 .await?;
3942 Ok(Operation::new(op))
3943 }
3944 };
3945
3946 let start = move || async {
3947 let op = self.send().await?;
3948 Ok(Operation::new(op))
3949 };
3950
3951 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3952 }
3953
3954 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3958 self.0.request.name = v.into();
3959 self
3960 }
3961
3962 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3964 self.0.request.validate_only = v.into();
3965 self
3966 }
3967
3968 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3970 self.0.request.etag = v.into();
3971 self
3972 }
3973 }
3974
3975 #[doc(hidden)]
3976 impl gax::options::internal::RequestBuilder for DeleteRevision {
3977 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3978 &mut self.0.options
3979 }
3980 }
3981
3982 #[derive(Clone, Debug)]
4003 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4004
4005 impl ListOperations {
4006 pub(crate) fn new(
4007 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4008 ) -> Self {
4009 Self(RequestBuilder::new(stub))
4010 }
4011
4012 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4014 mut self,
4015 v: V,
4016 ) -> Self {
4017 self.0.request = v.into();
4018 self
4019 }
4020
4021 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4023 self.0.options = v.into();
4024 self
4025 }
4026
4027 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4029 (*self.0.stub)
4030 .list_operations(self.0.request, self.0.options)
4031 .await
4032 .map(gax::response::Response::into_body)
4033 }
4034
4035 pub fn by_page(
4037 self,
4038 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4039 {
4040 use std::clone::Clone;
4041 let token = self.0.request.page_token.clone();
4042 let execute = move |token: String| {
4043 let mut builder = self.clone();
4044 builder.0.request = builder.0.request.set_page_token(token);
4045 builder.send()
4046 };
4047 gax::paginator::internal::new_paginator(token, execute)
4048 }
4049
4050 pub fn by_item(
4052 self,
4053 ) -> impl gax::paginator::ItemPaginator<
4054 longrunning::model::ListOperationsResponse,
4055 gax::error::Error,
4056 > {
4057 use gax::paginator::Paginator;
4058 self.by_page().items()
4059 }
4060
4061 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4063 self.0.request.name = v.into();
4064 self
4065 }
4066
4067 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4069 self.0.request.filter = v.into();
4070 self
4071 }
4072
4073 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4075 self.0.request.page_size = v.into();
4076 self
4077 }
4078
4079 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4081 self.0.request.page_token = v.into();
4082 self
4083 }
4084
4085 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4087 self.0.request.return_partial_success = v.into();
4088 self
4089 }
4090 }
4091
4092 #[doc(hidden)]
4093 impl gax::options::internal::RequestBuilder for ListOperations {
4094 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4095 &mut self.0.options
4096 }
4097 }
4098
4099 #[derive(Clone, Debug)]
4116 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4117
4118 impl GetOperation {
4119 pub(crate) fn new(
4120 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4121 ) -> Self {
4122 Self(RequestBuilder::new(stub))
4123 }
4124
4125 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4127 mut self,
4128 v: V,
4129 ) -> Self {
4130 self.0.request = v.into();
4131 self
4132 }
4133
4134 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4136 self.0.options = v.into();
4137 self
4138 }
4139
4140 pub async fn send(self) -> Result<longrunning::model::Operation> {
4142 (*self.0.stub)
4143 .get_operation(self.0.request, self.0.options)
4144 .await
4145 .map(gax::response::Response::into_body)
4146 }
4147
4148 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4150 self.0.request.name = v.into();
4151 self
4152 }
4153 }
4154
4155 #[doc(hidden)]
4156 impl gax::options::internal::RequestBuilder for GetOperation {
4157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4158 &mut self.0.options
4159 }
4160 }
4161
4162 #[derive(Clone, Debug)]
4179 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4180
4181 impl DeleteOperation {
4182 pub(crate) fn new(
4183 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4184 ) -> Self {
4185 Self(RequestBuilder::new(stub))
4186 }
4187
4188 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4190 mut self,
4191 v: V,
4192 ) -> Self {
4193 self.0.request = v.into();
4194 self
4195 }
4196
4197 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4199 self.0.options = v.into();
4200 self
4201 }
4202
4203 pub async fn send(self) -> Result<()> {
4205 (*self.0.stub)
4206 .delete_operation(self.0.request, self.0.options)
4207 .await
4208 .map(gax::response::Response::into_body)
4209 }
4210
4211 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4213 self.0.request.name = v.into();
4214 self
4215 }
4216 }
4217
4218 #[doc(hidden)]
4219 impl gax::options::internal::RequestBuilder for DeleteOperation {
4220 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4221 &mut self.0.options
4222 }
4223 }
4224
4225 #[derive(Clone, Debug)]
4242 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
4243
4244 impl WaitOperation {
4245 pub(crate) fn new(
4246 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4247 ) -> Self {
4248 Self(RequestBuilder::new(stub))
4249 }
4250
4251 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
4253 mut self,
4254 v: V,
4255 ) -> Self {
4256 self.0.request = v.into();
4257 self
4258 }
4259
4260 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4262 self.0.options = v.into();
4263 self
4264 }
4265
4266 pub async fn send(self) -> Result<longrunning::model::Operation> {
4268 (*self.0.stub)
4269 .wait_operation(self.0.request, self.0.options)
4270 .await
4271 .map(gax::response::Response::into_body)
4272 }
4273
4274 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4276 self.0.request.name = v.into();
4277 self
4278 }
4279
4280 pub fn set_timeout<T>(mut self, v: T) -> Self
4282 where
4283 T: std::convert::Into<wkt::Duration>,
4284 {
4285 self.0.request.timeout = std::option::Option::Some(v.into());
4286 self
4287 }
4288
4289 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4291 where
4292 T: std::convert::Into<wkt::Duration>,
4293 {
4294 self.0.request.timeout = v.map(|x| x.into());
4295 self
4296 }
4297 }
4298
4299 #[doc(hidden)]
4300 impl gax::options::internal::RequestBuilder for WaitOperation {
4301 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4302 &mut self.0.options
4303 }
4304 }
4305}
4306
4307pub mod services {
4308 use crate::Result;
4309
4310 pub type ClientBuilder =
4324 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4325
4326 pub(crate) mod client {
4327 use super::super::super::client::Services;
4328 pub struct Factory;
4329 impl gax::client_builder::internal::ClientFactory for Factory {
4330 type Client = Services;
4331 type Credentials = gaxi::options::Credentials;
4332 async fn build(
4333 self,
4334 config: gaxi::options::ClientConfig,
4335 ) -> gax::client_builder::Result<Self::Client> {
4336 Self::Client::new(config).await
4337 }
4338 }
4339 }
4340
4341 #[derive(Clone, Debug)]
4343 pub(crate) struct RequestBuilder<R: std::default::Default> {
4344 stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
4345 request: R,
4346 options: gax::options::RequestOptions,
4347 }
4348
4349 impl<R> RequestBuilder<R>
4350 where
4351 R: std::default::Default,
4352 {
4353 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4354 Self {
4355 stub,
4356 request: R::default(),
4357 options: gax::options::RequestOptions::default(),
4358 }
4359 }
4360 }
4361
4362 #[derive(Clone, Debug)]
4380 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
4381
4382 impl CreateService {
4383 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4384 Self(RequestBuilder::new(stub))
4385 }
4386
4387 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
4389 self.0.request = v.into();
4390 self
4391 }
4392
4393 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4395 self.0.options = v.into();
4396 self
4397 }
4398
4399 pub async fn send(self) -> Result<longrunning::model::Operation> {
4406 (*self.0.stub)
4407 .create_service(self.0.request, self.0.options)
4408 .await
4409 .map(gax::response::Response::into_body)
4410 }
4411
4412 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
4414 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
4415 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4416 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4417
4418 let stub = self.0.stub.clone();
4419 let mut options = self.0.options.clone();
4420 options.set_retry_policy(gax::retry_policy::NeverRetry);
4421 let query = move |name| {
4422 let stub = stub.clone();
4423 let options = options.clone();
4424 async {
4425 let op = GetOperation::new(stub)
4426 .set_name(name)
4427 .with_options(options)
4428 .send()
4429 .await?;
4430 Ok(Operation::new(op))
4431 }
4432 };
4433
4434 let start = move || async {
4435 let op = self.send().await?;
4436 Ok(Operation::new(op))
4437 };
4438
4439 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4440 }
4441
4442 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4446 self.0.request.parent = v.into();
4447 self
4448 }
4449
4450 pub fn set_service<T>(mut self, v: T) -> Self
4454 where
4455 T: std::convert::Into<crate::model::Service>,
4456 {
4457 self.0.request.service = std::option::Option::Some(v.into());
4458 self
4459 }
4460
4461 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4465 where
4466 T: std::convert::Into<crate::model::Service>,
4467 {
4468 self.0.request.service = v.map(|x| x.into());
4469 self
4470 }
4471
4472 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4476 self.0.request.service_id = v.into();
4477 self
4478 }
4479
4480 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4482 self.0.request.validate_only = v.into();
4483 self
4484 }
4485 }
4486
4487 #[doc(hidden)]
4488 impl gax::options::internal::RequestBuilder for CreateService {
4489 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4490 &mut self.0.options
4491 }
4492 }
4493
4494 #[derive(Clone, Debug)]
4511 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
4512
4513 impl GetService {
4514 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4515 Self(RequestBuilder::new(stub))
4516 }
4517
4518 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
4520 self.0.request = v.into();
4521 self
4522 }
4523
4524 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4526 self.0.options = v.into();
4527 self
4528 }
4529
4530 pub async fn send(self) -> Result<crate::model::Service> {
4532 (*self.0.stub)
4533 .get_service(self.0.request, self.0.options)
4534 .await
4535 .map(gax::response::Response::into_body)
4536 }
4537
4538 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4542 self.0.request.name = v.into();
4543 self
4544 }
4545 }
4546
4547 #[doc(hidden)]
4548 impl gax::options::internal::RequestBuilder for GetService {
4549 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4550 &mut self.0.options
4551 }
4552 }
4553
4554 #[derive(Clone, Debug)]
4575 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
4576
4577 impl ListServices {
4578 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4579 Self(RequestBuilder::new(stub))
4580 }
4581
4582 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
4584 self.0.request = v.into();
4585 self
4586 }
4587
4588 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4590 self.0.options = v.into();
4591 self
4592 }
4593
4594 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
4596 (*self.0.stub)
4597 .list_services(self.0.request, self.0.options)
4598 .await
4599 .map(gax::response::Response::into_body)
4600 }
4601
4602 pub fn by_page(
4604 self,
4605 ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
4606 {
4607 use std::clone::Clone;
4608 let token = self.0.request.page_token.clone();
4609 let execute = move |token: String| {
4610 let mut builder = self.clone();
4611 builder.0.request = builder.0.request.set_page_token(token);
4612 builder.send()
4613 };
4614 gax::paginator::internal::new_paginator(token, execute)
4615 }
4616
4617 pub fn by_item(
4619 self,
4620 ) -> impl gax::paginator::ItemPaginator<crate::model::ListServicesResponse, gax::error::Error>
4621 {
4622 use gax::paginator::Paginator;
4623 self.by_page().items()
4624 }
4625
4626 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4630 self.0.request.parent = v.into();
4631 self
4632 }
4633
4634 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4636 self.0.request.page_size = v.into();
4637 self
4638 }
4639
4640 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4642 self.0.request.page_token = v.into();
4643 self
4644 }
4645
4646 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4648 self.0.request.show_deleted = v.into();
4649 self
4650 }
4651 }
4652
4653 #[doc(hidden)]
4654 impl gax::options::internal::RequestBuilder for ListServices {
4655 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4656 &mut self.0.options
4657 }
4658 }
4659
4660 #[derive(Clone, Debug)]
4678 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
4679
4680 impl UpdateService {
4681 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4682 Self(RequestBuilder::new(stub))
4683 }
4684
4685 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
4687 self.0.request = v.into();
4688 self
4689 }
4690
4691 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4693 self.0.options = v.into();
4694 self
4695 }
4696
4697 pub async fn send(self) -> Result<longrunning::model::Operation> {
4704 (*self.0.stub)
4705 .update_service(self.0.request, self.0.options)
4706 .await
4707 .map(gax::response::Response::into_body)
4708 }
4709
4710 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
4712 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
4713 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4714 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4715
4716 let stub = self.0.stub.clone();
4717 let mut options = self.0.options.clone();
4718 options.set_retry_policy(gax::retry_policy::NeverRetry);
4719 let query = move |name| {
4720 let stub = stub.clone();
4721 let options = options.clone();
4722 async {
4723 let op = GetOperation::new(stub)
4724 .set_name(name)
4725 .with_options(options)
4726 .send()
4727 .await?;
4728 Ok(Operation::new(op))
4729 }
4730 };
4731
4732 let start = move || async {
4733 let op = self.send().await?;
4734 Ok(Operation::new(op))
4735 };
4736
4737 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4738 }
4739
4740 pub fn set_update_mask<T>(mut self, v: T) -> Self
4742 where
4743 T: std::convert::Into<wkt::FieldMask>,
4744 {
4745 self.0.request.update_mask = std::option::Option::Some(v.into());
4746 self
4747 }
4748
4749 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4751 where
4752 T: std::convert::Into<wkt::FieldMask>,
4753 {
4754 self.0.request.update_mask = v.map(|x| x.into());
4755 self
4756 }
4757
4758 pub fn set_service<T>(mut self, v: T) -> Self
4762 where
4763 T: std::convert::Into<crate::model::Service>,
4764 {
4765 self.0.request.service = std::option::Option::Some(v.into());
4766 self
4767 }
4768
4769 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4773 where
4774 T: std::convert::Into<crate::model::Service>,
4775 {
4776 self.0.request.service = v.map(|x| x.into());
4777 self
4778 }
4779
4780 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4782 self.0.request.validate_only = v.into();
4783 self
4784 }
4785
4786 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
4788 self.0.request.allow_missing = v.into();
4789 self
4790 }
4791 }
4792
4793 #[doc(hidden)]
4794 impl gax::options::internal::RequestBuilder for UpdateService {
4795 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4796 &mut self.0.options
4797 }
4798 }
4799
4800 #[derive(Clone, Debug)]
4818 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
4819
4820 impl DeleteService {
4821 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4822 Self(RequestBuilder::new(stub))
4823 }
4824
4825 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
4827 self.0.request = v.into();
4828 self
4829 }
4830
4831 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4833 self.0.options = v.into();
4834 self
4835 }
4836
4837 pub async fn send(self) -> Result<longrunning::model::Operation> {
4844 (*self.0.stub)
4845 .delete_service(self.0.request, self.0.options)
4846 .await
4847 .map(gax::response::Response::into_body)
4848 }
4849
4850 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
4852 type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
4853 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4854 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4855
4856 let stub = self.0.stub.clone();
4857 let mut options = self.0.options.clone();
4858 options.set_retry_policy(gax::retry_policy::NeverRetry);
4859 let query = move |name| {
4860 let stub = stub.clone();
4861 let options = options.clone();
4862 async {
4863 let op = GetOperation::new(stub)
4864 .set_name(name)
4865 .with_options(options)
4866 .send()
4867 .await?;
4868 Ok(Operation::new(op))
4869 }
4870 };
4871
4872 let start = move || async {
4873 let op = self.send().await?;
4874 Ok(Operation::new(op))
4875 };
4876
4877 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4878 }
4879
4880 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4884 self.0.request.name = v.into();
4885 self
4886 }
4887
4888 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4890 self.0.request.validate_only = v.into();
4891 self
4892 }
4893
4894 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4896 self.0.request.etag = v.into();
4897 self
4898 }
4899 }
4900
4901 #[doc(hidden)]
4902 impl gax::options::internal::RequestBuilder for DeleteService {
4903 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4904 &mut self.0.options
4905 }
4906 }
4907
4908 #[derive(Clone, Debug)]
4925 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4926
4927 impl GetIamPolicy {
4928 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4929 Self(RequestBuilder::new(stub))
4930 }
4931
4932 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4934 self.0.request = v.into();
4935 self
4936 }
4937
4938 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4940 self.0.options = v.into();
4941 self
4942 }
4943
4944 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4946 (*self.0.stub)
4947 .get_iam_policy(self.0.request, self.0.options)
4948 .await
4949 .map(gax::response::Response::into_body)
4950 }
4951
4952 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4956 self.0.request.resource = v.into();
4957 self
4958 }
4959
4960 pub fn set_options<T>(mut self, v: T) -> Self
4962 where
4963 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4964 {
4965 self.0.request.options = std::option::Option::Some(v.into());
4966 self
4967 }
4968
4969 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4971 where
4972 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4973 {
4974 self.0.request.options = v.map(|x| x.into());
4975 self
4976 }
4977 }
4978
4979 #[doc(hidden)]
4980 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4981 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4982 &mut self.0.options
4983 }
4984 }
4985
4986 #[derive(Clone, Debug)]
5003 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5004
5005 impl SetIamPolicy {
5006 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5007 Self(RequestBuilder::new(stub))
5008 }
5009
5010 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5012 self.0.request = v.into();
5013 self
5014 }
5015
5016 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5018 self.0.options = v.into();
5019 self
5020 }
5021
5022 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5024 (*self.0.stub)
5025 .set_iam_policy(self.0.request, self.0.options)
5026 .await
5027 .map(gax::response::Response::into_body)
5028 }
5029
5030 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5034 self.0.request.resource = v.into();
5035 self
5036 }
5037
5038 pub fn set_policy<T>(mut self, v: T) -> Self
5042 where
5043 T: std::convert::Into<iam_v1::model::Policy>,
5044 {
5045 self.0.request.policy = std::option::Option::Some(v.into());
5046 self
5047 }
5048
5049 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5053 where
5054 T: std::convert::Into<iam_v1::model::Policy>,
5055 {
5056 self.0.request.policy = v.map(|x| x.into());
5057 self
5058 }
5059
5060 pub fn set_update_mask<T>(mut self, v: T) -> Self
5062 where
5063 T: std::convert::Into<wkt::FieldMask>,
5064 {
5065 self.0.request.update_mask = std::option::Option::Some(v.into());
5066 self
5067 }
5068
5069 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5071 where
5072 T: std::convert::Into<wkt::FieldMask>,
5073 {
5074 self.0.request.update_mask = v.map(|x| x.into());
5075 self
5076 }
5077 }
5078
5079 #[doc(hidden)]
5080 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5081 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5082 &mut self.0.options
5083 }
5084 }
5085
5086 #[derive(Clone, Debug)]
5103 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5104
5105 impl TestIamPermissions {
5106 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5107 Self(RequestBuilder::new(stub))
5108 }
5109
5110 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5112 mut self,
5113 v: V,
5114 ) -> Self {
5115 self.0.request = v.into();
5116 self
5117 }
5118
5119 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5121 self.0.options = v.into();
5122 self
5123 }
5124
5125 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5127 (*self.0.stub)
5128 .test_iam_permissions(self.0.request, self.0.options)
5129 .await
5130 .map(gax::response::Response::into_body)
5131 }
5132
5133 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5137 self.0.request.resource = v.into();
5138 self
5139 }
5140
5141 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5145 where
5146 T: std::iter::IntoIterator<Item = V>,
5147 V: std::convert::Into<std::string::String>,
5148 {
5149 use std::iter::Iterator;
5150 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5151 self
5152 }
5153 }
5154
5155 #[doc(hidden)]
5156 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5158 &mut self.0.options
5159 }
5160 }
5161
5162 #[derive(Clone, Debug)]
5183 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5184
5185 impl ListOperations {
5186 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5187 Self(RequestBuilder::new(stub))
5188 }
5189
5190 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5192 mut self,
5193 v: V,
5194 ) -> Self {
5195 self.0.request = v.into();
5196 self
5197 }
5198
5199 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5201 self.0.options = v.into();
5202 self
5203 }
5204
5205 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5207 (*self.0.stub)
5208 .list_operations(self.0.request, self.0.options)
5209 .await
5210 .map(gax::response::Response::into_body)
5211 }
5212
5213 pub fn by_page(
5215 self,
5216 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5217 {
5218 use std::clone::Clone;
5219 let token = self.0.request.page_token.clone();
5220 let execute = move |token: String| {
5221 let mut builder = self.clone();
5222 builder.0.request = builder.0.request.set_page_token(token);
5223 builder.send()
5224 };
5225 gax::paginator::internal::new_paginator(token, execute)
5226 }
5227
5228 pub fn by_item(
5230 self,
5231 ) -> impl gax::paginator::ItemPaginator<
5232 longrunning::model::ListOperationsResponse,
5233 gax::error::Error,
5234 > {
5235 use gax::paginator::Paginator;
5236 self.by_page().items()
5237 }
5238
5239 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5241 self.0.request.name = v.into();
5242 self
5243 }
5244
5245 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5247 self.0.request.filter = v.into();
5248 self
5249 }
5250
5251 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5253 self.0.request.page_size = v.into();
5254 self
5255 }
5256
5257 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5259 self.0.request.page_token = v.into();
5260 self
5261 }
5262
5263 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5265 self.0.request.return_partial_success = v.into();
5266 self
5267 }
5268 }
5269
5270 #[doc(hidden)]
5271 impl gax::options::internal::RequestBuilder for ListOperations {
5272 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5273 &mut self.0.options
5274 }
5275 }
5276
5277 #[derive(Clone, Debug)]
5294 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5295
5296 impl GetOperation {
5297 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5298 Self(RequestBuilder::new(stub))
5299 }
5300
5301 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5303 mut self,
5304 v: V,
5305 ) -> Self {
5306 self.0.request = v.into();
5307 self
5308 }
5309
5310 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5312 self.0.options = v.into();
5313 self
5314 }
5315
5316 pub async fn send(self) -> Result<longrunning::model::Operation> {
5318 (*self.0.stub)
5319 .get_operation(self.0.request, self.0.options)
5320 .await
5321 .map(gax::response::Response::into_body)
5322 }
5323
5324 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5326 self.0.request.name = v.into();
5327 self
5328 }
5329 }
5330
5331 #[doc(hidden)]
5332 impl gax::options::internal::RequestBuilder for GetOperation {
5333 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5334 &mut self.0.options
5335 }
5336 }
5337
5338 #[derive(Clone, Debug)]
5355 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5356
5357 impl DeleteOperation {
5358 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5359 Self(RequestBuilder::new(stub))
5360 }
5361
5362 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5364 mut self,
5365 v: V,
5366 ) -> Self {
5367 self.0.request = v.into();
5368 self
5369 }
5370
5371 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5373 self.0.options = v.into();
5374 self
5375 }
5376
5377 pub async fn send(self) -> Result<()> {
5379 (*self.0.stub)
5380 .delete_operation(self.0.request, self.0.options)
5381 .await
5382 .map(gax::response::Response::into_body)
5383 }
5384
5385 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5387 self.0.request.name = v.into();
5388 self
5389 }
5390 }
5391
5392 #[doc(hidden)]
5393 impl gax::options::internal::RequestBuilder for DeleteOperation {
5394 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5395 &mut self.0.options
5396 }
5397 }
5398
5399 #[derive(Clone, Debug)]
5416 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
5417
5418 impl WaitOperation {
5419 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5420 Self(RequestBuilder::new(stub))
5421 }
5422
5423 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
5425 mut self,
5426 v: V,
5427 ) -> Self {
5428 self.0.request = v.into();
5429 self
5430 }
5431
5432 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5434 self.0.options = v.into();
5435 self
5436 }
5437
5438 pub async fn send(self) -> Result<longrunning::model::Operation> {
5440 (*self.0.stub)
5441 .wait_operation(self.0.request, self.0.options)
5442 .await
5443 .map(gax::response::Response::into_body)
5444 }
5445
5446 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5448 self.0.request.name = v.into();
5449 self
5450 }
5451
5452 pub fn set_timeout<T>(mut self, v: T) -> Self
5454 where
5455 T: std::convert::Into<wkt::Duration>,
5456 {
5457 self.0.request.timeout = std::option::Option::Some(v.into());
5458 self
5459 }
5460
5461 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5463 where
5464 T: std::convert::Into<wkt::Duration>,
5465 {
5466 self.0.request.timeout = v.map(|x| x.into());
5467 self
5468 }
5469 }
5470
5471 #[doc(hidden)]
5472 impl gax::options::internal::RequestBuilder for WaitOperation {
5473 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5474 &mut self.0.options
5475 }
5476 }
5477}
5478
5479pub mod tasks {
5480 use crate::Result;
5481
5482 pub type ClientBuilder =
5496 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5497
5498 pub(crate) mod client {
5499 use super::super::super::client::Tasks;
5500 pub struct Factory;
5501 impl gax::client_builder::internal::ClientFactory for Factory {
5502 type Client = Tasks;
5503 type Credentials = gaxi::options::Credentials;
5504 async fn build(
5505 self,
5506 config: gaxi::options::ClientConfig,
5507 ) -> gax::client_builder::Result<Self::Client> {
5508 Self::Client::new(config).await
5509 }
5510 }
5511 }
5512
5513 #[derive(Clone, Debug)]
5515 pub(crate) struct RequestBuilder<R: std::default::Default> {
5516 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
5517 request: R,
5518 options: gax::options::RequestOptions,
5519 }
5520
5521 impl<R> RequestBuilder<R>
5522 where
5523 R: std::default::Default,
5524 {
5525 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5526 Self {
5527 stub,
5528 request: R::default(),
5529 options: gax::options::RequestOptions::default(),
5530 }
5531 }
5532 }
5533
5534 #[derive(Clone, Debug)]
5551 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
5552
5553 impl GetTask {
5554 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5555 Self(RequestBuilder::new(stub))
5556 }
5557
5558 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
5560 self.0.request = v.into();
5561 self
5562 }
5563
5564 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5566 self.0.options = v.into();
5567 self
5568 }
5569
5570 pub async fn send(self) -> Result<crate::model::Task> {
5572 (*self.0.stub)
5573 .get_task(self.0.request, self.0.options)
5574 .await
5575 .map(gax::response::Response::into_body)
5576 }
5577
5578 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5582 self.0.request.name = v.into();
5583 self
5584 }
5585 }
5586
5587 #[doc(hidden)]
5588 impl gax::options::internal::RequestBuilder for GetTask {
5589 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5590 &mut self.0.options
5591 }
5592 }
5593
5594 #[derive(Clone, Debug)]
5615 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
5616
5617 impl ListTasks {
5618 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5619 Self(RequestBuilder::new(stub))
5620 }
5621
5622 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
5624 self.0.request = v.into();
5625 self
5626 }
5627
5628 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5630 self.0.options = v.into();
5631 self
5632 }
5633
5634 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
5636 (*self.0.stub)
5637 .list_tasks(self.0.request, self.0.options)
5638 .await
5639 .map(gax::response::Response::into_body)
5640 }
5641
5642 pub fn by_page(
5644 self,
5645 ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
5646 {
5647 use std::clone::Clone;
5648 let token = self.0.request.page_token.clone();
5649 let execute = move |token: String| {
5650 let mut builder = self.clone();
5651 builder.0.request = builder.0.request.set_page_token(token);
5652 builder.send()
5653 };
5654 gax::paginator::internal::new_paginator(token, execute)
5655 }
5656
5657 pub fn by_item(
5659 self,
5660 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTasksResponse, gax::error::Error>
5661 {
5662 use gax::paginator::Paginator;
5663 self.by_page().items()
5664 }
5665
5666 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5670 self.0.request.parent = v.into();
5671 self
5672 }
5673
5674 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5676 self.0.request.page_size = v.into();
5677 self
5678 }
5679
5680 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5682 self.0.request.page_token = v.into();
5683 self
5684 }
5685
5686 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5688 self.0.request.show_deleted = v.into();
5689 self
5690 }
5691 }
5692
5693 #[doc(hidden)]
5694 impl gax::options::internal::RequestBuilder for ListTasks {
5695 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5696 &mut self.0.options
5697 }
5698 }
5699
5700 #[derive(Clone, Debug)]
5721 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5722
5723 impl ListOperations {
5724 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5725 Self(RequestBuilder::new(stub))
5726 }
5727
5728 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5730 mut self,
5731 v: V,
5732 ) -> Self {
5733 self.0.request = v.into();
5734 self
5735 }
5736
5737 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5739 self.0.options = v.into();
5740 self
5741 }
5742
5743 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5745 (*self.0.stub)
5746 .list_operations(self.0.request, self.0.options)
5747 .await
5748 .map(gax::response::Response::into_body)
5749 }
5750
5751 pub fn by_page(
5753 self,
5754 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5755 {
5756 use std::clone::Clone;
5757 let token = self.0.request.page_token.clone();
5758 let execute = move |token: String| {
5759 let mut builder = self.clone();
5760 builder.0.request = builder.0.request.set_page_token(token);
5761 builder.send()
5762 };
5763 gax::paginator::internal::new_paginator(token, execute)
5764 }
5765
5766 pub fn by_item(
5768 self,
5769 ) -> impl gax::paginator::ItemPaginator<
5770 longrunning::model::ListOperationsResponse,
5771 gax::error::Error,
5772 > {
5773 use gax::paginator::Paginator;
5774 self.by_page().items()
5775 }
5776
5777 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5779 self.0.request.name = v.into();
5780 self
5781 }
5782
5783 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5785 self.0.request.filter = v.into();
5786 self
5787 }
5788
5789 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5791 self.0.request.page_size = v.into();
5792 self
5793 }
5794
5795 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5797 self.0.request.page_token = v.into();
5798 self
5799 }
5800
5801 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5803 self.0.request.return_partial_success = v.into();
5804 self
5805 }
5806 }
5807
5808 #[doc(hidden)]
5809 impl gax::options::internal::RequestBuilder for ListOperations {
5810 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5811 &mut self.0.options
5812 }
5813 }
5814
5815 #[derive(Clone, Debug)]
5832 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5833
5834 impl GetOperation {
5835 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5836 Self(RequestBuilder::new(stub))
5837 }
5838
5839 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5841 mut self,
5842 v: V,
5843 ) -> Self {
5844 self.0.request = v.into();
5845 self
5846 }
5847
5848 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5850 self.0.options = v.into();
5851 self
5852 }
5853
5854 pub async fn send(self) -> Result<longrunning::model::Operation> {
5856 (*self.0.stub)
5857 .get_operation(self.0.request, self.0.options)
5858 .await
5859 .map(gax::response::Response::into_body)
5860 }
5861
5862 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5864 self.0.request.name = v.into();
5865 self
5866 }
5867 }
5868
5869 #[doc(hidden)]
5870 impl gax::options::internal::RequestBuilder for GetOperation {
5871 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5872 &mut self.0.options
5873 }
5874 }
5875
5876 #[derive(Clone, Debug)]
5893 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5894
5895 impl DeleteOperation {
5896 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5897 Self(RequestBuilder::new(stub))
5898 }
5899
5900 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5902 mut self,
5903 v: V,
5904 ) -> Self {
5905 self.0.request = v.into();
5906 self
5907 }
5908
5909 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5911 self.0.options = v.into();
5912 self
5913 }
5914
5915 pub async fn send(self) -> Result<()> {
5917 (*self.0.stub)
5918 .delete_operation(self.0.request, self.0.options)
5919 .await
5920 .map(gax::response::Response::into_body)
5921 }
5922
5923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5925 self.0.request.name = v.into();
5926 self
5927 }
5928 }
5929
5930 #[doc(hidden)]
5931 impl gax::options::internal::RequestBuilder for DeleteOperation {
5932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5933 &mut self.0.options
5934 }
5935 }
5936
5937 #[derive(Clone, Debug)]
5954 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
5955
5956 impl WaitOperation {
5957 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5958 Self(RequestBuilder::new(stub))
5959 }
5960
5961 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
5963 mut self,
5964 v: V,
5965 ) -> Self {
5966 self.0.request = v.into();
5967 self
5968 }
5969
5970 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5972 self.0.options = v.into();
5973 self
5974 }
5975
5976 pub async fn send(self) -> Result<longrunning::model::Operation> {
5978 (*self.0.stub)
5979 .wait_operation(self.0.request, self.0.options)
5980 .await
5981 .map(gax::response::Response::into_body)
5982 }
5983
5984 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5986 self.0.request.name = v.into();
5987 self
5988 }
5989
5990 pub fn set_timeout<T>(mut self, v: T) -> Self
5992 where
5993 T: std::convert::Into<wkt::Duration>,
5994 {
5995 self.0.request.timeout = std::option::Option::Some(v.into());
5996 self
5997 }
5998
5999 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6001 where
6002 T: std::convert::Into<wkt::Duration>,
6003 {
6004 self.0.request.timeout = v.map(|x| x.into());
6005 self
6006 }
6007 }
6008
6009 #[doc(hidden)]
6010 impl gax::options::internal::RequestBuilder for WaitOperation {
6011 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6012 &mut self.0.options
6013 }
6014 }
6015}
6016
6017pub mod worker_pools {
6018 use crate::Result;
6019
6020 pub type ClientBuilder =
6034 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6035
6036 pub(crate) mod client {
6037 use super::super::super::client::WorkerPools;
6038 pub struct Factory;
6039 impl gax::client_builder::internal::ClientFactory for Factory {
6040 type Client = WorkerPools;
6041 type Credentials = gaxi::options::Credentials;
6042 async fn build(
6043 self,
6044 config: gaxi::options::ClientConfig,
6045 ) -> gax::client_builder::Result<Self::Client> {
6046 Self::Client::new(config).await
6047 }
6048 }
6049 }
6050
6051 #[derive(Clone, Debug)]
6053 pub(crate) struct RequestBuilder<R: std::default::Default> {
6054 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6055 request: R,
6056 options: gax::options::RequestOptions,
6057 }
6058
6059 impl<R> RequestBuilder<R>
6060 where
6061 R: std::default::Default,
6062 {
6063 pub(crate) fn new(
6064 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6065 ) -> Self {
6066 Self {
6067 stub,
6068 request: R::default(),
6069 options: gax::options::RequestOptions::default(),
6070 }
6071 }
6072 }
6073
6074 #[derive(Clone, Debug)]
6092 pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
6093
6094 impl CreateWorkerPool {
6095 pub(crate) fn new(
6096 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6097 ) -> Self {
6098 Self(RequestBuilder::new(stub))
6099 }
6100
6101 pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
6103 mut self,
6104 v: V,
6105 ) -> Self {
6106 self.0.request = v.into();
6107 self
6108 }
6109
6110 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6112 self.0.options = v.into();
6113 self
6114 }
6115
6116 pub async fn send(self) -> Result<longrunning::model::Operation> {
6123 (*self.0.stub)
6124 .create_worker_pool(self.0.request, self.0.options)
6125 .await
6126 .map(gax::response::Response::into_body)
6127 }
6128
6129 pub fn poller(
6131 self,
6132 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
6133 type Operation =
6134 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
6135 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6136 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6137
6138 let stub = self.0.stub.clone();
6139 let mut options = self.0.options.clone();
6140 options.set_retry_policy(gax::retry_policy::NeverRetry);
6141 let query = move |name| {
6142 let stub = stub.clone();
6143 let options = options.clone();
6144 async {
6145 let op = GetOperation::new(stub)
6146 .set_name(name)
6147 .with_options(options)
6148 .send()
6149 .await?;
6150 Ok(Operation::new(op))
6151 }
6152 };
6153
6154 let start = move || async {
6155 let op = self.send().await?;
6156 Ok(Operation::new(op))
6157 };
6158
6159 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6160 }
6161
6162 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6166 self.0.request.parent = v.into();
6167 self
6168 }
6169
6170 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6174 where
6175 T: std::convert::Into<crate::model::WorkerPool>,
6176 {
6177 self.0.request.worker_pool = std::option::Option::Some(v.into());
6178 self
6179 }
6180
6181 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6185 where
6186 T: std::convert::Into<crate::model::WorkerPool>,
6187 {
6188 self.0.request.worker_pool = v.map(|x| x.into());
6189 self
6190 }
6191
6192 pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6196 self.0.request.worker_pool_id = v.into();
6197 self
6198 }
6199
6200 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6202 self.0.request.validate_only = v.into();
6203 self
6204 }
6205 }
6206
6207 #[doc(hidden)]
6208 impl gax::options::internal::RequestBuilder for CreateWorkerPool {
6209 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6210 &mut self.0.options
6211 }
6212 }
6213
6214 #[derive(Clone, Debug)]
6231 pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
6232
6233 impl GetWorkerPool {
6234 pub(crate) fn new(
6235 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6236 ) -> Self {
6237 Self(RequestBuilder::new(stub))
6238 }
6239
6240 pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
6242 self.0.request = v.into();
6243 self
6244 }
6245
6246 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6248 self.0.options = v.into();
6249 self
6250 }
6251
6252 pub async fn send(self) -> Result<crate::model::WorkerPool> {
6254 (*self.0.stub)
6255 .get_worker_pool(self.0.request, self.0.options)
6256 .await
6257 .map(gax::response::Response::into_body)
6258 }
6259
6260 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6264 self.0.request.name = v.into();
6265 self
6266 }
6267 }
6268
6269 #[doc(hidden)]
6270 impl gax::options::internal::RequestBuilder for GetWorkerPool {
6271 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6272 &mut self.0.options
6273 }
6274 }
6275
6276 #[derive(Clone, Debug)]
6297 pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
6298
6299 impl ListWorkerPools {
6300 pub(crate) fn new(
6301 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6302 ) -> Self {
6303 Self(RequestBuilder::new(stub))
6304 }
6305
6306 pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
6308 self.0.request = v.into();
6309 self
6310 }
6311
6312 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6314 self.0.options = v.into();
6315 self
6316 }
6317
6318 pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
6320 (*self.0.stub)
6321 .list_worker_pools(self.0.request, self.0.options)
6322 .await
6323 .map(gax::response::Response::into_body)
6324 }
6325
6326 pub fn by_page(
6328 self,
6329 ) -> impl gax::paginator::Paginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
6330 {
6331 use std::clone::Clone;
6332 let token = self.0.request.page_token.clone();
6333 let execute = move |token: String| {
6334 let mut builder = self.clone();
6335 builder.0.request = builder.0.request.set_page_token(token);
6336 builder.send()
6337 };
6338 gax::paginator::internal::new_paginator(token, execute)
6339 }
6340
6341 pub fn by_item(
6343 self,
6344 ) -> impl gax::paginator::ItemPaginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
6345 {
6346 use gax::paginator::Paginator;
6347 self.by_page().items()
6348 }
6349
6350 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6354 self.0.request.parent = v.into();
6355 self
6356 }
6357
6358 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6360 self.0.request.page_size = v.into();
6361 self
6362 }
6363
6364 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6366 self.0.request.page_token = v.into();
6367 self
6368 }
6369
6370 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
6372 self.0.request.show_deleted = v.into();
6373 self
6374 }
6375 }
6376
6377 #[doc(hidden)]
6378 impl gax::options::internal::RequestBuilder for ListWorkerPools {
6379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6380 &mut self.0.options
6381 }
6382 }
6383
6384 #[derive(Clone, Debug)]
6402 pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
6403
6404 impl UpdateWorkerPool {
6405 pub(crate) fn new(
6406 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6407 ) -> Self {
6408 Self(RequestBuilder::new(stub))
6409 }
6410
6411 pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
6413 mut self,
6414 v: V,
6415 ) -> Self {
6416 self.0.request = v.into();
6417 self
6418 }
6419
6420 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6422 self.0.options = v.into();
6423 self
6424 }
6425
6426 pub async fn send(self) -> Result<longrunning::model::Operation> {
6433 (*self.0.stub)
6434 .update_worker_pool(self.0.request, self.0.options)
6435 .await
6436 .map(gax::response::Response::into_body)
6437 }
6438
6439 pub fn poller(
6441 self,
6442 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
6443 type Operation =
6444 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
6445 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6446 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6447
6448 let stub = self.0.stub.clone();
6449 let mut options = self.0.options.clone();
6450 options.set_retry_policy(gax::retry_policy::NeverRetry);
6451 let query = move |name| {
6452 let stub = stub.clone();
6453 let options = options.clone();
6454 async {
6455 let op = GetOperation::new(stub)
6456 .set_name(name)
6457 .with_options(options)
6458 .send()
6459 .await?;
6460 Ok(Operation::new(op))
6461 }
6462 };
6463
6464 let start = move || async {
6465 let op = self.send().await?;
6466 Ok(Operation::new(op))
6467 };
6468
6469 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6470 }
6471
6472 pub fn set_update_mask<T>(mut self, v: T) -> Self
6474 where
6475 T: std::convert::Into<wkt::FieldMask>,
6476 {
6477 self.0.request.update_mask = std::option::Option::Some(v.into());
6478 self
6479 }
6480
6481 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6483 where
6484 T: std::convert::Into<wkt::FieldMask>,
6485 {
6486 self.0.request.update_mask = v.map(|x| x.into());
6487 self
6488 }
6489
6490 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6494 where
6495 T: std::convert::Into<crate::model::WorkerPool>,
6496 {
6497 self.0.request.worker_pool = std::option::Option::Some(v.into());
6498 self
6499 }
6500
6501 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6505 where
6506 T: std::convert::Into<crate::model::WorkerPool>,
6507 {
6508 self.0.request.worker_pool = v.map(|x| x.into());
6509 self
6510 }
6511
6512 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6514 self.0.request.validate_only = v.into();
6515 self
6516 }
6517
6518 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6520 self.0.request.allow_missing = v.into();
6521 self
6522 }
6523
6524 pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
6526 self.0.request.force_new_revision = v.into();
6527 self
6528 }
6529 }
6530
6531 #[doc(hidden)]
6532 impl gax::options::internal::RequestBuilder for UpdateWorkerPool {
6533 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6534 &mut self.0.options
6535 }
6536 }
6537
6538 #[derive(Clone, Debug)]
6556 pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
6557
6558 impl DeleteWorkerPool {
6559 pub(crate) fn new(
6560 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6561 ) -> Self {
6562 Self(RequestBuilder::new(stub))
6563 }
6564
6565 pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
6567 mut self,
6568 v: V,
6569 ) -> Self {
6570 self.0.request = v.into();
6571 self
6572 }
6573
6574 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6576 self.0.options = v.into();
6577 self
6578 }
6579
6580 pub async fn send(self) -> Result<longrunning::model::Operation> {
6587 (*self.0.stub)
6588 .delete_worker_pool(self.0.request, self.0.options)
6589 .await
6590 .map(gax::response::Response::into_body)
6591 }
6592
6593 pub fn poller(
6595 self,
6596 ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
6597 type Operation =
6598 lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
6599 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6600 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6601
6602 let stub = self.0.stub.clone();
6603 let mut options = self.0.options.clone();
6604 options.set_retry_policy(gax::retry_policy::NeverRetry);
6605 let query = move |name| {
6606 let stub = stub.clone();
6607 let options = options.clone();
6608 async {
6609 let op = GetOperation::new(stub)
6610 .set_name(name)
6611 .with_options(options)
6612 .send()
6613 .await?;
6614 Ok(Operation::new(op))
6615 }
6616 };
6617
6618 let start = move || async {
6619 let op = self.send().await?;
6620 Ok(Operation::new(op))
6621 };
6622
6623 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6624 }
6625
6626 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6630 self.0.request.name = v.into();
6631 self
6632 }
6633
6634 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6636 self.0.request.validate_only = v.into();
6637 self
6638 }
6639
6640 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
6642 self.0.request.etag = v.into();
6643 self
6644 }
6645 }
6646
6647 #[doc(hidden)]
6648 impl gax::options::internal::RequestBuilder for DeleteWorkerPool {
6649 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6650 &mut self.0.options
6651 }
6652 }
6653
6654 #[derive(Clone, Debug)]
6671 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6672
6673 impl GetIamPolicy {
6674 pub(crate) fn new(
6675 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6676 ) -> Self {
6677 Self(RequestBuilder::new(stub))
6678 }
6679
6680 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6682 self.0.request = v.into();
6683 self
6684 }
6685
6686 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6688 self.0.options = v.into();
6689 self
6690 }
6691
6692 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6694 (*self.0.stub)
6695 .get_iam_policy(self.0.request, self.0.options)
6696 .await
6697 .map(gax::response::Response::into_body)
6698 }
6699
6700 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6704 self.0.request.resource = v.into();
6705 self
6706 }
6707
6708 pub fn set_options<T>(mut self, v: T) -> Self
6710 where
6711 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6712 {
6713 self.0.request.options = std::option::Option::Some(v.into());
6714 self
6715 }
6716
6717 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6719 where
6720 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6721 {
6722 self.0.request.options = v.map(|x| x.into());
6723 self
6724 }
6725 }
6726
6727 #[doc(hidden)]
6728 impl gax::options::internal::RequestBuilder for GetIamPolicy {
6729 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6730 &mut self.0.options
6731 }
6732 }
6733
6734 #[derive(Clone, Debug)]
6751 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6752
6753 impl SetIamPolicy {
6754 pub(crate) fn new(
6755 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6756 ) -> Self {
6757 Self(RequestBuilder::new(stub))
6758 }
6759
6760 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6762 self.0.request = v.into();
6763 self
6764 }
6765
6766 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6768 self.0.options = v.into();
6769 self
6770 }
6771
6772 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6774 (*self.0.stub)
6775 .set_iam_policy(self.0.request, self.0.options)
6776 .await
6777 .map(gax::response::Response::into_body)
6778 }
6779
6780 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6784 self.0.request.resource = v.into();
6785 self
6786 }
6787
6788 pub fn set_policy<T>(mut self, v: T) -> Self
6792 where
6793 T: std::convert::Into<iam_v1::model::Policy>,
6794 {
6795 self.0.request.policy = std::option::Option::Some(v.into());
6796 self
6797 }
6798
6799 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6803 where
6804 T: std::convert::Into<iam_v1::model::Policy>,
6805 {
6806 self.0.request.policy = v.map(|x| x.into());
6807 self
6808 }
6809
6810 pub fn set_update_mask<T>(mut self, v: T) -> Self
6812 where
6813 T: std::convert::Into<wkt::FieldMask>,
6814 {
6815 self.0.request.update_mask = std::option::Option::Some(v.into());
6816 self
6817 }
6818
6819 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6821 where
6822 T: std::convert::Into<wkt::FieldMask>,
6823 {
6824 self.0.request.update_mask = v.map(|x| x.into());
6825 self
6826 }
6827 }
6828
6829 #[doc(hidden)]
6830 impl gax::options::internal::RequestBuilder for SetIamPolicy {
6831 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6832 &mut self.0.options
6833 }
6834 }
6835
6836 #[derive(Clone, Debug)]
6853 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6854
6855 impl TestIamPermissions {
6856 pub(crate) fn new(
6857 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6858 ) -> Self {
6859 Self(RequestBuilder::new(stub))
6860 }
6861
6862 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6864 mut self,
6865 v: V,
6866 ) -> Self {
6867 self.0.request = v.into();
6868 self
6869 }
6870
6871 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6873 self.0.options = v.into();
6874 self
6875 }
6876
6877 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6879 (*self.0.stub)
6880 .test_iam_permissions(self.0.request, self.0.options)
6881 .await
6882 .map(gax::response::Response::into_body)
6883 }
6884
6885 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6889 self.0.request.resource = v.into();
6890 self
6891 }
6892
6893 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6897 where
6898 T: std::iter::IntoIterator<Item = V>,
6899 V: std::convert::Into<std::string::String>,
6900 {
6901 use std::iter::Iterator;
6902 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6903 self
6904 }
6905 }
6906
6907 #[doc(hidden)]
6908 impl gax::options::internal::RequestBuilder for TestIamPermissions {
6909 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6910 &mut self.0.options
6911 }
6912 }
6913
6914 #[derive(Clone, Debug)]
6935 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6936
6937 impl ListOperations {
6938 pub(crate) fn new(
6939 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6940 ) -> Self {
6941 Self(RequestBuilder::new(stub))
6942 }
6943
6944 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6946 mut self,
6947 v: V,
6948 ) -> Self {
6949 self.0.request = v.into();
6950 self
6951 }
6952
6953 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6955 self.0.options = v.into();
6956 self
6957 }
6958
6959 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6961 (*self.0.stub)
6962 .list_operations(self.0.request, self.0.options)
6963 .await
6964 .map(gax::response::Response::into_body)
6965 }
6966
6967 pub fn by_page(
6969 self,
6970 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6971 {
6972 use std::clone::Clone;
6973 let token = self.0.request.page_token.clone();
6974 let execute = move |token: String| {
6975 let mut builder = self.clone();
6976 builder.0.request = builder.0.request.set_page_token(token);
6977 builder.send()
6978 };
6979 gax::paginator::internal::new_paginator(token, execute)
6980 }
6981
6982 pub fn by_item(
6984 self,
6985 ) -> impl gax::paginator::ItemPaginator<
6986 longrunning::model::ListOperationsResponse,
6987 gax::error::Error,
6988 > {
6989 use gax::paginator::Paginator;
6990 self.by_page().items()
6991 }
6992
6993 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6995 self.0.request.name = v.into();
6996 self
6997 }
6998
6999 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7001 self.0.request.filter = v.into();
7002 self
7003 }
7004
7005 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7007 self.0.request.page_size = v.into();
7008 self
7009 }
7010
7011 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7013 self.0.request.page_token = v.into();
7014 self
7015 }
7016
7017 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7019 self.0.request.return_partial_success = v.into();
7020 self
7021 }
7022 }
7023
7024 #[doc(hidden)]
7025 impl gax::options::internal::RequestBuilder for ListOperations {
7026 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7027 &mut self.0.options
7028 }
7029 }
7030
7031 #[derive(Clone, Debug)]
7048 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7049
7050 impl GetOperation {
7051 pub(crate) fn new(
7052 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7053 ) -> Self {
7054 Self(RequestBuilder::new(stub))
7055 }
7056
7057 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7059 mut self,
7060 v: V,
7061 ) -> Self {
7062 self.0.request = v.into();
7063 self
7064 }
7065
7066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7068 self.0.options = v.into();
7069 self
7070 }
7071
7072 pub async fn send(self) -> Result<longrunning::model::Operation> {
7074 (*self.0.stub)
7075 .get_operation(self.0.request, self.0.options)
7076 .await
7077 .map(gax::response::Response::into_body)
7078 }
7079
7080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7082 self.0.request.name = v.into();
7083 self
7084 }
7085 }
7086
7087 #[doc(hidden)]
7088 impl gax::options::internal::RequestBuilder for GetOperation {
7089 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7090 &mut self.0.options
7091 }
7092 }
7093
7094 #[derive(Clone, Debug)]
7111 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7112
7113 impl DeleteOperation {
7114 pub(crate) fn new(
7115 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7116 ) -> Self {
7117 Self(RequestBuilder::new(stub))
7118 }
7119
7120 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7122 mut self,
7123 v: V,
7124 ) -> Self {
7125 self.0.request = v.into();
7126 self
7127 }
7128
7129 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7131 self.0.options = v.into();
7132 self
7133 }
7134
7135 pub async fn send(self) -> Result<()> {
7137 (*self.0.stub)
7138 .delete_operation(self.0.request, self.0.options)
7139 .await
7140 .map(gax::response::Response::into_body)
7141 }
7142
7143 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7145 self.0.request.name = v.into();
7146 self
7147 }
7148 }
7149
7150 #[doc(hidden)]
7151 impl gax::options::internal::RequestBuilder for DeleteOperation {
7152 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7153 &mut self.0.options
7154 }
7155 }
7156
7157 #[derive(Clone, Debug)]
7174 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
7175
7176 impl WaitOperation {
7177 pub(crate) fn new(
7178 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7179 ) -> Self {
7180 Self(RequestBuilder::new(stub))
7181 }
7182
7183 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
7185 mut self,
7186 v: V,
7187 ) -> Self {
7188 self.0.request = v.into();
7189 self
7190 }
7191
7192 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7194 self.0.options = v.into();
7195 self
7196 }
7197
7198 pub async fn send(self) -> Result<longrunning::model::Operation> {
7200 (*self.0.stub)
7201 .wait_operation(self.0.request, self.0.options)
7202 .await
7203 .map(gax::response::Response::into_body)
7204 }
7205
7206 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7208 self.0.request.name = v.into();
7209 self
7210 }
7211
7212 pub fn set_timeout<T>(mut self, v: T) -> Self
7214 where
7215 T: std::convert::Into<wkt::Duration>,
7216 {
7217 self.0.request.timeout = std::option::Option::Some(v.into());
7218 self
7219 }
7220
7221 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7223 where
7224 T: std::convert::Into<wkt::Duration>,
7225 {
7226 self.0.request.timeout = v.map(|x| x.into());
7227 self
7228 }
7229 }
7230
7231 #[doc(hidden)]
7232 impl gax::options::internal::RequestBuilder for WaitOperation {
7233 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7234 &mut self.0.options
7235 }
7236 }
7237}