1pub mod topic_admin {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::TopicAdmin;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = TopicAdmin;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<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::TopicAdmin>,
55 request: R,
56 options: crate::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::TopicAdmin>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
91 pub struct CreateTopic(RequestBuilder<crate::model::Topic>);
92
93 impl CreateTopic {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 pub fn with_request<V: Into<crate::model::Topic>>(mut self, v: V) -> Self {
102 self.0.request = v.into();
103 self
104 }
105
106 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 pub async fn send(self) -> Result<crate::model::Topic> {
114 (*self.0.stub)
115 .create_topic(self.0.request, self.0.options)
116 .await
117 .map(crate::Response::into_body)
118 }
119
120 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
124 self.0.request.name = v.into();
125 self
126 }
127
128 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
130 where
131 T: std::iter::IntoIterator<Item = (K, V)>,
132 K: std::convert::Into<std::string::String>,
133 V: std::convert::Into<std::string::String>,
134 {
135 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
136 self
137 }
138
139 pub fn set_message_storage_policy<T>(mut self, v: T) -> Self
141 where
142 T: std::convert::Into<crate::model::MessageStoragePolicy>,
143 {
144 self.0.request.message_storage_policy = std::option::Option::Some(v.into());
145 self
146 }
147
148 pub fn set_or_clear_message_storage_policy<T>(mut self, v: std::option::Option<T>) -> Self
150 where
151 T: std::convert::Into<crate::model::MessageStoragePolicy>,
152 {
153 self.0.request.message_storage_policy = v.map(|x| x.into());
154 self
155 }
156
157 pub fn set_kms_key_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
159 self.0.request.kms_key_name = v.into();
160 self
161 }
162
163 pub fn set_schema_settings<T>(mut self, v: T) -> Self
165 where
166 T: std::convert::Into<crate::model::SchemaSettings>,
167 {
168 self.0.request.schema_settings = std::option::Option::Some(v.into());
169 self
170 }
171
172 pub fn set_or_clear_schema_settings<T>(mut self, v: std::option::Option<T>) -> Self
174 where
175 T: std::convert::Into<crate::model::SchemaSettings>,
176 {
177 self.0.request.schema_settings = v.map(|x| x.into());
178 self
179 }
180
181 pub fn set_satisfies_pzs<T: Into<bool>>(mut self, v: T) -> Self {
183 self.0.request.satisfies_pzs = v.into();
184 self
185 }
186
187 pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
189 where
190 T: std::convert::Into<wkt::Duration>,
191 {
192 self.0.request.message_retention_duration = std::option::Option::Some(v.into());
193 self
194 }
195
196 pub fn set_or_clear_message_retention_duration<T>(
198 mut self,
199 v: std::option::Option<T>,
200 ) -> Self
201 where
202 T: std::convert::Into<wkt::Duration>,
203 {
204 self.0.request.message_retention_duration = v.map(|x| x.into());
205 self
206 }
207
208 pub fn set_state<T: Into<crate::model::topic::State>>(mut self, v: T) -> Self {
210 self.0.request.state = v.into();
211 self
212 }
213
214 pub fn set_ingestion_data_source_settings<T>(mut self, v: T) -> Self
216 where
217 T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
218 {
219 self.0.request.ingestion_data_source_settings = std::option::Option::Some(v.into());
220 self
221 }
222
223 pub fn set_or_clear_ingestion_data_source_settings<T>(
225 mut self,
226 v: std::option::Option<T>,
227 ) -> Self
228 where
229 T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
230 {
231 self.0.request.ingestion_data_source_settings = v.map(|x| x.into());
232 self
233 }
234
235 pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
237 where
238 T: std::iter::IntoIterator<Item = V>,
239 V: std::convert::Into<crate::model::MessageTransform>,
240 {
241 use std::iter::Iterator;
242 self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
243 self
244 }
245
246 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
248 where
249 T: std::iter::IntoIterator<Item = (K, V)>,
250 K: std::convert::Into<std::string::String>,
251 V: std::convert::Into<std::string::String>,
252 {
253 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
254 self
255 }
256 }
257
258 #[doc(hidden)]
259 impl crate::RequestBuilder for CreateTopic {
260 fn request_options(&mut self) -> &mut crate::RequestOptions {
261 &mut self.0.options
262 }
263 }
264
265 #[derive(Clone, Debug)]
282 pub struct UpdateTopic(RequestBuilder<crate::model::UpdateTopicRequest>);
283
284 impl UpdateTopic {
285 pub(crate) fn new(
286 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
287 ) -> Self {
288 Self(RequestBuilder::new(stub))
289 }
290
291 pub fn with_request<V: Into<crate::model::UpdateTopicRequest>>(mut self, v: V) -> Self {
293 self.0.request = v.into();
294 self
295 }
296
297 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299 self.0.options = v.into();
300 self
301 }
302
303 pub async fn send(self) -> Result<crate::model::Topic> {
305 (*self.0.stub)
306 .update_topic(self.0.request, self.0.options)
307 .await
308 .map(crate::Response::into_body)
309 }
310
311 pub fn set_topic<T>(mut self, v: T) -> Self
315 where
316 T: std::convert::Into<crate::model::Topic>,
317 {
318 self.0.request.topic = std::option::Option::Some(v.into());
319 self
320 }
321
322 pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
326 where
327 T: std::convert::Into<crate::model::Topic>,
328 {
329 self.0.request.topic = v.map(|x| x.into());
330 self
331 }
332
333 pub fn set_update_mask<T>(mut self, v: T) -> Self
337 where
338 T: std::convert::Into<wkt::FieldMask>,
339 {
340 self.0.request.update_mask = std::option::Option::Some(v.into());
341 self
342 }
343
344 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
348 where
349 T: std::convert::Into<wkt::FieldMask>,
350 {
351 self.0.request.update_mask = v.map(|x| x.into());
352 self
353 }
354 }
355
356 #[doc(hidden)]
357 impl crate::RequestBuilder for UpdateTopic {
358 fn request_options(&mut self) -> &mut crate::RequestOptions {
359 &mut self.0.options
360 }
361 }
362
363 #[derive(Clone, Debug)]
380 pub struct GetTopic(RequestBuilder<crate::model::GetTopicRequest>);
381
382 impl GetTopic {
383 pub(crate) fn new(
384 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
385 ) -> Self {
386 Self(RequestBuilder::new(stub))
387 }
388
389 pub fn with_request<V: Into<crate::model::GetTopicRequest>>(mut self, v: V) -> Self {
391 self.0.request = v.into();
392 self
393 }
394
395 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
397 self.0.options = v.into();
398 self
399 }
400
401 pub async fn send(self) -> Result<crate::model::Topic> {
403 (*self.0.stub)
404 .get_topic(self.0.request, self.0.options)
405 .await
406 .map(crate::Response::into_body)
407 }
408
409 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
413 self.0.request.topic = v.into();
414 self
415 }
416 }
417
418 #[doc(hidden)]
419 impl crate::RequestBuilder for GetTopic {
420 fn request_options(&mut self) -> &mut crate::RequestOptions {
421 &mut self.0.options
422 }
423 }
424
425 #[derive(Clone, Debug)]
446 pub struct ListTopics(RequestBuilder<crate::model::ListTopicsRequest>);
447
448 impl ListTopics {
449 pub(crate) fn new(
450 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
451 ) -> Self {
452 Self(RequestBuilder::new(stub))
453 }
454
455 pub fn with_request<V: Into<crate::model::ListTopicsRequest>>(mut self, v: V) -> Self {
457 self.0.request = v.into();
458 self
459 }
460
461 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
463 self.0.options = v.into();
464 self
465 }
466
467 pub async fn send(self) -> Result<crate::model::ListTopicsResponse> {
469 (*self.0.stub)
470 .list_topics(self.0.request, self.0.options)
471 .await
472 .map(crate::Response::into_body)
473 }
474
475 pub fn by_page(
477 self,
478 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTopicsResponse, crate::Error>
479 {
480 use std::clone::Clone;
481 let token = self.0.request.page_token.clone();
482 let execute = move |token: String| {
483 let mut builder = self.clone();
484 builder.0.request = builder.0.request.set_page_token(token);
485 builder.send()
486 };
487 google_cloud_gax::paginator::internal::new_paginator(token, execute)
488 }
489
490 pub fn by_item(
492 self,
493 ) -> impl google_cloud_gax::paginator::ItemPaginator<
494 crate::model::ListTopicsResponse,
495 crate::Error,
496 > {
497 use google_cloud_gax::paginator::Paginator;
498 self.by_page().items()
499 }
500
501 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
505 self.0.request.project = v.into();
506 self
507 }
508
509 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
511 self.0.request.page_size = v.into();
512 self
513 }
514
515 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
517 self.0.request.page_token = v.into();
518 self
519 }
520 }
521
522 #[doc(hidden)]
523 impl crate::RequestBuilder for ListTopics {
524 fn request_options(&mut self) -> &mut crate::RequestOptions {
525 &mut self.0.options
526 }
527 }
528
529 #[derive(Clone, Debug)]
550 pub struct ListTopicSubscriptions(RequestBuilder<crate::model::ListTopicSubscriptionsRequest>);
551
552 impl ListTopicSubscriptions {
553 pub(crate) fn new(
554 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
555 ) -> Self {
556 Self(RequestBuilder::new(stub))
557 }
558
559 pub fn with_request<V: Into<crate::model::ListTopicSubscriptionsRequest>>(
561 mut self,
562 v: V,
563 ) -> Self {
564 self.0.request = v.into();
565 self
566 }
567
568 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
570 self.0.options = v.into();
571 self
572 }
573
574 pub async fn send(self) -> Result<crate::model::ListTopicSubscriptionsResponse> {
576 (*self.0.stub)
577 .list_topic_subscriptions(self.0.request, self.0.options)
578 .await
579 .map(crate::Response::into_body)
580 }
581
582 pub fn by_page(
584 self,
585 ) -> impl google_cloud_gax::paginator::Paginator<
586 crate::model::ListTopicSubscriptionsResponse,
587 crate::Error,
588 > {
589 use std::clone::Clone;
590 let token = self.0.request.page_token.clone();
591 let execute = move |token: String| {
592 let mut builder = self.clone();
593 builder.0.request = builder.0.request.set_page_token(token);
594 builder.send()
595 };
596 google_cloud_gax::paginator::internal::new_paginator(token, execute)
597 }
598
599 pub fn by_item(
601 self,
602 ) -> impl google_cloud_gax::paginator::ItemPaginator<
603 crate::model::ListTopicSubscriptionsResponse,
604 crate::Error,
605 > {
606 use google_cloud_gax::paginator::Paginator;
607 self.by_page().items()
608 }
609
610 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
614 self.0.request.topic = v.into();
615 self
616 }
617
618 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
620 self.0.request.page_size = v.into();
621 self
622 }
623
624 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
626 self.0.request.page_token = v.into();
627 self
628 }
629 }
630
631 #[doc(hidden)]
632 impl crate::RequestBuilder for ListTopicSubscriptions {
633 fn request_options(&mut self) -> &mut crate::RequestOptions {
634 &mut self.0.options
635 }
636 }
637
638 #[derive(Clone, Debug)]
655 pub struct ListTopicSnapshots(RequestBuilder<crate::model::ListTopicSnapshotsRequest>);
656
657 impl ListTopicSnapshots {
658 pub(crate) fn new(
659 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
660 ) -> Self {
661 Self(RequestBuilder::new(stub))
662 }
663
664 pub fn with_request<V: Into<crate::model::ListTopicSnapshotsRequest>>(
666 mut self,
667 v: V,
668 ) -> Self {
669 self.0.request = v.into();
670 self
671 }
672
673 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
675 self.0.options = v.into();
676 self
677 }
678
679 pub async fn send(self) -> Result<crate::model::ListTopicSnapshotsResponse> {
681 (*self.0.stub)
682 .list_topic_snapshots(self.0.request, self.0.options)
683 .await
684 .map(crate::Response::into_body)
685 }
686
687 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
691 self.0.request.topic = v.into();
692 self
693 }
694
695 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
697 self.0.request.page_size = v.into();
698 self
699 }
700
701 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
703 self.0.request.page_token = v.into();
704 self
705 }
706 }
707
708 #[doc(hidden)]
709 impl crate::RequestBuilder for ListTopicSnapshots {
710 fn request_options(&mut self) -> &mut crate::RequestOptions {
711 &mut self.0.options
712 }
713 }
714
715 #[derive(Clone, Debug)]
732 pub struct DeleteTopic(RequestBuilder<crate::model::DeleteTopicRequest>);
733
734 impl DeleteTopic {
735 pub(crate) fn new(
736 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
737 ) -> Self {
738 Self(RequestBuilder::new(stub))
739 }
740
741 pub fn with_request<V: Into<crate::model::DeleteTopicRequest>>(mut self, v: V) -> Self {
743 self.0.request = v.into();
744 self
745 }
746
747 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
749 self.0.options = v.into();
750 self
751 }
752
753 pub async fn send(self) -> Result<()> {
755 (*self.0.stub)
756 .delete_topic(self.0.request, self.0.options)
757 .await
758 .map(crate::Response::into_body)
759 }
760
761 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
765 self.0.request.topic = v.into();
766 self
767 }
768 }
769
770 #[doc(hidden)]
771 impl crate::RequestBuilder for DeleteTopic {
772 fn request_options(&mut self) -> &mut crate::RequestOptions {
773 &mut self.0.options
774 }
775 }
776
777 #[derive(Clone, Debug)]
794 pub struct DetachSubscription(RequestBuilder<crate::model::DetachSubscriptionRequest>);
795
796 impl DetachSubscription {
797 pub(crate) fn new(
798 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
799 ) -> Self {
800 Self(RequestBuilder::new(stub))
801 }
802
803 pub fn with_request<V: Into<crate::model::DetachSubscriptionRequest>>(
805 mut self,
806 v: V,
807 ) -> Self {
808 self.0.request = v.into();
809 self
810 }
811
812 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
814 self.0.options = v.into();
815 self
816 }
817
818 pub async fn send(self) -> Result<crate::model::DetachSubscriptionResponse> {
820 (*self.0.stub)
821 .detach_subscription(self.0.request, self.0.options)
822 .await
823 .map(crate::Response::into_body)
824 }
825
826 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
830 self.0.request.subscription = v.into();
831 self
832 }
833 }
834
835 #[doc(hidden)]
836 impl crate::RequestBuilder for DetachSubscription {
837 fn request_options(&mut self) -> &mut crate::RequestOptions {
838 &mut self.0.options
839 }
840 }
841}
842
843pub mod subscription_admin {
845 use crate::Result;
846
847 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
861
862 pub(crate) mod client {
863 use super::super::super::client::SubscriptionAdmin;
864 pub struct Factory;
865 impl crate::ClientFactory for Factory {
866 type Client = SubscriptionAdmin;
867 type Credentials = gaxi::options::Credentials;
868 async fn build(
869 self,
870 config: gaxi::options::ClientConfig,
871 ) -> crate::ClientBuilderResult<Self::Client> {
872 Self::Client::new(config).await
873 }
874 }
875 }
876
877 #[derive(Clone, Debug)]
879 pub(crate) struct RequestBuilder<R: std::default::Default> {
880 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
881 request: R,
882 options: crate::RequestOptions,
883 }
884
885 impl<R> RequestBuilder<R>
886 where
887 R: std::default::Default,
888 {
889 pub(crate) fn new(
890 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
891 ) -> Self {
892 Self {
893 stub,
894 request: R::default(),
895 options: crate::RequestOptions::default(),
896 }
897 }
898 }
899
900 #[derive(Clone, Debug)]
917 pub struct CreateSubscription(RequestBuilder<crate::model::Subscription>);
918
919 impl CreateSubscription {
920 pub(crate) fn new(
921 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
922 ) -> Self {
923 Self(RequestBuilder::new(stub))
924 }
925
926 pub fn with_request<V: Into<crate::model::Subscription>>(mut self, v: V) -> Self {
928 self.0.request = v.into();
929 self
930 }
931
932 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
934 self.0.options = v.into();
935 self
936 }
937
938 pub async fn send(self) -> Result<crate::model::Subscription> {
940 (*self.0.stub)
941 .create_subscription(self.0.request, self.0.options)
942 .await
943 .map(crate::Response::into_body)
944 }
945
946 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
950 self.0.request.name = v.into();
951 self
952 }
953
954 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
958 self.0.request.topic = v.into();
959 self
960 }
961
962 pub fn set_push_config<T>(mut self, v: T) -> Self
964 where
965 T: std::convert::Into<crate::model::PushConfig>,
966 {
967 self.0.request.push_config = std::option::Option::Some(v.into());
968 self
969 }
970
971 pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
973 where
974 T: std::convert::Into<crate::model::PushConfig>,
975 {
976 self.0.request.push_config = v.map(|x| x.into());
977 self
978 }
979
980 pub fn set_bigquery_config<T>(mut self, v: T) -> Self
982 where
983 T: std::convert::Into<crate::model::BigQueryConfig>,
984 {
985 self.0.request.bigquery_config = std::option::Option::Some(v.into());
986 self
987 }
988
989 pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
991 where
992 T: std::convert::Into<crate::model::BigQueryConfig>,
993 {
994 self.0.request.bigquery_config = v.map(|x| x.into());
995 self
996 }
997
998 pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
1000 where
1001 T: std::convert::Into<crate::model::CloudStorageConfig>,
1002 {
1003 self.0.request.cloud_storage_config = std::option::Option::Some(v.into());
1004 self
1005 }
1006
1007 pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
1009 where
1010 T: std::convert::Into<crate::model::CloudStorageConfig>,
1011 {
1012 self.0.request.cloud_storage_config = v.map(|x| x.into());
1013 self
1014 }
1015
1016 pub fn set_bigtable_config<T>(mut self, v: T) -> Self
1018 where
1019 T: std::convert::Into<crate::model::BigtableConfig>,
1020 {
1021 self.0.request.bigtable_config = std::option::Option::Some(v.into());
1022 self
1023 }
1024
1025 pub fn set_or_clear_bigtable_config<T>(mut self, v: std::option::Option<T>) -> Self
1027 where
1028 T: std::convert::Into<crate::model::BigtableConfig>,
1029 {
1030 self.0.request.bigtable_config = v.map(|x| x.into());
1031 self
1032 }
1033
1034 pub fn set_ack_deadline_seconds<T: Into<i32>>(mut self, v: T) -> Self {
1036 self.0.request.ack_deadline_seconds = v.into();
1037 self
1038 }
1039
1040 pub fn set_retain_acked_messages<T: Into<bool>>(mut self, v: T) -> Self {
1042 self.0.request.retain_acked_messages = v.into();
1043 self
1044 }
1045
1046 pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
1048 where
1049 T: std::convert::Into<wkt::Duration>,
1050 {
1051 self.0.request.message_retention_duration = std::option::Option::Some(v.into());
1052 self
1053 }
1054
1055 pub fn set_or_clear_message_retention_duration<T>(
1057 mut self,
1058 v: std::option::Option<T>,
1059 ) -> Self
1060 where
1061 T: std::convert::Into<wkt::Duration>,
1062 {
1063 self.0.request.message_retention_duration = v.map(|x| x.into());
1064 self
1065 }
1066
1067 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1069 where
1070 T: std::iter::IntoIterator<Item = (K, V)>,
1071 K: std::convert::Into<std::string::String>,
1072 V: std::convert::Into<std::string::String>,
1073 {
1074 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1075 self
1076 }
1077
1078 pub fn set_enable_message_ordering<T: Into<bool>>(mut self, v: T) -> Self {
1080 self.0.request.enable_message_ordering = v.into();
1081 self
1082 }
1083
1084 pub fn set_expiration_policy<T>(mut self, v: T) -> Self
1086 where
1087 T: std::convert::Into<crate::model::ExpirationPolicy>,
1088 {
1089 self.0.request.expiration_policy = std::option::Option::Some(v.into());
1090 self
1091 }
1092
1093 pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
1095 where
1096 T: std::convert::Into<crate::model::ExpirationPolicy>,
1097 {
1098 self.0.request.expiration_policy = v.map(|x| x.into());
1099 self
1100 }
1101
1102 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1104 self.0.request.filter = v.into();
1105 self
1106 }
1107
1108 pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
1110 where
1111 T: std::convert::Into<crate::model::DeadLetterPolicy>,
1112 {
1113 self.0.request.dead_letter_policy = std::option::Option::Some(v.into());
1114 self
1115 }
1116
1117 pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
1119 where
1120 T: std::convert::Into<crate::model::DeadLetterPolicy>,
1121 {
1122 self.0.request.dead_letter_policy = v.map(|x| x.into());
1123 self
1124 }
1125
1126 pub fn set_retry_policy<T>(mut self, v: T) -> Self
1128 where
1129 T: std::convert::Into<crate::model::RetryPolicy>,
1130 {
1131 self.0.request.retry_policy = std::option::Option::Some(v.into());
1132 self
1133 }
1134
1135 pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
1137 where
1138 T: std::convert::Into<crate::model::RetryPolicy>,
1139 {
1140 self.0.request.retry_policy = v.map(|x| x.into());
1141 self
1142 }
1143
1144 pub fn set_detached<T: Into<bool>>(mut self, v: T) -> Self {
1146 self.0.request.detached = v.into();
1147 self
1148 }
1149
1150 pub fn set_enable_exactly_once_delivery<T: Into<bool>>(mut self, v: T) -> Self {
1152 self.0.request.enable_exactly_once_delivery = v.into();
1153 self
1154 }
1155
1156 pub fn set_topic_message_retention_duration<T>(mut self, v: T) -> Self
1158 where
1159 T: std::convert::Into<wkt::Duration>,
1160 {
1161 self.0.request.topic_message_retention_duration = std::option::Option::Some(v.into());
1162 self
1163 }
1164
1165 pub fn set_or_clear_topic_message_retention_duration<T>(
1167 mut self,
1168 v: std::option::Option<T>,
1169 ) -> Self
1170 where
1171 T: std::convert::Into<wkt::Duration>,
1172 {
1173 self.0.request.topic_message_retention_duration = v.map(|x| x.into());
1174 self
1175 }
1176
1177 pub fn set_state<T: Into<crate::model::subscription::State>>(mut self, v: T) -> Self {
1179 self.0.request.state = v.into();
1180 self
1181 }
1182
1183 pub fn set_analytics_hub_subscription_info<T>(mut self, v: T) -> Self
1185 where
1186 T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1187 {
1188 self.0.request.analytics_hub_subscription_info = std::option::Option::Some(v.into());
1189 self
1190 }
1191
1192 pub fn set_or_clear_analytics_hub_subscription_info<T>(
1194 mut self,
1195 v: std::option::Option<T>,
1196 ) -> Self
1197 where
1198 T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1199 {
1200 self.0.request.analytics_hub_subscription_info = v.map(|x| x.into());
1201 self
1202 }
1203
1204 pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
1206 where
1207 T: std::iter::IntoIterator<Item = V>,
1208 V: std::convert::Into<crate::model::MessageTransform>,
1209 {
1210 use std::iter::Iterator;
1211 self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
1212 self
1213 }
1214
1215 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1217 where
1218 T: std::iter::IntoIterator<Item = (K, V)>,
1219 K: std::convert::Into<std::string::String>,
1220 V: std::convert::Into<std::string::String>,
1221 {
1222 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1223 self
1224 }
1225 }
1226
1227 #[doc(hidden)]
1228 impl crate::RequestBuilder for CreateSubscription {
1229 fn request_options(&mut self) -> &mut crate::RequestOptions {
1230 &mut self.0.options
1231 }
1232 }
1233
1234 #[derive(Clone, Debug)]
1251 pub struct GetSubscription(RequestBuilder<crate::model::GetSubscriptionRequest>);
1252
1253 impl GetSubscription {
1254 pub(crate) fn new(
1255 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1256 ) -> Self {
1257 Self(RequestBuilder::new(stub))
1258 }
1259
1260 pub fn with_request<V: Into<crate::model::GetSubscriptionRequest>>(mut self, v: V) -> Self {
1262 self.0.request = v.into();
1263 self
1264 }
1265
1266 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1268 self.0.options = v.into();
1269 self
1270 }
1271
1272 pub async fn send(self) -> Result<crate::model::Subscription> {
1274 (*self.0.stub)
1275 .get_subscription(self.0.request, self.0.options)
1276 .await
1277 .map(crate::Response::into_body)
1278 }
1279
1280 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1284 self.0.request.subscription = v.into();
1285 self
1286 }
1287 }
1288
1289 #[doc(hidden)]
1290 impl crate::RequestBuilder for GetSubscription {
1291 fn request_options(&mut self) -> &mut crate::RequestOptions {
1292 &mut self.0.options
1293 }
1294 }
1295
1296 #[derive(Clone, Debug)]
1313 pub struct UpdateSubscription(RequestBuilder<crate::model::UpdateSubscriptionRequest>);
1314
1315 impl UpdateSubscription {
1316 pub(crate) fn new(
1317 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1318 ) -> Self {
1319 Self(RequestBuilder::new(stub))
1320 }
1321
1322 pub fn with_request<V: Into<crate::model::UpdateSubscriptionRequest>>(
1324 mut self,
1325 v: V,
1326 ) -> Self {
1327 self.0.request = v.into();
1328 self
1329 }
1330
1331 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1333 self.0.options = v.into();
1334 self
1335 }
1336
1337 pub async fn send(self) -> Result<crate::model::Subscription> {
1339 (*self.0.stub)
1340 .update_subscription(self.0.request, self.0.options)
1341 .await
1342 .map(crate::Response::into_body)
1343 }
1344
1345 pub fn set_subscription<T>(mut self, v: T) -> Self
1349 where
1350 T: std::convert::Into<crate::model::Subscription>,
1351 {
1352 self.0.request.subscription = std::option::Option::Some(v.into());
1353 self
1354 }
1355
1356 pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
1360 where
1361 T: std::convert::Into<crate::model::Subscription>,
1362 {
1363 self.0.request.subscription = v.map(|x| x.into());
1364 self
1365 }
1366
1367 pub fn set_update_mask<T>(mut self, v: T) -> Self
1371 where
1372 T: std::convert::Into<wkt::FieldMask>,
1373 {
1374 self.0.request.update_mask = std::option::Option::Some(v.into());
1375 self
1376 }
1377
1378 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1382 where
1383 T: std::convert::Into<wkt::FieldMask>,
1384 {
1385 self.0.request.update_mask = v.map(|x| x.into());
1386 self
1387 }
1388 }
1389
1390 #[doc(hidden)]
1391 impl crate::RequestBuilder for UpdateSubscription {
1392 fn request_options(&mut self) -> &mut crate::RequestOptions {
1393 &mut self.0.options
1394 }
1395 }
1396
1397 #[derive(Clone, Debug)]
1418 pub struct ListSubscriptions(RequestBuilder<crate::model::ListSubscriptionsRequest>);
1419
1420 impl ListSubscriptions {
1421 pub(crate) fn new(
1422 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1423 ) -> Self {
1424 Self(RequestBuilder::new(stub))
1425 }
1426
1427 pub fn with_request<V: Into<crate::model::ListSubscriptionsRequest>>(
1429 mut self,
1430 v: V,
1431 ) -> Self {
1432 self.0.request = v.into();
1433 self
1434 }
1435
1436 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1438 self.0.options = v.into();
1439 self
1440 }
1441
1442 pub async fn send(self) -> Result<crate::model::ListSubscriptionsResponse> {
1444 (*self.0.stub)
1445 .list_subscriptions(self.0.request, self.0.options)
1446 .await
1447 .map(crate::Response::into_body)
1448 }
1449
1450 pub fn by_page(
1452 self,
1453 ) -> impl google_cloud_gax::paginator::Paginator<
1454 crate::model::ListSubscriptionsResponse,
1455 crate::Error,
1456 > {
1457 use std::clone::Clone;
1458 let token = self.0.request.page_token.clone();
1459 let execute = move |token: String| {
1460 let mut builder = self.clone();
1461 builder.0.request = builder.0.request.set_page_token(token);
1462 builder.send()
1463 };
1464 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1465 }
1466
1467 pub fn by_item(
1469 self,
1470 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1471 crate::model::ListSubscriptionsResponse,
1472 crate::Error,
1473 > {
1474 use google_cloud_gax::paginator::Paginator;
1475 self.by_page().items()
1476 }
1477
1478 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.project = v.into();
1483 self
1484 }
1485
1486 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1488 self.0.request.page_size = v.into();
1489 self
1490 }
1491
1492 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1494 self.0.request.page_token = v.into();
1495 self
1496 }
1497 }
1498
1499 #[doc(hidden)]
1500 impl crate::RequestBuilder for ListSubscriptions {
1501 fn request_options(&mut self) -> &mut crate::RequestOptions {
1502 &mut self.0.options
1503 }
1504 }
1505
1506 #[derive(Clone, Debug)]
1523 pub struct DeleteSubscription(RequestBuilder<crate::model::DeleteSubscriptionRequest>);
1524
1525 impl DeleteSubscription {
1526 pub(crate) fn new(
1527 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1528 ) -> Self {
1529 Self(RequestBuilder::new(stub))
1530 }
1531
1532 pub fn with_request<V: Into<crate::model::DeleteSubscriptionRequest>>(
1534 mut self,
1535 v: V,
1536 ) -> Self {
1537 self.0.request = v.into();
1538 self
1539 }
1540
1541 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1543 self.0.options = v.into();
1544 self
1545 }
1546
1547 pub async fn send(self) -> Result<()> {
1549 (*self.0.stub)
1550 .delete_subscription(self.0.request, self.0.options)
1551 .await
1552 .map(crate::Response::into_body)
1553 }
1554
1555 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1559 self.0.request.subscription = v.into();
1560 self
1561 }
1562 }
1563
1564 #[doc(hidden)]
1565 impl crate::RequestBuilder for DeleteSubscription {
1566 fn request_options(&mut self) -> &mut crate::RequestOptions {
1567 &mut self.0.options
1568 }
1569 }
1570
1571 #[derive(Clone, Debug)]
1588 pub struct ModifyPushConfig(RequestBuilder<crate::model::ModifyPushConfigRequest>);
1589
1590 impl ModifyPushConfig {
1591 pub(crate) fn new(
1592 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1593 ) -> Self {
1594 Self(RequestBuilder::new(stub))
1595 }
1596
1597 pub fn with_request<V: Into<crate::model::ModifyPushConfigRequest>>(
1599 mut self,
1600 v: V,
1601 ) -> Self {
1602 self.0.request = v.into();
1603 self
1604 }
1605
1606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1608 self.0.options = v.into();
1609 self
1610 }
1611
1612 pub async fn send(self) -> Result<()> {
1614 (*self.0.stub)
1615 .modify_push_config(self.0.request, self.0.options)
1616 .await
1617 .map(crate::Response::into_body)
1618 }
1619
1620 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1624 self.0.request.subscription = v.into();
1625 self
1626 }
1627
1628 pub fn set_push_config<T>(mut self, v: T) -> Self
1632 where
1633 T: std::convert::Into<crate::model::PushConfig>,
1634 {
1635 self.0.request.push_config = std::option::Option::Some(v.into());
1636 self
1637 }
1638
1639 pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
1643 where
1644 T: std::convert::Into<crate::model::PushConfig>,
1645 {
1646 self.0.request.push_config = v.map(|x| x.into());
1647 self
1648 }
1649 }
1650
1651 #[doc(hidden)]
1652 impl crate::RequestBuilder for ModifyPushConfig {
1653 fn request_options(&mut self) -> &mut crate::RequestOptions {
1654 &mut self.0.options
1655 }
1656 }
1657
1658 #[derive(Clone, Debug)]
1675 pub struct GetSnapshot(RequestBuilder<crate::model::GetSnapshotRequest>);
1676
1677 impl GetSnapshot {
1678 pub(crate) fn new(
1679 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1680 ) -> Self {
1681 Self(RequestBuilder::new(stub))
1682 }
1683
1684 pub fn with_request<V: Into<crate::model::GetSnapshotRequest>>(mut self, v: V) -> Self {
1686 self.0.request = v.into();
1687 self
1688 }
1689
1690 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1692 self.0.options = v.into();
1693 self
1694 }
1695
1696 pub async fn send(self) -> Result<crate::model::Snapshot> {
1698 (*self.0.stub)
1699 .get_snapshot(self.0.request, self.0.options)
1700 .await
1701 .map(crate::Response::into_body)
1702 }
1703
1704 pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1708 self.0.request.snapshot = v.into();
1709 self
1710 }
1711 }
1712
1713 #[doc(hidden)]
1714 impl crate::RequestBuilder for GetSnapshot {
1715 fn request_options(&mut self) -> &mut crate::RequestOptions {
1716 &mut self.0.options
1717 }
1718 }
1719
1720 #[derive(Clone, Debug)]
1741 pub struct ListSnapshots(RequestBuilder<crate::model::ListSnapshotsRequest>);
1742
1743 impl ListSnapshots {
1744 pub(crate) fn new(
1745 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1746 ) -> Self {
1747 Self(RequestBuilder::new(stub))
1748 }
1749
1750 pub fn with_request<V: Into<crate::model::ListSnapshotsRequest>>(mut self, v: V) -> Self {
1752 self.0.request = v.into();
1753 self
1754 }
1755
1756 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1758 self.0.options = v.into();
1759 self
1760 }
1761
1762 pub async fn send(self) -> Result<crate::model::ListSnapshotsResponse> {
1764 (*self.0.stub)
1765 .list_snapshots(self.0.request, self.0.options)
1766 .await
1767 .map(crate::Response::into_body)
1768 }
1769
1770 pub fn by_page(
1772 self,
1773 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSnapshotsResponse, crate::Error>
1774 {
1775 use std::clone::Clone;
1776 let token = self.0.request.page_token.clone();
1777 let execute = move |token: String| {
1778 let mut builder = self.clone();
1779 builder.0.request = builder.0.request.set_page_token(token);
1780 builder.send()
1781 };
1782 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1783 }
1784
1785 pub fn by_item(
1787 self,
1788 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1789 crate::model::ListSnapshotsResponse,
1790 crate::Error,
1791 > {
1792 use google_cloud_gax::paginator::Paginator;
1793 self.by_page().items()
1794 }
1795
1796 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.0.request.project = v.into();
1801 self
1802 }
1803
1804 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1806 self.0.request.page_size = v.into();
1807 self
1808 }
1809
1810 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1812 self.0.request.page_token = v.into();
1813 self
1814 }
1815 }
1816
1817 #[doc(hidden)]
1818 impl crate::RequestBuilder for ListSnapshots {
1819 fn request_options(&mut self) -> &mut crate::RequestOptions {
1820 &mut self.0.options
1821 }
1822 }
1823
1824 #[derive(Clone, Debug)]
1841 pub struct CreateSnapshot(RequestBuilder<crate::model::CreateSnapshotRequest>);
1842
1843 impl CreateSnapshot {
1844 pub(crate) fn new(
1845 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1846 ) -> Self {
1847 Self(RequestBuilder::new(stub))
1848 }
1849
1850 pub fn with_request<V: Into<crate::model::CreateSnapshotRequest>>(mut self, v: V) -> Self {
1852 self.0.request = v.into();
1853 self
1854 }
1855
1856 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1858 self.0.options = v.into();
1859 self
1860 }
1861
1862 pub async fn send(self) -> Result<crate::model::Snapshot> {
1864 (*self.0.stub)
1865 .create_snapshot(self.0.request, self.0.options)
1866 .await
1867 .map(crate::Response::into_body)
1868 }
1869
1870 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1874 self.0.request.name = v.into();
1875 self
1876 }
1877
1878 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1882 self.0.request.subscription = v.into();
1883 self
1884 }
1885
1886 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1888 where
1889 T: std::iter::IntoIterator<Item = (K, V)>,
1890 K: std::convert::Into<std::string::String>,
1891 V: std::convert::Into<std::string::String>,
1892 {
1893 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1894 self
1895 }
1896
1897 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1899 where
1900 T: std::iter::IntoIterator<Item = (K, V)>,
1901 K: std::convert::Into<std::string::String>,
1902 V: std::convert::Into<std::string::String>,
1903 {
1904 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1905 self
1906 }
1907 }
1908
1909 #[doc(hidden)]
1910 impl crate::RequestBuilder for CreateSnapshot {
1911 fn request_options(&mut self) -> &mut crate::RequestOptions {
1912 &mut self.0.options
1913 }
1914 }
1915
1916 #[derive(Clone, Debug)]
1933 pub struct UpdateSnapshot(RequestBuilder<crate::model::UpdateSnapshotRequest>);
1934
1935 impl UpdateSnapshot {
1936 pub(crate) fn new(
1937 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1938 ) -> Self {
1939 Self(RequestBuilder::new(stub))
1940 }
1941
1942 pub fn with_request<V: Into<crate::model::UpdateSnapshotRequest>>(mut self, v: V) -> Self {
1944 self.0.request = v.into();
1945 self
1946 }
1947
1948 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1950 self.0.options = v.into();
1951 self
1952 }
1953
1954 pub async fn send(self) -> Result<crate::model::Snapshot> {
1956 (*self.0.stub)
1957 .update_snapshot(self.0.request, self.0.options)
1958 .await
1959 .map(crate::Response::into_body)
1960 }
1961
1962 pub fn set_snapshot<T>(mut self, v: T) -> Self
1966 where
1967 T: std::convert::Into<crate::model::Snapshot>,
1968 {
1969 self.0.request.snapshot = std::option::Option::Some(v.into());
1970 self
1971 }
1972
1973 pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
1977 where
1978 T: std::convert::Into<crate::model::Snapshot>,
1979 {
1980 self.0.request.snapshot = v.map(|x| x.into());
1981 self
1982 }
1983
1984 pub fn set_update_mask<T>(mut self, v: T) -> Self
1988 where
1989 T: std::convert::Into<wkt::FieldMask>,
1990 {
1991 self.0.request.update_mask = std::option::Option::Some(v.into());
1992 self
1993 }
1994
1995 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1999 where
2000 T: std::convert::Into<wkt::FieldMask>,
2001 {
2002 self.0.request.update_mask = v.map(|x| x.into());
2003 self
2004 }
2005 }
2006
2007 #[doc(hidden)]
2008 impl crate::RequestBuilder for UpdateSnapshot {
2009 fn request_options(&mut self) -> &mut crate::RequestOptions {
2010 &mut self.0.options
2011 }
2012 }
2013
2014 #[derive(Clone, Debug)]
2031 pub struct DeleteSnapshot(RequestBuilder<crate::model::DeleteSnapshotRequest>);
2032
2033 impl DeleteSnapshot {
2034 pub(crate) fn new(
2035 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2036 ) -> Self {
2037 Self(RequestBuilder::new(stub))
2038 }
2039
2040 pub fn with_request<V: Into<crate::model::DeleteSnapshotRequest>>(mut self, v: V) -> Self {
2042 self.0.request = v.into();
2043 self
2044 }
2045
2046 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2048 self.0.options = v.into();
2049 self
2050 }
2051
2052 pub async fn send(self) -> Result<()> {
2054 (*self.0.stub)
2055 .delete_snapshot(self.0.request, self.0.options)
2056 .await
2057 .map(crate::Response::into_body)
2058 }
2059
2060 pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
2064 self.0.request.snapshot = v.into();
2065 self
2066 }
2067 }
2068
2069 #[doc(hidden)]
2070 impl crate::RequestBuilder for DeleteSnapshot {
2071 fn request_options(&mut self) -> &mut crate::RequestOptions {
2072 &mut self.0.options
2073 }
2074 }
2075
2076 #[derive(Clone, Debug)]
2093 pub struct Seek(RequestBuilder<crate::model::SeekRequest>);
2094
2095 impl Seek {
2096 pub(crate) fn new(
2097 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2098 ) -> Self {
2099 Self(RequestBuilder::new(stub))
2100 }
2101
2102 pub fn with_request<V: Into<crate::model::SeekRequest>>(mut self, v: V) -> Self {
2104 self.0.request = v.into();
2105 self
2106 }
2107
2108 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2110 self.0.options = v.into();
2111 self
2112 }
2113
2114 pub async fn send(self) -> Result<crate::model::SeekResponse> {
2116 (*self.0.stub)
2117 .seek(self.0.request, self.0.options)
2118 .await
2119 .map(crate::Response::into_body)
2120 }
2121
2122 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
2126 self.0.request.subscription = v.into();
2127 self
2128 }
2129
2130 pub fn set_target<T: Into<Option<crate::model::seek_request::Target>>>(
2135 mut self,
2136 v: T,
2137 ) -> Self {
2138 self.0.request.target = v.into();
2139 self
2140 }
2141
2142 pub fn set_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2148 mut self,
2149 v: T,
2150 ) -> Self {
2151 self.0.request = self.0.request.set_time(v);
2152 self
2153 }
2154
2155 pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2161 self.0.request = self.0.request.set_snapshot(v);
2162 self
2163 }
2164 }
2165
2166 #[doc(hidden)]
2167 impl crate::RequestBuilder for Seek {
2168 fn request_options(&mut self) -> &mut crate::RequestOptions {
2169 &mut self.0.options
2170 }
2171 }
2172}
2173
2174pub mod schema_service {
2176 use crate::Result;
2177
2178 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2192
2193 pub(crate) mod client {
2194 use super::super::super::client::SchemaService;
2195 pub struct Factory;
2196 impl crate::ClientFactory for Factory {
2197 type Client = SchemaService;
2198 type Credentials = gaxi::options::Credentials;
2199 async fn build(
2200 self,
2201 config: gaxi::options::ClientConfig,
2202 ) -> crate::ClientBuilderResult<Self::Client> {
2203 Self::Client::new(config).await
2204 }
2205 }
2206 }
2207
2208 #[derive(Clone, Debug)]
2210 pub(crate) struct RequestBuilder<R: std::default::Default> {
2211 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2212 request: R,
2213 options: crate::RequestOptions,
2214 }
2215
2216 impl<R> RequestBuilder<R>
2217 where
2218 R: std::default::Default,
2219 {
2220 pub(crate) fn new(
2221 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2222 ) -> Self {
2223 Self {
2224 stub,
2225 request: R::default(),
2226 options: crate::RequestOptions::default(),
2227 }
2228 }
2229 }
2230
2231 #[derive(Clone, Debug)]
2248 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
2249
2250 impl CreateSchema {
2251 pub(crate) fn new(
2252 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2253 ) -> Self {
2254 Self(RequestBuilder::new(stub))
2255 }
2256
2257 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
2259 self.0.request = v.into();
2260 self
2261 }
2262
2263 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2265 self.0.options = v.into();
2266 self
2267 }
2268
2269 pub async fn send(self) -> Result<crate::model::Schema> {
2271 (*self.0.stub)
2272 .create_schema(self.0.request, self.0.options)
2273 .await
2274 .map(crate::Response::into_body)
2275 }
2276
2277 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2281 self.0.request.parent = v.into();
2282 self
2283 }
2284
2285 pub fn set_schema<T>(mut self, v: T) -> Self
2289 where
2290 T: std::convert::Into<crate::model::Schema>,
2291 {
2292 self.0.request.schema = std::option::Option::Some(v.into());
2293 self
2294 }
2295
2296 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2300 where
2301 T: std::convert::Into<crate::model::Schema>,
2302 {
2303 self.0.request.schema = v.map(|x| x.into());
2304 self
2305 }
2306
2307 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2309 self.0.request.schema_id = v.into();
2310 self
2311 }
2312 }
2313
2314 #[doc(hidden)]
2315 impl crate::RequestBuilder for CreateSchema {
2316 fn request_options(&mut self) -> &mut crate::RequestOptions {
2317 &mut self.0.options
2318 }
2319 }
2320
2321 #[derive(Clone, Debug)]
2338 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
2339
2340 impl GetSchema {
2341 pub(crate) fn new(
2342 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2343 ) -> Self {
2344 Self(RequestBuilder::new(stub))
2345 }
2346
2347 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
2349 self.0.request = v.into();
2350 self
2351 }
2352
2353 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2355 self.0.options = v.into();
2356 self
2357 }
2358
2359 pub async fn send(self) -> Result<crate::model::Schema> {
2361 (*self.0.stub)
2362 .get_schema(self.0.request, self.0.options)
2363 .await
2364 .map(crate::Response::into_body)
2365 }
2366
2367 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2371 self.0.request.name = v.into();
2372 self
2373 }
2374
2375 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2377 self.0.request.view = v.into();
2378 self
2379 }
2380 }
2381
2382 #[doc(hidden)]
2383 impl crate::RequestBuilder for GetSchema {
2384 fn request_options(&mut self) -> &mut crate::RequestOptions {
2385 &mut self.0.options
2386 }
2387 }
2388
2389 #[derive(Clone, Debug)]
2410 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
2411
2412 impl ListSchemas {
2413 pub(crate) fn new(
2414 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2415 ) -> Self {
2416 Self(RequestBuilder::new(stub))
2417 }
2418
2419 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
2421 self.0.request = v.into();
2422 self
2423 }
2424
2425 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2427 self.0.options = v.into();
2428 self
2429 }
2430
2431 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
2433 (*self.0.stub)
2434 .list_schemas(self.0.request, self.0.options)
2435 .await
2436 .map(crate::Response::into_body)
2437 }
2438
2439 pub fn by_page(
2441 self,
2442 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
2443 {
2444 use std::clone::Clone;
2445 let token = self.0.request.page_token.clone();
2446 let execute = move |token: String| {
2447 let mut builder = self.clone();
2448 builder.0.request = builder.0.request.set_page_token(token);
2449 builder.send()
2450 };
2451 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2452 }
2453
2454 pub fn by_item(
2456 self,
2457 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2458 crate::model::ListSchemasResponse,
2459 crate::Error,
2460 > {
2461 use google_cloud_gax::paginator::Paginator;
2462 self.by_page().items()
2463 }
2464
2465 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2469 self.0.request.parent = v.into();
2470 self
2471 }
2472
2473 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2475 self.0.request.view = v.into();
2476 self
2477 }
2478
2479 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2481 self.0.request.page_size = v.into();
2482 self
2483 }
2484
2485 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2487 self.0.request.page_token = v.into();
2488 self
2489 }
2490 }
2491
2492 #[doc(hidden)]
2493 impl crate::RequestBuilder for ListSchemas {
2494 fn request_options(&mut self) -> &mut crate::RequestOptions {
2495 &mut self.0.options
2496 }
2497 }
2498
2499 #[derive(Clone, Debug)]
2520 pub struct ListSchemaRevisions(RequestBuilder<crate::model::ListSchemaRevisionsRequest>);
2521
2522 impl ListSchemaRevisions {
2523 pub(crate) fn new(
2524 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2525 ) -> Self {
2526 Self(RequestBuilder::new(stub))
2527 }
2528
2529 pub fn with_request<V: Into<crate::model::ListSchemaRevisionsRequest>>(
2531 mut self,
2532 v: V,
2533 ) -> Self {
2534 self.0.request = v.into();
2535 self
2536 }
2537
2538 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2540 self.0.options = v.into();
2541 self
2542 }
2543
2544 pub async fn send(self) -> Result<crate::model::ListSchemaRevisionsResponse> {
2546 (*self.0.stub)
2547 .list_schema_revisions(self.0.request, self.0.options)
2548 .await
2549 .map(crate::Response::into_body)
2550 }
2551
2552 pub fn by_page(
2554 self,
2555 ) -> impl google_cloud_gax::paginator::Paginator<
2556 crate::model::ListSchemaRevisionsResponse,
2557 crate::Error,
2558 > {
2559 use std::clone::Clone;
2560 let token = self.0.request.page_token.clone();
2561 let execute = move |token: String| {
2562 let mut builder = self.clone();
2563 builder.0.request = builder.0.request.set_page_token(token);
2564 builder.send()
2565 };
2566 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2567 }
2568
2569 pub fn by_item(
2571 self,
2572 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2573 crate::model::ListSchemaRevisionsResponse,
2574 crate::Error,
2575 > {
2576 use google_cloud_gax::paginator::Paginator;
2577 self.by_page().items()
2578 }
2579
2580 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2584 self.0.request.name = v.into();
2585 self
2586 }
2587
2588 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2590 self.0.request.view = v.into();
2591 self
2592 }
2593
2594 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2596 self.0.request.page_size = v.into();
2597 self
2598 }
2599
2600 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2602 self.0.request.page_token = v.into();
2603 self
2604 }
2605 }
2606
2607 #[doc(hidden)]
2608 impl crate::RequestBuilder for ListSchemaRevisions {
2609 fn request_options(&mut self) -> &mut crate::RequestOptions {
2610 &mut self.0.options
2611 }
2612 }
2613
2614 #[derive(Clone, Debug)]
2631 pub struct CommitSchema(RequestBuilder<crate::model::CommitSchemaRequest>);
2632
2633 impl CommitSchema {
2634 pub(crate) fn new(
2635 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2636 ) -> Self {
2637 Self(RequestBuilder::new(stub))
2638 }
2639
2640 pub fn with_request<V: Into<crate::model::CommitSchemaRequest>>(mut self, v: V) -> Self {
2642 self.0.request = v.into();
2643 self
2644 }
2645
2646 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2648 self.0.options = v.into();
2649 self
2650 }
2651
2652 pub async fn send(self) -> Result<crate::model::Schema> {
2654 (*self.0.stub)
2655 .commit_schema(self.0.request, self.0.options)
2656 .await
2657 .map(crate::Response::into_body)
2658 }
2659
2660 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2664 self.0.request.name = v.into();
2665 self
2666 }
2667
2668 pub fn set_schema<T>(mut self, v: T) -> Self
2672 where
2673 T: std::convert::Into<crate::model::Schema>,
2674 {
2675 self.0.request.schema = std::option::Option::Some(v.into());
2676 self
2677 }
2678
2679 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2683 where
2684 T: std::convert::Into<crate::model::Schema>,
2685 {
2686 self.0.request.schema = v.map(|x| x.into());
2687 self
2688 }
2689 }
2690
2691 #[doc(hidden)]
2692 impl crate::RequestBuilder for CommitSchema {
2693 fn request_options(&mut self) -> &mut crate::RequestOptions {
2694 &mut self.0.options
2695 }
2696 }
2697
2698 #[derive(Clone, Debug)]
2715 pub struct RollbackSchema(RequestBuilder<crate::model::RollbackSchemaRequest>);
2716
2717 impl RollbackSchema {
2718 pub(crate) fn new(
2719 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2720 ) -> Self {
2721 Self(RequestBuilder::new(stub))
2722 }
2723
2724 pub fn with_request<V: Into<crate::model::RollbackSchemaRequest>>(mut self, v: V) -> Self {
2726 self.0.request = v.into();
2727 self
2728 }
2729
2730 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2732 self.0.options = v.into();
2733 self
2734 }
2735
2736 pub async fn send(self) -> Result<crate::model::Schema> {
2738 (*self.0.stub)
2739 .rollback_schema(self.0.request, self.0.options)
2740 .await
2741 .map(crate::Response::into_body)
2742 }
2743
2744 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2748 self.0.request.name = v.into();
2749 self
2750 }
2751
2752 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2756 self.0.request.revision_id = v.into();
2757 self
2758 }
2759 }
2760
2761 #[doc(hidden)]
2762 impl crate::RequestBuilder for RollbackSchema {
2763 fn request_options(&mut self) -> &mut crate::RequestOptions {
2764 &mut self.0.options
2765 }
2766 }
2767
2768 #[derive(Clone, Debug)]
2785 pub struct DeleteSchemaRevision(RequestBuilder<crate::model::DeleteSchemaRevisionRequest>);
2786
2787 impl DeleteSchemaRevision {
2788 pub(crate) fn new(
2789 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2790 ) -> Self {
2791 Self(RequestBuilder::new(stub))
2792 }
2793
2794 pub fn with_request<V: Into<crate::model::DeleteSchemaRevisionRequest>>(
2796 mut self,
2797 v: V,
2798 ) -> Self {
2799 self.0.request = v.into();
2800 self
2801 }
2802
2803 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2805 self.0.options = v.into();
2806 self
2807 }
2808
2809 pub async fn send(self) -> Result<crate::model::Schema> {
2811 (*self.0.stub)
2812 .delete_schema_revision(self.0.request, self.0.options)
2813 .await
2814 .map(crate::Response::into_body)
2815 }
2816
2817 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2821 self.0.request.name = v.into();
2822 self
2823 }
2824
2825 #[deprecated]
2827 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2828 self.0.request.revision_id = v.into();
2829 self
2830 }
2831 }
2832
2833 #[doc(hidden)]
2834 impl crate::RequestBuilder for DeleteSchemaRevision {
2835 fn request_options(&mut self) -> &mut crate::RequestOptions {
2836 &mut self.0.options
2837 }
2838 }
2839
2840 #[derive(Clone, Debug)]
2857 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
2858
2859 impl DeleteSchema {
2860 pub(crate) fn new(
2861 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2862 ) -> Self {
2863 Self(RequestBuilder::new(stub))
2864 }
2865
2866 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
2868 self.0.request = v.into();
2869 self
2870 }
2871
2872 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2874 self.0.options = v.into();
2875 self
2876 }
2877
2878 pub async fn send(self) -> Result<()> {
2880 (*self.0.stub)
2881 .delete_schema(self.0.request, self.0.options)
2882 .await
2883 .map(crate::Response::into_body)
2884 }
2885
2886 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2890 self.0.request.name = v.into();
2891 self
2892 }
2893 }
2894
2895 #[doc(hidden)]
2896 impl crate::RequestBuilder for DeleteSchema {
2897 fn request_options(&mut self) -> &mut crate::RequestOptions {
2898 &mut self.0.options
2899 }
2900 }
2901
2902 #[derive(Clone, Debug)]
2919 pub struct ValidateSchema(RequestBuilder<crate::model::ValidateSchemaRequest>);
2920
2921 impl ValidateSchema {
2922 pub(crate) fn new(
2923 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2924 ) -> Self {
2925 Self(RequestBuilder::new(stub))
2926 }
2927
2928 pub fn with_request<V: Into<crate::model::ValidateSchemaRequest>>(mut self, v: V) -> Self {
2930 self.0.request = v.into();
2931 self
2932 }
2933
2934 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2936 self.0.options = v.into();
2937 self
2938 }
2939
2940 pub async fn send(self) -> Result<crate::model::ValidateSchemaResponse> {
2942 (*self.0.stub)
2943 .validate_schema(self.0.request, self.0.options)
2944 .await
2945 .map(crate::Response::into_body)
2946 }
2947
2948 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2952 self.0.request.parent = v.into();
2953 self
2954 }
2955
2956 pub fn set_schema<T>(mut self, v: T) -> Self
2960 where
2961 T: std::convert::Into<crate::model::Schema>,
2962 {
2963 self.0.request.schema = std::option::Option::Some(v.into());
2964 self
2965 }
2966
2967 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2971 where
2972 T: std::convert::Into<crate::model::Schema>,
2973 {
2974 self.0.request.schema = v.map(|x| x.into());
2975 self
2976 }
2977 }
2978
2979 #[doc(hidden)]
2980 impl crate::RequestBuilder for ValidateSchema {
2981 fn request_options(&mut self) -> &mut crate::RequestOptions {
2982 &mut self.0.options
2983 }
2984 }
2985
2986 #[derive(Clone, Debug)]
3003 pub struct ValidateMessage(RequestBuilder<crate::model::ValidateMessageRequest>);
3004
3005 impl ValidateMessage {
3006 pub(crate) fn new(
3007 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3008 ) -> Self {
3009 Self(RequestBuilder::new(stub))
3010 }
3011
3012 pub fn with_request<V: Into<crate::model::ValidateMessageRequest>>(mut self, v: V) -> Self {
3014 self.0.request = v.into();
3015 self
3016 }
3017
3018 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3020 self.0.options = v.into();
3021 self
3022 }
3023
3024 pub async fn send(self) -> Result<crate::model::ValidateMessageResponse> {
3026 (*self.0.stub)
3027 .validate_message(self.0.request, self.0.options)
3028 .await
3029 .map(crate::Response::into_body)
3030 }
3031
3032 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3036 self.0.request.parent = v.into();
3037 self
3038 }
3039
3040 pub fn set_message<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3042 self.0.request.message = v.into();
3043 self
3044 }
3045
3046 pub fn set_encoding<T: Into<crate::model::Encoding>>(mut self, v: T) -> Self {
3048 self.0.request.encoding = v.into();
3049 self
3050 }
3051
3052 pub fn set_schema_spec<
3057 T: Into<Option<crate::model::validate_message_request::SchemaSpec>>,
3058 >(
3059 mut self,
3060 v: T,
3061 ) -> Self {
3062 self.0.request.schema_spec = v.into();
3063 self
3064 }
3065
3066 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3072 self.0.request = self.0.request.set_name(v);
3073 self
3074 }
3075
3076 pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
3082 mut self,
3083 v: T,
3084 ) -> Self {
3085 self.0.request = self.0.request.set_schema(v);
3086 self
3087 }
3088 }
3089
3090 #[doc(hidden)]
3091 impl crate::RequestBuilder for ValidateMessage {
3092 fn request_options(&mut self) -> &mut crate::RequestOptions {
3093 &mut self.0.options
3094 }
3095 }
3096
3097 #[derive(Clone, Debug)]
3114 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3115
3116 impl SetIamPolicy {
3117 pub(crate) fn new(
3118 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3119 ) -> Self {
3120 Self(RequestBuilder::new(stub))
3121 }
3122
3123 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3125 mut self,
3126 v: V,
3127 ) -> Self {
3128 self.0.request = v.into();
3129 self
3130 }
3131
3132 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3134 self.0.options = v.into();
3135 self
3136 }
3137
3138 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3140 (*self.0.stub)
3141 .set_iam_policy(self.0.request, self.0.options)
3142 .await
3143 .map(crate::Response::into_body)
3144 }
3145
3146 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150 self.0.request.resource = v.into();
3151 self
3152 }
3153
3154 pub fn set_policy<T>(mut self, v: T) -> Self
3158 where
3159 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3160 {
3161 self.0.request.policy = std::option::Option::Some(v.into());
3162 self
3163 }
3164
3165 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3169 where
3170 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3171 {
3172 self.0.request.policy = v.map(|x| x.into());
3173 self
3174 }
3175
3176 pub fn set_update_mask<T>(mut self, v: T) -> Self
3178 where
3179 T: std::convert::Into<wkt::FieldMask>,
3180 {
3181 self.0.request.update_mask = std::option::Option::Some(v.into());
3182 self
3183 }
3184
3185 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3187 where
3188 T: std::convert::Into<wkt::FieldMask>,
3189 {
3190 self.0.request.update_mask = v.map(|x| x.into());
3191 self
3192 }
3193 }
3194
3195 #[doc(hidden)]
3196 impl crate::RequestBuilder for SetIamPolicy {
3197 fn request_options(&mut self) -> &mut crate::RequestOptions {
3198 &mut self.0.options
3199 }
3200 }
3201
3202 #[derive(Clone, Debug)]
3219 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3220
3221 impl GetIamPolicy {
3222 pub(crate) fn new(
3223 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3224 ) -> Self {
3225 Self(RequestBuilder::new(stub))
3226 }
3227
3228 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3230 mut self,
3231 v: V,
3232 ) -> Self {
3233 self.0.request = v.into();
3234 self
3235 }
3236
3237 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3239 self.0.options = v.into();
3240 self
3241 }
3242
3243 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3245 (*self.0.stub)
3246 .get_iam_policy(self.0.request, self.0.options)
3247 .await
3248 .map(crate::Response::into_body)
3249 }
3250
3251 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3255 self.0.request.resource = v.into();
3256 self
3257 }
3258
3259 pub fn set_options<T>(mut self, v: T) -> Self
3261 where
3262 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3263 {
3264 self.0.request.options = std::option::Option::Some(v.into());
3265 self
3266 }
3267
3268 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3270 where
3271 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3272 {
3273 self.0.request.options = v.map(|x| x.into());
3274 self
3275 }
3276 }
3277
3278 #[doc(hidden)]
3279 impl crate::RequestBuilder for GetIamPolicy {
3280 fn request_options(&mut self) -> &mut crate::RequestOptions {
3281 &mut self.0.options
3282 }
3283 }
3284
3285 #[derive(Clone, Debug)]
3302 pub struct TestIamPermissions(
3303 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3304 );
3305
3306 impl TestIamPermissions {
3307 pub(crate) fn new(
3308 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3309 ) -> Self {
3310 Self(RequestBuilder::new(stub))
3311 }
3312
3313 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3315 mut self,
3316 v: V,
3317 ) -> Self {
3318 self.0.request = v.into();
3319 self
3320 }
3321
3322 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3324 self.0.options = v.into();
3325 self
3326 }
3327
3328 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3330 (*self.0.stub)
3331 .test_iam_permissions(self.0.request, self.0.options)
3332 .await
3333 .map(crate::Response::into_body)
3334 }
3335
3336 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3340 self.0.request.resource = v.into();
3341 self
3342 }
3343
3344 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3348 where
3349 T: std::iter::IntoIterator<Item = V>,
3350 V: std::convert::Into<std::string::String>,
3351 {
3352 use std::iter::Iterator;
3353 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3354 self
3355 }
3356 }
3357
3358 #[doc(hidden)]
3359 impl crate::RequestBuilder for TestIamPermissions {
3360 fn request_options(&mut self) -> &mut crate::RequestOptions {
3361 &mut self.0.options
3362 }
3363 }
3364}