1pub mod autoscaling_policy_service {
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::AutoscalingPolicyService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = AutoscalingPolicyService;
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::AutoscalingPolicyService>,
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(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
91 pub struct CreateAutoscalingPolicy(
92 RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
93 );
94
95 impl CreateAutoscalingPolicy {
96 pub(crate) fn new(
97 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
98 ) -> Self {
99 Self(RequestBuilder::new(stub))
100 }
101
102 pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
104 mut self,
105 v: V,
106 ) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
119 (*self.0.stub)
120 .create_autoscaling_policy(self.0.request, self.0.options)
121 .await
122 .map(crate::Response::into_body)
123 }
124
125 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
129 self.0.request.parent = v.into();
130 self
131 }
132
133 pub fn set_policy<T>(mut self, v: T) -> Self
137 where
138 T: std::convert::Into<crate::model::AutoscalingPolicy>,
139 {
140 self.0.request.policy = std::option::Option::Some(v.into());
141 self
142 }
143
144 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
148 where
149 T: std::convert::Into<crate::model::AutoscalingPolicy>,
150 {
151 self.0.request.policy = v.map(|x| x.into());
152 self
153 }
154 }
155
156 #[doc(hidden)]
157 impl crate::RequestBuilder for CreateAutoscalingPolicy {
158 fn request_options(&mut self) -> &mut crate::RequestOptions {
159 &mut self.0.options
160 }
161 }
162
163 #[derive(Clone, Debug)]
180 pub struct UpdateAutoscalingPolicy(
181 RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
182 );
183
184 impl UpdateAutoscalingPolicy {
185 pub(crate) fn new(
186 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
187 ) -> Self {
188 Self(RequestBuilder::new(stub))
189 }
190
191 pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
193 mut self,
194 v: V,
195 ) -> Self {
196 self.0.request = v.into();
197 self
198 }
199
200 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
202 self.0.options = v.into();
203 self
204 }
205
206 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
208 (*self.0.stub)
209 .update_autoscaling_policy(self.0.request, self.0.options)
210 .await
211 .map(crate::Response::into_body)
212 }
213
214 pub fn set_policy<T>(mut self, v: T) -> Self
218 where
219 T: std::convert::Into<crate::model::AutoscalingPolicy>,
220 {
221 self.0.request.policy = std::option::Option::Some(v.into());
222 self
223 }
224
225 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
229 where
230 T: std::convert::Into<crate::model::AutoscalingPolicy>,
231 {
232 self.0.request.policy = v.map(|x| x.into());
233 self
234 }
235 }
236
237 #[doc(hidden)]
238 impl crate::RequestBuilder for UpdateAutoscalingPolicy {
239 fn request_options(&mut self) -> &mut crate::RequestOptions {
240 &mut self.0.options
241 }
242 }
243
244 #[derive(Clone, Debug)]
261 pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
262
263 impl GetAutoscalingPolicy {
264 pub(crate) fn new(
265 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
266 ) -> Self {
267 Self(RequestBuilder::new(stub))
268 }
269
270 pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
272 mut self,
273 v: V,
274 ) -> Self {
275 self.0.request = v.into();
276 self
277 }
278
279 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
281 self.0.options = v.into();
282 self
283 }
284
285 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
287 (*self.0.stub)
288 .get_autoscaling_policy(self.0.request, self.0.options)
289 .await
290 .map(crate::Response::into_body)
291 }
292
293 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
297 self.0.request.name = v.into();
298 self
299 }
300 }
301
302 #[doc(hidden)]
303 impl crate::RequestBuilder for GetAutoscalingPolicy {
304 fn request_options(&mut self) -> &mut crate::RequestOptions {
305 &mut self.0.options
306 }
307 }
308
309 #[derive(Clone, Debug)]
330 pub struct ListAutoscalingPolicies(
331 RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
332 );
333
334 impl ListAutoscalingPolicies {
335 pub(crate) fn new(
336 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
337 ) -> Self {
338 Self(RequestBuilder::new(stub))
339 }
340
341 pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
343 mut self,
344 v: V,
345 ) -> Self {
346 self.0.request = v.into();
347 self
348 }
349
350 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
352 self.0.options = v.into();
353 self
354 }
355
356 pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
358 (*self.0.stub)
359 .list_autoscaling_policies(self.0.request, self.0.options)
360 .await
361 .map(crate::Response::into_body)
362 }
363
364 pub fn by_page(
366 self,
367 ) -> impl google_cloud_gax::paginator::Paginator<
368 crate::model::ListAutoscalingPoliciesResponse,
369 crate::Error,
370 > {
371 use std::clone::Clone;
372 let token = self.0.request.page_token.clone();
373 let execute = move |token: String| {
374 let mut builder = self.clone();
375 builder.0.request = builder.0.request.set_page_token(token);
376 builder.send()
377 };
378 google_cloud_gax::paginator::internal::new_paginator(token, execute)
379 }
380
381 pub fn by_item(
383 self,
384 ) -> impl google_cloud_gax::paginator::ItemPaginator<
385 crate::model::ListAutoscalingPoliciesResponse,
386 crate::Error,
387 > {
388 use google_cloud_gax::paginator::Paginator;
389 self.by_page().items()
390 }
391
392 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
396 self.0.request.parent = v.into();
397 self
398 }
399
400 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
402 self.0.request.page_size = v.into();
403 self
404 }
405
406 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
408 self.0.request.page_token = v.into();
409 self
410 }
411 }
412
413 #[doc(hidden)]
414 impl crate::RequestBuilder for ListAutoscalingPolicies {
415 fn request_options(&mut self) -> &mut crate::RequestOptions {
416 &mut self.0.options
417 }
418 }
419
420 #[derive(Clone, Debug)]
437 pub struct DeleteAutoscalingPolicy(
438 RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
439 );
440
441 impl DeleteAutoscalingPolicy {
442 pub(crate) fn new(
443 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
444 ) -> Self {
445 Self(RequestBuilder::new(stub))
446 }
447
448 pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
450 mut self,
451 v: V,
452 ) -> Self {
453 self.0.request = v.into();
454 self
455 }
456
457 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
459 self.0.options = v.into();
460 self
461 }
462
463 pub async fn send(self) -> Result<()> {
465 (*self.0.stub)
466 .delete_autoscaling_policy(self.0.request, self.0.options)
467 .await
468 .map(crate::Response::into_body)
469 }
470
471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
475 self.0.request.name = v.into();
476 self
477 }
478 }
479
480 #[doc(hidden)]
481 impl crate::RequestBuilder for DeleteAutoscalingPolicy {
482 fn request_options(&mut self) -> &mut crate::RequestOptions {
483 &mut self.0.options
484 }
485 }
486
487 #[derive(Clone, Debug)]
504 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
505
506 impl SetIamPolicy {
507 pub(crate) fn new(
508 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
509 ) -> Self {
510 Self(RequestBuilder::new(stub))
511 }
512
513 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
515 mut self,
516 v: V,
517 ) -> Self {
518 self.0.request = v.into();
519 self
520 }
521
522 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
524 self.0.options = v.into();
525 self
526 }
527
528 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
530 (*self.0.stub)
531 .set_iam_policy(self.0.request, self.0.options)
532 .await
533 .map(crate::Response::into_body)
534 }
535
536 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
540 self.0.request.resource = v.into();
541 self
542 }
543
544 pub fn set_policy<T>(mut self, v: T) -> Self
548 where
549 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
550 {
551 self.0.request.policy = std::option::Option::Some(v.into());
552 self
553 }
554
555 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
559 where
560 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
561 {
562 self.0.request.policy = v.map(|x| x.into());
563 self
564 }
565
566 pub fn set_update_mask<T>(mut self, v: T) -> Self
568 where
569 T: std::convert::Into<wkt::FieldMask>,
570 {
571 self.0.request.update_mask = std::option::Option::Some(v.into());
572 self
573 }
574
575 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
577 where
578 T: std::convert::Into<wkt::FieldMask>,
579 {
580 self.0.request.update_mask = v.map(|x| x.into());
581 self
582 }
583 }
584
585 #[doc(hidden)]
586 impl crate::RequestBuilder for SetIamPolicy {
587 fn request_options(&mut self) -> &mut crate::RequestOptions {
588 &mut self.0.options
589 }
590 }
591
592 #[derive(Clone, Debug)]
609 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
610
611 impl GetIamPolicy {
612 pub(crate) fn new(
613 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
614 ) -> Self {
615 Self(RequestBuilder::new(stub))
616 }
617
618 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
620 mut self,
621 v: V,
622 ) -> Self {
623 self.0.request = v.into();
624 self
625 }
626
627 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
629 self.0.options = v.into();
630 self
631 }
632
633 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
635 (*self.0.stub)
636 .get_iam_policy(self.0.request, self.0.options)
637 .await
638 .map(crate::Response::into_body)
639 }
640
641 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
645 self.0.request.resource = v.into();
646 self
647 }
648
649 pub fn set_options<T>(mut self, v: T) -> Self
651 where
652 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
653 {
654 self.0.request.options = std::option::Option::Some(v.into());
655 self
656 }
657
658 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
660 where
661 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
662 {
663 self.0.request.options = v.map(|x| x.into());
664 self
665 }
666 }
667
668 #[doc(hidden)]
669 impl crate::RequestBuilder for GetIamPolicy {
670 fn request_options(&mut self) -> &mut crate::RequestOptions {
671 &mut self.0.options
672 }
673 }
674
675 #[derive(Clone, Debug)]
692 pub struct TestIamPermissions(
693 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
694 );
695
696 impl TestIamPermissions {
697 pub(crate) fn new(
698 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
699 ) -> Self {
700 Self(RequestBuilder::new(stub))
701 }
702
703 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
705 mut self,
706 v: V,
707 ) -> Self {
708 self.0.request = v.into();
709 self
710 }
711
712 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
714 self.0.options = v.into();
715 self
716 }
717
718 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
720 (*self.0.stub)
721 .test_iam_permissions(self.0.request, self.0.options)
722 .await
723 .map(crate::Response::into_body)
724 }
725
726 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
730 self.0.request.resource = v.into();
731 self
732 }
733
734 pub fn set_permissions<T, V>(mut self, v: T) -> Self
738 where
739 T: std::iter::IntoIterator<Item = V>,
740 V: std::convert::Into<std::string::String>,
741 {
742 use std::iter::Iterator;
743 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
744 self
745 }
746 }
747
748 #[doc(hidden)]
749 impl crate::RequestBuilder for TestIamPermissions {
750 fn request_options(&mut self) -> &mut crate::RequestOptions {
751 &mut self.0.options
752 }
753 }
754
755 #[derive(Clone, Debug)]
776 pub struct ListOperations(
777 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
778 );
779
780 impl ListOperations {
781 pub(crate) fn new(
782 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
783 ) -> Self {
784 Self(RequestBuilder::new(stub))
785 }
786
787 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
789 mut self,
790 v: V,
791 ) -> Self {
792 self.0.request = v.into();
793 self
794 }
795
796 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
798 self.0.options = v.into();
799 self
800 }
801
802 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
804 (*self.0.stub)
805 .list_operations(self.0.request, self.0.options)
806 .await
807 .map(crate::Response::into_body)
808 }
809
810 pub fn by_page(
812 self,
813 ) -> impl google_cloud_gax::paginator::Paginator<
814 google_cloud_longrunning::model::ListOperationsResponse,
815 crate::Error,
816 > {
817 use std::clone::Clone;
818 let token = self.0.request.page_token.clone();
819 let execute = move |token: String| {
820 let mut builder = self.clone();
821 builder.0.request = builder.0.request.set_page_token(token);
822 builder.send()
823 };
824 google_cloud_gax::paginator::internal::new_paginator(token, execute)
825 }
826
827 pub fn by_item(
829 self,
830 ) -> impl google_cloud_gax::paginator::ItemPaginator<
831 google_cloud_longrunning::model::ListOperationsResponse,
832 crate::Error,
833 > {
834 use google_cloud_gax::paginator::Paginator;
835 self.by_page().items()
836 }
837
838 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
840 self.0.request.name = v.into();
841 self
842 }
843
844 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
846 self.0.request.filter = v.into();
847 self
848 }
849
850 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
852 self.0.request.page_size = v.into();
853 self
854 }
855
856 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
858 self.0.request.page_token = v.into();
859 self
860 }
861
862 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
864 self.0.request.return_partial_success = v.into();
865 self
866 }
867 }
868
869 #[doc(hidden)]
870 impl crate::RequestBuilder for ListOperations {
871 fn request_options(&mut self) -> &mut crate::RequestOptions {
872 &mut self.0.options
873 }
874 }
875
876 #[derive(Clone, Debug)]
893 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
894
895 impl GetOperation {
896 pub(crate) fn new(
897 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
898 ) -> Self {
899 Self(RequestBuilder::new(stub))
900 }
901
902 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
904 mut self,
905 v: V,
906 ) -> Self {
907 self.0.request = v.into();
908 self
909 }
910
911 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
913 self.0.options = v.into();
914 self
915 }
916
917 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
919 (*self.0.stub)
920 .get_operation(self.0.request, self.0.options)
921 .await
922 .map(crate::Response::into_body)
923 }
924
925 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
927 self.0.request.name = v.into();
928 self
929 }
930 }
931
932 #[doc(hidden)]
933 impl crate::RequestBuilder for GetOperation {
934 fn request_options(&mut self) -> &mut crate::RequestOptions {
935 &mut self.0.options
936 }
937 }
938
939 #[derive(Clone, Debug)]
956 pub struct DeleteOperation(
957 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
958 );
959
960 impl DeleteOperation {
961 pub(crate) fn new(
962 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
963 ) -> Self {
964 Self(RequestBuilder::new(stub))
965 }
966
967 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
969 mut self,
970 v: V,
971 ) -> Self {
972 self.0.request = v.into();
973 self
974 }
975
976 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
978 self.0.options = v.into();
979 self
980 }
981
982 pub async fn send(self) -> Result<()> {
984 (*self.0.stub)
985 .delete_operation(self.0.request, self.0.options)
986 .await
987 .map(crate::Response::into_body)
988 }
989
990 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
992 self.0.request.name = v.into();
993 self
994 }
995 }
996
997 #[doc(hidden)]
998 impl crate::RequestBuilder for DeleteOperation {
999 fn request_options(&mut self) -> &mut crate::RequestOptions {
1000 &mut self.0.options
1001 }
1002 }
1003
1004 #[derive(Clone, Debug)]
1021 pub struct CancelOperation(
1022 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1023 );
1024
1025 impl CancelOperation {
1026 pub(crate) fn new(
1027 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1028 ) -> Self {
1029 Self(RequestBuilder::new(stub))
1030 }
1031
1032 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1034 mut self,
1035 v: V,
1036 ) -> Self {
1037 self.0.request = v.into();
1038 self
1039 }
1040
1041 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1043 self.0.options = v.into();
1044 self
1045 }
1046
1047 pub async fn send(self) -> Result<()> {
1049 (*self.0.stub)
1050 .cancel_operation(self.0.request, self.0.options)
1051 .await
1052 .map(crate::Response::into_body)
1053 }
1054
1055 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1057 self.0.request.name = v.into();
1058 self
1059 }
1060 }
1061
1062 #[doc(hidden)]
1063 impl crate::RequestBuilder for CancelOperation {
1064 fn request_options(&mut self) -> &mut crate::RequestOptions {
1065 &mut self.0.options
1066 }
1067 }
1068}
1069
1070pub mod batch_controller {
1072 use crate::Result;
1073
1074 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1088
1089 pub(crate) mod client {
1090 use super::super::super::client::BatchController;
1091 pub struct Factory;
1092 impl crate::ClientFactory for Factory {
1093 type Client = BatchController;
1094 type Credentials = gaxi::options::Credentials;
1095 async fn build(
1096 self,
1097 config: gaxi::options::ClientConfig,
1098 ) -> crate::ClientBuilderResult<Self::Client> {
1099 Self::Client::new(config).await
1100 }
1101 }
1102 }
1103
1104 #[derive(Clone, Debug)]
1106 pub(crate) struct RequestBuilder<R: std::default::Default> {
1107 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1108 request: R,
1109 options: crate::RequestOptions,
1110 }
1111
1112 impl<R> RequestBuilder<R>
1113 where
1114 R: std::default::Default,
1115 {
1116 pub(crate) fn new(
1117 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1118 ) -> Self {
1119 Self {
1120 stub,
1121 request: R::default(),
1122 options: crate::RequestOptions::default(),
1123 }
1124 }
1125 }
1126
1127 #[derive(Clone, Debug)]
1145 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1146
1147 impl CreateBatch {
1148 pub(crate) fn new(
1149 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1150 ) -> Self {
1151 Self(RequestBuilder::new(stub))
1152 }
1153
1154 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1156 self.0.request = v.into();
1157 self
1158 }
1159
1160 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1162 self.0.options = v.into();
1163 self
1164 }
1165
1166 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1173 (*self.0.stub)
1174 .create_batch(self.0.request, self.0.options)
1175 .await
1176 .map(crate::Response::into_body)
1177 }
1178
1179 pub fn poller(
1181 self,
1182 ) -> impl google_cloud_lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata>
1183 {
1184 type Operation = google_cloud_lro::internal::Operation<
1185 crate::model::Batch,
1186 crate::model::BatchOperationMetadata,
1187 >;
1188 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1189 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1190 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1191 if let Some(ref mut details) = poller_options.tracing {
1192 details.method_name =
1193 "google_cloud_dataproc_v1::client::BatchController::create_batch::until_done";
1194 }
1195
1196 let stub = self.0.stub.clone();
1197 let mut options = self.0.options.clone();
1198 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1199 let query = move |name| {
1200 let stub = stub.clone();
1201 let options = options.clone();
1202 async {
1203 let op = GetOperation::new(stub)
1204 .set_name(name)
1205 .with_options(options)
1206 .send()
1207 .await?;
1208 Ok(Operation::new(op))
1209 }
1210 };
1211
1212 let start = move || async {
1213 let op = self.send().await?;
1214 Ok(Operation::new(op))
1215 };
1216
1217 use google_cloud_lro::internal::PollerExt;
1218 {
1219 google_cloud_lro::internal::new_poller(
1220 polling_error_policy,
1221 polling_backoff_policy,
1222 start,
1223 query,
1224 )
1225 }
1226 .with_options(poller_options)
1227 }
1228
1229 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1233 self.0.request.parent = v.into();
1234 self
1235 }
1236
1237 pub fn set_batch<T>(mut self, v: T) -> Self
1241 where
1242 T: std::convert::Into<crate::model::Batch>,
1243 {
1244 self.0.request.batch = std::option::Option::Some(v.into());
1245 self
1246 }
1247
1248 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1252 where
1253 T: std::convert::Into<crate::model::Batch>,
1254 {
1255 self.0.request.batch = v.map(|x| x.into());
1256 self
1257 }
1258
1259 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1261 self.0.request.batch_id = v.into();
1262 self
1263 }
1264
1265 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.0.request.request_id = v.into();
1268 self
1269 }
1270 }
1271
1272 #[doc(hidden)]
1273 impl crate::RequestBuilder for CreateBatch {
1274 fn request_options(&mut self) -> &mut crate::RequestOptions {
1275 &mut self.0.options
1276 }
1277 }
1278
1279 #[derive(Clone, Debug)]
1296 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1297
1298 impl GetBatch {
1299 pub(crate) fn new(
1300 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1301 ) -> Self {
1302 Self(RequestBuilder::new(stub))
1303 }
1304
1305 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1307 self.0.request = v.into();
1308 self
1309 }
1310
1311 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1313 self.0.options = v.into();
1314 self
1315 }
1316
1317 pub async fn send(self) -> Result<crate::model::Batch> {
1319 (*self.0.stub)
1320 .get_batch(self.0.request, self.0.options)
1321 .await
1322 .map(crate::Response::into_body)
1323 }
1324
1325 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1329 self.0.request.name = v.into();
1330 self
1331 }
1332 }
1333
1334 #[doc(hidden)]
1335 impl crate::RequestBuilder for GetBatch {
1336 fn request_options(&mut self) -> &mut crate::RequestOptions {
1337 &mut self.0.options
1338 }
1339 }
1340
1341 #[derive(Clone, Debug)]
1362 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1363
1364 impl ListBatches {
1365 pub(crate) fn new(
1366 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1367 ) -> Self {
1368 Self(RequestBuilder::new(stub))
1369 }
1370
1371 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1373 self.0.request = v.into();
1374 self
1375 }
1376
1377 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1379 self.0.options = v.into();
1380 self
1381 }
1382
1383 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1385 (*self.0.stub)
1386 .list_batches(self.0.request, self.0.options)
1387 .await
1388 .map(crate::Response::into_body)
1389 }
1390
1391 pub fn by_page(
1393 self,
1394 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListBatchesResponse, crate::Error>
1395 {
1396 use std::clone::Clone;
1397 let token = self.0.request.page_token.clone();
1398 let execute = move |token: String| {
1399 let mut builder = self.clone();
1400 builder.0.request = builder.0.request.set_page_token(token);
1401 builder.send()
1402 };
1403 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1404 }
1405
1406 pub fn by_item(
1408 self,
1409 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1410 crate::model::ListBatchesResponse,
1411 crate::Error,
1412 > {
1413 use google_cloud_gax::paginator::Paginator;
1414 self.by_page().items()
1415 }
1416
1417 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1421 self.0.request.parent = v.into();
1422 self
1423 }
1424
1425 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1427 self.0.request.page_size = v.into();
1428 self
1429 }
1430
1431 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1433 self.0.request.page_token = v.into();
1434 self
1435 }
1436
1437 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1439 self.0.request.filter = v.into();
1440 self
1441 }
1442
1443 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1445 self.0.request.order_by = v.into();
1446 self
1447 }
1448 }
1449
1450 #[doc(hidden)]
1451 impl crate::RequestBuilder for ListBatches {
1452 fn request_options(&mut self) -> &mut crate::RequestOptions {
1453 &mut self.0.options
1454 }
1455 }
1456
1457 #[derive(Clone, Debug)]
1474 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1475
1476 impl DeleteBatch {
1477 pub(crate) fn new(
1478 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1479 ) -> Self {
1480 Self(RequestBuilder::new(stub))
1481 }
1482
1483 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1485 self.0.request = v.into();
1486 self
1487 }
1488
1489 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1491 self.0.options = v.into();
1492 self
1493 }
1494
1495 pub async fn send(self) -> Result<()> {
1497 (*self.0.stub)
1498 .delete_batch(self.0.request, self.0.options)
1499 .await
1500 .map(crate::Response::into_body)
1501 }
1502
1503 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1507 self.0.request.name = v.into();
1508 self
1509 }
1510 }
1511
1512 #[doc(hidden)]
1513 impl crate::RequestBuilder for DeleteBatch {
1514 fn request_options(&mut self) -> &mut crate::RequestOptions {
1515 &mut self.0.options
1516 }
1517 }
1518
1519 #[derive(Clone, Debug)]
1536 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1537
1538 impl SetIamPolicy {
1539 pub(crate) fn new(
1540 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1541 ) -> Self {
1542 Self(RequestBuilder::new(stub))
1543 }
1544
1545 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1547 mut self,
1548 v: V,
1549 ) -> Self {
1550 self.0.request = v.into();
1551 self
1552 }
1553
1554 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1556 self.0.options = v.into();
1557 self
1558 }
1559
1560 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1562 (*self.0.stub)
1563 .set_iam_policy(self.0.request, self.0.options)
1564 .await
1565 .map(crate::Response::into_body)
1566 }
1567
1568 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1572 self.0.request.resource = v.into();
1573 self
1574 }
1575
1576 pub fn set_policy<T>(mut self, v: T) -> Self
1580 where
1581 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1582 {
1583 self.0.request.policy = std::option::Option::Some(v.into());
1584 self
1585 }
1586
1587 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1591 where
1592 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1593 {
1594 self.0.request.policy = v.map(|x| x.into());
1595 self
1596 }
1597
1598 pub fn set_update_mask<T>(mut self, v: T) -> Self
1600 where
1601 T: std::convert::Into<wkt::FieldMask>,
1602 {
1603 self.0.request.update_mask = std::option::Option::Some(v.into());
1604 self
1605 }
1606
1607 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1609 where
1610 T: std::convert::Into<wkt::FieldMask>,
1611 {
1612 self.0.request.update_mask = v.map(|x| x.into());
1613 self
1614 }
1615 }
1616
1617 #[doc(hidden)]
1618 impl crate::RequestBuilder for SetIamPolicy {
1619 fn request_options(&mut self) -> &mut crate::RequestOptions {
1620 &mut self.0.options
1621 }
1622 }
1623
1624 #[derive(Clone, Debug)]
1641 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1642
1643 impl GetIamPolicy {
1644 pub(crate) fn new(
1645 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1646 ) -> Self {
1647 Self(RequestBuilder::new(stub))
1648 }
1649
1650 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1652 mut self,
1653 v: V,
1654 ) -> Self {
1655 self.0.request = v.into();
1656 self
1657 }
1658
1659 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1661 self.0.options = v.into();
1662 self
1663 }
1664
1665 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1667 (*self.0.stub)
1668 .get_iam_policy(self.0.request, self.0.options)
1669 .await
1670 .map(crate::Response::into_body)
1671 }
1672
1673 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1677 self.0.request.resource = v.into();
1678 self
1679 }
1680
1681 pub fn set_options<T>(mut self, v: T) -> Self
1683 where
1684 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1685 {
1686 self.0.request.options = std::option::Option::Some(v.into());
1687 self
1688 }
1689
1690 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1692 where
1693 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1694 {
1695 self.0.request.options = v.map(|x| x.into());
1696 self
1697 }
1698 }
1699
1700 #[doc(hidden)]
1701 impl crate::RequestBuilder for GetIamPolicy {
1702 fn request_options(&mut self) -> &mut crate::RequestOptions {
1703 &mut self.0.options
1704 }
1705 }
1706
1707 #[derive(Clone, Debug)]
1724 pub struct TestIamPermissions(
1725 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1726 );
1727
1728 impl TestIamPermissions {
1729 pub(crate) fn new(
1730 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1731 ) -> Self {
1732 Self(RequestBuilder::new(stub))
1733 }
1734
1735 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1737 mut self,
1738 v: V,
1739 ) -> Self {
1740 self.0.request = v.into();
1741 self
1742 }
1743
1744 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1746 self.0.options = v.into();
1747 self
1748 }
1749
1750 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1752 (*self.0.stub)
1753 .test_iam_permissions(self.0.request, self.0.options)
1754 .await
1755 .map(crate::Response::into_body)
1756 }
1757
1758 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1762 self.0.request.resource = v.into();
1763 self
1764 }
1765
1766 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1770 where
1771 T: std::iter::IntoIterator<Item = V>,
1772 V: std::convert::Into<std::string::String>,
1773 {
1774 use std::iter::Iterator;
1775 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1776 self
1777 }
1778 }
1779
1780 #[doc(hidden)]
1781 impl crate::RequestBuilder for TestIamPermissions {
1782 fn request_options(&mut self) -> &mut crate::RequestOptions {
1783 &mut self.0.options
1784 }
1785 }
1786
1787 #[derive(Clone, Debug)]
1808 pub struct ListOperations(
1809 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1810 );
1811
1812 impl ListOperations {
1813 pub(crate) fn new(
1814 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1815 ) -> Self {
1816 Self(RequestBuilder::new(stub))
1817 }
1818
1819 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1821 mut self,
1822 v: V,
1823 ) -> Self {
1824 self.0.request = v.into();
1825 self
1826 }
1827
1828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1830 self.0.options = v.into();
1831 self
1832 }
1833
1834 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1836 (*self.0.stub)
1837 .list_operations(self.0.request, self.0.options)
1838 .await
1839 .map(crate::Response::into_body)
1840 }
1841
1842 pub fn by_page(
1844 self,
1845 ) -> impl google_cloud_gax::paginator::Paginator<
1846 google_cloud_longrunning::model::ListOperationsResponse,
1847 crate::Error,
1848 > {
1849 use std::clone::Clone;
1850 let token = self.0.request.page_token.clone();
1851 let execute = move |token: String| {
1852 let mut builder = self.clone();
1853 builder.0.request = builder.0.request.set_page_token(token);
1854 builder.send()
1855 };
1856 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1857 }
1858
1859 pub fn by_item(
1861 self,
1862 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1863 google_cloud_longrunning::model::ListOperationsResponse,
1864 crate::Error,
1865 > {
1866 use google_cloud_gax::paginator::Paginator;
1867 self.by_page().items()
1868 }
1869
1870 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1872 self.0.request.name = v.into();
1873 self
1874 }
1875
1876 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1878 self.0.request.filter = v.into();
1879 self
1880 }
1881
1882 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1884 self.0.request.page_size = v.into();
1885 self
1886 }
1887
1888 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1890 self.0.request.page_token = v.into();
1891 self
1892 }
1893
1894 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1896 self.0.request.return_partial_success = v.into();
1897 self
1898 }
1899 }
1900
1901 #[doc(hidden)]
1902 impl crate::RequestBuilder for ListOperations {
1903 fn request_options(&mut self) -> &mut crate::RequestOptions {
1904 &mut self.0.options
1905 }
1906 }
1907
1908 #[derive(Clone, Debug)]
1925 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1926
1927 impl GetOperation {
1928 pub(crate) fn new(
1929 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1930 ) -> Self {
1931 Self(RequestBuilder::new(stub))
1932 }
1933
1934 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1936 mut self,
1937 v: V,
1938 ) -> Self {
1939 self.0.request = v.into();
1940 self
1941 }
1942
1943 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1945 self.0.options = v.into();
1946 self
1947 }
1948
1949 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1951 (*self.0.stub)
1952 .get_operation(self.0.request, self.0.options)
1953 .await
1954 .map(crate::Response::into_body)
1955 }
1956
1957 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1959 self.0.request.name = v.into();
1960 self
1961 }
1962 }
1963
1964 #[doc(hidden)]
1965 impl crate::RequestBuilder for GetOperation {
1966 fn request_options(&mut self) -> &mut crate::RequestOptions {
1967 &mut self.0.options
1968 }
1969 }
1970
1971 #[derive(Clone, Debug)]
1988 pub struct DeleteOperation(
1989 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1990 );
1991
1992 impl DeleteOperation {
1993 pub(crate) fn new(
1994 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1995 ) -> Self {
1996 Self(RequestBuilder::new(stub))
1997 }
1998
1999 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2001 mut self,
2002 v: V,
2003 ) -> Self {
2004 self.0.request = v.into();
2005 self
2006 }
2007
2008 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2010 self.0.options = v.into();
2011 self
2012 }
2013
2014 pub async fn send(self) -> Result<()> {
2016 (*self.0.stub)
2017 .delete_operation(self.0.request, self.0.options)
2018 .await
2019 .map(crate::Response::into_body)
2020 }
2021
2022 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2024 self.0.request.name = v.into();
2025 self
2026 }
2027 }
2028
2029 #[doc(hidden)]
2030 impl crate::RequestBuilder for DeleteOperation {
2031 fn request_options(&mut self) -> &mut crate::RequestOptions {
2032 &mut self.0.options
2033 }
2034 }
2035
2036 #[derive(Clone, Debug)]
2053 pub struct CancelOperation(
2054 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2055 );
2056
2057 impl CancelOperation {
2058 pub(crate) fn new(
2059 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2060 ) -> Self {
2061 Self(RequestBuilder::new(stub))
2062 }
2063
2064 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2066 mut self,
2067 v: V,
2068 ) -> 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<()> {
2081 (*self.0.stub)
2082 .cancel_operation(self.0.request, self.0.options)
2083 .await
2084 .map(crate::Response::into_body)
2085 }
2086
2087 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2089 self.0.request.name = v.into();
2090 self
2091 }
2092 }
2093
2094 #[doc(hidden)]
2095 impl crate::RequestBuilder for CancelOperation {
2096 fn request_options(&mut self) -> &mut crate::RequestOptions {
2097 &mut self.0.options
2098 }
2099 }
2100}
2101
2102pub mod cluster_controller {
2104 use crate::Result;
2105
2106 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2120
2121 pub(crate) mod client {
2122 use super::super::super::client::ClusterController;
2123 pub struct Factory;
2124 impl crate::ClientFactory for Factory {
2125 type Client = ClusterController;
2126 type Credentials = gaxi::options::Credentials;
2127 async fn build(
2128 self,
2129 config: gaxi::options::ClientConfig,
2130 ) -> crate::ClientBuilderResult<Self::Client> {
2131 Self::Client::new(config).await
2132 }
2133 }
2134 }
2135
2136 #[derive(Clone, Debug)]
2138 pub(crate) struct RequestBuilder<R: std::default::Default> {
2139 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2140 request: R,
2141 options: crate::RequestOptions,
2142 }
2143
2144 impl<R> RequestBuilder<R>
2145 where
2146 R: std::default::Default,
2147 {
2148 pub(crate) fn new(
2149 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2150 ) -> Self {
2151 Self {
2152 stub,
2153 request: R::default(),
2154 options: crate::RequestOptions::default(),
2155 }
2156 }
2157 }
2158
2159 #[derive(Clone, Debug)]
2177 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2178
2179 impl CreateCluster {
2180 pub(crate) fn new(
2181 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2182 ) -> Self {
2183 Self(RequestBuilder::new(stub))
2184 }
2185
2186 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2188 self.0.request = v.into();
2189 self
2190 }
2191
2192 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2194 self.0.options = v.into();
2195 self
2196 }
2197
2198 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2205 (*self.0.stub)
2206 .create_cluster(self.0.request, self.0.options)
2207 .await
2208 .map(crate::Response::into_body)
2209 }
2210
2211 pub fn poller(
2213 self,
2214 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2215 {
2216 type Operation = google_cloud_lro::internal::Operation<
2217 crate::model::Cluster,
2218 crate::model::ClusterOperationMetadata,
2219 >;
2220 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2221 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2222 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2223 if let Some(ref mut details) = poller_options.tracing {
2224 details.method_name = "google_cloud_dataproc_v1::client::ClusterController::create_cluster::until_done";
2225 }
2226
2227 let stub = self.0.stub.clone();
2228 let mut options = self.0.options.clone();
2229 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2230 let query = move |name| {
2231 let stub = stub.clone();
2232 let options = options.clone();
2233 async {
2234 let op = GetOperation::new(stub)
2235 .set_name(name)
2236 .with_options(options)
2237 .send()
2238 .await?;
2239 Ok(Operation::new(op))
2240 }
2241 };
2242
2243 let start = move || async {
2244 let op = self.send().await?;
2245 Ok(Operation::new(op))
2246 };
2247
2248 use google_cloud_lro::internal::PollerExt;
2249 {
2250 google_cloud_lro::internal::new_poller(
2251 polling_error_policy,
2252 polling_backoff_policy,
2253 start,
2254 query,
2255 )
2256 }
2257 .with_options(poller_options)
2258 }
2259
2260 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2264 self.0.request.project_id = v.into();
2265 self
2266 }
2267
2268 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2272 self.0.request.region = v.into();
2273 self
2274 }
2275
2276 pub fn set_cluster<T>(mut self, v: T) -> Self
2280 where
2281 T: std::convert::Into<crate::model::Cluster>,
2282 {
2283 self.0.request.cluster = std::option::Option::Some(v.into());
2284 self
2285 }
2286
2287 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2291 where
2292 T: std::convert::Into<crate::model::Cluster>,
2293 {
2294 self.0.request.cluster = v.map(|x| x.into());
2295 self
2296 }
2297
2298 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2300 self.0.request.request_id = v.into();
2301 self
2302 }
2303
2304 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2306 mut self,
2307 v: T,
2308 ) -> Self {
2309 self.0.request.action_on_failed_primary_workers = v.into();
2310 self
2311 }
2312 }
2313
2314 #[doc(hidden)]
2315 impl crate::RequestBuilder for CreateCluster {
2316 fn request_options(&mut self) -> &mut crate::RequestOptions {
2317 &mut self.0.options
2318 }
2319 }
2320
2321 #[derive(Clone, Debug)]
2339 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2340
2341 impl UpdateCluster {
2342 pub(crate) fn new(
2343 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2344 ) -> Self {
2345 Self(RequestBuilder::new(stub))
2346 }
2347
2348 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2350 self.0.request = v.into();
2351 self
2352 }
2353
2354 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2356 self.0.options = v.into();
2357 self
2358 }
2359
2360 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2367 (*self.0.stub)
2368 .update_cluster(self.0.request, self.0.options)
2369 .await
2370 .map(crate::Response::into_body)
2371 }
2372
2373 pub fn poller(
2375 self,
2376 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2377 {
2378 type Operation = google_cloud_lro::internal::Operation<
2379 crate::model::Cluster,
2380 crate::model::ClusterOperationMetadata,
2381 >;
2382 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2383 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2384 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2385 if let Some(ref mut details) = poller_options.tracing {
2386 details.method_name = "google_cloud_dataproc_v1::client::ClusterController::update_cluster::until_done";
2387 }
2388
2389 let stub = self.0.stub.clone();
2390 let mut options = self.0.options.clone();
2391 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2392 let query = move |name| {
2393 let stub = stub.clone();
2394 let options = options.clone();
2395 async {
2396 let op = GetOperation::new(stub)
2397 .set_name(name)
2398 .with_options(options)
2399 .send()
2400 .await?;
2401 Ok(Operation::new(op))
2402 }
2403 };
2404
2405 let start = move || async {
2406 let op = self.send().await?;
2407 Ok(Operation::new(op))
2408 };
2409
2410 use google_cloud_lro::internal::PollerExt;
2411 {
2412 google_cloud_lro::internal::new_poller(
2413 polling_error_policy,
2414 polling_backoff_policy,
2415 start,
2416 query,
2417 )
2418 }
2419 .with_options(poller_options)
2420 }
2421
2422 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2426 self.0.request.project_id = v.into();
2427 self
2428 }
2429
2430 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2434 self.0.request.region = v.into();
2435 self
2436 }
2437
2438 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2442 self.0.request.cluster_name = v.into();
2443 self
2444 }
2445
2446 pub fn set_cluster<T>(mut self, v: T) -> Self
2450 where
2451 T: std::convert::Into<crate::model::Cluster>,
2452 {
2453 self.0.request.cluster = std::option::Option::Some(v.into());
2454 self
2455 }
2456
2457 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2461 where
2462 T: std::convert::Into<crate::model::Cluster>,
2463 {
2464 self.0.request.cluster = v.map(|x| x.into());
2465 self
2466 }
2467
2468 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2470 where
2471 T: std::convert::Into<wkt::Duration>,
2472 {
2473 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2474 self
2475 }
2476
2477 pub fn set_or_clear_graceful_decommission_timeout<T>(
2479 mut self,
2480 v: std::option::Option<T>,
2481 ) -> Self
2482 where
2483 T: std::convert::Into<wkt::Duration>,
2484 {
2485 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2486 self
2487 }
2488
2489 pub fn set_update_mask<T>(mut self, v: T) -> Self
2493 where
2494 T: std::convert::Into<wkt::FieldMask>,
2495 {
2496 self.0.request.update_mask = std::option::Option::Some(v.into());
2497 self
2498 }
2499
2500 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2504 where
2505 T: std::convert::Into<wkt::FieldMask>,
2506 {
2507 self.0.request.update_mask = v.map(|x| x.into());
2508 self
2509 }
2510
2511 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2513 self.0.request.request_id = v.into();
2514 self
2515 }
2516 }
2517
2518 #[doc(hidden)]
2519 impl crate::RequestBuilder for UpdateCluster {
2520 fn request_options(&mut self) -> &mut crate::RequestOptions {
2521 &mut self.0.options
2522 }
2523 }
2524
2525 #[derive(Clone, Debug)]
2543 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2544
2545 impl StopCluster {
2546 pub(crate) fn new(
2547 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2548 ) -> Self {
2549 Self(RequestBuilder::new(stub))
2550 }
2551
2552 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2554 self.0.request = v.into();
2555 self
2556 }
2557
2558 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2560 self.0.options = v.into();
2561 self
2562 }
2563
2564 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2571 (*self.0.stub)
2572 .stop_cluster(self.0.request, self.0.options)
2573 .await
2574 .map(crate::Response::into_body)
2575 }
2576
2577 pub fn poller(
2579 self,
2580 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2581 {
2582 type Operation = google_cloud_lro::internal::Operation<
2583 crate::model::Cluster,
2584 crate::model::ClusterOperationMetadata,
2585 >;
2586 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2587 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2588 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2589 if let Some(ref mut details) = poller_options.tracing {
2590 details.method_name =
2591 "google_cloud_dataproc_v1::client::ClusterController::stop_cluster::until_done";
2592 }
2593
2594 let stub = self.0.stub.clone();
2595 let mut options = self.0.options.clone();
2596 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2597 let query = move |name| {
2598 let stub = stub.clone();
2599 let options = options.clone();
2600 async {
2601 let op = GetOperation::new(stub)
2602 .set_name(name)
2603 .with_options(options)
2604 .send()
2605 .await?;
2606 Ok(Operation::new(op))
2607 }
2608 };
2609
2610 let start = move || async {
2611 let op = self.send().await?;
2612 Ok(Operation::new(op))
2613 };
2614
2615 use google_cloud_lro::internal::PollerExt;
2616 {
2617 google_cloud_lro::internal::new_poller(
2618 polling_error_policy,
2619 polling_backoff_policy,
2620 start,
2621 query,
2622 )
2623 }
2624 .with_options(poller_options)
2625 }
2626
2627 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2631 self.0.request.project_id = v.into();
2632 self
2633 }
2634
2635 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2639 self.0.request.region = v.into();
2640 self
2641 }
2642
2643 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2647 self.0.request.cluster_name = v.into();
2648 self
2649 }
2650
2651 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2653 self.0.request.cluster_uuid = v.into();
2654 self
2655 }
2656
2657 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2659 self.0.request.request_id = v.into();
2660 self
2661 }
2662 }
2663
2664 #[doc(hidden)]
2665 impl crate::RequestBuilder for StopCluster {
2666 fn request_options(&mut self) -> &mut crate::RequestOptions {
2667 &mut self.0.options
2668 }
2669 }
2670
2671 #[derive(Clone, Debug)]
2689 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2690
2691 impl StartCluster {
2692 pub(crate) fn new(
2693 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2694 ) -> Self {
2695 Self(RequestBuilder::new(stub))
2696 }
2697
2698 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2700 self.0.request = v.into();
2701 self
2702 }
2703
2704 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2706 self.0.options = v.into();
2707 self
2708 }
2709
2710 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2717 (*self.0.stub)
2718 .start_cluster(self.0.request, self.0.options)
2719 .await
2720 .map(crate::Response::into_body)
2721 }
2722
2723 pub fn poller(
2725 self,
2726 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2727 {
2728 type Operation = google_cloud_lro::internal::Operation<
2729 crate::model::Cluster,
2730 crate::model::ClusterOperationMetadata,
2731 >;
2732 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2733 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2734 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2735 if let Some(ref mut details) = poller_options.tracing {
2736 details.method_name = "google_cloud_dataproc_v1::client::ClusterController::start_cluster::until_done";
2737 }
2738
2739 let stub = self.0.stub.clone();
2740 let mut options = self.0.options.clone();
2741 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2742 let query = move |name| {
2743 let stub = stub.clone();
2744 let options = options.clone();
2745 async {
2746 let op = GetOperation::new(stub)
2747 .set_name(name)
2748 .with_options(options)
2749 .send()
2750 .await?;
2751 Ok(Operation::new(op))
2752 }
2753 };
2754
2755 let start = move || async {
2756 let op = self.send().await?;
2757 Ok(Operation::new(op))
2758 };
2759
2760 use google_cloud_lro::internal::PollerExt;
2761 {
2762 google_cloud_lro::internal::new_poller(
2763 polling_error_policy,
2764 polling_backoff_policy,
2765 start,
2766 query,
2767 )
2768 }
2769 .with_options(poller_options)
2770 }
2771
2772 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2776 self.0.request.project_id = v.into();
2777 self
2778 }
2779
2780 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2784 self.0.request.region = v.into();
2785 self
2786 }
2787
2788 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2792 self.0.request.cluster_name = v.into();
2793 self
2794 }
2795
2796 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2798 self.0.request.cluster_uuid = v.into();
2799 self
2800 }
2801
2802 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2804 self.0.request.request_id = v.into();
2805 self
2806 }
2807 }
2808
2809 #[doc(hidden)]
2810 impl crate::RequestBuilder for StartCluster {
2811 fn request_options(&mut self) -> &mut crate::RequestOptions {
2812 &mut self.0.options
2813 }
2814 }
2815
2816 #[derive(Clone, Debug)]
2834 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2835
2836 impl DeleteCluster {
2837 pub(crate) fn new(
2838 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2839 ) -> Self {
2840 Self(RequestBuilder::new(stub))
2841 }
2842
2843 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2845 self.0.request = v.into();
2846 self
2847 }
2848
2849 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2851 self.0.options = v.into();
2852 self
2853 }
2854
2855 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2862 (*self.0.stub)
2863 .delete_cluster(self.0.request, self.0.options)
2864 .await
2865 .map(crate::Response::into_body)
2866 }
2867
2868 pub fn poller(
2870 self,
2871 ) -> impl google_cloud_lro::Poller<(), crate::model::ClusterOperationMetadata> {
2872 type Operation = google_cloud_lro::internal::Operation<
2873 wkt::Empty,
2874 crate::model::ClusterOperationMetadata,
2875 >;
2876 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2877 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2878 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2879 if let Some(ref mut details) = poller_options.tracing {
2880 details.method_name = "google_cloud_dataproc_v1::client::ClusterController::delete_cluster::until_done";
2881 }
2882
2883 let stub = self.0.stub.clone();
2884 let mut options = self.0.options.clone();
2885 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2886 let query = move |name| {
2887 let stub = stub.clone();
2888 let options = options.clone();
2889 async {
2890 let op = GetOperation::new(stub)
2891 .set_name(name)
2892 .with_options(options)
2893 .send()
2894 .await?;
2895 Ok(Operation::new(op))
2896 }
2897 };
2898
2899 let start = move || async {
2900 let op = self.send().await?;
2901 Ok(Operation::new(op))
2902 };
2903
2904 use google_cloud_lro::internal::PollerExt;
2905 {
2906 google_cloud_lro::internal::new_unit_response_poller(
2907 polling_error_policy,
2908 polling_backoff_policy,
2909 start,
2910 query,
2911 )
2912 }
2913 .with_options(poller_options)
2914 }
2915
2916 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2920 self.0.request.project_id = v.into();
2921 self
2922 }
2923
2924 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2928 self.0.request.region = v.into();
2929 self
2930 }
2931
2932 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.0.request.cluster_name = v.into();
2937 self
2938 }
2939
2940 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2942 self.0.request.cluster_uuid = v.into();
2943 self
2944 }
2945
2946 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2948 self.0.request.request_id = v.into();
2949 self
2950 }
2951 }
2952
2953 #[doc(hidden)]
2954 impl crate::RequestBuilder for DeleteCluster {
2955 fn request_options(&mut self) -> &mut crate::RequestOptions {
2956 &mut self.0.options
2957 }
2958 }
2959
2960 #[derive(Clone, Debug)]
2977 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2978
2979 impl GetCluster {
2980 pub(crate) fn new(
2981 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2982 ) -> Self {
2983 Self(RequestBuilder::new(stub))
2984 }
2985
2986 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2988 self.0.request = v.into();
2989 self
2990 }
2991
2992 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2994 self.0.options = v.into();
2995 self
2996 }
2997
2998 pub async fn send(self) -> Result<crate::model::Cluster> {
3000 (*self.0.stub)
3001 .get_cluster(self.0.request, self.0.options)
3002 .await
3003 .map(crate::Response::into_body)
3004 }
3005
3006 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3010 self.0.request.project_id = v.into();
3011 self
3012 }
3013
3014 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3018 self.0.request.region = v.into();
3019 self
3020 }
3021
3022 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3026 self.0.request.cluster_name = v.into();
3027 self
3028 }
3029 }
3030
3031 #[doc(hidden)]
3032 impl crate::RequestBuilder for GetCluster {
3033 fn request_options(&mut self) -> &mut crate::RequestOptions {
3034 &mut self.0.options
3035 }
3036 }
3037
3038 #[derive(Clone, Debug)]
3059 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
3060
3061 impl ListClusters {
3062 pub(crate) fn new(
3063 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3064 ) -> Self {
3065 Self(RequestBuilder::new(stub))
3066 }
3067
3068 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
3070 self.0.request = v.into();
3071 self
3072 }
3073
3074 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3076 self.0.options = v.into();
3077 self
3078 }
3079
3080 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
3082 (*self.0.stub)
3083 .list_clusters(self.0.request, self.0.options)
3084 .await
3085 .map(crate::Response::into_body)
3086 }
3087
3088 pub fn by_page(
3090 self,
3091 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListClustersResponse, crate::Error>
3092 {
3093 use std::clone::Clone;
3094 let token = self.0.request.page_token.clone();
3095 let execute = move |token: String| {
3096 let mut builder = self.clone();
3097 builder.0.request = builder.0.request.set_page_token(token);
3098 builder.send()
3099 };
3100 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3101 }
3102
3103 pub fn by_item(
3105 self,
3106 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3107 crate::model::ListClustersResponse,
3108 crate::Error,
3109 > {
3110 use google_cloud_gax::paginator::Paginator;
3111 self.by_page().items()
3112 }
3113
3114 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3118 self.0.request.project_id = v.into();
3119 self
3120 }
3121
3122 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3126 self.0.request.region = v.into();
3127 self
3128 }
3129
3130 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3132 self.0.request.filter = v.into();
3133 self
3134 }
3135
3136 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3138 self.0.request.page_size = v.into();
3139 self
3140 }
3141
3142 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3144 self.0.request.page_token = v.into();
3145 self
3146 }
3147 }
3148
3149 #[doc(hidden)]
3150 impl crate::RequestBuilder for ListClusters {
3151 fn request_options(&mut self) -> &mut crate::RequestOptions {
3152 &mut self.0.options
3153 }
3154 }
3155
3156 #[derive(Clone, Debug)]
3174 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3175
3176 impl DiagnoseCluster {
3177 pub(crate) fn new(
3178 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3179 ) -> Self {
3180 Self(RequestBuilder::new(stub))
3181 }
3182
3183 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3185 self.0.request = v.into();
3186 self
3187 }
3188
3189 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3191 self.0.options = v.into();
3192 self
3193 }
3194
3195 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3202 (*self.0.stub)
3203 .diagnose_cluster(self.0.request, self.0.options)
3204 .await
3205 .map(crate::Response::into_body)
3206 }
3207
3208 pub fn poller(
3210 self,
3211 ) -> impl google_cloud_lro::Poller<
3212 crate::model::DiagnoseClusterResults,
3213 crate::model::ClusterOperationMetadata,
3214 > {
3215 type Operation = google_cloud_lro::internal::Operation<
3216 crate::model::DiagnoseClusterResults,
3217 crate::model::ClusterOperationMetadata,
3218 >;
3219 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3220 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3221 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
3222 if let Some(ref mut details) = poller_options.tracing {
3223 details.method_name = "google_cloud_dataproc_v1::client::ClusterController::diagnose_cluster::until_done";
3224 }
3225
3226 let stub = self.0.stub.clone();
3227 let mut options = self.0.options.clone();
3228 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3229 let query = move |name| {
3230 let stub = stub.clone();
3231 let options = options.clone();
3232 async {
3233 let op = GetOperation::new(stub)
3234 .set_name(name)
3235 .with_options(options)
3236 .send()
3237 .await?;
3238 Ok(Operation::new(op))
3239 }
3240 };
3241
3242 let start = move || async {
3243 let op = self.send().await?;
3244 Ok(Operation::new(op))
3245 };
3246
3247 use google_cloud_lro::internal::PollerExt;
3248 {
3249 google_cloud_lro::internal::new_poller(
3250 polling_error_policy,
3251 polling_backoff_policy,
3252 start,
3253 query,
3254 )
3255 }
3256 .with_options(poller_options)
3257 }
3258
3259 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3263 self.0.request.project_id = v.into();
3264 self
3265 }
3266
3267 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3271 self.0.request.region = v.into();
3272 self
3273 }
3274
3275 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3279 self.0.request.cluster_name = v.into();
3280 self
3281 }
3282
3283 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3285 self.0.request.tarball_gcs_dir = v.into();
3286 self
3287 }
3288
3289 pub fn set_tarball_access<
3291 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3292 >(
3293 mut self,
3294 v: T,
3295 ) -> Self {
3296 self.0.request.tarball_access = v.into();
3297 self
3298 }
3299
3300 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3302 where
3303 T: std::convert::Into<google_cloud_type::model::Interval>,
3304 {
3305 self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3306 self
3307 }
3308
3309 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3311 where
3312 T: std::convert::Into<google_cloud_type::model::Interval>,
3313 {
3314 self.0.request.diagnosis_interval = v.map(|x| x.into());
3315 self
3316 }
3317
3318 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3320 where
3321 T: std::iter::IntoIterator<Item = V>,
3322 V: std::convert::Into<std::string::String>,
3323 {
3324 use std::iter::Iterator;
3325 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3326 self
3327 }
3328
3329 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3331 where
3332 T: std::iter::IntoIterator<Item = V>,
3333 V: std::convert::Into<std::string::String>,
3334 {
3335 use std::iter::Iterator;
3336 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3337 self
3338 }
3339 }
3340
3341 #[doc(hidden)]
3342 impl crate::RequestBuilder for DiagnoseCluster {
3343 fn request_options(&mut self) -> &mut crate::RequestOptions {
3344 &mut self.0.options
3345 }
3346 }
3347
3348 #[derive(Clone, Debug)]
3365 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3366
3367 impl SetIamPolicy {
3368 pub(crate) fn new(
3369 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3370 ) -> Self {
3371 Self(RequestBuilder::new(stub))
3372 }
3373
3374 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3376 mut self,
3377 v: V,
3378 ) -> Self {
3379 self.0.request = v.into();
3380 self
3381 }
3382
3383 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3385 self.0.options = v.into();
3386 self
3387 }
3388
3389 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3391 (*self.0.stub)
3392 .set_iam_policy(self.0.request, self.0.options)
3393 .await
3394 .map(crate::Response::into_body)
3395 }
3396
3397 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3401 self.0.request.resource = v.into();
3402 self
3403 }
3404
3405 pub fn set_policy<T>(mut self, v: T) -> Self
3409 where
3410 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3411 {
3412 self.0.request.policy = std::option::Option::Some(v.into());
3413 self
3414 }
3415
3416 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3420 where
3421 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3422 {
3423 self.0.request.policy = v.map(|x| x.into());
3424 self
3425 }
3426
3427 pub fn set_update_mask<T>(mut self, v: T) -> Self
3429 where
3430 T: std::convert::Into<wkt::FieldMask>,
3431 {
3432 self.0.request.update_mask = std::option::Option::Some(v.into());
3433 self
3434 }
3435
3436 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3438 where
3439 T: std::convert::Into<wkt::FieldMask>,
3440 {
3441 self.0.request.update_mask = v.map(|x| x.into());
3442 self
3443 }
3444 }
3445
3446 #[doc(hidden)]
3447 impl crate::RequestBuilder for SetIamPolicy {
3448 fn request_options(&mut self) -> &mut crate::RequestOptions {
3449 &mut self.0.options
3450 }
3451 }
3452
3453 #[derive(Clone, Debug)]
3470 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3471
3472 impl GetIamPolicy {
3473 pub(crate) fn new(
3474 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3475 ) -> Self {
3476 Self(RequestBuilder::new(stub))
3477 }
3478
3479 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3481 mut self,
3482 v: V,
3483 ) -> Self {
3484 self.0.request = v.into();
3485 self
3486 }
3487
3488 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3490 self.0.options = v.into();
3491 self
3492 }
3493
3494 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3496 (*self.0.stub)
3497 .get_iam_policy(self.0.request, self.0.options)
3498 .await
3499 .map(crate::Response::into_body)
3500 }
3501
3502 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3506 self.0.request.resource = v.into();
3507 self
3508 }
3509
3510 pub fn set_options<T>(mut self, v: T) -> Self
3512 where
3513 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3514 {
3515 self.0.request.options = std::option::Option::Some(v.into());
3516 self
3517 }
3518
3519 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3521 where
3522 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3523 {
3524 self.0.request.options = v.map(|x| x.into());
3525 self
3526 }
3527 }
3528
3529 #[doc(hidden)]
3530 impl crate::RequestBuilder for GetIamPolicy {
3531 fn request_options(&mut self) -> &mut crate::RequestOptions {
3532 &mut self.0.options
3533 }
3534 }
3535
3536 #[derive(Clone, Debug)]
3553 pub struct TestIamPermissions(
3554 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3555 );
3556
3557 impl TestIamPermissions {
3558 pub(crate) fn new(
3559 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3560 ) -> Self {
3561 Self(RequestBuilder::new(stub))
3562 }
3563
3564 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3566 mut self,
3567 v: V,
3568 ) -> Self {
3569 self.0.request = v.into();
3570 self
3571 }
3572
3573 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3575 self.0.options = v.into();
3576 self
3577 }
3578
3579 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3581 (*self.0.stub)
3582 .test_iam_permissions(self.0.request, self.0.options)
3583 .await
3584 .map(crate::Response::into_body)
3585 }
3586
3587 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3591 self.0.request.resource = v.into();
3592 self
3593 }
3594
3595 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3599 where
3600 T: std::iter::IntoIterator<Item = V>,
3601 V: std::convert::Into<std::string::String>,
3602 {
3603 use std::iter::Iterator;
3604 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3605 self
3606 }
3607 }
3608
3609 #[doc(hidden)]
3610 impl crate::RequestBuilder for TestIamPermissions {
3611 fn request_options(&mut self) -> &mut crate::RequestOptions {
3612 &mut self.0.options
3613 }
3614 }
3615
3616 #[derive(Clone, Debug)]
3637 pub struct ListOperations(
3638 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3639 );
3640
3641 impl ListOperations {
3642 pub(crate) fn new(
3643 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3644 ) -> Self {
3645 Self(RequestBuilder::new(stub))
3646 }
3647
3648 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3650 mut self,
3651 v: V,
3652 ) -> Self {
3653 self.0.request = v.into();
3654 self
3655 }
3656
3657 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3659 self.0.options = v.into();
3660 self
3661 }
3662
3663 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3665 (*self.0.stub)
3666 .list_operations(self.0.request, self.0.options)
3667 .await
3668 .map(crate::Response::into_body)
3669 }
3670
3671 pub fn by_page(
3673 self,
3674 ) -> impl google_cloud_gax::paginator::Paginator<
3675 google_cloud_longrunning::model::ListOperationsResponse,
3676 crate::Error,
3677 > {
3678 use std::clone::Clone;
3679 let token = self.0.request.page_token.clone();
3680 let execute = move |token: String| {
3681 let mut builder = self.clone();
3682 builder.0.request = builder.0.request.set_page_token(token);
3683 builder.send()
3684 };
3685 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3686 }
3687
3688 pub fn by_item(
3690 self,
3691 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3692 google_cloud_longrunning::model::ListOperationsResponse,
3693 crate::Error,
3694 > {
3695 use google_cloud_gax::paginator::Paginator;
3696 self.by_page().items()
3697 }
3698
3699 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3701 self.0.request.name = v.into();
3702 self
3703 }
3704
3705 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3707 self.0.request.filter = v.into();
3708 self
3709 }
3710
3711 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3713 self.0.request.page_size = v.into();
3714 self
3715 }
3716
3717 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3719 self.0.request.page_token = v.into();
3720 self
3721 }
3722
3723 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3725 self.0.request.return_partial_success = v.into();
3726 self
3727 }
3728 }
3729
3730 #[doc(hidden)]
3731 impl crate::RequestBuilder for ListOperations {
3732 fn request_options(&mut self) -> &mut crate::RequestOptions {
3733 &mut self.0.options
3734 }
3735 }
3736
3737 #[derive(Clone, Debug)]
3754 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3755
3756 impl GetOperation {
3757 pub(crate) fn new(
3758 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3759 ) -> Self {
3760 Self(RequestBuilder::new(stub))
3761 }
3762
3763 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3765 mut self,
3766 v: V,
3767 ) -> Self {
3768 self.0.request = v.into();
3769 self
3770 }
3771
3772 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3774 self.0.options = v.into();
3775 self
3776 }
3777
3778 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3780 (*self.0.stub)
3781 .get_operation(self.0.request, self.0.options)
3782 .await
3783 .map(crate::Response::into_body)
3784 }
3785
3786 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3788 self.0.request.name = v.into();
3789 self
3790 }
3791 }
3792
3793 #[doc(hidden)]
3794 impl crate::RequestBuilder for GetOperation {
3795 fn request_options(&mut self) -> &mut crate::RequestOptions {
3796 &mut self.0.options
3797 }
3798 }
3799
3800 #[derive(Clone, Debug)]
3817 pub struct DeleteOperation(
3818 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3819 );
3820
3821 impl DeleteOperation {
3822 pub(crate) fn new(
3823 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3824 ) -> Self {
3825 Self(RequestBuilder::new(stub))
3826 }
3827
3828 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3830 mut self,
3831 v: V,
3832 ) -> Self {
3833 self.0.request = v.into();
3834 self
3835 }
3836
3837 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3839 self.0.options = v.into();
3840 self
3841 }
3842
3843 pub async fn send(self) -> Result<()> {
3845 (*self.0.stub)
3846 .delete_operation(self.0.request, self.0.options)
3847 .await
3848 .map(crate::Response::into_body)
3849 }
3850
3851 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3853 self.0.request.name = v.into();
3854 self
3855 }
3856 }
3857
3858 #[doc(hidden)]
3859 impl crate::RequestBuilder for DeleteOperation {
3860 fn request_options(&mut self) -> &mut crate::RequestOptions {
3861 &mut self.0.options
3862 }
3863 }
3864
3865 #[derive(Clone, Debug)]
3882 pub struct CancelOperation(
3883 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3884 );
3885
3886 impl CancelOperation {
3887 pub(crate) fn new(
3888 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3889 ) -> Self {
3890 Self(RequestBuilder::new(stub))
3891 }
3892
3893 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3895 mut self,
3896 v: V,
3897 ) -> Self {
3898 self.0.request = v.into();
3899 self
3900 }
3901
3902 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3904 self.0.options = v.into();
3905 self
3906 }
3907
3908 pub async fn send(self) -> Result<()> {
3910 (*self.0.stub)
3911 .cancel_operation(self.0.request, self.0.options)
3912 .await
3913 .map(crate::Response::into_body)
3914 }
3915
3916 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3918 self.0.request.name = v.into();
3919 self
3920 }
3921 }
3922
3923 #[doc(hidden)]
3924 impl crate::RequestBuilder for CancelOperation {
3925 fn request_options(&mut self) -> &mut crate::RequestOptions {
3926 &mut self.0.options
3927 }
3928 }
3929}
3930
3931pub mod job_controller {
3933 use crate::Result;
3934
3935 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3949
3950 pub(crate) mod client {
3951 use super::super::super::client::JobController;
3952 pub struct Factory;
3953 impl crate::ClientFactory for Factory {
3954 type Client = JobController;
3955 type Credentials = gaxi::options::Credentials;
3956 async fn build(
3957 self,
3958 config: gaxi::options::ClientConfig,
3959 ) -> crate::ClientBuilderResult<Self::Client> {
3960 Self::Client::new(config).await
3961 }
3962 }
3963 }
3964
3965 #[derive(Clone, Debug)]
3967 pub(crate) struct RequestBuilder<R: std::default::Default> {
3968 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3969 request: R,
3970 options: crate::RequestOptions,
3971 }
3972
3973 impl<R> RequestBuilder<R>
3974 where
3975 R: std::default::Default,
3976 {
3977 pub(crate) fn new(
3978 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3979 ) -> Self {
3980 Self {
3981 stub,
3982 request: R::default(),
3983 options: crate::RequestOptions::default(),
3984 }
3985 }
3986 }
3987
3988 #[derive(Clone, Debug)]
4005 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
4006
4007 impl SubmitJob {
4008 pub(crate) fn new(
4009 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4010 ) -> Self {
4011 Self(RequestBuilder::new(stub))
4012 }
4013
4014 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
4016 self.0.request = v.into();
4017 self
4018 }
4019
4020 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4022 self.0.options = v.into();
4023 self
4024 }
4025
4026 pub async fn send(self) -> Result<crate::model::Job> {
4028 (*self.0.stub)
4029 .submit_job(self.0.request, self.0.options)
4030 .await
4031 .map(crate::Response::into_body)
4032 }
4033
4034 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4038 self.0.request.project_id = v.into();
4039 self
4040 }
4041
4042 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4046 self.0.request.region = v.into();
4047 self
4048 }
4049
4050 pub fn set_job<T>(mut self, v: T) -> Self
4054 where
4055 T: std::convert::Into<crate::model::Job>,
4056 {
4057 self.0.request.job = std::option::Option::Some(v.into());
4058 self
4059 }
4060
4061 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4065 where
4066 T: std::convert::Into<crate::model::Job>,
4067 {
4068 self.0.request.job = v.map(|x| x.into());
4069 self
4070 }
4071
4072 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4074 self.0.request.request_id = v.into();
4075 self
4076 }
4077 }
4078
4079 #[doc(hidden)]
4080 impl crate::RequestBuilder for SubmitJob {
4081 fn request_options(&mut self) -> &mut crate::RequestOptions {
4082 &mut self.0.options
4083 }
4084 }
4085
4086 #[derive(Clone, Debug)]
4104 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
4105
4106 impl SubmitJobAsOperation {
4107 pub(crate) fn new(
4108 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4109 ) -> Self {
4110 Self(RequestBuilder::new(stub))
4111 }
4112
4113 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
4115 self.0.request = v.into();
4116 self
4117 }
4118
4119 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4121 self.0.options = v.into();
4122 self
4123 }
4124
4125 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4132 (*self.0.stub)
4133 .submit_job_as_operation(self.0.request, self.0.options)
4134 .await
4135 .map(crate::Response::into_body)
4136 }
4137
4138 pub fn poller(
4140 self,
4141 ) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::JobMetadata> {
4142 type Operation =
4143 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
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 = "google_cloud_dataproc_v1::client::JobController::submit_job_as_operation::until_done";
4149 }
4150
4151 let stub = self.0.stub.clone();
4152 let mut options = self.0.options.clone();
4153 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4154 let query = move |name| {
4155 let stub = stub.clone();
4156 let options = options.clone();
4157 async {
4158 let op = GetOperation::new(stub)
4159 .set_name(name)
4160 .with_options(options)
4161 .send()
4162 .await?;
4163 Ok(Operation::new(op))
4164 }
4165 };
4166
4167 let start = move || async {
4168 let op = self.send().await?;
4169 Ok(Operation::new(op))
4170 };
4171
4172 use google_cloud_lro::internal::PollerExt;
4173 {
4174 google_cloud_lro::internal::new_poller(
4175 polling_error_policy,
4176 polling_backoff_policy,
4177 start,
4178 query,
4179 )
4180 }
4181 .with_options(poller_options)
4182 }
4183
4184 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4188 self.0.request.project_id = v.into();
4189 self
4190 }
4191
4192 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4196 self.0.request.region = v.into();
4197 self
4198 }
4199
4200 pub fn set_job<T>(mut self, v: T) -> Self
4204 where
4205 T: std::convert::Into<crate::model::Job>,
4206 {
4207 self.0.request.job = std::option::Option::Some(v.into());
4208 self
4209 }
4210
4211 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4215 where
4216 T: std::convert::Into<crate::model::Job>,
4217 {
4218 self.0.request.job = v.map(|x| x.into());
4219 self
4220 }
4221
4222 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4224 self.0.request.request_id = v.into();
4225 self
4226 }
4227 }
4228
4229 #[doc(hidden)]
4230 impl crate::RequestBuilder for SubmitJobAsOperation {
4231 fn request_options(&mut self) -> &mut crate::RequestOptions {
4232 &mut self.0.options
4233 }
4234 }
4235
4236 #[derive(Clone, Debug)]
4253 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4254
4255 impl GetJob {
4256 pub(crate) fn new(
4257 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4258 ) -> Self {
4259 Self(RequestBuilder::new(stub))
4260 }
4261
4262 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4264 self.0.request = v.into();
4265 self
4266 }
4267
4268 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4270 self.0.options = v.into();
4271 self
4272 }
4273
4274 pub async fn send(self) -> Result<crate::model::Job> {
4276 (*self.0.stub)
4277 .get_job(self.0.request, self.0.options)
4278 .await
4279 .map(crate::Response::into_body)
4280 }
4281
4282 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4286 self.0.request.project_id = v.into();
4287 self
4288 }
4289
4290 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4294 self.0.request.region = v.into();
4295 self
4296 }
4297
4298 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4302 self.0.request.job_id = v.into();
4303 self
4304 }
4305 }
4306
4307 #[doc(hidden)]
4308 impl crate::RequestBuilder for GetJob {
4309 fn request_options(&mut self) -> &mut crate::RequestOptions {
4310 &mut self.0.options
4311 }
4312 }
4313
4314 #[derive(Clone, Debug)]
4335 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4336
4337 impl ListJobs {
4338 pub(crate) fn new(
4339 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4340 ) -> Self {
4341 Self(RequestBuilder::new(stub))
4342 }
4343
4344 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4346 self.0.request = v.into();
4347 self
4348 }
4349
4350 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4352 self.0.options = v.into();
4353 self
4354 }
4355
4356 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4358 (*self.0.stub)
4359 .list_jobs(self.0.request, self.0.options)
4360 .await
4361 .map(crate::Response::into_body)
4362 }
4363
4364 pub fn by_page(
4366 self,
4367 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
4368 {
4369 use std::clone::Clone;
4370 let token = self.0.request.page_token.clone();
4371 let execute = move |token: String| {
4372 let mut builder = self.clone();
4373 builder.0.request = builder.0.request.set_page_token(token);
4374 builder.send()
4375 };
4376 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4377 }
4378
4379 pub fn by_item(
4381 self,
4382 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
4383 {
4384 use google_cloud_gax::paginator::Paginator;
4385 self.by_page().items()
4386 }
4387
4388 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4392 self.0.request.project_id = v.into();
4393 self
4394 }
4395
4396 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4400 self.0.request.region = v.into();
4401 self
4402 }
4403
4404 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4406 self.0.request.page_size = v.into();
4407 self
4408 }
4409
4410 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4412 self.0.request.page_token = v.into();
4413 self
4414 }
4415
4416 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4418 self.0.request.cluster_name = v.into();
4419 self
4420 }
4421
4422 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4424 mut self,
4425 v: T,
4426 ) -> Self {
4427 self.0.request.job_state_matcher = v.into();
4428 self
4429 }
4430
4431 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4433 self.0.request.filter = v.into();
4434 self
4435 }
4436 }
4437
4438 #[doc(hidden)]
4439 impl crate::RequestBuilder for ListJobs {
4440 fn request_options(&mut self) -> &mut crate::RequestOptions {
4441 &mut self.0.options
4442 }
4443 }
4444
4445 #[derive(Clone, Debug)]
4462 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4463
4464 impl UpdateJob {
4465 pub(crate) fn new(
4466 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4467 ) -> Self {
4468 Self(RequestBuilder::new(stub))
4469 }
4470
4471 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4473 self.0.request = v.into();
4474 self
4475 }
4476
4477 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4479 self.0.options = v.into();
4480 self
4481 }
4482
4483 pub async fn send(self) -> Result<crate::model::Job> {
4485 (*self.0.stub)
4486 .update_job(self.0.request, self.0.options)
4487 .await
4488 .map(crate::Response::into_body)
4489 }
4490
4491 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4495 self.0.request.project_id = v.into();
4496 self
4497 }
4498
4499 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4503 self.0.request.region = v.into();
4504 self
4505 }
4506
4507 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4511 self.0.request.job_id = v.into();
4512 self
4513 }
4514
4515 pub fn set_job<T>(mut self, v: T) -> Self
4519 where
4520 T: std::convert::Into<crate::model::Job>,
4521 {
4522 self.0.request.job = std::option::Option::Some(v.into());
4523 self
4524 }
4525
4526 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4530 where
4531 T: std::convert::Into<crate::model::Job>,
4532 {
4533 self.0.request.job = v.map(|x| x.into());
4534 self
4535 }
4536
4537 pub fn set_update_mask<T>(mut self, v: T) -> Self
4541 where
4542 T: std::convert::Into<wkt::FieldMask>,
4543 {
4544 self.0.request.update_mask = std::option::Option::Some(v.into());
4545 self
4546 }
4547
4548 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4552 where
4553 T: std::convert::Into<wkt::FieldMask>,
4554 {
4555 self.0.request.update_mask = v.map(|x| x.into());
4556 self
4557 }
4558 }
4559
4560 #[doc(hidden)]
4561 impl crate::RequestBuilder for UpdateJob {
4562 fn request_options(&mut self) -> &mut crate::RequestOptions {
4563 &mut self.0.options
4564 }
4565 }
4566
4567 #[derive(Clone, Debug)]
4584 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4585
4586 impl CancelJob {
4587 pub(crate) fn new(
4588 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4589 ) -> Self {
4590 Self(RequestBuilder::new(stub))
4591 }
4592
4593 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4595 self.0.request = v.into();
4596 self
4597 }
4598
4599 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4601 self.0.options = v.into();
4602 self
4603 }
4604
4605 pub async fn send(self) -> Result<crate::model::Job> {
4607 (*self.0.stub)
4608 .cancel_job(self.0.request, self.0.options)
4609 .await
4610 .map(crate::Response::into_body)
4611 }
4612
4613 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4617 self.0.request.project_id = v.into();
4618 self
4619 }
4620
4621 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4625 self.0.request.region = v.into();
4626 self
4627 }
4628
4629 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4633 self.0.request.job_id = v.into();
4634 self
4635 }
4636 }
4637
4638 #[doc(hidden)]
4639 impl crate::RequestBuilder for CancelJob {
4640 fn request_options(&mut self) -> &mut crate::RequestOptions {
4641 &mut self.0.options
4642 }
4643 }
4644
4645 #[derive(Clone, Debug)]
4662 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4663
4664 impl DeleteJob {
4665 pub(crate) fn new(
4666 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4667 ) -> Self {
4668 Self(RequestBuilder::new(stub))
4669 }
4670
4671 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4673 self.0.request = v.into();
4674 self
4675 }
4676
4677 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4679 self.0.options = v.into();
4680 self
4681 }
4682
4683 pub async fn send(self) -> Result<()> {
4685 (*self.0.stub)
4686 .delete_job(self.0.request, self.0.options)
4687 .await
4688 .map(crate::Response::into_body)
4689 }
4690
4691 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4695 self.0.request.project_id = v.into();
4696 self
4697 }
4698
4699 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4703 self.0.request.region = v.into();
4704 self
4705 }
4706
4707 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4711 self.0.request.job_id = v.into();
4712 self
4713 }
4714 }
4715
4716 #[doc(hidden)]
4717 impl crate::RequestBuilder for DeleteJob {
4718 fn request_options(&mut self) -> &mut crate::RequestOptions {
4719 &mut self.0.options
4720 }
4721 }
4722
4723 #[derive(Clone, Debug)]
4740 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
4741
4742 impl SetIamPolicy {
4743 pub(crate) fn new(
4744 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4745 ) -> Self {
4746 Self(RequestBuilder::new(stub))
4747 }
4748
4749 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
4751 mut self,
4752 v: V,
4753 ) -> Self {
4754 self.0.request = v.into();
4755 self
4756 }
4757
4758 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4760 self.0.options = v.into();
4761 self
4762 }
4763
4764 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4766 (*self.0.stub)
4767 .set_iam_policy(self.0.request, self.0.options)
4768 .await
4769 .map(crate::Response::into_body)
4770 }
4771
4772 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4776 self.0.request.resource = v.into();
4777 self
4778 }
4779
4780 pub fn set_policy<T>(mut self, v: T) -> Self
4784 where
4785 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4786 {
4787 self.0.request.policy = std::option::Option::Some(v.into());
4788 self
4789 }
4790
4791 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4795 where
4796 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4797 {
4798 self.0.request.policy = v.map(|x| x.into());
4799 self
4800 }
4801
4802 pub fn set_update_mask<T>(mut self, v: T) -> Self
4804 where
4805 T: std::convert::Into<wkt::FieldMask>,
4806 {
4807 self.0.request.update_mask = std::option::Option::Some(v.into());
4808 self
4809 }
4810
4811 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4813 where
4814 T: std::convert::Into<wkt::FieldMask>,
4815 {
4816 self.0.request.update_mask = v.map(|x| x.into());
4817 self
4818 }
4819 }
4820
4821 #[doc(hidden)]
4822 impl crate::RequestBuilder for SetIamPolicy {
4823 fn request_options(&mut self) -> &mut crate::RequestOptions {
4824 &mut self.0.options
4825 }
4826 }
4827
4828 #[derive(Clone, Debug)]
4845 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
4846
4847 impl GetIamPolicy {
4848 pub(crate) fn new(
4849 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4850 ) -> Self {
4851 Self(RequestBuilder::new(stub))
4852 }
4853
4854 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
4856 mut self,
4857 v: V,
4858 ) -> Self {
4859 self.0.request = v.into();
4860 self
4861 }
4862
4863 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4865 self.0.options = v.into();
4866 self
4867 }
4868
4869 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4871 (*self.0.stub)
4872 .get_iam_policy(self.0.request, self.0.options)
4873 .await
4874 .map(crate::Response::into_body)
4875 }
4876
4877 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4881 self.0.request.resource = v.into();
4882 self
4883 }
4884
4885 pub fn set_options<T>(mut self, v: T) -> Self
4887 where
4888 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4889 {
4890 self.0.request.options = std::option::Option::Some(v.into());
4891 self
4892 }
4893
4894 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4896 where
4897 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4898 {
4899 self.0.request.options = v.map(|x| x.into());
4900 self
4901 }
4902 }
4903
4904 #[doc(hidden)]
4905 impl crate::RequestBuilder for GetIamPolicy {
4906 fn request_options(&mut self) -> &mut crate::RequestOptions {
4907 &mut self.0.options
4908 }
4909 }
4910
4911 #[derive(Clone, Debug)]
4928 pub struct TestIamPermissions(
4929 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
4930 );
4931
4932 impl TestIamPermissions {
4933 pub(crate) fn new(
4934 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4935 ) -> Self {
4936 Self(RequestBuilder::new(stub))
4937 }
4938
4939 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
4941 mut self,
4942 v: V,
4943 ) -> Self {
4944 self.0.request = v.into();
4945 self
4946 }
4947
4948 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4950 self.0.options = v.into();
4951 self
4952 }
4953
4954 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
4956 (*self.0.stub)
4957 .test_iam_permissions(self.0.request, self.0.options)
4958 .await
4959 .map(crate::Response::into_body)
4960 }
4961
4962 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4966 self.0.request.resource = v.into();
4967 self
4968 }
4969
4970 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4974 where
4975 T: std::iter::IntoIterator<Item = V>,
4976 V: std::convert::Into<std::string::String>,
4977 {
4978 use std::iter::Iterator;
4979 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4980 self
4981 }
4982 }
4983
4984 #[doc(hidden)]
4985 impl crate::RequestBuilder for TestIamPermissions {
4986 fn request_options(&mut self) -> &mut crate::RequestOptions {
4987 &mut self.0.options
4988 }
4989 }
4990
4991 #[derive(Clone, Debug)]
5012 pub struct ListOperations(
5013 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5014 );
5015
5016 impl ListOperations {
5017 pub(crate) fn new(
5018 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5019 ) -> Self {
5020 Self(RequestBuilder::new(stub))
5021 }
5022
5023 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5025 mut self,
5026 v: V,
5027 ) -> Self {
5028 self.0.request = v.into();
5029 self
5030 }
5031
5032 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5034 self.0.options = v.into();
5035 self
5036 }
5037
5038 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5040 (*self.0.stub)
5041 .list_operations(self.0.request, self.0.options)
5042 .await
5043 .map(crate::Response::into_body)
5044 }
5045
5046 pub fn by_page(
5048 self,
5049 ) -> impl google_cloud_gax::paginator::Paginator<
5050 google_cloud_longrunning::model::ListOperationsResponse,
5051 crate::Error,
5052 > {
5053 use std::clone::Clone;
5054 let token = self.0.request.page_token.clone();
5055 let execute = move |token: String| {
5056 let mut builder = self.clone();
5057 builder.0.request = builder.0.request.set_page_token(token);
5058 builder.send()
5059 };
5060 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5061 }
5062
5063 pub fn by_item(
5065 self,
5066 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5067 google_cloud_longrunning::model::ListOperationsResponse,
5068 crate::Error,
5069 > {
5070 use google_cloud_gax::paginator::Paginator;
5071 self.by_page().items()
5072 }
5073
5074 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5076 self.0.request.name = v.into();
5077 self
5078 }
5079
5080 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5082 self.0.request.filter = v.into();
5083 self
5084 }
5085
5086 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5088 self.0.request.page_size = v.into();
5089 self
5090 }
5091
5092 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5094 self.0.request.page_token = v.into();
5095 self
5096 }
5097
5098 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5100 self.0.request.return_partial_success = v.into();
5101 self
5102 }
5103 }
5104
5105 #[doc(hidden)]
5106 impl crate::RequestBuilder for ListOperations {
5107 fn request_options(&mut self) -> &mut crate::RequestOptions {
5108 &mut self.0.options
5109 }
5110 }
5111
5112 #[derive(Clone, Debug)]
5129 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5130
5131 impl GetOperation {
5132 pub(crate) fn new(
5133 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5134 ) -> Self {
5135 Self(RequestBuilder::new(stub))
5136 }
5137
5138 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5140 mut self,
5141 v: V,
5142 ) -> Self {
5143 self.0.request = v.into();
5144 self
5145 }
5146
5147 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5149 self.0.options = v.into();
5150 self
5151 }
5152
5153 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5155 (*self.0.stub)
5156 .get_operation(self.0.request, self.0.options)
5157 .await
5158 .map(crate::Response::into_body)
5159 }
5160
5161 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5163 self.0.request.name = v.into();
5164 self
5165 }
5166 }
5167
5168 #[doc(hidden)]
5169 impl crate::RequestBuilder for GetOperation {
5170 fn request_options(&mut self) -> &mut crate::RequestOptions {
5171 &mut self.0.options
5172 }
5173 }
5174
5175 #[derive(Clone, Debug)]
5192 pub struct DeleteOperation(
5193 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
5194 );
5195
5196 impl DeleteOperation {
5197 pub(crate) fn new(
5198 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5199 ) -> Self {
5200 Self(RequestBuilder::new(stub))
5201 }
5202
5203 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
5205 mut self,
5206 v: V,
5207 ) -> Self {
5208 self.0.request = v.into();
5209 self
5210 }
5211
5212 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5214 self.0.options = v.into();
5215 self
5216 }
5217
5218 pub async fn send(self) -> Result<()> {
5220 (*self.0.stub)
5221 .delete_operation(self.0.request, self.0.options)
5222 .await
5223 .map(crate::Response::into_body)
5224 }
5225
5226 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5228 self.0.request.name = v.into();
5229 self
5230 }
5231 }
5232
5233 #[doc(hidden)]
5234 impl crate::RequestBuilder for DeleteOperation {
5235 fn request_options(&mut self) -> &mut crate::RequestOptions {
5236 &mut self.0.options
5237 }
5238 }
5239
5240 #[derive(Clone, Debug)]
5257 pub struct CancelOperation(
5258 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5259 );
5260
5261 impl CancelOperation {
5262 pub(crate) fn new(
5263 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5264 ) -> Self {
5265 Self(RequestBuilder::new(stub))
5266 }
5267
5268 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5270 mut self,
5271 v: V,
5272 ) -> Self {
5273 self.0.request = v.into();
5274 self
5275 }
5276
5277 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5279 self.0.options = v.into();
5280 self
5281 }
5282
5283 pub async fn send(self) -> Result<()> {
5285 (*self.0.stub)
5286 .cancel_operation(self.0.request, self.0.options)
5287 .await
5288 .map(crate::Response::into_body)
5289 }
5290
5291 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5293 self.0.request.name = v.into();
5294 self
5295 }
5296 }
5297
5298 #[doc(hidden)]
5299 impl crate::RequestBuilder for CancelOperation {
5300 fn request_options(&mut self) -> &mut crate::RequestOptions {
5301 &mut self.0.options
5302 }
5303 }
5304}
5305
5306pub mod node_group_controller {
5308 use crate::Result;
5309
5310 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5324
5325 pub(crate) mod client {
5326 use super::super::super::client::NodeGroupController;
5327 pub struct Factory;
5328 impl crate::ClientFactory for Factory {
5329 type Client = NodeGroupController;
5330 type Credentials = gaxi::options::Credentials;
5331 async fn build(
5332 self,
5333 config: gaxi::options::ClientConfig,
5334 ) -> crate::ClientBuilderResult<Self::Client> {
5335 Self::Client::new(config).await
5336 }
5337 }
5338 }
5339
5340 #[derive(Clone, Debug)]
5342 pub(crate) struct RequestBuilder<R: std::default::Default> {
5343 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5344 request: R,
5345 options: crate::RequestOptions,
5346 }
5347
5348 impl<R> RequestBuilder<R>
5349 where
5350 R: std::default::Default,
5351 {
5352 pub(crate) fn new(
5353 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5354 ) -> Self {
5355 Self {
5356 stub,
5357 request: R::default(),
5358 options: crate::RequestOptions::default(),
5359 }
5360 }
5361 }
5362
5363 #[derive(Clone, Debug)]
5381 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5382
5383 impl CreateNodeGroup {
5384 pub(crate) fn new(
5385 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5386 ) -> Self {
5387 Self(RequestBuilder::new(stub))
5388 }
5389
5390 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5392 self.0.request = v.into();
5393 self
5394 }
5395
5396 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5398 self.0.options = v.into();
5399 self
5400 }
5401
5402 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5409 (*self.0.stub)
5410 .create_node_group(self.0.request, self.0.options)
5411 .await
5412 .map(crate::Response::into_body)
5413 }
5414
5415 pub fn poller(
5417 self,
5418 ) -> impl google_cloud_lro::Poller<
5419 crate::model::NodeGroup,
5420 crate::model::NodeGroupOperationMetadata,
5421 > {
5422 type Operation = google_cloud_lro::internal::Operation<
5423 crate::model::NodeGroup,
5424 crate::model::NodeGroupOperationMetadata,
5425 >;
5426 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5427 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5428 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5429 if let Some(ref mut details) = poller_options.tracing {
5430 details.method_name = "google_cloud_dataproc_v1::client::NodeGroupController::create_node_group::until_done";
5431 }
5432
5433 let stub = self.0.stub.clone();
5434 let mut options = self.0.options.clone();
5435 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5436 let query = move |name| {
5437 let stub = stub.clone();
5438 let options = options.clone();
5439 async {
5440 let op = GetOperation::new(stub)
5441 .set_name(name)
5442 .with_options(options)
5443 .send()
5444 .await?;
5445 Ok(Operation::new(op))
5446 }
5447 };
5448
5449 let start = move || async {
5450 let op = self.send().await?;
5451 Ok(Operation::new(op))
5452 };
5453
5454 use google_cloud_lro::internal::PollerExt;
5455 {
5456 google_cloud_lro::internal::new_poller(
5457 polling_error_policy,
5458 polling_backoff_policy,
5459 start,
5460 query,
5461 )
5462 }
5463 .with_options(poller_options)
5464 }
5465
5466 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5470 self.0.request.parent = v.into();
5471 self
5472 }
5473
5474 pub fn set_node_group<T>(mut self, v: T) -> Self
5478 where
5479 T: std::convert::Into<crate::model::NodeGroup>,
5480 {
5481 self.0.request.node_group = std::option::Option::Some(v.into());
5482 self
5483 }
5484
5485 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5489 where
5490 T: std::convert::Into<crate::model::NodeGroup>,
5491 {
5492 self.0.request.node_group = v.map(|x| x.into());
5493 self
5494 }
5495
5496 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5498 self.0.request.node_group_id = v.into();
5499 self
5500 }
5501
5502 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5504 self.0.request.request_id = v.into();
5505 self
5506 }
5507 }
5508
5509 #[doc(hidden)]
5510 impl crate::RequestBuilder for CreateNodeGroup {
5511 fn request_options(&mut self) -> &mut crate::RequestOptions {
5512 &mut self.0.options
5513 }
5514 }
5515
5516 #[derive(Clone, Debug)]
5534 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5535
5536 impl ResizeNodeGroup {
5537 pub(crate) fn new(
5538 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5539 ) -> Self {
5540 Self(RequestBuilder::new(stub))
5541 }
5542
5543 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5545 self.0.request = v.into();
5546 self
5547 }
5548
5549 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5551 self.0.options = v.into();
5552 self
5553 }
5554
5555 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5562 (*self.0.stub)
5563 .resize_node_group(self.0.request, self.0.options)
5564 .await
5565 .map(crate::Response::into_body)
5566 }
5567
5568 pub fn poller(
5570 self,
5571 ) -> impl google_cloud_lro::Poller<
5572 crate::model::NodeGroup,
5573 crate::model::NodeGroupOperationMetadata,
5574 > {
5575 type Operation = google_cloud_lro::internal::Operation<
5576 crate::model::NodeGroup,
5577 crate::model::NodeGroupOperationMetadata,
5578 >;
5579 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5580 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5581 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5582 if let Some(ref mut details) = poller_options.tracing {
5583 details.method_name = "google_cloud_dataproc_v1::client::NodeGroupController::resize_node_group::until_done";
5584 }
5585
5586 let stub = self.0.stub.clone();
5587 let mut options = self.0.options.clone();
5588 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5589 let query = move |name| {
5590 let stub = stub.clone();
5591 let options = options.clone();
5592 async {
5593 let op = GetOperation::new(stub)
5594 .set_name(name)
5595 .with_options(options)
5596 .send()
5597 .await?;
5598 Ok(Operation::new(op))
5599 }
5600 };
5601
5602 let start = move || async {
5603 let op = self.send().await?;
5604 Ok(Operation::new(op))
5605 };
5606
5607 use google_cloud_lro::internal::PollerExt;
5608 {
5609 google_cloud_lro::internal::new_poller(
5610 polling_error_policy,
5611 polling_backoff_policy,
5612 start,
5613 query,
5614 )
5615 }
5616 .with_options(poller_options)
5617 }
5618
5619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5623 self.0.request.name = v.into();
5624 self
5625 }
5626
5627 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5631 self.0.request.size = v.into();
5632 self
5633 }
5634
5635 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5637 self.0.request.request_id = v.into();
5638 self
5639 }
5640
5641 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5643 where
5644 T: std::convert::Into<wkt::Duration>,
5645 {
5646 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5647 self
5648 }
5649
5650 pub fn set_or_clear_graceful_decommission_timeout<T>(
5652 mut self,
5653 v: std::option::Option<T>,
5654 ) -> Self
5655 where
5656 T: std::convert::Into<wkt::Duration>,
5657 {
5658 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5659 self
5660 }
5661 }
5662
5663 #[doc(hidden)]
5664 impl crate::RequestBuilder for ResizeNodeGroup {
5665 fn request_options(&mut self) -> &mut crate::RequestOptions {
5666 &mut self.0.options
5667 }
5668 }
5669
5670 #[derive(Clone, Debug)]
5687 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5688
5689 impl GetNodeGroup {
5690 pub(crate) fn new(
5691 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5692 ) -> Self {
5693 Self(RequestBuilder::new(stub))
5694 }
5695
5696 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5698 self.0.request = v.into();
5699 self
5700 }
5701
5702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5704 self.0.options = v.into();
5705 self
5706 }
5707
5708 pub async fn send(self) -> Result<crate::model::NodeGroup> {
5710 (*self.0.stub)
5711 .get_node_group(self.0.request, self.0.options)
5712 .await
5713 .map(crate::Response::into_body)
5714 }
5715
5716 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5720 self.0.request.name = v.into();
5721 self
5722 }
5723 }
5724
5725 #[doc(hidden)]
5726 impl crate::RequestBuilder for GetNodeGroup {
5727 fn request_options(&mut self) -> &mut crate::RequestOptions {
5728 &mut self.0.options
5729 }
5730 }
5731
5732 #[derive(Clone, Debug)]
5749 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5750
5751 impl SetIamPolicy {
5752 pub(crate) fn new(
5753 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5754 ) -> Self {
5755 Self(RequestBuilder::new(stub))
5756 }
5757
5758 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5760 mut self,
5761 v: V,
5762 ) -> Self {
5763 self.0.request = v.into();
5764 self
5765 }
5766
5767 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5769 self.0.options = v.into();
5770 self
5771 }
5772
5773 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5775 (*self.0.stub)
5776 .set_iam_policy(self.0.request, self.0.options)
5777 .await
5778 .map(crate::Response::into_body)
5779 }
5780
5781 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5785 self.0.request.resource = v.into();
5786 self
5787 }
5788
5789 pub fn set_policy<T>(mut self, v: T) -> Self
5793 where
5794 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5795 {
5796 self.0.request.policy = std::option::Option::Some(v.into());
5797 self
5798 }
5799
5800 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5804 where
5805 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5806 {
5807 self.0.request.policy = v.map(|x| x.into());
5808 self
5809 }
5810
5811 pub fn set_update_mask<T>(mut self, v: T) -> Self
5813 where
5814 T: std::convert::Into<wkt::FieldMask>,
5815 {
5816 self.0.request.update_mask = std::option::Option::Some(v.into());
5817 self
5818 }
5819
5820 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5822 where
5823 T: std::convert::Into<wkt::FieldMask>,
5824 {
5825 self.0.request.update_mask = v.map(|x| x.into());
5826 self
5827 }
5828 }
5829
5830 #[doc(hidden)]
5831 impl crate::RequestBuilder for SetIamPolicy {
5832 fn request_options(&mut self) -> &mut crate::RequestOptions {
5833 &mut self.0.options
5834 }
5835 }
5836
5837 #[derive(Clone, Debug)]
5854 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5855
5856 impl GetIamPolicy {
5857 pub(crate) fn new(
5858 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5859 ) -> Self {
5860 Self(RequestBuilder::new(stub))
5861 }
5862
5863 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5865 mut self,
5866 v: V,
5867 ) -> Self {
5868 self.0.request = v.into();
5869 self
5870 }
5871
5872 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5874 self.0.options = v.into();
5875 self
5876 }
5877
5878 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5880 (*self.0.stub)
5881 .get_iam_policy(self.0.request, self.0.options)
5882 .await
5883 .map(crate::Response::into_body)
5884 }
5885
5886 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5890 self.0.request.resource = v.into();
5891 self
5892 }
5893
5894 pub fn set_options<T>(mut self, v: T) -> Self
5896 where
5897 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5898 {
5899 self.0.request.options = std::option::Option::Some(v.into());
5900 self
5901 }
5902
5903 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5905 where
5906 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5907 {
5908 self.0.request.options = v.map(|x| x.into());
5909 self
5910 }
5911 }
5912
5913 #[doc(hidden)]
5914 impl crate::RequestBuilder for GetIamPolicy {
5915 fn request_options(&mut self) -> &mut crate::RequestOptions {
5916 &mut self.0.options
5917 }
5918 }
5919
5920 #[derive(Clone, Debug)]
5937 pub struct TestIamPermissions(
5938 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5939 );
5940
5941 impl TestIamPermissions {
5942 pub(crate) fn new(
5943 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5944 ) -> Self {
5945 Self(RequestBuilder::new(stub))
5946 }
5947
5948 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5950 mut self,
5951 v: V,
5952 ) -> Self {
5953 self.0.request = v.into();
5954 self
5955 }
5956
5957 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5959 self.0.options = v.into();
5960 self
5961 }
5962
5963 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5965 (*self.0.stub)
5966 .test_iam_permissions(self.0.request, self.0.options)
5967 .await
5968 .map(crate::Response::into_body)
5969 }
5970
5971 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5975 self.0.request.resource = v.into();
5976 self
5977 }
5978
5979 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5983 where
5984 T: std::iter::IntoIterator<Item = V>,
5985 V: std::convert::Into<std::string::String>,
5986 {
5987 use std::iter::Iterator;
5988 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5989 self
5990 }
5991 }
5992
5993 #[doc(hidden)]
5994 impl crate::RequestBuilder for TestIamPermissions {
5995 fn request_options(&mut self) -> &mut crate::RequestOptions {
5996 &mut self.0.options
5997 }
5998 }
5999
6000 #[derive(Clone, Debug)]
6021 pub struct ListOperations(
6022 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6023 );
6024
6025 impl ListOperations {
6026 pub(crate) fn new(
6027 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6028 ) -> Self {
6029 Self(RequestBuilder::new(stub))
6030 }
6031
6032 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6034 mut self,
6035 v: V,
6036 ) -> Self {
6037 self.0.request = v.into();
6038 self
6039 }
6040
6041 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6043 self.0.options = v.into();
6044 self
6045 }
6046
6047 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6049 (*self.0.stub)
6050 .list_operations(self.0.request, self.0.options)
6051 .await
6052 .map(crate::Response::into_body)
6053 }
6054
6055 pub fn by_page(
6057 self,
6058 ) -> impl google_cloud_gax::paginator::Paginator<
6059 google_cloud_longrunning::model::ListOperationsResponse,
6060 crate::Error,
6061 > {
6062 use std::clone::Clone;
6063 let token = self.0.request.page_token.clone();
6064 let execute = move |token: String| {
6065 let mut builder = self.clone();
6066 builder.0.request = builder.0.request.set_page_token(token);
6067 builder.send()
6068 };
6069 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6070 }
6071
6072 pub fn by_item(
6074 self,
6075 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6076 google_cloud_longrunning::model::ListOperationsResponse,
6077 crate::Error,
6078 > {
6079 use google_cloud_gax::paginator::Paginator;
6080 self.by_page().items()
6081 }
6082
6083 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6085 self.0.request.name = v.into();
6086 self
6087 }
6088
6089 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6091 self.0.request.filter = v.into();
6092 self
6093 }
6094
6095 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6097 self.0.request.page_size = v.into();
6098 self
6099 }
6100
6101 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6103 self.0.request.page_token = v.into();
6104 self
6105 }
6106
6107 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6109 self.0.request.return_partial_success = v.into();
6110 self
6111 }
6112 }
6113
6114 #[doc(hidden)]
6115 impl crate::RequestBuilder for ListOperations {
6116 fn request_options(&mut self) -> &mut crate::RequestOptions {
6117 &mut self.0.options
6118 }
6119 }
6120
6121 #[derive(Clone, Debug)]
6138 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6139
6140 impl GetOperation {
6141 pub(crate) fn new(
6142 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6143 ) -> 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(
6207 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6208 ) -> Self {
6209 Self(RequestBuilder::new(stub))
6210 }
6211
6212 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
6214 mut self,
6215 v: V,
6216 ) -> Self {
6217 self.0.request = v.into();
6218 self
6219 }
6220
6221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6223 self.0.options = v.into();
6224 self
6225 }
6226
6227 pub async fn send(self) -> Result<()> {
6229 (*self.0.stub)
6230 .delete_operation(self.0.request, self.0.options)
6231 .await
6232 .map(crate::Response::into_body)
6233 }
6234
6235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6237 self.0.request.name = v.into();
6238 self
6239 }
6240 }
6241
6242 #[doc(hidden)]
6243 impl crate::RequestBuilder for DeleteOperation {
6244 fn request_options(&mut self) -> &mut crate::RequestOptions {
6245 &mut self.0.options
6246 }
6247 }
6248
6249 #[derive(Clone, Debug)]
6266 pub struct CancelOperation(
6267 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6268 );
6269
6270 impl CancelOperation {
6271 pub(crate) fn new(
6272 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6273 ) -> Self {
6274 Self(RequestBuilder::new(stub))
6275 }
6276
6277 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6279 mut self,
6280 v: V,
6281 ) -> Self {
6282 self.0.request = v.into();
6283 self
6284 }
6285
6286 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6288 self.0.options = v.into();
6289 self
6290 }
6291
6292 pub async fn send(self) -> Result<()> {
6294 (*self.0.stub)
6295 .cancel_operation(self.0.request, self.0.options)
6296 .await
6297 .map(crate::Response::into_body)
6298 }
6299
6300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6302 self.0.request.name = v.into();
6303 self
6304 }
6305 }
6306
6307 #[doc(hidden)]
6308 impl crate::RequestBuilder for CancelOperation {
6309 fn request_options(&mut self) -> &mut crate::RequestOptions {
6310 &mut self.0.options
6311 }
6312 }
6313}
6314
6315pub mod session_template_controller {
6317 use crate::Result;
6318
6319 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6333
6334 pub(crate) mod client {
6335 use super::super::super::client::SessionTemplateController;
6336 pub struct Factory;
6337 impl crate::ClientFactory for Factory {
6338 type Client = SessionTemplateController;
6339 type Credentials = gaxi::options::Credentials;
6340 async fn build(
6341 self,
6342 config: gaxi::options::ClientConfig,
6343 ) -> crate::ClientBuilderResult<Self::Client> {
6344 Self::Client::new(config).await
6345 }
6346 }
6347 }
6348
6349 #[derive(Clone, Debug)]
6351 pub(crate) struct RequestBuilder<R: std::default::Default> {
6352 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6353 request: R,
6354 options: crate::RequestOptions,
6355 }
6356
6357 impl<R> RequestBuilder<R>
6358 where
6359 R: std::default::Default,
6360 {
6361 pub(crate) fn new(
6362 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6363 ) -> Self {
6364 Self {
6365 stub,
6366 request: R::default(),
6367 options: crate::RequestOptions::default(),
6368 }
6369 }
6370 }
6371
6372 #[derive(Clone, Debug)]
6389 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6390
6391 impl CreateSessionTemplate {
6392 pub(crate) fn new(
6393 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6394 ) -> Self {
6395 Self(RequestBuilder::new(stub))
6396 }
6397
6398 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6400 mut self,
6401 v: V,
6402 ) -> Self {
6403 self.0.request = v.into();
6404 self
6405 }
6406
6407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6409 self.0.options = v.into();
6410 self
6411 }
6412
6413 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6415 (*self.0.stub)
6416 .create_session_template(self.0.request, self.0.options)
6417 .await
6418 .map(crate::Response::into_body)
6419 }
6420
6421 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6425 self.0.request.parent = v.into();
6426 self
6427 }
6428
6429 pub fn set_session_template<T>(mut self, v: T) -> Self
6433 where
6434 T: std::convert::Into<crate::model::SessionTemplate>,
6435 {
6436 self.0.request.session_template = std::option::Option::Some(v.into());
6437 self
6438 }
6439
6440 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6444 where
6445 T: std::convert::Into<crate::model::SessionTemplate>,
6446 {
6447 self.0.request.session_template = v.map(|x| x.into());
6448 self
6449 }
6450 }
6451
6452 #[doc(hidden)]
6453 impl crate::RequestBuilder for CreateSessionTemplate {
6454 fn request_options(&mut self) -> &mut crate::RequestOptions {
6455 &mut self.0.options
6456 }
6457 }
6458
6459 #[derive(Clone, Debug)]
6476 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6477
6478 impl UpdateSessionTemplate {
6479 pub(crate) fn new(
6480 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6481 ) -> Self {
6482 Self(RequestBuilder::new(stub))
6483 }
6484
6485 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6487 mut self,
6488 v: V,
6489 ) -> Self {
6490 self.0.request = v.into();
6491 self
6492 }
6493
6494 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6496 self.0.options = v.into();
6497 self
6498 }
6499
6500 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6502 (*self.0.stub)
6503 .update_session_template(self.0.request, self.0.options)
6504 .await
6505 .map(crate::Response::into_body)
6506 }
6507
6508 pub fn set_session_template<T>(mut self, v: T) -> Self
6512 where
6513 T: std::convert::Into<crate::model::SessionTemplate>,
6514 {
6515 self.0.request.session_template = std::option::Option::Some(v.into());
6516 self
6517 }
6518
6519 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6523 where
6524 T: std::convert::Into<crate::model::SessionTemplate>,
6525 {
6526 self.0.request.session_template = v.map(|x| x.into());
6527 self
6528 }
6529 }
6530
6531 #[doc(hidden)]
6532 impl crate::RequestBuilder for UpdateSessionTemplate {
6533 fn request_options(&mut self) -> &mut crate::RequestOptions {
6534 &mut self.0.options
6535 }
6536 }
6537
6538 #[derive(Clone, Debug)]
6555 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6556
6557 impl GetSessionTemplate {
6558 pub(crate) fn new(
6559 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6560 ) -> Self {
6561 Self(RequestBuilder::new(stub))
6562 }
6563
6564 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6566 mut self,
6567 v: V,
6568 ) -> 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::SessionTemplate> {
6581 (*self.0.stub)
6582 .get_session_template(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 GetSessionTemplate {
6598 fn request_options(&mut self) -> &mut crate::RequestOptions {
6599 &mut self.0.options
6600 }
6601 }
6602
6603 #[derive(Clone, Debug)]
6624 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6625
6626 impl ListSessionTemplates {
6627 pub(crate) fn new(
6628 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6629 ) -> Self {
6630 Self(RequestBuilder::new(stub))
6631 }
6632
6633 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6635 mut self,
6636 v: V,
6637 ) -> Self {
6638 self.0.request = v.into();
6639 self
6640 }
6641
6642 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6644 self.0.options = v.into();
6645 self
6646 }
6647
6648 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6650 (*self.0.stub)
6651 .list_session_templates(self.0.request, self.0.options)
6652 .await
6653 .map(crate::Response::into_body)
6654 }
6655
6656 pub fn by_page(
6658 self,
6659 ) -> impl google_cloud_gax::paginator::Paginator<
6660 crate::model::ListSessionTemplatesResponse,
6661 crate::Error,
6662 > {
6663 use std::clone::Clone;
6664 let token = self.0.request.page_token.clone();
6665 let execute = move |token: String| {
6666 let mut builder = self.clone();
6667 builder.0.request = builder.0.request.set_page_token(token);
6668 builder.send()
6669 };
6670 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6671 }
6672
6673 pub fn by_item(
6675 self,
6676 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6677 crate::model::ListSessionTemplatesResponse,
6678 crate::Error,
6679 > {
6680 use google_cloud_gax::paginator::Paginator;
6681 self.by_page().items()
6682 }
6683
6684 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6688 self.0.request.parent = v.into();
6689 self
6690 }
6691
6692 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6694 self.0.request.page_size = v.into();
6695 self
6696 }
6697
6698 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6700 self.0.request.page_token = v.into();
6701 self
6702 }
6703
6704 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6706 self.0.request.filter = v.into();
6707 self
6708 }
6709 }
6710
6711 #[doc(hidden)]
6712 impl crate::RequestBuilder for ListSessionTemplates {
6713 fn request_options(&mut self) -> &mut crate::RequestOptions {
6714 &mut self.0.options
6715 }
6716 }
6717
6718 #[derive(Clone, Debug)]
6735 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6736
6737 impl DeleteSessionTemplate {
6738 pub(crate) fn new(
6739 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6740 ) -> Self {
6741 Self(RequestBuilder::new(stub))
6742 }
6743
6744 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6746 mut self,
6747 v: V,
6748 ) -> Self {
6749 self.0.request = v.into();
6750 self
6751 }
6752
6753 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6755 self.0.options = v.into();
6756 self
6757 }
6758
6759 pub async fn send(self) -> Result<()> {
6761 (*self.0.stub)
6762 .delete_session_template(self.0.request, self.0.options)
6763 .await
6764 .map(crate::Response::into_body)
6765 }
6766
6767 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6771 self.0.request.name = v.into();
6772 self
6773 }
6774 }
6775
6776 #[doc(hidden)]
6777 impl crate::RequestBuilder for DeleteSessionTemplate {
6778 fn request_options(&mut self) -> &mut crate::RequestOptions {
6779 &mut self.0.options
6780 }
6781 }
6782
6783 #[derive(Clone, Debug)]
6800 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
6801
6802 impl SetIamPolicy {
6803 pub(crate) fn new(
6804 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6805 ) -> Self {
6806 Self(RequestBuilder::new(stub))
6807 }
6808
6809 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
6811 mut self,
6812 v: V,
6813 ) -> Self {
6814 self.0.request = v.into();
6815 self
6816 }
6817
6818 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6820 self.0.options = v.into();
6821 self
6822 }
6823
6824 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6826 (*self.0.stub)
6827 .set_iam_policy(self.0.request, self.0.options)
6828 .await
6829 .map(crate::Response::into_body)
6830 }
6831
6832 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6836 self.0.request.resource = v.into();
6837 self
6838 }
6839
6840 pub fn set_policy<T>(mut self, v: T) -> Self
6844 where
6845 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
6846 {
6847 self.0.request.policy = std::option::Option::Some(v.into());
6848 self
6849 }
6850
6851 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6855 where
6856 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
6857 {
6858 self.0.request.policy = v.map(|x| x.into());
6859 self
6860 }
6861
6862 pub fn set_update_mask<T>(mut self, v: T) -> Self
6864 where
6865 T: std::convert::Into<wkt::FieldMask>,
6866 {
6867 self.0.request.update_mask = std::option::Option::Some(v.into());
6868 self
6869 }
6870
6871 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6873 where
6874 T: std::convert::Into<wkt::FieldMask>,
6875 {
6876 self.0.request.update_mask = v.map(|x| x.into());
6877 self
6878 }
6879 }
6880
6881 #[doc(hidden)]
6882 impl crate::RequestBuilder for SetIamPolicy {
6883 fn request_options(&mut self) -> &mut crate::RequestOptions {
6884 &mut self.0.options
6885 }
6886 }
6887
6888 #[derive(Clone, Debug)]
6905 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
6906
6907 impl GetIamPolicy {
6908 pub(crate) fn new(
6909 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6910 ) -> Self {
6911 Self(RequestBuilder::new(stub))
6912 }
6913
6914 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
6916 mut self,
6917 v: V,
6918 ) -> Self {
6919 self.0.request = v.into();
6920 self
6921 }
6922
6923 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6925 self.0.options = v.into();
6926 self
6927 }
6928
6929 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6931 (*self.0.stub)
6932 .get_iam_policy(self.0.request, self.0.options)
6933 .await
6934 .map(crate::Response::into_body)
6935 }
6936
6937 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6941 self.0.request.resource = v.into();
6942 self
6943 }
6944
6945 pub fn set_options<T>(mut self, v: T) -> Self
6947 where
6948 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6949 {
6950 self.0.request.options = std::option::Option::Some(v.into());
6951 self
6952 }
6953
6954 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6956 where
6957 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6958 {
6959 self.0.request.options = v.map(|x| x.into());
6960 self
6961 }
6962 }
6963
6964 #[doc(hidden)]
6965 impl crate::RequestBuilder for GetIamPolicy {
6966 fn request_options(&mut self) -> &mut crate::RequestOptions {
6967 &mut self.0.options
6968 }
6969 }
6970
6971 #[derive(Clone, Debug)]
6988 pub struct TestIamPermissions(
6989 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
6990 );
6991
6992 impl TestIamPermissions {
6993 pub(crate) fn new(
6994 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6995 ) -> Self {
6996 Self(RequestBuilder::new(stub))
6997 }
6998
6999 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
7001 mut self,
7002 v: V,
7003 ) -> Self {
7004 self.0.request = v.into();
7005 self
7006 }
7007
7008 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7010 self.0.options = v.into();
7011 self
7012 }
7013
7014 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
7016 (*self.0.stub)
7017 .test_iam_permissions(self.0.request, self.0.options)
7018 .await
7019 .map(crate::Response::into_body)
7020 }
7021
7022 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7026 self.0.request.resource = v.into();
7027 self
7028 }
7029
7030 pub fn set_permissions<T, V>(mut self, v: T) -> Self
7034 where
7035 T: std::iter::IntoIterator<Item = V>,
7036 V: std::convert::Into<std::string::String>,
7037 {
7038 use std::iter::Iterator;
7039 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7040 self
7041 }
7042 }
7043
7044 #[doc(hidden)]
7045 impl crate::RequestBuilder for TestIamPermissions {
7046 fn request_options(&mut self) -> &mut crate::RequestOptions {
7047 &mut self.0.options
7048 }
7049 }
7050
7051 #[derive(Clone, Debug)]
7072 pub struct ListOperations(
7073 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7074 );
7075
7076 impl ListOperations {
7077 pub(crate) fn new(
7078 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7079 ) -> Self {
7080 Self(RequestBuilder::new(stub))
7081 }
7082
7083 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7085 mut self,
7086 v: V,
7087 ) -> Self {
7088 self.0.request = v.into();
7089 self
7090 }
7091
7092 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7094 self.0.options = v.into();
7095 self
7096 }
7097
7098 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7100 (*self.0.stub)
7101 .list_operations(self.0.request, self.0.options)
7102 .await
7103 .map(crate::Response::into_body)
7104 }
7105
7106 pub fn by_page(
7108 self,
7109 ) -> impl google_cloud_gax::paginator::Paginator<
7110 google_cloud_longrunning::model::ListOperationsResponse,
7111 crate::Error,
7112 > {
7113 use std::clone::Clone;
7114 let token = self.0.request.page_token.clone();
7115 let execute = move |token: String| {
7116 let mut builder = self.clone();
7117 builder.0.request = builder.0.request.set_page_token(token);
7118 builder.send()
7119 };
7120 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7121 }
7122
7123 pub fn by_item(
7125 self,
7126 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7127 google_cloud_longrunning::model::ListOperationsResponse,
7128 crate::Error,
7129 > {
7130 use google_cloud_gax::paginator::Paginator;
7131 self.by_page().items()
7132 }
7133
7134 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7136 self.0.request.name = v.into();
7137 self
7138 }
7139
7140 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7142 self.0.request.filter = v.into();
7143 self
7144 }
7145
7146 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7148 self.0.request.page_size = v.into();
7149 self
7150 }
7151
7152 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7154 self.0.request.page_token = v.into();
7155 self
7156 }
7157
7158 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7160 self.0.request.return_partial_success = v.into();
7161 self
7162 }
7163 }
7164
7165 #[doc(hidden)]
7166 impl crate::RequestBuilder for ListOperations {
7167 fn request_options(&mut self) -> &mut crate::RequestOptions {
7168 &mut self.0.options
7169 }
7170 }
7171
7172 #[derive(Clone, Debug)]
7189 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7190
7191 impl GetOperation {
7192 pub(crate) fn new(
7193 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7194 ) -> Self {
7195 Self(RequestBuilder::new(stub))
7196 }
7197
7198 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7200 mut self,
7201 v: V,
7202 ) -> Self {
7203 self.0.request = v.into();
7204 self
7205 }
7206
7207 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7209 self.0.options = v.into();
7210 self
7211 }
7212
7213 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7215 (*self.0.stub)
7216 .get_operation(self.0.request, self.0.options)
7217 .await
7218 .map(crate::Response::into_body)
7219 }
7220
7221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7223 self.0.request.name = v.into();
7224 self
7225 }
7226 }
7227
7228 #[doc(hidden)]
7229 impl crate::RequestBuilder for GetOperation {
7230 fn request_options(&mut self) -> &mut crate::RequestOptions {
7231 &mut self.0.options
7232 }
7233 }
7234
7235 #[derive(Clone, Debug)]
7252 pub struct DeleteOperation(
7253 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
7254 );
7255
7256 impl DeleteOperation {
7257 pub(crate) fn new(
7258 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7259 ) -> Self {
7260 Self(RequestBuilder::new(stub))
7261 }
7262
7263 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
7265 mut self,
7266 v: V,
7267 ) -> Self {
7268 self.0.request = v.into();
7269 self
7270 }
7271
7272 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7274 self.0.options = v.into();
7275 self
7276 }
7277
7278 pub async fn send(self) -> Result<()> {
7280 (*self.0.stub)
7281 .delete_operation(self.0.request, self.0.options)
7282 .await
7283 .map(crate::Response::into_body)
7284 }
7285
7286 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7288 self.0.request.name = v.into();
7289 self
7290 }
7291 }
7292
7293 #[doc(hidden)]
7294 impl crate::RequestBuilder for DeleteOperation {
7295 fn request_options(&mut self) -> &mut crate::RequestOptions {
7296 &mut self.0.options
7297 }
7298 }
7299
7300 #[derive(Clone, Debug)]
7317 pub struct CancelOperation(
7318 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7319 );
7320
7321 impl CancelOperation {
7322 pub(crate) fn new(
7323 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7324 ) -> Self {
7325 Self(RequestBuilder::new(stub))
7326 }
7327
7328 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7330 mut self,
7331 v: V,
7332 ) -> Self {
7333 self.0.request = v.into();
7334 self
7335 }
7336
7337 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7339 self.0.options = v.into();
7340 self
7341 }
7342
7343 pub async fn send(self) -> Result<()> {
7345 (*self.0.stub)
7346 .cancel_operation(self.0.request, self.0.options)
7347 .await
7348 .map(crate::Response::into_body)
7349 }
7350
7351 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7353 self.0.request.name = v.into();
7354 self
7355 }
7356 }
7357
7358 #[doc(hidden)]
7359 impl crate::RequestBuilder for CancelOperation {
7360 fn request_options(&mut self) -> &mut crate::RequestOptions {
7361 &mut self.0.options
7362 }
7363 }
7364}
7365
7366pub mod session_controller {
7368 use crate::Result;
7369
7370 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7384
7385 pub(crate) mod client {
7386 use super::super::super::client::SessionController;
7387 pub struct Factory;
7388 impl crate::ClientFactory for Factory {
7389 type Client = SessionController;
7390 type Credentials = gaxi::options::Credentials;
7391 async fn build(
7392 self,
7393 config: gaxi::options::ClientConfig,
7394 ) -> crate::ClientBuilderResult<Self::Client> {
7395 Self::Client::new(config).await
7396 }
7397 }
7398 }
7399
7400 #[derive(Clone, Debug)]
7402 pub(crate) struct RequestBuilder<R: std::default::Default> {
7403 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7404 request: R,
7405 options: crate::RequestOptions,
7406 }
7407
7408 impl<R> RequestBuilder<R>
7409 where
7410 R: std::default::Default,
7411 {
7412 pub(crate) fn new(
7413 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7414 ) -> Self {
7415 Self {
7416 stub,
7417 request: R::default(),
7418 options: crate::RequestOptions::default(),
7419 }
7420 }
7421 }
7422
7423 #[derive(Clone, Debug)]
7441 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7442
7443 impl CreateSession {
7444 pub(crate) fn new(
7445 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7446 ) -> Self {
7447 Self(RequestBuilder::new(stub))
7448 }
7449
7450 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7452 self.0.request = v.into();
7453 self
7454 }
7455
7456 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7458 self.0.options = v.into();
7459 self
7460 }
7461
7462 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7469 (*self.0.stub)
7470 .create_session(self.0.request, self.0.options)
7471 .await
7472 .map(crate::Response::into_body)
7473 }
7474
7475 pub fn poller(
7477 self,
7478 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7479 {
7480 type Operation = google_cloud_lro::internal::Operation<
7481 crate::model::Session,
7482 crate::model::SessionOperationMetadata,
7483 >;
7484 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7485 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7486 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7487 if let Some(ref mut details) = poller_options.tracing {
7488 details.method_name = "google_cloud_dataproc_v1::client::SessionController::create_session::until_done";
7489 }
7490
7491 let stub = self.0.stub.clone();
7492 let mut options = self.0.options.clone();
7493 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7494 let query = move |name| {
7495 let stub = stub.clone();
7496 let options = options.clone();
7497 async {
7498 let op = GetOperation::new(stub)
7499 .set_name(name)
7500 .with_options(options)
7501 .send()
7502 .await?;
7503 Ok(Operation::new(op))
7504 }
7505 };
7506
7507 let start = move || async {
7508 let op = self.send().await?;
7509 Ok(Operation::new(op))
7510 };
7511
7512 use google_cloud_lro::internal::PollerExt;
7513 {
7514 google_cloud_lro::internal::new_poller(
7515 polling_error_policy,
7516 polling_backoff_policy,
7517 start,
7518 query,
7519 )
7520 }
7521 .with_options(poller_options)
7522 }
7523
7524 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7528 self.0.request.parent = v.into();
7529 self
7530 }
7531
7532 pub fn set_session<T>(mut self, v: T) -> Self
7536 where
7537 T: std::convert::Into<crate::model::Session>,
7538 {
7539 self.0.request.session = std::option::Option::Some(v.into());
7540 self
7541 }
7542
7543 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7547 where
7548 T: std::convert::Into<crate::model::Session>,
7549 {
7550 self.0.request.session = v.map(|x| x.into());
7551 self
7552 }
7553
7554 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7558 self.0.request.session_id = v.into();
7559 self
7560 }
7561
7562 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7564 self.0.request.request_id = v.into();
7565 self
7566 }
7567 }
7568
7569 #[doc(hidden)]
7570 impl crate::RequestBuilder for CreateSession {
7571 fn request_options(&mut self) -> &mut crate::RequestOptions {
7572 &mut self.0.options
7573 }
7574 }
7575
7576 #[derive(Clone, Debug)]
7593 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7594
7595 impl GetSession {
7596 pub(crate) fn new(
7597 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7598 ) -> Self {
7599 Self(RequestBuilder::new(stub))
7600 }
7601
7602 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7604 self.0.request = v.into();
7605 self
7606 }
7607
7608 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7610 self.0.options = v.into();
7611 self
7612 }
7613
7614 pub async fn send(self) -> Result<crate::model::Session> {
7616 (*self.0.stub)
7617 .get_session(self.0.request, self.0.options)
7618 .await
7619 .map(crate::Response::into_body)
7620 }
7621
7622 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7626 self.0.request.name = v.into();
7627 self
7628 }
7629 }
7630
7631 #[doc(hidden)]
7632 impl crate::RequestBuilder for GetSession {
7633 fn request_options(&mut self) -> &mut crate::RequestOptions {
7634 &mut self.0.options
7635 }
7636 }
7637
7638 #[derive(Clone, Debug)]
7659 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7660
7661 impl ListSessions {
7662 pub(crate) fn new(
7663 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7664 ) -> Self {
7665 Self(RequestBuilder::new(stub))
7666 }
7667
7668 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7670 self.0.request = v.into();
7671 self
7672 }
7673
7674 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7676 self.0.options = v.into();
7677 self
7678 }
7679
7680 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7682 (*self.0.stub)
7683 .list_sessions(self.0.request, self.0.options)
7684 .await
7685 .map(crate::Response::into_body)
7686 }
7687
7688 pub fn by_page(
7690 self,
7691 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
7692 {
7693 use std::clone::Clone;
7694 let token = self.0.request.page_token.clone();
7695 let execute = move |token: String| {
7696 let mut builder = self.clone();
7697 builder.0.request = builder.0.request.set_page_token(token);
7698 builder.send()
7699 };
7700 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7701 }
7702
7703 pub fn by_item(
7705 self,
7706 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7707 crate::model::ListSessionsResponse,
7708 crate::Error,
7709 > {
7710 use google_cloud_gax::paginator::Paginator;
7711 self.by_page().items()
7712 }
7713
7714 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7718 self.0.request.parent = v.into();
7719 self
7720 }
7721
7722 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7724 self.0.request.page_size = v.into();
7725 self
7726 }
7727
7728 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7730 self.0.request.page_token = v.into();
7731 self
7732 }
7733
7734 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7736 self.0.request.filter = v.into();
7737 self
7738 }
7739 }
7740
7741 #[doc(hidden)]
7742 impl crate::RequestBuilder for ListSessions {
7743 fn request_options(&mut self) -> &mut crate::RequestOptions {
7744 &mut self.0.options
7745 }
7746 }
7747
7748 #[derive(Clone, Debug)]
7766 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7767
7768 impl TerminateSession {
7769 pub(crate) fn new(
7770 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7771 ) -> Self {
7772 Self(RequestBuilder::new(stub))
7773 }
7774
7775 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7777 mut self,
7778 v: V,
7779 ) -> Self {
7780 self.0.request = v.into();
7781 self
7782 }
7783
7784 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7786 self.0.options = v.into();
7787 self
7788 }
7789
7790 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7797 (*self.0.stub)
7798 .terminate_session(self.0.request, self.0.options)
7799 .await
7800 .map(crate::Response::into_body)
7801 }
7802
7803 pub fn poller(
7805 self,
7806 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7807 {
7808 type Operation = google_cloud_lro::internal::Operation<
7809 crate::model::Session,
7810 crate::model::SessionOperationMetadata,
7811 >;
7812 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7813 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7814 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7815 if let Some(ref mut details) = poller_options.tracing {
7816 details.method_name = "google_cloud_dataproc_v1::client::SessionController::terminate_session::until_done";
7817 }
7818
7819 let stub = self.0.stub.clone();
7820 let mut options = self.0.options.clone();
7821 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7822 let query = move |name| {
7823 let stub = stub.clone();
7824 let options = options.clone();
7825 async {
7826 let op = GetOperation::new(stub)
7827 .set_name(name)
7828 .with_options(options)
7829 .send()
7830 .await?;
7831 Ok(Operation::new(op))
7832 }
7833 };
7834
7835 let start = move || async {
7836 let op = self.send().await?;
7837 Ok(Operation::new(op))
7838 };
7839
7840 use google_cloud_lro::internal::PollerExt;
7841 {
7842 google_cloud_lro::internal::new_poller(
7843 polling_error_policy,
7844 polling_backoff_policy,
7845 start,
7846 query,
7847 )
7848 }
7849 .with_options(poller_options)
7850 }
7851
7852 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7856 self.0.request.name = v.into();
7857 self
7858 }
7859
7860 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7862 self.0.request.request_id = v.into();
7863 self
7864 }
7865 }
7866
7867 #[doc(hidden)]
7868 impl crate::RequestBuilder for TerminateSession {
7869 fn request_options(&mut self) -> &mut crate::RequestOptions {
7870 &mut self.0.options
7871 }
7872 }
7873
7874 #[derive(Clone, Debug)]
7892 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7893
7894 impl DeleteSession {
7895 pub(crate) fn new(
7896 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7897 ) -> Self {
7898 Self(RequestBuilder::new(stub))
7899 }
7900
7901 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7903 self.0.request = v.into();
7904 self
7905 }
7906
7907 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7909 self.0.options = v.into();
7910 self
7911 }
7912
7913 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7920 (*self.0.stub)
7921 .delete_session(self.0.request, self.0.options)
7922 .await
7923 .map(crate::Response::into_body)
7924 }
7925
7926 pub fn poller(
7928 self,
7929 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7930 {
7931 type Operation = google_cloud_lro::internal::Operation<
7932 crate::model::Session,
7933 crate::model::SessionOperationMetadata,
7934 >;
7935 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7936 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7937 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7938 if let Some(ref mut details) = poller_options.tracing {
7939 details.method_name = "google_cloud_dataproc_v1::client::SessionController::delete_session::until_done";
7940 }
7941
7942 let stub = self.0.stub.clone();
7943 let mut options = self.0.options.clone();
7944 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7945 let query = move |name| {
7946 let stub = stub.clone();
7947 let options = options.clone();
7948 async {
7949 let op = GetOperation::new(stub)
7950 .set_name(name)
7951 .with_options(options)
7952 .send()
7953 .await?;
7954 Ok(Operation::new(op))
7955 }
7956 };
7957
7958 let start = move || async {
7959 let op = self.send().await?;
7960 Ok(Operation::new(op))
7961 };
7962
7963 use google_cloud_lro::internal::PollerExt;
7964 {
7965 google_cloud_lro::internal::new_poller(
7966 polling_error_policy,
7967 polling_backoff_policy,
7968 start,
7969 query,
7970 )
7971 }
7972 .with_options(poller_options)
7973 }
7974
7975 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7979 self.0.request.name = v.into();
7980 self
7981 }
7982
7983 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7985 self.0.request.request_id = v.into();
7986 self
7987 }
7988 }
7989
7990 #[doc(hidden)]
7991 impl crate::RequestBuilder for DeleteSession {
7992 fn request_options(&mut self) -> &mut crate::RequestOptions {
7993 &mut self.0.options
7994 }
7995 }
7996
7997 #[derive(Clone, Debug)]
8014 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
8015
8016 impl SetIamPolicy {
8017 pub(crate) fn new(
8018 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8019 ) -> Self {
8020 Self(RequestBuilder::new(stub))
8021 }
8022
8023 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
8025 mut self,
8026 v: V,
8027 ) -> Self {
8028 self.0.request = v.into();
8029 self
8030 }
8031
8032 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8034 self.0.options = v.into();
8035 self
8036 }
8037
8038 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8040 (*self.0.stub)
8041 .set_iam_policy(self.0.request, self.0.options)
8042 .await
8043 .map(crate::Response::into_body)
8044 }
8045
8046 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8050 self.0.request.resource = v.into();
8051 self
8052 }
8053
8054 pub fn set_policy<T>(mut self, v: T) -> Self
8058 where
8059 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
8060 {
8061 self.0.request.policy = std::option::Option::Some(v.into());
8062 self
8063 }
8064
8065 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
8069 where
8070 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
8071 {
8072 self.0.request.policy = v.map(|x| x.into());
8073 self
8074 }
8075
8076 pub fn set_update_mask<T>(mut self, v: T) -> Self
8078 where
8079 T: std::convert::Into<wkt::FieldMask>,
8080 {
8081 self.0.request.update_mask = std::option::Option::Some(v.into());
8082 self
8083 }
8084
8085 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8087 where
8088 T: std::convert::Into<wkt::FieldMask>,
8089 {
8090 self.0.request.update_mask = v.map(|x| x.into());
8091 self
8092 }
8093 }
8094
8095 #[doc(hidden)]
8096 impl crate::RequestBuilder for SetIamPolicy {
8097 fn request_options(&mut self) -> &mut crate::RequestOptions {
8098 &mut self.0.options
8099 }
8100 }
8101
8102 #[derive(Clone, Debug)]
8119 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
8120
8121 impl GetIamPolicy {
8122 pub(crate) fn new(
8123 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8124 ) -> Self {
8125 Self(RequestBuilder::new(stub))
8126 }
8127
8128 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
8130 mut self,
8131 v: V,
8132 ) -> Self {
8133 self.0.request = v.into();
8134 self
8135 }
8136
8137 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8139 self.0.options = v.into();
8140 self
8141 }
8142
8143 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8145 (*self.0.stub)
8146 .get_iam_policy(self.0.request, self.0.options)
8147 .await
8148 .map(crate::Response::into_body)
8149 }
8150
8151 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8155 self.0.request.resource = v.into();
8156 self
8157 }
8158
8159 pub fn set_options<T>(mut self, v: T) -> Self
8161 where
8162 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8163 {
8164 self.0.request.options = std::option::Option::Some(v.into());
8165 self
8166 }
8167
8168 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
8170 where
8171 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8172 {
8173 self.0.request.options = v.map(|x| x.into());
8174 self
8175 }
8176 }
8177
8178 #[doc(hidden)]
8179 impl crate::RequestBuilder for GetIamPolicy {
8180 fn request_options(&mut self) -> &mut crate::RequestOptions {
8181 &mut self.0.options
8182 }
8183 }
8184
8185 #[derive(Clone, Debug)]
8202 pub struct TestIamPermissions(
8203 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
8204 );
8205
8206 impl TestIamPermissions {
8207 pub(crate) fn new(
8208 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8209 ) -> Self {
8210 Self(RequestBuilder::new(stub))
8211 }
8212
8213 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
8215 mut self,
8216 v: V,
8217 ) -> Self {
8218 self.0.request = v.into();
8219 self
8220 }
8221
8222 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8224 self.0.options = v.into();
8225 self
8226 }
8227
8228 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
8230 (*self.0.stub)
8231 .test_iam_permissions(self.0.request, self.0.options)
8232 .await
8233 .map(crate::Response::into_body)
8234 }
8235
8236 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8240 self.0.request.resource = v.into();
8241 self
8242 }
8243
8244 pub fn set_permissions<T, V>(mut self, v: T) -> Self
8248 where
8249 T: std::iter::IntoIterator<Item = V>,
8250 V: std::convert::Into<std::string::String>,
8251 {
8252 use std::iter::Iterator;
8253 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8254 self
8255 }
8256 }
8257
8258 #[doc(hidden)]
8259 impl crate::RequestBuilder for TestIamPermissions {
8260 fn request_options(&mut self) -> &mut crate::RequestOptions {
8261 &mut self.0.options
8262 }
8263 }
8264
8265 #[derive(Clone, Debug)]
8286 pub struct ListOperations(
8287 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8288 );
8289
8290 impl ListOperations {
8291 pub(crate) fn new(
8292 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8293 ) -> Self {
8294 Self(RequestBuilder::new(stub))
8295 }
8296
8297 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8299 mut self,
8300 v: V,
8301 ) -> Self {
8302 self.0.request = v.into();
8303 self
8304 }
8305
8306 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8308 self.0.options = v.into();
8309 self
8310 }
8311
8312 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8314 (*self.0.stub)
8315 .list_operations(self.0.request, self.0.options)
8316 .await
8317 .map(crate::Response::into_body)
8318 }
8319
8320 pub fn by_page(
8322 self,
8323 ) -> impl google_cloud_gax::paginator::Paginator<
8324 google_cloud_longrunning::model::ListOperationsResponse,
8325 crate::Error,
8326 > {
8327 use std::clone::Clone;
8328 let token = self.0.request.page_token.clone();
8329 let execute = move |token: String| {
8330 let mut builder = self.clone();
8331 builder.0.request = builder.0.request.set_page_token(token);
8332 builder.send()
8333 };
8334 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8335 }
8336
8337 pub fn by_item(
8339 self,
8340 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8341 google_cloud_longrunning::model::ListOperationsResponse,
8342 crate::Error,
8343 > {
8344 use google_cloud_gax::paginator::Paginator;
8345 self.by_page().items()
8346 }
8347
8348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8350 self.0.request.name = v.into();
8351 self
8352 }
8353
8354 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8356 self.0.request.filter = v.into();
8357 self
8358 }
8359
8360 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8362 self.0.request.page_size = v.into();
8363 self
8364 }
8365
8366 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8368 self.0.request.page_token = v.into();
8369 self
8370 }
8371
8372 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8374 self.0.request.return_partial_success = v.into();
8375 self
8376 }
8377 }
8378
8379 #[doc(hidden)]
8380 impl crate::RequestBuilder for ListOperations {
8381 fn request_options(&mut self) -> &mut crate::RequestOptions {
8382 &mut self.0.options
8383 }
8384 }
8385
8386 #[derive(Clone, Debug)]
8403 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8404
8405 impl GetOperation {
8406 pub(crate) fn new(
8407 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8408 ) -> Self {
8409 Self(RequestBuilder::new(stub))
8410 }
8411
8412 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8414 mut self,
8415 v: V,
8416 ) -> Self {
8417 self.0.request = v.into();
8418 self
8419 }
8420
8421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8423 self.0.options = v.into();
8424 self
8425 }
8426
8427 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8429 (*self.0.stub)
8430 .get_operation(self.0.request, self.0.options)
8431 .await
8432 .map(crate::Response::into_body)
8433 }
8434
8435 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8437 self.0.request.name = v.into();
8438 self
8439 }
8440 }
8441
8442 #[doc(hidden)]
8443 impl crate::RequestBuilder for GetOperation {
8444 fn request_options(&mut self) -> &mut crate::RequestOptions {
8445 &mut self.0.options
8446 }
8447 }
8448
8449 #[derive(Clone, Debug)]
8466 pub struct DeleteOperation(
8467 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
8468 );
8469
8470 impl DeleteOperation {
8471 pub(crate) fn new(
8472 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8473 ) -> Self {
8474 Self(RequestBuilder::new(stub))
8475 }
8476
8477 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
8479 mut self,
8480 v: V,
8481 ) -> Self {
8482 self.0.request = v.into();
8483 self
8484 }
8485
8486 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8488 self.0.options = v.into();
8489 self
8490 }
8491
8492 pub async fn send(self) -> Result<()> {
8494 (*self.0.stub)
8495 .delete_operation(self.0.request, self.0.options)
8496 .await
8497 .map(crate::Response::into_body)
8498 }
8499
8500 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8502 self.0.request.name = v.into();
8503 self
8504 }
8505 }
8506
8507 #[doc(hidden)]
8508 impl crate::RequestBuilder for DeleteOperation {
8509 fn request_options(&mut self) -> &mut crate::RequestOptions {
8510 &mut self.0.options
8511 }
8512 }
8513
8514 #[derive(Clone, Debug)]
8531 pub struct CancelOperation(
8532 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8533 );
8534
8535 impl CancelOperation {
8536 pub(crate) fn new(
8537 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8538 ) -> Self {
8539 Self(RequestBuilder::new(stub))
8540 }
8541
8542 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8544 mut self,
8545 v: V,
8546 ) -> Self {
8547 self.0.request = v.into();
8548 self
8549 }
8550
8551 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8553 self.0.options = v.into();
8554 self
8555 }
8556
8557 pub async fn send(self) -> Result<()> {
8559 (*self.0.stub)
8560 .cancel_operation(self.0.request, self.0.options)
8561 .await
8562 .map(crate::Response::into_body)
8563 }
8564
8565 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8567 self.0.request.name = v.into();
8568 self
8569 }
8570 }
8571
8572 #[doc(hidden)]
8573 impl crate::RequestBuilder for CancelOperation {
8574 fn request_options(&mut self) -> &mut crate::RequestOptions {
8575 &mut self.0.options
8576 }
8577 }
8578}
8579
8580pub mod workflow_template_service {
8582 use crate::Result;
8583
8584 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8598
8599 pub(crate) mod client {
8600 use super::super::super::client::WorkflowTemplateService;
8601 pub struct Factory;
8602 impl crate::ClientFactory for Factory {
8603 type Client = WorkflowTemplateService;
8604 type Credentials = gaxi::options::Credentials;
8605 async fn build(
8606 self,
8607 config: gaxi::options::ClientConfig,
8608 ) -> crate::ClientBuilderResult<Self::Client> {
8609 Self::Client::new(config).await
8610 }
8611 }
8612 }
8613
8614 #[derive(Clone, Debug)]
8616 pub(crate) struct RequestBuilder<R: std::default::Default> {
8617 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8618 request: R,
8619 options: crate::RequestOptions,
8620 }
8621
8622 impl<R> RequestBuilder<R>
8623 where
8624 R: std::default::Default,
8625 {
8626 pub(crate) fn new(
8627 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8628 ) -> Self {
8629 Self {
8630 stub,
8631 request: R::default(),
8632 options: crate::RequestOptions::default(),
8633 }
8634 }
8635 }
8636
8637 #[derive(Clone, Debug)]
8654 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8655
8656 impl CreateWorkflowTemplate {
8657 pub(crate) fn new(
8658 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8659 ) -> Self {
8660 Self(RequestBuilder::new(stub))
8661 }
8662
8663 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8665 mut self,
8666 v: V,
8667 ) -> Self {
8668 self.0.request = v.into();
8669 self
8670 }
8671
8672 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8674 self.0.options = v.into();
8675 self
8676 }
8677
8678 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8680 (*self.0.stub)
8681 .create_workflow_template(self.0.request, self.0.options)
8682 .await
8683 .map(crate::Response::into_body)
8684 }
8685
8686 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8690 self.0.request.parent = v.into();
8691 self
8692 }
8693
8694 pub fn set_template<T>(mut self, v: T) -> Self
8698 where
8699 T: std::convert::Into<crate::model::WorkflowTemplate>,
8700 {
8701 self.0.request.template = std::option::Option::Some(v.into());
8702 self
8703 }
8704
8705 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8709 where
8710 T: std::convert::Into<crate::model::WorkflowTemplate>,
8711 {
8712 self.0.request.template = v.map(|x| x.into());
8713 self
8714 }
8715 }
8716
8717 #[doc(hidden)]
8718 impl crate::RequestBuilder for CreateWorkflowTemplate {
8719 fn request_options(&mut self) -> &mut crate::RequestOptions {
8720 &mut self.0.options
8721 }
8722 }
8723
8724 #[derive(Clone, Debug)]
8741 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8742
8743 impl GetWorkflowTemplate {
8744 pub(crate) fn new(
8745 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8746 ) -> Self {
8747 Self(RequestBuilder::new(stub))
8748 }
8749
8750 pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
8752 mut self,
8753 v: V,
8754 ) -> Self {
8755 self.0.request = v.into();
8756 self
8757 }
8758
8759 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8761 self.0.options = v.into();
8762 self
8763 }
8764
8765 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8767 (*self.0.stub)
8768 .get_workflow_template(self.0.request, self.0.options)
8769 .await
8770 .map(crate::Response::into_body)
8771 }
8772
8773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8777 self.0.request.name = v.into();
8778 self
8779 }
8780
8781 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8783 self.0.request.version = v.into();
8784 self
8785 }
8786 }
8787
8788 #[doc(hidden)]
8789 impl crate::RequestBuilder for GetWorkflowTemplate {
8790 fn request_options(&mut self) -> &mut crate::RequestOptions {
8791 &mut self.0.options
8792 }
8793 }
8794
8795 #[derive(Clone, Debug)]
8813 pub struct InstantiateWorkflowTemplate(
8814 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8815 );
8816
8817 impl InstantiateWorkflowTemplate {
8818 pub(crate) fn new(
8819 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8820 ) -> Self {
8821 Self(RequestBuilder::new(stub))
8822 }
8823
8824 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8826 mut self,
8827 v: V,
8828 ) -> Self {
8829 self.0.request = v.into();
8830 self
8831 }
8832
8833 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8835 self.0.options = v.into();
8836 self
8837 }
8838
8839 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8846 (*self.0.stub)
8847 .instantiate_workflow_template(self.0.request, self.0.options)
8848 .await
8849 .map(crate::Response::into_body)
8850 }
8851
8852 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::WorkflowMetadata> {
8854 type Operation =
8855 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8856 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8857 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8858 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8859 if let Some(ref mut details) = poller_options.tracing {
8860 details.method_name = "google_cloud_dataproc_v1::client::WorkflowTemplateService::instantiate_workflow_template::until_done";
8861 }
8862
8863 let stub = self.0.stub.clone();
8864 let mut options = self.0.options.clone();
8865 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8866 let query = move |name| {
8867 let stub = stub.clone();
8868 let options = options.clone();
8869 async {
8870 let op = GetOperation::new(stub)
8871 .set_name(name)
8872 .with_options(options)
8873 .send()
8874 .await?;
8875 Ok(Operation::new(op))
8876 }
8877 };
8878
8879 let start = move || async {
8880 let op = self.send().await?;
8881 Ok(Operation::new(op))
8882 };
8883
8884 use google_cloud_lro::internal::PollerExt;
8885 {
8886 google_cloud_lro::internal::new_unit_response_poller(
8887 polling_error_policy,
8888 polling_backoff_policy,
8889 start,
8890 query,
8891 )
8892 }
8893 .with_options(poller_options)
8894 }
8895
8896 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8900 self.0.request.name = v.into();
8901 self
8902 }
8903
8904 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8906 self.0.request.version = v.into();
8907 self
8908 }
8909
8910 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8912 self.0.request.request_id = v.into();
8913 self
8914 }
8915
8916 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8918 where
8919 T: std::iter::IntoIterator<Item = (K, V)>,
8920 K: std::convert::Into<std::string::String>,
8921 V: std::convert::Into<std::string::String>,
8922 {
8923 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8924 self
8925 }
8926 }
8927
8928 #[doc(hidden)]
8929 impl crate::RequestBuilder for InstantiateWorkflowTemplate {
8930 fn request_options(&mut self) -> &mut crate::RequestOptions {
8931 &mut self.0.options
8932 }
8933 }
8934
8935 #[derive(Clone, Debug)]
8953 pub struct InstantiateInlineWorkflowTemplate(
8954 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8955 );
8956
8957 impl InstantiateInlineWorkflowTemplate {
8958 pub(crate) fn new(
8959 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8960 ) -> Self {
8961 Self(RequestBuilder::new(stub))
8962 }
8963
8964 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8966 mut self,
8967 v: V,
8968 ) -> Self {
8969 self.0.request = v.into();
8970 self
8971 }
8972
8973 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8975 self.0.options = v.into();
8976 self
8977 }
8978
8979 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8986 (*self.0.stub)
8987 .instantiate_inline_workflow_template(self.0.request, self.0.options)
8988 .await
8989 .map(crate::Response::into_body)
8990 }
8991
8992 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::WorkflowMetadata> {
8994 type Operation =
8995 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8996 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8997 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8998 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8999 if let Some(ref mut details) = poller_options.tracing {
9000 details.method_name = "google_cloud_dataproc_v1::client::WorkflowTemplateService::instantiate_inline_workflow_template::until_done";
9001 }
9002
9003 let stub = self.0.stub.clone();
9004 let mut options = self.0.options.clone();
9005 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9006 let query = move |name| {
9007 let stub = stub.clone();
9008 let options = options.clone();
9009 async {
9010 let op = GetOperation::new(stub)
9011 .set_name(name)
9012 .with_options(options)
9013 .send()
9014 .await?;
9015 Ok(Operation::new(op))
9016 }
9017 };
9018
9019 let start = move || async {
9020 let op = self.send().await?;
9021 Ok(Operation::new(op))
9022 };
9023
9024 use google_cloud_lro::internal::PollerExt;
9025 {
9026 google_cloud_lro::internal::new_unit_response_poller(
9027 polling_error_policy,
9028 polling_backoff_policy,
9029 start,
9030 query,
9031 )
9032 }
9033 .with_options(poller_options)
9034 }
9035
9036 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9040 self.0.request.parent = v.into();
9041 self
9042 }
9043
9044 pub fn set_template<T>(mut self, v: T) -> Self
9048 where
9049 T: std::convert::Into<crate::model::WorkflowTemplate>,
9050 {
9051 self.0.request.template = std::option::Option::Some(v.into());
9052 self
9053 }
9054
9055 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
9059 where
9060 T: std::convert::Into<crate::model::WorkflowTemplate>,
9061 {
9062 self.0.request.template = v.map(|x| x.into());
9063 self
9064 }
9065
9066 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
9068 self.0.request.request_id = v.into();
9069 self
9070 }
9071 }
9072
9073 #[doc(hidden)]
9074 impl crate::RequestBuilder for InstantiateInlineWorkflowTemplate {
9075 fn request_options(&mut self) -> &mut crate::RequestOptions {
9076 &mut self.0.options
9077 }
9078 }
9079
9080 #[derive(Clone, Debug)]
9097 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
9098
9099 impl UpdateWorkflowTemplate {
9100 pub(crate) fn new(
9101 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9102 ) -> Self {
9103 Self(RequestBuilder::new(stub))
9104 }
9105
9106 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
9108 mut self,
9109 v: V,
9110 ) -> Self {
9111 self.0.request = v.into();
9112 self
9113 }
9114
9115 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9117 self.0.options = v.into();
9118 self
9119 }
9120
9121 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
9123 (*self.0.stub)
9124 .update_workflow_template(self.0.request, self.0.options)
9125 .await
9126 .map(crate::Response::into_body)
9127 }
9128
9129 pub fn set_template<T>(mut self, v: T) -> Self
9133 where
9134 T: std::convert::Into<crate::model::WorkflowTemplate>,
9135 {
9136 self.0.request.template = std::option::Option::Some(v.into());
9137 self
9138 }
9139
9140 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
9144 where
9145 T: std::convert::Into<crate::model::WorkflowTemplate>,
9146 {
9147 self.0.request.template = v.map(|x| x.into());
9148 self
9149 }
9150 }
9151
9152 #[doc(hidden)]
9153 impl crate::RequestBuilder for UpdateWorkflowTemplate {
9154 fn request_options(&mut self) -> &mut crate::RequestOptions {
9155 &mut self.0.options
9156 }
9157 }
9158
9159 #[derive(Clone, Debug)]
9180 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
9181
9182 impl ListWorkflowTemplates {
9183 pub(crate) fn new(
9184 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9185 ) -> Self {
9186 Self(RequestBuilder::new(stub))
9187 }
9188
9189 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
9191 mut self,
9192 v: V,
9193 ) -> Self {
9194 self.0.request = v.into();
9195 self
9196 }
9197
9198 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9200 self.0.options = v.into();
9201 self
9202 }
9203
9204 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
9206 (*self.0.stub)
9207 .list_workflow_templates(self.0.request, self.0.options)
9208 .await
9209 .map(crate::Response::into_body)
9210 }
9211
9212 pub fn by_page(
9214 self,
9215 ) -> impl google_cloud_gax::paginator::Paginator<
9216 crate::model::ListWorkflowTemplatesResponse,
9217 crate::Error,
9218 > {
9219 use std::clone::Clone;
9220 let token = self.0.request.page_token.clone();
9221 let execute = move |token: String| {
9222 let mut builder = self.clone();
9223 builder.0.request = builder.0.request.set_page_token(token);
9224 builder.send()
9225 };
9226 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9227 }
9228
9229 pub fn by_item(
9231 self,
9232 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9233 crate::model::ListWorkflowTemplatesResponse,
9234 crate::Error,
9235 > {
9236 use google_cloud_gax::paginator::Paginator;
9237 self.by_page().items()
9238 }
9239
9240 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9244 self.0.request.parent = v.into();
9245 self
9246 }
9247
9248 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9250 self.0.request.page_size = v.into();
9251 self
9252 }
9253
9254 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9256 self.0.request.page_token = v.into();
9257 self
9258 }
9259 }
9260
9261 #[doc(hidden)]
9262 impl crate::RequestBuilder for ListWorkflowTemplates {
9263 fn request_options(&mut self) -> &mut crate::RequestOptions {
9264 &mut self.0.options
9265 }
9266 }
9267
9268 #[derive(Clone, Debug)]
9285 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
9286
9287 impl DeleteWorkflowTemplate {
9288 pub(crate) fn new(
9289 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9290 ) -> Self {
9291 Self(RequestBuilder::new(stub))
9292 }
9293
9294 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
9296 mut self,
9297 v: V,
9298 ) -> Self {
9299 self.0.request = v.into();
9300 self
9301 }
9302
9303 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9305 self.0.options = v.into();
9306 self
9307 }
9308
9309 pub async fn send(self) -> Result<()> {
9311 (*self.0.stub)
9312 .delete_workflow_template(self.0.request, self.0.options)
9313 .await
9314 .map(crate::Response::into_body)
9315 }
9316
9317 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9321 self.0.request.name = v.into();
9322 self
9323 }
9324
9325 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9327 self.0.request.version = v.into();
9328 self
9329 }
9330 }
9331
9332 #[doc(hidden)]
9333 impl crate::RequestBuilder for DeleteWorkflowTemplate {
9334 fn request_options(&mut self) -> &mut crate::RequestOptions {
9335 &mut self.0.options
9336 }
9337 }
9338
9339 #[derive(Clone, Debug)]
9356 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
9357
9358 impl SetIamPolicy {
9359 pub(crate) fn new(
9360 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9361 ) -> Self {
9362 Self(RequestBuilder::new(stub))
9363 }
9364
9365 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
9367 mut self,
9368 v: V,
9369 ) -> Self {
9370 self.0.request = v.into();
9371 self
9372 }
9373
9374 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9376 self.0.options = v.into();
9377 self
9378 }
9379
9380 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
9382 (*self.0.stub)
9383 .set_iam_policy(self.0.request, self.0.options)
9384 .await
9385 .map(crate::Response::into_body)
9386 }
9387
9388 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9392 self.0.request.resource = v.into();
9393 self
9394 }
9395
9396 pub fn set_policy<T>(mut self, v: T) -> Self
9400 where
9401 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
9402 {
9403 self.0.request.policy = std::option::Option::Some(v.into());
9404 self
9405 }
9406
9407 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9411 where
9412 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
9413 {
9414 self.0.request.policy = v.map(|x| x.into());
9415 self
9416 }
9417
9418 pub fn set_update_mask<T>(mut self, v: T) -> Self
9420 where
9421 T: std::convert::Into<wkt::FieldMask>,
9422 {
9423 self.0.request.update_mask = std::option::Option::Some(v.into());
9424 self
9425 }
9426
9427 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9429 where
9430 T: std::convert::Into<wkt::FieldMask>,
9431 {
9432 self.0.request.update_mask = v.map(|x| x.into());
9433 self
9434 }
9435 }
9436
9437 #[doc(hidden)]
9438 impl crate::RequestBuilder for SetIamPolicy {
9439 fn request_options(&mut self) -> &mut crate::RequestOptions {
9440 &mut self.0.options
9441 }
9442 }
9443
9444 #[derive(Clone, Debug)]
9461 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
9462
9463 impl GetIamPolicy {
9464 pub(crate) fn new(
9465 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9466 ) -> Self {
9467 Self(RequestBuilder::new(stub))
9468 }
9469
9470 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
9472 mut self,
9473 v: V,
9474 ) -> Self {
9475 self.0.request = v.into();
9476 self
9477 }
9478
9479 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9481 self.0.options = v.into();
9482 self
9483 }
9484
9485 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
9487 (*self.0.stub)
9488 .get_iam_policy(self.0.request, self.0.options)
9489 .await
9490 .map(crate::Response::into_body)
9491 }
9492
9493 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9497 self.0.request.resource = v.into();
9498 self
9499 }
9500
9501 pub fn set_options<T>(mut self, v: T) -> Self
9503 where
9504 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
9505 {
9506 self.0.request.options = std::option::Option::Some(v.into());
9507 self
9508 }
9509
9510 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9512 where
9513 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
9514 {
9515 self.0.request.options = v.map(|x| x.into());
9516 self
9517 }
9518 }
9519
9520 #[doc(hidden)]
9521 impl crate::RequestBuilder for GetIamPolicy {
9522 fn request_options(&mut self) -> &mut crate::RequestOptions {
9523 &mut self.0.options
9524 }
9525 }
9526
9527 #[derive(Clone, Debug)]
9544 pub struct TestIamPermissions(
9545 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
9546 );
9547
9548 impl TestIamPermissions {
9549 pub(crate) fn new(
9550 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9551 ) -> Self {
9552 Self(RequestBuilder::new(stub))
9553 }
9554
9555 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
9557 mut self,
9558 v: V,
9559 ) -> Self {
9560 self.0.request = v.into();
9561 self
9562 }
9563
9564 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9566 self.0.options = v.into();
9567 self
9568 }
9569
9570 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
9572 (*self.0.stub)
9573 .test_iam_permissions(self.0.request, self.0.options)
9574 .await
9575 .map(crate::Response::into_body)
9576 }
9577
9578 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9582 self.0.request.resource = v.into();
9583 self
9584 }
9585
9586 pub fn set_permissions<T, V>(mut self, v: T) -> Self
9590 where
9591 T: std::iter::IntoIterator<Item = V>,
9592 V: std::convert::Into<std::string::String>,
9593 {
9594 use std::iter::Iterator;
9595 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9596 self
9597 }
9598 }
9599
9600 #[doc(hidden)]
9601 impl crate::RequestBuilder for TestIamPermissions {
9602 fn request_options(&mut self) -> &mut crate::RequestOptions {
9603 &mut self.0.options
9604 }
9605 }
9606
9607 #[derive(Clone, Debug)]
9628 pub struct ListOperations(
9629 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9630 );
9631
9632 impl ListOperations {
9633 pub(crate) fn new(
9634 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9635 ) -> Self {
9636 Self(RequestBuilder::new(stub))
9637 }
9638
9639 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9641 mut self,
9642 v: V,
9643 ) -> Self {
9644 self.0.request = v.into();
9645 self
9646 }
9647
9648 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9650 self.0.options = v.into();
9651 self
9652 }
9653
9654 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9656 (*self.0.stub)
9657 .list_operations(self.0.request, self.0.options)
9658 .await
9659 .map(crate::Response::into_body)
9660 }
9661
9662 pub fn by_page(
9664 self,
9665 ) -> impl google_cloud_gax::paginator::Paginator<
9666 google_cloud_longrunning::model::ListOperationsResponse,
9667 crate::Error,
9668 > {
9669 use std::clone::Clone;
9670 let token = self.0.request.page_token.clone();
9671 let execute = move |token: String| {
9672 let mut builder = self.clone();
9673 builder.0.request = builder.0.request.set_page_token(token);
9674 builder.send()
9675 };
9676 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9677 }
9678
9679 pub fn by_item(
9681 self,
9682 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9683 google_cloud_longrunning::model::ListOperationsResponse,
9684 crate::Error,
9685 > {
9686 use google_cloud_gax::paginator::Paginator;
9687 self.by_page().items()
9688 }
9689
9690 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9692 self.0.request.name = v.into();
9693 self
9694 }
9695
9696 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9698 self.0.request.filter = v.into();
9699 self
9700 }
9701
9702 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9704 self.0.request.page_size = v.into();
9705 self
9706 }
9707
9708 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9710 self.0.request.page_token = v.into();
9711 self
9712 }
9713
9714 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9716 self.0.request.return_partial_success = v.into();
9717 self
9718 }
9719 }
9720
9721 #[doc(hidden)]
9722 impl crate::RequestBuilder for ListOperations {
9723 fn request_options(&mut self) -> &mut crate::RequestOptions {
9724 &mut self.0.options
9725 }
9726 }
9727
9728 #[derive(Clone, Debug)]
9745 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9746
9747 impl GetOperation {
9748 pub(crate) fn new(
9749 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9750 ) -> Self {
9751 Self(RequestBuilder::new(stub))
9752 }
9753
9754 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9756 mut self,
9757 v: V,
9758 ) -> Self {
9759 self.0.request = v.into();
9760 self
9761 }
9762
9763 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9765 self.0.options = v.into();
9766 self
9767 }
9768
9769 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9771 (*self.0.stub)
9772 .get_operation(self.0.request, self.0.options)
9773 .await
9774 .map(crate::Response::into_body)
9775 }
9776
9777 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9779 self.0.request.name = v.into();
9780 self
9781 }
9782 }
9783
9784 #[doc(hidden)]
9785 impl crate::RequestBuilder for GetOperation {
9786 fn request_options(&mut self) -> &mut crate::RequestOptions {
9787 &mut self.0.options
9788 }
9789 }
9790
9791 #[derive(Clone, Debug)]
9808 pub struct DeleteOperation(
9809 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
9810 );
9811
9812 impl DeleteOperation {
9813 pub(crate) fn new(
9814 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9815 ) -> Self {
9816 Self(RequestBuilder::new(stub))
9817 }
9818
9819 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
9821 mut self,
9822 v: V,
9823 ) -> Self {
9824 self.0.request = v.into();
9825 self
9826 }
9827
9828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9830 self.0.options = v.into();
9831 self
9832 }
9833
9834 pub async fn send(self) -> Result<()> {
9836 (*self.0.stub)
9837 .delete_operation(self.0.request, self.0.options)
9838 .await
9839 .map(crate::Response::into_body)
9840 }
9841
9842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9844 self.0.request.name = v.into();
9845 self
9846 }
9847 }
9848
9849 #[doc(hidden)]
9850 impl crate::RequestBuilder for DeleteOperation {
9851 fn request_options(&mut self) -> &mut crate::RequestOptions {
9852 &mut self.0.options
9853 }
9854 }
9855
9856 #[derive(Clone, Debug)]
9873 pub struct CancelOperation(
9874 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9875 );
9876
9877 impl CancelOperation {
9878 pub(crate) fn new(
9879 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9880 ) -> Self {
9881 Self(RequestBuilder::new(stub))
9882 }
9883
9884 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9886 mut self,
9887 v: V,
9888 ) -> Self {
9889 self.0.request = v.into();
9890 self
9891 }
9892
9893 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9895 self.0.options = v.into();
9896 self
9897 }
9898
9899 pub async fn send(self) -> Result<()> {
9901 (*self.0.stub)
9902 .cancel_operation(self.0.request, self.0.options)
9903 .await
9904 .map(crate::Response::into_body)
9905 }
9906
9907 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9909 self.0.request.name = v.into();
9910 self
9911 }
9912 }
9913
9914 #[doc(hidden)]
9915 impl crate::RequestBuilder for CancelOperation {
9916 fn request_options(&mut self) -> &mut crate::RequestOptions {
9917 &mut self.0.options
9918 }
9919 }
9920}