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 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
861 self.0.request.return_partial_success = v.into();
862 self
863 }
864 }
865
866 #[doc(hidden)]
867 impl gax::options::internal::RequestBuilder for ListOperations {
868 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
869 &mut self.0.options
870 }
871 }
872
873 #[derive(Clone, Debug)]
891 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
892
893 impl GetOperation {
894 pub(crate) fn new(
895 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
896 ) -> Self {
897 Self(RequestBuilder::new(stub))
898 }
899
900 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
902 mut self,
903 v: V,
904 ) -> Self {
905 self.0.request = v.into();
906 self
907 }
908
909 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
911 self.0.options = v.into();
912 self
913 }
914
915 pub async fn send(self) -> Result<longrunning::model::Operation> {
917 (*self.0.stub)
918 .get_operation(self.0.request, self.0.options)
919 .await
920 .map(gax::response::Response::into_body)
921 }
922
923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
925 self.0.request.name = v.into();
926 self
927 }
928 }
929
930 #[doc(hidden)]
931 impl gax::options::internal::RequestBuilder for GetOperation {
932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
933 &mut self.0.options
934 }
935 }
936
937 #[derive(Clone, Debug)]
955 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
956
957 impl DeleteOperation {
958 pub(crate) fn new(
959 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
960 ) -> Self {
961 Self(RequestBuilder::new(stub))
962 }
963
964 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
966 mut self,
967 v: V,
968 ) -> Self {
969 self.0.request = v.into();
970 self
971 }
972
973 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
975 self.0.options = v.into();
976 self
977 }
978
979 pub async fn send(self) -> Result<()> {
981 (*self.0.stub)
982 .delete_operation(self.0.request, self.0.options)
983 .await
984 .map(gax::response::Response::into_body)
985 }
986
987 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
989 self.0.request.name = v.into();
990 self
991 }
992 }
993
994 #[doc(hidden)]
995 impl gax::options::internal::RequestBuilder for DeleteOperation {
996 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
997 &mut self.0.options
998 }
999 }
1000
1001 #[derive(Clone, Debug)]
1019 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1020
1021 impl CancelOperation {
1022 pub(crate) fn new(
1023 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1024 ) -> Self {
1025 Self(RequestBuilder::new(stub))
1026 }
1027
1028 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1030 mut self,
1031 v: V,
1032 ) -> Self {
1033 self.0.request = v.into();
1034 self
1035 }
1036
1037 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1039 self.0.options = v.into();
1040 self
1041 }
1042
1043 pub async fn send(self) -> Result<()> {
1045 (*self.0.stub)
1046 .cancel_operation(self.0.request, self.0.options)
1047 .await
1048 .map(gax::response::Response::into_body)
1049 }
1050
1051 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1053 self.0.request.name = v.into();
1054 self
1055 }
1056 }
1057
1058 #[doc(hidden)]
1059 impl gax::options::internal::RequestBuilder for CancelOperation {
1060 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1061 &mut self.0.options
1062 }
1063 }
1064}
1065
1066pub mod batch_controller {
1067 use crate::Result;
1068
1069 pub type ClientBuilder =
1083 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1084
1085 pub(crate) mod client {
1086 use super::super::super::client::BatchController;
1087 pub struct Factory;
1088 impl gax::client_builder::internal::ClientFactory for Factory {
1089 type Client = BatchController;
1090 type Credentials = gaxi::options::Credentials;
1091 async fn build(
1092 self,
1093 config: gaxi::options::ClientConfig,
1094 ) -> gax::client_builder::Result<Self::Client> {
1095 Self::Client::new(config).await
1096 }
1097 }
1098 }
1099
1100 #[derive(Clone, Debug)]
1102 pub(crate) struct RequestBuilder<R: std::default::Default> {
1103 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1104 request: R,
1105 options: gax::options::RequestOptions,
1106 }
1107
1108 impl<R> RequestBuilder<R>
1109 where
1110 R: std::default::Default,
1111 {
1112 pub(crate) fn new(
1113 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1114 ) -> Self {
1115 Self {
1116 stub,
1117 request: R::default(),
1118 options: gax::options::RequestOptions::default(),
1119 }
1120 }
1121 }
1122
1123 #[derive(Clone, Debug)]
1142 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1143
1144 impl CreateBatch {
1145 pub(crate) fn new(
1146 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1147 ) -> Self {
1148 Self(RequestBuilder::new(stub))
1149 }
1150
1151 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1153 self.0.request = v.into();
1154 self
1155 }
1156
1157 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1159 self.0.options = v.into();
1160 self
1161 }
1162
1163 pub async fn send(self) -> Result<longrunning::model::Operation> {
1170 (*self.0.stub)
1171 .create_batch(self.0.request, self.0.options)
1172 .await
1173 .map(gax::response::Response::into_body)
1174 }
1175
1176 pub fn poller(
1178 self,
1179 ) -> impl lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata> {
1180 type Operation =
1181 lro::internal::Operation<crate::model::Batch, crate::model::BatchOperationMetadata>;
1182 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1183 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1184
1185 let stub = self.0.stub.clone();
1186 let mut options = self.0.options.clone();
1187 options.set_retry_policy(gax::retry_policy::NeverRetry);
1188 let query = move |name| {
1189 let stub = stub.clone();
1190 let options = options.clone();
1191 async {
1192 let op = GetOperation::new(stub)
1193 .set_name(name)
1194 .with_options(options)
1195 .send()
1196 .await?;
1197 Ok(Operation::new(op))
1198 }
1199 };
1200
1201 let start = move || async {
1202 let op = self.send().await?;
1203 Ok(Operation::new(op))
1204 };
1205
1206 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1207 }
1208
1209 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1213 self.0.request.parent = v.into();
1214 self
1215 }
1216
1217 pub fn set_batch<T>(mut self, v: T) -> Self
1221 where
1222 T: std::convert::Into<crate::model::Batch>,
1223 {
1224 self.0.request.batch = std::option::Option::Some(v.into());
1225 self
1226 }
1227
1228 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1232 where
1233 T: std::convert::Into<crate::model::Batch>,
1234 {
1235 self.0.request.batch = v.map(|x| x.into());
1236 self
1237 }
1238
1239 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1241 self.0.request.batch_id = v.into();
1242 self
1243 }
1244
1245 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1247 self.0.request.request_id = v.into();
1248 self
1249 }
1250 }
1251
1252 #[doc(hidden)]
1253 impl gax::options::internal::RequestBuilder for CreateBatch {
1254 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1255 &mut self.0.options
1256 }
1257 }
1258
1259 #[derive(Clone, Debug)]
1277 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1278
1279 impl GetBatch {
1280 pub(crate) fn new(
1281 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1282 ) -> Self {
1283 Self(RequestBuilder::new(stub))
1284 }
1285
1286 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1288 self.0.request = v.into();
1289 self
1290 }
1291
1292 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1294 self.0.options = v.into();
1295 self
1296 }
1297
1298 pub async fn send(self) -> Result<crate::model::Batch> {
1300 (*self.0.stub)
1301 .get_batch(self.0.request, self.0.options)
1302 .await
1303 .map(gax::response::Response::into_body)
1304 }
1305
1306 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1310 self.0.request.name = v.into();
1311 self
1312 }
1313 }
1314
1315 #[doc(hidden)]
1316 impl gax::options::internal::RequestBuilder for GetBatch {
1317 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1318 &mut self.0.options
1319 }
1320 }
1321
1322 #[derive(Clone, Debug)]
1344 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1345
1346 impl ListBatches {
1347 pub(crate) fn new(
1348 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1349 ) -> Self {
1350 Self(RequestBuilder::new(stub))
1351 }
1352
1353 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1355 self.0.request = v.into();
1356 self
1357 }
1358
1359 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1361 self.0.options = v.into();
1362 self
1363 }
1364
1365 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1367 (*self.0.stub)
1368 .list_batches(self.0.request, self.0.options)
1369 .await
1370 .map(gax::response::Response::into_body)
1371 }
1372
1373 pub fn by_page(
1375 self,
1376 ) -> impl gax::paginator::Paginator<crate::model::ListBatchesResponse, gax::error::Error>
1377 {
1378 use std::clone::Clone;
1379 let token = self.0.request.page_token.clone();
1380 let execute = move |token: String| {
1381 let mut builder = self.clone();
1382 builder.0.request = builder.0.request.set_page_token(token);
1383 builder.send()
1384 };
1385 gax::paginator::internal::new_paginator(token, execute)
1386 }
1387
1388 pub fn by_item(
1390 self,
1391 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBatchesResponse, gax::error::Error>
1392 {
1393 use gax::paginator::Paginator;
1394 self.by_page().items()
1395 }
1396
1397 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1401 self.0.request.parent = v.into();
1402 self
1403 }
1404
1405 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1407 self.0.request.page_size = v.into();
1408 self
1409 }
1410
1411 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413 self.0.request.page_token = v.into();
1414 self
1415 }
1416
1417 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.filter = v.into();
1420 self
1421 }
1422
1423 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1425 self.0.request.order_by = v.into();
1426 self
1427 }
1428 }
1429
1430 #[doc(hidden)]
1431 impl gax::options::internal::RequestBuilder for ListBatches {
1432 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1433 &mut self.0.options
1434 }
1435 }
1436
1437 #[derive(Clone, Debug)]
1455 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1456
1457 impl DeleteBatch {
1458 pub(crate) fn new(
1459 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1460 ) -> Self {
1461 Self(RequestBuilder::new(stub))
1462 }
1463
1464 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1466 self.0.request = v.into();
1467 self
1468 }
1469
1470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1472 self.0.options = v.into();
1473 self
1474 }
1475
1476 pub async fn send(self) -> Result<()> {
1478 (*self.0.stub)
1479 .delete_batch(self.0.request, self.0.options)
1480 .await
1481 .map(gax::response::Response::into_body)
1482 }
1483
1484 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1488 self.0.request.name = v.into();
1489 self
1490 }
1491 }
1492
1493 #[doc(hidden)]
1494 impl gax::options::internal::RequestBuilder for DeleteBatch {
1495 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1496 &mut self.0.options
1497 }
1498 }
1499
1500 #[derive(Clone, Debug)]
1518 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1519
1520 impl SetIamPolicy {
1521 pub(crate) fn new(
1522 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1523 ) -> Self {
1524 Self(RequestBuilder::new(stub))
1525 }
1526
1527 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1529 self.0.request = v.into();
1530 self
1531 }
1532
1533 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1535 self.0.options = v.into();
1536 self
1537 }
1538
1539 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1541 (*self.0.stub)
1542 .set_iam_policy(self.0.request, self.0.options)
1543 .await
1544 .map(gax::response::Response::into_body)
1545 }
1546
1547 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1551 self.0.request.resource = v.into();
1552 self
1553 }
1554
1555 pub fn set_policy<T>(mut self, v: T) -> Self
1559 where
1560 T: std::convert::Into<iam_v1::model::Policy>,
1561 {
1562 self.0.request.policy = std::option::Option::Some(v.into());
1563 self
1564 }
1565
1566 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1570 where
1571 T: std::convert::Into<iam_v1::model::Policy>,
1572 {
1573 self.0.request.policy = v.map(|x| x.into());
1574 self
1575 }
1576
1577 pub fn set_update_mask<T>(mut self, v: T) -> Self
1579 where
1580 T: std::convert::Into<wkt::FieldMask>,
1581 {
1582 self.0.request.update_mask = std::option::Option::Some(v.into());
1583 self
1584 }
1585
1586 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1588 where
1589 T: std::convert::Into<wkt::FieldMask>,
1590 {
1591 self.0.request.update_mask = v.map(|x| x.into());
1592 self
1593 }
1594 }
1595
1596 #[doc(hidden)]
1597 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1598 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1599 &mut self.0.options
1600 }
1601 }
1602
1603 #[derive(Clone, Debug)]
1621 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1622
1623 impl GetIamPolicy {
1624 pub(crate) fn new(
1625 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1626 ) -> Self {
1627 Self(RequestBuilder::new(stub))
1628 }
1629
1630 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1632 self.0.request = v.into();
1633 self
1634 }
1635
1636 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1638 self.0.options = v.into();
1639 self
1640 }
1641
1642 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1644 (*self.0.stub)
1645 .get_iam_policy(self.0.request, self.0.options)
1646 .await
1647 .map(gax::response::Response::into_body)
1648 }
1649
1650 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.0.request.resource = v.into();
1655 self
1656 }
1657
1658 pub fn set_options<T>(mut self, v: T) -> Self
1660 where
1661 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1662 {
1663 self.0.request.options = std::option::Option::Some(v.into());
1664 self
1665 }
1666
1667 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1669 where
1670 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1671 {
1672 self.0.request.options = v.map(|x| x.into());
1673 self
1674 }
1675 }
1676
1677 #[doc(hidden)]
1678 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1679 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1680 &mut self.0.options
1681 }
1682 }
1683
1684 #[derive(Clone, Debug)]
1702 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1703
1704 impl TestIamPermissions {
1705 pub(crate) fn new(
1706 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1707 ) -> Self {
1708 Self(RequestBuilder::new(stub))
1709 }
1710
1711 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1713 mut self,
1714 v: V,
1715 ) -> Self {
1716 self.0.request = v.into();
1717 self
1718 }
1719
1720 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1722 self.0.options = v.into();
1723 self
1724 }
1725
1726 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1728 (*self.0.stub)
1729 .test_iam_permissions(self.0.request, self.0.options)
1730 .await
1731 .map(gax::response::Response::into_body)
1732 }
1733
1734 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1738 self.0.request.resource = v.into();
1739 self
1740 }
1741
1742 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1746 where
1747 T: std::iter::IntoIterator<Item = V>,
1748 V: std::convert::Into<std::string::String>,
1749 {
1750 use std::iter::Iterator;
1751 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1752 self
1753 }
1754 }
1755
1756 #[doc(hidden)]
1757 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1758 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1759 &mut self.0.options
1760 }
1761 }
1762
1763 #[derive(Clone, Debug)]
1785 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1786
1787 impl ListOperations {
1788 pub(crate) fn new(
1789 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1790 ) -> Self {
1791 Self(RequestBuilder::new(stub))
1792 }
1793
1794 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1796 mut self,
1797 v: V,
1798 ) -> Self {
1799 self.0.request = v.into();
1800 self
1801 }
1802
1803 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1805 self.0.options = v.into();
1806 self
1807 }
1808
1809 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1811 (*self.0.stub)
1812 .list_operations(self.0.request, self.0.options)
1813 .await
1814 .map(gax::response::Response::into_body)
1815 }
1816
1817 pub fn by_page(
1819 self,
1820 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1821 {
1822 use std::clone::Clone;
1823 let token = self.0.request.page_token.clone();
1824 let execute = move |token: String| {
1825 let mut builder = self.clone();
1826 builder.0.request = builder.0.request.set_page_token(token);
1827 builder.send()
1828 };
1829 gax::paginator::internal::new_paginator(token, execute)
1830 }
1831
1832 pub fn by_item(
1834 self,
1835 ) -> impl gax::paginator::ItemPaginator<
1836 longrunning::model::ListOperationsResponse,
1837 gax::error::Error,
1838 > {
1839 use gax::paginator::Paginator;
1840 self.by_page().items()
1841 }
1842
1843 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.0.request.name = v.into();
1846 self
1847 }
1848
1849 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1851 self.0.request.filter = v.into();
1852 self
1853 }
1854
1855 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1857 self.0.request.page_size = v.into();
1858 self
1859 }
1860
1861 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1863 self.0.request.page_token = v.into();
1864 self
1865 }
1866
1867 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1869 self.0.request.return_partial_success = v.into();
1870 self
1871 }
1872 }
1873
1874 #[doc(hidden)]
1875 impl gax::options::internal::RequestBuilder for ListOperations {
1876 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1877 &mut self.0.options
1878 }
1879 }
1880
1881 #[derive(Clone, Debug)]
1899 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1900
1901 impl GetOperation {
1902 pub(crate) fn new(
1903 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1904 ) -> Self {
1905 Self(RequestBuilder::new(stub))
1906 }
1907
1908 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1910 mut self,
1911 v: V,
1912 ) -> Self {
1913 self.0.request = v.into();
1914 self
1915 }
1916
1917 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1919 self.0.options = v.into();
1920 self
1921 }
1922
1923 pub async fn send(self) -> Result<longrunning::model::Operation> {
1925 (*self.0.stub)
1926 .get_operation(self.0.request, self.0.options)
1927 .await
1928 .map(gax::response::Response::into_body)
1929 }
1930
1931 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1933 self.0.request.name = v.into();
1934 self
1935 }
1936 }
1937
1938 #[doc(hidden)]
1939 impl gax::options::internal::RequestBuilder for GetOperation {
1940 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1941 &mut self.0.options
1942 }
1943 }
1944
1945 #[derive(Clone, Debug)]
1963 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1964
1965 impl DeleteOperation {
1966 pub(crate) fn new(
1967 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1968 ) -> Self {
1969 Self(RequestBuilder::new(stub))
1970 }
1971
1972 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1974 mut self,
1975 v: V,
1976 ) -> Self {
1977 self.0.request = v.into();
1978 self
1979 }
1980
1981 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1983 self.0.options = v.into();
1984 self
1985 }
1986
1987 pub async fn send(self) -> Result<()> {
1989 (*self.0.stub)
1990 .delete_operation(self.0.request, self.0.options)
1991 .await
1992 .map(gax::response::Response::into_body)
1993 }
1994
1995 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1997 self.0.request.name = v.into();
1998 self
1999 }
2000 }
2001
2002 #[doc(hidden)]
2003 impl gax::options::internal::RequestBuilder for DeleteOperation {
2004 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2005 &mut self.0.options
2006 }
2007 }
2008
2009 #[derive(Clone, Debug)]
2027 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2028
2029 impl CancelOperation {
2030 pub(crate) fn new(
2031 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2032 ) -> Self {
2033 Self(RequestBuilder::new(stub))
2034 }
2035
2036 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2038 mut self,
2039 v: V,
2040 ) -> Self {
2041 self.0.request = v.into();
2042 self
2043 }
2044
2045 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2047 self.0.options = v.into();
2048 self
2049 }
2050
2051 pub async fn send(self) -> Result<()> {
2053 (*self.0.stub)
2054 .cancel_operation(self.0.request, self.0.options)
2055 .await
2056 .map(gax::response::Response::into_body)
2057 }
2058
2059 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2061 self.0.request.name = v.into();
2062 self
2063 }
2064 }
2065
2066 #[doc(hidden)]
2067 impl gax::options::internal::RequestBuilder for CancelOperation {
2068 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2069 &mut self.0.options
2070 }
2071 }
2072}
2073
2074pub mod cluster_controller {
2075 use crate::Result;
2076
2077 pub type ClientBuilder =
2091 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2092
2093 pub(crate) mod client {
2094 use super::super::super::client::ClusterController;
2095 pub struct Factory;
2096 impl gax::client_builder::internal::ClientFactory for Factory {
2097 type Client = ClusterController;
2098 type Credentials = gaxi::options::Credentials;
2099 async fn build(
2100 self,
2101 config: gaxi::options::ClientConfig,
2102 ) -> gax::client_builder::Result<Self::Client> {
2103 Self::Client::new(config).await
2104 }
2105 }
2106 }
2107
2108 #[derive(Clone, Debug)]
2110 pub(crate) struct RequestBuilder<R: std::default::Default> {
2111 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2112 request: R,
2113 options: gax::options::RequestOptions,
2114 }
2115
2116 impl<R> RequestBuilder<R>
2117 where
2118 R: std::default::Default,
2119 {
2120 pub(crate) fn new(
2121 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2122 ) -> Self {
2123 Self {
2124 stub,
2125 request: R::default(),
2126 options: gax::options::RequestOptions::default(),
2127 }
2128 }
2129 }
2130
2131 #[derive(Clone, Debug)]
2150 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2151
2152 impl CreateCluster {
2153 pub(crate) fn new(
2154 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2155 ) -> Self {
2156 Self(RequestBuilder::new(stub))
2157 }
2158
2159 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2161 self.0.request = v.into();
2162 self
2163 }
2164
2165 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2167 self.0.options = v.into();
2168 self
2169 }
2170
2171 pub async fn send(self) -> Result<longrunning::model::Operation> {
2178 (*self.0.stub)
2179 .create_cluster(self.0.request, self.0.options)
2180 .await
2181 .map(gax::response::Response::into_body)
2182 }
2183
2184 pub fn poller(
2186 self,
2187 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2188 {
2189 type Operation = lro::internal::Operation<
2190 crate::model::Cluster,
2191 crate::model::ClusterOperationMetadata,
2192 >;
2193 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2194 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2195
2196 let stub = self.0.stub.clone();
2197 let mut options = self.0.options.clone();
2198 options.set_retry_policy(gax::retry_policy::NeverRetry);
2199 let query = move |name| {
2200 let stub = stub.clone();
2201 let options = options.clone();
2202 async {
2203 let op = GetOperation::new(stub)
2204 .set_name(name)
2205 .with_options(options)
2206 .send()
2207 .await?;
2208 Ok(Operation::new(op))
2209 }
2210 };
2211
2212 let start = move || async {
2213 let op = self.send().await?;
2214 Ok(Operation::new(op))
2215 };
2216
2217 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2218 }
2219
2220 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2224 self.0.request.project_id = v.into();
2225 self
2226 }
2227
2228 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2232 self.0.request.region = v.into();
2233 self
2234 }
2235
2236 pub fn set_cluster<T>(mut self, v: T) -> Self
2240 where
2241 T: std::convert::Into<crate::model::Cluster>,
2242 {
2243 self.0.request.cluster = std::option::Option::Some(v.into());
2244 self
2245 }
2246
2247 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2251 where
2252 T: std::convert::Into<crate::model::Cluster>,
2253 {
2254 self.0.request.cluster = v.map(|x| x.into());
2255 self
2256 }
2257
2258 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2260 self.0.request.request_id = v.into();
2261 self
2262 }
2263
2264 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2266 mut self,
2267 v: T,
2268 ) -> Self {
2269 self.0.request.action_on_failed_primary_workers = v.into();
2270 self
2271 }
2272 }
2273
2274 #[doc(hidden)]
2275 impl gax::options::internal::RequestBuilder for CreateCluster {
2276 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2277 &mut self.0.options
2278 }
2279 }
2280
2281 #[derive(Clone, Debug)]
2300 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2301
2302 impl UpdateCluster {
2303 pub(crate) fn new(
2304 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2305 ) -> Self {
2306 Self(RequestBuilder::new(stub))
2307 }
2308
2309 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2311 self.0.request = v.into();
2312 self
2313 }
2314
2315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2317 self.0.options = v.into();
2318 self
2319 }
2320
2321 pub async fn send(self) -> Result<longrunning::model::Operation> {
2328 (*self.0.stub)
2329 .update_cluster(self.0.request, self.0.options)
2330 .await
2331 .map(gax::response::Response::into_body)
2332 }
2333
2334 pub fn poller(
2336 self,
2337 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2338 {
2339 type Operation = lro::internal::Operation<
2340 crate::model::Cluster,
2341 crate::model::ClusterOperationMetadata,
2342 >;
2343 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2344 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2345
2346 let stub = self.0.stub.clone();
2347 let mut options = self.0.options.clone();
2348 options.set_retry_policy(gax::retry_policy::NeverRetry);
2349 let query = move |name| {
2350 let stub = stub.clone();
2351 let options = options.clone();
2352 async {
2353 let op = GetOperation::new(stub)
2354 .set_name(name)
2355 .with_options(options)
2356 .send()
2357 .await?;
2358 Ok(Operation::new(op))
2359 }
2360 };
2361
2362 let start = move || async {
2363 let op = self.send().await?;
2364 Ok(Operation::new(op))
2365 };
2366
2367 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2368 }
2369
2370 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2374 self.0.request.project_id = v.into();
2375 self
2376 }
2377
2378 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2382 self.0.request.region = v.into();
2383 self
2384 }
2385
2386 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2390 self.0.request.cluster_name = v.into();
2391 self
2392 }
2393
2394 pub fn set_cluster<T>(mut self, v: T) -> Self
2398 where
2399 T: std::convert::Into<crate::model::Cluster>,
2400 {
2401 self.0.request.cluster = std::option::Option::Some(v.into());
2402 self
2403 }
2404
2405 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2409 where
2410 T: std::convert::Into<crate::model::Cluster>,
2411 {
2412 self.0.request.cluster = v.map(|x| x.into());
2413 self
2414 }
2415
2416 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2418 where
2419 T: std::convert::Into<wkt::Duration>,
2420 {
2421 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2422 self
2423 }
2424
2425 pub fn set_or_clear_graceful_decommission_timeout<T>(
2427 mut self,
2428 v: std::option::Option<T>,
2429 ) -> Self
2430 where
2431 T: std::convert::Into<wkt::Duration>,
2432 {
2433 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2434 self
2435 }
2436
2437 pub fn set_update_mask<T>(mut self, v: T) -> Self
2441 where
2442 T: std::convert::Into<wkt::FieldMask>,
2443 {
2444 self.0.request.update_mask = std::option::Option::Some(v.into());
2445 self
2446 }
2447
2448 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2452 where
2453 T: std::convert::Into<wkt::FieldMask>,
2454 {
2455 self.0.request.update_mask = v.map(|x| x.into());
2456 self
2457 }
2458
2459 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2461 self.0.request.request_id = v.into();
2462 self
2463 }
2464 }
2465
2466 #[doc(hidden)]
2467 impl gax::options::internal::RequestBuilder for UpdateCluster {
2468 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2469 &mut self.0.options
2470 }
2471 }
2472
2473 #[derive(Clone, Debug)]
2492 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2493
2494 impl StopCluster {
2495 pub(crate) fn new(
2496 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2497 ) -> Self {
2498 Self(RequestBuilder::new(stub))
2499 }
2500
2501 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2503 self.0.request = v.into();
2504 self
2505 }
2506
2507 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2509 self.0.options = v.into();
2510 self
2511 }
2512
2513 pub async fn send(self) -> Result<longrunning::model::Operation> {
2520 (*self.0.stub)
2521 .stop_cluster(self.0.request, self.0.options)
2522 .await
2523 .map(gax::response::Response::into_body)
2524 }
2525
2526 pub fn poller(
2528 self,
2529 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2530 {
2531 type Operation = lro::internal::Operation<
2532 crate::model::Cluster,
2533 crate::model::ClusterOperationMetadata,
2534 >;
2535 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2536 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2537
2538 let stub = self.0.stub.clone();
2539 let mut options = self.0.options.clone();
2540 options.set_retry_policy(gax::retry_policy::NeverRetry);
2541 let query = move |name| {
2542 let stub = stub.clone();
2543 let options = options.clone();
2544 async {
2545 let op = GetOperation::new(stub)
2546 .set_name(name)
2547 .with_options(options)
2548 .send()
2549 .await?;
2550 Ok(Operation::new(op))
2551 }
2552 };
2553
2554 let start = move || async {
2555 let op = self.send().await?;
2556 Ok(Operation::new(op))
2557 };
2558
2559 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2560 }
2561
2562 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2566 self.0.request.project_id = v.into();
2567 self
2568 }
2569
2570 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2574 self.0.request.region = v.into();
2575 self
2576 }
2577
2578 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2582 self.0.request.cluster_name = v.into();
2583 self
2584 }
2585
2586 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2588 self.0.request.cluster_uuid = v.into();
2589 self
2590 }
2591
2592 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2594 self.0.request.request_id = v.into();
2595 self
2596 }
2597 }
2598
2599 #[doc(hidden)]
2600 impl gax::options::internal::RequestBuilder for StopCluster {
2601 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2602 &mut self.0.options
2603 }
2604 }
2605
2606 #[derive(Clone, Debug)]
2625 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2626
2627 impl StartCluster {
2628 pub(crate) fn new(
2629 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2630 ) -> Self {
2631 Self(RequestBuilder::new(stub))
2632 }
2633
2634 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2636 self.0.request = v.into();
2637 self
2638 }
2639
2640 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2642 self.0.options = v.into();
2643 self
2644 }
2645
2646 pub async fn send(self) -> Result<longrunning::model::Operation> {
2653 (*self.0.stub)
2654 .start_cluster(self.0.request, self.0.options)
2655 .await
2656 .map(gax::response::Response::into_body)
2657 }
2658
2659 pub fn poller(
2661 self,
2662 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2663 {
2664 type Operation = lro::internal::Operation<
2665 crate::model::Cluster,
2666 crate::model::ClusterOperationMetadata,
2667 >;
2668 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2669 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2670
2671 let stub = self.0.stub.clone();
2672 let mut options = self.0.options.clone();
2673 options.set_retry_policy(gax::retry_policy::NeverRetry);
2674 let query = move |name| {
2675 let stub = stub.clone();
2676 let options = options.clone();
2677 async {
2678 let op = GetOperation::new(stub)
2679 .set_name(name)
2680 .with_options(options)
2681 .send()
2682 .await?;
2683 Ok(Operation::new(op))
2684 }
2685 };
2686
2687 let start = move || async {
2688 let op = self.send().await?;
2689 Ok(Operation::new(op))
2690 };
2691
2692 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2693 }
2694
2695 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2699 self.0.request.project_id = v.into();
2700 self
2701 }
2702
2703 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2707 self.0.request.region = v.into();
2708 self
2709 }
2710
2711 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2715 self.0.request.cluster_name = v.into();
2716 self
2717 }
2718
2719 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2721 self.0.request.cluster_uuid = v.into();
2722 self
2723 }
2724
2725 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2727 self.0.request.request_id = v.into();
2728 self
2729 }
2730 }
2731
2732 #[doc(hidden)]
2733 impl gax::options::internal::RequestBuilder for StartCluster {
2734 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2735 &mut self.0.options
2736 }
2737 }
2738
2739 #[derive(Clone, Debug)]
2758 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2759
2760 impl DeleteCluster {
2761 pub(crate) fn new(
2762 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2763 ) -> Self {
2764 Self(RequestBuilder::new(stub))
2765 }
2766
2767 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2769 self.0.request = v.into();
2770 self
2771 }
2772
2773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2775 self.0.options = v.into();
2776 self
2777 }
2778
2779 pub async fn send(self) -> Result<longrunning::model::Operation> {
2786 (*self.0.stub)
2787 .delete_cluster(self.0.request, self.0.options)
2788 .await
2789 .map(gax::response::Response::into_body)
2790 }
2791
2792 pub fn poller(self) -> impl lro::Poller<(), crate::model::ClusterOperationMetadata> {
2794 type Operation =
2795 lro::internal::Operation<wkt::Empty, crate::model::ClusterOperationMetadata>;
2796 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2797 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2798
2799 let stub = self.0.stub.clone();
2800 let mut options = self.0.options.clone();
2801 options.set_retry_policy(gax::retry_policy::NeverRetry);
2802 let query = move |name| {
2803 let stub = stub.clone();
2804 let options = options.clone();
2805 async {
2806 let op = GetOperation::new(stub)
2807 .set_name(name)
2808 .with_options(options)
2809 .send()
2810 .await?;
2811 Ok(Operation::new(op))
2812 }
2813 };
2814
2815 let start = move || async {
2816 let op = self.send().await?;
2817 Ok(Operation::new(op))
2818 };
2819
2820 lro::internal::new_unit_response_poller(
2821 polling_error_policy,
2822 polling_backoff_policy,
2823 start,
2824 query,
2825 )
2826 }
2827
2828 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2832 self.0.request.project_id = v.into();
2833 self
2834 }
2835
2836 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2840 self.0.request.region = v.into();
2841 self
2842 }
2843
2844 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2848 self.0.request.cluster_name = v.into();
2849 self
2850 }
2851
2852 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.0.request.cluster_uuid = v.into();
2855 self
2856 }
2857
2858 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2860 self.0.request.request_id = v.into();
2861 self
2862 }
2863 }
2864
2865 #[doc(hidden)]
2866 impl gax::options::internal::RequestBuilder for DeleteCluster {
2867 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2868 &mut self.0.options
2869 }
2870 }
2871
2872 #[derive(Clone, Debug)]
2890 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2891
2892 impl GetCluster {
2893 pub(crate) fn new(
2894 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2895 ) -> Self {
2896 Self(RequestBuilder::new(stub))
2897 }
2898
2899 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2901 self.0.request = v.into();
2902 self
2903 }
2904
2905 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2907 self.0.options = v.into();
2908 self
2909 }
2910
2911 pub async fn send(self) -> Result<crate::model::Cluster> {
2913 (*self.0.stub)
2914 .get_cluster(self.0.request, self.0.options)
2915 .await
2916 .map(gax::response::Response::into_body)
2917 }
2918
2919 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2923 self.0.request.project_id = v.into();
2924 self
2925 }
2926
2927 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2931 self.0.request.region = v.into();
2932 self
2933 }
2934
2935 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2939 self.0.request.cluster_name = v.into();
2940 self
2941 }
2942 }
2943
2944 #[doc(hidden)]
2945 impl gax::options::internal::RequestBuilder for GetCluster {
2946 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2947 &mut self.0.options
2948 }
2949 }
2950
2951 #[derive(Clone, Debug)]
2973 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
2974
2975 impl ListClusters {
2976 pub(crate) fn new(
2977 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2978 ) -> Self {
2979 Self(RequestBuilder::new(stub))
2980 }
2981
2982 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
2984 self.0.request = v.into();
2985 self
2986 }
2987
2988 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2990 self.0.options = v.into();
2991 self
2992 }
2993
2994 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
2996 (*self.0.stub)
2997 .list_clusters(self.0.request, self.0.options)
2998 .await
2999 .map(gax::response::Response::into_body)
3000 }
3001
3002 pub fn by_page(
3004 self,
3005 ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
3006 {
3007 use std::clone::Clone;
3008 let token = self.0.request.page_token.clone();
3009 let execute = move |token: String| {
3010 let mut builder = self.clone();
3011 builder.0.request = builder.0.request.set_page_token(token);
3012 builder.send()
3013 };
3014 gax::paginator::internal::new_paginator(token, execute)
3015 }
3016
3017 pub fn by_item(
3019 self,
3020 ) -> impl gax::paginator::ItemPaginator<crate::model::ListClustersResponse, gax::error::Error>
3021 {
3022 use gax::paginator::Paginator;
3023 self.by_page().items()
3024 }
3025
3026 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3030 self.0.request.project_id = v.into();
3031 self
3032 }
3033
3034 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3038 self.0.request.region = v.into();
3039 self
3040 }
3041
3042 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3044 self.0.request.filter = v.into();
3045 self
3046 }
3047
3048 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3050 self.0.request.page_size = v.into();
3051 self
3052 }
3053
3054 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3056 self.0.request.page_token = v.into();
3057 self
3058 }
3059 }
3060
3061 #[doc(hidden)]
3062 impl gax::options::internal::RequestBuilder for ListClusters {
3063 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3064 &mut self.0.options
3065 }
3066 }
3067
3068 #[derive(Clone, Debug)]
3087 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3088
3089 impl DiagnoseCluster {
3090 pub(crate) fn new(
3091 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3092 ) -> Self {
3093 Self(RequestBuilder::new(stub))
3094 }
3095
3096 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3098 self.0.request = v.into();
3099 self
3100 }
3101
3102 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3104 self.0.options = v.into();
3105 self
3106 }
3107
3108 pub async fn send(self) -> Result<longrunning::model::Operation> {
3115 (*self.0.stub)
3116 .diagnose_cluster(self.0.request, self.0.options)
3117 .await
3118 .map(gax::response::Response::into_body)
3119 }
3120
3121 pub fn poller(
3123 self,
3124 ) -> impl lro::Poller<crate::model::DiagnoseClusterResults, crate::model::ClusterOperationMetadata>
3125 {
3126 type Operation = lro::internal::Operation<
3127 crate::model::DiagnoseClusterResults,
3128 crate::model::ClusterOperationMetadata,
3129 >;
3130 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3131 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3132
3133 let stub = self.0.stub.clone();
3134 let mut options = self.0.options.clone();
3135 options.set_retry_policy(gax::retry_policy::NeverRetry);
3136 let query = move |name| {
3137 let stub = stub.clone();
3138 let options = options.clone();
3139 async {
3140 let op = GetOperation::new(stub)
3141 .set_name(name)
3142 .with_options(options)
3143 .send()
3144 .await?;
3145 Ok(Operation::new(op))
3146 }
3147 };
3148
3149 let start = move || async {
3150 let op = self.send().await?;
3151 Ok(Operation::new(op))
3152 };
3153
3154 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3155 }
3156
3157 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3161 self.0.request.project_id = v.into();
3162 self
3163 }
3164
3165 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3169 self.0.request.region = v.into();
3170 self
3171 }
3172
3173 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3177 self.0.request.cluster_name = v.into();
3178 self
3179 }
3180
3181 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3183 self.0.request.tarball_gcs_dir = v.into();
3184 self
3185 }
3186
3187 pub fn set_tarball_access<
3189 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3190 >(
3191 mut self,
3192 v: T,
3193 ) -> Self {
3194 self.0.request.tarball_access = v.into();
3195 self
3196 }
3197
3198 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3200 where
3201 T: std::convert::Into<gtype::model::Interval>,
3202 {
3203 self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3204 self
3205 }
3206
3207 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3209 where
3210 T: std::convert::Into<gtype::model::Interval>,
3211 {
3212 self.0.request.diagnosis_interval = v.map(|x| x.into());
3213 self
3214 }
3215
3216 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3218 where
3219 T: std::iter::IntoIterator<Item = V>,
3220 V: std::convert::Into<std::string::String>,
3221 {
3222 use std::iter::Iterator;
3223 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3224 self
3225 }
3226
3227 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3229 where
3230 T: std::iter::IntoIterator<Item = V>,
3231 V: std::convert::Into<std::string::String>,
3232 {
3233 use std::iter::Iterator;
3234 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3235 self
3236 }
3237 }
3238
3239 #[doc(hidden)]
3240 impl gax::options::internal::RequestBuilder for DiagnoseCluster {
3241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3242 &mut self.0.options
3243 }
3244 }
3245
3246 #[derive(Clone, Debug)]
3264 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3265
3266 impl SetIamPolicy {
3267 pub(crate) fn new(
3268 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3269 ) -> Self {
3270 Self(RequestBuilder::new(stub))
3271 }
3272
3273 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3275 self.0.request = v.into();
3276 self
3277 }
3278
3279 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3281 self.0.options = v.into();
3282 self
3283 }
3284
3285 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3287 (*self.0.stub)
3288 .set_iam_policy(self.0.request, self.0.options)
3289 .await
3290 .map(gax::response::Response::into_body)
3291 }
3292
3293 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3297 self.0.request.resource = v.into();
3298 self
3299 }
3300
3301 pub fn set_policy<T>(mut self, v: T) -> Self
3305 where
3306 T: std::convert::Into<iam_v1::model::Policy>,
3307 {
3308 self.0.request.policy = std::option::Option::Some(v.into());
3309 self
3310 }
3311
3312 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3316 where
3317 T: std::convert::Into<iam_v1::model::Policy>,
3318 {
3319 self.0.request.policy = v.map(|x| x.into());
3320 self
3321 }
3322
3323 pub fn set_update_mask<T>(mut self, v: T) -> Self
3325 where
3326 T: std::convert::Into<wkt::FieldMask>,
3327 {
3328 self.0.request.update_mask = std::option::Option::Some(v.into());
3329 self
3330 }
3331
3332 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3334 where
3335 T: std::convert::Into<wkt::FieldMask>,
3336 {
3337 self.0.request.update_mask = v.map(|x| x.into());
3338 self
3339 }
3340 }
3341
3342 #[doc(hidden)]
3343 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3344 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3345 &mut self.0.options
3346 }
3347 }
3348
3349 #[derive(Clone, Debug)]
3367 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3368
3369 impl GetIamPolicy {
3370 pub(crate) fn new(
3371 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3372 ) -> Self {
3373 Self(RequestBuilder::new(stub))
3374 }
3375
3376 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3378 self.0.request = v.into();
3379 self
3380 }
3381
3382 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3384 self.0.options = v.into();
3385 self
3386 }
3387
3388 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3390 (*self.0.stub)
3391 .get_iam_policy(self.0.request, self.0.options)
3392 .await
3393 .map(gax::response::Response::into_body)
3394 }
3395
3396 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3400 self.0.request.resource = v.into();
3401 self
3402 }
3403
3404 pub fn set_options<T>(mut self, v: T) -> Self
3406 where
3407 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3408 {
3409 self.0.request.options = std::option::Option::Some(v.into());
3410 self
3411 }
3412
3413 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3415 where
3416 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3417 {
3418 self.0.request.options = v.map(|x| x.into());
3419 self
3420 }
3421 }
3422
3423 #[doc(hidden)]
3424 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3425 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3426 &mut self.0.options
3427 }
3428 }
3429
3430 #[derive(Clone, Debug)]
3448 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3449
3450 impl TestIamPermissions {
3451 pub(crate) fn new(
3452 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3453 ) -> Self {
3454 Self(RequestBuilder::new(stub))
3455 }
3456
3457 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3459 mut self,
3460 v: V,
3461 ) -> Self {
3462 self.0.request = v.into();
3463 self
3464 }
3465
3466 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3468 self.0.options = v.into();
3469 self
3470 }
3471
3472 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3474 (*self.0.stub)
3475 .test_iam_permissions(self.0.request, self.0.options)
3476 .await
3477 .map(gax::response::Response::into_body)
3478 }
3479
3480 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3484 self.0.request.resource = v.into();
3485 self
3486 }
3487
3488 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3492 where
3493 T: std::iter::IntoIterator<Item = V>,
3494 V: std::convert::Into<std::string::String>,
3495 {
3496 use std::iter::Iterator;
3497 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3498 self
3499 }
3500 }
3501
3502 #[doc(hidden)]
3503 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3505 &mut self.0.options
3506 }
3507 }
3508
3509 #[derive(Clone, Debug)]
3531 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3532
3533 impl ListOperations {
3534 pub(crate) fn new(
3535 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3536 ) -> Self {
3537 Self(RequestBuilder::new(stub))
3538 }
3539
3540 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3542 mut self,
3543 v: V,
3544 ) -> Self {
3545 self.0.request = v.into();
3546 self
3547 }
3548
3549 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3551 self.0.options = v.into();
3552 self
3553 }
3554
3555 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3557 (*self.0.stub)
3558 .list_operations(self.0.request, self.0.options)
3559 .await
3560 .map(gax::response::Response::into_body)
3561 }
3562
3563 pub fn by_page(
3565 self,
3566 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3567 {
3568 use std::clone::Clone;
3569 let token = self.0.request.page_token.clone();
3570 let execute = move |token: String| {
3571 let mut builder = self.clone();
3572 builder.0.request = builder.0.request.set_page_token(token);
3573 builder.send()
3574 };
3575 gax::paginator::internal::new_paginator(token, execute)
3576 }
3577
3578 pub fn by_item(
3580 self,
3581 ) -> impl gax::paginator::ItemPaginator<
3582 longrunning::model::ListOperationsResponse,
3583 gax::error::Error,
3584 > {
3585 use gax::paginator::Paginator;
3586 self.by_page().items()
3587 }
3588
3589 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3591 self.0.request.name = v.into();
3592 self
3593 }
3594
3595 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3597 self.0.request.filter = v.into();
3598 self
3599 }
3600
3601 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3603 self.0.request.page_size = v.into();
3604 self
3605 }
3606
3607 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3609 self.0.request.page_token = v.into();
3610 self
3611 }
3612
3613 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3615 self.0.request.return_partial_success = v.into();
3616 self
3617 }
3618 }
3619
3620 #[doc(hidden)]
3621 impl gax::options::internal::RequestBuilder for ListOperations {
3622 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3623 &mut self.0.options
3624 }
3625 }
3626
3627 #[derive(Clone, Debug)]
3645 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3646
3647 impl GetOperation {
3648 pub(crate) fn new(
3649 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3650 ) -> Self {
3651 Self(RequestBuilder::new(stub))
3652 }
3653
3654 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3656 mut self,
3657 v: V,
3658 ) -> Self {
3659 self.0.request = v.into();
3660 self
3661 }
3662
3663 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3665 self.0.options = v.into();
3666 self
3667 }
3668
3669 pub async fn send(self) -> Result<longrunning::model::Operation> {
3671 (*self.0.stub)
3672 .get_operation(self.0.request, self.0.options)
3673 .await
3674 .map(gax::response::Response::into_body)
3675 }
3676
3677 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3679 self.0.request.name = v.into();
3680 self
3681 }
3682 }
3683
3684 #[doc(hidden)]
3685 impl gax::options::internal::RequestBuilder for GetOperation {
3686 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3687 &mut self.0.options
3688 }
3689 }
3690
3691 #[derive(Clone, Debug)]
3709 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3710
3711 impl DeleteOperation {
3712 pub(crate) fn new(
3713 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3714 ) -> Self {
3715 Self(RequestBuilder::new(stub))
3716 }
3717
3718 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3720 mut self,
3721 v: V,
3722 ) -> Self {
3723 self.0.request = v.into();
3724 self
3725 }
3726
3727 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3729 self.0.options = v.into();
3730 self
3731 }
3732
3733 pub async fn send(self) -> Result<()> {
3735 (*self.0.stub)
3736 .delete_operation(self.0.request, self.0.options)
3737 .await
3738 .map(gax::response::Response::into_body)
3739 }
3740
3741 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3743 self.0.request.name = v.into();
3744 self
3745 }
3746 }
3747
3748 #[doc(hidden)]
3749 impl gax::options::internal::RequestBuilder for DeleteOperation {
3750 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3751 &mut self.0.options
3752 }
3753 }
3754
3755 #[derive(Clone, Debug)]
3773 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3774
3775 impl CancelOperation {
3776 pub(crate) fn new(
3777 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3778 ) -> Self {
3779 Self(RequestBuilder::new(stub))
3780 }
3781
3782 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3784 mut self,
3785 v: V,
3786 ) -> Self {
3787 self.0.request = v.into();
3788 self
3789 }
3790
3791 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3793 self.0.options = v.into();
3794 self
3795 }
3796
3797 pub async fn send(self) -> Result<()> {
3799 (*self.0.stub)
3800 .cancel_operation(self.0.request, self.0.options)
3801 .await
3802 .map(gax::response::Response::into_body)
3803 }
3804
3805 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3807 self.0.request.name = v.into();
3808 self
3809 }
3810 }
3811
3812 #[doc(hidden)]
3813 impl gax::options::internal::RequestBuilder for CancelOperation {
3814 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3815 &mut self.0.options
3816 }
3817 }
3818}
3819
3820pub mod job_controller {
3821 use crate::Result;
3822
3823 pub type ClientBuilder =
3837 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3838
3839 pub(crate) mod client {
3840 use super::super::super::client::JobController;
3841 pub struct Factory;
3842 impl gax::client_builder::internal::ClientFactory for Factory {
3843 type Client = JobController;
3844 type Credentials = gaxi::options::Credentials;
3845 async fn build(
3846 self,
3847 config: gaxi::options::ClientConfig,
3848 ) -> gax::client_builder::Result<Self::Client> {
3849 Self::Client::new(config).await
3850 }
3851 }
3852 }
3853
3854 #[derive(Clone, Debug)]
3856 pub(crate) struct RequestBuilder<R: std::default::Default> {
3857 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3858 request: R,
3859 options: gax::options::RequestOptions,
3860 }
3861
3862 impl<R> RequestBuilder<R>
3863 where
3864 R: std::default::Default,
3865 {
3866 pub(crate) fn new(
3867 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3868 ) -> Self {
3869 Self {
3870 stub,
3871 request: R::default(),
3872 options: gax::options::RequestOptions::default(),
3873 }
3874 }
3875 }
3876
3877 #[derive(Clone, Debug)]
3895 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
3896
3897 impl SubmitJob {
3898 pub(crate) fn new(
3899 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3900 ) -> Self {
3901 Self(RequestBuilder::new(stub))
3902 }
3903
3904 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3906 self.0.request = v.into();
3907 self
3908 }
3909
3910 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3912 self.0.options = v.into();
3913 self
3914 }
3915
3916 pub async fn send(self) -> Result<crate::model::Job> {
3918 (*self.0.stub)
3919 .submit_job(self.0.request, self.0.options)
3920 .await
3921 .map(gax::response::Response::into_body)
3922 }
3923
3924 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3928 self.0.request.project_id = v.into();
3929 self
3930 }
3931
3932 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3936 self.0.request.region = v.into();
3937 self
3938 }
3939
3940 pub fn set_job<T>(mut self, v: T) -> Self
3944 where
3945 T: std::convert::Into<crate::model::Job>,
3946 {
3947 self.0.request.job = std::option::Option::Some(v.into());
3948 self
3949 }
3950
3951 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3955 where
3956 T: std::convert::Into<crate::model::Job>,
3957 {
3958 self.0.request.job = v.map(|x| x.into());
3959 self
3960 }
3961
3962 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3964 self.0.request.request_id = v.into();
3965 self
3966 }
3967 }
3968
3969 #[doc(hidden)]
3970 impl gax::options::internal::RequestBuilder for SubmitJob {
3971 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3972 &mut self.0.options
3973 }
3974 }
3975
3976 #[derive(Clone, Debug)]
3995 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
3996
3997 impl SubmitJobAsOperation {
3998 pub(crate) fn new(
3999 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4000 ) -> Self {
4001 Self(RequestBuilder::new(stub))
4002 }
4003
4004 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
4006 self.0.request = v.into();
4007 self
4008 }
4009
4010 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4012 self.0.options = v.into();
4013 self
4014 }
4015
4016 pub async fn send(self) -> Result<longrunning::model::Operation> {
4023 (*self.0.stub)
4024 .submit_job_as_operation(self.0.request, self.0.options)
4025 .await
4026 .map(gax::response::Response::into_body)
4027 }
4028
4029 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::JobMetadata> {
4031 type Operation = lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
4032 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4033 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4034
4035 let stub = self.0.stub.clone();
4036 let mut options = self.0.options.clone();
4037 options.set_retry_policy(gax::retry_policy::NeverRetry);
4038 let query = move |name| {
4039 let stub = stub.clone();
4040 let options = options.clone();
4041 async {
4042 let op = GetOperation::new(stub)
4043 .set_name(name)
4044 .with_options(options)
4045 .send()
4046 .await?;
4047 Ok(Operation::new(op))
4048 }
4049 };
4050
4051 let start = move || async {
4052 let op = self.send().await?;
4053 Ok(Operation::new(op))
4054 };
4055
4056 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4057 }
4058
4059 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4063 self.0.request.project_id = v.into();
4064 self
4065 }
4066
4067 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4071 self.0.request.region = v.into();
4072 self
4073 }
4074
4075 pub fn set_job<T>(mut self, v: T) -> Self
4079 where
4080 T: std::convert::Into<crate::model::Job>,
4081 {
4082 self.0.request.job = std::option::Option::Some(v.into());
4083 self
4084 }
4085
4086 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4090 where
4091 T: std::convert::Into<crate::model::Job>,
4092 {
4093 self.0.request.job = v.map(|x| x.into());
4094 self
4095 }
4096
4097 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4099 self.0.request.request_id = v.into();
4100 self
4101 }
4102 }
4103
4104 #[doc(hidden)]
4105 impl gax::options::internal::RequestBuilder for SubmitJobAsOperation {
4106 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4107 &mut self.0.options
4108 }
4109 }
4110
4111 #[derive(Clone, Debug)]
4129 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4130
4131 impl GetJob {
4132 pub(crate) fn new(
4133 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4134 ) -> Self {
4135 Self(RequestBuilder::new(stub))
4136 }
4137
4138 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4140 self.0.request = v.into();
4141 self
4142 }
4143
4144 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4146 self.0.options = v.into();
4147 self
4148 }
4149
4150 pub async fn send(self) -> Result<crate::model::Job> {
4152 (*self.0.stub)
4153 .get_job(self.0.request, self.0.options)
4154 .await
4155 .map(gax::response::Response::into_body)
4156 }
4157
4158 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4162 self.0.request.project_id = v.into();
4163 self
4164 }
4165
4166 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4170 self.0.request.region = v.into();
4171 self
4172 }
4173
4174 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4178 self.0.request.job_id = v.into();
4179 self
4180 }
4181 }
4182
4183 #[doc(hidden)]
4184 impl gax::options::internal::RequestBuilder for GetJob {
4185 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4186 &mut self.0.options
4187 }
4188 }
4189
4190 #[derive(Clone, Debug)]
4212 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4213
4214 impl ListJobs {
4215 pub(crate) fn new(
4216 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4217 ) -> Self {
4218 Self(RequestBuilder::new(stub))
4219 }
4220
4221 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4223 self.0.request = v.into();
4224 self
4225 }
4226
4227 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4229 self.0.options = v.into();
4230 self
4231 }
4232
4233 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4235 (*self.0.stub)
4236 .list_jobs(self.0.request, self.0.options)
4237 .await
4238 .map(gax::response::Response::into_body)
4239 }
4240
4241 pub fn by_page(
4243 self,
4244 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
4245 {
4246 use std::clone::Clone;
4247 let token = self.0.request.page_token.clone();
4248 let execute = move |token: String| {
4249 let mut builder = self.clone();
4250 builder.0.request = builder.0.request.set_page_token(token);
4251 builder.send()
4252 };
4253 gax::paginator::internal::new_paginator(token, execute)
4254 }
4255
4256 pub fn by_item(
4258 self,
4259 ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
4260 {
4261 use gax::paginator::Paginator;
4262 self.by_page().items()
4263 }
4264
4265 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4269 self.0.request.project_id = v.into();
4270 self
4271 }
4272
4273 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4277 self.0.request.region = v.into();
4278 self
4279 }
4280
4281 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4283 self.0.request.page_size = v.into();
4284 self
4285 }
4286
4287 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4289 self.0.request.page_token = v.into();
4290 self
4291 }
4292
4293 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4295 self.0.request.cluster_name = v.into();
4296 self
4297 }
4298
4299 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4301 mut self,
4302 v: T,
4303 ) -> Self {
4304 self.0.request.job_state_matcher = v.into();
4305 self
4306 }
4307
4308 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4310 self.0.request.filter = v.into();
4311 self
4312 }
4313 }
4314
4315 #[doc(hidden)]
4316 impl gax::options::internal::RequestBuilder for ListJobs {
4317 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4318 &mut self.0.options
4319 }
4320 }
4321
4322 #[derive(Clone, Debug)]
4340 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4341
4342 impl UpdateJob {
4343 pub(crate) fn new(
4344 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4345 ) -> Self {
4346 Self(RequestBuilder::new(stub))
4347 }
4348
4349 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4351 self.0.request = v.into();
4352 self
4353 }
4354
4355 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4357 self.0.options = v.into();
4358 self
4359 }
4360
4361 pub async fn send(self) -> Result<crate::model::Job> {
4363 (*self.0.stub)
4364 .update_job(self.0.request, self.0.options)
4365 .await
4366 .map(gax::response::Response::into_body)
4367 }
4368
4369 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4373 self.0.request.project_id = v.into();
4374 self
4375 }
4376
4377 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4381 self.0.request.region = v.into();
4382 self
4383 }
4384
4385 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4389 self.0.request.job_id = v.into();
4390 self
4391 }
4392
4393 pub fn set_job<T>(mut self, v: T) -> Self
4397 where
4398 T: std::convert::Into<crate::model::Job>,
4399 {
4400 self.0.request.job = std::option::Option::Some(v.into());
4401 self
4402 }
4403
4404 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4408 where
4409 T: std::convert::Into<crate::model::Job>,
4410 {
4411 self.0.request.job = v.map(|x| x.into());
4412 self
4413 }
4414
4415 pub fn set_update_mask<T>(mut self, v: T) -> Self
4419 where
4420 T: std::convert::Into<wkt::FieldMask>,
4421 {
4422 self.0.request.update_mask = std::option::Option::Some(v.into());
4423 self
4424 }
4425
4426 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4430 where
4431 T: std::convert::Into<wkt::FieldMask>,
4432 {
4433 self.0.request.update_mask = v.map(|x| x.into());
4434 self
4435 }
4436 }
4437
4438 #[doc(hidden)]
4439 impl gax::options::internal::RequestBuilder for UpdateJob {
4440 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4441 &mut self.0.options
4442 }
4443 }
4444
4445 #[derive(Clone, Debug)]
4463 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4464
4465 impl CancelJob {
4466 pub(crate) fn new(
4467 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4468 ) -> Self {
4469 Self(RequestBuilder::new(stub))
4470 }
4471
4472 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4474 self.0.request = v.into();
4475 self
4476 }
4477
4478 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4480 self.0.options = v.into();
4481 self
4482 }
4483
4484 pub async fn send(self) -> Result<crate::model::Job> {
4486 (*self.0.stub)
4487 .cancel_job(self.0.request, self.0.options)
4488 .await
4489 .map(gax::response::Response::into_body)
4490 }
4491
4492 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4496 self.0.request.project_id = v.into();
4497 self
4498 }
4499
4500 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4504 self.0.request.region = v.into();
4505 self
4506 }
4507
4508 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4512 self.0.request.job_id = v.into();
4513 self
4514 }
4515 }
4516
4517 #[doc(hidden)]
4518 impl gax::options::internal::RequestBuilder for CancelJob {
4519 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4520 &mut self.0.options
4521 }
4522 }
4523
4524 #[derive(Clone, Debug)]
4542 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4543
4544 impl DeleteJob {
4545 pub(crate) fn new(
4546 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4547 ) -> Self {
4548 Self(RequestBuilder::new(stub))
4549 }
4550
4551 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4553 self.0.request = v.into();
4554 self
4555 }
4556
4557 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4559 self.0.options = v.into();
4560 self
4561 }
4562
4563 pub async fn send(self) -> Result<()> {
4565 (*self.0.stub)
4566 .delete_job(self.0.request, self.0.options)
4567 .await
4568 .map(gax::response::Response::into_body)
4569 }
4570
4571 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4575 self.0.request.project_id = v.into();
4576 self
4577 }
4578
4579 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4583 self.0.request.region = v.into();
4584 self
4585 }
4586
4587 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4591 self.0.request.job_id = v.into();
4592 self
4593 }
4594 }
4595
4596 #[doc(hidden)]
4597 impl gax::options::internal::RequestBuilder for DeleteJob {
4598 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4599 &mut self.0.options
4600 }
4601 }
4602
4603 #[derive(Clone, Debug)]
4621 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4622
4623 impl SetIamPolicy {
4624 pub(crate) fn new(
4625 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4626 ) -> Self {
4627 Self(RequestBuilder::new(stub))
4628 }
4629
4630 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4632 self.0.request = v.into();
4633 self
4634 }
4635
4636 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4638 self.0.options = v.into();
4639 self
4640 }
4641
4642 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4644 (*self.0.stub)
4645 .set_iam_policy(self.0.request, self.0.options)
4646 .await
4647 .map(gax::response::Response::into_body)
4648 }
4649
4650 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4654 self.0.request.resource = v.into();
4655 self
4656 }
4657
4658 pub fn set_policy<T>(mut self, v: T) -> Self
4662 where
4663 T: std::convert::Into<iam_v1::model::Policy>,
4664 {
4665 self.0.request.policy = std::option::Option::Some(v.into());
4666 self
4667 }
4668
4669 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4673 where
4674 T: std::convert::Into<iam_v1::model::Policy>,
4675 {
4676 self.0.request.policy = v.map(|x| x.into());
4677 self
4678 }
4679
4680 pub fn set_update_mask<T>(mut self, v: T) -> Self
4682 where
4683 T: std::convert::Into<wkt::FieldMask>,
4684 {
4685 self.0.request.update_mask = std::option::Option::Some(v.into());
4686 self
4687 }
4688
4689 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4691 where
4692 T: std::convert::Into<wkt::FieldMask>,
4693 {
4694 self.0.request.update_mask = v.map(|x| x.into());
4695 self
4696 }
4697 }
4698
4699 #[doc(hidden)]
4700 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4701 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4702 &mut self.0.options
4703 }
4704 }
4705
4706 #[derive(Clone, Debug)]
4724 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4725
4726 impl GetIamPolicy {
4727 pub(crate) fn new(
4728 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4729 ) -> Self {
4730 Self(RequestBuilder::new(stub))
4731 }
4732
4733 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4735 self.0.request = v.into();
4736 self
4737 }
4738
4739 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4741 self.0.options = v.into();
4742 self
4743 }
4744
4745 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4747 (*self.0.stub)
4748 .get_iam_policy(self.0.request, self.0.options)
4749 .await
4750 .map(gax::response::Response::into_body)
4751 }
4752
4753 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4757 self.0.request.resource = v.into();
4758 self
4759 }
4760
4761 pub fn set_options<T>(mut self, v: T) -> Self
4763 where
4764 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4765 {
4766 self.0.request.options = std::option::Option::Some(v.into());
4767 self
4768 }
4769
4770 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4772 where
4773 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4774 {
4775 self.0.request.options = v.map(|x| x.into());
4776 self
4777 }
4778 }
4779
4780 #[doc(hidden)]
4781 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4782 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4783 &mut self.0.options
4784 }
4785 }
4786
4787 #[derive(Clone, Debug)]
4805 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4806
4807 impl TestIamPermissions {
4808 pub(crate) fn new(
4809 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4810 ) -> Self {
4811 Self(RequestBuilder::new(stub))
4812 }
4813
4814 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4816 mut self,
4817 v: V,
4818 ) -> Self {
4819 self.0.request = v.into();
4820 self
4821 }
4822
4823 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4825 self.0.options = v.into();
4826 self
4827 }
4828
4829 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4831 (*self.0.stub)
4832 .test_iam_permissions(self.0.request, self.0.options)
4833 .await
4834 .map(gax::response::Response::into_body)
4835 }
4836
4837 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4841 self.0.request.resource = v.into();
4842 self
4843 }
4844
4845 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4849 where
4850 T: std::iter::IntoIterator<Item = V>,
4851 V: std::convert::Into<std::string::String>,
4852 {
4853 use std::iter::Iterator;
4854 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4855 self
4856 }
4857 }
4858
4859 #[doc(hidden)]
4860 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4861 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4862 &mut self.0.options
4863 }
4864 }
4865
4866 #[derive(Clone, Debug)]
4888 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4889
4890 impl ListOperations {
4891 pub(crate) fn new(
4892 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4893 ) -> Self {
4894 Self(RequestBuilder::new(stub))
4895 }
4896
4897 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4899 mut self,
4900 v: V,
4901 ) -> Self {
4902 self.0.request = v.into();
4903 self
4904 }
4905
4906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4908 self.0.options = v.into();
4909 self
4910 }
4911
4912 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4914 (*self.0.stub)
4915 .list_operations(self.0.request, self.0.options)
4916 .await
4917 .map(gax::response::Response::into_body)
4918 }
4919
4920 pub fn by_page(
4922 self,
4923 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4924 {
4925 use std::clone::Clone;
4926 let token = self.0.request.page_token.clone();
4927 let execute = move |token: String| {
4928 let mut builder = self.clone();
4929 builder.0.request = builder.0.request.set_page_token(token);
4930 builder.send()
4931 };
4932 gax::paginator::internal::new_paginator(token, execute)
4933 }
4934
4935 pub fn by_item(
4937 self,
4938 ) -> impl gax::paginator::ItemPaginator<
4939 longrunning::model::ListOperationsResponse,
4940 gax::error::Error,
4941 > {
4942 use gax::paginator::Paginator;
4943 self.by_page().items()
4944 }
4945
4946 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4948 self.0.request.name = v.into();
4949 self
4950 }
4951
4952 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4954 self.0.request.filter = v.into();
4955 self
4956 }
4957
4958 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4960 self.0.request.page_size = v.into();
4961 self
4962 }
4963
4964 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4966 self.0.request.page_token = v.into();
4967 self
4968 }
4969
4970 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4972 self.0.request.return_partial_success = v.into();
4973 self
4974 }
4975 }
4976
4977 #[doc(hidden)]
4978 impl gax::options::internal::RequestBuilder for ListOperations {
4979 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4980 &mut self.0.options
4981 }
4982 }
4983
4984 #[derive(Clone, Debug)]
5002 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5003
5004 impl GetOperation {
5005 pub(crate) fn new(
5006 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5007 ) -> Self {
5008 Self(RequestBuilder::new(stub))
5009 }
5010
5011 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5013 mut self,
5014 v: V,
5015 ) -> Self {
5016 self.0.request = v.into();
5017 self
5018 }
5019
5020 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5022 self.0.options = v.into();
5023 self
5024 }
5025
5026 pub async fn send(self) -> Result<longrunning::model::Operation> {
5028 (*self.0.stub)
5029 .get_operation(self.0.request, self.0.options)
5030 .await
5031 .map(gax::response::Response::into_body)
5032 }
5033
5034 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5036 self.0.request.name = v.into();
5037 self
5038 }
5039 }
5040
5041 #[doc(hidden)]
5042 impl gax::options::internal::RequestBuilder for GetOperation {
5043 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5044 &mut self.0.options
5045 }
5046 }
5047
5048 #[derive(Clone, Debug)]
5066 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5067
5068 impl DeleteOperation {
5069 pub(crate) fn new(
5070 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5071 ) -> Self {
5072 Self(RequestBuilder::new(stub))
5073 }
5074
5075 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5077 mut self,
5078 v: V,
5079 ) -> Self {
5080 self.0.request = v.into();
5081 self
5082 }
5083
5084 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5086 self.0.options = v.into();
5087 self
5088 }
5089
5090 pub async fn send(self) -> Result<()> {
5092 (*self.0.stub)
5093 .delete_operation(self.0.request, self.0.options)
5094 .await
5095 .map(gax::response::Response::into_body)
5096 }
5097
5098 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5100 self.0.request.name = v.into();
5101 self
5102 }
5103 }
5104
5105 #[doc(hidden)]
5106 impl gax::options::internal::RequestBuilder for DeleteOperation {
5107 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5108 &mut self.0.options
5109 }
5110 }
5111
5112 #[derive(Clone, Debug)]
5130 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5131
5132 impl CancelOperation {
5133 pub(crate) fn new(
5134 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5135 ) -> Self {
5136 Self(RequestBuilder::new(stub))
5137 }
5138
5139 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5141 mut self,
5142 v: V,
5143 ) -> Self {
5144 self.0.request = v.into();
5145 self
5146 }
5147
5148 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5150 self.0.options = v.into();
5151 self
5152 }
5153
5154 pub async fn send(self) -> Result<()> {
5156 (*self.0.stub)
5157 .cancel_operation(self.0.request, self.0.options)
5158 .await
5159 .map(gax::response::Response::into_body)
5160 }
5161
5162 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5164 self.0.request.name = v.into();
5165 self
5166 }
5167 }
5168
5169 #[doc(hidden)]
5170 impl gax::options::internal::RequestBuilder for CancelOperation {
5171 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5172 &mut self.0.options
5173 }
5174 }
5175}
5176
5177pub mod node_group_controller {
5178 use crate::Result;
5179
5180 pub type ClientBuilder =
5194 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5195
5196 pub(crate) mod client {
5197 use super::super::super::client::NodeGroupController;
5198 pub struct Factory;
5199 impl gax::client_builder::internal::ClientFactory for Factory {
5200 type Client = NodeGroupController;
5201 type Credentials = gaxi::options::Credentials;
5202 async fn build(
5203 self,
5204 config: gaxi::options::ClientConfig,
5205 ) -> gax::client_builder::Result<Self::Client> {
5206 Self::Client::new(config).await
5207 }
5208 }
5209 }
5210
5211 #[derive(Clone, Debug)]
5213 pub(crate) struct RequestBuilder<R: std::default::Default> {
5214 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5215 request: R,
5216 options: gax::options::RequestOptions,
5217 }
5218
5219 impl<R> RequestBuilder<R>
5220 where
5221 R: std::default::Default,
5222 {
5223 pub(crate) fn new(
5224 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5225 ) -> Self {
5226 Self {
5227 stub,
5228 request: R::default(),
5229 options: gax::options::RequestOptions::default(),
5230 }
5231 }
5232 }
5233
5234 #[derive(Clone, Debug)]
5253 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5254
5255 impl CreateNodeGroup {
5256 pub(crate) fn new(
5257 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5258 ) -> Self {
5259 Self(RequestBuilder::new(stub))
5260 }
5261
5262 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5264 self.0.request = v.into();
5265 self
5266 }
5267
5268 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5270 self.0.options = v.into();
5271 self
5272 }
5273
5274 pub async fn send(self) -> Result<longrunning::model::Operation> {
5281 (*self.0.stub)
5282 .create_node_group(self.0.request, self.0.options)
5283 .await
5284 .map(gax::response::Response::into_body)
5285 }
5286
5287 pub fn poller(
5289 self,
5290 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5291 {
5292 type Operation = lro::internal::Operation<
5293 crate::model::NodeGroup,
5294 crate::model::NodeGroupOperationMetadata,
5295 >;
5296 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5297 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5298
5299 let stub = self.0.stub.clone();
5300 let mut options = self.0.options.clone();
5301 options.set_retry_policy(gax::retry_policy::NeverRetry);
5302 let query = move |name| {
5303 let stub = stub.clone();
5304 let options = options.clone();
5305 async {
5306 let op = GetOperation::new(stub)
5307 .set_name(name)
5308 .with_options(options)
5309 .send()
5310 .await?;
5311 Ok(Operation::new(op))
5312 }
5313 };
5314
5315 let start = move || async {
5316 let op = self.send().await?;
5317 Ok(Operation::new(op))
5318 };
5319
5320 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5321 }
5322
5323 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5327 self.0.request.parent = v.into();
5328 self
5329 }
5330
5331 pub fn set_node_group<T>(mut self, v: T) -> Self
5335 where
5336 T: std::convert::Into<crate::model::NodeGroup>,
5337 {
5338 self.0.request.node_group = std::option::Option::Some(v.into());
5339 self
5340 }
5341
5342 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5346 where
5347 T: std::convert::Into<crate::model::NodeGroup>,
5348 {
5349 self.0.request.node_group = v.map(|x| x.into());
5350 self
5351 }
5352
5353 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5355 self.0.request.node_group_id = v.into();
5356 self
5357 }
5358
5359 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5361 self.0.request.request_id = v.into();
5362 self
5363 }
5364 }
5365
5366 #[doc(hidden)]
5367 impl gax::options::internal::RequestBuilder for CreateNodeGroup {
5368 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5369 &mut self.0.options
5370 }
5371 }
5372
5373 #[derive(Clone, Debug)]
5392 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5393
5394 impl ResizeNodeGroup {
5395 pub(crate) fn new(
5396 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5397 ) -> Self {
5398 Self(RequestBuilder::new(stub))
5399 }
5400
5401 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5403 self.0.request = v.into();
5404 self
5405 }
5406
5407 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5409 self.0.options = v.into();
5410 self
5411 }
5412
5413 pub async fn send(self) -> Result<longrunning::model::Operation> {
5420 (*self.0.stub)
5421 .resize_node_group(self.0.request, self.0.options)
5422 .await
5423 .map(gax::response::Response::into_body)
5424 }
5425
5426 pub fn poller(
5428 self,
5429 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5430 {
5431 type Operation = lro::internal::Operation<
5432 crate::model::NodeGroup,
5433 crate::model::NodeGroupOperationMetadata,
5434 >;
5435 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5436 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5437
5438 let stub = self.0.stub.clone();
5439 let mut options = self.0.options.clone();
5440 options.set_retry_policy(gax::retry_policy::NeverRetry);
5441 let query = move |name| {
5442 let stub = stub.clone();
5443 let options = options.clone();
5444 async {
5445 let op = GetOperation::new(stub)
5446 .set_name(name)
5447 .with_options(options)
5448 .send()
5449 .await?;
5450 Ok(Operation::new(op))
5451 }
5452 };
5453
5454 let start = move || async {
5455 let op = self.send().await?;
5456 Ok(Operation::new(op))
5457 };
5458
5459 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5460 }
5461
5462 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5466 self.0.request.name = v.into();
5467 self
5468 }
5469
5470 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5474 self.0.request.size = v.into();
5475 self
5476 }
5477
5478 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5480 self.0.request.request_id = v.into();
5481 self
5482 }
5483
5484 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5486 where
5487 T: std::convert::Into<wkt::Duration>,
5488 {
5489 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5490 self
5491 }
5492
5493 pub fn set_or_clear_graceful_decommission_timeout<T>(
5495 mut self,
5496 v: std::option::Option<T>,
5497 ) -> Self
5498 where
5499 T: std::convert::Into<wkt::Duration>,
5500 {
5501 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5502 self
5503 }
5504 }
5505
5506 #[doc(hidden)]
5507 impl gax::options::internal::RequestBuilder for ResizeNodeGroup {
5508 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5509 &mut self.0.options
5510 }
5511 }
5512
5513 #[derive(Clone, Debug)]
5531 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5532
5533 impl GetNodeGroup {
5534 pub(crate) fn new(
5535 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5536 ) -> Self {
5537 Self(RequestBuilder::new(stub))
5538 }
5539
5540 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5542 self.0.request = v.into();
5543 self
5544 }
5545
5546 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5548 self.0.options = v.into();
5549 self
5550 }
5551
5552 pub async fn send(self) -> Result<crate::model::NodeGroup> {
5554 (*self.0.stub)
5555 .get_node_group(self.0.request, self.0.options)
5556 .await
5557 .map(gax::response::Response::into_body)
5558 }
5559
5560 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5564 self.0.request.name = v.into();
5565 self
5566 }
5567 }
5568
5569 #[doc(hidden)]
5570 impl gax::options::internal::RequestBuilder for GetNodeGroup {
5571 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5572 &mut self.0.options
5573 }
5574 }
5575
5576 #[derive(Clone, Debug)]
5594 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5595
5596 impl SetIamPolicy {
5597 pub(crate) fn new(
5598 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5599 ) -> Self {
5600 Self(RequestBuilder::new(stub))
5601 }
5602
5603 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5605 self.0.request = v.into();
5606 self
5607 }
5608
5609 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5611 self.0.options = v.into();
5612 self
5613 }
5614
5615 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5617 (*self.0.stub)
5618 .set_iam_policy(self.0.request, self.0.options)
5619 .await
5620 .map(gax::response::Response::into_body)
5621 }
5622
5623 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5627 self.0.request.resource = v.into();
5628 self
5629 }
5630
5631 pub fn set_policy<T>(mut self, v: T) -> Self
5635 where
5636 T: std::convert::Into<iam_v1::model::Policy>,
5637 {
5638 self.0.request.policy = std::option::Option::Some(v.into());
5639 self
5640 }
5641
5642 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5646 where
5647 T: std::convert::Into<iam_v1::model::Policy>,
5648 {
5649 self.0.request.policy = v.map(|x| x.into());
5650 self
5651 }
5652
5653 pub fn set_update_mask<T>(mut self, v: T) -> Self
5655 where
5656 T: std::convert::Into<wkt::FieldMask>,
5657 {
5658 self.0.request.update_mask = std::option::Option::Some(v.into());
5659 self
5660 }
5661
5662 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5664 where
5665 T: std::convert::Into<wkt::FieldMask>,
5666 {
5667 self.0.request.update_mask = v.map(|x| x.into());
5668 self
5669 }
5670 }
5671
5672 #[doc(hidden)]
5673 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5674 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5675 &mut self.0.options
5676 }
5677 }
5678
5679 #[derive(Clone, Debug)]
5697 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5698
5699 impl GetIamPolicy {
5700 pub(crate) fn new(
5701 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5702 ) -> Self {
5703 Self(RequestBuilder::new(stub))
5704 }
5705
5706 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5708 self.0.request = v.into();
5709 self
5710 }
5711
5712 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5714 self.0.options = v.into();
5715 self
5716 }
5717
5718 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5720 (*self.0.stub)
5721 .get_iam_policy(self.0.request, self.0.options)
5722 .await
5723 .map(gax::response::Response::into_body)
5724 }
5725
5726 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5730 self.0.request.resource = v.into();
5731 self
5732 }
5733
5734 pub fn set_options<T>(mut self, v: T) -> Self
5736 where
5737 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5738 {
5739 self.0.request.options = std::option::Option::Some(v.into());
5740 self
5741 }
5742
5743 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5745 where
5746 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5747 {
5748 self.0.request.options = v.map(|x| x.into());
5749 self
5750 }
5751 }
5752
5753 #[doc(hidden)]
5754 impl gax::options::internal::RequestBuilder for GetIamPolicy {
5755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5756 &mut self.0.options
5757 }
5758 }
5759
5760 #[derive(Clone, Debug)]
5778 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5779
5780 impl TestIamPermissions {
5781 pub(crate) fn new(
5782 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5783 ) -> Self {
5784 Self(RequestBuilder::new(stub))
5785 }
5786
5787 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5789 mut self,
5790 v: V,
5791 ) -> Self {
5792 self.0.request = v.into();
5793 self
5794 }
5795
5796 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5798 self.0.options = v.into();
5799 self
5800 }
5801
5802 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5804 (*self.0.stub)
5805 .test_iam_permissions(self.0.request, self.0.options)
5806 .await
5807 .map(gax::response::Response::into_body)
5808 }
5809
5810 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5814 self.0.request.resource = v.into();
5815 self
5816 }
5817
5818 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5822 where
5823 T: std::iter::IntoIterator<Item = V>,
5824 V: std::convert::Into<std::string::String>,
5825 {
5826 use std::iter::Iterator;
5827 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5828 self
5829 }
5830 }
5831
5832 #[doc(hidden)]
5833 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5834 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5835 &mut self.0.options
5836 }
5837 }
5838
5839 #[derive(Clone, Debug)]
5861 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5862
5863 impl ListOperations {
5864 pub(crate) fn new(
5865 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5866 ) -> Self {
5867 Self(RequestBuilder::new(stub))
5868 }
5869
5870 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5872 mut self,
5873 v: V,
5874 ) -> Self {
5875 self.0.request = v.into();
5876 self
5877 }
5878
5879 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5881 self.0.options = v.into();
5882 self
5883 }
5884
5885 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5887 (*self.0.stub)
5888 .list_operations(self.0.request, self.0.options)
5889 .await
5890 .map(gax::response::Response::into_body)
5891 }
5892
5893 pub fn by_page(
5895 self,
5896 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5897 {
5898 use std::clone::Clone;
5899 let token = self.0.request.page_token.clone();
5900 let execute = move |token: String| {
5901 let mut builder = self.clone();
5902 builder.0.request = builder.0.request.set_page_token(token);
5903 builder.send()
5904 };
5905 gax::paginator::internal::new_paginator(token, execute)
5906 }
5907
5908 pub fn by_item(
5910 self,
5911 ) -> impl gax::paginator::ItemPaginator<
5912 longrunning::model::ListOperationsResponse,
5913 gax::error::Error,
5914 > {
5915 use gax::paginator::Paginator;
5916 self.by_page().items()
5917 }
5918
5919 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5921 self.0.request.name = v.into();
5922 self
5923 }
5924
5925 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5927 self.0.request.filter = v.into();
5928 self
5929 }
5930
5931 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5933 self.0.request.page_size = v.into();
5934 self
5935 }
5936
5937 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5939 self.0.request.page_token = v.into();
5940 self
5941 }
5942
5943 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5945 self.0.request.return_partial_success = v.into();
5946 self
5947 }
5948 }
5949
5950 #[doc(hidden)]
5951 impl gax::options::internal::RequestBuilder for ListOperations {
5952 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5953 &mut self.0.options
5954 }
5955 }
5956
5957 #[derive(Clone, Debug)]
5975 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5976
5977 impl GetOperation {
5978 pub(crate) fn new(
5979 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5980 ) -> Self {
5981 Self(RequestBuilder::new(stub))
5982 }
5983
5984 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5986 mut self,
5987 v: V,
5988 ) -> Self {
5989 self.0.request = v.into();
5990 self
5991 }
5992
5993 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5995 self.0.options = v.into();
5996 self
5997 }
5998
5999 pub async fn send(self) -> Result<longrunning::model::Operation> {
6001 (*self.0.stub)
6002 .get_operation(self.0.request, self.0.options)
6003 .await
6004 .map(gax::response::Response::into_body)
6005 }
6006
6007 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6009 self.0.request.name = v.into();
6010 self
6011 }
6012 }
6013
6014 #[doc(hidden)]
6015 impl gax::options::internal::RequestBuilder for GetOperation {
6016 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6017 &mut self.0.options
6018 }
6019 }
6020
6021 #[derive(Clone, Debug)]
6039 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6040
6041 impl DeleteOperation {
6042 pub(crate) fn new(
6043 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6044 ) -> Self {
6045 Self(RequestBuilder::new(stub))
6046 }
6047
6048 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6050 mut self,
6051 v: V,
6052 ) -> Self {
6053 self.0.request = v.into();
6054 self
6055 }
6056
6057 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6059 self.0.options = v.into();
6060 self
6061 }
6062
6063 pub async fn send(self) -> Result<()> {
6065 (*self.0.stub)
6066 .delete_operation(self.0.request, self.0.options)
6067 .await
6068 .map(gax::response::Response::into_body)
6069 }
6070
6071 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6073 self.0.request.name = v.into();
6074 self
6075 }
6076 }
6077
6078 #[doc(hidden)]
6079 impl gax::options::internal::RequestBuilder for DeleteOperation {
6080 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6081 &mut self.0.options
6082 }
6083 }
6084
6085 #[derive(Clone, Debug)]
6103 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6104
6105 impl CancelOperation {
6106 pub(crate) fn new(
6107 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6108 ) -> Self {
6109 Self(RequestBuilder::new(stub))
6110 }
6111
6112 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6114 mut self,
6115 v: V,
6116 ) -> Self {
6117 self.0.request = v.into();
6118 self
6119 }
6120
6121 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6123 self.0.options = v.into();
6124 self
6125 }
6126
6127 pub async fn send(self) -> Result<()> {
6129 (*self.0.stub)
6130 .cancel_operation(self.0.request, self.0.options)
6131 .await
6132 .map(gax::response::Response::into_body)
6133 }
6134
6135 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6137 self.0.request.name = v.into();
6138 self
6139 }
6140 }
6141
6142 #[doc(hidden)]
6143 impl gax::options::internal::RequestBuilder for CancelOperation {
6144 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6145 &mut self.0.options
6146 }
6147 }
6148}
6149
6150pub mod session_template_controller {
6151 use crate::Result;
6152
6153 pub type ClientBuilder =
6167 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6168
6169 pub(crate) mod client {
6170 use super::super::super::client::SessionTemplateController;
6171 pub struct Factory;
6172 impl gax::client_builder::internal::ClientFactory for Factory {
6173 type Client = SessionTemplateController;
6174 type Credentials = gaxi::options::Credentials;
6175 async fn build(
6176 self,
6177 config: gaxi::options::ClientConfig,
6178 ) -> gax::client_builder::Result<Self::Client> {
6179 Self::Client::new(config).await
6180 }
6181 }
6182 }
6183
6184 #[derive(Clone, Debug)]
6186 pub(crate) struct RequestBuilder<R: std::default::Default> {
6187 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6188 request: R,
6189 options: gax::options::RequestOptions,
6190 }
6191
6192 impl<R> RequestBuilder<R>
6193 where
6194 R: std::default::Default,
6195 {
6196 pub(crate) fn new(
6197 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6198 ) -> Self {
6199 Self {
6200 stub,
6201 request: R::default(),
6202 options: gax::options::RequestOptions::default(),
6203 }
6204 }
6205 }
6206
6207 #[derive(Clone, Debug)]
6225 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6226
6227 impl CreateSessionTemplate {
6228 pub(crate) fn new(
6229 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6230 ) -> Self {
6231 Self(RequestBuilder::new(stub))
6232 }
6233
6234 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6236 mut self,
6237 v: V,
6238 ) -> Self {
6239 self.0.request = v.into();
6240 self
6241 }
6242
6243 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6245 self.0.options = v.into();
6246 self
6247 }
6248
6249 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6251 (*self.0.stub)
6252 .create_session_template(self.0.request, self.0.options)
6253 .await
6254 .map(gax::response::Response::into_body)
6255 }
6256
6257 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6261 self.0.request.parent = v.into();
6262 self
6263 }
6264
6265 pub fn set_session_template<T>(mut self, v: T) -> Self
6269 where
6270 T: std::convert::Into<crate::model::SessionTemplate>,
6271 {
6272 self.0.request.session_template = std::option::Option::Some(v.into());
6273 self
6274 }
6275
6276 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6280 where
6281 T: std::convert::Into<crate::model::SessionTemplate>,
6282 {
6283 self.0.request.session_template = v.map(|x| x.into());
6284 self
6285 }
6286 }
6287
6288 #[doc(hidden)]
6289 impl gax::options::internal::RequestBuilder for CreateSessionTemplate {
6290 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6291 &mut self.0.options
6292 }
6293 }
6294
6295 #[derive(Clone, Debug)]
6313 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6314
6315 impl UpdateSessionTemplate {
6316 pub(crate) fn new(
6317 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6318 ) -> Self {
6319 Self(RequestBuilder::new(stub))
6320 }
6321
6322 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6324 mut self,
6325 v: V,
6326 ) -> Self {
6327 self.0.request = v.into();
6328 self
6329 }
6330
6331 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6333 self.0.options = v.into();
6334 self
6335 }
6336
6337 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6339 (*self.0.stub)
6340 .update_session_template(self.0.request, self.0.options)
6341 .await
6342 .map(gax::response::Response::into_body)
6343 }
6344
6345 pub fn set_session_template<T>(mut self, v: T) -> Self
6349 where
6350 T: std::convert::Into<crate::model::SessionTemplate>,
6351 {
6352 self.0.request.session_template = std::option::Option::Some(v.into());
6353 self
6354 }
6355
6356 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6360 where
6361 T: std::convert::Into<crate::model::SessionTemplate>,
6362 {
6363 self.0.request.session_template = v.map(|x| x.into());
6364 self
6365 }
6366 }
6367
6368 #[doc(hidden)]
6369 impl gax::options::internal::RequestBuilder for UpdateSessionTemplate {
6370 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6371 &mut self.0.options
6372 }
6373 }
6374
6375 #[derive(Clone, Debug)]
6393 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6394
6395 impl GetSessionTemplate {
6396 pub(crate) fn new(
6397 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6398 ) -> Self {
6399 Self(RequestBuilder::new(stub))
6400 }
6401
6402 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6404 mut self,
6405 v: V,
6406 ) -> Self {
6407 self.0.request = v.into();
6408 self
6409 }
6410
6411 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6413 self.0.options = v.into();
6414 self
6415 }
6416
6417 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6419 (*self.0.stub)
6420 .get_session_template(self.0.request, self.0.options)
6421 .await
6422 .map(gax::response::Response::into_body)
6423 }
6424
6425 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6429 self.0.request.name = v.into();
6430 self
6431 }
6432 }
6433
6434 #[doc(hidden)]
6435 impl gax::options::internal::RequestBuilder for GetSessionTemplate {
6436 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6437 &mut self.0.options
6438 }
6439 }
6440
6441 #[derive(Clone, Debug)]
6463 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6464
6465 impl ListSessionTemplates {
6466 pub(crate) fn new(
6467 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6468 ) -> Self {
6469 Self(RequestBuilder::new(stub))
6470 }
6471
6472 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6474 mut self,
6475 v: V,
6476 ) -> Self {
6477 self.0.request = v.into();
6478 self
6479 }
6480
6481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6483 self.0.options = v.into();
6484 self
6485 }
6486
6487 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6489 (*self.0.stub)
6490 .list_session_templates(self.0.request, self.0.options)
6491 .await
6492 .map(gax::response::Response::into_body)
6493 }
6494
6495 pub fn by_page(
6497 self,
6498 ) -> impl gax::paginator::Paginator<crate::model::ListSessionTemplatesResponse, gax::error::Error>
6499 {
6500 use std::clone::Clone;
6501 let token = self.0.request.page_token.clone();
6502 let execute = move |token: String| {
6503 let mut builder = self.clone();
6504 builder.0.request = builder.0.request.set_page_token(token);
6505 builder.send()
6506 };
6507 gax::paginator::internal::new_paginator(token, execute)
6508 }
6509
6510 pub fn by_item(
6512 self,
6513 ) -> impl gax::paginator::ItemPaginator<
6514 crate::model::ListSessionTemplatesResponse,
6515 gax::error::Error,
6516 > {
6517 use gax::paginator::Paginator;
6518 self.by_page().items()
6519 }
6520
6521 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6525 self.0.request.parent = v.into();
6526 self
6527 }
6528
6529 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6531 self.0.request.page_size = v.into();
6532 self
6533 }
6534
6535 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6537 self.0.request.page_token = v.into();
6538 self
6539 }
6540
6541 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6543 self.0.request.filter = v.into();
6544 self
6545 }
6546 }
6547
6548 #[doc(hidden)]
6549 impl gax::options::internal::RequestBuilder for ListSessionTemplates {
6550 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6551 &mut self.0.options
6552 }
6553 }
6554
6555 #[derive(Clone, Debug)]
6573 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6574
6575 impl DeleteSessionTemplate {
6576 pub(crate) fn new(
6577 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6578 ) -> Self {
6579 Self(RequestBuilder::new(stub))
6580 }
6581
6582 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6584 mut self,
6585 v: V,
6586 ) -> Self {
6587 self.0.request = v.into();
6588 self
6589 }
6590
6591 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6593 self.0.options = v.into();
6594 self
6595 }
6596
6597 pub async fn send(self) -> Result<()> {
6599 (*self.0.stub)
6600 .delete_session_template(self.0.request, self.0.options)
6601 .await
6602 .map(gax::response::Response::into_body)
6603 }
6604
6605 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6609 self.0.request.name = v.into();
6610 self
6611 }
6612 }
6613
6614 #[doc(hidden)]
6615 impl gax::options::internal::RequestBuilder for DeleteSessionTemplate {
6616 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6617 &mut self.0.options
6618 }
6619 }
6620
6621 #[derive(Clone, Debug)]
6639 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6640
6641 impl SetIamPolicy {
6642 pub(crate) fn new(
6643 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6644 ) -> Self {
6645 Self(RequestBuilder::new(stub))
6646 }
6647
6648 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6650 self.0.request = v.into();
6651 self
6652 }
6653
6654 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6656 self.0.options = v.into();
6657 self
6658 }
6659
6660 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6662 (*self.0.stub)
6663 .set_iam_policy(self.0.request, self.0.options)
6664 .await
6665 .map(gax::response::Response::into_body)
6666 }
6667
6668 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6672 self.0.request.resource = v.into();
6673 self
6674 }
6675
6676 pub fn set_policy<T>(mut self, v: T) -> Self
6680 where
6681 T: std::convert::Into<iam_v1::model::Policy>,
6682 {
6683 self.0.request.policy = std::option::Option::Some(v.into());
6684 self
6685 }
6686
6687 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6691 where
6692 T: std::convert::Into<iam_v1::model::Policy>,
6693 {
6694 self.0.request.policy = v.map(|x| x.into());
6695 self
6696 }
6697
6698 pub fn set_update_mask<T>(mut self, v: T) -> Self
6700 where
6701 T: std::convert::Into<wkt::FieldMask>,
6702 {
6703 self.0.request.update_mask = std::option::Option::Some(v.into());
6704 self
6705 }
6706
6707 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6709 where
6710 T: std::convert::Into<wkt::FieldMask>,
6711 {
6712 self.0.request.update_mask = v.map(|x| x.into());
6713 self
6714 }
6715 }
6716
6717 #[doc(hidden)]
6718 impl gax::options::internal::RequestBuilder for SetIamPolicy {
6719 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6720 &mut self.0.options
6721 }
6722 }
6723
6724 #[derive(Clone, Debug)]
6742 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6743
6744 impl GetIamPolicy {
6745 pub(crate) fn new(
6746 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6747 ) -> Self {
6748 Self(RequestBuilder::new(stub))
6749 }
6750
6751 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6753 self.0.request = v.into();
6754 self
6755 }
6756
6757 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6759 self.0.options = v.into();
6760 self
6761 }
6762
6763 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6765 (*self.0.stub)
6766 .get_iam_policy(self.0.request, self.0.options)
6767 .await
6768 .map(gax::response::Response::into_body)
6769 }
6770
6771 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6775 self.0.request.resource = v.into();
6776 self
6777 }
6778
6779 pub fn set_options<T>(mut self, v: T) -> Self
6781 where
6782 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6783 {
6784 self.0.request.options = std::option::Option::Some(v.into());
6785 self
6786 }
6787
6788 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6790 where
6791 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6792 {
6793 self.0.request.options = v.map(|x| x.into());
6794 self
6795 }
6796 }
6797
6798 #[doc(hidden)]
6799 impl gax::options::internal::RequestBuilder for GetIamPolicy {
6800 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6801 &mut self.0.options
6802 }
6803 }
6804
6805 #[derive(Clone, Debug)]
6823 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6824
6825 impl TestIamPermissions {
6826 pub(crate) fn new(
6827 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6828 ) -> Self {
6829 Self(RequestBuilder::new(stub))
6830 }
6831
6832 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6834 mut self,
6835 v: V,
6836 ) -> Self {
6837 self.0.request = v.into();
6838 self
6839 }
6840
6841 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6843 self.0.options = v.into();
6844 self
6845 }
6846
6847 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6849 (*self.0.stub)
6850 .test_iam_permissions(self.0.request, self.0.options)
6851 .await
6852 .map(gax::response::Response::into_body)
6853 }
6854
6855 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6859 self.0.request.resource = v.into();
6860 self
6861 }
6862
6863 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6867 where
6868 T: std::iter::IntoIterator<Item = V>,
6869 V: std::convert::Into<std::string::String>,
6870 {
6871 use std::iter::Iterator;
6872 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6873 self
6874 }
6875 }
6876
6877 #[doc(hidden)]
6878 impl gax::options::internal::RequestBuilder for TestIamPermissions {
6879 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6880 &mut self.0.options
6881 }
6882 }
6883
6884 #[derive(Clone, Debug)]
6906 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6907
6908 impl ListOperations {
6909 pub(crate) fn new(
6910 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6911 ) -> Self {
6912 Self(RequestBuilder::new(stub))
6913 }
6914
6915 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6917 mut self,
6918 v: V,
6919 ) -> Self {
6920 self.0.request = v.into();
6921 self
6922 }
6923
6924 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6926 self.0.options = v.into();
6927 self
6928 }
6929
6930 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6932 (*self.0.stub)
6933 .list_operations(self.0.request, self.0.options)
6934 .await
6935 .map(gax::response::Response::into_body)
6936 }
6937
6938 pub fn by_page(
6940 self,
6941 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6942 {
6943 use std::clone::Clone;
6944 let token = self.0.request.page_token.clone();
6945 let execute = move |token: String| {
6946 let mut builder = self.clone();
6947 builder.0.request = builder.0.request.set_page_token(token);
6948 builder.send()
6949 };
6950 gax::paginator::internal::new_paginator(token, execute)
6951 }
6952
6953 pub fn by_item(
6955 self,
6956 ) -> impl gax::paginator::ItemPaginator<
6957 longrunning::model::ListOperationsResponse,
6958 gax::error::Error,
6959 > {
6960 use gax::paginator::Paginator;
6961 self.by_page().items()
6962 }
6963
6964 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6966 self.0.request.name = v.into();
6967 self
6968 }
6969
6970 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6972 self.0.request.filter = v.into();
6973 self
6974 }
6975
6976 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6978 self.0.request.page_size = v.into();
6979 self
6980 }
6981
6982 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6984 self.0.request.page_token = v.into();
6985 self
6986 }
6987
6988 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6990 self.0.request.return_partial_success = v.into();
6991 self
6992 }
6993 }
6994
6995 #[doc(hidden)]
6996 impl gax::options::internal::RequestBuilder for ListOperations {
6997 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6998 &mut self.0.options
6999 }
7000 }
7001
7002 #[derive(Clone, Debug)]
7020 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7021
7022 impl GetOperation {
7023 pub(crate) fn new(
7024 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7025 ) -> Self {
7026 Self(RequestBuilder::new(stub))
7027 }
7028
7029 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7031 mut self,
7032 v: V,
7033 ) -> Self {
7034 self.0.request = v.into();
7035 self
7036 }
7037
7038 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7040 self.0.options = v.into();
7041 self
7042 }
7043
7044 pub async fn send(self) -> Result<longrunning::model::Operation> {
7046 (*self.0.stub)
7047 .get_operation(self.0.request, self.0.options)
7048 .await
7049 .map(gax::response::Response::into_body)
7050 }
7051
7052 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7054 self.0.request.name = v.into();
7055 self
7056 }
7057 }
7058
7059 #[doc(hidden)]
7060 impl gax::options::internal::RequestBuilder for GetOperation {
7061 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7062 &mut self.0.options
7063 }
7064 }
7065
7066 #[derive(Clone, Debug)]
7084 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7085
7086 impl DeleteOperation {
7087 pub(crate) fn new(
7088 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7089 ) -> Self {
7090 Self(RequestBuilder::new(stub))
7091 }
7092
7093 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7095 mut self,
7096 v: V,
7097 ) -> Self {
7098 self.0.request = v.into();
7099 self
7100 }
7101
7102 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7104 self.0.options = v.into();
7105 self
7106 }
7107
7108 pub async fn send(self) -> Result<()> {
7110 (*self.0.stub)
7111 .delete_operation(self.0.request, self.0.options)
7112 .await
7113 .map(gax::response::Response::into_body)
7114 }
7115
7116 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7118 self.0.request.name = v.into();
7119 self
7120 }
7121 }
7122
7123 #[doc(hidden)]
7124 impl gax::options::internal::RequestBuilder for DeleteOperation {
7125 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7126 &mut self.0.options
7127 }
7128 }
7129
7130 #[derive(Clone, Debug)]
7148 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7149
7150 impl CancelOperation {
7151 pub(crate) fn new(
7152 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7153 ) -> Self {
7154 Self(RequestBuilder::new(stub))
7155 }
7156
7157 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7159 mut self,
7160 v: V,
7161 ) -> Self {
7162 self.0.request = v.into();
7163 self
7164 }
7165
7166 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7168 self.0.options = v.into();
7169 self
7170 }
7171
7172 pub async fn send(self) -> Result<()> {
7174 (*self.0.stub)
7175 .cancel_operation(self.0.request, self.0.options)
7176 .await
7177 .map(gax::response::Response::into_body)
7178 }
7179
7180 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7182 self.0.request.name = v.into();
7183 self
7184 }
7185 }
7186
7187 #[doc(hidden)]
7188 impl gax::options::internal::RequestBuilder for CancelOperation {
7189 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7190 &mut self.0.options
7191 }
7192 }
7193}
7194
7195pub mod session_controller {
7196 use crate::Result;
7197
7198 pub type ClientBuilder =
7212 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7213
7214 pub(crate) mod client {
7215 use super::super::super::client::SessionController;
7216 pub struct Factory;
7217 impl gax::client_builder::internal::ClientFactory for Factory {
7218 type Client = SessionController;
7219 type Credentials = gaxi::options::Credentials;
7220 async fn build(
7221 self,
7222 config: gaxi::options::ClientConfig,
7223 ) -> gax::client_builder::Result<Self::Client> {
7224 Self::Client::new(config).await
7225 }
7226 }
7227 }
7228
7229 #[derive(Clone, Debug)]
7231 pub(crate) struct RequestBuilder<R: std::default::Default> {
7232 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7233 request: R,
7234 options: gax::options::RequestOptions,
7235 }
7236
7237 impl<R> RequestBuilder<R>
7238 where
7239 R: std::default::Default,
7240 {
7241 pub(crate) fn new(
7242 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7243 ) -> Self {
7244 Self {
7245 stub,
7246 request: R::default(),
7247 options: gax::options::RequestOptions::default(),
7248 }
7249 }
7250 }
7251
7252 #[derive(Clone, Debug)]
7271 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7272
7273 impl CreateSession {
7274 pub(crate) fn new(
7275 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7276 ) -> Self {
7277 Self(RequestBuilder::new(stub))
7278 }
7279
7280 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7282 self.0.request = v.into();
7283 self
7284 }
7285
7286 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7288 self.0.options = v.into();
7289 self
7290 }
7291
7292 pub async fn send(self) -> Result<longrunning::model::Operation> {
7299 (*self.0.stub)
7300 .create_session(self.0.request, self.0.options)
7301 .await
7302 .map(gax::response::Response::into_body)
7303 }
7304
7305 pub fn poller(
7307 self,
7308 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7309 {
7310 type Operation = lro::internal::Operation<
7311 crate::model::Session,
7312 crate::model::SessionOperationMetadata,
7313 >;
7314 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7315 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7316
7317 let stub = self.0.stub.clone();
7318 let mut options = self.0.options.clone();
7319 options.set_retry_policy(gax::retry_policy::NeverRetry);
7320 let query = move |name| {
7321 let stub = stub.clone();
7322 let options = options.clone();
7323 async {
7324 let op = GetOperation::new(stub)
7325 .set_name(name)
7326 .with_options(options)
7327 .send()
7328 .await?;
7329 Ok(Operation::new(op))
7330 }
7331 };
7332
7333 let start = move || async {
7334 let op = self.send().await?;
7335 Ok(Operation::new(op))
7336 };
7337
7338 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7339 }
7340
7341 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7345 self.0.request.parent = v.into();
7346 self
7347 }
7348
7349 pub fn set_session<T>(mut self, v: T) -> Self
7353 where
7354 T: std::convert::Into<crate::model::Session>,
7355 {
7356 self.0.request.session = std::option::Option::Some(v.into());
7357 self
7358 }
7359
7360 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7364 where
7365 T: std::convert::Into<crate::model::Session>,
7366 {
7367 self.0.request.session = v.map(|x| x.into());
7368 self
7369 }
7370
7371 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7375 self.0.request.session_id = v.into();
7376 self
7377 }
7378
7379 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7381 self.0.request.request_id = v.into();
7382 self
7383 }
7384 }
7385
7386 #[doc(hidden)]
7387 impl gax::options::internal::RequestBuilder for CreateSession {
7388 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7389 &mut self.0.options
7390 }
7391 }
7392
7393 #[derive(Clone, Debug)]
7411 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7412
7413 impl GetSession {
7414 pub(crate) fn new(
7415 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7416 ) -> Self {
7417 Self(RequestBuilder::new(stub))
7418 }
7419
7420 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7422 self.0.request = v.into();
7423 self
7424 }
7425
7426 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7428 self.0.options = v.into();
7429 self
7430 }
7431
7432 pub async fn send(self) -> Result<crate::model::Session> {
7434 (*self.0.stub)
7435 .get_session(self.0.request, self.0.options)
7436 .await
7437 .map(gax::response::Response::into_body)
7438 }
7439
7440 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7444 self.0.request.name = v.into();
7445 self
7446 }
7447 }
7448
7449 #[doc(hidden)]
7450 impl gax::options::internal::RequestBuilder for GetSession {
7451 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7452 &mut self.0.options
7453 }
7454 }
7455
7456 #[derive(Clone, Debug)]
7478 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7479
7480 impl ListSessions {
7481 pub(crate) fn new(
7482 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7483 ) -> Self {
7484 Self(RequestBuilder::new(stub))
7485 }
7486
7487 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7489 self.0.request = v.into();
7490 self
7491 }
7492
7493 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7495 self.0.options = v.into();
7496 self
7497 }
7498
7499 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7501 (*self.0.stub)
7502 .list_sessions(self.0.request, self.0.options)
7503 .await
7504 .map(gax::response::Response::into_body)
7505 }
7506
7507 pub fn by_page(
7509 self,
7510 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
7511 {
7512 use std::clone::Clone;
7513 let token = self.0.request.page_token.clone();
7514 let execute = move |token: String| {
7515 let mut builder = self.clone();
7516 builder.0.request = builder.0.request.set_page_token(token);
7517 builder.send()
7518 };
7519 gax::paginator::internal::new_paginator(token, execute)
7520 }
7521
7522 pub fn by_item(
7524 self,
7525 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
7526 {
7527 use gax::paginator::Paginator;
7528 self.by_page().items()
7529 }
7530
7531 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7535 self.0.request.parent = v.into();
7536 self
7537 }
7538
7539 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7541 self.0.request.page_size = v.into();
7542 self
7543 }
7544
7545 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7547 self.0.request.page_token = v.into();
7548 self
7549 }
7550
7551 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7553 self.0.request.filter = v.into();
7554 self
7555 }
7556 }
7557
7558 #[doc(hidden)]
7559 impl gax::options::internal::RequestBuilder for ListSessions {
7560 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7561 &mut self.0.options
7562 }
7563 }
7564
7565 #[derive(Clone, Debug)]
7584 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7585
7586 impl TerminateSession {
7587 pub(crate) fn new(
7588 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7589 ) -> Self {
7590 Self(RequestBuilder::new(stub))
7591 }
7592
7593 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7595 mut self,
7596 v: V,
7597 ) -> Self {
7598 self.0.request = v.into();
7599 self
7600 }
7601
7602 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7604 self.0.options = v.into();
7605 self
7606 }
7607
7608 pub async fn send(self) -> Result<longrunning::model::Operation> {
7615 (*self.0.stub)
7616 .terminate_session(self.0.request, self.0.options)
7617 .await
7618 .map(gax::response::Response::into_body)
7619 }
7620
7621 pub fn poller(
7623 self,
7624 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7625 {
7626 type Operation = lro::internal::Operation<
7627 crate::model::Session,
7628 crate::model::SessionOperationMetadata,
7629 >;
7630 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7631 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7632
7633 let stub = self.0.stub.clone();
7634 let mut options = self.0.options.clone();
7635 options.set_retry_policy(gax::retry_policy::NeverRetry);
7636 let query = move |name| {
7637 let stub = stub.clone();
7638 let options = options.clone();
7639 async {
7640 let op = GetOperation::new(stub)
7641 .set_name(name)
7642 .with_options(options)
7643 .send()
7644 .await?;
7645 Ok(Operation::new(op))
7646 }
7647 };
7648
7649 let start = move || async {
7650 let op = self.send().await?;
7651 Ok(Operation::new(op))
7652 };
7653
7654 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7655 }
7656
7657 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7661 self.0.request.name = v.into();
7662 self
7663 }
7664
7665 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7667 self.0.request.request_id = v.into();
7668 self
7669 }
7670 }
7671
7672 #[doc(hidden)]
7673 impl gax::options::internal::RequestBuilder for TerminateSession {
7674 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7675 &mut self.0.options
7676 }
7677 }
7678
7679 #[derive(Clone, Debug)]
7698 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7699
7700 impl DeleteSession {
7701 pub(crate) fn new(
7702 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7703 ) -> Self {
7704 Self(RequestBuilder::new(stub))
7705 }
7706
7707 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7709 self.0.request = v.into();
7710 self
7711 }
7712
7713 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7715 self.0.options = v.into();
7716 self
7717 }
7718
7719 pub async fn send(self) -> Result<longrunning::model::Operation> {
7726 (*self.0.stub)
7727 .delete_session(self.0.request, self.0.options)
7728 .await
7729 .map(gax::response::Response::into_body)
7730 }
7731
7732 pub fn poller(
7734 self,
7735 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7736 {
7737 type Operation = lro::internal::Operation<
7738 crate::model::Session,
7739 crate::model::SessionOperationMetadata,
7740 >;
7741 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7742 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7743
7744 let stub = self.0.stub.clone();
7745 let mut options = self.0.options.clone();
7746 options.set_retry_policy(gax::retry_policy::NeverRetry);
7747 let query = move |name| {
7748 let stub = stub.clone();
7749 let options = options.clone();
7750 async {
7751 let op = GetOperation::new(stub)
7752 .set_name(name)
7753 .with_options(options)
7754 .send()
7755 .await?;
7756 Ok(Operation::new(op))
7757 }
7758 };
7759
7760 let start = move || async {
7761 let op = self.send().await?;
7762 Ok(Operation::new(op))
7763 };
7764
7765 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7766 }
7767
7768 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7772 self.0.request.name = v.into();
7773 self
7774 }
7775
7776 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7778 self.0.request.request_id = v.into();
7779 self
7780 }
7781 }
7782
7783 #[doc(hidden)]
7784 impl gax::options::internal::RequestBuilder for DeleteSession {
7785 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7786 &mut self.0.options
7787 }
7788 }
7789
7790 #[derive(Clone, Debug)]
7808 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
7809
7810 impl SetIamPolicy {
7811 pub(crate) fn new(
7812 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7813 ) -> Self {
7814 Self(RequestBuilder::new(stub))
7815 }
7816
7817 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
7819 self.0.request = v.into();
7820 self
7821 }
7822
7823 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7825 self.0.options = v.into();
7826 self
7827 }
7828
7829 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7831 (*self.0.stub)
7832 .set_iam_policy(self.0.request, self.0.options)
7833 .await
7834 .map(gax::response::Response::into_body)
7835 }
7836
7837 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7841 self.0.request.resource = v.into();
7842 self
7843 }
7844
7845 pub fn set_policy<T>(mut self, v: T) -> Self
7849 where
7850 T: std::convert::Into<iam_v1::model::Policy>,
7851 {
7852 self.0.request.policy = std::option::Option::Some(v.into());
7853 self
7854 }
7855
7856 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7860 where
7861 T: std::convert::Into<iam_v1::model::Policy>,
7862 {
7863 self.0.request.policy = v.map(|x| x.into());
7864 self
7865 }
7866
7867 pub fn set_update_mask<T>(mut self, v: T) -> Self
7869 where
7870 T: std::convert::Into<wkt::FieldMask>,
7871 {
7872 self.0.request.update_mask = std::option::Option::Some(v.into());
7873 self
7874 }
7875
7876 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7878 where
7879 T: std::convert::Into<wkt::FieldMask>,
7880 {
7881 self.0.request.update_mask = v.map(|x| x.into());
7882 self
7883 }
7884 }
7885
7886 #[doc(hidden)]
7887 impl gax::options::internal::RequestBuilder for SetIamPolicy {
7888 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7889 &mut self.0.options
7890 }
7891 }
7892
7893 #[derive(Clone, Debug)]
7911 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
7912
7913 impl GetIamPolicy {
7914 pub(crate) fn new(
7915 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7916 ) -> Self {
7917 Self(RequestBuilder::new(stub))
7918 }
7919
7920 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
7922 self.0.request = v.into();
7923 self
7924 }
7925
7926 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7928 self.0.options = v.into();
7929 self
7930 }
7931
7932 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7934 (*self.0.stub)
7935 .get_iam_policy(self.0.request, self.0.options)
7936 .await
7937 .map(gax::response::Response::into_body)
7938 }
7939
7940 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7944 self.0.request.resource = v.into();
7945 self
7946 }
7947
7948 pub fn set_options<T>(mut self, v: T) -> Self
7950 where
7951 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7952 {
7953 self.0.request.options = std::option::Option::Some(v.into());
7954 self
7955 }
7956
7957 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7959 where
7960 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7961 {
7962 self.0.request.options = v.map(|x| x.into());
7963 self
7964 }
7965 }
7966
7967 #[doc(hidden)]
7968 impl gax::options::internal::RequestBuilder for GetIamPolicy {
7969 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7970 &mut self.0.options
7971 }
7972 }
7973
7974 #[derive(Clone, Debug)]
7992 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
7993
7994 impl TestIamPermissions {
7995 pub(crate) fn new(
7996 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7997 ) -> Self {
7998 Self(RequestBuilder::new(stub))
7999 }
8000
8001 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
8003 mut self,
8004 v: V,
8005 ) -> Self {
8006 self.0.request = v.into();
8007 self
8008 }
8009
8010 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8012 self.0.options = v.into();
8013 self
8014 }
8015
8016 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
8018 (*self.0.stub)
8019 .test_iam_permissions(self.0.request, self.0.options)
8020 .await
8021 .map(gax::response::Response::into_body)
8022 }
8023
8024 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8028 self.0.request.resource = v.into();
8029 self
8030 }
8031
8032 pub fn set_permissions<T, V>(mut self, v: T) -> Self
8036 where
8037 T: std::iter::IntoIterator<Item = V>,
8038 V: std::convert::Into<std::string::String>,
8039 {
8040 use std::iter::Iterator;
8041 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8042 self
8043 }
8044 }
8045
8046 #[doc(hidden)]
8047 impl gax::options::internal::RequestBuilder for TestIamPermissions {
8048 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8049 &mut self.0.options
8050 }
8051 }
8052
8053 #[derive(Clone, Debug)]
8075 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8076
8077 impl ListOperations {
8078 pub(crate) fn new(
8079 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8080 ) -> Self {
8081 Self(RequestBuilder::new(stub))
8082 }
8083
8084 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8086 mut self,
8087 v: V,
8088 ) -> Self {
8089 self.0.request = v.into();
8090 self
8091 }
8092
8093 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8095 self.0.options = v.into();
8096 self
8097 }
8098
8099 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8101 (*self.0.stub)
8102 .list_operations(self.0.request, self.0.options)
8103 .await
8104 .map(gax::response::Response::into_body)
8105 }
8106
8107 pub fn by_page(
8109 self,
8110 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8111 {
8112 use std::clone::Clone;
8113 let token = self.0.request.page_token.clone();
8114 let execute = move |token: String| {
8115 let mut builder = self.clone();
8116 builder.0.request = builder.0.request.set_page_token(token);
8117 builder.send()
8118 };
8119 gax::paginator::internal::new_paginator(token, execute)
8120 }
8121
8122 pub fn by_item(
8124 self,
8125 ) -> impl gax::paginator::ItemPaginator<
8126 longrunning::model::ListOperationsResponse,
8127 gax::error::Error,
8128 > {
8129 use gax::paginator::Paginator;
8130 self.by_page().items()
8131 }
8132
8133 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8135 self.0.request.name = v.into();
8136 self
8137 }
8138
8139 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8141 self.0.request.filter = v.into();
8142 self
8143 }
8144
8145 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8147 self.0.request.page_size = v.into();
8148 self
8149 }
8150
8151 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8153 self.0.request.page_token = v.into();
8154 self
8155 }
8156
8157 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8159 self.0.request.return_partial_success = v.into();
8160 self
8161 }
8162 }
8163
8164 #[doc(hidden)]
8165 impl gax::options::internal::RequestBuilder for ListOperations {
8166 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8167 &mut self.0.options
8168 }
8169 }
8170
8171 #[derive(Clone, Debug)]
8189 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8190
8191 impl GetOperation {
8192 pub(crate) fn new(
8193 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8194 ) -> Self {
8195 Self(RequestBuilder::new(stub))
8196 }
8197
8198 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8200 mut self,
8201 v: V,
8202 ) -> Self {
8203 self.0.request = v.into();
8204 self
8205 }
8206
8207 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8209 self.0.options = v.into();
8210 self
8211 }
8212
8213 pub async fn send(self) -> Result<longrunning::model::Operation> {
8215 (*self.0.stub)
8216 .get_operation(self.0.request, self.0.options)
8217 .await
8218 .map(gax::response::Response::into_body)
8219 }
8220
8221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8223 self.0.request.name = v.into();
8224 self
8225 }
8226 }
8227
8228 #[doc(hidden)]
8229 impl gax::options::internal::RequestBuilder for GetOperation {
8230 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8231 &mut self.0.options
8232 }
8233 }
8234
8235 #[derive(Clone, Debug)]
8253 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
8254
8255 impl DeleteOperation {
8256 pub(crate) fn new(
8257 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8258 ) -> Self {
8259 Self(RequestBuilder::new(stub))
8260 }
8261
8262 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
8264 mut self,
8265 v: V,
8266 ) -> Self {
8267 self.0.request = v.into();
8268 self
8269 }
8270
8271 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8273 self.0.options = v.into();
8274 self
8275 }
8276
8277 pub async fn send(self) -> Result<()> {
8279 (*self.0.stub)
8280 .delete_operation(self.0.request, self.0.options)
8281 .await
8282 .map(gax::response::Response::into_body)
8283 }
8284
8285 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8287 self.0.request.name = v.into();
8288 self
8289 }
8290 }
8291
8292 #[doc(hidden)]
8293 impl gax::options::internal::RequestBuilder for DeleteOperation {
8294 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8295 &mut self.0.options
8296 }
8297 }
8298
8299 #[derive(Clone, Debug)]
8317 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8318
8319 impl CancelOperation {
8320 pub(crate) fn new(
8321 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8322 ) -> Self {
8323 Self(RequestBuilder::new(stub))
8324 }
8325
8326 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8328 mut self,
8329 v: V,
8330 ) -> Self {
8331 self.0.request = v.into();
8332 self
8333 }
8334
8335 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8337 self.0.options = v.into();
8338 self
8339 }
8340
8341 pub async fn send(self) -> Result<()> {
8343 (*self.0.stub)
8344 .cancel_operation(self.0.request, self.0.options)
8345 .await
8346 .map(gax::response::Response::into_body)
8347 }
8348
8349 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8351 self.0.request.name = v.into();
8352 self
8353 }
8354 }
8355
8356 #[doc(hidden)]
8357 impl gax::options::internal::RequestBuilder for CancelOperation {
8358 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8359 &mut self.0.options
8360 }
8361 }
8362}
8363
8364pub mod workflow_template_service {
8365 use crate::Result;
8366
8367 pub type ClientBuilder =
8381 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8382
8383 pub(crate) mod client {
8384 use super::super::super::client::WorkflowTemplateService;
8385 pub struct Factory;
8386 impl gax::client_builder::internal::ClientFactory for Factory {
8387 type Client = WorkflowTemplateService;
8388 type Credentials = gaxi::options::Credentials;
8389 async fn build(
8390 self,
8391 config: gaxi::options::ClientConfig,
8392 ) -> gax::client_builder::Result<Self::Client> {
8393 Self::Client::new(config).await
8394 }
8395 }
8396 }
8397
8398 #[derive(Clone, Debug)]
8400 pub(crate) struct RequestBuilder<R: std::default::Default> {
8401 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8402 request: R,
8403 options: gax::options::RequestOptions,
8404 }
8405
8406 impl<R> RequestBuilder<R>
8407 where
8408 R: std::default::Default,
8409 {
8410 pub(crate) fn new(
8411 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8412 ) -> Self {
8413 Self {
8414 stub,
8415 request: R::default(),
8416 options: gax::options::RequestOptions::default(),
8417 }
8418 }
8419 }
8420
8421 #[derive(Clone, Debug)]
8439 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8440
8441 impl CreateWorkflowTemplate {
8442 pub(crate) fn new(
8443 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8444 ) -> Self {
8445 Self(RequestBuilder::new(stub))
8446 }
8447
8448 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8450 mut self,
8451 v: V,
8452 ) -> Self {
8453 self.0.request = v.into();
8454 self
8455 }
8456
8457 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8459 self.0.options = v.into();
8460 self
8461 }
8462
8463 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8465 (*self.0.stub)
8466 .create_workflow_template(self.0.request, self.0.options)
8467 .await
8468 .map(gax::response::Response::into_body)
8469 }
8470
8471 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8475 self.0.request.parent = v.into();
8476 self
8477 }
8478
8479 pub fn set_template<T>(mut self, v: T) -> Self
8483 where
8484 T: std::convert::Into<crate::model::WorkflowTemplate>,
8485 {
8486 self.0.request.template = std::option::Option::Some(v.into());
8487 self
8488 }
8489
8490 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8494 where
8495 T: std::convert::Into<crate::model::WorkflowTemplate>,
8496 {
8497 self.0.request.template = v.map(|x| x.into());
8498 self
8499 }
8500 }
8501
8502 #[doc(hidden)]
8503 impl gax::options::internal::RequestBuilder for CreateWorkflowTemplate {
8504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8505 &mut self.0.options
8506 }
8507 }
8508
8509 #[derive(Clone, Debug)]
8527 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8528
8529 impl GetWorkflowTemplate {
8530 pub(crate) fn new(
8531 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8532 ) -> Self {
8533 Self(RequestBuilder::new(stub))
8534 }
8535
8536 pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
8538 mut self,
8539 v: V,
8540 ) -> Self {
8541 self.0.request = v.into();
8542 self
8543 }
8544
8545 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8547 self.0.options = v.into();
8548 self
8549 }
8550
8551 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8553 (*self.0.stub)
8554 .get_workflow_template(self.0.request, self.0.options)
8555 .await
8556 .map(gax::response::Response::into_body)
8557 }
8558
8559 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8563 self.0.request.name = v.into();
8564 self
8565 }
8566
8567 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8569 self.0.request.version = v.into();
8570 self
8571 }
8572 }
8573
8574 #[doc(hidden)]
8575 impl gax::options::internal::RequestBuilder for GetWorkflowTemplate {
8576 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8577 &mut self.0.options
8578 }
8579 }
8580
8581 #[derive(Clone, Debug)]
8600 pub struct InstantiateWorkflowTemplate(
8601 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8602 );
8603
8604 impl InstantiateWorkflowTemplate {
8605 pub(crate) fn new(
8606 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8607 ) -> Self {
8608 Self(RequestBuilder::new(stub))
8609 }
8610
8611 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8613 mut self,
8614 v: V,
8615 ) -> Self {
8616 self.0.request = v.into();
8617 self
8618 }
8619
8620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8622 self.0.options = v.into();
8623 self
8624 }
8625
8626 pub async fn send(self) -> Result<longrunning::model::Operation> {
8633 (*self.0.stub)
8634 .instantiate_workflow_template(self.0.request, self.0.options)
8635 .await
8636 .map(gax::response::Response::into_body)
8637 }
8638
8639 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8641 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8642 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8643 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8644
8645 let stub = self.0.stub.clone();
8646 let mut options = self.0.options.clone();
8647 options.set_retry_policy(gax::retry_policy::NeverRetry);
8648 let query = move |name| {
8649 let stub = stub.clone();
8650 let options = options.clone();
8651 async {
8652 let op = GetOperation::new(stub)
8653 .set_name(name)
8654 .with_options(options)
8655 .send()
8656 .await?;
8657 Ok(Operation::new(op))
8658 }
8659 };
8660
8661 let start = move || async {
8662 let op = self.send().await?;
8663 Ok(Operation::new(op))
8664 };
8665
8666 lro::internal::new_unit_response_poller(
8667 polling_error_policy,
8668 polling_backoff_policy,
8669 start,
8670 query,
8671 )
8672 }
8673
8674 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8678 self.0.request.name = v.into();
8679 self
8680 }
8681
8682 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8684 self.0.request.version = v.into();
8685 self
8686 }
8687
8688 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8690 self.0.request.request_id = v.into();
8691 self
8692 }
8693
8694 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8696 where
8697 T: std::iter::IntoIterator<Item = (K, V)>,
8698 K: std::convert::Into<std::string::String>,
8699 V: std::convert::Into<std::string::String>,
8700 {
8701 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8702 self
8703 }
8704 }
8705
8706 #[doc(hidden)]
8707 impl gax::options::internal::RequestBuilder for InstantiateWorkflowTemplate {
8708 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8709 &mut self.0.options
8710 }
8711 }
8712
8713 #[derive(Clone, Debug)]
8732 pub struct InstantiateInlineWorkflowTemplate(
8733 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8734 );
8735
8736 impl InstantiateInlineWorkflowTemplate {
8737 pub(crate) fn new(
8738 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8739 ) -> Self {
8740 Self(RequestBuilder::new(stub))
8741 }
8742
8743 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8745 mut self,
8746 v: V,
8747 ) -> Self {
8748 self.0.request = v.into();
8749 self
8750 }
8751
8752 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8754 self.0.options = v.into();
8755 self
8756 }
8757
8758 pub async fn send(self) -> Result<longrunning::model::Operation> {
8765 (*self.0.stub)
8766 .instantiate_inline_workflow_template(self.0.request, self.0.options)
8767 .await
8768 .map(gax::response::Response::into_body)
8769 }
8770
8771 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8773 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8774 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8775 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8776
8777 let stub = self.0.stub.clone();
8778 let mut options = self.0.options.clone();
8779 options.set_retry_policy(gax::retry_policy::NeverRetry);
8780 let query = move |name| {
8781 let stub = stub.clone();
8782 let options = options.clone();
8783 async {
8784 let op = GetOperation::new(stub)
8785 .set_name(name)
8786 .with_options(options)
8787 .send()
8788 .await?;
8789 Ok(Operation::new(op))
8790 }
8791 };
8792
8793 let start = move || async {
8794 let op = self.send().await?;
8795 Ok(Operation::new(op))
8796 };
8797
8798 lro::internal::new_unit_response_poller(
8799 polling_error_policy,
8800 polling_backoff_policy,
8801 start,
8802 query,
8803 )
8804 }
8805
8806 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8810 self.0.request.parent = v.into();
8811 self
8812 }
8813
8814 pub fn set_template<T>(mut self, v: T) -> Self
8818 where
8819 T: std::convert::Into<crate::model::WorkflowTemplate>,
8820 {
8821 self.0.request.template = std::option::Option::Some(v.into());
8822 self
8823 }
8824
8825 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8829 where
8830 T: std::convert::Into<crate::model::WorkflowTemplate>,
8831 {
8832 self.0.request.template = v.map(|x| x.into());
8833 self
8834 }
8835
8836 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8838 self.0.request.request_id = v.into();
8839 self
8840 }
8841 }
8842
8843 #[doc(hidden)]
8844 impl gax::options::internal::RequestBuilder for InstantiateInlineWorkflowTemplate {
8845 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8846 &mut self.0.options
8847 }
8848 }
8849
8850 #[derive(Clone, Debug)]
8868 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
8869
8870 impl UpdateWorkflowTemplate {
8871 pub(crate) fn new(
8872 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8873 ) -> Self {
8874 Self(RequestBuilder::new(stub))
8875 }
8876
8877 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
8879 mut self,
8880 v: V,
8881 ) -> Self {
8882 self.0.request = v.into();
8883 self
8884 }
8885
8886 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8888 self.0.options = v.into();
8889 self
8890 }
8891
8892 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8894 (*self.0.stub)
8895 .update_workflow_template(self.0.request, self.0.options)
8896 .await
8897 .map(gax::response::Response::into_body)
8898 }
8899
8900 pub fn set_template<T>(mut self, v: T) -> Self
8904 where
8905 T: std::convert::Into<crate::model::WorkflowTemplate>,
8906 {
8907 self.0.request.template = std::option::Option::Some(v.into());
8908 self
8909 }
8910
8911 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8915 where
8916 T: std::convert::Into<crate::model::WorkflowTemplate>,
8917 {
8918 self.0.request.template = v.map(|x| x.into());
8919 self
8920 }
8921 }
8922
8923 #[doc(hidden)]
8924 impl gax::options::internal::RequestBuilder for UpdateWorkflowTemplate {
8925 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8926 &mut self.0.options
8927 }
8928 }
8929
8930 #[derive(Clone, Debug)]
8952 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
8953
8954 impl ListWorkflowTemplates {
8955 pub(crate) fn new(
8956 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8957 ) -> Self {
8958 Self(RequestBuilder::new(stub))
8959 }
8960
8961 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
8963 mut self,
8964 v: V,
8965 ) -> Self {
8966 self.0.request = v.into();
8967 self
8968 }
8969
8970 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8972 self.0.options = v.into();
8973 self
8974 }
8975
8976 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
8978 (*self.0.stub)
8979 .list_workflow_templates(self.0.request, self.0.options)
8980 .await
8981 .map(gax::response::Response::into_body)
8982 }
8983
8984 pub fn by_page(
8986 self,
8987 ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowTemplatesResponse, gax::error::Error>
8988 {
8989 use std::clone::Clone;
8990 let token = self.0.request.page_token.clone();
8991 let execute = move |token: String| {
8992 let mut builder = self.clone();
8993 builder.0.request = builder.0.request.set_page_token(token);
8994 builder.send()
8995 };
8996 gax::paginator::internal::new_paginator(token, execute)
8997 }
8998
8999 pub fn by_item(
9001 self,
9002 ) -> impl gax::paginator::ItemPaginator<
9003 crate::model::ListWorkflowTemplatesResponse,
9004 gax::error::Error,
9005 > {
9006 use gax::paginator::Paginator;
9007 self.by_page().items()
9008 }
9009
9010 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9014 self.0.request.parent = v.into();
9015 self
9016 }
9017
9018 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9020 self.0.request.page_size = v.into();
9021 self
9022 }
9023
9024 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9026 self.0.request.page_token = v.into();
9027 self
9028 }
9029 }
9030
9031 #[doc(hidden)]
9032 impl gax::options::internal::RequestBuilder for ListWorkflowTemplates {
9033 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9034 &mut self.0.options
9035 }
9036 }
9037
9038 #[derive(Clone, Debug)]
9056 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
9057
9058 impl DeleteWorkflowTemplate {
9059 pub(crate) fn new(
9060 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9061 ) -> Self {
9062 Self(RequestBuilder::new(stub))
9063 }
9064
9065 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
9067 mut self,
9068 v: V,
9069 ) -> Self {
9070 self.0.request = v.into();
9071 self
9072 }
9073
9074 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9076 self.0.options = v.into();
9077 self
9078 }
9079
9080 pub async fn send(self) -> Result<()> {
9082 (*self.0.stub)
9083 .delete_workflow_template(self.0.request, self.0.options)
9084 .await
9085 .map(gax::response::Response::into_body)
9086 }
9087
9088 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9092 self.0.request.name = v.into();
9093 self
9094 }
9095
9096 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9098 self.0.request.version = v.into();
9099 self
9100 }
9101 }
9102
9103 #[doc(hidden)]
9104 impl gax::options::internal::RequestBuilder for DeleteWorkflowTemplate {
9105 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9106 &mut self.0.options
9107 }
9108 }
9109
9110 #[derive(Clone, Debug)]
9128 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
9129
9130 impl SetIamPolicy {
9131 pub(crate) fn new(
9132 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9133 ) -> Self {
9134 Self(RequestBuilder::new(stub))
9135 }
9136
9137 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
9139 self.0.request = v.into();
9140 self
9141 }
9142
9143 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9145 self.0.options = v.into();
9146 self
9147 }
9148
9149 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9151 (*self.0.stub)
9152 .set_iam_policy(self.0.request, self.0.options)
9153 .await
9154 .map(gax::response::Response::into_body)
9155 }
9156
9157 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9161 self.0.request.resource = v.into();
9162 self
9163 }
9164
9165 pub fn set_policy<T>(mut self, v: T) -> Self
9169 where
9170 T: std::convert::Into<iam_v1::model::Policy>,
9171 {
9172 self.0.request.policy = std::option::Option::Some(v.into());
9173 self
9174 }
9175
9176 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9180 where
9181 T: std::convert::Into<iam_v1::model::Policy>,
9182 {
9183 self.0.request.policy = v.map(|x| x.into());
9184 self
9185 }
9186
9187 pub fn set_update_mask<T>(mut self, v: T) -> Self
9189 where
9190 T: std::convert::Into<wkt::FieldMask>,
9191 {
9192 self.0.request.update_mask = std::option::Option::Some(v.into());
9193 self
9194 }
9195
9196 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9198 where
9199 T: std::convert::Into<wkt::FieldMask>,
9200 {
9201 self.0.request.update_mask = v.map(|x| x.into());
9202 self
9203 }
9204 }
9205
9206 #[doc(hidden)]
9207 impl gax::options::internal::RequestBuilder for SetIamPolicy {
9208 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9209 &mut self.0.options
9210 }
9211 }
9212
9213 #[derive(Clone, Debug)]
9231 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
9232
9233 impl GetIamPolicy {
9234 pub(crate) fn new(
9235 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9236 ) -> Self {
9237 Self(RequestBuilder::new(stub))
9238 }
9239
9240 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
9242 self.0.request = v.into();
9243 self
9244 }
9245
9246 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9248 self.0.options = v.into();
9249 self
9250 }
9251
9252 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9254 (*self.0.stub)
9255 .get_iam_policy(self.0.request, self.0.options)
9256 .await
9257 .map(gax::response::Response::into_body)
9258 }
9259
9260 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9264 self.0.request.resource = v.into();
9265 self
9266 }
9267
9268 pub fn set_options<T>(mut self, v: T) -> Self
9270 where
9271 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9272 {
9273 self.0.request.options = std::option::Option::Some(v.into());
9274 self
9275 }
9276
9277 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9279 where
9280 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9281 {
9282 self.0.request.options = v.map(|x| x.into());
9283 self
9284 }
9285 }
9286
9287 #[doc(hidden)]
9288 impl gax::options::internal::RequestBuilder for GetIamPolicy {
9289 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9290 &mut self.0.options
9291 }
9292 }
9293
9294 #[derive(Clone, Debug)]
9312 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
9313
9314 impl TestIamPermissions {
9315 pub(crate) fn new(
9316 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9317 ) -> Self {
9318 Self(RequestBuilder::new(stub))
9319 }
9320
9321 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
9323 mut self,
9324 v: V,
9325 ) -> Self {
9326 self.0.request = v.into();
9327 self
9328 }
9329
9330 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9332 self.0.options = v.into();
9333 self
9334 }
9335
9336 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
9338 (*self.0.stub)
9339 .test_iam_permissions(self.0.request, self.0.options)
9340 .await
9341 .map(gax::response::Response::into_body)
9342 }
9343
9344 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9348 self.0.request.resource = v.into();
9349 self
9350 }
9351
9352 pub fn set_permissions<T, V>(mut self, v: T) -> Self
9356 where
9357 T: std::iter::IntoIterator<Item = V>,
9358 V: std::convert::Into<std::string::String>,
9359 {
9360 use std::iter::Iterator;
9361 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9362 self
9363 }
9364 }
9365
9366 #[doc(hidden)]
9367 impl gax::options::internal::RequestBuilder for TestIamPermissions {
9368 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9369 &mut self.0.options
9370 }
9371 }
9372
9373 #[derive(Clone, Debug)]
9395 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9396
9397 impl ListOperations {
9398 pub(crate) fn new(
9399 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9400 ) -> Self {
9401 Self(RequestBuilder::new(stub))
9402 }
9403
9404 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9406 mut self,
9407 v: V,
9408 ) -> Self {
9409 self.0.request = v.into();
9410 self
9411 }
9412
9413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9415 self.0.options = v.into();
9416 self
9417 }
9418
9419 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9421 (*self.0.stub)
9422 .list_operations(self.0.request, self.0.options)
9423 .await
9424 .map(gax::response::Response::into_body)
9425 }
9426
9427 pub fn by_page(
9429 self,
9430 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9431 {
9432 use std::clone::Clone;
9433 let token = self.0.request.page_token.clone();
9434 let execute = move |token: String| {
9435 let mut builder = self.clone();
9436 builder.0.request = builder.0.request.set_page_token(token);
9437 builder.send()
9438 };
9439 gax::paginator::internal::new_paginator(token, execute)
9440 }
9441
9442 pub fn by_item(
9444 self,
9445 ) -> impl gax::paginator::ItemPaginator<
9446 longrunning::model::ListOperationsResponse,
9447 gax::error::Error,
9448 > {
9449 use gax::paginator::Paginator;
9450 self.by_page().items()
9451 }
9452
9453 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9455 self.0.request.name = v.into();
9456 self
9457 }
9458
9459 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9461 self.0.request.filter = v.into();
9462 self
9463 }
9464
9465 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9467 self.0.request.page_size = v.into();
9468 self
9469 }
9470
9471 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9473 self.0.request.page_token = v.into();
9474 self
9475 }
9476
9477 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9479 self.0.request.return_partial_success = v.into();
9480 self
9481 }
9482 }
9483
9484 #[doc(hidden)]
9485 impl gax::options::internal::RequestBuilder for ListOperations {
9486 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9487 &mut self.0.options
9488 }
9489 }
9490
9491 #[derive(Clone, Debug)]
9509 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9510
9511 impl GetOperation {
9512 pub(crate) fn new(
9513 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9514 ) -> Self {
9515 Self(RequestBuilder::new(stub))
9516 }
9517
9518 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9520 mut self,
9521 v: V,
9522 ) -> Self {
9523 self.0.request = v.into();
9524 self
9525 }
9526
9527 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9529 self.0.options = v.into();
9530 self
9531 }
9532
9533 pub async fn send(self) -> Result<longrunning::model::Operation> {
9535 (*self.0.stub)
9536 .get_operation(self.0.request, self.0.options)
9537 .await
9538 .map(gax::response::Response::into_body)
9539 }
9540
9541 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9543 self.0.request.name = v.into();
9544 self
9545 }
9546 }
9547
9548 #[doc(hidden)]
9549 impl gax::options::internal::RequestBuilder for GetOperation {
9550 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9551 &mut self.0.options
9552 }
9553 }
9554
9555 #[derive(Clone, Debug)]
9573 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
9574
9575 impl DeleteOperation {
9576 pub(crate) fn new(
9577 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9578 ) -> Self {
9579 Self(RequestBuilder::new(stub))
9580 }
9581
9582 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
9584 mut self,
9585 v: V,
9586 ) -> Self {
9587 self.0.request = v.into();
9588 self
9589 }
9590
9591 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9593 self.0.options = v.into();
9594 self
9595 }
9596
9597 pub async fn send(self) -> Result<()> {
9599 (*self.0.stub)
9600 .delete_operation(self.0.request, self.0.options)
9601 .await
9602 .map(gax::response::Response::into_body)
9603 }
9604
9605 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9607 self.0.request.name = v.into();
9608 self
9609 }
9610 }
9611
9612 #[doc(hidden)]
9613 impl gax::options::internal::RequestBuilder for DeleteOperation {
9614 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9615 &mut self.0.options
9616 }
9617 }
9618
9619 #[derive(Clone, Debug)]
9637 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9638
9639 impl CancelOperation {
9640 pub(crate) fn new(
9641 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9642 ) -> Self {
9643 Self(RequestBuilder::new(stub))
9644 }
9645
9646 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9648 mut self,
9649 v: V,
9650 ) -> Self {
9651 self.0.request = v.into();
9652 self
9653 }
9654
9655 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9657 self.0.options = v.into();
9658 self
9659 }
9660
9661 pub async fn send(self) -> Result<()> {
9663 (*self.0.stub)
9664 .cancel_operation(self.0.request, self.0.options)
9665 .await
9666 .map(gax::response::Response::into_body)
9667 }
9668
9669 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9671 self.0.request.name = v.into();
9672 self
9673 }
9674 }
9675
9676 #[doc(hidden)]
9677 impl gax::options::internal::RequestBuilder for CancelOperation {
9678 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9679 &mut self.0.options
9680 }
9681 }
9682}