1pub mod hub_service {
18 use crate::Result;
19 use std::sync::Arc;
20
21 #[derive(Clone, Debug)]
23 pub struct RequestBuilder<R: std::default::Default> {
24 stub: Arc<dyn crate::stubs::dynamic::HubService>,
25 request: R,
26 options: gax::options::RequestOptions,
27 }
28
29 impl<R> RequestBuilder<R>
30 where
31 R: std::default::Default,
32 {
33 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
34 Self {
35 stub,
36 request: R::default(),
37 options: gax::options::RequestOptions::default(),
38 }
39 }
40 }
41
42 #[derive(Clone, Debug)]
44 pub struct ListHubs(RequestBuilder<crate::model::ListHubsRequest>);
45
46 impl ListHubs {
47 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
48 Self(RequestBuilder::new(stub))
49 }
50
51 pub fn with_request<V: Into<crate::model::ListHubsRequest>>(mut self, v: V) -> Self {
53 self.0.request = v.into();
54 self
55 }
56
57 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
59 self.0.options = v.into();
60 self
61 }
62
63 pub async fn send(self) -> Result<crate::model::ListHubsResponse> {
65 (*self.0.stub)
66 .list_hubs(self.0.request, self.0.options)
67 .await
68 }
69
70 #[cfg(feature = "unstable-stream")]
72 pub async fn stream(
73 self,
74 ) -> gax::paginator::Paginator<crate::model::ListHubsResponse, gax::error::Error> {
75 let token = gax::paginator::extract_token(&self.0.request.page_token);
76 let execute = move |token: String| {
77 let mut builder = self.clone();
78 builder.0.request = builder.0.request.set_page_token(token);
79 builder.send()
80 };
81 gax::paginator::Paginator::new(token, execute)
82 }
83
84 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
86 self.0.request.parent = v.into();
87 self
88 }
89
90 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
92 self.0.request.page_size = v.into();
93 self
94 }
95
96 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
98 self.0.request.page_token = v.into();
99 self
100 }
101
102 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
104 self.0.request.filter = v.into();
105 self
106 }
107
108 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
110 self.0.request.order_by = v.into();
111 self
112 }
113 }
114
115 impl gax::options::RequestBuilder for ListHubs {
116 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
117 &mut self.0.options
118 }
119 }
120
121 #[derive(Clone, Debug)]
123 pub struct GetHub(RequestBuilder<crate::model::GetHubRequest>);
124
125 impl GetHub {
126 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
127 Self(RequestBuilder::new(stub))
128 }
129
130 pub fn with_request<V: Into<crate::model::GetHubRequest>>(mut self, v: V) -> Self {
132 self.0.request = v.into();
133 self
134 }
135
136 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
138 self.0.options = v.into();
139 self
140 }
141
142 pub async fn send(self) -> Result<crate::model::Hub> {
144 (*self.0.stub).get_hub(self.0.request, self.0.options).await
145 }
146
147 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
149 self.0.request.name = v.into();
150 self
151 }
152 }
153
154 impl gax::options::RequestBuilder for GetHub {
155 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
156 &mut self.0.options
157 }
158 }
159
160 #[derive(Clone, Debug)]
162 pub struct CreateHub(RequestBuilder<crate::model::CreateHubRequest>);
163
164 impl CreateHub {
165 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
166 Self(RequestBuilder::new(stub))
167 }
168
169 pub fn with_request<V: Into<crate::model::CreateHubRequest>>(mut self, v: V) -> Self {
171 self.0.request = v.into();
172 self
173 }
174
175 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
177 self.0.options = v.into();
178 self
179 }
180
181 pub async fn send(self) -> Result<longrunning::model::Operation> {
188 (*self.0.stub)
189 .create_hub(self.0.request, self.0.options)
190 .await
191 }
192
193 pub fn poller(
195 self,
196 ) -> impl lro::Poller<crate::model::Hub, crate::model::OperationMetadata> {
197 type Operation = lro::Operation<crate::model::Hub, crate::model::OperationMetadata>;
198 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
199 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
200
201 let stub = self.0.stub.clone();
202 let mut options = self.0.options.clone();
203 options.set_retry_policy(gax::retry_policy::NeverRetry);
204 let query = move |name| {
205 let stub = stub.clone();
206 let options = options.clone();
207 async {
208 let op = GetOperation::new(stub)
209 .set_name(name)
210 .with_options(options)
211 .send()
212 .await?;
213 Ok(Operation::new(op))
214 }
215 };
216
217 let start = move || async {
218 let op = self.send().await?;
219 Ok(Operation::new(op))
220 };
221
222 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
223 }
224
225 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
227 self.0.request.parent = v.into();
228 self
229 }
230
231 pub fn set_hub_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
233 self.0.request.hub_id = v.into();
234 self
235 }
236
237 pub fn set_hub<T: Into<std::option::Option<crate::model::Hub>>>(mut self, v: T) -> Self {
239 self.0.request.hub = v.into();
240 self
241 }
242
243 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
245 self.0.request.request_id = v.into();
246 self
247 }
248 }
249
250 impl gax::options::RequestBuilder for CreateHub {
251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252 &mut self.0.options
253 }
254 }
255
256 #[derive(Clone, Debug)]
258 pub struct UpdateHub(RequestBuilder<crate::model::UpdateHubRequest>);
259
260 impl UpdateHub {
261 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
262 Self(RequestBuilder::new(stub))
263 }
264
265 pub fn with_request<V: Into<crate::model::UpdateHubRequest>>(mut self, v: V) -> Self {
267 self.0.request = v.into();
268 self
269 }
270
271 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
273 self.0.options = v.into();
274 self
275 }
276
277 pub async fn send(self) -> Result<longrunning::model::Operation> {
284 (*self.0.stub)
285 .update_hub(self.0.request, self.0.options)
286 .await
287 }
288
289 pub fn poller(
291 self,
292 ) -> impl lro::Poller<crate::model::Hub, crate::model::OperationMetadata> {
293 type Operation = lro::Operation<crate::model::Hub, crate::model::OperationMetadata>;
294 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
295 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
296
297 let stub = self.0.stub.clone();
298 let mut options = self.0.options.clone();
299 options.set_retry_policy(gax::retry_policy::NeverRetry);
300 let query = move |name| {
301 let stub = stub.clone();
302 let options = options.clone();
303 async {
304 let op = GetOperation::new(stub)
305 .set_name(name)
306 .with_options(options)
307 .send()
308 .await?;
309 Ok(Operation::new(op))
310 }
311 };
312
313 let start = move || async {
314 let op = self.send().await?;
315 Ok(Operation::new(op))
316 };
317
318 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
319 }
320
321 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
323 mut self,
324 v: T,
325 ) -> Self {
326 self.0.request.update_mask = v.into();
327 self
328 }
329
330 pub fn set_hub<T: Into<std::option::Option<crate::model::Hub>>>(mut self, v: T) -> Self {
332 self.0.request.hub = v.into();
333 self
334 }
335
336 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
338 self.0.request.request_id = v.into();
339 self
340 }
341 }
342
343 impl gax::options::RequestBuilder for UpdateHub {
344 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
345 &mut self.0.options
346 }
347 }
348
349 #[derive(Clone, Debug)]
351 pub struct DeleteHub(RequestBuilder<crate::model::DeleteHubRequest>);
352
353 impl DeleteHub {
354 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
355 Self(RequestBuilder::new(stub))
356 }
357
358 pub fn with_request<V: Into<crate::model::DeleteHubRequest>>(mut self, v: V) -> Self {
360 self.0.request = v.into();
361 self
362 }
363
364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
366 self.0.options = v.into();
367 self
368 }
369
370 pub async fn send(self) -> Result<longrunning::model::Operation> {
377 (*self.0.stub)
378 .delete_hub(self.0.request, self.0.options)
379 .await
380 }
381
382 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
384 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
385 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
386 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
387
388 let stub = self.0.stub.clone();
389 let mut options = self.0.options.clone();
390 options.set_retry_policy(gax::retry_policy::NeverRetry);
391 let query = move |name| {
392 let stub = stub.clone();
393 let options = options.clone();
394 async {
395 let op = GetOperation::new(stub)
396 .set_name(name)
397 .with_options(options)
398 .send()
399 .await?;
400 Ok(Operation::new(op))
401 }
402 };
403
404 let start = move || async {
405 let op = self.send().await?;
406 Ok(Operation::new(op))
407 };
408
409 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
410 }
411
412 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
414 self.0.request.name = v.into();
415 self
416 }
417
418 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
420 self.0.request.request_id = v.into();
421 self
422 }
423 }
424
425 impl gax::options::RequestBuilder for DeleteHub {
426 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
427 &mut self.0.options
428 }
429 }
430
431 #[derive(Clone, Debug)]
433 pub struct ListHubSpokes(RequestBuilder<crate::model::ListHubSpokesRequest>);
434
435 impl ListHubSpokes {
436 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
437 Self(RequestBuilder::new(stub))
438 }
439
440 pub fn with_request<V: Into<crate::model::ListHubSpokesRequest>>(mut self, v: V) -> Self {
442 self.0.request = v.into();
443 self
444 }
445
446 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
448 self.0.options = v.into();
449 self
450 }
451
452 pub async fn send(self) -> Result<crate::model::ListHubSpokesResponse> {
454 (*self.0.stub)
455 .list_hub_spokes(self.0.request, self.0.options)
456 .await
457 }
458
459 #[cfg(feature = "unstable-stream")]
461 pub async fn stream(
462 self,
463 ) -> gax::paginator::Paginator<crate::model::ListHubSpokesResponse, gax::error::Error>
464 {
465 let token = gax::paginator::extract_token(&self.0.request.page_token);
466 let execute = move |token: String| {
467 let mut builder = self.clone();
468 builder.0.request = builder.0.request.set_page_token(token);
469 builder.send()
470 };
471 gax::paginator::Paginator::new(token, execute)
472 }
473
474 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
476 self.0.request.name = v.into();
477 self
478 }
479
480 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
482 self.0.request.page_size = v.into();
483 self
484 }
485
486 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
488 self.0.request.page_token = v.into();
489 self
490 }
491
492 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
494 self.0.request.filter = v.into();
495 self
496 }
497
498 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
500 self.0.request.order_by = v.into();
501 self
502 }
503
504 pub fn set_view<T: Into<crate::model::list_hub_spokes_request::SpokeView>>(
506 mut self,
507 v: T,
508 ) -> Self {
509 self.0.request.view = v.into();
510 self
511 }
512
513 pub fn set_spoke_locations<T, V>(mut self, v: T) -> Self
515 where
516 T: std::iter::IntoIterator<Item = V>,
517 V: std::convert::Into<std::string::String>,
518 {
519 use std::iter::Iterator;
520 self.0.request.spoke_locations = v.into_iter().map(|i| i.into()).collect();
521 self
522 }
523 }
524
525 impl gax::options::RequestBuilder for ListHubSpokes {
526 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
527 &mut self.0.options
528 }
529 }
530
531 #[derive(Clone, Debug)]
533 pub struct QueryHubStatus(RequestBuilder<crate::model::QueryHubStatusRequest>);
534
535 impl QueryHubStatus {
536 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
537 Self(RequestBuilder::new(stub))
538 }
539
540 pub fn with_request<V: Into<crate::model::QueryHubStatusRequest>>(mut self, v: V) -> Self {
542 self.0.request = v.into();
543 self
544 }
545
546 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
548 self.0.options = v.into();
549 self
550 }
551
552 pub async fn send(self) -> Result<crate::model::QueryHubStatusResponse> {
554 (*self.0.stub)
555 .query_hub_status(self.0.request, self.0.options)
556 .await
557 }
558
559 #[cfg(feature = "unstable-stream")]
561 pub async fn stream(
562 self,
563 ) -> gax::paginator::Paginator<crate::model::QueryHubStatusResponse, gax::error::Error>
564 {
565 let token = gax::paginator::extract_token(&self.0.request.page_token);
566 let execute = move |token: String| {
567 let mut builder = self.clone();
568 builder.0.request = builder.0.request.set_page_token(token);
569 builder.send()
570 };
571 gax::paginator::Paginator::new(token, execute)
572 }
573
574 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
576 self.0.request.name = v.into();
577 self
578 }
579
580 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
582 self.0.request.page_size = v.into();
583 self
584 }
585
586 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
588 self.0.request.page_token = v.into();
589 self
590 }
591
592 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
594 self.0.request.filter = v.into();
595 self
596 }
597
598 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
600 self.0.request.order_by = v.into();
601 self
602 }
603
604 pub fn set_group_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
606 self.0.request.group_by = v.into();
607 self
608 }
609 }
610
611 impl gax::options::RequestBuilder for QueryHubStatus {
612 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
613 &mut self.0.options
614 }
615 }
616
617 #[derive(Clone, Debug)]
619 pub struct ListSpokes(RequestBuilder<crate::model::ListSpokesRequest>);
620
621 impl ListSpokes {
622 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
623 Self(RequestBuilder::new(stub))
624 }
625
626 pub fn with_request<V: Into<crate::model::ListSpokesRequest>>(mut self, v: V) -> Self {
628 self.0.request = v.into();
629 self
630 }
631
632 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
634 self.0.options = v.into();
635 self
636 }
637
638 pub async fn send(self) -> Result<crate::model::ListSpokesResponse> {
640 (*self.0.stub)
641 .list_spokes(self.0.request, self.0.options)
642 .await
643 }
644
645 #[cfg(feature = "unstable-stream")]
647 pub async fn stream(
648 self,
649 ) -> gax::paginator::Paginator<crate::model::ListSpokesResponse, gax::error::Error>
650 {
651 let token = gax::paginator::extract_token(&self.0.request.page_token);
652 let execute = move |token: String| {
653 let mut builder = self.clone();
654 builder.0.request = builder.0.request.set_page_token(token);
655 builder.send()
656 };
657 gax::paginator::Paginator::new(token, execute)
658 }
659
660 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
662 self.0.request.parent = v.into();
663 self
664 }
665
666 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
668 self.0.request.page_size = v.into();
669 self
670 }
671
672 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
674 self.0.request.page_token = v.into();
675 self
676 }
677
678 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
680 self.0.request.filter = v.into();
681 self
682 }
683
684 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
686 self.0.request.order_by = v.into();
687 self
688 }
689 }
690
691 impl gax::options::RequestBuilder for ListSpokes {
692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
693 &mut self.0.options
694 }
695 }
696
697 #[derive(Clone, Debug)]
699 pub struct GetSpoke(RequestBuilder<crate::model::GetSpokeRequest>);
700
701 impl GetSpoke {
702 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
703 Self(RequestBuilder::new(stub))
704 }
705
706 pub fn with_request<V: Into<crate::model::GetSpokeRequest>>(mut self, v: V) -> Self {
708 self.0.request = v.into();
709 self
710 }
711
712 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
714 self.0.options = v.into();
715 self
716 }
717
718 pub async fn send(self) -> Result<crate::model::Spoke> {
720 (*self.0.stub)
721 .get_spoke(self.0.request, self.0.options)
722 .await
723 }
724
725 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
727 self.0.request.name = v.into();
728 self
729 }
730 }
731
732 impl gax::options::RequestBuilder for GetSpoke {
733 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734 &mut self.0.options
735 }
736 }
737
738 #[derive(Clone, Debug)]
740 pub struct CreateSpoke(RequestBuilder<crate::model::CreateSpokeRequest>);
741
742 impl CreateSpoke {
743 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
744 Self(RequestBuilder::new(stub))
745 }
746
747 pub fn with_request<V: Into<crate::model::CreateSpokeRequest>>(mut self, v: V) -> Self {
749 self.0.request = v.into();
750 self
751 }
752
753 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
755 self.0.options = v.into();
756 self
757 }
758
759 pub async fn send(self) -> Result<longrunning::model::Operation> {
766 (*self.0.stub)
767 .create_spoke(self.0.request, self.0.options)
768 .await
769 }
770
771 pub fn poller(
773 self,
774 ) -> impl lro::Poller<crate::model::Spoke, crate::model::OperationMetadata> {
775 type Operation = lro::Operation<crate::model::Spoke, crate::model::OperationMetadata>;
776 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
777 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
778
779 let stub = self.0.stub.clone();
780 let mut options = self.0.options.clone();
781 options.set_retry_policy(gax::retry_policy::NeverRetry);
782 let query = move |name| {
783 let stub = stub.clone();
784 let options = options.clone();
785 async {
786 let op = GetOperation::new(stub)
787 .set_name(name)
788 .with_options(options)
789 .send()
790 .await?;
791 Ok(Operation::new(op))
792 }
793 };
794
795 let start = move || async {
796 let op = self.send().await?;
797 Ok(Operation::new(op))
798 };
799
800 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
801 }
802
803 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
805 self.0.request.parent = v.into();
806 self
807 }
808
809 pub fn set_spoke_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
811 self.0.request.spoke_id = v.into();
812 self
813 }
814
815 pub fn set_spoke<T: Into<std::option::Option<crate::model::Spoke>>>(
817 mut self,
818 v: T,
819 ) -> Self {
820 self.0.request.spoke = v.into();
821 self
822 }
823
824 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
826 self.0.request.request_id = v.into();
827 self
828 }
829 }
830
831 impl gax::options::RequestBuilder for CreateSpoke {
832 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
833 &mut self.0.options
834 }
835 }
836
837 #[derive(Clone, Debug)]
839 pub struct UpdateSpoke(RequestBuilder<crate::model::UpdateSpokeRequest>);
840
841 impl UpdateSpoke {
842 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
843 Self(RequestBuilder::new(stub))
844 }
845
846 pub fn with_request<V: Into<crate::model::UpdateSpokeRequest>>(mut self, v: V) -> Self {
848 self.0.request = v.into();
849 self
850 }
851
852 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
854 self.0.options = v.into();
855 self
856 }
857
858 pub async fn send(self) -> Result<longrunning::model::Operation> {
865 (*self.0.stub)
866 .update_spoke(self.0.request, self.0.options)
867 .await
868 }
869
870 pub fn poller(
872 self,
873 ) -> impl lro::Poller<crate::model::Spoke, crate::model::OperationMetadata> {
874 type Operation = lro::Operation<crate::model::Spoke, crate::model::OperationMetadata>;
875 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
876 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
877
878 let stub = self.0.stub.clone();
879 let mut options = self.0.options.clone();
880 options.set_retry_policy(gax::retry_policy::NeverRetry);
881 let query = move |name| {
882 let stub = stub.clone();
883 let options = options.clone();
884 async {
885 let op = GetOperation::new(stub)
886 .set_name(name)
887 .with_options(options)
888 .send()
889 .await?;
890 Ok(Operation::new(op))
891 }
892 };
893
894 let start = move || async {
895 let op = self.send().await?;
896 Ok(Operation::new(op))
897 };
898
899 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
900 }
901
902 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
904 mut self,
905 v: T,
906 ) -> Self {
907 self.0.request.update_mask = v.into();
908 self
909 }
910
911 pub fn set_spoke<T: Into<std::option::Option<crate::model::Spoke>>>(
913 mut self,
914 v: T,
915 ) -> Self {
916 self.0.request.spoke = v.into();
917 self
918 }
919
920 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
922 self.0.request.request_id = v.into();
923 self
924 }
925 }
926
927 impl gax::options::RequestBuilder for UpdateSpoke {
928 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
929 &mut self.0.options
930 }
931 }
932
933 #[derive(Clone, Debug)]
935 pub struct RejectHubSpoke(RequestBuilder<crate::model::RejectHubSpokeRequest>);
936
937 impl RejectHubSpoke {
938 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
939 Self(RequestBuilder::new(stub))
940 }
941
942 pub fn with_request<V: Into<crate::model::RejectHubSpokeRequest>>(mut self, v: V) -> Self {
944 self.0.request = v.into();
945 self
946 }
947
948 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
950 self.0.options = v.into();
951 self
952 }
953
954 pub async fn send(self) -> Result<longrunning::model::Operation> {
961 (*self.0.stub)
962 .reject_hub_spoke(self.0.request, self.0.options)
963 .await
964 }
965
966 pub fn poller(
968 self,
969 ) -> impl lro::Poller<crate::model::RejectHubSpokeResponse, crate::model::OperationMetadata>
970 {
971 type Operation = lro::Operation<
972 crate::model::RejectHubSpokeResponse,
973 crate::model::OperationMetadata,
974 >;
975 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
976 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
977
978 let stub = self.0.stub.clone();
979 let mut options = self.0.options.clone();
980 options.set_retry_policy(gax::retry_policy::NeverRetry);
981 let query = move |name| {
982 let stub = stub.clone();
983 let options = options.clone();
984 async {
985 let op = GetOperation::new(stub)
986 .set_name(name)
987 .with_options(options)
988 .send()
989 .await?;
990 Ok(Operation::new(op))
991 }
992 };
993
994 let start = move || async {
995 let op = self.send().await?;
996 Ok(Operation::new(op))
997 };
998
999 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1000 }
1001
1002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1004 self.0.request.name = v.into();
1005 self
1006 }
1007
1008 pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
1010 self.0.request.spoke_uri = v.into();
1011 self
1012 }
1013
1014 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1016 self.0.request.request_id = v.into();
1017 self
1018 }
1019
1020 pub fn set_details<T: Into<std::string::String>>(mut self, v: T) -> Self {
1022 self.0.request.details = v.into();
1023 self
1024 }
1025 }
1026
1027 impl gax::options::RequestBuilder for RejectHubSpoke {
1028 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1029 &mut self.0.options
1030 }
1031 }
1032
1033 #[derive(Clone, Debug)]
1035 pub struct AcceptHubSpoke(RequestBuilder<crate::model::AcceptHubSpokeRequest>);
1036
1037 impl AcceptHubSpoke {
1038 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1039 Self(RequestBuilder::new(stub))
1040 }
1041
1042 pub fn with_request<V: Into<crate::model::AcceptHubSpokeRequest>>(mut self, v: V) -> Self {
1044 self.0.request = v.into();
1045 self
1046 }
1047
1048 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1050 self.0.options = v.into();
1051 self
1052 }
1053
1054 pub async fn send(self) -> Result<longrunning::model::Operation> {
1061 (*self.0.stub)
1062 .accept_hub_spoke(self.0.request, self.0.options)
1063 .await
1064 }
1065
1066 pub fn poller(
1068 self,
1069 ) -> impl lro::Poller<crate::model::AcceptHubSpokeResponse, crate::model::OperationMetadata>
1070 {
1071 type Operation = lro::Operation<
1072 crate::model::AcceptHubSpokeResponse,
1073 crate::model::OperationMetadata,
1074 >;
1075 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1076 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1077
1078 let stub = self.0.stub.clone();
1079 let mut options = self.0.options.clone();
1080 options.set_retry_policy(gax::retry_policy::NeverRetry);
1081 let query = move |name| {
1082 let stub = stub.clone();
1083 let options = options.clone();
1084 async {
1085 let op = GetOperation::new(stub)
1086 .set_name(name)
1087 .with_options(options)
1088 .send()
1089 .await?;
1090 Ok(Operation::new(op))
1091 }
1092 };
1093
1094 let start = move || async {
1095 let op = self.send().await?;
1096 Ok(Operation::new(op))
1097 };
1098
1099 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1100 }
1101
1102 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1104 self.0.request.name = v.into();
1105 self
1106 }
1107
1108 pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
1110 self.0.request.spoke_uri = v.into();
1111 self
1112 }
1113
1114 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1116 self.0.request.request_id = v.into();
1117 self
1118 }
1119 }
1120
1121 impl gax::options::RequestBuilder for AcceptHubSpoke {
1122 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1123 &mut self.0.options
1124 }
1125 }
1126
1127 #[derive(Clone, Debug)]
1129 pub struct DeleteSpoke(RequestBuilder<crate::model::DeleteSpokeRequest>);
1130
1131 impl DeleteSpoke {
1132 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1133 Self(RequestBuilder::new(stub))
1134 }
1135
1136 pub fn with_request<V: Into<crate::model::DeleteSpokeRequest>>(mut self, v: V) -> Self {
1138 self.0.request = v.into();
1139 self
1140 }
1141
1142 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1144 self.0.options = v.into();
1145 self
1146 }
1147
1148 pub async fn send(self) -> Result<longrunning::model::Operation> {
1155 (*self.0.stub)
1156 .delete_spoke(self.0.request, self.0.options)
1157 .await
1158 }
1159
1160 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
1162 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
1163 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1164 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1165
1166 let stub = self.0.stub.clone();
1167 let mut options = self.0.options.clone();
1168 options.set_retry_policy(gax::retry_policy::NeverRetry);
1169 let query = move |name| {
1170 let stub = stub.clone();
1171 let options = options.clone();
1172 async {
1173 let op = GetOperation::new(stub)
1174 .set_name(name)
1175 .with_options(options)
1176 .send()
1177 .await?;
1178 Ok(Operation::new(op))
1179 }
1180 };
1181
1182 let start = move || async {
1183 let op = self.send().await?;
1184 Ok(Operation::new(op))
1185 };
1186
1187 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1188 }
1189
1190 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1192 self.0.request.name = v.into();
1193 self
1194 }
1195
1196 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1198 self.0.request.request_id = v.into();
1199 self
1200 }
1201 }
1202
1203 impl gax::options::RequestBuilder for DeleteSpoke {
1204 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1205 &mut self.0.options
1206 }
1207 }
1208
1209 #[derive(Clone, Debug)]
1211 pub struct GetRouteTable(RequestBuilder<crate::model::GetRouteTableRequest>);
1212
1213 impl GetRouteTable {
1214 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1215 Self(RequestBuilder::new(stub))
1216 }
1217
1218 pub fn with_request<V: Into<crate::model::GetRouteTableRequest>>(mut self, v: V) -> Self {
1220 self.0.request = v.into();
1221 self
1222 }
1223
1224 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1226 self.0.options = v.into();
1227 self
1228 }
1229
1230 pub async fn send(self) -> Result<crate::model::RouteTable> {
1232 (*self.0.stub)
1233 .get_route_table(self.0.request, self.0.options)
1234 .await
1235 }
1236
1237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1239 self.0.request.name = v.into();
1240 self
1241 }
1242 }
1243
1244 impl gax::options::RequestBuilder for GetRouteTable {
1245 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1246 &mut self.0.options
1247 }
1248 }
1249
1250 #[derive(Clone, Debug)]
1252 pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
1253
1254 impl GetRoute {
1255 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1256 Self(RequestBuilder::new(stub))
1257 }
1258
1259 pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
1261 self.0.request = v.into();
1262 self
1263 }
1264
1265 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1267 self.0.options = v.into();
1268 self
1269 }
1270
1271 pub async fn send(self) -> Result<crate::model::Route> {
1273 (*self.0.stub)
1274 .get_route(self.0.request, self.0.options)
1275 .await
1276 }
1277
1278 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1280 self.0.request.name = v.into();
1281 self
1282 }
1283 }
1284
1285 impl gax::options::RequestBuilder for GetRoute {
1286 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1287 &mut self.0.options
1288 }
1289 }
1290
1291 #[derive(Clone, Debug)]
1293 pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
1294
1295 impl ListRoutes {
1296 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1297 Self(RequestBuilder::new(stub))
1298 }
1299
1300 pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
1302 self.0.request = v.into();
1303 self
1304 }
1305
1306 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1308 self.0.options = v.into();
1309 self
1310 }
1311
1312 pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
1314 (*self.0.stub)
1315 .list_routes(self.0.request, self.0.options)
1316 .await
1317 }
1318
1319 #[cfg(feature = "unstable-stream")]
1321 pub async fn stream(
1322 self,
1323 ) -> gax::paginator::Paginator<crate::model::ListRoutesResponse, gax::error::Error>
1324 {
1325 let token = gax::paginator::extract_token(&self.0.request.page_token);
1326 let execute = move |token: String| {
1327 let mut builder = self.clone();
1328 builder.0.request = builder.0.request.set_page_token(token);
1329 builder.send()
1330 };
1331 gax::paginator::Paginator::new(token, execute)
1332 }
1333
1334 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1336 self.0.request.parent = v.into();
1337 self
1338 }
1339
1340 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1342 self.0.request.page_size = v.into();
1343 self
1344 }
1345
1346 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1348 self.0.request.page_token = v.into();
1349 self
1350 }
1351
1352 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1354 self.0.request.filter = v.into();
1355 self
1356 }
1357
1358 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1360 self.0.request.order_by = v.into();
1361 self
1362 }
1363 }
1364
1365 impl gax::options::RequestBuilder for ListRoutes {
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 ListRouteTables(RequestBuilder<crate::model::ListRouteTablesRequest>);
1374
1375 impl ListRouteTables {
1376 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1377 Self(RequestBuilder::new(stub))
1378 }
1379
1380 pub fn with_request<V: Into<crate::model::ListRouteTablesRequest>>(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<crate::model::ListRouteTablesResponse> {
1394 (*self.0.stub)
1395 .list_route_tables(self.0.request, self.0.options)
1396 .await
1397 }
1398
1399 #[cfg(feature = "unstable-stream")]
1401 pub async fn stream(
1402 self,
1403 ) -> gax::paginator::Paginator<crate::model::ListRouteTablesResponse, gax::error::Error>
1404 {
1405 let token = gax::paginator::extract_token(&self.0.request.page_token);
1406 let execute = move |token: String| {
1407 let mut builder = self.clone();
1408 builder.0.request = builder.0.request.set_page_token(token);
1409 builder.send()
1410 };
1411 gax::paginator::Paginator::new(token, execute)
1412 }
1413
1414 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1416 self.0.request.parent = v.into();
1417 self
1418 }
1419
1420 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1422 self.0.request.page_size = v.into();
1423 self
1424 }
1425
1426 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1428 self.0.request.page_token = v.into();
1429 self
1430 }
1431
1432 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1434 self.0.request.filter = v.into();
1435 self
1436 }
1437
1438 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1440 self.0.request.order_by = v.into();
1441 self
1442 }
1443 }
1444
1445 impl gax::options::RequestBuilder for ListRouteTables {
1446 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1447 &mut self.0.options
1448 }
1449 }
1450
1451 #[derive(Clone, Debug)]
1453 pub struct GetGroup(RequestBuilder<crate::model::GetGroupRequest>);
1454
1455 impl GetGroup {
1456 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1457 Self(RequestBuilder::new(stub))
1458 }
1459
1460 pub fn with_request<V: Into<crate::model::GetGroupRequest>>(mut self, v: V) -> Self {
1462 self.0.request = v.into();
1463 self
1464 }
1465
1466 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1468 self.0.options = v.into();
1469 self
1470 }
1471
1472 pub async fn send(self) -> Result<crate::model::Group> {
1474 (*self.0.stub)
1475 .get_group(self.0.request, self.0.options)
1476 .await
1477 }
1478
1479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1481 self.0.request.name = v.into();
1482 self
1483 }
1484 }
1485
1486 impl gax::options::RequestBuilder for GetGroup {
1487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1488 &mut self.0.options
1489 }
1490 }
1491
1492 #[derive(Clone, Debug)]
1494 pub struct ListGroups(RequestBuilder<crate::model::ListGroupsRequest>);
1495
1496 impl ListGroups {
1497 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1498 Self(RequestBuilder::new(stub))
1499 }
1500
1501 pub fn with_request<V: Into<crate::model::ListGroupsRequest>>(mut self, v: V) -> Self {
1503 self.0.request = v.into();
1504 self
1505 }
1506
1507 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1509 self.0.options = v.into();
1510 self
1511 }
1512
1513 pub async fn send(self) -> Result<crate::model::ListGroupsResponse> {
1515 (*self.0.stub)
1516 .list_groups(self.0.request, self.0.options)
1517 .await
1518 }
1519
1520 #[cfg(feature = "unstable-stream")]
1522 pub async fn stream(
1523 self,
1524 ) -> gax::paginator::Paginator<crate::model::ListGroupsResponse, gax::error::Error>
1525 {
1526 let token = gax::paginator::extract_token(&self.0.request.page_token);
1527 let execute = move |token: String| {
1528 let mut builder = self.clone();
1529 builder.0.request = builder.0.request.set_page_token(token);
1530 builder.send()
1531 };
1532 gax::paginator::Paginator::new(token, execute)
1533 }
1534
1535 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1537 self.0.request.parent = v.into();
1538 self
1539 }
1540
1541 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1543 self.0.request.page_size = v.into();
1544 self
1545 }
1546
1547 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1549 self.0.request.page_token = v.into();
1550 self
1551 }
1552
1553 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1555 self.0.request.filter = v.into();
1556 self
1557 }
1558
1559 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1561 self.0.request.order_by = v.into();
1562 self
1563 }
1564 }
1565
1566 impl gax::options::RequestBuilder for ListGroups {
1567 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1568 &mut self.0.options
1569 }
1570 }
1571
1572 #[derive(Clone, Debug)]
1574 pub struct UpdateGroup(RequestBuilder<crate::model::UpdateGroupRequest>);
1575
1576 impl UpdateGroup {
1577 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1578 Self(RequestBuilder::new(stub))
1579 }
1580
1581 pub fn with_request<V: Into<crate::model::UpdateGroupRequest>>(mut self, v: V) -> Self {
1583 self.0.request = v.into();
1584 self
1585 }
1586
1587 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1589 self.0.options = v.into();
1590 self
1591 }
1592
1593 pub async fn send(self) -> Result<longrunning::model::Operation> {
1600 (*self.0.stub)
1601 .update_group(self.0.request, self.0.options)
1602 .await
1603 }
1604
1605 pub fn poller(
1607 self,
1608 ) -> impl lro::Poller<crate::model::Group, crate::model::OperationMetadata> {
1609 type Operation = lro::Operation<crate::model::Group, crate::model::OperationMetadata>;
1610 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1611 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1612
1613 let stub = self.0.stub.clone();
1614 let mut options = self.0.options.clone();
1615 options.set_retry_policy(gax::retry_policy::NeverRetry);
1616 let query = move |name| {
1617 let stub = stub.clone();
1618 let options = options.clone();
1619 async {
1620 let op = GetOperation::new(stub)
1621 .set_name(name)
1622 .with_options(options)
1623 .send()
1624 .await?;
1625 Ok(Operation::new(op))
1626 }
1627 };
1628
1629 let start = move || async {
1630 let op = self.send().await?;
1631 Ok(Operation::new(op))
1632 };
1633
1634 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1635 }
1636
1637 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1639 mut self,
1640 v: T,
1641 ) -> Self {
1642 self.0.request.update_mask = v.into();
1643 self
1644 }
1645
1646 pub fn set_group<T: Into<std::option::Option<crate::model::Group>>>(
1648 mut self,
1649 v: T,
1650 ) -> Self {
1651 self.0.request.group = v.into();
1652 self
1653 }
1654
1655 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1657 self.0.request.request_id = v.into();
1658 self
1659 }
1660 }
1661
1662 impl gax::options::RequestBuilder for UpdateGroup {
1663 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1664 &mut self.0.options
1665 }
1666 }
1667
1668 #[derive(Clone, Debug)]
1670 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1671
1672 impl ListLocations {
1673 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1674 Self(RequestBuilder::new(stub))
1675 }
1676
1677 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1679 mut self,
1680 v: V,
1681 ) -> Self {
1682 self.0.request = v.into();
1683 self
1684 }
1685
1686 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1688 self.0.options = v.into();
1689 self
1690 }
1691
1692 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1694 (*self.0.stub)
1695 .list_locations(self.0.request, self.0.options)
1696 .await
1697 }
1698
1699 #[cfg(feature = "unstable-stream")]
1701 pub async fn stream(
1702 self,
1703 ) -> gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1704 {
1705 let token = gax::paginator::extract_token(&self.0.request.page_token);
1706 let execute = move |token: String| {
1707 let mut builder = self.clone();
1708 builder.0.request = builder.0.request.set_page_token(token);
1709 builder.send()
1710 };
1711 gax::paginator::Paginator::new(token, execute)
1712 }
1713
1714 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1716 self.0.request.name = v.into();
1717 self
1718 }
1719
1720 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1722 self.0.request.filter = v.into();
1723 self
1724 }
1725
1726 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1728 self.0.request.page_size = v.into();
1729 self
1730 }
1731
1732 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1734 self.0.request.page_token = v.into();
1735 self
1736 }
1737 }
1738
1739 impl gax::options::RequestBuilder for ListLocations {
1740 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1741 &mut self.0.options
1742 }
1743 }
1744
1745 #[derive(Clone, Debug)]
1747 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1748
1749 impl GetLocation {
1750 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1751 Self(RequestBuilder::new(stub))
1752 }
1753
1754 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1756 self.0.request = v.into();
1757 self
1758 }
1759
1760 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1762 self.0.options = v.into();
1763 self
1764 }
1765
1766 pub async fn send(self) -> Result<location::model::Location> {
1768 (*self.0.stub)
1769 .get_location(self.0.request, self.0.options)
1770 .await
1771 }
1772
1773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1775 self.0.request.name = v.into();
1776 self
1777 }
1778 }
1779
1780 impl gax::options::RequestBuilder for GetLocation {
1781 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1782 &mut self.0.options
1783 }
1784 }
1785
1786 #[derive(Clone, Debug)]
1788 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1789
1790 impl SetIamPolicy {
1791 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1792 Self(RequestBuilder::new(stub))
1793 }
1794
1795 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1797 self.0.request = v.into();
1798 self
1799 }
1800
1801 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1803 self.0.options = v.into();
1804 self
1805 }
1806
1807 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1809 (*self.0.stub)
1810 .set_iam_policy(self.0.request, self.0.options)
1811 .await
1812 }
1813
1814 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1816 self.0.request.resource = v.into();
1817 self
1818 }
1819
1820 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
1822 mut self,
1823 v: T,
1824 ) -> Self {
1825 self.0.request.policy = v.into();
1826 self
1827 }
1828
1829 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1831 mut self,
1832 v: T,
1833 ) -> Self {
1834 self.0.request.update_mask = v.into();
1835 self
1836 }
1837 }
1838
1839 impl gax::options::RequestBuilder for SetIamPolicy {
1840 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1841 &mut self.0.options
1842 }
1843 }
1844
1845 #[derive(Clone, Debug)]
1847 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1848
1849 impl GetIamPolicy {
1850 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1851 Self(RequestBuilder::new(stub))
1852 }
1853
1854 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1856 self.0.request = v.into();
1857 self
1858 }
1859
1860 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1862 self.0.options = v.into();
1863 self
1864 }
1865
1866 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1868 (*self.0.stub)
1869 .get_iam_policy(self.0.request, self.0.options)
1870 .await
1871 }
1872
1873 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1875 self.0.request.resource = v.into();
1876 self
1877 }
1878
1879 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
1881 mut self,
1882 v: T,
1883 ) -> Self {
1884 self.0.request.options = v.into();
1885 self
1886 }
1887 }
1888
1889 impl gax::options::RequestBuilder for GetIamPolicy {
1890 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1891 &mut self.0.options
1892 }
1893 }
1894
1895 #[derive(Clone, Debug)]
1897 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1898
1899 impl TestIamPermissions {
1900 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1901 Self(RequestBuilder::new(stub))
1902 }
1903
1904 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1906 mut self,
1907 v: V,
1908 ) -> Self {
1909 self.0.request = v.into();
1910 self
1911 }
1912
1913 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1915 self.0.options = v.into();
1916 self
1917 }
1918
1919 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1921 (*self.0.stub)
1922 .test_iam_permissions(self.0.request, self.0.options)
1923 .await
1924 }
1925
1926 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1928 self.0.request.resource = v.into();
1929 self
1930 }
1931
1932 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1934 where
1935 T: std::iter::IntoIterator<Item = V>,
1936 V: std::convert::Into<std::string::String>,
1937 {
1938 use std::iter::Iterator;
1939 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1940 self
1941 }
1942 }
1943
1944 impl gax::options::RequestBuilder for TestIamPermissions {
1945 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1946 &mut self.0.options
1947 }
1948 }
1949
1950 #[derive(Clone, Debug)]
1952 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1953
1954 impl ListOperations {
1955 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
1956 Self(RequestBuilder::new(stub))
1957 }
1958
1959 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1961 mut self,
1962 v: V,
1963 ) -> Self {
1964 self.0.request = v.into();
1965 self
1966 }
1967
1968 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1970 self.0.options = v.into();
1971 self
1972 }
1973
1974 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1976 (*self.0.stub)
1977 .list_operations(self.0.request, self.0.options)
1978 .await
1979 }
1980
1981 #[cfg(feature = "unstable-stream")]
1983 pub async fn stream(
1984 self,
1985 ) -> gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1986 {
1987 let token = gax::paginator::extract_token(&self.0.request.page_token);
1988 let execute = move |token: String| {
1989 let mut builder = self.clone();
1990 builder.0.request = builder.0.request.set_page_token(token);
1991 builder.send()
1992 };
1993 gax::paginator::Paginator::new(token, execute)
1994 }
1995
1996 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1998 self.0.request.name = v.into();
1999 self
2000 }
2001
2002 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2004 self.0.request.filter = v.into();
2005 self
2006 }
2007
2008 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2010 self.0.request.page_size = v.into();
2011 self
2012 }
2013
2014 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2016 self.0.request.page_token = v.into();
2017 self
2018 }
2019 }
2020
2021 impl gax::options::RequestBuilder for ListOperations {
2022 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2023 &mut self.0.options
2024 }
2025 }
2026
2027 #[derive(Clone, Debug)]
2029 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2030
2031 impl GetOperation {
2032 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
2033 Self(RequestBuilder::new(stub))
2034 }
2035
2036 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2038 mut self,
2039 v: V,
2040 ) -> Self {
2041 self.0.request = v.into();
2042 self
2043 }
2044
2045 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2047 self.0.options = v.into();
2048 self
2049 }
2050
2051 pub async fn send(self) -> Result<longrunning::model::Operation> {
2053 (*self.0.stub)
2054 .get_operation(self.0.request, self.0.options)
2055 .await
2056 }
2057
2058 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2060 self.0.request.name = v.into();
2061 self
2062 }
2063 }
2064
2065 impl gax::options::RequestBuilder for GetOperation {
2066 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2067 &mut self.0.options
2068 }
2069 }
2070
2071 #[derive(Clone, Debug)]
2073 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2074
2075 impl DeleteOperation {
2076 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
2077 Self(RequestBuilder::new(stub))
2078 }
2079
2080 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2082 mut self,
2083 v: V,
2084 ) -> Self {
2085 self.0.request = v.into();
2086 self
2087 }
2088
2089 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2091 self.0.options = v.into();
2092 self
2093 }
2094
2095 pub async fn send(self) -> Result<wkt::Empty> {
2097 (*self.0.stub)
2098 .delete_operation(self.0.request, self.0.options)
2099 .await
2100 }
2101
2102 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2104 self.0.request.name = v.into();
2105 self
2106 }
2107 }
2108
2109 impl gax::options::RequestBuilder for DeleteOperation {
2110 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2111 &mut self.0.options
2112 }
2113 }
2114
2115 #[derive(Clone, Debug)]
2117 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2118
2119 impl CancelOperation {
2120 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::HubService>) -> Self {
2121 Self(RequestBuilder::new(stub))
2122 }
2123
2124 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2126 mut self,
2127 v: V,
2128 ) -> Self {
2129 self.0.request = v.into();
2130 self
2131 }
2132
2133 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2135 self.0.options = v.into();
2136 self
2137 }
2138
2139 pub async fn send(self) -> Result<wkt::Empty> {
2141 (*self.0.stub)
2142 .cancel_operation(self.0.request, self.0.options)
2143 .await
2144 }
2145
2146 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2148 self.0.request.name = v.into();
2149 self
2150 }
2151 }
2152
2153 impl gax::options::RequestBuilder for CancelOperation {
2154 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2155 &mut self.0.options
2156 }
2157 }
2158}
2159
2160pub mod policy_based_routing_service {
2161 use crate::Result;
2162 use std::sync::Arc;
2163
2164 #[derive(Clone, Debug)]
2166 pub struct RequestBuilder<R: std::default::Default> {
2167 stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>,
2168 request: R,
2169 options: gax::options::RequestOptions,
2170 }
2171
2172 impl<R> RequestBuilder<R>
2173 where
2174 R: std::default::Default,
2175 {
2176 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2177 Self {
2178 stub,
2179 request: R::default(),
2180 options: gax::options::RequestOptions::default(),
2181 }
2182 }
2183 }
2184
2185 #[derive(Clone, Debug)]
2187 pub struct ListPolicyBasedRoutes(RequestBuilder<crate::model::ListPolicyBasedRoutesRequest>);
2188
2189 impl ListPolicyBasedRoutes {
2190 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2191 Self(RequestBuilder::new(stub))
2192 }
2193
2194 pub fn with_request<V: Into<crate::model::ListPolicyBasedRoutesRequest>>(
2196 mut self,
2197 v: V,
2198 ) -> Self {
2199 self.0.request = v.into();
2200 self
2201 }
2202
2203 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2205 self.0.options = v.into();
2206 self
2207 }
2208
2209 pub async fn send(self) -> Result<crate::model::ListPolicyBasedRoutesResponse> {
2211 (*self.0.stub)
2212 .list_policy_based_routes(self.0.request, self.0.options)
2213 .await
2214 }
2215
2216 #[cfg(feature = "unstable-stream")]
2218 pub async fn stream(
2219 self,
2220 ) -> gax::paginator::Paginator<crate::model::ListPolicyBasedRoutesResponse, gax::error::Error>
2221 {
2222 let token = gax::paginator::extract_token(&self.0.request.page_token);
2223 let execute = move |token: String| {
2224 let mut builder = self.clone();
2225 builder.0.request = builder.0.request.set_page_token(token);
2226 builder.send()
2227 };
2228 gax::paginator::Paginator::new(token, execute)
2229 }
2230
2231 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2233 self.0.request.parent = v.into();
2234 self
2235 }
2236
2237 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2239 self.0.request.page_size = v.into();
2240 self
2241 }
2242
2243 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2245 self.0.request.page_token = v.into();
2246 self
2247 }
2248
2249 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2251 self.0.request.filter = v.into();
2252 self
2253 }
2254
2255 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2257 self.0.request.order_by = v.into();
2258 self
2259 }
2260 }
2261
2262 impl gax::options::RequestBuilder for ListPolicyBasedRoutes {
2263 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2264 &mut self.0.options
2265 }
2266 }
2267
2268 #[derive(Clone, Debug)]
2270 pub struct GetPolicyBasedRoute(RequestBuilder<crate::model::GetPolicyBasedRouteRequest>);
2271
2272 impl GetPolicyBasedRoute {
2273 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2274 Self(RequestBuilder::new(stub))
2275 }
2276
2277 pub fn with_request<V: Into<crate::model::GetPolicyBasedRouteRequest>>(
2279 mut self,
2280 v: V,
2281 ) -> Self {
2282 self.0.request = v.into();
2283 self
2284 }
2285
2286 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2288 self.0.options = v.into();
2289 self
2290 }
2291
2292 pub async fn send(self) -> Result<crate::model::PolicyBasedRoute> {
2294 (*self.0.stub)
2295 .get_policy_based_route(self.0.request, self.0.options)
2296 .await
2297 }
2298
2299 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2301 self.0.request.name = v.into();
2302 self
2303 }
2304 }
2305
2306 impl gax::options::RequestBuilder for GetPolicyBasedRoute {
2307 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2308 &mut self.0.options
2309 }
2310 }
2311
2312 #[derive(Clone, Debug)]
2314 pub struct CreatePolicyBasedRoute(RequestBuilder<crate::model::CreatePolicyBasedRouteRequest>);
2315
2316 impl CreatePolicyBasedRoute {
2317 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2318 Self(RequestBuilder::new(stub))
2319 }
2320
2321 pub fn with_request<V: Into<crate::model::CreatePolicyBasedRouteRequest>>(
2323 mut self,
2324 v: V,
2325 ) -> Self {
2326 self.0.request = v.into();
2327 self
2328 }
2329
2330 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2332 self.0.options = v.into();
2333 self
2334 }
2335
2336 pub async fn send(self) -> Result<longrunning::model::Operation> {
2343 (*self.0.stub)
2344 .create_policy_based_route(self.0.request, self.0.options)
2345 .await
2346 }
2347
2348 pub fn poller(
2350 self,
2351 ) -> impl lro::Poller<crate::model::PolicyBasedRoute, crate::model::OperationMetadata>
2352 {
2353 type Operation =
2354 lro::Operation<crate::model::PolicyBasedRoute, crate::model::OperationMetadata>;
2355 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
2356 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2357
2358 let stub = self.0.stub.clone();
2359 let mut options = self.0.options.clone();
2360 options.set_retry_policy(gax::retry_policy::NeverRetry);
2361 let query = move |name| {
2362 let stub = stub.clone();
2363 let options = options.clone();
2364 async {
2365 let op = GetOperation::new(stub)
2366 .set_name(name)
2367 .with_options(options)
2368 .send()
2369 .await?;
2370 Ok(Operation::new(op))
2371 }
2372 };
2373
2374 let start = move || async {
2375 let op = self.send().await?;
2376 Ok(Operation::new(op))
2377 };
2378
2379 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
2380 }
2381
2382 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2384 self.0.request.parent = v.into();
2385 self
2386 }
2387
2388 pub fn set_policy_based_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2390 self.0.request.policy_based_route_id = v.into();
2391 self
2392 }
2393
2394 pub fn set_policy_based_route<
2396 T: Into<std::option::Option<crate::model::PolicyBasedRoute>>,
2397 >(
2398 mut self,
2399 v: T,
2400 ) -> Self {
2401 self.0.request.policy_based_route = v.into();
2402 self
2403 }
2404
2405 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2407 self.0.request.request_id = v.into();
2408 self
2409 }
2410 }
2411
2412 impl gax::options::RequestBuilder for CreatePolicyBasedRoute {
2413 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2414 &mut self.0.options
2415 }
2416 }
2417
2418 #[derive(Clone, Debug)]
2420 pub struct DeletePolicyBasedRoute(RequestBuilder<crate::model::DeletePolicyBasedRouteRequest>);
2421
2422 impl DeletePolicyBasedRoute {
2423 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2424 Self(RequestBuilder::new(stub))
2425 }
2426
2427 pub fn with_request<V: Into<crate::model::DeletePolicyBasedRouteRequest>>(
2429 mut self,
2430 v: V,
2431 ) -> Self {
2432 self.0.request = v.into();
2433 self
2434 }
2435
2436 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2438 self.0.options = v.into();
2439 self
2440 }
2441
2442 pub async fn send(self) -> Result<longrunning::model::Operation> {
2449 (*self.0.stub)
2450 .delete_policy_based_route(self.0.request, self.0.options)
2451 .await
2452 }
2453
2454 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
2456 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
2457 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
2458 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2459
2460 let stub = self.0.stub.clone();
2461 let mut options = self.0.options.clone();
2462 options.set_retry_policy(gax::retry_policy::NeverRetry);
2463 let query = move |name| {
2464 let stub = stub.clone();
2465 let options = options.clone();
2466 async {
2467 let op = GetOperation::new(stub)
2468 .set_name(name)
2469 .with_options(options)
2470 .send()
2471 .await?;
2472 Ok(Operation::new(op))
2473 }
2474 };
2475
2476 let start = move || async {
2477 let op = self.send().await?;
2478 Ok(Operation::new(op))
2479 };
2480
2481 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
2482 }
2483
2484 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2486 self.0.request.name = v.into();
2487 self
2488 }
2489
2490 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2492 self.0.request.request_id = v.into();
2493 self
2494 }
2495 }
2496
2497 impl gax::options::RequestBuilder for DeletePolicyBasedRoute {
2498 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2499 &mut self.0.options
2500 }
2501 }
2502
2503 #[derive(Clone, Debug)]
2505 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2506
2507 impl ListLocations {
2508 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2509 Self(RequestBuilder::new(stub))
2510 }
2511
2512 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2514 mut self,
2515 v: V,
2516 ) -> Self {
2517 self.0.request = v.into();
2518 self
2519 }
2520
2521 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2523 self.0.options = v.into();
2524 self
2525 }
2526
2527 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2529 (*self.0.stub)
2530 .list_locations(self.0.request, self.0.options)
2531 .await
2532 }
2533
2534 #[cfg(feature = "unstable-stream")]
2536 pub async fn stream(
2537 self,
2538 ) -> gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2539 {
2540 let token = gax::paginator::extract_token(&self.0.request.page_token);
2541 let execute = move |token: String| {
2542 let mut builder = self.clone();
2543 builder.0.request = builder.0.request.set_page_token(token);
2544 builder.send()
2545 };
2546 gax::paginator::Paginator::new(token, execute)
2547 }
2548
2549 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2551 self.0.request.name = v.into();
2552 self
2553 }
2554
2555 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2557 self.0.request.filter = v.into();
2558 self
2559 }
2560
2561 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2563 self.0.request.page_size = v.into();
2564 self
2565 }
2566
2567 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2569 self.0.request.page_token = v.into();
2570 self
2571 }
2572 }
2573
2574 impl gax::options::RequestBuilder for ListLocations {
2575 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2576 &mut self.0.options
2577 }
2578 }
2579
2580 #[derive(Clone, Debug)]
2582 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2583
2584 impl GetLocation {
2585 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2586 Self(RequestBuilder::new(stub))
2587 }
2588
2589 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2591 self.0.request = v.into();
2592 self
2593 }
2594
2595 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2597 self.0.options = v.into();
2598 self
2599 }
2600
2601 pub async fn send(self) -> Result<location::model::Location> {
2603 (*self.0.stub)
2604 .get_location(self.0.request, self.0.options)
2605 .await
2606 }
2607
2608 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.0.request.name = v.into();
2611 self
2612 }
2613 }
2614
2615 impl gax::options::RequestBuilder for GetLocation {
2616 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2617 &mut self.0.options
2618 }
2619 }
2620
2621 #[derive(Clone, Debug)]
2623 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2624
2625 impl SetIamPolicy {
2626 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2627 Self(RequestBuilder::new(stub))
2628 }
2629
2630 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2632 self.0.request = v.into();
2633 self
2634 }
2635
2636 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2638 self.0.options = v.into();
2639 self
2640 }
2641
2642 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2644 (*self.0.stub)
2645 .set_iam_policy(self.0.request, self.0.options)
2646 .await
2647 }
2648
2649 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2651 self.0.request.resource = v.into();
2652 self
2653 }
2654
2655 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
2657 mut self,
2658 v: T,
2659 ) -> Self {
2660 self.0.request.policy = v.into();
2661 self
2662 }
2663
2664 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
2666 mut self,
2667 v: T,
2668 ) -> Self {
2669 self.0.request.update_mask = v.into();
2670 self
2671 }
2672 }
2673
2674 impl gax::options::RequestBuilder for SetIamPolicy {
2675 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2676 &mut self.0.options
2677 }
2678 }
2679
2680 #[derive(Clone, Debug)]
2682 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2683
2684 impl GetIamPolicy {
2685 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2686 Self(RequestBuilder::new(stub))
2687 }
2688
2689 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2691 self.0.request = v.into();
2692 self
2693 }
2694
2695 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2697 self.0.options = v.into();
2698 self
2699 }
2700
2701 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2703 (*self.0.stub)
2704 .get_iam_policy(self.0.request, self.0.options)
2705 .await
2706 }
2707
2708 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2710 self.0.request.resource = v.into();
2711 self
2712 }
2713
2714 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
2716 mut self,
2717 v: T,
2718 ) -> Self {
2719 self.0.request.options = v.into();
2720 self
2721 }
2722 }
2723
2724 impl gax::options::RequestBuilder for GetIamPolicy {
2725 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2726 &mut self.0.options
2727 }
2728 }
2729
2730 #[derive(Clone, Debug)]
2732 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2733
2734 impl TestIamPermissions {
2735 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2736 Self(RequestBuilder::new(stub))
2737 }
2738
2739 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2741 mut self,
2742 v: V,
2743 ) -> Self {
2744 self.0.request = v.into();
2745 self
2746 }
2747
2748 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2750 self.0.options = v.into();
2751 self
2752 }
2753
2754 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2756 (*self.0.stub)
2757 .test_iam_permissions(self.0.request, self.0.options)
2758 .await
2759 }
2760
2761 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2763 self.0.request.resource = v.into();
2764 self
2765 }
2766
2767 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2769 where
2770 T: std::iter::IntoIterator<Item = V>,
2771 V: std::convert::Into<std::string::String>,
2772 {
2773 use std::iter::Iterator;
2774 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2775 self
2776 }
2777 }
2778
2779 impl gax::options::RequestBuilder for TestIamPermissions {
2780 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2781 &mut self.0.options
2782 }
2783 }
2784
2785 #[derive(Clone, Debug)]
2787 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2788
2789 impl ListOperations {
2790 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2791 Self(RequestBuilder::new(stub))
2792 }
2793
2794 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2796 mut self,
2797 v: V,
2798 ) -> Self {
2799 self.0.request = v.into();
2800 self
2801 }
2802
2803 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2805 self.0.options = v.into();
2806 self
2807 }
2808
2809 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2811 (*self.0.stub)
2812 .list_operations(self.0.request, self.0.options)
2813 .await
2814 }
2815
2816 #[cfg(feature = "unstable-stream")]
2818 pub async fn stream(
2819 self,
2820 ) -> gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2821 {
2822 let token = gax::paginator::extract_token(&self.0.request.page_token);
2823 let execute = move |token: String| {
2824 let mut builder = self.clone();
2825 builder.0.request = builder.0.request.set_page_token(token);
2826 builder.send()
2827 };
2828 gax::paginator::Paginator::new(token, execute)
2829 }
2830
2831 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2833 self.0.request.name = v.into();
2834 self
2835 }
2836
2837 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2839 self.0.request.filter = v.into();
2840 self
2841 }
2842
2843 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2845 self.0.request.page_size = v.into();
2846 self
2847 }
2848
2849 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2851 self.0.request.page_token = v.into();
2852 self
2853 }
2854 }
2855
2856 impl gax::options::RequestBuilder for ListOperations {
2857 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2858 &mut self.0.options
2859 }
2860 }
2861
2862 #[derive(Clone, Debug)]
2864 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2865
2866 impl GetOperation {
2867 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2868 Self(RequestBuilder::new(stub))
2869 }
2870
2871 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2873 mut self,
2874 v: V,
2875 ) -> Self {
2876 self.0.request = v.into();
2877 self
2878 }
2879
2880 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2882 self.0.options = v.into();
2883 self
2884 }
2885
2886 pub async fn send(self) -> Result<longrunning::model::Operation> {
2888 (*self.0.stub)
2889 .get_operation(self.0.request, self.0.options)
2890 .await
2891 }
2892
2893 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2895 self.0.request.name = v.into();
2896 self
2897 }
2898 }
2899
2900 impl gax::options::RequestBuilder for GetOperation {
2901 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2902 &mut self.0.options
2903 }
2904 }
2905
2906 #[derive(Clone, Debug)]
2908 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2909
2910 impl DeleteOperation {
2911 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2912 Self(RequestBuilder::new(stub))
2913 }
2914
2915 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2917 mut self,
2918 v: V,
2919 ) -> Self {
2920 self.0.request = v.into();
2921 self
2922 }
2923
2924 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2926 self.0.options = v.into();
2927 self
2928 }
2929
2930 pub async fn send(self) -> Result<wkt::Empty> {
2932 (*self.0.stub)
2933 .delete_operation(self.0.request, self.0.options)
2934 .await
2935 }
2936
2937 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2939 self.0.request.name = v.into();
2940 self
2941 }
2942 }
2943
2944 impl gax::options::RequestBuilder for DeleteOperation {
2945 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2946 &mut self.0.options
2947 }
2948 }
2949
2950 #[derive(Clone, Debug)]
2952 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2953
2954 impl CancelOperation {
2955 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::PolicyBasedRoutingService>) -> Self {
2956 Self(RequestBuilder::new(stub))
2957 }
2958
2959 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2961 mut self,
2962 v: V,
2963 ) -> Self {
2964 self.0.request = v.into();
2965 self
2966 }
2967
2968 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2970 self.0.options = v.into();
2971 self
2972 }
2973
2974 pub async fn send(self) -> Result<wkt::Empty> {
2976 (*self.0.stub)
2977 .cancel_operation(self.0.request, self.0.options)
2978 .await
2979 }
2980
2981 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2983 self.0.request.name = v.into();
2984 self
2985 }
2986 }
2987
2988 impl gax::options::RequestBuilder for CancelOperation {
2989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2990 &mut self.0.options
2991 }
2992 }
2993}