1pub mod autoscaling_policy_service {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::AutoscalingPolicyService;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = AutoscalingPolicyService;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct CreateAutoscalingPolicy(
91 RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
92 );
93
94 impl CreateAutoscalingPolicy {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
103 mut self,
104 v: V,
105 ) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
118 (*self.0.stub)
119 .create_autoscaling_policy(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
128 self.0.request.parent = v.into();
129 self
130 }
131
132 pub fn set_policy<T>(mut self, v: T) -> Self
136 where
137 T: std::convert::Into<crate::model::AutoscalingPolicy>,
138 {
139 self.0.request.policy = std::option::Option::Some(v.into());
140 self
141 }
142
143 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
147 where
148 T: std::convert::Into<crate::model::AutoscalingPolicy>,
149 {
150 self.0.request.policy = v.map(|x| x.into());
151 self
152 }
153 }
154
155 #[doc(hidden)]
156 impl crate::RequestBuilder for CreateAutoscalingPolicy {
157 fn request_options(&mut self) -> &mut crate::RequestOptions {
158 &mut self.0.options
159 }
160 }
161
162 #[derive(Clone, Debug)]
179 pub struct UpdateAutoscalingPolicy(
180 RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
181 );
182
183 impl UpdateAutoscalingPolicy {
184 pub(crate) fn new(
185 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
186 ) -> Self {
187 Self(RequestBuilder::new(stub))
188 }
189
190 pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
192 mut self,
193 v: V,
194 ) -> Self {
195 self.0.request = v.into();
196 self
197 }
198
199 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
201 self.0.options = v.into();
202 self
203 }
204
205 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
207 (*self.0.stub)
208 .update_autoscaling_policy(self.0.request, self.0.options)
209 .await
210 .map(crate::Response::into_body)
211 }
212
213 pub fn set_policy<T>(mut self, v: T) -> Self
217 where
218 T: std::convert::Into<crate::model::AutoscalingPolicy>,
219 {
220 self.0.request.policy = std::option::Option::Some(v.into());
221 self
222 }
223
224 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
228 where
229 T: std::convert::Into<crate::model::AutoscalingPolicy>,
230 {
231 self.0.request.policy = v.map(|x| x.into());
232 self
233 }
234 }
235
236 #[doc(hidden)]
237 impl crate::RequestBuilder for UpdateAutoscalingPolicy {
238 fn request_options(&mut self) -> &mut crate::RequestOptions {
239 &mut self.0.options
240 }
241 }
242
243 #[derive(Clone, Debug)]
260 pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
261
262 impl GetAutoscalingPolicy {
263 pub(crate) fn new(
264 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
265 ) -> Self {
266 Self(RequestBuilder::new(stub))
267 }
268
269 pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
271 mut self,
272 v: V,
273 ) -> Self {
274 self.0.request = v.into();
275 self
276 }
277
278 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
280 self.0.options = v.into();
281 self
282 }
283
284 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
286 (*self.0.stub)
287 .get_autoscaling_policy(self.0.request, self.0.options)
288 .await
289 .map(crate::Response::into_body)
290 }
291
292 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
296 self.0.request.name = v.into();
297 self
298 }
299 }
300
301 #[doc(hidden)]
302 impl crate::RequestBuilder for GetAutoscalingPolicy {
303 fn request_options(&mut self) -> &mut crate::RequestOptions {
304 &mut self.0.options
305 }
306 }
307
308 #[derive(Clone, Debug)]
329 pub struct ListAutoscalingPolicies(
330 RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
331 );
332
333 impl ListAutoscalingPolicies {
334 pub(crate) fn new(
335 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
336 ) -> Self {
337 Self(RequestBuilder::new(stub))
338 }
339
340 pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
342 mut self,
343 v: V,
344 ) -> Self {
345 self.0.request = v.into();
346 self
347 }
348
349 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
351 self.0.options = v.into();
352 self
353 }
354
355 pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
357 (*self.0.stub)
358 .list_autoscaling_policies(self.0.request, self.0.options)
359 .await
360 .map(crate::Response::into_body)
361 }
362
363 pub fn by_page(
365 self,
366 ) -> impl google_cloud_gax::paginator::Paginator<
367 crate::model::ListAutoscalingPoliciesResponse,
368 crate::Error,
369 > {
370 use std::clone::Clone;
371 let token = self.0.request.page_token.clone();
372 let execute = move |token: String| {
373 let mut builder = self.clone();
374 builder.0.request = builder.0.request.set_page_token(token);
375 builder.send()
376 };
377 google_cloud_gax::paginator::internal::new_paginator(token, execute)
378 }
379
380 pub fn by_item(
382 self,
383 ) -> impl google_cloud_gax::paginator::ItemPaginator<
384 crate::model::ListAutoscalingPoliciesResponse,
385 crate::Error,
386 > {
387 use google_cloud_gax::paginator::Paginator;
388 self.by_page().items()
389 }
390
391 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
395 self.0.request.parent = v.into();
396 self
397 }
398
399 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
401 self.0.request.page_size = v.into();
402 self
403 }
404
405 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
407 self.0.request.page_token = v.into();
408 self
409 }
410 }
411
412 #[doc(hidden)]
413 impl crate::RequestBuilder for ListAutoscalingPolicies {
414 fn request_options(&mut self) -> &mut crate::RequestOptions {
415 &mut self.0.options
416 }
417 }
418
419 #[derive(Clone, Debug)]
436 pub struct DeleteAutoscalingPolicy(
437 RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
438 );
439
440 impl DeleteAutoscalingPolicy {
441 pub(crate) fn new(
442 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
443 ) -> Self {
444 Self(RequestBuilder::new(stub))
445 }
446
447 pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
449 mut self,
450 v: V,
451 ) -> Self {
452 self.0.request = v.into();
453 self
454 }
455
456 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
458 self.0.options = v.into();
459 self
460 }
461
462 pub async fn send(self) -> Result<()> {
464 (*self.0.stub)
465 .delete_autoscaling_policy(self.0.request, self.0.options)
466 .await
467 .map(crate::Response::into_body)
468 }
469
470 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
474 self.0.request.name = v.into();
475 self
476 }
477 }
478
479 #[doc(hidden)]
480 impl crate::RequestBuilder for DeleteAutoscalingPolicy {
481 fn request_options(&mut self) -> &mut crate::RequestOptions {
482 &mut self.0.options
483 }
484 }
485
486 #[derive(Clone, Debug)]
503 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
504
505 impl SetIamPolicy {
506 pub(crate) fn new(
507 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
508 ) -> Self {
509 Self(RequestBuilder::new(stub))
510 }
511
512 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
514 mut self,
515 v: V,
516 ) -> Self {
517 self.0.request = v.into();
518 self
519 }
520
521 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
523 self.0.options = v.into();
524 self
525 }
526
527 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
529 (*self.0.stub)
530 .set_iam_policy(self.0.request, self.0.options)
531 .await
532 .map(crate::Response::into_body)
533 }
534
535 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
539 self.0.request.resource = v.into();
540 self
541 }
542
543 pub fn set_policy<T>(mut self, v: T) -> Self
547 where
548 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
549 {
550 self.0.request.policy = std::option::Option::Some(v.into());
551 self
552 }
553
554 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
558 where
559 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
560 {
561 self.0.request.policy = v.map(|x| x.into());
562 self
563 }
564
565 pub fn set_update_mask<T>(mut self, v: T) -> Self
567 where
568 T: std::convert::Into<wkt::FieldMask>,
569 {
570 self.0.request.update_mask = std::option::Option::Some(v.into());
571 self
572 }
573
574 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
576 where
577 T: std::convert::Into<wkt::FieldMask>,
578 {
579 self.0.request.update_mask = v.map(|x| x.into());
580 self
581 }
582 }
583
584 #[doc(hidden)]
585 impl crate::RequestBuilder for SetIamPolicy {
586 fn request_options(&mut self) -> &mut crate::RequestOptions {
587 &mut self.0.options
588 }
589 }
590
591 #[derive(Clone, Debug)]
608 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
609
610 impl GetIamPolicy {
611 pub(crate) fn new(
612 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
613 ) -> Self {
614 Self(RequestBuilder::new(stub))
615 }
616
617 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
619 mut self,
620 v: V,
621 ) -> Self {
622 self.0.request = v.into();
623 self
624 }
625
626 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
628 self.0.options = v.into();
629 self
630 }
631
632 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
634 (*self.0.stub)
635 .get_iam_policy(self.0.request, self.0.options)
636 .await
637 .map(crate::Response::into_body)
638 }
639
640 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
644 self.0.request.resource = v.into();
645 self
646 }
647
648 pub fn set_options<T>(mut self, v: T) -> Self
650 where
651 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
652 {
653 self.0.request.options = std::option::Option::Some(v.into());
654 self
655 }
656
657 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
659 where
660 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
661 {
662 self.0.request.options = v.map(|x| x.into());
663 self
664 }
665 }
666
667 #[doc(hidden)]
668 impl crate::RequestBuilder for GetIamPolicy {
669 fn request_options(&mut self) -> &mut crate::RequestOptions {
670 &mut self.0.options
671 }
672 }
673
674 #[derive(Clone, Debug)]
691 pub struct TestIamPermissions(
692 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
693 );
694
695 impl TestIamPermissions {
696 pub(crate) fn new(
697 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
698 ) -> Self {
699 Self(RequestBuilder::new(stub))
700 }
701
702 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
704 mut self,
705 v: V,
706 ) -> Self {
707 self.0.request = v.into();
708 self
709 }
710
711 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
713 self.0.options = v.into();
714 self
715 }
716
717 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
719 (*self.0.stub)
720 .test_iam_permissions(self.0.request, self.0.options)
721 .await
722 .map(crate::Response::into_body)
723 }
724
725 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
729 self.0.request.resource = v.into();
730 self
731 }
732
733 pub fn set_permissions<T, V>(mut self, v: T) -> Self
737 where
738 T: std::iter::IntoIterator<Item = V>,
739 V: std::convert::Into<std::string::String>,
740 {
741 use std::iter::Iterator;
742 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
743 self
744 }
745 }
746
747 #[doc(hidden)]
748 impl crate::RequestBuilder for TestIamPermissions {
749 fn request_options(&mut self) -> &mut crate::RequestOptions {
750 &mut self.0.options
751 }
752 }
753
754 #[derive(Clone, Debug)]
775 pub struct ListOperations(
776 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
777 );
778
779 impl ListOperations {
780 pub(crate) fn new(
781 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
782 ) -> Self {
783 Self(RequestBuilder::new(stub))
784 }
785
786 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
788 mut self,
789 v: V,
790 ) -> Self {
791 self.0.request = v.into();
792 self
793 }
794
795 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
797 self.0.options = v.into();
798 self
799 }
800
801 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
803 (*self.0.stub)
804 .list_operations(self.0.request, self.0.options)
805 .await
806 .map(crate::Response::into_body)
807 }
808
809 pub fn by_page(
811 self,
812 ) -> impl google_cloud_gax::paginator::Paginator<
813 google_cloud_longrunning::model::ListOperationsResponse,
814 crate::Error,
815 > {
816 use std::clone::Clone;
817 let token = self.0.request.page_token.clone();
818 let execute = move |token: String| {
819 let mut builder = self.clone();
820 builder.0.request = builder.0.request.set_page_token(token);
821 builder.send()
822 };
823 google_cloud_gax::paginator::internal::new_paginator(token, execute)
824 }
825
826 pub fn by_item(
828 self,
829 ) -> impl google_cloud_gax::paginator::ItemPaginator<
830 google_cloud_longrunning::model::ListOperationsResponse,
831 crate::Error,
832 > {
833 use google_cloud_gax::paginator::Paginator;
834 self.by_page().items()
835 }
836
837 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
839 self.0.request.name = v.into();
840 self
841 }
842
843 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
845 self.0.request.filter = v.into();
846 self
847 }
848
849 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
851 self.0.request.page_size = v.into();
852 self
853 }
854
855 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
857 self.0.request.page_token = v.into();
858 self
859 }
860
861 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
863 self.0.request.return_partial_success = v.into();
864 self
865 }
866 }
867
868 #[doc(hidden)]
869 impl crate::RequestBuilder for ListOperations {
870 fn request_options(&mut self) -> &mut crate::RequestOptions {
871 &mut self.0.options
872 }
873 }
874
875 #[derive(Clone, Debug)]
892 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
893
894 impl GetOperation {
895 pub(crate) fn new(
896 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
897 ) -> Self {
898 Self(RequestBuilder::new(stub))
899 }
900
901 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
903 mut self,
904 v: V,
905 ) -> Self {
906 self.0.request = v.into();
907 self
908 }
909
910 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
912 self.0.options = v.into();
913 self
914 }
915
916 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
918 (*self.0.stub)
919 .get_operation(self.0.request, self.0.options)
920 .await
921 .map(crate::Response::into_body)
922 }
923
924 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
926 self.0.request.name = v.into();
927 self
928 }
929 }
930
931 #[doc(hidden)]
932 impl crate::RequestBuilder for GetOperation {
933 fn request_options(&mut self) -> &mut crate::RequestOptions {
934 &mut self.0.options
935 }
936 }
937
938 #[derive(Clone, Debug)]
955 pub struct DeleteOperation(
956 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
957 );
958
959 impl DeleteOperation {
960 pub(crate) fn new(
961 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
962 ) -> Self {
963 Self(RequestBuilder::new(stub))
964 }
965
966 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
968 mut self,
969 v: V,
970 ) -> Self {
971 self.0.request = v.into();
972 self
973 }
974
975 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
977 self.0.options = v.into();
978 self
979 }
980
981 pub async fn send(self) -> Result<()> {
983 (*self.0.stub)
984 .delete_operation(self.0.request, self.0.options)
985 .await
986 .map(crate::Response::into_body)
987 }
988
989 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
991 self.0.request.name = v.into();
992 self
993 }
994 }
995
996 #[doc(hidden)]
997 impl crate::RequestBuilder for DeleteOperation {
998 fn request_options(&mut self) -> &mut crate::RequestOptions {
999 &mut self.0.options
1000 }
1001 }
1002
1003 #[derive(Clone, Debug)]
1020 pub struct CancelOperation(
1021 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1022 );
1023
1024 impl CancelOperation {
1025 pub(crate) fn new(
1026 stub: std::sync::Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
1027 ) -> Self {
1028 Self(RequestBuilder::new(stub))
1029 }
1030
1031 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1033 mut self,
1034 v: V,
1035 ) -> Self {
1036 self.0.request = v.into();
1037 self
1038 }
1039
1040 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1042 self.0.options = v.into();
1043 self
1044 }
1045
1046 pub async fn send(self) -> Result<()> {
1048 (*self.0.stub)
1049 .cancel_operation(self.0.request, self.0.options)
1050 .await
1051 .map(crate::Response::into_body)
1052 }
1053
1054 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1056 self.0.request.name = v.into();
1057 self
1058 }
1059 }
1060
1061 #[doc(hidden)]
1062 impl crate::RequestBuilder for CancelOperation {
1063 fn request_options(&mut self) -> &mut crate::RequestOptions {
1064 &mut self.0.options
1065 }
1066 }
1067}
1068
1069pub mod batch_controller {
1070 use crate::Result;
1071
1072 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1086
1087 pub(crate) mod client {
1088 use super::super::super::client::BatchController;
1089 pub struct Factory;
1090 impl crate::ClientFactory for Factory {
1091 type Client = BatchController;
1092 type Credentials = gaxi::options::Credentials;
1093 async fn build(
1094 self,
1095 config: gaxi::options::ClientConfig,
1096 ) -> crate::ClientBuilderResult<Self::Client> {
1097 Self::Client::new(config).await
1098 }
1099 }
1100 }
1101
1102 #[derive(Clone, Debug)]
1104 pub(crate) struct RequestBuilder<R: std::default::Default> {
1105 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1106 request: R,
1107 options: crate::RequestOptions,
1108 }
1109
1110 impl<R> RequestBuilder<R>
1111 where
1112 R: std::default::Default,
1113 {
1114 pub(crate) fn new(
1115 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1116 ) -> Self {
1117 Self {
1118 stub,
1119 request: R::default(),
1120 options: crate::RequestOptions::default(),
1121 }
1122 }
1123 }
1124
1125 #[derive(Clone, Debug)]
1143 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
1144
1145 impl CreateBatch {
1146 pub(crate) fn new(
1147 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1148 ) -> Self {
1149 Self(RequestBuilder::new(stub))
1150 }
1151
1152 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
1154 self.0.request = v.into();
1155 self
1156 }
1157
1158 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1160 self.0.options = v.into();
1161 self
1162 }
1163
1164 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1171 (*self.0.stub)
1172 .create_batch(self.0.request, self.0.options)
1173 .await
1174 .map(crate::Response::into_body)
1175 }
1176
1177 pub fn poller(
1179 self,
1180 ) -> impl google_cloud_lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata>
1181 {
1182 type Operation = google_cloud_lro::internal::Operation<
1183 crate::model::Batch,
1184 crate::model::BatchOperationMetadata,
1185 >;
1186 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1187 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1188
1189 let stub = self.0.stub.clone();
1190 let mut options = self.0.options.clone();
1191 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1192 let query = move |name| {
1193 let stub = stub.clone();
1194 let options = options.clone();
1195 async {
1196 let op = GetOperation::new(stub)
1197 .set_name(name)
1198 .with_options(options)
1199 .send()
1200 .await?;
1201 Ok(Operation::new(op))
1202 }
1203 };
1204
1205 let start = move || async {
1206 let op = self.send().await?;
1207 Ok(Operation::new(op))
1208 };
1209
1210 google_cloud_lro::internal::new_poller(
1211 polling_error_policy,
1212 polling_backoff_policy,
1213 start,
1214 query,
1215 )
1216 }
1217
1218 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1222 self.0.request.parent = v.into();
1223 self
1224 }
1225
1226 pub fn set_batch<T>(mut self, v: T) -> Self
1230 where
1231 T: std::convert::Into<crate::model::Batch>,
1232 {
1233 self.0.request.batch = std::option::Option::Some(v.into());
1234 self
1235 }
1236
1237 pub fn set_or_clear_batch<T>(mut self, v: std::option::Option<T>) -> Self
1241 where
1242 T: std::convert::Into<crate::model::Batch>,
1243 {
1244 self.0.request.batch = v.map(|x| x.into());
1245 self
1246 }
1247
1248 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1250 self.0.request.batch_id = v.into();
1251 self
1252 }
1253
1254 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1256 self.0.request.request_id = v.into();
1257 self
1258 }
1259 }
1260
1261 #[doc(hidden)]
1262 impl crate::RequestBuilder for CreateBatch {
1263 fn request_options(&mut self) -> &mut crate::RequestOptions {
1264 &mut self.0.options
1265 }
1266 }
1267
1268 #[derive(Clone, Debug)]
1285 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
1286
1287 impl GetBatch {
1288 pub(crate) fn new(
1289 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1290 ) -> Self {
1291 Self(RequestBuilder::new(stub))
1292 }
1293
1294 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
1296 self.0.request = v.into();
1297 self
1298 }
1299
1300 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1302 self.0.options = v.into();
1303 self
1304 }
1305
1306 pub async fn send(self) -> Result<crate::model::Batch> {
1308 (*self.0.stub)
1309 .get_batch(self.0.request, self.0.options)
1310 .await
1311 .map(crate::Response::into_body)
1312 }
1313
1314 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1318 self.0.request.name = v.into();
1319 self
1320 }
1321 }
1322
1323 #[doc(hidden)]
1324 impl crate::RequestBuilder for GetBatch {
1325 fn request_options(&mut self) -> &mut crate::RequestOptions {
1326 &mut self.0.options
1327 }
1328 }
1329
1330 #[derive(Clone, Debug)]
1351 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
1352
1353 impl ListBatches {
1354 pub(crate) fn new(
1355 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1356 ) -> Self {
1357 Self(RequestBuilder::new(stub))
1358 }
1359
1360 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
1362 self.0.request = v.into();
1363 self
1364 }
1365
1366 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1368 self.0.options = v.into();
1369 self
1370 }
1371
1372 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
1374 (*self.0.stub)
1375 .list_batches(self.0.request, self.0.options)
1376 .await
1377 .map(crate::Response::into_body)
1378 }
1379
1380 pub fn by_page(
1382 self,
1383 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListBatchesResponse, crate::Error>
1384 {
1385 use std::clone::Clone;
1386 let token = self.0.request.page_token.clone();
1387 let execute = move |token: String| {
1388 let mut builder = self.clone();
1389 builder.0.request = builder.0.request.set_page_token(token);
1390 builder.send()
1391 };
1392 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1393 }
1394
1395 pub fn by_item(
1397 self,
1398 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1399 crate::model::ListBatchesResponse,
1400 crate::Error,
1401 > {
1402 use google_cloud_gax::paginator::Paginator;
1403 self.by_page().items()
1404 }
1405
1406 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1410 self.0.request.parent = v.into();
1411 self
1412 }
1413
1414 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1416 self.0.request.page_size = v.into();
1417 self
1418 }
1419
1420 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1422 self.0.request.page_token = v.into();
1423 self
1424 }
1425
1426 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1428 self.0.request.filter = v.into();
1429 self
1430 }
1431
1432 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1434 self.0.request.order_by = v.into();
1435 self
1436 }
1437 }
1438
1439 #[doc(hidden)]
1440 impl crate::RequestBuilder for ListBatches {
1441 fn request_options(&mut self) -> &mut crate::RequestOptions {
1442 &mut self.0.options
1443 }
1444 }
1445
1446 #[derive(Clone, Debug)]
1463 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1464
1465 impl DeleteBatch {
1466 pub(crate) fn new(
1467 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1468 ) -> Self {
1469 Self(RequestBuilder::new(stub))
1470 }
1471
1472 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1474 self.0.request = v.into();
1475 self
1476 }
1477
1478 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1480 self.0.options = v.into();
1481 self
1482 }
1483
1484 pub async fn send(self) -> Result<()> {
1486 (*self.0.stub)
1487 .delete_batch(self.0.request, self.0.options)
1488 .await
1489 .map(crate::Response::into_body)
1490 }
1491
1492 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1496 self.0.request.name = v.into();
1497 self
1498 }
1499 }
1500
1501 #[doc(hidden)]
1502 impl crate::RequestBuilder for DeleteBatch {
1503 fn request_options(&mut self) -> &mut crate::RequestOptions {
1504 &mut self.0.options
1505 }
1506 }
1507
1508 #[derive(Clone, Debug)]
1525 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1526
1527 impl SetIamPolicy {
1528 pub(crate) fn new(
1529 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1530 ) -> Self {
1531 Self(RequestBuilder::new(stub))
1532 }
1533
1534 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1536 mut self,
1537 v: V,
1538 ) -> Self {
1539 self.0.request = v.into();
1540 self
1541 }
1542
1543 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1545 self.0.options = v.into();
1546 self
1547 }
1548
1549 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1551 (*self.0.stub)
1552 .set_iam_policy(self.0.request, self.0.options)
1553 .await
1554 .map(crate::Response::into_body)
1555 }
1556
1557 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1561 self.0.request.resource = v.into();
1562 self
1563 }
1564
1565 pub fn set_policy<T>(mut self, v: T) -> Self
1569 where
1570 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1571 {
1572 self.0.request.policy = std::option::Option::Some(v.into());
1573 self
1574 }
1575
1576 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1580 where
1581 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1582 {
1583 self.0.request.policy = v.map(|x| x.into());
1584 self
1585 }
1586
1587 pub fn set_update_mask<T>(mut self, v: T) -> Self
1589 where
1590 T: std::convert::Into<wkt::FieldMask>,
1591 {
1592 self.0.request.update_mask = std::option::Option::Some(v.into());
1593 self
1594 }
1595
1596 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1598 where
1599 T: std::convert::Into<wkt::FieldMask>,
1600 {
1601 self.0.request.update_mask = v.map(|x| x.into());
1602 self
1603 }
1604 }
1605
1606 #[doc(hidden)]
1607 impl crate::RequestBuilder for SetIamPolicy {
1608 fn request_options(&mut self) -> &mut crate::RequestOptions {
1609 &mut self.0.options
1610 }
1611 }
1612
1613 #[derive(Clone, Debug)]
1630 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1631
1632 impl GetIamPolicy {
1633 pub(crate) fn new(
1634 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1635 ) -> Self {
1636 Self(RequestBuilder::new(stub))
1637 }
1638
1639 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1641 mut self,
1642 v: V,
1643 ) -> Self {
1644 self.0.request = v.into();
1645 self
1646 }
1647
1648 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1650 self.0.options = v.into();
1651 self
1652 }
1653
1654 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1656 (*self.0.stub)
1657 .get_iam_policy(self.0.request, self.0.options)
1658 .await
1659 .map(crate::Response::into_body)
1660 }
1661
1662 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1666 self.0.request.resource = v.into();
1667 self
1668 }
1669
1670 pub fn set_options<T>(mut self, v: T) -> Self
1672 where
1673 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1674 {
1675 self.0.request.options = std::option::Option::Some(v.into());
1676 self
1677 }
1678
1679 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1681 where
1682 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1683 {
1684 self.0.request.options = v.map(|x| x.into());
1685 self
1686 }
1687 }
1688
1689 #[doc(hidden)]
1690 impl crate::RequestBuilder for GetIamPolicy {
1691 fn request_options(&mut self) -> &mut crate::RequestOptions {
1692 &mut self.0.options
1693 }
1694 }
1695
1696 #[derive(Clone, Debug)]
1713 pub struct TestIamPermissions(
1714 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1715 );
1716
1717 impl TestIamPermissions {
1718 pub(crate) fn new(
1719 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1720 ) -> Self {
1721 Self(RequestBuilder::new(stub))
1722 }
1723
1724 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1726 mut self,
1727 v: V,
1728 ) -> Self {
1729 self.0.request = v.into();
1730 self
1731 }
1732
1733 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1735 self.0.options = v.into();
1736 self
1737 }
1738
1739 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1741 (*self.0.stub)
1742 .test_iam_permissions(self.0.request, self.0.options)
1743 .await
1744 .map(crate::Response::into_body)
1745 }
1746
1747 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1751 self.0.request.resource = v.into();
1752 self
1753 }
1754
1755 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1759 where
1760 T: std::iter::IntoIterator<Item = V>,
1761 V: std::convert::Into<std::string::String>,
1762 {
1763 use std::iter::Iterator;
1764 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1765 self
1766 }
1767 }
1768
1769 #[doc(hidden)]
1770 impl crate::RequestBuilder for TestIamPermissions {
1771 fn request_options(&mut self) -> &mut crate::RequestOptions {
1772 &mut self.0.options
1773 }
1774 }
1775
1776 #[derive(Clone, Debug)]
1797 pub struct ListOperations(
1798 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1799 );
1800
1801 impl ListOperations {
1802 pub(crate) fn new(
1803 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1804 ) -> Self {
1805 Self(RequestBuilder::new(stub))
1806 }
1807
1808 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1810 mut self,
1811 v: V,
1812 ) -> Self {
1813 self.0.request = v.into();
1814 self
1815 }
1816
1817 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1819 self.0.options = v.into();
1820 self
1821 }
1822
1823 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1825 (*self.0.stub)
1826 .list_operations(self.0.request, self.0.options)
1827 .await
1828 .map(crate::Response::into_body)
1829 }
1830
1831 pub fn by_page(
1833 self,
1834 ) -> impl google_cloud_gax::paginator::Paginator<
1835 google_cloud_longrunning::model::ListOperationsResponse,
1836 crate::Error,
1837 > {
1838 use std::clone::Clone;
1839 let token = self.0.request.page_token.clone();
1840 let execute = move |token: String| {
1841 let mut builder = self.clone();
1842 builder.0.request = builder.0.request.set_page_token(token);
1843 builder.send()
1844 };
1845 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1846 }
1847
1848 pub fn by_item(
1850 self,
1851 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1852 google_cloud_longrunning::model::ListOperationsResponse,
1853 crate::Error,
1854 > {
1855 use google_cloud_gax::paginator::Paginator;
1856 self.by_page().items()
1857 }
1858
1859 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1861 self.0.request.name = v.into();
1862 self
1863 }
1864
1865 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1867 self.0.request.filter = v.into();
1868 self
1869 }
1870
1871 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1873 self.0.request.page_size = v.into();
1874 self
1875 }
1876
1877 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1879 self.0.request.page_token = v.into();
1880 self
1881 }
1882
1883 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1885 self.0.request.return_partial_success = v.into();
1886 self
1887 }
1888 }
1889
1890 #[doc(hidden)]
1891 impl crate::RequestBuilder for ListOperations {
1892 fn request_options(&mut self) -> &mut crate::RequestOptions {
1893 &mut self.0.options
1894 }
1895 }
1896
1897 #[derive(Clone, Debug)]
1914 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1915
1916 impl GetOperation {
1917 pub(crate) fn new(
1918 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1919 ) -> Self {
1920 Self(RequestBuilder::new(stub))
1921 }
1922
1923 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1925 mut self,
1926 v: V,
1927 ) -> Self {
1928 self.0.request = v.into();
1929 self
1930 }
1931
1932 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1934 self.0.options = v.into();
1935 self
1936 }
1937
1938 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1940 (*self.0.stub)
1941 .get_operation(self.0.request, self.0.options)
1942 .await
1943 .map(crate::Response::into_body)
1944 }
1945
1946 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1948 self.0.request.name = v.into();
1949 self
1950 }
1951 }
1952
1953 #[doc(hidden)]
1954 impl crate::RequestBuilder for GetOperation {
1955 fn request_options(&mut self) -> &mut crate::RequestOptions {
1956 &mut self.0.options
1957 }
1958 }
1959
1960 #[derive(Clone, Debug)]
1977 pub struct DeleteOperation(
1978 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1979 );
1980
1981 impl DeleteOperation {
1982 pub(crate) fn new(
1983 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
1984 ) -> Self {
1985 Self(RequestBuilder::new(stub))
1986 }
1987
1988 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1990 mut self,
1991 v: V,
1992 ) -> Self {
1993 self.0.request = v.into();
1994 self
1995 }
1996
1997 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1999 self.0.options = v.into();
2000 self
2001 }
2002
2003 pub async fn send(self) -> Result<()> {
2005 (*self.0.stub)
2006 .delete_operation(self.0.request, self.0.options)
2007 .await
2008 .map(crate::Response::into_body)
2009 }
2010
2011 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2013 self.0.request.name = v.into();
2014 self
2015 }
2016 }
2017
2018 #[doc(hidden)]
2019 impl crate::RequestBuilder for DeleteOperation {
2020 fn request_options(&mut self) -> &mut crate::RequestOptions {
2021 &mut self.0.options
2022 }
2023 }
2024
2025 #[derive(Clone, Debug)]
2042 pub struct CancelOperation(
2043 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2044 );
2045
2046 impl CancelOperation {
2047 pub(crate) fn new(
2048 stub: std::sync::Arc<dyn super::super::stub::dynamic::BatchController>,
2049 ) -> Self {
2050 Self(RequestBuilder::new(stub))
2051 }
2052
2053 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2055 mut self,
2056 v: V,
2057 ) -> Self {
2058 self.0.request = v.into();
2059 self
2060 }
2061
2062 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2064 self.0.options = v.into();
2065 self
2066 }
2067
2068 pub async fn send(self) -> Result<()> {
2070 (*self.0.stub)
2071 .cancel_operation(self.0.request, self.0.options)
2072 .await
2073 .map(crate::Response::into_body)
2074 }
2075
2076 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2078 self.0.request.name = v.into();
2079 self
2080 }
2081 }
2082
2083 #[doc(hidden)]
2084 impl crate::RequestBuilder for CancelOperation {
2085 fn request_options(&mut self) -> &mut crate::RequestOptions {
2086 &mut self.0.options
2087 }
2088 }
2089}
2090
2091pub mod cluster_controller {
2092 use crate::Result;
2093
2094 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2108
2109 pub(crate) mod client {
2110 use super::super::super::client::ClusterController;
2111 pub struct Factory;
2112 impl crate::ClientFactory for Factory {
2113 type Client = ClusterController;
2114 type Credentials = gaxi::options::Credentials;
2115 async fn build(
2116 self,
2117 config: gaxi::options::ClientConfig,
2118 ) -> crate::ClientBuilderResult<Self::Client> {
2119 Self::Client::new(config).await
2120 }
2121 }
2122 }
2123
2124 #[derive(Clone, Debug)]
2126 pub(crate) struct RequestBuilder<R: std::default::Default> {
2127 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2128 request: R,
2129 options: crate::RequestOptions,
2130 }
2131
2132 impl<R> RequestBuilder<R>
2133 where
2134 R: std::default::Default,
2135 {
2136 pub(crate) fn new(
2137 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2138 ) -> Self {
2139 Self {
2140 stub,
2141 request: R::default(),
2142 options: crate::RequestOptions::default(),
2143 }
2144 }
2145 }
2146
2147 #[derive(Clone, Debug)]
2165 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
2166
2167 impl CreateCluster {
2168 pub(crate) fn new(
2169 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2170 ) -> Self {
2171 Self(RequestBuilder::new(stub))
2172 }
2173
2174 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
2176 self.0.request = v.into();
2177 self
2178 }
2179
2180 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2182 self.0.options = v.into();
2183 self
2184 }
2185
2186 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2193 (*self.0.stub)
2194 .create_cluster(self.0.request, self.0.options)
2195 .await
2196 .map(crate::Response::into_body)
2197 }
2198
2199 pub fn poller(
2201 self,
2202 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2203 {
2204 type Operation = google_cloud_lro::internal::Operation<
2205 crate::model::Cluster,
2206 crate::model::ClusterOperationMetadata,
2207 >;
2208 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2209 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2210
2211 let stub = self.0.stub.clone();
2212 let mut options = self.0.options.clone();
2213 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2214 let query = move |name| {
2215 let stub = stub.clone();
2216 let options = options.clone();
2217 async {
2218 let op = GetOperation::new(stub)
2219 .set_name(name)
2220 .with_options(options)
2221 .send()
2222 .await?;
2223 Ok(Operation::new(op))
2224 }
2225 };
2226
2227 let start = move || async {
2228 let op = self.send().await?;
2229 Ok(Operation::new(op))
2230 };
2231
2232 google_cloud_lro::internal::new_poller(
2233 polling_error_policy,
2234 polling_backoff_policy,
2235 start,
2236 query,
2237 )
2238 }
2239
2240 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2244 self.0.request.project_id = v.into();
2245 self
2246 }
2247
2248 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2252 self.0.request.region = v.into();
2253 self
2254 }
2255
2256 pub fn set_cluster<T>(mut self, v: T) -> Self
2260 where
2261 T: std::convert::Into<crate::model::Cluster>,
2262 {
2263 self.0.request.cluster = std::option::Option::Some(v.into());
2264 self
2265 }
2266
2267 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2271 where
2272 T: std::convert::Into<crate::model::Cluster>,
2273 {
2274 self.0.request.cluster = v.map(|x| x.into());
2275 self
2276 }
2277
2278 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2280 self.0.request.request_id = v.into();
2281 self
2282 }
2283
2284 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
2286 mut self,
2287 v: T,
2288 ) -> Self {
2289 self.0.request.action_on_failed_primary_workers = v.into();
2290 self
2291 }
2292 }
2293
2294 #[doc(hidden)]
2295 impl crate::RequestBuilder for CreateCluster {
2296 fn request_options(&mut self) -> &mut crate::RequestOptions {
2297 &mut self.0.options
2298 }
2299 }
2300
2301 #[derive(Clone, Debug)]
2319 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
2320
2321 impl UpdateCluster {
2322 pub(crate) fn new(
2323 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2324 ) -> Self {
2325 Self(RequestBuilder::new(stub))
2326 }
2327
2328 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
2330 self.0.request = v.into();
2331 self
2332 }
2333
2334 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2336 self.0.options = v.into();
2337 self
2338 }
2339
2340 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2347 (*self.0.stub)
2348 .update_cluster(self.0.request, self.0.options)
2349 .await
2350 .map(crate::Response::into_body)
2351 }
2352
2353 pub fn poller(
2355 self,
2356 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2357 {
2358 type Operation = google_cloud_lro::internal::Operation<
2359 crate::model::Cluster,
2360 crate::model::ClusterOperationMetadata,
2361 >;
2362 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2363 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2364
2365 let stub = self.0.stub.clone();
2366 let mut options = self.0.options.clone();
2367 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2368 let query = move |name| {
2369 let stub = stub.clone();
2370 let options = options.clone();
2371 async {
2372 let op = GetOperation::new(stub)
2373 .set_name(name)
2374 .with_options(options)
2375 .send()
2376 .await?;
2377 Ok(Operation::new(op))
2378 }
2379 };
2380
2381 let start = move || async {
2382 let op = self.send().await?;
2383 Ok(Operation::new(op))
2384 };
2385
2386 google_cloud_lro::internal::new_poller(
2387 polling_error_policy,
2388 polling_backoff_policy,
2389 start,
2390 query,
2391 )
2392 }
2393
2394 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2398 self.0.request.project_id = v.into();
2399 self
2400 }
2401
2402 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2406 self.0.request.region = v.into();
2407 self
2408 }
2409
2410 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2414 self.0.request.cluster_name = v.into();
2415 self
2416 }
2417
2418 pub fn set_cluster<T>(mut self, v: T) -> Self
2422 where
2423 T: std::convert::Into<crate::model::Cluster>,
2424 {
2425 self.0.request.cluster = std::option::Option::Some(v.into());
2426 self
2427 }
2428
2429 pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2433 where
2434 T: std::convert::Into<crate::model::Cluster>,
2435 {
2436 self.0.request.cluster = v.map(|x| x.into());
2437 self
2438 }
2439
2440 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
2442 where
2443 T: std::convert::Into<wkt::Duration>,
2444 {
2445 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
2446 self
2447 }
2448
2449 pub fn set_or_clear_graceful_decommission_timeout<T>(
2451 mut self,
2452 v: std::option::Option<T>,
2453 ) -> Self
2454 where
2455 T: std::convert::Into<wkt::Duration>,
2456 {
2457 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
2458 self
2459 }
2460
2461 pub fn set_update_mask<T>(mut self, v: T) -> Self
2465 where
2466 T: std::convert::Into<wkt::FieldMask>,
2467 {
2468 self.0.request.update_mask = std::option::Option::Some(v.into());
2469 self
2470 }
2471
2472 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2476 where
2477 T: std::convert::Into<wkt::FieldMask>,
2478 {
2479 self.0.request.update_mask = v.map(|x| x.into());
2480 self
2481 }
2482
2483 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2485 self.0.request.request_id = v.into();
2486 self
2487 }
2488 }
2489
2490 #[doc(hidden)]
2491 impl crate::RequestBuilder for UpdateCluster {
2492 fn request_options(&mut self) -> &mut crate::RequestOptions {
2493 &mut self.0.options
2494 }
2495 }
2496
2497 #[derive(Clone, Debug)]
2515 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
2516
2517 impl StopCluster {
2518 pub(crate) fn new(
2519 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2520 ) -> Self {
2521 Self(RequestBuilder::new(stub))
2522 }
2523
2524 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
2526 self.0.request = v.into();
2527 self
2528 }
2529
2530 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2532 self.0.options = v.into();
2533 self
2534 }
2535
2536 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2543 (*self.0.stub)
2544 .stop_cluster(self.0.request, self.0.options)
2545 .await
2546 .map(crate::Response::into_body)
2547 }
2548
2549 pub fn poller(
2551 self,
2552 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2553 {
2554 type Operation = google_cloud_lro::internal::Operation<
2555 crate::model::Cluster,
2556 crate::model::ClusterOperationMetadata,
2557 >;
2558 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2559 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2560
2561 let stub = self.0.stub.clone();
2562 let mut options = self.0.options.clone();
2563 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2564 let query = move |name| {
2565 let stub = stub.clone();
2566 let options = options.clone();
2567 async {
2568 let op = GetOperation::new(stub)
2569 .set_name(name)
2570 .with_options(options)
2571 .send()
2572 .await?;
2573 Ok(Operation::new(op))
2574 }
2575 };
2576
2577 let start = move || async {
2578 let op = self.send().await?;
2579 Ok(Operation::new(op))
2580 };
2581
2582 google_cloud_lro::internal::new_poller(
2583 polling_error_policy,
2584 polling_backoff_policy,
2585 start,
2586 query,
2587 )
2588 }
2589
2590 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2594 self.0.request.project_id = v.into();
2595 self
2596 }
2597
2598 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2602 self.0.request.region = v.into();
2603 self
2604 }
2605
2606 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.0.request.cluster_name = v.into();
2611 self
2612 }
2613
2614 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2616 self.0.request.cluster_uuid = v.into();
2617 self
2618 }
2619
2620 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2622 self.0.request.request_id = v.into();
2623 self
2624 }
2625 }
2626
2627 #[doc(hidden)]
2628 impl crate::RequestBuilder for StopCluster {
2629 fn request_options(&mut self) -> &mut crate::RequestOptions {
2630 &mut self.0.options
2631 }
2632 }
2633
2634 #[derive(Clone, Debug)]
2652 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
2653
2654 impl StartCluster {
2655 pub(crate) fn new(
2656 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2657 ) -> Self {
2658 Self(RequestBuilder::new(stub))
2659 }
2660
2661 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
2663 self.0.request = v.into();
2664 self
2665 }
2666
2667 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2669 self.0.options = v.into();
2670 self
2671 }
2672
2673 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2680 (*self.0.stub)
2681 .start_cluster(self.0.request, self.0.options)
2682 .await
2683 .map(crate::Response::into_body)
2684 }
2685
2686 pub fn poller(
2688 self,
2689 ) -> impl google_cloud_lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
2690 {
2691 type Operation = google_cloud_lro::internal::Operation<
2692 crate::model::Cluster,
2693 crate::model::ClusterOperationMetadata,
2694 >;
2695 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2696 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2697
2698 let stub = self.0.stub.clone();
2699 let mut options = self.0.options.clone();
2700 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2701 let query = move |name| {
2702 let stub = stub.clone();
2703 let options = options.clone();
2704 async {
2705 let op = GetOperation::new(stub)
2706 .set_name(name)
2707 .with_options(options)
2708 .send()
2709 .await?;
2710 Ok(Operation::new(op))
2711 }
2712 };
2713
2714 let start = move || async {
2715 let op = self.send().await?;
2716 Ok(Operation::new(op))
2717 };
2718
2719 google_cloud_lro::internal::new_poller(
2720 polling_error_policy,
2721 polling_backoff_policy,
2722 start,
2723 query,
2724 )
2725 }
2726
2727 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2731 self.0.request.project_id = v.into();
2732 self
2733 }
2734
2735 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2739 self.0.request.region = v.into();
2740 self
2741 }
2742
2743 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2747 self.0.request.cluster_name = v.into();
2748 self
2749 }
2750
2751 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2753 self.0.request.cluster_uuid = v.into();
2754 self
2755 }
2756
2757 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2759 self.0.request.request_id = v.into();
2760 self
2761 }
2762 }
2763
2764 #[doc(hidden)]
2765 impl crate::RequestBuilder for StartCluster {
2766 fn request_options(&mut self) -> &mut crate::RequestOptions {
2767 &mut self.0.options
2768 }
2769 }
2770
2771 #[derive(Clone, Debug)]
2789 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
2790
2791 impl DeleteCluster {
2792 pub(crate) fn new(
2793 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2794 ) -> Self {
2795 Self(RequestBuilder::new(stub))
2796 }
2797
2798 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
2800 self.0.request = v.into();
2801 self
2802 }
2803
2804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2806 self.0.options = v.into();
2807 self
2808 }
2809
2810 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2817 (*self.0.stub)
2818 .delete_cluster(self.0.request, self.0.options)
2819 .await
2820 .map(crate::Response::into_body)
2821 }
2822
2823 pub fn poller(
2825 self,
2826 ) -> impl google_cloud_lro::Poller<(), crate::model::ClusterOperationMetadata> {
2827 type Operation = google_cloud_lro::internal::Operation<
2828 wkt::Empty,
2829 crate::model::ClusterOperationMetadata,
2830 >;
2831 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2832 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2833
2834 let stub = self.0.stub.clone();
2835 let mut options = self.0.options.clone();
2836 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2837 let query = move |name| {
2838 let stub = stub.clone();
2839 let options = options.clone();
2840 async {
2841 let op = GetOperation::new(stub)
2842 .set_name(name)
2843 .with_options(options)
2844 .send()
2845 .await?;
2846 Ok(Operation::new(op))
2847 }
2848 };
2849
2850 let start = move || async {
2851 let op = self.send().await?;
2852 Ok(Operation::new(op))
2853 };
2854
2855 google_cloud_lro::internal::new_unit_response_poller(
2856 polling_error_policy,
2857 polling_backoff_policy,
2858 start,
2859 query,
2860 )
2861 }
2862
2863 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2867 self.0.request.project_id = v.into();
2868 self
2869 }
2870
2871 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2875 self.0.request.region = v.into();
2876 self
2877 }
2878
2879 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2883 self.0.request.cluster_name = v.into();
2884 self
2885 }
2886
2887 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2889 self.0.request.cluster_uuid = v.into();
2890 self
2891 }
2892
2893 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2895 self.0.request.request_id = v.into();
2896 self
2897 }
2898 }
2899
2900 #[doc(hidden)]
2901 impl crate::RequestBuilder for DeleteCluster {
2902 fn request_options(&mut self) -> &mut crate::RequestOptions {
2903 &mut self.0.options
2904 }
2905 }
2906
2907 #[derive(Clone, Debug)]
2924 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2925
2926 impl GetCluster {
2927 pub(crate) fn new(
2928 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
2929 ) -> Self {
2930 Self(RequestBuilder::new(stub))
2931 }
2932
2933 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2935 self.0.request = v.into();
2936 self
2937 }
2938
2939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2941 self.0.options = v.into();
2942 self
2943 }
2944
2945 pub async fn send(self) -> Result<crate::model::Cluster> {
2947 (*self.0.stub)
2948 .get_cluster(self.0.request, self.0.options)
2949 .await
2950 .map(crate::Response::into_body)
2951 }
2952
2953 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2957 self.0.request.project_id = v.into();
2958 self
2959 }
2960
2961 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2965 self.0.request.region = v.into();
2966 self
2967 }
2968
2969 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2973 self.0.request.cluster_name = v.into();
2974 self
2975 }
2976 }
2977
2978 #[doc(hidden)]
2979 impl crate::RequestBuilder for GetCluster {
2980 fn request_options(&mut self) -> &mut crate::RequestOptions {
2981 &mut self.0.options
2982 }
2983 }
2984
2985 #[derive(Clone, Debug)]
3006 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
3007
3008 impl ListClusters {
3009 pub(crate) fn new(
3010 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3011 ) -> Self {
3012 Self(RequestBuilder::new(stub))
3013 }
3014
3015 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
3017 self.0.request = v.into();
3018 self
3019 }
3020
3021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3023 self.0.options = v.into();
3024 self
3025 }
3026
3027 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
3029 (*self.0.stub)
3030 .list_clusters(self.0.request, self.0.options)
3031 .await
3032 .map(crate::Response::into_body)
3033 }
3034
3035 pub fn by_page(
3037 self,
3038 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListClustersResponse, crate::Error>
3039 {
3040 use std::clone::Clone;
3041 let token = self.0.request.page_token.clone();
3042 let execute = move |token: String| {
3043 let mut builder = self.clone();
3044 builder.0.request = builder.0.request.set_page_token(token);
3045 builder.send()
3046 };
3047 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3048 }
3049
3050 pub fn by_item(
3052 self,
3053 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3054 crate::model::ListClustersResponse,
3055 crate::Error,
3056 > {
3057 use google_cloud_gax::paginator::Paginator;
3058 self.by_page().items()
3059 }
3060
3061 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3065 self.0.request.project_id = v.into();
3066 self
3067 }
3068
3069 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3073 self.0.request.region = v.into();
3074 self
3075 }
3076
3077 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3079 self.0.request.filter = v.into();
3080 self
3081 }
3082
3083 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3085 self.0.request.page_size = v.into();
3086 self
3087 }
3088
3089 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3091 self.0.request.page_token = v.into();
3092 self
3093 }
3094 }
3095
3096 #[doc(hidden)]
3097 impl crate::RequestBuilder for ListClusters {
3098 fn request_options(&mut self) -> &mut crate::RequestOptions {
3099 &mut self.0.options
3100 }
3101 }
3102
3103 #[derive(Clone, Debug)]
3121 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
3122
3123 impl DiagnoseCluster {
3124 pub(crate) fn new(
3125 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3126 ) -> Self {
3127 Self(RequestBuilder::new(stub))
3128 }
3129
3130 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
3132 self.0.request = v.into();
3133 self
3134 }
3135
3136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3138 self.0.options = v.into();
3139 self
3140 }
3141
3142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3149 (*self.0.stub)
3150 .diagnose_cluster(self.0.request, self.0.options)
3151 .await
3152 .map(crate::Response::into_body)
3153 }
3154
3155 pub fn poller(
3157 self,
3158 ) -> impl google_cloud_lro::Poller<
3159 crate::model::DiagnoseClusterResults,
3160 crate::model::ClusterOperationMetadata,
3161 > {
3162 type Operation = google_cloud_lro::internal::Operation<
3163 crate::model::DiagnoseClusterResults,
3164 crate::model::ClusterOperationMetadata,
3165 >;
3166 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3167 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3168
3169 let stub = self.0.stub.clone();
3170 let mut options = self.0.options.clone();
3171 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3172 let query = move |name| {
3173 let stub = stub.clone();
3174 let options = options.clone();
3175 async {
3176 let op = GetOperation::new(stub)
3177 .set_name(name)
3178 .with_options(options)
3179 .send()
3180 .await?;
3181 Ok(Operation::new(op))
3182 }
3183 };
3184
3185 let start = move || async {
3186 let op = self.send().await?;
3187 Ok(Operation::new(op))
3188 };
3189
3190 google_cloud_lro::internal::new_poller(
3191 polling_error_policy,
3192 polling_backoff_policy,
3193 start,
3194 query,
3195 )
3196 }
3197
3198 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3202 self.0.request.project_id = v.into();
3203 self
3204 }
3205
3206 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3210 self.0.request.region = v.into();
3211 self
3212 }
3213
3214 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3218 self.0.request.cluster_name = v.into();
3219 self
3220 }
3221
3222 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
3224 self.0.request.tarball_gcs_dir = v.into();
3225 self
3226 }
3227
3228 pub fn set_tarball_access<
3230 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
3231 >(
3232 mut self,
3233 v: T,
3234 ) -> Self {
3235 self.0.request.tarball_access = v.into();
3236 self
3237 }
3238
3239 pub fn set_diagnosis_interval<T>(mut self, v: T) -> Self
3241 where
3242 T: std::convert::Into<google_cloud_type::model::Interval>,
3243 {
3244 self.0.request.diagnosis_interval = std::option::Option::Some(v.into());
3245 self
3246 }
3247
3248 pub fn set_or_clear_diagnosis_interval<T>(mut self, v: std::option::Option<T>) -> Self
3250 where
3251 T: std::convert::Into<google_cloud_type::model::Interval>,
3252 {
3253 self.0.request.diagnosis_interval = v.map(|x| x.into());
3254 self
3255 }
3256
3257 pub fn set_jobs<T, V>(mut self, v: T) -> Self
3259 where
3260 T: std::iter::IntoIterator<Item = V>,
3261 V: std::convert::Into<std::string::String>,
3262 {
3263 use std::iter::Iterator;
3264 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
3265 self
3266 }
3267
3268 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
3270 where
3271 T: std::iter::IntoIterator<Item = V>,
3272 V: std::convert::Into<std::string::String>,
3273 {
3274 use std::iter::Iterator;
3275 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
3276 self
3277 }
3278 }
3279
3280 #[doc(hidden)]
3281 impl crate::RequestBuilder for DiagnoseCluster {
3282 fn request_options(&mut self) -> &mut crate::RequestOptions {
3283 &mut self.0.options
3284 }
3285 }
3286
3287 #[derive(Clone, Debug)]
3304 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3305
3306 impl SetIamPolicy {
3307 pub(crate) fn new(
3308 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3309 ) -> Self {
3310 Self(RequestBuilder::new(stub))
3311 }
3312
3313 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3315 mut self,
3316 v: V,
3317 ) -> Self {
3318 self.0.request = v.into();
3319 self
3320 }
3321
3322 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3324 self.0.options = v.into();
3325 self
3326 }
3327
3328 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3330 (*self.0.stub)
3331 .set_iam_policy(self.0.request, self.0.options)
3332 .await
3333 .map(crate::Response::into_body)
3334 }
3335
3336 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3340 self.0.request.resource = v.into();
3341 self
3342 }
3343
3344 pub fn set_policy<T>(mut self, v: T) -> Self
3348 where
3349 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3350 {
3351 self.0.request.policy = std::option::Option::Some(v.into());
3352 self
3353 }
3354
3355 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3359 where
3360 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3361 {
3362 self.0.request.policy = v.map(|x| x.into());
3363 self
3364 }
3365
3366 pub fn set_update_mask<T>(mut self, v: T) -> Self
3368 where
3369 T: std::convert::Into<wkt::FieldMask>,
3370 {
3371 self.0.request.update_mask = std::option::Option::Some(v.into());
3372 self
3373 }
3374
3375 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3377 where
3378 T: std::convert::Into<wkt::FieldMask>,
3379 {
3380 self.0.request.update_mask = v.map(|x| x.into());
3381 self
3382 }
3383 }
3384
3385 #[doc(hidden)]
3386 impl crate::RequestBuilder for SetIamPolicy {
3387 fn request_options(&mut self) -> &mut crate::RequestOptions {
3388 &mut self.0.options
3389 }
3390 }
3391
3392 #[derive(Clone, Debug)]
3409 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3410
3411 impl GetIamPolicy {
3412 pub(crate) fn new(
3413 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3414 ) -> Self {
3415 Self(RequestBuilder::new(stub))
3416 }
3417
3418 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3420 mut self,
3421 v: V,
3422 ) -> Self {
3423 self.0.request = v.into();
3424 self
3425 }
3426
3427 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3429 self.0.options = v.into();
3430 self
3431 }
3432
3433 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3435 (*self.0.stub)
3436 .get_iam_policy(self.0.request, self.0.options)
3437 .await
3438 .map(crate::Response::into_body)
3439 }
3440
3441 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3445 self.0.request.resource = v.into();
3446 self
3447 }
3448
3449 pub fn set_options<T>(mut self, v: T) -> Self
3451 where
3452 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3453 {
3454 self.0.request.options = std::option::Option::Some(v.into());
3455 self
3456 }
3457
3458 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3460 where
3461 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3462 {
3463 self.0.request.options = v.map(|x| x.into());
3464 self
3465 }
3466 }
3467
3468 #[doc(hidden)]
3469 impl crate::RequestBuilder for GetIamPolicy {
3470 fn request_options(&mut self) -> &mut crate::RequestOptions {
3471 &mut self.0.options
3472 }
3473 }
3474
3475 #[derive(Clone, Debug)]
3492 pub struct TestIamPermissions(
3493 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3494 );
3495
3496 impl TestIamPermissions {
3497 pub(crate) fn new(
3498 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3499 ) -> Self {
3500 Self(RequestBuilder::new(stub))
3501 }
3502
3503 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3505 mut self,
3506 v: V,
3507 ) -> Self {
3508 self.0.request = v.into();
3509 self
3510 }
3511
3512 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3514 self.0.options = v.into();
3515 self
3516 }
3517
3518 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3520 (*self.0.stub)
3521 .test_iam_permissions(self.0.request, self.0.options)
3522 .await
3523 .map(crate::Response::into_body)
3524 }
3525
3526 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3530 self.0.request.resource = v.into();
3531 self
3532 }
3533
3534 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3538 where
3539 T: std::iter::IntoIterator<Item = V>,
3540 V: std::convert::Into<std::string::String>,
3541 {
3542 use std::iter::Iterator;
3543 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3544 self
3545 }
3546 }
3547
3548 #[doc(hidden)]
3549 impl crate::RequestBuilder for TestIamPermissions {
3550 fn request_options(&mut self) -> &mut crate::RequestOptions {
3551 &mut self.0.options
3552 }
3553 }
3554
3555 #[derive(Clone, Debug)]
3576 pub struct ListOperations(
3577 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3578 );
3579
3580 impl ListOperations {
3581 pub(crate) fn new(
3582 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3583 ) -> Self {
3584 Self(RequestBuilder::new(stub))
3585 }
3586
3587 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3589 mut self,
3590 v: V,
3591 ) -> Self {
3592 self.0.request = v.into();
3593 self
3594 }
3595
3596 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3598 self.0.options = v.into();
3599 self
3600 }
3601
3602 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3604 (*self.0.stub)
3605 .list_operations(self.0.request, self.0.options)
3606 .await
3607 .map(crate::Response::into_body)
3608 }
3609
3610 pub fn by_page(
3612 self,
3613 ) -> impl google_cloud_gax::paginator::Paginator<
3614 google_cloud_longrunning::model::ListOperationsResponse,
3615 crate::Error,
3616 > {
3617 use std::clone::Clone;
3618 let token = self.0.request.page_token.clone();
3619 let execute = move |token: String| {
3620 let mut builder = self.clone();
3621 builder.0.request = builder.0.request.set_page_token(token);
3622 builder.send()
3623 };
3624 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3625 }
3626
3627 pub fn by_item(
3629 self,
3630 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3631 google_cloud_longrunning::model::ListOperationsResponse,
3632 crate::Error,
3633 > {
3634 use google_cloud_gax::paginator::Paginator;
3635 self.by_page().items()
3636 }
3637
3638 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3640 self.0.request.name = v.into();
3641 self
3642 }
3643
3644 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3646 self.0.request.filter = v.into();
3647 self
3648 }
3649
3650 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3652 self.0.request.page_size = v.into();
3653 self
3654 }
3655
3656 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3658 self.0.request.page_token = v.into();
3659 self
3660 }
3661
3662 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3664 self.0.request.return_partial_success = v.into();
3665 self
3666 }
3667 }
3668
3669 #[doc(hidden)]
3670 impl crate::RequestBuilder for ListOperations {
3671 fn request_options(&mut self) -> &mut crate::RequestOptions {
3672 &mut self.0.options
3673 }
3674 }
3675
3676 #[derive(Clone, Debug)]
3693 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3694
3695 impl GetOperation {
3696 pub(crate) fn new(
3697 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3698 ) -> Self {
3699 Self(RequestBuilder::new(stub))
3700 }
3701
3702 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3704 mut self,
3705 v: V,
3706 ) -> Self {
3707 self.0.request = v.into();
3708 self
3709 }
3710
3711 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3713 self.0.options = v.into();
3714 self
3715 }
3716
3717 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3719 (*self.0.stub)
3720 .get_operation(self.0.request, self.0.options)
3721 .await
3722 .map(crate::Response::into_body)
3723 }
3724
3725 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3727 self.0.request.name = v.into();
3728 self
3729 }
3730 }
3731
3732 #[doc(hidden)]
3733 impl crate::RequestBuilder for GetOperation {
3734 fn request_options(&mut self) -> &mut crate::RequestOptions {
3735 &mut self.0.options
3736 }
3737 }
3738
3739 #[derive(Clone, Debug)]
3756 pub struct DeleteOperation(
3757 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3758 );
3759
3760 impl DeleteOperation {
3761 pub(crate) fn new(
3762 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3763 ) -> Self {
3764 Self(RequestBuilder::new(stub))
3765 }
3766
3767 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3769 mut self,
3770 v: V,
3771 ) -> Self {
3772 self.0.request = v.into();
3773 self
3774 }
3775
3776 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3778 self.0.options = v.into();
3779 self
3780 }
3781
3782 pub async fn send(self) -> Result<()> {
3784 (*self.0.stub)
3785 .delete_operation(self.0.request, self.0.options)
3786 .await
3787 .map(crate::Response::into_body)
3788 }
3789
3790 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3792 self.0.request.name = v.into();
3793 self
3794 }
3795 }
3796
3797 #[doc(hidden)]
3798 impl crate::RequestBuilder for DeleteOperation {
3799 fn request_options(&mut self) -> &mut crate::RequestOptions {
3800 &mut self.0.options
3801 }
3802 }
3803
3804 #[derive(Clone, Debug)]
3821 pub struct CancelOperation(
3822 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3823 );
3824
3825 impl CancelOperation {
3826 pub(crate) fn new(
3827 stub: std::sync::Arc<dyn super::super::stub::dynamic::ClusterController>,
3828 ) -> Self {
3829 Self(RequestBuilder::new(stub))
3830 }
3831
3832 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3834 mut self,
3835 v: V,
3836 ) -> Self {
3837 self.0.request = v.into();
3838 self
3839 }
3840
3841 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3843 self.0.options = v.into();
3844 self
3845 }
3846
3847 pub async fn send(self) -> Result<()> {
3849 (*self.0.stub)
3850 .cancel_operation(self.0.request, self.0.options)
3851 .await
3852 .map(crate::Response::into_body)
3853 }
3854
3855 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3857 self.0.request.name = v.into();
3858 self
3859 }
3860 }
3861
3862 #[doc(hidden)]
3863 impl crate::RequestBuilder for CancelOperation {
3864 fn request_options(&mut self) -> &mut crate::RequestOptions {
3865 &mut self.0.options
3866 }
3867 }
3868}
3869
3870pub mod job_controller {
3871 use crate::Result;
3872
3873 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3887
3888 pub(crate) mod client {
3889 use super::super::super::client::JobController;
3890 pub struct Factory;
3891 impl crate::ClientFactory for Factory {
3892 type Client = JobController;
3893 type Credentials = gaxi::options::Credentials;
3894 async fn build(
3895 self,
3896 config: gaxi::options::ClientConfig,
3897 ) -> crate::ClientBuilderResult<Self::Client> {
3898 Self::Client::new(config).await
3899 }
3900 }
3901 }
3902
3903 #[derive(Clone, Debug)]
3905 pub(crate) struct RequestBuilder<R: std::default::Default> {
3906 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3907 request: R,
3908 options: crate::RequestOptions,
3909 }
3910
3911 impl<R> RequestBuilder<R>
3912 where
3913 R: std::default::Default,
3914 {
3915 pub(crate) fn new(
3916 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3917 ) -> Self {
3918 Self {
3919 stub,
3920 request: R::default(),
3921 options: crate::RequestOptions::default(),
3922 }
3923 }
3924 }
3925
3926 #[derive(Clone, Debug)]
3943 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
3944
3945 impl SubmitJob {
3946 pub(crate) fn new(
3947 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
3948 ) -> Self {
3949 Self(RequestBuilder::new(stub))
3950 }
3951
3952 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
3954 self.0.request = v.into();
3955 self
3956 }
3957
3958 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3960 self.0.options = v.into();
3961 self
3962 }
3963
3964 pub async fn send(self) -> Result<crate::model::Job> {
3966 (*self.0.stub)
3967 .submit_job(self.0.request, self.0.options)
3968 .await
3969 .map(crate::Response::into_body)
3970 }
3971
3972 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3976 self.0.request.project_id = v.into();
3977 self
3978 }
3979
3980 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3984 self.0.request.region = v.into();
3985 self
3986 }
3987
3988 pub fn set_job<T>(mut self, v: T) -> Self
3992 where
3993 T: std::convert::Into<crate::model::Job>,
3994 {
3995 self.0.request.job = std::option::Option::Some(v.into());
3996 self
3997 }
3998
3999 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4003 where
4004 T: std::convert::Into<crate::model::Job>,
4005 {
4006 self.0.request.job = v.map(|x| x.into());
4007 self
4008 }
4009
4010 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4012 self.0.request.request_id = v.into();
4013 self
4014 }
4015 }
4016
4017 #[doc(hidden)]
4018 impl crate::RequestBuilder for SubmitJob {
4019 fn request_options(&mut self) -> &mut crate::RequestOptions {
4020 &mut self.0.options
4021 }
4022 }
4023
4024 #[derive(Clone, Debug)]
4042 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
4043
4044 impl SubmitJobAsOperation {
4045 pub(crate) fn new(
4046 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4047 ) -> Self {
4048 Self(RequestBuilder::new(stub))
4049 }
4050
4051 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
4053 self.0.request = v.into();
4054 self
4055 }
4056
4057 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4059 self.0.options = v.into();
4060 self
4061 }
4062
4063 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4070 (*self.0.stub)
4071 .submit_job_as_operation(self.0.request, self.0.options)
4072 .await
4073 .map(crate::Response::into_body)
4074 }
4075
4076 pub fn poller(
4078 self,
4079 ) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::JobMetadata> {
4080 type Operation =
4081 google_cloud_lro::internal::Operation<crate::model::Job, crate::model::JobMetadata>;
4082 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4083 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4084
4085 let stub = self.0.stub.clone();
4086 let mut options = self.0.options.clone();
4087 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4088 let query = move |name| {
4089 let stub = stub.clone();
4090 let options = options.clone();
4091 async {
4092 let op = GetOperation::new(stub)
4093 .set_name(name)
4094 .with_options(options)
4095 .send()
4096 .await?;
4097 Ok(Operation::new(op))
4098 }
4099 };
4100
4101 let start = move || async {
4102 let op = self.send().await?;
4103 Ok(Operation::new(op))
4104 };
4105
4106 google_cloud_lro::internal::new_poller(
4107 polling_error_policy,
4108 polling_backoff_policy,
4109 start,
4110 query,
4111 )
4112 }
4113
4114 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4118 self.0.request.project_id = v.into();
4119 self
4120 }
4121
4122 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4126 self.0.request.region = v.into();
4127 self
4128 }
4129
4130 pub fn set_job<T>(mut self, v: T) -> Self
4134 where
4135 T: std::convert::Into<crate::model::Job>,
4136 {
4137 self.0.request.job = std::option::Option::Some(v.into());
4138 self
4139 }
4140
4141 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4145 where
4146 T: std::convert::Into<crate::model::Job>,
4147 {
4148 self.0.request.job = v.map(|x| x.into());
4149 self
4150 }
4151
4152 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4154 self.0.request.request_id = v.into();
4155 self
4156 }
4157 }
4158
4159 #[doc(hidden)]
4160 impl crate::RequestBuilder for SubmitJobAsOperation {
4161 fn request_options(&mut self) -> &mut crate::RequestOptions {
4162 &mut self.0.options
4163 }
4164 }
4165
4166 #[derive(Clone, Debug)]
4183 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
4184
4185 impl GetJob {
4186 pub(crate) fn new(
4187 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4188 ) -> Self {
4189 Self(RequestBuilder::new(stub))
4190 }
4191
4192 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
4194 self.0.request = v.into();
4195 self
4196 }
4197
4198 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4200 self.0.options = v.into();
4201 self
4202 }
4203
4204 pub async fn send(self) -> Result<crate::model::Job> {
4206 (*self.0.stub)
4207 .get_job(self.0.request, self.0.options)
4208 .await
4209 .map(crate::Response::into_body)
4210 }
4211
4212 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4216 self.0.request.project_id = v.into();
4217 self
4218 }
4219
4220 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4224 self.0.request.region = v.into();
4225 self
4226 }
4227
4228 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4232 self.0.request.job_id = v.into();
4233 self
4234 }
4235 }
4236
4237 #[doc(hidden)]
4238 impl crate::RequestBuilder for GetJob {
4239 fn request_options(&mut self) -> &mut crate::RequestOptions {
4240 &mut self.0.options
4241 }
4242 }
4243
4244 #[derive(Clone, Debug)]
4265 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
4266
4267 impl ListJobs {
4268 pub(crate) fn new(
4269 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4270 ) -> Self {
4271 Self(RequestBuilder::new(stub))
4272 }
4273
4274 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
4276 self.0.request = v.into();
4277 self
4278 }
4279
4280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4282 self.0.options = v.into();
4283 self
4284 }
4285
4286 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
4288 (*self.0.stub)
4289 .list_jobs(self.0.request, self.0.options)
4290 .await
4291 .map(crate::Response::into_body)
4292 }
4293
4294 pub fn by_page(
4296 self,
4297 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
4298 {
4299 use std::clone::Clone;
4300 let token = self.0.request.page_token.clone();
4301 let execute = move |token: String| {
4302 let mut builder = self.clone();
4303 builder.0.request = builder.0.request.set_page_token(token);
4304 builder.send()
4305 };
4306 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4307 }
4308
4309 pub fn by_item(
4311 self,
4312 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
4313 {
4314 use google_cloud_gax::paginator::Paginator;
4315 self.by_page().items()
4316 }
4317
4318 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4322 self.0.request.project_id = v.into();
4323 self
4324 }
4325
4326 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4330 self.0.request.region = v.into();
4331 self
4332 }
4333
4334 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4336 self.0.request.page_size = v.into();
4337 self
4338 }
4339
4340 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4342 self.0.request.page_token = v.into();
4343 self
4344 }
4345
4346 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4348 self.0.request.cluster_name = v.into();
4349 self
4350 }
4351
4352 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
4354 mut self,
4355 v: T,
4356 ) -> Self {
4357 self.0.request.job_state_matcher = v.into();
4358 self
4359 }
4360
4361 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4363 self.0.request.filter = v.into();
4364 self
4365 }
4366 }
4367
4368 #[doc(hidden)]
4369 impl crate::RequestBuilder for ListJobs {
4370 fn request_options(&mut self) -> &mut crate::RequestOptions {
4371 &mut self.0.options
4372 }
4373 }
4374
4375 #[derive(Clone, Debug)]
4392 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
4393
4394 impl UpdateJob {
4395 pub(crate) fn new(
4396 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4397 ) -> Self {
4398 Self(RequestBuilder::new(stub))
4399 }
4400
4401 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
4403 self.0.request = v.into();
4404 self
4405 }
4406
4407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4409 self.0.options = v.into();
4410 self
4411 }
4412
4413 pub async fn send(self) -> Result<crate::model::Job> {
4415 (*self.0.stub)
4416 .update_job(self.0.request, self.0.options)
4417 .await
4418 .map(crate::Response::into_body)
4419 }
4420
4421 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4425 self.0.request.project_id = v.into();
4426 self
4427 }
4428
4429 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4433 self.0.request.region = v.into();
4434 self
4435 }
4436
4437 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4441 self.0.request.job_id = v.into();
4442 self
4443 }
4444
4445 pub fn set_job<T>(mut self, v: T) -> Self
4449 where
4450 T: std::convert::Into<crate::model::Job>,
4451 {
4452 self.0.request.job = std::option::Option::Some(v.into());
4453 self
4454 }
4455
4456 pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
4460 where
4461 T: std::convert::Into<crate::model::Job>,
4462 {
4463 self.0.request.job = v.map(|x| x.into());
4464 self
4465 }
4466
4467 pub fn set_update_mask<T>(mut self, v: T) -> Self
4471 where
4472 T: std::convert::Into<wkt::FieldMask>,
4473 {
4474 self.0.request.update_mask = std::option::Option::Some(v.into());
4475 self
4476 }
4477
4478 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4482 where
4483 T: std::convert::Into<wkt::FieldMask>,
4484 {
4485 self.0.request.update_mask = v.map(|x| x.into());
4486 self
4487 }
4488 }
4489
4490 #[doc(hidden)]
4491 impl crate::RequestBuilder for UpdateJob {
4492 fn request_options(&mut self) -> &mut crate::RequestOptions {
4493 &mut self.0.options
4494 }
4495 }
4496
4497 #[derive(Clone, Debug)]
4514 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
4515
4516 impl CancelJob {
4517 pub(crate) fn new(
4518 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4519 ) -> Self {
4520 Self(RequestBuilder::new(stub))
4521 }
4522
4523 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
4525 self.0.request = v.into();
4526 self
4527 }
4528
4529 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4531 self.0.options = v.into();
4532 self
4533 }
4534
4535 pub async fn send(self) -> Result<crate::model::Job> {
4537 (*self.0.stub)
4538 .cancel_job(self.0.request, self.0.options)
4539 .await
4540 .map(crate::Response::into_body)
4541 }
4542
4543 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4547 self.0.request.project_id = v.into();
4548 self
4549 }
4550
4551 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4555 self.0.request.region = v.into();
4556 self
4557 }
4558
4559 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4563 self.0.request.job_id = v.into();
4564 self
4565 }
4566 }
4567
4568 #[doc(hidden)]
4569 impl crate::RequestBuilder for CancelJob {
4570 fn request_options(&mut self) -> &mut crate::RequestOptions {
4571 &mut self.0.options
4572 }
4573 }
4574
4575 #[derive(Clone, Debug)]
4592 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
4593
4594 impl DeleteJob {
4595 pub(crate) fn new(
4596 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4597 ) -> Self {
4598 Self(RequestBuilder::new(stub))
4599 }
4600
4601 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
4603 self.0.request = v.into();
4604 self
4605 }
4606
4607 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4609 self.0.options = v.into();
4610 self
4611 }
4612
4613 pub async fn send(self) -> Result<()> {
4615 (*self.0.stub)
4616 .delete_job(self.0.request, self.0.options)
4617 .await
4618 .map(crate::Response::into_body)
4619 }
4620
4621 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4625 self.0.request.project_id = v.into();
4626 self
4627 }
4628
4629 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
4633 self.0.request.region = v.into();
4634 self
4635 }
4636
4637 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4641 self.0.request.job_id = v.into();
4642 self
4643 }
4644 }
4645
4646 #[doc(hidden)]
4647 impl crate::RequestBuilder for DeleteJob {
4648 fn request_options(&mut self) -> &mut crate::RequestOptions {
4649 &mut self.0.options
4650 }
4651 }
4652
4653 #[derive(Clone, Debug)]
4670 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
4671
4672 impl SetIamPolicy {
4673 pub(crate) fn new(
4674 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4675 ) -> Self {
4676 Self(RequestBuilder::new(stub))
4677 }
4678
4679 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
4681 mut self,
4682 v: V,
4683 ) -> Self {
4684 self.0.request = v.into();
4685 self
4686 }
4687
4688 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4690 self.0.options = v.into();
4691 self
4692 }
4693
4694 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4696 (*self.0.stub)
4697 .set_iam_policy(self.0.request, self.0.options)
4698 .await
4699 .map(crate::Response::into_body)
4700 }
4701
4702 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4706 self.0.request.resource = v.into();
4707 self
4708 }
4709
4710 pub fn set_policy<T>(mut self, v: T) -> Self
4714 where
4715 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4716 {
4717 self.0.request.policy = std::option::Option::Some(v.into());
4718 self
4719 }
4720
4721 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4725 where
4726 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4727 {
4728 self.0.request.policy = v.map(|x| x.into());
4729 self
4730 }
4731
4732 pub fn set_update_mask<T>(mut self, v: T) -> Self
4734 where
4735 T: std::convert::Into<wkt::FieldMask>,
4736 {
4737 self.0.request.update_mask = std::option::Option::Some(v.into());
4738 self
4739 }
4740
4741 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4743 where
4744 T: std::convert::Into<wkt::FieldMask>,
4745 {
4746 self.0.request.update_mask = v.map(|x| x.into());
4747 self
4748 }
4749 }
4750
4751 #[doc(hidden)]
4752 impl crate::RequestBuilder for SetIamPolicy {
4753 fn request_options(&mut self) -> &mut crate::RequestOptions {
4754 &mut self.0.options
4755 }
4756 }
4757
4758 #[derive(Clone, Debug)]
4775 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
4776
4777 impl GetIamPolicy {
4778 pub(crate) fn new(
4779 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4780 ) -> Self {
4781 Self(RequestBuilder::new(stub))
4782 }
4783
4784 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
4786 mut self,
4787 v: V,
4788 ) -> Self {
4789 self.0.request = v.into();
4790 self
4791 }
4792
4793 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4795 self.0.options = v.into();
4796 self
4797 }
4798
4799 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4801 (*self.0.stub)
4802 .get_iam_policy(self.0.request, self.0.options)
4803 .await
4804 .map(crate::Response::into_body)
4805 }
4806
4807 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4811 self.0.request.resource = v.into();
4812 self
4813 }
4814
4815 pub fn set_options<T>(mut self, v: T) -> Self
4817 where
4818 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4819 {
4820 self.0.request.options = std::option::Option::Some(v.into());
4821 self
4822 }
4823
4824 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4826 where
4827 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4828 {
4829 self.0.request.options = v.map(|x| x.into());
4830 self
4831 }
4832 }
4833
4834 #[doc(hidden)]
4835 impl crate::RequestBuilder for GetIamPolicy {
4836 fn request_options(&mut self) -> &mut crate::RequestOptions {
4837 &mut self.0.options
4838 }
4839 }
4840
4841 #[derive(Clone, Debug)]
4858 pub struct TestIamPermissions(
4859 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
4860 );
4861
4862 impl TestIamPermissions {
4863 pub(crate) fn new(
4864 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4865 ) -> Self {
4866 Self(RequestBuilder::new(stub))
4867 }
4868
4869 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
4871 mut self,
4872 v: V,
4873 ) -> Self {
4874 self.0.request = v.into();
4875 self
4876 }
4877
4878 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4880 self.0.options = v.into();
4881 self
4882 }
4883
4884 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
4886 (*self.0.stub)
4887 .test_iam_permissions(self.0.request, self.0.options)
4888 .await
4889 .map(crate::Response::into_body)
4890 }
4891
4892 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4896 self.0.request.resource = v.into();
4897 self
4898 }
4899
4900 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4904 where
4905 T: std::iter::IntoIterator<Item = V>,
4906 V: std::convert::Into<std::string::String>,
4907 {
4908 use std::iter::Iterator;
4909 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4910 self
4911 }
4912 }
4913
4914 #[doc(hidden)]
4915 impl crate::RequestBuilder for TestIamPermissions {
4916 fn request_options(&mut self) -> &mut crate::RequestOptions {
4917 &mut self.0.options
4918 }
4919 }
4920
4921 #[derive(Clone, Debug)]
4942 pub struct ListOperations(
4943 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4944 );
4945
4946 impl ListOperations {
4947 pub(crate) fn new(
4948 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
4949 ) -> Self {
4950 Self(RequestBuilder::new(stub))
4951 }
4952
4953 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4955 mut self,
4956 v: V,
4957 ) -> Self {
4958 self.0.request = v.into();
4959 self
4960 }
4961
4962 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4964 self.0.options = v.into();
4965 self
4966 }
4967
4968 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4970 (*self.0.stub)
4971 .list_operations(self.0.request, self.0.options)
4972 .await
4973 .map(crate::Response::into_body)
4974 }
4975
4976 pub fn by_page(
4978 self,
4979 ) -> impl google_cloud_gax::paginator::Paginator<
4980 google_cloud_longrunning::model::ListOperationsResponse,
4981 crate::Error,
4982 > {
4983 use std::clone::Clone;
4984 let token = self.0.request.page_token.clone();
4985 let execute = move |token: String| {
4986 let mut builder = self.clone();
4987 builder.0.request = builder.0.request.set_page_token(token);
4988 builder.send()
4989 };
4990 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4991 }
4992
4993 pub fn by_item(
4995 self,
4996 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4997 google_cloud_longrunning::model::ListOperationsResponse,
4998 crate::Error,
4999 > {
5000 use google_cloud_gax::paginator::Paginator;
5001 self.by_page().items()
5002 }
5003
5004 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5006 self.0.request.name = v.into();
5007 self
5008 }
5009
5010 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5012 self.0.request.filter = v.into();
5013 self
5014 }
5015
5016 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5018 self.0.request.page_size = v.into();
5019 self
5020 }
5021
5022 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5024 self.0.request.page_token = v.into();
5025 self
5026 }
5027
5028 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5030 self.0.request.return_partial_success = v.into();
5031 self
5032 }
5033 }
5034
5035 #[doc(hidden)]
5036 impl crate::RequestBuilder for ListOperations {
5037 fn request_options(&mut self) -> &mut crate::RequestOptions {
5038 &mut self.0.options
5039 }
5040 }
5041
5042 #[derive(Clone, Debug)]
5059 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5060
5061 impl GetOperation {
5062 pub(crate) fn new(
5063 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5064 ) -> Self {
5065 Self(RequestBuilder::new(stub))
5066 }
5067
5068 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5070 mut self,
5071 v: V,
5072 ) -> Self {
5073 self.0.request = v.into();
5074 self
5075 }
5076
5077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5079 self.0.options = v.into();
5080 self
5081 }
5082
5083 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5085 (*self.0.stub)
5086 .get_operation(self.0.request, self.0.options)
5087 .await
5088 .map(crate::Response::into_body)
5089 }
5090
5091 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5093 self.0.request.name = v.into();
5094 self
5095 }
5096 }
5097
5098 #[doc(hidden)]
5099 impl crate::RequestBuilder for GetOperation {
5100 fn request_options(&mut self) -> &mut crate::RequestOptions {
5101 &mut self.0.options
5102 }
5103 }
5104
5105 #[derive(Clone, Debug)]
5122 pub struct DeleteOperation(
5123 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
5124 );
5125
5126 impl DeleteOperation {
5127 pub(crate) fn new(
5128 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5129 ) -> Self {
5130 Self(RequestBuilder::new(stub))
5131 }
5132
5133 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
5135 mut self,
5136 v: V,
5137 ) -> Self {
5138 self.0.request = v.into();
5139 self
5140 }
5141
5142 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5144 self.0.options = v.into();
5145 self
5146 }
5147
5148 pub async fn send(self) -> Result<()> {
5150 (*self.0.stub)
5151 .delete_operation(self.0.request, self.0.options)
5152 .await
5153 .map(crate::Response::into_body)
5154 }
5155
5156 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5158 self.0.request.name = v.into();
5159 self
5160 }
5161 }
5162
5163 #[doc(hidden)]
5164 impl crate::RequestBuilder for DeleteOperation {
5165 fn request_options(&mut self) -> &mut crate::RequestOptions {
5166 &mut self.0.options
5167 }
5168 }
5169
5170 #[derive(Clone, Debug)]
5187 pub struct CancelOperation(
5188 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5189 );
5190
5191 impl CancelOperation {
5192 pub(crate) fn new(
5193 stub: std::sync::Arc<dyn super::super::stub::dynamic::JobController>,
5194 ) -> Self {
5195 Self(RequestBuilder::new(stub))
5196 }
5197
5198 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5200 mut self,
5201 v: V,
5202 ) -> Self {
5203 self.0.request = v.into();
5204 self
5205 }
5206
5207 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5209 self.0.options = v.into();
5210 self
5211 }
5212
5213 pub async fn send(self) -> Result<()> {
5215 (*self.0.stub)
5216 .cancel_operation(self.0.request, self.0.options)
5217 .await
5218 .map(crate::Response::into_body)
5219 }
5220
5221 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5223 self.0.request.name = v.into();
5224 self
5225 }
5226 }
5227
5228 #[doc(hidden)]
5229 impl crate::RequestBuilder for CancelOperation {
5230 fn request_options(&mut self) -> &mut crate::RequestOptions {
5231 &mut self.0.options
5232 }
5233 }
5234}
5235
5236pub mod node_group_controller {
5237 use crate::Result;
5238
5239 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5253
5254 pub(crate) mod client {
5255 use super::super::super::client::NodeGroupController;
5256 pub struct Factory;
5257 impl crate::ClientFactory for Factory {
5258 type Client = NodeGroupController;
5259 type Credentials = gaxi::options::Credentials;
5260 async fn build(
5261 self,
5262 config: gaxi::options::ClientConfig,
5263 ) -> crate::ClientBuilderResult<Self::Client> {
5264 Self::Client::new(config).await
5265 }
5266 }
5267 }
5268
5269 #[derive(Clone, Debug)]
5271 pub(crate) struct RequestBuilder<R: std::default::Default> {
5272 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5273 request: R,
5274 options: crate::RequestOptions,
5275 }
5276
5277 impl<R> RequestBuilder<R>
5278 where
5279 R: std::default::Default,
5280 {
5281 pub(crate) fn new(
5282 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5283 ) -> Self {
5284 Self {
5285 stub,
5286 request: R::default(),
5287 options: crate::RequestOptions::default(),
5288 }
5289 }
5290 }
5291
5292 #[derive(Clone, Debug)]
5310 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
5311
5312 impl CreateNodeGroup {
5313 pub(crate) fn new(
5314 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5315 ) -> Self {
5316 Self(RequestBuilder::new(stub))
5317 }
5318
5319 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
5321 self.0.request = v.into();
5322 self
5323 }
5324
5325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5327 self.0.options = v.into();
5328 self
5329 }
5330
5331 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5338 (*self.0.stub)
5339 .create_node_group(self.0.request, self.0.options)
5340 .await
5341 .map(crate::Response::into_body)
5342 }
5343
5344 pub fn poller(
5346 self,
5347 ) -> impl google_cloud_lro::Poller<
5348 crate::model::NodeGroup,
5349 crate::model::NodeGroupOperationMetadata,
5350 > {
5351 type Operation = google_cloud_lro::internal::Operation<
5352 crate::model::NodeGroup,
5353 crate::model::NodeGroupOperationMetadata,
5354 >;
5355 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5356 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5357
5358 let stub = self.0.stub.clone();
5359 let mut options = self.0.options.clone();
5360 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5361 let query = move |name| {
5362 let stub = stub.clone();
5363 let options = options.clone();
5364 async {
5365 let op = GetOperation::new(stub)
5366 .set_name(name)
5367 .with_options(options)
5368 .send()
5369 .await?;
5370 Ok(Operation::new(op))
5371 }
5372 };
5373
5374 let start = move || async {
5375 let op = self.send().await?;
5376 Ok(Operation::new(op))
5377 };
5378
5379 google_cloud_lro::internal::new_poller(
5380 polling_error_policy,
5381 polling_backoff_policy,
5382 start,
5383 query,
5384 )
5385 }
5386
5387 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5391 self.0.request.parent = v.into();
5392 self
5393 }
5394
5395 pub fn set_node_group<T>(mut self, v: T) -> Self
5399 where
5400 T: std::convert::Into<crate::model::NodeGroup>,
5401 {
5402 self.0.request.node_group = std::option::Option::Some(v.into());
5403 self
5404 }
5405
5406 pub fn set_or_clear_node_group<T>(mut self, v: std::option::Option<T>) -> Self
5410 where
5411 T: std::convert::Into<crate::model::NodeGroup>,
5412 {
5413 self.0.request.node_group = v.map(|x| x.into());
5414 self
5415 }
5416
5417 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5419 self.0.request.node_group_id = v.into();
5420 self
5421 }
5422
5423 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5425 self.0.request.request_id = v.into();
5426 self
5427 }
5428 }
5429
5430 #[doc(hidden)]
5431 impl crate::RequestBuilder for CreateNodeGroup {
5432 fn request_options(&mut self) -> &mut crate::RequestOptions {
5433 &mut self.0.options
5434 }
5435 }
5436
5437 #[derive(Clone, Debug)]
5455 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
5456
5457 impl ResizeNodeGroup {
5458 pub(crate) fn new(
5459 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5460 ) -> Self {
5461 Self(RequestBuilder::new(stub))
5462 }
5463
5464 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
5466 self.0.request = v.into();
5467 self
5468 }
5469
5470 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5472 self.0.options = v.into();
5473 self
5474 }
5475
5476 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5483 (*self.0.stub)
5484 .resize_node_group(self.0.request, self.0.options)
5485 .await
5486 .map(crate::Response::into_body)
5487 }
5488
5489 pub fn poller(
5491 self,
5492 ) -> impl google_cloud_lro::Poller<
5493 crate::model::NodeGroup,
5494 crate::model::NodeGroupOperationMetadata,
5495 > {
5496 type Operation = google_cloud_lro::internal::Operation<
5497 crate::model::NodeGroup,
5498 crate::model::NodeGroupOperationMetadata,
5499 >;
5500 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5501 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5502
5503 let stub = self.0.stub.clone();
5504 let mut options = self.0.options.clone();
5505 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5506 let query = move |name| {
5507 let stub = stub.clone();
5508 let options = options.clone();
5509 async {
5510 let op = GetOperation::new(stub)
5511 .set_name(name)
5512 .with_options(options)
5513 .send()
5514 .await?;
5515 Ok(Operation::new(op))
5516 }
5517 };
5518
5519 let start = move || async {
5520 let op = self.send().await?;
5521 Ok(Operation::new(op))
5522 };
5523
5524 google_cloud_lro::internal::new_poller(
5525 polling_error_policy,
5526 polling_backoff_policy,
5527 start,
5528 query,
5529 )
5530 }
5531
5532 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5536 self.0.request.name = v.into();
5537 self
5538 }
5539
5540 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
5544 self.0.request.size = v.into();
5545 self
5546 }
5547
5548 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5550 self.0.request.request_id = v.into();
5551 self
5552 }
5553
5554 pub fn set_graceful_decommission_timeout<T>(mut self, v: T) -> Self
5556 where
5557 T: std::convert::Into<wkt::Duration>,
5558 {
5559 self.0.request.graceful_decommission_timeout = std::option::Option::Some(v.into());
5560 self
5561 }
5562
5563 pub fn set_or_clear_graceful_decommission_timeout<T>(
5565 mut self,
5566 v: std::option::Option<T>,
5567 ) -> Self
5568 where
5569 T: std::convert::Into<wkt::Duration>,
5570 {
5571 self.0.request.graceful_decommission_timeout = v.map(|x| x.into());
5572 self
5573 }
5574 }
5575
5576 #[doc(hidden)]
5577 impl crate::RequestBuilder for ResizeNodeGroup {
5578 fn request_options(&mut self) -> &mut crate::RequestOptions {
5579 &mut self.0.options
5580 }
5581 }
5582
5583 #[derive(Clone, Debug)]
5600 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
5601
5602 impl GetNodeGroup {
5603 pub(crate) fn new(
5604 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5605 ) -> Self {
5606 Self(RequestBuilder::new(stub))
5607 }
5608
5609 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
5611 self.0.request = v.into();
5612 self
5613 }
5614
5615 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5617 self.0.options = v.into();
5618 self
5619 }
5620
5621 pub async fn send(self) -> Result<crate::model::NodeGroup> {
5623 (*self.0.stub)
5624 .get_node_group(self.0.request, self.0.options)
5625 .await
5626 .map(crate::Response::into_body)
5627 }
5628
5629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5633 self.0.request.name = v.into();
5634 self
5635 }
5636 }
5637
5638 #[doc(hidden)]
5639 impl crate::RequestBuilder for GetNodeGroup {
5640 fn request_options(&mut self) -> &mut crate::RequestOptions {
5641 &mut self.0.options
5642 }
5643 }
5644
5645 #[derive(Clone, Debug)]
5662 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5663
5664 impl SetIamPolicy {
5665 pub(crate) fn new(
5666 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5667 ) -> Self {
5668 Self(RequestBuilder::new(stub))
5669 }
5670
5671 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5673 mut self,
5674 v: V,
5675 ) -> Self {
5676 self.0.request = v.into();
5677 self
5678 }
5679
5680 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5682 self.0.options = v.into();
5683 self
5684 }
5685
5686 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5688 (*self.0.stub)
5689 .set_iam_policy(self.0.request, self.0.options)
5690 .await
5691 .map(crate::Response::into_body)
5692 }
5693
5694 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5698 self.0.request.resource = v.into();
5699 self
5700 }
5701
5702 pub fn set_policy<T>(mut self, v: T) -> Self
5706 where
5707 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5708 {
5709 self.0.request.policy = std::option::Option::Some(v.into());
5710 self
5711 }
5712
5713 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5717 where
5718 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5719 {
5720 self.0.request.policy = v.map(|x| x.into());
5721 self
5722 }
5723
5724 pub fn set_update_mask<T>(mut self, v: T) -> Self
5726 where
5727 T: std::convert::Into<wkt::FieldMask>,
5728 {
5729 self.0.request.update_mask = std::option::Option::Some(v.into());
5730 self
5731 }
5732
5733 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5735 where
5736 T: std::convert::Into<wkt::FieldMask>,
5737 {
5738 self.0.request.update_mask = v.map(|x| x.into());
5739 self
5740 }
5741 }
5742
5743 #[doc(hidden)]
5744 impl crate::RequestBuilder for SetIamPolicy {
5745 fn request_options(&mut self) -> &mut crate::RequestOptions {
5746 &mut self.0.options
5747 }
5748 }
5749
5750 #[derive(Clone, Debug)]
5767 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5768
5769 impl GetIamPolicy {
5770 pub(crate) fn new(
5771 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5772 ) -> Self {
5773 Self(RequestBuilder::new(stub))
5774 }
5775
5776 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5778 mut self,
5779 v: V,
5780 ) -> Self {
5781 self.0.request = v.into();
5782 self
5783 }
5784
5785 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5787 self.0.options = v.into();
5788 self
5789 }
5790
5791 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5793 (*self.0.stub)
5794 .get_iam_policy(self.0.request, self.0.options)
5795 .await
5796 .map(crate::Response::into_body)
5797 }
5798
5799 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5803 self.0.request.resource = v.into();
5804 self
5805 }
5806
5807 pub fn set_options<T>(mut self, v: T) -> Self
5809 where
5810 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5811 {
5812 self.0.request.options = std::option::Option::Some(v.into());
5813 self
5814 }
5815
5816 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5818 where
5819 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5820 {
5821 self.0.request.options = v.map(|x| x.into());
5822 self
5823 }
5824 }
5825
5826 #[doc(hidden)]
5827 impl crate::RequestBuilder for GetIamPolicy {
5828 fn request_options(&mut self) -> &mut crate::RequestOptions {
5829 &mut self.0.options
5830 }
5831 }
5832
5833 #[derive(Clone, Debug)]
5850 pub struct TestIamPermissions(
5851 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5852 );
5853
5854 impl TestIamPermissions {
5855 pub(crate) fn new(
5856 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5857 ) -> Self {
5858 Self(RequestBuilder::new(stub))
5859 }
5860
5861 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5863 mut self,
5864 v: V,
5865 ) -> Self {
5866 self.0.request = v.into();
5867 self
5868 }
5869
5870 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5872 self.0.options = v.into();
5873 self
5874 }
5875
5876 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5878 (*self.0.stub)
5879 .test_iam_permissions(self.0.request, self.0.options)
5880 .await
5881 .map(crate::Response::into_body)
5882 }
5883
5884 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5888 self.0.request.resource = v.into();
5889 self
5890 }
5891
5892 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5896 where
5897 T: std::iter::IntoIterator<Item = V>,
5898 V: std::convert::Into<std::string::String>,
5899 {
5900 use std::iter::Iterator;
5901 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5902 self
5903 }
5904 }
5905
5906 #[doc(hidden)]
5907 impl crate::RequestBuilder for TestIamPermissions {
5908 fn request_options(&mut self) -> &mut crate::RequestOptions {
5909 &mut self.0.options
5910 }
5911 }
5912
5913 #[derive(Clone, Debug)]
5934 pub struct ListOperations(
5935 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5936 );
5937
5938 impl ListOperations {
5939 pub(crate) fn new(
5940 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
5941 ) -> Self {
5942 Self(RequestBuilder::new(stub))
5943 }
5944
5945 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5947 mut self,
5948 v: V,
5949 ) -> Self {
5950 self.0.request = v.into();
5951 self
5952 }
5953
5954 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5956 self.0.options = v.into();
5957 self
5958 }
5959
5960 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5962 (*self.0.stub)
5963 .list_operations(self.0.request, self.0.options)
5964 .await
5965 .map(crate::Response::into_body)
5966 }
5967
5968 pub fn by_page(
5970 self,
5971 ) -> impl google_cloud_gax::paginator::Paginator<
5972 google_cloud_longrunning::model::ListOperationsResponse,
5973 crate::Error,
5974 > {
5975 use std::clone::Clone;
5976 let token = self.0.request.page_token.clone();
5977 let execute = move |token: String| {
5978 let mut builder = self.clone();
5979 builder.0.request = builder.0.request.set_page_token(token);
5980 builder.send()
5981 };
5982 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5983 }
5984
5985 pub fn by_item(
5987 self,
5988 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5989 google_cloud_longrunning::model::ListOperationsResponse,
5990 crate::Error,
5991 > {
5992 use google_cloud_gax::paginator::Paginator;
5993 self.by_page().items()
5994 }
5995
5996 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5998 self.0.request.name = v.into();
5999 self
6000 }
6001
6002 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6004 self.0.request.filter = v.into();
6005 self
6006 }
6007
6008 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6010 self.0.request.page_size = v.into();
6011 self
6012 }
6013
6014 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6016 self.0.request.page_token = v.into();
6017 self
6018 }
6019
6020 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6022 self.0.request.return_partial_success = v.into();
6023 self
6024 }
6025 }
6026
6027 #[doc(hidden)]
6028 impl crate::RequestBuilder for ListOperations {
6029 fn request_options(&mut self) -> &mut crate::RequestOptions {
6030 &mut self.0.options
6031 }
6032 }
6033
6034 #[derive(Clone, Debug)]
6051 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6052
6053 impl GetOperation {
6054 pub(crate) fn new(
6055 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6056 ) -> Self {
6057 Self(RequestBuilder::new(stub))
6058 }
6059
6060 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6062 mut self,
6063 v: V,
6064 ) -> Self {
6065 self.0.request = v.into();
6066 self
6067 }
6068
6069 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6071 self.0.options = v.into();
6072 self
6073 }
6074
6075 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6077 (*self.0.stub)
6078 .get_operation(self.0.request, self.0.options)
6079 .await
6080 .map(crate::Response::into_body)
6081 }
6082
6083 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6085 self.0.request.name = v.into();
6086 self
6087 }
6088 }
6089
6090 #[doc(hidden)]
6091 impl crate::RequestBuilder for GetOperation {
6092 fn request_options(&mut self) -> &mut crate::RequestOptions {
6093 &mut self.0.options
6094 }
6095 }
6096
6097 #[derive(Clone, Debug)]
6114 pub struct DeleteOperation(
6115 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
6116 );
6117
6118 impl DeleteOperation {
6119 pub(crate) fn new(
6120 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6121 ) -> Self {
6122 Self(RequestBuilder::new(stub))
6123 }
6124
6125 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
6127 mut self,
6128 v: V,
6129 ) -> Self {
6130 self.0.request = v.into();
6131 self
6132 }
6133
6134 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6136 self.0.options = v.into();
6137 self
6138 }
6139
6140 pub async fn send(self) -> Result<()> {
6142 (*self.0.stub)
6143 .delete_operation(self.0.request, self.0.options)
6144 .await
6145 .map(crate::Response::into_body)
6146 }
6147
6148 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6150 self.0.request.name = v.into();
6151 self
6152 }
6153 }
6154
6155 #[doc(hidden)]
6156 impl crate::RequestBuilder for DeleteOperation {
6157 fn request_options(&mut self) -> &mut crate::RequestOptions {
6158 &mut self.0.options
6159 }
6160 }
6161
6162 #[derive(Clone, Debug)]
6179 pub struct CancelOperation(
6180 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6181 );
6182
6183 impl CancelOperation {
6184 pub(crate) fn new(
6185 stub: std::sync::Arc<dyn super::super::stub::dynamic::NodeGroupController>,
6186 ) -> Self {
6187 Self(RequestBuilder::new(stub))
6188 }
6189
6190 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6192 mut self,
6193 v: V,
6194 ) -> Self {
6195 self.0.request = v.into();
6196 self
6197 }
6198
6199 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6201 self.0.options = v.into();
6202 self
6203 }
6204
6205 pub async fn send(self) -> Result<()> {
6207 (*self.0.stub)
6208 .cancel_operation(self.0.request, self.0.options)
6209 .await
6210 .map(crate::Response::into_body)
6211 }
6212
6213 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6215 self.0.request.name = v.into();
6216 self
6217 }
6218 }
6219
6220 #[doc(hidden)]
6221 impl crate::RequestBuilder for CancelOperation {
6222 fn request_options(&mut self) -> &mut crate::RequestOptions {
6223 &mut self.0.options
6224 }
6225 }
6226}
6227
6228pub mod session_template_controller {
6229 use crate::Result;
6230
6231 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6245
6246 pub(crate) mod client {
6247 use super::super::super::client::SessionTemplateController;
6248 pub struct Factory;
6249 impl crate::ClientFactory for Factory {
6250 type Client = SessionTemplateController;
6251 type Credentials = gaxi::options::Credentials;
6252 async fn build(
6253 self,
6254 config: gaxi::options::ClientConfig,
6255 ) -> crate::ClientBuilderResult<Self::Client> {
6256 Self::Client::new(config).await
6257 }
6258 }
6259 }
6260
6261 #[derive(Clone, Debug)]
6263 pub(crate) struct RequestBuilder<R: std::default::Default> {
6264 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6265 request: R,
6266 options: crate::RequestOptions,
6267 }
6268
6269 impl<R> RequestBuilder<R>
6270 where
6271 R: std::default::Default,
6272 {
6273 pub(crate) fn new(
6274 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6275 ) -> Self {
6276 Self {
6277 stub,
6278 request: R::default(),
6279 options: crate::RequestOptions::default(),
6280 }
6281 }
6282 }
6283
6284 #[derive(Clone, Debug)]
6301 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
6302
6303 impl CreateSessionTemplate {
6304 pub(crate) fn new(
6305 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6306 ) -> Self {
6307 Self(RequestBuilder::new(stub))
6308 }
6309
6310 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
6312 mut self,
6313 v: V,
6314 ) -> Self {
6315 self.0.request = v.into();
6316 self
6317 }
6318
6319 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6321 self.0.options = v.into();
6322 self
6323 }
6324
6325 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6327 (*self.0.stub)
6328 .create_session_template(self.0.request, self.0.options)
6329 .await
6330 .map(crate::Response::into_body)
6331 }
6332
6333 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6337 self.0.request.parent = v.into();
6338 self
6339 }
6340
6341 pub fn set_session_template<T>(mut self, v: T) -> Self
6345 where
6346 T: std::convert::Into<crate::model::SessionTemplate>,
6347 {
6348 self.0.request.session_template = std::option::Option::Some(v.into());
6349 self
6350 }
6351
6352 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6356 where
6357 T: std::convert::Into<crate::model::SessionTemplate>,
6358 {
6359 self.0.request.session_template = v.map(|x| x.into());
6360 self
6361 }
6362 }
6363
6364 #[doc(hidden)]
6365 impl crate::RequestBuilder for CreateSessionTemplate {
6366 fn request_options(&mut self) -> &mut crate::RequestOptions {
6367 &mut self.0.options
6368 }
6369 }
6370
6371 #[derive(Clone, Debug)]
6388 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
6389
6390 impl UpdateSessionTemplate {
6391 pub(crate) fn new(
6392 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6393 ) -> Self {
6394 Self(RequestBuilder::new(stub))
6395 }
6396
6397 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
6399 mut self,
6400 v: V,
6401 ) -> Self {
6402 self.0.request = v.into();
6403 self
6404 }
6405
6406 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6408 self.0.options = v.into();
6409 self
6410 }
6411
6412 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6414 (*self.0.stub)
6415 .update_session_template(self.0.request, self.0.options)
6416 .await
6417 .map(crate::Response::into_body)
6418 }
6419
6420 pub fn set_session_template<T>(mut self, v: T) -> Self
6424 where
6425 T: std::convert::Into<crate::model::SessionTemplate>,
6426 {
6427 self.0.request.session_template = std::option::Option::Some(v.into());
6428 self
6429 }
6430
6431 pub fn set_or_clear_session_template<T>(mut self, v: std::option::Option<T>) -> Self
6435 where
6436 T: std::convert::Into<crate::model::SessionTemplate>,
6437 {
6438 self.0.request.session_template = v.map(|x| x.into());
6439 self
6440 }
6441 }
6442
6443 #[doc(hidden)]
6444 impl crate::RequestBuilder for UpdateSessionTemplate {
6445 fn request_options(&mut self) -> &mut crate::RequestOptions {
6446 &mut self.0.options
6447 }
6448 }
6449
6450 #[derive(Clone, Debug)]
6467 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
6468
6469 impl GetSessionTemplate {
6470 pub(crate) fn new(
6471 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6472 ) -> Self {
6473 Self(RequestBuilder::new(stub))
6474 }
6475
6476 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
6478 mut self,
6479 v: V,
6480 ) -> Self {
6481 self.0.request = v.into();
6482 self
6483 }
6484
6485 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6487 self.0.options = v.into();
6488 self
6489 }
6490
6491 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
6493 (*self.0.stub)
6494 .get_session_template(self.0.request, self.0.options)
6495 .await
6496 .map(crate::Response::into_body)
6497 }
6498
6499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6503 self.0.request.name = v.into();
6504 self
6505 }
6506 }
6507
6508 #[doc(hidden)]
6509 impl crate::RequestBuilder for GetSessionTemplate {
6510 fn request_options(&mut self) -> &mut crate::RequestOptions {
6511 &mut self.0.options
6512 }
6513 }
6514
6515 #[derive(Clone, Debug)]
6536 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
6537
6538 impl ListSessionTemplates {
6539 pub(crate) fn new(
6540 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6541 ) -> Self {
6542 Self(RequestBuilder::new(stub))
6543 }
6544
6545 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
6547 mut self,
6548 v: V,
6549 ) -> Self {
6550 self.0.request = v.into();
6551 self
6552 }
6553
6554 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6556 self.0.options = v.into();
6557 self
6558 }
6559
6560 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
6562 (*self.0.stub)
6563 .list_session_templates(self.0.request, self.0.options)
6564 .await
6565 .map(crate::Response::into_body)
6566 }
6567
6568 pub fn by_page(
6570 self,
6571 ) -> impl google_cloud_gax::paginator::Paginator<
6572 crate::model::ListSessionTemplatesResponse,
6573 crate::Error,
6574 > {
6575 use std::clone::Clone;
6576 let token = self.0.request.page_token.clone();
6577 let execute = move |token: String| {
6578 let mut builder = self.clone();
6579 builder.0.request = builder.0.request.set_page_token(token);
6580 builder.send()
6581 };
6582 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6583 }
6584
6585 pub fn by_item(
6587 self,
6588 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6589 crate::model::ListSessionTemplatesResponse,
6590 crate::Error,
6591 > {
6592 use google_cloud_gax::paginator::Paginator;
6593 self.by_page().items()
6594 }
6595
6596 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6600 self.0.request.parent = v.into();
6601 self
6602 }
6603
6604 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6606 self.0.request.page_size = v.into();
6607 self
6608 }
6609
6610 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6612 self.0.request.page_token = v.into();
6613 self
6614 }
6615
6616 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6618 self.0.request.filter = v.into();
6619 self
6620 }
6621 }
6622
6623 #[doc(hidden)]
6624 impl crate::RequestBuilder for ListSessionTemplates {
6625 fn request_options(&mut self) -> &mut crate::RequestOptions {
6626 &mut self.0.options
6627 }
6628 }
6629
6630 #[derive(Clone, Debug)]
6647 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
6648
6649 impl DeleteSessionTemplate {
6650 pub(crate) fn new(
6651 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6652 ) -> Self {
6653 Self(RequestBuilder::new(stub))
6654 }
6655
6656 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
6658 mut self,
6659 v: V,
6660 ) -> Self {
6661 self.0.request = v.into();
6662 self
6663 }
6664
6665 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6667 self.0.options = v.into();
6668 self
6669 }
6670
6671 pub async fn send(self) -> Result<()> {
6673 (*self.0.stub)
6674 .delete_session_template(self.0.request, self.0.options)
6675 .await
6676 .map(crate::Response::into_body)
6677 }
6678
6679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6683 self.0.request.name = v.into();
6684 self
6685 }
6686 }
6687
6688 #[doc(hidden)]
6689 impl crate::RequestBuilder for DeleteSessionTemplate {
6690 fn request_options(&mut self) -> &mut crate::RequestOptions {
6691 &mut self.0.options
6692 }
6693 }
6694
6695 #[derive(Clone, Debug)]
6712 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
6713
6714 impl SetIamPolicy {
6715 pub(crate) fn new(
6716 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6717 ) -> Self {
6718 Self(RequestBuilder::new(stub))
6719 }
6720
6721 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
6723 mut self,
6724 v: V,
6725 ) -> Self {
6726 self.0.request = v.into();
6727 self
6728 }
6729
6730 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6732 self.0.options = v.into();
6733 self
6734 }
6735
6736 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6738 (*self.0.stub)
6739 .set_iam_policy(self.0.request, self.0.options)
6740 .await
6741 .map(crate::Response::into_body)
6742 }
6743
6744 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6748 self.0.request.resource = v.into();
6749 self
6750 }
6751
6752 pub fn set_policy<T>(mut self, v: T) -> Self
6756 where
6757 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
6758 {
6759 self.0.request.policy = std::option::Option::Some(v.into());
6760 self
6761 }
6762
6763 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
6767 where
6768 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
6769 {
6770 self.0.request.policy = v.map(|x| x.into());
6771 self
6772 }
6773
6774 pub fn set_update_mask<T>(mut self, v: T) -> Self
6776 where
6777 T: std::convert::Into<wkt::FieldMask>,
6778 {
6779 self.0.request.update_mask = std::option::Option::Some(v.into());
6780 self
6781 }
6782
6783 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6785 where
6786 T: std::convert::Into<wkt::FieldMask>,
6787 {
6788 self.0.request.update_mask = v.map(|x| x.into());
6789 self
6790 }
6791 }
6792
6793 #[doc(hidden)]
6794 impl crate::RequestBuilder for SetIamPolicy {
6795 fn request_options(&mut self) -> &mut crate::RequestOptions {
6796 &mut self.0.options
6797 }
6798 }
6799
6800 #[derive(Clone, Debug)]
6817 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
6818
6819 impl GetIamPolicy {
6820 pub(crate) fn new(
6821 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6822 ) -> Self {
6823 Self(RequestBuilder::new(stub))
6824 }
6825
6826 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
6828 mut self,
6829 v: V,
6830 ) -> Self {
6831 self.0.request = v.into();
6832 self
6833 }
6834
6835 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6837 self.0.options = v.into();
6838 self
6839 }
6840
6841 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
6843 (*self.0.stub)
6844 .get_iam_policy(self.0.request, self.0.options)
6845 .await
6846 .map(crate::Response::into_body)
6847 }
6848
6849 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6853 self.0.request.resource = v.into();
6854 self
6855 }
6856
6857 pub fn set_options<T>(mut self, v: T) -> Self
6859 where
6860 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6861 {
6862 self.0.request.options = std::option::Option::Some(v.into());
6863 self
6864 }
6865
6866 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
6868 where
6869 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
6870 {
6871 self.0.request.options = v.map(|x| x.into());
6872 self
6873 }
6874 }
6875
6876 #[doc(hidden)]
6877 impl crate::RequestBuilder for GetIamPolicy {
6878 fn request_options(&mut self) -> &mut crate::RequestOptions {
6879 &mut self.0.options
6880 }
6881 }
6882
6883 #[derive(Clone, Debug)]
6900 pub struct TestIamPermissions(
6901 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
6902 );
6903
6904 impl TestIamPermissions {
6905 pub(crate) fn new(
6906 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6907 ) -> Self {
6908 Self(RequestBuilder::new(stub))
6909 }
6910
6911 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
6913 mut self,
6914 v: V,
6915 ) -> Self {
6916 self.0.request = v.into();
6917 self
6918 }
6919
6920 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6922 self.0.options = v.into();
6923 self
6924 }
6925
6926 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
6928 (*self.0.stub)
6929 .test_iam_permissions(self.0.request, self.0.options)
6930 .await
6931 .map(crate::Response::into_body)
6932 }
6933
6934 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6938 self.0.request.resource = v.into();
6939 self
6940 }
6941
6942 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6946 where
6947 T: std::iter::IntoIterator<Item = V>,
6948 V: std::convert::Into<std::string::String>,
6949 {
6950 use std::iter::Iterator;
6951 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6952 self
6953 }
6954 }
6955
6956 #[doc(hidden)]
6957 impl crate::RequestBuilder for TestIamPermissions {
6958 fn request_options(&mut self) -> &mut crate::RequestOptions {
6959 &mut self.0.options
6960 }
6961 }
6962
6963 #[derive(Clone, Debug)]
6984 pub struct ListOperations(
6985 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6986 );
6987
6988 impl ListOperations {
6989 pub(crate) fn new(
6990 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
6991 ) -> Self {
6992 Self(RequestBuilder::new(stub))
6993 }
6994
6995 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6997 mut self,
6998 v: V,
6999 ) -> Self {
7000 self.0.request = v.into();
7001 self
7002 }
7003
7004 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7006 self.0.options = v.into();
7007 self
7008 }
7009
7010 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7012 (*self.0.stub)
7013 .list_operations(self.0.request, self.0.options)
7014 .await
7015 .map(crate::Response::into_body)
7016 }
7017
7018 pub fn by_page(
7020 self,
7021 ) -> impl google_cloud_gax::paginator::Paginator<
7022 google_cloud_longrunning::model::ListOperationsResponse,
7023 crate::Error,
7024 > {
7025 use std::clone::Clone;
7026 let token = self.0.request.page_token.clone();
7027 let execute = move |token: String| {
7028 let mut builder = self.clone();
7029 builder.0.request = builder.0.request.set_page_token(token);
7030 builder.send()
7031 };
7032 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7033 }
7034
7035 pub fn by_item(
7037 self,
7038 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7039 google_cloud_longrunning::model::ListOperationsResponse,
7040 crate::Error,
7041 > {
7042 use google_cloud_gax::paginator::Paginator;
7043 self.by_page().items()
7044 }
7045
7046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7048 self.0.request.name = v.into();
7049 self
7050 }
7051
7052 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7054 self.0.request.filter = v.into();
7055 self
7056 }
7057
7058 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7060 self.0.request.page_size = v.into();
7061 self
7062 }
7063
7064 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7066 self.0.request.page_token = v.into();
7067 self
7068 }
7069
7070 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7072 self.0.request.return_partial_success = v.into();
7073 self
7074 }
7075 }
7076
7077 #[doc(hidden)]
7078 impl crate::RequestBuilder for ListOperations {
7079 fn request_options(&mut self) -> &mut crate::RequestOptions {
7080 &mut self.0.options
7081 }
7082 }
7083
7084 #[derive(Clone, Debug)]
7101 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7102
7103 impl GetOperation {
7104 pub(crate) fn new(
7105 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7106 ) -> Self {
7107 Self(RequestBuilder::new(stub))
7108 }
7109
7110 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7112 mut self,
7113 v: V,
7114 ) -> Self {
7115 self.0.request = v.into();
7116 self
7117 }
7118
7119 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7121 self.0.options = v.into();
7122 self
7123 }
7124
7125 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7127 (*self.0.stub)
7128 .get_operation(self.0.request, self.0.options)
7129 .await
7130 .map(crate::Response::into_body)
7131 }
7132
7133 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7135 self.0.request.name = v.into();
7136 self
7137 }
7138 }
7139
7140 #[doc(hidden)]
7141 impl crate::RequestBuilder for GetOperation {
7142 fn request_options(&mut self) -> &mut crate::RequestOptions {
7143 &mut self.0.options
7144 }
7145 }
7146
7147 #[derive(Clone, Debug)]
7164 pub struct DeleteOperation(
7165 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
7166 );
7167
7168 impl DeleteOperation {
7169 pub(crate) fn new(
7170 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7171 ) -> Self {
7172 Self(RequestBuilder::new(stub))
7173 }
7174
7175 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
7177 mut self,
7178 v: V,
7179 ) -> Self {
7180 self.0.request = v.into();
7181 self
7182 }
7183
7184 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7186 self.0.options = v.into();
7187 self
7188 }
7189
7190 pub async fn send(self) -> Result<()> {
7192 (*self.0.stub)
7193 .delete_operation(self.0.request, self.0.options)
7194 .await
7195 .map(crate::Response::into_body)
7196 }
7197
7198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7200 self.0.request.name = v.into();
7201 self
7202 }
7203 }
7204
7205 #[doc(hidden)]
7206 impl crate::RequestBuilder for DeleteOperation {
7207 fn request_options(&mut self) -> &mut crate::RequestOptions {
7208 &mut self.0.options
7209 }
7210 }
7211
7212 #[derive(Clone, Debug)]
7229 pub struct CancelOperation(
7230 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7231 );
7232
7233 impl CancelOperation {
7234 pub(crate) fn new(
7235 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
7236 ) -> Self {
7237 Self(RequestBuilder::new(stub))
7238 }
7239
7240 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7242 mut self,
7243 v: V,
7244 ) -> Self {
7245 self.0.request = v.into();
7246 self
7247 }
7248
7249 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7251 self.0.options = v.into();
7252 self
7253 }
7254
7255 pub async fn send(self) -> Result<()> {
7257 (*self.0.stub)
7258 .cancel_operation(self.0.request, self.0.options)
7259 .await
7260 .map(crate::Response::into_body)
7261 }
7262
7263 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7265 self.0.request.name = v.into();
7266 self
7267 }
7268 }
7269
7270 #[doc(hidden)]
7271 impl crate::RequestBuilder for CancelOperation {
7272 fn request_options(&mut self) -> &mut crate::RequestOptions {
7273 &mut self.0.options
7274 }
7275 }
7276}
7277
7278pub mod session_controller {
7279 use crate::Result;
7280
7281 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7295
7296 pub(crate) mod client {
7297 use super::super::super::client::SessionController;
7298 pub struct Factory;
7299 impl crate::ClientFactory for Factory {
7300 type Client = SessionController;
7301 type Credentials = gaxi::options::Credentials;
7302 async fn build(
7303 self,
7304 config: gaxi::options::ClientConfig,
7305 ) -> crate::ClientBuilderResult<Self::Client> {
7306 Self::Client::new(config).await
7307 }
7308 }
7309 }
7310
7311 #[derive(Clone, Debug)]
7313 pub(crate) struct RequestBuilder<R: std::default::Default> {
7314 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7315 request: R,
7316 options: crate::RequestOptions,
7317 }
7318
7319 impl<R> RequestBuilder<R>
7320 where
7321 R: std::default::Default,
7322 {
7323 pub(crate) fn new(
7324 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7325 ) -> Self {
7326 Self {
7327 stub,
7328 request: R::default(),
7329 options: crate::RequestOptions::default(),
7330 }
7331 }
7332 }
7333
7334 #[derive(Clone, Debug)]
7352 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
7353
7354 impl CreateSession {
7355 pub(crate) fn new(
7356 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7357 ) -> Self {
7358 Self(RequestBuilder::new(stub))
7359 }
7360
7361 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
7363 self.0.request = v.into();
7364 self
7365 }
7366
7367 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7369 self.0.options = v.into();
7370 self
7371 }
7372
7373 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7380 (*self.0.stub)
7381 .create_session(self.0.request, self.0.options)
7382 .await
7383 .map(crate::Response::into_body)
7384 }
7385
7386 pub fn poller(
7388 self,
7389 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7390 {
7391 type Operation = google_cloud_lro::internal::Operation<
7392 crate::model::Session,
7393 crate::model::SessionOperationMetadata,
7394 >;
7395 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7396 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7397
7398 let stub = self.0.stub.clone();
7399 let mut options = self.0.options.clone();
7400 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7401 let query = move |name| {
7402 let stub = stub.clone();
7403 let options = options.clone();
7404 async {
7405 let op = GetOperation::new(stub)
7406 .set_name(name)
7407 .with_options(options)
7408 .send()
7409 .await?;
7410 Ok(Operation::new(op))
7411 }
7412 };
7413
7414 let start = move || async {
7415 let op = self.send().await?;
7416 Ok(Operation::new(op))
7417 };
7418
7419 google_cloud_lro::internal::new_poller(
7420 polling_error_policy,
7421 polling_backoff_policy,
7422 start,
7423 query,
7424 )
7425 }
7426
7427 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7431 self.0.request.parent = v.into();
7432 self
7433 }
7434
7435 pub fn set_session<T>(mut self, v: T) -> Self
7439 where
7440 T: std::convert::Into<crate::model::Session>,
7441 {
7442 self.0.request.session = std::option::Option::Some(v.into());
7443 self
7444 }
7445
7446 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
7450 where
7451 T: std::convert::Into<crate::model::Session>,
7452 {
7453 self.0.request.session = v.map(|x| x.into());
7454 self
7455 }
7456
7457 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7461 self.0.request.session_id = v.into();
7462 self
7463 }
7464
7465 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7467 self.0.request.request_id = v.into();
7468 self
7469 }
7470 }
7471
7472 #[doc(hidden)]
7473 impl crate::RequestBuilder for CreateSession {
7474 fn request_options(&mut self) -> &mut crate::RequestOptions {
7475 &mut self.0.options
7476 }
7477 }
7478
7479 #[derive(Clone, Debug)]
7496 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
7497
7498 impl GetSession {
7499 pub(crate) fn new(
7500 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7501 ) -> Self {
7502 Self(RequestBuilder::new(stub))
7503 }
7504
7505 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
7507 self.0.request = v.into();
7508 self
7509 }
7510
7511 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7513 self.0.options = v.into();
7514 self
7515 }
7516
7517 pub async fn send(self) -> Result<crate::model::Session> {
7519 (*self.0.stub)
7520 .get_session(self.0.request, self.0.options)
7521 .await
7522 .map(crate::Response::into_body)
7523 }
7524
7525 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7529 self.0.request.name = v.into();
7530 self
7531 }
7532 }
7533
7534 #[doc(hidden)]
7535 impl crate::RequestBuilder for GetSession {
7536 fn request_options(&mut self) -> &mut crate::RequestOptions {
7537 &mut self.0.options
7538 }
7539 }
7540
7541 #[derive(Clone, Debug)]
7562 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
7563
7564 impl ListSessions {
7565 pub(crate) fn new(
7566 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7567 ) -> Self {
7568 Self(RequestBuilder::new(stub))
7569 }
7570
7571 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
7573 self.0.request = v.into();
7574 self
7575 }
7576
7577 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7579 self.0.options = v.into();
7580 self
7581 }
7582
7583 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
7585 (*self.0.stub)
7586 .list_sessions(self.0.request, self.0.options)
7587 .await
7588 .map(crate::Response::into_body)
7589 }
7590
7591 pub fn by_page(
7593 self,
7594 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
7595 {
7596 use std::clone::Clone;
7597 let token = self.0.request.page_token.clone();
7598 let execute = move |token: String| {
7599 let mut builder = self.clone();
7600 builder.0.request = builder.0.request.set_page_token(token);
7601 builder.send()
7602 };
7603 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7604 }
7605
7606 pub fn by_item(
7608 self,
7609 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7610 crate::model::ListSessionsResponse,
7611 crate::Error,
7612 > {
7613 use google_cloud_gax::paginator::Paginator;
7614 self.by_page().items()
7615 }
7616
7617 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7621 self.0.request.parent = v.into();
7622 self
7623 }
7624
7625 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7627 self.0.request.page_size = v.into();
7628 self
7629 }
7630
7631 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7633 self.0.request.page_token = v.into();
7634 self
7635 }
7636
7637 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7639 self.0.request.filter = v.into();
7640 self
7641 }
7642 }
7643
7644 #[doc(hidden)]
7645 impl crate::RequestBuilder for ListSessions {
7646 fn request_options(&mut self) -> &mut crate::RequestOptions {
7647 &mut self.0.options
7648 }
7649 }
7650
7651 #[derive(Clone, Debug)]
7669 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
7670
7671 impl TerminateSession {
7672 pub(crate) fn new(
7673 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7674 ) -> Self {
7675 Self(RequestBuilder::new(stub))
7676 }
7677
7678 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
7680 mut self,
7681 v: V,
7682 ) -> Self {
7683 self.0.request = v.into();
7684 self
7685 }
7686
7687 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7689 self.0.options = v.into();
7690 self
7691 }
7692
7693 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7700 (*self.0.stub)
7701 .terminate_session(self.0.request, self.0.options)
7702 .await
7703 .map(crate::Response::into_body)
7704 }
7705
7706 pub fn poller(
7708 self,
7709 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7710 {
7711 type Operation = google_cloud_lro::internal::Operation<
7712 crate::model::Session,
7713 crate::model::SessionOperationMetadata,
7714 >;
7715 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7716 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7717
7718 let stub = self.0.stub.clone();
7719 let mut options = self.0.options.clone();
7720 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7721 let query = move |name| {
7722 let stub = stub.clone();
7723 let options = options.clone();
7724 async {
7725 let op = GetOperation::new(stub)
7726 .set_name(name)
7727 .with_options(options)
7728 .send()
7729 .await?;
7730 Ok(Operation::new(op))
7731 }
7732 };
7733
7734 let start = move || async {
7735 let op = self.send().await?;
7736 Ok(Operation::new(op))
7737 };
7738
7739 google_cloud_lro::internal::new_poller(
7740 polling_error_policy,
7741 polling_backoff_policy,
7742 start,
7743 query,
7744 )
7745 }
7746
7747 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7751 self.0.request.name = v.into();
7752 self
7753 }
7754
7755 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7757 self.0.request.request_id = v.into();
7758 self
7759 }
7760 }
7761
7762 #[doc(hidden)]
7763 impl crate::RequestBuilder for TerminateSession {
7764 fn request_options(&mut self) -> &mut crate::RequestOptions {
7765 &mut self.0.options
7766 }
7767 }
7768
7769 #[derive(Clone, Debug)]
7787 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
7788
7789 impl DeleteSession {
7790 pub(crate) fn new(
7791 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7792 ) -> Self {
7793 Self(RequestBuilder::new(stub))
7794 }
7795
7796 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
7798 self.0.request = v.into();
7799 self
7800 }
7801
7802 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7804 self.0.options = v.into();
7805 self
7806 }
7807
7808 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7815 (*self.0.stub)
7816 .delete_session(self.0.request, self.0.options)
7817 .await
7818 .map(crate::Response::into_body)
7819 }
7820
7821 pub fn poller(
7823 self,
7824 ) -> impl google_cloud_lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
7825 {
7826 type Operation = google_cloud_lro::internal::Operation<
7827 crate::model::Session,
7828 crate::model::SessionOperationMetadata,
7829 >;
7830 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7831 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7832
7833 let stub = self.0.stub.clone();
7834 let mut options = self.0.options.clone();
7835 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7836 let query = move |name| {
7837 let stub = stub.clone();
7838 let options = options.clone();
7839 async {
7840 let op = GetOperation::new(stub)
7841 .set_name(name)
7842 .with_options(options)
7843 .send()
7844 .await?;
7845 Ok(Operation::new(op))
7846 }
7847 };
7848
7849 let start = move || async {
7850 let op = self.send().await?;
7851 Ok(Operation::new(op))
7852 };
7853
7854 google_cloud_lro::internal::new_poller(
7855 polling_error_policy,
7856 polling_backoff_policy,
7857 start,
7858 query,
7859 )
7860 }
7861
7862 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7866 self.0.request.name = v.into();
7867 self
7868 }
7869
7870 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7872 self.0.request.request_id = v.into();
7873 self
7874 }
7875 }
7876
7877 #[doc(hidden)]
7878 impl crate::RequestBuilder for DeleteSession {
7879 fn request_options(&mut self) -> &mut crate::RequestOptions {
7880 &mut self.0.options
7881 }
7882 }
7883
7884 #[derive(Clone, Debug)]
7901 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
7902
7903 impl SetIamPolicy {
7904 pub(crate) fn new(
7905 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
7906 ) -> Self {
7907 Self(RequestBuilder::new(stub))
7908 }
7909
7910 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
7912 mut self,
7913 v: V,
7914 ) -> Self {
7915 self.0.request = v.into();
7916 self
7917 }
7918
7919 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7921 self.0.options = v.into();
7922 self
7923 }
7924
7925 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
7927 (*self.0.stub)
7928 .set_iam_policy(self.0.request, self.0.options)
7929 .await
7930 .map(crate::Response::into_body)
7931 }
7932
7933 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7937 self.0.request.resource = v.into();
7938 self
7939 }
7940
7941 pub fn set_policy<T>(mut self, v: T) -> Self
7945 where
7946 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7947 {
7948 self.0.request.policy = std::option::Option::Some(v.into());
7949 self
7950 }
7951
7952 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7956 where
7957 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
7958 {
7959 self.0.request.policy = v.map(|x| x.into());
7960 self
7961 }
7962
7963 pub fn set_update_mask<T>(mut self, v: T) -> Self
7965 where
7966 T: std::convert::Into<wkt::FieldMask>,
7967 {
7968 self.0.request.update_mask = std::option::Option::Some(v.into());
7969 self
7970 }
7971
7972 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7974 where
7975 T: std::convert::Into<wkt::FieldMask>,
7976 {
7977 self.0.request.update_mask = v.map(|x| x.into());
7978 self
7979 }
7980 }
7981
7982 #[doc(hidden)]
7983 impl crate::RequestBuilder for SetIamPolicy {
7984 fn request_options(&mut self) -> &mut crate::RequestOptions {
7985 &mut self.0.options
7986 }
7987 }
7988
7989 #[derive(Clone, Debug)]
8006 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
8007
8008 impl GetIamPolicy {
8009 pub(crate) fn new(
8010 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8011 ) -> Self {
8012 Self(RequestBuilder::new(stub))
8013 }
8014
8015 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
8017 mut self,
8018 v: V,
8019 ) -> Self {
8020 self.0.request = v.into();
8021 self
8022 }
8023
8024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8026 self.0.options = v.into();
8027 self
8028 }
8029
8030 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
8032 (*self.0.stub)
8033 .get_iam_policy(self.0.request, self.0.options)
8034 .await
8035 .map(crate::Response::into_body)
8036 }
8037
8038 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8042 self.0.request.resource = v.into();
8043 self
8044 }
8045
8046 pub fn set_options<T>(mut self, v: T) -> Self
8048 where
8049 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8050 {
8051 self.0.request.options = std::option::Option::Some(v.into());
8052 self
8053 }
8054
8055 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
8057 where
8058 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
8059 {
8060 self.0.request.options = v.map(|x| x.into());
8061 self
8062 }
8063 }
8064
8065 #[doc(hidden)]
8066 impl crate::RequestBuilder for GetIamPolicy {
8067 fn request_options(&mut self) -> &mut crate::RequestOptions {
8068 &mut self.0.options
8069 }
8070 }
8071
8072 #[derive(Clone, Debug)]
8089 pub struct TestIamPermissions(
8090 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
8091 );
8092
8093 impl TestIamPermissions {
8094 pub(crate) fn new(
8095 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8096 ) -> Self {
8097 Self(RequestBuilder::new(stub))
8098 }
8099
8100 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
8102 mut self,
8103 v: V,
8104 ) -> Self {
8105 self.0.request = v.into();
8106 self
8107 }
8108
8109 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8111 self.0.options = v.into();
8112 self
8113 }
8114
8115 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
8117 (*self.0.stub)
8118 .test_iam_permissions(self.0.request, self.0.options)
8119 .await
8120 .map(crate::Response::into_body)
8121 }
8122
8123 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
8127 self.0.request.resource = v.into();
8128 self
8129 }
8130
8131 pub fn set_permissions<T, V>(mut self, v: T) -> Self
8135 where
8136 T: std::iter::IntoIterator<Item = V>,
8137 V: std::convert::Into<std::string::String>,
8138 {
8139 use std::iter::Iterator;
8140 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
8141 self
8142 }
8143 }
8144
8145 #[doc(hidden)]
8146 impl crate::RequestBuilder for TestIamPermissions {
8147 fn request_options(&mut self) -> &mut crate::RequestOptions {
8148 &mut self.0.options
8149 }
8150 }
8151
8152 #[derive(Clone, Debug)]
8173 pub struct ListOperations(
8174 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8175 );
8176
8177 impl ListOperations {
8178 pub(crate) fn new(
8179 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8180 ) -> Self {
8181 Self(RequestBuilder::new(stub))
8182 }
8183
8184 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8186 mut self,
8187 v: V,
8188 ) -> Self {
8189 self.0.request = v.into();
8190 self
8191 }
8192
8193 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8195 self.0.options = v.into();
8196 self
8197 }
8198
8199 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8201 (*self.0.stub)
8202 .list_operations(self.0.request, self.0.options)
8203 .await
8204 .map(crate::Response::into_body)
8205 }
8206
8207 pub fn by_page(
8209 self,
8210 ) -> impl google_cloud_gax::paginator::Paginator<
8211 google_cloud_longrunning::model::ListOperationsResponse,
8212 crate::Error,
8213 > {
8214 use std::clone::Clone;
8215 let token = self.0.request.page_token.clone();
8216 let execute = move |token: String| {
8217 let mut builder = self.clone();
8218 builder.0.request = builder.0.request.set_page_token(token);
8219 builder.send()
8220 };
8221 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8222 }
8223
8224 pub fn by_item(
8226 self,
8227 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8228 google_cloud_longrunning::model::ListOperationsResponse,
8229 crate::Error,
8230 > {
8231 use google_cloud_gax::paginator::Paginator;
8232 self.by_page().items()
8233 }
8234
8235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8237 self.0.request.name = v.into();
8238 self
8239 }
8240
8241 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8243 self.0.request.filter = v.into();
8244 self
8245 }
8246
8247 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8249 self.0.request.page_size = v.into();
8250 self
8251 }
8252
8253 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8255 self.0.request.page_token = v.into();
8256 self
8257 }
8258
8259 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8261 self.0.request.return_partial_success = v.into();
8262 self
8263 }
8264 }
8265
8266 #[doc(hidden)]
8267 impl crate::RequestBuilder for ListOperations {
8268 fn request_options(&mut self) -> &mut crate::RequestOptions {
8269 &mut self.0.options
8270 }
8271 }
8272
8273 #[derive(Clone, Debug)]
8290 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8291
8292 impl GetOperation {
8293 pub(crate) fn new(
8294 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8295 ) -> Self {
8296 Self(RequestBuilder::new(stub))
8297 }
8298
8299 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8301 mut self,
8302 v: V,
8303 ) -> Self {
8304 self.0.request = v.into();
8305 self
8306 }
8307
8308 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8310 self.0.options = v.into();
8311 self
8312 }
8313
8314 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8316 (*self.0.stub)
8317 .get_operation(self.0.request, self.0.options)
8318 .await
8319 .map(crate::Response::into_body)
8320 }
8321
8322 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8324 self.0.request.name = v.into();
8325 self
8326 }
8327 }
8328
8329 #[doc(hidden)]
8330 impl crate::RequestBuilder for GetOperation {
8331 fn request_options(&mut self) -> &mut crate::RequestOptions {
8332 &mut self.0.options
8333 }
8334 }
8335
8336 #[derive(Clone, Debug)]
8353 pub struct DeleteOperation(
8354 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
8355 );
8356
8357 impl DeleteOperation {
8358 pub(crate) fn new(
8359 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8360 ) -> Self {
8361 Self(RequestBuilder::new(stub))
8362 }
8363
8364 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
8366 mut self,
8367 v: V,
8368 ) -> Self {
8369 self.0.request = v.into();
8370 self
8371 }
8372
8373 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8375 self.0.options = v.into();
8376 self
8377 }
8378
8379 pub async fn send(self) -> Result<()> {
8381 (*self.0.stub)
8382 .delete_operation(self.0.request, self.0.options)
8383 .await
8384 .map(crate::Response::into_body)
8385 }
8386
8387 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8389 self.0.request.name = v.into();
8390 self
8391 }
8392 }
8393
8394 #[doc(hidden)]
8395 impl crate::RequestBuilder for DeleteOperation {
8396 fn request_options(&mut self) -> &mut crate::RequestOptions {
8397 &mut self.0.options
8398 }
8399 }
8400
8401 #[derive(Clone, Debug)]
8418 pub struct CancelOperation(
8419 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8420 );
8421
8422 impl CancelOperation {
8423 pub(crate) fn new(
8424 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionController>,
8425 ) -> Self {
8426 Self(RequestBuilder::new(stub))
8427 }
8428
8429 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8431 mut self,
8432 v: V,
8433 ) -> Self {
8434 self.0.request = v.into();
8435 self
8436 }
8437
8438 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8440 self.0.options = v.into();
8441 self
8442 }
8443
8444 pub async fn send(self) -> Result<()> {
8446 (*self.0.stub)
8447 .cancel_operation(self.0.request, self.0.options)
8448 .await
8449 .map(crate::Response::into_body)
8450 }
8451
8452 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8454 self.0.request.name = v.into();
8455 self
8456 }
8457 }
8458
8459 #[doc(hidden)]
8460 impl crate::RequestBuilder for CancelOperation {
8461 fn request_options(&mut self) -> &mut crate::RequestOptions {
8462 &mut self.0.options
8463 }
8464 }
8465}
8466
8467pub mod workflow_template_service {
8468 use crate::Result;
8469
8470 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8484
8485 pub(crate) mod client {
8486 use super::super::super::client::WorkflowTemplateService;
8487 pub struct Factory;
8488 impl crate::ClientFactory for Factory {
8489 type Client = WorkflowTemplateService;
8490 type Credentials = gaxi::options::Credentials;
8491 async fn build(
8492 self,
8493 config: gaxi::options::ClientConfig,
8494 ) -> crate::ClientBuilderResult<Self::Client> {
8495 Self::Client::new(config).await
8496 }
8497 }
8498 }
8499
8500 #[derive(Clone, Debug)]
8502 pub(crate) struct RequestBuilder<R: std::default::Default> {
8503 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8504 request: R,
8505 options: crate::RequestOptions,
8506 }
8507
8508 impl<R> RequestBuilder<R>
8509 where
8510 R: std::default::Default,
8511 {
8512 pub(crate) fn new(
8513 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8514 ) -> Self {
8515 Self {
8516 stub,
8517 request: R::default(),
8518 options: crate::RequestOptions::default(),
8519 }
8520 }
8521 }
8522
8523 #[derive(Clone, Debug)]
8540 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
8541
8542 impl CreateWorkflowTemplate {
8543 pub(crate) fn new(
8544 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8545 ) -> Self {
8546 Self(RequestBuilder::new(stub))
8547 }
8548
8549 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
8551 mut self,
8552 v: V,
8553 ) -> Self {
8554 self.0.request = v.into();
8555 self
8556 }
8557
8558 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8560 self.0.options = v.into();
8561 self
8562 }
8563
8564 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8566 (*self.0.stub)
8567 .create_workflow_template(self.0.request, self.0.options)
8568 .await
8569 .map(crate::Response::into_body)
8570 }
8571
8572 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8576 self.0.request.parent = v.into();
8577 self
8578 }
8579
8580 pub fn set_template<T>(mut self, v: T) -> Self
8584 where
8585 T: std::convert::Into<crate::model::WorkflowTemplate>,
8586 {
8587 self.0.request.template = std::option::Option::Some(v.into());
8588 self
8589 }
8590
8591 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8595 where
8596 T: std::convert::Into<crate::model::WorkflowTemplate>,
8597 {
8598 self.0.request.template = v.map(|x| x.into());
8599 self
8600 }
8601 }
8602
8603 #[doc(hidden)]
8604 impl crate::RequestBuilder for CreateWorkflowTemplate {
8605 fn request_options(&mut self) -> &mut crate::RequestOptions {
8606 &mut self.0.options
8607 }
8608 }
8609
8610 #[derive(Clone, Debug)]
8627 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
8628
8629 impl GetWorkflowTemplate {
8630 pub(crate) fn new(
8631 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8632 ) -> Self {
8633 Self(RequestBuilder::new(stub))
8634 }
8635
8636 pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
8638 mut self,
8639 v: V,
8640 ) -> Self {
8641 self.0.request = v.into();
8642 self
8643 }
8644
8645 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8647 self.0.options = v.into();
8648 self
8649 }
8650
8651 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8653 (*self.0.stub)
8654 .get_workflow_template(self.0.request, self.0.options)
8655 .await
8656 .map(crate::Response::into_body)
8657 }
8658
8659 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8663 self.0.request.name = v.into();
8664 self
8665 }
8666
8667 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8669 self.0.request.version = v.into();
8670 self
8671 }
8672 }
8673
8674 #[doc(hidden)]
8675 impl crate::RequestBuilder for GetWorkflowTemplate {
8676 fn request_options(&mut self) -> &mut crate::RequestOptions {
8677 &mut self.0.options
8678 }
8679 }
8680
8681 #[derive(Clone, Debug)]
8699 pub struct InstantiateWorkflowTemplate(
8700 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
8701 );
8702
8703 impl InstantiateWorkflowTemplate {
8704 pub(crate) fn new(
8705 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8706 ) -> Self {
8707 Self(RequestBuilder::new(stub))
8708 }
8709
8710 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
8712 mut self,
8713 v: V,
8714 ) -> Self {
8715 self.0.request = v.into();
8716 self
8717 }
8718
8719 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8721 self.0.options = v.into();
8722 self
8723 }
8724
8725 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8732 (*self.0.stub)
8733 .instantiate_workflow_template(self.0.request, self.0.options)
8734 .await
8735 .map(crate::Response::into_body)
8736 }
8737
8738 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::WorkflowMetadata> {
8740 type Operation =
8741 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8742 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8743 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8744
8745 let stub = self.0.stub.clone();
8746 let mut options = self.0.options.clone();
8747 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8748 let query = move |name| {
8749 let stub = stub.clone();
8750 let options = options.clone();
8751 async {
8752 let op = GetOperation::new(stub)
8753 .set_name(name)
8754 .with_options(options)
8755 .send()
8756 .await?;
8757 Ok(Operation::new(op))
8758 }
8759 };
8760
8761 let start = move || async {
8762 let op = self.send().await?;
8763 Ok(Operation::new(op))
8764 };
8765
8766 google_cloud_lro::internal::new_unit_response_poller(
8767 polling_error_policy,
8768 polling_backoff_policy,
8769 start,
8770 query,
8771 )
8772 }
8773
8774 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8778 self.0.request.name = v.into();
8779 self
8780 }
8781
8782 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
8784 self.0.request.version = v.into();
8785 self
8786 }
8787
8788 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8790 self.0.request.request_id = v.into();
8791 self
8792 }
8793
8794 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
8796 where
8797 T: std::iter::IntoIterator<Item = (K, V)>,
8798 K: std::convert::Into<std::string::String>,
8799 V: std::convert::Into<std::string::String>,
8800 {
8801 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8802 self
8803 }
8804 }
8805
8806 #[doc(hidden)]
8807 impl crate::RequestBuilder for InstantiateWorkflowTemplate {
8808 fn request_options(&mut self) -> &mut crate::RequestOptions {
8809 &mut self.0.options
8810 }
8811 }
8812
8813 #[derive(Clone, Debug)]
8831 pub struct InstantiateInlineWorkflowTemplate(
8832 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
8833 );
8834
8835 impl InstantiateInlineWorkflowTemplate {
8836 pub(crate) fn new(
8837 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8838 ) -> Self {
8839 Self(RequestBuilder::new(stub))
8840 }
8841
8842 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
8844 mut self,
8845 v: V,
8846 ) -> Self {
8847 self.0.request = v.into();
8848 self
8849 }
8850
8851 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8853 self.0.options = v.into();
8854 self
8855 }
8856
8857 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8864 (*self.0.stub)
8865 .instantiate_inline_workflow_template(self.0.request, self.0.options)
8866 .await
8867 .map(crate::Response::into_body)
8868 }
8869
8870 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::WorkflowMetadata> {
8872 type Operation =
8873 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
8874 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8875 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8876
8877 let stub = self.0.stub.clone();
8878 let mut options = self.0.options.clone();
8879 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8880 let query = move |name| {
8881 let stub = stub.clone();
8882 let options = options.clone();
8883 async {
8884 let op = GetOperation::new(stub)
8885 .set_name(name)
8886 .with_options(options)
8887 .send()
8888 .await?;
8889 Ok(Operation::new(op))
8890 }
8891 };
8892
8893 let start = move || async {
8894 let op = self.send().await?;
8895 Ok(Operation::new(op))
8896 };
8897
8898 google_cloud_lro::internal::new_unit_response_poller(
8899 polling_error_policy,
8900 polling_backoff_policy,
8901 start,
8902 query,
8903 )
8904 }
8905
8906 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8910 self.0.request.parent = v.into();
8911 self
8912 }
8913
8914 pub fn set_template<T>(mut self, v: T) -> Self
8918 where
8919 T: std::convert::Into<crate::model::WorkflowTemplate>,
8920 {
8921 self.0.request.template = std::option::Option::Some(v.into());
8922 self
8923 }
8924
8925 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
8929 where
8930 T: std::convert::Into<crate::model::WorkflowTemplate>,
8931 {
8932 self.0.request.template = v.map(|x| x.into());
8933 self
8934 }
8935
8936 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8938 self.0.request.request_id = v.into();
8939 self
8940 }
8941 }
8942
8943 #[doc(hidden)]
8944 impl crate::RequestBuilder for InstantiateInlineWorkflowTemplate {
8945 fn request_options(&mut self) -> &mut crate::RequestOptions {
8946 &mut self.0.options
8947 }
8948 }
8949
8950 #[derive(Clone, Debug)]
8967 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
8968
8969 impl UpdateWorkflowTemplate {
8970 pub(crate) fn new(
8971 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
8972 ) -> Self {
8973 Self(RequestBuilder::new(stub))
8974 }
8975
8976 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
8978 mut self,
8979 v: V,
8980 ) -> Self {
8981 self.0.request = v.into();
8982 self
8983 }
8984
8985 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8987 self.0.options = v.into();
8988 self
8989 }
8990
8991 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
8993 (*self.0.stub)
8994 .update_workflow_template(self.0.request, self.0.options)
8995 .await
8996 .map(crate::Response::into_body)
8997 }
8998
8999 pub fn set_template<T>(mut self, v: T) -> Self
9003 where
9004 T: std::convert::Into<crate::model::WorkflowTemplate>,
9005 {
9006 self.0.request.template = std::option::Option::Some(v.into());
9007 self
9008 }
9009
9010 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
9014 where
9015 T: std::convert::Into<crate::model::WorkflowTemplate>,
9016 {
9017 self.0.request.template = v.map(|x| x.into());
9018 self
9019 }
9020 }
9021
9022 #[doc(hidden)]
9023 impl crate::RequestBuilder for UpdateWorkflowTemplate {
9024 fn request_options(&mut self) -> &mut crate::RequestOptions {
9025 &mut self.0.options
9026 }
9027 }
9028
9029 #[derive(Clone, Debug)]
9050 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
9051
9052 impl ListWorkflowTemplates {
9053 pub(crate) fn new(
9054 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9055 ) -> Self {
9056 Self(RequestBuilder::new(stub))
9057 }
9058
9059 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
9061 mut self,
9062 v: V,
9063 ) -> Self {
9064 self.0.request = v.into();
9065 self
9066 }
9067
9068 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9070 self.0.options = v.into();
9071 self
9072 }
9073
9074 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
9076 (*self.0.stub)
9077 .list_workflow_templates(self.0.request, self.0.options)
9078 .await
9079 .map(crate::Response::into_body)
9080 }
9081
9082 pub fn by_page(
9084 self,
9085 ) -> impl google_cloud_gax::paginator::Paginator<
9086 crate::model::ListWorkflowTemplatesResponse,
9087 crate::Error,
9088 > {
9089 use std::clone::Clone;
9090 let token = self.0.request.page_token.clone();
9091 let execute = move |token: String| {
9092 let mut builder = self.clone();
9093 builder.0.request = builder.0.request.set_page_token(token);
9094 builder.send()
9095 };
9096 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9097 }
9098
9099 pub fn by_item(
9101 self,
9102 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9103 crate::model::ListWorkflowTemplatesResponse,
9104 crate::Error,
9105 > {
9106 use google_cloud_gax::paginator::Paginator;
9107 self.by_page().items()
9108 }
9109
9110 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9114 self.0.request.parent = v.into();
9115 self
9116 }
9117
9118 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9120 self.0.request.page_size = v.into();
9121 self
9122 }
9123
9124 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9126 self.0.request.page_token = v.into();
9127 self
9128 }
9129 }
9130
9131 #[doc(hidden)]
9132 impl crate::RequestBuilder for ListWorkflowTemplates {
9133 fn request_options(&mut self) -> &mut crate::RequestOptions {
9134 &mut self.0.options
9135 }
9136 }
9137
9138 #[derive(Clone, Debug)]
9155 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
9156
9157 impl DeleteWorkflowTemplate {
9158 pub(crate) fn new(
9159 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9160 ) -> Self {
9161 Self(RequestBuilder::new(stub))
9162 }
9163
9164 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
9166 mut self,
9167 v: V,
9168 ) -> Self {
9169 self.0.request = v.into();
9170 self
9171 }
9172
9173 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9175 self.0.options = v.into();
9176 self
9177 }
9178
9179 pub async fn send(self) -> Result<()> {
9181 (*self.0.stub)
9182 .delete_workflow_template(self.0.request, self.0.options)
9183 .await
9184 .map(crate::Response::into_body)
9185 }
9186
9187 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9191 self.0.request.name = v.into();
9192 self
9193 }
9194
9195 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
9197 self.0.request.version = v.into();
9198 self
9199 }
9200 }
9201
9202 #[doc(hidden)]
9203 impl crate::RequestBuilder for DeleteWorkflowTemplate {
9204 fn request_options(&mut self) -> &mut crate::RequestOptions {
9205 &mut self.0.options
9206 }
9207 }
9208
9209 #[derive(Clone, Debug)]
9226 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
9227
9228 impl SetIamPolicy {
9229 pub(crate) fn new(
9230 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9231 ) -> Self {
9232 Self(RequestBuilder::new(stub))
9233 }
9234
9235 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
9237 mut self,
9238 v: V,
9239 ) -> Self {
9240 self.0.request = v.into();
9241 self
9242 }
9243
9244 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9246 self.0.options = v.into();
9247 self
9248 }
9249
9250 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
9252 (*self.0.stub)
9253 .set_iam_policy(self.0.request, self.0.options)
9254 .await
9255 .map(crate::Response::into_body)
9256 }
9257
9258 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9262 self.0.request.resource = v.into();
9263 self
9264 }
9265
9266 pub fn set_policy<T>(mut self, v: T) -> Self
9270 where
9271 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
9272 {
9273 self.0.request.policy = std::option::Option::Some(v.into());
9274 self
9275 }
9276
9277 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
9281 where
9282 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
9283 {
9284 self.0.request.policy = v.map(|x| x.into());
9285 self
9286 }
9287
9288 pub fn set_update_mask<T>(mut self, v: T) -> Self
9290 where
9291 T: std::convert::Into<wkt::FieldMask>,
9292 {
9293 self.0.request.update_mask = std::option::Option::Some(v.into());
9294 self
9295 }
9296
9297 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9299 where
9300 T: std::convert::Into<wkt::FieldMask>,
9301 {
9302 self.0.request.update_mask = v.map(|x| x.into());
9303 self
9304 }
9305 }
9306
9307 #[doc(hidden)]
9308 impl crate::RequestBuilder for SetIamPolicy {
9309 fn request_options(&mut self) -> &mut crate::RequestOptions {
9310 &mut self.0.options
9311 }
9312 }
9313
9314 #[derive(Clone, Debug)]
9331 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
9332
9333 impl GetIamPolicy {
9334 pub(crate) fn new(
9335 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9336 ) -> Self {
9337 Self(RequestBuilder::new(stub))
9338 }
9339
9340 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
9342 mut self,
9343 v: V,
9344 ) -> Self {
9345 self.0.request = v.into();
9346 self
9347 }
9348
9349 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9351 self.0.options = v.into();
9352 self
9353 }
9354
9355 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
9357 (*self.0.stub)
9358 .get_iam_policy(self.0.request, self.0.options)
9359 .await
9360 .map(crate::Response::into_body)
9361 }
9362
9363 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9367 self.0.request.resource = v.into();
9368 self
9369 }
9370
9371 pub fn set_options<T>(mut self, v: T) -> Self
9373 where
9374 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
9375 {
9376 self.0.request.options = std::option::Option::Some(v.into());
9377 self
9378 }
9379
9380 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
9382 where
9383 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
9384 {
9385 self.0.request.options = v.map(|x| x.into());
9386 self
9387 }
9388 }
9389
9390 #[doc(hidden)]
9391 impl crate::RequestBuilder for GetIamPolicy {
9392 fn request_options(&mut self) -> &mut crate::RequestOptions {
9393 &mut self.0.options
9394 }
9395 }
9396
9397 #[derive(Clone, Debug)]
9414 pub struct TestIamPermissions(
9415 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
9416 );
9417
9418 impl TestIamPermissions {
9419 pub(crate) fn new(
9420 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9421 ) -> Self {
9422 Self(RequestBuilder::new(stub))
9423 }
9424
9425 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
9427 mut self,
9428 v: V,
9429 ) -> Self {
9430 self.0.request = v.into();
9431 self
9432 }
9433
9434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9436 self.0.options = v.into();
9437 self
9438 }
9439
9440 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
9442 (*self.0.stub)
9443 .test_iam_permissions(self.0.request, self.0.options)
9444 .await
9445 .map(crate::Response::into_body)
9446 }
9447
9448 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
9452 self.0.request.resource = v.into();
9453 self
9454 }
9455
9456 pub fn set_permissions<T, V>(mut self, v: T) -> Self
9460 where
9461 T: std::iter::IntoIterator<Item = V>,
9462 V: std::convert::Into<std::string::String>,
9463 {
9464 use std::iter::Iterator;
9465 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
9466 self
9467 }
9468 }
9469
9470 #[doc(hidden)]
9471 impl crate::RequestBuilder for TestIamPermissions {
9472 fn request_options(&mut self) -> &mut crate::RequestOptions {
9473 &mut self.0.options
9474 }
9475 }
9476
9477 #[derive(Clone, Debug)]
9498 pub struct ListOperations(
9499 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9500 );
9501
9502 impl ListOperations {
9503 pub(crate) fn new(
9504 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9505 ) -> Self {
9506 Self(RequestBuilder::new(stub))
9507 }
9508
9509 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9511 mut self,
9512 v: V,
9513 ) -> Self {
9514 self.0.request = v.into();
9515 self
9516 }
9517
9518 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9520 self.0.options = v.into();
9521 self
9522 }
9523
9524 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9526 (*self.0.stub)
9527 .list_operations(self.0.request, self.0.options)
9528 .await
9529 .map(crate::Response::into_body)
9530 }
9531
9532 pub fn by_page(
9534 self,
9535 ) -> impl google_cloud_gax::paginator::Paginator<
9536 google_cloud_longrunning::model::ListOperationsResponse,
9537 crate::Error,
9538 > {
9539 use std::clone::Clone;
9540 let token = self.0.request.page_token.clone();
9541 let execute = move |token: String| {
9542 let mut builder = self.clone();
9543 builder.0.request = builder.0.request.set_page_token(token);
9544 builder.send()
9545 };
9546 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9547 }
9548
9549 pub fn by_item(
9551 self,
9552 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9553 google_cloud_longrunning::model::ListOperationsResponse,
9554 crate::Error,
9555 > {
9556 use google_cloud_gax::paginator::Paginator;
9557 self.by_page().items()
9558 }
9559
9560 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9562 self.0.request.name = v.into();
9563 self
9564 }
9565
9566 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9568 self.0.request.filter = v.into();
9569 self
9570 }
9571
9572 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9574 self.0.request.page_size = v.into();
9575 self
9576 }
9577
9578 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9580 self.0.request.page_token = v.into();
9581 self
9582 }
9583
9584 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9586 self.0.request.return_partial_success = v.into();
9587 self
9588 }
9589 }
9590
9591 #[doc(hidden)]
9592 impl crate::RequestBuilder for ListOperations {
9593 fn request_options(&mut self) -> &mut crate::RequestOptions {
9594 &mut self.0.options
9595 }
9596 }
9597
9598 #[derive(Clone, Debug)]
9615 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9616
9617 impl GetOperation {
9618 pub(crate) fn new(
9619 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9620 ) -> Self {
9621 Self(RequestBuilder::new(stub))
9622 }
9623
9624 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9626 mut self,
9627 v: V,
9628 ) -> Self {
9629 self.0.request = v.into();
9630 self
9631 }
9632
9633 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9635 self.0.options = v.into();
9636 self
9637 }
9638
9639 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9641 (*self.0.stub)
9642 .get_operation(self.0.request, self.0.options)
9643 .await
9644 .map(crate::Response::into_body)
9645 }
9646
9647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9649 self.0.request.name = v.into();
9650 self
9651 }
9652 }
9653
9654 #[doc(hidden)]
9655 impl crate::RequestBuilder for GetOperation {
9656 fn request_options(&mut self) -> &mut crate::RequestOptions {
9657 &mut self.0.options
9658 }
9659 }
9660
9661 #[derive(Clone, Debug)]
9678 pub struct DeleteOperation(
9679 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
9680 );
9681
9682 impl DeleteOperation {
9683 pub(crate) fn new(
9684 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9685 ) -> Self {
9686 Self(RequestBuilder::new(stub))
9687 }
9688
9689 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
9691 mut self,
9692 v: V,
9693 ) -> Self {
9694 self.0.request = v.into();
9695 self
9696 }
9697
9698 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9700 self.0.options = v.into();
9701 self
9702 }
9703
9704 pub async fn send(self) -> Result<()> {
9706 (*self.0.stub)
9707 .delete_operation(self.0.request, self.0.options)
9708 .await
9709 .map(crate::Response::into_body)
9710 }
9711
9712 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9714 self.0.request.name = v.into();
9715 self
9716 }
9717 }
9718
9719 #[doc(hidden)]
9720 impl crate::RequestBuilder for DeleteOperation {
9721 fn request_options(&mut self) -> &mut crate::RequestOptions {
9722 &mut self.0.options
9723 }
9724 }
9725
9726 #[derive(Clone, Debug)]
9743 pub struct CancelOperation(
9744 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9745 );
9746
9747 impl CancelOperation {
9748 pub(crate) fn new(
9749 stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
9750 ) -> Self {
9751 Self(RequestBuilder::new(stub))
9752 }
9753
9754 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9756 mut self,
9757 v: V,
9758 ) -> Self {
9759 self.0.request = v.into();
9760 self
9761 }
9762
9763 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9765 self.0.options = v.into();
9766 self
9767 }
9768
9769 pub async fn send(self) -> Result<()> {
9771 (*self.0.stub)
9772 .cancel_operation(self.0.request, self.0.options)
9773 .await
9774 .map(crate::Response::into_body)
9775 }
9776
9777 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9779 self.0.request.name = v.into();
9780 self
9781 }
9782 }
9783
9784 #[doc(hidden)]
9785 impl crate::RequestBuilder for CancelOperation {
9786 fn request_options(&mut self) -> &mut crate::RequestOptions {
9787 &mut self.0.options
9788 }
9789 }
9790}