1pub mod tpu {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::Tpu;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Tpu;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
63 Self {
64 stub,
65 request: R::default(),
66 options: crate::RequestOptions::default(),
67 }
68 }
69 }
70
71 #[derive(Clone, Debug)]
92 pub struct ListNodes(RequestBuilder<crate::model::ListNodesRequest>);
93
94 impl ListNodes {
95 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::ListNodesRequest>>(mut self, v: V) -> Self {
101 self.0.request = v.into();
102 self
103 }
104
105 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107 self.0.options = v.into();
108 self
109 }
110
111 pub async fn send(self) -> Result<crate::model::ListNodesResponse> {
113 (*self.0.stub)
114 .list_nodes(self.0.request, self.0.options)
115 .await
116 .map(crate::Response::into_body)
117 }
118
119 pub fn by_page(
121 self,
122 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListNodesResponse, crate::Error>
123 {
124 use std::clone::Clone;
125 let token = self.0.request.page_token.clone();
126 let execute = move |token: String| {
127 let mut builder = self.clone();
128 builder.0.request = builder.0.request.set_page_token(token);
129 builder.send()
130 };
131 google_cloud_gax::paginator::internal::new_paginator(token, execute)
132 }
133
134 pub fn by_item(
136 self,
137 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListNodesResponse, crate::Error>
138 {
139 use google_cloud_gax::paginator::Paginator;
140 self.by_page().items()
141 }
142
143 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
147 self.0.request.parent = v.into();
148 self
149 }
150
151 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
153 self.0.request.page_size = v.into();
154 self
155 }
156
157 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
159 self.0.request.page_token = v.into();
160 self
161 }
162 }
163
164 #[doc(hidden)]
165 impl crate::RequestBuilder for ListNodes {
166 fn request_options(&mut self) -> &mut crate::RequestOptions {
167 &mut self.0.options
168 }
169 }
170
171 #[derive(Clone, Debug)]
188 pub struct GetNode(RequestBuilder<crate::model::GetNodeRequest>);
189
190 impl GetNode {
191 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
192 Self(RequestBuilder::new(stub))
193 }
194
195 pub fn with_request<V: Into<crate::model::GetNodeRequest>>(mut self, v: V) -> Self {
197 self.0.request = v.into();
198 self
199 }
200
201 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
203 self.0.options = v.into();
204 self
205 }
206
207 pub async fn send(self) -> Result<crate::model::Node> {
209 (*self.0.stub)
210 .get_node(self.0.request, self.0.options)
211 .await
212 .map(crate::Response::into_body)
213 }
214
215 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
219 self.0.request.name = v.into();
220 self
221 }
222 }
223
224 #[doc(hidden)]
225 impl crate::RequestBuilder for GetNode {
226 fn request_options(&mut self) -> &mut crate::RequestOptions {
227 &mut self.0.options
228 }
229 }
230
231 #[derive(Clone, Debug)]
249 pub struct CreateNode(RequestBuilder<crate::model::CreateNodeRequest>);
250
251 impl CreateNode {
252 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
253 Self(RequestBuilder::new(stub))
254 }
255
256 pub fn with_request<V: Into<crate::model::CreateNodeRequest>>(mut self, v: V) -> Self {
258 self.0.request = v.into();
259 self
260 }
261
262 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
264 self.0.options = v.into();
265 self
266 }
267
268 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
275 (*self.0.stub)
276 .create_node(self.0.request, self.0.options)
277 .await
278 .map(crate::Response::into_body)
279 }
280
281 pub fn poller(
283 self,
284 ) -> impl google_cloud_lro::Poller<crate::model::Node, crate::model::OperationMetadata>
285 {
286 type Operation = google_cloud_lro::internal::Operation<
287 crate::model::Node,
288 crate::model::OperationMetadata,
289 >;
290 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
291 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
292
293 let stub = self.0.stub.clone();
294 let mut options = self.0.options.clone();
295 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
296 let query = move |name| {
297 let stub = stub.clone();
298 let options = options.clone();
299 async {
300 let op = GetOperation::new(stub)
301 .set_name(name)
302 .with_options(options)
303 .send()
304 .await?;
305 Ok(Operation::new(op))
306 }
307 };
308
309 let start = move || async {
310 let op = self.send().await?;
311 Ok(Operation::new(op))
312 };
313
314 google_cloud_lro::internal::new_poller(
315 polling_error_policy,
316 polling_backoff_policy,
317 start,
318 query,
319 )
320 }
321
322 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
326 self.0.request.parent = v.into();
327 self
328 }
329
330 pub fn set_node_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
332 self.0.request.node_id = v.into();
333 self
334 }
335
336 pub fn set_node<T>(mut self, v: T) -> Self
340 where
341 T: std::convert::Into<crate::model::Node>,
342 {
343 self.0.request.node = std::option::Option::Some(v.into());
344 self
345 }
346
347 pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
351 where
352 T: std::convert::Into<crate::model::Node>,
353 {
354 self.0.request.node = v.map(|x| x.into());
355 self
356 }
357 }
358
359 #[doc(hidden)]
360 impl crate::RequestBuilder for CreateNode {
361 fn request_options(&mut self) -> &mut crate::RequestOptions {
362 &mut self.0.options
363 }
364 }
365
366 #[derive(Clone, Debug)]
384 pub struct DeleteNode(RequestBuilder<crate::model::DeleteNodeRequest>);
385
386 impl DeleteNode {
387 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
388 Self(RequestBuilder::new(stub))
389 }
390
391 pub fn with_request<V: Into<crate::model::DeleteNodeRequest>>(mut self, v: V) -> Self {
393 self.0.request = v.into();
394 self
395 }
396
397 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
399 self.0.options = v.into();
400 self
401 }
402
403 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
410 (*self.0.stub)
411 .delete_node(self.0.request, self.0.options)
412 .await
413 .map(crate::Response::into_body)
414 }
415
416 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
418 type Operation =
419 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
420 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
421 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
422
423 let stub = self.0.stub.clone();
424 let mut options = self.0.options.clone();
425 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
426 let query = move |name| {
427 let stub = stub.clone();
428 let options = options.clone();
429 async {
430 let op = GetOperation::new(stub)
431 .set_name(name)
432 .with_options(options)
433 .send()
434 .await?;
435 Ok(Operation::new(op))
436 }
437 };
438
439 let start = move || async {
440 let op = self.send().await?;
441 Ok(Operation::new(op))
442 };
443
444 google_cloud_lro::internal::new_unit_response_poller(
445 polling_error_policy,
446 polling_backoff_policy,
447 start,
448 query,
449 )
450 }
451
452 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
456 self.0.request.name = v.into();
457 self
458 }
459 }
460
461 #[doc(hidden)]
462 impl crate::RequestBuilder for DeleteNode {
463 fn request_options(&mut self) -> &mut crate::RequestOptions {
464 &mut self.0.options
465 }
466 }
467
468 #[derive(Clone, Debug)]
486 pub struct StopNode(RequestBuilder<crate::model::StopNodeRequest>);
487
488 impl StopNode {
489 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
490 Self(RequestBuilder::new(stub))
491 }
492
493 pub fn with_request<V: Into<crate::model::StopNodeRequest>>(mut self, v: V) -> Self {
495 self.0.request = v.into();
496 self
497 }
498
499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
501 self.0.options = v.into();
502 self
503 }
504
505 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
512 (*self.0.stub)
513 .stop_node(self.0.request, self.0.options)
514 .await
515 .map(crate::Response::into_body)
516 }
517
518 pub fn poller(
520 self,
521 ) -> impl google_cloud_lro::Poller<crate::model::Node, crate::model::OperationMetadata>
522 {
523 type Operation = google_cloud_lro::internal::Operation<
524 crate::model::Node,
525 crate::model::OperationMetadata,
526 >;
527 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
528 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
529
530 let stub = self.0.stub.clone();
531 let mut options = self.0.options.clone();
532 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
533 let query = move |name| {
534 let stub = stub.clone();
535 let options = options.clone();
536 async {
537 let op = GetOperation::new(stub)
538 .set_name(name)
539 .with_options(options)
540 .send()
541 .await?;
542 Ok(Operation::new(op))
543 }
544 };
545
546 let start = move || async {
547 let op = self.send().await?;
548 Ok(Operation::new(op))
549 };
550
551 google_cloud_lro::internal::new_poller(
552 polling_error_policy,
553 polling_backoff_policy,
554 start,
555 query,
556 )
557 }
558
559 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
563 self.0.request.name = v.into();
564 self
565 }
566 }
567
568 #[doc(hidden)]
569 impl crate::RequestBuilder for StopNode {
570 fn request_options(&mut self) -> &mut crate::RequestOptions {
571 &mut self.0.options
572 }
573 }
574
575 #[derive(Clone, Debug)]
593 pub struct StartNode(RequestBuilder<crate::model::StartNodeRequest>);
594
595 impl StartNode {
596 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
597 Self(RequestBuilder::new(stub))
598 }
599
600 pub fn with_request<V: Into<crate::model::StartNodeRequest>>(mut self, v: V) -> Self {
602 self.0.request = v.into();
603 self
604 }
605
606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
608 self.0.options = v.into();
609 self
610 }
611
612 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
619 (*self.0.stub)
620 .start_node(self.0.request, self.0.options)
621 .await
622 .map(crate::Response::into_body)
623 }
624
625 pub fn poller(
627 self,
628 ) -> impl google_cloud_lro::Poller<crate::model::Node, crate::model::OperationMetadata>
629 {
630 type Operation = google_cloud_lro::internal::Operation<
631 crate::model::Node,
632 crate::model::OperationMetadata,
633 >;
634 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
635 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
636
637 let stub = self.0.stub.clone();
638 let mut options = self.0.options.clone();
639 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
640 let query = move |name| {
641 let stub = stub.clone();
642 let options = options.clone();
643 async {
644 let op = GetOperation::new(stub)
645 .set_name(name)
646 .with_options(options)
647 .send()
648 .await?;
649 Ok(Operation::new(op))
650 }
651 };
652
653 let start = move || async {
654 let op = self.send().await?;
655 Ok(Operation::new(op))
656 };
657
658 google_cloud_lro::internal::new_poller(
659 polling_error_policy,
660 polling_backoff_policy,
661 start,
662 query,
663 )
664 }
665
666 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
670 self.0.request.name = v.into();
671 self
672 }
673 }
674
675 #[doc(hidden)]
676 impl crate::RequestBuilder for StartNode {
677 fn request_options(&mut self) -> &mut crate::RequestOptions {
678 &mut self.0.options
679 }
680 }
681
682 #[derive(Clone, Debug)]
700 pub struct UpdateNode(RequestBuilder<crate::model::UpdateNodeRequest>);
701
702 impl UpdateNode {
703 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
704 Self(RequestBuilder::new(stub))
705 }
706
707 pub fn with_request<V: Into<crate::model::UpdateNodeRequest>>(mut self, v: V) -> Self {
709 self.0.request = v.into();
710 self
711 }
712
713 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
715 self.0.options = v.into();
716 self
717 }
718
719 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
726 (*self.0.stub)
727 .update_node(self.0.request, self.0.options)
728 .await
729 .map(crate::Response::into_body)
730 }
731
732 pub fn poller(
734 self,
735 ) -> impl google_cloud_lro::Poller<crate::model::Node, crate::model::OperationMetadata>
736 {
737 type Operation = google_cloud_lro::internal::Operation<
738 crate::model::Node,
739 crate::model::OperationMetadata,
740 >;
741 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
742 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
743
744 let stub = self.0.stub.clone();
745 let mut options = self.0.options.clone();
746 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
747 let query = move |name| {
748 let stub = stub.clone();
749 let options = options.clone();
750 async {
751 let op = GetOperation::new(stub)
752 .set_name(name)
753 .with_options(options)
754 .send()
755 .await?;
756 Ok(Operation::new(op))
757 }
758 };
759
760 let start = move || async {
761 let op = self.send().await?;
762 Ok(Operation::new(op))
763 };
764
765 google_cloud_lro::internal::new_poller(
766 polling_error_policy,
767 polling_backoff_policy,
768 start,
769 query,
770 )
771 }
772
773 pub fn set_update_mask<T>(mut self, v: T) -> Self
777 where
778 T: std::convert::Into<wkt::FieldMask>,
779 {
780 self.0.request.update_mask = std::option::Option::Some(v.into());
781 self
782 }
783
784 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
788 where
789 T: std::convert::Into<wkt::FieldMask>,
790 {
791 self.0.request.update_mask = v.map(|x| x.into());
792 self
793 }
794
795 pub fn set_node<T>(mut self, v: T) -> Self
799 where
800 T: std::convert::Into<crate::model::Node>,
801 {
802 self.0.request.node = std::option::Option::Some(v.into());
803 self
804 }
805
806 pub fn set_or_clear_node<T>(mut self, v: std::option::Option<T>) -> Self
810 where
811 T: std::convert::Into<crate::model::Node>,
812 {
813 self.0.request.node = v.map(|x| x.into());
814 self
815 }
816 }
817
818 #[doc(hidden)]
819 impl crate::RequestBuilder for UpdateNode {
820 fn request_options(&mut self) -> &mut crate::RequestOptions {
821 &mut self.0.options
822 }
823 }
824
825 #[derive(Clone, Debug)]
846 pub struct ListQueuedResources(RequestBuilder<crate::model::ListQueuedResourcesRequest>);
847
848 impl ListQueuedResources {
849 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
850 Self(RequestBuilder::new(stub))
851 }
852
853 pub fn with_request<V: Into<crate::model::ListQueuedResourcesRequest>>(
855 mut self,
856 v: V,
857 ) -> Self {
858 self.0.request = v.into();
859 self
860 }
861
862 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
864 self.0.options = v.into();
865 self
866 }
867
868 pub async fn send(self) -> Result<crate::model::ListQueuedResourcesResponse> {
870 (*self.0.stub)
871 .list_queued_resources(self.0.request, self.0.options)
872 .await
873 .map(crate::Response::into_body)
874 }
875
876 pub fn by_page(
878 self,
879 ) -> impl google_cloud_gax::paginator::Paginator<
880 crate::model::ListQueuedResourcesResponse,
881 crate::Error,
882 > {
883 use std::clone::Clone;
884 let token = self.0.request.page_token.clone();
885 let execute = move |token: String| {
886 let mut builder = self.clone();
887 builder.0.request = builder.0.request.set_page_token(token);
888 builder.send()
889 };
890 google_cloud_gax::paginator::internal::new_paginator(token, execute)
891 }
892
893 pub fn by_item(
895 self,
896 ) -> impl google_cloud_gax::paginator::ItemPaginator<
897 crate::model::ListQueuedResourcesResponse,
898 crate::Error,
899 > {
900 use google_cloud_gax::paginator::Paginator;
901 self.by_page().items()
902 }
903
904 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
908 self.0.request.parent = v.into();
909 self
910 }
911
912 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
914 self.0.request.page_size = v.into();
915 self
916 }
917
918 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
920 self.0.request.page_token = v.into();
921 self
922 }
923 }
924
925 #[doc(hidden)]
926 impl crate::RequestBuilder for ListQueuedResources {
927 fn request_options(&mut self) -> &mut crate::RequestOptions {
928 &mut self.0.options
929 }
930 }
931
932 #[derive(Clone, Debug)]
949 pub struct GetQueuedResource(RequestBuilder<crate::model::GetQueuedResourceRequest>);
950
951 impl GetQueuedResource {
952 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
953 Self(RequestBuilder::new(stub))
954 }
955
956 pub fn with_request<V: Into<crate::model::GetQueuedResourceRequest>>(
958 mut self,
959 v: V,
960 ) -> Self {
961 self.0.request = v.into();
962 self
963 }
964
965 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
967 self.0.options = v.into();
968 self
969 }
970
971 pub async fn send(self) -> Result<crate::model::QueuedResource> {
973 (*self.0.stub)
974 .get_queued_resource(self.0.request, self.0.options)
975 .await
976 .map(crate::Response::into_body)
977 }
978
979 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
983 self.0.request.name = v.into();
984 self
985 }
986 }
987
988 #[doc(hidden)]
989 impl crate::RequestBuilder for GetQueuedResource {
990 fn request_options(&mut self) -> &mut crate::RequestOptions {
991 &mut self.0.options
992 }
993 }
994
995 #[derive(Clone, Debug)]
1013 pub struct CreateQueuedResource(RequestBuilder<crate::model::CreateQueuedResourceRequest>);
1014
1015 impl CreateQueuedResource {
1016 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1017 Self(RequestBuilder::new(stub))
1018 }
1019
1020 pub fn with_request<V: Into<crate::model::CreateQueuedResourceRequest>>(
1022 mut self,
1023 v: V,
1024 ) -> Self {
1025 self.0.request = v.into();
1026 self
1027 }
1028
1029 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1031 self.0.options = v.into();
1032 self
1033 }
1034
1035 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1042 (*self.0.stub)
1043 .create_queued_resource(self.0.request, self.0.options)
1044 .await
1045 .map(crate::Response::into_body)
1046 }
1047
1048 pub fn poller(
1050 self,
1051 ) -> impl google_cloud_lro::Poller<crate::model::QueuedResource, crate::model::OperationMetadata>
1052 {
1053 type Operation = google_cloud_lro::internal::Operation<
1054 crate::model::QueuedResource,
1055 crate::model::OperationMetadata,
1056 >;
1057 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1058 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1059
1060 let stub = self.0.stub.clone();
1061 let mut options = self.0.options.clone();
1062 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1063 let query = move |name| {
1064 let stub = stub.clone();
1065 let options = options.clone();
1066 async {
1067 let op = GetOperation::new(stub)
1068 .set_name(name)
1069 .with_options(options)
1070 .send()
1071 .await?;
1072 Ok(Operation::new(op))
1073 }
1074 };
1075
1076 let start = move || async {
1077 let op = self.send().await?;
1078 Ok(Operation::new(op))
1079 };
1080
1081 google_cloud_lro::internal::new_poller(
1082 polling_error_policy,
1083 polling_backoff_policy,
1084 start,
1085 query,
1086 )
1087 }
1088
1089 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1093 self.0.request.parent = v.into();
1094 self
1095 }
1096
1097 pub fn set_queued_resource_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1099 self.0.request.queued_resource_id = v.into();
1100 self
1101 }
1102
1103 pub fn set_queued_resource<T>(mut self, v: T) -> Self
1107 where
1108 T: std::convert::Into<crate::model::QueuedResource>,
1109 {
1110 self.0.request.queued_resource = std::option::Option::Some(v.into());
1111 self
1112 }
1113
1114 pub fn set_or_clear_queued_resource<T>(mut self, v: std::option::Option<T>) -> Self
1118 where
1119 T: std::convert::Into<crate::model::QueuedResource>,
1120 {
1121 self.0.request.queued_resource = v.map(|x| x.into());
1122 self
1123 }
1124
1125 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1127 self.0.request.request_id = v.into();
1128 self
1129 }
1130 }
1131
1132 #[doc(hidden)]
1133 impl crate::RequestBuilder for CreateQueuedResource {
1134 fn request_options(&mut self) -> &mut crate::RequestOptions {
1135 &mut self.0.options
1136 }
1137 }
1138
1139 #[derive(Clone, Debug)]
1157 pub struct DeleteQueuedResource(RequestBuilder<crate::model::DeleteQueuedResourceRequest>);
1158
1159 impl DeleteQueuedResource {
1160 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1161 Self(RequestBuilder::new(stub))
1162 }
1163
1164 pub fn with_request<V: Into<crate::model::DeleteQueuedResourceRequest>>(
1166 mut self,
1167 v: V,
1168 ) -> Self {
1169 self.0.request = v.into();
1170 self
1171 }
1172
1173 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1175 self.0.options = v.into();
1176 self
1177 }
1178
1179 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1186 (*self.0.stub)
1187 .delete_queued_resource(self.0.request, self.0.options)
1188 .await
1189 .map(crate::Response::into_body)
1190 }
1191
1192 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
1194 type Operation =
1195 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1196 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1197 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1198
1199 let stub = self.0.stub.clone();
1200 let mut options = self.0.options.clone();
1201 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1202 let query = move |name| {
1203 let stub = stub.clone();
1204 let options = options.clone();
1205 async {
1206 let op = GetOperation::new(stub)
1207 .set_name(name)
1208 .with_options(options)
1209 .send()
1210 .await?;
1211 Ok(Operation::new(op))
1212 }
1213 };
1214
1215 let start = move || async {
1216 let op = self.send().await?;
1217 Ok(Operation::new(op))
1218 };
1219
1220 google_cloud_lro::internal::new_unit_response_poller(
1221 polling_error_policy,
1222 polling_backoff_policy,
1223 start,
1224 query,
1225 )
1226 }
1227
1228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1232 self.0.request.name = v.into();
1233 self
1234 }
1235
1236 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1238 self.0.request.request_id = v.into();
1239 self
1240 }
1241
1242 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1244 self.0.request.force = v.into();
1245 self
1246 }
1247 }
1248
1249 #[doc(hidden)]
1250 impl crate::RequestBuilder for DeleteQueuedResource {
1251 fn request_options(&mut self) -> &mut crate::RequestOptions {
1252 &mut self.0.options
1253 }
1254 }
1255
1256 #[derive(Clone, Debug)]
1274 pub struct ResetQueuedResource(RequestBuilder<crate::model::ResetQueuedResourceRequest>);
1275
1276 impl ResetQueuedResource {
1277 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1278 Self(RequestBuilder::new(stub))
1279 }
1280
1281 pub fn with_request<V: Into<crate::model::ResetQueuedResourceRequest>>(
1283 mut self,
1284 v: V,
1285 ) -> Self {
1286 self.0.request = v.into();
1287 self
1288 }
1289
1290 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1292 self.0.options = v.into();
1293 self
1294 }
1295
1296 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1303 (*self.0.stub)
1304 .reset_queued_resource(self.0.request, self.0.options)
1305 .await
1306 .map(crate::Response::into_body)
1307 }
1308
1309 pub fn poller(
1311 self,
1312 ) -> impl google_cloud_lro::Poller<crate::model::QueuedResource, crate::model::OperationMetadata>
1313 {
1314 type Operation = google_cloud_lro::internal::Operation<
1315 crate::model::QueuedResource,
1316 crate::model::OperationMetadata,
1317 >;
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(google_cloud_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 google_cloud_lro::internal::new_poller(
1343 polling_error_policy,
1344 polling_backoff_policy,
1345 start,
1346 query,
1347 )
1348 }
1349
1350 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1354 self.0.request.name = v.into();
1355 self
1356 }
1357 }
1358
1359 #[doc(hidden)]
1360 impl crate::RequestBuilder for ResetQueuedResource {
1361 fn request_options(&mut self) -> &mut crate::RequestOptions {
1362 &mut self.0.options
1363 }
1364 }
1365
1366 #[derive(Clone, Debug)]
1383 pub struct GenerateServiceIdentity(
1384 RequestBuilder<crate::model::GenerateServiceIdentityRequest>,
1385 );
1386
1387 impl GenerateServiceIdentity {
1388 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1389 Self(RequestBuilder::new(stub))
1390 }
1391
1392 pub fn with_request<V: Into<crate::model::GenerateServiceIdentityRequest>>(
1394 mut self,
1395 v: V,
1396 ) -> Self {
1397 self.0.request = v.into();
1398 self
1399 }
1400
1401 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1403 self.0.options = v.into();
1404 self
1405 }
1406
1407 pub async fn send(self) -> Result<crate::model::GenerateServiceIdentityResponse> {
1409 (*self.0.stub)
1410 .generate_service_identity(self.0.request, self.0.options)
1411 .await
1412 .map(crate::Response::into_body)
1413 }
1414
1415 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.parent = v.into();
1420 self
1421 }
1422 }
1423
1424 #[doc(hidden)]
1425 impl crate::RequestBuilder for GenerateServiceIdentity {
1426 fn request_options(&mut self) -> &mut crate::RequestOptions {
1427 &mut self.0.options
1428 }
1429 }
1430
1431 #[derive(Clone, Debug)]
1452 pub struct ListAcceleratorTypes(RequestBuilder<crate::model::ListAcceleratorTypesRequest>);
1453
1454 impl ListAcceleratorTypes {
1455 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1456 Self(RequestBuilder::new(stub))
1457 }
1458
1459 pub fn with_request<V: Into<crate::model::ListAcceleratorTypesRequest>>(
1461 mut self,
1462 v: V,
1463 ) -> Self {
1464 self.0.request = v.into();
1465 self
1466 }
1467
1468 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1470 self.0.options = v.into();
1471 self
1472 }
1473
1474 pub async fn send(self) -> Result<crate::model::ListAcceleratorTypesResponse> {
1476 (*self.0.stub)
1477 .list_accelerator_types(self.0.request, self.0.options)
1478 .await
1479 .map(crate::Response::into_body)
1480 }
1481
1482 pub fn by_page(
1484 self,
1485 ) -> impl google_cloud_gax::paginator::Paginator<
1486 crate::model::ListAcceleratorTypesResponse,
1487 crate::Error,
1488 > {
1489 use std::clone::Clone;
1490 let token = self.0.request.page_token.clone();
1491 let execute = move |token: String| {
1492 let mut builder = self.clone();
1493 builder.0.request = builder.0.request.set_page_token(token);
1494 builder.send()
1495 };
1496 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1497 }
1498
1499 pub fn by_item(
1501 self,
1502 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1503 crate::model::ListAcceleratorTypesResponse,
1504 crate::Error,
1505 > {
1506 use google_cloud_gax::paginator::Paginator;
1507 self.by_page().items()
1508 }
1509
1510 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1514 self.0.request.parent = v.into();
1515 self
1516 }
1517
1518 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1520 self.0.request.page_size = v.into();
1521 self
1522 }
1523
1524 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1526 self.0.request.page_token = v.into();
1527 self
1528 }
1529
1530 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1532 self.0.request.filter = v.into();
1533 self
1534 }
1535
1536 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1538 self.0.request.order_by = v.into();
1539 self
1540 }
1541 }
1542
1543 #[doc(hidden)]
1544 impl crate::RequestBuilder for ListAcceleratorTypes {
1545 fn request_options(&mut self) -> &mut crate::RequestOptions {
1546 &mut self.0.options
1547 }
1548 }
1549
1550 #[derive(Clone, Debug)]
1567 pub struct GetAcceleratorType(RequestBuilder<crate::model::GetAcceleratorTypeRequest>);
1568
1569 impl GetAcceleratorType {
1570 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1571 Self(RequestBuilder::new(stub))
1572 }
1573
1574 pub fn with_request<V: Into<crate::model::GetAcceleratorTypeRequest>>(
1576 mut self,
1577 v: V,
1578 ) -> Self {
1579 self.0.request = v.into();
1580 self
1581 }
1582
1583 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1585 self.0.options = v.into();
1586 self
1587 }
1588
1589 pub async fn send(self) -> Result<crate::model::AcceleratorType> {
1591 (*self.0.stub)
1592 .get_accelerator_type(self.0.request, self.0.options)
1593 .await
1594 .map(crate::Response::into_body)
1595 }
1596
1597 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1601 self.0.request.name = v.into();
1602 self
1603 }
1604 }
1605
1606 #[doc(hidden)]
1607 impl crate::RequestBuilder for GetAcceleratorType {
1608 fn request_options(&mut self) -> &mut crate::RequestOptions {
1609 &mut self.0.options
1610 }
1611 }
1612
1613 #[derive(Clone, Debug)]
1634 pub struct ListRuntimeVersions(RequestBuilder<crate::model::ListRuntimeVersionsRequest>);
1635
1636 impl ListRuntimeVersions {
1637 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1638 Self(RequestBuilder::new(stub))
1639 }
1640
1641 pub fn with_request<V: Into<crate::model::ListRuntimeVersionsRequest>>(
1643 mut self,
1644 v: V,
1645 ) -> Self {
1646 self.0.request = v.into();
1647 self
1648 }
1649
1650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1652 self.0.options = v.into();
1653 self
1654 }
1655
1656 pub async fn send(self) -> Result<crate::model::ListRuntimeVersionsResponse> {
1658 (*self.0.stub)
1659 .list_runtime_versions(self.0.request, self.0.options)
1660 .await
1661 .map(crate::Response::into_body)
1662 }
1663
1664 pub fn by_page(
1666 self,
1667 ) -> impl google_cloud_gax::paginator::Paginator<
1668 crate::model::ListRuntimeVersionsResponse,
1669 crate::Error,
1670 > {
1671 use std::clone::Clone;
1672 let token = self.0.request.page_token.clone();
1673 let execute = move |token: String| {
1674 let mut builder = self.clone();
1675 builder.0.request = builder.0.request.set_page_token(token);
1676 builder.send()
1677 };
1678 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1679 }
1680
1681 pub fn by_item(
1683 self,
1684 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1685 crate::model::ListRuntimeVersionsResponse,
1686 crate::Error,
1687 > {
1688 use google_cloud_gax::paginator::Paginator;
1689 self.by_page().items()
1690 }
1691
1692 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1696 self.0.request.parent = v.into();
1697 self
1698 }
1699
1700 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1702 self.0.request.page_size = v.into();
1703 self
1704 }
1705
1706 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1708 self.0.request.page_token = v.into();
1709 self
1710 }
1711
1712 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1714 self.0.request.filter = v.into();
1715 self
1716 }
1717
1718 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1720 self.0.request.order_by = v.into();
1721 self
1722 }
1723 }
1724
1725 #[doc(hidden)]
1726 impl crate::RequestBuilder for ListRuntimeVersions {
1727 fn request_options(&mut self) -> &mut crate::RequestOptions {
1728 &mut self.0.options
1729 }
1730 }
1731
1732 #[derive(Clone, Debug)]
1749 pub struct GetRuntimeVersion(RequestBuilder<crate::model::GetRuntimeVersionRequest>);
1750
1751 impl GetRuntimeVersion {
1752 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1753 Self(RequestBuilder::new(stub))
1754 }
1755
1756 pub fn with_request<V: Into<crate::model::GetRuntimeVersionRequest>>(
1758 mut self,
1759 v: V,
1760 ) -> Self {
1761 self.0.request = v.into();
1762 self
1763 }
1764
1765 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1767 self.0.options = v.into();
1768 self
1769 }
1770
1771 pub async fn send(self) -> Result<crate::model::RuntimeVersion> {
1773 (*self.0.stub)
1774 .get_runtime_version(self.0.request, self.0.options)
1775 .await
1776 .map(crate::Response::into_body)
1777 }
1778
1779 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1783 self.0.request.name = v.into();
1784 self
1785 }
1786 }
1787
1788 #[doc(hidden)]
1789 impl crate::RequestBuilder for GetRuntimeVersion {
1790 fn request_options(&mut self) -> &mut crate::RequestOptions {
1791 &mut self.0.options
1792 }
1793 }
1794
1795 #[derive(Clone, Debug)]
1812 pub struct GetGuestAttributes(RequestBuilder<crate::model::GetGuestAttributesRequest>);
1813
1814 impl GetGuestAttributes {
1815 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1816 Self(RequestBuilder::new(stub))
1817 }
1818
1819 pub fn with_request<V: Into<crate::model::GetGuestAttributesRequest>>(
1821 mut self,
1822 v: V,
1823 ) -> Self {
1824 self.0.request = v.into();
1825 self
1826 }
1827
1828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1830 self.0.options = v.into();
1831 self
1832 }
1833
1834 pub async fn send(self) -> Result<crate::model::GetGuestAttributesResponse> {
1836 (*self.0.stub)
1837 .get_guest_attributes(self.0.request, self.0.options)
1838 .await
1839 .map(crate::Response::into_body)
1840 }
1841
1842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1846 self.0.request.name = v.into();
1847 self
1848 }
1849
1850 pub fn set_query_path<T: Into<std::string::String>>(mut self, v: T) -> Self {
1852 self.0.request.query_path = v.into();
1853 self
1854 }
1855
1856 pub fn set_worker_ids<T, V>(mut self, v: T) -> Self
1858 where
1859 T: std::iter::IntoIterator<Item = V>,
1860 V: std::convert::Into<std::string::String>,
1861 {
1862 use std::iter::Iterator;
1863 self.0.request.worker_ids = v.into_iter().map(|i| i.into()).collect();
1864 self
1865 }
1866 }
1867
1868 #[doc(hidden)]
1869 impl crate::RequestBuilder for GetGuestAttributes {
1870 fn request_options(&mut self) -> &mut crate::RequestOptions {
1871 &mut self.0.options
1872 }
1873 }
1874
1875 #[derive(Clone, Debug)]
1896 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1897
1898 impl ListLocations {
1899 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
1900 Self(RequestBuilder::new(stub))
1901 }
1902
1903 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1905 mut self,
1906 v: V,
1907 ) -> Self {
1908 self.0.request = v.into();
1909 self
1910 }
1911
1912 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1914 self.0.options = v.into();
1915 self
1916 }
1917
1918 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1920 (*self.0.stub)
1921 .list_locations(self.0.request, self.0.options)
1922 .await
1923 .map(crate::Response::into_body)
1924 }
1925
1926 pub fn by_page(
1928 self,
1929 ) -> impl google_cloud_gax::paginator::Paginator<
1930 google_cloud_location::model::ListLocationsResponse,
1931 crate::Error,
1932 > {
1933 use std::clone::Clone;
1934 let token = self.0.request.page_token.clone();
1935 let execute = move |token: String| {
1936 let mut builder = self.clone();
1937 builder.0.request = builder.0.request.set_page_token(token);
1938 builder.send()
1939 };
1940 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1941 }
1942
1943 pub fn by_item(
1945 self,
1946 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1947 google_cloud_location::model::ListLocationsResponse,
1948 crate::Error,
1949 > {
1950 use google_cloud_gax::paginator::Paginator;
1951 self.by_page().items()
1952 }
1953
1954 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1956 self.0.request.name = v.into();
1957 self
1958 }
1959
1960 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1962 self.0.request.filter = v.into();
1963 self
1964 }
1965
1966 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1968 self.0.request.page_size = v.into();
1969 self
1970 }
1971
1972 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1974 self.0.request.page_token = v.into();
1975 self
1976 }
1977 }
1978
1979 #[doc(hidden)]
1980 impl crate::RequestBuilder for ListLocations {
1981 fn request_options(&mut self) -> &mut crate::RequestOptions {
1982 &mut self.0.options
1983 }
1984 }
1985
1986 #[derive(Clone, Debug)]
2003 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2004
2005 impl GetLocation {
2006 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
2007 Self(RequestBuilder::new(stub))
2008 }
2009
2010 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2012 mut self,
2013 v: V,
2014 ) -> Self {
2015 self.0.request = v.into();
2016 self
2017 }
2018
2019 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2021 self.0.options = v.into();
2022 self
2023 }
2024
2025 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2027 (*self.0.stub)
2028 .get_location(self.0.request, self.0.options)
2029 .await
2030 .map(crate::Response::into_body)
2031 }
2032
2033 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2035 self.0.request.name = v.into();
2036 self
2037 }
2038 }
2039
2040 #[doc(hidden)]
2041 impl crate::RequestBuilder for GetLocation {
2042 fn request_options(&mut self) -> &mut crate::RequestOptions {
2043 &mut self.0.options
2044 }
2045 }
2046
2047 #[derive(Clone, Debug)]
2068 pub struct ListOperations(
2069 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2070 );
2071
2072 impl ListOperations {
2073 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
2074 Self(RequestBuilder::new(stub))
2075 }
2076
2077 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2079 mut self,
2080 v: V,
2081 ) -> Self {
2082 self.0.request = v.into();
2083 self
2084 }
2085
2086 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2088 self.0.options = v.into();
2089 self
2090 }
2091
2092 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2094 (*self.0.stub)
2095 .list_operations(self.0.request, self.0.options)
2096 .await
2097 .map(crate::Response::into_body)
2098 }
2099
2100 pub fn by_page(
2102 self,
2103 ) -> impl google_cloud_gax::paginator::Paginator<
2104 google_cloud_longrunning::model::ListOperationsResponse,
2105 crate::Error,
2106 > {
2107 use std::clone::Clone;
2108 let token = self.0.request.page_token.clone();
2109 let execute = move |token: String| {
2110 let mut builder = self.clone();
2111 builder.0.request = builder.0.request.set_page_token(token);
2112 builder.send()
2113 };
2114 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2115 }
2116
2117 pub fn by_item(
2119 self,
2120 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2121 google_cloud_longrunning::model::ListOperationsResponse,
2122 crate::Error,
2123 > {
2124 use google_cloud_gax::paginator::Paginator;
2125 self.by_page().items()
2126 }
2127
2128 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2130 self.0.request.name = v.into();
2131 self
2132 }
2133
2134 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2136 self.0.request.filter = v.into();
2137 self
2138 }
2139
2140 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2142 self.0.request.page_size = v.into();
2143 self
2144 }
2145
2146 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2148 self.0.request.page_token = v.into();
2149 self
2150 }
2151
2152 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2154 self.0.request.return_partial_success = v.into();
2155 self
2156 }
2157 }
2158
2159 #[doc(hidden)]
2160 impl crate::RequestBuilder for ListOperations {
2161 fn request_options(&mut self) -> &mut crate::RequestOptions {
2162 &mut self.0.options
2163 }
2164 }
2165
2166 #[derive(Clone, Debug)]
2183 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2184
2185 impl GetOperation {
2186 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
2187 Self(RequestBuilder::new(stub))
2188 }
2189
2190 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2192 mut self,
2193 v: V,
2194 ) -> Self {
2195 self.0.request = v.into();
2196 self
2197 }
2198
2199 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2201 self.0.options = v.into();
2202 self
2203 }
2204
2205 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2207 (*self.0.stub)
2208 .get_operation(self.0.request, self.0.options)
2209 .await
2210 .map(crate::Response::into_body)
2211 }
2212
2213 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2215 self.0.request.name = v.into();
2216 self
2217 }
2218 }
2219
2220 #[doc(hidden)]
2221 impl crate::RequestBuilder for GetOperation {
2222 fn request_options(&mut self) -> &mut crate::RequestOptions {
2223 &mut self.0.options
2224 }
2225 }
2226
2227 #[derive(Clone, Debug)]
2244 pub struct DeleteOperation(
2245 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2246 );
2247
2248 impl DeleteOperation {
2249 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
2250 Self(RequestBuilder::new(stub))
2251 }
2252
2253 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2255 mut self,
2256 v: V,
2257 ) -> Self {
2258 self.0.request = v.into();
2259 self
2260 }
2261
2262 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2264 self.0.options = v.into();
2265 self
2266 }
2267
2268 pub async fn send(self) -> Result<()> {
2270 (*self.0.stub)
2271 .delete_operation(self.0.request, self.0.options)
2272 .await
2273 .map(crate::Response::into_body)
2274 }
2275
2276 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278 self.0.request.name = v.into();
2279 self
2280 }
2281 }
2282
2283 #[doc(hidden)]
2284 impl crate::RequestBuilder for DeleteOperation {
2285 fn request_options(&mut self) -> &mut crate::RequestOptions {
2286 &mut self.0.options
2287 }
2288 }
2289
2290 #[derive(Clone, Debug)]
2307 pub struct CancelOperation(
2308 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2309 );
2310
2311 impl CancelOperation {
2312 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tpu>) -> Self {
2313 Self(RequestBuilder::new(stub))
2314 }
2315
2316 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2318 mut self,
2319 v: V,
2320 ) -> Self {
2321 self.0.request = v.into();
2322 self
2323 }
2324
2325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2327 self.0.options = v.into();
2328 self
2329 }
2330
2331 pub async fn send(self) -> Result<()> {
2333 (*self.0.stub)
2334 .cancel_operation(self.0.request, self.0.options)
2335 .await
2336 .map(crate::Response::into_body)
2337 }
2338
2339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2341 self.0.request.name = v.into();
2342 self
2343 }
2344 }
2345
2346 #[doc(hidden)]
2347 impl crate::RequestBuilder for CancelOperation {
2348 fn request_options(&mut self) -> &mut crate::RequestOptions {
2349 &mut self.0.options
2350 }
2351 }
2352}