1pub mod datastream {
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::Datastream>,
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::Datastream>) -> 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 ListConnectionProfiles(RequestBuilder<crate::model::ListConnectionProfilesRequest>);
45
46 impl ListConnectionProfiles {
47 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
48 Self(RequestBuilder::new(stub))
49 }
50
51 pub fn with_request<V: Into<crate::model::ListConnectionProfilesRequest>>(
53 mut self,
54 v: V,
55 ) -> Self {
56 self.0.request = v.into();
57 self
58 }
59
60 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
62 self.0.options = v.into();
63 self
64 }
65
66 pub async fn send(self) -> Result<crate::model::ListConnectionProfilesResponse> {
68 (*self.0.stub)
69 .list_connection_profiles(self.0.request, self.0.options)
70 .await
71 }
72
73 #[cfg(feature = "unstable-stream")]
75 pub async fn stream(
76 self,
77 ) -> gax::paginator::Paginator<
78 crate::model::ListConnectionProfilesResponse,
79 gax::error::Error,
80 > {
81 let token = gax::paginator::extract_token(&self.0.request.page_token);
82 let execute = move |token: String| {
83 let mut builder = self.clone();
84 builder.0.request = builder.0.request.set_page_token(token);
85 builder.send()
86 };
87 gax::paginator::Paginator::new(token, execute)
88 }
89
90 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
92 self.0.request.parent = v.into();
93 self
94 }
95
96 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
98 self.0.request.page_size = v.into();
99 self
100 }
101
102 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
104 self.0.request.page_token = v.into();
105 self
106 }
107
108 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
110 self.0.request.filter = v.into();
111 self
112 }
113
114 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
116 self.0.request.order_by = v.into();
117 self
118 }
119 }
120
121 impl gax::options::RequestBuilder for ListConnectionProfiles {
122 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
123 &mut self.0.options
124 }
125 }
126
127 #[derive(Clone, Debug)]
129 pub struct GetConnectionProfile(RequestBuilder<crate::model::GetConnectionProfileRequest>);
130
131 impl GetConnectionProfile {
132 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
133 Self(RequestBuilder::new(stub))
134 }
135
136 pub fn with_request<V: Into<crate::model::GetConnectionProfileRequest>>(
138 mut self,
139 v: V,
140 ) -> Self {
141 self.0.request = v.into();
142 self
143 }
144
145 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
147 self.0.options = v.into();
148 self
149 }
150
151 pub async fn send(self) -> Result<crate::model::ConnectionProfile> {
153 (*self.0.stub)
154 .get_connection_profile(self.0.request, self.0.options)
155 .await
156 }
157
158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
160 self.0.request.name = v.into();
161 self
162 }
163 }
164
165 impl gax::options::RequestBuilder for GetConnectionProfile {
166 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
167 &mut self.0.options
168 }
169 }
170
171 #[derive(Clone, Debug)]
173 pub struct CreateConnectionProfile(
174 RequestBuilder<crate::model::CreateConnectionProfileRequest>,
175 );
176
177 impl CreateConnectionProfile {
178 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
179 Self(RequestBuilder::new(stub))
180 }
181
182 pub fn with_request<V: Into<crate::model::CreateConnectionProfileRequest>>(
184 mut self,
185 v: V,
186 ) -> Self {
187 self.0.request = v.into();
188 self
189 }
190
191 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
193 self.0.options = v.into();
194 self
195 }
196
197 pub async fn send(self) -> Result<longrunning::model::Operation> {
204 (*self.0.stub)
205 .create_connection_profile(self.0.request, self.0.options)
206 .await
207 }
208
209 pub fn poller(
211 self,
212 ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
213 {
214 type Operation =
215 lro::Operation<crate::model::ConnectionProfile, crate::model::OperationMetadata>;
216 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
217 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
218
219 let stub = self.0.stub.clone();
220 let mut options = self.0.options.clone();
221 options.set_retry_policy(gax::retry_policy::NeverRetry);
222 let query = move |name| {
223 let stub = stub.clone();
224 let options = options.clone();
225 async {
226 let op = GetOperation::new(stub)
227 .set_name(name)
228 .with_options(options)
229 .send()
230 .await?;
231 Ok(Operation::new(op))
232 }
233 };
234
235 let start = move || async {
236 let op = self.send().await?;
237 Ok(Operation::new(op))
238 };
239
240 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
241 }
242
243 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
245 self.0.request.parent = v.into();
246 self
247 }
248
249 pub fn set_connection_profile_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
251 self.0.request.connection_profile_id = v.into();
252 self
253 }
254
255 pub fn set_connection_profile<
257 T: Into<std::option::Option<crate::model::ConnectionProfile>>,
258 >(
259 mut self,
260 v: T,
261 ) -> Self {
262 self.0.request.connection_profile = v.into();
263 self
264 }
265
266 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
268 self.0.request.request_id = v.into();
269 self
270 }
271
272 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
274 self.0.request.validate_only = v.into();
275 self
276 }
277
278 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
280 self.0.request.force = v.into();
281 self
282 }
283 }
284
285 impl gax::options::RequestBuilder for CreateConnectionProfile {
286 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
287 &mut self.0.options
288 }
289 }
290
291 #[derive(Clone, Debug)]
293 pub struct UpdateConnectionProfile(
294 RequestBuilder<crate::model::UpdateConnectionProfileRequest>,
295 );
296
297 impl UpdateConnectionProfile {
298 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
299 Self(RequestBuilder::new(stub))
300 }
301
302 pub fn with_request<V: Into<crate::model::UpdateConnectionProfileRequest>>(
304 mut self,
305 v: V,
306 ) -> Self {
307 self.0.request = v.into();
308 self
309 }
310
311 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
313 self.0.options = v.into();
314 self
315 }
316
317 pub async fn send(self) -> Result<longrunning::model::Operation> {
324 (*self.0.stub)
325 .update_connection_profile(self.0.request, self.0.options)
326 .await
327 }
328
329 pub fn poller(
331 self,
332 ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
333 {
334 type Operation =
335 lro::Operation<crate::model::ConnectionProfile, crate::model::OperationMetadata>;
336 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
337 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
338
339 let stub = self.0.stub.clone();
340 let mut options = self.0.options.clone();
341 options.set_retry_policy(gax::retry_policy::NeverRetry);
342 let query = move |name| {
343 let stub = stub.clone();
344 let options = options.clone();
345 async {
346 let op = GetOperation::new(stub)
347 .set_name(name)
348 .with_options(options)
349 .send()
350 .await?;
351 Ok(Operation::new(op))
352 }
353 };
354
355 let start = move || async {
356 let op = self.send().await?;
357 Ok(Operation::new(op))
358 };
359
360 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
361 }
362
363 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
365 mut self,
366 v: T,
367 ) -> Self {
368 self.0.request.update_mask = v.into();
369 self
370 }
371
372 pub fn set_connection_profile<
374 T: Into<std::option::Option<crate::model::ConnectionProfile>>,
375 >(
376 mut self,
377 v: T,
378 ) -> Self {
379 self.0.request.connection_profile = v.into();
380 self
381 }
382
383 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
385 self.0.request.request_id = v.into();
386 self
387 }
388
389 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
391 self.0.request.validate_only = v.into();
392 self
393 }
394
395 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
397 self.0.request.force = v.into();
398 self
399 }
400 }
401
402 impl gax::options::RequestBuilder for UpdateConnectionProfile {
403 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
404 &mut self.0.options
405 }
406 }
407
408 #[derive(Clone, Debug)]
410 pub struct DeleteConnectionProfile(
411 RequestBuilder<crate::model::DeleteConnectionProfileRequest>,
412 );
413
414 impl DeleteConnectionProfile {
415 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
416 Self(RequestBuilder::new(stub))
417 }
418
419 pub fn with_request<V: Into<crate::model::DeleteConnectionProfileRequest>>(
421 mut self,
422 v: V,
423 ) -> Self {
424 self.0.request = v.into();
425 self
426 }
427
428 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
430 self.0.options = v.into();
431 self
432 }
433
434 pub async fn send(self) -> Result<longrunning::model::Operation> {
441 (*self.0.stub)
442 .delete_connection_profile(self.0.request, self.0.options)
443 .await
444 }
445
446 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
448 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
449 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
450 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
451
452 let stub = self.0.stub.clone();
453 let mut options = self.0.options.clone();
454 options.set_retry_policy(gax::retry_policy::NeverRetry);
455 let query = move |name| {
456 let stub = stub.clone();
457 let options = options.clone();
458 async {
459 let op = GetOperation::new(stub)
460 .set_name(name)
461 .with_options(options)
462 .send()
463 .await?;
464 Ok(Operation::new(op))
465 }
466 };
467
468 let start = move || async {
469 let op = self.send().await?;
470 Ok(Operation::new(op))
471 };
472
473 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
474 }
475
476 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
478 self.0.request.name = v.into();
479 self
480 }
481
482 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
484 self.0.request.request_id = v.into();
485 self
486 }
487 }
488
489 impl gax::options::RequestBuilder for DeleteConnectionProfile {
490 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
491 &mut self.0.options
492 }
493 }
494
495 #[derive(Clone, Debug)]
497 pub struct DiscoverConnectionProfile(
498 RequestBuilder<crate::model::DiscoverConnectionProfileRequest>,
499 );
500
501 impl DiscoverConnectionProfile {
502 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
503 Self(RequestBuilder::new(stub))
504 }
505
506 pub fn with_request<V: Into<crate::model::DiscoverConnectionProfileRequest>>(
508 mut self,
509 v: V,
510 ) -> Self {
511 self.0.request = v.into();
512 self
513 }
514
515 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
517 self.0.options = v.into();
518 self
519 }
520
521 pub async fn send(self) -> Result<crate::model::DiscoverConnectionProfileResponse> {
523 (*self.0.stub)
524 .discover_connection_profile(self.0.request, self.0.options)
525 .await
526 }
527
528 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
530 self.0.request.parent = v.into();
531 self
532 }
533
534 pub fn set_target<
536 T: Into<Option<crate::model::discover_connection_profile_request::Target>>,
537 >(
538 mut self,
539 v: T,
540 ) -> Self {
541 self.0.request.target = v.into();
542 self
543 }
544
545 pub fn set_hierarchy<
547 T: Into<Option<crate::model::discover_connection_profile_request::Hierarchy>>,
548 >(
549 mut self,
550 v: T,
551 ) -> Self {
552 self.0.request.hierarchy = v.into();
553 self
554 }
555
556 pub fn set_data_object<
558 T: Into<Option<crate::model::discover_connection_profile_request::DataObject>>,
559 >(
560 mut self,
561 v: T,
562 ) -> Self {
563 self.0.request.data_object = v.into();
564 self
565 }
566 }
567
568 impl gax::options::RequestBuilder for DiscoverConnectionProfile {
569 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
570 &mut self.0.options
571 }
572 }
573
574 #[derive(Clone, Debug)]
576 pub struct ListStreams(RequestBuilder<crate::model::ListStreamsRequest>);
577
578 impl ListStreams {
579 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
580 Self(RequestBuilder::new(stub))
581 }
582
583 pub fn with_request<V: Into<crate::model::ListStreamsRequest>>(mut self, v: V) -> Self {
585 self.0.request = v.into();
586 self
587 }
588
589 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
591 self.0.options = v.into();
592 self
593 }
594
595 pub async fn send(self) -> Result<crate::model::ListStreamsResponse> {
597 (*self.0.stub)
598 .list_streams(self.0.request, self.0.options)
599 .await
600 }
601
602 #[cfg(feature = "unstable-stream")]
604 pub async fn stream(
605 self,
606 ) -> gax::paginator::Paginator<crate::model::ListStreamsResponse, gax::error::Error>
607 {
608 let token = gax::paginator::extract_token(&self.0.request.page_token);
609 let execute = move |token: String| {
610 let mut builder = self.clone();
611 builder.0.request = builder.0.request.set_page_token(token);
612 builder.send()
613 };
614 gax::paginator::Paginator::new(token, execute)
615 }
616
617 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
619 self.0.request.parent = v.into();
620 self
621 }
622
623 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
625 self.0.request.page_size = v.into();
626 self
627 }
628
629 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
631 self.0.request.page_token = v.into();
632 self
633 }
634
635 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
637 self.0.request.filter = v.into();
638 self
639 }
640
641 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
643 self.0.request.order_by = v.into();
644 self
645 }
646 }
647
648 impl gax::options::RequestBuilder for ListStreams {
649 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
650 &mut self.0.options
651 }
652 }
653
654 #[derive(Clone, Debug)]
656 pub struct GetStream(RequestBuilder<crate::model::GetStreamRequest>);
657
658 impl GetStream {
659 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
660 Self(RequestBuilder::new(stub))
661 }
662
663 pub fn with_request<V: Into<crate::model::GetStreamRequest>>(mut self, v: V) -> Self {
665 self.0.request = v.into();
666 self
667 }
668
669 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
671 self.0.options = v.into();
672 self
673 }
674
675 pub async fn send(self) -> Result<crate::model::Stream> {
677 (*self.0.stub)
678 .get_stream(self.0.request, self.0.options)
679 .await
680 }
681
682 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
684 self.0.request.name = v.into();
685 self
686 }
687 }
688
689 impl gax::options::RequestBuilder for GetStream {
690 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
691 &mut self.0.options
692 }
693 }
694
695 #[derive(Clone, Debug)]
697 pub struct CreateStream(RequestBuilder<crate::model::CreateStreamRequest>);
698
699 impl CreateStream {
700 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
701 Self(RequestBuilder::new(stub))
702 }
703
704 pub fn with_request<V: Into<crate::model::CreateStreamRequest>>(mut self, v: V) -> Self {
706 self.0.request = v.into();
707 self
708 }
709
710 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
712 self.0.options = v.into();
713 self
714 }
715
716 pub async fn send(self) -> Result<longrunning::model::Operation> {
723 (*self.0.stub)
724 .create_stream(self.0.request, self.0.options)
725 .await
726 }
727
728 pub fn poller(
730 self,
731 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
732 type Operation = lro::Operation<crate::model::Stream, crate::model::OperationMetadata>;
733 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
734 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
735
736 let stub = self.0.stub.clone();
737 let mut options = self.0.options.clone();
738 options.set_retry_policy(gax::retry_policy::NeverRetry);
739 let query = move |name| {
740 let stub = stub.clone();
741 let options = options.clone();
742 async {
743 let op = GetOperation::new(stub)
744 .set_name(name)
745 .with_options(options)
746 .send()
747 .await?;
748 Ok(Operation::new(op))
749 }
750 };
751
752 let start = move || async {
753 let op = self.send().await?;
754 Ok(Operation::new(op))
755 };
756
757 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
758 }
759
760 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
762 self.0.request.parent = v.into();
763 self
764 }
765
766 pub fn set_stream_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
768 self.0.request.stream_id = v.into();
769 self
770 }
771
772 pub fn set_stream<T: Into<std::option::Option<crate::model::Stream>>>(
774 mut self,
775 v: T,
776 ) -> Self {
777 self.0.request.stream = v.into();
778 self
779 }
780
781 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
783 self.0.request.request_id = v.into();
784 self
785 }
786
787 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
789 self.0.request.validate_only = v.into();
790 self
791 }
792
793 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
795 self.0.request.force = v.into();
796 self
797 }
798 }
799
800 impl gax::options::RequestBuilder for CreateStream {
801 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
802 &mut self.0.options
803 }
804 }
805
806 #[derive(Clone, Debug)]
808 pub struct UpdateStream(RequestBuilder<crate::model::UpdateStreamRequest>);
809
810 impl UpdateStream {
811 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
812 Self(RequestBuilder::new(stub))
813 }
814
815 pub fn with_request<V: Into<crate::model::UpdateStreamRequest>>(mut self, v: V) -> Self {
817 self.0.request = v.into();
818 self
819 }
820
821 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
823 self.0.options = v.into();
824 self
825 }
826
827 pub async fn send(self) -> Result<longrunning::model::Operation> {
834 (*self.0.stub)
835 .update_stream(self.0.request, self.0.options)
836 .await
837 }
838
839 pub fn poller(
841 self,
842 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
843 type Operation = lro::Operation<crate::model::Stream, crate::model::OperationMetadata>;
844 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
845 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
846
847 let stub = self.0.stub.clone();
848 let mut options = self.0.options.clone();
849 options.set_retry_policy(gax::retry_policy::NeverRetry);
850 let query = move |name| {
851 let stub = stub.clone();
852 let options = options.clone();
853 async {
854 let op = GetOperation::new(stub)
855 .set_name(name)
856 .with_options(options)
857 .send()
858 .await?;
859 Ok(Operation::new(op))
860 }
861 };
862
863 let start = move || async {
864 let op = self.send().await?;
865 Ok(Operation::new(op))
866 };
867
868 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
869 }
870
871 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
873 mut self,
874 v: T,
875 ) -> Self {
876 self.0.request.update_mask = v.into();
877 self
878 }
879
880 pub fn set_stream<T: Into<std::option::Option<crate::model::Stream>>>(
882 mut self,
883 v: T,
884 ) -> Self {
885 self.0.request.stream = v.into();
886 self
887 }
888
889 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
891 self.0.request.request_id = v.into();
892 self
893 }
894
895 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
897 self.0.request.validate_only = v.into();
898 self
899 }
900
901 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
903 self.0.request.force = v.into();
904 self
905 }
906 }
907
908 impl gax::options::RequestBuilder for UpdateStream {
909 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
910 &mut self.0.options
911 }
912 }
913
914 #[derive(Clone, Debug)]
916 pub struct DeleteStream(RequestBuilder<crate::model::DeleteStreamRequest>);
917
918 impl DeleteStream {
919 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
920 Self(RequestBuilder::new(stub))
921 }
922
923 pub fn with_request<V: Into<crate::model::DeleteStreamRequest>>(mut self, v: V) -> Self {
925 self.0.request = v.into();
926 self
927 }
928
929 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
931 self.0.options = v.into();
932 self
933 }
934
935 pub async fn send(self) -> Result<longrunning::model::Operation> {
942 (*self.0.stub)
943 .delete_stream(self.0.request, self.0.options)
944 .await
945 }
946
947 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
949 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
950 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
951 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
952
953 let stub = self.0.stub.clone();
954 let mut options = self.0.options.clone();
955 options.set_retry_policy(gax::retry_policy::NeverRetry);
956 let query = move |name| {
957 let stub = stub.clone();
958 let options = options.clone();
959 async {
960 let op = GetOperation::new(stub)
961 .set_name(name)
962 .with_options(options)
963 .send()
964 .await?;
965 Ok(Operation::new(op))
966 }
967 };
968
969 let start = move || async {
970 let op = self.send().await?;
971 Ok(Operation::new(op))
972 };
973
974 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
975 }
976
977 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
979 self.0.request.name = v.into();
980 self
981 }
982
983 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
985 self.0.request.request_id = v.into();
986 self
987 }
988 }
989
990 impl gax::options::RequestBuilder for DeleteStream {
991 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
992 &mut self.0.options
993 }
994 }
995
996 #[derive(Clone, Debug)]
998 pub struct RunStream(RequestBuilder<crate::model::RunStreamRequest>);
999
1000 impl RunStream {
1001 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1002 Self(RequestBuilder::new(stub))
1003 }
1004
1005 pub fn with_request<V: Into<crate::model::RunStreamRequest>>(mut self, v: V) -> Self {
1007 self.0.request = v.into();
1008 self
1009 }
1010
1011 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1013 self.0.options = v.into();
1014 self
1015 }
1016
1017 pub async fn send(self) -> Result<longrunning::model::Operation> {
1024 (*self.0.stub)
1025 .run_stream(self.0.request, self.0.options)
1026 .await
1027 }
1028
1029 pub fn poller(
1031 self,
1032 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1033 type Operation = lro::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1034 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1035 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1036
1037 let stub = self.0.stub.clone();
1038 let mut options = self.0.options.clone();
1039 options.set_retry_policy(gax::retry_policy::NeverRetry);
1040 let query = move |name| {
1041 let stub = stub.clone();
1042 let options = options.clone();
1043 async {
1044 let op = GetOperation::new(stub)
1045 .set_name(name)
1046 .with_options(options)
1047 .send()
1048 .await?;
1049 Ok(Operation::new(op))
1050 }
1051 };
1052
1053 let start = move || async {
1054 let op = self.send().await?;
1055 Ok(Operation::new(op))
1056 };
1057
1058 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1059 }
1060
1061 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1063 self.0.request.name = v.into();
1064 self
1065 }
1066
1067 pub fn set_cdc_strategy<T: Into<std::option::Option<crate::model::CdcStrategy>>>(
1069 mut self,
1070 v: T,
1071 ) -> Self {
1072 self.0.request.cdc_strategy = v.into();
1073 self
1074 }
1075
1076 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1078 self.0.request.force = v.into();
1079 self
1080 }
1081 }
1082
1083 impl gax::options::RequestBuilder for RunStream {
1084 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1085 &mut self.0.options
1086 }
1087 }
1088
1089 #[derive(Clone, Debug)]
1091 pub struct GetStreamObject(RequestBuilder<crate::model::GetStreamObjectRequest>);
1092
1093 impl GetStreamObject {
1094 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1095 Self(RequestBuilder::new(stub))
1096 }
1097
1098 pub fn with_request<V: Into<crate::model::GetStreamObjectRequest>>(mut self, v: V) -> Self {
1100 self.0.request = v.into();
1101 self
1102 }
1103
1104 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1106 self.0.options = v.into();
1107 self
1108 }
1109
1110 pub async fn send(self) -> Result<crate::model::StreamObject> {
1112 (*self.0.stub)
1113 .get_stream_object(self.0.request, self.0.options)
1114 .await
1115 }
1116
1117 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1119 self.0.request.name = v.into();
1120 self
1121 }
1122 }
1123
1124 impl gax::options::RequestBuilder for GetStreamObject {
1125 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1126 &mut self.0.options
1127 }
1128 }
1129
1130 #[derive(Clone, Debug)]
1132 pub struct LookupStreamObject(RequestBuilder<crate::model::LookupStreamObjectRequest>);
1133
1134 impl LookupStreamObject {
1135 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1136 Self(RequestBuilder::new(stub))
1137 }
1138
1139 pub fn with_request<V: Into<crate::model::LookupStreamObjectRequest>>(
1141 mut self,
1142 v: V,
1143 ) -> Self {
1144 self.0.request = v.into();
1145 self
1146 }
1147
1148 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1150 self.0.options = v.into();
1151 self
1152 }
1153
1154 pub async fn send(self) -> Result<crate::model::StreamObject> {
1156 (*self.0.stub)
1157 .lookup_stream_object(self.0.request, self.0.options)
1158 .await
1159 }
1160
1161 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1163 self.0.request.parent = v.into();
1164 self
1165 }
1166
1167 pub fn set_source_object_identifier<
1169 T: Into<std::option::Option<crate::model::SourceObjectIdentifier>>,
1170 >(
1171 mut self,
1172 v: T,
1173 ) -> Self {
1174 self.0.request.source_object_identifier = v.into();
1175 self
1176 }
1177 }
1178
1179 impl gax::options::RequestBuilder for LookupStreamObject {
1180 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1181 &mut self.0.options
1182 }
1183 }
1184
1185 #[derive(Clone, Debug)]
1187 pub struct ListStreamObjects(RequestBuilder<crate::model::ListStreamObjectsRequest>);
1188
1189 impl ListStreamObjects {
1190 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1191 Self(RequestBuilder::new(stub))
1192 }
1193
1194 pub fn with_request<V: Into<crate::model::ListStreamObjectsRequest>>(
1196 mut self,
1197 v: V,
1198 ) -> Self {
1199 self.0.request = v.into();
1200 self
1201 }
1202
1203 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1205 self.0.options = v.into();
1206 self
1207 }
1208
1209 pub async fn send(self) -> Result<crate::model::ListStreamObjectsResponse> {
1211 (*self.0.stub)
1212 .list_stream_objects(self.0.request, self.0.options)
1213 .await
1214 }
1215
1216 #[cfg(feature = "unstable-stream")]
1218 pub async fn stream(
1219 self,
1220 ) -> gax::paginator::Paginator<crate::model::ListStreamObjectsResponse, gax::error::Error>
1221 {
1222 let token = gax::paginator::extract_token(&self.0.request.page_token);
1223 let execute = move |token: String| {
1224 let mut builder = self.clone();
1225 builder.0.request = builder.0.request.set_page_token(token);
1226 builder.send()
1227 };
1228 gax::paginator::Paginator::new(token, execute)
1229 }
1230
1231 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1233 self.0.request.parent = v.into();
1234 self
1235 }
1236
1237 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1239 self.0.request.page_size = v.into();
1240 self
1241 }
1242
1243 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1245 self.0.request.page_token = v.into();
1246 self
1247 }
1248 }
1249
1250 impl gax::options::RequestBuilder for ListStreamObjects {
1251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1252 &mut self.0.options
1253 }
1254 }
1255
1256 #[derive(Clone, Debug)]
1258 pub struct StartBackfillJob(RequestBuilder<crate::model::StartBackfillJobRequest>);
1259
1260 impl StartBackfillJob {
1261 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1262 Self(RequestBuilder::new(stub))
1263 }
1264
1265 pub fn with_request<V: Into<crate::model::StartBackfillJobRequest>>(
1267 mut self,
1268 v: V,
1269 ) -> Self {
1270 self.0.request = v.into();
1271 self
1272 }
1273
1274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1276 self.0.options = v.into();
1277 self
1278 }
1279
1280 pub async fn send(self) -> Result<crate::model::StartBackfillJobResponse> {
1282 (*self.0.stub)
1283 .start_backfill_job(self.0.request, self.0.options)
1284 .await
1285 }
1286
1287 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
1289 self.0.request.object = v.into();
1290 self
1291 }
1292 }
1293
1294 impl gax::options::RequestBuilder for StartBackfillJob {
1295 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1296 &mut self.0.options
1297 }
1298 }
1299
1300 #[derive(Clone, Debug)]
1302 pub struct StopBackfillJob(RequestBuilder<crate::model::StopBackfillJobRequest>);
1303
1304 impl StopBackfillJob {
1305 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1306 Self(RequestBuilder::new(stub))
1307 }
1308
1309 pub fn with_request<V: Into<crate::model::StopBackfillJobRequest>>(mut self, v: V) -> Self {
1311 self.0.request = v.into();
1312 self
1313 }
1314
1315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1317 self.0.options = v.into();
1318 self
1319 }
1320
1321 pub async fn send(self) -> Result<crate::model::StopBackfillJobResponse> {
1323 (*self.0.stub)
1324 .stop_backfill_job(self.0.request, self.0.options)
1325 .await
1326 }
1327
1328 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
1330 self.0.request.object = v.into();
1331 self
1332 }
1333 }
1334
1335 impl gax::options::RequestBuilder for StopBackfillJob {
1336 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1337 &mut self.0.options
1338 }
1339 }
1340
1341 #[derive(Clone, Debug)]
1343 pub struct FetchStaticIps(RequestBuilder<crate::model::FetchStaticIpsRequest>);
1344
1345 impl FetchStaticIps {
1346 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1347 Self(RequestBuilder::new(stub))
1348 }
1349
1350 pub fn with_request<V: Into<crate::model::FetchStaticIpsRequest>>(mut self, v: V) -> Self {
1352 self.0.request = v.into();
1353 self
1354 }
1355
1356 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1358 self.0.options = v.into();
1359 self
1360 }
1361
1362 pub async fn send(self) -> Result<crate::model::FetchStaticIpsResponse> {
1364 (*self.0.stub)
1365 .fetch_static_ips(self.0.request, self.0.options)
1366 .await
1367 }
1368
1369 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1371 self.0.request.name = v.into();
1372 self
1373 }
1374
1375 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1377 self.0.request.page_size = v.into();
1378 self
1379 }
1380
1381 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1383 self.0.request.page_token = v.into();
1384 self
1385 }
1386 }
1387
1388 impl gax::options::RequestBuilder for FetchStaticIps {
1389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1390 &mut self.0.options
1391 }
1392 }
1393
1394 #[derive(Clone, Debug)]
1396 pub struct CreatePrivateConnection(
1397 RequestBuilder<crate::model::CreatePrivateConnectionRequest>,
1398 );
1399
1400 impl CreatePrivateConnection {
1401 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1402 Self(RequestBuilder::new(stub))
1403 }
1404
1405 pub fn with_request<V: Into<crate::model::CreatePrivateConnectionRequest>>(
1407 mut self,
1408 v: V,
1409 ) -> Self {
1410 self.0.request = v.into();
1411 self
1412 }
1413
1414 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1416 self.0.options = v.into();
1417 self
1418 }
1419
1420 pub async fn send(self) -> Result<longrunning::model::Operation> {
1427 (*self.0.stub)
1428 .create_private_connection(self.0.request, self.0.options)
1429 .await
1430 }
1431
1432 pub fn poller(
1434 self,
1435 ) -> impl lro::Poller<crate::model::PrivateConnection, crate::model::OperationMetadata>
1436 {
1437 type Operation =
1438 lro::Operation<crate::model::PrivateConnection, crate::model::OperationMetadata>;
1439 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1440 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1441
1442 let stub = self.0.stub.clone();
1443 let mut options = self.0.options.clone();
1444 options.set_retry_policy(gax::retry_policy::NeverRetry);
1445 let query = move |name| {
1446 let stub = stub.clone();
1447 let options = options.clone();
1448 async {
1449 let op = GetOperation::new(stub)
1450 .set_name(name)
1451 .with_options(options)
1452 .send()
1453 .await?;
1454 Ok(Operation::new(op))
1455 }
1456 };
1457
1458 let start = move || async {
1459 let op = self.send().await?;
1460 Ok(Operation::new(op))
1461 };
1462
1463 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1464 }
1465
1466 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1468 self.0.request.parent = v.into();
1469 self
1470 }
1471
1472 pub fn set_private_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1474 self.0.request.private_connection_id = v.into();
1475 self
1476 }
1477
1478 pub fn set_private_connection<
1480 T: Into<std::option::Option<crate::model::PrivateConnection>>,
1481 >(
1482 mut self,
1483 v: T,
1484 ) -> Self {
1485 self.0.request.private_connection = v.into();
1486 self
1487 }
1488
1489 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1491 self.0.request.request_id = v.into();
1492 self
1493 }
1494
1495 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1497 self.0.request.force = v.into();
1498 self
1499 }
1500 }
1501
1502 impl gax::options::RequestBuilder for CreatePrivateConnection {
1503 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1504 &mut self.0.options
1505 }
1506 }
1507
1508 #[derive(Clone, Debug)]
1510 pub struct GetPrivateConnection(RequestBuilder<crate::model::GetPrivateConnectionRequest>);
1511
1512 impl GetPrivateConnection {
1513 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1514 Self(RequestBuilder::new(stub))
1515 }
1516
1517 pub fn with_request<V: Into<crate::model::GetPrivateConnectionRequest>>(
1519 mut self,
1520 v: V,
1521 ) -> Self {
1522 self.0.request = v.into();
1523 self
1524 }
1525
1526 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1528 self.0.options = v.into();
1529 self
1530 }
1531
1532 pub async fn send(self) -> Result<crate::model::PrivateConnection> {
1534 (*self.0.stub)
1535 .get_private_connection(self.0.request, self.0.options)
1536 .await
1537 }
1538
1539 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1541 self.0.request.name = v.into();
1542 self
1543 }
1544 }
1545
1546 impl gax::options::RequestBuilder for GetPrivateConnection {
1547 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1548 &mut self.0.options
1549 }
1550 }
1551
1552 #[derive(Clone, Debug)]
1554 pub struct ListPrivateConnections(RequestBuilder<crate::model::ListPrivateConnectionsRequest>);
1555
1556 impl ListPrivateConnections {
1557 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1558 Self(RequestBuilder::new(stub))
1559 }
1560
1561 pub fn with_request<V: Into<crate::model::ListPrivateConnectionsRequest>>(
1563 mut self,
1564 v: V,
1565 ) -> Self {
1566 self.0.request = v.into();
1567 self
1568 }
1569
1570 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1572 self.0.options = v.into();
1573 self
1574 }
1575
1576 pub async fn send(self) -> Result<crate::model::ListPrivateConnectionsResponse> {
1578 (*self.0.stub)
1579 .list_private_connections(self.0.request, self.0.options)
1580 .await
1581 }
1582
1583 #[cfg(feature = "unstable-stream")]
1585 pub async fn stream(
1586 self,
1587 ) -> gax::paginator::Paginator<
1588 crate::model::ListPrivateConnectionsResponse,
1589 gax::error::Error,
1590 > {
1591 let token = gax::paginator::extract_token(&self.0.request.page_token);
1592 let execute = move |token: String| {
1593 let mut builder = self.clone();
1594 builder.0.request = builder.0.request.set_page_token(token);
1595 builder.send()
1596 };
1597 gax::paginator::Paginator::new(token, execute)
1598 }
1599
1600 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1602 self.0.request.parent = v.into();
1603 self
1604 }
1605
1606 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1608 self.0.request.page_size = v.into();
1609 self
1610 }
1611
1612 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1614 self.0.request.page_token = v.into();
1615 self
1616 }
1617
1618 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1620 self.0.request.filter = v.into();
1621 self
1622 }
1623
1624 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1626 self.0.request.order_by = v.into();
1627 self
1628 }
1629 }
1630
1631 impl gax::options::RequestBuilder for ListPrivateConnections {
1632 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1633 &mut self.0.options
1634 }
1635 }
1636
1637 #[derive(Clone, Debug)]
1639 pub struct DeletePrivateConnection(
1640 RequestBuilder<crate::model::DeletePrivateConnectionRequest>,
1641 );
1642
1643 impl DeletePrivateConnection {
1644 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1645 Self(RequestBuilder::new(stub))
1646 }
1647
1648 pub fn with_request<V: Into<crate::model::DeletePrivateConnectionRequest>>(
1650 mut self,
1651 v: V,
1652 ) -> Self {
1653 self.0.request = v.into();
1654 self
1655 }
1656
1657 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1659 self.0.options = v.into();
1660 self
1661 }
1662
1663 pub async fn send(self) -> Result<longrunning::model::Operation> {
1670 (*self.0.stub)
1671 .delete_private_connection(self.0.request, self.0.options)
1672 .await
1673 }
1674
1675 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
1677 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
1678 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1679 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1680
1681 let stub = self.0.stub.clone();
1682 let mut options = self.0.options.clone();
1683 options.set_retry_policy(gax::retry_policy::NeverRetry);
1684 let query = move |name| {
1685 let stub = stub.clone();
1686 let options = options.clone();
1687 async {
1688 let op = GetOperation::new(stub)
1689 .set_name(name)
1690 .with_options(options)
1691 .send()
1692 .await?;
1693 Ok(Operation::new(op))
1694 }
1695 };
1696
1697 let start = move || async {
1698 let op = self.send().await?;
1699 Ok(Operation::new(op))
1700 };
1701
1702 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1703 }
1704
1705 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1707 self.0.request.name = v.into();
1708 self
1709 }
1710
1711 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1713 self.0.request.request_id = v.into();
1714 self
1715 }
1716
1717 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1719 self.0.request.force = v.into();
1720 self
1721 }
1722 }
1723
1724 impl gax::options::RequestBuilder for DeletePrivateConnection {
1725 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1726 &mut self.0.options
1727 }
1728 }
1729
1730 #[derive(Clone, Debug)]
1732 pub struct CreateRoute(RequestBuilder<crate::model::CreateRouteRequest>);
1733
1734 impl CreateRoute {
1735 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1736 Self(RequestBuilder::new(stub))
1737 }
1738
1739 pub fn with_request<V: Into<crate::model::CreateRouteRequest>>(mut self, v: V) -> Self {
1741 self.0.request = v.into();
1742 self
1743 }
1744
1745 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1747 self.0.options = v.into();
1748 self
1749 }
1750
1751 pub async fn send(self) -> Result<longrunning::model::Operation> {
1758 (*self.0.stub)
1759 .create_route(self.0.request, self.0.options)
1760 .await
1761 }
1762
1763 pub fn poller(
1765 self,
1766 ) -> impl lro::Poller<crate::model::Route, crate::model::OperationMetadata> {
1767 type Operation = lro::Operation<crate::model::Route, crate::model::OperationMetadata>;
1768 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1769 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1770
1771 let stub = self.0.stub.clone();
1772 let mut options = self.0.options.clone();
1773 options.set_retry_policy(gax::retry_policy::NeverRetry);
1774 let query = move |name| {
1775 let stub = stub.clone();
1776 let options = options.clone();
1777 async {
1778 let op = GetOperation::new(stub)
1779 .set_name(name)
1780 .with_options(options)
1781 .send()
1782 .await?;
1783 Ok(Operation::new(op))
1784 }
1785 };
1786
1787 let start = move || async {
1788 let op = self.send().await?;
1789 Ok(Operation::new(op))
1790 };
1791
1792 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
1793 }
1794
1795 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1797 self.0.request.parent = v.into();
1798 self
1799 }
1800
1801 pub fn set_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1803 self.0.request.route_id = v.into();
1804 self
1805 }
1806
1807 pub fn set_route<T: Into<std::option::Option<crate::model::Route>>>(
1809 mut self,
1810 v: T,
1811 ) -> Self {
1812 self.0.request.route = v.into();
1813 self
1814 }
1815
1816 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1818 self.0.request.request_id = v.into();
1819 self
1820 }
1821 }
1822
1823 impl gax::options::RequestBuilder for CreateRoute {
1824 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1825 &mut self.0.options
1826 }
1827 }
1828
1829 #[derive(Clone, Debug)]
1831 pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
1832
1833 impl GetRoute {
1834 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1835 Self(RequestBuilder::new(stub))
1836 }
1837
1838 pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
1840 self.0.request = v.into();
1841 self
1842 }
1843
1844 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1846 self.0.options = v.into();
1847 self
1848 }
1849
1850 pub async fn send(self) -> Result<crate::model::Route> {
1852 (*self.0.stub)
1853 .get_route(self.0.request, self.0.options)
1854 .await
1855 }
1856
1857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1859 self.0.request.name = v.into();
1860 self
1861 }
1862 }
1863
1864 impl gax::options::RequestBuilder for GetRoute {
1865 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1866 &mut self.0.options
1867 }
1868 }
1869
1870 #[derive(Clone, Debug)]
1872 pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
1873
1874 impl ListRoutes {
1875 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1876 Self(RequestBuilder::new(stub))
1877 }
1878
1879 pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
1881 self.0.request = v.into();
1882 self
1883 }
1884
1885 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1887 self.0.options = v.into();
1888 self
1889 }
1890
1891 pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
1893 (*self.0.stub)
1894 .list_routes(self.0.request, self.0.options)
1895 .await
1896 }
1897
1898 #[cfg(feature = "unstable-stream")]
1900 pub async fn stream(
1901 self,
1902 ) -> gax::paginator::Paginator<crate::model::ListRoutesResponse, gax::error::Error>
1903 {
1904 let token = gax::paginator::extract_token(&self.0.request.page_token);
1905 let execute = move |token: String| {
1906 let mut builder = self.clone();
1907 builder.0.request = builder.0.request.set_page_token(token);
1908 builder.send()
1909 };
1910 gax::paginator::Paginator::new(token, execute)
1911 }
1912
1913 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1915 self.0.request.parent = v.into();
1916 self
1917 }
1918
1919 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1921 self.0.request.page_size = v.into();
1922 self
1923 }
1924
1925 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1927 self.0.request.page_token = v.into();
1928 self
1929 }
1930
1931 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1933 self.0.request.filter = v.into();
1934 self
1935 }
1936
1937 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1939 self.0.request.order_by = v.into();
1940 self
1941 }
1942 }
1943
1944 impl gax::options::RequestBuilder for ListRoutes {
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 DeleteRoute(RequestBuilder<crate::model::DeleteRouteRequest>);
1953
1954 impl DeleteRoute {
1955 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
1956 Self(RequestBuilder::new(stub))
1957 }
1958
1959 pub fn with_request<V: Into<crate::model::DeleteRouteRequest>>(mut self, v: V) -> Self {
1961 self.0.request = v.into();
1962 self
1963 }
1964
1965 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1967 self.0.options = v.into();
1968 self
1969 }
1970
1971 pub async fn send(self) -> Result<longrunning::model::Operation> {
1978 (*self.0.stub)
1979 .delete_route(self.0.request, self.0.options)
1980 .await
1981 }
1982
1983 pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::OperationMetadata> {
1985 type Operation = lro::Operation<wkt::Empty, crate::model::OperationMetadata>;
1986 let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
1987 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1988
1989 let stub = self.0.stub.clone();
1990 let mut options = self.0.options.clone();
1991 options.set_retry_policy(gax::retry_policy::NeverRetry);
1992 let query = move |name| {
1993 let stub = stub.clone();
1994 let options = options.clone();
1995 async {
1996 let op = GetOperation::new(stub)
1997 .set_name(name)
1998 .with_options(options)
1999 .send()
2000 .await?;
2001 Ok(Operation::new(op))
2002 }
2003 };
2004
2005 let start = move || async {
2006 let op = self.send().await?;
2007 Ok(Operation::new(op))
2008 };
2009
2010 lro::new_poller(polling_policy, polling_backoff_policy, start, query)
2011 }
2012
2013 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2015 self.0.request.name = v.into();
2016 self
2017 }
2018
2019 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2021 self.0.request.request_id = v.into();
2022 self
2023 }
2024 }
2025
2026 impl gax::options::RequestBuilder for DeleteRoute {
2027 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2028 &mut self.0.options
2029 }
2030 }
2031
2032 #[derive(Clone, Debug)]
2034 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2035
2036 impl ListLocations {
2037 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2038 Self(RequestBuilder::new(stub))
2039 }
2040
2041 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2043 mut self,
2044 v: V,
2045 ) -> Self {
2046 self.0.request = v.into();
2047 self
2048 }
2049
2050 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2052 self.0.options = v.into();
2053 self
2054 }
2055
2056 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2058 (*self.0.stub)
2059 .list_locations(self.0.request, self.0.options)
2060 .await
2061 }
2062
2063 #[cfg(feature = "unstable-stream")]
2065 pub async fn stream(
2066 self,
2067 ) -> gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2068 {
2069 let token = gax::paginator::extract_token(&self.0.request.page_token);
2070 let execute = move |token: String| {
2071 let mut builder = self.clone();
2072 builder.0.request = builder.0.request.set_page_token(token);
2073 builder.send()
2074 };
2075 gax::paginator::Paginator::new(token, execute)
2076 }
2077
2078 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2080 self.0.request.name = v.into();
2081 self
2082 }
2083
2084 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2086 self.0.request.filter = v.into();
2087 self
2088 }
2089
2090 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2092 self.0.request.page_size = v.into();
2093 self
2094 }
2095
2096 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098 self.0.request.page_token = v.into();
2099 self
2100 }
2101 }
2102
2103 impl gax::options::RequestBuilder for ListLocations {
2104 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2105 &mut self.0.options
2106 }
2107 }
2108
2109 #[derive(Clone, Debug)]
2111 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2112
2113 impl GetLocation {
2114 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2115 Self(RequestBuilder::new(stub))
2116 }
2117
2118 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2120 self.0.request = v.into();
2121 self
2122 }
2123
2124 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2126 self.0.options = v.into();
2127 self
2128 }
2129
2130 pub async fn send(self) -> Result<location::model::Location> {
2132 (*self.0.stub)
2133 .get_location(self.0.request, self.0.options)
2134 .await
2135 }
2136
2137 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2139 self.0.request.name = v.into();
2140 self
2141 }
2142 }
2143
2144 impl gax::options::RequestBuilder for GetLocation {
2145 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2146 &mut self.0.options
2147 }
2148 }
2149
2150 #[derive(Clone, Debug)]
2152 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2153
2154 impl ListOperations {
2155 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2156 Self(RequestBuilder::new(stub))
2157 }
2158
2159 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2161 mut self,
2162 v: V,
2163 ) -> Self {
2164 self.0.request = v.into();
2165 self
2166 }
2167
2168 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2170 self.0.options = v.into();
2171 self
2172 }
2173
2174 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2176 (*self.0.stub)
2177 .list_operations(self.0.request, self.0.options)
2178 .await
2179 }
2180
2181 #[cfg(feature = "unstable-stream")]
2183 pub async fn stream(
2184 self,
2185 ) -> gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2186 {
2187 let token = gax::paginator::extract_token(&self.0.request.page_token);
2188 let execute = move |token: String| {
2189 let mut builder = self.clone();
2190 builder.0.request = builder.0.request.set_page_token(token);
2191 builder.send()
2192 };
2193 gax::paginator::Paginator::new(token, execute)
2194 }
2195
2196 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2198 self.0.request.name = v.into();
2199 self
2200 }
2201
2202 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2204 self.0.request.filter = v.into();
2205 self
2206 }
2207
2208 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2210 self.0.request.page_size = v.into();
2211 self
2212 }
2213
2214 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2216 self.0.request.page_token = v.into();
2217 self
2218 }
2219 }
2220
2221 impl gax::options::RequestBuilder for ListOperations {
2222 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2223 &mut self.0.options
2224 }
2225 }
2226
2227 #[derive(Clone, Debug)]
2229 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2230
2231 impl GetOperation {
2232 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2233 Self(RequestBuilder::new(stub))
2234 }
2235
2236 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2238 mut self,
2239 v: V,
2240 ) -> Self {
2241 self.0.request = v.into();
2242 self
2243 }
2244
2245 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2247 self.0.options = v.into();
2248 self
2249 }
2250
2251 pub async fn send(self) -> Result<longrunning::model::Operation> {
2253 (*self.0.stub)
2254 .get_operation(self.0.request, self.0.options)
2255 .await
2256 }
2257
2258 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2260 self.0.request.name = v.into();
2261 self
2262 }
2263 }
2264
2265 impl gax::options::RequestBuilder for GetOperation {
2266 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2267 &mut self.0.options
2268 }
2269 }
2270
2271 #[derive(Clone, Debug)]
2273 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2274
2275 impl DeleteOperation {
2276 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2277 Self(RequestBuilder::new(stub))
2278 }
2279
2280 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2282 mut self,
2283 v: V,
2284 ) -> Self {
2285 self.0.request = v.into();
2286 self
2287 }
2288
2289 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2291 self.0.options = v.into();
2292 self
2293 }
2294
2295 pub async fn send(self) -> Result<wkt::Empty> {
2297 (*self.0.stub)
2298 .delete_operation(self.0.request, self.0.options)
2299 .await
2300 }
2301
2302 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2304 self.0.request.name = v.into();
2305 self
2306 }
2307 }
2308
2309 impl gax::options::RequestBuilder for DeleteOperation {
2310 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2311 &mut self.0.options
2312 }
2313 }
2314
2315 #[derive(Clone, Debug)]
2317 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2318
2319 impl CancelOperation {
2320 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Datastream>) -> Self {
2321 Self(RequestBuilder::new(stub))
2322 }
2323
2324 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2326 mut self,
2327 v: V,
2328 ) -> Self {
2329 self.0.request = v.into();
2330 self
2331 }
2332
2333 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2335 self.0.options = v.into();
2336 self
2337 }
2338
2339 pub async fn send(self) -> Result<wkt::Empty> {
2341 (*self.0.stub)
2342 .cancel_operation(self.0.request, self.0.options)
2343 .await
2344 }
2345
2346 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2348 self.0.request.name = v.into();
2349 self
2350 }
2351 }
2352
2353 impl gax::options::RequestBuilder for CancelOperation {
2354 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2355 &mut self.0.options
2356 }
2357 }
2358}