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)]
91 pub struct CreateAutoscalingPolicy(
92 RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
93 );
94
95 impl CreateAutoscalingPolicy {
96 pub(crate) fn new(
97 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
98 ) -> Self {
99 Self(RequestBuilder::new(stub))
100 }
101
102 pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
104 mut self,
105 v: V,
106 ) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
119 (*self.0.stub)
120 .create_autoscaling_policy(self.0.request, self.0.options)
121 .await
122 .map(gax::response::Response::into_body)
123 }
124
125 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
129 self.0.request.parent = v.into();
130 self
131 }
132
133 pub fn set_policy<T>(mut self, v: T) -> Self
137 where
138 T: std::convert::Into<crate::model::AutoscalingPolicy>,
139 {
140 self.0.request.policy = std::option::Option::Some(v.into());
141 self
142 }
143
144 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
148 where
149 T: std::convert::Into<crate::model::AutoscalingPolicy>,
150 {
151 self.0.request.policy = v.map(|x| x.into());
152 self
153 }
154 }
155
156 #[doc(hidden)]
157 impl gax::options::internal::RequestBuilder for CreateAutoscalingPolicy {
158 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
159 &mut self.0.options
160 }
161 }
162
163 #[derive(Clone, Debug)]
180 pub struct UpdateAutoscalingPolicy(
181 RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
182 );
183
184 impl UpdateAutoscalingPolicy {
185 pub(crate) fn new(
186 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
187 ) -> Self {
188 Self(RequestBuilder::new(stub))
189 }
190
191 pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
193 mut self,
194 v: V,
195 ) -> Self {
196 self.0.request = v.into();
197 self
198 }
199
200 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
202 self.0.options = v.into();
203 self
204 }
205
206 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
208 (*self.0.stub)
209 .update_autoscaling_policy(self.0.request, self.0.options)
210 .await
211 .map(gax::response::Response::into_body)
212 }
213
214 pub fn set_policy<T>(mut self, v: T) -> Self
218 where
219 T: std::convert::Into<crate::model::AutoscalingPolicy>,
220 {
221 self.0.request.policy = std::option::Option::Some(v.into());
222 self
223 }
224
225 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
229 where
230 T: std::convert::Into<crate::model::AutoscalingPolicy>,
231 {
232 self.0.request.policy = v.map(|x| x.into());
233 self
234 }
235 }
236
237 #[doc(hidden)]
238 impl gax::options::internal::RequestBuilder for UpdateAutoscalingPolicy {
239 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
240 &mut self.0.options
241 }
242 }
243
244 #[derive(Clone, Debug)]
261 pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
262
263 impl GetAutoscalingPolicy {
264 pub(crate) fn new(
265 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
266 ) -> Self {
267 Self(RequestBuilder::new(stub))
268 }
269
270 pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
272 mut self,
273 v: V,
274 ) -> Self {
275 self.0.request = v.into();
276 self
277 }
278
279 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
281 self.0.options = v.into();
282 self
283 }
284
285 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
287 (*self.0.stub)
288 .get_autoscaling_policy(self.0.request, self.0.options)
289 .await
290 .map(gax::response::Response::into_body)
291 }
292
293 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
297 self.0.request.name = v.into();
298 self
299 }
300 }
301
302 #[doc(hidden)]
303 impl gax::options::internal::RequestBuilder for GetAutoscalingPolicy {
304 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
305 &mut self.0.options
306 }
307 }
308
309 #[derive(Clone, Debug)]
330 pub struct ListAutoscalingPolicies(
331 RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
332 );
333
334 impl ListAutoscalingPolicies {
335 pub(crate) fn new(
336 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
337 ) -> Self {
338 Self(RequestBuilder::new(stub))
339 }
340
341 pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
343 mut self,
344 v: V,
345 ) -> Self {
346 self.0.request = v.into();
347 self
348 }
349
350 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
352 self.0.options = v.into();
353 self
354 }
355
356 pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
358 (*self.0.stub)
359 .list_autoscaling_policies(self.0.request, self.0.options)
360 .await
361 .map(gax::response::Response::into_body)
362 }
363
364 pub fn by_page(
366 self,
367 ) -> impl gax::paginator::Paginator<
368 crate::model::ListAutoscalingPoliciesResponse,
369 gax::error::Error,
370 > {
371 use std::clone::Clone;
372 let token = self.0.request.page_token.clone();
373 let execute = move |token: String| {
374 let mut builder = self.clone();
375 builder.0.request = builder.0.request.set_page_token(token);
376 builder.send()
377 };
378 gax::paginator::internal::new_paginator(token, execute)
379 }
380
381 pub fn by_item(
383 self,
384 ) -> impl gax::paginator::ItemPaginator<
385 crate::model::ListAutoscalingPoliciesResponse,
386 gax::error::Error,
387 > {
388 use gax::paginator::Paginator;
389 self.by_page().items()
390 }
391
392 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
396 self.0.request.parent = v.into();
397 self
398 }
399
400 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
402 self.0.request.page_size = v.into();
403 self
404 }
405
406 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
408 self.0.request.page_token = v.into();
409 self
410 }
411 }
412
413 #[doc(hidden)]
414 impl gax::options::internal::RequestBuilder for ListAutoscalingPolicies {
415 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
416 &mut self.0.options
417 }
418 }
419
420 #[derive(Clone, Debug)]
437 pub struct DeleteAutoscalingPolicy(
438 RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
439 );
440
441 impl DeleteAutoscalingPolicy {
442 pub(crate) fn new(
443 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
444 ) -> Self {
445 Self(RequestBuilder::new(stub))
446 }
447
448 pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
450 mut self,
451 v: V,
452 ) -> Self {
453 self.0.request = v.into();
454 self
455 }
456
457 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
459 self.0.options = v.into();
460 self
461 }
462
463 pub async fn send(self) -> Result<()> {
465 (*self.0.stub)
466 .delete_autoscaling_policy(self.0.request, self.0.options)
467 .await
468 .map(gax::response::Response::into_body)
469 }
470
471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
475 self.0.request.name = v.into();
476 self
477 }
478 }
479
480 #[doc(hidden)]
481 impl gax::options::internal::RequestBuilder for DeleteAutoscalingPolicy {
482 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
483 &mut self.0.options
484 }
485 }
486
487 #[derive(Clone, Debug)]
504 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
505
506 impl SetIamPolicy {
507 pub(crate) fn new(
508 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
509 ) -> Self {
510 Self(RequestBuilder::new(stub))
511 }
512
513 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
515 self.0.request = v.into();
516 self
517 }
518
519 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
521 self.0.options = v.into();
522 self
523 }
524
525 pub async fn send(self) -> Result<iam_v1::model::Policy> {
527 (*self.0.stub)
528 .set_iam_policy(self.0.request, self.0.options)
529 .await
530 .map(gax::response::Response::into_body)
531 }
532
533 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
537 self.0.request.resource = v.into();
538 self
539 }
540
541 pub fn set_policy<T>(mut self, v: T) -> Self
545 where
546 T: std::convert::Into<iam_v1::model::Policy>,
547 {
548 self.0.request.policy = std::option::Option::Some(v.into());
549 self
550 }
551
552 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
556 where
557 T: std::convert::Into<iam_v1::model::Policy>,
558 {
559 self.0.request.policy = v.map(|x| x.into());
560 self
561 }
562
563 pub fn set_update_mask<T>(mut self, v: T) -> Self
565 where
566 T: std::convert::Into<wkt::FieldMask>,
567 {
568 self.0.request.update_mask = std::option::Option::Some(v.into());
569 self
570 }
571
572 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
574 where
575 T: std::convert::Into<wkt::FieldMask>,
576 {
577 self.0.request.update_mask = v.map(|x| x.into());
578 self
579 }
580 }
581
582 #[doc(hidden)]
583 impl gax::options::internal::RequestBuilder for SetIamPolicy {
584 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
585 &mut self.0.options
586 }
587 }
588
589 #[derive(Clone, Debug)]
606 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
607
608 impl GetIamPolicy {
609 pub(crate) fn new(
610 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
611 ) -> Self {
612 Self(RequestBuilder::new(stub))
613 }
614
615 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
617 self.0.request = v.into();
618 self
619 }
620
621 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
623 self.0.options = v.into();
624 self
625 }
626
627 pub async fn send(self) -> Result<iam_v1::model::Policy> {
629 (*self.0.stub)
630 .get_iam_policy(self.0.request, self.0.options)
631 .await
632 .map(gax::response::Response::into_body)
633 }
634
635 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
639 self.0.request.resource = v.into();
640 self
641 }
642
643 pub fn set_options<T>(mut self, v: T) -> Self
645 where
646 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
647 {
648 self.0.request.options = std::option::Option::Some(v.into());
649 self
650 }
651
652 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
654 where
655 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
656 {
657 self.0.request.options = v.map(|x| x.into());
658 self
659 }
660 }
661
662 #[doc(hidden)]
663 impl gax::options::internal::RequestBuilder for GetIamPolicy {
664 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
665 &mut self.0.options
666 }
667 }
668
669 #[derive(Clone, Debug)]
686 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
687
688 impl TestIamPermissions {
689 pub(crate) fn new(
690 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
691 ) -> Self {
692 Self(RequestBuilder::new(stub))
693 }
694
695 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
697 mut self,
698 v: V,
699 ) -> Self {
700 self.0.request = v.into();
701 self
702 }
703
704 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
706 self.0.options = v.into();
707 self
708 }
709
710 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
712 (*self.0.stub)
713 .test_iam_permissions(self.0.request, self.0.options)
714 .await
715 .map(gax::response::Response::into_body)
716 }
717
718 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
722 self.0.request.resource = v.into();
723 self
724 }
725
726 pub fn set_permissions<T, V>(mut self, v: T) -> Self
730 where
731 T: std::iter::IntoIterator<Item = V>,
732 V: std::convert::Into<std::string::String>,
733 {
734 use std::iter::Iterator;
735 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
736 self
737 }
738 }
739
740 #[doc(hidden)]
741 impl gax::options::internal::RequestBuilder for TestIamPermissions {
742 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
743 &mut self.0.options
744 }
745 }
746
747 #[derive(Clone, Debug)]
768 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
769
770 impl ListOperations {
771 pub(crate) fn new(
772 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
773 ) -> Self {
774 Self(RequestBuilder::new(stub))
775 }
776
777 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
779 mut self,
780 v: V,
781 ) -> Self {
782 self.0.request = v.into();
783 self
784 }
785
786 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
788 self.0.options = v.into();
789 self
790 }
791
792 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
794 (*self.0.stub)
795 .list_operations(self.0.request, self.0.options)
796 .await
797 .map(gax::response::Response::into_body)
798 }
799
800 pub fn by_page(
802 self,
803 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
804 {
805 use std::clone::Clone;
806 let token = self.0.request.page_token.clone();
807 let execute = move |token: String| {
808 let mut builder = self.clone();
809 builder.0.request = builder.0.request.set_page_token(token);
810 builder.send()
811 };
812 gax::paginator::internal::new_paginator(token, execute)
813 }
814
815 pub fn by_item(
817 self,
818 ) -> impl gax::paginator::ItemPaginator<
819 longrunning::model::ListOperationsResponse,
820 gax::error::Error,
821 > {
822 use gax::paginator::Paginator;
823 self.by_page().items()
824 }
825
826 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
828 self.0.request.name = v.into();
829 self
830 }
831
832 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
834 self.0.request.filter = v.into();
835 self
836 }
837
838 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
840 self.0.request.page_size = v.into();
841 self
842 }
843
844 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
846 self.0.request.page_token = v.into();
847 self
848 }
849
850 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
852 self.0.request.return_partial_success = v.into();
853 self
854 }
855 }
856
857 #[doc(hidden)]
858 impl gax::options::internal::RequestBuilder for ListOperations {
859 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
860 &mut self.0.options
861 }
862 }
863
864 #[derive(Clone, Debug)]
881 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
882
883 impl GetOperation {
884 pub(crate) fn new(
885 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
886 ) -> Self {
887 Self(RequestBuilder::new(stub))
888 }
889
890 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
892 mut self,
893 v: V,
894 ) -> Self {
895 self.0.request = v.into();
896 self
897 }
898
899 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
901 self.0.options = v.into();
902 self
903 }
904
905 pub async fn send(self) -> Result<longrunning::model::Operation> {
907 (*self.0.stub)
908 .get_operation(self.0.request, self.0.options)
909 .await
910 .map(gax::response::Response::into_body)
911 }
912
913 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
915 self.0.request.name = v.into();
916 self
917 }
918 }
919
920 #[doc(hidden)]
921 impl gax::options::internal::RequestBuilder for GetOperation {
922 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
923 &mut self.0.options
924 }
925 }
926
927 #[derive(Clone, Debug)]
944 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
945
946 impl DeleteOperation {
947 pub(crate) fn new(
948 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
949 ) -> Self {
950 Self(RequestBuilder::new(stub))
951 }
952
953 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
955 mut self,
956 v: V,
957 ) -> Self {
958 self.0.request = v.into();
959 self
960 }
961
962 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
964 self.0.options = v.into();
965 self
966 }
967
968 pub async fn send(self) -> Result<()> {
970 (*self.0.stub)
971 .delete_operation(self.0.request, self.0.options)
972 .await
973 .map(gax::response::Response::into_body)
974 }
975
976 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
978 self.0.request.name = v.into();
979 self
980 }
981 }
982
983 #[doc(hidden)]
984 impl gax::options::internal::RequestBuilder for DeleteOperation {
985 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
986 &mut self.0.options
987 }
988 }
989
990 #[derive(Clone, Debug)]
1007 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1008
1009 impl CancelOperation {
1010 pub(crate) fn new(
1011 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1012 ) -> Self {
1013 Self(RequestBuilder::new(stub))
1014 }
1015
1016 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1018 mut self,
1019 v: V,
1020 ) -> Self {
1021 self.0.request = v.into();
1022 self
1023 }
1024
1025 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1027 self.0.options = v.into();
1028 self
1029 }
1030
1031 pub async fn send(self) -> Result<()> {
1033 (*self.0.stub)
1034 .cancel_operation(self.0.request, self.0.options)
1035 .await
1036 .map(gax::response::Response::into_body)
1037 }
1038
1039 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1041 self.0.request.name = v.into();
1042 self
1043 }
1044 }
1045
1046 #[doc(hidden)]
1047 impl gax::options::internal::RequestBuilder for CancelOperation {
1048 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1049 &mut self.0.options
1050 }
1051 }
1052}
1053
1054pub mod batch_controller {
1055 use crate::Result;
1056
1057 pub type ClientBuilder =
1071 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1072
1073 pub(crate) mod client {
1074 use super::super::super::client::BatchController;
1075 pub struct Factory;
1076 impl gax::client_builder::internal::ClientFactory for Factory {
1077 type Client = BatchController;
1078 type Credentials = gaxi::options::Credentials;
1079 async fn build(
1080 self,
1081 config: gaxi::options::ClientConfig,
1082 ) -> gax::client_builder::Result<Self::Client> {
1083 Self::Client::new(config).await
1084 }
1085 }
1086 }
1087
1088 #[derive(Clone, Debug)]
1090 pub(crate) struct RequestBuilder<R: std::default::Default> {
1091 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1092 request: R,
1093 options: gax::options::RequestOptions,
1094 }
1095
1096 impl<R> RequestBuilder<R>
1097 where
1098 R: std::default::Default,
1099 {
1100 pub(crate) fn new(
1101 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1102 ) -> Self {
1103 Self {
1104 stub,
1105 request: R::default(),
1106 options: gax::options::RequestOptions::default(),
1107 }
1108 }
1109 }
1110
1111 #[derive(Clone, Debug)]
1129 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1130
1131 impl CreateBatch {
1132 pub(crate) fn new(
1133 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1134 ) -> Self {
1135 Self(RequestBuilder::new(stub))
1136 }
1137
1138 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1140 self.0.request = v.into();
1141 self
1142 }
1143
1144 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1146 self.0.options = v.into();
1147 self
1148 }
1149
1150 pub async fn send(self) -> Result<longrunning::model::Operation> {
1157 (*self.0.stub)
1158 .create_batch(self.0.request, self.0.options)
1159 .await
1160 .map(gax::response::Response::into_body)
1161 }
1162
1163 pub fn poller(
1165 self,
1166 ) -> impl lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata> {
1167 type Operation =
1168 lro::internal::Operation<crate::model::Batch, crate::model::BatchOperationMetadata>;
1169 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1170 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1171
1172 let stub = self.0.stub.clone();
1173 let mut options = self.0.options.clone();
1174 options.set_retry_policy(gax::retry_policy::NeverRetry);
1175 let query = move |name| {
1176 let stub = stub.clone();
1177 let options = options.clone();
1178 async {
1179 let op = GetOperation::new(stub)
1180 .set_name(name)
1181 .with_options(options)
1182 .send()
1183 .await?;
1184 Ok(Operation::new(op))
1185 }
1186 };
1187
1188 let start = move || async {
1189 let op = self.send().await?;
1190 Ok(Operation::new(op))
1191 };
1192
1193 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1194 }
1195
1196 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1200 self.0.request.parent = v.into();
1201 self
1202 }
1203
1204 pub fn set_batch<T>(mut self, v: T) -> Self
1208 where
1209 T: std::convert::Into<crate::model::Batch>,
1210 {
1211 self.0.request.batch = std::option::Option::Some(v.into());
1212 self
1213 }
1214
1215 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1219 where
1220 T: std::convert::Into<crate::model::Batch>,
1221 {
1222 self.0.request.batch = v.map(|x| x.into());
1223 self
1224 }
1225
1226 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1228 self.0.request.batch_id = v.into();
1229 self
1230 }
1231
1232 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1234 self.0.request.request_id = v.into();
1235 self
1236 }
1237 }
1238
1239 #[doc(hidden)]
1240 impl gax::options::internal::RequestBuilder for CreateBatch {
1241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1242 &mut self.0.options
1243 }
1244 }
1245
1246 #[derive(Clone, Debug)]
1263 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1264
1265 impl GetBatch {
1266 pub(crate) fn new(
1267 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1268 ) -> Self {
1269 Self(RequestBuilder::new(stub))
1270 }
1271
1272 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1274 self.0.request = v.into();
1275 self
1276 }
1277
1278 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1280 self.0.options = v.into();
1281 self
1282 }
1283
1284 pub async fn send(self) -> Result<crate::model::Batch> {
1286 (*self.0.stub)
1287 .get_batch(self.0.request, self.0.options)
1288 .await
1289 .map(gax::response::Response::into_body)
1290 }
1291
1292 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1296 self.0.request.name = v.into();
1297 self
1298 }
1299 }
1300
1301 #[doc(hidden)]
1302 impl gax::options::internal::RequestBuilder for GetBatch {
1303 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1304 &mut self.0.options
1305 }
1306 }
1307
1308 #[derive(Clone, Debug)]
1329 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1330
1331 impl ListBatches {
1332 pub(crate) fn new(
1333 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1334 ) -> Self {
1335 Self(RequestBuilder::new(stub))
1336 }
1337
1338 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1340 self.0.request = v.into();
1341 self
1342 }
1343
1344 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1346 self.0.options = v.into();
1347 self
1348 }
1349
1350 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1352 (*self.0.stub)
1353 .list_batches(self.0.request, self.0.options)
1354 .await
1355 .map(gax::response::Response::into_body)
1356 }
1357
1358 pub fn by_page(
1360 self,
1361 ) -> impl gax::paginator::Paginator<crate::model::ListBatchesResponse, gax::error::Error>
1362 {
1363 use std::clone::Clone;
1364 let token = self.0.request.page_token.clone();
1365 let execute = move |token: String| {
1366 let mut builder = self.clone();
1367 builder.0.request = builder.0.request.set_page_token(token);
1368 builder.send()
1369 };
1370 gax::paginator::internal::new_paginator(token, execute)
1371 }
1372
1373 pub fn by_item(
1375 self,
1376 ) -> impl gax::paginator::ItemPaginator<crate::model::ListBatchesResponse, gax::error::Error>
1377 {
1378 use gax::paginator::Paginator;
1379 self.by_page().items()
1380 }
1381
1382 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1386 self.0.request.parent = v.into();
1387 self
1388 }
1389
1390 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1392 self.0.request.page_size = v.into();
1393 self
1394 }
1395
1396 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1398 self.0.request.page_token = v.into();
1399 self
1400 }
1401
1402 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1404 self.0.request.filter = v.into();
1405 self
1406 }
1407
1408 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1410 self.0.request.order_by = v.into();
1411 self
1412 }
1413 }
1414
1415 #[doc(hidden)]
1416 impl gax::options::internal::RequestBuilder for ListBatches {
1417 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1418 &mut self.0.options
1419 }
1420 }
1421
1422 #[derive(Clone, Debug)]
1439 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1440
1441 impl DeleteBatch {
1442 pub(crate) fn new(
1443 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1444 ) -> Self {
1445 Self(RequestBuilder::new(stub))
1446 }
1447
1448 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1450 self.0.request = v.into();
1451 self
1452 }
1453
1454 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1456 self.0.options = v.into();
1457 self
1458 }
1459
1460 pub async fn send(self) -> Result<()> {
1462 (*self.0.stub)
1463 .delete_batch(self.0.request, self.0.options)
1464 .await
1465 .map(gax::response::Response::into_body)
1466 }
1467
1468 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1472 self.0.request.name = v.into();
1473 self
1474 }
1475 }
1476
1477 #[doc(hidden)]
1478 impl gax::options::internal::RequestBuilder for DeleteBatch {
1479 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1480 &mut self.0.options
1481 }
1482 }
1483
1484 #[derive(Clone, Debug)]
1501 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1502
1503 impl SetIamPolicy {
1504 pub(crate) fn new(
1505 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1506 ) -> Self {
1507 Self(RequestBuilder::new(stub))
1508 }
1509
1510 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1512 self.0.request = v.into();
1513 self
1514 }
1515
1516 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1518 self.0.options = v.into();
1519 self
1520 }
1521
1522 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1524 (*self.0.stub)
1525 .set_iam_policy(self.0.request, self.0.options)
1526 .await
1527 .map(gax::response::Response::into_body)
1528 }
1529
1530 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1534 self.0.request.resource = v.into();
1535 self
1536 }
1537
1538 pub fn set_policy<T>(mut self, v: T) -> Self
1542 where
1543 T: std::convert::Into<iam_v1::model::Policy>,
1544 {
1545 self.0.request.policy = std::option::Option::Some(v.into());
1546 self
1547 }
1548
1549 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1553 where
1554 T: std::convert::Into<iam_v1::model::Policy>,
1555 {
1556 self.0.request.policy = v.map(|x| x.into());
1557 self
1558 }
1559
1560 pub fn set_update_mask<T>(mut self, v: T) -> Self
1562 where
1563 T: std::convert::Into<wkt::FieldMask>,
1564 {
1565 self.0.request.update_mask = std::option::Option::Some(v.into());
1566 self
1567 }
1568
1569 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1571 where
1572 T: std::convert::Into<wkt::FieldMask>,
1573 {
1574 self.0.request.update_mask = v.map(|x| x.into());
1575 self
1576 }
1577 }
1578
1579 #[doc(hidden)]
1580 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1581 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1582 &mut self.0.options
1583 }
1584 }
1585
1586 #[derive(Clone, Debug)]
1603 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1604
1605 impl GetIamPolicy {
1606 pub(crate) fn new(
1607 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1608 ) -> Self {
1609 Self(RequestBuilder::new(stub))
1610 }
1611
1612 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1614 self.0.request = v.into();
1615 self
1616 }
1617
1618 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1620 self.0.options = v.into();
1621 self
1622 }
1623
1624 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1626 (*self.0.stub)
1627 .get_iam_policy(self.0.request, self.0.options)
1628 .await
1629 .map(gax::response::Response::into_body)
1630 }
1631
1632 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1636 self.0.request.resource = v.into();
1637 self
1638 }
1639
1640 pub fn set_options<T>(mut self, v: T) -> Self
1642 where
1643 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1644 {
1645 self.0.request.options = std::option::Option::Some(v.into());
1646 self
1647 }
1648
1649 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1651 where
1652 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1653 {
1654 self.0.request.options = v.map(|x| x.into());
1655 self
1656 }
1657 }
1658
1659 #[doc(hidden)]
1660 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1661 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1662 &mut self.0.options
1663 }
1664 }
1665
1666 #[derive(Clone, Debug)]
1683 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1684
1685 impl TestIamPermissions {
1686 pub(crate) fn new(
1687 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1688 ) -> Self {
1689 Self(RequestBuilder::new(stub))
1690 }
1691
1692 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1694 mut self,
1695 v: V,
1696 ) -> Self {
1697 self.0.request = v.into();
1698 self
1699 }
1700
1701 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1703 self.0.options = v.into();
1704 self
1705 }
1706
1707 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1709 (*self.0.stub)
1710 .test_iam_permissions(self.0.request, self.0.options)
1711 .await
1712 .map(gax::response::Response::into_body)
1713 }
1714
1715 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.0.request.resource = v.into();
1720 self
1721 }
1722
1723 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1727 where
1728 T: std::iter::IntoIterator<Item = V>,
1729 V: std::convert::Into<std::string::String>,
1730 {
1731 use std::iter::Iterator;
1732 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1733 self
1734 }
1735 }
1736
1737 #[doc(hidden)]
1738 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1739 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1740 &mut self.0.options
1741 }
1742 }
1743
1744 #[derive(Clone, Debug)]
1765 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1766
1767 impl ListOperations {
1768 pub(crate) fn new(
1769 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1770 ) -> Self {
1771 Self(RequestBuilder::new(stub))
1772 }
1773
1774 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1776 mut self,
1777 v: V,
1778 ) -> Self {
1779 self.0.request = v.into();
1780 self
1781 }
1782
1783 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1785 self.0.options = v.into();
1786 self
1787 }
1788
1789 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1791 (*self.0.stub)
1792 .list_operations(self.0.request, self.0.options)
1793 .await
1794 .map(gax::response::Response::into_body)
1795 }
1796
1797 pub fn by_page(
1799 self,
1800 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1801 {
1802 use std::clone::Clone;
1803 let token = self.0.request.page_token.clone();
1804 let execute = move |token: String| {
1805 let mut builder = self.clone();
1806 builder.0.request = builder.0.request.set_page_token(token);
1807 builder.send()
1808 };
1809 gax::paginator::internal::new_paginator(token, execute)
1810 }
1811
1812 pub fn by_item(
1814 self,
1815 ) -> impl gax::paginator::ItemPaginator<
1816 longrunning::model::ListOperationsResponse,
1817 gax::error::Error,
1818 > {
1819 use gax::paginator::Paginator;
1820 self.by_page().items()
1821 }
1822
1823 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1825 self.0.request.name = v.into();
1826 self
1827 }
1828
1829 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1831 self.0.request.filter = v.into();
1832 self
1833 }
1834
1835 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1837 self.0.request.page_size = v.into();
1838 self
1839 }
1840
1841 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1843 self.0.request.page_token = v.into();
1844 self
1845 }
1846
1847 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1849 self.0.request.return_partial_success = v.into();
1850 self
1851 }
1852 }
1853
1854 #[doc(hidden)]
1855 impl gax::options::internal::RequestBuilder for ListOperations {
1856 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1857 &mut self.0.options
1858 }
1859 }
1860
1861 #[derive(Clone, Debug)]
1878 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1879
1880 impl GetOperation {
1881 pub(crate) fn new(
1882 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1883 ) -> Self {
1884 Self(RequestBuilder::new(stub))
1885 }
1886
1887 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1889 mut self,
1890 v: V,
1891 ) -> Self {
1892 self.0.request = v.into();
1893 self
1894 }
1895
1896 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1898 self.0.options = v.into();
1899 self
1900 }
1901
1902 pub async fn send(self) -> Result<longrunning::model::Operation> {
1904 (*self.0.stub)
1905 .get_operation(self.0.request, self.0.options)
1906 .await
1907 .map(gax::response::Response::into_body)
1908 }
1909
1910 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1912 self.0.request.name = v.into();
1913 self
1914 }
1915 }
1916
1917 #[doc(hidden)]
1918 impl gax::options::internal::RequestBuilder for GetOperation {
1919 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1920 &mut self.0.options
1921 }
1922 }
1923
1924 #[derive(Clone, Debug)]
1941 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1942
1943 impl DeleteOperation {
1944 pub(crate) fn new(
1945 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1946 ) -> Self {
1947 Self(RequestBuilder::new(stub))
1948 }
1949
1950 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1952 mut self,
1953 v: V,
1954 ) -> Self {
1955 self.0.request = v.into();
1956 self
1957 }
1958
1959 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1961 self.0.options = v.into();
1962 self
1963 }
1964
1965 pub async fn send(self) -> Result<()> {
1967 (*self.0.stub)
1968 .delete_operation(self.0.request, self.0.options)
1969 .await
1970 .map(gax::response::Response::into_body)
1971 }
1972
1973 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1975 self.0.request.name = v.into();
1976 self
1977 }
1978 }
1979
1980 #[doc(hidden)]
1981 impl gax::options::internal::RequestBuilder for DeleteOperation {
1982 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1983 &mut self.0.options
1984 }
1985 }
1986
1987 #[derive(Clone, Debug)]
2004 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2005
2006 impl CancelOperation {
2007 pub(crate) fn new(
2008 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2009 ) -> Self {
2010 Self(RequestBuilder::new(stub))
2011 }
2012
2013 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2015 mut self,
2016 v: V,
2017 ) -> Self {
2018 self.0.request = v.into();
2019 self
2020 }
2021
2022 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2024 self.0.options = v.into();
2025 self
2026 }
2027
2028 pub async fn send(self) -> Result<()> {
2030 (*self.0.stub)
2031 .cancel_operation(self.0.request, self.0.options)
2032 .await
2033 .map(gax::response::Response::into_body)
2034 }
2035
2036 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2038 self.0.request.name = v.into();
2039 self
2040 }
2041 }
2042
2043 #[doc(hidden)]
2044 impl gax::options::internal::RequestBuilder for CancelOperation {
2045 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2046 &mut self.0.options
2047 }
2048 }
2049}
2050
2051pub mod cluster_controller {
2052 use crate::Result;
2053
2054 pub type ClientBuilder =
2068 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2069
2070 pub(crate) mod client {
2071 use super::super::super::client::ClusterController;
2072 pub struct Factory;
2073 impl gax::client_builder::internal::ClientFactory for Factory {
2074 type Client = ClusterController;
2075 type Credentials = gaxi::options::Credentials;
2076 async fn build(
2077 self,
2078 config: gaxi::options::ClientConfig,
2079 ) -> gax::client_builder::Result<Self::Client> {
2080 Self::Client::new(config).await
2081 }
2082 }
2083 }
2084
2085 #[derive(Clone, Debug)]
2087 pub(crate) struct RequestBuilder<R: std::default::Default> {
2088 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2089 request: R,
2090 options: gax::options::RequestOptions,
2091 }
2092
2093 impl<R> RequestBuilder<R>
2094 where
2095 R: std::default::Default,
2096 {
2097 pub(crate) fn new(
2098 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2099 ) -> Self {
2100 Self {
2101 stub,
2102 request: R::default(),
2103 options: gax::options::RequestOptions::default(),
2104 }
2105 }
2106 }
2107
2108 #[derive(Clone, Debug)]
2126 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2127
2128 impl CreateCluster {
2129 pub(crate) fn new(
2130 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2131 ) -> Self {
2132 Self(RequestBuilder::new(stub))
2133 }
2134
2135 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2137 self.0.request = v.into();
2138 self
2139 }
2140
2141 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2143 self.0.options = v.into();
2144 self
2145 }
2146
2147 pub async fn send(self) -> Result<longrunning::model::Operation> {
2154 (*self.0.stub)
2155 .create_cluster(self.0.request, self.0.options)
2156 .await
2157 .map(gax::response::Response::into_body)
2158 }
2159
2160 pub fn poller(
2162 self,
2163 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2164 {
2165 type Operation = lro::internal::Operation<
2166 crate::model::Cluster,
2167 crate::model::ClusterOperationMetadata,
2168 >;
2169 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2170 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2171
2172 let stub = self.0.stub.clone();
2173 let mut options = self.0.options.clone();
2174 options.set_retry_policy(gax::retry_policy::NeverRetry);
2175 let query = move |name| {
2176 let stub = stub.clone();
2177 let options = options.clone();
2178 async {
2179 let op = GetOperation::new(stub)
2180 .set_name(name)
2181 .with_options(options)
2182 .send()
2183 .await?;
2184 Ok(Operation::new(op))
2185 }
2186 };
2187
2188 let start = move || async {
2189 let op = self.send().await?;
2190 Ok(Operation::new(op))
2191 };
2192
2193 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2194 }
2195
2196 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2200 self.0.request.project_id = v.into();
2201 self
2202 }
2203
2204 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2208 self.0.request.region = v.into();
2209 self
2210 }
2211
2212 pub fn set_cluster<T>(mut self, v: T) -> Self
2216 where
2217 T: std::convert::Into<crate::model::Cluster>,
2218 {
2219 self.0.request.cluster = std::option::Option::Some(v.into());
2220 self
2221 }
2222
2223 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2227 where
2228 T: std::convert::Into<crate::model::Cluster>,
2229 {
2230 self.0.request.cluster = v.map(|x| x.into());
2231 self
2232 }
2233
2234 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2236 self.0.request.request_id = v.into();
2237 self
2238 }
2239
2240 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2242 mut self,
2243 v: T,
2244 ) -> Self {
2245 self.0.request.action_on_failed_primary_workers = v.into();
2246 self
2247 }
2248 }
2249
2250 #[doc(hidden)]
2251 impl gax::options::internal::RequestBuilder for CreateCluster {
2252 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2253 &mut self.0.options
2254 }
2255 }
2256
2257 #[derive(Clone, Debug)]
2275 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2276
2277 impl UpdateCluster {
2278 pub(crate) fn new(
2279 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2280 ) -> Self {
2281 Self(RequestBuilder::new(stub))
2282 }
2283
2284 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2286 self.0.request = v.into();
2287 self
2288 }
2289
2290 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2292 self.0.options = v.into();
2293 self
2294 }
2295
2296 pub async fn send(self) -> Result<longrunning::model::Operation> {
2303 (*self.0.stub)
2304 .update_cluster(self.0.request, self.0.options)
2305 .await
2306 .map(gax::response::Response::into_body)
2307 }
2308
2309 pub fn poller(
2311 self,
2312 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2313 {
2314 type Operation = lro::internal::Operation<
2315 crate::model::Cluster,
2316 crate::model::ClusterOperationMetadata,
2317 >;
2318 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2319 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2320
2321 let stub = self.0.stub.clone();
2322 let mut options = self.0.options.clone();
2323 options.set_retry_policy(gax::retry_policy::NeverRetry);
2324 let query = move |name| {
2325 let stub = stub.clone();
2326 let options = options.clone();
2327 async {
2328 let op = GetOperation::new(stub)
2329 .set_name(name)
2330 .with_options(options)
2331 .send()
2332 .await?;
2333 Ok(Operation::new(op))
2334 }
2335 };
2336
2337 let start = move || async {
2338 let op = self.send().await?;
2339 Ok(Operation::new(op))
2340 };
2341
2342 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2343 }
2344
2345 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2349 self.0.request.project_id = v.into();
2350 self
2351 }
2352
2353 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2357 self.0.request.region = v.into();
2358 self
2359 }
2360
2361 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2365 self.0.request.cluster_name = v.into();
2366 self
2367 }
2368
2369 pub fn set_cluster<T>(mut self, v: T) -> Self
2373 where
2374 T: std::convert::Into<crate::model::Cluster>,
2375 {
2376 self.0.request.cluster = std::option::Option::Some(v.into());
2377 self
2378 }
2379
2380 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2384 where
2385 T: std::convert::Into<crate::model::Cluster>,
2386 {
2387 self.0.request.cluster = v.map(|x| x.into());
2388 self
2389 }
2390
2391 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2393 where
2394 T: std::convert::Into<wkt::Duration>,
2395 {
2396 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2397 self
2398 }
2399
2400 pub fn set_or_clear_graceful_decommission_timeout<T>(
2402 mut self,
2403 v: std::option::Option<T>,
2404 ) -> Self
2405 where
2406 T: std::convert::Into<wkt::Duration>,
2407 {
2408 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2409 self
2410 }
2411
2412 pub fn set_update_mask<T>(mut self, v: T) -> Self
2416 where
2417 T: std::convert::Into<wkt::FieldMask>,
2418 {
2419 self.0.request.update_mask = std::option::Option::Some(v.into());
2420 self
2421 }
2422
2423 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2427 where
2428 T: std::convert::Into<wkt::FieldMask>,
2429 {
2430 self.0.request.update_mask = v.map(|x| x.into());
2431 self
2432 }
2433
2434 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2436 self.0.request.request_id = v.into();
2437 self
2438 }
2439 }
2440
2441 #[doc(hidden)]
2442 impl gax::options::internal::RequestBuilder for UpdateCluster {
2443 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2444 &mut self.0.options
2445 }
2446 }
2447
2448 #[derive(Clone, Debug)]
2466 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2467
2468 impl StopCluster {
2469 pub(crate) fn new(
2470 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2471 ) -> Self {
2472 Self(RequestBuilder::new(stub))
2473 }
2474
2475 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2477 self.0.request = v.into();
2478 self
2479 }
2480
2481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2483 self.0.options = v.into();
2484 self
2485 }
2486
2487 pub async fn send(self) -> Result<longrunning::model::Operation> {
2494 (*self.0.stub)
2495 .stop_cluster(self.0.request, self.0.options)
2496 .await
2497 .map(gax::response::Response::into_body)
2498 }
2499
2500 pub fn poller(
2502 self,
2503 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2504 {
2505 type Operation = lro::internal::Operation<
2506 crate::model::Cluster,
2507 crate::model::ClusterOperationMetadata,
2508 >;
2509 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2510 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2511
2512 let stub = self.0.stub.clone();
2513 let mut options = self.0.options.clone();
2514 options.set_retry_policy(gax::retry_policy::NeverRetry);
2515 let query = move |name| {
2516 let stub = stub.clone();
2517 let options = options.clone();
2518 async {
2519 let op = GetOperation::new(stub)
2520 .set_name(name)
2521 .with_options(options)
2522 .send()
2523 .await?;
2524 Ok(Operation::new(op))
2525 }
2526 };
2527
2528 let start = move || async {
2529 let op = self.send().await?;
2530 Ok(Operation::new(op))
2531 };
2532
2533 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2534 }
2535
2536 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2540 self.0.request.project_id = v.into();
2541 self
2542 }
2543
2544 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2548 self.0.request.region = v.into();
2549 self
2550 }
2551
2552 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2556 self.0.request.cluster_name = v.into();
2557 self
2558 }
2559
2560 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2562 self.0.request.cluster_uuid = v.into();
2563 self
2564 }
2565
2566 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2568 self.0.request.request_id = v.into();
2569 self
2570 }
2571 }
2572
2573 #[doc(hidden)]
2574 impl gax::options::internal::RequestBuilder for StopCluster {
2575 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2576 &mut self.0.options
2577 }
2578 }
2579
2580 #[derive(Clone, Debug)]
2598 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2599
2600 impl StartCluster {
2601 pub(crate) fn new(
2602 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2603 ) -> Self {
2604 Self(RequestBuilder::new(stub))
2605 }
2606
2607 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2609 self.0.request = v.into();
2610 self
2611 }
2612
2613 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2615 self.0.options = v.into();
2616 self
2617 }
2618
2619 pub async fn send(self) -> Result<longrunning::model::Operation> {
2626 (*self.0.stub)
2627 .start_cluster(self.0.request, self.0.options)
2628 .await
2629 .map(gax::response::Response::into_body)
2630 }
2631
2632 pub fn poller(
2634 self,
2635 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2636 {
2637 type Operation = lro::internal::Operation<
2638 crate::model::Cluster,
2639 crate::model::ClusterOperationMetadata,
2640 >;
2641 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2642 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2643
2644 let stub = self.0.stub.clone();
2645 let mut options = self.0.options.clone();
2646 options.set_retry_policy(gax::retry_policy::NeverRetry);
2647 let query = move |name| {
2648 let stub = stub.clone();
2649 let options = options.clone();
2650 async {
2651 let op = GetOperation::new(stub)
2652 .set_name(name)
2653 .with_options(options)
2654 .send()
2655 .await?;
2656 Ok(Operation::new(op))
2657 }
2658 };
2659
2660 let start = move || async {
2661 let op = self.send().await?;
2662 Ok(Operation::new(op))
2663 };
2664
2665 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2666 }
2667
2668 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2672 self.0.request.project_id = v.into();
2673 self
2674 }
2675
2676 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2680 self.0.request.region = v.into();
2681 self
2682 }
2683
2684 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2688 self.0.request.cluster_name = v.into();
2689 self
2690 }
2691
2692 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2694 self.0.request.cluster_uuid = v.into();
2695 self
2696 }
2697
2698 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2700 self.0.request.request_id = v.into();
2701 self
2702 }
2703 }
2704
2705 #[doc(hidden)]
2706 impl gax::options::internal::RequestBuilder for StartCluster {
2707 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2708 &mut self.0.options
2709 }
2710 }
2711
2712 #[derive(Clone, Debug)]
2730 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2731
2732 impl DeleteCluster {
2733 pub(crate) fn new(
2734 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2735 ) -> Self {
2736 Self(RequestBuilder::new(stub))
2737 }
2738
2739 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2741 self.0.request = v.into();
2742 self
2743 }
2744
2745 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2747 self.0.options = v.into();
2748 self
2749 }
2750
2751 pub async fn send(self) -> Result<longrunning::model::Operation> {
2758 (*self.0.stub)
2759 .delete_cluster(self.0.request, self.0.options)
2760 .await
2761 .map(gax::response::Response::into_body)
2762 }
2763
2764 pub fn poller(self) -> impl lro::Poller<(), crate::model::ClusterOperationMetadata> {
2766 type Operation =
2767 lro::internal::Operation<wkt::Empty, crate::model::ClusterOperationMetadata>;
2768 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2769 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2770
2771 let stub = self.0.stub.clone();
2772 let mut options = self.0.options.clone();
2773 options.set_retry_policy(gax::retry_policy::NeverRetry);
2774 let query = move |name| {
2775 let stub = stub.clone();
2776 let options = options.clone();
2777 async {
2778 let op = GetOperation::new(stub)
2779 .set_name(name)
2780 .with_options(options)
2781 .send()
2782 .await?;
2783 Ok(Operation::new(op))
2784 }
2785 };
2786
2787 let start = move || async {
2788 let op = self.send().await?;
2789 Ok(Operation::new(op))
2790 };
2791
2792 lro::internal::new_unit_response_poller(
2793 polling_error_policy,
2794 polling_backoff_policy,
2795 start,
2796 query,
2797 )
2798 }
2799
2800 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2804 self.0.request.project_id = v.into();
2805 self
2806 }
2807
2808 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2812 self.0.request.region = v.into();
2813 self
2814 }
2815
2816 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2820 self.0.request.cluster_name = v.into();
2821 self
2822 }
2823
2824 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2826 self.0.request.cluster_uuid = v.into();
2827 self
2828 }
2829
2830 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2832 self.0.request.request_id = v.into();
2833 self
2834 }
2835 }
2836
2837 #[doc(hidden)]
2838 impl gax::options::internal::RequestBuilder for DeleteCluster {
2839 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2840 &mut self.0.options
2841 }
2842 }
2843
2844 #[derive(Clone, Debug)]
2861 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2862
2863 impl GetCluster {
2864 pub(crate) fn new(
2865 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2866 ) -> Self {
2867 Self(RequestBuilder::new(stub))
2868 }
2869
2870 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2872 self.0.request = v.into();
2873 self
2874 }
2875
2876 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2878 self.0.options = v.into();
2879 self
2880 }
2881
2882 pub async fn send(self) -> Result<crate::model::Cluster> {
2884 (*self.0.stub)
2885 .get_cluster(self.0.request, self.0.options)
2886 .await
2887 .map(gax::response::Response::into_body)
2888 }
2889
2890 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2894 self.0.request.project_id = v.into();
2895 self
2896 }
2897
2898 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2902 self.0.request.region = v.into();
2903 self
2904 }
2905
2906 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2910 self.0.request.cluster_name = v.into();
2911 self
2912 }
2913 }
2914
2915 #[doc(hidden)]
2916 impl gax::options::internal::RequestBuilder for GetCluster {
2917 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2918 &mut self.0.options
2919 }
2920 }
2921
2922 #[derive(Clone, Debug)]
2943 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
2944
2945 impl ListClusters {
2946 pub(crate) fn new(
2947 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2948 ) -> Self {
2949 Self(RequestBuilder::new(stub))
2950 }
2951
2952 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
2954 self.0.request = v.into();
2955 self
2956 }
2957
2958 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2960 self.0.options = v.into();
2961 self
2962 }
2963
2964 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
2966 (*self.0.stub)
2967 .list_clusters(self.0.request, self.0.options)
2968 .await
2969 .map(gax::response::Response::into_body)
2970 }
2971
2972 pub fn by_page(
2974 self,
2975 ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
2976 {
2977 use std::clone::Clone;
2978 let token = self.0.request.page_token.clone();
2979 let execute = move |token: String| {
2980 let mut builder = self.clone();
2981 builder.0.request = builder.0.request.set_page_token(token);
2982 builder.send()
2983 };
2984 gax::paginator::internal::new_paginator(token, execute)
2985 }
2986
2987 pub fn by_item(
2989 self,
2990 ) -> impl gax::paginator::ItemPaginator<crate::model::ListClustersResponse, gax::error::Error>
2991 {
2992 use gax::paginator::Paginator;
2993 self.by_page().items()
2994 }
2995
2996 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3000 self.0.request.project_id = v.into();
3001 self
3002 }
3003
3004 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3008 self.0.request.region = v.into();
3009 self
3010 }
3011
3012 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3014 self.0.request.filter = v.into();
3015 self
3016 }
3017
3018 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3020 self.0.request.page_size = v.into();
3021 self
3022 }
3023
3024 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3026 self.0.request.page_token = v.into();
3027 self
3028 }
3029 }
3030
3031 #[doc(hidden)]
3032 impl gax::options::internal::RequestBuilder for ListClusters {
3033 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3034 &mut self.0.options
3035 }
3036 }
3037
3038 #[derive(Clone, Debug)]
3056 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3057
3058 impl DiagnoseCluster {
3059 pub(crate) fn new(
3060 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3061 ) -> Self {
3062 Self(RequestBuilder::new(stub))
3063 }
3064
3065 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3067 self.0.request = v.into();
3068 self
3069 }
3070
3071 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3073 self.0.options = v.into();
3074 self
3075 }
3076
3077 pub async fn send(self) -> Result<longrunning::model::Operation> {
3084 (*self.0.stub)
3085 .diagnose_cluster(self.0.request, self.0.options)
3086 .await
3087 .map(gax::response::Response::into_body)
3088 }
3089
3090 pub fn poller(
3092 self,
3093 ) -> impl lro::Poller<crate::model::DiagnoseClusterResults, crate::model::ClusterOperationMetadata>
3094 {
3095 type Operation = lro::internal::Operation<
3096 crate::model::DiagnoseClusterResults,
3097 crate::model::ClusterOperationMetadata,
3098 >;
3099 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3100 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3101
3102 let stub = self.0.stub.clone();
3103 let mut options = self.0.options.clone();
3104 options.set_retry_policy(gax::retry_policy::NeverRetry);
3105 let query = move |name| {
3106 let stub = stub.clone();
3107 let options = options.clone();
3108 async {
3109 let op = GetOperation::new(stub)
3110 .set_name(name)
3111 .with_options(options)
3112 .send()
3113 .await?;
3114 Ok(Operation::new(op))
3115 }
3116 };
3117
3118 let start = move || async {
3119 let op = self.send().await?;
3120 Ok(Operation::new(op))
3121 };
3122
3123 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3124 }
3125
3126 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3130 self.0.request.project_id = v.into();
3131 self
3132 }
3133
3134 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3138 self.0.request.region = v.into();
3139 self
3140 }
3141
3142 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3146 self.0.request.cluster_name = v.into();
3147 self
3148 }
3149
3150 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3152 self.0.request.tarball_gcs_dir = v.into();
3153 self
3154 }
3155
3156 pub fn set_tarball_access<
3158 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3159 >(
3160 mut self,
3161 v: T,
3162 ) -> Self {
3163 self.0.request.tarball_access = v.into();
3164 self
3165 }
3166
3167 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3169 where
3170 T: std::convert::Into<gtype::model::Interval>,
3171 {
3172 self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3173 self
3174 }
3175
3176 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3178 where
3179 T: std::convert::Into<gtype::model::Interval>,
3180 {
3181 self.0.request.diagnosis_interval = v.map(|x| x.into());
3182 self
3183 }
3184
3185 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3187 where
3188 T: std::iter::IntoIterator<Item = V>,
3189 V: std::convert::Into<std::string::String>,
3190 {
3191 use std::iter::Iterator;
3192 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3193 self
3194 }
3195
3196 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3198 where
3199 T: std::iter::IntoIterator<Item = V>,
3200 V: std::convert::Into<std::string::String>,
3201 {
3202 use std::iter::Iterator;
3203 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3204 self
3205 }
3206 }
3207
3208 #[doc(hidden)]
3209 impl gax::options::internal::RequestBuilder for DiagnoseCluster {
3210 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3211 &mut self.0.options
3212 }
3213 }
3214
3215 #[derive(Clone, Debug)]
3232 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3233
3234 impl SetIamPolicy {
3235 pub(crate) fn new(
3236 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3237 ) -> Self {
3238 Self(RequestBuilder::new(stub))
3239 }
3240
3241 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3243 self.0.request = v.into();
3244 self
3245 }
3246
3247 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3249 self.0.options = v.into();
3250 self
3251 }
3252
3253 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3255 (*self.0.stub)
3256 .set_iam_policy(self.0.request, self.0.options)
3257 .await
3258 .map(gax::response::Response::into_body)
3259 }
3260
3261 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3265 self.0.request.resource = v.into();
3266 self
3267 }
3268
3269 pub fn set_policy<T>(mut self, v: T) -> Self
3273 where
3274 T: std::convert::Into<iam_v1::model::Policy>,
3275 {
3276 self.0.request.policy = std::option::Option::Some(v.into());
3277 self
3278 }
3279
3280 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3284 where
3285 T: std::convert::Into<iam_v1::model::Policy>,
3286 {
3287 self.0.request.policy = v.map(|x| x.into());
3288 self
3289 }
3290
3291 pub fn set_update_mask<T>(mut self, v: T) -> Self
3293 where
3294 T: std::convert::Into<wkt::FieldMask>,
3295 {
3296 self.0.request.update_mask = std::option::Option::Some(v.into());
3297 self
3298 }
3299
3300 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3302 where
3303 T: std::convert::Into<wkt::FieldMask>,
3304 {
3305 self.0.request.update_mask = v.map(|x| x.into());
3306 self
3307 }
3308 }
3309
3310 #[doc(hidden)]
3311 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3312 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3313 &mut self.0.options
3314 }
3315 }
3316
3317 #[derive(Clone, Debug)]
3334 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3335
3336 impl GetIamPolicy {
3337 pub(crate) fn new(
3338 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3339 ) -> Self {
3340 Self(RequestBuilder::new(stub))
3341 }
3342
3343 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3345 self.0.request = v.into();
3346 self
3347 }
3348
3349 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3351 self.0.options = v.into();
3352 self
3353 }
3354
3355 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3357 (*self.0.stub)
3358 .get_iam_policy(self.0.request, self.0.options)
3359 .await
3360 .map(gax::response::Response::into_body)
3361 }
3362
3363 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3367 self.0.request.resource = v.into();
3368 self
3369 }
3370
3371 pub fn set_options<T>(mut self, v: T) -> Self
3373 where
3374 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3375 {
3376 self.0.request.options = std::option::Option::Some(v.into());
3377 self
3378 }
3379
3380 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3382 where
3383 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3384 {
3385 self.0.request.options = v.map(|x| x.into());
3386 self
3387 }
3388 }
3389
3390 #[doc(hidden)]
3391 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3392 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3393 &mut self.0.options
3394 }
3395 }
3396
3397 #[derive(Clone, Debug)]
3414 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3415
3416 impl TestIamPermissions {
3417 pub(crate) fn new(
3418 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3419 ) -> Self {
3420 Self(RequestBuilder::new(stub))
3421 }
3422
3423 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3425 mut self,
3426 v: V,
3427 ) -> Self {
3428 self.0.request = v.into();
3429 self
3430 }
3431
3432 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3434 self.0.options = v.into();
3435 self
3436 }
3437
3438 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3440 (*self.0.stub)
3441 .test_iam_permissions(self.0.request, self.0.options)
3442 .await
3443 .map(gax::response::Response::into_body)
3444 }
3445
3446 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3450 self.0.request.resource = v.into();
3451 self
3452 }
3453
3454 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3458 where
3459 T: std::iter::IntoIterator<Item = V>,
3460 V: std::convert::Into<std::string::String>,
3461 {
3462 use std::iter::Iterator;
3463 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3464 self
3465 }
3466 }
3467
3468 #[doc(hidden)]
3469 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3470 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3471 &mut self.0.options
3472 }
3473 }
3474
3475 #[derive(Clone, Debug)]
3496 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3497
3498 impl ListOperations {
3499 pub(crate) fn new(
3500 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3501 ) -> Self {
3502 Self(RequestBuilder::new(stub))
3503 }
3504
3505 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3507 mut self,
3508 v: V,
3509 ) -> Self {
3510 self.0.request = v.into();
3511 self
3512 }
3513
3514 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3516 self.0.options = v.into();
3517 self
3518 }
3519
3520 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3522 (*self.0.stub)
3523 .list_operations(self.0.request, self.0.options)
3524 .await
3525 .map(gax::response::Response::into_body)
3526 }
3527
3528 pub fn by_page(
3530 self,
3531 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3532 {
3533 use std::clone::Clone;
3534 let token = self.0.request.page_token.clone();
3535 let execute = move |token: String| {
3536 let mut builder = self.clone();
3537 builder.0.request = builder.0.request.set_page_token(token);
3538 builder.send()
3539 };
3540 gax::paginator::internal::new_paginator(token, execute)
3541 }
3542
3543 pub fn by_item(
3545 self,
3546 ) -> impl gax::paginator::ItemPaginator<
3547 longrunning::model::ListOperationsResponse,
3548 gax::error::Error,
3549 > {
3550 use gax::paginator::Paginator;
3551 self.by_page().items()
3552 }
3553
3554 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3556 self.0.request.name = v.into();
3557 self
3558 }
3559
3560 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3562 self.0.request.filter = v.into();
3563 self
3564 }
3565
3566 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3568 self.0.request.page_size = v.into();
3569 self
3570 }
3571
3572 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3574 self.0.request.page_token = v.into();
3575 self
3576 }
3577
3578 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3580 self.0.request.return_partial_success = v.into();
3581 self
3582 }
3583 }
3584
3585 #[doc(hidden)]
3586 impl gax::options::internal::RequestBuilder for ListOperations {
3587 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3588 &mut self.0.options
3589 }
3590 }
3591
3592 #[derive(Clone, Debug)]
3609 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3610
3611 impl GetOperation {
3612 pub(crate) fn new(
3613 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3614 ) -> Self {
3615 Self(RequestBuilder::new(stub))
3616 }
3617
3618 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3620 mut self,
3621 v: V,
3622 ) -> Self {
3623 self.0.request = v.into();
3624 self
3625 }
3626
3627 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3629 self.0.options = v.into();
3630 self
3631 }
3632
3633 pub async fn send(self) -> Result<longrunning::model::Operation> {
3635 (*self.0.stub)
3636 .get_operation(self.0.request, self.0.options)
3637 .await
3638 .map(gax::response::Response::into_body)
3639 }
3640
3641 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3643 self.0.request.name = v.into();
3644 self
3645 }
3646 }
3647
3648 #[doc(hidden)]
3649 impl gax::options::internal::RequestBuilder for GetOperation {
3650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3651 &mut self.0.options
3652 }
3653 }
3654
3655 #[derive(Clone, Debug)]
3672 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3673
3674 impl DeleteOperation {
3675 pub(crate) fn new(
3676 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3677 ) -> Self {
3678 Self(RequestBuilder::new(stub))
3679 }
3680
3681 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3683 mut self,
3684 v: V,
3685 ) -> Self {
3686 self.0.request = v.into();
3687 self
3688 }
3689
3690 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3692 self.0.options = v.into();
3693 self
3694 }
3695
3696 pub async fn send(self) -> Result<()> {
3698 (*self.0.stub)
3699 .delete_operation(self.0.request, self.0.options)
3700 .await
3701 .map(gax::response::Response::into_body)
3702 }
3703
3704 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3706 self.0.request.name = v.into();
3707 self
3708 }
3709 }
3710
3711 #[doc(hidden)]
3712 impl gax::options::internal::RequestBuilder for DeleteOperation {
3713 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3714 &mut self.0.options
3715 }
3716 }
3717
3718 #[derive(Clone, Debug)]
3735 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3736
3737 impl CancelOperation {
3738 pub(crate) fn new(
3739 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3740 ) -> Self {
3741 Self(RequestBuilder::new(stub))
3742 }
3743
3744 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3746 mut self,
3747 v: V,
3748 ) -> Self {
3749 self.0.request = v.into();
3750 self
3751 }
3752
3753 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3755 self.0.options = v.into();
3756 self
3757 }
3758
3759 pub async fn send(self) -> Result<()> {
3761 (*self.0.stub)
3762 .cancel_operation(self.0.request, self.0.options)
3763 .await
3764 .map(gax::response::Response::into_body)
3765 }
3766
3767 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3769 self.0.request.name = v.into();
3770 self
3771 }
3772 }
3773
3774 #[doc(hidden)]
3775 impl gax::options::internal::RequestBuilder for CancelOperation {
3776 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3777 &mut self.0.options
3778 }
3779 }
3780}
3781
3782pub mod job_controller {
3783 use crate::Result;
3784
3785 pub type ClientBuilder =
3799 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3800
3801 pub(crate) mod client {
3802 use super::super::super::client::JobController;
3803 pub struct Factory;
3804 impl gax::client_builder::internal::ClientFactory for Factory {
3805 type Client = JobController;
3806 type Credentials = gaxi::options::Credentials;
3807 async fn build(
3808 self,
3809 config: gaxi::options::ClientConfig,
3810 ) -> gax::client_builder::Result<Self::Client> {
3811 Self::Client::new(config).await
3812 }
3813 }
3814 }
3815
3816 #[derive(Clone, Debug)]
3818 pub(crate) struct RequestBuilder<R: std::default::Default> {
3819 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3820 request: R,
3821 options: gax::options::RequestOptions,
3822 }
3823
3824 impl<R> RequestBuilder<R>
3825 where
3826 R: std::default::Default,
3827 {
3828 pub(crate) fn new(
3829 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3830 ) -> Self {
3831 Self {
3832 stub,
3833 request: R::default(),
3834 options: gax::options::RequestOptions::default(),
3835 }
3836 }
3837 }
3838
3839 #[derive(Clone, Debug)]
3856 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
3857
3858 impl SubmitJob {
3859 pub(crate) fn new(
3860 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3861 ) -> Self {
3862 Self(RequestBuilder::new(stub))
3863 }
3864
3865 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3867 self.0.request = v.into();
3868 self
3869 }
3870
3871 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3873 self.0.options = v.into();
3874 self
3875 }
3876
3877 pub async fn send(self) -> Result<crate::model::Job> {
3879 (*self.0.stub)
3880 .submit_job(self.0.request, self.0.options)
3881 .await
3882 .map(gax::response::Response::into_body)
3883 }
3884
3885 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3889 self.0.request.project_id = v.into();
3890 self
3891 }
3892
3893 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3897 self.0.request.region = v.into();
3898 self
3899 }
3900
3901 pub fn set_job<T>(mut self, v: T) -> Self
3905 where
3906 T: std::convert::Into<crate::model::Job>,
3907 {
3908 self.0.request.job = std::option::Option::Some(v.into());
3909 self
3910 }
3911
3912 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
3916 where
3917 T: std::convert::Into<crate::model::Job>,
3918 {
3919 self.0.request.job = v.map(|x| x.into());
3920 self
3921 }
3922
3923 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3925 self.0.request.request_id = v.into();
3926 self
3927 }
3928 }
3929
3930 #[doc(hidden)]
3931 impl gax::options::internal::RequestBuilder for SubmitJob {
3932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3933 &mut self.0.options
3934 }
3935 }
3936
3937 #[derive(Clone, Debug)]
3955 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
3956
3957 impl SubmitJobAsOperation {
3958 pub(crate) fn new(
3959 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3960 ) -> Self {
3961 Self(RequestBuilder::new(stub))
3962 }
3963
3964 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3966 self.0.request = v.into();
3967 self
3968 }
3969
3970 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3972 self.0.options = v.into();
3973 self
3974 }
3975
3976 pub async fn send(self) -> Result<longrunning::model::Operation> {
3983 (*self.0.stub)
3984 .submit_job_as_operation(self.0.request, self.0.options)
3985 .await
3986 .map(gax::response::Response::into_body)
3987 }
3988
3989 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::JobMetadata> {
3991 type Operation = lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
3992 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3993 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3994
3995 let stub = self.0.stub.clone();
3996 let mut options = self.0.options.clone();
3997 options.set_retry_policy(gax::retry_policy::NeverRetry);
3998 let query = move |name| {
3999 let stub = stub.clone();
4000 let options = options.clone();
4001 async {
4002 let op = GetOperation::new(stub)
4003 .set_name(name)
4004 .with_options(options)
4005 .send()
4006 .await?;
4007 Ok(Operation::new(op))
4008 }
4009 };
4010
4011 let start = move || async {
4012 let op = self.send().await?;
4013 Ok(Operation::new(op))
4014 };
4015
4016 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4017 }
4018
4019 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4023 self.0.request.project_id = v.into();
4024 self
4025 }
4026
4027 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4031 self.0.request.region = v.into();
4032 self
4033 }
4034
4035 pub fn set_job<T>(mut self, v: T) -> Self
4039 where
4040 T: std::convert::Into<crate::model::Job>,
4041 {
4042 self.0.request.job = std::option::Option::Some(v.into());
4043 self
4044 }
4045
4046 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4050 where
4051 T: std::convert::Into<crate::model::Job>,
4052 {
4053 self.0.request.job = v.map(|x| x.into());
4054 self
4055 }
4056
4057 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4059 self.0.request.request_id = v.into();
4060 self
4061 }
4062 }
4063
4064 #[doc(hidden)]
4065 impl gax::options::internal::RequestBuilder for SubmitJobAsOperation {
4066 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4067 &mut self.0.options
4068 }
4069 }
4070
4071 #[derive(Clone, Debug)]
4088 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4089
4090 impl GetJob {
4091 pub(crate) fn new(
4092 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4093 ) -> Self {
4094 Self(RequestBuilder::new(stub))
4095 }
4096
4097 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4099 self.0.request = v.into();
4100 self
4101 }
4102
4103 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4105 self.0.options = v.into();
4106 self
4107 }
4108
4109 pub async fn send(self) -> Result<crate::model::Job> {
4111 (*self.0.stub)
4112 .get_job(self.0.request, self.0.options)
4113 .await
4114 .map(gax::response::Response::into_body)
4115 }
4116
4117 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4121 self.0.request.project_id = v.into();
4122 self
4123 }
4124
4125 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4129 self.0.request.region = v.into();
4130 self
4131 }
4132
4133 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4137 self.0.request.job_id = v.into();
4138 self
4139 }
4140 }
4141
4142 #[doc(hidden)]
4143 impl gax::options::internal::RequestBuilder for GetJob {
4144 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4145 &mut self.0.options
4146 }
4147 }
4148
4149 #[derive(Clone, Debug)]
4170 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4171
4172 impl ListJobs {
4173 pub(crate) fn new(
4174 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4175 ) -> Self {
4176 Self(RequestBuilder::new(stub))
4177 }
4178
4179 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4181 self.0.request = v.into();
4182 self
4183 }
4184
4185 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4187 self.0.options = v.into();
4188 self
4189 }
4190
4191 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4193 (*self.0.stub)
4194 .list_jobs(self.0.request, self.0.options)
4195 .await
4196 .map(gax::response::Response::into_body)
4197 }
4198
4199 pub fn by_page(
4201 self,
4202 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
4203 {
4204 use std::clone::Clone;
4205 let token = self.0.request.page_token.clone();
4206 let execute = move |token: String| {
4207 let mut builder = self.clone();
4208 builder.0.request = builder.0.request.set_page_token(token);
4209 builder.send()
4210 };
4211 gax::paginator::internal::new_paginator(token, execute)
4212 }
4213
4214 pub fn by_item(
4216 self,
4217 ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
4218 {
4219 use gax::paginator::Paginator;
4220 self.by_page().items()
4221 }
4222
4223 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4227 self.0.request.project_id = v.into();
4228 self
4229 }
4230
4231 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4235 self.0.request.region = v.into();
4236 self
4237 }
4238
4239 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4241 self.0.request.page_size = v.into();
4242 self
4243 }
4244
4245 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4247 self.0.request.page_token = v.into();
4248 self
4249 }
4250
4251 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4253 self.0.request.cluster_name = v.into();
4254 self
4255 }
4256
4257 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4259 mut self,
4260 v: T,
4261 ) -> Self {
4262 self.0.request.job_state_matcher = v.into();
4263 self
4264 }
4265
4266 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4268 self.0.request.filter = v.into();
4269 self
4270 }
4271 }
4272
4273 #[doc(hidden)]
4274 impl gax::options::internal::RequestBuilder for ListJobs {
4275 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4276 &mut self.0.options
4277 }
4278 }
4279
4280 #[derive(Clone, Debug)]
4297 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4298
4299 impl UpdateJob {
4300 pub(crate) fn new(
4301 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4302 ) -> Self {
4303 Self(RequestBuilder::new(stub))
4304 }
4305
4306 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4308 self.0.request = v.into();
4309 self
4310 }
4311
4312 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4314 self.0.options = v.into();
4315 self
4316 }
4317
4318 pub async fn send(self) -> Result<crate::model::Job> {
4320 (*self.0.stub)
4321 .update_job(self.0.request, self.0.options)
4322 .await
4323 .map(gax::response::Response::into_body)
4324 }
4325
4326 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4330 self.0.request.project_id = v.into();
4331 self
4332 }
4333
4334 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4338 self.0.request.region = v.into();
4339 self
4340 }
4341
4342 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4346 self.0.request.job_id = v.into();
4347 self
4348 }
4349
4350 pub fn set_job<T>(mut self, v: T) -> Self
4354 where
4355 T: std::convert::Into<crate::model::Job>,
4356 {
4357 self.0.request.job = std::option::Option::Some(v.into());
4358 self
4359 }
4360
4361 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4365 where
4366 T: std::convert::Into<crate::model::Job>,
4367 {
4368 self.0.request.job = v.map(|x| x.into());
4369 self
4370 }
4371
4372 pub fn set_update_mask<T>(mut self, v: T) -> Self
4376 where
4377 T: std::convert::Into<wkt::FieldMask>,
4378 {
4379 self.0.request.update_mask = std::option::Option::Some(v.into());
4380 self
4381 }
4382
4383 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4387 where
4388 T: std::convert::Into<wkt::FieldMask>,
4389 {
4390 self.0.request.update_mask = v.map(|x| x.into());
4391 self
4392 }
4393 }
4394
4395 #[doc(hidden)]
4396 impl gax::options::internal::RequestBuilder for UpdateJob {
4397 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4398 &mut self.0.options
4399 }
4400 }
4401
4402 #[derive(Clone, Debug)]
4419 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4420
4421 impl CancelJob {
4422 pub(crate) fn new(
4423 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4424 ) -> Self {
4425 Self(RequestBuilder::new(stub))
4426 }
4427
4428 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4430 self.0.request = v.into();
4431 self
4432 }
4433
4434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4436 self.0.options = v.into();
4437 self
4438 }
4439
4440 pub async fn send(self) -> Result<crate::model::Job> {
4442 (*self.0.stub)
4443 .cancel_job(self.0.request, self.0.options)
4444 .await
4445 .map(gax::response::Response::into_body)
4446 }
4447
4448 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4452 self.0.request.project_id = v.into();
4453 self
4454 }
4455
4456 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4460 self.0.request.region = v.into();
4461 self
4462 }
4463
4464 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4468 self.0.request.job_id = v.into();
4469 self
4470 }
4471 }
4472
4473 #[doc(hidden)]
4474 impl gax::options::internal::RequestBuilder for CancelJob {
4475 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4476 &mut self.0.options
4477 }
4478 }
4479
4480 #[derive(Clone, Debug)]
4497 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4498
4499 impl DeleteJob {
4500 pub(crate) fn new(
4501 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4502 ) -> Self {
4503 Self(RequestBuilder::new(stub))
4504 }
4505
4506 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4508 self.0.request = v.into();
4509 self
4510 }
4511
4512 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4514 self.0.options = v.into();
4515 self
4516 }
4517
4518 pub async fn send(self) -> Result<()> {
4520 (*self.0.stub)
4521 .delete_job(self.0.request, self.0.options)
4522 .await
4523 .map(gax::response::Response::into_body)
4524 }
4525
4526 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4530 self.0.request.project_id = v.into();
4531 self
4532 }
4533
4534 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4538 self.0.request.region = v.into();
4539 self
4540 }
4541
4542 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4546 self.0.request.job_id = v.into();
4547 self
4548 }
4549 }
4550
4551 #[doc(hidden)]
4552 impl gax::options::internal::RequestBuilder for DeleteJob {
4553 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4554 &mut self.0.options
4555 }
4556 }
4557
4558 #[derive(Clone, Debug)]
4575 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4576
4577 impl SetIamPolicy {
4578 pub(crate) fn new(
4579 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4580 ) -> Self {
4581 Self(RequestBuilder::new(stub))
4582 }
4583
4584 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4586 self.0.request = v.into();
4587 self
4588 }
4589
4590 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4592 self.0.options = v.into();
4593 self
4594 }
4595
4596 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4598 (*self.0.stub)
4599 .set_iam_policy(self.0.request, self.0.options)
4600 .await
4601 .map(gax::response::Response::into_body)
4602 }
4603
4604 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4608 self.0.request.resource = v.into();
4609 self
4610 }
4611
4612 pub fn set_policy<T>(mut self, v: T) -> Self
4616 where
4617 T: std::convert::Into<iam_v1::model::Policy>,
4618 {
4619 self.0.request.policy = std::option::Option::Some(v.into());
4620 self
4621 }
4622
4623 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4627 where
4628 T: std::convert::Into<iam_v1::model::Policy>,
4629 {
4630 self.0.request.policy = v.map(|x| x.into());
4631 self
4632 }
4633
4634 pub fn set_update_mask<T>(mut self, v: T) -> Self
4636 where
4637 T: std::convert::Into<wkt::FieldMask>,
4638 {
4639 self.0.request.update_mask = std::option::Option::Some(v.into());
4640 self
4641 }
4642
4643 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4645 where
4646 T: std::convert::Into<wkt::FieldMask>,
4647 {
4648 self.0.request.update_mask = v.map(|x| x.into());
4649 self
4650 }
4651 }
4652
4653 #[doc(hidden)]
4654 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4655 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4656 &mut self.0.options
4657 }
4658 }
4659
4660 #[derive(Clone, Debug)]
4677 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4678
4679 impl GetIamPolicy {
4680 pub(crate) fn new(
4681 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4682 ) -> Self {
4683 Self(RequestBuilder::new(stub))
4684 }
4685
4686 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4688 self.0.request = v.into();
4689 self
4690 }
4691
4692 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4694 self.0.options = v.into();
4695 self
4696 }
4697
4698 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4700 (*self.0.stub)
4701 .get_iam_policy(self.0.request, self.0.options)
4702 .await
4703 .map(gax::response::Response::into_body)
4704 }
4705
4706 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4710 self.0.request.resource = v.into();
4711 self
4712 }
4713
4714 pub fn set_options<T>(mut self, v: T) -> Self
4716 where
4717 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4718 {
4719 self.0.request.options = std::option::Option::Some(v.into());
4720 self
4721 }
4722
4723 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4725 where
4726 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
4727 {
4728 self.0.request.options = v.map(|x| x.into());
4729 self
4730 }
4731 }
4732
4733 #[doc(hidden)]
4734 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4735 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4736 &mut self.0.options
4737 }
4738 }
4739
4740 #[derive(Clone, Debug)]
4757 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4758
4759 impl TestIamPermissions {
4760 pub(crate) fn new(
4761 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4762 ) -> Self {
4763 Self(RequestBuilder::new(stub))
4764 }
4765
4766 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4768 mut self,
4769 v: V,
4770 ) -> Self {
4771 self.0.request = v.into();
4772 self
4773 }
4774
4775 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4777 self.0.options = v.into();
4778 self
4779 }
4780
4781 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4783 (*self.0.stub)
4784 .test_iam_permissions(self.0.request, self.0.options)
4785 .await
4786 .map(gax::response::Response::into_body)
4787 }
4788
4789 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4793 self.0.request.resource = v.into();
4794 self
4795 }
4796
4797 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4801 where
4802 T: std::iter::IntoIterator<Item = V>,
4803 V: std::convert::Into<std::string::String>,
4804 {
4805 use std::iter::Iterator;
4806 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4807 self
4808 }
4809 }
4810
4811 #[doc(hidden)]
4812 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4813 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4814 &mut self.0.options
4815 }
4816 }
4817
4818 #[derive(Clone, Debug)]
4839 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4840
4841 impl ListOperations {
4842 pub(crate) fn new(
4843 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4844 ) -> Self {
4845 Self(RequestBuilder::new(stub))
4846 }
4847
4848 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4850 mut self,
4851 v: V,
4852 ) -> Self {
4853 self.0.request = v.into();
4854 self
4855 }
4856
4857 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4859 self.0.options = v.into();
4860 self
4861 }
4862
4863 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4865 (*self.0.stub)
4866 .list_operations(self.0.request, self.0.options)
4867 .await
4868 .map(gax::response::Response::into_body)
4869 }
4870
4871 pub fn by_page(
4873 self,
4874 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4875 {
4876 use std::clone::Clone;
4877 let token = self.0.request.page_token.clone();
4878 let execute = move |token: String| {
4879 let mut builder = self.clone();
4880 builder.0.request = builder.0.request.set_page_token(token);
4881 builder.send()
4882 };
4883 gax::paginator::internal::new_paginator(token, execute)
4884 }
4885
4886 pub fn by_item(
4888 self,
4889 ) -> impl gax::paginator::ItemPaginator<
4890 longrunning::model::ListOperationsResponse,
4891 gax::error::Error,
4892 > {
4893 use gax::paginator::Paginator;
4894 self.by_page().items()
4895 }
4896
4897 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4899 self.0.request.name = v.into();
4900 self
4901 }
4902
4903 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4905 self.0.request.filter = v.into();
4906 self
4907 }
4908
4909 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4911 self.0.request.page_size = v.into();
4912 self
4913 }
4914
4915 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4917 self.0.request.page_token = v.into();
4918 self
4919 }
4920
4921 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4923 self.0.request.return_partial_success = v.into();
4924 self
4925 }
4926 }
4927
4928 #[doc(hidden)]
4929 impl gax::options::internal::RequestBuilder for ListOperations {
4930 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4931 &mut self.0.options
4932 }
4933 }
4934
4935 #[derive(Clone, Debug)]
4952 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4953
4954 impl GetOperation {
4955 pub(crate) fn new(
4956 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4957 ) -> Self {
4958 Self(RequestBuilder::new(stub))
4959 }
4960
4961 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4963 mut self,
4964 v: V,
4965 ) -> Self {
4966 self.0.request = v.into();
4967 self
4968 }
4969
4970 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4972 self.0.options = v.into();
4973 self
4974 }
4975
4976 pub async fn send(self) -> Result<longrunning::model::Operation> {
4978 (*self.0.stub)
4979 .get_operation(self.0.request, self.0.options)
4980 .await
4981 .map(gax::response::Response::into_body)
4982 }
4983
4984 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4986 self.0.request.name = v.into();
4987 self
4988 }
4989 }
4990
4991 #[doc(hidden)]
4992 impl gax::options::internal::RequestBuilder for GetOperation {
4993 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4994 &mut self.0.options
4995 }
4996 }
4997
4998 #[derive(Clone, Debug)]
5015 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5016
5017 impl DeleteOperation {
5018 pub(crate) fn new(
5019 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5020 ) -> Self {
5021 Self(RequestBuilder::new(stub))
5022 }
5023
5024 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5026 mut self,
5027 v: V,
5028 ) -> Self {
5029 self.0.request = v.into();
5030 self
5031 }
5032
5033 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5035 self.0.options = v.into();
5036 self
5037 }
5038
5039 pub async fn send(self) -> Result<()> {
5041 (*self.0.stub)
5042 .delete_operation(self.0.request, self.0.options)
5043 .await
5044 .map(gax::response::Response::into_body)
5045 }
5046
5047 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5049 self.0.request.name = v.into();
5050 self
5051 }
5052 }
5053
5054 #[doc(hidden)]
5055 impl gax::options::internal::RequestBuilder for DeleteOperation {
5056 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5057 &mut self.0.options
5058 }
5059 }
5060
5061 #[derive(Clone, Debug)]
5078 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5079
5080 impl CancelOperation {
5081 pub(crate) fn new(
5082 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5083 ) -> Self {
5084 Self(RequestBuilder::new(stub))
5085 }
5086
5087 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5089 mut self,
5090 v: V,
5091 ) -> Self {
5092 self.0.request = v.into();
5093 self
5094 }
5095
5096 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5098 self.0.options = v.into();
5099 self
5100 }
5101
5102 pub async fn send(self) -> Result<()> {
5104 (*self.0.stub)
5105 .cancel_operation(self.0.request, self.0.options)
5106 .await
5107 .map(gax::response::Response::into_body)
5108 }
5109
5110 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5112 self.0.request.name = v.into();
5113 self
5114 }
5115 }
5116
5117 #[doc(hidden)]
5118 impl gax::options::internal::RequestBuilder for CancelOperation {
5119 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5120 &mut self.0.options
5121 }
5122 }
5123}
5124
5125pub mod node_group_controller {
5126 use crate::Result;
5127
5128 pub type ClientBuilder =
5142 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5143
5144 pub(crate) mod client {
5145 use super::super::super::client::NodeGroupController;
5146 pub struct Factory;
5147 impl gax::client_builder::internal::ClientFactory for Factory {
5148 type Client = NodeGroupController;
5149 type Credentials = gaxi::options::Credentials;
5150 async fn build(
5151 self,
5152 config: gaxi::options::ClientConfig,
5153 ) -> gax::client_builder::Result<Self::Client> {
5154 Self::Client::new(config).await
5155 }
5156 }
5157 }
5158
5159 #[derive(Clone, Debug)]
5161 pub(crate) struct RequestBuilder<R: std::default::Default> {
5162 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5163 request: R,
5164 options: gax::options::RequestOptions,
5165 }
5166
5167 impl<R> RequestBuilder<R>
5168 where
5169 R: std::default::Default,
5170 {
5171 pub(crate) fn new(
5172 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5173 ) -> Self {
5174 Self {
5175 stub,
5176 request: R::default(),
5177 options: gax::options::RequestOptions::default(),
5178 }
5179 }
5180 }
5181
5182 #[derive(Clone, Debug)]
5200 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5201
5202 impl CreateNodeGroup {
5203 pub(crate) fn new(
5204 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5205 ) -> Self {
5206 Self(RequestBuilder::new(stub))
5207 }
5208
5209 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5211 self.0.request = v.into();
5212 self
5213 }
5214
5215 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5217 self.0.options = v.into();
5218 self
5219 }
5220
5221 pub async fn send(self) -> Result<longrunning::model::Operation> {
5228 (*self.0.stub)
5229 .create_node_group(self.0.request, self.0.options)
5230 .await
5231 .map(gax::response::Response::into_body)
5232 }
5233
5234 pub fn poller(
5236 self,
5237 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5238 {
5239 type Operation = lro::internal::Operation<
5240 crate::model::NodeGroup,
5241 crate::model::NodeGroupOperationMetadata,
5242 >;
5243 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5244 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5245
5246 let stub = self.0.stub.clone();
5247 let mut options = self.0.options.clone();
5248 options.set_retry_policy(gax::retry_policy::NeverRetry);
5249 let query = move |name| {
5250 let stub = stub.clone();
5251 let options = options.clone();
5252 async {
5253 let op = GetOperation::new(stub)
5254 .set_name(name)
5255 .with_options(options)
5256 .send()
5257 .await?;
5258 Ok(Operation::new(op))
5259 }
5260 };
5261
5262 let start = move || async {
5263 let op = self.send().await?;
5264 Ok(Operation::new(op))
5265 };
5266
5267 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5268 }
5269
5270 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5274 self.0.request.parent = v.into();
5275 self
5276 }
5277
5278 pub fn set_node_group<T>(mut self, v: T) -> Self
5282 where
5283 T: std::convert::Into<crate::model::NodeGroup>,
5284 {
5285 self.0.request.node_group = std::option::Option::Some(v.into());
5286 self
5287 }
5288
5289 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5293 where
5294 T: std::convert::Into<crate::model::NodeGroup>,
5295 {
5296 self.0.request.node_group = v.map(|x| x.into());
5297 self
5298 }
5299
5300 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5302 self.0.request.node_group_id = v.into();
5303 self
5304 }
5305
5306 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5308 self.0.request.request_id = v.into();
5309 self
5310 }
5311 }
5312
5313 #[doc(hidden)]
5314 impl gax::options::internal::RequestBuilder for CreateNodeGroup {
5315 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5316 &mut self.0.options
5317 }
5318 }
5319
5320 #[derive(Clone, Debug)]
5338 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5339
5340 impl ResizeNodeGroup {
5341 pub(crate) fn new(
5342 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5343 ) -> Self {
5344 Self(RequestBuilder::new(stub))
5345 }
5346
5347 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5349 self.0.request = v.into();
5350 self
5351 }
5352
5353 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5355 self.0.options = v.into();
5356 self
5357 }
5358
5359 pub async fn send(self) -> Result<longrunning::model::Operation> {
5366 (*self.0.stub)
5367 .resize_node_group(self.0.request, self.0.options)
5368 .await
5369 .map(gax::response::Response::into_body)
5370 }
5371
5372 pub fn poller(
5374 self,
5375 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
5376 {
5377 type Operation = lro::internal::Operation<
5378 crate::model::NodeGroup,
5379 crate::model::NodeGroupOperationMetadata,
5380 >;
5381 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5382 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5383
5384 let stub = self.0.stub.clone();
5385 let mut options = self.0.options.clone();
5386 options.set_retry_policy(gax::retry_policy::NeverRetry);
5387 let query = move |name| {
5388 let stub = stub.clone();
5389 let options = options.clone();
5390 async {
5391 let op = GetOperation::new(stub)
5392 .set_name(name)
5393 .with_options(options)
5394 .send()
5395 .await?;
5396 Ok(Operation::new(op))
5397 }
5398 };
5399
5400 let start = move || async {
5401 let op = self.send().await?;
5402 Ok(Operation::new(op))
5403 };
5404
5405 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5406 }
5407
5408 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5412 self.0.request.name = v.into();
5413 self
5414 }
5415
5416 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5420 self.0.request.size = v.into();
5421 self
5422 }
5423
5424 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5426 self.0.request.request_id = v.into();
5427 self
5428 }
5429
5430 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5432 where
5433 T: std::convert::Into<wkt::Duration>,
5434 {
5435 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5436 self
5437 }
5438
5439 pub fn set_or_clear_graceful_decommission_timeout<T>(
5441 mut self,
5442 v: std::option::Option<T>,
5443 ) -> Self
5444 where
5445 T: std::convert::Into<wkt::Duration>,
5446 {
5447 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5448 self
5449 }
5450 }
5451
5452 #[doc(hidden)]
5453 impl gax::options::internal::RequestBuilder for ResizeNodeGroup {
5454 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5455 &mut self.0.options
5456 }
5457 }
5458
5459 #[derive(Clone, Debug)]
5476 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5477
5478 impl GetNodeGroup {
5479 pub(crate) fn new(
5480 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5481 ) -> Self {
5482 Self(RequestBuilder::new(stub))
5483 }
5484
5485 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5487 self.0.request = v.into();
5488 self
5489 }
5490
5491 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5493 self.0.options = v.into();
5494 self
5495 }
5496
5497 pub async fn send(self) -> Result<crate::model::NodeGroup> {
5499 (*self.0.stub)
5500 .get_node_group(self.0.request, self.0.options)
5501 .await
5502 .map(gax::response::Response::into_body)
5503 }
5504
5505 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5509 self.0.request.name = v.into();
5510 self
5511 }
5512 }
5513
5514 #[doc(hidden)]
5515 impl gax::options::internal::RequestBuilder for GetNodeGroup {
5516 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5517 &mut self.0.options
5518 }
5519 }
5520
5521 #[derive(Clone, Debug)]
5538 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5539
5540 impl SetIamPolicy {
5541 pub(crate) fn new(
5542 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5543 ) -> Self {
5544 Self(RequestBuilder::new(stub))
5545 }
5546
5547 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5549 self.0.request = v.into();
5550 self
5551 }
5552
5553 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5555 self.0.options = v.into();
5556 self
5557 }
5558
5559 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5561 (*self.0.stub)
5562 .set_iam_policy(self.0.request, self.0.options)
5563 .await
5564 .map(gax::response::Response::into_body)
5565 }
5566
5567 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5571 self.0.request.resource = v.into();
5572 self
5573 }
5574
5575 pub fn set_policy<T>(mut self, v: T) -> Self
5579 where
5580 T: std::convert::Into<iam_v1::model::Policy>,
5581 {
5582 self.0.request.policy = std::option::Option::Some(v.into());
5583 self
5584 }
5585
5586 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5590 where
5591 T: std::convert::Into<iam_v1::model::Policy>,
5592 {
5593 self.0.request.policy = v.map(|x| x.into());
5594 self
5595 }
5596
5597 pub fn set_update_mask<T>(mut self, v: T) -> Self
5599 where
5600 T: std::convert::Into<wkt::FieldMask>,
5601 {
5602 self.0.request.update_mask = std::option::Option::Some(v.into());
5603 self
5604 }
5605
5606 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5608 where
5609 T: std::convert::Into<wkt::FieldMask>,
5610 {
5611 self.0.request.update_mask = v.map(|x| x.into());
5612 self
5613 }
5614 }
5615
5616 #[doc(hidden)]
5617 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5618 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5619 &mut self.0.options
5620 }
5621 }
5622
5623 #[derive(Clone, Debug)]
5640 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5641
5642 impl GetIamPolicy {
5643 pub(crate) fn new(
5644 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5645 ) -> Self {
5646 Self(RequestBuilder::new(stub))
5647 }
5648
5649 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5651 self.0.request = v.into();
5652 self
5653 }
5654
5655 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5657 self.0.options = v.into();
5658 self
5659 }
5660
5661 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5663 (*self.0.stub)
5664 .get_iam_policy(self.0.request, self.0.options)
5665 .await
5666 .map(gax::response::Response::into_body)
5667 }
5668
5669 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5673 self.0.request.resource = v.into();
5674 self
5675 }
5676
5677 pub fn set_options<T>(mut self, v: T) -> Self
5679 where
5680 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5681 {
5682 self.0.request.options = std::option::Option::Some(v.into());
5683 self
5684 }
5685
5686 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5688 where
5689 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5690 {
5691 self.0.request.options = v.map(|x| x.into());
5692 self
5693 }
5694 }
5695
5696 #[doc(hidden)]
5697 impl gax::options::internal::RequestBuilder for GetIamPolicy {
5698 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5699 &mut self.0.options
5700 }
5701 }
5702
5703 #[derive(Clone, Debug)]
5720 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5721
5722 impl TestIamPermissions {
5723 pub(crate) fn new(
5724 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5725 ) -> Self {
5726 Self(RequestBuilder::new(stub))
5727 }
5728
5729 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5731 mut self,
5732 v: V,
5733 ) -> Self {
5734 self.0.request = v.into();
5735 self
5736 }
5737
5738 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5740 self.0.options = v.into();
5741 self
5742 }
5743
5744 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5746 (*self.0.stub)
5747 .test_iam_permissions(self.0.request, self.0.options)
5748 .await
5749 .map(gax::response::Response::into_body)
5750 }
5751
5752 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5756 self.0.request.resource = v.into();
5757 self
5758 }
5759
5760 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5764 where
5765 T: std::iter::IntoIterator<Item = V>,
5766 V: std::convert::Into<std::string::String>,
5767 {
5768 use std::iter::Iterator;
5769 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5770 self
5771 }
5772 }
5773
5774 #[doc(hidden)]
5775 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5776 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5777 &mut self.0.options
5778 }
5779 }
5780
5781 #[derive(Clone, Debug)]
5802 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5803
5804 impl ListOperations {
5805 pub(crate) fn new(
5806 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5807 ) -> Self {
5808 Self(RequestBuilder::new(stub))
5809 }
5810
5811 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5813 mut self,
5814 v: V,
5815 ) -> Self {
5816 self.0.request = v.into();
5817 self
5818 }
5819
5820 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5822 self.0.options = v.into();
5823 self
5824 }
5825
5826 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5828 (*self.0.stub)
5829 .list_operations(self.0.request, self.0.options)
5830 .await
5831 .map(gax::response::Response::into_body)
5832 }
5833
5834 pub fn by_page(
5836 self,
5837 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5838 {
5839 use std::clone::Clone;
5840 let token = self.0.request.page_token.clone();
5841 let execute = move |token: String| {
5842 let mut builder = self.clone();
5843 builder.0.request = builder.0.request.set_page_token(token);
5844 builder.send()
5845 };
5846 gax::paginator::internal::new_paginator(token, execute)
5847 }
5848
5849 pub fn by_item(
5851 self,
5852 ) -> impl gax::paginator::ItemPaginator<
5853 longrunning::model::ListOperationsResponse,
5854 gax::error::Error,
5855 > {
5856 use gax::paginator::Paginator;
5857 self.by_page().items()
5858 }
5859
5860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5862 self.0.request.name = v.into();
5863 self
5864 }
5865
5866 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5868 self.0.request.filter = v.into();
5869 self
5870 }
5871
5872 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5874 self.0.request.page_size = v.into();
5875 self
5876 }
5877
5878 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5880 self.0.request.page_token = v.into();
5881 self
5882 }
5883
5884 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5886 self.0.request.return_partial_success = v.into();
5887 self
5888 }
5889 }
5890
5891 #[doc(hidden)]
5892 impl gax::options::internal::RequestBuilder for ListOperations {
5893 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5894 &mut self.0.options
5895 }
5896 }
5897
5898 #[derive(Clone, Debug)]
5915 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5916
5917 impl GetOperation {
5918 pub(crate) fn new(
5919 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5920 ) -> Self {
5921 Self(RequestBuilder::new(stub))
5922 }
5923
5924 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5926 mut self,
5927 v: V,
5928 ) -> Self {
5929 self.0.request = v.into();
5930 self
5931 }
5932
5933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5935 self.0.options = v.into();
5936 self
5937 }
5938
5939 pub async fn send(self) -> Result<longrunning::model::Operation> {
5941 (*self.0.stub)
5942 .get_operation(self.0.request, self.0.options)
5943 .await
5944 .map(gax::response::Response::into_body)
5945 }
5946
5947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5949 self.0.request.name = v.into();
5950 self
5951 }
5952 }
5953
5954 #[doc(hidden)]
5955 impl gax::options::internal::RequestBuilder for GetOperation {
5956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5957 &mut self.0.options
5958 }
5959 }
5960
5961 #[derive(Clone, Debug)]
5978 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5979
5980 impl DeleteOperation {
5981 pub(crate) fn new(
5982 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5983 ) -> Self {
5984 Self(RequestBuilder::new(stub))
5985 }
5986
5987 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5989 mut self,
5990 v: V,
5991 ) -> Self {
5992 self.0.request = v.into();
5993 self
5994 }
5995
5996 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5998 self.0.options = v.into();
5999 self
6000 }
6001
6002 pub async fn send(self) -> Result<()> {
6004 (*self.0.stub)
6005 .delete_operation(self.0.request, self.0.options)
6006 .await
6007 .map(gax::response::Response::into_body)
6008 }
6009
6010 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6012 self.0.request.name = v.into();
6013 self
6014 }
6015 }
6016
6017 #[doc(hidden)]
6018 impl gax::options::internal::RequestBuilder for DeleteOperation {
6019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6020 &mut self.0.options
6021 }
6022 }
6023
6024 #[derive(Clone, Debug)]
6041 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6042
6043 impl CancelOperation {
6044 pub(crate) fn new(
6045 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6046 ) -> Self {
6047 Self(RequestBuilder::new(stub))
6048 }
6049
6050 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6052 mut self,
6053 v: V,
6054 ) -> Self {
6055 self.0.request = v.into();
6056 self
6057 }
6058
6059 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6061 self.0.options = v.into();
6062 self
6063 }
6064
6065 pub async fn send(self) -> Result<()> {
6067 (*self.0.stub)
6068 .cancel_operation(self.0.request, self.0.options)
6069 .await
6070 .map(gax::response::Response::into_body)
6071 }
6072
6073 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6075 self.0.request.name = v.into();
6076 self
6077 }
6078 }
6079
6080 #[doc(hidden)]
6081 impl gax::options::internal::RequestBuilder for CancelOperation {
6082 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6083 &mut self.0.options
6084 }
6085 }
6086}
6087
6088pub mod session_template_controller {
6089 use crate::Result;
6090
6091 pub type ClientBuilder =
6105 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6106
6107 pub(crate) mod client {
6108 use super::super::super::client::SessionTemplateController;
6109 pub struct Factory;
6110 impl gax::client_builder::internal::ClientFactory for Factory {
6111 type Client = SessionTemplateController;
6112 type Credentials = gaxi::options::Credentials;
6113 async fn build(
6114 self,
6115 config: gaxi::options::ClientConfig,
6116 ) -> gax::client_builder::Result<Self::Client> {
6117 Self::Client::new(config).await
6118 }
6119 }
6120 }
6121
6122 #[derive(Clone, Debug)]
6124 pub(crate) struct RequestBuilder<R: std::default::Default> {
6125 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6126 request: R,
6127 options: gax::options::RequestOptions,
6128 }
6129
6130 impl<R> RequestBuilder<R>
6131 where
6132 R: std::default::Default,
6133 {
6134 pub(crate) fn new(
6135 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6136 ) -> Self {
6137 Self {
6138 stub,
6139 request: R::default(),
6140 options: gax::options::RequestOptions::default(),
6141 }
6142 }
6143 }
6144
6145 #[derive(Clone, Debug)]
6162 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6163
6164 impl CreateSessionTemplate {
6165 pub(crate) fn new(
6166 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6167 ) -> Self {
6168 Self(RequestBuilder::new(stub))
6169 }
6170
6171 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6173 mut self,
6174 v: V,
6175 ) -> Self {
6176 self.0.request = v.into();
6177 self
6178 }
6179
6180 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6182 self.0.options = v.into();
6183 self
6184 }
6185
6186 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6188 (*self.0.stub)
6189 .create_session_template(self.0.request, self.0.options)
6190 .await
6191 .map(gax::response::Response::into_body)
6192 }
6193
6194 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6198 self.0.request.parent = v.into();
6199 self
6200 }
6201
6202 pub fn set_session_template<T>(mut self, v: T) -> Self
6206 where
6207 T: std::convert::Into<crate::model::SessionTemplate>,
6208 {
6209 self.0.request.session_template = std::option::Option::Some(v.into());
6210 self
6211 }
6212
6213 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6217 where
6218 T: std::convert::Into<crate::model::SessionTemplate>,
6219 {
6220 self.0.request.session_template = v.map(|x| x.into());
6221 self
6222 }
6223 }
6224
6225 #[doc(hidden)]
6226 impl gax::options::internal::RequestBuilder for CreateSessionTemplate {
6227 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6228 &mut self.0.options
6229 }
6230 }
6231
6232 #[derive(Clone, Debug)]
6249 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6250
6251 impl UpdateSessionTemplate {
6252 pub(crate) fn new(
6253 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6254 ) -> Self {
6255 Self(RequestBuilder::new(stub))
6256 }
6257
6258 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6260 mut self,
6261 v: V,
6262 ) -> Self {
6263 self.0.request = v.into();
6264 self
6265 }
6266
6267 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6269 self.0.options = v.into();
6270 self
6271 }
6272
6273 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6275 (*self.0.stub)
6276 .update_session_template(self.0.request, self.0.options)
6277 .await
6278 .map(gax::response::Response::into_body)
6279 }
6280
6281 pub fn set_session_template<T>(mut self, v: T) -> Self
6285 where
6286 T: std::convert::Into<crate::model::SessionTemplate>,
6287 {
6288 self.0.request.session_template = std::option::Option::Some(v.into());
6289 self
6290 }
6291
6292 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6296 where
6297 T: std::convert::Into<crate::model::SessionTemplate>,
6298 {
6299 self.0.request.session_template = v.map(|x| x.into());
6300 self
6301 }
6302 }
6303
6304 #[doc(hidden)]
6305 impl gax::options::internal::RequestBuilder for UpdateSessionTemplate {
6306 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6307 &mut self.0.options
6308 }
6309 }
6310
6311 #[derive(Clone, Debug)]
6328 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6329
6330 impl GetSessionTemplate {
6331 pub(crate) fn new(
6332 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6333 ) -> Self {
6334 Self(RequestBuilder::new(stub))
6335 }
6336
6337 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6339 mut self,
6340 v: V,
6341 ) -> Self {
6342 self.0.request = v.into();
6343 self
6344 }
6345
6346 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6348 self.0.options = v.into();
6349 self
6350 }
6351
6352 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6354 (*self.0.stub)
6355 .get_session_template(self.0.request, self.0.options)
6356 .await
6357 .map(gax::response::Response::into_body)
6358 }
6359
6360 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6364 self.0.request.name = v.into();
6365 self
6366 }
6367 }
6368
6369 #[doc(hidden)]
6370 impl gax::options::internal::RequestBuilder for GetSessionTemplate {
6371 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6372 &mut self.0.options
6373 }
6374 }
6375
6376 #[derive(Clone, Debug)]
6397 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6398
6399 impl ListSessionTemplates {
6400 pub(crate) fn new(
6401 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6402 ) -> Self {
6403 Self(RequestBuilder::new(stub))
6404 }
6405
6406 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6408 mut self,
6409 v: V,
6410 ) -> Self {
6411 self.0.request = v.into();
6412 self
6413 }
6414
6415 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6417 self.0.options = v.into();
6418 self
6419 }
6420
6421 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6423 (*self.0.stub)
6424 .list_session_templates(self.0.request, self.0.options)
6425 .await
6426 .map(gax::response::Response::into_body)
6427 }
6428
6429 pub fn by_page(
6431 self,
6432 ) -> impl gax::paginator::Paginator<crate::model::ListSessionTemplatesResponse, gax::error::Error>
6433 {
6434 use std::clone::Clone;
6435 let token = self.0.request.page_token.clone();
6436 let execute = move |token: String| {
6437 let mut builder = self.clone();
6438 builder.0.request = builder.0.request.set_page_token(token);
6439 builder.send()
6440 };
6441 gax::paginator::internal::new_paginator(token, execute)
6442 }
6443
6444 pub fn by_item(
6446 self,
6447 ) -> impl gax::paginator::ItemPaginator<
6448 crate::model::ListSessionTemplatesResponse,
6449 gax::error::Error,
6450 > {
6451 use gax::paginator::Paginator;
6452 self.by_page().items()
6453 }
6454
6455 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6459 self.0.request.parent = v.into();
6460 self
6461 }
6462
6463 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6465 self.0.request.page_size = v.into();
6466 self
6467 }
6468
6469 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6471 self.0.request.page_token = v.into();
6472 self
6473 }
6474
6475 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6477 self.0.request.filter = v.into();
6478 self
6479 }
6480 }
6481
6482 #[doc(hidden)]
6483 impl gax::options::internal::RequestBuilder for ListSessionTemplates {
6484 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6485 &mut self.0.options
6486 }
6487 }
6488
6489 #[derive(Clone, Debug)]
6506 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6507
6508 impl DeleteSessionTemplate {
6509 pub(crate) fn new(
6510 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6511 ) -> Self {
6512 Self(RequestBuilder::new(stub))
6513 }
6514
6515 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6517 mut self,
6518 v: V,
6519 ) -> Self {
6520 self.0.request = v.into();
6521 self
6522 }
6523
6524 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6526 self.0.options = v.into();
6527 self
6528 }
6529
6530 pub async fn send(self) -> Result<()> {
6532 (*self.0.stub)
6533 .delete_session_template(self.0.request, self.0.options)
6534 .await
6535 .map(gax::response::Response::into_body)
6536 }
6537
6538 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6542 self.0.request.name = v.into();
6543 self
6544 }
6545 }
6546
6547 #[doc(hidden)]
6548 impl gax::options::internal::RequestBuilder for DeleteSessionTemplate {
6549 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6550 &mut self.0.options
6551 }
6552 }
6553
6554 #[derive(Clone, Debug)]
6571 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6572
6573 impl SetIamPolicy {
6574 pub(crate) fn new(
6575 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6576 ) -> Self {
6577 Self(RequestBuilder::new(stub))
6578 }
6579
6580 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6582 self.0.request = v.into();
6583 self
6584 }
6585
6586 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6588 self.0.options = v.into();
6589 self
6590 }
6591
6592 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6594 (*self.0.stub)
6595 .set_iam_policy(self.0.request, self.0.options)
6596 .await
6597 .map(gax::response::Response::into_body)
6598 }
6599
6600 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6604 self.0.request.resource = v.into();
6605 self
6606 }
6607
6608 pub fn set_policy<T>(mut self, v: T) -> Self
6612 where
6613 T: std::convert::Into<iam_v1::model::Policy>,
6614 {
6615 self.0.request.policy = std::option::Option::Some(v.into());
6616 self
6617 }
6618
6619 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6623 where
6624 T: std::convert::Into<iam_v1::model::Policy>,
6625 {
6626 self.0.request.policy = v.map(|x| x.into());
6627 self
6628 }
6629
6630 pub fn set_update_mask<T>(mut self, v: T) -> Self
6632 where
6633 T: std::convert::Into<wkt::FieldMask>,
6634 {
6635 self.0.request.update_mask = std::option::Option::Some(v.into());
6636 self
6637 }
6638
6639 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6641 where
6642 T: std::convert::Into<wkt::FieldMask>,
6643 {
6644 self.0.request.update_mask = v.map(|x| x.into());
6645 self
6646 }
6647 }
6648
6649 #[doc(hidden)]
6650 impl gax::options::internal::RequestBuilder for SetIamPolicy {
6651 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6652 &mut self.0.options
6653 }
6654 }
6655
6656 #[derive(Clone, Debug)]
6673 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6674
6675 impl GetIamPolicy {
6676 pub(crate) fn new(
6677 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6678 ) -> Self {
6679 Self(RequestBuilder::new(stub))
6680 }
6681
6682 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6684 self.0.request = v.into();
6685 self
6686 }
6687
6688 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6690 self.0.options = v.into();
6691 self
6692 }
6693
6694 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6696 (*self.0.stub)
6697 .get_iam_policy(self.0.request, self.0.options)
6698 .await
6699 .map(gax::response::Response::into_body)
6700 }
6701
6702 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6706 self.0.request.resource = v.into();
6707 self
6708 }
6709
6710 pub fn set_options<T>(mut self, v: T) -> Self
6712 where
6713 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6714 {
6715 self.0.request.options = std::option::Option::Some(v.into());
6716 self
6717 }
6718
6719 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6721 where
6722 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
6723 {
6724 self.0.request.options = v.map(|x| x.into());
6725 self
6726 }
6727 }
6728
6729 #[doc(hidden)]
6730 impl gax::options::internal::RequestBuilder for GetIamPolicy {
6731 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6732 &mut self.0.options
6733 }
6734 }
6735
6736 #[derive(Clone, Debug)]
6753 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6754
6755 impl TestIamPermissions {
6756 pub(crate) fn new(
6757 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6758 ) -> Self {
6759 Self(RequestBuilder::new(stub))
6760 }
6761
6762 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6764 mut self,
6765 v: V,
6766 ) -> Self {
6767 self.0.request = v.into();
6768 self
6769 }
6770
6771 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6773 self.0.options = v.into();
6774 self
6775 }
6776
6777 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6779 (*self.0.stub)
6780 .test_iam_permissions(self.0.request, self.0.options)
6781 .await
6782 .map(gax::response::Response::into_body)
6783 }
6784
6785 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6789 self.0.request.resource = v.into();
6790 self
6791 }
6792
6793 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6797 where
6798 T: std::iter::IntoIterator<Item = V>,
6799 V: std::convert::Into<std::string::String>,
6800 {
6801 use std::iter::Iterator;
6802 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6803 self
6804 }
6805 }
6806
6807 #[doc(hidden)]
6808 impl gax::options::internal::RequestBuilder for TestIamPermissions {
6809 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6810 &mut self.0.options
6811 }
6812 }
6813
6814 #[derive(Clone, Debug)]
6835 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6836
6837 impl ListOperations {
6838 pub(crate) fn new(
6839 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6840 ) -> Self {
6841 Self(RequestBuilder::new(stub))
6842 }
6843
6844 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6846 mut self,
6847 v: V,
6848 ) -> Self {
6849 self.0.request = v.into();
6850 self
6851 }
6852
6853 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6855 self.0.options = v.into();
6856 self
6857 }
6858
6859 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6861 (*self.0.stub)
6862 .list_operations(self.0.request, self.0.options)
6863 .await
6864 .map(gax::response::Response::into_body)
6865 }
6866
6867 pub fn by_page(
6869 self,
6870 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6871 {
6872 use std::clone::Clone;
6873 let token = self.0.request.page_token.clone();
6874 let execute = move |token: String| {
6875 let mut builder = self.clone();
6876 builder.0.request = builder.0.request.set_page_token(token);
6877 builder.send()
6878 };
6879 gax::paginator::internal::new_paginator(token, execute)
6880 }
6881
6882 pub fn by_item(
6884 self,
6885 ) -> impl gax::paginator::ItemPaginator<
6886 longrunning::model::ListOperationsResponse,
6887 gax::error::Error,
6888 > {
6889 use gax::paginator::Paginator;
6890 self.by_page().items()
6891 }
6892
6893 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6895 self.0.request.name = v.into();
6896 self
6897 }
6898
6899 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6901 self.0.request.filter = v.into();
6902 self
6903 }
6904
6905 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6907 self.0.request.page_size = v.into();
6908 self
6909 }
6910
6911 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6913 self.0.request.page_token = v.into();
6914 self
6915 }
6916
6917 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6919 self.0.request.return_partial_success = v.into();
6920 self
6921 }
6922 }
6923
6924 #[doc(hidden)]
6925 impl gax::options::internal::RequestBuilder for ListOperations {
6926 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6927 &mut self.0.options
6928 }
6929 }
6930
6931 #[derive(Clone, Debug)]
6948 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6949
6950 impl GetOperation {
6951 pub(crate) fn new(
6952 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6953 ) -> Self {
6954 Self(RequestBuilder::new(stub))
6955 }
6956
6957 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6959 mut self,
6960 v: V,
6961 ) -> Self {
6962 self.0.request = v.into();
6963 self
6964 }
6965
6966 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6968 self.0.options = v.into();
6969 self
6970 }
6971
6972 pub async fn send(self) -> Result<longrunning::model::Operation> {
6974 (*self.0.stub)
6975 .get_operation(self.0.request, self.0.options)
6976 .await
6977 .map(gax::response::Response::into_body)
6978 }
6979
6980 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6982 self.0.request.name = v.into();
6983 self
6984 }
6985 }
6986
6987 #[doc(hidden)]
6988 impl gax::options::internal::RequestBuilder for GetOperation {
6989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6990 &mut self.0.options
6991 }
6992 }
6993
6994 #[derive(Clone, Debug)]
7011 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7012
7013 impl DeleteOperation {
7014 pub(crate) fn new(
7015 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7016 ) -> Self {
7017 Self(RequestBuilder::new(stub))
7018 }
7019
7020 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7022 mut self,
7023 v: V,
7024 ) -> Self {
7025 self.0.request = v.into();
7026 self
7027 }
7028
7029 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7031 self.0.options = v.into();
7032 self
7033 }
7034
7035 pub async fn send(self) -> Result<()> {
7037 (*self.0.stub)
7038 .delete_operation(self.0.request, self.0.options)
7039 .await
7040 .map(gax::response::Response::into_body)
7041 }
7042
7043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7045 self.0.request.name = v.into();
7046 self
7047 }
7048 }
7049
7050 #[doc(hidden)]
7051 impl gax::options::internal::RequestBuilder for DeleteOperation {
7052 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7053 &mut self.0.options
7054 }
7055 }
7056
7057 #[derive(Clone, Debug)]
7074 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7075
7076 impl CancelOperation {
7077 pub(crate) fn new(
7078 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7079 ) -> Self {
7080 Self(RequestBuilder::new(stub))
7081 }
7082
7083 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7085 mut self,
7086 v: V,
7087 ) -> Self {
7088 self.0.request = v.into();
7089 self
7090 }
7091
7092 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7094 self.0.options = v.into();
7095 self
7096 }
7097
7098 pub async fn send(self) -> Result<()> {
7100 (*self.0.stub)
7101 .cancel_operation(self.0.request, self.0.options)
7102 .await
7103 .map(gax::response::Response::into_body)
7104 }
7105
7106 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7108 self.0.request.name = v.into();
7109 self
7110 }
7111 }
7112
7113 #[doc(hidden)]
7114 impl gax::options::internal::RequestBuilder for CancelOperation {
7115 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7116 &mut self.0.options
7117 }
7118 }
7119}
7120
7121pub mod session_controller {
7122 use crate::Result;
7123
7124 pub type ClientBuilder =
7138 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7139
7140 pub(crate) mod client {
7141 use super::super::super::client::SessionController;
7142 pub struct Factory;
7143 impl gax::client_builder::internal::ClientFactory for Factory {
7144 type Client = SessionController;
7145 type Credentials = gaxi::options::Credentials;
7146 async fn build(
7147 self,
7148 config: gaxi::options::ClientConfig,
7149 ) -> gax::client_builder::Result<Self::Client> {
7150 Self::Client::new(config).await
7151 }
7152 }
7153 }
7154
7155 #[derive(Clone, Debug)]
7157 pub(crate) struct RequestBuilder<R: std::default::Default> {
7158 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7159 request: R,
7160 options: gax::options::RequestOptions,
7161 }
7162
7163 impl<R> RequestBuilder<R>
7164 where
7165 R: std::default::Default,
7166 {
7167 pub(crate) fn new(
7168 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7169 ) -> Self {
7170 Self {
7171 stub,
7172 request: R::default(),
7173 options: gax::options::RequestOptions::default(),
7174 }
7175 }
7176 }
7177
7178 #[derive(Clone, Debug)]
7196 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7197
7198 impl CreateSession {
7199 pub(crate) fn new(
7200 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7201 ) -> Self {
7202 Self(RequestBuilder::new(stub))
7203 }
7204
7205 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7207 self.0.request = v.into();
7208 self
7209 }
7210
7211 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7213 self.0.options = v.into();
7214 self
7215 }
7216
7217 pub async fn send(self) -> Result<longrunning::model::Operation> {
7224 (*self.0.stub)
7225 .create_session(self.0.request, self.0.options)
7226 .await
7227 .map(gax::response::Response::into_body)
7228 }
7229
7230 pub fn poller(
7232 self,
7233 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7234 {
7235 type Operation = lro::internal::Operation<
7236 crate::model::Session,
7237 crate::model::SessionOperationMetadata,
7238 >;
7239 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7240 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7241
7242 let stub = self.0.stub.clone();
7243 let mut options = self.0.options.clone();
7244 options.set_retry_policy(gax::retry_policy::NeverRetry);
7245 let query = move |name| {
7246 let stub = stub.clone();
7247 let options = options.clone();
7248 async {
7249 let op = GetOperation::new(stub)
7250 .set_name(name)
7251 .with_options(options)
7252 .send()
7253 .await?;
7254 Ok(Operation::new(op))
7255 }
7256 };
7257
7258 let start = move || async {
7259 let op = self.send().await?;
7260 Ok(Operation::new(op))
7261 };
7262
7263 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7264 }
7265
7266 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7270 self.0.request.parent = v.into();
7271 self
7272 }
7273
7274 pub fn set_session<T>(mut self, v: T) -> Self
7278 where
7279 T: std::convert::Into<crate::model::Session>,
7280 {
7281 self.0.request.session = std::option::Option::Some(v.into());
7282 self
7283 }
7284
7285 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7289 where
7290 T: std::convert::Into<crate::model::Session>,
7291 {
7292 self.0.request.session = v.map(|x| x.into());
7293 self
7294 }
7295
7296 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7300 self.0.request.session_id = v.into();
7301 self
7302 }
7303
7304 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7306 self.0.request.request_id = v.into();
7307 self
7308 }
7309 }
7310
7311 #[doc(hidden)]
7312 impl gax::options::internal::RequestBuilder for CreateSession {
7313 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7314 &mut self.0.options
7315 }
7316 }
7317
7318 #[derive(Clone, Debug)]
7335 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7336
7337 impl GetSession {
7338 pub(crate) fn new(
7339 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7340 ) -> Self {
7341 Self(RequestBuilder::new(stub))
7342 }
7343
7344 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7346 self.0.request = v.into();
7347 self
7348 }
7349
7350 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7352 self.0.options = v.into();
7353 self
7354 }
7355
7356 pub async fn send(self) -> Result<crate::model::Session> {
7358 (*self.0.stub)
7359 .get_session(self.0.request, self.0.options)
7360 .await
7361 .map(gax::response::Response::into_body)
7362 }
7363
7364 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7368 self.0.request.name = v.into();
7369 self
7370 }
7371 }
7372
7373 #[doc(hidden)]
7374 impl gax::options::internal::RequestBuilder for GetSession {
7375 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7376 &mut self.0.options
7377 }
7378 }
7379
7380 #[derive(Clone, Debug)]
7401 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7402
7403 impl ListSessions {
7404 pub(crate) fn new(
7405 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7406 ) -> Self {
7407 Self(RequestBuilder::new(stub))
7408 }
7409
7410 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7412 self.0.request = v.into();
7413 self
7414 }
7415
7416 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7418 self.0.options = v.into();
7419 self
7420 }
7421
7422 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7424 (*self.0.stub)
7425 .list_sessions(self.0.request, self.0.options)
7426 .await
7427 .map(gax::response::Response::into_body)
7428 }
7429
7430 pub fn by_page(
7432 self,
7433 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
7434 {
7435 use std::clone::Clone;
7436 let token = self.0.request.page_token.clone();
7437 let execute = move |token: String| {
7438 let mut builder = self.clone();
7439 builder.0.request = builder.0.request.set_page_token(token);
7440 builder.send()
7441 };
7442 gax::paginator::internal::new_paginator(token, execute)
7443 }
7444
7445 pub fn by_item(
7447 self,
7448 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
7449 {
7450 use gax::paginator::Paginator;
7451 self.by_page().items()
7452 }
7453
7454 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7458 self.0.request.parent = v.into();
7459 self
7460 }
7461
7462 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7464 self.0.request.page_size = v.into();
7465 self
7466 }
7467
7468 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7470 self.0.request.page_token = v.into();
7471 self
7472 }
7473
7474 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7476 self.0.request.filter = v.into();
7477 self
7478 }
7479 }
7480
7481 #[doc(hidden)]
7482 impl gax::options::internal::RequestBuilder for ListSessions {
7483 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7484 &mut self.0.options
7485 }
7486 }
7487
7488 #[derive(Clone, Debug)]
7506 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7507
7508 impl TerminateSession {
7509 pub(crate) fn new(
7510 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7511 ) -> Self {
7512 Self(RequestBuilder::new(stub))
7513 }
7514
7515 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7517 mut self,
7518 v: V,
7519 ) -> Self {
7520 self.0.request = v.into();
7521 self
7522 }
7523
7524 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7526 self.0.options = v.into();
7527 self
7528 }
7529
7530 pub async fn send(self) -> Result<longrunning::model::Operation> {
7537 (*self.0.stub)
7538 .terminate_session(self.0.request, self.0.options)
7539 .await
7540 .map(gax::response::Response::into_body)
7541 }
7542
7543 pub fn poller(
7545 self,
7546 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7547 {
7548 type Operation = lro::internal::Operation<
7549 crate::model::Session,
7550 crate::model::SessionOperationMetadata,
7551 >;
7552 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7553 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7554
7555 let stub = self.0.stub.clone();
7556 let mut options = self.0.options.clone();
7557 options.set_retry_policy(gax::retry_policy::NeverRetry);
7558 let query = move |name| {
7559 let stub = stub.clone();
7560 let options = options.clone();
7561 async {
7562 let op = GetOperation::new(stub)
7563 .set_name(name)
7564 .with_options(options)
7565 .send()
7566 .await?;
7567 Ok(Operation::new(op))
7568 }
7569 };
7570
7571 let start = move || async {
7572 let op = self.send().await?;
7573 Ok(Operation::new(op))
7574 };
7575
7576 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7577 }
7578
7579 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7583 self.0.request.name = v.into();
7584 self
7585 }
7586
7587 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7589 self.0.request.request_id = v.into();
7590 self
7591 }
7592 }
7593
7594 #[doc(hidden)]
7595 impl gax::options::internal::RequestBuilder for TerminateSession {
7596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7597 &mut self.0.options
7598 }
7599 }
7600
7601 #[derive(Clone, Debug)]
7619 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7620
7621 impl DeleteSession {
7622 pub(crate) fn new(
7623 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7624 ) -> Self {
7625 Self(RequestBuilder::new(stub))
7626 }
7627
7628 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7630 self.0.request = v.into();
7631 self
7632 }
7633
7634 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7636 self.0.options = v.into();
7637 self
7638 }
7639
7640 pub async fn send(self) -> Result<longrunning::model::Operation> {
7647 (*self.0.stub)
7648 .delete_session(self.0.request, self.0.options)
7649 .await
7650 .map(gax::response::Response::into_body)
7651 }
7652
7653 pub fn poller(
7655 self,
7656 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7657 {
7658 type Operation = lro::internal::Operation<
7659 crate::model::Session,
7660 crate::model::SessionOperationMetadata,
7661 >;
7662 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7663 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7664
7665 let stub = self.0.stub.clone();
7666 let mut options = self.0.options.clone();
7667 options.set_retry_policy(gax::retry_policy::NeverRetry);
7668 let query = move |name| {
7669 let stub = stub.clone();
7670 let options = options.clone();
7671 async {
7672 let op = GetOperation::new(stub)
7673 .set_name(name)
7674 .with_options(options)
7675 .send()
7676 .await?;
7677 Ok(Operation::new(op))
7678 }
7679 };
7680
7681 let start = move || async {
7682 let op = self.send().await?;
7683 Ok(Operation::new(op))
7684 };
7685
7686 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7687 }
7688
7689 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7693 self.0.request.name = v.into();
7694 self
7695 }
7696
7697 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7699 self.0.request.request_id = v.into();
7700 self
7701 }
7702 }
7703
7704 #[doc(hidden)]
7705 impl gax::options::internal::RequestBuilder for DeleteSession {
7706 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7707 &mut self.0.options
7708 }
7709 }
7710
7711 #[derive(Clone, Debug)]
7728 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
7729
7730 impl SetIamPolicy {
7731 pub(crate) fn new(
7732 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7733 ) -> Self {
7734 Self(RequestBuilder::new(stub))
7735 }
7736
7737 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
7739 self.0.request = v.into();
7740 self
7741 }
7742
7743 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7745 self.0.options = v.into();
7746 self
7747 }
7748
7749 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7751 (*self.0.stub)
7752 .set_iam_policy(self.0.request, self.0.options)
7753 .await
7754 .map(gax::response::Response::into_body)
7755 }
7756
7757 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7761 self.0.request.resource = v.into();
7762 self
7763 }
7764
7765 pub fn set_policy<T>(mut self, v: T) -> Self
7769 where
7770 T: std::convert::Into<iam_v1::model::Policy>,
7771 {
7772 self.0.request.policy = std::option::Option::Some(v.into());
7773 self
7774 }
7775
7776 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7780 where
7781 T: std::convert::Into<iam_v1::model::Policy>,
7782 {
7783 self.0.request.policy = v.map(|x| x.into());
7784 self
7785 }
7786
7787 pub fn set_update_mask<T>(mut self, v: T) -> Self
7789 where
7790 T: std::convert::Into<wkt::FieldMask>,
7791 {
7792 self.0.request.update_mask = std::option::Option::Some(v.into());
7793 self
7794 }
7795
7796 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7798 where
7799 T: std::convert::Into<wkt::FieldMask>,
7800 {
7801 self.0.request.update_mask = v.map(|x| x.into());
7802 self
7803 }
7804 }
7805
7806 #[doc(hidden)]
7807 impl gax::options::internal::RequestBuilder for SetIamPolicy {
7808 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7809 &mut self.0.options
7810 }
7811 }
7812
7813 #[derive(Clone, Debug)]
7830 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
7831
7832 impl GetIamPolicy {
7833 pub(crate) fn new(
7834 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7835 ) -> Self {
7836 Self(RequestBuilder::new(stub))
7837 }
7838
7839 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
7841 self.0.request = v.into();
7842 self
7843 }
7844
7845 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7847 self.0.options = v.into();
7848 self
7849 }
7850
7851 pub async fn send(self) -> Result<iam_v1::model::Policy> {
7853 (*self.0.stub)
7854 .get_iam_policy(self.0.request, self.0.options)
7855 .await
7856 .map(gax::response::Response::into_body)
7857 }
7858
7859 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7863 self.0.request.resource = v.into();
7864 self
7865 }
7866
7867 pub fn set_options<T>(mut self, v: T) -> Self
7869 where
7870 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7871 {
7872 self.0.request.options = std::option::Option::Some(v.into());
7873 self
7874 }
7875
7876 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7878 where
7879 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7880 {
7881 self.0.request.options = v.map(|x| x.into());
7882 self
7883 }
7884 }
7885
7886 #[doc(hidden)]
7887 impl gax::options::internal::RequestBuilder for GetIamPolicy {
7888 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7889 &mut self.0.options
7890 }
7891 }
7892
7893 #[derive(Clone, Debug)]
7910 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
7911
7912 impl TestIamPermissions {
7913 pub(crate) fn new(
7914 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7915 ) -> Self {
7916 Self(RequestBuilder::new(stub))
7917 }
7918
7919 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
7921 mut self,
7922 v: V,
7923 ) -> Self {
7924 self.0.request = v.into();
7925 self
7926 }
7927
7928 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7930 self.0.options = v.into();
7931 self
7932 }
7933
7934 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
7936 (*self.0.stub)
7937 .test_iam_permissions(self.0.request, self.0.options)
7938 .await
7939 .map(gax::response::Response::into_body)
7940 }
7941
7942 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7946 self.0.request.resource = v.into();
7947 self
7948 }
7949
7950 pub fn set_permissions<T, V>(mut self, v: T) -> Self
7954 where
7955 T: std::iter::IntoIterator<Item = V>,
7956 V: std::convert::Into<std::string::String>,
7957 {
7958 use std::iter::Iterator;
7959 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7960 self
7961 }
7962 }
7963
7964 #[doc(hidden)]
7965 impl gax::options::internal::RequestBuilder for TestIamPermissions {
7966 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7967 &mut self.0.options
7968 }
7969 }
7970
7971 #[derive(Clone, Debug)]
7992 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7993
7994 impl ListOperations {
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<longrunning::model::ListOperationsRequest>>(
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<longrunning::model::ListOperationsResponse> {
8018 (*self.0.stub)
8019 .list_operations(self.0.request, self.0.options)
8020 .await
8021 .map(gax::response::Response::into_body)
8022 }
8023
8024 pub fn by_page(
8026 self,
8027 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8028 {
8029 use std::clone::Clone;
8030 let token = self.0.request.page_token.clone();
8031 let execute = move |token: String| {
8032 let mut builder = self.clone();
8033 builder.0.request = builder.0.request.set_page_token(token);
8034 builder.send()
8035 };
8036 gax::paginator::internal::new_paginator(token, execute)
8037 }
8038
8039 pub fn by_item(
8041 self,
8042 ) -> impl gax::paginator::ItemPaginator<
8043 longrunning::model::ListOperationsResponse,
8044 gax::error::Error,
8045 > {
8046 use gax::paginator::Paginator;
8047 self.by_page().items()
8048 }
8049
8050 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8052 self.0.request.name = v.into();
8053 self
8054 }
8055
8056 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8058 self.0.request.filter = v.into();
8059 self
8060 }
8061
8062 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8064 self.0.request.page_size = v.into();
8065 self
8066 }
8067
8068 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8070 self.0.request.page_token = v.into();
8071 self
8072 }
8073
8074 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8076 self.0.request.return_partial_success = v.into();
8077 self
8078 }
8079 }
8080
8081 #[doc(hidden)]
8082 impl gax::options::internal::RequestBuilder for ListOperations {
8083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8084 &mut self.0.options
8085 }
8086 }
8087
8088 #[derive(Clone, Debug)]
8105 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8106
8107 impl GetOperation {
8108 pub(crate) fn new(
8109 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8110 ) -> Self {
8111 Self(RequestBuilder::new(stub))
8112 }
8113
8114 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8116 mut self,
8117 v: V,
8118 ) -> Self {
8119 self.0.request = v.into();
8120 self
8121 }
8122
8123 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8125 self.0.options = v.into();
8126 self
8127 }
8128
8129 pub async fn send(self) -> Result<longrunning::model::Operation> {
8131 (*self.0.stub)
8132 .get_operation(self.0.request, self.0.options)
8133 .await
8134 .map(gax::response::Response::into_body)
8135 }
8136
8137 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8139 self.0.request.name = v.into();
8140 self
8141 }
8142 }
8143
8144 #[doc(hidden)]
8145 impl gax::options::internal::RequestBuilder for GetOperation {
8146 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8147 &mut self.0.options
8148 }
8149 }
8150
8151 #[derive(Clone, Debug)]
8168 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
8169
8170 impl DeleteOperation {
8171 pub(crate) fn new(
8172 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8173 ) -> Self {
8174 Self(RequestBuilder::new(stub))
8175 }
8176
8177 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
8179 mut self,
8180 v: V,
8181 ) -> Self {
8182 self.0.request = v.into();
8183 self
8184 }
8185
8186 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8188 self.0.options = v.into();
8189 self
8190 }
8191
8192 pub async fn send(self) -> Result<()> {
8194 (*self.0.stub)
8195 .delete_operation(self.0.request, self.0.options)
8196 .await
8197 .map(gax::response::Response::into_body)
8198 }
8199
8200 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8202 self.0.request.name = v.into();
8203 self
8204 }
8205 }
8206
8207 #[doc(hidden)]
8208 impl gax::options::internal::RequestBuilder for DeleteOperation {
8209 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8210 &mut self.0.options
8211 }
8212 }
8213
8214 #[derive(Clone, Debug)]
8231 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8232
8233 impl CancelOperation {
8234 pub(crate) fn new(
8235 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8236 ) -> Self {
8237 Self(RequestBuilder::new(stub))
8238 }
8239
8240 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8242 mut self,
8243 v: V,
8244 ) -> Self {
8245 self.0.request = v.into();
8246 self
8247 }
8248
8249 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8251 self.0.options = v.into();
8252 self
8253 }
8254
8255 pub async fn send(self) -> Result<()> {
8257 (*self.0.stub)
8258 .cancel_operation(self.0.request, self.0.options)
8259 .await
8260 .map(gax::response::Response::into_body)
8261 }
8262
8263 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8265 self.0.request.name = v.into();
8266 self
8267 }
8268 }
8269
8270 #[doc(hidden)]
8271 impl gax::options::internal::RequestBuilder for CancelOperation {
8272 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8273 &mut self.0.options
8274 }
8275 }
8276}
8277
8278pub mod workflow_template_service {
8279 use crate::Result;
8280
8281 pub type ClientBuilder =
8295 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8296
8297 pub(crate) mod client {
8298 use super::super::super::client::WorkflowTemplateService;
8299 pub struct Factory;
8300 impl gax::client_builder::internal::ClientFactory for Factory {
8301 type Client = WorkflowTemplateService;
8302 type Credentials = gaxi::options::Credentials;
8303 async fn build(
8304 self,
8305 config: gaxi::options::ClientConfig,
8306 ) -> gax::client_builder::Result<Self::Client> {
8307 Self::Client::new(config).await
8308 }
8309 }
8310 }
8311
8312 #[derive(Clone, Debug)]
8314 pub(crate) struct RequestBuilder<R: std::default::Default> {
8315 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8316 request: R,
8317 options: gax::options::RequestOptions,
8318 }
8319
8320 impl<R> RequestBuilder<R>
8321 where
8322 R: std::default::Default,
8323 {
8324 pub(crate) fn new(
8325 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8326 ) -> Self {
8327 Self {
8328 stub,
8329 request: R::default(),
8330 options: gax::options::RequestOptions::default(),
8331 }
8332 }
8333 }
8334
8335 #[derive(Clone, Debug)]
8352 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8353
8354 impl CreateWorkflowTemplate {
8355 pub(crate) fn new(
8356 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8357 ) -> Self {
8358 Self(RequestBuilder::new(stub))
8359 }
8360
8361 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8363 mut self,
8364 v: V,
8365 ) -> Self {
8366 self.0.request = v.into();
8367 self
8368 }
8369
8370 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8372 self.0.options = v.into();
8373 self
8374 }
8375
8376 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8378 (*self.0.stub)
8379 .create_workflow_template(self.0.request, self.0.options)
8380 .await
8381 .map(gax::response::Response::into_body)
8382 }
8383
8384 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8388 self.0.request.parent = v.into();
8389 self
8390 }
8391
8392 pub fn set_template<T>(mut self, v: T) -> Self
8396 where
8397 T: std::convert::Into<crate::model::WorkflowTemplate>,
8398 {
8399 self.0.request.template = std::option::Option::Some(v.into());
8400 self
8401 }
8402
8403 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8407 where
8408 T: std::convert::Into<crate::model::WorkflowTemplate>,
8409 {
8410 self.0.request.template = v.map(|x| x.into());
8411 self
8412 }
8413 }
8414
8415 #[doc(hidden)]
8416 impl gax::options::internal::RequestBuilder for CreateWorkflowTemplate {
8417 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8418 &mut self.0.options
8419 }
8420 }
8421
8422 #[derive(Clone, Debug)]
8439 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8440
8441 impl GetWorkflowTemplate {
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::GetWorkflowTemplateRequest>>(
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 .get_workflow_template(self.0.request, self.0.options)
8467 .await
8468 .map(gax::response::Response::into_body)
8469 }
8470
8471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8475 self.0.request.name = v.into();
8476 self
8477 }
8478
8479 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8481 self.0.request.version = v.into();
8482 self
8483 }
8484 }
8485
8486 #[doc(hidden)]
8487 impl gax::options::internal::RequestBuilder for GetWorkflowTemplate {
8488 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8489 &mut self.0.options
8490 }
8491 }
8492
8493 #[derive(Clone, Debug)]
8511 pub struct InstantiateWorkflowTemplate(
8512 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8513 );
8514
8515 impl InstantiateWorkflowTemplate {
8516 pub(crate) fn new(
8517 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8518 ) -> Self {
8519 Self(RequestBuilder::new(stub))
8520 }
8521
8522 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8524 mut self,
8525 v: V,
8526 ) -> Self {
8527 self.0.request = v.into();
8528 self
8529 }
8530
8531 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8533 self.0.options = v.into();
8534 self
8535 }
8536
8537 pub async fn send(self) -> Result<longrunning::model::Operation> {
8544 (*self.0.stub)
8545 .instantiate_workflow_template(self.0.request, self.0.options)
8546 .await
8547 .map(gax::response::Response::into_body)
8548 }
8549
8550 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8552 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8553 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8554 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8555
8556 let stub = self.0.stub.clone();
8557 let mut options = self.0.options.clone();
8558 options.set_retry_policy(gax::retry_policy::NeverRetry);
8559 let query = move |name| {
8560 let stub = stub.clone();
8561 let options = options.clone();
8562 async {
8563 let op = GetOperation::new(stub)
8564 .set_name(name)
8565 .with_options(options)
8566 .send()
8567 .await?;
8568 Ok(Operation::new(op))
8569 }
8570 };
8571
8572 let start = move || async {
8573 let op = self.send().await?;
8574 Ok(Operation::new(op))
8575 };
8576
8577 lro::internal::new_unit_response_poller(
8578 polling_error_policy,
8579 polling_backoff_policy,
8580 start,
8581 query,
8582 )
8583 }
8584
8585 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8589 self.0.request.name = v.into();
8590 self
8591 }
8592
8593 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8595 self.0.request.version = v.into();
8596 self
8597 }
8598
8599 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8601 self.0.request.request_id = v.into();
8602 self
8603 }
8604
8605 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8607 where
8608 T: std::iter::IntoIterator<Item = (K, V)>,
8609 K: std::convert::Into<std::string::String>,
8610 V: std::convert::Into<std::string::String>,
8611 {
8612 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8613 self
8614 }
8615 }
8616
8617 #[doc(hidden)]
8618 impl gax::options::internal::RequestBuilder for InstantiateWorkflowTemplate {
8619 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8620 &mut self.0.options
8621 }
8622 }
8623
8624 #[derive(Clone, Debug)]
8642 pub struct InstantiateInlineWorkflowTemplate(
8643 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8644 );
8645
8646 impl InstantiateInlineWorkflowTemplate {
8647 pub(crate) fn new(
8648 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8649 ) -> Self {
8650 Self(RequestBuilder::new(stub))
8651 }
8652
8653 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8655 mut self,
8656 v: V,
8657 ) -> Self {
8658 self.0.request = v.into();
8659 self
8660 }
8661
8662 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8664 self.0.options = v.into();
8665 self
8666 }
8667
8668 pub async fn send(self) -> Result<longrunning::model::Operation> {
8675 (*self.0.stub)
8676 .instantiate_inline_workflow_template(self.0.request, self.0.options)
8677 .await
8678 .map(gax::response::Response::into_body)
8679 }
8680
8681 pub fn poller(self) -> impl lro::Poller<(), crate::model::WorkflowMetadata> {
8683 type Operation = lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8684 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8685 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8686
8687 let stub = self.0.stub.clone();
8688 let mut options = self.0.options.clone();
8689 options.set_retry_policy(gax::retry_policy::NeverRetry);
8690 let query = move |name| {
8691 let stub = stub.clone();
8692 let options = options.clone();
8693 async {
8694 let op = GetOperation::new(stub)
8695 .set_name(name)
8696 .with_options(options)
8697 .send()
8698 .await?;
8699 Ok(Operation::new(op))
8700 }
8701 };
8702
8703 let start = move || async {
8704 let op = self.send().await?;
8705 Ok(Operation::new(op))
8706 };
8707
8708 lro::internal::new_unit_response_poller(
8709 polling_error_policy,
8710 polling_backoff_policy,
8711 start,
8712 query,
8713 )
8714 }
8715
8716 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8720 self.0.request.parent = v.into();
8721 self
8722 }
8723
8724 pub fn set_template<T>(mut self, v: T) -> Self
8728 where
8729 T: std::convert::Into<crate::model::WorkflowTemplate>,
8730 {
8731 self.0.request.template = std::option::Option::Some(v.into());
8732 self
8733 }
8734
8735 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8739 where
8740 T: std::convert::Into<crate::model::WorkflowTemplate>,
8741 {
8742 self.0.request.template = v.map(|x| x.into());
8743 self
8744 }
8745
8746 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8748 self.0.request.request_id = v.into();
8749 self
8750 }
8751 }
8752
8753 #[doc(hidden)]
8754 impl gax::options::internal::RequestBuilder for InstantiateInlineWorkflowTemplate {
8755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8756 &mut self.0.options
8757 }
8758 }
8759
8760 #[derive(Clone, Debug)]
8777 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
8778
8779 impl UpdateWorkflowTemplate {
8780 pub(crate) fn new(
8781 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8782 ) -> Self {
8783 Self(RequestBuilder::new(stub))
8784 }
8785
8786 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
8788 mut self,
8789 v: V,
8790 ) -> Self {
8791 self.0.request = v.into();
8792 self
8793 }
8794
8795 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8797 self.0.options = v.into();
8798 self
8799 }
8800
8801 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8803 (*self.0.stub)
8804 .update_workflow_template(self.0.request, self.0.options)
8805 .await
8806 .map(gax::response::Response::into_body)
8807 }
8808
8809 pub fn set_template<T>(mut self, v: T) -> Self
8813 where
8814 T: std::convert::Into<crate::model::WorkflowTemplate>,
8815 {
8816 self.0.request.template = std::option::Option::Some(v.into());
8817 self
8818 }
8819
8820 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8824 where
8825 T: std::convert::Into<crate::model::WorkflowTemplate>,
8826 {
8827 self.0.request.template = v.map(|x| x.into());
8828 self
8829 }
8830 }
8831
8832 #[doc(hidden)]
8833 impl gax::options::internal::RequestBuilder for UpdateWorkflowTemplate {
8834 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8835 &mut self.0.options
8836 }
8837 }
8838
8839 #[derive(Clone, Debug)]
8860 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
8861
8862 impl ListWorkflowTemplates {
8863 pub(crate) fn new(
8864 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8865 ) -> Self {
8866 Self(RequestBuilder::new(stub))
8867 }
8868
8869 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
8871 mut self,
8872 v: V,
8873 ) -> Self {
8874 self.0.request = v.into();
8875 self
8876 }
8877
8878 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8880 self.0.options = v.into();
8881 self
8882 }
8883
8884 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
8886 (*self.0.stub)
8887 .list_workflow_templates(self.0.request, self.0.options)
8888 .await
8889 .map(gax::response::Response::into_body)
8890 }
8891
8892 pub fn by_page(
8894 self,
8895 ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowTemplatesResponse, gax::error::Error>
8896 {
8897 use std::clone::Clone;
8898 let token = self.0.request.page_token.clone();
8899 let execute = move |token: String| {
8900 let mut builder = self.clone();
8901 builder.0.request = builder.0.request.set_page_token(token);
8902 builder.send()
8903 };
8904 gax::paginator::internal::new_paginator(token, execute)
8905 }
8906
8907 pub fn by_item(
8909 self,
8910 ) -> impl gax::paginator::ItemPaginator<
8911 crate::model::ListWorkflowTemplatesResponse,
8912 gax::error::Error,
8913 > {
8914 use gax::paginator::Paginator;
8915 self.by_page().items()
8916 }
8917
8918 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8922 self.0.request.parent = v.into();
8923 self
8924 }
8925
8926 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8928 self.0.request.page_size = v.into();
8929 self
8930 }
8931
8932 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8934 self.0.request.page_token = v.into();
8935 self
8936 }
8937 }
8938
8939 #[doc(hidden)]
8940 impl gax::options::internal::RequestBuilder for ListWorkflowTemplates {
8941 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8942 &mut self.0.options
8943 }
8944 }
8945
8946 #[derive(Clone, Debug)]
8963 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
8964
8965 impl DeleteWorkflowTemplate {
8966 pub(crate) fn new(
8967 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8968 ) -> Self {
8969 Self(RequestBuilder::new(stub))
8970 }
8971
8972 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
8974 mut self,
8975 v: V,
8976 ) -> Self {
8977 self.0.request = v.into();
8978 self
8979 }
8980
8981 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8983 self.0.options = v.into();
8984 self
8985 }
8986
8987 pub async fn send(self) -> Result<()> {
8989 (*self.0.stub)
8990 .delete_workflow_template(self.0.request, self.0.options)
8991 .await
8992 .map(gax::response::Response::into_body)
8993 }
8994
8995 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8999 self.0.request.name = v.into();
9000 self
9001 }
9002
9003 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9005 self.0.request.version = v.into();
9006 self
9007 }
9008 }
9009
9010 #[doc(hidden)]
9011 impl gax::options::internal::RequestBuilder for DeleteWorkflowTemplate {
9012 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9013 &mut self.0.options
9014 }
9015 }
9016
9017 #[derive(Clone, Debug)]
9034 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
9035
9036 impl SetIamPolicy {
9037 pub(crate) fn new(
9038 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9039 ) -> Self {
9040 Self(RequestBuilder::new(stub))
9041 }
9042
9043 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
9045 self.0.request = v.into();
9046 self
9047 }
9048
9049 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9051 self.0.options = v.into();
9052 self
9053 }
9054
9055 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9057 (*self.0.stub)
9058 .set_iam_policy(self.0.request, self.0.options)
9059 .await
9060 .map(gax::response::Response::into_body)
9061 }
9062
9063 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9067 self.0.request.resource = v.into();
9068 self
9069 }
9070
9071 pub fn set_policy<T>(mut self, v: T) -> Self
9075 where
9076 T: std::convert::Into<iam_v1::model::Policy>,
9077 {
9078 self.0.request.policy = std::option::Option::Some(v.into());
9079 self
9080 }
9081
9082 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9086 where
9087 T: std::convert::Into<iam_v1::model::Policy>,
9088 {
9089 self.0.request.policy = v.map(|x| x.into());
9090 self
9091 }
9092
9093 pub fn set_update_mask<T>(mut self, v: T) -> Self
9095 where
9096 T: std::convert::Into<wkt::FieldMask>,
9097 {
9098 self.0.request.update_mask = std::option::Option::Some(v.into());
9099 self
9100 }
9101
9102 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9104 where
9105 T: std::convert::Into<wkt::FieldMask>,
9106 {
9107 self.0.request.update_mask = v.map(|x| x.into());
9108 self
9109 }
9110 }
9111
9112 #[doc(hidden)]
9113 impl gax::options::internal::RequestBuilder for SetIamPolicy {
9114 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9115 &mut self.0.options
9116 }
9117 }
9118
9119 #[derive(Clone, Debug)]
9136 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
9137
9138 impl GetIamPolicy {
9139 pub(crate) fn new(
9140 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9141 ) -> Self {
9142 Self(RequestBuilder::new(stub))
9143 }
9144
9145 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
9147 self.0.request = v.into();
9148 self
9149 }
9150
9151 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9153 self.0.options = v.into();
9154 self
9155 }
9156
9157 pub async fn send(self) -> Result<iam_v1::model::Policy> {
9159 (*self.0.stub)
9160 .get_iam_policy(self.0.request, self.0.options)
9161 .await
9162 .map(gax::response::Response::into_body)
9163 }
9164
9165 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9169 self.0.request.resource = v.into();
9170 self
9171 }
9172
9173 pub fn set_options<T>(mut self, v: T) -> Self
9175 where
9176 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9177 {
9178 self.0.request.options = std::option::Option::Some(v.into());
9179 self
9180 }
9181
9182 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9184 where
9185 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
9186 {
9187 self.0.request.options = v.map(|x| x.into());
9188 self
9189 }
9190 }
9191
9192 #[doc(hidden)]
9193 impl gax::options::internal::RequestBuilder for GetIamPolicy {
9194 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9195 &mut self.0.options
9196 }
9197 }
9198
9199 #[derive(Clone, Debug)]
9216 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
9217
9218 impl TestIamPermissions {
9219 pub(crate) fn new(
9220 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9221 ) -> Self {
9222 Self(RequestBuilder::new(stub))
9223 }
9224
9225 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
9227 mut self,
9228 v: V,
9229 ) -> Self {
9230 self.0.request = v.into();
9231 self
9232 }
9233
9234 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9236 self.0.options = v.into();
9237 self
9238 }
9239
9240 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
9242 (*self.0.stub)
9243 .test_iam_permissions(self.0.request, self.0.options)
9244 .await
9245 .map(gax::response::Response::into_body)
9246 }
9247
9248 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9252 self.0.request.resource = v.into();
9253 self
9254 }
9255
9256 pub fn set_permissions<T, V>(mut self, v: T) -> Self
9260 where
9261 T: std::iter::IntoIterator<Item = V>,
9262 V: std::convert::Into<std::string::String>,
9263 {
9264 use std::iter::Iterator;
9265 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9266 self
9267 }
9268 }
9269
9270 #[doc(hidden)]
9271 impl gax::options::internal::RequestBuilder for TestIamPermissions {
9272 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9273 &mut self.0.options
9274 }
9275 }
9276
9277 #[derive(Clone, Debug)]
9298 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9299
9300 impl ListOperations {
9301 pub(crate) fn new(
9302 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9303 ) -> Self {
9304 Self(RequestBuilder::new(stub))
9305 }
9306
9307 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9309 mut self,
9310 v: V,
9311 ) -> Self {
9312 self.0.request = v.into();
9313 self
9314 }
9315
9316 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9318 self.0.options = v.into();
9319 self
9320 }
9321
9322 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9324 (*self.0.stub)
9325 .list_operations(self.0.request, self.0.options)
9326 .await
9327 .map(gax::response::Response::into_body)
9328 }
9329
9330 pub fn by_page(
9332 self,
9333 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9334 {
9335 use std::clone::Clone;
9336 let token = self.0.request.page_token.clone();
9337 let execute = move |token: String| {
9338 let mut builder = self.clone();
9339 builder.0.request = builder.0.request.set_page_token(token);
9340 builder.send()
9341 };
9342 gax::paginator::internal::new_paginator(token, execute)
9343 }
9344
9345 pub fn by_item(
9347 self,
9348 ) -> impl gax::paginator::ItemPaginator<
9349 longrunning::model::ListOperationsResponse,
9350 gax::error::Error,
9351 > {
9352 use gax::paginator::Paginator;
9353 self.by_page().items()
9354 }
9355
9356 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9358 self.0.request.name = v.into();
9359 self
9360 }
9361
9362 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9364 self.0.request.filter = v.into();
9365 self
9366 }
9367
9368 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9370 self.0.request.page_size = v.into();
9371 self
9372 }
9373
9374 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9376 self.0.request.page_token = v.into();
9377 self
9378 }
9379
9380 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9382 self.0.request.return_partial_success = v.into();
9383 self
9384 }
9385 }
9386
9387 #[doc(hidden)]
9388 impl gax::options::internal::RequestBuilder for ListOperations {
9389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9390 &mut self.0.options
9391 }
9392 }
9393
9394 #[derive(Clone, Debug)]
9411 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9412
9413 impl GetOperation {
9414 pub(crate) fn new(
9415 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9416 ) -> Self {
9417 Self(RequestBuilder::new(stub))
9418 }
9419
9420 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9422 mut self,
9423 v: V,
9424 ) -> Self {
9425 self.0.request = v.into();
9426 self
9427 }
9428
9429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9431 self.0.options = v.into();
9432 self
9433 }
9434
9435 pub async fn send(self) -> Result<longrunning::model::Operation> {
9437 (*self.0.stub)
9438 .get_operation(self.0.request, self.0.options)
9439 .await
9440 .map(gax::response::Response::into_body)
9441 }
9442
9443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9445 self.0.request.name = v.into();
9446 self
9447 }
9448 }
9449
9450 #[doc(hidden)]
9451 impl gax::options::internal::RequestBuilder for GetOperation {
9452 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9453 &mut self.0.options
9454 }
9455 }
9456
9457 #[derive(Clone, Debug)]
9474 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
9475
9476 impl DeleteOperation {
9477 pub(crate) fn new(
9478 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9479 ) -> Self {
9480 Self(RequestBuilder::new(stub))
9481 }
9482
9483 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
9485 mut self,
9486 v: V,
9487 ) -> Self {
9488 self.0.request = v.into();
9489 self
9490 }
9491
9492 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9494 self.0.options = v.into();
9495 self
9496 }
9497
9498 pub async fn send(self) -> Result<()> {
9500 (*self.0.stub)
9501 .delete_operation(self.0.request, self.0.options)
9502 .await
9503 .map(gax::response::Response::into_body)
9504 }
9505
9506 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9508 self.0.request.name = v.into();
9509 self
9510 }
9511 }
9512
9513 #[doc(hidden)]
9514 impl gax::options::internal::RequestBuilder for DeleteOperation {
9515 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9516 &mut self.0.options
9517 }
9518 }
9519
9520 #[derive(Clone, Debug)]
9537 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9538
9539 impl CancelOperation {
9540 pub(crate) fn new(
9541 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9542 ) -> Self {
9543 Self(RequestBuilder::new(stub))
9544 }
9545
9546 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9548 mut self,
9549 v: V,
9550 ) -> Self {
9551 self.0.request = v.into();
9552 self
9553 }
9554
9555 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9557 self.0.options = v.into();
9558 self
9559 }
9560
9561 pub async fn send(self) -> Result<()> {
9563 (*self.0.stub)
9564 .cancel_operation(self.0.request, self.0.options)
9565 .await
9566 .map(gax::response::Response::into_body)
9567 }
9568
9569 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9571 self.0.request.name = v.into();
9572 self
9573 }
9574 }
9575
9576 #[doc(hidden)]
9577 impl gax::options::internal::RequestBuilder for CancelOperation {
9578 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9579 &mut self.0.options
9580 }
9581 }
9582}