1pub mod datastream {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::Datastream;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = Datastream;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
96 pub struct ListConnectionProfiles(RequestBuilder<crate::model::ListConnectionProfilesRequest>);
97
98 impl ListConnectionProfiles {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::ListConnectionProfilesRequest>>(
107 mut self,
108 v: V,
109 ) -> Self {
110 self.0.request = v.into();
111 self
112 }
113
114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
116 self.0.options = v.into();
117 self
118 }
119
120 pub async fn send(self) -> Result<crate::model::ListConnectionProfilesResponse> {
122 (*self.0.stub)
123 .list_connection_profiles(self.0.request, self.0.options)
124 .await
125 .map(gax::response::Response::into_body)
126 }
127
128 pub fn by_page(
130 self,
131 ) -> impl gax::paginator::Paginator<
132 crate::model::ListConnectionProfilesResponse,
133 gax::error::Error,
134 > {
135 use std::clone::Clone;
136 let token = self.0.request.page_token.clone();
137 let execute = move |token: String| {
138 let mut builder = self.clone();
139 builder.0.request = builder.0.request.set_page_token(token);
140 builder.send()
141 };
142 gax::paginator::internal::new_paginator(token, execute)
143 }
144
145 pub fn by_item(
147 self,
148 ) -> impl gax::paginator::ItemPaginator<
149 crate::model::ListConnectionProfilesResponse,
150 gax::error::Error,
151 > {
152 use gax::paginator::Paginator;
153 self.by_page().items()
154 }
155
156 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
160 self.0.request.parent = v.into();
161 self
162 }
163
164 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
166 self.0.request.page_size = v.into();
167 self
168 }
169
170 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
172 self.0.request.page_token = v.into();
173 self
174 }
175
176 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
178 self.0.request.filter = v.into();
179 self
180 }
181
182 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
184 self.0.request.order_by = v.into();
185 self
186 }
187 }
188
189 #[doc(hidden)]
190 impl gax::options::internal::RequestBuilder for ListConnectionProfiles {
191 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
192 &mut self.0.options
193 }
194 }
195
196 #[derive(Clone, Debug)]
214 pub struct GetConnectionProfile(RequestBuilder<crate::model::GetConnectionProfileRequest>);
215
216 impl GetConnectionProfile {
217 pub(crate) fn new(
218 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
219 ) -> Self {
220 Self(RequestBuilder::new(stub))
221 }
222
223 pub fn with_request<V: Into<crate::model::GetConnectionProfileRequest>>(
225 mut self,
226 v: V,
227 ) -> Self {
228 self.0.request = v.into();
229 self
230 }
231
232 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
234 self.0.options = v.into();
235 self
236 }
237
238 pub async fn send(self) -> Result<crate::model::ConnectionProfile> {
240 (*self.0.stub)
241 .get_connection_profile(self.0.request, self.0.options)
242 .await
243 .map(gax::response::Response::into_body)
244 }
245
246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
250 self.0.request.name = v.into();
251 self
252 }
253 }
254
255 #[doc(hidden)]
256 impl gax::options::internal::RequestBuilder for GetConnectionProfile {
257 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
258 &mut self.0.options
259 }
260 }
261
262 #[derive(Clone, Debug)]
281 pub struct CreateConnectionProfile(
282 RequestBuilder<crate::model::CreateConnectionProfileRequest>,
283 );
284
285 impl CreateConnectionProfile {
286 pub(crate) fn new(
287 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
288 ) -> Self {
289 Self(RequestBuilder::new(stub))
290 }
291
292 pub fn with_request<V: Into<crate::model::CreateConnectionProfileRequest>>(
294 mut self,
295 v: V,
296 ) -> Self {
297 self.0.request = v.into();
298 self
299 }
300
301 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
303 self.0.options = v.into();
304 self
305 }
306
307 pub async fn send(self) -> Result<longrunning::model::Operation> {
314 (*self.0.stub)
315 .create_connection_profile(self.0.request, self.0.options)
316 .await
317 .map(gax::response::Response::into_body)
318 }
319
320 pub fn poller(
322 self,
323 ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
324 {
325 type Operation = lro::internal::Operation<
326 crate::model::ConnectionProfile,
327 crate::model::OperationMetadata,
328 >;
329 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
330 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
331
332 let stub = self.0.stub.clone();
333 let mut options = self.0.options.clone();
334 options.set_retry_policy(gax::retry_policy::NeverRetry);
335 let query = move |name| {
336 let stub = stub.clone();
337 let options = options.clone();
338 async {
339 let op = GetOperation::new(stub)
340 .set_name(name)
341 .with_options(options)
342 .send()
343 .await?;
344 Ok(Operation::new(op))
345 }
346 };
347
348 let start = move || async {
349 let op = self.send().await?;
350 Ok(Operation::new(op))
351 };
352
353 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
354 }
355
356 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
360 self.0.request.parent = v.into();
361 self
362 }
363
364 pub fn set_connection_profile_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
368 self.0.request.connection_profile_id = v.into();
369 self
370 }
371
372 pub fn set_connection_profile<T>(mut self, v: T) -> Self
376 where
377 T: std::convert::Into<crate::model::ConnectionProfile>,
378 {
379 self.0.request.connection_profile = std::option::Option::Some(v.into());
380 self
381 }
382
383 pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
387 where
388 T: std::convert::Into<crate::model::ConnectionProfile>,
389 {
390 self.0.request.connection_profile = v.map(|x| x.into());
391 self
392 }
393
394 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
396 self.0.request.request_id = v.into();
397 self
398 }
399
400 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
402 self.0.request.validate_only = v.into();
403 self
404 }
405
406 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
408 self.0.request.force = v.into();
409 self
410 }
411 }
412
413 #[doc(hidden)]
414 impl gax::options::internal::RequestBuilder for CreateConnectionProfile {
415 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
416 &mut self.0.options
417 }
418 }
419
420 #[derive(Clone, Debug)]
439 pub struct UpdateConnectionProfile(
440 RequestBuilder<crate::model::UpdateConnectionProfileRequest>,
441 );
442
443 impl UpdateConnectionProfile {
444 pub(crate) fn new(
445 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
446 ) -> Self {
447 Self(RequestBuilder::new(stub))
448 }
449
450 pub fn with_request<V: Into<crate::model::UpdateConnectionProfileRequest>>(
452 mut self,
453 v: V,
454 ) -> Self {
455 self.0.request = v.into();
456 self
457 }
458
459 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
461 self.0.options = v.into();
462 self
463 }
464
465 pub async fn send(self) -> Result<longrunning::model::Operation> {
472 (*self.0.stub)
473 .update_connection_profile(self.0.request, self.0.options)
474 .await
475 .map(gax::response::Response::into_body)
476 }
477
478 pub fn poller(
480 self,
481 ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
482 {
483 type Operation = lro::internal::Operation<
484 crate::model::ConnectionProfile,
485 crate::model::OperationMetadata,
486 >;
487 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
488 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
489
490 let stub = self.0.stub.clone();
491 let mut options = self.0.options.clone();
492 options.set_retry_policy(gax::retry_policy::NeverRetry);
493 let query = move |name| {
494 let stub = stub.clone();
495 let options = options.clone();
496 async {
497 let op = GetOperation::new(stub)
498 .set_name(name)
499 .with_options(options)
500 .send()
501 .await?;
502 Ok(Operation::new(op))
503 }
504 };
505
506 let start = move || async {
507 let op = self.send().await?;
508 Ok(Operation::new(op))
509 };
510
511 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
512 }
513
514 pub fn set_update_mask<T>(mut self, v: T) -> Self
516 where
517 T: std::convert::Into<wkt::FieldMask>,
518 {
519 self.0.request.update_mask = std::option::Option::Some(v.into());
520 self
521 }
522
523 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
525 where
526 T: std::convert::Into<wkt::FieldMask>,
527 {
528 self.0.request.update_mask = v.map(|x| x.into());
529 self
530 }
531
532 pub fn set_connection_profile<T>(mut self, v: T) -> Self
536 where
537 T: std::convert::Into<crate::model::ConnectionProfile>,
538 {
539 self.0.request.connection_profile = std::option::Option::Some(v.into());
540 self
541 }
542
543 pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
547 where
548 T: std::convert::Into<crate::model::ConnectionProfile>,
549 {
550 self.0.request.connection_profile = v.map(|x| x.into());
551 self
552 }
553
554 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
556 self.0.request.request_id = v.into();
557 self
558 }
559
560 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
562 self.0.request.validate_only = v.into();
563 self
564 }
565
566 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
568 self.0.request.force = v.into();
569 self
570 }
571 }
572
573 #[doc(hidden)]
574 impl gax::options::internal::RequestBuilder for UpdateConnectionProfile {
575 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
576 &mut self.0.options
577 }
578 }
579
580 #[derive(Clone, Debug)]
599 pub struct DeleteConnectionProfile(
600 RequestBuilder<crate::model::DeleteConnectionProfileRequest>,
601 );
602
603 impl DeleteConnectionProfile {
604 pub(crate) fn new(
605 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
606 ) -> Self {
607 Self(RequestBuilder::new(stub))
608 }
609
610 pub fn with_request<V: Into<crate::model::DeleteConnectionProfileRequest>>(
612 mut self,
613 v: V,
614 ) -> Self {
615 self.0.request = v.into();
616 self
617 }
618
619 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
621 self.0.options = v.into();
622 self
623 }
624
625 pub async fn send(self) -> Result<longrunning::model::Operation> {
632 (*self.0.stub)
633 .delete_connection_profile(self.0.request, self.0.options)
634 .await
635 .map(gax::response::Response::into_body)
636 }
637
638 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
640 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
641 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
642 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
643
644 let stub = self.0.stub.clone();
645 let mut options = self.0.options.clone();
646 options.set_retry_policy(gax::retry_policy::NeverRetry);
647 let query = move |name| {
648 let stub = stub.clone();
649 let options = options.clone();
650 async {
651 let op = GetOperation::new(stub)
652 .set_name(name)
653 .with_options(options)
654 .send()
655 .await?;
656 Ok(Operation::new(op))
657 }
658 };
659
660 let start = move || async {
661 let op = self.send().await?;
662 Ok(Operation::new(op))
663 };
664
665 lro::internal::new_unit_response_poller(
666 polling_error_policy,
667 polling_backoff_policy,
668 start,
669 query,
670 )
671 }
672
673 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
677 self.0.request.name = v.into();
678 self
679 }
680
681 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
683 self.0.request.request_id = v.into();
684 self
685 }
686 }
687
688 #[doc(hidden)]
689 impl gax::options::internal::RequestBuilder for DeleteConnectionProfile {
690 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
691 &mut self.0.options
692 }
693 }
694
695 #[derive(Clone, Debug)]
713 pub struct DiscoverConnectionProfile(
714 RequestBuilder<crate::model::DiscoverConnectionProfileRequest>,
715 );
716
717 impl DiscoverConnectionProfile {
718 pub(crate) fn new(
719 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
720 ) -> Self {
721 Self(RequestBuilder::new(stub))
722 }
723
724 pub fn with_request<V: Into<crate::model::DiscoverConnectionProfileRequest>>(
726 mut self,
727 v: V,
728 ) -> Self {
729 self.0.request = v.into();
730 self
731 }
732
733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
735 self.0.options = v.into();
736 self
737 }
738
739 pub async fn send(self) -> Result<crate::model::DiscoverConnectionProfileResponse> {
741 (*self.0.stub)
742 .discover_connection_profile(self.0.request, self.0.options)
743 .await
744 .map(gax::response::Response::into_body)
745 }
746
747 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
751 self.0.request.parent = v.into();
752 self
753 }
754
755 pub fn set_target<
760 T: Into<Option<crate::model::discover_connection_profile_request::Target>>,
761 >(
762 mut self,
763 v: T,
764 ) -> Self {
765 self.0.request.target = v.into();
766 self
767 }
768
769 pub fn set_connection_profile<
775 T: std::convert::Into<std::boxed::Box<crate::model::ConnectionProfile>>,
776 >(
777 mut self,
778 v: T,
779 ) -> Self {
780 self.0.request = self.0.request.set_connection_profile(v);
781 self
782 }
783
784 pub fn set_connection_profile_name<T: std::convert::Into<std::string::String>>(
790 mut self,
791 v: T,
792 ) -> Self {
793 self.0.request = self.0.request.set_connection_profile_name(v);
794 self
795 }
796
797 pub fn set_hierarchy<
802 T: Into<Option<crate::model::discover_connection_profile_request::Hierarchy>>,
803 >(
804 mut self,
805 v: T,
806 ) -> Self {
807 self.0.request.hierarchy = v.into();
808 self
809 }
810
811 pub fn set_full_hierarchy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
817 self.0.request = self.0.request.set_full_hierarchy(v);
818 self
819 }
820
821 pub fn set_hierarchy_depth<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
827 self.0.request = self.0.request.set_hierarchy_depth(v);
828 self
829 }
830
831 pub fn set_data_object<
836 T: Into<Option<crate::model::discover_connection_profile_request::DataObject>>,
837 >(
838 mut self,
839 v: T,
840 ) -> Self {
841 self.0.request.data_object = v.into();
842 self
843 }
844
845 pub fn set_oracle_rdbms<
851 T: std::convert::Into<std::boxed::Box<crate::model::OracleRdbms>>,
852 >(
853 mut self,
854 v: T,
855 ) -> Self {
856 self.0.request = self.0.request.set_oracle_rdbms(v);
857 self
858 }
859
860 pub fn set_mysql_rdbms<T: std::convert::Into<std::boxed::Box<crate::model::MysqlRdbms>>>(
866 mut self,
867 v: T,
868 ) -> Self {
869 self.0.request = self.0.request.set_mysql_rdbms(v);
870 self
871 }
872
873 pub fn set_postgresql_rdbms<
879 T: std::convert::Into<std::boxed::Box<crate::model::PostgresqlRdbms>>,
880 >(
881 mut self,
882 v: T,
883 ) -> Self {
884 self.0.request = self.0.request.set_postgresql_rdbms(v);
885 self
886 }
887
888 pub fn set_sql_server_rdbms<
894 T: std::convert::Into<std::boxed::Box<crate::model::SqlServerRdbms>>,
895 >(
896 mut self,
897 v: T,
898 ) -> Self {
899 self.0.request = self.0.request.set_sql_server_rdbms(v);
900 self
901 }
902 }
903
904 #[doc(hidden)]
905 impl gax::options::internal::RequestBuilder for DiscoverConnectionProfile {
906 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
907 &mut self.0.options
908 }
909 }
910
911 #[derive(Clone, Debug)]
933 pub struct ListStreams(RequestBuilder<crate::model::ListStreamsRequest>);
934
935 impl ListStreams {
936 pub(crate) fn new(
937 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
938 ) -> Self {
939 Self(RequestBuilder::new(stub))
940 }
941
942 pub fn with_request<V: Into<crate::model::ListStreamsRequest>>(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<crate::model::ListStreamsResponse> {
956 (*self.0.stub)
957 .list_streams(self.0.request, self.0.options)
958 .await
959 .map(gax::response::Response::into_body)
960 }
961
962 pub fn by_page(
964 self,
965 ) -> impl gax::paginator::Paginator<crate::model::ListStreamsResponse, gax::error::Error>
966 {
967 use std::clone::Clone;
968 let token = self.0.request.page_token.clone();
969 let execute = move |token: String| {
970 let mut builder = self.clone();
971 builder.0.request = builder.0.request.set_page_token(token);
972 builder.send()
973 };
974 gax::paginator::internal::new_paginator(token, execute)
975 }
976
977 pub fn by_item(
979 self,
980 ) -> impl gax::paginator::ItemPaginator<crate::model::ListStreamsResponse, gax::error::Error>
981 {
982 use gax::paginator::Paginator;
983 self.by_page().items()
984 }
985
986 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
990 self.0.request.parent = v.into();
991 self
992 }
993
994 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
996 self.0.request.page_size = v.into();
997 self
998 }
999
1000 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1002 self.0.request.page_token = v.into();
1003 self
1004 }
1005
1006 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1008 self.0.request.filter = v.into();
1009 self
1010 }
1011
1012 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1014 self.0.request.order_by = v.into();
1015 self
1016 }
1017 }
1018
1019 #[doc(hidden)]
1020 impl gax::options::internal::RequestBuilder for ListStreams {
1021 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1022 &mut self.0.options
1023 }
1024 }
1025
1026 #[derive(Clone, Debug)]
1044 pub struct GetStream(RequestBuilder<crate::model::GetStreamRequest>);
1045
1046 impl GetStream {
1047 pub(crate) fn new(
1048 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1049 ) -> Self {
1050 Self(RequestBuilder::new(stub))
1051 }
1052
1053 pub fn with_request<V: Into<crate::model::GetStreamRequest>>(mut self, v: V) -> Self {
1055 self.0.request = v.into();
1056 self
1057 }
1058
1059 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1061 self.0.options = v.into();
1062 self
1063 }
1064
1065 pub async fn send(self) -> Result<crate::model::Stream> {
1067 (*self.0.stub)
1068 .get_stream(self.0.request, self.0.options)
1069 .await
1070 .map(gax::response::Response::into_body)
1071 }
1072
1073 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1077 self.0.request.name = v.into();
1078 self
1079 }
1080 }
1081
1082 #[doc(hidden)]
1083 impl gax::options::internal::RequestBuilder for GetStream {
1084 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1085 &mut self.0.options
1086 }
1087 }
1088
1089 #[derive(Clone, Debug)]
1108 pub struct CreateStream(RequestBuilder<crate::model::CreateStreamRequest>);
1109
1110 impl CreateStream {
1111 pub(crate) fn new(
1112 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1113 ) -> Self {
1114 Self(RequestBuilder::new(stub))
1115 }
1116
1117 pub fn with_request<V: Into<crate::model::CreateStreamRequest>>(mut self, v: V) -> Self {
1119 self.0.request = v.into();
1120 self
1121 }
1122
1123 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1125 self.0.options = v.into();
1126 self
1127 }
1128
1129 pub async fn send(self) -> Result<longrunning::model::Operation> {
1136 (*self.0.stub)
1137 .create_stream(self.0.request, self.0.options)
1138 .await
1139 .map(gax::response::Response::into_body)
1140 }
1141
1142 pub fn poller(
1144 self,
1145 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1146 type Operation =
1147 lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1148 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1149 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1150
1151 let stub = self.0.stub.clone();
1152 let mut options = self.0.options.clone();
1153 options.set_retry_policy(gax::retry_policy::NeverRetry);
1154 let query = move |name| {
1155 let stub = stub.clone();
1156 let options = options.clone();
1157 async {
1158 let op = GetOperation::new(stub)
1159 .set_name(name)
1160 .with_options(options)
1161 .send()
1162 .await?;
1163 Ok(Operation::new(op))
1164 }
1165 };
1166
1167 let start = move || async {
1168 let op = self.send().await?;
1169 Ok(Operation::new(op))
1170 };
1171
1172 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1173 }
1174
1175 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1179 self.0.request.parent = v.into();
1180 self
1181 }
1182
1183 pub fn set_stream_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1187 self.0.request.stream_id = v.into();
1188 self
1189 }
1190
1191 pub fn set_stream<T>(mut self, v: T) -> Self
1195 where
1196 T: std::convert::Into<crate::model::Stream>,
1197 {
1198 self.0.request.stream = std::option::Option::Some(v.into());
1199 self
1200 }
1201
1202 pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1206 where
1207 T: std::convert::Into<crate::model::Stream>,
1208 {
1209 self.0.request.stream = v.map(|x| x.into());
1210 self
1211 }
1212
1213 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1215 self.0.request.request_id = v.into();
1216 self
1217 }
1218
1219 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1221 self.0.request.validate_only = v.into();
1222 self
1223 }
1224
1225 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1227 self.0.request.force = v.into();
1228 self
1229 }
1230 }
1231
1232 #[doc(hidden)]
1233 impl gax::options::internal::RequestBuilder for CreateStream {
1234 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1235 &mut self.0.options
1236 }
1237 }
1238
1239 #[derive(Clone, Debug)]
1258 pub struct UpdateStream(RequestBuilder<crate::model::UpdateStreamRequest>);
1259
1260 impl UpdateStream {
1261 pub(crate) fn new(
1262 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1263 ) -> Self {
1264 Self(RequestBuilder::new(stub))
1265 }
1266
1267 pub fn with_request<V: Into<crate::model::UpdateStreamRequest>>(mut self, v: V) -> Self {
1269 self.0.request = v.into();
1270 self
1271 }
1272
1273 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1275 self.0.options = v.into();
1276 self
1277 }
1278
1279 pub async fn send(self) -> Result<longrunning::model::Operation> {
1286 (*self.0.stub)
1287 .update_stream(self.0.request, self.0.options)
1288 .await
1289 .map(gax::response::Response::into_body)
1290 }
1291
1292 pub fn poller(
1294 self,
1295 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1296 type Operation =
1297 lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1298 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1299 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1300
1301 let stub = self.0.stub.clone();
1302 let mut options = self.0.options.clone();
1303 options.set_retry_policy(gax::retry_policy::NeverRetry);
1304 let query = move |name| {
1305 let stub = stub.clone();
1306 let options = options.clone();
1307 async {
1308 let op = GetOperation::new(stub)
1309 .set_name(name)
1310 .with_options(options)
1311 .send()
1312 .await?;
1313 Ok(Operation::new(op))
1314 }
1315 };
1316
1317 let start = move || async {
1318 let op = self.send().await?;
1319 Ok(Operation::new(op))
1320 };
1321
1322 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1323 }
1324
1325 pub fn set_update_mask<T>(mut self, v: T) -> Self
1327 where
1328 T: std::convert::Into<wkt::FieldMask>,
1329 {
1330 self.0.request.update_mask = std::option::Option::Some(v.into());
1331 self
1332 }
1333
1334 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1336 where
1337 T: std::convert::Into<wkt::FieldMask>,
1338 {
1339 self.0.request.update_mask = v.map(|x| x.into());
1340 self
1341 }
1342
1343 pub fn set_stream<T>(mut self, v: T) -> Self
1347 where
1348 T: std::convert::Into<crate::model::Stream>,
1349 {
1350 self.0.request.stream = std::option::Option::Some(v.into());
1351 self
1352 }
1353
1354 pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1358 where
1359 T: std::convert::Into<crate::model::Stream>,
1360 {
1361 self.0.request.stream = v.map(|x| x.into());
1362 self
1363 }
1364
1365 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1367 self.0.request.request_id = v.into();
1368 self
1369 }
1370
1371 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1373 self.0.request.validate_only = v.into();
1374 self
1375 }
1376
1377 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1379 self.0.request.force = v.into();
1380 self
1381 }
1382 }
1383
1384 #[doc(hidden)]
1385 impl gax::options::internal::RequestBuilder for UpdateStream {
1386 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1387 &mut self.0.options
1388 }
1389 }
1390
1391 #[derive(Clone, Debug)]
1410 pub struct DeleteStream(RequestBuilder<crate::model::DeleteStreamRequest>);
1411
1412 impl DeleteStream {
1413 pub(crate) fn new(
1414 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1415 ) -> Self {
1416 Self(RequestBuilder::new(stub))
1417 }
1418
1419 pub fn with_request<V: Into<crate::model::DeleteStreamRequest>>(mut self, v: V) -> Self {
1421 self.0.request = v.into();
1422 self
1423 }
1424
1425 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1427 self.0.options = v.into();
1428 self
1429 }
1430
1431 pub async fn send(self) -> Result<longrunning::model::Operation> {
1438 (*self.0.stub)
1439 .delete_stream(self.0.request, self.0.options)
1440 .await
1441 .map(gax::response::Response::into_body)
1442 }
1443
1444 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1446 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1447 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1448 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1449
1450 let stub = self.0.stub.clone();
1451 let mut options = self.0.options.clone();
1452 options.set_retry_policy(gax::retry_policy::NeverRetry);
1453 let query = move |name| {
1454 let stub = stub.clone();
1455 let options = options.clone();
1456 async {
1457 let op = GetOperation::new(stub)
1458 .set_name(name)
1459 .with_options(options)
1460 .send()
1461 .await?;
1462 Ok(Operation::new(op))
1463 }
1464 };
1465
1466 let start = move || async {
1467 let op = self.send().await?;
1468 Ok(Operation::new(op))
1469 };
1470
1471 lro::internal::new_unit_response_poller(
1472 polling_error_policy,
1473 polling_backoff_policy,
1474 start,
1475 query,
1476 )
1477 }
1478
1479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1483 self.0.request.name = v.into();
1484 self
1485 }
1486
1487 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1489 self.0.request.request_id = v.into();
1490 self
1491 }
1492 }
1493
1494 #[doc(hidden)]
1495 impl gax::options::internal::RequestBuilder for DeleteStream {
1496 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1497 &mut self.0.options
1498 }
1499 }
1500
1501 #[derive(Clone, Debug)]
1520 pub struct RunStream(RequestBuilder<crate::model::RunStreamRequest>);
1521
1522 impl RunStream {
1523 pub(crate) fn new(
1524 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1525 ) -> Self {
1526 Self(RequestBuilder::new(stub))
1527 }
1528
1529 pub fn with_request<V: Into<crate::model::RunStreamRequest>>(mut self, v: V) -> Self {
1531 self.0.request = v.into();
1532 self
1533 }
1534
1535 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1537 self.0.options = v.into();
1538 self
1539 }
1540
1541 pub async fn send(self) -> Result<longrunning::model::Operation> {
1548 (*self.0.stub)
1549 .run_stream(self.0.request, self.0.options)
1550 .await
1551 .map(gax::response::Response::into_body)
1552 }
1553
1554 pub fn poller(
1556 self,
1557 ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1558 type Operation =
1559 lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1560 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1561 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1562
1563 let stub = self.0.stub.clone();
1564 let mut options = self.0.options.clone();
1565 options.set_retry_policy(gax::retry_policy::NeverRetry);
1566 let query = move |name| {
1567 let stub = stub.clone();
1568 let options = options.clone();
1569 async {
1570 let op = GetOperation::new(stub)
1571 .set_name(name)
1572 .with_options(options)
1573 .send()
1574 .await?;
1575 Ok(Operation::new(op))
1576 }
1577 };
1578
1579 let start = move || async {
1580 let op = self.send().await?;
1581 Ok(Operation::new(op))
1582 };
1583
1584 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1585 }
1586
1587 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1591 self.0.request.name = v.into();
1592 self
1593 }
1594
1595 pub fn set_cdc_strategy<T>(mut self, v: T) -> Self
1597 where
1598 T: std::convert::Into<crate::model::CdcStrategy>,
1599 {
1600 self.0.request.cdc_strategy = std::option::Option::Some(v.into());
1601 self
1602 }
1603
1604 pub fn set_or_clear_cdc_strategy<T>(mut self, v: std::option::Option<T>) -> Self
1606 where
1607 T: std::convert::Into<crate::model::CdcStrategy>,
1608 {
1609 self.0.request.cdc_strategy = v.map(|x| x.into());
1610 self
1611 }
1612
1613 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1615 self.0.request.force = v.into();
1616 self
1617 }
1618 }
1619
1620 #[doc(hidden)]
1621 impl gax::options::internal::RequestBuilder for RunStream {
1622 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1623 &mut self.0.options
1624 }
1625 }
1626
1627 #[derive(Clone, Debug)]
1645 pub struct GetStreamObject(RequestBuilder<crate::model::GetStreamObjectRequest>);
1646
1647 impl GetStreamObject {
1648 pub(crate) fn new(
1649 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1650 ) -> Self {
1651 Self(RequestBuilder::new(stub))
1652 }
1653
1654 pub fn with_request<V: Into<crate::model::GetStreamObjectRequest>>(mut self, v: V) -> Self {
1656 self.0.request = v.into();
1657 self
1658 }
1659
1660 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1662 self.0.options = v.into();
1663 self
1664 }
1665
1666 pub async fn send(self) -> Result<crate::model::StreamObject> {
1668 (*self.0.stub)
1669 .get_stream_object(self.0.request, self.0.options)
1670 .await
1671 .map(gax::response::Response::into_body)
1672 }
1673
1674 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1678 self.0.request.name = v.into();
1679 self
1680 }
1681 }
1682
1683 #[doc(hidden)]
1684 impl gax::options::internal::RequestBuilder for GetStreamObject {
1685 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1686 &mut self.0.options
1687 }
1688 }
1689
1690 #[derive(Clone, Debug)]
1708 pub struct LookupStreamObject(RequestBuilder<crate::model::LookupStreamObjectRequest>);
1709
1710 impl LookupStreamObject {
1711 pub(crate) fn new(
1712 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1713 ) -> Self {
1714 Self(RequestBuilder::new(stub))
1715 }
1716
1717 pub fn with_request<V: Into<crate::model::LookupStreamObjectRequest>>(
1719 mut self,
1720 v: V,
1721 ) -> Self {
1722 self.0.request = v.into();
1723 self
1724 }
1725
1726 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1728 self.0.options = v.into();
1729 self
1730 }
1731
1732 pub async fn send(self) -> Result<crate::model::StreamObject> {
1734 (*self.0.stub)
1735 .lookup_stream_object(self.0.request, self.0.options)
1736 .await
1737 .map(gax::response::Response::into_body)
1738 }
1739
1740 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1744 self.0.request.parent = v.into();
1745 self
1746 }
1747
1748 pub fn set_source_object_identifier<T>(mut self, v: T) -> Self
1752 where
1753 T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1754 {
1755 self.0.request.source_object_identifier = std::option::Option::Some(v.into());
1756 self
1757 }
1758
1759 pub fn set_or_clear_source_object_identifier<T>(mut self, v: std::option::Option<T>) -> Self
1763 where
1764 T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1765 {
1766 self.0.request.source_object_identifier = v.map(|x| x.into());
1767 self
1768 }
1769 }
1770
1771 #[doc(hidden)]
1772 impl gax::options::internal::RequestBuilder for LookupStreamObject {
1773 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1774 &mut self.0.options
1775 }
1776 }
1777
1778 #[derive(Clone, Debug)]
1800 pub struct ListStreamObjects(RequestBuilder<crate::model::ListStreamObjectsRequest>);
1801
1802 impl ListStreamObjects {
1803 pub(crate) fn new(
1804 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1805 ) -> Self {
1806 Self(RequestBuilder::new(stub))
1807 }
1808
1809 pub fn with_request<V: Into<crate::model::ListStreamObjectsRequest>>(
1811 mut self,
1812 v: V,
1813 ) -> Self {
1814 self.0.request = v.into();
1815 self
1816 }
1817
1818 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1820 self.0.options = v.into();
1821 self
1822 }
1823
1824 pub async fn send(self) -> Result<crate::model::ListStreamObjectsResponse> {
1826 (*self.0.stub)
1827 .list_stream_objects(self.0.request, self.0.options)
1828 .await
1829 .map(gax::response::Response::into_body)
1830 }
1831
1832 pub fn by_page(
1834 self,
1835 ) -> impl gax::paginator::Paginator<crate::model::ListStreamObjectsResponse, gax::error::Error>
1836 {
1837 use std::clone::Clone;
1838 let token = self.0.request.page_token.clone();
1839 let execute = move |token: String| {
1840 let mut builder = self.clone();
1841 builder.0.request = builder.0.request.set_page_token(token);
1842 builder.send()
1843 };
1844 gax::paginator::internal::new_paginator(token, execute)
1845 }
1846
1847 pub fn by_item(
1849 self,
1850 ) -> impl gax::paginator::ItemPaginator<crate::model::ListStreamObjectsResponse, gax::error::Error>
1851 {
1852 use gax::paginator::Paginator;
1853 self.by_page().items()
1854 }
1855
1856 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1860 self.0.request.parent = v.into();
1861 self
1862 }
1863
1864 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1866 self.0.request.page_size = v.into();
1867 self
1868 }
1869
1870 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1872 self.0.request.page_token = v.into();
1873 self
1874 }
1875 }
1876
1877 #[doc(hidden)]
1878 impl gax::options::internal::RequestBuilder for ListStreamObjects {
1879 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1880 &mut self.0.options
1881 }
1882 }
1883
1884 #[derive(Clone, Debug)]
1902 pub struct StartBackfillJob(RequestBuilder<crate::model::StartBackfillJobRequest>);
1903
1904 impl StartBackfillJob {
1905 pub(crate) fn new(
1906 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1907 ) -> Self {
1908 Self(RequestBuilder::new(stub))
1909 }
1910
1911 pub fn with_request<V: Into<crate::model::StartBackfillJobRequest>>(
1913 mut self,
1914 v: V,
1915 ) -> Self {
1916 self.0.request = v.into();
1917 self
1918 }
1919
1920 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1922 self.0.options = v.into();
1923 self
1924 }
1925
1926 pub async fn send(self) -> Result<crate::model::StartBackfillJobResponse> {
1928 (*self.0.stub)
1929 .start_backfill_job(self.0.request, self.0.options)
1930 .await
1931 .map(gax::response::Response::into_body)
1932 }
1933
1934 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
1938 self.0.request.object = v.into();
1939 self
1940 }
1941 }
1942
1943 #[doc(hidden)]
1944 impl gax::options::internal::RequestBuilder for StartBackfillJob {
1945 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1946 &mut self.0.options
1947 }
1948 }
1949
1950 #[derive(Clone, Debug)]
1968 pub struct StopBackfillJob(RequestBuilder<crate::model::StopBackfillJobRequest>);
1969
1970 impl StopBackfillJob {
1971 pub(crate) fn new(
1972 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1973 ) -> Self {
1974 Self(RequestBuilder::new(stub))
1975 }
1976
1977 pub fn with_request<V: Into<crate::model::StopBackfillJobRequest>>(mut self, v: V) -> Self {
1979 self.0.request = v.into();
1980 self
1981 }
1982
1983 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1985 self.0.options = v.into();
1986 self
1987 }
1988
1989 pub async fn send(self) -> Result<crate::model::StopBackfillJobResponse> {
1991 (*self.0.stub)
1992 .stop_backfill_job(self.0.request, self.0.options)
1993 .await
1994 .map(gax::response::Response::into_body)
1995 }
1996
1997 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
2001 self.0.request.object = v.into();
2002 self
2003 }
2004 }
2005
2006 #[doc(hidden)]
2007 impl gax::options::internal::RequestBuilder for StopBackfillJob {
2008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2009 &mut self.0.options
2010 }
2011 }
2012
2013 #[derive(Clone, Debug)]
2031 pub struct FetchStaticIps(RequestBuilder<crate::model::FetchStaticIpsRequest>);
2032
2033 impl FetchStaticIps {
2034 pub(crate) fn new(
2035 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2036 ) -> Self {
2037 Self(RequestBuilder::new(stub))
2038 }
2039
2040 pub fn with_request<V: Into<crate::model::FetchStaticIpsRequest>>(mut self, v: V) -> Self {
2042 self.0.request = v.into();
2043 self
2044 }
2045
2046 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2048 self.0.options = v.into();
2049 self
2050 }
2051
2052 pub async fn send(self) -> Result<crate::model::FetchStaticIpsResponse> {
2054 (*self.0.stub)
2055 .fetch_static_ips(self.0.request, self.0.options)
2056 .await
2057 .map(gax::response::Response::into_body)
2058 }
2059
2060 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2064 self.0.request.name = v.into();
2065 self
2066 }
2067
2068 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2070 self.0.request.page_size = v.into();
2071 self
2072 }
2073
2074 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2076 self.0.request.page_token = v.into();
2077 self
2078 }
2079 }
2080
2081 #[doc(hidden)]
2082 impl gax::options::internal::RequestBuilder for FetchStaticIps {
2083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2084 &mut self.0.options
2085 }
2086 }
2087
2088 #[derive(Clone, Debug)]
2107 pub struct CreatePrivateConnection(
2108 RequestBuilder<crate::model::CreatePrivateConnectionRequest>,
2109 );
2110
2111 impl CreatePrivateConnection {
2112 pub(crate) fn new(
2113 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2114 ) -> Self {
2115 Self(RequestBuilder::new(stub))
2116 }
2117
2118 pub fn with_request<V: Into<crate::model::CreatePrivateConnectionRequest>>(
2120 mut self,
2121 v: V,
2122 ) -> Self {
2123 self.0.request = v.into();
2124 self
2125 }
2126
2127 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2129 self.0.options = v.into();
2130 self
2131 }
2132
2133 pub async fn send(self) -> Result<longrunning::model::Operation> {
2140 (*self.0.stub)
2141 .create_private_connection(self.0.request, self.0.options)
2142 .await
2143 .map(gax::response::Response::into_body)
2144 }
2145
2146 pub fn poller(
2148 self,
2149 ) -> impl lro::Poller<crate::model::PrivateConnection, crate::model::OperationMetadata>
2150 {
2151 type Operation = lro::internal::Operation<
2152 crate::model::PrivateConnection,
2153 crate::model::OperationMetadata,
2154 >;
2155 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2156 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2157
2158 let stub = self.0.stub.clone();
2159 let mut options = self.0.options.clone();
2160 options.set_retry_policy(gax::retry_policy::NeverRetry);
2161 let query = move |name| {
2162 let stub = stub.clone();
2163 let options = options.clone();
2164 async {
2165 let op = GetOperation::new(stub)
2166 .set_name(name)
2167 .with_options(options)
2168 .send()
2169 .await?;
2170 Ok(Operation::new(op))
2171 }
2172 };
2173
2174 let start = move || async {
2175 let op = self.send().await?;
2176 Ok(Operation::new(op))
2177 };
2178
2179 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2180 }
2181
2182 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2186 self.0.request.parent = v.into();
2187 self
2188 }
2189
2190 pub fn set_private_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2194 self.0.request.private_connection_id = v.into();
2195 self
2196 }
2197
2198 pub fn set_private_connection<T>(mut self, v: T) -> Self
2202 where
2203 T: std::convert::Into<crate::model::PrivateConnection>,
2204 {
2205 self.0.request.private_connection = std::option::Option::Some(v.into());
2206 self
2207 }
2208
2209 pub fn set_or_clear_private_connection<T>(mut self, v: std::option::Option<T>) -> Self
2213 where
2214 T: std::convert::Into<crate::model::PrivateConnection>,
2215 {
2216 self.0.request.private_connection = v.map(|x| x.into());
2217 self
2218 }
2219
2220 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2222 self.0.request.request_id = v.into();
2223 self
2224 }
2225
2226 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2228 self.0.request.force = v.into();
2229 self
2230 }
2231 }
2232
2233 #[doc(hidden)]
2234 impl gax::options::internal::RequestBuilder for CreatePrivateConnection {
2235 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2236 &mut self.0.options
2237 }
2238 }
2239
2240 #[derive(Clone, Debug)]
2258 pub struct GetPrivateConnection(RequestBuilder<crate::model::GetPrivateConnectionRequest>);
2259
2260 impl GetPrivateConnection {
2261 pub(crate) fn new(
2262 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2263 ) -> Self {
2264 Self(RequestBuilder::new(stub))
2265 }
2266
2267 pub fn with_request<V: Into<crate::model::GetPrivateConnectionRequest>>(
2269 mut self,
2270 v: V,
2271 ) -> Self {
2272 self.0.request = v.into();
2273 self
2274 }
2275
2276 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2278 self.0.options = v.into();
2279 self
2280 }
2281
2282 pub async fn send(self) -> Result<crate::model::PrivateConnection> {
2284 (*self.0.stub)
2285 .get_private_connection(self.0.request, self.0.options)
2286 .await
2287 .map(gax::response::Response::into_body)
2288 }
2289
2290 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2294 self.0.request.name = v.into();
2295 self
2296 }
2297 }
2298
2299 #[doc(hidden)]
2300 impl gax::options::internal::RequestBuilder for GetPrivateConnection {
2301 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2302 &mut self.0.options
2303 }
2304 }
2305
2306 #[derive(Clone, Debug)]
2328 pub struct ListPrivateConnections(RequestBuilder<crate::model::ListPrivateConnectionsRequest>);
2329
2330 impl ListPrivateConnections {
2331 pub(crate) fn new(
2332 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2333 ) -> Self {
2334 Self(RequestBuilder::new(stub))
2335 }
2336
2337 pub fn with_request<V: Into<crate::model::ListPrivateConnectionsRequest>>(
2339 mut self,
2340 v: V,
2341 ) -> Self {
2342 self.0.request = v.into();
2343 self
2344 }
2345
2346 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2348 self.0.options = v.into();
2349 self
2350 }
2351
2352 pub async fn send(self) -> Result<crate::model::ListPrivateConnectionsResponse> {
2354 (*self.0.stub)
2355 .list_private_connections(self.0.request, self.0.options)
2356 .await
2357 .map(gax::response::Response::into_body)
2358 }
2359
2360 pub fn by_page(
2362 self,
2363 ) -> impl gax::paginator::Paginator<
2364 crate::model::ListPrivateConnectionsResponse,
2365 gax::error::Error,
2366 > {
2367 use std::clone::Clone;
2368 let token = self.0.request.page_token.clone();
2369 let execute = move |token: String| {
2370 let mut builder = self.clone();
2371 builder.0.request = builder.0.request.set_page_token(token);
2372 builder.send()
2373 };
2374 gax::paginator::internal::new_paginator(token, execute)
2375 }
2376
2377 pub fn by_item(
2379 self,
2380 ) -> impl gax::paginator::ItemPaginator<
2381 crate::model::ListPrivateConnectionsResponse,
2382 gax::error::Error,
2383 > {
2384 use gax::paginator::Paginator;
2385 self.by_page().items()
2386 }
2387
2388 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2392 self.0.request.parent = v.into();
2393 self
2394 }
2395
2396 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2398 self.0.request.page_size = v.into();
2399 self
2400 }
2401
2402 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2404 self.0.request.page_token = v.into();
2405 self
2406 }
2407
2408 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2410 self.0.request.filter = v.into();
2411 self
2412 }
2413
2414 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2416 self.0.request.order_by = v.into();
2417 self
2418 }
2419 }
2420
2421 #[doc(hidden)]
2422 impl gax::options::internal::RequestBuilder for ListPrivateConnections {
2423 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2424 &mut self.0.options
2425 }
2426 }
2427
2428 #[derive(Clone, Debug)]
2447 pub struct DeletePrivateConnection(
2448 RequestBuilder<crate::model::DeletePrivateConnectionRequest>,
2449 );
2450
2451 impl DeletePrivateConnection {
2452 pub(crate) fn new(
2453 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2454 ) -> Self {
2455 Self(RequestBuilder::new(stub))
2456 }
2457
2458 pub fn with_request<V: Into<crate::model::DeletePrivateConnectionRequest>>(
2460 mut self,
2461 v: V,
2462 ) -> Self {
2463 self.0.request = v.into();
2464 self
2465 }
2466
2467 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2469 self.0.options = v.into();
2470 self
2471 }
2472
2473 pub async fn send(self) -> Result<longrunning::model::Operation> {
2480 (*self.0.stub)
2481 .delete_private_connection(self.0.request, self.0.options)
2482 .await
2483 .map(gax::response::Response::into_body)
2484 }
2485
2486 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2488 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2489 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2490 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2491
2492 let stub = self.0.stub.clone();
2493 let mut options = self.0.options.clone();
2494 options.set_retry_policy(gax::retry_policy::NeverRetry);
2495 let query = move |name| {
2496 let stub = stub.clone();
2497 let options = options.clone();
2498 async {
2499 let op = GetOperation::new(stub)
2500 .set_name(name)
2501 .with_options(options)
2502 .send()
2503 .await?;
2504 Ok(Operation::new(op))
2505 }
2506 };
2507
2508 let start = move || async {
2509 let op = self.send().await?;
2510 Ok(Operation::new(op))
2511 };
2512
2513 lro::internal::new_unit_response_poller(
2514 polling_error_policy,
2515 polling_backoff_policy,
2516 start,
2517 query,
2518 )
2519 }
2520
2521 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2525 self.0.request.name = v.into();
2526 self
2527 }
2528
2529 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2531 self.0.request.request_id = v.into();
2532 self
2533 }
2534
2535 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2537 self.0.request.force = v.into();
2538 self
2539 }
2540 }
2541
2542 #[doc(hidden)]
2543 impl gax::options::internal::RequestBuilder for DeletePrivateConnection {
2544 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2545 &mut self.0.options
2546 }
2547 }
2548
2549 #[derive(Clone, Debug)]
2568 pub struct CreateRoute(RequestBuilder<crate::model::CreateRouteRequest>);
2569
2570 impl CreateRoute {
2571 pub(crate) fn new(
2572 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2573 ) -> Self {
2574 Self(RequestBuilder::new(stub))
2575 }
2576
2577 pub fn with_request<V: Into<crate::model::CreateRouteRequest>>(mut self, v: V) -> Self {
2579 self.0.request = v.into();
2580 self
2581 }
2582
2583 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2585 self.0.options = v.into();
2586 self
2587 }
2588
2589 pub async fn send(self) -> Result<longrunning::model::Operation> {
2596 (*self.0.stub)
2597 .create_route(self.0.request, self.0.options)
2598 .await
2599 .map(gax::response::Response::into_body)
2600 }
2601
2602 pub fn poller(
2604 self,
2605 ) -> impl lro::Poller<crate::model::Route, crate::model::OperationMetadata> {
2606 type Operation =
2607 lro::internal::Operation<crate::model::Route, crate::model::OperationMetadata>;
2608 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2609 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2610
2611 let stub = self.0.stub.clone();
2612 let mut options = self.0.options.clone();
2613 options.set_retry_policy(gax::retry_policy::NeverRetry);
2614 let query = move |name| {
2615 let stub = stub.clone();
2616 let options = options.clone();
2617 async {
2618 let op = GetOperation::new(stub)
2619 .set_name(name)
2620 .with_options(options)
2621 .send()
2622 .await?;
2623 Ok(Operation::new(op))
2624 }
2625 };
2626
2627 let start = move || async {
2628 let op = self.send().await?;
2629 Ok(Operation::new(op))
2630 };
2631
2632 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2633 }
2634
2635 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2639 self.0.request.parent = v.into();
2640 self
2641 }
2642
2643 pub fn set_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2647 self.0.request.route_id = v.into();
2648 self
2649 }
2650
2651 pub fn set_route<T>(mut self, v: T) -> Self
2655 where
2656 T: std::convert::Into<crate::model::Route>,
2657 {
2658 self.0.request.route = std::option::Option::Some(v.into());
2659 self
2660 }
2661
2662 pub fn set_or_clear_route<T>(mut self, v: std::option::Option<T>) -> Self
2666 where
2667 T: std::convert::Into<crate::model::Route>,
2668 {
2669 self.0.request.route = v.map(|x| x.into());
2670 self
2671 }
2672
2673 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2675 self.0.request.request_id = v.into();
2676 self
2677 }
2678 }
2679
2680 #[doc(hidden)]
2681 impl gax::options::internal::RequestBuilder for CreateRoute {
2682 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2683 &mut self.0.options
2684 }
2685 }
2686
2687 #[derive(Clone, Debug)]
2705 pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
2706
2707 impl GetRoute {
2708 pub(crate) fn new(
2709 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2710 ) -> Self {
2711 Self(RequestBuilder::new(stub))
2712 }
2713
2714 pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
2716 self.0.request = v.into();
2717 self
2718 }
2719
2720 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2722 self.0.options = v.into();
2723 self
2724 }
2725
2726 pub async fn send(self) -> Result<crate::model::Route> {
2728 (*self.0.stub)
2729 .get_route(self.0.request, self.0.options)
2730 .await
2731 .map(gax::response::Response::into_body)
2732 }
2733
2734 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2738 self.0.request.name = v.into();
2739 self
2740 }
2741 }
2742
2743 #[doc(hidden)]
2744 impl gax::options::internal::RequestBuilder for GetRoute {
2745 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2746 &mut self.0.options
2747 }
2748 }
2749
2750 #[derive(Clone, Debug)]
2772 pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
2773
2774 impl ListRoutes {
2775 pub(crate) fn new(
2776 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2777 ) -> Self {
2778 Self(RequestBuilder::new(stub))
2779 }
2780
2781 pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
2783 self.0.request = v.into();
2784 self
2785 }
2786
2787 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2789 self.0.options = v.into();
2790 self
2791 }
2792
2793 pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
2795 (*self.0.stub)
2796 .list_routes(self.0.request, self.0.options)
2797 .await
2798 .map(gax::response::Response::into_body)
2799 }
2800
2801 pub fn by_page(
2803 self,
2804 ) -> impl gax::paginator::Paginator<crate::model::ListRoutesResponse, gax::error::Error>
2805 {
2806 use std::clone::Clone;
2807 let token = self.0.request.page_token.clone();
2808 let execute = move |token: String| {
2809 let mut builder = self.clone();
2810 builder.0.request = builder.0.request.set_page_token(token);
2811 builder.send()
2812 };
2813 gax::paginator::internal::new_paginator(token, execute)
2814 }
2815
2816 pub fn by_item(
2818 self,
2819 ) -> impl gax::paginator::ItemPaginator<crate::model::ListRoutesResponse, gax::error::Error>
2820 {
2821 use gax::paginator::Paginator;
2822 self.by_page().items()
2823 }
2824
2825 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2829 self.0.request.parent = v.into();
2830 self
2831 }
2832
2833 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2835 self.0.request.page_size = v.into();
2836 self
2837 }
2838
2839 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2841 self.0.request.page_token = v.into();
2842 self
2843 }
2844
2845 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2847 self.0.request.filter = v.into();
2848 self
2849 }
2850
2851 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2853 self.0.request.order_by = v.into();
2854 self
2855 }
2856 }
2857
2858 #[doc(hidden)]
2859 impl gax::options::internal::RequestBuilder for ListRoutes {
2860 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2861 &mut self.0.options
2862 }
2863 }
2864
2865 #[derive(Clone, Debug)]
2884 pub struct DeleteRoute(RequestBuilder<crate::model::DeleteRouteRequest>);
2885
2886 impl DeleteRoute {
2887 pub(crate) fn new(
2888 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2889 ) -> Self {
2890 Self(RequestBuilder::new(stub))
2891 }
2892
2893 pub fn with_request<V: Into<crate::model::DeleteRouteRequest>>(mut self, v: V) -> Self {
2895 self.0.request = v.into();
2896 self
2897 }
2898
2899 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2901 self.0.options = v.into();
2902 self
2903 }
2904
2905 pub async fn send(self) -> Result<longrunning::model::Operation> {
2912 (*self.0.stub)
2913 .delete_route(self.0.request, self.0.options)
2914 .await
2915 .map(gax::response::Response::into_body)
2916 }
2917
2918 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2920 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2921 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2922 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2923
2924 let stub = self.0.stub.clone();
2925 let mut options = self.0.options.clone();
2926 options.set_retry_policy(gax::retry_policy::NeverRetry);
2927 let query = move |name| {
2928 let stub = stub.clone();
2929 let options = options.clone();
2930 async {
2931 let op = GetOperation::new(stub)
2932 .set_name(name)
2933 .with_options(options)
2934 .send()
2935 .await?;
2936 Ok(Operation::new(op))
2937 }
2938 };
2939
2940 let start = move || async {
2941 let op = self.send().await?;
2942 Ok(Operation::new(op))
2943 };
2944
2945 lro::internal::new_unit_response_poller(
2946 polling_error_policy,
2947 polling_backoff_policy,
2948 start,
2949 query,
2950 )
2951 }
2952
2953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2957 self.0.request.name = v.into();
2958 self
2959 }
2960
2961 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2963 self.0.request.request_id = v.into();
2964 self
2965 }
2966 }
2967
2968 #[doc(hidden)]
2969 impl gax::options::internal::RequestBuilder for DeleteRoute {
2970 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2971 &mut self.0.options
2972 }
2973 }
2974
2975 #[derive(Clone, Debug)]
2997 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2998
2999 impl ListLocations {
3000 pub(crate) fn new(
3001 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3002 ) -> Self {
3003 Self(RequestBuilder::new(stub))
3004 }
3005
3006 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
3008 mut self,
3009 v: V,
3010 ) -> Self {
3011 self.0.request = v.into();
3012 self
3013 }
3014
3015 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3017 self.0.options = v.into();
3018 self
3019 }
3020
3021 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
3023 (*self.0.stub)
3024 .list_locations(self.0.request, self.0.options)
3025 .await
3026 .map(gax::response::Response::into_body)
3027 }
3028
3029 pub fn by_page(
3031 self,
3032 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
3033 {
3034 use std::clone::Clone;
3035 let token = self.0.request.page_token.clone();
3036 let execute = move |token: String| {
3037 let mut builder = self.clone();
3038 builder.0.request = builder.0.request.set_page_token(token);
3039 builder.send()
3040 };
3041 gax::paginator::internal::new_paginator(token, execute)
3042 }
3043
3044 pub fn by_item(
3046 self,
3047 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
3048 {
3049 use gax::paginator::Paginator;
3050 self.by_page().items()
3051 }
3052
3053 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3055 self.0.request.name = v.into();
3056 self
3057 }
3058
3059 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3061 self.0.request.filter = v.into();
3062 self
3063 }
3064
3065 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3067 self.0.request.page_size = v.into();
3068 self
3069 }
3070
3071 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3073 self.0.request.page_token = v.into();
3074 self
3075 }
3076 }
3077
3078 #[doc(hidden)]
3079 impl gax::options::internal::RequestBuilder for ListLocations {
3080 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3081 &mut self.0.options
3082 }
3083 }
3084
3085 #[derive(Clone, Debug)]
3103 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
3104
3105 impl GetLocation {
3106 pub(crate) fn new(
3107 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3108 ) -> Self {
3109 Self(RequestBuilder::new(stub))
3110 }
3111
3112 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
3114 self.0.request = v.into();
3115 self
3116 }
3117
3118 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3120 self.0.options = v.into();
3121 self
3122 }
3123
3124 pub async fn send(self) -> Result<location::model::Location> {
3126 (*self.0.stub)
3127 .get_location(self.0.request, self.0.options)
3128 .await
3129 .map(gax::response::Response::into_body)
3130 }
3131
3132 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3134 self.0.request.name = v.into();
3135 self
3136 }
3137 }
3138
3139 #[doc(hidden)]
3140 impl gax::options::internal::RequestBuilder for GetLocation {
3141 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3142 &mut self.0.options
3143 }
3144 }
3145
3146 #[derive(Clone, Debug)]
3168 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3169
3170 impl ListOperations {
3171 pub(crate) fn new(
3172 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3173 ) -> Self {
3174 Self(RequestBuilder::new(stub))
3175 }
3176
3177 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3179 mut self,
3180 v: V,
3181 ) -> Self {
3182 self.0.request = v.into();
3183 self
3184 }
3185
3186 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3188 self.0.options = v.into();
3189 self
3190 }
3191
3192 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3194 (*self.0.stub)
3195 .list_operations(self.0.request, self.0.options)
3196 .await
3197 .map(gax::response::Response::into_body)
3198 }
3199
3200 pub fn by_page(
3202 self,
3203 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3204 {
3205 use std::clone::Clone;
3206 let token = self.0.request.page_token.clone();
3207 let execute = move |token: String| {
3208 let mut builder = self.clone();
3209 builder.0.request = builder.0.request.set_page_token(token);
3210 builder.send()
3211 };
3212 gax::paginator::internal::new_paginator(token, execute)
3213 }
3214
3215 pub fn by_item(
3217 self,
3218 ) -> impl gax::paginator::ItemPaginator<
3219 longrunning::model::ListOperationsResponse,
3220 gax::error::Error,
3221 > {
3222 use gax::paginator::Paginator;
3223 self.by_page().items()
3224 }
3225
3226 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3228 self.0.request.name = v.into();
3229 self
3230 }
3231
3232 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3234 self.0.request.filter = v.into();
3235 self
3236 }
3237
3238 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3240 self.0.request.page_size = v.into();
3241 self
3242 }
3243
3244 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3246 self.0.request.page_token = v.into();
3247 self
3248 }
3249 }
3250
3251 #[doc(hidden)]
3252 impl gax::options::internal::RequestBuilder for ListOperations {
3253 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3254 &mut self.0.options
3255 }
3256 }
3257
3258 #[derive(Clone, Debug)]
3276 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3277
3278 impl GetOperation {
3279 pub(crate) fn new(
3280 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3281 ) -> Self {
3282 Self(RequestBuilder::new(stub))
3283 }
3284
3285 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3287 mut self,
3288 v: V,
3289 ) -> Self {
3290 self.0.request = v.into();
3291 self
3292 }
3293
3294 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3296 self.0.options = v.into();
3297 self
3298 }
3299
3300 pub async fn send(self) -> Result<longrunning::model::Operation> {
3302 (*self.0.stub)
3303 .get_operation(self.0.request, self.0.options)
3304 .await
3305 .map(gax::response::Response::into_body)
3306 }
3307
3308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3310 self.0.request.name = v.into();
3311 self
3312 }
3313 }
3314
3315 #[doc(hidden)]
3316 impl gax::options::internal::RequestBuilder for GetOperation {
3317 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3318 &mut self.0.options
3319 }
3320 }
3321
3322 #[derive(Clone, Debug)]
3340 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3341
3342 impl DeleteOperation {
3343 pub(crate) fn new(
3344 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3345 ) -> Self {
3346 Self(RequestBuilder::new(stub))
3347 }
3348
3349 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3351 mut self,
3352 v: V,
3353 ) -> Self {
3354 self.0.request = v.into();
3355 self
3356 }
3357
3358 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3360 self.0.options = v.into();
3361 self
3362 }
3363
3364 pub async fn send(self) -> Result<()> {
3366 (*self.0.stub)
3367 .delete_operation(self.0.request, self.0.options)
3368 .await
3369 .map(gax::response::Response::into_body)
3370 }
3371
3372 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3374 self.0.request.name = v.into();
3375 self
3376 }
3377 }
3378
3379 #[doc(hidden)]
3380 impl gax::options::internal::RequestBuilder for DeleteOperation {
3381 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3382 &mut self.0.options
3383 }
3384 }
3385
3386 #[derive(Clone, Debug)]
3404 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3405
3406 impl CancelOperation {
3407 pub(crate) fn new(
3408 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3409 ) -> Self {
3410 Self(RequestBuilder::new(stub))
3411 }
3412
3413 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3415 mut self,
3416 v: V,
3417 ) -> Self {
3418 self.0.request = v.into();
3419 self
3420 }
3421
3422 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3424 self.0.options = v.into();
3425 self
3426 }
3427
3428 pub async fn send(self) -> Result<()> {
3430 (*self.0.stub)
3431 .cancel_operation(self.0.request, self.0.options)
3432 .await
3433 .map(gax::response::Response::into_body)
3434 }
3435
3436 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3438 self.0.request.name = v.into();
3439 self
3440 }
3441 }
3442
3443 #[doc(hidden)]
3444 impl gax::options::internal::RequestBuilder for CancelOperation {
3445 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3446 &mut self.0.options
3447 }
3448 }
3449}