1pub mod autoscaling_policy_service {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::AutoscalingPolicyService;
38 pub struct Factory;
39 impl gax::client_builder::internal::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 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
92 pub struct CreateAutoscalingPolicy(
93 RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
94 );
95
96 impl CreateAutoscalingPolicy {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
105 mut self,
106 v: V,
107 ) -> Self {
108 self.0.request = v.into();
109 self
110 }
111
112 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
114 self.0.options = v.into();
115 self
116 }
117
118 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
120 (*self.0.stub)
121 .create_autoscaling_policy(self.0.request, self.0.options)
122 .await
123 .map(gax::response::Response::into_body)
124 }
125
126 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
130 self.0.request.parent = v.into();
131 self
132 }
133
134 pub fn set_policy<T>(mut self, v: T) -> Self
138 where
139 T: std::convert::Into<crate::model::AutoscalingPolicy>,
140 {
141 self.0.request.policy = std::option::Option::Some(v.into());
142 self
143 }
144
145 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
149 where
150 T: std::convert::Into<crate::model::AutoscalingPolicy>,
151 {
152 self.0.request.policy = v.map(|x| x.into());
153 self
154 }
155 }
156
157 #[doc(hidden)]
158 impl gax::options::internal::RequestBuilder for CreateAutoscalingPolicy {
159 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
160 &mut self.0.options
161 }
162 }
163
164 #[derive(Clone, Debug)]
182 pub struct UpdateAutoscalingPolicy(
183 RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
184 );
185
186 impl UpdateAutoscalingPolicy {
187 pub(crate) fn new(
188 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
189 ) -> Self {
190 Self(RequestBuilder::new(stub))
191 }
192
193 pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
195 mut self,
196 v: V,
197 ) -> Self {
198 self.0.request = v.into();
199 self
200 }
201
202 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
204 self.0.options = v.into();
205 self
206 }
207
208 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
210 (*self.0.stub)
211 .update_autoscaling_policy(self.0.request, self.0.options)
212 .await
213 .map(gax::response::Response::into_body)
214 }
215
216 pub fn set_policy<T>(mut self, v: T) -> Self
220 where
221 T: std::convert::Into<crate::model::AutoscalingPolicy>,
222 {
223 self.0.request.policy = std::option::Option::Some(v.into());
224 self
225 }
226
227 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
231 where
232 T: std::convert::Into<crate::model::AutoscalingPolicy>,
233 {
234 self.0.request.policy = v.map(|x| x.into());
235 self
236 }
237 }
238
239 #[doc(hidden)]
240 impl gax::options::internal::RequestBuilder for UpdateAutoscalingPolicy {
241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
242 &mut self.0.options
243 }
244 }
245
246 #[derive(Clone, Debug)]
264 pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
265
266 impl GetAutoscalingPolicy {
267 pub(crate) fn new(
268 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
269 ) -> Self {
270 Self(RequestBuilder::new(stub))
271 }
272
273 pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
275 mut self,
276 v: V,
277 ) -> Self {
278 self.0.request = v.into();
279 self
280 }
281
282 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
284 self.0.options = v.into();
285 self
286 }
287
288 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
290 (*self.0.stub)
291 .get_autoscaling_policy(self.0.request, self.0.options)
292 .await
293 .map(gax::response::Response::into_body)
294 }
295
296 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
300 self.0.request.name = v.into();
301 self
302 }
303 }
304
305 #[doc(hidden)]
306 impl gax::options::internal::RequestBuilder for GetAutoscalingPolicy {
307 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
308 &mut self.0.options
309 }
310 }
311
312 #[derive(Clone, Debug)]
334 pub struct ListAutoscalingPolicies(
335 RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
336 );
337
338 impl ListAutoscalingPolicies {
339 pub(crate) fn new(
340 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
341 ) -> Self {
342 Self(RequestBuilder::new(stub))
343 }
344
345 pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
347 mut self,
348 v: V,
349 ) -> Self {
350 self.0.request = v.into();
351 self
352 }
353
354 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
356 self.0.options = v.into();
357 self
358 }
359
360 pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
362 (*self.0.stub)
363 .list_autoscaling_policies(self.0.request, self.0.options)
364 .await
365 .map(gax::response::Response::into_body)
366 }
367
368 pub fn by_page(
370 self,
371 ) -> impl gax::paginator::Paginator<
372 crate::model::ListAutoscalingPoliciesResponse,
373 gax::error::Error,
374 > {
375 use std::clone::Clone;
376 let token = self.0.request.page_token.clone();
377 let execute = move |token: String| {
378 let mut builder = self.clone();
379 builder.0.request = builder.0.request.set_page_token(token);
380 builder.send()
381 };
382 gax::paginator::internal::new_paginator(token, execute)
383 }
384
385 pub fn by_item(
387 self,
388 ) -> impl gax::paginator::ItemPaginator<
389 crate::model::ListAutoscalingPoliciesResponse,
390 gax::error::Error,
391 > {
392 use gax::paginator::Paginator;
393 self.by_page().items()
394 }
395
396 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
400 self.0.request.parent = v.into();
401 self
402 }
403
404 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
406 self.0.request.page_size = v.into();
407 self
408 }
409
410 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
412 self.0.request.page_token = v.into();
413 self
414 }
415 }
416
417 #[doc(hidden)]
418 impl gax::options::internal::RequestBuilder for ListAutoscalingPolicies {
419 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
420 &mut self.0.options
421 }
422 }
423
424 #[derive(Clone, Debug)]
442 pub struct DeleteAutoscalingPolicy(
443 RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
444 );
445
446 impl DeleteAutoscalingPolicy {
447 pub(crate) fn new(
448 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
449 ) -> Self {
450 Self(RequestBuilder::new(stub))
451 }
452
453 pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
455 mut self,
456 v: V,
457 ) -> Self {
458 self.0.request = v.into();
459 self
460 }
461
462 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
464 self.0.options = v.into();
465 self
466 }
467
468 pub async fn send(self) -> Result<()> {
470 (*self.0.stub)
471 .delete_autoscaling_policy(self.0.request, self.0.options)
472 .await
473 .map(gax::response::Response::into_body)
474 }
475
476 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
480 self.0.request.name = v.into();
481 self
482 }
483 }
484
485 #[doc(hidden)]
486 impl gax::options::internal::RequestBuilder for DeleteAutoscalingPolicy {
487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
488 &mut self.0.options
489 }
490 }
491
492 #[derive(Clone, Debug)]
510 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
511
512 impl SetIamPolicy {
513 pub(crate) fn new(
514 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
515 ) -> Self {
516 Self(RequestBuilder::new(stub))
517 }
518
519 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
521 self.0.request = v.into();
522 self
523 }
524
525 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
527 self.0.options = v.into();
528 self
529 }
530
531 pub async fn send(self) -> Result<iam_v1::model::Policy> {
533 (*self.0.stub)
534 .set_iam_policy(self.0.request, self.0.options)
535 .await
536 .map(gax::response::Response::into_body)
537 }
538
539 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
543 self.0.request.resource = v.into();
544 self
545 }
546
547 pub fn set_policy<T>(mut self, v: T) -> Self
551 where
552 T: std::convert::Into<iam_v1::model::Policy>,
553 {
554 self.0.request.policy = std::option::Option::Some(v.into());
555 self
556 }
557
558 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
562 where
563 T: std::convert::Into<iam_v1::model::Policy>,
564 {
565 self.0.request.policy = v.map(|x| x.into());
566 self
567 }
568
569 pub fn set_update_mask<T>(mut self, v: T) -> Self
571 where
572 T: std::convert::Into<wkt::FieldMask>,
573 {
574 self.0.request.update_mask = std::option::Option::Some(v.into());
575 self
576 }
577
578 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
580 where
581 T: std::convert::Into<wkt::FieldMask>,
582 {
583 self.0.request.update_mask = v.map(|x| x.into());
584 self
585 }
586 }
587
588 #[doc(hidden)]
589 impl gax::options::internal::RequestBuilder for SetIamPolicy {
590 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
591 &mut self.0.options
592 }
593 }
594
595 #[derive(Clone, Debug)]
613 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
614
615 impl GetIamPolicy {
616 pub(crate) fn new(
617 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
618 ) -> Self {
619 Self(RequestBuilder::new(stub))
620 }
621
622 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
624 self.0.request = v.into();
625 self
626 }
627
628 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
630 self.0.options = v.into();
631 self
632 }
633
634 pub async fn send(self) -> Result<iam_v1::model::Policy> {
636 (*self.0.stub)
637 .get_iam_policy(self.0.request, self.0.options)
638 .await
639 .map(gax::response::Response::into_body)
640 }
641
642 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
646 self.0.request.resource = v.into();
647 self
648 }
649
650 pub fn set_options<T>(mut self, v: T) -> Self
652 where
653 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
654 {
655 self.0.request.options = std::option::Option::Some(v.into());
656 self
657 }
658
659 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
661 where
662 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
663 {
664 self.0.request.options = v.map(|x| x.into());
665 self
666 }
667 }
668
669 #[doc(hidden)]
670 impl gax::options::internal::RequestBuilder for GetIamPolicy {
671 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
672 &mut self.0.options
673 }
674 }
675
676 #[derive(Clone, Debug)]
694 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
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<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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
714 self.0.options = v.into();
715 self
716 }
717
718 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
720 (*self.0.stub)
721 .test_iam_permissions(self.0.request, self.0.options)
722 .await
723 .map(gax::response::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 gax::options::internal::RequestBuilder for TestIamPermissions {
750 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
751 &mut self.0.options
752 }
753 }
754
755 #[derive(Clone, Debug)]
777 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
778
779 impl ListOperations {
780 pub(crate) fn new(
781 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
782 ) -> Self {
783 Self(RequestBuilder::new(stub))
784 }
785
786 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
788 mut self,
789 v: V,
790 ) -> Self {
791 self.0.request = v.into();
792 self
793 }
794
795 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
797 self.0.options = v.into();
798 self
799 }
800
801 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
803 (*self.0.stub)
804 .list_operations(self.0.request, self.0.options)
805 .await
806 .map(gax::response::Response::into_body)
807 }
808
809 pub fn by_page(
811 self,
812 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
813 {
814 use std::clone::Clone;
815 let token = self.0.request.page_token.clone();
816 let execute = move |token: String| {
817 let mut builder = self.clone();
818 builder.0.request = builder.0.request.set_page_token(token);
819 builder.send()
820 };
821 gax::paginator::internal::new_paginator(token, execute)
822 }
823
824 pub fn by_item(
826 self,
827 ) -> impl gax::paginator::ItemPaginator<
828 longrunning::model::ListOperationsResponse,
829 gax::error::Error,
830 > {
831 use gax::paginator::Paginator;
832 self.by_page().items()
833 }
834
835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
837 self.0.request.name = v.into();
838 self
839 }
840
841 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
843 self.0.request.filter = v.into();
844 self
845 }
846
847 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
849 self.0.request.page_size = v.into();
850 self
851 }
852
853 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
855 self.0.request.page_token = v.into();
856 self
857 }
858 }
859
860 #[doc(hidden)]
861 impl gax::options::internal::RequestBuilder for ListOperations {
862 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
863 &mut self.0.options
864 }
865 }
866
867 #[derive(Clone, Debug)]
885 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
886
887 impl GetOperation {
888 pub(crate) fn new(
889 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
890 ) -> Self {
891 Self(RequestBuilder::new(stub))
892 }
893
894 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
896 mut self,
897 v: V,
898 ) -> Self {
899 self.0.request = v.into();
900 self
901 }
902
903 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
905 self.0.options = v.into();
906 self
907 }
908
909 pub async fn send(self) -> Result<longrunning::model::Operation> {
911 (*self.0.stub)
912 .get_operation(self.0.request, self.0.options)
913 .await
914 .map(gax::response::Response::into_body)
915 }
916
917 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
919 self.0.request.name = v.into();
920 self
921 }
922 }
923
924 #[doc(hidden)]
925 impl gax::options::internal::RequestBuilder for GetOperation {
926 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
927 &mut self.0.options
928 }
929 }
930
931 #[derive(Clone, Debug)]
949 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
950
951 impl DeleteOperation {
952 pub(crate) fn new(
953 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
954 ) -> Self {
955 Self(RequestBuilder::new(stub))
956 }
957
958 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
960 mut self,
961 v: V,
962 ) -> Self {
963 self.0.request = v.into();
964 self
965 }
966
967 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
969 self.0.options = v.into();
970 self
971 }
972
973 pub async fn send(self) -> Result<()> {
975 (*self.0.stub)
976 .delete_operation(self.0.request, self.0.options)
977 .await
978 .map(gax::response::Response::into_body)
979 }
980
981 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
983 self.0.request.name = v.into();
984 self
985 }
986 }
987
988 #[doc(hidden)]
989 impl gax::options::internal::RequestBuilder for DeleteOperation {
990 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
991 &mut self.0.options
992 }
993 }
994
995 #[derive(Clone, Debug)]
1013 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1014
1015 impl CancelOperation {
1016 pub(crate) fn new(
1017 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1018 ) -> Self {
1019 Self(RequestBuilder::new(stub))
1020 }
1021
1022 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1024 mut self,
1025 v: V,
1026 ) -> Self {
1027 self.0.request = v.into();
1028 self
1029 }
1030
1031 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1033 self.0.options = v.into();
1034 self
1035 }
1036
1037 pub async fn send(self) -> Result<()> {
1039 (*self.0.stub)
1040 .cancel_operation(self.0.request, self.0.options)
1041 .await
1042 .map(gax::response::Response::into_body)
1043 }
1044
1045 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.0.request.name = v.into();
1048 self
1049 }
1050 }
1051
1052 #[doc(hidden)]
1053 impl gax::options::internal::RequestBuilder for CancelOperation {
1054 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1055 &mut self.0.options
1056 }
1057 }
1058}
1059
1060pub mod batch_controller {
1061 use crate::Result;
1062
1063 pub type ClientBuilder =
1077 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1078
1079 pub(crate) mod client {
1080 use super::super::super::client::BatchController;
1081 pub struct Factory;
1082 impl gax::client_builder::internal::ClientFactory for Factory {
1083 type Client = BatchController;
1084 type Credentials = gaxi::options::Credentials;
1085 async fn build(
1086 self,
1087 config: gaxi::options::ClientConfig,
1088 ) -> gax::client_builder::Result<Self::Client> {
1089 Self::Client::new(config).await
1090 }
1091 }
1092 }
1093
1094 #[derive(Clone, Debug)]
1096 pub(crate) struct RequestBuilder<R: std::default::Default> {
1097 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1098 request: R,
1099 options: gax::options::RequestOptions,
1100 }
1101
1102 impl<R> RequestBuilder<R>
1103 where
1104 R: std::default::Default,
1105 {
1106 pub(crate) fn new(
1107 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1108 ) -> Self {
1109 Self {
1110 stub,
1111 request: R::default(),
1112 options: gax::options::RequestOptions::default(),
1113 }
1114 }
1115 }
1116
1117 #[derive(Clone, Debug)]
1136 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1137
1138 impl CreateBatch {
1139 pub(crate) fn new(
1140 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1141 ) -> Self {
1142 Self(RequestBuilder::new(stub))
1143 }
1144
1145 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1147 self.0.request = v.into();
1148 self
1149 }
1150
1151 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1153 self.0.options = v.into();
1154 self
1155 }
1156
1157 pub async fn send(self) -> Result<longrunning::model::Operation> {
1164 (*self.0.stub)
1165 .create_batch(self.0.request, self.0.options)
1166 .await
1167 .map(gax::response::Response::into_body)
1168 }
1169
1170 pub fn poller(
1172 self,
1173 ) -> impl lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata> {
1174 type Operation =
1175 lro::internal::Operation<crate::model::Batch, crate::model::BatchOperationMetadata>;
1176 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1177 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1178
1179 let stub = self.0.stub.clone();
1180 let mut options = self.0.options.clone();
1181 options.set_retry_policy(gax::retry_policy::NeverRetry);
1182 let query = move |name| {
1183 let stub = stub.clone();
1184 let options = options.clone();
1185 async {
1186 let op = GetOperation::new(stub)
1187 .set_name(name)
1188 .with_options(options)
1189 .send()
1190 .await?;
1191 Ok(Operation::new(op))
1192 }
1193 };
1194
1195 let start = move || async {
1196 let op = self.send().await?;
1197 Ok(Operation::new(op))
1198 };
1199
1200 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1201 }
1202
1203 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1207 self.0.request.parent = v.into();
1208 self
1209 }
1210
1211 pub fn set_batch<T>(mut self, v: T) -> Self
1215 where
1216 T: std::convert::Into<crate::model::Batch>,
1217 {
1218 self.0.request.batch = std::option::Option::Some(v.into());
1219 self
1220 }
1221
1222 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1226 where
1227 T: std::convert::Into<crate::model::Batch>,
1228 {
1229 self.0.request.batch = v.map(|x| x.into());
1230 self
1231 }
1232
1233 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1235 self.0.request.batch_id = v.into();
1236 self
1237 }
1238
1239 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1241 self.0.request.request_id = v.into();
1242 self
1243 }
1244 }
1245
1246 #[doc(hidden)]
1247 impl gax::options::internal::RequestBuilder for CreateBatch {
1248 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1249 &mut self.0.options
1250 }
1251 }
1252
1253 #[derive(Clone, Debug)]
1271 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1272
1273 impl GetBatch {
1274 pub(crate) fn new(
1275 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1276 ) -> Self {
1277 Self(RequestBuilder::new(stub))
1278 }
1279
1280 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1282 self.0.request = v.into();
1283 self
1284 }
1285
1286 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1288 self.0.options = v.into();
1289 self
1290 }
1291
1292 pub async fn send(self) -> Result<crate::model::Batch> {
1294 (*self.0.stub)
1295 .get_batch(self.0.request, self.0.options)
1296 .await
1297 .map(gax::response::Response::into_body)
1298 }
1299
1300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1304 self.0.request.name = v.into();
1305 self
1306 }
1307 }
1308
1309 #[doc(hidden)]
1310 impl gax::options::internal::RequestBuilder for GetBatch {
1311 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1312 &mut self.0.options
1313 }
1314 }
1315
1316 #[derive(Clone, Debug)]
1338 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1339
1340 impl ListBatches {
1341 pub(crate) fn new(
1342 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1343 ) -> Self {
1344 Self(RequestBuilder::new(stub))
1345 }
1346
1347 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1349 self.0.request = v.into();
1350 self
1351 }
1352
1353 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1355 self.0.options = v.into();
1356 self
1357 }
1358
1359 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1361 (*self.0.stub)
1362 .list_batches(self.0.request, self.0.options)
1363 .await
1364 .map(gax::response::Response::into_body)
1365 }
1366
1367 pub fn by_page(
1369 self,
1370 ) -> impl gax::paginator::Paginator<crate::model::ListBatchesResponse, gax::error::Error>
1371 {
1372 use std::clone::Clone;
1373 let token = self.0.request.page_token.clone();
1374 let execute = move |token: String| {
1375 let mut builder = self.clone();
1376 builder.0.request = builder.0.request.set_page_token(token);
1377 builder.send()
1378 };
1379 gax::paginator::internal::new_paginator(token, execute)
1380 }
1381
1382 pub fn by_item(
1384 self,
1385 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBatchesResponse, gax::error::Error>
1386 {
1387 use gax::paginator::Paginator;
1388 self.by_page().items()
1389 }
1390
1391 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1395 self.0.request.parent = v.into();
1396 self
1397 }
1398
1399 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1401 self.0.request.page_size = v.into();
1402 self
1403 }
1404
1405 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1407 self.0.request.page_token = v.into();
1408 self
1409 }
1410
1411 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413 self.0.request.filter = v.into();
1414 self
1415 }
1416
1417 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.order_by = v.into();
1420 self
1421 }
1422 }
1423
1424 #[doc(hidden)]
1425 impl gax::options::internal::RequestBuilder for ListBatches {
1426 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1427 &mut self.0.options
1428 }
1429 }
1430
1431 #[derive(Clone, Debug)]
1449 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1450
1451 impl DeleteBatch {
1452 pub(crate) fn new(
1453 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1454 ) -> Self {
1455 Self(RequestBuilder::new(stub))
1456 }
1457
1458 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1460 self.0.request = v.into();
1461 self
1462 }
1463
1464 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1466 self.0.options = v.into();
1467 self
1468 }
1469
1470 pub async fn send(self) -> Result<()> {
1472 (*self.0.stub)
1473 .delete_batch(self.0.request, self.0.options)
1474 .await
1475 .map(gax::response::Response::into_body)
1476 }
1477
1478 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.name = v.into();
1483 self
1484 }
1485 }
1486
1487 #[doc(hidden)]
1488 impl gax::options::internal::RequestBuilder for DeleteBatch {
1489 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1490 &mut self.0.options
1491 }
1492 }
1493
1494 #[derive(Clone, Debug)]
1512 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1513
1514 impl SetIamPolicy {
1515 pub(crate) fn new(
1516 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1517 ) -> Self {
1518 Self(RequestBuilder::new(stub))
1519 }
1520
1521 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1523 self.0.request = v.into();
1524 self
1525 }
1526
1527 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1529 self.0.options = v.into();
1530 self
1531 }
1532
1533 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1535 (*self.0.stub)
1536 .set_iam_policy(self.0.request, self.0.options)
1537 .await
1538 .map(gax::response::Response::into_body)
1539 }
1540
1541 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545 self.0.request.resource = v.into();
1546 self
1547 }
1548
1549 pub fn set_policy<T>(mut self, v: T) -> Self
1553 where
1554 T: std::convert::Into<iam_v1::model::Policy>,
1555 {
1556 self.0.request.policy = std::option::Option::Some(v.into());
1557 self
1558 }
1559
1560 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1564 where
1565 T: std::convert::Into<iam_v1::model::Policy>,
1566 {
1567 self.0.request.policy = v.map(|x| x.into());
1568 self
1569 }
1570
1571 pub fn set_update_mask<T>(mut self, v: T) -> Self
1573 where
1574 T: std::convert::Into<wkt::FieldMask>,
1575 {
1576 self.0.request.update_mask = std::option::Option::Some(v.into());
1577 self
1578 }
1579
1580 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1582 where
1583 T: std::convert::Into<wkt::FieldMask>,
1584 {
1585 self.0.request.update_mask = v.map(|x| x.into());
1586 self
1587 }
1588 }
1589
1590 #[doc(hidden)]
1591 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1592 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1593 &mut self.0.options
1594 }
1595 }
1596
1597 #[derive(Clone, Debug)]
1615 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1616
1617 impl GetIamPolicy {
1618 pub(crate) fn new(
1619 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1620 ) -> Self {
1621 Self(RequestBuilder::new(stub))
1622 }
1623
1624 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1626 self.0.request = v.into();
1627 self
1628 }
1629
1630 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1632 self.0.options = v.into();
1633 self
1634 }
1635
1636 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1638 (*self.0.stub)
1639 .get_iam_policy(self.0.request, self.0.options)
1640 .await
1641 .map(gax::response::Response::into_body)
1642 }
1643
1644 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1648 self.0.request.resource = v.into();
1649 self
1650 }
1651
1652 pub fn set_options<T>(mut self, v: T) -> Self
1654 where
1655 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1656 {
1657 self.0.request.options = std::option::Option::Some(v.into());
1658 self
1659 }
1660
1661 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1663 where
1664 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1665 {
1666 self.0.request.options = v.map(|x| x.into());
1667 self
1668 }
1669 }
1670
1671 #[doc(hidden)]
1672 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1673 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1674 &mut self.0.options
1675 }
1676 }
1677
1678 #[derive(Clone, Debug)]
1696 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1697
1698 impl TestIamPermissions {
1699 pub(crate) fn new(
1700 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1701 ) -> Self {
1702 Self(RequestBuilder::new(stub))
1703 }
1704
1705 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1707 mut self,
1708 v: V,
1709 ) -> Self {
1710 self.0.request = v.into();
1711 self
1712 }
1713
1714 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1716 self.0.options = v.into();
1717 self
1718 }
1719
1720 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1722 (*self.0.stub)
1723 .test_iam_permissions(self.0.request, self.0.options)
1724 .await
1725 .map(gax::response::Response::into_body)
1726 }
1727
1728 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1732 self.0.request.resource = v.into();
1733 self
1734 }
1735
1736 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1740 where
1741 T: std::iter::IntoIterator<Item = V>,
1742 V: std::convert::Into<std::string::String>,
1743 {
1744 use std::iter::Iterator;
1745 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1746 self
1747 }
1748 }
1749
1750 #[doc(hidden)]
1751 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1752 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1753 &mut self.0.options
1754 }
1755 }
1756
1757 #[derive(Clone, Debug)]
1779 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1780
1781 impl ListOperations {
1782 pub(crate) fn new(
1783 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1784 ) -> Self {
1785 Self(RequestBuilder::new(stub))
1786 }
1787
1788 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1790 mut self,
1791 v: V,
1792 ) -> Self {
1793 self.0.request = v.into();
1794 self
1795 }
1796
1797 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1799 self.0.options = v.into();
1800 self
1801 }
1802
1803 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1805 (*self.0.stub)
1806 .list_operations(self.0.request, self.0.options)
1807 .await
1808 .map(gax::response::Response::into_body)
1809 }
1810
1811 pub fn by_page(
1813 self,
1814 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1815 {
1816 use std::clone::Clone;
1817 let token = self.0.request.page_token.clone();
1818 let execute = move |token: String| {
1819 let mut builder = self.clone();
1820 builder.0.request = builder.0.request.set_page_token(token);
1821 builder.send()
1822 };
1823 gax::paginator::internal::new_paginator(token, execute)
1824 }
1825
1826 pub fn by_item(
1828 self,
1829 ) -> impl gax::paginator::ItemPaginator<
1830 longrunning::model::ListOperationsResponse,
1831 gax::error::Error,
1832 > {
1833 use gax::paginator::Paginator;
1834 self.by_page().items()
1835 }
1836
1837 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1839 self.0.request.name = v.into();
1840 self
1841 }
1842
1843 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.0.request.filter = v.into();
1846 self
1847 }
1848
1849 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1851 self.0.request.page_size = v.into();
1852 self
1853 }
1854
1855 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1857 self.0.request.page_token = v.into();
1858 self
1859 }
1860 }
1861
1862 #[doc(hidden)]
1863 impl gax::options::internal::RequestBuilder for ListOperations {
1864 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1865 &mut self.0.options
1866 }
1867 }
1868
1869 #[derive(Clone, Debug)]
1887 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1888
1889 impl GetOperation {
1890 pub(crate) fn new(
1891 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1892 ) -> Self {
1893 Self(RequestBuilder::new(stub))
1894 }
1895
1896 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1898 mut self,
1899 v: V,
1900 ) -> Self {
1901 self.0.request = v.into();
1902 self
1903 }
1904
1905 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1907 self.0.options = v.into();
1908 self
1909 }
1910
1911 pub async fn send(self) -> Result<longrunning::model::Operation> {
1913 (*self.0.stub)
1914 .get_operation(self.0.request, self.0.options)
1915 .await
1916 .map(gax::response::Response::into_body)
1917 }
1918
1919 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1921 self.0.request.name = v.into();
1922 self
1923 }
1924 }
1925
1926 #[doc(hidden)]
1927 impl gax::options::internal::RequestBuilder for GetOperation {
1928 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1929 &mut self.0.options
1930 }
1931 }
1932
1933 #[derive(Clone, Debug)]
1951 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1952
1953 impl DeleteOperation {
1954 pub(crate) fn new(
1955 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1956 ) -> Self {
1957 Self(RequestBuilder::new(stub))
1958 }
1959
1960 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1962 mut self,
1963 v: V,
1964 ) -> Self {
1965 self.0.request = v.into();
1966 self
1967 }
1968
1969 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1971 self.0.options = v.into();
1972 self
1973 }
1974
1975 pub async fn send(self) -> Result<()> {
1977 (*self.0.stub)
1978 .delete_operation(self.0.request, self.0.options)
1979 .await
1980 .map(gax::response::Response::into_body)
1981 }
1982
1983 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1985 self.0.request.name = v.into();
1986 self
1987 }
1988 }
1989
1990 #[doc(hidden)]
1991 impl gax::options::internal::RequestBuilder for DeleteOperation {
1992 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1993 &mut self.0.options
1994 }
1995 }
1996
1997 #[derive(Clone, Debug)]
2015 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2016
2017 impl CancelOperation {
2018 pub(crate) fn new(
2019 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2020 ) -> Self {
2021 Self(RequestBuilder::new(stub))
2022 }
2023
2024 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2026 mut self,
2027 v: V,
2028 ) -> Self {
2029 self.0.request = v.into();
2030 self
2031 }
2032
2033 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2035 self.0.options = v.into();
2036 self
2037 }
2038
2039 pub async fn send(self) -> Result<()> {
2041 (*self.0.stub)
2042 .cancel_operation(self.0.request, self.0.options)
2043 .await
2044 .map(gax::response::Response::into_body)
2045 }
2046
2047 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2049 self.0.request.name = v.into();
2050 self
2051 }
2052 }
2053
2054 #[doc(hidden)]
2055 impl gax::options::internal::RequestBuilder for CancelOperation {
2056 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2057 &mut self.0.options
2058 }
2059 }
2060}
2061
2062pub mod cluster_controller {
2063 use crate::Result;
2064
2065 pub type ClientBuilder =
2079 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2080
2081 pub(crate) mod client {
2082 use super::super::super::client::ClusterController;
2083 pub struct Factory;
2084 impl gax::client_builder::internal::ClientFactory for Factory {
2085 type Client = ClusterController;
2086 type Credentials = gaxi::options::Credentials;
2087 async fn build(
2088 self,
2089 config: gaxi::options::ClientConfig,
2090 ) -> gax::client_builder::Result<Self::Client> {
2091 Self::Client::new(config).await
2092 }
2093 }
2094 }
2095
2096 #[derive(Clone, Debug)]
2098 pub(crate) struct RequestBuilder<R: std::default::Default> {
2099 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2100 request: R,
2101 options: gax::options::RequestOptions,
2102 }
2103
2104 impl<R> RequestBuilder<R>
2105 where
2106 R: std::default::Default,
2107 {
2108 pub(crate) fn new(
2109 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2110 ) -> Self {
2111 Self {
2112 stub,
2113 request: R::default(),
2114 options: gax::options::RequestOptions::default(),
2115 }
2116 }
2117 }
2118
2119 #[derive(Clone, Debug)]
2138 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2139
2140 impl CreateCluster {
2141 pub(crate) fn new(
2142 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2143 ) -> Self {
2144 Self(RequestBuilder::new(stub))
2145 }
2146
2147 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2149 self.0.request = v.into();
2150 self
2151 }
2152
2153 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2155 self.0.options = v.into();
2156 self
2157 }
2158
2159 pub async fn send(self) -> Result<longrunning::model::Operation> {
2166 (*self.0.stub)
2167 .create_cluster(self.0.request, self.0.options)
2168 .await
2169 .map(gax::response::Response::into_body)
2170 }
2171
2172 pub fn poller(
2174 self,
2175 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2176 {
2177 type Operation = lro::internal::Operation<
2178 crate::model::Cluster,
2179 crate::model::ClusterOperationMetadata,
2180 >;
2181 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2182 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2183
2184 let stub = self.0.stub.clone();
2185 let mut options = self.0.options.clone();
2186 options.set_retry_policy(gax::retry_policy::NeverRetry);
2187 let query = move |name| {
2188 let stub = stub.clone();
2189 let options = options.clone();
2190 async {
2191 let op = GetOperation::new(stub)
2192 .set_name(name)
2193 .with_options(options)
2194 .send()
2195 .await?;
2196 Ok(Operation::new(op))
2197 }
2198 };
2199
2200 let start = move || async {
2201 let op = self.send().await?;
2202 Ok(Operation::new(op))
2203 };
2204
2205 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2206 }
2207
2208 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2212 self.0.request.project_id = v.into();
2213 self
2214 }
2215
2216 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2220 self.0.request.region = v.into();
2221 self
2222 }
2223
2224 pub fn set_cluster<T>(mut self, v: T) -> Self
2228 where
2229 T: std::convert::Into<crate::model::Cluster>,
2230 {
2231 self.0.request.cluster = std::option::Option::Some(v.into());
2232 self
2233 }
2234
2235 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2239 where
2240 T: std::convert::Into<crate::model::Cluster>,
2241 {
2242 self.0.request.cluster = v.map(|x| x.into());
2243 self
2244 }
2245
2246 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2248 self.0.request.request_id = v.into();
2249 self
2250 }
2251
2252 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2254 mut self,
2255 v: T,
2256 ) -> Self {
2257 self.0.request.action_on_failed_primary_workers = v.into();
2258 self
2259 }
2260 }
2261
2262 #[doc(hidden)]
2263 impl gax::options::internal::RequestBuilder for CreateCluster {
2264 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2265 &mut self.0.options
2266 }
2267 }
2268
2269 #[derive(Clone, Debug)]
2288 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2289
2290 impl UpdateCluster {
2291 pub(crate) fn new(
2292 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2293 ) -> Self {
2294 Self(RequestBuilder::new(stub))
2295 }
2296
2297 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2299 self.0.request = v.into();
2300 self
2301 }
2302
2303 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2305 self.0.options = v.into();
2306 self
2307 }
2308
2309 pub async fn send(self) -> Result<longrunning::model::Operation> {
2316 (*self.0.stub)
2317 .update_cluster(self.0.request, self.0.options)
2318 .await
2319 .map(gax::response::Response::into_body)
2320 }
2321
2322 pub fn poller(
2324 self,
2325 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2326 {
2327 type Operation = lro::internal::Operation<
2328 crate::model::Cluster,
2329 crate::model::ClusterOperationMetadata,
2330 >;
2331 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2332 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2333
2334 let stub = self.0.stub.clone();
2335 let mut options = self.0.options.clone();
2336 options.set_retry_policy(gax::retry_policy::NeverRetry);
2337 let query = move |name| {
2338 let stub = stub.clone();
2339 let options = options.clone();
2340 async {
2341 let op = GetOperation::new(stub)
2342 .set_name(name)
2343 .with_options(options)
2344 .send()
2345 .await?;
2346 Ok(Operation::new(op))
2347 }
2348 };
2349
2350 let start = move || async {
2351 let op = self.send().await?;
2352 Ok(Operation::new(op))
2353 };
2354
2355 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2356 }
2357
2358 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2362 self.0.request.project_id = v.into();
2363 self
2364 }
2365
2366 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2370 self.0.request.region = v.into();
2371 self
2372 }
2373
2374 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2378 self.0.request.cluster_name = v.into();
2379 self
2380 }
2381
2382 pub fn set_cluster<T>(mut self, v: T) -> Self
2386 where
2387 T: std::convert::Into<crate::model::Cluster>,
2388 {
2389 self.0.request.cluster = std::option::Option::Some(v.into());
2390 self
2391 }
2392
2393 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2397 where
2398 T: std::convert::Into<crate::model::Cluster>,
2399 {
2400 self.0.request.cluster = v.map(|x| x.into());
2401 self
2402 }
2403
2404 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2406 where
2407 T: std::convert::Into<wkt::Duration>,
2408 {
2409 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2410 self
2411 }
2412
2413 pub fn set_or_clear_graceful_decommission_timeout<T>(
2415 mut self,
2416 v: std::option::Option<T>,
2417 ) -> Self
2418 where
2419 T: std::convert::Into<wkt::Duration>,
2420 {
2421 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2422 self
2423 }
2424
2425 pub fn set_update_mask<T>(mut self, v: T) -> Self
2429 where
2430 T: std::convert::Into<wkt::FieldMask>,
2431 {
2432 self.0.request.update_mask = std::option::Option::Some(v.into());
2433 self
2434 }
2435
2436 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2440 where
2441 T: std::convert::Into<wkt::FieldMask>,
2442 {
2443 self.0.request.update_mask = v.map(|x| x.into());
2444 self
2445 }
2446
2447 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2449 self.0.request.request_id = v.into();
2450 self
2451 }
2452 }
2453
2454 #[doc(hidden)]
2455 impl gax::options::internal::RequestBuilder for UpdateCluster {
2456 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2457 &mut self.0.options
2458 }
2459 }
2460
2461 #[derive(Clone, Debug)]
2480 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2481
2482 impl StopCluster {
2483 pub(crate) fn new(
2484 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2485 ) -> Self {
2486 Self(RequestBuilder::new(stub))
2487 }
2488
2489 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2491 self.0.request = v.into();
2492 self
2493 }
2494
2495 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2497 self.0.options = v.into();
2498 self
2499 }
2500
2501 pub async fn send(self) -> Result<longrunning::model::Operation> {
2508 (*self.0.stub)
2509 .stop_cluster(self.0.request, self.0.options)
2510 .await
2511 .map(gax::response::Response::into_body)
2512 }
2513
2514 pub fn poller(
2516 self,
2517 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2518 {
2519 type Operation = lro::internal::Operation<
2520 crate::model::Cluster,
2521 crate::model::ClusterOperationMetadata,
2522 >;
2523 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2524 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2525
2526 let stub = self.0.stub.clone();
2527 let mut options = self.0.options.clone();
2528 options.set_retry_policy(gax::retry_policy::NeverRetry);
2529 let query = move |name| {
2530 let stub = stub.clone();
2531 let options = options.clone();
2532 async {
2533 let op = GetOperation::new(stub)
2534 .set_name(name)
2535 .with_options(options)
2536 .send()
2537 .await?;
2538 Ok(Operation::new(op))
2539 }
2540 };
2541
2542 let start = move || async {
2543 let op = self.send().await?;
2544 Ok(Operation::new(op))
2545 };
2546
2547 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2548 }
2549
2550 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2554 self.0.request.project_id = v.into();
2555 self
2556 }
2557
2558 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2562 self.0.request.region = v.into();
2563 self
2564 }
2565
2566 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2570 self.0.request.cluster_name = v.into();
2571 self
2572 }
2573
2574 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2576 self.0.request.cluster_uuid = v.into();
2577 self
2578 }
2579
2580 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2582 self.0.request.request_id = v.into();
2583 self
2584 }
2585 }
2586
2587 #[doc(hidden)]
2588 impl gax::options::internal::RequestBuilder for StopCluster {
2589 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2590 &mut self.0.options
2591 }
2592 }
2593
2594 #[derive(Clone, Debug)]
2613 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2614
2615 impl StartCluster {
2616 pub(crate) fn new(
2617 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2618 ) -> Self {
2619 Self(RequestBuilder::new(stub))
2620 }
2621
2622 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2624 self.0.request = v.into();
2625 self
2626 }
2627
2628 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2630 self.0.options = v.into();
2631 self
2632 }
2633
2634 pub async fn send(self) -> Result<longrunning::model::Operation> {
2641 (*self.0.stub)
2642 .start_cluster(self.0.request, self.0.options)
2643 .await
2644 .map(gax::response::Response::into_body)
2645 }
2646
2647 pub fn poller(
2649 self,
2650 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2651 {
2652 type Operation = lro::internal::Operation<
2653 crate::model::Cluster,
2654 crate::model::ClusterOperationMetadata,
2655 >;
2656 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2657 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2658
2659 let stub = self.0.stub.clone();
2660 let mut options = self.0.options.clone();
2661 options.set_retry_policy(gax::retry_policy::NeverRetry);
2662 let query = move |name| {
2663 let stub = stub.clone();
2664 let options = options.clone();
2665 async {
2666 let op = GetOperation::new(stub)
2667 .set_name(name)
2668 .with_options(options)
2669 .send()
2670 .await?;
2671 Ok(Operation::new(op))
2672 }
2673 };
2674
2675 let start = move || async {
2676 let op = self.send().await?;
2677 Ok(Operation::new(op))
2678 };
2679
2680 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2681 }
2682
2683 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2687 self.0.request.project_id = v.into();
2688 self
2689 }
2690
2691 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2695 self.0.request.region = v.into();
2696 self
2697 }
2698
2699 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2703 self.0.request.cluster_name = v.into();
2704 self
2705 }
2706
2707 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2709 self.0.request.cluster_uuid = v.into();
2710 self
2711 }
2712
2713 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2715 self.0.request.request_id = v.into();
2716 self
2717 }
2718 }
2719
2720 #[doc(hidden)]
2721 impl gax::options::internal::RequestBuilder for StartCluster {
2722 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2723 &mut self.0.options
2724 }
2725 }
2726
2727 #[derive(Clone, Debug)]
2746 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2747
2748 impl DeleteCluster {
2749 pub(crate) fn new(
2750 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2751 ) -> Self {
2752 Self(RequestBuilder::new(stub))
2753 }
2754
2755 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2757 self.0.request = v.into();
2758 self
2759 }
2760
2761 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2763 self.0.options = v.into();
2764 self
2765 }
2766
2767 pub async fn send(self) -> Result<longrunning::model::Operation> {
2774 (*self.0.stub)
2775 .delete_cluster(self.0.request, self.0.options)
2776 .await
2777 .map(gax::response::Response::into_body)
2778 }
2779
2780 pub fn poller(self) -> impl lro::Poller<(), crate::model::ClusterOperationMetadata> {
2782 type Operation =
2783 lro::internal::Operation<wkt::Empty, crate::model::ClusterOperationMetadata>;
2784 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2785 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2786
2787 let stub = self.0.stub.clone();
2788 let mut options = self.0.options.clone();
2789 options.set_retry_policy(gax::retry_policy::NeverRetry);
2790 let query = move |name| {
2791 let stub = stub.clone();
2792 let options = options.clone();
2793 async {
2794 let op = GetOperation::new(stub)
2795 .set_name(name)
2796 .with_options(options)
2797 .send()
2798 .await?;
2799 Ok(Operation::new(op))
2800 }
2801 };
2802
2803 let start = move || async {
2804 let op = self.send().await?;
2805 Ok(Operation::new(op))
2806 };
2807
2808 lro::internal::new_unit_response_poller(
2809 polling_error_policy,
2810 polling_backoff_policy,
2811 start,
2812 query,
2813 )
2814 }
2815
2816 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2820 self.0.request.project_id = v.into();
2821 self
2822 }
2823
2824 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2828 self.0.request.region = v.into();
2829 self
2830 }
2831
2832 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2836 self.0.request.cluster_name = v.into();
2837 self
2838 }
2839
2840 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2842 self.0.request.cluster_uuid = v.into();
2843 self
2844 }
2845
2846 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2848 self.0.request.request_id = v.into();
2849 self
2850 }
2851 }
2852
2853 #[doc(hidden)]
2854 impl gax::options::internal::RequestBuilder for DeleteCluster {
2855 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2856 &mut self.0.options
2857 }
2858 }
2859
2860 #[derive(Clone, Debug)]
2878 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2879
2880 impl GetCluster {
2881 pub(crate) fn new(
2882 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2883 ) -> Self {
2884 Self(RequestBuilder::new(stub))
2885 }
2886
2887 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2889 self.0.request = v.into();
2890 self
2891 }
2892
2893 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2895 self.0.options = v.into();
2896 self
2897 }
2898
2899 pub async fn send(self) -> Result<crate::model::Cluster> {
2901 (*self.0.stub)
2902 .get_cluster(self.0.request, self.0.options)
2903 .await
2904 .map(gax::response::Response::into_body)
2905 }
2906
2907 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2911 self.0.request.project_id = v.into();
2912 self
2913 }
2914
2915 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2919 self.0.request.region = v.into();
2920 self
2921 }
2922
2923 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2927 self.0.request.cluster_name = v.into();
2928 self
2929 }
2930 }
2931
2932 #[doc(hidden)]
2933 impl gax::options::internal::RequestBuilder for GetCluster {
2934 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2935 &mut self.0.options
2936 }
2937 }
2938
2939 #[derive(Clone, Debug)]
2961 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
2962
2963 impl ListClusters {
2964 pub(crate) fn new(
2965 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2966 ) -> Self {
2967 Self(RequestBuilder::new(stub))
2968 }
2969
2970 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
2972 self.0.request = v.into();
2973 self
2974 }
2975
2976 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2978 self.0.options = v.into();
2979 self
2980 }
2981
2982 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
2984 (*self.0.stub)
2985 .list_clusters(self.0.request, self.0.options)
2986 .await
2987 .map(gax::response::Response::into_body)
2988 }
2989
2990 pub fn by_page(
2992 self,
2993 ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
2994 {
2995 use std::clone::Clone;
2996 let token = self.0.request.page_token.clone();
2997 let execute = move |token: String| {
2998 let mut builder = self.clone();
2999 builder.0.request = builder.0.request.set_page_token(token);
3000 builder.send()
3001 };
3002 gax::paginator::internal::new_paginator(token, execute)
3003 }
3004
3005 pub fn by_item(
3007 self,
3008 ) -> impl gax::paginator::ItemPaginator<crate::model::ListClustersResponse, gax::error::Error>
3009 {
3010 use gax::paginator::Paginator;
3011 self.by_page().items()
3012 }
3013
3014 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3018 self.0.request.project_id = v.into();
3019 self
3020 }
3021
3022 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3026 self.0.request.region = v.into();
3027 self
3028 }
3029
3030 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3032 self.0.request.filter = v.into();
3033 self
3034 }
3035
3036 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3038 self.0.request.page_size = v.into();
3039 self
3040 }
3041
3042 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3044 self.0.request.page_token = v.into();
3045 self
3046 }
3047 }
3048
3049 #[doc(hidden)]
3050 impl gax::options::internal::RequestBuilder for ListClusters {
3051 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3052 &mut self.0.options
3053 }
3054 }
3055
3056 #[derive(Clone, Debug)]
3075 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3076
3077 impl DiagnoseCluster {
3078 pub(crate) fn new(
3079 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3080 ) -> Self {
3081 Self(RequestBuilder::new(stub))
3082 }
3083
3084 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3086 self.0.request = v.into();
3087 self
3088 }
3089
3090 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3092 self.0.options = v.into();
3093 self
3094 }
3095
3096 pub async fn send(self) -> Result<longrunning::model::Operation> {
3103 (*self.0.stub)
3104 .diagnose_cluster(self.0.request, self.0.options)
3105 .await
3106 .map(gax::response::Response::into_body)
3107 }
3108
3109 pub fn poller(
3111 self,
3112 ) -> impl lro::Poller<crate::model::DiagnoseClusterResults, crate::model::ClusterOperationMetadata>
3113 {
3114 type Operation = lro::internal::Operation<
3115 crate::model::DiagnoseClusterResults,
3116 crate::model::ClusterOperationMetadata,
3117 >;
3118 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3119 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3120
3121 let stub = self.0.stub.clone();
3122 let mut options = self.0.options.clone();
3123 options.set_retry_policy(gax::retry_policy::NeverRetry);
3124 let query = move |name| {
3125 let stub = stub.clone();
3126 let options = options.clone();
3127 async {
3128 let op = GetOperation::new(stub)
3129 .set_name(name)
3130 .with_options(options)
3131 .send()
3132 .await?;
3133 Ok(Operation::new(op))
3134 }
3135 };
3136
3137 let start = move || async {
3138 let op = self.send().await?;
3139 Ok(Operation::new(op))
3140 };
3141
3142 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3143 }
3144
3145 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3149 self.0.request.project_id = v.into();
3150 self
3151 }
3152
3153 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3157 self.0.request.region = v.into();
3158 self
3159 }
3160
3161 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3165 self.0.request.cluster_name = v.into();
3166 self
3167 }
3168
3169 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3171 self.0.request.tarball_gcs_dir = v.into();
3172 self
3173 }
3174
3175 pub fn set_tarball_access<
3177 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3178 >(
3179 mut self,
3180 v: T,
3181 ) -> Self {
3182 self.0.request.tarball_access = v.into();
3183 self
3184 }
3185
3186 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3188 where
3189 T: std::convert::Into<gtype::model::Interval>,
3190 {
3191 self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3192 self
3193 }
3194
3195 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3197 where
3198 T: std::convert::Into<gtype::model::Interval>,
3199 {
3200 self.0.request.diagnosis_interval = v.map(|x| x.into());
3201 self
3202 }
3203
3204 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3206 where
3207 T: std::iter::IntoIterator<Item = V>,
3208 V: std::convert::Into<std::string::String>,
3209 {
3210 use std::iter::Iterator;
3211 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3212 self
3213 }
3214
3215 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3217 where
3218 T: std::iter::IntoIterator<Item = V>,
3219 V: std::convert::Into<std::string::String>,
3220 {
3221 use std::iter::Iterator;
3222 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3223 self
3224 }
3225 }
3226
3227 #[doc(hidden)]
3228 impl gax::options::internal::RequestBuilder for DiagnoseCluster {
3229 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3230 &mut self.0.options
3231 }
3232 }
3233
3234 #[derive(Clone, Debug)]
3252 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3253
3254 impl SetIamPolicy {
3255 pub(crate) fn new(
3256 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3257 ) -> Self {
3258 Self(RequestBuilder::new(stub))
3259 }
3260
3261 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3263 self.0.request = v.into();
3264 self
3265 }
3266
3267 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3269 self.0.options = v.into();
3270 self
3271 }
3272
3273 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3275 (*self.0.stub)
3276 .set_iam_policy(self.0.request, self.0.options)
3277 .await
3278 .map(gax::response::Response::into_body)
3279 }
3280
3281 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3285 self.0.request.resource = v.into();
3286 self
3287 }
3288
3289 pub fn set_policy<T>(mut self, v: T) -> Self
3293 where
3294 T: std::convert::Into<iam_v1::model::Policy>,
3295 {
3296 self.0.request.policy = std::option::Option::Some(v.into());
3297 self
3298 }
3299
3300 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3304 where
3305 T: std::convert::Into<iam_v1::model::Policy>,
3306 {
3307 self.0.request.policy = v.map(|x| x.into());
3308 self
3309 }
3310
3311 pub fn set_update_mask<T>(mut self, v: T) -> Self
3313 where
3314 T: std::convert::Into<wkt::FieldMask>,
3315 {
3316 self.0.request.update_mask = std::option::Option::Some(v.into());
3317 self
3318 }
3319
3320 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3322 where
3323 T: std::convert::Into<wkt::FieldMask>,
3324 {
3325 self.0.request.update_mask = v.map(|x| x.into());
3326 self
3327 }
3328 }
3329
3330 #[doc(hidden)]
3331 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3332 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3333 &mut self.0.options
3334 }
3335 }
3336
3337 #[derive(Clone, Debug)]
3355 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3356
3357 impl GetIamPolicy {
3358 pub(crate) fn new(
3359 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3360 ) -> Self {
3361 Self(RequestBuilder::new(stub))
3362 }
3363
3364 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3366 self.0.request = v.into();
3367 self
3368 }
3369
3370 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3372 self.0.options = v.into();
3373 self
3374 }
3375
3376 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3378 (*self.0.stub)
3379 .get_iam_policy(self.0.request, self.0.options)
3380 .await
3381 .map(gax::response::Response::into_body)
3382 }
3383
3384 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3388 self.0.request.resource = v.into();
3389 self
3390 }
3391
3392 pub fn set_options<T>(mut self, v: T) -> Self
3394 where
3395 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3396 {
3397 self.0.request.options = std::option::Option::Some(v.into());
3398 self
3399 }
3400
3401 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3403 where
3404 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3405 {
3406 self.0.request.options = v.map(|x| x.into());
3407 self
3408 }
3409 }
3410
3411 #[doc(hidden)]
3412 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3413 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3414 &mut self.0.options
3415 }
3416 }
3417
3418 #[derive(Clone, Debug)]
3436 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3437
3438 impl TestIamPermissions {
3439 pub(crate) fn new(
3440 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3441 ) -> Self {
3442 Self(RequestBuilder::new(stub))
3443 }
3444
3445 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3447 mut self,
3448 v: V,
3449 ) -> Self {
3450 self.0.request = v.into();
3451 self
3452 }
3453
3454 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3456 self.0.options = v.into();
3457 self
3458 }
3459
3460 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3462 (*self.0.stub)
3463 .test_iam_permissions(self.0.request, self.0.options)
3464 .await
3465 .map(gax::response::Response::into_body)
3466 }
3467
3468 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3472 self.0.request.resource = v.into();
3473 self
3474 }
3475
3476 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3480 where
3481 T: std::iter::IntoIterator<Item = V>,
3482 V: std::convert::Into<std::string::String>,
3483 {
3484 use std::iter::Iterator;
3485 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3486 self
3487 }
3488 }
3489
3490 #[doc(hidden)]
3491 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3492 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3493 &mut self.0.options
3494 }
3495 }
3496
3497 #[derive(Clone, Debug)]
3519 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3520
3521 impl ListOperations {
3522 pub(crate) fn new(
3523 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3524 ) -> Self {
3525 Self(RequestBuilder::new(stub))
3526 }
3527
3528 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3530 mut self,
3531 v: V,
3532 ) -> Self {
3533 self.0.request = v.into();
3534 self
3535 }
3536
3537 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3539 self.0.options = v.into();
3540 self
3541 }
3542
3543 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3545 (*self.0.stub)
3546 .list_operations(self.0.request, self.0.options)
3547 .await
3548 .map(gax::response::Response::into_body)
3549 }
3550
3551 pub fn by_page(
3553 self,
3554 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3555 {
3556 use std::clone::Clone;
3557 let token = self.0.request.page_token.clone();
3558 let execute = move |token: String| {
3559 let mut builder = self.clone();
3560 builder.0.request = builder.0.request.set_page_token(token);
3561 builder.send()
3562 };
3563 gax::paginator::internal::new_paginator(token, execute)
3564 }
3565
3566 pub fn by_item(
3568 self,
3569 ) -> impl gax::paginator::ItemPaginator<
3570 longrunning::model::ListOperationsResponse,
3571 gax::error::Error,
3572 > {
3573 use gax::paginator::Paginator;
3574 self.by_page().items()
3575 }
3576
3577 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579 self.0.request.name = v.into();
3580 self
3581 }
3582
3583 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3585 self.0.request.filter = v.into();
3586 self
3587 }
3588
3589 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3591 self.0.request.page_size = v.into();
3592 self
3593 }
3594
3595 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3597 self.0.request.page_token = v.into();
3598 self
3599 }
3600 }
3601
3602 #[doc(hidden)]
3603 impl gax::options::internal::RequestBuilder for ListOperations {
3604 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3605 &mut self.0.options
3606 }
3607 }
3608
3609 #[derive(Clone, Debug)]
3627 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3628
3629 impl GetOperation {
3630 pub(crate) fn new(
3631 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3632 ) -> Self {
3633 Self(RequestBuilder::new(stub))
3634 }
3635
3636 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3638 mut self,
3639 v: V,
3640 ) -> Self {
3641 self.0.request = v.into();
3642 self
3643 }
3644
3645 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3647 self.0.options = v.into();
3648 self
3649 }
3650
3651 pub async fn send(self) -> Result<longrunning::model::Operation> {
3653 (*self.0.stub)
3654 .get_operation(self.0.request, self.0.options)
3655 .await
3656 .map(gax::response::Response::into_body)
3657 }
3658
3659 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3661 self.0.request.name = v.into();
3662 self
3663 }
3664 }
3665
3666 #[doc(hidden)]
3667 impl gax::options::internal::RequestBuilder for GetOperation {
3668 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3669 &mut self.0.options
3670 }
3671 }
3672
3673 #[derive(Clone, Debug)]
3691 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3692
3693 impl DeleteOperation {
3694 pub(crate) fn new(
3695 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3696 ) -> Self {
3697 Self(RequestBuilder::new(stub))
3698 }
3699
3700 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3702 mut self,
3703 v: V,
3704 ) -> Self {
3705 self.0.request = v.into();
3706 self
3707 }
3708
3709 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3711 self.0.options = v.into();
3712 self
3713 }
3714
3715 pub async fn send(self) -> Result<()> {
3717 (*self.0.stub)
3718 .delete_operation(self.0.request, self.0.options)
3719 .await
3720 .map(gax::response::Response::into_body)
3721 }
3722
3723 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3725 self.0.request.name = v.into();
3726 self
3727 }
3728 }
3729
3730 #[doc(hidden)]
3731 impl gax::options::internal::RequestBuilder for DeleteOperation {
3732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3733 &mut self.0.options
3734 }
3735 }
3736
3737 #[derive(Clone, Debug)]
3755 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3756
3757 impl CancelOperation {
3758 pub(crate) fn new(
3759 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3760 ) -> Self {
3761 Self(RequestBuilder::new(stub))
3762 }
3763
3764 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3766 mut self,
3767 v: V,
3768 ) -> Self {
3769 self.0.request = v.into();
3770 self
3771 }
3772
3773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3775 self.0.options = v.into();
3776 self
3777 }
3778
3779 pub async fn send(self) -> Result<()> {
3781 (*self.0.stub)
3782 .cancel_operation(self.0.request, self.0.options)
3783 .await
3784 .map(gax::response::Response::into_body)
3785 }
3786
3787 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3789 self.0.request.name = v.into();
3790 self
3791 }
3792 }
3793
3794 #[doc(hidden)]
3795 impl gax::options::internal::RequestBuilder for CancelOperation {
3796 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3797 &mut self.0.options
3798 }
3799 }
3800}
3801
3802pub mod job_controller {
3803 use crate::Result;
3804
3805 pub type ClientBuilder =
3819 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3820
3821 pub(crate) mod client {
3822 use super::super::super::client::JobController;
3823 pub struct Factory;
3824 impl gax::client_builder::internal::ClientFactory for Factory {
3825 type Client = JobController;
3826 type Credentials = gaxi::options::Credentials;
3827 async fn build(
3828 self,
3829 config: gaxi::options::ClientConfig,
3830 ) -> gax::client_builder::Result<Self::Client> {
3831 Self::Client::new(config).await
3832 }
3833 }
3834 }
3835
3836 #[derive(Clone, Debug)]
3838 pub(crate) struct RequestBuilder<R: std::default::Default> {
3839 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3840 request: R,
3841 options: gax::options::RequestOptions,
3842 }
3843
3844 impl<R> RequestBuilder<R>
3845 where
3846 R: std::default::Default,
3847 {
3848 pub(crate) fn new(
3849 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3850 ) -> Self {
3851 Self {
3852 stub,
3853 request: R::default(),
3854 options: gax::options::RequestOptions::default(),
3855 }
3856 }
3857 }
3858
3859 #[derive(Clone, Debug)]
3877 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
3878
3879 impl SubmitJob {
3880 pub(crate) fn new(
3881 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3882 ) -> Self {
3883 Self(RequestBuilder::new(stub))
3884 }
3885
3886 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3888 self.0.request = v.into();
3889 self
3890 }
3891
3892 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3894 self.0.options = v.into();
3895 self
3896 }
3897
3898 pub async fn send(self) -> Result<crate::model::Job> {
3900 (*self.0.stub)
3901 .submit_job(self.0.request, self.0.options)
3902 .await
3903 .map(gax::response::Response::into_body)
3904 }
3905
3906 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3910 self.0.request.project_id = v.into();
3911 self
3912 }
3913
3914 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3918 self.0.request.region = v.into();
3919 self
3920 }
3921
3922 pub fn set_job<T>(mut self, v: T) -> Self
3926 where
3927 T: std::convert::Into<crate::model::Job>,
3928 {
3929 self.0.request.job = std::option::Option::Some(v.into());
3930 self
3931 }
3932
3933 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3937 where
3938 T: std::convert::Into<crate::model::Job>,
3939 {
3940 self.0.request.job = v.map(|x| x.into());
3941 self
3942 }
3943
3944 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3946 self.0.request.request_id = v.into();
3947 self
3948 }
3949 }
3950
3951 #[doc(hidden)]
3952 impl gax::options::internal::RequestBuilder for SubmitJob {
3953 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3954 &mut self.0.options
3955 }
3956 }
3957
3958 #[derive(Clone, Debug)]
3977 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
3978
3979 impl SubmitJobAsOperation {
3980 pub(crate) fn new(
3981 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3982 ) -> Self {
3983 Self(RequestBuilder::new(stub))
3984 }
3985
3986 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3988 self.0.request = v.into();
3989 self
3990 }
3991
3992 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3994 self.0.options = v.into();
3995 self
3996 }
3997
3998 pub async fn send(self) -> Result<longrunning::model::Operation> {
4005 (*self.0.stub)
4006 .submit_job_as_operation(self.0.request, self.0.options)
4007 .await
4008 .map(gax::response::Response::into_body)
4009 }
4010
4011 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::JobMetadata> {
4013 type Operation = lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
4014 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4015 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4016
4017 let stub = self.0.stub.clone();
4018 let mut options = self.0.options.clone();
4019 options.set_retry_policy(gax::retry_policy::NeverRetry);
4020 let query = move |name| {
4021 let stub = stub.clone();
4022 let options = options.clone();
4023 async {
4024 let op = GetOperation::new(stub)
4025 .set_name(name)
4026 .with_options(options)
4027 .send()
4028 .await?;
4029 Ok(Operation::new(op))
4030 }
4031 };
4032
4033 let start = move || async {
4034 let op = self.send().await?;
4035 Ok(Operation::new(op))
4036 };
4037
4038 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4039 }
4040
4041 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4045 self.0.request.project_id = v.into();
4046 self
4047 }
4048
4049 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4053 self.0.request.region = v.into();
4054 self
4055 }
4056
4057 pub fn set_job<T>(mut self, v: T) -> Self
4061 where
4062 T: std::convert::Into<crate::model::Job>,
4063 {
4064 self.0.request.job = std::option::Option::Some(v.into());
4065 self
4066 }
4067
4068 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4072 where
4073 T: std::convert::Into<crate::model::Job>,
4074 {
4075 self.0.request.job = v.map(|x| x.into());
4076 self
4077 }
4078
4079 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4081 self.0.request.request_id = v.into();
4082 self
4083 }
4084 }
4085
4086 #[doc(hidden)]
4087 impl gax::options::internal::RequestBuilder for SubmitJobAsOperation {
4088 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4089 &mut self.0.options
4090 }
4091 }
4092
4093 #[derive(Clone, Debug)]
4111 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4112
4113 impl GetJob {
4114 pub(crate) fn new(
4115 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4116 ) -> Self {
4117 Self(RequestBuilder::new(stub))
4118 }
4119
4120 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4122 self.0.request = v.into();
4123 self
4124 }
4125
4126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4128 self.0.options = v.into();
4129 self
4130 }
4131
4132 pub async fn send(self) -> Result<crate::model::Job> {
4134 (*self.0.stub)
4135 .get_job(self.0.request, self.0.options)
4136 .await
4137 .map(gax::response::Response::into_body)
4138 }
4139
4140 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4144 self.0.request.project_id = v.into();
4145 self
4146 }
4147
4148 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4152 self.0.request.region = v.into();
4153 self
4154 }
4155
4156 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4160 self.0.request.job_id = v.into();
4161 self
4162 }
4163 }
4164
4165 #[doc(hidden)]
4166 impl gax::options::internal::RequestBuilder for GetJob {
4167 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4168 &mut self.0.options
4169 }
4170 }
4171
4172 #[derive(Clone, Debug)]
4194 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4195
4196 impl ListJobs {
4197 pub(crate) fn new(
4198 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4199 ) -> Self {
4200 Self(RequestBuilder::new(stub))
4201 }
4202
4203 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4205 self.0.request = v.into();
4206 self
4207 }
4208
4209 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4211 self.0.options = v.into();
4212 self
4213 }
4214
4215 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4217 (*self.0.stub)
4218 .list_jobs(self.0.request, self.0.options)
4219 .await
4220 .map(gax::response::Response::into_body)
4221 }
4222
4223 pub fn by_page(
4225 self,
4226 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
4227 {
4228 use std::clone::Clone;
4229 let token = self.0.request.page_token.clone();
4230 let execute = move |token: String| {
4231 let mut builder = self.clone();
4232 builder.0.request = builder.0.request.set_page_token(token);
4233 builder.send()
4234 };
4235 gax::paginator::internal::new_paginator(token, execute)
4236 }
4237
4238 pub fn by_item(
4240 self,
4241 ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
4242 {
4243 use gax::paginator::Paginator;
4244 self.by_page().items()
4245 }
4246
4247 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4251 self.0.request.project_id = v.into();
4252 self
4253 }
4254
4255 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4259 self.0.request.region = v.into();
4260 self
4261 }
4262
4263 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4265 self.0.request.page_size = v.into();
4266 self
4267 }
4268
4269 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4271 self.0.request.page_token = v.into();
4272 self
4273 }
4274
4275 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4277 self.0.request.cluster_name = v.into();
4278 self
4279 }
4280
4281 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4283 mut self,
4284 v: T,
4285 ) -> Self {
4286 self.0.request.job_state_matcher = v.into();
4287 self
4288 }
4289
4290 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4292 self.0.request.filter = v.into();
4293 self
4294 }
4295 }
4296
4297 #[doc(hidden)]
4298 impl gax::options::internal::RequestBuilder for ListJobs {
4299 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4300 &mut self.0.options
4301 }
4302 }
4303
4304 #[derive(Clone, Debug)]
4322 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4323
4324 impl UpdateJob {
4325 pub(crate) fn new(
4326 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4327 ) -> Self {
4328 Self(RequestBuilder::new(stub))
4329 }
4330
4331 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4333 self.0.request = v.into();
4334 self
4335 }
4336
4337 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4339 self.0.options = v.into();
4340 self
4341 }
4342
4343 pub async fn send(self) -> Result<crate::model::Job> {
4345 (*self.0.stub)
4346 .update_job(self.0.request, self.0.options)
4347 .await
4348 .map(gax::response::Response::into_body)
4349 }
4350
4351 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4355 self.0.request.project_id = v.into();
4356 self
4357 }
4358
4359 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4363 self.0.request.region = v.into();
4364 self
4365 }
4366
4367 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4371 self.0.request.job_id = v.into();
4372 self
4373 }
4374
4375 pub fn set_job<T>(mut self, v: T) -> Self
4379 where
4380 T: std::convert::Into<crate::model::Job>,
4381 {
4382 self.0.request.job = std::option::Option::Some(v.into());
4383 self
4384 }
4385
4386 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4390 where
4391 T: std::convert::Into<crate::model::Job>,
4392 {
4393 self.0.request.job = v.map(|x| x.into());
4394 self
4395 }
4396
4397 pub fn set_update_mask<T>(mut self, v: T) -> Self
4401 where
4402 T: std::convert::Into<wkt::FieldMask>,
4403 {
4404 self.0.request.update_mask = std::option::Option::Some(v.into());
4405 self
4406 }
4407
4408 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4412 where
4413 T: std::convert::Into<wkt::FieldMask>,
4414 {
4415 self.0.request.update_mask = v.map(|x| x.into());
4416 self
4417 }
4418 }
4419
4420 #[doc(hidden)]
4421 impl gax::options::internal::RequestBuilder for UpdateJob {
4422 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4423 &mut self.0.options
4424 }
4425 }
4426
4427 #[derive(Clone, Debug)]
4445 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4446
4447 impl CancelJob {
4448 pub(crate) fn new(
4449 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4450 ) -> Self {
4451 Self(RequestBuilder::new(stub))
4452 }
4453
4454 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4456 self.0.request = v.into();
4457 self
4458 }
4459
4460 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4462 self.0.options = v.into();
4463 self
4464 }
4465
4466 pub async fn send(self) -> Result<crate::model::Job> {
4468 (*self.0.stub)
4469 .cancel_job(self.0.request, self.0.options)
4470 .await
4471 .map(gax::response::Response::into_body)
4472 }
4473
4474 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4478 self.0.request.project_id = v.into();
4479 self
4480 }
4481
4482 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4486 self.0.request.region = v.into();
4487 self
4488 }
4489
4490 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4494 self.0.request.job_id = v.into();
4495 self
4496 }
4497 }
4498
4499 #[doc(hidden)]
4500 impl gax::options::internal::RequestBuilder for CancelJob {
4501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4502 &mut self.0.options
4503 }
4504 }
4505
4506 #[derive(Clone, Debug)]
4524 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4525
4526 impl DeleteJob {
4527 pub(crate) fn new(
4528 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4529 ) -> Self {
4530 Self(RequestBuilder::new(stub))
4531 }
4532
4533 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4535 self.0.request = v.into();
4536 self
4537 }
4538
4539 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4541 self.0.options = v.into();
4542 self
4543 }
4544
4545 pub async fn send(self) -> Result<()> {
4547 (*self.0.stub)
4548 .delete_job(self.0.request, self.0.options)
4549 .await
4550 .map(gax::response::Response::into_body)
4551 }
4552
4553 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4557 self.0.request.project_id = v.into();
4558 self
4559 }
4560
4561 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4565 self.0.request.region = v.into();
4566 self
4567 }
4568
4569 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4573 self.0.request.job_id = v.into();
4574 self
4575 }
4576 }
4577
4578 #[doc(hidden)]
4579 impl gax::options::internal::RequestBuilder for DeleteJob {
4580 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4581 &mut self.0.options
4582 }
4583 }
4584
4585 #[derive(Clone, Debug)]
4603 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4604
4605 impl SetIamPolicy {
4606 pub(crate) fn new(
4607 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4608 ) -> Self {
4609 Self(RequestBuilder::new(stub))
4610 }
4611
4612 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4614 self.0.request = v.into();
4615 self
4616 }
4617
4618 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4620 self.0.options = v.into();
4621 self
4622 }
4623
4624 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4626 (*self.0.stub)
4627 .set_iam_policy(self.0.request, self.0.options)
4628 .await
4629 .map(gax::response::Response::into_body)
4630 }
4631
4632 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4636 self.0.request.resource = v.into();
4637 self
4638 }
4639
4640 pub fn set_policy<T>(mut self, v: T) -> Self
4644 where
4645 T: std::convert::Into<iam_v1::model::Policy>,
4646 {
4647 self.0.request.policy = std::option::Option::Some(v.into());
4648 self
4649 }
4650
4651 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4655 where
4656 T: std::convert::Into<iam_v1::model::Policy>,
4657 {
4658 self.0.request.policy = v.map(|x| x.into());
4659 self
4660 }
4661
4662 pub fn set_update_mask<T>(mut self, v: T) -> Self
4664 where
4665 T: std::convert::Into<wkt::FieldMask>,
4666 {
4667 self.0.request.update_mask = std::option::Option::Some(v.into());
4668 self
4669 }
4670
4671 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4673 where
4674 T: std::convert::Into<wkt::FieldMask>,
4675 {
4676 self.0.request.update_mask = v.map(|x| x.into());
4677 self
4678 }
4679 }
4680
4681 #[doc(hidden)]
4682 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4683 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4684 &mut self.0.options
4685 }
4686 }
4687
4688 #[derive(Clone, Debug)]
4706 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4707
4708 impl GetIamPolicy {
4709 pub(crate) fn new(
4710 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4711 ) -> Self {
4712 Self(RequestBuilder::new(stub))
4713 }
4714
4715 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4717 self.0.request = v.into();
4718 self
4719 }
4720
4721 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4723 self.0.options = v.into();
4724 self
4725 }
4726
4727 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4729 (*self.0.stub)
4730 .get_iam_policy(self.0.request, self.0.options)
4731 .await
4732 .map(gax::response::Response::into_body)
4733 }
4734
4735 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4739 self.0.request.resource = v.into();
4740 self
4741 }
4742
4743 pub fn set_options<T>(mut self, v: T) -> Self
4745 where
4746 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4747 {
4748 self.0.request.options = std::option::Option::Some(v.into());
4749 self
4750 }
4751
4752 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4754 where
4755 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4756 {
4757 self.0.request.options = v.map(|x| x.into());
4758 self
4759 }
4760 }
4761
4762 #[doc(hidden)]
4763 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4764 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4765 &mut self.0.options
4766 }
4767 }
4768
4769 #[derive(Clone, Debug)]
4787 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4788
4789 impl TestIamPermissions {
4790 pub(crate) fn new(
4791 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4792 ) -> Self {
4793 Self(RequestBuilder::new(stub))
4794 }
4795
4796 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4798 mut self,
4799 v: V,
4800 ) -> Self {
4801 self.0.request = v.into();
4802 self
4803 }
4804
4805 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4807 self.0.options = v.into();
4808 self
4809 }
4810
4811 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4813 (*self.0.stub)
4814 .test_iam_permissions(self.0.request, self.0.options)
4815 .await
4816 .map(gax::response::Response::into_body)
4817 }
4818
4819 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4823 self.0.request.resource = v.into();
4824 self
4825 }
4826
4827 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4831 where
4832 T: std::iter::IntoIterator<Item = V>,
4833 V: std::convert::Into<std::string::String>,
4834 {
4835 use std::iter::Iterator;
4836 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4837 self
4838 }
4839 }
4840
4841 #[doc(hidden)]
4842 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4843 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4844 &mut self.0.options
4845 }
4846 }
4847
4848 #[derive(Clone, Debug)]
4870 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4871
4872 impl ListOperations {
4873 pub(crate) fn new(
4874 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4875 ) -> Self {
4876 Self(RequestBuilder::new(stub))
4877 }
4878
4879 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4881 mut self,
4882 v: V,
4883 ) -> Self {
4884 self.0.request = v.into();
4885 self
4886 }
4887
4888 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4890 self.0.options = v.into();
4891 self
4892 }
4893
4894 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4896 (*self.0.stub)
4897 .list_operations(self.0.request, self.0.options)
4898 .await
4899 .map(gax::response::Response::into_body)
4900 }
4901
4902 pub fn by_page(
4904 self,
4905 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4906 {
4907 use std::clone::Clone;
4908 let token = self.0.request.page_token.clone();
4909 let execute = move |token: String| {
4910 let mut builder = self.clone();
4911 builder.0.request = builder.0.request.set_page_token(token);
4912 builder.send()
4913 };
4914 gax::paginator::internal::new_paginator(token, execute)
4915 }
4916
4917 pub fn by_item(
4919 self,
4920 ) -> impl gax::paginator::ItemPaginator<
4921 longrunning::model::ListOperationsResponse,
4922 gax::error::Error,
4923 > {
4924 use gax::paginator::Paginator;
4925 self.by_page().items()
4926 }
4927
4928 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4930 self.0.request.name = v.into();
4931 self
4932 }
4933
4934 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4936 self.0.request.filter = v.into();
4937 self
4938 }
4939
4940 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4942 self.0.request.page_size = v.into();
4943 self
4944 }
4945
4946 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4948 self.0.request.page_token = v.into();
4949 self
4950 }
4951 }
4952
4953 #[doc(hidden)]
4954 impl gax::options::internal::RequestBuilder for ListOperations {
4955 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4956 &mut self.0.options
4957 }
4958 }
4959
4960 #[derive(Clone, Debug)]
4978 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4979
4980 impl GetOperation {
4981 pub(crate) fn new(
4982 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4983 ) -> Self {
4984 Self(RequestBuilder::new(stub))
4985 }
4986
4987 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4989 mut self,
4990 v: V,
4991 ) -> Self {
4992 self.0.request = v.into();
4993 self
4994 }
4995
4996 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4998 self.0.options = v.into();
4999 self
5000 }
5001
5002 pub async fn send(self) -> Result<longrunning::model::Operation> {
5004 (*self.0.stub)
5005 .get_operation(self.0.request, self.0.options)
5006 .await
5007 .map(gax::response::Response::into_body)
5008 }
5009
5010 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5012 self.0.request.name = v.into();
5013 self
5014 }
5015 }
5016
5017 #[doc(hidden)]
5018 impl gax::options::internal::RequestBuilder for GetOperation {
5019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5020 &mut self.0.options
5021 }
5022 }
5023
5024 #[derive(Clone, Debug)]
5042 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5043
5044 impl DeleteOperation {
5045 pub(crate) fn new(
5046 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5047 ) -> Self {
5048 Self(RequestBuilder::new(stub))
5049 }
5050
5051 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5053 mut self,
5054 v: V,
5055 ) -> Self {
5056 self.0.request = v.into();
5057 self
5058 }
5059
5060 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5062 self.0.options = v.into();
5063 self
5064 }
5065
5066 pub async fn send(self) -> Result<()> {
5068 (*self.0.stub)
5069 .delete_operation(self.0.request, self.0.options)
5070 .await
5071 .map(gax::response::Response::into_body)
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
5081 #[doc(hidden)]
5082 impl gax::options::internal::RequestBuilder for DeleteOperation {
5083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5084 &mut self.0.options
5085 }
5086 }
5087
5088 #[derive(Clone, Debug)]
5106 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5107
5108 impl CancelOperation {
5109 pub(crate) fn new(
5110 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5111 ) -> Self {
5112 Self(RequestBuilder::new(stub))
5113 }
5114
5115 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5117 mut self,
5118 v: V,
5119 ) -> Self {
5120 self.0.request = v.into();
5121 self
5122 }
5123
5124 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5126 self.0.options = v.into();
5127 self
5128 }
5129
5130 pub async fn send(self) -> Result<()> {
5132 (*self.0.stub)
5133 .cancel_operation(self.0.request, self.0.options)
5134 .await
5135 .map(gax::response::Response::into_body)
5136 }
5137
5138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5140 self.0.request.name = v.into();
5141 self
5142 }
5143 }
5144
5145 #[doc(hidden)]
5146 impl gax::options::internal::RequestBuilder for CancelOperation {
5147 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5148 &mut self.0.options
5149 }
5150 }
5151}
5152
5153pub mod node_group_controller {
5154 use crate::Result;
5155
5156 pub type ClientBuilder =
5170 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5171
5172 pub(crate) mod client {
5173 use super::super::super::client::NodeGroupController;
5174 pub struct Factory;
5175 impl gax::client_builder::internal::ClientFactory for Factory {
5176 type Client = NodeGroupController;
5177 type Credentials = gaxi::options::Credentials;
5178 async fn build(
5179 self,
5180 config: gaxi::options::ClientConfig,
5181 ) -> gax::client_builder::Result<Self::Client> {
5182 Self::Client::new(config).await
5183 }
5184 }
5185 }
5186
5187 #[derive(Clone, Debug)]
5189 pub(crate) struct RequestBuilder<R: std::default::Default> {
5190 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5191 request: R,
5192 options: gax::options::RequestOptions,
5193 }
5194
5195 impl<R> RequestBuilder<R>
5196 where
5197 R: std::default::Default,
5198 {
5199 pub(crate) fn new(
5200 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5201 ) -> Self {
5202 Self {
5203 stub,
5204 request: R::default(),
5205 options: gax::options::RequestOptions::default(),
5206 }
5207 }
5208 }
5209
5210 #[derive(Clone, Debug)]
5229 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5230
5231 impl CreateNodeGroup {
5232 pub(crate) fn new(
5233 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5234 ) -> Self {
5235 Self(RequestBuilder::new(stub))
5236 }
5237
5238 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5240 self.0.request = v.into();
5241 self
5242 }
5243
5244 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5246 self.0.options = v.into();
5247 self
5248 }
5249
5250 pub async fn send(self) -> Result<longrunning::model::Operation> {
5257 (*self.0.stub)
5258 .create_node_group(self.0.request, self.0.options)
5259 .await
5260 .map(gax::response::Response::into_body)
5261 }
5262
5263 pub fn poller(
5265 self,
5266 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5267 {
5268 type Operation = lro::internal::Operation<
5269 crate::model::NodeGroup,
5270 crate::model::NodeGroupOperationMetadata,
5271 >;
5272 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5273 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5274
5275 let stub = self.0.stub.clone();
5276 let mut options = self.0.options.clone();
5277 options.set_retry_policy(gax::retry_policy::NeverRetry);
5278 let query = move |name| {
5279 let stub = stub.clone();
5280 let options = options.clone();
5281 async {
5282 let op = GetOperation::new(stub)
5283 .set_name(name)
5284 .with_options(options)
5285 .send()
5286 .await?;
5287 Ok(Operation::new(op))
5288 }
5289 };
5290
5291 let start = move || async {
5292 let op = self.send().await?;
5293 Ok(Operation::new(op))
5294 };
5295
5296 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5297 }
5298
5299 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5303 self.0.request.parent = v.into();
5304 self
5305 }
5306
5307 pub fn set_node_group<T>(mut self, v: T) -> Self
5311 where
5312 T: std::convert::Into<crate::model::NodeGroup>,
5313 {
5314 self.0.request.node_group = std::option::Option::Some(v.into());
5315 self
5316 }
5317
5318 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5322 where
5323 T: std::convert::Into<crate::model::NodeGroup>,
5324 {
5325 self.0.request.node_group = v.map(|x| x.into());
5326 self
5327 }
5328
5329 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5331 self.0.request.node_group_id = v.into();
5332 self
5333 }
5334
5335 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5337 self.0.request.request_id = v.into();
5338 self
5339 }
5340 }
5341
5342 #[doc(hidden)]
5343 impl gax::options::internal::RequestBuilder for CreateNodeGroup {
5344 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5345 &mut self.0.options
5346 }
5347 }
5348
5349 #[derive(Clone, Debug)]
5368 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5369
5370 impl ResizeNodeGroup {
5371 pub(crate) fn new(
5372 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5373 ) -> Self {
5374 Self(RequestBuilder::new(stub))
5375 }
5376
5377 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5379 self.0.request = v.into();
5380 self
5381 }
5382
5383 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5385 self.0.options = v.into();
5386 self
5387 }
5388
5389 pub async fn send(self) -> Result<longrunning::model::Operation> {
5396 (*self.0.stub)
5397 .resize_node_group(self.0.request, self.0.options)
5398 .await
5399 .map(gax::response::Response::into_body)
5400 }
5401
5402 pub fn poller(
5404 self,
5405 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5406 {
5407 type Operation = lro::internal::Operation<
5408 crate::model::NodeGroup,
5409 crate::model::NodeGroupOperationMetadata,
5410 >;
5411 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5412 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5413
5414 let stub = self.0.stub.clone();
5415 let mut options = self.0.options.clone();
5416 options.set_retry_policy(gax::retry_policy::NeverRetry);
5417 let query = move |name| {
5418 let stub = stub.clone();
5419 let options = options.clone();
5420 async {
5421 let op = GetOperation::new(stub)
5422 .set_name(name)
5423 .with_options(options)
5424 .send()
5425 .await?;
5426 Ok(Operation::new(op))
5427 }
5428 };
5429
5430 let start = move || async {
5431 let op = self.send().await?;
5432 Ok(Operation::new(op))
5433 };
5434
5435 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5436 }
5437
5438 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5442 self.0.request.name = v.into();
5443 self
5444 }
5445
5446 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5450 self.0.request.size = v.into();
5451 self
5452 }
5453
5454 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5456 self.0.request.request_id = v.into();
5457 self
5458 }
5459
5460 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5462 where
5463 T: std::convert::Into<wkt::Duration>,
5464 {
5465 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5466 self
5467 }
5468
5469 pub fn set_or_clear_graceful_decommission_timeout<T>(
5471 mut self,
5472 v: std::option::Option<T>,
5473 ) -> Self
5474 where
5475 T: std::convert::Into<wkt::Duration>,
5476 {
5477 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5478 self
5479 }
5480 }
5481
5482 #[doc(hidden)]
5483 impl gax::options::internal::RequestBuilder for ResizeNodeGroup {
5484 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5485 &mut self.0.options
5486 }
5487 }
5488
5489 #[derive(Clone, Debug)]
5507 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5508
5509 impl GetNodeGroup {
5510 pub(crate) fn new(
5511 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5512 ) -> Self {
5513 Self(RequestBuilder::new(stub))
5514 }
5515
5516 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5518 self.0.request = v.into();
5519 self
5520 }
5521
5522 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5524 self.0.options = v.into();
5525 self
5526 }
5527
5528 pub async fn send(self) -> Result<crate::model::NodeGroup> {
5530 (*self.0.stub)
5531 .get_node_group(self.0.request, self.0.options)
5532 .await
5533 .map(gax::response::Response::into_body)
5534 }
5535
5536 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5540 self.0.request.name = v.into();
5541 self
5542 }
5543 }
5544
5545 #[doc(hidden)]
5546 impl gax::options::internal::RequestBuilder for GetNodeGroup {
5547 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5548 &mut self.0.options
5549 }
5550 }
5551
5552 #[derive(Clone, Debug)]
5570 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5571
5572 impl SetIamPolicy {
5573 pub(crate) fn new(
5574 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5575 ) -> Self {
5576 Self(RequestBuilder::new(stub))
5577 }
5578
5579 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5581 self.0.request = v.into();
5582 self
5583 }
5584
5585 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5587 self.0.options = v.into();
5588 self
5589 }
5590
5591 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5593 (*self.0.stub)
5594 .set_iam_policy(self.0.request, self.0.options)
5595 .await
5596 .map(gax::response::Response::into_body)
5597 }
5598
5599 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5603 self.0.request.resource = v.into();
5604 self
5605 }
5606
5607 pub fn set_policy<T>(mut self, v: T) -> Self
5611 where
5612 T: std::convert::Into<iam_v1::model::Policy>,
5613 {
5614 self.0.request.policy = std::option::Option::Some(v.into());
5615 self
5616 }
5617
5618 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5622 where
5623 T: std::convert::Into<iam_v1::model::Policy>,
5624 {
5625 self.0.request.policy = v.map(|x| x.into());
5626 self
5627 }
5628
5629 pub fn set_update_mask<T>(mut self, v: T) -> Self
5631 where
5632 T: std::convert::Into<wkt::FieldMask>,
5633 {
5634 self.0.request.update_mask = std::option::Option::Some(v.into());
5635 self
5636 }
5637
5638 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5640 where
5641 T: std::convert::Into<wkt::FieldMask>,
5642 {
5643 self.0.request.update_mask = v.map(|x| x.into());
5644 self
5645 }
5646 }
5647
5648 #[doc(hidden)]
5649 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5651 &mut self.0.options
5652 }
5653 }
5654
5655 #[derive(Clone, Debug)]
5673 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5674
5675 impl GetIamPolicy {
5676 pub(crate) fn new(
5677 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5678 ) -> Self {
5679 Self(RequestBuilder::new(stub))
5680 }
5681
5682 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5684 self.0.request = v.into();
5685 self
5686 }
5687
5688 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5690 self.0.options = v.into();
5691 self
5692 }
5693
5694 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5696 (*self.0.stub)
5697 .get_iam_policy(self.0.request, self.0.options)
5698 .await
5699 .map(gax::response::Response::into_body)
5700 }
5701
5702 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5706 self.0.request.resource = v.into();
5707 self
5708 }
5709
5710 pub fn set_options<T>(mut self, v: T) -> Self
5712 where
5713 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5714 {
5715 self.0.request.options = std::option::Option::Some(v.into());
5716 self
5717 }
5718
5719 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5721 where
5722 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5723 {
5724 self.0.request.options = v.map(|x| x.into());
5725 self
5726 }
5727 }
5728
5729 #[doc(hidden)]
5730 impl gax::options::internal::RequestBuilder for GetIamPolicy {
5731 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5732 &mut self.0.options
5733 }
5734 }
5735
5736 #[derive(Clone, Debug)]
5754 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5755
5756 impl TestIamPermissions {
5757 pub(crate) fn new(
5758 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5759 ) -> Self {
5760 Self(RequestBuilder::new(stub))
5761 }
5762
5763 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5765 mut self,
5766 v: V,
5767 ) -> Self {
5768 self.0.request = v.into();
5769 self
5770 }
5771
5772 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5774 self.0.options = v.into();
5775 self
5776 }
5777
5778 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5780 (*self.0.stub)
5781 .test_iam_permissions(self.0.request, self.0.options)
5782 .await
5783 .map(gax::response::Response::into_body)
5784 }
5785
5786 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5790 self.0.request.resource = v.into();
5791 self
5792 }
5793
5794 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5798 where
5799 T: std::iter::IntoIterator<Item = V>,
5800 V: std::convert::Into<std::string::String>,
5801 {
5802 use std::iter::Iterator;
5803 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5804 self
5805 }
5806 }
5807
5808 #[doc(hidden)]
5809 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5810 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5811 &mut self.0.options
5812 }
5813 }
5814
5815 #[derive(Clone, Debug)]
5837 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5838
5839 impl ListOperations {
5840 pub(crate) fn new(
5841 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5842 ) -> Self {
5843 Self(RequestBuilder::new(stub))
5844 }
5845
5846 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5848 mut self,
5849 v: V,
5850 ) -> Self {
5851 self.0.request = v.into();
5852 self
5853 }
5854
5855 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5857 self.0.options = v.into();
5858 self
5859 }
5860
5861 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5863 (*self.0.stub)
5864 .list_operations(self.0.request, self.0.options)
5865 .await
5866 .map(gax::response::Response::into_body)
5867 }
5868
5869 pub fn by_page(
5871 self,
5872 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5873 {
5874 use std::clone::Clone;
5875 let token = self.0.request.page_token.clone();
5876 let execute = move |token: String| {
5877 let mut builder = self.clone();
5878 builder.0.request = builder.0.request.set_page_token(token);
5879 builder.send()
5880 };
5881 gax::paginator::internal::new_paginator(token, execute)
5882 }
5883
5884 pub fn by_item(
5886 self,
5887 ) -> impl gax::paginator::ItemPaginator<
5888 longrunning::model::ListOperationsResponse,
5889 gax::error::Error,
5890 > {
5891 use gax::paginator::Paginator;
5892 self.by_page().items()
5893 }
5894
5895 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5897 self.0.request.name = v.into();
5898 self
5899 }
5900
5901 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5903 self.0.request.filter = v.into();
5904 self
5905 }
5906
5907 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5909 self.0.request.page_size = v.into();
5910 self
5911 }
5912
5913 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5915 self.0.request.page_token = v.into();
5916 self
5917 }
5918 }
5919
5920 #[doc(hidden)]
5921 impl gax::options::internal::RequestBuilder for ListOperations {
5922 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5923 &mut self.0.options
5924 }
5925 }
5926
5927 #[derive(Clone, Debug)]
5945 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5946
5947 impl GetOperation {
5948 pub(crate) fn new(
5949 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5950 ) -> Self {
5951 Self(RequestBuilder::new(stub))
5952 }
5953
5954 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5956 mut self,
5957 v: V,
5958 ) -> Self {
5959 self.0.request = v.into();
5960 self
5961 }
5962
5963 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5965 self.0.options = v.into();
5966 self
5967 }
5968
5969 pub async fn send(self) -> Result<longrunning::model::Operation> {
5971 (*self.0.stub)
5972 .get_operation(self.0.request, self.0.options)
5973 .await
5974 .map(gax::response::Response::into_body)
5975 }
5976
5977 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5979 self.0.request.name = v.into();
5980 self
5981 }
5982 }
5983
5984 #[doc(hidden)]
5985 impl gax::options::internal::RequestBuilder for GetOperation {
5986 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5987 &mut self.0.options
5988 }
5989 }
5990
5991 #[derive(Clone, Debug)]
6009 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6010
6011 impl DeleteOperation {
6012 pub(crate) fn new(
6013 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6014 ) -> Self {
6015 Self(RequestBuilder::new(stub))
6016 }
6017
6018 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6020 mut self,
6021 v: V,
6022 ) -> Self {
6023 self.0.request = v.into();
6024 self
6025 }
6026
6027 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6029 self.0.options = v.into();
6030 self
6031 }
6032
6033 pub async fn send(self) -> Result<()> {
6035 (*self.0.stub)
6036 .delete_operation(self.0.request, self.0.options)
6037 .await
6038 .map(gax::response::Response::into_body)
6039 }
6040
6041 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6043 self.0.request.name = v.into();
6044 self
6045 }
6046 }
6047
6048 #[doc(hidden)]
6049 impl gax::options::internal::RequestBuilder for DeleteOperation {
6050 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6051 &mut self.0.options
6052 }
6053 }
6054
6055 #[derive(Clone, Debug)]
6073 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6074
6075 impl CancelOperation {
6076 pub(crate) fn new(
6077 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6078 ) -> Self {
6079 Self(RequestBuilder::new(stub))
6080 }
6081
6082 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6084 mut self,
6085 v: V,
6086 ) -> Self {
6087 self.0.request = v.into();
6088 self
6089 }
6090
6091 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6093 self.0.options = v.into();
6094 self
6095 }
6096
6097 pub async fn send(self) -> Result<()> {
6099 (*self.0.stub)
6100 .cancel_operation(self.0.request, self.0.options)
6101 .await
6102 .map(gax::response::Response::into_body)
6103 }
6104
6105 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6107 self.0.request.name = v.into();
6108 self
6109 }
6110 }
6111
6112 #[doc(hidden)]
6113 impl gax::options::internal::RequestBuilder for CancelOperation {
6114 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6115 &mut self.0.options
6116 }
6117 }
6118}
6119
6120pub mod session_template_controller {
6121 use crate::Result;
6122
6123 pub type ClientBuilder =
6137 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6138
6139 pub(crate) mod client {
6140 use super::super::super::client::SessionTemplateController;
6141 pub struct Factory;
6142 impl gax::client_builder::internal::ClientFactory for Factory {
6143 type Client = SessionTemplateController;
6144 type Credentials = gaxi::options::Credentials;
6145 async fn build(
6146 self,
6147 config: gaxi::options::ClientConfig,
6148 ) -> gax::client_builder::Result<Self::Client> {
6149 Self::Client::new(config).await
6150 }
6151 }
6152 }
6153
6154 #[derive(Clone, Debug)]
6156 pub(crate) struct RequestBuilder<R: std::default::Default> {
6157 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6158 request: R,
6159 options: gax::options::RequestOptions,
6160 }
6161
6162 impl<R> RequestBuilder<R>
6163 where
6164 R: std::default::Default,
6165 {
6166 pub(crate) fn new(
6167 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6168 ) -> Self {
6169 Self {
6170 stub,
6171 request: R::default(),
6172 options: gax::options::RequestOptions::default(),
6173 }
6174 }
6175 }
6176
6177 #[derive(Clone, Debug)]
6195 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6196
6197 impl CreateSessionTemplate {
6198 pub(crate) fn new(
6199 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6200 ) -> Self {
6201 Self(RequestBuilder::new(stub))
6202 }
6203
6204 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6206 mut self,
6207 v: V,
6208 ) -> Self {
6209 self.0.request = v.into();
6210 self
6211 }
6212
6213 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6215 self.0.options = v.into();
6216 self
6217 }
6218
6219 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6221 (*self.0.stub)
6222 .create_session_template(self.0.request, self.0.options)
6223 .await
6224 .map(gax::response::Response::into_body)
6225 }
6226
6227 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6231 self.0.request.parent = v.into();
6232 self
6233 }
6234
6235 pub fn set_session_template<T>(mut self, v: T) -> Self
6239 where
6240 T: std::convert::Into<crate::model::SessionTemplate>,
6241 {
6242 self.0.request.session_template = std::option::Option::Some(v.into());
6243 self
6244 }
6245
6246 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6250 where
6251 T: std::convert::Into<crate::model::SessionTemplate>,
6252 {
6253 self.0.request.session_template = v.map(|x| x.into());
6254 self
6255 }
6256 }
6257
6258 #[doc(hidden)]
6259 impl gax::options::internal::RequestBuilder for CreateSessionTemplate {
6260 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6261 &mut self.0.options
6262 }
6263 }
6264
6265 #[derive(Clone, Debug)]
6283 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6284
6285 impl UpdateSessionTemplate {
6286 pub(crate) fn new(
6287 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6288 ) -> Self {
6289 Self(RequestBuilder::new(stub))
6290 }
6291
6292 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6294 mut self,
6295 v: V,
6296 ) -> Self {
6297 self.0.request = v.into();
6298 self
6299 }
6300
6301 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6303 self.0.options = v.into();
6304 self
6305 }
6306
6307 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6309 (*self.0.stub)
6310 .update_session_template(self.0.request, self.0.options)
6311 .await
6312 .map(gax::response::Response::into_body)
6313 }
6314
6315 pub fn set_session_template<T>(mut self, v: T) -> Self
6319 where
6320 T: std::convert::Into<crate::model::SessionTemplate>,
6321 {
6322 self.0.request.session_template = std::option::Option::Some(v.into());
6323 self
6324 }
6325
6326 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6330 where
6331 T: std::convert::Into<crate::model::SessionTemplate>,
6332 {
6333 self.0.request.session_template = v.map(|x| x.into());
6334 self
6335 }
6336 }
6337
6338 #[doc(hidden)]
6339 impl gax::options::internal::RequestBuilder for UpdateSessionTemplate {
6340 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6341 &mut self.0.options
6342 }
6343 }
6344
6345 #[derive(Clone, Debug)]
6363 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6364
6365 impl GetSessionTemplate {
6366 pub(crate) fn new(
6367 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6368 ) -> Self {
6369 Self(RequestBuilder::new(stub))
6370 }
6371
6372 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6374 mut self,
6375 v: V,
6376 ) -> Self {
6377 self.0.request = v.into();
6378 self
6379 }
6380
6381 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6383 self.0.options = v.into();
6384 self
6385 }
6386
6387 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6389 (*self.0.stub)
6390 .get_session_template(self.0.request, self.0.options)
6391 .await
6392 .map(gax::response::Response::into_body)
6393 }
6394
6395 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6399 self.0.request.name = v.into();
6400 self
6401 }
6402 }
6403
6404 #[doc(hidden)]
6405 impl gax::options::internal::RequestBuilder for GetSessionTemplate {
6406 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6407 &mut self.0.options
6408 }
6409 }
6410
6411 #[derive(Clone, Debug)]
6433 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6434
6435 impl ListSessionTemplates {
6436 pub(crate) fn new(
6437 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6438 ) -> Self {
6439 Self(RequestBuilder::new(stub))
6440 }
6441
6442 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6444 mut self,
6445 v: V,
6446 ) -> Self {
6447 self.0.request = v.into();
6448 self
6449 }
6450
6451 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6453 self.0.options = v.into();
6454 self
6455 }
6456
6457 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6459 (*self.0.stub)
6460 .list_session_templates(self.0.request, self.0.options)
6461 .await
6462 .map(gax::response::Response::into_body)
6463 }
6464
6465 pub fn by_page(
6467 self,
6468 ) -> impl gax::paginator::Paginator<crate::model::ListSessionTemplatesResponse, gax::error::Error>
6469 {
6470 use std::clone::Clone;
6471 let token = self.0.request.page_token.clone();
6472 let execute = move |token: String| {
6473 let mut builder = self.clone();
6474 builder.0.request = builder.0.request.set_page_token(token);
6475 builder.send()
6476 };
6477 gax::paginator::internal::new_paginator(token, execute)
6478 }
6479
6480 pub fn by_item(
6482 self,
6483 ) -> impl gax::paginator::ItemPaginator<
6484 crate::model::ListSessionTemplatesResponse,
6485 gax::error::Error,
6486 > {
6487 use gax::paginator::Paginator;
6488 self.by_page().items()
6489 }
6490
6491 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6495 self.0.request.parent = v.into();
6496 self
6497 }
6498
6499 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6501 self.0.request.page_size = v.into();
6502 self
6503 }
6504
6505 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6507 self.0.request.page_token = v.into();
6508 self
6509 }
6510
6511 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6513 self.0.request.filter = v.into();
6514 self
6515 }
6516 }
6517
6518 #[doc(hidden)]
6519 impl gax::options::internal::RequestBuilder for ListSessionTemplates {
6520 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6521 &mut self.0.options
6522 }
6523 }
6524
6525 #[derive(Clone, Debug)]
6543 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6544
6545 impl DeleteSessionTemplate {
6546 pub(crate) fn new(
6547 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6548 ) -> Self {
6549 Self(RequestBuilder::new(stub))
6550 }
6551
6552 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6554 mut self,
6555 v: V,
6556 ) -> Self {
6557 self.0.request = v.into();
6558 self
6559 }
6560
6561 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6563 self.0.options = v.into();
6564 self
6565 }
6566
6567 pub async fn send(self) -> Result<()> {
6569 (*self.0.stub)
6570 .delete_session_template(self.0.request, self.0.options)
6571 .await
6572 .map(gax::response::Response::into_body)
6573 }
6574
6575 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6579 self.0.request.name = v.into();
6580 self
6581 }
6582 }
6583
6584 #[doc(hidden)]
6585 impl gax::options::internal::RequestBuilder for DeleteSessionTemplate {
6586 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6587 &mut self.0.options
6588 }
6589 }
6590
6591 #[derive(Clone, Debug)]
6609 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6610
6611 impl SetIamPolicy {
6612 pub(crate) fn new(
6613 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6614 ) -> Self {
6615 Self(RequestBuilder::new(stub))
6616 }
6617
6618 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6620 self.0.request = v.into();
6621 self
6622 }
6623
6624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6626 self.0.options = v.into();
6627 self
6628 }
6629
6630 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6632 (*self.0.stub)
6633 .set_iam_policy(self.0.request, self.0.options)
6634 .await
6635 .map(gax::response::Response::into_body)
6636 }
6637
6638 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6642 self.0.request.resource = v.into();
6643 self
6644 }
6645
6646 pub fn set_policy<T>(mut self, v: T) -> Self
6650 where
6651 T: std::convert::Into<iam_v1::model::Policy>,
6652 {
6653 self.0.request.policy = std::option::Option::Some(v.into());
6654 self
6655 }
6656
6657 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6661 where
6662 T: std::convert::Into<iam_v1::model::Policy>,
6663 {
6664 self.0.request.policy = v.map(|x| x.into());
6665 self
6666 }
6667
6668 pub fn set_update_mask<T>(mut self, v: T) -> Self
6670 where
6671 T: std::convert::Into<wkt::FieldMask>,
6672 {
6673 self.0.request.update_mask = std::option::Option::Some(v.into());
6674 self
6675 }
6676
6677 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6679 where
6680 T: std::convert::Into<wkt::FieldMask>,
6681 {
6682 self.0.request.update_mask = v.map(|x| x.into());
6683 self
6684 }
6685 }
6686
6687 #[doc(hidden)]
6688 impl gax::options::internal::RequestBuilder for SetIamPolicy {
6689 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6690 &mut self.0.options
6691 }
6692 }
6693
6694 #[derive(Clone, Debug)]
6712 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6713
6714 impl GetIamPolicy {
6715 pub(crate) fn new(
6716 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6717 ) -> Self {
6718 Self(RequestBuilder::new(stub))
6719 }
6720
6721 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6723 self.0.request = v.into();
6724 self
6725 }
6726
6727 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6729 self.0.options = v.into();
6730 self
6731 }
6732
6733 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6735 (*self.0.stub)
6736 .get_iam_policy(self.0.request, self.0.options)
6737 .await
6738 .map(gax::response::Response::into_body)
6739 }
6740
6741 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6745 self.0.request.resource = v.into();
6746 self
6747 }
6748
6749 pub fn set_options<T>(mut self, v: T) -> Self
6751 where
6752 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6753 {
6754 self.0.request.options = std::option::Option::Some(v.into());
6755 self
6756 }
6757
6758 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6760 where
6761 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6762 {
6763 self.0.request.options = v.map(|x| x.into());
6764 self
6765 }
6766 }
6767
6768 #[doc(hidden)]
6769 impl gax::options::internal::RequestBuilder for GetIamPolicy {
6770 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6771 &mut self.0.options
6772 }
6773 }
6774
6775 #[derive(Clone, Debug)]
6793 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6794
6795 impl TestIamPermissions {
6796 pub(crate) fn new(
6797 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6798 ) -> Self {
6799 Self(RequestBuilder::new(stub))
6800 }
6801
6802 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6804 mut self,
6805 v: V,
6806 ) -> Self {
6807 self.0.request = v.into();
6808 self
6809 }
6810
6811 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6813 self.0.options = v.into();
6814 self
6815 }
6816
6817 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6819 (*self.0.stub)
6820 .test_iam_permissions(self.0.request, self.0.options)
6821 .await
6822 .map(gax::response::Response::into_body)
6823 }
6824
6825 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6829 self.0.request.resource = v.into();
6830 self
6831 }
6832
6833 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6837 where
6838 T: std::iter::IntoIterator<Item = V>,
6839 V: std::convert::Into<std::string::String>,
6840 {
6841 use std::iter::Iterator;
6842 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6843 self
6844 }
6845 }
6846
6847 #[doc(hidden)]
6848 impl gax::options::internal::RequestBuilder for TestIamPermissions {
6849 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6850 &mut self.0.options
6851 }
6852 }
6853
6854 #[derive(Clone, Debug)]
6876 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6877
6878 impl ListOperations {
6879 pub(crate) fn new(
6880 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6881 ) -> Self {
6882 Self(RequestBuilder::new(stub))
6883 }
6884
6885 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6887 mut self,
6888 v: V,
6889 ) -> Self {
6890 self.0.request = v.into();
6891 self
6892 }
6893
6894 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6896 self.0.options = v.into();
6897 self
6898 }
6899
6900 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6902 (*self.0.stub)
6903 .list_operations(self.0.request, self.0.options)
6904 .await
6905 .map(gax::response::Response::into_body)
6906 }
6907
6908 pub fn by_page(
6910 self,
6911 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6912 {
6913 use std::clone::Clone;
6914 let token = self.0.request.page_token.clone();
6915 let execute = move |token: String| {
6916 let mut builder = self.clone();
6917 builder.0.request = builder.0.request.set_page_token(token);
6918 builder.send()
6919 };
6920 gax::paginator::internal::new_paginator(token, execute)
6921 }
6922
6923 pub fn by_item(
6925 self,
6926 ) -> impl gax::paginator::ItemPaginator<
6927 longrunning::model::ListOperationsResponse,
6928 gax::error::Error,
6929 > {
6930 use gax::paginator::Paginator;
6931 self.by_page().items()
6932 }
6933
6934 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6936 self.0.request.name = v.into();
6937 self
6938 }
6939
6940 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6942 self.0.request.filter = v.into();
6943 self
6944 }
6945
6946 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6948 self.0.request.page_size = v.into();
6949 self
6950 }
6951
6952 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6954 self.0.request.page_token = v.into();
6955 self
6956 }
6957 }
6958
6959 #[doc(hidden)]
6960 impl gax::options::internal::RequestBuilder for ListOperations {
6961 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6962 &mut self.0.options
6963 }
6964 }
6965
6966 #[derive(Clone, Debug)]
6984 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6985
6986 impl GetOperation {
6987 pub(crate) fn new(
6988 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6989 ) -> Self {
6990 Self(RequestBuilder::new(stub))
6991 }
6992
6993 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6995 mut self,
6996 v: V,
6997 ) -> Self {
6998 self.0.request = v.into();
6999 self
7000 }
7001
7002 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7004 self.0.options = v.into();
7005 self
7006 }
7007
7008 pub async fn send(self) -> Result<longrunning::model::Operation> {
7010 (*self.0.stub)
7011 .get_operation(self.0.request, self.0.options)
7012 .await
7013 .map(gax::response::Response::into_body)
7014 }
7015
7016 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7018 self.0.request.name = v.into();
7019 self
7020 }
7021 }
7022
7023 #[doc(hidden)]
7024 impl gax::options::internal::RequestBuilder for GetOperation {
7025 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7026 &mut self.0.options
7027 }
7028 }
7029
7030 #[derive(Clone, Debug)]
7048 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7049
7050 impl DeleteOperation {
7051 pub(crate) fn new(
7052 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7053 ) -> Self {
7054 Self(RequestBuilder::new(stub))
7055 }
7056
7057 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7059 mut self,
7060 v: V,
7061 ) -> Self {
7062 self.0.request = v.into();
7063 self
7064 }
7065
7066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7068 self.0.options = v.into();
7069 self
7070 }
7071
7072 pub async fn send(self) -> Result<()> {
7074 (*self.0.stub)
7075 .delete_operation(self.0.request, self.0.options)
7076 .await
7077 .map(gax::response::Response::into_body)
7078 }
7079
7080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7082 self.0.request.name = v.into();
7083 self
7084 }
7085 }
7086
7087 #[doc(hidden)]
7088 impl gax::options::internal::RequestBuilder for DeleteOperation {
7089 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7090 &mut self.0.options
7091 }
7092 }
7093
7094 #[derive(Clone, Debug)]
7112 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7113
7114 impl CancelOperation {
7115 pub(crate) fn new(
7116 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7117 ) -> Self {
7118 Self(RequestBuilder::new(stub))
7119 }
7120
7121 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7123 mut self,
7124 v: V,
7125 ) -> Self {
7126 self.0.request = v.into();
7127 self
7128 }
7129
7130 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7132 self.0.options = v.into();
7133 self
7134 }
7135
7136 pub async fn send(self) -> Result<()> {
7138 (*self.0.stub)
7139 .cancel_operation(self.0.request, self.0.options)
7140 .await
7141 .map(gax::response::Response::into_body)
7142 }
7143
7144 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7146 self.0.request.name = v.into();
7147 self
7148 }
7149 }
7150
7151 #[doc(hidden)]
7152 impl gax::options::internal::RequestBuilder for CancelOperation {
7153 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7154 &mut self.0.options
7155 }
7156 }
7157}
7158
7159pub mod session_controller {
7160 use crate::Result;
7161
7162 pub type ClientBuilder =
7176 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7177
7178 pub(crate) mod client {
7179 use super::super::super::client::SessionController;
7180 pub struct Factory;
7181 impl gax::client_builder::internal::ClientFactory for Factory {
7182 type Client = SessionController;
7183 type Credentials = gaxi::options::Credentials;
7184 async fn build(
7185 self,
7186 config: gaxi::options::ClientConfig,
7187 ) -> gax::client_builder::Result<Self::Client> {
7188 Self::Client::new(config).await
7189 }
7190 }
7191 }
7192
7193 #[derive(Clone, Debug)]
7195 pub(crate) struct RequestBuilder<R: std::default::Default> {
7196 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7197 request: R,
7198 options: gax::options::RequestOptions,
7199 }
7200
7201 impl<R> RequestBuilder<R>
7202 where
7203 R: std::default::Default,
7204 {
7205 pub(crate) fn new(
7206 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7207 ) -> Self {
7208 Self {
7209 stub,
7210 request: R::default(),
7211 options: gax::options::RequestOptions::default(),
7212 }
7213 }
7214 }
7215
7216 #[derive(Clone, Debug)]
7235 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7236
7237 impl CreateSession {
7238 pub(crate) fn new(
7239 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7240 ) -> Self {
7241 Self(RequestBuilder::new(stub))
7242 }
7243
7244 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7246 self.0.request = v.into();
7247 self
7248 }
7249
7250 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7252 self.0.options = v.into();
7253 self
7254 }
7255
7256 pub async fn send(self) -> Result<longrunning::model::Operation> {
7263 (*self.0.stub)
7264 .create_session(self.0.request, self.0.options)
7265 .await
7266 .map(gax::response::Response::into_body)
7267 }
7268
7269 pub fn poller(
7271 self,
7272 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7273 {
7274 type Operation = lro::internal::Operation<
7275 crate::model::Session,
7276 crate::model::SessionOperationMetadata,
7277 >;
7278 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7279 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7280
7281 let stub = self.0.stub.clone();
7282 let mut options = self.0.options.clone();
7283 options.set_retry_policy(gax::retry_policy::NeverRetry);
7284 let query = move |name| {
7285 let stub = stub.clone();
7286 let options = options.clone();
7287 async {
7288 let op = GetOperation::new(stub)
7289 .set_name(name)
7290 .with_options(options)
7291 .send()
7292 .await?;
7293 Ok(Operation::new(op))
7294 }
7295 };
7296
7297 let start = move || async {
7298 let op = self.send().await?;
7299 Ok(Operation::new(op))
7300 };
7301
7302 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7303 }
7304
7305 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7309 self.0.request.parent = v.into();
7310 self
7311 }
7312
7313 pub fn set_session<T>(mut self, v: T) -> Self
7317 where
7318 T: std::convert::Into<crate::model::Session>,
7319 {
7320 self.0.request.session = std::option::Option::Some(v.into());
7321 self
7322 }
7323
7324 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7328 where
7329 T: std::convert::Into<crate::model::Session>,
7330 {
7331 self.0.request.session = v.map(|x| x.into());
7332 self
7333 }
7334
7335 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7339 self.0.request.session_id = v.into();
7340 self
7341 }
7342
7343 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7345 self.0.request.request_id = v.into();
7346 self
7347 }
7348 }
7349
7350 #[doc(hidden)]
7351 impl gax::options::internal::RequestBuilder for CreateSession {
7352 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7353 &mut self.0.options
7354 }
7355 }
7356
7357 #[derive(Clone, Debug)]
7375 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7376
7377 impl GetSession {
7378 pub(crate) fn new(
7379 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7380 ) -> Self {
7381 Self(RequestBuilder::new(stub))
7382 }
7383
7384 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7386 self.0.request = v.into();
7387 self
7388 }
7389
7390 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7392 self.0.options = v.into();
7393 self
7394 }
7395
7396 pub async fn send(self) -> Result<crate::model::Session> {
7398 (*self.0.stub)
7399 .get_session(self.0.request, self.0.options)
7400 .await
7401 .map(gax::response::Response::into_body)
7402 }
7403
7404 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7408 self.0.request.name = v.into();
7409 self
7410 }
7411 }
7412
7413 #[doc(hidden)]
7414 impl gax::options::internal::RequestBuilder for GetSession {
7415 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7416 &mut self.0.options
7417 }
7418 }
7419
7420 #[derive(Clone, Debug)]
7442 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7443
7444 impl ListSessions {
7445 pub(crate) fn new(
7446 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7447 ) -> Self {
7448 Self(RequestBuilder::new(stub))
7449 }
7450
7451 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7453 self.0.request = v.into();
7454 self
7455 }
7456
7457 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7459 self.0.options = v.into();
7460 self
7461 }
7462
7463 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7465 (*self.0.stub)
7466 .list_sessions(self.0.request, self.0.options)
7467 .await
7468 .map(gax::response::Response::into_body)
7469 }
7470
7471 pub fn by_page(
7473 self,
7474 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
7475 {
7476 use std::clone::Clone;
7477 let token = self.0.request.page_token.clone();
7478 let execute = move |token: String| {
7479 let mut builder = self.clone();
7480 builder.0.request = builder.0.request.set_page_token(token);
7481 builder.send()
7482 };
7483 gax::paginator::internal::new_paginator(token, execute)
7484 }
7485
7486 pub fn by_item(
7488 self,
7489 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
7490 {
7491 use gax::paginator::Paginator;
7492 self.by_page().items()
7493 }
7494
7495 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7499 self.0.request.parent = v.into();
7500 self
7501 }
7502
7503 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7505 self.0.request.page_size = v.into();
7506 self
7507 }
7508
7509 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7511 self.0.request.page_token = v.into();
7512 self
7513 }
7514
7515 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7517 self.0.request.filter = v.into();
7518 self
7519 }
7520 }
7521
7522 #[doc(hidden)]
7523 impl gax::options::internal::RequestBuilder for ListSessions {
7524 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7525 &mut self.0.options
7526 }
7527 }
7528
7529 #[derive(Clone, Debug)]
7548 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7549
7550 impl TerminateSession {
7551 pub(crate) fn new(
7552 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7553 ) -> Self {
7554 Self(RequestBuilder::new(stub))
7555 }
7556
7557 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7559 mut self,
7560 v: V,
7561 ) -> Self {
7562 self.0.request = v.into();
7563 self
7564 }
7565
7566 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7568 self.0.options = v.into();
7569 self
7570 }
7571
7572 pub async fn send(self) -> Result<longrunning::model::Operation> {
7579 (*self.0.stub)
7580 .terminate_session(self.0.request, self.0.options)
7581 .await
7582 .map(gax::response::Response::into_body)
7583 }
7584
7585 pub fn poller(
7587 self,
7588 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7589 {
7590 type Operation = lro::internal::Operation<
7591 crate::model::Session,
7592 crate::model::SessionOperationMetadata,
7593 >;
7594 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7595 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7596
7597 let stub = self.0.stub.clone();
7598 let mut options = self.0.options.clone();
7599 options.set_retry_policy(gax::retry_policy::NeverRetry);
7600 let query = move |name| {
7601 let stub = stub.clone();
7602 let options = options.clone();
7603 async {
7604 let op = GetOperation::new(stub)
7605 .set_name(name)
7606 .with_options(options)
7607 .send()
7608 .await?;
7609 Ok(Operation::new(op))
7610 }
7611 };
7612
7613 let start = move || async {
7614 let op = self.send().await?;
7615 Ok(Operation::new(op))
7616 };
7617
7618 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7619 }
7620
7621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7625 self.0.request.name = v.into();
7626 self
7627 }
7628
7629 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7631 self.0.request.request_id = v.into();
7632 self
7633 }
7634 }
7635
7636 #[doc(hidden)]
7637 impl gax::options::internal::RequestBuilder for TerminateSession {
7638 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7639 &mut self.0.options
7640 }
7641 }
7642
7643 #[derive(Clone, Debug)]
7662 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7663
7664 impl DeleteSession {
7665 pub(crate) fn new(
7666 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7667 ) -> Self {
7668 Self(RequestBuilder::new(stub))
7669 }
7670
7671 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7673 self.0.request = v.into();
7674 self
7675 }
7676
7677 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7679 self.0.options = v.into();
7680 self
7681 }
7682
7683 pub async fn send(self) -> Result<longrunning::model::Operation> {
7690 (*self.0.stub)
7691 .delete_session(self.0.request, self.0.options)
7692 .await
7693 .map(gax::response::Response::into_body)
7694 }
7695
7696 pub fn poller(
7698 self,
7699 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7700 {
7701 type Operation = lro::internal::Operation<
7702 crate::model::Session,
7703 crate::model::SessionOperationMetadata,
7704 >;
7705 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7706 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7707
7708 let stub = self.0.stub.clone();
7709 let mut options = self.0.options.clone();
7710 options.set_retry_policy(gax::retry_policy::NeverRetry);
7711 let query = move |name| {
7712 let stub = stub.clone();
7713 let options = options.clone();
7714 async {
7715 let op = GetOperation::new(stub)
7716 .set_name(name)
7717 .with_options(options)
7718 .send()
7719 .await?;
7720 Ok(Operation::new(op))
7721 }
7722 };
7723
7724 let start = move || async {
7725 let op = self.send().await?;
7726 Ok(Operation::new(op))
7727 };
7728
7729 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7730 }
7731
7732 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7736 self.0.request.name = v.into();
7737 self
7738 }
7739
7740 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7742 self.0.request.request_id = v.into();
7743 self
7744 }
7745 }
7746
7747 #[doc(hidden)]
7748 impl gax::options::internal::RequestBuilder for DeleteSession {
7749 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7750 &mut self.0.options
7751 }
7752 }
7753
7754 #[derive(Clone, Debug)]
7772 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
7773
7774 impl SetIamPolicy {
7775 pub(crate) fn new(
7776 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7777 ) -> Self {
7778 Self(RequestBuilder::new(stub))
7779 }
7780
7781 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
7783 self.0.request = v.into();
7784 self
7785 }
7786
7787 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7789 self.0.options = v.into();
7790 self
7791 }
7792
7793 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7795 (*self.0.stub)
7796 .set_iam_policy(self.0.request, self.0.options)
7797 .await
7798 .map(gax::response::Response::into_body)
7799 }
7800
7801 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7805 self.0.request.resource = v.into();
7806 self
7807 }
7808
7809 pub fn set_policy<T>(mut self, v: T) -> Self
7813 where
7814 T: std::convert::Into<iam_v1::model::Policy>,
7815 {
7816 self.0.request.policy = std::option::Option::Some(v.into());
7817 self
7818 }
7819
7820 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7824 where
7825 T: std::convert::Into<iam_v1::model::Policy>,
7826 {
7827 self.0.request.policy = v.map(|x| x.into());
7828 self
7829 }
7830
7831 pub fn set_update_mask<T>(mut self, v: T) -> Self
7833 where
7834 T: std::convert::Into<wkt::FieldMask>,
7835 {
7836 self.0.request.update_mask = std::option::Option::Some(v.into());
7837 self
7838 }
7839
7840 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7842 where
7843 T: std::convert::Into<wkt::FieldMask>,
7844 {
7845 self.0.request.update_mask = v.map(|x| x.into());
7846 self
7847 }
7848 }
7849
7850 #[doc(hidden)]
7851 impl gax::options::internal::RequestBuilder for SetIamPolicy {
7852 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7853 &mut self.0.options
7854 }
7855 }
7856
7857 #[derive(Clone, Debug)]
7875 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
7876
7877 impl GetIamPolicy {
7878 pub(crate) fn new(
7879 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7880 ) -> Self {
7881 Self(RequestBuilder::new(stub))
7882 }
7883
7884 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
7886 self.0.request = v.into();
7887 self
7888 }
7889
7890 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7892 self.0.options = v.into();
7893 self
7894 }
7895
7896 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7898 (*self.0.stub)
7899 .get_iam_policy(self.0.request, self.0.options)
7900 .await
7901 .map(gax::response::Response::into_body)
7902 }
7903
7904 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7908 self.0.request.resource = v.into();
7909 self
7910 }
7911
7912 pub fn set_options<T>(mut self, v: T) -> Self
7914 where
7915 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7916 {
7917 self.0.request.options = std::option::Option::Some(v.into());
7918 self
7919 }
7920
7921 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7923 where
7924 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7925 {
7926 self.0.request.options = v.map(|x| x.into());
7927 self
7928 }
7929 }
7930
7931 #[doc(hidden)]
7932 impl gax::options::internal::RequestBuilder for GetIamPolicy {
7933 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7934 &mut self.0.options
7935 }
7936 }
7937
7938 #[derive(Clone, Debug)]
7956 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
7957
7958 impl TestIamPermissions {
7959 pub(crate) fn new(
7960 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7961 ) -> Self {
7962 Self(RequestBuilder::new(stub))
7963 }
7964
7965 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
7967 mut self,
7968 v: V,
7969 ) -> Self {
7970 self.0.request = v.into();
7971 self
7972 }
7973
7974 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7976 self.0.options = v.into();
7977 self
7978 }
7979
7980 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
7982 (*self.0.stub)
7983 .test_iam_permissions(self.0.request, self.0.options)
7984 .await
7985 .map(gax::response::Response::into_body)
7986 }
7987
7988 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7992 self.0.request.resource = v.into();
7993 self
7994 }
7995
7996 pub fn set_permissions<T, V>(mut self, v: T) -> Self
8000 where
8001 T: std::iter::IntoIterator<Item = V>,
8002 V: std::convert::Into<std::string::String>,
8003 {
8004 use std::iter::Iterator;
8005 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8006 self
8007 }
8008 }
8009
8010 #[doc(hidden)]
8011 impl gax::options::internal::RequestBuilder for TestIamPermissions {
8012 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8013 &mut self.0.options
8014 }
8015 }
8016
8017 #[derive(Clone, Debug)]
8039 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8040
8041 impl ListOperations {
8042 pub(crate) fn new(
8043 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8044 ) -> Self {
8045 Self(RequestBuilder::new(stub))
8046 }
8047
8048 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8050 mut self,
8051 v: V,
8052 ) -> Self {
8053 self.0.request = v.into();
8054 self
8055 }
8056
8057 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8059 self.0.options = v.into();
8060 self
8061 }
8062
8063 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8065 (*self.0.stub)
8066 .list_operations(self.0.request, self.0.options)
8067 .await
8068 .map(gax::response::Response::into_body)
8069 }
8070
8071 pub fn by_page(
8073 self,
8074 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8075 {
8076 use std::clone::Clone;
8077 let token = self.0.request.page_token.clone();
8078 let execute = move |token: String| {
8079 let mut builder = self.clone();
8080 builder.0.request = builder.0.request.set_page_token(token);
8081 builder.send()
8082 };
8083 gax::paginator::internal::new_paginator(token, execute)
8084 }
8085
8086 pub fn by_item(
8088 self,
8089 ) -> impl gax::paginator::ItemPaginator<
8090 longrunning::model::ListOperationsResponse,
8091 gax::error::Error,
8092 > {
8093 use gax::paginator::Paginator;
8094 self.by_page().items()
8095 }
8096
8097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8099 self.0.request.name = v.into();
8100 self
8101 }
8102
8103 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8105 self.0.request.filter = v.into();
8106 self
8107 }
8108
8109 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8111 self.0.request.page_size = v.into();
8112 self
8113 }
8114
8115 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8117 self.0.request.page_token = v.into();
8118 self
8119 }
8120 }
8121
8122 #[doc(hidden)]
8123 impl gax::options::internal::RequestBuilder for ListOperations {
8124 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8125 &mut self.0.options
8126 }
8127 }
8128
8129 #[derive(Clone, Debug)]
8147 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8148
8149 impl GetOperation {
8150 pub(crate) fn new(
8151 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8152 ) -> Self {
8153 Self(RequestBuilder::new(stub))
8154 }
8155
8156 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8158 mut self,
8159 v: V,
8160 ) -> Self {
8161 self.0.request = v.into();
8162 self
8163 }
8164
8165 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8167 self.0.options = v.into();
8168 self
8169 }
8170
8171 pub async fn send(self) -> Result<longrunning::model::Operation> {
8173 (*self.0.stub)
8174 .get_operation(self.0.request, self.0.options)
8175 .await
8176 .map(gax::response::Response::into_body)
8177 }
8178
8179 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8181 self.0.request.name = v.into();
8182 self
8183 }
8184 }
8185
8186 #[doc(hidden)]
8187 impl gax::options::internal::RequestBuilder for GetOperation {
8188 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8189 &mut self.0.options
8190 }
8191 }
8192
8193 #[derive(Clone, Debug)]
8211 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
8212
8213 impl DeleteOperation {
8214 pub(crate) fn new(
8215 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8216 ) -> Self {
8217 Self(RequestBuilder::new(stub))
8218 }
8219
8220 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
8222 mut self,
8223 v: V,
8224 ) -> Self {
8225 self.0.request = v.into();
8226 self
8227 }
8228
8229 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8231 self.0.options = v.into();
8232 self
8233 }
8234
8235 pub async fn send(self) -> Result<()> {
8237 (*self.0.stub)
8238 .delete_operation(self.0.request, self.0.options)
8239 .await
8240 .map(gax::response::Response::into_body)
8241 }
8242
8243 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8245 self.0.request.name = v.into();
8246 self
8247 }
8248 }
8249
8250 #[doc(hidden)]
8251 impl gax::options::internal::RequestBuilder for DeleteOperation {
8252 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8253 &mut self.0.options
8254 }
8255 }
8256
8257 #[derive(Clone, Debug)]
8275 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8276
8277 impl CancelOperation {
8278 pub(crate) fn new(
8279 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8280 ) -> Self {
8281 Self(RequestBuilder::new(stub))
8282 }
8283
8284 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8286 mut self,
8287 v: V,
8288 ) -> Self {
8289 self.0.request = v.into();
8290 self
8291 }
8292
8293 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8295 self.0.options = v.into();
8296 self
8297 }
8298
8299 pub async fn send(self) -> Result<()> {
8301 (*self.0.stub)
8302 .cancel_operation(self.0.request, self.0.options)
8303 .await
8304 .map(gax::response::Response::into_body)
8305 }
8306
8307 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8309 self.0.request.name = v.into();
8310 self
8311 }
8312 }
8313
8314 #[doc(hidden)]
8315 impl gax::options::internal::RequestBuilder for CancelOperation {
8316 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8317 &mut self.0.options
8318 }
8319 }
8320}
8321
8322pub mod workflow_template_service {
8323 use crate::Result;
8324
8325 pub type ClientBuilder =
8339 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8340
8341 pub(crate) mod client {
8342 use super::super::super::client::WorkflowTemplateService;
8343 pub struct Factory;
8344 impl gax::client_builder::internal::ClientFactory for Factory {
8345 type Client = WorkflowTemplateService;
8346 type Credentials = gaxi::options::Credentials;
8347 async fn build(
8348 self,
8349 config: gaxi::options::ClientConfig,
8350 ) -> gax::client_builder::Result<Self::Client> {
8351 Self::Client::new(config).await
8352 }
8353 }
8354 }
8355
8356 #[derive(Clone, Debug)]
8358 pub(crate) struct RequestBuilder<R: std::default::Default> {
8359 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8360 request: R,
8361 options: gax::options::RequestOptions,
8362 }
8363
8364 impl<R> RequestBuilder<R>
8365 where
8366 R: std::default::Default,
8367 {
8368 pub(crate) fn new(
8369 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8370 ) -> Self {
8371 Self {
8372 stub,
8373 request: R::default(),
8374 options: gax::options::RequestOptions::default(),
8375 }
8376 }
8377 }
8378
8379 #[derive(Clone, Debug)]
8397 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8398
8399 impl CreateWorkflowTemplate {
8400 pub(crate) fn new(
8401 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8402 ) -> Self {
8403 Self(RequestBuilder::new(stub))
8404 }
8405
8406 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8408 mut self,
8409 v: V,
8410 ) -> Self {
8411 self.0.request = v.into();
8412 self
8413 }
8414
8415 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8417 self.0.options = v.into();
8418 self
8419 }
8420
8421 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8423 (*self.0.stub)
8424 .create_workflow_template(self.0.request, self.0.options)
8425 .await
8426 .map(gax::response::Response::into_body)
8427 }
8428
8429 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8433 self.0.request.parent = v.into();
8434 self
8435 }
8436
8437 pub fn set_template<T>(mut self, v: T) -> Self
8441 where
8442 T: std::convert::Into<crate::model::WorkflowTemplate>,
8443 {
8444 self.0.request.template = std::option::Option::Some(v.into());
8445 self
8446 }
8447
8448 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8452 where
8453 T: std::convert::Into<crate::model::WorkflowTemplate>,
8454 {
8455 self.0.request.template = v.map(|x| x.into());
8456 self
8457 }
8458 }
8459
8460 #[doc(hidden)]
8461 impl gax::options::internal::RequestBuilder for CreateWorkflowTemplate {
8462 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8463 &mut self.0.options
8464 }
8465 }
8466
8467 #[derive(Clone, Debug)]
8485 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8486
8487 impl GetWorkflowTemplate {
8488 pub(crate) fn new(
8489 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8490 ) -> Self {
8491 Self(RequestBuilder::new(stub))
8492 }
8493
8494 pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
8496 mut self,
8497 v: V,
8498 ) -> Self {
8499 self.0.request = v.into();
8500 self
8501 }
8502
8503 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8505 self.0.options = v.into();
8506 self
8507 }
8508
8509 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8511 (*self.0.stub)
8512 .get_workflow_template(self.0.request, self.0.options)
8513 .await
8514 .map(gax::response::Response::into_body)
8515 }
8516
8517 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8521 self.0.request.name = v.into();
8522 self
8523 }
8524
8525 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8527 self.0.request.version = v.into();
8528 self
8529 }
8530 }
8531
8532 #[doc(hidden)]
8533 impl gax::options::internal::RequestBuilder for GetWorkflowTemplate {
8534 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8535 &mut self.0.options
8536 }
8537 }
8538
8539 #[derive(Clone, Debug)]
8558 pub struct InstantiateWorkflowTemplate(
8559 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8560 );
8561
8562 impl InstantiateWorkflowTemplate {
8563 pub(crate) fn new(
8564 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8565 ) -> Self {
8566 Self(RequestBuilder::new(stub))
8567 }
8568
8569 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8571 mut self,
8572 v: V,
8573 ) -> Self {
8574 self.0.request = v.into();
8575 self
8576 }
8577
8578 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8580 self.0.options = v.into();
8581 self
8582 }
8583
8584 pub async fn send(self) -> Result<longrunning::model::Operation> {
8591 (*self.0.stub)
8592 .instantiate_workflow_template(self.0.request, self.0.options)
8593 .await
8594 .map(gax::response::Response::into_body)
8595 }
8596
8597 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8599 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8600 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8601 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8602
8603 let stub = self.0.stub.clone();
8604 let mut options = self.0.options.clone();
8605 options.set_retry_policy(gax::retry_policy::NeverRetry);
8606 let query = move |name| {
8607 let stub = stub.clone();
8608 let options = options.clone();
8609 async {
8610 let op = GetOperation::new(stub)
8611 .set_name(name)
8612 .with_options(options)
8613 .send()
8614 .await?;
8615 Ok(Operation::new(op))
8616 }
8617 };
8618
8619 let start = move || async {
8620 let op = self.send().await?;
8621 Ok(Operation::new(op))
8622 };
8623
8624 lro::internal::new_unit_response_poller(
8625 polling_error_policy,
8626 polling_backoff_policy,
8627 start,
8628 query,
8629 )
8630 }
8631
8632 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8636 self.0.request.name = v.into();
8637 self
8638 }
8639
8640 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8642 self.0.request.version = v.into();
8643 self
8644 }
8645
8646 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8648 self.0.request.request_id = v.into();
8649 self
8650 }
8651
8652 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8654 where
8655 T: std::iter::IntoIterator<Item = (K, V)>,
8656 K: std::convert::Into<std::string::String>,
8657 V: std::convert::Into<std::string::String>,
8658 {
8659 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8660 self
8661 }
8662 }
8663
8664 #[doc(hidden)]
8665 impl gax::options::internal::RequestBuilder for InstantiateWorkflowTemplate {
8666 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8667 &mut self.0.options
8668 }
8669 }
8670
8671 #[derive(Clone, Debug)]
8690 pub struct InstantiateInlineWorkflowTemplate(
8691 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8692 );
8693
8694 impl InstantiateInlineWorkflowTemplate {
8695 pub(crate) fn new(
8696 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8697 ) -> Self {
8698 Self(RequestBuilder::new(stub))
8699 }
8700
8701 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8703 mut self,
8704 v: V,
8705 ) -> Self {
8706 self.0.request = v.into();
8707 self
8708 }
8709
8710 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8712 self.0.options = v.into();
8713 self
8714 }
8715
8716 pub async fn send(self) -> Result<longrunning::model::Operation> {
8723 (*self.0.stub)
8724 .instantiate_inline_workflow_template(self.0.request, self.0.options)
8725 .await
8726 .map(gax::response::Response::into_body)
8727 }
8728
8729 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8731 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8732 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8733 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8734
8735 let stub = self.0.stub.clone();
8736 let mut options = self.0.options.clone();
8737 options.set_retry_policy(gax::retry_policy::NeverRetry);
8738 let query = move |name| {
8739 let stub = stub.clone();
8740 let options = options.clone();
8741 async {
8742 let op = GetOperation::new(stub)
8743 .set_name(name)
8744 .with_options(options)
8745 .send()
8746 .await?;
8747 Ok(Operation::new(op))
8748 }
8749 };
8750
8751 let start = move || async {
8752 let op = self.send().await?;
8753 Ok(Operation::new(op))
8754 };
8755
8756 lro::internal::new_unit_response_poller(
8757 polling_error_policy,
8758 polling_backoff_policy,
8759 start,
8760 query,
8761 )
8762 }
8763
8764 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8768 self.0.request.parent = v.into();
8769 self
8770 }
8771
8772 pub fn set_template<T>(mut self, v: T) -> Self
8776 where
8777 T: std::convert::Into<crate::model::WorkflowTemplate>,
8778 {
8779 self.0.request.template = std::option::Option::Some(v.into());
8780 self
8781 }
8782
8783 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8787 where
8788 T: std::convert::Into<crate::model::WorkflowTemplate>,
8789 {
8790 self.0.request.template = v.map(|x| x.into());
8791 self
8792 }
8793
8794 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8796 self.0.request.request_id = v.into();
8797 self
8798 }
8799 }
8800
8801 #[doc(hidden)]
8802 impl gax::options::internal::RequestBuilder for InstantiateInlineWorkflowTemplate {
8803 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8804 &mut self.0.options
8805 }
8806 }
8807
8808 #[derive(Clone, Debug)]
8826 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
8827
8828 impl UpdateWorkflowTemplate {
8829 pub(crate) fn new(
8830 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8831 ) -> Self {
8832 Self(RequestBuilder::new(stub))
8833 }
8834
8835 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
8837 mut self,
8838 v: V,
8839 ) -> Self {
8840 self.0.request = v.into();
8841 self
8842 }
8843
8844 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8846 self.0.options = v.into();
8847 self
8848 }
8849
8850 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8852 (*self.0.stub)
8853 .update_workflow_template(self.0.request, self.0.options)
8854 .await
8855 .map(gax::response::Response::into_body)
8856 }
8857
8858 pub fn set_template<T>(mut self, v: T) -> Self
8862 where
8863 T: std::convert::Into<crate::model::WorkflowTemplate>,
8864 {
8865 self.0.request.template = std::option::Option::Some(v.into());
8866 self
8867 }
8868
8869 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8873 where
8874 T: std::convert::Into<crate::model::WorkflowTemplate>,
8875 {
8876 self.0.request.template = v.map(|x| x.into());
8877 self
8878 }
8879 }
8880
8881 #[doc(hidden)]
8882 impl gax::options::internal::RequestBuilder for UpdateWorkflowTemplate {
8883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8884 &mut self.0.options
8885 }
8886 }
8887
8888 #[derive(Clone, Debug)]
8910 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
8911
8912 impl ListWorkflowTemplates {
8913 pub(crate) fn new(
8914 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8915 ) -> Self {
8916 Self(RequestBuilder::new(stub))
8917 }
8918
8919 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
8921 mut self,
8922 v: V,
8923 ) -> Self {
8924 self.0.request = v.into();
8925 self
8926 }
8927
8928 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8930 self.0.options = v.into();
8931 self
8932 }
8933
8934 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
8936 (*self.0.stub)
8937 .list_workflow_templates(self.0.request, self.0.options)
8938 .await
8939 .map(gax::response::Response::into_body)
8940 }
8941
8942 pub fn by_page(
8944 self,
8945 ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowTemplatesResponse, gax::error::Error>
8946 {
8947 use std::clone::Clone;
8948 let token = self.0.request.page_token.clone();
8949 let execute = move |token: String| {
8950 let mut builder = self.clone();
8951 builder.0.request = builder.0.request.set_page_token(token);
8952 builder.send()
8953 };
8954 gax::paginator::internal::new_paginator(token, execute)
8955 }
8956
8957 pub fn by_item(
8959 self,
8960 ) -> impl gax::paginator::ItemPaginator<
8961 crate::model::ListWorkflowTemplatesResponse,
8962 gax::error::Error,
8963 > {
8964 use gax::paginator::Paginator;
8965 self.by_page().items()
8966 }
8967
8968 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8972 self.0.request.parent = v.into();
8973 self
8974 }
8975
8976 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8978 self.0.request.page_size = v.into();
8979 self
8980 }
8981
8982 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8984 self.0.request.page_token = v.into();
8985 self
8986 }
8987 }
8988
8989 #[doc(hidden)]
8990 impl gax::options::internal::RequestBuilder for ListWorkflowTemplates {
8991 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8992 &mut self.0.options
8993 }
8994 }
8995
8996 #[derive(Clone, Debug)]
9014 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
9015
9016 impl DeleteWorkflowTemplate {
9017 pub(crate) fn new(
9018 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9019 ) -> Self {
9020 Self(RequestBuilder::new(stub))
9021 }
9022
9023 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
9025 mut self,
9026 v: V,
9027 ) -> Self {
9028 self.0.request = v.into();
9029 self
9030 }
9031
9032 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9034 self.0.options = v.into();
9035 self
9036 }
9037
9038 pub async fn send(self) -> Result<()> {
9040 (*self.0.stub)
9041 .delete_workflow_template(self.0.request, self.0.options)
9042 .await
9043 .map(gax::response::Response::into_body)
9044 }
9045
9046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9050 self.0.request.name = v.into();
9051 self
9052 }
9053
9054 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9056 self.0.request.version = v.into();
9057 self
9058 }
9059 }
9060
9061 #[doc(hidden)]
9062 impl gax::options::internal::RequestBuilder for DeleteWorkflowTemplate {
9063 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9064 &mut self.0.options
9065 }
9066 }
9067
9068 #[derive(Clone, Debug)]
9086 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
9087
9088 impl SetIamPolicy {
9089 pub(crate) fn new(
9090 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9091 ) -> Self {
9092 Self(RequestBuilder::new(stub))
9093 }
9094
9095 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
9097 self.0.request = v.into();
9098 self
9099 }
9100
9101 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9103 self.0.options = v.into();
9104 self
9105 }
9106
9107 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9109 (*self.0.stub)
9110 .set_iam_policy(self.0.request, self.0.options)
9111 .await
9112 .map(gax::response::Response::into_body)
9113 }
9114
9115 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9119 self.0.request.resource = v.into();
9120 self
9121 }
9122
9123 pub fn set_policy<T>(mut self, v: T) -> Self
9127 where
9128 T: std::convert::Into<iam_v1::model::Policy>,
9129 {
9130 self.0.request.policy = std::option::Option::Some(v.into());
9131 self
9132 }
9133
9134 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9138 where
9139 T: std::convert::Into<iam_v1::model::Policy>,
9140 {
9141 self.0.request.policy = v.map(|x| x.into());
9142 self
9143 }
9144
9145 pub fn set_update_mask<T>(mut self, v: T) -> Self
9147 where
9148 T: std::convert::Into<wkt::FieldMask>,
9149 {
9150 self.0.request.update_mask = std::option::Option::Some(v.into());
9151 self
9152 }
9153
9154 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9156 where
9157 T: std::convert::Into<wkt::FieldMask>,
9158 {
9159 self.0.request.update_mask = v.map(|x| x.into());
9160 self
9161 }
9162 }
9163
9164 #[doc(hidden)]
9165 impl gax::options::internal::RequestBuilder for SetIamPolicy {
9166 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9167 &mut self.0.options
9168 }
9169 }
9170
9171 #[derive(Clone, Debug)]
9189 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
9190
9191 impl GetIamPolicy {
9192 pub(crate) fn new(
9193 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9194 ) -> Self {
9195 Self(RequestBuilder::new(stub))
9196 }
9197
9198 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
9200 self.0.request = v.into();
9201 self
9202 }
9203
9204 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9206 self.0.options = v.into();
9207 self
9208 }
9209
9210 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9212 (*self.0.stub)
9213 .get_iam_policy(self.0.request, self.0.options)
9214 .await
9215 .map(gax::response::Response::into_body)
9216 }
9217
9218 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9222 self.0.request.resource = v.into();
9223 self
9224 }
9225
9226 pub fn set_options<T>(mut self, v: T) -> Self
9228 where
9229 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9230 {
9231 self.0.request.options = std::option::Option::Some(v.into());
9232 self
9233 }
9234
9235 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9237 where
9238 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9239 {
9240 self.0.request.options = v.map(|x| x.into());
9241 self
9242 }
9243 }
9244
9245 #[doc(hidden)]
9246 impl gax::options::internal::RequestBuilder for GetIamPolicy {
9247 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9248 &mut self.0.options
9249 }
9250 }
9251
9252 #[derive(Clone, Debug)]
9270 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
9271
9272 impl TestIamPermissions {
9273 pub(crate) fn new(
9274 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9275 ) -> Self {
9276 Self(RequestBuilder::new(stub))
9277 }
9278
9279 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
9281 mut self,
9282 v: V,
9283 ) -> Self {
9284 self.0.request = v.into();
9285 self
9286 }
9287
9288 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9290 self.0.options = v.into();
9291 self
9292 }
9293
9294 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
9296 (*self.0.stub)
9297 .test_iam_permissions(self.0.request, self.0.options)
9298 .await
9299 .map(gax::response::Response::into_body)
9300 }
9301
9302 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9306 self.0.request.resource = v.into();
9307 self
9308 }
9309
9310 pub fn set_permissions<T, V>(mut self, v: T) -> Self
9314 where
9315 T: std::iter::IntoIterator<Item = V>,
9316 V: std::convert::Into<std::string::String>,
9317 {
9318 use std::iter::Iterator;
9319 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9320 self
9321 }
9322 }
9323
9324 #[doc(hidden)]
9325 impl gax::options::internal::RequestBuilder for TestIamPermissions {
9326 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9327 &mut self.0.options
9328 }
9329 }
9330
9331 #[derive(Clone, Debug)]
9353 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9354
9355 impl ListOperations {
9356 pub(crate) fn new(
9357 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9358 ) -> Self {
9359 Self(RequestBuilder::new(stub))
9360 }
9361
9362 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9364 mut self,
9365 v: V,
9366 ) -> Self {
9367 self.0.request = v.into();
9368 self
9369 }
9370
9371 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9373 self.0.options = v.into();
9374 self
9375 }
9376
9377 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9379 (*self.0.stub)
9380 .list_operations(self.0.request, self.0.options)
9381 .await
9382 .map(gax::response::Response::into_body)
9383 }
9384
9385 pub fn by_page(
9387 self,
9388 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9389 {
9390 use std::clone::Clone;
9391 let token = self.0.request.page_token.clone();
9392 let execute = move |token: String| {
9393 let mut builder = self.clone();
9394 builder.0.request = builder.0.request.set_page_token(token);
9395 builder.send()
9396 };
9397 gax::paginator::internal::new_paginator(token, execute)
9398 }
9399
9400 pub fn by_item(
9402 self,
9403 ) -> impl gax::paginator::ItemPaginator<
9404 longrunning::model::ListOperationsResponse,
9405 gax::error::Error,
9406 > {
9407 use gax::paginator::Paginator;
9408 self.by_page().items()
9409 }
9410
9411 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9413 self.0.request.name = v.into();
9414 self
9415 }
9416
9417 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9419 self.0.request.filter = v.into();
9420 self
9421 }
9422
9423 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9425 self.0.request.page_size = v.into();
9426 self
9427 }
9428
9429 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9431 self.0.request.page_token = v.into();
9432 self
9433 }
9434 }
9435
9436 #[doc(hidden)]
9437 impl gax::options::internal::RequestBuilder for ListOperations {
9438 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9439 &mut self.0.options
9440 }
9441 }
9442
9443 #[derive(Clone, Debug)]
9461 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9462
9463 impl GetOperation {
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<longrunning::model::GetOperationRequest>>(
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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9481 self.0.options = v.into();
9482 self
9483 }
9484
9485 pub async fn send(self) -> Result<longrunning::model::Operation> {
9487 (*self.0.stub)
9488 .get_operation(self.0.request, self.0.options)
9489 .await
9490 .map(gax::response::Response::into_body)
9491 }
9492
9493 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9495 self.0.request.name = v.into();
9496 self
9497 }
9498 }
9499
9500 #[doc(hidden)]
9501 impl gax::options::internal::RequestBuilder for GetOperation {
9502 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9503 &mut self.0.options
9504 }
9505 }
9506
9507 #[derive(Clone, Debug)]
9525 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
9526
9527 impl DeleteOperation {
9528 pub(crate) fn new(
9529 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9530 ) -> Self {
9531 Self(RequestBuilder::new(stub))
9532 }
9533
9534 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
9536 mut self,
9537 v: V,
9538 ) -> Self {
9539 self.0.request = v.into();
9540 self
9541 }
9542
9543 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9545 self.0.options = v.into();
9546 self
9547 }
9548
9549 pub async fn send(self) -> Result<()> {
9551 (*self.0.stub)
9552 .delete_operation(self.0.request, self.0.options)
9553 .await
9554 .map(gax::response::Response::into_body)
9555 }
9556
9557 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9559 self.0.request.name = v.into();
9560 self
9561 }
9562 }
9563
9564 #[doc(hidden)]
9565 impl gax::options::internal::RequestBuilder for DeleteOperation {
9566 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9567 &mut self.0.options
9568 }
9569 }
9570
9571 #[derive(Clone, Debug)]
9589 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9590
9591 impl CancelOperation {
9592 pub(crate) fn new(
9593 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9594 ) -> Self {
9595 Self(RequestBuilder::new(stub))
9596 }
9597
9598 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9600 mut self,
9601 v: V,
9602 ) -> Self {
9603 self.0.request = v.into();
9604 self
9605 }
9606
9607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9609 self.0.options = v.into();
9610 self
9611 }
9612
9613 pub async fn send(self) -> Result<()> {
9615 (*self.0.stub)
9616 .cancel_operation(self.0.request, self.0.options)
9617 .await
9618 .map(gax::response::Response::into_body)
9619 }
9620
9621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9623 self.0.request.name = v.into();
9624 self
9625 }
9626 }
9627
9628 #[doc(hidden)]
9629 impl gax::options::internal::RequestBuilder for CancelOperation {
9630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9631 &mut self.0.options
9632 }
9633 }
9634}