1pub mod builds {
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::Builds;
39 pub struct Factory;
40 impl gax::client_builder::internal::ClientFactory for Factory {
41 type Client = Builds;
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::Builds>,
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(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
62 Self {
63 stub,
64 request: R::default(),
65 options: gax::options::RequestOptions::default(),
66 }
67 }
68 }
69
70 #[derive(Clone, Debug)]
72 pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
73
74 impl SubmitBuild {
75 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
76 Self(RequestBuilder::new(stub))
77 }
78
79 pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
81 self.0.request = v.into();
82 self
83 }
84
85 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87 self.0.options = v.into();
88 self
89 }
90
91 pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
93 (*self.0.stub)
94 .submit_build(self.0.request, self.0.options)
95 .await
96 .map(gax::response::Response::into_body)
97 }
98
99 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
101 self.0.request.parent = v.into();
102 self
103 }
104
105 pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
107 self.0.request.image_uri = v.into();
108 self
109 }
110
111 pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
113 self.0.request.service_account = v.into();
114 self
115 }
116
117 pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
119 self.0.request.worker_pool = v.into();
120 self
121 }
122
123 pub fn set_tags<T, V>(mut self, v: T) -> Self
125 where
126 T: std::iter::IntoIterator<Item = V>,
127 V: std::convert::Into<std::string::String>,
128 {
129 use std::iter::Iterator;
130 self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
131 self
132 }
133
134 pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
139 mut self,
140 v: T,
141 ) -> Self {
142 self.0.request.source = v.into();
143 self
144 }
145
146 pub fn set_storage_source<
152 T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
153 >(
154 mut self,
155 v: T,
156 ) -> Self {
157 self.0.request = self.0.request.set_storage_source(v);
158 self
159 }
160
161 pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
166 mut self,
167 v: T,
168 ) -> Self {
169 self.0.request.build_type = v.into();
170 self
171 }
172
173 pub fn set_buildpack_build<
179 T: std::convert::Into<
180 std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
181 >,
182 >(
183 mut self,
184 v: T,
185 ) -> Self {
186 self.0.request = self.0.request.set_buildpack_build(v);
187 self
188 }
189
190 pub fn set_docker_build<
196 T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
197 >(
198 mut self,
199 v: T,
200 ) -> Self {
201 self.0.request = self.0.request.set_docker_build(v);
202 self
203 }
204 }
205
206 #[doc(hidden)]
207 impl gax::options::internal::RequestBuilder for SubmitBuild {
208 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
209 &mut self.0.options
210 }
211 }
212
213 #[derive(Clone, Debug)]
215 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
216
217 impl ListOperations {
218 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
219 Self(RequestBuilder::new(stub))
220 }
221
222 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
224 mut self,
225 v: V,
226 ) -> Self {
227 self.0.request = v.into();
228 self
229 }
230
231 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
233 self.0.options = v.into();
234 self
235 }
236
237 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
239 (*self.0.stub)
240 .list_operations(self.0.request, self.0.options)
241 .await
242 .map(gax::response::Response::into_body)
243 }
244
245 pub async fn paginator(
247 self,
248 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
249 {
250 use std::clone::Clone;
251 let token = self.0.request.page_token.clone();
252 let execute = move |token: String| {
253 let mut builder = self.clone();
254 builder.0.request = builder.0.request.set_page_token(token);
255 builder.send()
256 };
257 gax::paginator::internal::new_paginator(token, execute)
258 }
259
260 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
262 self.0.request.name = v.into();
263 self
264 }
265
266 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
268 self.0.request.filter = v.into();
269 self
270 }
271
272 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
274 self.0.request.page_size = v.into();
275 self
276 }
277
278 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
280 self.0.request.page_token = v.into();
281 self
282 }
283 }
284
285 #[doc(hidden)]
286 impl gax::options::internal::RequestBuilder for ListOperations {
287 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
288 &mut self.0.options
289 }
290 }
291
292 #[derive(Clone, Debug)]
294 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
295
296 impl GetOperation {
297 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
298 Self(RequestBuilder::new(stub))
299 }
300
301 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
303 mut self,
304 v: V,
305 ) -> Self {
306 self.0.request = v.into();
307 self
308 }
309
310 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
312 self.0.options = v.into();
313 self
314 }
315
316 pub async fn send(self) -> Result<longrunning::model::Operation> {
318 (*self.0.stub)
319 .get_operation(self.0.request, self.0.options)
320 .await
321 .map(gax::response::Response::into_body)
322 }
323
324 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
326 self.0.request.name = v.into();
327 self
328 }
329 }
330
331 #[doc(hidden)]
332 impl gax::options::internal::RequestBuilder for GetOperation {
333 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
334 &mut self.0.options
335 }
336 }
337
338 #[derive(Clone, Debug)]
340 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
341
342 impl DeleteOperation {
343 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
344 Self(RequestBuilder::new(stub))
345 }
346
347 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
349 mut self,
350 v: V,
351 ) -> Self {
352 self.0.request = v.into();
353 self
354 }
355
356 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
358 self.0.options = v.into();
359 self
360 }
361
362 pub async fn send(self) -> Result<()> {
364 (*self.0.stub)
365 .delete_operation(self.0.request, self.0.options)
366 .await
367 .map(gax::response::Response::into_body)
368 }
369
370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
372 self.0.request.name = v.into();
373 self
374 }
375 }
376
377 #[doc(hidden)]
378 impl gax::options::internal::RequestBuilder for DeleteOperation {
379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
380 &mut self.0.options
381 }
382 }
383
384 #[derive(Clone, Debug)]
386 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
387
388 impl WaitOperation {
389 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
390 Self(RequestBuilder::new(stub))
391 }
392
393 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
395 mut self,
396 v: V,
397 ) -> Self {
398 self.0.request = v.into();
399 self
400 }
401
402 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
404 self.0.options = v.into();
405 self
406 }
407
408 pub async fn send(self) -> Result<longrunning::model::Operation> {
410 (*self.0.stub)
411 .wait_operation(self.0.request, self.0.options)
412 .await
413 .map(gax::response::Response::into_body)
414 }
415
416 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
418 self.0.request.name = v.into();
419 self
420 }
421
422 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
424 self.0.request.timeout = v.into();
425 self
426 }
427 }
428
429 #[doc(hidden)]
430 impl gax::options::internal::RequestBuilder for WaitOperation {
431 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
432 &mut self.0.options
433 }
434 }
435}
436
437pub mod executions {
438 use crate::Result;
439 use std::sync::Arc;
440
441 pub type ClientBuilder =
455 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
456
457 pub(crate) mod client {
458 use super::super::super::client::Executions;
459 pub struct Factory;
460 impl gax::client_builder::internal::ClientFactory for Factory {
461 type Client = Executions;
462 type Credentials = gaxi::options::Credentials;
463 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
464 Self::Client::new(config).await
465 }
466 }
467 }
468
469 #[derive(Clone, Debug)]
471 pub(crate) struct RequestBuilder<R: std::default::Default> {
472 stub: Arc<dyn super::super::stub::dynamic::Executions>,
473 request: R,
474 options: gax::options::RequestOptions,
475 }
476
477 impl<R> RequestBuilder<R>
478 where
479 R: std::default::Default,
480 {
481 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
482 Self {
483 stub,
484 request: R::default(),
485 options: gax::options::RequestOptions::default(),
486 }
487 }
488 }
489
490 #[derive(Clone, Debug)]
492 pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
493
494 impl GetExecution {
495 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
496 Self(RequestBuilder::new(stub))
497 }
498
499 pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
501 self.0.request = v.into();
502 self
503 }
504
505 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
507 self.0.options = v.into();
508 self
509 }
510
511 pub async fn send(self) -> Result<crate::model::Execution> {
513 (*self.0.stub)
514 .get_execution(self.0.request, self.0.options)
515 .await
516 .map(gax::response::Response::into_body)
517 }
518
519 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
521 self.0.request.name = v.into();
522 self
523 }
524 }
525
526 #[doc(hidden)]
527 impl gax::options::internal::RequestBuilder for GetExecution {
528 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
529 &mut self.0.options
530 }
531 }
532
533 #[derive(Clone, Debug)]
535 pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
536
537 impl ListExecutions {
538 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
539 Self(RequestBuilder::new(stub))
540 }
541
542 pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
544 self.0.request = v.into();
545 self
546 }
547
548 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
550 self.0.options = v.into();
551 self
552 }
553
554 pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
556 (*self.0.stub)
557 .list_executions(self.0.request, self.0.options)
558 .await
559 .map(gax::response::Response::into_body)
560 }
561
562 pub async fn paginator(
564 self,
565 ) -> impl gax::paginator::Paginator<crate::model::ListExecutionsResponse, gax::error::Error>
566 {
567 use std::clone::Clone;
568 let token = self.0.request.page_token.clone();
569 let execute = move |token: String| {
570 let mut builder = self.clone();
571 builder.0.request = builder.0.request.set_page_token(token);
572 builder.send()
573 };
574 gax::paginator::internal::new_paginator(token, execute)
575 }
576
577 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
579 self.0.request.parent = v.into();
580 self
581 }
582
583 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
585 self.0.request.page_size = v.into();
586 self
587 }
588
589 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
591 self.0.request.page_token = v.into();
592 self
593 }
594
595 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
597 self.0.request.show_deleted = v.into();
598 self
599 }
600 }
601
602 #[doc(hidden)]
603 impl gax::options::internal::RequestBuilder for ListExecutions {
604 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
605 &mut self.0.options
606 }
607 }
608
609 #[derive(Clone, Debug)]
611 pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
612
613 impl DeleteExecution {
614 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
615 Self(RequestBuilder::new(stub))
616 }
617
618 pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
620 self.0.request = v.into();
621 self
622 }
623
624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
626 self.0.options = v.into();
627 self
628 }
629
630 pub async fn send(self) -> Result<longrunning::model::Operation> {
637 (*self.0.stub)
638 .delete_execution(self.0.request, self.0.options)
639 .await
640 .map(gax::response::Response::into_body)
641 }
642
643 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
645 type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
646 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
647 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
648
649 let stub = self.0.stub.clone();
650 let mut options = self.0.options.clone();
651 options.set_retry_policy(gax::retry_policy::NeverRetry);
652 let query = move |name| {
653 let stub = stub.clone();
654 let options = options.clone();
655 async {
656 let op = GetOperation::new(stub)
657 .set_name(name)
658 .with_options(options)
659 .send()
660 .await?;
661 Ok(Operation::new(op))
662 }
663 };
664
665 let start = move || async {
666 let op = self.send().await?;
667 Ok(Operation::new(op))
668 };
669
670 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
671 }
672
673 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
675 self.0.request.name = v.into();
676 self
677 }
678
679 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
681 self.0.request.validate_only = v.into();
682 self
683 }
684
685 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
687 self.0.request.etag = v.into();
688 self
689 }
690 }
691
692 #[doc(hidden)]
693 impl gax::options::internal::RequestBuilder for DeleteExecution {
694 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
695 &mut self.0.options
696 }
697 }
698
699 #[derive(Clone, Debug)]
701 pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
702
703 impl CancelExecution {
704 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
705 Self(RequestBuilder::new(stub))
706 }
707
708 pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
710 self.0.request = v.into();
711 self
712 }
713
714 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
716 self.0.options = v.into();
717 self
718 }
719
720 pub async fn send(self) -> Result<longrunning::model::Operation> {
727 (*self.0.stub)
728 .cancel_execution(self.0.request, self.0.options)
729 .await
730 .map(gax::response::Response::into_body)
731 }
732
733 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
735 type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
736 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
737 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
738
739 let stub = self.0.stub.clone();
740 let mut options = self.0.options.clone();
741 options.set_retry_policy(gax::retry_policy::NeverRetry);
742 let query = move |name| {
743 let stub = stub.clone();
744 let options = options.clone();
745 async {
746 let op = GetOperation::new(stub)
747 .set_name(name)
748 .with_options(options)
749 .send()
750 .await?;
751 Ok(Operation::new(op))
752 }
753 };
754
755 let start = move || async {
756 let op = self.send().await?;
757 Ok(Operation::new(op))
758 };
759
760 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
761 }
762
763 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
765 self.0.request.name = v.into();
766 self
767 }
768
769 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
771 self.0.request.validate_only = v.into();
772 self
773 }
774
775 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
777 self.0.request.etag = v.into();
778 self
779 }
780 }
781
782 #[doc(hidden)]
783 impl gax::options::internal::RequestBuilder for CancelExecution {
784 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
785 &mut self.0.options
786 }
787 }
788
789 #[derive(Clone, Debug)]
791 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
792
793 impl ListOperations {
794 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
795 Self(RequestBuilder::new(stub))
796 }
797
798 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
800 mut self,
801 v: V,
802 ) -> Self {
803 self.0.request = v.into();
804 self
805 }
806
807 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
809 self.0.options = v.into();
810 self
811 }
812
813 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
815 (*self.0.stub)
816 .list_operations(self.0.request, self.0.options)
817 .await
818 .map(gax::response::Response::into_body)
819 }
820
821 pub async fn paginator(
823 self,
824 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
825 {
826 use std::clone::Clone;
827 let token = self.0.request.page_token.clone();
828 let execute = move |token: String| {
829 let mut builder = self.clone();
830 builder.0.request = builder.0.request.set_page_token(token);
831 builder.send()
832 };
833 gax::paginator::internal::new_paginator(token, execute)
834 }
835
836 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
838 self.0.request.name = v.into();
839 self
840 }
841
842 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
844 self.0.request.filter = v.into();
845 self
846 }
847
848 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
850 self.0.request.page_size = v.into();
851 self
852 }
853
854 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
856 self.0.request.page_token = v.into();
857 self
858 }
859 }
860
861 #[doc(hidden)]
862 impl gax::options::internal::RequestBuilder for ListOperations {
863 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
864 &mut self.0.options
865 }
866 }
867
868 #[derive(Clone, Debug)]
870 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
871
872 impl GetOperation {
873 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
874 Self(RequestBuilder::new(stub))
875 }
876
877 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
879 mut self,
880 v: V,
881 ) -> Self {
882 self.0.request = v.into();
883 self
884 }
885
886 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
888 self.0.options = v.into();
889 self
890 }
891
892 pub async fn send(self) -> Result<longrunning::model::Operation> {
894 (*self.0.stub)
895 .get_operation(self.0.request, self.0.options)
896 .await
897 .map(gax::response::Response::into_body)
898 }
899
900 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
902 self.0.request.name = v.into();
903 self
904 }
905 }
906
907 #[doc(hidden)]
908 impl gax::options::internal::RequestBuilder for GetOperation {
909 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
910 &mut self.0.options
911 }
912 }
913
914 #[derive(Clone, Debug)]
916 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
917
918 impl DeleteOperation {
919 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
920 Self(RequestBuilder::new(stub))
921 }
922
923 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
925 mut self,
926 v: V,
927 ) -> Self {
928 self.0.request = v.into();
929 self
930 }
931
932 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
934 self.0.options = v.into();
935 self
936 }
937
938 pub async fn send(self) -> Result<()> {
940 (*self.0.stub)
941 .delete_operation(self.0.request, self.0.options)
942 .await
943 .map(gax::response::Response::into_body)
944 }
945
946 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948 self.0.request.name = v.into();
949 self
950 }
951 }
952
953 #[doc(hidden)]
954 impl gax::options::internal::RequestBuilder for DeleteOperation {
955 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
956 &mut self.0.options
957 }
958 }
959
960 #[derive(Clone, Debug)]
962 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
963
964 impl WaitOperation {
965 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
966 Self(RequestBuilder::new(stub))
967 }
968
969 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
971 mut self,
972 v: V,
973 ) -> Self {
974 self.0.request = v.into();
975 self
976 }
977
978 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
980 self.0.options = v.into();
981 self
982 }
983
984 pub async fn send(self) -> Result<longrunning::model::Operation> {
986 (*self.0.stub)
987 .wait_operation(self.0.request, self.0.options)
988 .await
989 .map(gax::response::Response::into_body)
990 }
991
992 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
994 self.0.request.name = v.into();
995 self
996 }
997
998 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
1000 self.0.request.timeout = v.into();
1001 self
1002 }
1003 }
1004
1005 #[doc(hidden)]
1006 impl gax::options::internal::RequestBuilder for WaitOperation {
1007 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1008 &mut self.0.options
1009 }
1010 }
1011}
1012
1013pub mod jobs {
1014 use crate::Result;
1015 use std::sync::Arc;
1016
1017 pub type ClientBuilder =
1031 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1032
1033 pub(crate) mod client {
1034 use super::super::super::client::Jobs;
1035 pub struct Factory;
1036 impl gax::client_builder::internal::ClientFactory for Factory {
1037 type Client = Jobs;
1038 type Credentials = gaxi::options::Credentials;
1039 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
1040 Self::Client::new(config).await
1041 }
1042 }
1043 }
1044
1045 #[derive(Clone, Debug)]
1047 pub(crate) struct RequestBuilder<R: std::default::Default> {
1048 stub: Arc<dyn super::super::stub::dynamic::Jobs>,
1049 request: R,
1050 options: gax::options::RequestOptions,
1051 }
1052
1053 impl<R> RequestBuilder<R>
1054 where
1055 R: std::default::Default,
1056 {
1057 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1058 Self {
1059 stub,
1060 request: R::default(),
1061 options: gax::options::RequestOptions::default(),
1062 }
1063 }
1064 }
1065
1066 #[derive(Clone, Debug)]
1068 pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
1069
1070 impl CreateJob {
1071 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1072 Self(RequestBuilder::new(stub))
1073 }
1074
1075 pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
1077 self.0.request = v.into();
1078 self
1079 }
1080
1081 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1083 self.0.options = v.into();
1084 self
1085 }
1086
1087 pub async fn send(self) -> Result<longrunning::model::Operation> {
1094 (*self.0.stub)
1095 .create_job(self.0.request, self.0.options)
1096 .await
1097 .map(gax::response::Response::into_body)
1098 }
1099
1100 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1102 type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1103 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1104 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1105
1106 let stub = self.0.stub.clone();
1107 let mut options = self.0.options.clone();
1108 options.set_retry_policy(gax::retry_policy::NeverRetry);
1109 let query = move |name| {
1110 let stub = stub.clone();
1111 let options = options.clone();
1112 async {
1113 let op = GetOperation::new(stub)
1114 .set_name(name)
1115 .with_options(options)
1116 .send()
1117 .await?;
1118 Ok(Operation::new(op))
1119 }
1120 };
1121
1122 let start = move || async {
1123 let op = self.send().await?;
1124 Ok(Operation::new(op))
1125 };
1126
1127 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1128 }
1129
1130 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1132 self.0.request.parent = v.into();
1133 self
1134 }
1135
1136 pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
1138 self.0.request.job = v.into();
1139 self
1140 }
1141
1142 pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1144 self.0.request.job_id = v.into();
1145 self
1146 }
1147
1148 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1150 self.0.request.validate_only = v.into();
1151 self
1152 }
1153 }
1154
1155 #[doc(hidden)]
1156 impl gax::options::internal::RequestBuilder for CreateJob {
1157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1158 &mut self.0.options
1159 }
1160 }
1161
1162 #[derive(Clone, Debug)]
1164 pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
1165
1166 impl GetJob {
1167 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1168 Self(RequestBuilder::new(stub))
1169 }
1170
1171 pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
1173 self.0.request = v.into();
1174 self
1175 }
1176
1177 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1179 self.0.options = v.into();
1180 self
1181 }
1182
1183 pub async fn send(self) -> Result<crate::model::Job> {
1185 (*self.0.stub)
1186 .get_job(self.0.request, self.0.options)
1187 .await
1188 .map(gax::response::Response::into_body)
1189 }
1190
1191 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1193 self.0.request.name = v.into();
1194 self
1195 }
1196 }
1197
1198 #[doc(hidden)]
1199 impl gax::options::internal::RequestBuilder for GetJob {
1200 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1201 &mut self.0.options
1202 }
1203 }
1204
1205 #[derive(Clone, Debug)]
1207 pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1208
1209 impl ListJobs {
1210 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1211 Self(RequestBuilder::new(stub))
1212 }
1213
1214 pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1216 self.0.request = v.into();
1217 self
1218 }
1219
1220 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1222 self.0.options = v.into();
1223 self
1224 }
1225
1226 pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
1228 (*self.0.stub)
1229 .list_jobs(self.0.request, self.0.options)
1230 .await
1231 .map(gax::response::Response::into_body)
1232 }
1233
1234 pub async fn paginator(
1236 self,
1237 ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
1238 {
1239 use std::clone::Clone;
1240 let token = self.0.request.page_token.clone();
1241 let execute = move |token: String| {
1242 let mut builder = self.clone();
1243 builder.0.request = builder.0.request.set_page_token(token);
1244 builder.send()
1245 };
1246 gax::paginator::internal::new_paginator(token, execute)
1247 }
1248
1249 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1251 self.0.request.parent = v.into();
1252 self
1253 }
1254
1255 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1257 self.0.request.page_size = v.into();
1258 self
1259 }
1260
1261 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1263 self.0.request.page_token = v.into();
1264 self
1265 }
1266
1267 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1269 self.0.request.show_deleted = v.into();
1270 self
1271 }
1272 }
1273
1274 #[doc(hidden)]
1275 impl gax::options::internal::RequestBuilder for ListJobs {
1276 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1277 &mut self.0.options
1278 }
1279 }
1280
1281 #[derive(Clone, Debug)]
1283 pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
1284
1285 impl UpdateJob {
1286 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1287 Self(RequestBuilder::new(stub))
1288 }
1289
1290 pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
1292 self.0.request = v.into();
1293 self
1294 }
1295
1296 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1298 self.0.options = v.into();
1299 self
1300 }
1301
1302 pub async fn send(self) -> Result<longrunning::model::Operation> {
1309 (*self.0.stub)
1310 .update_job(self.0.request, self.0.options)
1311 .await
1312 .map(gax::response::Response::into_body)
1313 }
1314
1315 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1317 type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1318 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1319 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1320
1321 let stub = self.0.stub.clone();
1322 let mut options = self.0.options.clone();
1323 options.set_retry_policy(gax::retry_policy::NeverRetry);
1324 let query = move |name| {
1325 let stub = stub.clone();
1326 let options = options.clone();
1327 async {
1328 let op = GetOperation::new(stub)
1329 .set_name(name)
1330 .with_options(options)
1331 .send()
1332 .await?;
1333 Ok(Operation::new(op))
1334 }
1335 };
1336
1337 let start = move || async {
1338 let op = self.send().await?;
1339 Ok(Operation::new(op))
1340 };
1341
1342 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1343 }
1344
1345 pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
1347 self.0.request.job = v.into();
1348 self
1349 }
1350
1351 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1353 self.0.request.validate_only = v.into();
1354 self
1355 }
1356
1357 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1359 self.0.request.allow_missing = v.into();
1360 self
1361 }
1362 }
1363
1364 #[doc(hidden)]
1365 impl gax::options::internal::RequestBuilder for UpdateJob {
1366 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1367 &mut self.0.options
1368 }
1369 }
1370
1371 #[derive(Clone, Debug)]
1373 pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1374
1375 impl DeleteJob {
1376 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1377 Self(RequestBuilder::new(stub))
1378 }
1379
1380 pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1382 self.0.request = v.into();
1383 self
1384 }
1385
1386 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1388 self.0.options = v.into();
1389 self
1390 }
1391
1392 pub async fn send(self) -> Result<longrunning::model::Operation> {
1399 (*self.0.stub)
1400 .delete_job(self.0.request, self.0.options)
1401 .await
1402 .map(gax::response::Response::into_body)
1403 }
1404
1405 pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1407 type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1408 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1409 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1410
1411 let stub = self.0.stub.clone();
1412 let mut options = self.0.options.clone();
1413 options.set_retry_policy(gax::retry_policy::NeverRetry);
1414 let query = move |name| {
1415 let stub = stub.clone();
1416 let options = options.clone();
1417 async {
1418 let op = GetOperation::new(stub)
1419 .set_name(name)
1420 .with_options(options)
1421 .send()
1422 .await?;
1423 Ok(Operation::new(op))
1424 }
1425 };
1426
1427 let start = move || async {
1428 let op = self.send().await?;
1429 Ok(Operation::new(op))
1430 };
1431
1432 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1433 }
1434
1435 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1437 self.0.request.name = v.into();
1438 self
1439 }
1440
1441 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1443 self.0.request.validate_only = v.into();
1444 self
1445 }
1446
1447 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449 self.0.request.etag = v.into();
1450 self
1451 }
1452 }
1453
1454 #[doc(hidden)]
1455 impl gax::options::internal::RequestBuilder for DeleteJob {
1456 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1457 &mut self.0.options
1458 }
1459 }
1460
1461 #[derive(Clone, Debug)]
1463 pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
1464
1465 impl RunJob {
1466 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1467 Self(RequestBuilder::new(stub))
1468 }
1469
1470 pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
1472 self.0.request = v.into();
1473 self
1474 }
1475
1476 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1478 self.0.options = v.into();
1479 self
1480 }
1481
1482 pub async fn send(self) -> Result<longrunning::model::Operation> {
1489 (*self.0.stub)
1490 .run_job(self.0.request, self.0.options)
1491 .await
1492 .map(gax::response::Response::into_body)
1493 }
1494
1495 pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
1497 type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
1498 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1499 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1500
1501 let stub = self.0.stub.clone();
1502 let mut options = self.0.options.clone();
1503 options.set_retry_policy(gax::retry_policy::NeverRetry);
1504 let query = move |name| {
1505 let stub = stub.clone();
1506 let options = options.clone();
1507 async {
1508 let op = GetOperation::new(stub)
1509 .set_name(name)
1510 .with_options(options)
1511 .send()
1512 .await?;
1513 Ok(Operation::new(op))
1514 }
1515 };
1516
1517 let start = move || async {
1518 let op = self.send().await?;
1519 Ok(Operation::new(op))
1520 };
1521
1522 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1523 }
1524
1525 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1527 self.0.request.name = v.into();
1528 self
1529 }
1530
1531 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1533 self.0.request.validate_only = v.into();
1534 self
1535 }
1536
1537 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1539 self.0.request.etag = v.into();
1540 self
1541 }
1542
1543 pub fn set_overrides<
1545 T: Into<std::option::Option<crate::model::run_job_request::Overrides>>,
1546 >(
1547 mut self,
1548 v: T,
1549 ) -> Self {
1550 self.0.request.overrides = v.into();
1551 self
1552 }
1553 }
1554
1555 #[doc(hidden)]
1556 impl gax::options::internal::RequestBuilder for RunJob {
1557 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1558 &mut self.0.options
1559 }
1560 }
1561
1562 #[derive(Clone, Debug)]
1564 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1565
1566 impl GetIamPolicy {
1567 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1568 Self(RequestBuilder::new(stub))
1569 }
1570
1571 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1573 self.0.request = v.into();
1574 self
1575 }
1576
1577 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1579 self.0.options = v.into();
1580 self
1581 }
1582
1583 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1585 (*self.0.stub)
1586 .get_iam_policy(self.0.request, self.0.options)
1587 .await
1588 .map(gax::response::Response::into_body)
1589 }
1590
1591 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593 self.0.request.resource = v.into();
1594 self
1595 }
1596
1597 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
1599 mut self,
1600 v: T,
1601 ) -> Self {
1602 self.0.request.options = v.into();
1603 self
1604 }
1605 }
1606
1607 #[doc(hidden)]
1608 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1609 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1610 &mut self.0.options
1611 }
1612 }
1613
1614 #[derive(Clone, Debug)]
1616 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1617
1618 impl SetIamPolicy {
1619 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1620 Self(RequestBuilder::new(stub))
1621 }
1622
1623 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1625 self.0.request = v.into();
1626 self
1627 }
1628
1629 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1631 self.0.options = v.into();
1632 self
1633 }
1634
1635 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1637 (*self.0.stub)
1638 .set_iam_policy(self.0.request, self.0.options)
1639 .await
1640 .map(gax::response::Response::into_body)
1641 }
1642
1643 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1645 self.0.request.resource = v.into();
1646 self
1647 }
1648
1649 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
1651 mut self,
1652 v: T,
1653 ) -> Self {
1654 self.0.request.policy = v.into();
1655 self
1656 }
1657
1658 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1660 mut self,
1661 v: T,
1662 ) -> Self {
1663 self.0.request.update_mask = v.into();
1664 self
1665 }
1666 }
1667
1668 #[doc(hidden)]
1669 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1670 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1671 &mut self.0.options
1672 }
1673 }
1674
1675 #[derive(Clone, Debug)]
1677 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1678
1679 impl TestIamPermissions {
1680 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1681 Self(RequestBuilder::new(stub))
1682 }
1683
1684 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1686 mut self,
1687 v: V,
1688 ) -> Self {
1689 self.0.request = v.into();
1690 self
1691 }
1692
1693 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1695 self.0.options = v.into();
1696 self
1697 }
1698
1699 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1701 (*self.0.stub)
1702 .test_iam_permissions(self.0.request, self.0.options)
1703 .await
1704 .map(gax::response::Response::into_body)
1705 }
1706
1707 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709 self.0.request.resource = v.into();
1710 self
1711 }
1712
1713 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1715 where
1716 T: std::iter::IntoIterator<Item = V>,
1717 V: std::convert::Into<std::string::String>,
1718 {
1719 use std::iter::Iterator;
1720 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1721 self
1722 }
1723 }
1724
1725 #[doc(hidden)]
1726 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1727 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1728 &mut self.0.options
1729 }
1730 }
1731
1732 #[derive(Clone, Debug)]
1734 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1735
1736 impl ListOperations {
1737 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1738 Self(RequestBuilder::new(stub))
1739 }
1740
1741 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1743 mut self,
1744 v: V,
1745 ) -> Self {
1746 self.0.request = v.into();
1747 self
1748 }
1749
1750 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1752 self.0.options = v.into();
1753 self
1754 }
1755
1756 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1758 (*self.0.stub)
1759 .list_operations(self.0.request, self.0.options)
1760 .await
1761 .map(gax::response::Response::into_body)
1762 }
1763
1764 pub async fn paginator(
1766 self,
1767 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1768 {
1769 use std::clone::Clone;
1770 let token = self.0.request.page_token.clone();
1771 let execute = move |token: String| {
1772 let mut builder = self.clone();
1773 builder.0.request = builder.0.request.set_page_token(token);
1774 builder.send()
1775 };
1776 gax::paginator::internal::new_paginator(token, execute)
1777 }
1778
1779 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1781 self.0.request.name = v.into();
1782 self
1783 }
1784
1785 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1787 self.0.request.filter = v.into();
1788 self
1789 }
1790
1791 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1793 self.0.request.page_size = v.into();
1794 self
1795 }
1796
1797 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1799 self.0.request.page_token = v.into();
1800 self
1801 }
1802 }
1803
1804 #[doc(hidden)]
1805 impl gax::options::internal::RequestBuilder for ListOperations {
1806 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1807 &mut self.0.options
1808 }
1809 }
1810
1811 #[derive(Clone, Debug)]
1813 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1814
1815 impl GetOperation {
1816 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1817 Self(RequestBuilder::new(stub))
1818 }
1819
1820 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1822 mut self,
1823 v: V,
1824 ) -> Self {
1825 self.0.request = v.into();
1826 self
1827 }
1828
1829 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1831 self.0.options = v.into();
1832 self
1833 }
1834
1835 pub async fn send(self) -> Result<longrunning::model::Operation> {
1837 (*self.0.stub)
1838 .get_operation(self.0.request, self.0.options)
1839 .await
1840 .map(gax::response::Response::into_body)
1841 }
1842
1843 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.0.request.name = v.into();
1846 self
1847 }
1848 }
1849
1850 #[doc(hidden)]
1851 impl gax::options::internal::RequestBuilder for GetOperation {
1852 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1853 &mut self.0.options
1854 }
1855 }
1856
1857 #[derive(Clone, Debug)]
1859 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1860
1861 impl DeleteOperation {
1862 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1863 Self(RequestBuilder::new(stub))
1864 }
1865
1866 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1868 mut self,
1869 v: V,
1870 ) -> Self {
1871 self.0.request = v.into();
1872 self
1873 }
1874
1875 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1877 self.0.options = v.into();
1878 self
1879 }
1880
1881 pub async fn send(self) -> Result<()> {
1883 (*self.0.stub)
1884 .delete_operation(self.0.request, self.0.options)
1885 .await
1886 .map(gax::response::Response::into_body)
1887 }
1888
1889 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1891 self.0.request.name = v.into();
1892 self
1893 }
1894 }
1895
1896 #[doc(hidden)]
1897 impl gax::options::internal::RequestBuilder for DeleteOperation {
1898 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1899 &mut self.0.options
1900 }
1901 }
1902
1903 #[derive(Clone, Debug)]
1905 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
1906
1907 impl WaitOperation {
1908 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1909 Self(RequestBuilder::new(stub))
1910 }
1911
1912 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
1914 mut self,
1915 v: V,
1916 ) -> Self {
1917 self.0.request = v.into();
1918 self
1919 }
1920
1921 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1923 self.0.options = v.into();
1924 self
1925 }
1926
1927 pub async fn send(self) -> Result<longrunning::model::Operation> {
1929 (*self.0.stub)
1930 .wait_operation(self.0.request, self.0.options)
1931 .await
1932 .map(gax::response::Response::into_body)
1933 }
1934
1935 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1937 self.0.request.name = v.into();
1938 self
1939 }
1940
1941 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
1943 self.0.request.timeout = v.into();
1944 self
1945 }
1946 }
1947
1948 #[doc(hidden)]
1949 impl gax::options::internal::RequestBuilder for WaitOperation {
1950 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1951 &mut self.0.options
1952 }
1953 }
1954}
1955
1956pub mod revisions {
1957 use crate::Result;
1958 use std::sync::Arc;
1959
1960 pub type ClientBuilder =
1974 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1975
1976 pub(crate) mod client {
1977 use super::super::super::client::Revisions;
1978 pub struct Factory;
1979 impl gax::client_builder::internal::ClientFactory for Factory {
1980 type Client = Revisions;
1981 type Credentials = gaxi::options::Credentials;
1982 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
1983 Self::Client::new(config).await
1984 }
1985 }
1986 }
1987
1988 #[derive(Clone, Debug)]
1990 pub(crate) struct RequestBuilder<R: std::default::Default> {
1991 stub: Arc<dyn super::super::stub::dynamic::Revisions>,
1992 request: R,
1993 options: gax::options::RequestOptions,
1994 }
1995
1996 impl<R> RequestBuilder<R>
1997 where
1998 R: std::default::Default,
1999 {
2000 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2001 Self {
2002 stub,
2003 request: R::default(),
2004 options: gax::options::RequestOptions::default(),
2005 }
2006 }
2007 }
2008
2009 #[derive(Clone, Debug)]
2011 pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
2012
2013 impl GetRevision {
2014 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2015 Self(RequestBuilder::new(stub))
2016 }
2017
2018 pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
2020 self.0.request = v.into();
2021 self
2022 }
2023
2024 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2026 self.0.options = v.into();
2027 self
2028 }
2029
2030 pub async fn send(self) -> Result<crate::model::Revision> {
2032 (*self.0.stub)
2033 .get_revision(self.0.request, self.0.options)
2034 .await
2035 .map(gax::response::Response::into_body)
2036 }
2037
2038 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2040 self.0.request.name = v.into();
2041 self
2042 }
2043 }
2044
2045 #[doc(hidden)]
2046 impl gax::options::internal::RequestBuilder for GetRevision {
2047 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2048 &mut self.0.options
2049 }
2050 }
2051
2052 #[derive(Clone, Debug)]
2054 pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
2055
2056 impl ListRevisions {
2057 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2058 Self(RequestBuilder::new(stub))
2059 }
2060
2061 pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
2063 self.0.request = v.into();
2064 self
2065 }
2066
2067 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2069 self.0.options = v.into();
2070 self
2071 }
2072
2073 pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
2075 (*self.0.stub)
2076 .list_revisions(self.0.request, self.0.options)
2077 .await
2078 .map(gax::response::Response::into_body)
2079 }
2080
2081 pub async fn paginator(
2083 self,
2084 ) -> impl gax::paginator::Paginator<crate::model::ListRevisionsResponse, gax::error::Error>
2085 {
2086 use std::clone::Clone;
2087 let token = self.0.request.page_token.clone();
2088 let execute = move |token: String| {
2089 let mut builder = self.clone();
2090 builder.0.request = builder.0.request.set_page_token(token);
2091 builder.send()
2092 };
2093 gax::paginator::internal::new_paginator(token, execute)
2094 }
2095
2096 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098 self.0.request.parent = v.into();
2099 self
2100 }
2101
2102 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2104 self.0.request.page_size = v.into();
2105 self
2106 }
2107
2108 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2110 self.0.request.page_token = v.into();
2111 self
2112 }
2113
2114 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2116 self.0.request.show_deleted = v.into();
2117 self
2118 }
2119 }
2120
2121 #[doc(hidden)]
2122 impl gax::options::internal::RequestBuilder for ListRevisions {
2123 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2124 &mut self.0.options
2125 }
2126 }
2127
2128 #[derive(Clone, Debug)]
2130 pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
2131
2132 impl DeleteRevision {
2133 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2134 Self(RequestBuilder::new(stub))
2135 }
2136
2137 pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
2139 self.0.request = v.into();
2140 self
2141 }
2142
2143 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2145 self.0.options = v.into();
2146 self
2147 }
2148
2149 pub async fn send(self) -> Result<longrunning::model::Operation> {
2156 (*self.0.stub)
2157 .delete_revision(self.0.request, self.0.options)
2158 .await
2159 .map(gax::response::Response::into_body)
2160 }
2161
2162 pub fn poller(self) -> impl lro::Poller<crate::model::Revision, crate::model::Revision> {
2164 type Operation = lro::Operation<crate::model::Revision, crate::model::Revision>;
2165 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2166 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2167
2168 let stub = self.0.stub.clone();
2169 let mut options = self.0.options.clone();
2170 options.set_retry_policy(gax::retry_policy::NeverRetry);
2171 let query = move |name| {
2172 let stub = stub.clone();
2173 let options = options.clone();
2174 async {
2175 let op = GetOperation::new(stub)
2176 .set_name(name)
2177 .with_options(options)
2178 .send()
2179 .await?;
2180 Ok(Operation::new(op))
2181 }
2182 };
2183
2184 let start = move || async {
2185 let op = self.send().await?;
2186 Ok(Operation::new(op))
2187 };
2188
2189 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2190 }
2191
2192 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2194 self.0.request.name = v.into();
2195 self
2196 }
2197
2198 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2200 self.0.request.validate_only = v.into();
2201 self
2202 }
2203
2204 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206 self.0.request.etag = v.into();
2207 self
2208 }
2209 }
2210
2211 #[doc(hidden)]
2212 impl gax::options::internal::RequestBuilder for DeleteRevision {
2213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2214 &mut self.0.options
2215 }
2216 }
2217
2218 #[derive(Clone, Debug)]
2220 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2221
2222 impl ListOperations {
2223 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2224 Self(RequestBuilder::new(stub))
2225 }
2226
2227 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2229 mut self,
2230 v: V,
2231 ) -> Self {
2232 self.0.request = v.into();
2233 self
2234 }
2235
2236 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2238 self.0.options = v.into();
2239 self
2240 }
2241
2242 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2244 (*self.0.stub)
2245 .list_operations(self.0.request, self.0.options)
2246 .await
2247 .map(gax::response::Response::into_body)
2248 }
2249
2250 pub async fn paginator(
2252 self,
2253 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2254 {
2255 use std::clone::Clone;
2256 let token = self.0.request.page_token.clone();
2257 let execute = move |token: String| {
2258 let mut builder = self.clone();
2259 builder.0.request = builder.0.request.set_page_token(token);
2260 builder.send()
2261 };
2262 gax::paginator::internal::new_paginator(token, execute)
2263 }
2264
2265 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2267 self.0.request.name = v.into();
2268 self
2269 }
2270
2271 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2273 self.0.request.filter = v.into();
2274 self
2275 }
2276
2277 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2279 self.0.request.page_size = v.into();
2280 self
2281 }
2282
2283 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2285 self.0.request.page_token = v.into();
2286 self
2287 }
2288 }
2289
2290 #[doc(hidden)]
2291 impl gax::options::internal::RequestBuilder for ListOperations {
2292 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2293 &mut self.0.options
2294 }
2295 }
2296
2297 #[derive(Clone, Debug)]
2299 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2300
2301 impl GetOperation {
2302 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2303 Self(RequestBuilder::new(stub))
2304 }
2305
2306 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2308 mut self,
2309 v: V,
2310 ) -> Self {
2311 self.0.request = v.into();
2312 self
2313 }
2314
2315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2317 self.0.options = v.into();
2318 self
2319 }
2320
2321 pub async fn send(self) -> Result<longrunning::model::Operation> {
2323 (*self.0.stub)
2324 .get_operation(self.0.request, self.0.options)
2325 .await
2326 .map(gax::response::Response::into_body)
2327 }
2328
2329 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2331 self.0.request.name = v.into();
2332 self
2333 }
2334 }
2335
2336 #[doc(hidden)]
2337 impl gax::options::internal::RequestBuilder for GetOperation {
2338 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2339 &mut self.0.options
2340 }
2341 }
2342
2343 #[derive(Clone, Debug)]
2345 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2346
2347 impl DeleteOperation {
2348 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2349 Self(RequestBuilder::new(stub))
2350 }
2351
2352 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2354 mut self,
2355 v: V,
2356 ) -> Self {
2357 self.0.request = v.into();
2358 self
2359 }
2360
2361 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2363 self.0.options = v.into();
2364 self
2365 }
2366
2367 pub async fn send(self) -> Result<()> {
2369 (*self.0.stub)
2370 .delete_operation(self.0.request, self.0.options)
2371 .await
2372 .map(gax::response::Response::into_body)
2373 }
2374
2375 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2377 self.0.request.name = v.into();
2378 self
2379 }
2380 }
2381
2382 #[doc(hidden)]
2383 impl gax::options::internal::RequestBuilder for DeleteOperation {
2384 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2385 &mut self.0.options
2386 }
2387 }
2388
2389 #[derive(Clone, Debug)]
2391 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
2392
2393 impl WaitOperation {
2394 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2395 Self(RequestBuilder::new(stub))
2396 }
2397
2398 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
2400 mut self,
2401 v: V,
2402 ) -> Self {
2403 self.0.request = v.into();
2404 self
2405 }
2406
2407 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2409 self.0.options = v.into();
2410 self
2411 }
2412
2413 pub async fn send(self) -> Result<longrunning::model::Operation> {
2415 (*self.0.stub)
2416 .wait_operation(self.0.request, self.0.options)
2417 .await
2418 .map(gax::response::Response::into_body)
2419 }
2420
2421 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2423 self.0.request.name = v.into();
2424 self
2425 }
2426
2427 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
2429 self.0.request.timeout = v.into();
2430 self
2431 }
2432 }
2433
2434 #[doc(hidden)]
2435 impl gax::options::internal::RequestBuilder for WaitOperation {
2436 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2437 &mut self.0.options
2438 }
2439 }
2440}
2441
2442pub mod services {
2443 use crate::Result;
2444 use std::sync::Arc;
2445
2446 pub type ClientBuilder =
2460 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2461
2462 pub(crate) mod client {
2463 use super::super::super::client::Services;
2464 pub struct Factory;
2465 impl gax::client_builder::internal::ClientFactory for Factory {
2466 type Client = Services;
2467 type Credentials = gaxi::options::Credentials;
2468 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
2469 Self::Client::new(config).await
2470 }
2471 }
2472 }
2473
2474 #[derive(Clone, Debug)]
2476 pub(crate) struct RequestBuilder<R: std::default::Default> {
2477 stub: Arc<dyn super::super::stub::dynamic::Services>,
2478 request: R,
2479 options: gax::options::RequestOptions,
2480 }
2481
2482 impl<R> RequestBuilder<R>
2483 where
2484 R: std::default::Default,
2485 {
2486 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2487 Self {
2488 stub,
2489 request: R::default(),
2490 options: gax::options::RequestOptions::default(),
2491 }
2492 }
2493 }
2494
2495 #[derive(Clone, Debug)]
2497 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
2498
2499 impl CreateService {
2500 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2501 Self(RequestBuilder::new(stub))
2502 }
2503
2504 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
2506 self.0.request = v.into();
2507 self
2508 }
2509
2510 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2512 self.0.options = v.into();
2513 self
2514 }
2515
2516 pub async fn send(self) -> Result<longrunning::model::Operation> {
2523 (*self.0.stub)
2524 .create_service(self.0.request, self.0.options)
2525 .await
2526 .map(gax::response::Response::into_body)
2527 }
2528
2529 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2531 type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2532 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2533 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2534
2535 let stub = self.0.stub.clone();
2536 let mut options = self.0.options.clone();
2537 options.set_retry_policy(gax::retry_policy::NeverRetry);
2538 let query = move |name| {
2539 let stub = stub.clone();
2540 let options = options.clone();
2541 async {
2542 let op = GetOperation::new(stub)
2543 .set_name(name)
2544 .with_options(options)
2545 .send()
2546 .await?;
2547 Ok(Operation::new(op))
2548 }
2549 };
2550
2551 let start = move || async {
2552 let op = self.send().await?;
2553 Ok(Operation::new(op))
2554 };
2555
2556 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2557 }
2558
2559 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2561 self.0.request.parent = v.into();
2562 self
2563 }
2564
2565 pub fn set_service<T: Into<std::option::Option<crate::model::Service>>>(
2567 mut self,
2568 v: T,
2569 ) -> Self {
2570 self.0.request.service = v.into();
2571 self
2572 }
2573
2574 pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2576 self.0.request.service_id = v.into();
2577 self
2578 }
2579
2580 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2582 self.0.request.validate_only = v.into();
2583 self
2584 }
2585 }
2586
2587 #[doc(hidden)]
2588 impl gax::options::internal::RequestBuilder for CreateService {
2589 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2590 &mut self.0.options
2591 }
2592 }
2593
2594 #[derive(Clone, Debug)]
2596 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
2597
2598 impl GetService {
2599 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2600 Self(RequestBuilder::new(stub))
2601 }
2602
2603 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
2605 self.0.request = v.into();
2606 self
2607 }
2608
2609 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2611 self.0.options = v.into();
2612 self
2613 }
2614
2615 pub async fn send(self) -> Result<crate::model::Service> {
2617 (*self.0.stub)
2618 .get_service(self.0.request, self.0.options)
2619 .await
2620 .map(gax::response::Response::into_body)
2621 }
2622
2623 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2625 self.0.request.name = v.into();
2626 self
2627 }
2628 }
2629
2630 #[doc(hidden)]
2631 impl gax::options::internal::RequestBuilder for GetService {
2632 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2633 &mut self.0.options
2634 }
2635 }
2636
2637 #[derive(Clone, Debug)]
2639 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
2640
2641 impl ListServices {
2642 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2643 Self(RequestBuilder::new(stub))
2644 }
2645
2646 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
2648 self.0.request = v.into();
2649 self
2650 }
2651
2652 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2654 self.0.options = v.into();
2655 self
2656 }
2657
2658 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
2660 (*self.0.stub)
2661 .list_services(self.0.request, self.0.options)
2662 .await
2663 .map(gax::response::Response::into_body)
2664 }
2665
2666 pub async fn paginator(
2668 self,
2669 ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
2670 {
2671 use std::clone::Clone;
2672 let token = self.0.request.page_token.clone();
2673 let execute = move |token: String| {
2674 let mut builder = self.clone();
2675 builder.0.request = builder.0.request.set_page_token(token);
2676 builder.send()
2677 };
2678 gax::paginator::internal::new_paginator(token, execute)
2679 }
2680
2681 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2683 self.0.request.parent = v.into();
2684 self
2685 }
2686
2687 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2689 self.0.request.page_size = v.into();
2690 self
2691 }
2692
2693 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2695 self.0.request.page_token = v.into();
2696 self
2697 }
2698
2699 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2701 self.0.request.show_deleted = v.into();
2702 self
2703 }
2704 }
2705
2706 #[doc(hidden)]
2707 impl gax::options::internal::RequestBuilder for ListServices {
2708 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2709 &mut self.0.options
2710 }
2711 }
2712
2713 #[derive(Clone, Debug)]
2715 pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
2716
2717 impl UpdateService {
2718 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2719 Self(RequestBuilder::new(stub))
2720 }
2721
2722 pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
2724 self.0.request = v.into();
2725 self
2726 }
2727
2728 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2730 self.0.options = v.into();
2731 self
2732 }
2733
2734 pub async fn send(self) -> Result<longrunning::model::Operation> {
2741 (*self.0.stub)
2742 .update_service(self.0.request, self.0.options)
2743 .await
2744 .map(gax::response::Response::into_body)
2745 }
2746
2747 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2749 type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2750 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2751 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2752
2753 let stub = self.0.stub.clone();
2754 let mut options = self.0.options.clone();
2755 options.set_retry_policy(gax::retry_policy::NeverRetry);
2756 let query = move |name| {
2757 let stub = stub.clone();
2758 let options = options.clone();
2759 async {
2760 let op = GetOperation::new(stub)
2761 .set_name(name)
2762 .with_options(options)
2763 .send()
2764 .await?;
2765 Ok(Operation::new(op))
2766 }
2767 };
2768
2769 let start = move || async {
2770 let op = self.send().await?;
2771 Ok(Operation::new(op))
2772 };
2773
2774 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2775 }
2776
2777 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
2779 mut self,
2780 v: T,
2781 ) -> Self {
2782 self.0.request.update_mask = v.into();
2783 self
2784 }
2785
2786 pub fn set_service<T: Into<std::option::Option<crate::model::Service>>>(
2788 mut self,
2789 v: T,
2790 ) -> Self {
2791 self.0.request.service = v.into();
2792 self
2793 }
2794
2795 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2797 self.0.request.validate_only = v.into();
2798 self
2799 }
2800
2801 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2803 self.0.request.allow_missing = v.into();
2804 self
2805 }
2806 }
2807
2808 #[doc(hidden)]
2809 impl gax::options::internal::RequestBuilder for UpdateService {
2810 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2811 &mut self.0.options
2812 }
2813 }
2814
2815 #[derive(Clone, Debug)]
2817 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
2818
2819 impl DeleteService {
2820 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2821 Self(RequestBuilder::new(stub))
2822 }
2823
2824 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
2826 self.0.request = v.into();
2827 self
2828 }
2829
2830 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2832 self.0.options = v.into();
2833 self
2834 }
2835
2836 pub async fn send(self) -> Result<longrunning::model::Operation> {
2843 (*self.0.stub)
2844 .delete_service(self.0.request, self.0.options)
2845 .await
2846 .map(gax::response::Response::into_body)
2847 }
2848
2849 pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2851 type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2852 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2853 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2854
2855 let stub = self.0.stub.clone();
2856 let mut options = self.0.options.clone();
2857 options.set_retry_policy(gax::retry_policy::NeverRetry);
2858 let query = move |name| {
2859 let stub = stub.clone();
2860 let options = options.clone();
2861 async {
2862 let op = GetOperation::new(stub)
2863 .set_name(name)
2864 .with_options(options)
2865 .send()
2866 .await?;
2867 Ok(Operation::new(op))
2868 }
2869 };
2870
2871 let start = move || async {
2872 let op = self.send().await?;
2873 Ok(Operation::new(op))
2874 };
2875
2876 lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2877 }
2878
2879 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2881 self.0.request.name = v.into();
2882 self
2883 }
2884
2885 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2887 self.0.request.validate_only = v.into();
2888 self
2889 }
2890
2891 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2893 self.0.request.etag = v.into();
2894 self
2895 }
2896 }
2897
2898 #[doc(hidden)]
2899 impl gax::options::internal::RequestBuilder for DeleteService {
2900 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2901 &mut self.0.options
2902 }
2903 }
2904
2905 #[derive(Clone, Debug)]
2907 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2908
2909 impl GetIamPolicy {
2910 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2911 Self(RequestBuilder::new(stub))
2912 }
2913
2914 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2916 self.0.request = v.into();
2917 self
2918 }
2919
2920 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2922 self.0.options = v.into();
2923 self
2924 }
2925
2926 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2928 (*self.0.stub)
2929 .get_iam_policy(self.0.request, self.0.options)
2930 .await
2931 .map(gax::response::Response::into_body)
2932 }
2933
2934 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.0.request.resource = v.into();
2937 self
2938 }
2939
2940 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
2942 mut self,
2943 v: T,
2944 ) -> Self {
2945 self.0.request.options = v.into();
2946 self
2947 }
2948 }
2949
2950 #[doc(hidden)]
2951 impl gax::options::internal::RequestBuilder for GetIamPolicy {
2952 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2953 &mut self.0.options
2954 }
2955 }
2956
2957 #[derive(Clone, Debug)]
2959 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2960
2961 impl SetIamPolicy {
2962 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2963 Self(RequestBuilder::new(stub))
2964 }
2965
2966 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2968 self.0.request = v.into();
2969 self
2970 }
2971
2972 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2974 self.0.options = v.into();
2975 self
2976 }
2977
2978 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2980 (*self.0.stub)
2981 .set_iam_policy(self.0.request, self.0.options)
2982 .await
2983 .map(gax::response::Response::into_body)
2984 }
2985
2986 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2988 self.0.request.resource = v.into();
2989 self
2990 }
2991
2992 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
2994 mut self,
2995 v: T,
2996 ) -> Self {
2997 self.0.request.policy = v.into();
2998 self
2999 }
3000
3001 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
3003 mut self,
3004 v: T,
3005 ) -> Self {
3006 self.0.request.update_mask = v.into();
3007 self
3008 }
3009 }
3010
3011 #[doc(hidden)]
3012 impl gax::options::internal::RequestBuilder for SetIamPolicy {
3013 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3014 &mut self.0.options
3015 }
3016 }
3017
3018 #[derive(Clone, Debug)]
3020 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3021
3022 impl TestIamPermissions {
3023 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3024 Self(RequestBuilder::new(stub))
3025 }
3026
3027 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3029 mut self,
3030 v: V,
3031 ) -> Self {
3032 self.0.request = v.into();
3033 self
3034 }
3035
3036 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3038 self.0.options = v.into();
3039 self
3040 }
3041
3042 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3044 (*self.0.stub)
3045 .test_iam_permissions(self.0.request, self.0.options)
3046 .await
3047 .map(gax::response::Response::into_body)
3048 }
3049
3050 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3052 self.0.request.resource = v.into();
3053 self
3054 }
3055
3056 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3058 where
3059 T: std::iter::IntoIterator<Item = V>,
3060 V: std::convert::Into<std::string::String>,
3061 {
3062 use std::iter::Iterator;
3063 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3064 self
3065 }
3066 }
3067
3068 #[doc(hidden)]
3069 impl gax::options::internal::RequestBuilder for TestIamPermissions {
3070 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3071 &mut self.0.options
3072 }
3073 }
3074
3075 #[derive(Clone, Debug)]
3077 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3078
3079 impl ListOperations {
3080 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3081 Self(RequestBuilder::new(stub))
3082 }
3083
3084 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3086 mut self,
3087 v: V,
3088 ) -> Self {
3089 self.0.request = v.into();
3090 self
3091 }
3092
3093 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3095 self.0.options = v.into();
3096 self
3097 }
3098
3099 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3101 (*self.0.stub)
3102 .list_operations(self.0.request, self.0.options)
3103 .await
3104 .map(gax::response::Response::into_body)
3105 }
3106
3107 pub async fn paginator(
3109 self,
3110 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3111 {
3112 use std::clone::Clone;
3113 let token = self.0.request.page_token.clone();
3114 let execute = move |token: String| {
3115 let mut builder = self.clone();
3116 builder.0.request = builder.0.request.set_page_token(token);
3117 builder.send()
3118 };
3119 gax::paginator::internal::new_paginator(token, execute)
3120 }
3121
3122 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3124 self.0.request.name = v.into();
3125 self
3126 }
3127
3128 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3130 self.0.request.filter = v.into();
3131 self
3132 }
3133
3134 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3136 self.0.request.page_size = v.into();
3137 self
3138 }
3139
3140 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3142 self.0.request.page_token = v.into();
3143 self
3144 }
3145 }
3146
3147 #[doc(hidden)]
3148 impl gax::options::internal::RequestBuilder for ListOperations {
3149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3150 &mut self.0.options
3151 }
3152 }
3153
3154 #[derive(Clone, Debug)]
3156 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3157
3158 impl GetOperation {
3159 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3160 Self(RequestBuilder::new(stub))
3161 }
3162
3163 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3165 mut self,
3166 v: V,
3167 ) -> Self {
3168 self.0.request = v.into();
3169 self
3170 }
3171
3172 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3174 self.0.options = v.into();
3175 self
3176 }
3177
3178 pub async fn send(self) -> Result<longrunning::model::Operation> {
3180 (*self.0.stub)
3181 .get_operation(self.0.request, self.0.options)
3182 .await
3183 .map(gax::response::Response::into_body)
3184 }
3185
3186 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3188 self.0.request.name = v.into();
3189 self
3190 }
3191 }
3192
3193 #[doc(hidden)]
3194 impl gax::options::internal::RequestBuilder for GetOperation {
3195 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3196 &mut self.0.options
3197 }
3198 }
3199
3200 #[derive(Clone, Debug)]
3202 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3203
3204 impl DeleteOperation {
3205 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3206 Self(RequestBuilder::new(stub))
3207 }
3208
3209 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3211 mut self,
3212 v: V,
3213 ) -> Self {
3214 self.0.request = v.into();
3215 self
3216 }
3217
3218 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3220 self.0.options = v.into();
3221 self
3222 }
3223
3224 pub async fn send(self) -> Result<()> {
3226 (*self.0.stub)
3227 .delete_operation(self.0.request, self.0.options)
3228 .await
3229 .map(gax::response::Response::into_body)
3230 }
3231
3232 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3234 self.0.request.name = v.into();
3235 self
3236 }
3237 }
3238
3239 #[doc(hidden)]
3240 impl gax::options::internal::RequestBuilder for DeleteOperation {
3241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3242 &mut self.0.options
3243 }
3244 }
3245
3246 #[derive(Clone, Debug)]
3248 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3249
3250 impl WaitOperation {
3251 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3252 Self(RequestBuilder::new(stub))
3253 }
3254
3255 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3257 mut self,
3258 v: V,
3259 ) -> Self {
3260 self.0.request = v.into();
3261 self
3262 }
3263
3264 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3266 self.0.options = v.into();
3267 self
3268 }
3269
3270 pub async fn send(self) -> Result<longrunning::model::Operation> {
3272 (*self.0.stub)
3273 .wait_operation(self.0.request, self.0.options)
3274 .await
3275 .map(gax::response::Response::into_body)
3276 }
3277
3278 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3280 self.0.request.name = v.into();
3281 self
3282 }
3283
3284 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
3286 self.0.request.timeout = v.into();
3287 self
3288 }
3289 }
3290
3291 #[doc(hidden)]
3292 impl gax::options::internal::RequestBuilder for WaitOperation {
3293 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3294 &mut self.0.options
3295 }
3296 }
3297}
3298
3299pub mod tasks {
3300 use crate::Result;
3301 use std::sync::Arc;
3302
3303 pub type ClientBuilder =
3317 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3318
3319 pub(crate) mod client {
3320 use super::super::super::client::Tasks;
3321 pub struct Factory;
3322 impl gax::client_builder::internal::ClientFactory for Factory {
3323 type Client = Tasks;
3324 type Credentials = gaxi::options::Credentials;
3325 async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
3326 Self::Client::new(config).await
3327 }
3328 }
3329 }
3330
3331 #[derive(Clone, Debug)]
3333 pub(crate) struct RequestBuilder<R: std::default::Default> {
3334 stub: Arc<dyn super::super::stub::dynamic::Tasks>,
3335 request: R,
3336 options: gax::options::RequestOptions,
3337 }
3338
3339 impl<R> RequestBuilder<R>
3340 where
3341 R: std::default::Default,
3342 {
3343 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3344 Self {
3345 stub,
3346 request: R::default(),
3347 options: gax::options::RequestOptions::default(),
3348 }
3349 }
3350 }
3351
3352 #[derive(Clone, Debug)]
3354 pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
3355
3356 impl GetTask {
3357 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3358 Self(RequestBuilder::new(stub))
3359 }
3360
3361 pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
3363 self.0.request = v.into();
3364 self
3365 }
3366
3367 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3369 self.0.options = v.into();
3370 self
3371 }
3372
3373 pub async fn send(self) -> Result<crate::model::Task> {
3375 (*self.0.stub)
3376 .get_task(self.0.request, self.0.options)
3377 .await
3378 .map(gax::response::Response::into_body)
3379 }
3380
3381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3383 self.0.request.name = v.into();
3384 self
3385 }
3386 }
3387
3388 #[doc(hidden)]
3389 impl gax::options::internal::RequestBuilder for GetTask {
3390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3391 &mut self.0.options
3392 }
3393 }
3394
3395 #[derive(Clone, Debug)]
3397 pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
3398
3399 impl ListTasks {
3400 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3401 Self(RequestBuilder::new(stub))
3402 }
3403
3404 pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
3406 self.0.request = v.into();
3407 self
3408 }
3409
3410 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3412 self.0.options = v.into();
3413 self
3414 }
3415
3416 pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
3418 (*self.0.stub)
3419 .list_tasks(self.0.request, self.0.options)
3420 .await
3421 .map(gax::response::Response::into_body)
3422 }
3423
3424 pub async fn paginator(
3426 self,
3427 ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
3428 {
3429 use std::clone::Clone;
3430 let token = self.0.request.page_token.clone();
3431 let execute = move |token: String| {
3432 let mut builder = self.clone();
3433 builder.0.request = builder.0.request.set_page_token(token);
3434 builder.send()
3435 };
3436 gax::paginator::internal::new_paginator(token, execute)
3437 }
3438
3439 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3441 self.0.request.parent = v.into();
3442 self
3443 }
3444
3445 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3447 self.0.request.page_size = v.into();
3448 self
3449 }
3450
3451 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3453 self.0.request.page_token = v.into();
3454 self
3455 }
3456
3457 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3459 self.0.request.show_deleted = v.into();
3460 self
3461 }
3462 }
3463
3464 #[doc(hidden)]
3465 impl gax::options::internal::RequestBuilder for ListTasks {
3466 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3467 &mut self.0.options
3468 }
3469 }
3470
3471 #[derive(Clone, Debug)]
3473 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3474
3475 impl ListOperations {
3476 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3477 Self(RequestBuilder::new(stub))
3478 }
3479
3480 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3482 mut self,
3483 v: V,
3484 ) -> Self {
3485 self.0.request = v.into();
3486 self
3487 }
3488
3489 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3491 self.0.options = v.into();
3492 self
3493 }
3494
3495 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3497 (*self.0.stub)
3498 .list_operations(self.0.request, self.0.options)
3499 .await
3500 .map(gax::response::Response::into_body)
3501 }
3502
3503 pub async fn paginator(
3505 self,
3506 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3507 {
3508 use std::clone::Clone;
3509 let token = self.0.request.page_token.clone();
3510 let execute = move |token: String| {
3511 let mut builder = self.clone();
3512 builder.0.request = builder.0.request.set_page_token(token);
3513 builder.send()
3514 };
3515 gax::paginator::internal::new_paginator(token, execute)
3516 }
3517
3518 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3520 self.0.request.name = v.into();
3521 self
3522 }
3523
3524 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3526 self.0.request.filter = v.into();
3527 self
3528 }
3529
3530 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3532 self.0.request.page_size = v.into();
3533 self
3534 }
3535
3536 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3538 self.0.request.page_token = v.into();
3539 self
3540 }
3541 }
3542
3543 #[doc(hidden)]
3544 impl gax::options::internal::RequestBuilder for ListOperations {
3545 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3546 &mut self.0.options
3547 }
3548 }
3549
3550 #[derive(Clone, Debug)]
3552 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3553
3554 impl GetOperation {
3555 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3556 Self(RequestBuilder::new(stub))
3557 }
3558
3559 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3561 mut self,
3562 v: V,
3563 ) -> Self {
3564 self.0.request = v.into();
3565 self
3566 }
3567
3568 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3570 self.0.options = v.into();
3571 self
3572 }
3573
3574 pub async fn send(self) -> Result<longrunning::model::Operation> {
3576 (*self.0.stub)
3577 .get_operation(self.0.request, self.0.options)
3578 .await
3579 .map(gax::response::Response::into_body)
3580 }
3581
3582 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3584 self.0.request.name = v.into();
3585 self
3586 }
3587 }
3588
3589 #[doc(hidden)]
3590 impl gax::options::internal::RequestBuilder for GetOperation {
3591 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3592 &mut self.0.options
3593 }
3594 }
3595
3596 #[derive(Clone, Debug)]
3598 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3599
3600 impl DeleteOperation {
3601 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3602 Self(RequestBuilder::new(stub))
3603 }
3604
3605 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3607 mut self,
3608 v: V,
3609 ) -> Self {
3610 self.0.request = v.into();
3611 self
3612 }
3613
3614 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3616 self.0.options = v.into();
3617 self
3618 }
3619
3620 pub async fn send(self) -> Result<()> {
3622 (*self.0.stub)
3623 .delete_operation(self.0.request, self.0.options)
3624 .await
3625 .map(gax::response::Response::into_body)
3626 }
3627
3628 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3630 self.0.request.name = v.into();
3631 self
3632 }
3633 }
3634
3635 #[doc(hidden)]
3636 impl gax::options::internal::RequestBuilder for DeleteOperation {
3637 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3638 &mut self.0.options
3639 }
3640 }
3641
3642 #[derive(Clone, Debug)]
3644 pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3645
3646 impl WaitOperation {
3647 pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3648 Self(RequestBuilder::new(stub))
3649 }
3650
3651 pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3653 mut self,
3654 v: V,
3655 ) -> Self {
3656 self.0.request = v.into();
3657 self
3658 }
3659
3660 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3662 self.0.options = v.into();
3663 self
3664 }
3665
3666 pub async fn send(self) -> Result<longrunning::model::Operation> {
3668 (*self.0.stub)
3669 .wait_operation(self.0.request, self.0.options)
3670 .await
3671 .map(gax::response::Response::into_body)
3672 }
3673
3674 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3676 self.0.request.name = v.into();
3677 self
3678 }
3679
3680 pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
3682 self.0.request.timeout = v.into();
3683 self
3684 }
3685 }
3686
3687 #[doc(hidden)]
3688 impl gax::options::internal::RequestBuilder for WaitOperation {
3689 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3690 &mut self.0.options
3691 }
3692 }
3693}