1pub mod autoscaling_policy_service {
18 use crate::Result;
19 use std::sync::Arc;
20
21 pub type ClientBuilder =
35 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37 pub(crate) mod client {
38 use super::super::super::client::AutoscalingPolicyService;
39 pub struct Factory;
40 impl gax::client_builder::internal::ClientFactory for Factory {
41 type Client = AutoscalingPolicyService;
42 type Credentials = gaxi::options::Credentials;
43 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44 Self::Client::new(config).await
45 }
46 }
47 }
48
49 #[derive(Clone, Debug)]
51 pub(crate) struct RequestBuilder<R: std::default::Default> {
52 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
53 request: R,
54 options: gax::options::RequestOptions,
55 }
56
57 impl<R> RequestBuilder<R>
58 where
59 R: std::default::Default,
60 {
61 pub(crate) fn new(
62 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
63 ) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: gax::options::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
74 pub struct CreateAutoscalingPolicy(
75 RequestBuilder<crate::model::CreateAutoscalingPolicyRequest>,
76 );
77
78 impl CreateAutoscalingPolicy {
79 pub(crate) fn new(
80 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
81 ) -> Self {
82 Self(RequestBuilder::new(stub))
83 }
84
85 pub fn with_request<V: Into<crate::model::CreateAutoscalingPolicyRequest>>(
87 mut self,
88 v: V,
89 ) -> Self {
90 self.0.request = v.into();
91 self
92 }
93
94 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
96 self.0.options = v.into();
97 self
98 }
99
100 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
102 (*self.0.stub)
103 .create_autoscaling_policy(self.0.request, self.0.options)
104 .await
105 .map(gax::response::Response::into_body)
106 }
107
108 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
110 self.0.request.parent = v.into();
111 self
112 }
113
114 pub fn set_policy<T: Into<std::option::Option<crate::model::AutoscalingPolicy>>>(
116 mut self,
117 v: T,
118 ) -> Self {
119 self.0.request.policy = v.into();
120 self
121 }
122 }
123
124 #[doc(hidden)]
125 impl gax::options::internal::RequestBuilder for CreateAutoscalingPolicy {
126 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
127 &mut self.0.options
128 }
129 }
130
131 #[derive(Clone, Debug)]
133 pub struct UpdateAutoscalingPolicy(
134 RequestBuilder<crate::model::UpdateAutoscalingPolicyRequest>,
135 );
136
137 impl UpdateAutoscalingPolicy {
138 pub(crate) fn new(
139 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
140 ) -> Self {
141 Self(RequestBuilder::new(stub))
142 }
143
144 pub fn with_request<V: Into<crate::model::UpdateAutoscalingPolicyRequest>>(
146 mut self,
147 v: V,
148 ) -> Self {
149 self.0.request = v.into();
150 self
151 }
152
153 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
155 self.0.options = v.into();
156 self
157 }
158
159 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
161 (*self.0.stub)
162 .update_autoscaling_policy(self.0.request, self.0.options)
163 .await
164 .map(gax::response::Response::into_body)
165 }
166
167 pub fn set_policy<T: Into<std::option::Option<crate::model::AutoscalingPolicy>>>(
169 mut self,
170 v: T,
171 ) -> Self {
172 self.0.request.policy = v.into();
173 self
174 }
175 }
176
177 #[doc(hidden)]
178 impl gax::options::internal::RequestBuilder for UpdateAutoscalingPolicy {
179 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
180 &mut self.0.options
181 }
182 }
183
184 #[derive(Clone, Debug)]
186 pub struct GetAutoscalingPolicy(RequestBuilder<crate::model::GetAutoscalingPolicyRequest>);
187
188 impl GetAutoscalingPolicy {
189 pub(crate) fn new(
190 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
191 ) -> Self {
192 Self(RequestBuilder::new(stub))
193 }
194
195 pub fn with_request<V: Into<crate::model::GetAutoscalingPolicyRequest>>(
197 mut self,
198 v: V,
199 ) -> Self {
200 self.0.request = v.into();
201 self
202 }
203
204 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
206 self.0.options = v.into();
207 self
208 }
209
210 pub async fn send(self) -> Result<crate::model::AutoscalingPolicy> {
212 (*self.0.stub)
213 .get_autoscaling_policy(self.0.request, self.0.options)
214 .await
215 .map(gax::response::Response::into_body)
216 }
217
218 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
220 self.0.request.name = v.into();
221 self
222 }
223 }
224
225 #[doc(hidden)]
226 impl gax::options::internal::RequestBuilder for GetAutoscalingPolicy {
227 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
228 &mut self.0.options
229 }
230 }
231
232 #[derive(Clone, Debug)]
234 pub struct ListAutoscalingPolicies(
235 RequestBuilder<crate::model::ListAutoscalingPoliciesRequest>,
236 );
237
238 impl ListAutoscalingPolicies {
239 pub(crate) fn new(
240 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
241 ) -> Self {
242 Self(RequestBuilder::new(stub))
243 }
244
245 pub fn with_request<V: Into<crate::model::ListAutoscalingPoliciesRequest>>(
247 mut self,
248 v: V,
249 ) -> Self {
250 self.0.request = v.into();
251 self
252 }
253
254 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
256 self.0.options = v.into();
257 self
258 }
259
260 pub async fn send(self) -> Result<crate::model::ListAutoscalingPoliciesResponse> {
262 (*self.0.stub)
263 .list_autoscaling_policies(self.0.request, self.0.options)
264 .await
265 .map(gax::response::Response::into_body)
266 }
267
268 pub async fn paginator(
270 self,
271 ) -> impl gax::paginator::Paginator<
272 crate::model::ListAutoscalingPoliciesResponse,
273 gax::error::Error,
274 > {
275 use std::clone::Clone;
276 let token = self.0.request.page_token.clone();
277 let execute = move |token: String| {
278 let mut builder = self.clone();
279 builder.0.request = builder.0.request.set_page_token(token);
280 builder.send()
281 };
282 gax::paginator::internal::new_paginator(token, execute)
283 }
284
285 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
287 self.0.request.parent = v.into();
288 self
289 }
290
291 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
293 self.0.request.page_size = v.into();
294 self
295 }
296
297 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
299 self.0.request.page_token = v.into();
300 self
301 }
302 }
303
304 #[doc(hidden)]
305 impl gax::options::internal::RequestBuilder for ListAutoscalingPolicies {
306 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
307 &mut self.0.options
308 }
309 }
310
311 #[derive(Clone, Debug)]
313 pub struct DeleteAutoscalingPolicy(
314 RequestBuilder<crate::model::DeleteAutoscalingPolicyRequest>,
315 );
316
317 impl DeleteAutoscalingPolicy {
318 pub(crate) fn new(
319 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
320 ) -> Self {
321 Self(RequestBuilder::new(stub))
322 }
323
324 pub fn with_request<V: Into<crate::model::DeleteAutoscalingPolicyRequest>>(
326 mut self,
327 v: V,
328 ) -> Self {
329 self.0.request = v.into();
330 self
331 }
332
333 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
335 self.0.options = v.into();
336 self
337 }
338
339 pub async fn send(self) -> Result<()> {
341 (*self.0.stub)
342 .delete_autoscaling_policy(self.0.request, self.0.options)
343 .await
344 .map(gax::response::Response::into_body)
345 }
346
347 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
349 self.0.request.name = v.into();
350 self
351 }
352 }
353
354 #[doc(hidden)]
355 impl gax::options::internal::RequestBuilder for DeleteAutoscalingPolicy {
356 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
357 &mut self.0.options
358 }
359 }
360
361 #[derive(Clone, Debug)]
363 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
364
365 impl SetIamPolicy {
366 pub(crate) fn new(
367 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
368 ) -> Self {
369 Self(RequestBuilder::new(stub))
370 }
371
372 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
374 self.0.request = v.into();
375 self
376 }
377
378 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
380 self.0.options = v.into();
381 self
382 }
383
384 pub async fn send(self) -> Result<iam_v1::model::Policy> {
386 (*self.0.stub)
387 .set_iam_policy(self.0.request, self.0.options)
388 .await
389 .map(gax::response::Response::into_body)
390 }
391
392 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
394 self.0.request.resource = v.into();
395 self
396 }
397
398 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
400 mut self,
401 v: T,
402 ) -> Self {
403 self.0.request.policy = v.into();
404 self
405 }
406
407 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
409 mut self,
410 v: T,
411 ) -> Self {
412 self.0.request.update_mask = v.into();
413 self
414 }
415 }
416
417 #[doc(hidden)]
418 impl gax::options::internal::RequestBuilder for SetIamPolicy {
419 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
420 &mut self.0.options
421 }
422 }
423
424 #[derive(Clone, Debug)]
426 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
427
428 impl GetIamPolicy {
429 pub(crate) fn new(
430 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
431 ) -> Self {
432 Self(RequestBuilder::new(stub))
433 }
434
435 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
437 self.0.request = v.into();
438 self
439 }
440
441 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
443 self.0.options = v.into();
444 self
445 }
446
447 pub async fn send(self) -> Result<iam_v1::model::Policy> {
449 (*self.0.stub)
450 .get_iam_policy(self.0.request, self.0.options)
451 .await
452 .map(gax::response::Response::into_body)
453 }
454
455 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
457 self.0.request.resource = v.into();
458 self
459 }
460
461 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
463 mut self,
464 v: T,
465 ) -> Self {
466 self.0.request.options = v.into();
467 self
468 }
469 }
470
471 #[doc(hidden)]
472 impl gax::options::internal::RequestBuilder for GetIamPolicy {
473 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
474 &mut self.0.options
475 }
476 }
477
478 #[derive(Clone, Debug)]
480 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
481
482 impl TestIamPermissions {
483 pub(crate) fn new(
484 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
485 ) -> Self {
486 Self(RequestBuilder::new(stub))
487 }
488
489 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
491 mut self,
492 v: V,
493 ) -> Self {
494 self.0.request = v.into();
495 self
496 }
497
498 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
500 self.0.options = v.into();
501 self
502 }
503
504 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
506 (*self.0.stub)
507 .test_iam_permissions(self.0.request, self.0.options)
508 .await
509 .map(gax::response::Response::into_body)
510 }
511
512 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
514 self.0.request.resource = v.into();
515 self
516 }
517
518 pub fn set_permissions<T, V>(mut self, v: T) -> Self
520 where
521 T: std::iter::IntoIterator<Item = V>,
522 V: std::convert::Into<std::string::String>,
523 {
524 use std::iter::Iterator;
525 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
526 self
527 }
528 }
529
530 #[doc(hidden)]
531 impl gax::options::internal::RequestBuilder for TestIamPermissions {
532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
533 &mut self.0.options
534 }
535 }
536
537 #[derive(Clone, Debug)]
539 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
540
541 impl ListOperations {
542 pub(crate) fn new(
543 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
544 ) -> Self {
545 Self(RequestBuilder::new(stub))
546 }
547
548 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
550 mut self,
551 v: V,
552 ) -> Self {
553 self.0.request = v.into();
554 self
555 }
556
557 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
559 self.0.options = v.into();
560 self
561 }
562
563 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
565 (*self.0.stub)
566 .list_operations(self.0.request, self.0.options)
567 .await
568 .map(gax::response::Response::into_body)
569 }
570
571 pub async fn paginator(
573 self,
574 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
575 {
576 use std::clone::Clone;
577 let token = self.0.request.page_token.clone();
578 let execute = move |token: String| {
579 let mut builder = self.clone();
580 builder.0.request = builder.0.request.set_page_token(token);
581 builder.send()
582 };
583 gax::paginator::internal::new_paginator(token, execute)
584 }
585
586 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
588 self.0.request.name = v.into();
589 self
590 }
591
592 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
594 self.0.request.filter = v.into();
595 self
596 }
597
598 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
600 self.0.request.page_size = v.into();
601 self
602 }
603
604 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
606 self.0.request.page_token = v.into();
607 self
608 }
609 }
610
611 #[doc(hidden)]
612 impl gax::options::internal::RequestBuilder for ListOperations {
613 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
614 &mut self.0.options
615 }
616 }
617
618 #[derive(Clone, Debug)]
620 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
621
622 impl GetOperation {
623 pub(crate) fn new(
624 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
625 ) -> Self {
626 Self(RequestBuilder::new(stub))
627 }
628
629 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
631 mut self,
632 v: V,
633 ) -> Self {
634 self.0.request = v.into();
635 self
636 }
637
638 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
640 self.0.options = v.into();
641 self
642 }
643
644 pub async fn send(self) -> Result<longrunning::model::Operation> {
646 (*self.0.stub)
647 .get_operation(self.0.request, self.0.options)
648 .await
649 .map(gax::response::Response::into_body)
650 }
651
652 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
654 self.0.request.name = v.into();
655 self
656 }
657 }
658
659 #[doc(hidden)]
660 impl gax::options::internal::RequestBuilder for GetOperation {
661 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
662 &mut self.0.options
663 }
664 }
665
666 #[derive(Clone, Debug)]
668 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
669
670 impl DeleteOperation {
671 pub(crate) fn new(
672 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
673 ) -> Self {
674 Self(RequestBuilder::new(stub))
675 }
676
677 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
679 mut self,
680 v: V,
681 ) -> Self {
682 self.0.request = v.into();
683 self
684 }
685
686 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
688 self.0.options = v.into();
689 self
690 }
691
692 pub async fn send(self) -> Result<()> {
694 (*self.0.stub)
695 .delete_operation(self.0.request, self.0.options)
696 .await
697 .map(gax::response::Response::into_body)
698 }
699
700 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
702 self.0.request.name = v.into();
703 self
704 }
705 }
706
707 #[doc(hidden)]
708 impl gax::options::internal::RequestBuilder for DeleteOperation {
709 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
710 &mut self.0.options
711 }
712 }
713
714 #[derive(Clone, Debug)]
716 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
717
718 impl CancelOperation {
719 pub(crate) fn new(
720 stub: Arc<dyn super::super::stub::dynamic::AutoscalingPolicyService>,
721 ) -> Self {
722 Self(RequestBuilder::new(stub))
723 }
724
725 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
727 mut self,
728 v: V,
729 ) -> Self {
730 self.0.request = v.into();
731 self
732 }
733
734 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
736 self.0.options = v.into();
737 self
738 }
739
740 pub async fn send(self) -> Result<()> {
742 (*self.0.stub)
743 .cancel_operation(self.0.request, self.0.options)
744 .await
745 .map(gax::response::Response::into_body)
746 }
747
748 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
750 self.0.request.name = v.into();
751 self
752 }
753 }
754
755 #[doc(hidden)]
756 impl gax::options::internal::RequestBuilder for CancelOperation {
757 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
758 &mut self.0.options
759 }
760 }
761}
762
763pub mod batch_controller {
764 use crate::Result;
765 use std::sync::Arc;
766
767 pub type ClientBuilder =
781 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
782
783 pub(crate) mod client {
784 use super::super::super::client::BatchController;
785 pub struct Factory;
786 impl gax::client_builder::internal::ClientFactory for Factory {
787 type Client = BatchController;
788 type Credentials = gaxi::options::Credentials;
789 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
790 Self::Client::new(config).await
791 }
792 }
793 }
794
795 #[derive(Clone, Debug)]
797 pub(crate) struct RequestBuilder<R: std::default::Default> {
798 stub: Arc<dyn super::super::stub::dynamic::BatchController>,
799 request: R,
800 options: gax::options::RequestOptions,
801 }
802
803 impl<R> RequestBuilder<R>
804 where
805 R: std::default::Default,
806 {
807 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
808 Self {
809 stub,
810 request: R::default(),
811 options: gax::options::RequestOptions::default(),
812 }
813 }
814 }
815
816 #[derive(Clone, Debug)]
818 pub struct CreateBatch(RequestBuilder<crate::model::CreateBatchRequest>);
819
820 impl CreateBatch {
821 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
822 Self(RequestBuilder::new(stub))
823 }
824
825 pub fn with_request<V: Into<crate::model::CreateBatchRequest>>(mut self, v: V) -> Self {
827 self.0.request = v.into();
828 self
829 }
830
831 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
833 self.0.options = v.into();
834 self
835 }
836
837 pub async fn send(self) -> Result<longrunning::model::Operation> {
844 (*self.0.stub)
845 .create_batch(self.0.request, self.0.options)
846 .await
847 .map(gax::response::Response::into_body)
848 }
849
850 pub fn poller(
852 self,
853 ) -> impl lro::Poller<crate::model::Batch, crate::model::BatchOperationMetadata> {
854 type Operation =
855 lro::Operation<crate::model::Batch, crate::model::BatchOperationMetadata>;
856 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
857 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
858
859 let stub = self.0.stub.clone();
860 let mut options = self.0.options.clone();
861 options.set_retry_policy(gax::retry_policy::NeverRetry);
862 let query = move |name| {
863 let stub = stub.clone();
864 let options = options.clone();
865 async {
866 let op = GetOperation::new(stub)
867 .set_name(name)
868 .with_options(options)
869 .send()
870 .await?;
871 Ok(Operation::new(op))
872 }
873 };
874
875 let start = move || async {
876 let op = self.send().await?;
877 Ok(Operation::new(op))
878 };
879
880 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
881 }
882
883 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
885 self.0.request.parent = v.into();
886 self
887 }
888
889 pub fn set_batch<T: Into<std::option::Option<crate::model::Batch>>>(
891 mut self,
892 v: T,
893 ) -> Self {
894 self.0.request.batch = v.into();
895 self
896 }
897
898 pub fn set_batch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
900 self.0.request.batch_id = v.into();
901 self
902 }
903
904 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
906 self.0.request.request_id = v.into();
907 self
908 }
909 }
910
911 #[doc(hidden)]
912 impl gax::options::internal::RequestBuilder for CreateBatch {
913 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
914 &mut self.0.options
915 }
916 }
917
918 #[derive(Clone, Debug)]
920 pub struct GetBatch(RequestBuilder<crate::model::GetBatchRequest>);
921
922 impl GetBatch {
923 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
924 Self(RequestBuilder::new(stub))
925 }
926
927 pub fn with_request<V: Into<crate::model::GetBatchRequest>>(mut self, v: V) -> Self {
929 self.0.request = v.into();
930 self
931 }
932
933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
935 self.0.options = v.into();
936 self
937 }
938
939 pub async fn send(self) -> Result<crate::model::Batch> {
941 (*self.0.stub)
942 .get_batch(self.0.request, self.0.options)
943 .await
944 .map(gax::response::Response::into_body)
945 }
946
947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
949 self.0.request.name = v.into();
950 self
951 }
952 }
953
954 #[doc(hidden)]
955 impl gax::options::internal::RequestBuilder for GetBatch {
956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
957 &mut self.0.options
958 }
959 }
960
961 #[derive(Clone, Debug)]
963 pub struct ListBatches(RequestBuilder<crate::model::ListBatchesRequest>);
964
965 impl ListBatches {
966 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
967 Self(RequestBuilder::new(stub))
968 }
969
970 pub fn with_request<V: Into<crate::model::ListBatchesRequest>>(mut self, v: V) -> Self {
972 self.0.request = v.into();
973 self
974 }
975
976 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
978 self.0.options = v.into();
979 self
980 }
981
982 pub async fn send(self) -> Result<crate::model::ListBatchesResponse> {
984 (*self.0.stub)
985 .list_batches(self.0.request, self.0.options)
986 .await
987 .map(gax::response::Response::into_body)
988 }
989
990 pub async fn paginator(
992 self,
993 ) -> impl gax::paginator::Paginator<crate::model::ListBatchesResponse, gax::error::Error>
994 {
995 use std::clone::Clone;
996 let token = self.0.request.page_token.clone();
997 let execute = move |token: String| {
998 let mut builder = self.clone();
999 builder.0.request = builder.0.request.set_page_token(token);
1000 builder.send()
1001 };
1002 gax::paginator::internal::new_paginator(token, execute)
1003 }
1004
1005 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1007 self.0.request.parent = v.into();
1008 self
1009 }
1010
1011 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1013 self.0.request.page_size = v.into();
1014 self
1015 }
1016
1017 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1019 self.0.request.page_token = v.into();
1020 self
1021 }
1022
1023 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1025 self.0.request.filter = v.into();
1026 self
1027 }
1028
1029 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1031 self.0.request.order_by = v.into();
1032 self
1033 }
1034 }
1035
1036 #[doc(hidden)]
1037 impl gax::options::internal::RequestBuilder for ListBatches {
1038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1039 &mut self.0.options
1040 }
1041 }
1042
1043 #[derive(Clone, Debug)]
1045 pub struct DeleteBatch(RequestBuilder<crate::model::DeleteBatchRequest>);
1046
1047 impl DeleteBatch {
1048 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1049 Self(RequestBuilder::new(stub))
1050 }
1051
1052 pub fn with_request<V: Into<crate::model::DeleteBatchRequest>>(mut self, v: V) -> Self {
1054 self.0.request = v.into();
1055 self
1056 }
1057
1058 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1060 self.0.options = v.into();
1061 self
1062 }
1063
1064 pub async fn send(self) -> Result<()> {
1066 (*self.0.stub)
1067 .delete_batch(self.0.request, self.0.options)
1068 .await
1069 .map(gax::response::Response::into_body)
1070 }
1071
1072 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1074 self.0.request.name = v.into();
1075 self
1076 }
1077 }
1078
1079 #[doc(hidden)]
1080 impl gax::options::internal::RequestBuilder for DeleteBatch {
1081 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1082 &mut self.0.options
1083 }
1084 }
1085
1086 #[derive(Clone, Debug)]
1088 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1089
1090 impl SetIamPolicy {
1091 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1092 Self(RequestBuilder::new(stub))
1093 }
1094
1095 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1097 self.0.request = v.into();
1098 self
1099 }
1100
1101 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1103 self.0.options = v.into();
1104 self
1105 }
1106
1107 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1109 (*self.0.stub)
1110 .set_iam_policy(self.0.request, self.0.options)
1111 .await
1112 .map(gax::response::Response::into_body)
1113 }
1114
1115 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1117 self.0.request.resource = v.into();
1118 self
1119 }
1120
1121 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
1123 mut self,
1124 v: T,
1125 ) -> Self {
1126 self.0.request.policy = v.into();
1127 self
1128 }
1129
1130 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1132 mut self,
1133 v: T,
1134 ) -> Self {
1135 self.0.request.update_mask = v.into();
1136 self
1137 }
1138 }
1139
1140 #[doc(hidden)]
1141 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1142 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1143 &mut self.0.options
1144 }
1145 }
1146
1147 #[derive(Clone, Debug)]
1149 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1150
1151 impl GetIamPolicy {
1152 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1153 Self(RequestBuilder::new(stub))
1154 }
1155
1156 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1158 self.0.request = v.into();
1159 self
1160 }
1161
1162 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1164 self.0.options = v.into();
1165 self
1166 }
1167
1168 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1170 (*self.0.stub)
1171 .get_iam_policy(self.0.request, self.0.options)
1172 .await
1173 .map(gax::response::Response::into_body)
1174 }
1175
1176 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1178 self.0.request.resource = v.into();
1179 self
1180 }
1181
1182 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
1184 mut self,
1185 v: T,
1186 ) -> Self {
1187 self.0.request.options = v.into();
1188 self
1189 }
1190 }
1191
1192 #[doc(hidden)]
1193 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1194 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1195 &mut self.0.options
1196 }
1197 }
1198
1199 #[derive(Clone, Debug)]
1201 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1202
1203 impl TestIamPermissions {
1204 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1205 Self(RequestBuilder::new(stub))
1206 }
1207
1208 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1210 mut self,
1211 v: V,
1212 ) -> Self {
1213 self.0.request = v.into();
1214 self
1215 }
1216
1217 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1219 self.0.options = v.into();
1220 self
1221 }
1222
1223 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1225 (*self.0.stub)
1226 .test_iam_permissions(self.0.request, self.0.options)
1227 .await
1228 .map(gax::response::Response::into_body)
1229 }
1230
1231 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1233 self.0.request.resource = v.into();
1234 self
1235 }
1236
1237 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1239 where
1240 T: std::iter::IntoIterator<Item = V>,
1241 V: std::convert::Into<std::string::String>,
1242 {
1243 use std::iter::Iterator;
1244 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1245 self
1246 }
1247 }
1248
1249 #[doc(hidden)]
1250 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1252 &mut self.0.options
1253 }
1254 }
1255
1256 #[derive(Clone, Debug)]
1258 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1259
1260 impl ListOperations {
1261 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1262 Self(RequestBuilder::new(stub))
1263 }
1264
1265 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1267 mut self,
1268 v: V,
1269 ) -> Self {
1270 self.0.request = v.into();
1271 self
1272 }
1273
1274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1276 self.0.options = v.into();
1277 self
1278 }
1279
1280 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1282 (*self.0.stub)
1283 .list_operations(self.0.request, self.0.options)
1284 .await
1285 .map(gax::response::Response::into_body)
1286 }
1287
1288 pub async fn paginator(
1290 self,
1291 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1292 {
1293 use std::clone::Clone;
1294 let token = self.0.request.page_token.clone();
1295 let execute = move |token: String| {
1296 let mut builder = self.clone();
1297 builder.0.request = builder.0.request.set_page_token(token);
1298 builder.send()
1299 };
1300 gax::paginator::internal::new_paginator(token, execute)
1301 }
1302
1303 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1305 self.0.request.name = v.into();
1306 self
1307 }
1308
1309 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1311 self.0.request.filter = v.into();
1312 self
1313 }
1314
1315 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1317 self.0.request.page_size = v.into();
1318 self
1319 }
1320
1321 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1323 self.0.request.page_token = v.into();
1324 self
1325 }
1326 }
1327
1328 #[doc(hidden)]
1329 impl gax::options::internal::RequestBuilder for ListOperations {
1330 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1331 &mut self.0.options
1332 }
1333 }
1334
1335 #[derive(Clone, Debug)]
1337 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1338
1339 impl GetOperation {
1340 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1341 Self(RequestBuilder::new(stub))
1342 }
1343
1344 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1346 mut self,
1347 v: V,
1348 ) -> Self {
1349 self.0.request = v.into();
1350 self
1351 }
1352
1353 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1355 self.0.options = v.into();
1356 self
1357 }
1358
1359 pub async fn send(self) -> Result<longrunning::model::Operation> {
1361 (*self.0.stub)
1362 .get_operation(self.0.request, self.0.options)
1363 .await
1364 .map(gax::response::Response::into_body)
1365 }
1366
1367 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1369 self.0.request.name = v.into();
1370 self
1371 }
1372 }
1373
1374 #[doc(hidden)]
1375 impl gax::options::internal::RequestBuilder for GetOperation {
1376 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1377 &mut self.0.options
1378 }
1379 }
1380
1381 #[derive(Clone, Debug)]
1383 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1384
1385 impl DeleteOperation {
1386 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1387 Self(RequestBuilder::new(stub))
1388 }
1389
1390 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1392 mut self,
1393 v: V,
1394 ) -> Self {
1395 self.0.request = v.into();
1396 self
1397 }
1398
1399 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1401 self.0.options = v.into();
1402 self
1403 }
1404
1405 pub async fn send(self) -> Result<()> {
1407 (*self.0.stub)
1408 .delete_operation(self.0.request, self.0.options)
1409 .await
1410 .map(gax::response::Response::into_body)
1411 }
1412
1413 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1415 self.0.request.name = v.into();
1416 self
1417 }
1418 }
1419
1420 #[doc(hidden)]
1421 impl gax::options::internal::RequestBuilder for DeleteOperation {
1422 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1423 &mut self.0.options
1424 }
1425 }
1426
1427 #[derive(Clone, Debug)]
1429 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1430
1431 impl CancelOperation {
1432 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::BatchController>) -> Self {
1433 Self(RequestBuilder::new(stub))
1434 }
1435
1436 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1438 mut self,
1439 v: V,
1440 ) -> Self {
1441 self.0.request = v.into();
1442 self
1443 }
1444
1445 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1447 self.0.options = v.into();
1448 self
1449 }
1450
1451 pub async fn send(self) -> Result<()> {
1453 (*self.0.stub)
1454 .cancel_operation(self.0.request, self.0.options)
1455 .await
1456 .map(gax::response::Response::into_body)
1457 }
1458
1459 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1461 self.0.request.name = v.into();
1462 self
1463 }
1464 }
1465
1466 #[doc(hidden)]
1467 impl gax::options::internal::RequestBuilder for CancelOperation {
1468 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1469 &mut self.0.options
1470 }
1471 }
1472}
1473
1474pub mod cluster_controller {
1475 use crate::Result;
1476 use std::sync::Arc;
1477
1478 pub type ClientBuilder =
1492 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1493
1494 pub(crate) mod client {
1495 use super::super::super::client::ClusterController;
1496 pub struct Factory;
1497 impl gax::client_builder::internal::ClientFactory for Factory {
1498 type Client = ClusterController;
1499 type Credentials = gaxi::options::Credentials;
1500 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
1501 Self::Client::new(config).await
1502 }
1503 }
1504 }
1505
1506 #[derive(Clone, Debug)]
1508 pub(crate) struct RequestBuilder<R: std::default::Default> {
1509 stub: Arc<dyn super::super::stub::dynamic::ClusterController>,
1510 request: R,
1511 options: gax::options::RequestOptions,
1512 }
1513
1514 impl<R> RequestBuilder<R>
1515 where
1516 R: std::default::Default,
1517 {
1518 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1519 Self {
1520 stub,
1521 request: R::default(),
1522 options: gax::options::RequestOptions::default(),
1523 }
1524 }
1525 }
1526
1527 #[derive(Clone, Debug)]
1529 pub struct CreateCluster(RequestBuilder<crate::model::CreateClusterRequest>);
1530
1531 impl CreateCluster {
1532 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1533 Self(RequestBuilder::new(stub))
1534 }
1535
1536 pub fn with_request<V: Into<crate::model::CreateClusterRequest>>(mut self, v: V) -> Self {
1538 self.0.request = v.into();
1539 self
1540 }
1541
1542 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1544 self.0.options = v.into();
1545 self
1546 }
1547
1548 pub async fn send(self) -> Result<longrunning::model::Operation> {
1555 (*self.0.stub)
1556 .create_cluster(self.0.request, self.0.options)
1557 .await
1558 .map(gax::response::Response::into_body)
1559 }
1560
1561 pub fn poller(
1563 self,
1564 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
1565 {
1566 type Operation =
1567 lro::Operation<crate::model::Cluster, crate::model::ClusterOperationMetadata>;
1568 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1569 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1570
1571 let stub = self.0.stub.clone();
1572 let mut options = self.0.options.clone();
1573 options.set_retry_policy(gax::retry_policy::NeverRetry);
1574 let query = move |name| {
1575 let stub = stub.clone();
1576 let options = options.clone();
1577 async {
1578 let op = GetOperation::new(stub)
1579 .set_name(name)
1580 .with_options(options)
1581 .send()
1582 .await?;
1583 Ok(Operation::new(op))
1584 }
1585 };
1586
1587 let start = move || async {
1588 let op = self.send().await?;
1589 Ok(Operation::new(op))
1590 };
1591
1592 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1593 }
1594
1595 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1597 self.0.request.project_id = v.into();
1598 self
1599 }
1600
1601 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
1603 self.0.request.region = v.into();
1604 self
1605 }
1606
1607 pub fn set_cluster<T: Into<std::option::Option<crate::model::Cluster>>>(
1609 mut self,
1610 v: T,
1611 ) -> Self {
1612 self.0.request.cluster = v.into();
1613 self
1614 }
1615
1616 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1618 self.0.request.request_id = v.into();
1619 self
1620 }
1621
1622 pub fn set_action_on_failed_primary_workers<T: Into<crate::model::FailureAction>>(
1624 mut self,
1625 v: T,
1626 ) -> Self {
1627 self.0.request.action_on_failed_primary_workers = v.into();
1628 self
1629 }
1630 }
1631
1632 #[doc(hidden)]
1633 impl gax::options::internal::RequestBuilder for CreateCluster {
1634 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1635 &mut self.0.options
1636 }
1637 }
1638
1639 #[derive(Clone, Debug)]
1641 pub struct UpdateCluster(RequestBuilder<crate::model::UpdateClusterRequest>);
1642
1643 impl UpdateCluster {
1644 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1645 Self(RequestBuilder::new(stub))
1646 }
1647
1648 pub fn with_request<V: Into<crate::model::UpdateClusterRequest>>(mut self, v: V) -> Self {
1650 self.0.request = v.into();
1651 self
1652 }
1653
1654 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1656 self.0.options = v.into();
1657 self
1658 }
1659
1660 pub async fn send(self) -> Result<longrunning::model::Operation> {
1667 (*self.0.stub)
1668 .update_cluster(self.0.request, self.0.options)
1669 .await
1670 .map(gax::response::Response::into_body)
1671 }
1672
1673 pub fn poller(
1675 self,
1676 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
1677 {
1678 type Operation =
1679 lro::Operation<crate::model::Cluster, crate::model::ClusterOperationMetadata>;
1680 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1681 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1682
1683 let stub = self.0.stub.clone();
1684 let mut options = self.0.options.clone();
1685 options.set_retry_policy(gax::retry_policy::NeverRetry);
1686 let query = move |name| {
1687 let stub = stub.clone();
1688 let options = options.clone();
1689 async {
1690 let op = GetOperation::new(stub)
1691 .set_name(name)
1692 .with_options(options)
1693 .send()
1694 .await?;
1695 Ok(Operation::new(op))
1696 }
1697 };
1698
1699 let start = move || async {
1700 let op = self.send().await?;
1701 Ok(Operation::new(op))
1702 };
1703
1704 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1705 }
1706
1707 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709 self.0.request.project_id = v.into();
1710 self
1711 }
1712
1713 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715 self.0.request.region = v.into();
1716 self
1717 }
1718
1719 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1721 self.0.request.cluster_name = v.into();
1722 self
1723 }
1724
1725 pub fn set_cluster<T: Into<std::option::Option<crate::model::Cluster>>>(
1727 mut self,
1728 v: T,
1729 ) -> Self {
1730 self.0.request.cluster = v.into();
1731 self
1732 }
1733
1734 pub fn set_graceful_decommission_timeout<T: Into<std::option::Option<wkt::Duration>>>(
1736 mut self,
1737 v: T,
1738 ) -> Self {
1739 self.0.request.graceful_decommission_timeout = v.into();
1740 self
1741 }
1742
1743 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1745 mut self,
1746 v: T,
1747 ) -> Self {
1748 self.0.request.update_mask = v.into();
1749 self
1750 }
1751
1752 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1754 self.0.request.request_id = v.into();
1755 self
1756 }
1757 }
1758
1759 #[doc(hidden)]
1760 impl gax::options::internal::RequestBuilder for UpdateCluster {
1761 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1762 &mut self.0.options
1763 }
1764 }
1765
1766 #[derive(Clone, Debug)]
1768 pub struct StopCluster(RequestBuilder<crate::model::StopClusterRequest>);
1769
1770 impl StopCluster {
1771 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1772 Self(RequestBuilder::new(stub))
1773 }
1774
1775 pub fn with_request<V: Into<crate::model::StopClusterRequest>>(mut self, v: V) -> Self {
1777 self.0.request = v.into();
1778 self
1779 }
1780
1781 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1783 self.0.options = v.into();
1784 self
1785 }
1786
1787 pub async fn send(self) -> Result<longrunning::model::Operation> {
1794 (*self.0.stub)
1795 .stop_cluster(self.0.request, self.0.options)
1796 .await
1797 .map(gax::response::Response::into_body)
1798 }
1799
1800 pub fn poller(
1802 self,
1803 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
1804 {
1805 type Operation =
1806 lro::Operation<crate::model::Cluster, crate::model::ClusterOperationMetadata>;
1807 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1808 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1809
1810 let stub = self.0.stub.clone();
1811 let mut options = self.0.options.clone();
1812 options.set_retry_policy(gax::retry_policy::NeverRetry);
1813 let query = move |name| {
1814 let stub = stub.clone();
1815 let options = options.clone();
1816 async {
1817 let op = GetOperation::new(stub)
1818 .set_name(name)
1819 .with_options(options)
1820 .send()
1821 .await?;
1822 Ok(Operation::new(op))
1823 }
1824 };
1825
1826 let start = move || async {
1827 let op = self.send().await?;
1828 Ok(Operation::new(op))
1829 };
1830
1831 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1832 }
1833
1834 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1836 self.0.request.project_id = v.into();
1837 self
1838 }
1839
1840 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
1842 self.0.request.region = v.into();
1843 self
1844 }
1845
1846 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1848 self.0.request.cluster_name = v.into();
1849 self
1850 }
1851
1852 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
1854 self.0.request.cluster_uuid = v.into();
1855 self
1856 }
1857
1858 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1860 self.0.request.request_id = v.into();
1861 self
1862 }
1863 }
1864
1865 #[doc(hidden)]
1866 impl gax::options::internal::RequestBuilder for StopCluster {
1867 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1868 &mut self.0.options
1869 }
1870 }
1871
1872 #[derive(Clone, Debug)]
1874 pub struct StartCluster(RequestBuilder<crate::model::StartClusterRequest>);
1875
1876 impl StartCluster {
1877 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1878 Self(RequestBuilder::new(stub))
1879 }
1880
1881 pub fn with_request<V: Into<crate::model::StartClusterRequest>>(mut self, v: V) -> Self {
1883 self.0.request = v.into();
1884 self
1885 }
1886
1887 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1889 self.0.options = v.into();
1890 self
1891 }
1892
1893 pub async fn send(self) -> Result<longrunning::model::Operation> {
1900 (*self.0.stub)
1901 .start_cluster(self.0.request, self.0.options)
1902 .await
1903 .map(gax::response::Response::into_body)
1904 }
1905
1906 pub fn poller(
1908 self,
1909 ) -> impl lro::Poller<crate::model::Cluster, crate::model::ClusterOperationMetadata>
1910 {
1911 type Operation =
1912 lro::Operation<crate::model::Cluster, crate::model::ClusterOperationMetadata>;
1913 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1914 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1915
1916 let stub = self.0.stub.clone();
1917 let mut options = self.0.options.clone();
1918 options.set_retry_policy(gax::retry_policy::NeverRetry);
1919 let query = move |name| {
1920 let stub = stub.clone();
1921 let options = options.clone();
1922 async {
1923 let op = GetOperation::new(stub)
1924 .set_name(name)
1925 .with_options(options)
1926 .send()
1927 .await?;
1928 Ok(Operation::new(op))
1929 }
1930 };
1931
1932 let start = move || async {
1933 let op = self.send().await?;
1934 Ok(Operation::new(op))
1935 };
1936
1937 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1938 }
1939
1940 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1942 self.0.request.project_id = v.into();
1943 self
1944 }
1945
1946 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
1948 self.0.request.region = v.into();
1949 self
1950 }
1951
1952 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1954 self.0.request.cluster_name = v.into();
1955 self
1956 }
1957
1958 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
1960 self.0.request.cluster_uuid = v.into();
1961 self
1962 }
1963
1964 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1966 self.0.request.request_id = v.into();
1967 self
1968 }
1969 }
1970
1971 #[doc(hidden)]
1972 impl gax::options::internal::RequestBuilder for StartCluster {
1973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1974 &mut self.0.options
1975 }
1976 }
1977
1978 #[derive(Clone, Debug)]
1980 pub struct DeleteCluster(RequestBuilder<crate::model::DeleteClusterRequest>);
1981
1982 impl DeleteCluster {
1983 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
1984 Self(RequestBuilder::new(stub))
1985 }
1986
1987 pub fn with_request<V: Into<crate::model::DeleteClusterRequest>>(mut self, v: V) -> Self {
1989 self.0.request = v.into();
1990 self
1991 }
1992
1993 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1995 self.0.options = v.into();
1996 self
1997 }
1998
1999 pub async fn send(self) -> Result<longrunning::model::Operation> {
2006 (*self.0.stub)
2007 .delete_cluster(self.0.request, self.0.options)
2008 .await
2009 .map(gax::response::Response::into_body)
2010 }
2011
2012 pub fn poller(
2014 self,
2015 ) -> impl lro::Poller<wkt::Empty, crate::model::ClusterOperationMetadata> {
2016 type Operation = lro::Operation<wkt::Empty, crate::model::ClusterOperationMetadata>;
2017 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2018 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2019
2020 let stub = self.0.stub.clone();
2021 let mut options = self.0.options.clone();
2022 options.set_retry_policy(gax::retry_policy::NeverRetry);
2023 let query = move |name| {
2024 let stub = stub.clone();
2025 let options = options.clone();
2026 async {
2027 let op = GetOperation::new(stub)
2028 .set_name(name)
2029 .with_options(options)
2030 .send()
2031 .await?;
2032 Ok(Operation::new(op))
2033 }
2034 };
2035
2036 let start = move || async {
2037 let op = self.send().await?;
2038 Ok(Operation::new(op))
2039 };
2040
2041 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2042 }
2043
2044 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2046 self.0.request.project_id = v.into();
2047 self
2048 }
2049
2050 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2052 self.0.request.region = v.into();
2053 self
2054 }
2055
2056 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2058 self.0.request.cluster_name = v.into();
2059 self
2060 }
2061
2062 pub fn set_cluster_uuid<T: Into<std::string::String>>(mut self, v: T) -> Self {
2064 self.0.request.cluster_uuid = v.into();
2065 self
2066 }
2067
2068 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2070 self.0.request.request_id = v.into();
2071 self
2072 }
2073 }
2074
2075 #[doc(hidden)]
2076 impl gax::options::internal::RequestBuilder for DeleteCluster {
2077 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2078 &mut self.0.options
2079 }
2080 }
2081
2082 #[derive(Clone, Debug)]
2084 pub struct GetCluster(RequestBuilder<crate::model::GetClusterRequest>);
2085
2086 impl GetCluster {
2087 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2088 Self(RequestBuilder::new(stub))
2089 }
2090
2091 pub fn with_request<V: Into<crate::model::GetClusterRequest>>(mut self, v: V) -> Self {
2093 self.0.request = v.into();
2094 self
2095 }
2096
2097 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2099 self.0.options = v.into();
2100 self
2101 }
2102
2103 pub async fn send(self) -> Result<crate::model::Cluster> {
2105 (*self.0.stub)
2106 .get_cluster(self.0.request, self.0.options)
2107 .await
2108 .map(gax::response::Response::into_body)
2109 }
2110
2111 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2113 self.0.request.project_id = v.into();
2114 self
2115 }
2116
2117 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2119 self.0.request.region = v.into();
2120 self
2121 }
2122
2123 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2125 self.0.request.cluster_name = v.into();
2126 self
2127 }
2128 }
2129
2130 #[doc(hidden)]
2131 impl gax::options::internal::RequestBuilder for GetCluster {
2132 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2133 &mut self.0.options
2134 }
2135 }
2136
2137 #[derive(Clone, Debug)]
2139 pub struct ListClusters(RequestBuilder<crate::model::ListClustersRequest>);
2140
2141 impl ListClusters {
2142 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2143 Self(RequestBuilder::new(stub))
2144 }
2145
2146 pub fn with_request<V: Into<crate::model::ListClustersRequest>>(mut self, v: V) -> Self {
2148 self.0.request = v.into();
2149 self
2150 }
2151
2152 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2154 self.0.options = v.into();
2155 self
2156 }
2157
2158 pub async fn send(self) -> Result<crate::model::ListClustersResponse> {
2160 (*self.0.stub)
2161 .list_clusters(self.0.request, self.0.options)
2162 .await
2163 .map(gax::response::Response::into_body)
2164 }
2165
2166 pub async fn paginator(
2168 self,
2169 ) -> impl gax::paginator::Paginator<crate::model::ListClustersResponse, gax::error::Error>
2170 {
2171 use std::clone::Clone;
2172 let token = self.0.request.page_token.clone();
2173 let execute = move |token: String| {
2174 let mut builder = self.clone();
2175 builder.0.request = builder.0.request.set_page_token(token);
2176 builder.send()
2177 };
2178 gax::paginator::internal::new_paginator(token, execute)
2179 }
2180
2181 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2183 self.0.request.project_id = v.into();
2184 self
2185 }
2186
2187 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2189 self.0.request.region = v.into();
2190 self
2191 }
2192
2193 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2195 self.0.request.filter = v.into();
2196 self
2197 }
2198
2199 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2201 self.0.request.page_size = v.into();
2202 self
2203 }
2204
2205 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2207 self.0.request.page_token = v.into();
2208 self
2209 }
2210 }
2211
2212 #[doc(hidden)]
2213 impl gax::options::internal::RequestBuilder for ListClusters {
2214 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2215 &mut self.0.options
2216 }
2217 }
2218
2219 #[derive(Clone, Debug)]
2221 pub struct DiagnoseCluster(RequestBuilder<crate::model::DiagnoseClusterRequest>);
2222
2223 impl DiagnoseCluster {
2224 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2225 Self(RequestBuilder::new(stub))
2226 }
2227
2228 pub fn with_request<V: Into<crate::model::DiagnoseClusterRequest>>(mut self, v: V) -> Self {
2230 self.0.request = v.into();
2231 self
2232 }
2233
2234 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2236 self.0.options = v.into();
2237 self
2238 }
2239
2240 pub async fn send(self) -> Result<longrunning::model::Operation> {
2247 (*self.0.stub)
2248 .diagnose_cluster(self.0.request, self.0.options)
2249 .await
2250 .map(gax::response::Response::into_body)
2251 }
2252
2253 pub fn poller(
2255 self,
2256 ) -> impl lro::Poller<crate::model::DiagnoseClusterResults, crate::model::ClusterOperationMetadata>
2257 {
2258 type Operation = lro::Operation<
2259 crate::model::DiagnoseClusterResults,
2260 crate::model::ClusterOperationMetadata,
2261 >;
2262 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2263 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2264
2265 let stub = self.0.stub.clone();
2266 let mut options = self.0.options.clone();
2267 options.set_retry_policy(gax::retry_policy::NeverRetry);
2268 let query = move |name| {
2269 let stub = stub.clone();
2270 let options = options.clone();
2271 async {
2272 let op = GetOperation::new(stub)
2273 .set_name(name)
2274 .with_options(options)
2275 .send()
2276 .await?;
2277 Ok(Operation::new(op))
2278 }
2279 };
2280
2281 let start = move || async {
2282 let op = self.send().await?;
2283 Ok(Operation::new(op))
2284 };
2285
2286 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2287 }
2288
2289 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2291 self.0.request.project_id = v.into();
2292 self
2293 }
2294
2295 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2297 self.0.request.region = v.into();
2298 self
2299 }
2300
2301 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2303 self.0.request.cluster_name = v.into();
2304 self
2305 }
2306
2307 pub fn set_tarball_gcs_dir<T: Into<std::string::String>>(mut self, v: T) -> Self {
2309 self.0.request.tarball_gcs_dir = v.into();
2310 self
2311 }
2312
2313 pub fn set_tarball_access<
2315 T: Into<crate::model::diagnose_cluster_request::TarballAccess>,
2316 >(
2317 mut self,
2318 v: T,
2319 ) -> Self {
2320 self.0.request.tarball_access = v.into();
2321 self
2322 }
2323
2324 pub fn set_diagnosis_interval<T: Into<std::option::Option<gtype::model::Interval>>>(
2326 mut self,
2327 v: T,
2328 ) -> Self {
2329 self.0.request.diagnosis_interval = v.into();
2330 self
2331 }
2332
2333 pub fn set_jobs<T, V>(mut self, v: T) -> Self
2335 where
2336 T: std::iter::IntoIterator<Item = V>,
2337 V: std::convert::Into<std::string::String>,
2338 {
2339 use std::iter::Iterator;
2340 self.0.request.jobs = v.into_iter().map(|i| i.into()).collect();
2341 self
2342 }
2343
2344 pub fn set_yarn_application_ids<T, V>(mut self, v: T) -> Self
2346 where
2347 T: std::iter::IntoIterator<Item = V>,
2348 V: std::convert::Into<std::string::String>,
2349 {
2350 use std::iter::Iterator;
2351 self.0.request.yarn_application_ids = v.into_iter().map(|i| i.into()).collect();
2352 self
2353 }
2354 }
2355
2356 #[doc(hidden)]
2357 impl gax::options::internal::RequestBuilder for DiagnoseCluster {
2358 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2359 &mut self.0.options
2360 }
2361 }
2362
2363 #[derive(Clone, Debug)]
2365 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2366
2367 impl SetIamPolicy {
2368 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2369 Self(RequestBuilder::new(stub))
2370 }
2371
2372 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2374 self.0.request = v.into();
2375 self
2376 }
2377
2378 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2380 self.0.options = v.into();
2381 self
2382 }
2383
2384 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2386 (*self.0.stub)
2387 .set_iam_policy(self.0.request, self.0.options)
2388 .await
2389 .map(gax::response::Response::into_body)
2390 }
2391
2392 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2394 self.0.request.resource = v.into();
2395 self
2396 }
2397
2398 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
2400 mut self,
2401 v: T,
2402 ) -> Self {
2403 self.0.request.policy = v.into();
2404 self
2405 }
2406
2407 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
2409 mut self,
2410 v: T,
2411 ) -> Self {
2412 self.0.request.update_mask = v.into();
2413 self
2414 }
2415 }
2416
2417 #[doc(hidden)]
2418 impl gax::options::internal::RequestBuilder for SetIamPolicy {
2419 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2420 &mut self.0.options
2421 }
2422 }
2423
2424 #[derive(Clone, Debug)]
2426 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2427
2428 impl GetIamPolicy {
2429 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2430 Self(RequestBuilder::new(stub))
2431 }
2432
2433 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2435 self.0.request = v.into();
2436 self
2437 }
2438
2439 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2441 self.0.options = v.into();
2442 self
2443 }
2444
2445 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2447 (*self.0.stub)
2448 .get_iam_policy(self.0.request, self.0.options)
2449 .await
2450 .map(gax::response::Response::into_body)
2451 }
2452
2453 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2455 self.0.request.resource = v.into();
2456 self
2457 }
2458
2459 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
2461 mut self,
2462 v: T,
2463 ) -> Self {
2464 self.0.request.options = v.into();
2465 self
2466 }
2467 }
2468
2469 #[doc(hidden)]
2470 impl gax::options::internal::RequestBuilder for GetIamPolicy {
2471 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2472 &mut self.0.options
2473 }
2474 }
2475
2476 #[derive(Clone, Debug)]
2478 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2479
2480 impl TestIamPermissions {
2481 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2482 Self(RequestBuilder::new(stub))
2483 }
2484
2485 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2487 mut self,
2488 v: V,
2489 ) -> Self {
2490 self.0.request = v.into();
2491 self
2492 }
2493
2494 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2496 self.0.options = v.into();
2497 self
2498 }
2499
2500 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2502 (*self.0.stub)
2503 .test_iam_permissions(self.0.request, self.0.options)
2504 .await
2505 .map(gax::response::Response::into_body)
2506 }
2507
2508 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2510 self.0.request.resource = v.into();
2511 self
2512 }
2513
2514 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2516 where
2517 T: std::iter::IntoIterator<Item = V>,
2518 V: std::convert::Into<std::string::String>,
2519 {
2520 use std::iter::Iterator;
2521 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2522 self
2523 }
2524 }
2525
2526 #[doc(hidden)]
2527 impl gax::options::internal::RequestBuilder for TestIamPermissions {
2528 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2529 &mut self.0.options
2530 }
2531 }
2532
2533 #[derive(Clone, Debug)]
2535 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2536
2537 impl ListOperations {
2538 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2539 Self(RequestBuilder::new(stub))
2540 }
2541
2542 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2544 mut self,
2545 v: V,
2546 ) -> Self {
2547 self.0.request = v.into();
2548 self
2549 }
2550
2551 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2553 self.0.options = v.into();
2554 self
2555 }
2556
2557 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2559 (*self.0.stub)
2560 .list_operations(self.0.request, self.0.options)
2561 .await
2562 .map(gax::response::Response::into_body)
2563 }
2564
2565 pub async fn paginator(
2567 self,
2568 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2569 {
2570 use std::clone::Clone;
2571 let token = self.0.request.page_token.clone();
2572 let execute = move |token: String| {
2573 let mut builder = self.clone();
2574 builder.0.request = builder.0.request.set_page_token(token);
2575 builder.send()
2576 };
2577 gax::paginator::internal::new_paginator(token, execute)
2578 }
2579
2580 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2582 self.0.request.name = v.into();
2583 self
2584 }
2585
2586 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2588 self.0.request.filter = v.into();
2589 self
2590 }
2591
2592 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2594 self.0.request.page_size = v.into();
2595 self
2596 }
2597
2598 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2600 self.0.request.page_token = v.into();
2601 self
2602 }
2603 }
2604
2605 #[doc(hidden)]
2606 impl gax::options::internal::RequestBuilder for ListOperations {
2607 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2608 &mut self.0.options
2609 }
2610 }
2611
2612 #[derive(Clone, Debug)]
2614 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2615
2616 impl GetOperation {
2617 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2618 Self(RequestBuilder::new(stub))
2619 }
2620
2621 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2623 mut self,
2624 v: V,
2625 ) -> Self {
2626 self.0.request = v.into();
2627 self
2628 }
2629
2630 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2632 self.0.options = v.into();
2633 self
2634 }
2635
2636 pub async fn send(self) -> Result<longrunning::model::Operation> {
2638 (*self.0.stub)
2639 .get_operation(self.0.request, self.0.options)
2640 .await
2641 .map(gax::response::Response::into_body)
2642 }
2643
2644 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2646 self.0.request.name = v.into();
2647 self
2648 }
2649 }
2650
2651 #[doc(hidden)]
2652 impl gax::options::internal::RequestBuilder for GetOperation {
2653 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2654 &mut self.0.options
2655 }
2656 }
2657
2658 #[derive(Clone, Debug)]
2660 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2661
2662 impl DeleteOperation {
2663 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2664 Self(RequestBuilder::new(stub))
2665 }
2666
2667 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2669 mut self,
2670 v: V,
2671 ) -> Self {
2672 self.0.request = v.into();
2673 self
2674 }
2675
2676 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2678 self.0.options = v.into();
2679 self
2680 }
2681
2682 pub async fn send(self) -> Result<()> {
2684 (*self.0.stub)
2685 .delete_operation(self.0.request, self.0.options)
2686 .await
2687 .map(gax::response::Response::into_body)
2688 }
2689
2690 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.0.request.name = v.into();
2693 self
2694 }
2695 }
2696
2697 #[doc(hidden)]
2698 impl gax::options::internal::RequestBuilder for DeleteOperation {
2699 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2700 &mut self.0.options
2701 }
2702 }
2703
2704 #[derive(Clone, Debug)]
2706 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2707
2708 impl CancelOperation {
2709 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::ClusterController>) -> Self {
2710 Self(RequestBuilder::new(stub))
2711 }
2712
2713 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2715 mut self,
2716 v: V,
2717 ) -> Self {
2718 self.0.request = v.into();
2719 self
2720 }
2721
2722 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2724 self.0.options = v.into();
2725 self
2726 }
2727
2728 pub async fn send(self) -> Result<()> {
2730 (*self.0.stub)
2731 .cancel_operation(self.0.request, self.0.options)
2732 .await
2733 .map(gax::response::Response::into_body)
2734 }
2735
2736 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2738 self.0.request.name = v.into();
2739 self
2740 }
2741 }
2742
2743 #[doc(hidden)]
2744 impl gax::options::internal::RequestBuilder for CancelOperation {
2745 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2746 &mut self.0.options
2747 }
2748 }
2749}
2750
2751pub mod job_controller {
2752 use crate::Result;
2753 use std::sync::Arc;
2754
2755 pub type ClientBuilder =
2769 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2770
2771 pub(crate) mod client {
2772 use super::super::super::client::JobController;
2773 pub struct Factory;
2774 impl gax::client_builder::internal::ClientFactory for Factory {
2775 type Client = JobController;
2776 type Credentials = gaxi::options::Credentials;
2777 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
2778 Self::Client::new(config).await
2779 }
2780 }
2781 }
2782
2783 #[derive(Clone, Debug)]
2785 pub(crate) struct RequestBuilder<R: std::default::Default> {
2786 stub: Arc<dyn super::super::stub::dynamic::JobController>,
2787 request: R,
2788 options: gax::options::RequestOptions,
2789 }
2790
2791 impl<R> RequestBuilder<R>
2792 where
2793 R: std::default::Default,
2794 {
2795 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
2796 Self {
2797 stub,
2798 request: R::default(),
2799 options: gax::options::RequestOptions::default(),
2800 }
2801 }
2802 }
2803
2804 #[derive(Clone, Debug)]
2806 pub struct SubmitJob(RequestBuilder<crate::model::SubmitJobRequest>);
2807
2808 impl SubmitJob {
2809 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
2810 Self(RequestBuilder::new(stub))
2811 }
2812
2813 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
2815 self.0.request = v.into();
2816 self
2817 }
2818
2819 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2821 self.0.options = v.into();
2822 self
2823 }
2824
2825 pub async fn send(self) -> Result<crate::model::Job> {
2827 (*self.0.stub)
2828 .submit_job(self.0.request, self.0.options)
2829 .await
2830 .map(gax::response::Response::into_body)
2831 }
2832
2833 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2835 self.0.request.project_id = v.into();
2836 self
2837 }
2838
2839 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2841 self.0.request.region = v.into();
2842 self
2843 }
2844
2845 pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
2847 self.0.request.job = v.into();
2848 self
2849 }
2850
2851 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2853 self.0.request.request_id = v.into();
2854 self
2855 }
2856 }
2857
2858 #[doc(hidden)]
2859 impl gax::options::internal::RequestBuilder for SubmitJob {
2860 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2861 &mut self.0.options
2862 }
2863 }
2864
2865 #[derive(Clone, Debug)]
2867 pub struct SubmitJobAsOperation(RequestBuilder<crate::model::SubmitJobRequest>);
2868
2869 impl SubmitJobAsOperation {
2870 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
2871 Self(RequestBuilder::new(stub))
2872 }
2873
2874 pub fn with_request<V: Into<crate::model::SubmitJobRequest>>(mut self, v: V) -> Self {
2876 self.0.request = v.into();
2877 self
2878 }
2879
2880 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2882 self.0.options = v.into();
2883 self
2884 }
2885
2886 pub async fn send(self) -> Result<longrunning::model::Operation> {
2893 (*self.0.stub)
2894 .submit_job_as_operation(self.0.request, self.0.options)
2895 .await
2896 .map(gax::response::Response::into_body)
2897 }
2898
2899 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::JobMetadata> {
2901 type Operation = lro::Operation<crate::model::Job, crate::model::JobMetadata>;
2902 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2903 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2904
2905 let stub = self.0.stub.clone();
2906 let mut options = self.0.options.clone();
2907 options.set_retry_policy(gax::retry_policy::NeverRetry);
2908 let query = move |name| {
2909 let stub = stub.clone();
2910 let options = options.clone();
2911 async {
2912 let op = GetOperation::new(stub)
2913 .set_name(name)
2914 .with_options(options)
2915 .send()
2916 .await?;
2917 Ok(Operation::new(op))
2918 }
2919 };
2920
2921 let start = move || async {
2922 let op = self.send().await?;
2923 Ok(Operation::new(op))
2924 };
2925
2926 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2927 }
2928
2929 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2931 self.0.request.project_id = v.into();
2932 self
2933 }
2934
2935 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2937 self.0.request.region = v.into();
2938 self
2939 }
2940
2941 pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
2943 self.0.request.job = v.into();
2944 self
2945 }
2946
2947 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2949 self.0.request.request_id = v.into();
2950 self
2951 }
2952 }
2953
2954 #[doc(hidden)]
2955 impl gax::options::internal::RequestBuilder for SubmitJobAsOperation {
2956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2957 &mut self.0.options
2958 }
2959 }
2960
2961 #[derive(Clone, Debug)]
2963 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
2964
2965 impl GetJob {
2966 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
2967 Self(RequestBuilder::new(stub))
2968 }
2969
2970 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
2972 self.0.request = v.into();
2973 self
2974 }
2975
2976 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2978 self.0.options = v.into();
2979 self
2980 }
2981
2982 pub async fn send(self) -> Result<crate::model::Job> {
2984 (*self.0.stub)
2985 .get_job(self.0.request, self.0.options)
2986 .await
2987 .map(gax::response::Response::into_body)
2988 }
2989
2990 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2992 self.0.request.project_id = v.into();
2993 self
2994 }
2995
2996 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
2998 self.0.request.region = v.into();
2999 self
3000 }
3001
3002 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3004 self.0.request.job_id = v.into();
3005 self
3006 }
3007 }
3008
3009 #[doc(hidden)]
3010 impl gax::options::internal::RequestBuilder for GetJob {
3011 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3012 &mut self.0.options
3013 }
3014 }
3015
3016 #[derive(Clone, Debug)]
3018 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
3019
3020 impl ListJobs {
3021 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3022 Self(RequestBuilder::new(stub))
3023 }
3024
3025 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
3027 self.0.request = v.into();
3028 self
3029 }
3030
3031 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3033 self.0.options = v.into();
3034 self
3035 }
3036
3037 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
3039 (*self.0.stub)
3040 .list_jobs(self.0.request, self.0.options)
3041 .await
3042 .map(gax::response::Response::into_body)
3043 }
3044
3045 pub async fn paginator(
3047 self,
3048 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
3049 {
3050 use std::clone::Clone;
3051 let token = self.0.request.page_token.clone();
3052 let execute = move |token: String| {
3053 let mut builder = self.clone();
3054 builder.0.request = builder.0.request.set_page_token(token);
3055 builder.send()
3056 };
3057 gax::paginator::internal::new_paginator(token, execute)
3058 }
3059
3060 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3062 self.0.request.project_id = v.into();
3063 self
3064 }
3065
3066 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3068 self.0.request.region = v.into();
3069 self
3070 }
3071
3072 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3074 self.0.request.page_size = v.into();
3075 self
3076 }
3077
3078 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3080 self.0.request.page_token = v.into();
3081 self
3082 }
3083
3084 pub fn set_cluster_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3086 self.0.request.cluster_name = v.into();
3087 self
3088 }
3089
3090 pub fn set_job_state_matcher<T: Into<crate::model::list_jobs_request::JobStateMatcher>>(
3092 mut self,
3093 v: T,
3094 ) -> Self {
3095 self.0.request.job_state_matcher = v.into();
3096 self
3097 }
3098
3099 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3101 self.0.request.filter = v.into();
3102 self
3103 }
3104 }
3105
3106 #[doc(hidden)]
3107 impl gax::options::internal::RequestBuilder for ListJobs {
3108 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3109 &mut self.0.options
3110 }
3111 }
3112
3113 #[derive(Clone, Debug)]
3115 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
3116
3117 impl UpdateJob {
3118 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3119 Self(RequestBuilder::new(stub))
3120 }
3121
3122 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
3124 self.0.request = v.into();
3125 self
3126 }
3127
3128 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3130 self.0.options = v.into();
3131 self
3132 }
3133
3134 pub async fn send(self) -> Result<crate::model::Job> {
3136 (*self.0.stub)
3137 .update_job(self.0.request, self.0.options)
3138 .await
3139 .map(gax::response::Response::into_body)
3140 }
3141
3142 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3144 self.0.request.project_id = v.into();
3145 self
3146 }
3147
3148 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150 self.0.request.region = v.into();
3151 self
3152 }
3153
3154 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3156 self.0.request.job_id = v.into();
3157 self
3158 }
3159
3160 pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
3162 self.0.request.job = v.into();
3163 self
3164 }
3165
3166 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
3168 mut self,
3169 v: T,
3170 ) -> Self {
3171 self.0.request.update_mask = v.into();
3172 self
3173 }
3174 }
3175
3176 #[doc(hidden)]
3177 impl gax::options::internal::RequestBuilder for UpdateJob {
3178 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3179 &mut self.0.options
3180 }
3181 }
3182
3183 #[derive(Clone, Debug)]
3185 pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
3186
3187 impl CancelJob {
3188 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3189 Self(RequestBuilder::new(stub))
3190 }
3191
3192 pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
3194 self.0.request = v.into();
3195 self
3196 }
3197
3198 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3200 self.0.options = v.into();
3201 self
3202 }
3203
3204 pub async fn send(self) -> Result<crate::model::Job> {
3206 (*self.0.stub)
3207 .cancel_job(self.0.request, self.0.options)
3208 .await
3209 .map(gax::response::Response::into_body)
3210 }
3211
3212 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3214 self.0.request.project_id = v.into();
3215 self
3216 }
3217
3218 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3220 self.0.request.region = v.into();
3221 self
3222 }
3223
3224 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3226 self.0.request.job_id = v.into();
3227 self
3228 }
3229 }
3230
3231 #[doc(hidden)]
3232 impl gax::options::internal::RequestBuilder for CancelJob {
3233 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3234 &mut self.0.options
3235 }
3236 }
3237
3238 #[derive(Clone, Debug)]
3240 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
3241
3242 impl DeleteJob {
3243 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3244 Self(RequestBuilder::new(stub))
3245 }
3246
3247 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
3249 self.0.request = v.into();
3250 self
3251 }
3252
3253 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3255 self.0.options = v.into();
3256 self
3257 }
3258
3259 pub async fn send(self) -> Result<()> {
3261 (*self.0.stub)
3262 .delete_job(self.0.request, self.0.options)
3263 .await
3264 .map(gax::response::Response::into_body)
3265 }
3266
3267 pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3269 self.0.request.project_id = v.into();
3270 self
3271 }
3272
3273 pub fn set_region<T: Into<std::string::String>>(mut self, v: T) -> Self {
3275 self.0.request.region = v.into();
3276 self
3277 }
3278
3279 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3281 self.0.request.job_id = v.into();
3282 self
3283 }
3284 }
3285
3286 #[doc(hidden)]
3287 impl gax::options::internal::RequestBuilder for DeleteJob {
3288 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3289 &mut self.0.options
3290 }
3291 }
3292
3293 #[derive(Clone, Debug)]
3295 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3296
3297 impl SetIamPolicy {
3298 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3299 Self(RequestBuilder::new(stub))
3300 }
3301
3302 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3304 self.0.request = v.into();
3305 self
3306 }
3307
3308 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3310 self.0.options = v.into();
3311 self
3312 }
3313
3314 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3316 (*self.0.stub)
3317 .set_iam_policy(self.0.request, self.0.options)
3318 .await
3319 .map(gax::response::Response::into_body)
3320 }
3321
3322 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3324 self.0.request.resource = v.into();
3325 self
3326 }
3327
3328 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
3330 mut self,
3331 v: T,
3332 ) -> Self {
3333 self.0.request.policy = v.into();
3334 self
3335 }
3336
3337 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
3339 mut self,
3340 v: T,
3341 ) -> Self {
3342 self.0.request.update_mask = v.into();
3343 self
3344 }
3345 }
3346
3347 #[doc(hidden)]
3348 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3349 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3350 &mut self.0.options
3351 }
3352 }
3353
3354 #[derive(Clone, Debug)]
3356 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3357
3358 impl GetIamPolicy {
3359 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3360 Self(RequestBuilder::new(stub))
3361 }
3362
3363 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3365 self.0.request = v.into();
3366 self
3367 }
3368
3369 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3371 self.0.options = v.into();
3372 self
3373 }
3374
3375 pub async fn send(self) -> Result<iam_v1::model::Policy> {
3377 (*self.0.stub)
3378 .get_iam_policy(self.0.request, self.0.options)
3379 .await
3380 .map(gax::response::Response::into_body)
3381 }
3382
3383 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3385 self.0.request.resource = v.into();
3386 self
3387 }
3388
3389 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
3391 mut self,
3392 v: T,
3393 ) -> Self {
3394 self.0.request.options = v.into();
3395 self
3396 }
3397 }
3398
3399 #[doc(hidden)]
3400 impl gax::options::internal::RequestBuilder for GetIamPolicy {
3401 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3402 &mut self.0.options
3403 }
3404 }
3405
3406 #[derive(Clone, Debug)]
3408 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3409
3410 impl TestIamPermissions {
3411 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3412 Self(RequestBuilder::new(stub))
3413 }
3414
3415 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3417 mut self,
3418 v: V,
3419 ) -> Self {
3420 self.0.request = v.into();
3421 self
3422 }
3423
3424 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3426 self.0.options = v.into();
3427 self
3428 }
3429
3430 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3432 (*self.0.stub)
3433 .test_iam_permissions(self.0.request, self.0.options)
3434 .await
3435 .map(gax::response::Response::into_body)
3436 }
3437
3438 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3440 self.0.request.resource = v.into();
3441 self
3442 }
3443
3444 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3446 where
3447 T: std::iter::IntoIterator<Item = V>,
3448 V: std::convert::Into<std::string::String>,
3449 {
3450 use std::iter::Iterator;
3451 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3452 self
3453 }
3454 }
3455
3456 #[doc(hidden)]
3457 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3458 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3459 &mut self.0.options
3460 }
3461 }
3462
3463 #[derive(Clone, Debug)]
3465 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3466
3467 impl ListOperations {
3468 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3469 Self(RequestBuilder::new(stub))
3470 }
3471
3472 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3474 mut self,
3475 v: V,
3476 ) -> Self {
3477 self.0.request = v.into();
3478 self
3479 }
3480
3481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3483 self.0.options = v.into();
3484 self
3485 }
3486
3487 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3489 (*self.0.stub)
3490 .list_operations(self.0.request, self.0.options)
3491 .await
3492 .map(gax::response::Response::into_body)
3493 }
3494
3495 pub async fn paginator(
3497 self,
3498 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3499 {
3500 use std::clone::Clone;
3501 let token = self.0.request.page_token.clone();
3502 let execute = move |token: String| {
3503 let mut builder = self.clone();
3504 builder.0.request = builder.0.request.set_page_token(token);
3505 builder.send()
3506 };
3507 gax::paginator::internal::new_paginator(token, execute)
3508 }
3509
3510 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3512 self.0.request.name = v.into();
3513 self
3514 }
3515
3516 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3518 self.0.request.filter = v.into();
3519 self
3520 }
3521
3522 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3524 self.0.request.page_size = v.into();
3525 self
3526 }
3527
3528 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3530 self.0.request.page_token = v.into();
3531 self
3532 }
3533 }
3534
3535 #[doc(hidden)]
3536 impl gax::options::internal::RequestBuilder for ListOperations {
3537 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3538 &mut self.0.options
3539 }
3540 }
3541
3542 #[derive(Clone, Debug)]
3544 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3545
3546 impl GetOperation {
3547 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3548 Self(RequestBuilder::new(stub))
3549 }
3550
3551 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3553 mut self,
3554 v: V,
3555 ) -> Self {
3556 self.0.request = v.into();
3557 self
3558 }
3559
3560 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3562 self.0.options = v.into();
3563 self
3564 }
3565
3566 pub async fn send(self) -> Result<longrunning::model::Operation> {
3568 (*self.0.stub)
3569 .get_operation(self.0.request, self.0.options)
3570 .await
3571 .map(gax::response::Response::into_body)
3572 }
3573
3574 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3576 self.0.request.name = v.into();
3577 self
3578 }
3579 }
3580
3581 #[doc(hidden)]
3582 impl gax::options::internal::RequestBuilder for GetOperation {
3583 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3584 &mut self.0.options
3585 }
3586 }
3587
3588 #[derive(Clone, Debug)]
3590 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3591
3592 impl DeleteOperation {
3593 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3594 Self(RequestBuilder::new(stub))
3595 }
3596
3597 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3599 mut self,
3600 v: V,
3601 ) -> Self {
3602 self.0.request = v.into();
3603 self
3604 }
3605
3606 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3608 self.0.options = v.into();
3609 self
3610 }
3611
3612 pub async fn send(self) -> Result<()> {
3614 (*self.0.stub)
3615 .delete_operation(self.0.request, self.0.options)
3616 .await
3617 .map(gax::response::Response::into_body)
3618 }
3619
3620 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3622 self.0.request.name = v.into();
3623 self
3624 }
3625 }
3626
3627 #[doc(hidden)]
3628 impl gax::options::internal::RequestBuilder for DeleteOperation {
3629 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3630 &mut self.0.options
3631 }
3632 }
3633
3634 #[derive(Clone, Debug)]
3636 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3637
3638 impl CancelOperation {
3639 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::JobController>) -> Self {
3640 Self(RequestBuilder::new(stub))
3641 }
3642
3643 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3645 mut self,
3646 v: V,
3647 ) -> Self {
3648 self.0.request = v.into();
3649 self
3650 }
3651
3652 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3654 self.0.options = v.into();
3655 self
3656 }
3657
3658 pub async fn send(self) -> Result<()> {
3660 (*self.0.stub)
3661 .cancel_operation(self.0.request, self.0.options)
3662 .await
3663 .map(gax::response::Response::into_body)
3664 }
3665
3666 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3668 self.0.request.name = v.into();
3669 self
3670 }
3671 }
3672
3673 #[doc(hidden)]
3674 impl gax::options::internal::RequestBuilder for CancelOperation {
3675 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3676 &mut self.0.options
3677 }
3678 }
3679}
3680
3681pub mod node_group_controller {
3682 use crate::Result;
3683 use std::sync::Arc;
3684
3685 pub type ClientBuilder =
3699 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3700
3701 pub(crate) mod client {
3702 use super::super::super::client::NodeGroupController;
3703 pub struct Factory;
3704 impl gax::client_builder::internal::ClientFactory for Factory {
3705 type Client = NodeGroupController;
3706 type Credentials = gaxi::options::Credentials;
3707 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
3708 Self::Client::new(config).await
3709 }
3710 }
3711 }
3712
3713 #[derive(Clone, Debug)]
3715 pub(crate) struct RequestBuilder<R: std::default::Default> {
3716 stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>,
3717 request: R,
3718 options: gax::options::RequestOptions,
3719 }
3720
3721 impl<R> RequestBuilder<R>
3722 where
3723 R: std::default::Default,
3724 {
3725 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
3726 Self {
3727 stub,
3728 request: R::default(),
3729 options: gax::options::RequestOptions::default(),
3730 }
3731 }
3732 }
3733
3734 #[derive(Clone, Debug)]
3736 pub struct CreateNodeGroup(RequestBuilder<crate::model::CreateNodeGroupRequest>);
3737
3738 impl CreateNodeGroup {
3739 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
3740 Self(RequestBuilder::new(stub))
3741 }
3742
3743 pub fn with_request<V: Into<crate::model::CreateNodeGroupRequest>>(mut self, v: V) -> Self {
3745 self.0.request = v.into();
3746 self
3747 }
3748
3749 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3751 self.0.options = v.into();
3752 self
3753 }
3754
3755 pub async fn send(self) -> Result<longrunning::model::Operation> {
3762 (*self.0.stub)
3763 .create_node_group(self.0.request, self.0.options)
3764 .await
3765 .map(gax::response::Response::into_body)
3766 }
3767
3768 pub fn poller(
3770 self,
3771 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
3772 {
3773 type Operation =
3774 lro::Operation<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>;
3775 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3776 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3777
3778 let stub = self.0.stub.clone();
3779 let mut options = self.0.options.clone();
3780 options.set_retry_policy(gax::retry_policy::NeverRetry);
3781 let query = move |name| {
3782 let stub = stub.clone();
3783 let options = options.clone();
3784 async {
3785 let op = GetOperation::new(stub)
3786 .set_name(name)
3787 .with_options(options)
3788 .send()
3789 .await?;
3790 Ok(Operation::new(op))
3791 }
3792 };
3793
3794 let start = move || async {
3795 let op = self.send().await?;
3796 Ok(Operation::new(op))
3797 };
3798
3799 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3800 }
3801
3802 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3804 self.0.request.parent = v.into();
3805 self
3806 }
3807
3808 pub fn set_node_group<T: Into<std::option::Option<crate::model::NodeGroup>>>(
3810 mut self,
3811 v: T,
3812 ) -> Self {
3813 self.0.request.node_group = v.into();
3814 self
3815 }
3816
3817 pub fn set_node_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3819 self.0.request.node_group_id = v.into();
3820 self
3821 }
3822
3823 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3825 self.0.request.request_id = v.into();
3826 self
3827 }
3828 }
3829
3830 #[doc(hidden)]
3831 impl gax::options::internal::RequestBuilder for CreateNodeGroup {
3832 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3833 &mut self.0.options
3834 }
3835 }
3836
3837 #[derive(Clone, Debug)]
3839 pub struct ResizeNodeGroup(RequestBuilder<crate::model::ResizeNodeGroupRequest>);
3840
3841 impl ResizeNodeGroup {
3842 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
3843 Self(RequestBuilder::new(stub))
3844 }
3845
3846 pub fn with_request<V: Into<crate::model::ResizeNodeGroupRequest>>(mut self, v: V) -> Self {
3848 self.0.request = v.into();
3849 self
3850 }
3851
3852 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3854 self.0.options = v.into();
3855 self
3856 }
3857
3858 pub async fn send(self) -> Result<longrunning::model::Operation> {
3865 (*self.0.stub)
3866 .resize_node_group(self.0.request, self.0.options)
3867 .await
3868 .map(gax::response::Response::into_body)
3869 }
3870
3871 pub fn poller(
3873 self,
3874 ) -> impl lro::Poller<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>
3875 {
3876 type Operation =
3877 lro::Operation<crate::model::NodeGroup, crate::model::NodeGroupOperationMetadata>;
3878 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3879 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3880
3881 let stub = self.0.stub.clone();
3882 let mut options = self.0.options.clone();
3883 options.set_retry_policy(gax::retry_policy::NeverRetry);
3884 let query = move |name| {
3885 let stub = stub.clone();
3886 let options = options.clone();
3887 async {
3888 let op = GetOperation::new(stub)
3889 .set_name(name)
3890 .with_options(options)
3891 .send()
3892 .await?;
3893 Ok(Operation::new(op))
3894 }
3895 };
3896
3897 let start = move || async {
3898 let op = self.send().await?;
3899 Ok(Operation::new(op))
3900 };
3901
3902 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3903 }
3904
3905 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3907 self.0.request.name = v.into();
3908 self
3909 }
3910
3911 pub fn set_size<T: Into<i32>>(mut self, v: T) -> Self {
3913 self.0.request.size = v.into();
3914 self
3915 }
3916
3917 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3919 self.0.request.request_id = v.into();
3920 self
3921 }
3922
3923 pub fn set_graceful_decommission_timeout<T: Into<std::option::Option<wkt::Duration>>>(
3925 mut self,
3926 v: T,
3927 ) -> Self {
3928 self.0.request.graceful_decommission_timeout = v.into();
3929 self
3930 }
3931 }
3932
3933 #[doc(hidden)]
3934 impl gax::options::internal::RequestBuilder for ResizeNodeGroup {
3935 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3936 &mut self.0.options
3937 }
3938 }
3939
3940 #[derive(Clone, Debug)]
3942 pub struct GetNodeGroup(RequestBuilder<crate::model::GetNodeGroupRequest>);
3943
3944 impl GetNodeGroup {
3945 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
3946 Self(RequestBuilder::new(stub))
3947 }
3948
3949 pub fn with_request<V: Into<crate::model::GetNodeGroupRequest>>(mut self, v: V) -> Self {
3951 self.0.request = v.into();
3952 self
3953 }
3954
3955 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3957 self.0.options = v.into();
3958 self
3959 }
3960
3961 pub async fn send(self) -> Result<crate::model::NodeGroup> {
3963 (*self.0.stub)
3964 .get_node_group(self.0.request, self.0.options)
3965 .await
3966 .map(gax::response::Response::into_body)
3967 }
3968
3969 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3971 self.0.request.name = v.into();
3972 self
3973 }
3974 }
3975
3976 #[doc(hidden)]
3977 impl gax::options::internal::RequestBuilder for GetNodeGroup {
3978 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3979 &mut self.0.options
3980 }
3981 }
3982
3983 #[derive(Clone, Debug)]
3985 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
3986
3987 impl SetIamPolicy {
3988 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
3989 Self(RequestBuilder::new(stub))
3990 }
3991
3992 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
3994 self.0.request = v.into();
3995 self
3996 }
3997
3998 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4000 self.0.options = v.into();
4001 self
4002 }
4003
4004 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4006 (*self.0.stub)
4007 .set_iam_policy(self.0.request, self.0.options)
4008 .await
4009 .map(gax::response::Response::into_body)
4010 }
4011
4012 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4014 self.0.request.resource = v.into();
4015 self
4016 }
4017
4018 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
4020 mut self,
4021 v: T,
4022 ) -> Self {
4023 self.0.request.policy = v.into();
4024 self
4025 }
4026
4027 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
4029 mut self,
4030 v: T,
4031 ) -> Self {
4032 self.0.request.update_mask = v.into();
4033 self
4034 }
4035 }
4036
4037 #[doc(hidden)]
4038 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4039 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4040 &mut self.0.options
4041 }
4042 }
4043
4044 #[derive(Clone, Debug)]
4046 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4047
4048 impl GetIamPolicy {
4049 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4050 Self(RequestBuilder::new(stub))
4051 }
4052
4053 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4055 self.0.request = v.into();
4056 self
4057 }
4058
4059 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4061 self.0.options = v.into();
4062 self
4063 }
4064
4065 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4067 (*self.0.stub)
4068 .get_iam_policy(self.0.request, self.0.options)
4069 .await
4070 .map(gax::response::Response::into_body)
4071 }
4072
4073 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4075 self.0.request.resource = v.into();
4076 self
4077 }
4078
4079 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
4081 mut self,
4082 v: T,
4083 ) -> Self {
4084 self.0.request.options = v.into();
4085 self
4086 }
4087 }
4088
4089 #[doc(hidden)]
4090 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4091 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4092 &mut self.0.options
4093 }
4094 }
4095
4096 #[derive(Clone, Debug)]
4098 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4099
4100 impl TestIamPermissions {
4101 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4102 Self(RequestBuilder::new(stub))
4103 }
4104
4105 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4107 mut self,
4108 v: V,
4109 ) -> Self {
4110 self.0.request = v.into();
4111 self
4112 }
4113
4114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4116 self.0.options = v.into();
4117 self
4118 }
4119
4120 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4122 (*self.0.stub)
4123 .test_iam_permissions(self.0.request, self.0.options)
4124 .await
4125 .map(gax::response::Response::into_body)
4126 }
4127
4128 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4130 self.0.request.resource = v.into();
4131 self
4132 }
4133
4134 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4136 where
4137 T: std::iter::IntoIterator<Item = V>,
4138 V: std::convert::Into<std::string::String>,
4139 {
4140 use std::iter::Iterator;
4141 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4142 self
4143 }
4144 }
4145
4146 #[doc(hidden)]
4147 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4148 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4149 &mut self.0.options
4150 }
4151 }
4152
4153 #[derive(Clone, Debug)]
4155 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4156
4157 impl ListOperations {
4158 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4159 Self(RequestBuilder::new(stub))
4160 }
4161
4162 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4164 mut self,
4165 v: V,
4166 ) -> Self {
4167 self.0.request = v.into();
4168 self
4169 }
4170
4171 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4173 self.0.options = v.into();
4174 self
4175 }
4176
4177 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4179 (*self.0.stub)
4180 .list_operations(self.0.request, self.0.options)
4181 .await
4182 .map(gax::response::Response::into_body)
4183 }
4184
4185 pub async fn paginator(
4187 self,
4188 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4189 {
4190 use std::clone::Clone;
4191 let token = self.0.request.page_token.clone();
4192 let execute = move |token: String| {
4193 let mut builder = self.clone();
4194 builder.0.request = builder.0.request.set_page_token(token);
4195 builder.send()
4196 };
4197 gax::paginator::internal::new_paginator(token, execute)
4198 }
4199
4200 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4202 self.0.request.name = v.into();
4203 self
4204 }
4205
4206 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4208 self.0.request.filter = v.into();
4209 self
4210 }
4211
4212 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4214 self.0.request.page_size = v.into();
4215 self
4216 }
4217
4218 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4220 self.0.request.page_token = v.into();
4221 self
4222 }
4223 }
4224
4225 #[doc(hidden)]
4226 impl gax::options::internal::RequestBuilder for ListOperations {
4227 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4228 &mut self.0.options
4229 }
4230 }
4231
4232 #[derive(Clone, Debug)]
4234 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4235
4236 impl GetOperation {
4237 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4238 Self(RequestBuilder::new(stub))
4239 }
4240
4241 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4243 mut self,
4244 v: V,
4245 ) -> Self {
4246 self.0.request = v.into();
4247 self
4248 }
4249
4250 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4252 self.0.options = v.into();
4253 self
4254 }
4255
4256 pub async fn send(self) -> Result<longrunning::model::Operation> {
4258 (*self.0.stub)
4259 .get_operation(self.0.request, self.0.options)
4260 .await
4261 .map(gax::response::Response::into_body)
4262 }
4263
4264 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4266 self.0.request.name = v.into();
4267 self
4268 }
4269 }
4270
4271 #[doc(hidden)]
4272 impl gax::options::internal::RequestBuilder for GetOperation {
4273 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4274 &mut self.0.options
4275 }
4276 }
4277
4278 #[derive(Clone, Debug)]
4280 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4281
4282 impl DeleteOperation {
4283 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4284 Self(RequestBuilder::new(stub))
4285 }
4286
4287 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4289 mut self,
4290 v: V,
4291 ) -> Self {
4292 self.0.request = v.into();
4293 self
4294 }
4295
4296 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4298 self.0.options = v.into();
4299 self
4300 }
4301
4302 pub async fn send(self) -> Result<()> {
4304 (*self.0.stub)
4305 .delete_operation(self.0.request, self.0.options)
4306 .await
4307 .map(gax::response::Response::into_body)
4308 }
4309
4310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4312 self.0.request.name = v.into();
4313 self
4314 }
4315 }
4316
4317 #[doc(hidden)]
4318 impl gax::options::internal::RequestBuilder for DeleteOperation {
4319 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4320 &mut self.0.options
4321 }
4322 }
4323
4324 #[derive(Clone, Debug)]
4326 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4327
4328 impl CancelOperation {
4329 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::NodeGroupController>) -> Self {
4330 Self(RequestBuilder::new(stub))
4331 }
4332
4333 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4335 mut self,
4336 v: V,
4337 ) -> Self {
4338 self.0.request = v.into();
4339 self
4340 }
4341
4342 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4344 self.0.options = v.into();
4345 self
4346 }
4347
4348 pub async fn send(self) -> Result<()> {
4350 (*self.0.stub)
4351 .cancel_operation(self.0.request, self.0.options)
4352 .await
4353 .map(gax::response::Response::into_body)
4354 }
4355
4356 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4358 self.0.request.name = v.into();
4359 self
4360 }
4361 }
4362
4363 #[doc(hidden)]
4364 impl gax::options::internal::RequestBuilder for CancelOperation {
4365 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4366 &mut self.0.options
4367 }
4368 }
4369}
4370
4371pub mod session_template_controller {
4372 use crate::Result;
4373 use std::sync::Arc;
4374
4375 pub type ClientBuilder =
4389 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4390
4391 pub(crate) mod client {
4392 use super::super::super::client::SessionTemplateController;
4393 pub struct Factory;
4394 impl gax::client_builder::internal::ClientFactory for Factory {
4395 type Client = SessionTemplateController;
4396 type Credentials = gaxi::options::Credentials;
4397 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
4398 Self::Client::new(config).await
4399 }
4400 }
4401 }
4402
4403 #[derive(Clone, Debug)]
4405 pub(crate) struct RequestBuilder<R: std::default::Default> {
4406 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4407 request: R,
4408 options: gax::options::RequestOptions,
4409 }
4410
4411 impl<R> RequestBuilder<R>
4412 where
4413 R: std::default::Default,
4414 {
4415 pub(crate) fn new(
4416 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4417 ) -> Self {
4418 Self {
4419 stub,
4420 request: R::default(),
4421 options: gax::options::RequestOptions::default(),
4422 }
4423 }
4424 }
4425
4426 #[derive(Clone, Debug)]
4428 pub struct CreateSessionTemplate(RequestBuilder<crate::model::CreateSessionTemplateRequest>);
4429
4430 impl CreateSessionTemplate {
4431 pub(crate) fn new(
4432 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4433 ) -> Self {
4434 Self(RequestBuilder::new(stub))
4435 }
4436
4437 pub fn with_request<V: Into<crate::model::CreateSessionTemplateRequest>>(
4439 mut self,
4440 v: V,
4441 ) -> Self {
4442 self.0.request = v.into();
4443 self
4444 }
4445
4446 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4448 self.0.options = v.into();
4449 self
4450 }
4451
4452 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
4454 (*self.0.stub)
4455 .create_session_template(self.0.request, self.0.options)
4456 .await
4457 .map(gax::response::Response::into_body)
4458 }
4459
4460 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4462 self.0.request.parent = v.into();
4463 self
4464 }
4465
4466 pub fn set_session_template<T: Into<std::option::Option<crate::model::SessionTemplate>>>(
4468 mut self,
4469 v: T,
4470 ) -> Self {
4471 self.0.request.session_template = v.into();
4472 self
4473 }
4474 }
4475
4476 #[doc(hidden)]
4477 impl gax::options::internal::RequestBuilder for CreateSessionTemplate {
4478 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4479 &mut self.0.options
4480 }
4481 }
4482
4483 #[derive(Clone, Debug)]
4485 pub struct UpdateSessionTemplate(RequestBuilder<crate::model::UpdateSessionTemplateRequest>);
4486
4487 impl UpdateSessionTemplate {
4488 pub(crate) fn new(
4489 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4490 ) -> Self {
4491 Self(RequestBuilder::new(stub))
4492 }
4493
4494 pub fn with_request<V: Into<crate::model::UpdateSessionTemplateRequest>>(
4496 mut self,
4497 v: V,
4498 ) -> Self {
4499 self.0.request = v.into();
4500 self
4501 }
4502
4503 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4505 self.0.options = v.into();
4506 self
4507 }
4508
4509 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
4511 (*self.0.stub)
4512 .update_session_template(self.0.request, self.0.options)
4513 .await
4514 .map(gax::response::Response::into_body)
4515 }
4516
4517 pub fn set_session_template<T: Into<std::option::Option<crate::model::SessionTemplate>>>(
4519 mut self,
4520 v: T,
4521 ) -> Self {
4522 self.0.request.session_template = v.into();
4523 self
4524 }
4525 }
4526
4527 #[doc(hidden)]
4528 impl gax::options::internal::RequestBuilder for UpdateSessionTemplate {
4529 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4530 &mut self.0.options
4531 }
4532 }
4533
4534 #[derive(Clone, Debug)]
4536 pub struct GetSessionTemplate(RequestBuilder<crate::model::GetSessionTemplateRequest>);
4537
4538 impl GetSessionTemplate {
4539 pub(crate) fn new(
4540 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4541 ) -> Self {
4542 Self(RequestBuilder::new(stub))
4543 }
4544
4545 pub fn with_request<V: Into<crate::model::GetSessionTemplateRequest>>(
4547 mut self,
4548 v: V,
4549 ) -> Self {
4550 self.0.request = v.into();
4551 self
4552 }
4553
4554 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4556 self.0.options = v.into();
4557 self
4558 }
4559
4560 pub async fn send(self) -> Result<crate::model::SessionTemplate> {
4562 (*self.0.stub)
4563 .get_session_template(self.0.request, self.0.options)
4564 .await
4565 .map(gax::response::Response::into_body)
4566 }
4567
4568 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4570 self.0.request.name = v.into();
4571 self
4572 }
4573 }
4574
4575 #[doc(hidden)]
4576 impl gax::options::internal::RequestBuilder for GetSessionTemplate {
4577 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4578 &mut self.0.options
4579 }
4580 }
4581
4582 #[derive(Clone, Debug)]
4584 pub struct ListSessionTemplates(RequestBuilder<crate::model::ListSessionTemplatesRequest>);
4585
4586 impl ListSessionTemplates {
4587 pub(crate) fn new(
4588 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4589 ) -> Self {
4590 Self(RequestBuilder::new(stub))
4591 }
4592
4593 pub fn with_request<V: Into<crate::model::ListSessionTemplatesRequest>>(
4595 mut self,
4596 v: V,
4597 ) -> Self {
4598 self.0.request = v.into();
4599 self
4600 }
4601
4602 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4604 self.0.options = v.into();
4605 self
4606 }
4607
4608 pub async fn send(self) -> Result<crate::model::ListSessionTemplatesResponse> {
4610 (*self.0.stub)
4611 .list_session_templates(self.0.request, self.0.options)
4612 .await
4613 .map(gax::response::Response::into_body)
4614 }
4615
4616 pub async fn paginator(
4618 self,
4619 ) -> impl gax::paginator::Paginator<crate::model::ListSessionTemplatesResponse, gax::error::Error>
4620 {
4621 use std::clone::Clone;
4622 let token = self.0.request.page_token.clone();
4623 let execute = move |token: String| {
4624 let mut builder = self.clone();
4625 builder.0.request = builder.0.request.set_page_token(token);
4626 builder.send()
4627 };
4628 gax::paginator::internal::new_paginator(token, execute)
4629 }
4630
4631 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4633 self.0.request.parent = v.into();
4634 self
4635 }
4636
4637 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4639 self.0.request.page_size = v.into();
4640 self
4641 }
4642
4643 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4645 self.0.request.page_token = v.into();
4646 self
4647 }
4648
4649 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4651 self.0.request.filter = v.into();
4652 self
4653 }
4654 }
4655
4656 #[doc(hidden)]
4657 impl gax::options::internal::RequestBuilder for ListSessionTemplates {
4658 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4659 &mut self.0.options
4660 }
4661 }
4662
4663 #[derive(Clone, Debug)]
4665 pub struct DeleteSessionTemplate(RequestBuilder<crate::model::DeleteSessionTemplateRequest>);
4666
4667 impl DeleteSessionTemplate {
4668 pub(crate) fn new(
4669 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4670 ) -> Self {
4671 Self(RequestBuilder::new(stub))
4672 }
4673
4674 pub fn with_request<V: Into<crate::model::DeleteSessionTemplateRequest>>(
4676 mut self,
4677 v: V,
4678 ) -> Self {
4679 self.0.request = v.into();
4680 self
4681 }
4682
4683 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4685 self.0.options = v.into();
4686 self
4687 }
4688
4689 pub async fn send(self) -> Result<()> {
4691 (*self.0.stub)
4692 .delete_session_template(self.0.request, self.0.options)
4693 .await
4694 .map(gax::response::Response::into_body)
4695 }
4696
4697 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4699 self.0.request.name = v.into();
4700 self
4701 }
4702 }
4703
4704 #[doc(hidden)]
4705 impl gax::options::internal::RequestBuilder for DeleteSessionTemplate {
4706 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4707 &mut self.0.options
4708 }
4709 }
4710
4711 #[derive(Clone, Debug)]
4713 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4714
4715 impl SetIamPolicy {
4716 pub(crate) fn new(
4717 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4718 ) -> Self {
4719 Self(RequestBuilder::new(stub))
4720 }
4721
4722 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4724 self.0.request = v.into();
4725 self
4726 }
4727
4728 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4730 self.0.options = v.into();
4731 self
4732 }
4733
4734 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4736 (*self.0.stub)
4737 .set_iam_policy(self.0.request, self.0.options)
4738 .await
4739 .map(gax::response::Response::into_body)
4740 }
4741
4742 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4744 self.0.request.resource = v.into();
4745 self
4746 }
4747
4748 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
4750 mut self,
4751 v: T,
4752 ) -> Self {
4753 self.0.request.policy = v.into();
4754 self
4755 }
4756
4757 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
4759 mut self,
4760 v: T,
4761 ) -> Self {
4762 self.0.request.update_mask = v.into();
4763 self
4764 }
4765 }
4766
4767 #[doc(hidden)]
4768 impl gax::options::internal::RequestBuilder for SetIamPolicy {
4769 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4770 &mut self.0.options
4771 }
4772 }
4773
4774 #[derive(Clone, Debug)]
4776 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
4777
4778 impl GetIamPolicy {
4779 pub(crate) fn new(
4780 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4781 ) -> Self {
4782 Self(RequestBuilder::new(stub))
4783 }
4784
4785 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
4787 self.0.request = v.into();
4788 self
4789 }
4790
4791 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4793 self.0.options = v.into();
4794 self
4795 }
4796
4797 pub async fn send(self) -> Result<iam_v1::model::Policy> {
4799 (*self.0.stub)
4800 .get_iam_policy(self.0.request, self.0.options)
4801 .await
4802 .map(gax::response::Response::into_body)
4803 }
4804
4805 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4807 self.0.request.resource = v.into();
4808 self
4809 }
4810
4811 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
4813 mut self,
4814 v: T,
4815 ) -> Self {
4816 self.0.request.options = v.into();
4817 self
4818 }
4819 }
4820
4821 #[doc(hidden)]
4822 impl gax::options::internal::RequestBuilder for GetIamPolicy {
4823 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4824 &mut self.0.options
4825 }
4826 }
4827
4828 #[derive(Clone, Debug)]
4830 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4831
4832 impl TestIamPermissions {
4833 pub(crate) fn new(
4834 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4835 ) -> Self {
4836 Self(RequestBuilder::new(stub))
4837 }
4838
4839 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4841 mut self,
4842 v: V,
4843 ) -> Self {
4844 self.0.request = v.into();
4845 self
4846 }
4847
4848 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4850 self.0.options = v.into();
4851 self
4852 }
4853
4854 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4856 (*self.0.stub)
4857 .test_iam_permissions(self.0.request, self.0.options)
4858 .await
4859 .map(gax::response::Response::into_body)
4860 }
4861
4862 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4864 self.0.request.resource = v.into();
4865 self
4866 }
4867
4868 pub fn set_permissions<T, V>(mut self, v: T) -> Self
4870 where
4871 T: std::iter::IntoIterator<Item = V>,
4872 V: std::convert::Into<std::string::String>,
4873 {
4874 use std::iter::Iterator;
4875 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4876 self
4877 }
4878 }
4879
4880 #[doc(hidden)]
4881 impl gax::options::internal::RequestBuilder for TestIamPermissions {
4882 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4883 &mut self.0.options
4884 }
4885 }
4886
4887 #[derive(Clone, Debug)]
4889 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4890
4891 impl ListOperations {
4892 pub(crate) fn new(
4893 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4894 ) -> Self {
4895 Self(RequestBuilder::new(stub))
4896 }
4897
4898 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4900 mut self,
4901 v: V,
4902 ) -> Self {
4903 self.0.request = v.into();
4904 self
4905 }
4906
4907 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4909 self.0.options = v.into();
4910 self
4911 }
4912
4913 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4915 (*self.0.stub)
4916 .list_operations(self.0.request, self.0.options)
4917 .await
4918 .map(gax::response::Response::into_body)
4919 }
4920
4921 pub async fn paginator(
4923 self,
4924 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4925 {
4926 use std::clone::Clone;
4927 let token = self.0.request.page_token.clone();
4928 let execute = move |token: String| {
4929 let mut builder = self.clone();
4930 builder.0.request = builder.0.request.set_page_token(token);
4931 builder.send()
4932 };
4933 gax::paginator::internal::new_paginator(token, execute)
4934 }
4935
4936 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4938 self.0.request.name = v.into();
4939 self
4940 }
4941
4942 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4944 self.0.request.filter = v.into();
4945 self
4946 }
4947
4948 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4950 self.0.request.page_size = v.into();
4951 self
4952 }
4953
4954 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4956 self.0.request.page_token = v.into();
4957 self
4958 }
4959 }
4960
4961 #[doc(hidden)]
4962 impl gax::options::internal::RequestBuilder for ListOperations {
4963 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4964 &mut self.0.options
4965 }
4966 }
4967
4968 #[derive(Clone, Debug)]
4970 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4971
4972 impl GetOperation {
4973 pub(crate) fn new(
4974 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
4975 ) -> Self {
4976 Self(RequestBuilder::new(stub))
4977 }
4978
4979 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4981 mut self,
4982 v: V,
4983 ) -> Self {
4984 self.0.request = v.into();
4985 self
4986 }
4987
4988 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4990 self.0.options = v.into();
4991 self
4992 }
4993
4994 pub async fn send(self) -> Result<longrunning::model::Operation> {
4996 (*self.0.stub)
4997 .get_operation(self.0.request, self.0.options)
4998 .await
4999 .map(gax::response::Response::into_body)
5000 }
5001
5002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5004 self.0.request.name = v.into();
5005 self
5006 }
5007 }
5008
5009 #[doc(hidden)]
5010 impl gax::options::internal::RequestBuilder for GetOperation {
5011 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5012 &mut self.0.options
5013 }
5014 }
5015
5016 #[derive(Clone, Debug)]
5018 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5019
5020 impl DeleteOperation {
5021 pub(crate) fn new(
5022 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
5023 ) -> Self {
5024 Self(RequestBuilder::new(stub))
5025 }
5026
5027 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5029 mut self,
5030 v: V,
5031 ) -> Self {
5032 self.0.request = v.into();
5033 self
5034 }
5035
5036 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5038 self.0.options = v.into();
5039 self
5040 }
5041
5042 pub async fn send(self) -> Result<()> {
5044 (*self.0.stub)
5045 .delete_operation(self.0.request, self.0.options)
5046 .await
5047 .map(gax::response::Response::into_body)
5048 }
5049
5050 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5052 self.0.request.name = v.into();
5053 self
5054 }
5055 }
5056
5057 #[doc(hidden)]
5058 impl gax::options::internal::RequestBuilder for DeleteOperation {
5059 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5060 &mut self.0.options
5061 }
5062 }
5063
5064 #[derive(Clone, Debug)]
5066 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5067
5068 impl CancelOperation {
5069 pub(crate) fn new(
5070 stub: Arc<dyn super::super::stub::dynamic::SessionTemplateController>,
5071 ) -> Self {
5072 Self(RequestBuilder::new(stub))
5073 }
5074
5075 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5077 mut self,
5078 v: V,
5079 ) -> Self {
5080 self.0.request = v.into();
5081 self
5082 }
5083
5084 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5086 self.0.options = v.into();
5087 self
5088 }
5089
5090 pub async fn send(self) -> Result<()> {
5092 (*self.0.stub)
5093 .cancel_operation(self.0.request, self.0.options)
5094 .await
5095 .map(gax::response::Response::into_body)
5096 }
5097
5098 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5100 self.0.request.name = v.into();
5101 self
5102 }
5103 }
5104
5105 #[doc(hidden)]
5106 impl gax::options::internal::RequestBuilder for CancelOperation {
5107 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5108 &mut self.0.options
5109 }
5110 }
5111}
5112
5113pub mod session_controller {
5114 use crate::Result;
5115 use std::sync::Arc;
5116
5117 pub type ClientBuilder =
5131 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5132
5133 pub(crate) mod client {
5134 use super::super::super::client::SessionController;
5135 pub struct Factory;
5136 impl gax::client_builder::internal::ClientFactory for Factory {
5137 type Client = SessionController;
5138 type Credentials = gaxi::options::Credentials;
5139 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
5140 Self::Client::new(config).await
5141 }
5142 }
5143 }
5144
5145 #[derive(Clone, Debug)]
5147 pub(crate) struct RequestBuilder<R: std::default::Default> {
5148 stub: Arc<dyn super::super::stub::dynamic::SessionController>,
5149 request: R,
5150 options: gax::options::RequestOptions,
5151 }
5152
5153 impl<R> RequestBuilder<R>
5154 where
5155 R: std::default::Default,
5156 {
5157 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5158 Self {
5159 stub,
5160 request: R::default(),
5161 options: gax::options::RequestOptions::default(),
5162 }
5163 }
5164 }
5165
5166 #[derive(Clone, Debug)]
5168 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
5169
5170 impl CreateSession {
5171 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5172 Self(RequestBuilder::new(stub))
5173 }
5174
5175 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
5177 self.0.request = v.into();
5178 self
5179 }
5180
5181 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5183 self.0.options = v.into();
5184 self
5185 }
5186
5187 pub async fn send(self) -> Result<longrunning::model::Operation> {
5194 (*self.0.stub)
5195 .create_session(self.0.request, self.0.options)
5196 .await
5197 .map(gax::response::Response::into_body)
5198 }
5199
5200 pub fn poller(
5202 self,
5203 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
5204 {
5205 type Operation =
5206 lro::Operation<crate::model::Session, crate::model::SessionOperationMetadata>;
5207 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5208 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5209
5210 let stub = self.0.stub.clone();
5211 let mut options = self.0.options.clone();
5212 options.set_retry_policy(gax::retry_policy::NeverRetry);
5213 let query = move |name| {
5214 let stub = stub.clone();
5215 let options = options.clone();
5216 async {
5217 let op = GetOperation::new(stub)
5218 .set_name(name)
5219 .with_options(options)
5220 .send()
5221 .await?;
5222 Ok(Operation::new(op))
5223 }
5224 };
5225
5226 let start = move || async {
5227 let op = self.send().await?;
5228 Ok(Operation::new(op))
5229 };
5230
5231 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5232 }
5233
5234 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5236 self.0.request.parent = v.into();
5237 self
5238 }
5239
5240 pub fn set_session<T: Into<std::option::Option<crate::model::Session>>>(
5242 mut self,
5243 v: T,
5244 ) -> Self {
5245 self.0.request.session = v.into();
5246 self
5247 }
5248
5249 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5251 self.0.request.session_id = v.into();
5252 self
5253 }
5254
5255 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5257 self.0.request.request_id = v.into();
5258 self
5259 }
5260 }
5261
5262 #[doc(hidden)]
5263 impl gax::options::internal::RequestBuilder for CreateSession {
5264 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5265 &mut self.0.options
5266 }
5267 }
5268
5269 #[derive(Clone, Debug)]
5271 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
5272
5273 impl GetSession {
5274 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5275 Self(RequestBuilder::new(stub))
5276 }
5277
5278 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
5280 self.0.request = v.into();
5281 self
5282 }
5283
5284 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5286 self.0.options = v.into();
5287 self
5288 }
5289
5290 pub async fn send(self) -> Result<crate::model::Session> {
5292 (*self.0.stub)
5293 .get_session(self.0.request, self.0.options)
5294 .await
5295 .map(gax::response::Response::into_body)
5296 }
5297
5298 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5300 self.0.request.name = v.into();
5301 self
5302 }
5303 }
5304
5305 #[doc(hidden)]
5306 impl gax::options::internal::RequestBuilder for GetSession {
5307 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5308 &mut self.0.options
5309 }
5310 }
5311
5312 #[derive(Clone, Debug)]
5314 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
5315
5316 impl ListSessions {
5317 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5318 Self(RequestBuilder::new(stub))
5319 }
5320
5321 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
5323 self.0.request = v.into();
5324 self
5325 }
5326
5327 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5329 self.0.options = v.into();
5330 self
5331 }
5332
5333 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
5335 (*self.0.stub)
5336 .list_sessions(self.0.request, self.0.options)
5337 .await
5338 .map(gax::response::Response::into_body)
5339 }
5340
5341 pub async fn paginator(
5343 self,
5344 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
5345 {
5346 use std::clone::Clone;
5347 let token = self.0.request.page_token.clone();
5348 let execute = move |token: String| {
5349 let mut builder = self.clone();
5350 builder.0.request = builder.0.request.set_page_token(token);
5351 builder.send()
5352 };
5353 gax::paginator::internal::new_paginator(token, execute)
5354 }
5355
5356 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5358 self.0.request.parent = v.into();
5359 self
5360 }
5361
5362 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5364 self.0.request.page_size = v.into();
5365 self
5366 }
5367
5368 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5370 self.0.request.page_token = v.into();
5371 self
5372 }
5373
5374 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5376 self.0.request.filter = v.into();
5377 self
5378 }
5379 }
5380
5381 #[doc(hidden)]
5382 impl gax::options::internal::RequestBuilder for ListSessions {
5383 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5384 &mut self.0.options
5385 }
5386 }
5387
5388 #[derive(Clone, Debug)]
5390 pub struct TerminateSession(RequestBuilder<crate::model::TerminateSessionRequest>);
5391
5392 impl TerminateSession {
5393 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5394 Self(RequestBuilder::new(stub))
5395 }
5396
5397 pub fn with_request<V: Into<crate::model::TerminateSessionRequest>>(
5399 mut self,
5400 v: V,
5401 ) -> Self {
5402 self.0.request = v.into();
5403 self
5404 }
5405
5406 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5408 self.0.options = v.into();
5409 self
5410 }
5411
5412 pub async fn send(self) -> Result<longrunning::model::Operation> {
5419 (*self.0.stub)
5420 .terminate_session(self.0.request, self.0.options)
5421 .await
5422 .map(gax::response::Response::into_body)
5423 }
5424
5425 pub fn poller(
5427 self,
5428 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
5429 {
5430 type Operation =
5431 lro::Operation<crate::model::Session, crate::model::SessionOperationMetadata>;
5432 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5433 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5434
5435 let stub = self.0.stub.clone();
5436 let mut options = self.0.options.clone();
5437 options.set_retry_policy(gax::retry_policy::NeverRetry);
5438 let query = move |name| {
5439 let stub = stub.clone();
5440 let options = options.clone();
5441 async {
5442 let op = GetOperation::new(stub)
5443 .set_name(name)
5444 .with_options(options)
5445 .send()
5446 .await?;
5447 Ok(Operation::new(op))
5448 }
5449 };
5450
5451 let start = move || async {
5452 let op = self.send().await?;
5453 Ok(Operation::new(op))
5454 };
5455
5456 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5457 }
5458
5459 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5461 self.0.request.name = v.into();
5462 self
5463 }
5464
5465 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5467 self.0.request.request_id = v.into();
5468 self
5469 }
5470 }
5471
5472 #[doc(hidden)]
5473 impl gax::options::internal::RequestBuilder for TerminateSession {
5474 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5475 &mut self.0.options
5476 }
5477 }
5478
5479 #[derive(Clone, Debug)]
5481 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
5482
5483 impl DeleteSession {
5484 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5485 Self(RequestBuilder::new(stub))
5486 }
5487
5488 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
5490 self.0.request = v.into();
5491 self
5492 }
5493
5494 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5496 self.0.options = v.into();
5497 self
5498 }
5499
5500 pub async fn send(self) -> Result<longrunning::model::Operation> {
5507 (*self.0.stub)
5508 .delete_session(self.0.request, self.0.options)
5509 .await
5510 .map(gax::response::Response::into_body)
5511 }
5512
5513 pub fn poller(
5515 self,
5516 ) -> impl lro::Poller<crate::model::Session, crate::model::SessionOperationMetadata>
5517 {
5518 type Operation =
5519 lro::Operation<crate::model::Session, crate::model::SessionOperationMetadata>;
5520 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5521 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5522
5523 let stub = self.0.stub.clone();
5524 let mut options = self.0.options.clone();
5525 options.set_retry_policy(gax::retry_policy::NeverRetry);
5526 let query = move |name| {
5527 let stub = stub.clone();
5528 let options = options.clone();
5529 async {
5530 let op = GetOperation::new(stub)
5531 .set_name(name)
5532 .with_options(options)
5533 .send()
5534 .await?;
5535 Ok(Operation::new(op))
5536 }
5537 };
5538
5539 let start = move || async {
5540 let op = self.send().await?;
5541 Ok(Operation::new(op))
5542 };
5543
5544 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5545 }
5546
5547 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5549 self.0.request.name = v.into();
5550 self
5551 }
5552
5553 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5555 self.0.request.request_id = v.into();
5556 self
5557 }
5558 }
5559
5560 #[doc(hidden)]
5561 impl gax::options::internal::RequestBuilder for DeleteSession {
5562 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5563 &mut self.0.options
5564 }
5565 }
5566
5567 #[derive(Clone, Debug)]
5569 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5570
5571 impl SetIamPolicy {
5572 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5573 Self(RequestBuilder::new(stub))
5574 }
5575
5576 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5578 self.0.request = v.into();
5579 self
5580 }
5581
5582 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5584 self.0.options = v.into();
5585 self
5586 }
5587
5588 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5590 (*self.0.stub)
5591 .set_iam_policy(self.0.request, self.0.options)
5592 .await
5593 .map(gax::response::Response::into_body)
5594 }
5595
5596 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5598 self.0.request.resource = v.into();
5599 self
5600 }
5601
5602 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
5604 mut self,
5605 v: T,
5606 ) -> Self {
5607 self.0.request.policy = v.into();
5608 self
5609 }
5610
5611 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
5613 mut self,
5614 v: T,
5615 ) -> Self {
5616 self.0.request.update_mask = v.into();
5617 self
5618 }
5619 }
5620
5621 #[doc(hidden)]
5622 impl gax::options::internal::RequestBuilder for SetIamPolicy {
5623 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5624 &mut self.0.options
5625 }
5626 }
5627
5628 #[derive(Clone, Debug)]
5630 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5631
5632 impl GetIamPolicy {
5633 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5634 Self(RequestBuilder::new(stub))
5635 }
5636
5637 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5639 self.0.request = v.into();
5640 self
5641 }
5642
5643 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5645 self.0.options = v.into();
5646 self
5647 }
5648
5649 pub async fn send(self) -> Result<iam_v1::model::Policy> {
5651 (*self.0.stub)
5652 .get_iam_policy(self.0.request, self.0.options)
5653 .await
5654 .map(gax::response::Response::into_body)
5655 }
5656
5657 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5659 self.0.request.resource = v.into();
5660 self
5661 }
5662
5663 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
5665 mut self,
5666 v: T,
5667 ) -> Self {
5668 self.0.request.options = v.into();
5669 self
5670 }
5671 }
5672
5673 #[doc(hidden)]
5674 impl gax::options::internal::RequestBuilder for GetIamPolicy {
5675 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5676 &mut self.0.options
5677 }
5678 }
5679
5680 #[derive(Clone, Debug)]
5682 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5683
5684 impl TestIamPermissions {
5685 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5686 Self(RequestBuilder::new(stub))
5687 }
5688
5689 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5691 mut self,
5692 v: V,
5693 ) -> Self {
5694 self.0.request = v.into();
5695 self
5696 }
5697
5698 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5700 self.0.options = v.into();
5701 self
5702 }
5703
5704 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5706 (*self.0.stub)
5707 .test_iam_permissions(self.0.request, self.0.options)
5708 .await
5709 .map(gax::response::Response::into_body)
5710 }
5711
5712 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5714 self.0.request.resource = v.into();
5715 self
5716 }
5717
5718 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5720 where
5721 T: std::iter::IntoIterator<Item = V>,
5722 V: std::convert::Into<std::string::String>,
5723 {
5724 use std::iter::Iterator;
5725 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5726 self
5727 }
5728 }
5729
5730 #[doc(hidden)]
5731 impl gax::options::internal::RequestBuilder for TestIamPermissions {
5732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5733 &mut self.0.options
5734 }
5735 }
5736
5737 #[derive(Clone, Debug)]
5739 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5740
5741 impl ListOperations {
5742 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5743 Self(RequestBuilder::new(stub))
5744 }
5745
5746 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5748 mut self,
5749 v: V,
5750 ) -> Self {
5751 self.0.request = v.into();
5752 self
5753 }
5754
5755 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5757 self.0.options = v.into();
5758 self
5759 }
5760
5761 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5763 (*self.0.stub)
5764 .list_operations(self.0.request, self.0.options)
5765 .await
5766 .map(gax::response::Response::into_body)
5767 }
5768
5769 pub async fn paginator(
5771 self,
5772 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5773 {
5774 use std::clone::Clone;
5775 let token = self.0.request.page_token.clone();
5776 let execute = move |token: String| {
5777 let mut builder = self.clone();
5778 builder.0.request = builder.0.request.set_page_token(token);
5779 builder.send()
5780 };
5781 gax::paginator::internal::new_paginator(token, execute)
5782 }
5783
5784 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5786 self.0.request.name = v.into();
5787 self
5788 }
5789
5790 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5792 self.0.request.filter = v.into();
5793 self
5794 }
5795
5796 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5798 self.0.request.page_size = v.into();
5799 self
5800 }
5801
5802 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5804 self.0.request.page_token = v.into();
5805 self
5806 }
5807 }
5808
5809 #[doc(hidden)]
5810 impl gax::options::internal::RequestBuilder for ListOperations {
5811 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5812 &mut self.0.options
5813 }
5814 }
5815
5816 #[derive(Clone, Debug)]
5818 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5819
5820 impl GetOperation {
5821 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5822 Self(RequestBuilder::new(stub))
5823 }
5824
5825 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5827 mut self,
5828 v: V,
5829 ) -> Self {
5830 self.0.request = v.into();
5831 self
5832 }
5833
5834 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5836 self.0.options = v.into();
5837 self
5838 }
5839
5840 pub async fn send(self) -> Result<longrunning::model::Operation> {
5842 (*self.0.stub)
5843 .get_operation(self.0.request, self.0.options)
5844 .await
5845 .map(gax::response::Response::into_body)
5846 }
5847
5848 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5850 self.0.request.name = v.into();
5851 self
5852 }
5853 }
5854
5855 #[doc(hidden)]
5856 impl gax::options::internal::RequestBuilder for GetOperation {
5857 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5858 &mut self.0.options
5859 }
5860 }
5861
5862 #[derive(Clone, Debug)]
5864 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
5865
5866 impl DeleteOperation {
5867 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5868 Self(RequestBuilder::new(stub))
5869 }
5870
5871 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
5873 mut self,
5874 v: V,
5875 ) -> Self {
5876 self.0.request = v.into();
5877 self
5878 }
5879
5880 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5882 self.0.options = v.into();
5883 self
5884 }
5885
5886 pub async fn send(self) -> Result<()> {
5888 (*self.0.stub)
5889 .delete_operation(self.0.request, self.0.options)
5890 .await
5891 .map(gax::response::Response::into_body)
5892 }
5893
5894 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5896 self.0.request.name = v.into();
5897 self
5898 }
5899 }
5900
5901 #[doc(hidden)]
5902 impl gax::options::internal::RequestBuilder for DeleteOperation {
5903 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5904 &mut self.0.options
5905 }
5906 }
5907
5908 #[derive(Clone, Debug)]
5910 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5911
5912 impl CancelOperation {
5913 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::SessionController>) -> Self {
5914 Self(RequestBuilder::new(stub))
5915 }
5916
5917 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5919 mut self,
5920 v: V,
5921 ) -> Self {
5922 self.0.request = v.into();
5923 self
5924 }
5925
5926 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5928 self.0.options = v.into();
5929 self
5930 }
5931
5932 pub async fn send(self) -> Result<()> {
5934 (*self.0.stub)
5935 .cancel_operation(self.0.request, self.0.options)
5936 .await
5937 .map(gax::response::Response::into_body)
5938 }
5939
5940 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5942 self.0.request.name = v.into();
5943 self
5944 }
5945 }
5946
5947 #[doc(hidden)]
5948 impl gax::options::internal::RequestBuilder for CancelOperation {
5949 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5950 &mut self.0.options
5951 }
5952 }
5953}
5954
5955pub mod workflow_template_service {
5956 use crate::Result;
5957 use std::sync::Arc;
5958
5959 pub type ClientBuilder =
5973 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5974
5975 pub(crate) mod client {
5976 use super::super::super::client::WorkflowTemplateService;
5977 pub struct Factory;
5978 impl gax::client_builder::internal::ClientFactory for Factory {
5979 type Client = WorkflowTemplateService;
5980 type Credentials = gaxi::options::Credentials;
5981 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
5982 Self::Client::new(config).await
5983 }
5984 }
5985 }
5986
5987 #[derive(Clone, Debug)]
5989 pub(crate) struct RequestBuilder<R: std::default::Default> {
5990 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
5991 request: R,
5992 options: gax::options::RequestOptions,
5993 }
5994
5995 impl<R> RequestBuilder<R>
5996 where
5997 R: std::default::Default,
5998 {
5999 pub(crate) fn new(
6000 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6001 ) -> Self {
6002 Self {
6003 stub,
6004 request: R::default(),
6005 options: gax::options::RequestOptions::default(),
6006 }
6007 }
6008 }
6009
6010 #[derive(Clone, Debug)]
6012 pub struct CreateWorkflowTemplate(RequestBuilder<crate::model::CreateWorkflowTemplateRequest>);
6013
6014 impl CreateWorkflowTemplate {
6015 pub(crate) fn new(
6016 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6017 ) -> Self {
6018 Self(RequestBuilder::new(stub))
6019 }
6020
6021 pub fn with_request<V: Into<crate::model::CreateWorkflowTemplateRequest>>(
6023 mut self,
6024 v: V,
6025 ) -> Self {
6026 self.0.request = v.into();
6027 self
6028 }
6029
6030 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6032 self.0.options = v.into();
6033 self
6034 }
6035
6036 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
6038 (*self.0.stub)
6039 .create_workflow_template(self.0.request, self.0.options)
6040 .await
6041 .map(gax::response::Response::into_body)
6042 }
6043
6044 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6046 self.0.request.parent = v.into();
6047 self
6048 }
6049
6050 pub fn set_template<T: Into<std::option::Option<crate::model::WorkflowTemplate>>>(
6052 mut self,
6053 v: T,
6054 ) -> Self {
6055 self.0.request.template = v.into();
6056 self
6057 }
6058 }
6059
6060 #[doc(hidden)]
6061 impl gax::options::internal::RequestBuilder for CreateWorkflowTemplate {
6062 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6063 &mut self.0.options
6064 }
6065 }
6066
6067 #[derive(Clone, Debug)]
6069 pub struct GetWorkflowTemplate(RequestBuilder<crate::model::GetWorkflowTemplateRequest>);
6070
6071 impl GetWorkflowTemplate {
6072 pub(crate) fn new(
6073 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6074 ) -> Self {
6075 Self(RequestBuilder::new(stub))
6076 }
6077
6078 pub fn with_request<V: Into<crate::model::GetWorkflowTemplateRequest>>(
6080 mut self,
6081 v: V,
6082 ) -> Self {
6083 self.0.request = v.into();
6084 self
6085 }
6086
6087 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6089 self.0.options = v.into();
6090 self
6091 }
6092
6093 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
6095 (*self.0.stub)
6096 .get_workflow_template(self.0.request, self.0.options)
6097 .await
6098 .map(gax::response::Response::into_body)
6099 }
6100
6101 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6103 self.0.request.name = v.into();
6104 self
6105 }
6106
6107 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
6109 self.0.request.version = v.into();
6110 self
6111 }
6112 }
6113
6114 #[doc(hidden)]
6115 impl gax::options::internal::RequestBuilder for GetWorkflowTemplate {
6116 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6117 &mut self.0.options
6118 }
6119 }
6120
6121 #[derive(Clone, Debug)]
6123 pub struct InstantiateWorkflowTemplate(
6124 RequestBuilder<crate::model::InstantiateWorkflowTemplateRequest>,
6125 );
6126
6127 impl InstantiateWorkflowTemplate {
6128 pub(crate) fn new(
6129 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6130 ) -> Self {
6131 Self(RequestBuilder::new(stub))
6132 }
6133
6134 pub fn with_request<V: Into<crate::model::InstantiateWorkflowTemplateRequest>>(
6136 mut self,
6137 v: V,
6138 ) -> Self {
6139 self.0.request = v.into();
6140 self
6141 }
6142
6143 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6145 self.0.options = v.into();
6146 self
6147 }
6148
6149 pub async fn send(self) -> Result<longrunning::model::Operation> {
6156 (*self.0.stub)
6157 .instantiate_workflow_template(self.0.request, self.0.options)
6158 .await
6159 .map(gax::response::Response::into_body)
6160 }
6161
6162 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::WorkflowMetadata> {
6164 type Operation = lro::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
6165 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6166 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6167
6168 let stub = self.0.stub.clone();
6169 let mut options = self.0.options.clone();
6170 options.set_retry_policy(gax::retry_policy::NeverRetry);
6171 let query = move |name| {
6172 let stub = stub.clone();
6173 let options = options.clone();
6174 async {
6175 let op = GetOperation::new(stub)
6176 .set_name(name)
6177 .with_options(options)
6178 .send()
6179 .await?;
6180 Ok(Operation::new(op))
6181 }
6182 };
6183
6184 let start = move || async {
6185 let op = self.send().await?;
6186 Ok(Operation::new(op))
6187 };
6188
6189 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6190 }
6191
6192 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6194 self.0.request.name = v.into();
6195 self
6196 }
6197
6198 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
6200 self.0.request.version = v.into();
6201 self
6202 }
6203
6204 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6206 self.0.request.request_id = v.into();
6207 self
6208 }
6209
6210 pub fn set_parameters<T, K, V>(mut self, v: T) -> Self
6212 where
6213 T: std::iter::IntoIterator<Item = (K, V)>,
6214 K: std::convert::Into<std::string::String>,
6215 V: std::convert::Into<std::string::String>,
6216 {
6217 self.0.request.parameters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6218 self
6219 }
6220 }
6221
6222 #[doc(hidden)]
6223 impl gax::options::internal::RequestBuilder for InstantiateWorkflowTemplate {
6224 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6225 &mut self.0.options
6226 }
6227 }
6228
6229 #[derive(Clone, Debug)]
6231 pub struct InstantiateInlineWorkflowTemplate(
6232 RequestBuilder<crate::model::InstantiateInlineWorkflowTemplateRequest>,
6233 );
6234
6235 impl InstantiateInlineWorkflowTemplate {
6236 pub(crate) fn new(
6237 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6238 ) -> Self {
6239 Self(RequestBuilder::new(stub))
6240 }
6241
6242 pub fn with_request<V: Into<crate::model::InstantiateInlineWorkflowTemplateRequest>>(
6244 mut self,
6245 v: V,
6246 ) -> Self {
6247 self.0.request = v.into();
6248 self
6249 }
6250
6251 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6253 self.0.options = v.into();
6254 self
6255 }
6256
6257 pub async fn send(self) -> Result<longrunning::model::Operation> {
6264 (*self.0.stub)
6265 .instantiate_inline_workflow_template(self.0.request, self.0.options)
6266 .await
6267 .map(gax::response::Response::into_body)
6268 }
6269
6270 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::WorkflowMetadata> {
6272 type Operation = lro::Operation<wkt::Empty, crate::model::WorkflowMetadata>;
6273 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6274 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6275
6276 let stub = self.0.stub.clone();
6277 let mut options = self.0.options.clone();
6278 options.set_retry_policy(gax::retry_policy::NeverRetry);
6279 let query = move |name| {
6280 let stub = stub.clone();
6281 let options = options.clone();
6282 async {
6283 let op = GetOperation::new(stub)
6284 .set_name(name)
6285 .with_options(options)
6286 .send()
6287 .await?;
6288 Ok(Operation::new(op))
6289 }
6290 };
6291
6292 let start = move || async {
6293 let op = self.send().await?;
6294 Ok(Operation::new(op))
6295 };
6296
6297 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6298 }
6299
6300 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6302 self.0.request.parent = v.into();
6303 self
6304 }
6305
6306 pub fn set_template<T: Into<std::option::Option<crate::model::WorkflowTemplate>>>(
6308 mut self,
6309 v: T,
6310 ) -> Self {
6311 self.0.request.template = v.into();
6312 self
6313 }
6314
6315 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6317 self.0.request.request_id = v.into();
6318 self
6319 }
6320 }
6321
6322 #[doc(hidden)]
6323 impl gax::options::internal::RequestBuilder for InstantiateInlineWorkflowTemplate {
6324 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6325 &mut self.0.options
6326 }
6327 }
6328
6329 #[derive(Clone, Debug)]
6331 pub struct UpdateWorkflowTemplate(RequestBuilder<crate::model::UpdateWorkflowTemplateRequest>);
6332
6333 impl UpdateWorkflowTemplate {
6334 pub(crate) fn new(
6335 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6336 ) -> Self {
6337 Self(RequestBuilder::new(stub))
6338 }
6339
6340 pub fn with_request<V: Into<crate::model::UpdateWorkflowTemplateRequest>>(
6342 mut self,
6343 v: V,
6344 ) -> Self {
6345 self.0.request = v.into();
6346 self
6347 }
6348
6349 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6351 self.0.options = v.into();
6352 self
6353 }
6354
6355 pub async fn send(self) -> Result<crate::model::WorkflowTemplate> {
6357 (*self.0.stub)
6358 .update_workflow_template(self.0.request, self.0.options)
6359 .await
6360 .map(gax::response::Response::into_body)
6361 }
6362
6363 pub fn set_template<T: Into<std::option::Option<crate::model::WorkflowTemplate>>>(
6365 mut self,
6366 v: T,
6367 ) -> Self {
6368 self.0.request.template = v.into();
6369 self
6370 }
6371 }
6372
6373 #[doc(hidden)]
6374 impl gax::options::internal::RequestBuilder for UpdateWorkflowTemplate {
6375 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6376 &mut self.0.options
6377 }
6378 }
6379
6380 #[derive(Clone, Debug)]
6382 pub struct ListWorkflowTemplates(RequestBuilder<crate::model::ListWorkflowTemplatesRequest>);
6383
6384 impl ListWorkflowTemplates {
6385 pub(crate) fn new(
6386 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6387 ) -> Self {
6388 Self(RequestBuilder::new(stub))
6389 }
6390
6391 pub fn with_request<V: Into<crate::model::ListWorkflowTemplatesRequest>>(
6393 mut self,
6394 v: V,
6395 ) -> Self {
6396 self.0.request = v.into();
6397 self
6398 }
6399
6400 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6402 self.0.options = v.into();
6403 self
6404 }
6405
6406 pub async fn send(self) -> Result<crate::model::ListWorkflowTemplatesResponse> {
6408 (*self.0.stub)
6409 .list_workflow_templates(self.0.request, self.0.options)
6410 .await
6411 .map(gax::response::Response::into_body)
6412 }
6413
6414 pub async fn paginator(
6416 self,
6417 ) -> impl gax::paginator::Paginator<crate::model::ListWorkflowTemplatesResponse, gax::error::Error>
6418 {
6419 use std::clone::Clone;
6420 let token = self.0.request.page_token.clone();
6421 let execute = move |token: String| {
6422 let mut builder = self.clone();
6423 builder.0.request = builder.0.request.set_page_token(token);
6424 builder.send()
6425 };
6426 gax::paginator::internal::new_paginator(token, execute)
6427 }
6428
6429 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6431 self.0.request.parent = v.into();
6432 self
6433 }
6434
6435 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6437 self.0.request.page_size = v.into();
6438 self
6439 }
6440
6441 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6443 self.0.request.page_token = v.into();
6444 self
6445 }
6446 }
6447
6448 #[doc(hidden)]
6449 impl gax::options::internal::RequestBuilder for ListWorkflowTemplates {
6450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6451 &mut self.0.options
6452 }
6453 }
6454
6455 #[derive(Clone, Debug)]
6457 pub struct DeleteWorkflowTemplate(RequestBuilder<crate::model::DeleteWorkflowTemplateRequest>);
6458
6459 impl DeleteWorkflowTemplate {
6460 pub(crate) fn new(
6461 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6462 ) -> Self {
6463 Self(RequestBuilder::new(stub))
6464 }
6465
6466 pub fn with_request<V: Into<crate::model::DeleteWorkflowTemplateRequest>>(
6468 mut self,
6469 v: V,
6470 ) -> Self {
6471 self.0.request = v.into();
6472 self
6473 }
6474
6475 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6477 self.0.options = v.into();
6478 self
6479 }
6480
6481 pub async fn send(self) -> Result<()> {
6483 (*self.0.stub)
6484 .delete_workflow_template(self.0.request, self.0.options)
6485 .await
6486 .map(gax::response::Response::into_body)
6487 }
6488
6489 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6491 self.0.request.name = v.into();
6492 self
6493 }
6494
6495 pub fn set_version<T: Into<i32>>(mut self, v: T) -> Self {
6497 self.0.request.version = v.into();
6498 self
6499 }
6500 }
6501
6502 #[doc(hidden)]
6503 impl gax::options::internal::RequestBuilder for DeleteWorkflowTemplate {
6504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6505 &mut self.0.options
6506 }
6507 }
6508
6509 #[derive(Clone, Debug)]
6511 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
6512
6513 impl SetIamPolicy {
6514 pub(crate) fn new(
6515 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6516 ) -> Self {
6517 Self(RequestBuilder::new(stub))
6518 }
6519
6520 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
6522 self.0.request = v.into();
6523 self
6524 }
6525
6526 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6528 self.0.options = v.into();
6529 self
6530 }
6531
6532 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6534 (*self.0.stub)
6535 .set_iam_policy(self.0.request, self.0.options)
6536 .await
6537 .map(gax::response::Response::into_body)
6538 }
6539
6540 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6542 self.0.request.resource = v.into();
6543 self
6544 }
6545
6546 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
6548 mut self,
6549 v: T,
6550 ) -> Self {
6551 self.0.request.policy = v.into();
6552 self
6553 }
6554
6555 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
6557 mut self,
6558 v: T,
6559 ) -> Self {
6560 self.0.request.update_mask = v.into();
6561 self
6562 }
6563 }
6564
6565 #[doc(hidden)]
6566 impl gax::options::internal::RequestBuilder for SetIamPolicy {
6567 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6568 &mut self.0.options
6569 }
6570 }
6571
6572 #[derive(Clone, Debug)]
6574 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
6575
6576 impl GetIamPolicy {
6577 pub(crate) fn new(
6578 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6579 ) -> Self {
6580 Self(RequestBuilder::new(stub))
6581 }
6582
6583 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
6585 self.0.request = v.into();
6586 self
6587 }
6588
6589 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6591 self.0.options = v.into();
6592 self
6593 }
6594
6595 pub async fn send(self) -> Result<iam_v1::model::Policy> {
6597 (*self.0.stub)
6598 .get_iam_policy(self.0.request, self.0.options)
6599 .await
6600 .map(gax::response::Response::into_body)
6601 }
6602
6603 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6605 self.0.request.resource = v.into();
6606 self
6607 }
6608
6609 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
6611 mut self,
6612 v: T,
6613 ) -> Self {
6614 self.0.request.options = v.into();
6615 self
6616 }
6617 }
6618
6619 #[doc(hidden)]
6620 impl gax::options::internal::RequestBuilder for GetIamPolicy {
6621 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6622 &mut self.0.options
6623 }
6624 }
6625
6626 #[derive(Clone, Debug)]
6628 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
6629
6630 impl TestIamPermissions {
6631 pub(crate) fn new(
6632 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6633 ) -> Self {
6634 Self(RequestBuilder::new(stub))
6635 }
6636
6637 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6639 mut self,
6640 v: V,
6641 ) -> Self {
6642 self.0.request = v.into();
6643 self
6644 }
6645
6646 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6648 self.0.options = v.into();
6649 self
6650 }
6651
6652 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6654 (*self.0.stub)
6655 .test_iam_permissions(self.0.request, self.0.options)
6656 .await
6657 .map(gax::response::Response::into_body)
6658 }
6659
6660 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6662 self.0.request.resource = v.into();
6663 self
6664 }
6665
6666 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6668 where
6669 T: std::iter::IntoIterator<Item = V>,
6670 V: std::convert::Into<std::string::String>,
6671 {
6672 use std::iter::Iterator;
6673 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6674 self
6675 }
6676 }
6677
6678 #[doc(hidden)]
6679 impl gax::options::internal::RequestBuilder for TestIamPermissions {
6680 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6681 &mut self.0.options
6682 }
6683 }
6684
6685 #[derive(Clone, Debug)]
6687 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6688
6689 impl ListOperations {
6690 pub(crate) fn new(
6691 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6692 ) -> Self {
6693 Self(RequestBuilder::new(stub))
6694 }
6695
6696 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6698 mut self,
6699 v: V,
6700 ) -> Self {
6701 self.0.request = v.into();
6702 self
6703 }
6704
6705 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6707 self.0.options = v.into();
6708 self
6709 }
6710
6711 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6713 (*self.0.stub)
6714 .list_operations(self.0.request, self.0.options)
6715 .await
6716 .map(gax::response::Response::into_body)
6717 }
6718
6719 pub async fn paginator(
6721 self,
6722 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6723 {
6724 use std::clone::Clone;
6725 let token = self.0.request.page_token.clone();
6726 let execute = move |token: String| {
6727 let mut builder = self.clone();
6728 builder.0.request = builder.0.request.set_page_token(token);
6729 builder.send()
6730 };
6731 gax::paginator::internal::new_paginator(token, execute)
6732 }
6733
6734 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6736 self.0.request.name = v.into();
6737 self
6738 }
6739
6740 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6742 self.0.request.filter = v.into();
6743 self
6744 }
6745
6746 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6748 self.0.request.page_size = v.into();
6749 self
6750 }
6751
6752 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6754 self.0.request.page_token = v.into();
6755 self
6756 }
6757 }
6758
6759 #[doc(hidden)]
6760 impl gax::options::internal::RequestBuilder for ListOperations {
6761 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6762 &mut self.0.options
6763 }
6764 }
6765
6766 #[derive(Clone, Debug)]
6768 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6769
6770 impl GetOperation {
6771 pub(crate) fn new(
6772 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6773 ) -> Self {
6774 Self(RequestBuilder::new(stub))
6775 }
6776
6777 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6779 mut self,
6780 v: V,
6781 ) -> Self {
6782 self.0.request = v.into();
6783 self
6784 }
6785
6786 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6788 self.0.options = v.into();
6789 self
6790 }
6791
6792 pub async fn send(self) -> Result<longrunning::model::Operation> {
6794 (*self.0.stub)
6795 .get_operation(self.0.request, self.0.options)
6796 .await
6797 .map(gax::response::Response::into_body)
6798 }
6799
6800 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6802 self.0.request.name = v.into();
6803 self
6804 }
6805 }
6806
6807 #[doc(hidden)]
6808 impl gax::options::internal::RequestBuilder for GetOperation {
6809 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6810 &mut self.0.options
6811 }
6812 }
6813
6814 #[derive(Clone, Debug)]
6816 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6817
6818 impl DeleteOperation {
6819 pub(crate) fn new(
6820 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6821 ) -> Self {
6822 Self(RequestBuilder::new(stub))
6823 }
6824
6825 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6827 mut self,
6828 v: V,
6829 ) -> Self {
6830 self.0.request = v.into();
6831 self
6832 }
6833
6834 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6836 self.0.options = v.into();
6837 self
6838 }
6839
6840 pub async fn send(self) -> Result<()> {
6842 (*self.0.stub)
6843 .delete_operation(self.0.request, self.0.options)
6844 .await
6845 .map(gax::response::Response::into_body)
6846 }
6847
6848 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6850 self.0.request.name = v.into();
6851 self
6852 }
6853 }
6854
6855 #[doc(hidden)]
6856 impl gax::options::internal::RequestBuilder for DeleteOperation {
6857 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6858 &mut self.0.options
6859 }
6860 }
6861
6862 #[derive(Clone, Debug)]
6864 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6865
6866 impl CancelOperation {
6867 pub(crate) fn new(
6868 stub: Arc<dyn super::super::stub::dynamic::WorkflowTemplateService>,
6869 ) -> Self {
6870 Self(RequestBuilder::new(stub))
6871 }
6872
6873 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6875 mut self,
6876 v: V,
6877 ) -> Self {
6878 self.0.request = v.into();
6879 self
6880 }
6881
6882 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6884 self.0.options = v.into();
6885 self
6886 }
6887
6888 pub async fn send(self) -> Result<()> {
6890 (*self.0.stub)
6891 .cancel_operation(self.0.request, self.0.options)
6892 .await
6893 .map(gax::response::Response::into_body)
6894 }
6895
6896 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6898 self.0.request.name = v.into();
6899 self
6900 }
6901 }
6902
6903 #[doc(hidden)]
6904 impl gax::options::internal::RequestBuilder for CancelOperation {
6905 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6906 &mut self.0.options
6907 }
6908 }
6909}