1pub mod builds {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::Builds;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = Builds;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: crate::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
89 pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
90
91 impl SubmitBuild {
92 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
93 Self(RequestBuilder::new(stub))
94 }
95
96 pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
98 self.0.request = v.into();
99 self
100 }
101
102 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
104 self.0.options = v.into();
105 self
106 }
107
108 pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
110 (*self.0.stub)
111 .submit_build(self.0.request, self.0.options)
112 .await
113 .map(crate::Response::into_body)
114 }
115
116 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
120 self.0.request.parent = v.into();
121 self
122 }
123
124 pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.image_uri = v.into();
129 self
130 }
131
132 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.service_account = v.into();
135 self
136 }
137
138 pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
140 self.0.request.worker_pool = v.into();
141 self
142 }
143
144 pub fn set_tags<T, V>(mut self, v: T) -> Self
146 where
147 T: std::iter::IntoIterator<Item = V>,
148 V: std::convert::Into<std::string::String>,
149 {
150 use std::iter::Iterator;
151 self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
152 self
153 }
154
155 pub fn set_machine_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
157 self.0.request.machine_type = v.into();
158 self
159 }
160
161 pub fn set_release_track<T: Into<google_cloud_api::model::LaunchStage>>(
163 mut self,
164 v: T,
165 ) -> Self {
166 self.0.request.release_track = v.into();
167 self
168 }
169
170 pub fn set_client<T: Into<std::string::String>>(mut self, v: T) -> Self {
172 self.0.request.client = v.into();
173 self
174 }
175
176 pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
181 mut self,
182 v: T,
183 ) -> Self {
184 self.0.request.source = v.into();
185 self
186 }
187
188 pub fn set_storage_source<
194 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
195 >(
196 mut self,
197 v: T,
198 ) -> Self {
199 self.0.request = self.0.request.set_storage_source(v);
200 self
201 }
202
203 pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
208 mut self,
209 v: T,
210 ) -> Self {
211 self.0.request.build_type = v.into();
212 self
213 }
214
215 pub fn set_buildpack_build<
221 T: std::convert::Into<
222 std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
223 >,
224 >(
225 mut self,
226 v: T,
227 ) -> Self {
228 self.0.request = self.0.request.set_buildpack_build(v);
229 self
230 }
231
232 pub fn set_docker_build<
238 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
239 >(
240 mut self,
241 v: T,
242 ) -> Self {
243 self.0.request = self.0.request.set_docker_build(v);
244 self
245 }
246 }
247
248 #[doc(hidden)]
249 impl crate::RequestBuilder for SubmitBuild {
250 fn request_options(&mut self) -> &mut crate::RequestOptions {
251 &mut self.0.options
252 }
253 }
254
255 #[derive(Clone, Debug)]
276 pub struct ListOperations(
277 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
278 );
279
280 impl ListOperations {
281 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
282 Self(RequestBuilder::new(stub))
283 }
284
285 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
287 mut self,
288 v: V,
289 ) -> Self {
290 self.0.request = v.into();
291 self
292 }
293
294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
296 self.0.options = v.into();
297 self
298 }
299
300 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
302 (*self.0.stub)
303 .list_operations(self.0.request, self.0.options)
304 .await
305 .map(crate::Response::into_body)
306 }
307
308 pub fn by_page(
310 self,
311 ) -> impl google_cloud_gax::paginator::Paginator<
312 google_cloud_longrunning::model::ListOperationsResponse,
313 crate::Error,
314 > {
315 use std::clone::Clone;
316 let token = self.0.request.page_token.clone();
317 let execute = move |token: String| {
318 let mut builder = self.clone();
319 builder.0.request = builder.0.request.set_page_token(token);
320 builder.send()
321 };
322 google_cloud_gax::paginator::internal::new_paginator(token, execute)
323 }
324
325 pub fn by_item(
327 self,
328 ) -> impl google_cloud_gax::paginator::ItemPaginator<
329 google_cloud_longrunning::model::ListOperationsResponse,
330 crate::Error,
331 > {
332 use google_cloud_gax::paginator::Paginator;
333 self.by_page().items()
334 }
335
336 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
338 self.0.request.name = v.into();
339 self
340 }
341
342 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
344 self.0.request.filter = v.into();
345 self
346 }
347
348 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
350 self.0.request.page_size = v.into();
351 self
352 }
353
354 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
356 self.0.request.page_token = v.into();
357 self
358 }
359
360 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
362 self.0.request.return_partial_success = v.into();
363 self
364 }
365 }
366
367 #[doc(hidden)]
368 impl crate::RequestBuilder for ListOperations {
369 fn request_options(&mut self) -> &mut crate::RequestOptions {
370 &mut self.0.options
371 }
372 }
373
374 #[derive(Clone, Debug)]
391 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
392
393 impl GetOperation {
394 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
395 Self(RequestBuilder::new(stub))
396 }
397
398 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
400 mut self,
401 v: V,
402 ) -> Self {
403 self.0.request = v.into();
404 self
405 }
406
407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
409 self.0.options = v.into();
410 self
411 }
412
413 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
415 (*self.0.stub)
416 .get_operation(self.0.request, self.0.options)
417 .await
418 .map(crate::Response::into_body)
419 }
420
421 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
423 self.0.request.name = v.into();
424 self
425 }
426 }
427
428 #[doc(hidden)]
429 impl crate::RequestBuilder for GetOperation {
430 fn request_options(&mut self) -> &mut crate::RequestOptions {
431 &mut self.0.options
432 }
433 }
434
435 #[derive(Clone, Debug)]
452 pub struct DeleteOperation(
453 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
454 );
455
456 impl DeleteOperation {
457 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
458 Self(RequestBuilder::new(stub))
459 }
460
461 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
463 mut self,
464 v: V,
465 ) -> Self {
466 self.0.request = v.into();
467 self
468 }
469
470 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
472 self.0.options = v.into();
473 self
474 }
475
476 pub async fn send(self) -> Result<()> {
478 (*self.0.stub)
479 .delete_operation(self.0.request, self.0.options)
480 .await
481 .map(crate::Response::into_body)
482 }
483
484 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
486 self.0.request.name = v.into();
487 self
488 }
489 }
490
491 #[doc(hidden)]
492 impl crate::RequestBuilder for DeleteOperation {
493 fn request_options(&mut self) -> &mut crate::RequestOptions {
494 &mut self.0.options
495 }
496 }
497
498 #[derive(Clone, Debug)]
515 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
516
517 impl WaitOperation {
518 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
519 Self(RequestBuilder::new(stub))
520 }
521
522 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
524 mut self,
525 v: V,
526 ) -> Self {
527 self.0.request = v.into();
528 self
529 }
530
531 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
533 self.0.options = v.into();
534 self
535 }
536
537 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
539 (*self.0.stub)
540 .wait_operation(self.0.request, self.0.options)
541 .await
542 .map(crate::Response::into_body)
543 }
544
545 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
547 self.0.request.name = v.into();
548 self
549 }
550
551 pub fn set_timeout<T>(mut self, v: T) -> Self
553 where
554 T: std::convert::Into<wkt::Duration>,
555 {
556 self.0.request.timeout = std::option::Option::Some(v.into());
557 self
558 }
559
560 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
562 where
563 T: std::convert::Into<wkt::Duration>,
564 {
565 self.0.request.timeout = v.map(|x| x.into());
566 self
567 }
568 }
569
570 #[doc(hidden)]
571 impl crate::RequestBuilder for WaitOperation {
572 fn request_options(&mut self) -> &mut crate::RequestOptions {
573 &mut self.0.options
574 }
575 }
576}
577
578pub mod executions {
580 use crate::Result;
581
582 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
596
597 pub(crate) mod client {
598 use super::super::super::client::Executions;
599 pub struct Factory;
600 impl crate::ClientFactory for Factory {
601 type Client = Executions;
602 type Credentials = gaxi::options::Credentials;
603 async fn build(
604 self,
605 config: gaxi::options::ClientConfig,
606 ) -> crate::ClientBuilderResult<Self::Client> {
607 Self::Client::new(config).await
608 }
609 }
610 }
611
612 #[derive(Clone, Debug)]
614 pub(crate) struct RequestBuilder<R: std::default::Default> {
615 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
616 request: R,
617 options: crate::RequestOptions,
618 }
619
620 impl<R> RequestBuilder<R>
621 where
622 R: std::default::Default,
623 {
624 pub(crate) fn new(
625 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
626 ) -> Self {
627 Self {
628 stub,
629 request: R::default(),
630 options: crate::RequestOptions::default(),
631 }
632 }
633 }
634
635 #[derive(Clone, Debug)]
652 pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
653
654 impl GetExecution {
655 pub(crate) fn new(
656 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
657 ) -> Self {
658 Self(RequestBuilder::new(stub))
659 }
660
661 pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
663 self.0.request = v.into();
664 self
665 }
666
667 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
669 self.0.options = v.into();
670 self
671 }
672
673 pub async fn send(self) -> Result<crate::model::Execution> {
675 (*self.0.stub)
676 .get_execution(self.0.request, self.0.options)
677 .await
678 .map(crate::Response::into_body)
679 }
680
681 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
685 self.0.request.name = v.into();
686 self
687 }
688 }
689
690 #[doc(hidden)]
691 impl crate::RequestBuilder for GetExecution {
692 fn request_options(&mut self) -> &mut crate::RequestOptions {
693 &mut self.0.options
694 }
695 }
696
697 #[derive(Clone, Debug)]
718 pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
719
720 impl ListExecutions {
721 pub(crate) fn new(
722 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
723 ) -> Self {
724 Self(RequestBuilder::new(stub))
725 }
726
727 pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
729 self.0.request = v.into();
730 self
731 }
732
733 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
735 self.0.options = v.into();
736 self
737 }
738
739 pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
741 (*self.0.stub)
742 .list_executions(self.0.request, self.0.options)
743 .await
744 .map(crate::Response::into_body)
745 }
746
747 pub fn by_page(
749 self,
750 ) -> impl google_cloud_gax::paginator::Paginator<
751 crate::model::ListExecutionsResponse,
752 crate::Error,
753 > {
754 use std::clone::Clone;
755 let token = self.0.request.page_token.clone();
756 let execute = move |token: String| {
757 let mut builder = self.clone();
758 builder.0.request = builder.0.request.set_page_token(token);
759 builder.send()
760 };
761 google_cloud_gax::paginator::internal::new_paginator(token, execute)
762 }
763
764 pub fn by_item(
766 self,
767 ) -> impl google_cloud_gax::paginator::ItemPaginator<
768 crate::model::ListExecutionsResponse,
769 crate::Error,
770 > {
771 use google_cloud_gax::paginator::Paginator;
772 self.by_page().items()
773 }
774
775 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
779 self.0.request.parent = v.into();
780 self
781 }
782
783 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
785 self.0.request.page_size = v.into();
786 self
787 }
788
789 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
791 self.0.request.page_token = v.into();
792 self
793 }
794
795 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
797 self.0.request.show_deleted = v.into();
798 self
799 }
800 }
801
802 #[doc(hidden)]
803 impl crate::RequestBuilder for ListExecutions {
804 fn request_options(&mut self) -> &mut crate::RequestOptions {
805 &mut self.0.options
806 }
807 }
808
809 #[derive(Clone, Debug)]
827 pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
828
829 impl DeleteExecution {
830 pub(crate) fn new(
831 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
832 ) -> Self {
833 Self(RequestBuilder::new(stub))
834 }
835
836 pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
838 self.0.request = v.into();
839 self
840 }
841
842 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
844 self.0.options = v.into();
845 self
846 }
847
848 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
855 (*self.0.stub)
856 .delete_execution(self.0.request, self.0.options)
857 .await
858 .map(crate::Response::into_body)
859 }
860
861 pub fn poller(
863 self,
864 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
865 {
866 type Operation = google_cloud_lro::internal::Operation<
867 crate::model::Execution,
868 crate::model::Execution,
869 >;
870 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
871 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
872 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
873 if let Some(ref mut details) = poller_options.tracing {
874 details.method_name =
875 "google_cloud_run_v2::client::Executions::delete_execution::until_done";
876 }
877
878 let stub = self.0.stub.clone();
879 let mut options = self.0.options.clone();
880 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
881 let query = move |name| {
882 let stub = stub.clone();
883 let options = options.clone();
884 async {
885 let op = GetOperation::new(stub)
886 .set_name(name)
887 .with_options(options)
888 .send()
889 .await?;
890 Ok(Operation::new(op))
891 }
892 };
893
894 let start = move || async {
895 let op = self.send().await?;
896 Ok(Operation::new(op))
897 };
898
899 use google_cloud_lro::internal::PollerExt;
900 {
901 google_cloud_lro::internal::new_poller(
902 polling_error_policy,
903 polling_backoff_policy,
904 start,
905 query,
906 )
907 }
908 .with_options(poller_options)
909 }
910
911 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
915 self.0.request.name = v.into();
916 self
917 }
918
919 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
921 self.0.request.validate_only = v.into();
922 self
923 }
924
925 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
927 self.0.request.etag = v.into();
928 self
929 }
930 }
931
932 #[doc(hidden)]
933 impl crate::RequestBuilder for DeleteExecution {
934 fn request_options(&mut self) -> &mut crate::RequestOptions {
935 &mut self.0.options
936 }
937 }
938
939 #[derive(Clone, Debug)]
957 pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
958
959 impl CancelExecution {
960 pub(crate) fn new(
961 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
962 ) -> Self {
963 Self(RequestBuilder::new(stub))
964 }
965
966 pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
968 self.0.request = v.into();
969 self
970 }
971
972 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
974 self.0.options = v.into();
975 self
976 }
977
978 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
985 (*self.0.stub)
986 .cancel_execution(self.0.request, self.0.options)
987 .await
988 .map(crate::Response::into_body)
989 }
990
991 pub fn poller(
993 self,
994 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
995 {
996 type Operation = google_cloud_lro::internal::Operation<
997 crate::model::Execution,
998 crate::model::Execution,
999 >;
1000 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1001 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1002 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1003 if let Some(ref mut details) = poller_options.tracing {
1004 details.method_name =
1005 "google_cloud_run_v2::client::Executions::cancel_execution::until_done";
1006 }
1007
1008 let stub = self.0.stub.clone();
1009 let mut options = self.0.options.clone();
1010 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1011 let query = move |name| {
1012 let stub = stub.clone();
1013 let options = options.clone();
1014 async {
1015 let op = GetOperation::new(stub)
1016 .set_name(name)
1017 .with_options(options)
1018 .send()
1019 .await?;
1020 Ok(Operation::new(op))
1021 }
1022 };
1023
1024 let start = move || async {
1025 let op = self.send().await?;
1026 Ok(Operation::new(op))
1027 };
1028
1029 use google_cloud_lro::internal::PollerExt;
1030 {
1031 google_cloud_lro::internal::new_poller(
1032 polling_error_policy,
1033 polling_backoff_policy,
1034 start,
1035 query,
1036 )
1037 }
1038 .with_options(poller_options)
1039 }
1040
1041 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1045 self.0.request.name = v.into();
1046 self
1047 }
1048
1049 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1051 self.0.request.validate_only = v.into();
1052 self
1053 }
1054
1055 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1057 self.0.request.etag = v.into();
1058 self
1059 }
1060 }
1061
1062 #[doc(hidden)]
1063 impl crate::RequestBuilder for CancelExecution {
1064 fn request_options(&mut self) -> &mut crate::RequestOptions {
1065 &mut self.0.options
1066 }
1067 }
1068
1069 #[derive(Clone, Debug)]
1090 pub struct ListOperations(
1091 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1092 );
1093
1094 impl ListOperations {
1095 pub(crate) fn new(
1096 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1097 ) -> Self {
1098 Self(RequestBuilder::new(stub))
1099 }
1100
1101 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1103 mut self,
1104 v: V,
1105 ) -> Self {
1106 self.0.request = v.into();
1107 self
1108 }
1109
1110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1112 self.0.options = v.into();
1113 self
1114 }
1115
1116 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1118 (*self.0.stub)
1119 .list_operations(self.0.request, self.0.options)
1120 .await
1121 .map(crate::Response::into_body)
1122 }
1123
1124 pub fn by_page(
1126 self,
1127 ) -> impl google_cloud_gax::paginator::Paginator<
1128 google_cloud_longrunning::model::ListOperationsResponse,
1129 crate::Error,
1130 > {
1131 use std::clone::Clone;
1132 let token = self.0.request.page_token.clone();
1133 let execute = move |token: String| {
1134 let mut builder = self.clone();
1135 builder.0.request = builder.0.request.set_page_token(token);
1136 builder.send()
1137 };
1138 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1139 }
1140
1141 pub fn by_item(
1143 self,
1144 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1145 google_cloud_longrunning::model::ListOperationsResponse,
1146 crate::Error,
1147 > {
1148 use google_cloud_gax::paginator::Paginator;
1149 self.by_page().items()
1150 }
1151
1152 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1154 self.0.request.name = v.into();
1155 self
1156 }
1157
1158 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1160 self.0.request.filter = v.into();
1161 self
1162 }
1163
1164 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1166 self.0.request.page_size = v.into();
1167 self
1168 }
1169
1170 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1172 self.0.request.page_token = v.into();
1173 self
1174 }
1175
1176 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1178 self.0.request.return_partial_success = v.into();
1179 self
1180 }
1181 }
1182
1183 #[doc(hidden)]
1184 impl crate::RequestBuilder for ListOperations {
1185 fn request_options(&mut self) -> &mut crate::RequestOptions {
1186 &mut self.0.options
1187 }
1188 }
1189
1190 #[derive(Clone, Debug)]
1207 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1208
1209 impl GetOperation {
1210 pub(crate) fn new(
1211 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1212 ) -> Self {
1213 Self(RequestBuilder::new(stub))
1214 }
1215
1216 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1218 mut self,
1219 v: V,
1220 ) -> Self {
1221 self.0.request = v.into();
1222 self
1223 }
1224
1225 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1227 self.0.options = v.into();
1228 self
1229 }
1230
1231 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1233 (*self.0.stub)
1234 .get_operation(self.0.request, self.0.options)
1235 .await
1236 .map(crate::Response::into_body)
1237 }
1238
1239 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1241 self.0.request.name = v.into();
1242 self
1243 }
1244 }
1245
1246 #[doc(hidden)]
1247 impl crate::RequestBuilder for GetOperation {
1248 fn request_options(&mut self) -> &mut crate::RequestOptions {
1249 &mut self.0.options
1250 }
1251 }
1252
1253 #[derive(Clone, Debug)]
1270 pub struct DeleteOperation(
1271 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1272 );
1273
1274 impl DeleteOperation {
1275 pub(crate) fn new(
1276 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1277 ) -> Self {
1278 Self(RequestBuilder::new(stub))
1279 }
1280
1281 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1283 mut self,
1284 v: V,
1285 ) -> Self {
1286 self.0.request = v.into();
1287 self
1288 }
1289
1290 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1292 self.0.options = v.into();
1293 self
1294 }
1295
1296 pub async fn send(self) -> Result<()> {
1298 (*self.0.stub)
1299 .delete_operation(self.0.request, self.0.options)
1300 .await
1301 .map(crate::Response::into_body)
1302 }
1303
1304 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1306 self.0.request.name = v.into();
1307 self
1308 }
1309 }
1310
1311 #[doc(hidden)]
1312 impl crate::RequestBuilder for DeleteOperation {
1313 fn request_options(&mut self) -> &mut crate::RequestOptions {
1314 &mut self.0.options
1315 }
1316 }
1317
1318 #[derive(Clone, Debug)]
1335 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
1336
1337 impl WaitOperation {
1338 pub(crate) fn new(
1339 stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1340 ) -> Self {
1341 Self(RequestBuilder::new(stub))
1342 }
1343
1344 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
1346 mut self,
1347 v: V,
1348 ) -> Self {
1349 self.0.request = v.into();
1350 self
1351 }
1352
1353 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1355 self.0.options = v.into();
1356 self
1357 }
1358
1359 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1361 (*self.0.stub)
1362 .wait_operation(self.0.request, self.0.options)
1363 .await
1364 .map(crate::Response::into_body)
1365 }
1366
1367 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1369 self.0.request.name = v.into();
1370 self
1371 }
1372
1373 pub fn set_timeout<T>(mut self, v: T) -> Self
1375 where
1376 T: std::convert::Into<wkt::Duration>,
1377 {
1378 self.0.request.timeout = std::option::Option::Some(v.into());
1379 self
1380 }
1381
1382 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1384 where
1385 T: std::convert::Into<wkt::Duration>,
1386 {
1387 self.0.request.timeout = v.map(|x| x.into());
1388 self
1389 }
1390 }
1391
1392 #[doc(hidden)]
1393 impl crate::RequestBuilder for WaitOperation {
1394 fn request_options(&mut self) -> &mut crate::RequestOptions {
1395 &mut self.0.options
1396 }
1397 }
1398}
1399
1400pub mod instances {
1402 use crate::Result;
1403
1404 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1418
1419 pub(crate) mod client {
1420 use super::super::super::client::Instances;
1421 pub struct Factory;
1422 impl crate::ClientFactory for Factory {
1423 type Client = Instances;
1424 type Credentials = gaxi::options::Credentials;
1425 async fn build(
1426 self,
1427 config: gaxi::options::ClientConfig,
1428 ) -> crate::ClientBuilderResult<Self::Client> {
1429 Self::Client::new(config).await
1430 }
1431 }
1432 }
1433
1434 #[derive(Clone, Debug)]
1436 pub(crate) struct RequestBuilder<R: std::default::Default> {
1437 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1438 request: R,
1439 options: crate::RequestOptions,
1440 }
1441
1442 impl<R> RequestBuilder<R>
1443 where
1444 R: std::default::Default,
1445 {
1446 pub(crate) fn new(
1447 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1448 ) -> Self {
1449 Self {
1450 stub,
1451 request: R::default(),
1452 options: crate::RequestOptions::default(),
1453 }
1454 }
1455 }
1456
1457 #[derive(Clone, Debug)]
1475 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1476
1477 impl CreateInstance {
1478 pub(crate) fn new(
1479 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1480 ) -> Self {
1481 Self(RequestBuilder::new(stub))
1482 }
1483
1484 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1486 self.0.request = v.into();
1487 self
1488 }
1489
1490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1492 self.0.options = v.into();
1493 self
1494 }
1495
1496 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1503 (*self.0.stub)
1504 .create_instance(self.0.request, self.0.options)
1505 .await
1506 .map(crate::Response::into_body)
1507 }
1508
1509 pub fn poller(
1511 self,
1512 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1513 type Operation = google_cloud_lro::internal::Operation<
1514 crate::model::Instance,
1515 crate::model::Instance,
1516 >;
1517 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1518 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1519 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1520 if let Some(ref mut details) = poller_options.tracing {
1521 details.method_name =
1522 "google_cloud_run_v2::client::Instances::create_instance::until_done";
1523 }
1524
1525 let stub = self.0.stub.clone();
1526 let mut options = self.0.options.clone();
1527 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1528 let query = move |name| {
1529 let stub = stub.clone();
1530 let options = options.clone();
1531 async {
1532 let op = GetOperation::new(stub)
1533 .set_name(name)
1534 .with_options(options)
1535 .send()
1536 .await?;
1537 Ok(Operation::new(op))
1538 }
1539 };
1540
1541 let start = move || async {
1542 let op = self.send().await?;
1543 Ok(Operation::new(op))
1544 };
1545
1546 use google_cloud_lro::internal::PollerExt;
1547 {
1548 google_cloud_lro::internal::new_poller(
1549 polling_error_policy,
1550 polling_backoff_policy,
1551 start,
1552 query,
1553 )
1554 }
1555 .with_options(poller_options)
1556 }
1557
1558 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.0.request.parent = v.into();
1563 self
1564 }
1565
1566 pub fn set_instance<T>(mut self, v: T) -> Self
1570 where
1571 T: std::convert::Into<crate::model::Instance>,
1572 {
1573 self.0.request.instance = std::option::Option::Some(v.into());
1574 self
1575 }
1576
1577 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1581 where
1582 T: std::convert::Into<crate::model::Instance>,
1583 {
1584 self.0.request.instance = v.map(|x| x.into());
1585 self
1586 }
1587
1588 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1592 self.0.request.instance_id = v.into();
1593 self
1594 }
1595
1596 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1598 self.0.request.validate_only = v.into();
1599 self
1600 }
1601 }
1602
1603 #[doc(hidden)]
1604 impl crate::RequestBuilder for CreateInstance {
1605 fn request_options(&mut self) -> &mut crate::RequestOptions {
1606 &mut self.0.options
1607 }
1608 }
1609
1610 #[derive(Clone, Debug)]
1628 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1629
1630 impl DeleteInstance {
1631 pub(crate) fn new(
1632 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1633 ) -> Self {
1634 Self(RequestBuilder::new(stub))
1635 }
1636
1637 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1639 self.0.request = v.into();
1640 self
1641 }
1642
1643 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1645 self.0.options = v.into();
1646 self
1647 }
1648
1649 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1656 (*self.0.stub)
1657 .delete_instance(self.0.request, self.0.options)
1658 .await
1659 .map(crate::Response::into_body)
1660 }
1661
1662 pub fn poller(
1664 self,
1665 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1666 type Operation = google_cloud_lro::internal::Operation<
1667 crate::model::Instance,
1668 crate::model::Instance,
1669 >;
1670 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1671 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1672 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1673 if let Some(ref mut details) = poller_options.tracing {
1674 details.method_name =
1675 "google_cloud_run_v2::client::Instances::delete_instance::until_done";
1676 }
1677
1678 let stub = self.0.stub.clone();
1679 let mut options = self.0.options.clone();
1680 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1681 let query = move |name| {
1682 let stub = stub.clone();
1683 let options = options.clone();
1684 async {
1685 let op = GetOperation::new(stub)
1686 .set_name(name)
1687 .with_options(options)
1688 .send()
1689 .await?;
1690 Ok(Operation::new(op))
1691 }
1692 };
1693
1694 let start = move || async {
1695 let op = self.send().await?;
1696 Ok(Operation::new(op))
1697 };
1698
1699 use google_cloud_lro::internal::PollerExt;
1700 {
1701 google_cloud_lro::internal::new_poller(
1702 polling_error_policy,
1703 polling_backoff_policy,
1704 start,
1705 query,
1706 )
1707 }
1708 .with_options(poller_options)
1709 }
1710
1711 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715 self.0.request.name = v.into();
1716 self
1717 }
1718
1719 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1721 self.0.request.validate_only = v.into();
1722 self
1723 }
1724
1725 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1727 self.0.request.etag = v.into();
1728 self
1729 }
1730 }
1731
1732 #[doc(hidden)]
1733 impl crate::RequestBuilder for DeleteInstance {
1734 fn request_options(&mut self) -> &mut crate::RequestOptions {
1735 &mut self.0.options
1736 }
1737 }
1738
1739 #[derive(Clone, Debug)]
1756 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1757
1758 impl GetInstance {
1759 pub(crate) fn new(
1760 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1761 ) -> Self {
1762 Self(RequestBuilder::new(stub))
1763 }
1764
1765 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1767 self.0.request = v.into();
1768 self
1769 }
1770
1771 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1773 self.0.options = v.into();
1774 self
1775 }
1776
1777 pub async fn send(self) -> Result<crate::model::Instance> {
1779 (*self.0.stub)
1780 .get_instance(self.0.request, self.0.options)
1781 .await
1782 .map(crate::Response::into_body)
1783 }
1784
1785 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1789 self.0.request.name = v.into();
1790 self
1791 }
1792 }
1793
1794 #[doc(hidden)]
1795 impl crate::RequestBuilder for GetInstance {
1796 fn request_options(&mut self) -> &mut crate::RequestOptions {
1797 &mut self.0.options
1798 }
1799 }
1800
1801 #[derive(Clone, Debug)]
1822 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
1823
1824 impl ListInstances {
1825 pub(crate) fn new(
1826 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1827 ) -> Self {
1828 Self(RequestBuilder::new(stub))
1829 }
1830
1831 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
1833 self.0.request = v.into();
1834 self
1835 }
1836
1837 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1839 self.0.options = v.into();
1840 self
1841 }
1842
1843 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
1845 (*self.0.stub)
1846 .list_instances(self.0.request, self.0.options)
1847 .await
1848 .map(crate::Response::into_body)
1849 }
1850
1851 pub fn by_page(
1853 self,
1854 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
1855 {
1856 use std::clone::Clone;
1857 let token = self.0.request.page_token.clone();
1858 let execute = move |token: String| {
1859 let mut builder = self.clone();
1860 builder.0.request = builder.0.request.set_page_token(token);
1861 builder.send()
1862 };
1863 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1864 }
1865
1866 pub fn by_item(
1868 self,
1869 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1870 crate::model::ListInstancesResponse,
1871 crate::Error,
1872 > {
1873 use google_cloud_gax::paginator::Paginator;
1874 self.by_page().items()
1875 }
1876
1877 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1881 self.0.request.parent = v.into();
1882 self
1883 }
1884
1885 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1887 self.0.request.page_size = v.into();
1888 self
1889 }
1890
1891 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1893 self.0.request.page_token = v.into();
1894 self
1895 }
1896
1897 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1899 self.0.request.show_deleted = v.into();
1900 self
1901 }
1902 }
1903
1904 #[doc(hidden)]
1905 impl crate::RequestBuilder for ListInstances {
1906 fn request_options(&mut self) -> &mut crate::RequestOptions {
1907 &mut self.0.options
1908 }
1909 }
1910
1911 #[derive(Clone, Debug)]
1929 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
1930
1931 impl StopInstance {
1932 pub(crate) fn new(
1933 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
1934 ) -> Self {
1935 Self(RequestBuilder::new(stub))
1936 }
1937
1938 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
1940 self.0.request = v.into();
1941 self
1942 }
1943
1944 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1946 self.0.options = v.into();
1947 self
1948 }
1949
1950 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1957 (*self.0.stub)
1958 .stop_instance(self.0.request, self.0.options)
1959 .await
1960 .map(crate::Response::into_body)
1961 }
1962
1963 pub fn poller(
1965 self,
1966 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
1967 type Operation = google_cloud_lro::internal::Operation<
1968 crate::model::Instance,
1969 crate::model::Instance,
1970 >;
1971 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1972 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1973 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1974 if let Some(ref mut details) = poller_options.tracing {
1975 details.method_name =
1976 "google_cloud_run_v2::client::Instances::stop_instance::until_done";
1977 }
1978
1979 let stub = self.0.stub.clone();
1980 let mut options = self.0.options.clone();
1981 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1982 let query = move |name| {
1983 let stub = stub.clone();
1984 let options = options.clone();
1985 async {
1986 let op = GetOperation::new(stub)
1987 .set_name(name)
1988 .with_options(options)
1989 .send()
1990 .await?;
1991 Ok(Operation::new(op))
1992 }
1993 };
1994
1995 let start = move || async {
1996 let op = self.send().await?;
1997 Ok(Operation::new(op))
1998 };
1999
2000 use google_cloud_lro::internal::PollerExt;
2001 {
2002 google_cloud_lro::internal::new_poller(
2003 polling_error_policy,
2004 polling_backoff_policy,
2005 start,
2006 query,
2007 )
2008 }
2009 .with_options(poller_options)
2010 }
2011
2012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2016 self.0.request.name = v.into();
2017 self
2018 }
2019
2020 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2022 self.0.request.validate_only = v.into();
2023 self
2024 }
2025
2026 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2028 self.0.request.etag = v.into();
2029 self
2030 }
2031 }
2032
2033 #[doc(hidden)]
2034 impl crate::RequestBuilder for StopInstance {
2035 fn request_options(&mut self) -> &mut crate::RequestOptions {
2036 &mut self.0.options
2037 }
2038 }
2039
2040 #[derive(Clone, Debug)]
2058 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
2059
2060 impl StartInstance {
2061 pub(crate) fn new(
2062 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2063 ) -> Self {
2064 Self(RequestBuilder::new(stub))
2065 }
2066
2067 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
2069 self.0.request = v.into();
2070 self
2071 }
2072
2073 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2075 self.0.options = v.into();
2076 self
2077 }
2078
2079 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2086 (*self.0.stub)
2087 .start_instance(self.0.request, self.0.options)
2088 .await
2089 .map(crate::Response::into_body)
2090 }
2091
2092 pub fn poller(
2094 self,
2095 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::Instance> {
2096 type Operation = google_cloud_lro::internal::Operation<
2097 crate::model::Instance,
2098 crate::model::Instance,
2099 >;
2100 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2101 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2102 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2103 if let Some(ref mut details) = poller_options.tracing {
2104 details.method_name =
2105 "google_cloud_run_v2::client::Instances::start_instance::until_done";
2106 }
2107
2108 let stub = self.0.stub.clone();
2109 let mut options = self.0.options.clone();
2110 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2111 let query = move |name| {
2112 let stub = stub.clone();
2113 let options = options.clone();
2114 async {
2115 let op = GetOperation::new(stub)
2116 .set_name(name)
2117 .with_options(options)
2118 .send()
2119 .await?;
2120 Ok(Operation::new(op))
2121 }
2122 };
2123
2124 let start = move || async {
2125 let op = self.send().await?;
2126 Ok(Operation::new(op))
2127 };
2128
2129 use google_cloud_lro::internal::PollerExt;
2130 {
2131 google_cloud_lro::internal::new_poller(
2132 polling_error_policy,
2133 polling_backoff_policy,
2134 start,
2135 query,
2136 )
2137 }
2138 .with_options(poller_options)
2139 }
2140
2141 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2145 self.0.request.name = v.into();
2146 self
2147 }
2148
2149 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2151 self.0.request.validate_only = v.into();
2152 self
2153 }
2154
2155 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2157 self.0.request.etag = v.into();
2158 self
2159 }
2160 }
2161
2162 #[doc(hidden)]
2163 impl crate::RequestBuilder for StartInstance {
2164 fn request_options(&mut self) -> &mut crate::RequestOptions {
2165 &mut self.0.options
2166 }
2167 }
2168
2169 #[derive(Clone, Debug)]
2190 pub struct ListOperations(
2191 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2192 );
2193
2194 impl ListOperations {
2195 pub(crate) fn new(
2196 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2197 ) -> Self {
2198 Self(RequestBuilder::new(stub))
2199 }
2200
2201 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2203 mut self,
2204 v: V,
2205 ) -> Self {
2206 self.0.request = v.into();
2207 self
2208 }
2209
2210 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2212 self.0.options = v.into();
2213 self
2214 }
2215
2216 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2218 (*self.0.stub)
2219 .list_operations(self.0.request, self.0.options)
2220 .await
2221 .map(crate::Response::into_body)
2222 }
2223
2224 pub fn by_page(
2226 self,
2227 ) -> impl google_cloud_gax::paginator::Paginator<
2228 google_cloud_longrunning::model::ListOperationsResponse,
2229 crate::Error,
2230 > {
2231 use std::clone::Clone;
2232 let token = self.0.request.page_token.clone();
2233 let execute = move |token: String| {
2234 let mut builder = self.clone();
2235 builder.0.request = builder.0.request.set_page_token(token);
2236 builder.send()
2237 };
2238 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2239 }
2240
2241 pub fn by_item(
2243 self,
2244 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2245 google_cloud_longrunning::model::ListOperationsResponse,
2246 crate::Error,
2247 > {
2248 use google_cloud_gax::paginator::Paginator;
2249 self.by_page().items()
2250 }
2251
2252 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2254 self.0.request.name = v.into();
2255 self
2256 }
2257
2258 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2260 self.0.request.filter = v.into();
2261 self
2262 }
2263
2264 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2266 self.0.request.page_size = v.into();
2267 self
2268 }
2269
2270 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2272 self.0.request.page_token = v.into();
2273 self
2274 }
2275
2276 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2278 self.0.request.return_partial_success = v.into();
2279 self
2280 }
2281 }
2282
2283 #[doc(hidden)]
2284 impl crate::RequestBuilder for ListOperations {
2285 fn request_options(&mut self) -> &mut crate::RequestOptions {
2286 &mut self.0.options
2287 }
2288 }
2289
2290 #[derive(Clone, Debug)]
2307 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2308
2309 impl GetOperation {
2310 pub(crate) fn new(
2311 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2312 ) -> Self {
2313 Self(RequestBuilder::new(stub))
2314 }
2315
2316 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2318 mut self,
2319 v: V,
2320 ) -> Self {
2321 self.0.request = v.into();
2322 self
2323 }
2324
2325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2327 self.0.options = v.into();
2328 self
2329 }
2330
2331 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2333 (*self.0.stub)
2334 .get_operation(self.0.request, self.0.options)
2335 .await
2336 .map(crate::Response::into_body)
2337 }
2338
2339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2341 self.0.request.name = v.into();
2342 self
2343 }
2344 }
2345
2346 #[doc(hidden)]
2347 impl crate::RequestBuilder for GetOperation {
2348 fn request_options(&mut self) -> &mut crate::RequestOptions {
2349 &mut self.0.options
2350 }
2351 }
2352
2353 #[derive(Clone, Debug)]
2370 pub struct DeleteOperation(
2371 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2372 );
2373
2374 impl DeleteOperation {
2375 pub(crate) fn new(
2376 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2377 ) -> Self {
2378 Self(RequestBuilder::new(stub))
2379 }
2380
2381 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2383 mut self,
2384 v: V,
2385 ) -> Self {
2386 self.0.request = v.into();
2387 self
2388 }
2389
2390 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2392 self.0.options = v.into();
2393 self
2394 }
2395
2396 pub async fn send(self) -> Result<()> {
2398 (*self.0.stub)
2399 .delete_operation(self.0.request, self.0.options)
2400 .await
2401 .map(crate::Response::into_body)
2402 }
2403
2404 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2406 self.0.request.name = v.into();
2407 self
2408 }
2409 }
2410
2411 #[doc(hidden)]
2412 impl crate::RequestBuilder for DeleteOperation {
2413 fn request_options(&mut self) -> &mut crate::RequestOptions {
2414 &mut self.0.options
2415 }
2416 }
2417
2418 #[derive(Clone, Debug)]
2435 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
2436
2437 impl WaitOperation {
2438 pub(crate) fn new(
2439 stub: std::sync::Arc<dyn super::super::stub::dynamic::Instances>,
2440 ) -> Self {
2441 Self(RequestBuilder::new(stub))
2442 }
2443
2444 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
2446 mut self,
2447 v: V,
2448 ) -> Self {
2449 self.0.request = v.into();
2450 self
2451 }
2452
2453 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2455 self.0.options = v.into();
2456 self
2457 }
2458
2459 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2461 (*self.0.stub)
2462 .wait_operation(self.0.request, self.0.options)
2463 .await
2464 .map(crate::Response::into_body)
2465 }
2466
2467 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2469 self.0.request.name = v.into();
2470 self
2471 }
2472
2473 pub fn set_timeout<T>(mut self, v: T) -> Self
2475 where
2476 T: std::convert::Into<wkt::Duration>,
2477 {
2478 self.0.request.timeout = std::option::Option::Some(v.into());
2479 self
2480 }
2481
2482 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2484 where
2485 T: std::convert::Into<wkt::Duration>,
2486 {
2487 self.0.request.timeout = v.map(|x| x.into());
2488 self
2489 }
2490 }
2491
2492 #[doc(hidden)]
2493 impl crate::RequestBuilder for WaitOperation {
2494 fn request_options(&mut self) -> &mut crate::RequestOptions {
2495 &mut self.0.options
2496 }
2497 }
2498}
2499
2500pub mod jobs {
2502 use crate::Result;
2503
2504 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2518
2519 pub(crate) mod client {
2520 use super::super::super::client::Jobs;
2521 pub struct Factory;
2522 impl crate::ClientFactory for Factory {
2523 type Client = Jobs;
2524 type Credentials = gaxi::options::Credentials;
2525 async fn build(
2526 self,
2527 config: gaxi::options::ClientConfig,
2528 ) -> crate::ClientBuilderResult<Self::Client> {
2529 Self::Client::new(config).await
2530 }
2531 }
2532 }
2533
2534 #[derive(Clone, Debug)]
2536 pub(crate) struct RequestBuilder<R: std::default::Default> {
2537 stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
2538 request: R,
2539 options: crate::RequestOptions,
2540 }
2541
2542 impl<R> RequestBuilder<R>
2543 where
2544 R: std::default::Default,
2545 {
2546 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2547 Self {
2548 stub,
2549 request: R::default(),
2550 options: crate::RequestOptions::default(),
2551 }
2552 }
2553 }
2554
2555 #[derive(Clone, Debug)]
2573 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
2574
2575 impl CreateJob {
2576 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2577 Self(RequestBuilder::new(stub))
2578 }
2579
2580 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
2582 self.0.request = v.into();
2583 self
2584 }
2585
2586 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2588 self.0.options = v.into();
2589 self
2590 }
2591
2592 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2599 (*self.0.stub)
2600 .create_job(self.0.request, self.0.options)
2601 .await
2602 .map(crate::Response::into_body)
2603 }
2604
2605 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2607 type Operation =
2608 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2609 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2610 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2611 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2612 if let Some(ref mut details) = poller_options.tracing {
2613 details.method_name = "google_cloud_run_v2::client::Jobs::create_job::until_done";
2614 }
2615
2616 let stub = self.0.stub.clone();
2617 let mut options = self.0.options.clone();
2618 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2619 let query = move |name| {
2620 let stub = stub.clone();
2621 let options = options.clone();
2622 async {
2623 let op = GetOperation::new(stub)
2624 .set_name(name)
2625 .with_options(options)
2626 .send()
2627 .await?;
2628 Ok(Operation::new(op))
2629 }
2630 };
2631
2632 let start = move || async {
2633 let op = self.send().await?;
2634 Ok(Operation::new(op))
2635 };
2636
2637 use google_cloud_lro::internal::PollerExt;
2638 {
2639 google_cloud_lro::internal::new_poller(
2640 polling_error_policy,
2641 polling_backoff_policy,
2642 start,
2643 query,
2644 )
2645 }
2646 .with_options(poller_options)
2647 }
2648
2649 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2653 self.0.request.parent = v.into();
2654 self
2655 }
2656
2657 pub fn set_job<T>(mut self, v: T) -> Self
2661 where
2662 T: std::convert::Into<crate::model::Job>,
2663 {
2664 self.0.request.job = std::option::Option::Some(v.into());
2665 self
2666 }
2667
2668 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2672 where
2673 T: std::convert::Into<crate::model::Job>,
2674 {
2675 self.0.request.job = v.map(|x| x.into());
2676 self
2677 }
2678
2679 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.0.request.job_id = v.into();
2684 self
2685 }
2686
2687 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2689 self.0.request.validate_only = v.into();
2690 self
2691 }
2692 }
2693
2694 #[doc(hidden)]
2695 impl crate::RequestBuilder for CreateJob {
2696 fn request_options(&mut self) -> &mut crate::RequestOptions {
2697 &mut self.0.options
2698 }
2699 }
2700
2701 #[derive(Clone, Debug)]
2718 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
2719
2720 impl GetJob {
2721 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2722 Self(RequestBuilder::new(stub))
2723 }
2724
2725 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
2727 self.0.request = v.into();
2728 self
2729 }
2730
2731 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2733 self.0.options = v.into();
2734 self
2735 }
2736
2737 pub async fn send(self) -> Result<crate::model::Job> {
2739 (*self.0.stub)
2740 .get_job(self.0.request, self.0.options)
2741 .await
2742 .map(crate::Response::into_body)
2743 }
2744
2745 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2749 self.0.request.name = v.into();
2750 self
2751 }
2752 }
2753
2754 #[doc(hidden)]
2755 impl crate::RequestBuilder for GetJob {
2756 fn request_options(&mut self) -> &mut crate::RequestOptions {
2757 &mut self.0.options
2758 }
2759 }
2760
2761 #[derive(Clone, Debug)]
2782 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
2783
2784 impl ListJobs {
2785 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2786 Self(RequestBuilder::new(stub))
2787 }
2788
2789 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
2791 self.0.request = v.into();
2792 self
2793 }
2794
2795 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2797 self.0.options = v.into();
2798 self
2799 }
2800
2801 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
2803 (*self.0.stub)
2804 .list_jobs(self.0.request, self.0.options)
2805 .await
2806 .map(crate::Response::into_body)
2807 }
2808
2809 pub fn by_page(
2811 self,
2812 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
2813 {
2814 use std::clone::Clone;
2815 let token = self.0.request.page_token.clone();
2816 let execute = move |token: String| {
2817 let mut builder = self.clone();
2818 builder.0.request = builder.0.request.set_page_token(token);
2819 builder.send()
2820 };
2821 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2822 }
2823
2824 pub fn by_item(
2826 self,
2827 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
2828 {
2829 use google_cloud_gax::paginator::Paginator;
2830 self.by_page().items()
2831 }
2832
2833 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2837 self.0.request.parent = v.into();
2838 self
2839 }
2840
2841 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2843 self.0.request.page_size = v.into();
2844 self
2845 }
2846
2847 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849 self.0.request.page_token = v.into();
2850 self
2851 }
2852
2853 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2855 self.0.request.show_deleted = v.into();
2856 self
2857 }
2858 }
2859
2860 #[doc(hidden)]
2861 impl crate::RequestBuilder for ListJobs {
2862 fn request_options(&mut self) -> &mut crate::RequestOptions {
2863 &mut self.0.options
2864 }
2865 }
2866
2867 #[derive(Clone, Debug)]
2885 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
2886
2887 impl UpdateJob {
2888 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2889 Self(RequestBuilder::new(stub))
2890 }
2891
2892 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
2894 self.0.request = v.into();
2895 self
2896 }
2897
2898 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2900 self.0.options = v.into();
2901 self
2902 }
2903
2904 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2911 (*self.0.stub)
2912 .update_job(self.0.request, self.0.options)
2913 .await
2914 .map(crate::Response::into_body)
2915 }
2916
2917 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
2919 type Operation =
2920 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
2921 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2922 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2923 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2924 if let Some(ref mut details) = poller_options.tracing {
2925 details.method_name = "google_cloud_run_v2::client::Jobs::update_job::until_done";
2926 }
2927
2928 let stub = self.0.stub.clone();
2929 let mut options = self.0.options.clone();
2930 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2931 let query = move |name| {
2932 let stub = stub.clone();
2933 let options = options.clone();
2934 async {
2935 let op = GetOperation::new(stub)
2936 .set_name(name)
2937 .with_options(options)
2938 .send()
2939 .await?;
2940 Ok(Operation::new(op))
2941 }
2942 };
2943
2944 let start = move || async {
2945 let op = self.send().await?;
2946 Ok(Operation::new(op))
2947 };
2948
2949 use google_cloud_lro::internal::PollerExt;
2950 {
2951 google_cloud_lro::internal::new_poller(
2952 polling_error_policy,
2953 polling_backoff_policy,
2954 start,
2955 query,
2956 )
2957 }
2958 .with_options(poller_options)
2959 }
2960
2961 pub fn set_job<T>(mut self, v: T) -> Self
2965 where
2966 T: std::convert::Into<crate::model::Job>,
2967 {
2968 self.0.request.job = std::option::Option::Some(v.into());
2969 self
2970 }
2971
2972 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
2976 where
2977 T: std::convert::Into<crate::model::Job>,
2978 {
2979 self.0.request.job = v.map(|x| x.into());
2980 self
2981 }
2982
2983 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2985 self.0.request.validate_only = v.into();
2986 self
2987 }
2988
2989 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2991 self.0.request.allow_missing = v.into();
2992 self
2993 }
2994 }
2995
2996 #[doc(hidden)]
2997 impl crate::RequestBuilder for UpdateJob {
2998 fn request_options(&mut self) -> &mut crate::RequestOptions {
2999 &mut self.0.options
3000 }
3001 }
3002
3003 #[derive(Clone, Debug)]
3021 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
3022
3023 impl DeleteJob {
3024 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3025 Self(RequestBuilder::new(stub))
3026 }
3027
3028 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
3030 self.0.request = v.into();
3031 self
3032 }
3033
3034 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3036 self.0.options = v.into();
3037 self
3038 }
3039
3040 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3047 (*self.0.stub)
3048 .delete_job(self.0.request, self.0.options)
3049 .await
3050 .map(crate::Response::into_body)
3051 }
3052
3053 pub fn poller(self) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::Job> {
3055 type Operation =
3056 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::Job>;
3057 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3058 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3059 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3060 if let Some(ref mut details) = poller_options.tracing {
3061 details.method_name = "google_cloud_run_v2::client::Jobs::delete_job::until_done";
3062 }
3063
3064 let stub = self.0.stub.clone();
3065 let mut options = self.0.options.clone();
3066 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3067 let query = move |name| {
3068 let stub = stub.clone();
3069 let options = options.clone();
3070 async {
3071 let op = GetOperation::new(stub)
3072 .set_name(name)
3073 .with_options(options)
3074 .send()
3075 .await?;
3076 Ok(Operation::new(op))
3077 }
3078 };
3079
3080 let start = move || async {
3081 let op = self.send().await?;
3082 Ok(Operation::new(op))
3083 };
3084
3085 use google_cloud_lro::internal::PollerExt;
3086 {
3087 google_cloud_lro::internal::new_poller(
3088 polling_error_policy,
3089 polling_backoff_policy,
3090 start,
3091 query,
3092 )
3093 }
3094 .with_options(poller_options)
3095 }
3096
3097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3101 self.0.request.name = v.into();
3102 self
3103 }
3104
3105 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3107 self.0.request.validate_only = v.into();
3108 self
3109 }
3110
3111 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3113 self.0.request.etag = v.into();
3114 self
3115 }
3116 }
3117
3118 #[doc(hidden)]
3119 impl crate::RequestBuilder for DeleteJob {
3120 fn request_options(&mut self) -> &mut crate::RequestOptions {
3121 &mut self.0.options
3122 }
3123 }
3124
3125 #[derive(Clone, Debug)]
3143 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
3144
3145 impl RunJob {
3146 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3147 Self(RequestBuilder::new(stub))
3148 }
3149
3150 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
3152 self.0.request = v.into();
3153 self
3154 }
3155
3156 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3158 self.0.options = v.into();
3159 self
3160 }
3161
3162 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3169 (*self.0.stub)
3170 .run_job(self.0.request, self.0.options)
3171 .await
3172 .map(crate::Response::into_body)
3173 }
3174
3175 pub fn poller(
3177 self,
3178 ) -> impl google_cloud_lro::Poller<crate::model::Execution, crate::model::Execution>
3179 {
3180 type Operation = google_cloud_lro::internal::Operation<
3181 crate::model::Execution,
3182 crate::model::Execution,
3183 >;
3184 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3185 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3186 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3187 if let Some(ref mut details) = poller_options.tracing {
3188 details.method_name = "google_cloud_run_v2::client::Jobs::run_job::until_done";
3189 }
3190
3191 let stub = self.0.stub.clone();
3192 let mut options = self.0.options.clone();
3193 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3194 let query = move |name| {
3195 let stub = stub.clone();
3196 let options = options.clone();
3197 async {
3198 let op = GetOperation::new(stub)
3199 .set_name(name)
3200 .with_options(options)
3201 .send()
3202 .await?;
3203 Ok(Operation::new(op))
3204 }
3205 };
3206
3207 let start = move || async {
3208 let op = self.send().await?;
3209 Ok(Operation::new(op))
3210 };
3211
3212 use google_cloud_lro::internal::PollerExt;
3213 {
3214 google_cloud_lro::internal::new_poller(
3215 polling_error_policy,
3216 polling_backoff_policy,
3217 start,
3218 query,
3219 )
3220 }
3221 .with_options(poller_options)
3222 }
3223
3224 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3228 self.0.request.name = v.into();
3229 self
3230 }
3231
3232 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3234 self.0.request.validate_only = v.into();
3235 self
3236 }
3237
3238 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3240 self.0.request.etag = v.into();
3241 self
3242 }
3243
3244 pub fn set_overrides<T>(mut self, v: T) -> Self
3246 where
3247 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3248 {
3249 self.0.request.overrides = std::option::Option::Some(v.into());
3250 self
3251 }
3252
3253 pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
3255 where
3256 T: std::convert::Into<crate::model::run_job_request::Overrides>,
3257 {
3258 self.0.request.overrides = v.map(|x| x.into());
3259 self
3260 }
3261 }
3262
3263 #[doc(hidden)]
3264 impl crate::RequestBuilder for RunJob {
3265 fn request_options(&mut self) -> &mut crate::RequestOptions {
3266 &mut self.0.options
3267 }
3268 }
3269
3270 #[derive(Clone, Debug)]
3287 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3288
3289 impl GetIamPolicy {
3290 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3291 Self(RequestBuilder::new(stub))
3292 }
3293
3294 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3296 mut self,
3297 v: V,
3298 ) -> Self {
3299 self.0.request = v.into();
3300 self
3301 }
3302
3303 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3305 self.0.options = v.into();
3306 self
3307 }
3308
3309 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3311 (*self.0.stub)
3312 .get_iam_policy(self.0.request, self.0.options)
3313 .await
3314 .map(crate::Response::into_body)
3315 }
3316
3317 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3321 self.0.request.resource = v.into();
3322 self
3323 }
3324
3325 pub fn set_options<T>(mut self, v: T) -> Self
3327 where
3328 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3329 {
3330 self.0.request.options = std::option::Option::Some(v.into());
3331 self
3332 }
3333
3334 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3336 where
3337 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3338 {
3339 self.0.request.options = v.map(|x| x.into());
3340 self
3341 }
3342 }
3343
3344 #[doc(hidden)]
3345 impl crate::RequestBuilder for GetIamPolicy {
3346 fn request_options(&mut self) -> &mut crate::RequestOptions {
3347 &mut self.0.options
3348 }
3349 }
3350
3351 #[derive(Clone, Debug)]
3368 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3369
3370 impl SetIamPolicy {
3371 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3372 Self(RequestBuilder::new(stub))
3373 }
3374
3375 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3377 mut self,
3378 v: V,
3379 ) -> Self {
3380 self.0.request = v.into();
3381 self
3382 }
3383
3384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3386 self.0.options = v.into();
3387 self
3388 }
3389
3390 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3392 (*self.0.stub)
3393 .set_iam_policy(self.0.request, self.0.options)
3394 .await
3395 .map(crate::Response::into_body)
3396 }
3397
3398 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3402 self.0.request.resource = v.into();
3403 self
3404 }
3405
3406 pub fn set_policy<T>(mut self, v: T) -> Self
3410 where
3411 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3412 {
3413 self.0.request.policy = std::option::Option::Some(v.into());
3414 self
3415 }
3416
3417 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3421 where
3422 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3423 {
3424 self.0.request.policy = v.map(|x| x.into());
3425 self
3426 }
3427
3428 pub fn set_update_mask<T>(mut self, v: T) -> Self
3430 where
3431 T: std::convert::Into<wkt::FieldMask>,
3432 {
3433 self.0.request.update_mask = std::option::Option::Some(v.into());
3434 self
3435 }
3436
3437 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3439 where
3440 T: std::convert::Into<wkt::FieldMask>,
3441 {
3442 self.0.request.update_mask = v.map(|x| x.into());
3443 self
3444 }
3445 }
3446
3447 #[doc(hidden)]
3448 impl crate::RequestBuilder for SetIamPolicy {
3449 fn request_options(&mut self) -> &mut crate::RequestOptions {
3450 &mut self.0.options
3451 }
3452 }
3453
3454 #[derive(Clone, Debug)]
3471 pub struct TestIamPermissions(
3472 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3473 );
3474
3475 impl TestIamPermissions {
3476 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3477 Self(RequestBuilder::new(stub))
3478 }
3479
3480 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3482 mut self,
3483 v: V,
3484 ) -> Self {
3485 self.0.request = v.into();
3486 self
3487 }
3488
3489 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3491 self.0.options = v.into();
3492 self
3493 }
3494
3495 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3497 (*self.0.stub)
3498 .test_iam_permissions(self.0.request, self.0.options)
3499 .await
3500 .map(crate::Response::into_body)
3501 }
3502
3503 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3507 self.0.request.resource = v.into();
3508 self
3509 }
3510
3511 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3515 where
3516 T: std::iter::IntoIterator<Item = V>,
3517 V: std::convert::Into<std::string::String>,
3518 {
3519 use std::iter::Iterator;
3520 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3521 self
3522 }
3523 }
3524
3525 #[doc(hidden)]
3526 impl crate::RequestBuilder for TestIamPermissions {
3527 fn request_options(&mut self) -> &mut crate::RequestOptions {
3528 &mut self.0.options
3529 }
3530 }
3531
3532 #[derive(Clone, Debug)]
3553 pub struct ListOperations(
3554 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3555 );
3556
3557 impl ListOperations {
3558 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3559 Self(RequestBuilder::new(stub))
3560 }
3561
3562 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3564 mut self,
3565 v: V,
3566 ) -> Self {
3567 self.0.request = v.into();
3568 self
3569 }
3570
3571 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3573 self.0.options = v.into();
3574 self
3575 }
3576
3577 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3579 (*self.0.stub)
3580 .list_operations(self.0.request, self.0.options)
3581 .await
3582 .map(crate::Response::into_body)
3583 }
3584
3585 pub fn by_page(
3587 self,
3588 ) -> impl google_cloud_gax::paginator::Paginator<
3589 google_cloud_longrunning::model::ListOperationsResponse,
3590 crate::Error,
3591 > {
3592 use std::clone::Clone;
3593 let token = self.0.request.page_token.clone();
3594 let execute = move |token: String| {
3595 let mut builder = self.clone();
3596 builder.0.request = builder.0.request.set_page_token(token);
3597 builder.send()
3598 };
3599 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3600 }
3601
3602 pub fn by_item(
3604 self,
3605 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3606 google_cloud_longrunning::model::ListOperationsResponse,
3607 crate::Error,
3608 > {
3609 use google_cloud_gax::paginator::Paginator;
3610 self.by_page().items()
3611 }
3612
3613 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3615 self.0.request.name = v.into();
3616 self
3617 }
3618
3619 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3621 self.0.request.filter = v.into();
3622 self
3623 }
3624
3625 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3627 self.0.request.page_size = v.into();
3628 self
3629 }
3630
3631 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3633 self.0.request.page_token = v.into();
3634 self
3635 }
3636
3637 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3639 self.0.request.return_partial_success = v.into();
3640 self
3641 }
3642 }
3643
3644 #[doc(hidden)]
3645 impl crate::RequestBuilder for ListOperations {
3646 fn request_options(&mut self) -> &mut crate::RequestOptions {
3647 &mut self.0.options
3648 }
3649 }
3650
3651 #[derive(Clone, Debug)]
3668 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3669
3670 impl GetOperation {
3671 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3672 Self(RequestBuilder::new(stub))
3673 }
3674
3675 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3677 mut self,
3678 v: V,
3679 ) -> Self {
3680 self.0.request = v.into();
3681 self
3682 }
3683
3684 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3686 self.0.options = v.into();
3687 self
3688 }
3689
3690 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3692 (*self.0.stub)
3693 .get_operation(self.0.request, self.0.options)
3694 .await
3695 .map(crate::Response::into_body)
3696 }
3697
3698 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3700 self.0.request.name = v.into();
3701 self
3702 }
3703 }
3704
3705 #[doc(hidden)]
3706 impl crate::RequestBuilder for GetOperation {
3707 fn request_options(&mut self) -> &mut crate::RequestOptions {
3708 &mut self.0.options
3709 }
3710 }
3711
3712 #[derive(Clone, Debug)]
3729 pub struct DeleteOperation(
3730 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3731 );
3732
3733 impl DeleteOperation {
3734 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3735 Self(RequestBuilder::new(stub))
3736 }
3737
3738 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3740 mut self,
3741 v: V,
3742 ) -> Self {
3743 self.0.request = v.into();
3744 self
3745 }
3746
3747 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3749 self.0.options = v.into();
3750 self
3751 }
3752
3753 pub async fn send(self) -> Result<()> {
3755 (*self.0.stub)
3756 .delete_operation(self.0.request, self.0.options)
3757 .await
3758 .map(crate::Response::into_body)
3759 }
3760
3761 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3763 self.0.request.name = v.into();
3764 self
3765 }
3766 }
3767
3768 #[doc(hidden)]
3769 impl crate::RequestBuilder for DeleteOperation {
3770 fn request_options(&mut self) -> &mut crate::RequestOptions {
3771 &mut self.0.options
3772 }
3773 }
3774
3775 #[derive(Clone, Debug)]
3792 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
3793
3794 impl WaitOperation {
3795 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
3796 Self(RequestBuilder::new(stub))
3797 }
3798
3799 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
3801 mut self,
3802 v: V,
3803 ) -> Self {
3804 self.0.request = v.into();
3805 self
3806 }
3807
3808 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3810 self.0.options = v.into();
3811 self
3812 }
3813
3814 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3816 (*self.0.stub)
3817 .wait_operation(self.0.request, self.0.options)
3818 .await
3819 .map(crate::Response::into_body)
3820 }
3821
3822 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3824 self.0.request.name = v.into();
3825 self
3826 }
3827
3828 pub fn set_timeout<T>(mut self, v: T) -> Self
3830 where
3831 T: std::convert::Into<wkt::Duration>,
3832 {
3833 self.0.request.timeout = std::option::Option::Some(v.into());
3834 self
3835 }
3836
3837 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3839 where
3840 T: std::convert::Into<wkt::Duration>,
3841 {
3842 self.0.request.timeout = v.map(|x| x.into());
3843 self
3844 }
3845 }
3846
3847 #[doc(hidden)]
3848 impl crate::RequestBuilder for WaitOperation {
3849 fn request_options(&mut self) -> &mut crate::RequestOptions {
3850 &mut self.0.options
3851 }
3852 }
3853}
3854
3855pub mod revisions {
3857 use crate::Result;
3858
3859 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3873
3874 pub(crate) mod client {
3875 use super::super::super::client::Revisions;
3876 pub struct Factory;
3877 impl crate::ClientFactory for Factory {
3878 type Client = Revisions;
3879 type Credentials = gaxi::options::Credentials;
3880 async fn build(
3881 self,
3882 config: gaxi::options::ClientConfig,
3883 ) -> crate::ClientBuilderResult<Self::Client> {
3884 Self::Client::new(config).await
3885 }
3886 }
3887 }
3888
3889 #[derive(Clone, Debug)]
3891 pub(crate) struct RequestBuilder<R: std::default::Default> {
3892 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3893 request: R,
3894 options: crate::RequestOptions,
3895 }
3896
3897 impl<R> RequestBuilder<R>
3898 where
3899 R: std::default::Default,
3900 {
3901 pub(crate) fn new(
3902 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3903 ) -> Self {
3904 Self {
3905 stub,
3906 request: R::default(),
3907 options: crate::RequestOptions::default(),
3908 }
3909 }
3910 }
3911
3912 #[derive(Clone, Debug)]
3929 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
3930
3931 impl GetRevision {
3932 pub(crate) fn new(
3933 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3934 ) -> Self {
3935 Self(RequestBuilder::new(stub))
3936 }
3937
3938 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
3940 self.0.request = v.into();
3941 self
3942 }
3943
3944 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3946 self.0.options = v.into();
3947 self
3948 }
3949
3950 pub async fn send(self) -> Result<crate::model::Revision> {
3952 (*self.0.stub)
3953 .get_revision(self.0.request, self.0.options)
3954 .await
3955 .map(crate::Response::into_body)
3956 }
3957
3958 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3962 self.0.request.name = v.into();
3963 self
3964 }
3965 }
3966
3967 #[doc(hidden)]
3968 impl crate::RequestBuilder for GetRevision {
3969 fn request_options(&mut self) -> &mut crate::RequestOptions {
3970 &mut self.0.options
3971 }
3972 }
3973
3974 #[derive(Clone, Debug)]
3995 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
3996
3997 impl ListRevisions {
3998 pub(crate) fn new(
3999 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4000 ) -> Self {
4001 Self(RequestBuilder::new(stub))
4002 }
4003
4004 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
4006 self.0.request = v.into();
4007 self
4008 }
4009
4010 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4012 self.0.options = v.into();
4013 self
4014 }
4015
4016 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
4018 (*self.0.stub)
4019 .list_revisions(self.0.request, self.0.options)
4020 .await
4021 .map(crate::Response::into_body)
4022 }
4023
4024 pub fn by_page(
4026 self,
4027 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRevisionsResponse, crate::Error>
4028 {
4029 use std::clone::Clone;
4030 let token = self.0.request.page_token.clone();
4031 let execute = move |token: String| {
4032 let mut builder = self.clone();
4033 builder.0.request = builder.0.request.set_page_token(token);
4034 builder.send()
4035 };
4036 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4037 }
4038
4039 pub fn by_item(
4041 self,
4042 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4043 crate::model::ListRevisionsResponse,
4044 crate::Error,
4045 > {
4046 use google_cloud_gax::paginator::Paginator;
4047 self.by_page().items()
4048 }
4049
4050 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4054 self.0.request.parent = v.into();
4055 self
4056 }
4057
4058 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4060 self.0.request.page_size = v.into();
4061 self
4062 }
4063
4064 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4066 self.0.request.page_token = v.into();
4067 self
4068 }
4069
4070 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4072 self.0.request.show_deleted = v.into();
4073 self
4074 }
4075 }
4076
4077 #[doc(hidden)]
4078 impl crate::RequestBuilder for ListRevisions {
4079 fn request_options(&mut self) -> &mut crate::RequestOptions {
4080 &mut self.0.options
4081 }
4082 }
4083
4084 #[derive(Clone, Debug)]
4102 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
4103
4104 impl DeleteRevision {
4105 pub(crate) fn new(
4106 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4107 ) -> Self {
4108 Self(RequestBuilder::new(stub))
4109 }
4110
4111 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
4113 self.0.request = v.into();
4114 self
4115 }
4116
4117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4119 self.0.options = v.into();
4120 self
4121 }
4122
4123 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4130 (*self.0.stub)
4131 .delete_revision(self.0.request, self.0.options)
4132 .await
4133 .map(crate::Response::into_body)
4134 }
4135
4136 pub fn poller(
4138 self,
4139 ) -> impl google_cloud_lro::Poller<crate::model::Revision, crate::model::Revision> {
4140 type Operation = google_cloud_lro::internal::Operation<
4141 crate::model::Revision,
4142 crate::model::Revision,
4143 >;
4144 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4145 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4146 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4147 if let Some(ref mut details) = poller_options.tracing {
4148 details.method_name =
4149 "google_cloud_run_v2::client::Revisions::delete_revision::until_done";
4150 }
4151
4152 let stub = self.0.stub.clone();
4153 let mut options = self.0.options.clone();
4154 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4155 let query = move |name| {
4156 let stub = stub.clone();
4157 let options = options.clone();
4158 async {
4159 let op = GetOperation::new(stub)
4160 .set_name(name)
4161 .with_options(options)
4162 .send()
4163 .await?;
4164 Ok(Operation::new(op))
4165 }
4166 };
4167
4168 let start = move || async {
4169 let op = self.send().await?;
4170 Ok(Operation::new(op))
4171 };
4172
4173 use google_cloud_lro::internal::PollerExt;
4174 {
4175 google_cloud_lro::internal::new_poller(
4176 polling_error_policy,
4177 polling_backoff_policy,
4178 start,
4179 query,
4180 )
4181 }
4182 .with_options(poller_options)
4183 }
4184
4185 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4189 self.0.request.name = v.into();
4190 self
4191 }
4192
4193 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4195 self.0.request.validate_only = v.into();
4196 self
4197 }
4198
4199 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4201 self.0.request.etag = v.into();
4202 self
4203 }
4204 }
4205
4206 #[doc(hidden)]
4207 impl crate::RequestBuilder for DeleteRevision {
4208 fn request_options(&mut self) -> &mut crate::RequestOptions {
4209 &mut self.0.options
4210 }
4211 }
4212
4213 #[derive(Clone, Debug)]
4234 pub struct ListOperations(
4235 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4236 );
4237
4238 impl ListOperations {
4239 pub(crate) fn new(
4240 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4241 ) -> Self {
4242 Self(RequestBuilder::new(stub))
4243 }
4244
4245 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4247 mut self,
4248 v: V,
4249 ) -> Self {
4250 self.0.request = v.into();
4251 self
4252 }
4253
4254 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4256 self.0.options = v.into();
4257 self
4258 }
4259
4260 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4262 (*self.0.stub)
4263 .list_operations(self.0.request, self.0.options)
4264 .await
4265 .map(crate::Response::into_body)
4266 }
4267
4268 pub fn by_page(
4270 self,
4271 ) -> impl google_cloud_gax::paginator::Paginator<
4272 google_cloud_longrunning::model::ListOperationsResponse,
4273 crate::Error,
4274 > {
4275 use std::clone::Clone;
4276 let token = self.0.request.page_token.clone();
4277 let execute = move |token: String| {
4278 let mut builder = self.clone();
4279 builder.0.request = builder.0.request.set_page_token(token);
4280 builder.send()
4281 };
4282 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4283 }
4284
4285 pub fn by_item(
4287 self,
4288 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4289 google_cloud_longrunning::model::ListOperationsResponse,
4290 crate::Error,
4291 > {
4292 use google_cloud_gax::paginator::Paginator;
4293 self.by_page().items()
4294 }
4295
4296 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4298 self.0.request.name = v.into();
4299 self
4300 }
4301
4302 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4304 self.0.request.filter = v.into();
4305 self
4306 }
4307
4308 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4310 self.0.request.page_size = v.into();
4311 self
4312 }
4313
4314 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4316 self.0.request.page_token = v.into();
4317 self
4318 }
4319
4320 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4322 self.0.request.return_partial_success = v.into();
4323 self
4324 }
4325 }
4326
4327 #[doc(hidden)]
4328 impl crate::RequestBuilder for ListOperations {
4329 fn request_options(&mut self) -> &mut crate::RequestOptions {
4330 &mut self.0.options
4331 }
4332 }
4333
4334 #[derive(Clone, Debug)]
4351 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4352
4353 impl GetOperation {
4354 pub(crate) fn new(
4355 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4356 ) -> Self {
4357 Self(RequestBuilder::new(stub))
4358 }
4359
4360 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4362 mut self,
4363 v: V,
4364 ) -> Self {
4365 self.0.request = v.into();
4366 self
4367 }
4368
4369 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4371 self.0.options = v.into();
4372 self
4373 }
4374
4375 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4377 (*self.0.stub)
4378 .get_operation(self.0.request, self.0.options)
4379 .await
4380 .map(crate::Response::into_body)
4381 }
4382
4383 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4385 self.0.request.name = v.into();
4386 self
4387 }
4388 }
4389
4390 #[doc(hidden)]
4391 impl crate::RequestBuilder for GetOperation {
4392 fn request_options(&mut self) -> &mut crate::RequestOptions {
4393 &mut self.0.options
4394 }
4395 }
4396
4397 #[derive(Clone, Debug)]
4414 pub struct DeleteOperation(
4415 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
4416 );
4417
4418 impl DeleteOperation {
4419 pub(crate) fn new(
4420 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4421 ) -> Self {
4422 Self(RequestBuilder::new(stub))
4423 }
4424
4425 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
4427 mut self,
4428 v: V,
4429 ) -> Self {
4430 self.0.request = v.into();
4431 self
4432 }
4433
4434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4436 self.0.options = v.into();
4437 self
4438 }
4439
4440 pub async fn send(self) -> Result<()> {
4442 (*self.0.stub)
4443 .delete_operation(self.0.request, self.0.options)
4444 .await
4445 .map(crate::Response::into_body)
4446 }
4447
4448 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4450 self.0.request.name = v.into();
4451 self
4452 }
4453 }
4454
4455 #[doc(hidden)]
4456 impl crate::RequestBuilder for DeleteOperation {
4457 fn request_options(&mut self) -> &mut crate::RequestOptions {
4458 &mut self.0.options
4459 }
4460 }
4461
4462 #[derive(Clone, Debug)]
4479 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
4480
4481 impl WaitOperation {
4482 pub(crate) fn new(
4483 stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
4484 ) -> Self {
4485 Self(RequestBuilder::new(stub))
4486 }
4487
4488 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
4490 mut self,
4491 v: V,
4492 ) -> Self {
4493 self.0.request = v.into();
4494 self
4495 }
4496
4497 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4499 self.0.options = v.into();
4500 self
4501 }
4502
4503 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4505 (*self.0.stub)
4506 .wait_operation(self.0.request, self.0.options)
4507 .await
4508 .map(crate::Response::into_body)
4509 }
4510
4511 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4513 self.0.request.name = v.into();
4514 self
4515 }
4516
4517 pub fn set_timeout<T>(mut self, v: T) -> Self
4519 where
4520 T: std::convert::Into<wkt::Duration>,
4521 {
4522 self.0.request.timeout = std::option::Option::Some(v.into());
4523 self
4524 }
4525
4526 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4528 where
4529 T: std::convert::Into<wkt::Duration>,
4530 {
4531 self.0.request.timeout = v.map(|x| x.into());
4532 self
4533 }
4534 }
4535
4536 #[doc(hidden)]
4537 impl crate::RequestBuilder for WaitOperation {
4538 fn request_options(&mut self) -> &mut crate::RequestOptions {
4539 &mut self.0.options
4540 }
4541 }
4542}
4543
4544pub mod services {
4546 use crate::Result;
4547
4548 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4562
4563 pub(crate) mod client {
4564 use super::super::super::client::Services;
4565 pub struct Factory;
4566 impl crate::ClientFactory for Factory {
4567 type Client = Services;
4568 type Credentials = gaxi::options::Credentials;
4569 async fn build(
4570 self,
4571 config: gaxi::options::ClientConfig,
4572 ) -> crate::ClientBuilderResult<Self::Client> {
4573 Self::Client::new(config).await
4574 }
4575 }
4576 }
4577
4578 #[derive(Clone, Debug)]
4580 pub(crate) struct RequestBuilder<R: std::default::Default> {
4581 stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
4582 request: R,
4583 options: crate::RequestOptions,
4584 }
4585
4586 impl<R> RequestBuilder<R>
4587 where
4588 R: std::default::Default,
4589 {
4590 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4591 Self {
4592 stub,
4593 request: R::default(),
4594 options: crate::RequestOptions::default(),
4595 }
4596 }
4597 }
4598
4599 #[derive(Clone, Debug)]
4617 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
4618
4619 impl CreateService {
4620 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4621 Self(RequestBuilder::new(stub))
4622 }
4623
4624 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
4626 self.0.request = v.into();
4627 self
4628 }
4629
4630 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4632 self.0.options = v.into();
4633 self
4634 }
4635
4636 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4643 (*self.0.stub)
4644 .create_service(self.0.request, self.0.options)
4645 .await
4646 .map(crate::Response::into_body)
4647 }
4648
4649 pub fn poller(
4651 self,
4652 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4653 type Operation =
4654 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4655 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4656 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4657 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4658 if let Some(ref mut details) = poller_options.tracing {
4659 details.method_name =
4660 "google_cloud_run_v2::client::Services::create_service::until_done";
4661 }
4662
4663 let stub = self.0.stub.clone();
4664 let mut options = self.0.options.clone();
4665 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4666 let query = move |name| {
4667 let stub = stub.clone();
4668 let options = options.clone();
4669 async {
4670 let op = GetOperation::new(stub)
4671 .set_name(name)
4672 .with_options(options)
4673 .send()
4674 .await?;
4675 Ok(Operation::new(op))
4676 }
4677 };
4678
4679 let start = move || async {
4680 let op = self.send().await?;
4681 Ok(Operation::new(op))
4682 };
4683
4684 use google_cloud_lro::internal::PollerExt;
4685 {
4686 google_cloud_lro::internal::new_poller(
4687 polling_error_policy,
4688 polling_backoff_policy,
4689 start,
4690 query,
4691 )
4692 }
4693 .with_options(poller_options)
4694 }
4695
4696 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4700 self.0.request.parent = v.into();
4701 self
4702 }
4703
4704 pub fn set_service<T>(mut self, v: T) -> Self
4708 where
4709 T: std::convert::Into<crate::model::Service>,
4710 {
4711 self.0.request.service = std::option::Option::Some(v.into());
4712 self
4713 }
4714
4715 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
4719 where
4720 T: std::convert::Into<crate::model::Service>,
4721 {
4722 self.0.request.service = v.map(|x| x.into());
4723 self
4724 }
4725
4726 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4730 self.0.request.service_id = v.into();
4731 self
4732 }
4733
4734 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4736 self.0.request.validate_only = v.into();
4737 self
4738 }
4739 }
4740
4741 #[doc(hidden)]
4742 impl crate::RequestBuilder for CreateService {
4743 fn request_options(&mut self) -> &mut crate::RequestOptions {
4744 &mut self.0.options
4745 }
4746 }
4747
4748 #[derive(Clone, Debug)]
4765 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
4766
4767 impl GetService {
4768 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4769 Self(RequestBuilder::new(stub))
4770 }
4771
4772 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
4774 self.0.request = v.into();
4775 self
4776 }
4777
4778 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4780 self.0.options = v.into();
4781 self
4782 }
4783
4784 pub async fn send(self) -> Result<crate::model::Service> {
4786 (*self.0.stub)
4787 .get_service(self.0.request, self.0.options)
4788 .await
4789 .map(crate::Response::into_body)
4790 }
4791
4792 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4796 self.0.request.name = v.into();
4797 self
4798 }
4799 }
4800
4801 #[doc(hidden)]
4802 impl crate::RequestBuilder for GetService {
4803 fn request_options(&mut self) -> &mut crate::RequestOptions {
4804 &mut self.0.options
4805 }
4806 }
4807
4808 #[derive(Clone, Debug)]
4829 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
4830
4831 impl ListServices {
4832 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4833 Self(RequestBuilder::new(stub))
4834 }
4835
4836 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
4838 self.0.request = v.into();
4839 self
4840 }
4841
4842 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4844 self.0.options = v.into();
4845 self
4846 }
4847
4848 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
4850 (*self.0.stub)
4851 .list_services(self.0.request, self.0.options)
4852 .await
4853 .map(crate::Response::into_body)
4854 }
4855
4856 pub fn by_page(
4858 self,
4859 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListServicesResponse, crate::Error>
4860 {
4861 use std::clone::Clone;
4862 let token = self.0.request.page_token.clone();
4863 let execute = move |token: String| {
4864 let mut builder = self.clone();
4865 builder.0.request = builder.0.request.set_page_token(token);
4866 builder.send()
4867 };
4868 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4869 }
4870
4871 pub fn by_item(
4873 self,
4874 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4875 crate::model::ListServicesResponse,
4876 crate::Error,
4877 > {
4878 use google_cloud_gax::paginator::Paginator;
4879 self.by_page().items()
4880 }
4881
4882 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4886 self.0.request.parent = v.into();
4887 self
4888 }
4889
4890 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4892 self.0.request.page_size = v.into();
4893 self
4894 }
4895
4896 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4898 self.0.request.page_token = v.into();
4899 self
4900 }
4901
4902 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4904 self.0.request.show_deleted = v.into();
4905 self
4906 }
4907 }
4908
4909 #[doc(hidden)]
4910 impl crate::RequestBuilder for ListServices {
4911 fn request_options(&mut self) -> &mut crate::RequestOptions {
4912 &mut self.0.options
4913 }
4914 }
4915
4916 #[derive(Clone, Debug)]
4934 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
4935
4936 impl UpdateService {
4937 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4938 Self(RequestBuilder::new(stub))
4939 }
4940
4941 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
4943 self.0.request = v.into();
4944 self
4945 }
4946
4947 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4949 self.0.options = v.into();
4950 self
4951 }
4952
4953 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4960 (*self.0.stub)
4961 .update_service(self.0.request, self.0.options)
4962 .await
4963 .map(crate::Response::into_body)
4964 }
4965
4966 pub fn poller(
4968 self,
4969 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
4970 type Operation =
4971 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
4972 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4973 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4974 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4975 if let Some(ref mut details) = poller_options.tracing {
4976 details.method_name =
4977 "google_cloud_run_v2::client::Services::update_service::until_done";
4978 }
4979
4980 let stub = self.0.stub.clone();
4981 let mut options = self.0.options.clone();
4982 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4983 let query = move |name| {
4984 let stub = stub.clone();
4985 let options = options.clone();
4986 async {
4987 let op = GetOperation::new(stub)
4988 .set_name(name)
4989 .with_options(options)
4990 .send()
4991 .await?;
4992 Ok(Operation::new(op))
4993 }
4994 };
4995
4996 let start = move || async {
4997 let op = self.send().await?;
4998 Ok(Operation::new(op))
4999 };
5000
5001 use google_cloud_lro::internal::PollerExt;
5002 {
5003 google_cloud_lro::internal::new_poller(
5004 polling_error_policy,
5005 polling_backoff_policy,
5006 start,
5007 query,
5008 )
5009 }
5010 .with_options(poller_options)
5011 }
5012
5013 pub fn set_update_mask<T>(mut self, v: T) -> Self
5015 where
5016 T: std::convert::Into<wkt::FieldMask>,
5017 {
5018 self.0.request.update_mask = std::option::Option::Some(v.into());
5019 self
5020 }
5021
5022 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5024 where
5025 T: std::convert::Into<wkt::FieldMask>,
5026 {
5027 self.0.request.update_mask = v.map(|x| x.into());
5028 self
5029 }
5030
5031 pub fn set_service<T>(mut self, v: T) -> Self
5035 where
5036 T: std::convert::Into<crate::model::Service>,
5037 {
5038 self.0.request.service = std::option::Option::Some(v.into());
5039 self
5040 }
5041
5042 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
5046 where
5047 T: std::convert::Into<crate::model::Service>,
5048 {
5049 self.0.request.service = v.map(|x| x.into());
5050 self
5051 }
5052
5053 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5055 self.0.request.validate_only = v.into();
5056 self
5057 }
5058
5059 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5061 self.0.request.allow_missing = v.into();
5062 self
5063 }
5064 }
5065
5066 #[doc(hidden)]
5067 impl crate::RequestBuilder for UpdateService {
5068 fn request_options(&mut self) -> &mut crate::RequestOptions {
5069 &mut self.0.options
5070 }
5071 }
5072
5073 #[derive(Clone, Debug)]
5091 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
5092
5093 impl DeleteService {
5094 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5095 Self(RequestBuilder::new(stub))
5096 }
5097
5098 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
5100 self.0.request = v.into();
5101 self
5102 }
5103
5104 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5106 self.0.options = v.into();
5107 self
5108 }
5109
5110 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5117 (*self.0.stub)
5118 .delete_service(self.0.request, self.0.options)
5119 .await
5120 .map(crate::Response::into_body)
5121 }
5122
5123 pub fn poller(
5125 self,
5126 ) -> impl google_cloud_lro::Poller<crate::model::Service, crate::model::Service> {
5127 type Operation =
5128 google_cloud_lro::internal::Operation<crate::model::Service, crate::model::Service>;
5129 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5130 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5131 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5132 if let Some(ref mut details) = poller_options.tracing {
5133 details.method_name =
5134 "google_cloud_run_v2::client::Services::delete_service::until_done";
5135 }
5136
5137 let stub = self.0.stub.clone();
5138 let mut options = self.0.options.clone();
5139 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5140 let query = move |name| {
5141 let stub = stub.clone();
5142 let options = options.clone();
5143 async {
5144 let op = GetOperation::new(stub)
5145 .set_name(name)
5146 .with_options(options)
5147 .send()
5148 .await?;
5149 Ok(Operation::new(op))
5150 }
5151 };
5152
5153 let start = move || async {
5154 let op = self.send().await?;
5155 Ok(Operation::new(op))
5156 };
5157
5158 use google_cloud_lro::internal::PollerExt;
5159 {
5160 google_cloud_lro::internal::new_poller(
5161 polling_error_policy,
5162 polling_backoff_policy,
5163 start,
5164 query,
5165 )
5166 }
5167 .with_options(poller_options)
5168 }
5169
5170 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5174 self.0.request.name = v.into();
5175 self
5176 }
5177
5178 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5180 self.0.request.validate_only = v.into();
5181 self
5182 }
5183
5184 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5186 self.0.request.etag = v.into();
5187 self
5188 }
5189 }
5190
5191 #[doc(hidden)]
5192 impl crate::RequestBuilder for DeleteService {
5193 fn request_options(&mut self) -> &mut crate::RequestOptions {
5194 &mut self.0.options
5195 }
5196 }
5197
5198 #[derive(Clone, Debug)]
5215 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5216
5217 impl GetIamPolicy {
5218 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5219 Self(RequestBuilder::new(stub))
5220 }
5221
5222 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5224 mut self,
5225 v: V,
5226 ) -> Self {
5227 self.0.request = v.into();
5228 self
5229 }
5230
5231 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5233 self.0.options = v.into();
5234 self
5235 }
5236
5237 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5239 (*self.0.stub)
5240 .get_iam_policy(self.0.request, self.0.options)
5241 .await
5242 .map(crate::Response::into_body)
5243 }
5244
5245 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5249 self.0.request.resource = v.into();
5250 self
5251 }
5252
5253 pub fn set_options<T>(mut self, v: T) -> Self
5255 where
5256 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5257 {
5258 self.0.request.options = std::option::Option::Some(v.into());
5259 self
5260 }
5261
5262 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5264 where
5265 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5266 {
5267 self.0.request.options = v.map(|x| x.into());
5268 self
5269 }
5270 }
5271
5272 #[doc(hidden)]
5273 impl crate::RequestBuilder for GetIamPolicy {
5274 fn request_options(&mut self) -> &mut crate::RequestOptions {
5275 &mut self.0.options
5276 }
5277 }
5278
5279 #[derive(Clone, Debug)]
5296 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5297
5298 impl SetIamPolicy {
5299 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5300 Self(RequestBuilder::new(stub))
5301 }
5302
5303 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5305 mut self,
5306 v: V,
5307 ) -> Self {
5308 self.0.request = v.into();
5309 self
5310 }
5311
5312 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5314 self.0.options = v.into();
5315 self
5316 }
5317
5318 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5320 (*self.0.stub)
5321 .set_iam_policy(self.0.request, self.0.options)
5322 .await
5323 .map(crate::Response::into_body)
5324 }
5325
5326 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5330 self.0.request.resource = v.into();
5331 self
5332 }
5333
5334 pub fn set_policy<T>(mut self, v: T) -> Self
5338 where
5339 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5340 {
5341 self.0.request.policy = std::option::Option::Some(v.into());
5342 self
5343 }
5344
5345 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5349 where
5350 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5351 {
5352 self.0.request.policy = v.map(|x| x.into());
5353 self
5354 }
5355
5356 pub fn set_update_mask<T>(mut self, v: T) -> Self
5358 where
5359 T: std::convert::Into<wkt::FieldMask>,
5360 {
5361 self.0.request.update_mask = std::option::Option::Some(v.into());
5362 self
5363 }
5364
5365 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5367 where
5368 T: std::convert::Into<wkt::FieldMask>,
5369 {
5370 self.0.request.update_mask = v.map(|x| x.into());
5371 self
5372 }
5373 }
5374
5375 #[doc(hidden)]
5376 impl crate::RequestBuilder for SetIamPolicy {
5377 fn request_options(&mut self) -> &mut crate::RequestOptions {
5378 &mut self.0.options
5379 }
5380 }
5381
5382 #[derive(Clone, Debug)]
5399 pub struct TestIamPermissions(
5400 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5401 );
5402
5403 impl TestIamPermissions {
5404 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5405 Self(RequestBuilder::new(stub))
5406 }
5407
5408 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5410 mut self,
5411 v: V,
5412 ) -> Self {
5413 self.0.request = v.into();
5414 self
5415 }
5416
5417 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5419 self.0.options = v.into();
5420 self
5421 }
5422
5423 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5425 (*self.0.stub)
5426 .test_iam_permissions(self.0.request, self.0.options)
5427 .await
5428 .map(crate::Response::into_body)
5429 }
5430
5431 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5435 self.0.request.resource = v.into();
5436 self
5437 }
5438
5439 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5443 where
5444 T: std::iter::IntoIterator<Item = V>,
5445 V: std::convert::Into<std::string::String>,
5446 {
5447 use std::iter::Iterator;
5448 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5449 self
5450 }
5451 }
5452
5453 #[doc(hidden)]
5454 impl crate::RequestBuilder for TestIamPermissions {
5455 fn request_options(&mut self) -> &mut crate::RequestOptions {
5456 &mut self.0.options
5457 }
5458 }
5459
5460 #[derive(Clone, Debug)]
5481 pub struct ListOperations(
5482 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5483 );
5484
5485 impl ListOperations {
5486 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5487 Self(RequestBuilder::new(stub))
5488 }
5489
5490 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5492 mut self,
5493 v: V,
5494 ) -> Self {
5495 self.0.request = v.into();
5496 self
5497 }
5498
5499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5501 self.0.options = v.into();
5502 self
5503 }
5504
5505 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5507 (*self.0.stub)
5508 .list_operations(self.0.request, self.0.options)
5509 .await
5510 .map(crate::Response::into_body)
5511 }
5512
5513 pub fn by_page(
5515 self,
5516 ) -> impl google_cloud_gax::paginator::Paginator<
5517 google_cloud_longrunning::model::ListOperationsResponse,
5518 crate::Error,
5519 > {
5520 use std::clone::Clone;
5521 let token = self.0.request.page_token.clone();
5522 let execute = move |token: String| {
5523 let mut builder = self.clone();
5524 builder.0.request = builder.0.request.set_page_token(token);
5525 builder.send()
5526 };
5527 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5528 }
5529
5530 pub fn by_item(
5532 self,
5533 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5534 google_cloud_longrunning::model::ListOperationsResponse,
5535 crate::Error,
5536 > {
5537 use google_cloud_gax::paginator::Paginator;
5538 self.by_page().items()
5539 }
5540
5541 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5543 self.0.request.name = v.into();
5544 self
5545 }
5546
5547 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5549 self.0.request.filter = v.into();
5550 self
5551 }
5552
5553 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5555 self.0.request.page_size = v.into();
5556 self
5557 }
5558
5559 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5561 self.0.request.page_token = v.into();
5562 self
5563 }
5564
5565 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5567 self.0.request.return_partial_success = v.into();
5568 self
5569 }
5570 }
5571
5572 #[doc(hidden)]
5573 impl crate::RequestBuilder for ListOperations {
5574 fn request_options(&mut self) -> &mut crate::RequestOptions {
5575 &mut self.0.options
5576 }
5577 }
5578
5579 #[derive(Clone, Debug)]
5596 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5597
5598 impl GetOperation {
5599 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5600 Self(RequestBuilder::new(stub))
5601 }
5602
5603 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5605 mut self,
5606 v: V,
5607 ) -> Self {
5608 self.0.request = v.into();
5609 self
5610 }
5611
5612 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5614 self.0.options = v.into();
5615 self
5616 }
5617
5618 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5620 (*self.0.stub)
5621 .get_operation(self.0.request, self.0.options)
5622 .await
5623 .map(crate::Response::into_body)
5624 }
5625
5626 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5628 self.0.request.name = v.into();
5629 self
5630 }
5631 }
5632
5633 #[doc(hidden)]
5634 impl crate::RequestBuilder for GetOperation {
5635 fn request_options(&mut self) -> &mut crate::RequestOptions {
5636 &mut self.0.options
5637 }
5638 }
5639
5640 #[derive(Clone, Debug)]
5657 pub struct DeleteOperation(
5658 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
5659 );
5660
5661 impl DeleteOperation {
5662 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5663 Self(RequestBuilder::new(stub))
5664 }
5665
5666 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
5668 mut self,
5669 v: V,
5670 ) -> Self {
5671 self.0.request = v.into();
5672 self
5673 }
5674
5675 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5677 self.0.options = v.into();
5678 self
5679 }
5680
5681 pub async fn send(self) -> Result<()> {
5683 (*self.0.stub)
5684 .delete_operation(self.0.request, self.0.options)
5685 .await
5686 .map(crate::Response::into_body)
5687 }
5688
5689 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5691 self.0.request.name = v.into();
5692 self
5693 }
5694 }
5695
5696 #[doc(hidden)]
5697 impl crate::RequestBuilder for DeleteOperation {
5698 fn request_options(&mut self) -> &mut crate::RequestOptions {
5699 &mut self.0.options
5700 }
5701 }
5702
5703 #[derive(Clone, Debug)]
5720 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
5721
5722 impl WaitOperation {
5723 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
5724 Self(RequestBuilder::new(stub))
5725 }
5726
5727 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
5729 mut self,
5730 v: V,
5731 ) -> Self {
5732 self.0.request = v.into();
5733 self
5734 }
5735
5736 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5738 self.0.options = v.into();
5739 self
5740 }
5741
5742 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5744 (*self.0.stub)
5745 .wait_operation(self.0.request, self.0.options)
5746 .await
5747 .map(crate::Response::into_body)
5748 }
5749
5750 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5752 self.0.request.name = v.into();
5753 self
5754 }
5755
5756 pub fn set_timeout<T>(mut self, v: T) -> Self
5758 where
5759 T: std::convert::Into<wkt::Duration>,
5760 {
5761 self.0.request.timeout = std::option::Option::Some(v.into());
5762 self
5763 }
5764
5765 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5767 where
5768 T: std::convert::Into<wkt::Duration>,
5769 {
5770 self.0.request.timeout = v.map(|x| x.into());
5771 self
5772 }
5773 }
5774
5775 #[doc(hidden)]
5776 impl crate::RequestBuilder for WaitOperation {
5777 fn request_options(&mut self) -> &mut crate::RequestOptions {
5778 &mut self.0.options
5779 }
5780 }
5781}
5782
5783pub mod tasks {
5785 use crate::Result;
5786
5787 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5801
5802 pub(crate) mod client {
5803 use super::super::super::client::Tasks;
5804 pub struct Factory;
5805 impl crate::ClientFactory for Factory {
5806 type Client = Tasks;
5807 type Credentials = gaxi::options::Credentials;
5808 async fn build(
5809 self,
5810 config: gaxi::options::ClientConfig,
5811 ) -> crate::ClientBuilderResult<Self::Client> {
5812 Self::Client::new(config).await
5813 }
5814 }
5815 }
5816
5817 #[derive(Clone, Debug)]
5819 pub(crate) struct RequestBuilder<R: std::default::Default> {
5820 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
5821 request: R,
5822 options: crate::RequestOptions,
5823 }
5824
5825 impl<R> RequestBuilder<R>
5826 where
5827 R: std::default::Default,
5828 {
5829 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5830 Self {
5831 stub,
5832 request: R::default(),
5833 options: crate::RequestOptions::default(),
5834 }
5835 }
5836 }
5837
5838 #[derive(Clone, Debug)]
5855 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
5856
5857 impl GetTask {
5858 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5859 Self(RequestBuilder::new(stub))
5860 }
5861
5862 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
5864 self.0.request = v.into();
5865 self
5866 }
5867
5868 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5870 self.0.options = v.into();
5871 self
5872 }
5873
5874 pub async fn send(self) -> Result<crate::model::Task> {
5876 (*self.0.stub)
5877 .get_task(self.0.request, self.0.options)
5878 .await
5879 .map(crate::Response::into_body)
5880 }
5881
5882 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5886 self.0.request.name = v.into();
5887 self
5888 }
5889 }
5890
5891 #[doc(hidden)]
5892 impl crate::RequestBuilder for GetTask {
5893 fn request_options(&mut self) -> &mut crate::RequestOptions {
5894 &mut self.0.options
5895 }
5896 }
5897
5898 #[derive(Clone, Debug)]
5919 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
5920
5921 impl ListTasks {
5922 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
5923 Self(RequestBuilder::new(stub))
5924 }
5925
5926 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
5928 self.0.request = v.into();
5929 self
5930 }
5931
5932 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5934 self.0.options = v.into();
5935 self
5936 }
5937
5938 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
5940 (*self.0.stub)
5941 .list_tasks(self.0.request, self.0.options)
5942 .await
5943 .map(crate::Response::into_body)
5944 }
5945
5946 pub fn by_page(
5948 self,
5949 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTasksResponse, crate::Error>
5950 {
5951 use std::clone::Clone;
5952 let token = self.0.request.page_token.clone();
5953 let execute = move |token: String| {
5954 let mut builder = self.clone();
5955 builder.0.request = builder.0.request.set_page_token(token);
5956 builder.send()
5957 };
5958 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5959 }
5960
5961 pub fn by_item(
5963 self,
5964 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListTasksResponse, crate::Error>
5965 {
5966 use google_cloud_gax::paginator::Paginator;
5967 self.by_page().items()
5968 }
5969
5970 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5974 self.0.request.parent = v.into();
5975 self
5976 }
5977
5978 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5980 self.0.request.page_size = v.into();
5981 self
5982 }
5983
5984 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5986 self.0.request.page_token = v.into();
5987 self
5988 }
5989
5990 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5992 self.0.request.show_deleted = v.into();
5993 self
5994 }
5995 }
5996
5997 #[doc(hidden)]
5998 impl crate::RequestBuilder for ListTasks {
5999 fn request_options(&mut self) -> &mut crate::RequestOptions {
6000 &mut self.0.options
6001 }
6002 }
6003
6004 #[derive(Clone, Debug)]
6025 pub struct ListOperations(
6026 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6027 );
6028
6029 impl ListOperations {
6030 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6031 Self(RequestBuilder::new(stub))
6032 }
6033
6034 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6036 mut self,
6037 v: V,
6038 ) -> Self {
6039 self.0.request = v.into();
6040 self
6041 }
6042
6043 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6045 self.0.options = v.into();
6046 self
6047 }
6048
6049 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6051 (*self.0.stub)
6052 .list_operations(self.0.request, self.0.options)
6053 .await
6054 .map(crate::Response::into_body)
6055 }
6056
6057 pub fn by_page(
6059 self,
6060 ) -> impl google_cloud_gax::paginator::Paginator<
6061 google_cloud_longrunning::model::ListOperationsResponse,
6062 crate::Error,
6063 > {
6064 use std::clone::Clone;
6065 let token = self.0.request.page_token.clone();
6066 let execute = move |token: String| {
6067 let mut builder = self.clone();
6068 builder.0.request = builder.0.request.set_page_token(token);
6069 builder.send()
6070 };
6071 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6072 }
6073
6074 pub fn by_item(
6076 self,
6077 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6078 google_cloud_longrunning::model::ListOperationsResponse,
6079 crate::Error,
6080 > {
6081 use google_cloud_gax::paginator::Paginator;
6082 self.by_page().items()
6083 }
6084
6085 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6087 self.0.request.name = v.into();
6088 self
6089 }
6090
6091 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6093 self.0.request.filter = v.into();
6094 self
6095 }
6096
6097 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6099 self.0.request.page_size = v.into();
6100 self
6101 }
6102
6103 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6105 self.0.request.page_token = v.into();
6106 self
6107 }
6108
6109 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6111 self.0.request.return_partial_success = v.into();
6112 self
6113 }
6114 }
6115
6116 #[doc(hidden)]
6117 impl crate::RequestBuilder for ListOperations {
6118 fn request_options(&mut self) -> &mut crate::RequestOptions {
6119 &mut self.0.options
6120 }
6121 }
6122
6123 #[derive(Clone, Debug)]
6140 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6141
6142 impl GetOperation {
6143 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6144 Self(RequestBuilder::new(stub))
6145 }
6146
6147 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6149 mut self,
6150 v: V,
6151 ) -> Self {
6152 self.0.request = v.into();
6153 self
6154 }
6155
6156 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6158 self.0.options = v.into();
6159 self
6160 }
6161
6162 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6164 (*self.0.stub)
6165 .get_operation(self.0.request, self.0.options)
6166 .await
6167 .map(crate::Response::into_body)
6168 }
6169
6170 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6172 self.0.request.name = v.into();
6173 self
6174 }
6175 }
6176
6177 #[doc(hidden)]
6178 impl crate::RequestBuilder for GetOperation {
6179 fn request_options(&mut self) -> &mut crate::RequestOptions {
6180 &mut self.0.options
6181 }
6182 }
6183
6184 #[derive(Clone, Debug)]
6201 pub struct DeleteOperation(
6202 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
6203 );
6204
6205 impl DeleteOperation {
6206 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6207 Self(RequestBuilder::new(stub))
6208 }
6209
6210 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
6212 mut self,
6213 v: V,
6214 ) -> Self {
6215 self.0.request = v.into();
6216 self
6217 }
6218
6219 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6221 self.0.options = v.into();
6222 self
6223 }
6224
6225 pub async fn send(self) -> Result<()> {
6227 (*self.0.stub)
6228 .delete_operation(self.0.request, self.0.options)
6229 .await
6230 .map(crate::Response::into_body)
6231 }
6232
6233 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6235 self.0.request.name = v.into();
6236 self
6237 }
6238 }
6239
6240 #[doc(hidden)]
6241 impl crate::RequestBuilder for DeleteOperation {
6242 fn request_options(&mut self) -> &mut crate::RequestOptions {
6243 &mut self.0.options
6244 }
6245 }
6246
6247 #[derive(Clone, Debug)]
6264 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
6265
6266 impl WaitOperation {
6267 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
6268 Self(RequestBuilder::new(stub))
6269 }
6270
6271 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
6273 mut self,
6274 v: V,
6275 ) -> Self {
6276 self.0.request = v.into();
6277 self
6278 }
6279
6280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6282 self.0.options = v.into();
6283 self
6284 }
6285
6286 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6288 (*self.0.stub)
6289 .wait_operation(self.0.request, self.0.options)
6290 .await
6291 .map(crate::Response::into_body)
6292 }
6293
6294 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6296 self.0.request.name = v.into();
6297 self
6298 }
6299
6300 pub fn set_timeout<T>(mut self, v: T) -> Self
6302 where
6303 T: std::convert::Into<wkt::Duration>,
6304 {
6305 self.0.request.timeout = std::option::Option::Some(v.into());
6306 self
6307 }
6308
6309 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6311 where
6312 T: std::convert::Into<wkt::Duration>,
6313 {
6314 self.0.request.timeout = v.map(|x| x.into());
6315 self
6316 }
6317 }
6318
6319 #[doc(hidden)]
6320 impl crate::RequestBuilder for WaitOperation {
6321 fn request_options(&mut self) -> &mut crate::RequestOptions {
6322 &mut self.0.options
6323 }
6324 }
6325}
6326
6327pub mod worker_pools {
6329 use crate::Result;
6330
6331 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6345
6346 pub(crate) mod client {
6347 use super::super::super::client::WorkerPools;
6348 pub struct Factory;
6349 impl crate::ClientFactory for Factory {
6350 type Client = WorkerPools;
6351 type Credentials = gaxi::options::Credentials;
6352 async fn build(
6353 self,
6354 config: gaxi::options::ClientConfig,
6355 ) -> crate::ClientBuilderResult<Self::Client> {
6356 Self::Client::new(config).await
6357 }
6358 }
6359 }
6360
6361 #[derive(Clone, Debug)]
6363 pub(crate) struct RequestBuilder<R: std::default::Default> {
6364 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6365 request: R,
6366 options: crate::RequestOptions,
6367 }
6368
6369 impl<R> RequestBuilder<R>
6370 where
6371 R: std::default::Default,
6372 {
6373 pub(crate) fn new(
6374 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6375 ) -> Self {
6376 Self {
6377 stub,
6378 request: R::default(),
6379 options: crate::RequestOptions::default(),
6380 }
6381 }
6382 }
6383
6384 #[derive(Clone, Debug)]
6402 pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
6403
6404 impl CreateWorkerPool {
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::CreateWorkerPoolRequest>>(
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<crate::RequestOptions>>(mut self, v: V) -> Self {
6422 self.0.options = v.into();
6423 self
6424 }
6425
6426 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6433 (*self.0.stub)
6434 .create_worker_pool(self.0.request, self.0.options)
6435 .await
6436 .map(crate::Response::into_body)
6437 }
6438
6439 pub fn poller(
6441 self,
6442 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6443 {
6444 type Operation = google_cloud_lro::internal::Operation<
6445 crate::model::WorkerPool,
6446 crate::model::WorkerPool,
6447 >;
6448 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6449 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6450 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6451 if let Some(ref mut details) = poller_options.tracing {
6452 details.method_name =
6453 "google_cloud_run_v2::client::WorkerPools::create_worker_pool::until_done";
6454 }
6455
6456 let stub = self.0.stub.clone();
6457 let mut options = self.0.options.clone();
6458 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6459 let query = move |name| {
6460 let stub = stub.clone();
6461 let options = options.clone();
6462 async {
6463 let op = GetOperation::new(stub)
6464 .set_name(name)
6465 .with_options(options)
6466 .send()
6467 .await?;
6468 Ok(Operation::new(op))
6469 }
6470 };
6471
6472 let start = move || async {
6473 let op = self.send().await?;
6474 Ok(Operation::new(op))
6475 };
6476
6477 use google_cloud_lro::internal::PollerExt;
6478 {
6479 google_cloud_lro::internal::new_poller(
6480 polling_error_policy,
6481 polling_backoff_policy,
6482 start,
6483 query,
6484 )
6485 }
6486 .with_options(poller_options)
6487 }
6488
6489 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6493 self.0.request.parent = v.into();
6494 self
6495 }
6496
6497 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6501 where
6502 T: std::convert::Into<crate::model::WorkerPool>,
6503 {
6504 self.0.request.worker_pool = std::option::Option::Some(v.into());
6505 self
6506 }
6507
6508 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6512 where
6513 T: std::convert::Into<crate::model::WorkerPool>,
6514 {
6515 self.0.request.worker_pool = v.map(|x| x.into());
6516 self
6517 }
6518
6519 pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6523 self.0.request.worker_pool_id = v.into();
6524 self
6525 }
6526
6527 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6529 self.0.request.validate_only = v.into();
6530 self
6531 }
6532 }
6533
6534 #[doc(hidden)]
6535 impl crate::RequestBuilder for CreateWorkerPool {
6536 fn request_options(&mut self) -> &mut crate::RequestOptions {
6537 &mut self.0.options
6538 }
6539 }
6540
6541 #[derive(Clone, Debug)]
6558 pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
6559
6560 impl GetWorkerPool {
6561 pub(crate) fn new(
6562 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6563 ) -> Self {
6564 Self(RequestBuilder::new(stub))
6565 }
6566
6567 pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
6569 self.0.request = v.into();
6570 self
6571 }
6572
6573 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6575 self.0.options = v.into();
6576 self
6577 }
6578
6579 pub async fn send(self) -> Result<crate::model::WorkerPool> {
6581 (*self.0.stub)
6582 .get_worker_pool(self.0.request, self.0.options)
6583 .await
6584 .map(crate::Response::into_body)
6585 }
6586
6587 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6591 self.0.request.name = v.into();
6592 self
6593 }
6594 }
6595
6596 #[doc(hidden)]
6597 impl crate::RequestBuilder for GetWorkerPool {
6598 fn request_options(&mut self) -> &mut crate::RequestOptions {
6599 &mut self.0.options
6600 }
6601 }
6602
6603 #[derive(Clone, Debug)]
6624 pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
6625
6626 impl ListWorkerPools {
6627 pub(crate) fn new(
6628 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6629 ) -> Self {
6630 Self(RequestBuilder::new(stub))
6631 }
6632
6633 pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
6635 self.0.request = v.into();
6636 self
6637 }
6638
6639 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6641 self.0.options = v.into();
6642 self
6643 }
6644
6645 pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
6647 (*self.0.stub)
6648 .list_worker_pools(self.0.request, self.0.options)
6649 .await
6650 .map(crate::Response::into_body)
6651 }
6652
6653 pub fn by_page(
6655 self,
6656 ) -> impl google_cloud_gax::paginator::Paginator<
6657 crate::model::ListWorkerPoolsResponse,
6658 crate::Error,
6659 > {
6660 use std::clone::Clone;
6661 let token = self.0.request.page_token.clone();
6662 let execute = move |token: String| {
6663 let mut builder = self.clone();
6664 builder.0.request = builder.0.request.set_page_token(token);
6665 builder.send()
6666 };
6667 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6668 }
6669
6670 pub fn by_item(
6672 self,
6673 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6674 crate::model::ListWorkerPoolsResponse,
6675 crate::Error,
6676 > {
6677 use google_cloud_gax::paginator::Paginator;
6678 self.by_page().items()
6679 }
6680
6681 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6685 self.0.request.parent = v.into();
6686 self
6687 }
6688
6689 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6691 self.0.request.page_size = v.into();
6692 self
6693 }
6694
6695 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6697 self.0.request.page_token = v.into();
6698 self
6699 }
6700
6701 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
6703 self.0.request.show_deleted = v.into();
6704 self
6705 }
6706 }
6707
6708 #[doc(hidden)]
6709 impl crate::RequestBuilder for ListWorkerPools {
6710 fn request_options(&mut self) -> &mut crate::RequestOptions {
6711 &mut self.0.options
6712 }
6713 }
6714
6715 #[derive(Clone, Debug)]
6733 pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
6734
6735 impl UpdateWorkerPool {
6736 pub(crate) fn new(
6737 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6738 ) -> Self {
6739 Self(RequestBuilder::new(stub))
6740 }
6741
6742 pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
6744 mut self,
6745 v: V,
6746 ) -> Self {
6747 self.0.request = v.into();
6748 self
6749 }
6750
6751 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6753 self.0.options = v.into();
6754 self
6755 }
6756
6757 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6764 (*self.0.stub)
6765 .update_worker_pool(self.0.request, self.0.options)
6766 .await
6767 .map(crate::Response::into_body)
6768 }
6769
6770 pub fn poller(
6772 self,
6773 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6774 {
6775 type Operation = google_cloud_lro::internal::Operation<
6776 crate::model::WorkerPool,
6777 crate::model::WorkerPool,
6778 >;
6779 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6780 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6781 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6782 if let Some(ref mut details) = poller_options.tracing {
6783 details.method_name =
6784 "google_cloud_run_v2::client::WorkerPools::update_worker_pool::until_done";
6785 }
6786
6787 let stub = self.0.stub.clone();
6788 let mut options = self.0.options.clone();
6789 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6790 let query = move |name| {
6791 let stub = stub.clone();
6792 let options = options.clone();
6793 async {
6794 let op = GetOperation::new(stub)
6795 .set_name(name)
6796 .with_options(options)
6797 .send()
6798 .await?;
6799 Ok(Operation::new(op))
6800 }
6801 };
6802
6803 let start = move || async {
6804 let op = self.send().await?;
6805 Ok(Operation::new(op))
6806 };
6807
6808 use google_cloud_lro::internal::PollerExt;
6809 {
6810 google_cloud_lro::internal::new_poller(
6811 polling_error_policy,
6812 polling_backoff_policy,
6813 start,
6814 query,
6815 )
6816 }
6817 .with_options(poller_options)
6818 }
6819
6820 pub fn set_update_mask<T>(mut self, v: T) -> Self
6822 where
6823 T: std::convert::Into<wkt::FieldMask>,
6824 {
6825 self.0.request.update_mask = std::option::Option::Some(v.into());
6826 self
6827 }
6828
6829 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6831 where
6832 T: std::convert::Into<wkt::FieldMask>,
6833 {
6834 self.0.request.update_mask = v.map(|x| x.into());
6835 self
6836 }
6837
6838 pub fn set_worker_pool<T>(mut self, v: T) -> Self
6842 where
6843 T: std::convert::Into<crate::model::WorkerPool>,
6844 {
6845 self.0.request.worker_pool = std::option::Option::Some(v.into());
6846 self
6847 }
6848
6849 pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
6853 where
6854 T: std::convert::Into<crate::model::WorkerPool>,
6855 {
6856 self.0.request.worker_pool = v.map(|x| x.into());
6857 self
6858 }
6859
6860 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
6862 self.0.request.validate_only = v.into();
6863 self
6864 }
6865
6866 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6868 self.0.request.allow_missing = v.into();
6869 self
6870 }
6871
6872 pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
6874 self.0.request.force_new_revision = v.into();
6875 self
6876 }
6877 }
6878
6879 #[doc(hidden)]
6880 impl crate::RequestBuilder for UpdateWorkerPool {
6881 fn request_options(&mut self) -> &mut crate::RequestOptions {
6882 &mut self.0.options
6883 }
6884 }
6885
6886 #[derive(Clone, Debug)]
6904 pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
6905
6906 impl DeleteWorkerPool {
6907 pub(crate) fn new(
6908 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6909 ) -> Self {
6910 Self(RequestBuilder::new(stub))
6911 }
6912
6913 pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
6915 mut self,
6916 v: V,
6917 ) -> Self {
6918 self.0.request = v.into();
6919 self
6920 }
6921
6922 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6924 self.0.options = v.into();
6925 self
6926 }
6927
6928 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6935 (*self.0.stub)
6936 .delete_worker_pool(self.0.request, self.0.options)
6937 .await
6938 .map(crate::Response::into_body)
6939 }
6940
6941 pub fn poller(
6943 self,
6944 ) -> impl google_cloud_lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool>
6945 {
6946 type Operation = google_cloud_lro::internal::Operation<
6947 crate::model::WorkerPool,
6948 crate::model::WorkerPool,
6949 >;
6950 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6951 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6952 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6953 if let Some(ref mut details) = poller_options.tracing {
6954 details.method_name =
6955 "google_cloud_run_v2::client::WorkerPools::delete_worker_pool::until_done";
6956 }
6957
6958 let stub = self.0.stub.clone();
6959 let mut options = self.0.options.clone();
6960 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6961 let query = move |name| {
6962 let stub = stub.clone();
6963 let options = options.clone();
6964 async {
6965 let op = GetOperation::new(stub)
6966 .set_name(name)
6967 .with_options(options)
6968 .send()
6969 .await?;
6970 Ok(Operation::new(op))
6971 }
6972 };
6973
6974 let start = move || async {
6975 let op = self.send().await?;
6976 Ok(Operation::new(op))
6977 };
6978
6979 use google_cloud_lro::internal::PollerExt;
6980 {
6981 google_cloud_lro::internal::new_poller(
6982 polling_error_policy,
6983 polling_backoff_policy,
6984 start,
6985 query,
6986 )
6987 }
6988 .with_options(poller_options)
6989 }
6990
6991 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_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
7001 self.0.request.validate_only = v.into();
7002 self
7003 }
7004
7005 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
7007 self.0.request.etag = v.into();
7008 self
7009 }
7010 }
7011
7012 #[doc(hidden)]
7013 impl crate::RequestBuilder for DeleteWorkerPool {
7014 fn request_options(&mut self) -> &mut crate::RequestOptions {
7015 &mut self.0.options
7016 }
7017 }
7018
7019 #[derive(Clone, Debug)]
7036 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
7037
7038 impl GetIamPolicy {
7039 pub(crate) fn new(
7040 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7041 ) -> Self {
7042 Self(RequestBuilder::new(stub))
7043 }
7044
7045 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
7047 mut self,
7048 v: V,
7049 ) -> Self {
7050 self.0.request = v.into();
7051 self
7052 }
7053
7054 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7056 self.0.options = v.into();
7057 self
7058 }
7059
7060 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
7062 (*self.0.stub)
7063 .get_iam_policy(self.0.request, self.0.options)
7064 .await
7065 .map(crate::Response::into_body)
7066 }
7067
7068 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7072 self.0.request.resource = v.into();
7073 self
7074 }
7075
7076 pub fn set_options<T>(mut self, v: T) -> Self
7078 where
7079 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
7080 {
7081 self.0.request.options = std::option::Option::Some(v.into());
7082 self
7083 }
7084
7085 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7087 where
7088 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
7089 {
7090 self.0.request.options = v.map(|x| x.into());
7091 self
7092 }
7093 }
7094
7095 #[doc(hidden)]
7096 impl crate::RequestBuilder for GetIamPolicy {
7097 fn request_options(&mut self) -> &mut crate::RequestOptions {
7098 &mut self.0.options
7099 }
7100 }
7101
7102 #[derive(Clone, Debug)]
7119 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
7120
7121 impl SetIamPolicy {
7122 pub(crate) fn new(
7123 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7124 ) -> Self {
7125 Self(RequestBuilder::new(stub))
7126 }
7127
7128 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
7130 mut self,
7131 v: V,
7132 ) -> Self {
7133 self.0.request = v.into();
7134 self
7135 }
7136
7137 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7139 self.0.options = v.into();
7140 self
7141 }
7142
7143 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
7145 (*self.0.stub)
7146 .set_iam_policy(self.0.request, self.0.options)
7147 .await
7148 .map(crate::Response::into_body)
7149 }
7150
7151 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7155 self.0.request.resource = v.into();
7156 self
7157 }
7158
7159 pub fn set_policy<T>(mut self, v: T) -> Self
7163 where
7164 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7165 {
7166 self.0.request.policy = std::option::Option::Some(v.into());
7167 self
7168 }
7169
7170 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7174 where
7175 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7176 {
7177 self.0.request.policy = v.map(|x| x.into());
7178 self
7179 }
7180
7181 pub fn set_update_mask<T>(mut self, v: T) -> Self
7183 where
7184 T: std::convert::Into<wkt::FieldMask>,
7185 {
7186 self.0.request.update_mask = std::option::Option::Some(v.into());
7187 self
7188 }
7189
7190 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7192 where
7193 T: std::convert::Into<wkt::FieldMask>,
7194 {
7195 self.0.request.update_mask = v.map(|x| x.into());
7196 self
7197 }
7198 }
7199
7200 #[doc(hidden)]
7201 impl crate::RequestBuilder for SetIamPolicy {
7202 fn request_options(&mut self) -> &mut crate::RequestOptions {
7203 &mut self.0.options
7204 }
7205 }
7206
7207 #[derive(Clone, Debug)]
7224 pub struct TestIamPermissions(
7225 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
7226 );
7227
7228 impl TestIamPermissions {
7229 pub(crate) fn new(
7230 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7231 ) -> Self {
7232 Self(RequestBuilder::new(stub))
7233 }
7234
7235 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
7237 mut self,
7238 v: V,
7239 ) -> Self {
7240 self.0.request = v.into();
7241 self
7242 }
7243
7244 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7246 self.0.options = v.into();
7247 self
7248 }
7249
7250 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
7252 (*self.0.stub)
7253 .test_iam_permissions(self.0.request, self.0.options)
7254 .await
7255 .map(crate::Response::into_body)
7256 }
7257
7258 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7262 self.0.request.resource = v.into();
7263 self
7264 }
7265
7266 pub fn set_permissions<T, V>(mut self, v: T) -> Self
7270 where
7271 T: std::iter::IntoIterator<Item = V>,
7272 V: std::convert::Into<std::string::String>,
7273 {
7274 use std::iter::Iterator;
7275 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7276 self
7277 }
7278 }
7279
7280 #[doc(hidden)]
7281 impl crate::RequestBuilder for TestIamPermissions {
7282 fn request_options(&mut self) -> &mut crate::RequestOptions {
7283 &mut self.0.options
7284 }
7285 }
7286
7287 #[derive(Clone, Debug)]
7308 pub struct ListOperations(
7309 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7310 );
7311
7312 impl ListOperations {
7313 pub(crate) fn new(
7314 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7315 ) -> Self {
7316 Self(RequestBuilder::new(stub))
7317 }
7318
7319 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7321 mut self,
7322 v: V,
7323 ) -> Self {
7324 self.0.request = v.into();
7325 self
7326 }
7327
7328 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7330 self.0.options = v.into();
7331 self
7332 }
7333
7334 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7336 (*self.0.stub)
7337 .list_operations(self.0.request, self.0.options)
7338 .await
7339 .map(crate::Response::into_body)
7340 }
7341
7342 pub fn by_page(
7344 self,
7345 ) -> impl google_cloud_gax::paginator::Paginator<
7346 google_cloud_longrunning::model::ListOperationsResponse,
7347 crate::Error,
7348 > {
7349 use std::clone::Clone;
7350 let token = self.0.request.page_token.clone();
7351 let execute = move |token: String| {
7352 let mut builder = self.clone();
7353 builder.0.request = builder.0.request.set_page_token(token);
7354 builder.send()
7355 };
7356 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7357 }
7358
7359 pub fn by_item(
7361 self,
7362 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7363 google_cloud_longrunning::model::ListOperationsResponse,
7364 crate::Error,
7365 > {
7366 use google_cloud_gax::paginator::Paginator;
7367 self.by_page().items()
7368 }
7369
7370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7372 self.0.request.name = v.into();
7373 self
7374 }
7375
7376 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7378 self.0.request.filter = v.into();
7379 self
7380 }
7381
7382 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7384 self.0.request.page_size = v.into();
7385 self
7386 }
7387
7388 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7390 self.0.request.page_token = v.into();
7391 self
7392 }
7393
7394 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7396 self.0.request.return_partial_success = v.into();
7397 self
7398 }
7399 }
7400
7401 #[doc(hidden)]
7402 impl crate::RequestBuilder for ListOperations {
7403 fn request_options(&mut self) -> &mut crate::RequestOptions {
7404 &mut self.0.options
7405 }
7406 }
7407
7408 #[derive(Clone, Debug)]
7425 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7426
7427 impl GetOperation {
7428 pub(crate) fn new(
7429 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7430 ) -> Self {
7431 Self(RequestBuilder::new(stub))
7432 }
7433
7434 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7436 mut self,
7437 v: V,
7438 ) -> Self {
7439 self.0.request = v.into();
7440 self
7441 }
7442
7443 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7445 self.0.options = v.into();
7446 self
7447 }
7448
7449 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7451 (*self.0.stub)
7452 .get_operation(self.0.request, self.0.options)
7453 .await
7454 .map(crate::Response::into_body)
7455 }
7456
7457 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7459 self.0.request.name = v.into();
7460 self
7461 }
7462 }
7463
7464 #[doc(hidden)]
7465 impl crate::RequestBuilder for GetOperation {
7466 fn request_options(&mut self) -> &mut crate::RequestOptions {
7467 &mut self.0.options
7468 }
7469 }
7470
7471 #[derive(Clone, Debug)]
7488 pub struct DeleteOperation(
7489 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
7490 );
7491
7492 impl DeleteOperation {
7493 pub(crate) fn new(
7494 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7495 ) -> Self {
7496 Self(RequestBuilder::new(stub))
7497 }
7498
7499 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
7501 mut self,
7502 v: V,
7503 ) -> Self {
7504 self.0.request = v.into();
7505 self
7506 }
7507
7508 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7510 self.0.options = v.into();
7511 self
7512 }
7513
7514 pub async fn send(self) -> Result<()> {
7516 (*self.0.stub)
7517 .delete_operation(self.0.request, self.0.options)
7518 .await
7519 .map(crate::Response::into_body)
7520 }
7521
7522 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7524 self.0.request.name = v.into();
7525 self
7526 }
7527 }
7528
7529 #[doc(hidden)]
7530 impl crate::RequestBuilder for DeleteOperation {
7531 fn request_options(&mut self) -> &mut crate::RequestOptions {
7532 &mut self.0.options
7533 }
7534 }
7535
7536 #[derive(Clone, Debug)]
7553 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
7554
7555 impl WaitOperation {
7556 pub(crate) fn new(
7557 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
7558 ) -> Self {
7559 Self(RequestBuilder::new(stub))
7560 }
7561
7562 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
7564 mut self,
7565 v: V,
7566 ) -> Self {
7567 self.0.request = v.into();
7568 self
7569 }
7570
7571 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7573 self.0.options = v.into();
7574 self
7575 }
7576
7577 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7579 (*self.0.stub)
7580 .wait_operation(self.0.request, self.0.options)
7581 .await
7582 .map(crate::Response::into_body)
7583 }
7584
7585 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7587 self.0.request.name = v.into();
7588 self
7589 }
7590
7591 pub fn set_timeout<T>(mut self, v: T) -> Self
7593 where
7594 T: std::convert::Into<wkt::Duration>,
7595 {
7596 self.0.request.timeout = std::option::Option::Some(v.into());
7597 self
7598 }
7599
7600 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
7602 where
7603 T: std::convert::Into<wkt::Duration>,
7604 {
7605 self.0.request.timeout = v.map(|x| x.into());
7606 self
7607 }
7608 }
7609
7610 #[doc(hidden)]
7611 impl crate::RequestBuilder for WaitOperation {
7612 fn request_options(&mut self) -> &mut crate::RequestOptions {
7613 &mut self.0.options
7614 }
7615 }
7616}