1pub mod topic_admin {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::TopicAdmin;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = TopicAdmin;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct CreateTopic(RequestBuilder<crate::model::Topic>);
91
92 impl CreateTopic {
93 pub(crate) fn new(
94 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
95 ) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::Topic>>(mut self, v: V) -> Self {
101 self.0.request = v.into();
102 self
103 }
104
105 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107 self.0.options = v.into();
108 self
109 }
110
111 pub async fn send(self) -> Result<crate::model::Topic> {
113 (*self.0.stub)
114 .create_topic(self.0.request, self.0.options)
115 .await
116 .map(crate::Response::into_body)
117 }
118
119 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
123 self.0.request.name = v.into();
124 self
125 }
126
127 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
129 where
130 T: std::iter::IntoIterator<Item = (K, V)>,
131 K: std::convert::Into<std::string::String>,
132 V: std::convert::Into<std::string::String>,
133 {
134 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
135 self
136 }
137
138 pub fn set_message_storage_policy<T>(mut self, v: T) -> Self
140 where
141 T: std::convert::Into<crate::model::MessageStoragePolicy>,
142 {
143 self.0.request.message_storage_policy = std::option::Option::Some(v.into());
144 self
145 }
146
147 pub fn set_or_clear_message_storage_policy<T>(mut self, v: std::option::Option<T>) -> Self
149 where
150 T: std::convert::Into<crate::model::MessageStoragePolicy>,
151 {
152 self.0.request.message_storage_policy = v.map(|x| x.into());
153 self
154 }
155
156 pub fn set_kms_key_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.kms_key_name = v.into();
159 self
160 }
161
162 pub fn set_schema_settings<T>(mut self, v: T) -> Self
164 where
165 T: std::convert::Into<crate::model::SchemaSettings>,
166 {
167 self.0.request.schema_settings = std::option::Option::Some(v.into());
168 self
169 }
170
171 pub fn set_or_clear_schema_settings<T>(mut self, v: std::option::Option<T>) -> Self
173 where
174 T: std::convert::Into<crate::model::SchemaSettings>,
175 {
176 self.0.request.schema_settings = v.map(|x| x.into());
177 self
178 }
179
180 pub fn set_satisfies_pzs<T: Into<bool>>(mut self, v: T) -> Self {
182 self.0.request.satisfies_pzs = v.into();
183 self
184 }
185
186 pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
188 where
189 T: std::convert::Into<wkt::Duration>,
190 {
191 self.0.request.message_retention_duration = std::option::Option::Some(v.into());
192 self
193 }
194
195 pub fn set_or_clear_message_retention_duration<T>(
197 mut self,
198 v: std::option::Option<T>,
199 ) -> Self
200 where
201 T: std::convert::Into<wkt::Duration>,
202 {
203 self.0.request.message_retention_duration = v.map(|x| x.into());
204 self
205 }
206
207 pub fn set_state<T: Into<crate::model::topic::State>>(mut self, v: T) -> Self {
209 self.0.request.state = v.into();
210 self
211 }
212
213 pub fn set_ingestion_data_source_settings<T>(mut self, v: T) -> Self
215 where
216 T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
217 {
218 self.0.request.ingestion_data_source_settings = std::option::Option::Some(v.into());
219 self
220 }
221
222 pub fn set_or_clear_ingestion_data_source_settings<T>(
224 mut self,
225 v: std::option::Option<T>,
226 ) -> Self
227 where
228 T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
229 {
230 self.0.request.ingestion_data_source_settings = v.map(|x| x.into());
231 self
232 }
233
234 pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
236 where
237 T: std::iter::IntoIterator<Item = V>,
238 V: std::convert::Into<crate::model::MessageTransform>,
239 {
240 use std::iter::Iterator;
241 self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
242 self
243 }
244
245 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
247 where
248 T: std::iter::IntoIterator<Item = (K, V)>,
249 K: std::convert::Into<std::string::String>,
250 V: std::convert::Into<std::string::String>,
251 {
252 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
253 self
254 }
255 }
256
257 #[doc(hidden)]
258 impl crate::RequestBuilder for CreateTopic {
259 fn request_options(&mut self) -> &mut crate::RequestOptions {
260 &mut self.0.options
261 }
262 }
263
264 #[derive(Clone, Debug)]
281 pub struct UpdateTopic(RequestBuilder<crate::model::UpdateTopicRequest>);
282
283 impl UpdateTopic {
284 pub(crate) fn new(
285 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
286 ) -> Self {
287 Self(RequestBuilder::new(stub))
288 }
289
290 pub fn with_request<V: Into<crate::model::UpdateTopicRequest>>(mut self, v: V) -> Self {
292 self.0.request = v.into();
293 self
294 }
295
296 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
298 self.0.options = v.into();
299 self
300 }
301
302 pub async fn send(self) -> Result<crate::model::Topic> {
304 (*self.0.stub)
305 .update_topic(self.0.request, self.0.options)
306 .await
307 .map(crate::Response::into_body)
308 }
309
310 pub fn set_topic<T>(mut self, v: T) -> Self
314 where
315 T: std::convert::Into<crate::model::Topic>,
316 {
317 self.0.request.topic = std::option::Option::Some(v.into());
318 self
319 }
320
321 pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
325 where
326 T: std::convert::Into<crate::model::Topic>,
327 {
328 self.0.request.topic = v.map(|x| x.into());
329 self
330 }
331
332 pub fn set_update_mask<T>(mut self, v: T) -> Self
336 where
337 T: std::convert::Into<wkt::FieldMask>,
338 {
339 self.0.request.update_mask = std::option::Option::Some(v.into());
340 self
341 }
342
343 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
347 where
348 T: std::convert::Into<wkt::FieldMask>,
349 {
350 self.0.request.update_mask = v.map(|x| x.into());
351 self
352 }
353 }
354
355 #[doc(hidden)]
356 impl crate::RequestBuilder for UpdateTopic {
357 fn request_options(&mut self) -> &mut crate::RequestOptions {
358 &mut self.0.options
359 }
360 }
361
362 #[derive(Clone, Debug)]
379 pub struct GetTopic(RequestBuilder<crate::model::GetTopicRequest>);
380
381 impl GetTopic {
382 pub(crate) fn new(
383 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
384 ) -> Self {
385 Self(RequestBuilder::new(stub))
386 }
387
388 pub fn with_request<V: Into<crate::model::GetTopicRequest>>(mut self, v: V) -> Self {
390 self.0.request = v.into();
391 self
392 }
393
394 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
396 self.0.options = v.into();
397 self
398 }
399
400 pub async fn send(self) -> Result<crate::model::Topic> {
402 (*self.0.stub)
403 .get_topic(self.0.request, self.0.options)
404 .await
405 .map(crate::Response::into_body)
406 }
407
408 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
412 self.0.request.topic = v.into();
413 self
414 }
415 }
416
417 #[doc(hidden)]
418 impl crate::RequestBuilder for GetTopic {
419 fn request_options(&mut self) -> &mut crate::RequestOptions {
420 &mut self.0.options
421 }
422 }
423
424 #[derive(Clone, Debug)]
445 pub struct ListTopics(RequestBuilder<crate::model::ListTopicsRequest>);
446
447 impl ListTopics {
448 pub(crate) fn new(
449 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
450 ) -> Self {
451 Self(RequestBuilder::new(stub))
452 }
453
454 pub fn with_request<V: Into<crate::model::ListTopicsRequest>>(mut self, v: V) -> Self {
456 self.0.request = v.into();
457 self
458 }
459
460 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
462 self.0.options = v.into();
463 self
464 }
465
466 pub async fn send(self) -> Result<crate::model::ListTopicsResponse> {
468 (*self.0.stub)
469 .list_topics(self.0.request, self.0.options)
470 .await
471 .map(crate::Response::into_body)
472 }
473
474 pub fn by_page(
476 self,
477 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTopicsResponse, crate::Error>
478 {
479 use std::clone::Clone;
480 let token = self.0.request.page_token.clone();
481 let execute = move |token: String| {
482 let mut builder = self.clone();
483 builder.0.request = builder.0.request.set_page_token(token);
484 builder.send()
485 };
486 google_cloud_gax::paginator::internal::new_paginator(token, execute)
487 }
488
489 pub fn by_item(
491 self,
492 ) -> impl google_cloud_gax::paginator::ItemPaginator<
493 crate::model::ListTopicsResponse,
494 crate::Error,
495 > {
496 use google_cloud_gax::paginator::Paginator;
497 self.by_page().items()
498 }
499
500 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
504 self.0.request.project = v.into();
505 self
506 }
507
508 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
510 self.0.request.page_size = v.into();
511 self
512 }
513
514 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
516 self.0.request.page_token = v.into();
517 self
518 }
519 }
520
521 #[doc(hidden)]
522 impl crate::RequestBuilder for ListTopics {
523 fn request_options(&mut self) -> &mut crate::RequestOptions {
524 &mut self.0.options
525 }
526 }
527
528 #[derive(Clone, Debug)]
549 pub struct ListTopicSubscriptions(RequestBuilder<crate::model::ListTopicSubscriptionsRequest>);
550
551 impl ListTopicSubscriptions {
552 pub(crate) fn new(
553 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
554 ) -> Self {
555 Self(RequestBuilder::new(stub))
556 }
557
558 pub fn with_request<V: Into<crate::model::ListTopicSubscriptionsRequest>>(
560 mut self,
561 v: V,
562 ) -> Self {
563 self.0.request = v.into();
564 self
565 }
566
567 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
569 self.0.options = v.into();
570 self
571 }
572
573 pub async fn send(self) -> Result<crate::model::ListTopicSubscriptionsResponse> {
575 (*self.0.stub)
576 .list_topic_subscriptions(self.0.request, self.0.options)
577 .await
578 .map(crate::Response::into_body)
579 }
580
581 pub fn by_page(
583 self,
584 ) -> impl google_cloud_gax::paginator::Paginator<
585 crate::model::ListTopicSubscriptionsResponse,
586 crate::Error,
587 > {
588 use std::clone::Clone;
589 let token = self.0.request.page_token.clone();
590 let execute = move |token: String| {
591 let mut builder = self.clone();
592 builder.0.request = builder.0.request.set_page_token(token);
593 builder.send()
594 };
595 google_cloud_gax::paginator::internal::new_paginator(token, execute)
596 }
597
598 pub fn by_item(
600 self,
601 ) -> impl google_cloud_gax::paginator::ItemPaginator<
602 crate::model::ListTopicSubscriptionsResponse,
603 crate::Error,
604 > {
605 use google_cloud_gax::paginator::Paginator;
606 self.by_page().items()
607 }
608
609 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
613 self.0.request.topic = v.into();
614 self
615 }
616
617 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
619 self.0.request.page_size = v.into();
620 self
621 }
622
623 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
625 self.0.request.page_token = v.into();
626 self
627 }
628 }
629
630 #[doc(hidden)]
631 impl crate::RequestBuilder for ListTopicSubscriptions {
632 fn request_options(&mut self) -> &mut crate::RequestOptions {
633 &mut self.0.options
634 }
635 }
636
637 #[derive(Clone, Debug)]
654 pub struct ListTopicSnapshots(RequestBuilder<crate::model::ListTopicSnapshotsRequest>);
655
656 impl ListTopicSnapshots {
657 pub(crate) fn new(
658 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
659 ) -> Self {
660 Self(RequestBuilder::new(stub))
661 }
662
663 pub fn with_request<V: Into<crate::model::ListTopicSnapshotsRequest>>(
665 mut self,
666 v: V,
667 ) -> Self {
668 self.0.request = v.into();
669 self
670 }
671
672 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
674 self.0.options = v.into();
675 self
676 }
677
678 pub async fn send(self) -> Result<crate::model::ListTopicSnapshotsResponse> {
680 (*self.0.stub)
681 .list_topic_snapshots(self.0.request, self.0.options)
682 .await
683 .map(crate::Response::into_body)
684 }
685
686 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
690 self.0.request.topic = v.into();
691 self
692 }
693
694 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
696 self.0.request.page_size = v.into();
697 self
698 }
699
700 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
702 self.0.request.page_token = v.into();
703 self
704 }
705 }
706
707 #[doc(hidden)]
708 impl crate::RequestBuilder for ListTopicSnapshots {
709 fn request_options(&mut self) -> &mut crate::RequestOptions {
710 &mut self.0.options
711 }
712 }
713
714 #[derive(Clone, Debug)]
731 pub struct DeleteTopic(RequestBuilder<crate::model::DeleteTopicRequest>);
732
733 impl DeleteTopic {
734 pub(crate) fn new(
735 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
736 ) -> Self {
737 Self(RequestBuilder::new(stub))
738 }
739
740 pub fn with_request<V: Into<crate::model::DeleteTopicRequest>>(mut self, v: V) -> Self {
742 self.0.request = v.into();
743 self
744 }
745
746 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
748 self.0.options = v.into();
749 self
750 }
751
752 pub async fn send(self) -> Result<()> {
754 (*self.0.stub)
755 .delete_topic(self.0.request, self.0.options)
756 .await
757 .map(crate::Response::into_body)
758 }
759
760 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
764 self.0.request.topic = v.into();
765 self
766 }
767 }
768
769 #[doc(hidden)]
770 impl crate::RequestBuilder for DeleteTopic {
771 fn request_options(&mut self) -> &mut crate::RequestOptions {
772 &mut self.0.options
773 }
774 }
775
776 #[derive(Clone, Debug)]
793 pub struct DetachSubscription(RequestBuilder<crate::model::DetachSubscriptionRequest>);
794
795 impl DetachSubscription {
796 pub(crate) fn new(
797 stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
798 ) -> Self {
799 Self(RequestBuilder::new(stub))
800 }
801
802 pub fn with_request<V: Into<crate::model::DetachSubscriptionRequest>>(
804 mut self,
805 v: V,
806 ) -> Self {
807 self.0.request = v.into();
808 self
809 }
810
811 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
813 self.0.options = v.into();
814 self
815 }
816
817 pub async fn send(self) -> Result<crate::model::DetachSubscriptionResponse> {
819 (*self.0.stub)
820 .detach_subscription(self.0.request, self.0.options)
821 .await
822 .map(crate::Response::into_body)
823 }
824
825 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
829 self.0.request.subscription = v.into();
830 self
831 }
832 }
833
834 #[doc(hidden)]
835 impl crate::RequestBuilder for DetachSubscription {
836 fn request_options(&mut self) -> &mut crate::RequestOptions {
837 &mut self.0.options
838 }
839 }
840}
841
842pub mod subscription_admin {
843 use crate::Result;
844
845 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
859
860 pub(crate) mod client {
861 use super::super::super::client::SubscriptionAdmin;
862 pub struct Factory;
863 impl crate::ClientFactory for Factory {
864 type Client = SubscriptionAdmin;
865 type Credentials = gaxi::options::Credentials;
866 async fn build(
867 self,
868 config: gaxi::options::ClientConfig,
869 ) -> crate::ClientBuilderResult<Self::Client> {
870 Self::Client::new(config).await
871 }
872 }
873 }
874
875 #[derive(Clone, Debug)]
877 pub(crate) struct RequestBuilder<R: std::default::Default> {
878 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
879 request: R,
880 options: crate::RequestOptions,
881 }
882
883 impl<R> RequestBuilder<R>
884 where
885 R: std::default::Default,
886 {
887 pub(crate) fn new(
888 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
889 ) -> Self {
890 Self {
891 stub,
892 request: R::default(),
893 options: crate::RequestOptions::default(),
894 }
895 }
896 }
897
898 #[derive(Clone, Debug)]
915 pub struct CreateSubscription(RequestBuilder<crate::model::Subscription>);
916
917 impl CreateSubscription {
918 pub(crate) fn new(
919 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
920 ) -> Self {
921 Self(RequestBuilder::new(stub))
922 }
923
924 pub fn with_request<V: Into<crate::model::Subscription>>(mut self, v: V) -> Self {
926 self.0.request = v.into();
927 self
928 }
929
930 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
932 self.0.options = v.into();
933 self
934 }
935
936 pub async fn send(self) -> Result<crate::model::Subscription> {
938 (*self.0.stub)
939 .create_subscription(self.0.request, self.0.options)
940 .await
941 .map(crate::Response::into_body)
942 }
943
944 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948 self.0.request.name = v.into();
949 self
950 }
951
952 pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
956 self.0.request.topic = v.into();
957 self
958 }
959
960 pub fn set_push_config<T>(mut self, v: T) -> Self
962 where
963 T: std::convert::Into<crate::model::PushConfig>,
964 {
965 self.0.request.push_config = std::option::Option::Some(v.into());
966 self
967 }
968
969 pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
971 where
972 T: std::convert::Into<crate::model::PushConfig>,
973 {
974 self.0.request.push_config = v.map(|x| x.into());
975 self
976 }
977
978 pub fn set_bigquery_config<T>(mut self, v: T) -> Self
980 where
981 T: std::convert::Into<crate::model::BigQueryConfig>,
982 {
983 self.0.request.bigquery_config = std::option::Option::Some(v.into());
984 self
985 }
986
987 pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
989 where
990 T: std::convert::Into<crate::model::BigQueryConfig>,
991 {
992 self.0.request.bigquery_config = v.map(|x| x.into());
993 self
994 }
995
996 pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
998 where
999 T: std::convert::Into<crate::model::CloudStorageConfig>,
1000 {
1001 self.0.request.cloud_storage_config = std::option::Option::Some(v.into());
1002 self
1003 }
1004
1005 pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
1007 where
1008 T: std::convert::Into<crate::model::CloudStorageConfig>,
1009 {
1010 self.0.request.cloud_storage_config = v.map(|x| x.into());
1011 self
1012 }
1013
1014 pub fn set_bigtable_config<T>(mut self, v: T) -> Self
1016 where
1017 T: std::convert::Into<crate::model::BigtableConfig>,
1018 {
1019 self.0.request.bigtable_config = std::option::Option::Some(v.into());
1020 self
1021 }
1022
1023 pub fn set_or_clear_bigtable_config<T>(mut self, v: std::option::Option<T>) -> Self
1025 where
1026 T: std::convert::Into<crate::model::BigtableConfig>,
1027 {
1028 self.0.request.bigtable_config = v.map(|x| x.into());
1029 self
1030 }
1031
1032 pub fn set_ack_deadline_seconds<T: Into<i32>>(mut self, v: T) -> Self {
1034 self.0.request.ack_deadline_seconds = v.into();
1035 self
1036 }
1037
1038 pub fn set_retain_acked_messages<T: Into<bool>>(mut self, v: T) -> Self {
1040 self.0.request.retain_acked_messages = v.into();
1041 self
1042 }
1043
1044 pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
1046 where
1047 T: std::convert::Into<wkt::Duration>,
1048 {
1049 self.0.request.message_retention_duration = std::option::Option::Some(v.into());
1050 self
1051 }
1052
1053 pub fn set_or_clear_message_retention_duration<T>(
1055 mut self,
1056 v: std::option::Option<T>,
1057 ) -> Self
1058 where
1059 T: std::convert::Into<wkt::Duration>,
1060 {
1061 self.0.request.message_retention_duration = v.map(|x| x.into());
1062 self
1063 }
1064
1065 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1067 where
1068 T: std::iter::IntoIterator<Item = (K, V)>,
1069 K: std::convert::Into<std::string::String>,
1070 V: std::convert::Into<std::string::String>,
1071 {
1072 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1073 self
1074 }
1075
1076 pub fn set_enable_message_ordering<T: Into<bool>>(mut self, v: T) -> Self {
1078 self.0.request.enable_message_ordering = v.into();
1079 self
1080 }
1081
1082 pub fn set_expiration_policy<T>(mut self, v: T) -> Self
1084 where
1085 T: std::convert::Into<crate::model::ExpirationPolicy>,
1086 {
1087 self.0.request.expiration_policy = std::option::Option::Some(v.into());
1088 self
1089 }
1090
1091 pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
1093 where
1094 T: std::convert::Into<crate::model::ExpirationPolicy>,
1095 {
1096 self.0.request.expiration_policy = v.map(|x| x.into());
1097 self
1098 }
1099
1100 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1102 self.0.request.filter = v.into();
1103 self
1104 }
1105
1106 pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
1108 where
1109 T: std::convert::Into<crate::model::DeadLetterPolicy>,
1110 {
1111 self.0.request.dead_letter_policy = std::option::Option::Some(v.into());
1112 self
1113 }
1114
1115 pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
1117 where
1118 T: std::convert::Into<crate::model::DeadLetterPolicy>,
1119 {
1120 self.0.request.dead_letter_policy = v.map(|x| x.into());
1121 self
1122 }
1123
1124 pub fn set_retry_policy<T>(mut self, v: T) -> Self
1126 where
1127 T: std::convert::Into<crate::model::RetryPolicy>,
1128 {
1129 self.0.request.retry_policy = std::option::Option::Some(v.into());
1130 self
1131 }
1132
1133 pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
1135 where
1136 T: std::convert::Into<crate::model::RetryPolicy>,
1137 {
1138 self.0.request.retry_policy = v.map(|x| x.into());
1139 self
1140 }
1141
1142 pub fn set_detached<T: Into<bool>>(mut self, v: T) -> Self {
1144 self.0.request.detached = v.into();
1145 self
1146 }
1147
1148 pub fn set_enable_exactly_once_delivery<T: Into<bool>>(mut self, v: T) -> Self {
1150 self.0.request.enable_exactly_once_delivery = v.into();
1151 self
1152 }
1153
1154 pub fn set_topic_message_retention_duration<T>(mut self, v: T) -> Self
1156 where
1157 T: std::convert::Into<wkt::Duration>,
1158 {
1159 self.0.request.topic_message_retention_duration = std::option::Option::Some(v.into());
1160 self
1161 }
1162
1163 pub fn set_or_clear_topic_message_retention_duration<T>(
1165 mut self,
1166 v: std::option::Option<T>,
1167 ) -> Self
1168 where
1169 T: std::convert::Into<wkt::Duration>,
1170 {
1171 self.0.request.topic_message_retention_duration = v.map(|x| x.into());
1172 self
1173 }
1174
1175 pub fn set_state<T: Into<crate::model::subscription::State>>(mut self, v: T) -> Self {
1177 self.0.request.state = v.into();
1178 self
1179 }
1180
1181 pub fn set_analytics_hub_subscription_info<T>(mut self, v: T) -> Self
1183 where
1184 T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1185 {
1186 self.0.request.analytics_hub_subscription_info = std::option::Option::Some(v.into());
1187 self
1188 }
1189
1190 pub fn set_or_clear_analytics_hub_subscription_info<T>(
1192 mut self,
1193 v: std::option::Option<T>,
1194 ) -> Self
1195 where
1196 T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1197 {
1198 self.0.request.analytics_hub_subscription_info = v.map(|x| x.into());
1199 self
1200 }
1201
1202 pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
1204 where
1205 T: std::iter::IntoIterator<Item = V>,
1206 V: std::convert::Into<crate::model::MessageTransform>,
1207 {
1208 use std::iter::Iterator;
1209 self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
1210 self
1211 }
1212
1213 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1215 where
1216 T: std::iter::IntoIterator<Item = (K, V)>,
1217 K: std::convert::Into<std::string::String>,
1218 V: std::convert::Into<std::string::String>,
1219 {
1220 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1221 self
1222 }
1223 }
1224
1225 #[doc(hidden)]
1226 impl crate::RequestBuilder for CreateSubscription {
1227 fn request_options(&mut self) -> &mut crate::RequestOptions {
1228 &mut self.0.options
1229 }
1230 }
1231
1232 #[derive(Clone, Debug)]
1249 pub struct GetSubscription(RequestBuilder<crate::model::GetSubscriptionRequest>);
1250
1251 impl GetSubscription {
1252 pub(crate) fn new(
1253 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1254 ) -> Self {
1255 Self(RequestBuilder::new(stub))
1256 }
1257
1258 pub fn with_request<V: Into<crate::model::GetSubscriptionRequest>>(mut self, v: V) -> Self {
1260 self.0.request = v.into();
1261 self
1262 }
1263
1264 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1266 self.0.options = v.into();
1267 self
1268 }
1269
1270 pub async fn send(self) -> Result<crate::model::Subscription> {
1272 (*self.0.stub)
1273 .get_subscription(self.0.request, self.0.options)
1274 .await
1275 .map(crate::Response::into_body)
1276 }
1277
1278 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1282 self.0.request.subscription = v.into();
1283 self
1284 }
1285 }
1286
1287 #[doc(hidden)]
1288 impl crate::RequestBuilder for GetSubscription {
1289 fn request_options(&mut self) -> &mut crate::RequestOptions {
1290 &mut self.0.options
1291 }
1292 }
1293
1294 #[derive(Clone, Debug)]
1311 pub struct UpdateSubscription(RequestBuilder<crate::model::UpdateSubscriptionRequest>);
1312
1313 impl UpdateSubscription {
1314 pub(crate) fn new(
1315 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1316 ) -> Self {
1317 Self(RequestBuilder::new(stub))
1318 }
1319
1320 pub fn with_request<V: Into<crate::model::UpdateSubscriptionRequest>>(
1322 mut self,
1323 v: V,
1324 ) -> Self {
1325 self.0.request = v.into();
1326 self
1327 }
1328
1329 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1331 self.0.options = v.into();
1332 self
1333 }
1334
1335 pub async fn send(self) -> Result<crate::model::Subscription> {
1337 (*self.0.stub)
1338 .update_subscription(self.0.request, self.0.options)
1339 .await
1340 .map(crate::Response::into_body)
1341 }
1342
1343 pub fn set_subscription<T>(mut self, v: T) -> Self
1347 where
1348 T: std::convert::Into<crate::model::Subscription>,
1349 {
1350 self.0.request.subscription = std::option::Option::Some(v.into());
1351 self
1352 }
1353
1354 pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
1358 where
1359 T: std::convert::Into<crate::model::Subscription>,
1360 {
1361 self.0.request.subscription = v.map(|x| x.into());
1362 self
1363 }
1364
1365 pub fn set_update_mask<T>(mut self, v: T) -> Self
1369 where
1370 T: std::convert::Into<wkt::FieldMask>,
1371 {
1372 self.0.request.update_mask = std::option::Option::Some(v.into());
1373 self
1374 }
1375
1376 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1380 where
1381 T: std::convert::Into<wkt::FieldMask>,
1382 {
1383 self.0.request.update_mask = v.map(|x| x.into());
1384 self
1385 }
1386 }
1387
1388 #[doc(hidden)]
1389 impl crate::RequestBuilder for UpdateSubscription {
1390 fn request_options(&mut self) -> &mut crate::RequestOptions {
1391 &mut self.0.options
1392 }
1393 }
1394
1395 #[derive(Clone, Debug)]
1416 pub struct ListSubscriptions(RequestBuilder<crate::model::ListSubscriptionsRequest>);
1417
1418 impl ListSubscriptions {
1419 pub(crate) fn new(
1420 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1421 ) -> Self {
1422 Self(RequestBuilder::new(stub))
1423 }
1424
1425 pub fn with_request<V: Into<crate::model::ListSubscriptionsRequest>>(
1427 mut self,
1428 v: V,
1429 ) -> Self {
1430 self.0.request = v.into();
1431 self
1432 }
1433
1434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1436 self.0.options = v.into();
1437 self
1438 }
1439
1440 pub async fn send(self) -> Result<crate::model::ListSubscriptionsResponse> {
1442 (*self.0.stub)
1443 .list_subscriptions(self.0.request, self.0.options)
1444 .await
1445 .map(crate::Response::into_body)
1446 }
1447
1448 pub fn by_page(
1450 self,
1451 ) -> impl google_cloud_gax::paginator::Paginator<
1452 crate::model::ListSubscriptionsResponse,
1453 crate::Error,
1454 > {
1455 use std::clone::Clone;
1456 let token = self.0.request.page_token.clone();
1457 let execute = move |token: String| {
1458 let mut builder = self.clone();
1459 builder.0.request = builder.0.request.set_page_token(token);
1460 builder.send()
1461 };
1462 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1463 }
1464
1465 pub fn by_item(
1467 self,
1468 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1469 crate::model::ListSubscriptionsResponse,
1470 crate::Error,
1471 > {
1472 use google_cloud_gax::paginator::Paginator;
1473 self.by_page().items()
1474 }
1475
1476 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1480 self.0.request.project = v.into();
1481 self
1482 }
1483
1484 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1486 self.0.request.page_size = v.into();
1487 self
1488 }
1489
1490 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1492 self.0.request.page_token = v.into();
1493 self
1494 }
1495 }
1496
1497 #[doc(hidden)]
1498 impl crate::RequestBuilder for ListSubscriptions {
1499 fn request_options(&mut self) -> &mut crate::RequestOptions {
1500 &mut self.0.options
1501 }
1502 }
1503
1504 #[derive(Clone, Debug)]
1521 pub struct DeleteSubscription(RequestBuilder<crate::model::DeleteSubscriptionRequest>);
1522
1523 impl DeleteSubscription {
1524 pub(crate) fn new(
1525 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1526 ) -> Self {
1527 Self(RequestBuilder::new(stub))
1528 }
1529
1530 pub fn with_request<V: Into<crate::model::DeleteSubscriptionRequest>>(
1532 mut self,
1533 v: V,
1534 ) -> Self {
1535 self.0.request = v.into();
1536 self
1537 }
1538
1539 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1541 self.0.options = v.into();
1542 self
1543 }
1544
1545 pub async fn send(self) -> Result<()> {
1547 (*self.0.stub)
1548 .delete_subscription(self.0.request, self.0.options)
1549 .await
1550 .map(crate::Response::into_body)
1551 }
1552
1553 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1557 self.0.request.subscription = v.into();
1558 self
1559 }
1560 }
1561
1562 #[doc(hidden)]
1563 impl crate::RequestBuilder for DeleteSubscription {
1564 fn request_options(&mut self) -> &mut crate::RequestOptions {
1565 &mut self.0.options
1566 }
1567 }
1568
1569 #[derive(Clone, Debug)]
1586 pub struct ModifyPushConfig(RequestBuilder<crate::model::ModifyPushConfigRequest>);
1587
1588 impl ModifyPushConfig {
1589 pub(crate) fn new(
1590 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1591 ) -> Self {
1592 Self(RequestBuilder::new(stub))
1593 }
1594
1595 pub fn with_request<V: Into<crate::model::ModifyPushConfigRequest>>(
1597 mut self,
1598 v: V,
1599 ) -> Self {
1600 self.0.request = v.into();
1601 self
1602 }
1603
1604 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1606 self.0.options = v.into();
1607 self
1608 }
1609
1610 pub async fn send(self) -> Result<()> {
1612 (*self.0.stub)
1613 .modify_push_config(self.0.request, self.0.options)
1614 .await
1615 .map(crate::Response::into_body)
1616 }
1617
1618 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.0.request.subscription = v.into();
1623 self
1624 }
1625
1626 pub fn set_push_config<T>(mut self, v: T) -> Self
1630 where
1631 T: std::convert::Into<crate::model::PushConfig>,
1632 {
1633 self.0.request.push_config = std::option::Option::Some(v.into());
1634 self
1635 }
1636
1637 pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
1641 where
1642 T: std::convert::Into<crate::model::PushConfig>,
1643 {
1644 self.0.request.push_config = v.map(|x| x.into());
1645 self
1646 }
1647 }
1648
1649 #[doc(hidden)]
1650 impl crate::RequestBuilder for ModifyPushConfig {
1651 fn request_options(&mut self) -> &mut crate::RequestOptions {
1652 &mut self.0.options
1653 }
1654 }
1655
1656 #[derive(Clone, Debug)]
1673 pub struct GetSnapshot(RequestBuilder<crate::model::GetSnapshotRequest>);
1674
1675 impl GetSnapshot {
1676 pub(crate) fn new(
1677 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1678 ) -> Self {
1679 Self(RequestBuilder::new(stub))
1680 }
1681
1682 pub fn with_request<V: Into<crate::model::GetSnapshotRequest>>(mut self, v: V) -> Self {
1684 self.0.request = v.into();
1685 self
1686 }
1687
1688 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1690 self.0.options = v.into();
1691 self
1692 }
1693
1694 pub async fn send(self) -> Result<crate::model::Snapshot> {
1696 (*self.0.stub)
1697 .get_snapshot(self.0.request, self.0.options)
1698 .await
1699 .map(crate::Response::into_body)
1700 }
1701
1702 pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1706 self.0.request.snapshot = v.into();
1707 self
1708 }
1709 }
1710
1711 #[doc(hidden)]
1712 impl crate::RequestBuilder for GetSnapshot {
1713 fn request_options(&mut self) -> &mut crate::RequestOptions {
1714 &mut self.0.options
1715 }
1716 }
1717
1718 #[derive(Clone, Debug)]
1739 pub struct ListSnapshots(RequestBuilder<crate::model::ListSnapshotsRequest>);
1740
1741 impl ListSnapshots {
1742 pub(crate) fn new(
1743 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1744 ) -> Self {
1745 Self(RequestBuilder::new(stub))
1746 }
1747
1748 pub fn with_request<V: Into<crate::model::ListSnapshotsRequest>>(mut self, v: V) -> Self {
1750 self.0.request = v.into();
1751 self
1752 }
1753
1754 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1756 self.0.options = v.into();
1757 self
1758 }
1759
1760 pub async fn send(self) -> Result<crate::model::ListSnapshotsResponse> {
1762 (*self.0.stub)
1763 .list_snapshots(self.0.request, self.0.options)
1764 .await
1765 .map(crate::Response::into_body)
1766 }
1767
1768 pub fn by_page(
1770 self,
1771 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSnapshotsResponse, crate::Error>
1772 {
1773 use std::clone::Clone;
1774 let token = self.0.request.page_token.clone();
1775 let execute = move |token: String| {
1776 let mut builder = self.clone();
1777 builder.0.request = builder.0.request.set_page_token(token);
1778 builder.send()
1779 };
1780 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1781 }
1782
1783 pub fn by_item(
1785 self,
1786 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1787 crate::model::ListSnapshotsResponse,
1788 crate::Error,
1789 > {
1790 use google_cloud_gax::paginator::Paginator;
1791 self.by_page().items()
1792 }
1793
1794 pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1798 self.0.request.project = v.into();
1799 self
1800 }
1801
1802 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1804 self.0.request.page_size = v.into();
1805 self
1806 }
1807
1808 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1810 self.0.request.page_token = v.into();
1811 self
1812 }
1813 }
1814
1815 #[doc(hidden)]
1816 impl crate::RequestBuilder for ListSnapshots {
1817 fn request_options(&mut self) -> &mut crate::RequestOptions {
1818 &mut self.0.options
1819 }
1820 }
1821
1822 #[derive(Clone, Debug)]
1839 pub struct CreateSnapshot(RequestBuilder<crate::model::CreateSnapshotRequest>);
1840
1841 impl CreateSnapshot {
1842 pub(crate) fn new(
1843 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1844 ) -> Self {
1845 Self(RequestBuilder::new(stub))
1846 }
1847
1848 pub fn with_request<V: Into<crate::model::CreateSnapshotRequest>>(mut self, v: V) -> Self {
1850 self.0.request = v.into();
1851 self
1852 }
1853
1854 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1856 self.0.options = v.into();
1857 self
1858 }
1859
1860 pub async fn send(self) -> Result<crate::model::Snapshot> {
1862 (*self.0.stub)
1863 .create_snapshot(self.0.request, self.0.options)
1864 .await
1865 .map(crate::Response::into_body)
1866 }
1867
1868 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1872 self.0.request.name = v.into();
1873 self
1874 }
1875
1876 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1880 self.0.request.subscription = v.into();
1881 self
1882 }
1883
1884 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1886 where
1887 T: std::iter::IntoIterator<Item = (K, V)>,
1888 K: std::convert::Into<std::string::String>,
1889 V: std::convert::Into<std::string::String>,
1890 {
1891 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1892 self
1893 }
1894
1895 pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1897 where
1898 T: std::iter::IntoIterator<Item = (K, V)>,
1899 K: std::convert::Into<std::string::String>,
1900 V: std::convert::Into<std::string::String>,
1901 {
1902 self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1903 self
1904 }
1905 }
1906
1907 #[doc(hidden)]
1908 impl crate::RequestBuilder for CreateSnapshot {
1909 fn request_options(&mut self) -> &mut crate::RequestOptions {
1910 &mut self.0.options
1911 }
1912 }
1913
1914 #[derive(Clone, Debug)]
1931 pub struct UpdateSnapshot(RequestBuilder<crate::model::UpdateSnapshotRequest>);
1932
1933 impl UpdateSnapshot {
1934 pub(crate) fn new(
1935 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1936 ) -> Self {
1937 Self(RequestBuilder::new(stub))
1938 }
1939
1940 pub fn with_request<V: Into<crate::model::UpdateSnapshotRequest>>(mut self, v: V) -> Self {
1942 self.0.request = v.into();
1943 self
1944 }
1945
1946 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1948 self.0.options = v.into();
1949 self
1950 }
1951
1952 pub async fn send(self) -> Result<crate::model::Snapshot> {
1954 (*self.0.stub)
1955 .update_snapshot(self.0.request, self.0.options)
1956 .await
1957 .map(crate::Response::into_body)
1958 }
1959
1960 pub fn set_snapshot<T>(mut self, v: T) -> Self
1964 where
1965 T: std::convert::Into<crate::model::Snapshot>,
1966 {
1967 self.0.request.snapshot = std::option::Option::Some(v.into());
1968 self
1969 }
1970
1971 pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
1975 where
1976 T: std::convert::Into<crate::model::Snapshot>,
1977 {
1978 self.0.request.snapshot = v.map(|x| x.into());
1979 self
1980 }
1981
1982 pub fn set_update_mask<T>(mut self, v: T) -> Self
1986 where
1987 T: std::convert::Into<wkt::FieldMask>,
1988 {
1989 self.0.request.update_mask = std::option::Option::Some(v.into());
1990 self
1991 }
1992
1993 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1997 where
1998 T: std::convert::Into<wkt::FieldMask>,
1999 {
2000 self.0.request.update_mask = v.map(|x| x.into());
2001 self
2002 }
2003 }
2004
2005 #[doc(hidden)]
2006 impl crate::RequestBuilder for UpdateSnapshot {
2007 fn request_options(&mut self) -> &mut crate::RequestOptions {
2008 &mut self.0.options
2009 }
2010 }
2011
2012 #[derive(Clone, Debug)]
2029 pub struct DeleteSnapshot(RequestBuilder<crate::model::DeleteSnapshotRequest>);
2030
2031 impl DeleteSnapshot {
2032 pub(crate) fn new(
2033 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2034 ) -> Self {
2035 Self(RequestBuilder::new(stub))
2036 }
2037
2038 pub fn with_request<V: Into<crate::model::DeleteSnapshotRequest>>(mut self, v: V) -> Self {
2040 self.0.request = v.into();
2041 self
2042 }
2043
2044 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2046 self.0.options = v.into();
2047 self
2048 }
2049
2050 pub async fn send(self) -> Result<()> {
2052 (*self.0.stub)
2053 .delete_snapshot(self.0.request, self.0.options)
2054 .await
2055 .map(crate::Response::into_body)
2056 }
2057
2058 pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
2062 self.0.request.snapshot = v.into();
2063 self
2064 }
2065 }
2066
2067 #[doc(hidden)]
2068 impl crate::RequestBuilder for DeleteSnapshot {
2069 fn request_options(&mut self) -> &mut crate::RequestOptions {
2070 &mut self.0.options
2071 }
2072 }
2073
2074 #[derive(Clone, Debug)]
2091 pub struct Seek(RequestBuilder<crate::model::SeekRequest>);
2092
2093 impl Seek {
2094 pub(crate) fn new(
2095 stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2096 ) -> Self {
2097 Self(RequestBuilder::new(stub))
2098 }
2099
2100 pub fn with_request<V: Into<crate::model::SeekRequest>>(mut self, v: V) -> Self {
2102 self.0.request = v.into();
2103 self
2104 }
2105
2106 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2108 self.0.options = v.into();
2109 self
2110 }
2111
2112 pub async fn send(self) -> Result<crate::model::SeekResponse> {
2114 (*self.0.stub)
2115 .seek(self.0.request, self.0.options)
2116 .await
2117 .map(crate::Response::into_body)
2118 }
2119
2120 pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
2124 self.0.request.subscription = v.into();
2125 self
2126 }
2127
2128 pub fn set_target<T: Into<Option<crate::model::seek_request::Target>>>(
2133 mut self,
2134 v: T,
2135 ) -> Self {
2136 self.0.request.target = v.into();
2137 self
2138 }
2139
2140 pub fn set_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2146 mut self,
2147 v: T,
2148 ) -> Self {
2149 self.0.request = self.0.request.set_time(v);
2150 self
2151 }
2152
2153 pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2159 self.0.request = self.0.request.set_snapshot(v);
2160 self
2161 }
2162 }
2163
2164 #[doc(hidden)]
2165 impl crate::RequestBuilder for Seek {
2166 fn request_options(&mut self) -> &mut crate::RequestOptions {
2167 &mut self.0.options
2168 }
2169 }
2170}
2171
2172pub mod schema_service {
2173 use crate::Result;
2174
2175 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2189
2190 pub(crate) mod client {
2191 use super::super::super::client::SchemaService;
2192 pub struct Factory;
2193 impl crate::ClientFactory for Factory {
2194 type Client = SchemaService;
2195 type Credentials = gaxi::options::Credentials;
2196 async fn build(
2197 self,
2198 config: gaxi::options::ClientConfig,
2199 ) -> crate::ClientBuilderResult<Self::Client> {
2200 Self::Client::new(config).await
2201 }
2202 }
2203 }
2204
2205 #[derive(Clone, Debug)]
2207 pub(crate) struct RequestBuilder<R: std::default::Default> {
2208 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2209 request: R,
2210 options: crate::RequestOptions,
2211 }
2212
2213 impl<R> RequestBuilder<R>
2214 where
2215 R: std::default::Default,
2216 {
2217 pub(crate) fn new(
2218 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2219 ) -> Self {
2220 Self {
2221 stub,
2222 request: R::default(),
2223 options: crate::RequestOptions::default(),
2224 }
2225 }
2226 }
2227
2228 #[derive(Clone, Debug)]
2245 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
2246
2247 impl CreateSchema {
2248 pub(crate) fn new(
2249 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2250 ) -> Self {
2251 Self(RequestBuilder::new(stub))
2252 }
2253
2254 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
2256 self.0.request = v.into();
2257 self
2258 }
2259
2260 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2262 self.0.options = v.into();
2263 self
2264 }
2265
2266 pub async fn send(self) -> Result<crate::model::Schema> {
2268 (*self.0.stub)
2269 .create_schema(self.0.request, self.0.options)
2270 .await
2271 .map(crate::Response::into_body)
2272 }
2273
2274 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278 self.0.request.parent = v.into();
2279 self
2280 }
2281
2282 pub fn set_schema<T>(mut self, v: T) -> Self
2286 where
2287 T: std::convert::Into<crate::model::Schema>,
2288 {
2289 self.0.request.schema = std::option::Option::Some(v.into());
2290 self
2291 }
2292
2293 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2297 where
2298 T: std::convert::Into<crate::model::Schema>,
2299 {
2300 self.0.request.schema = v.map(|x| x.into());
2301 self
2302 }
2303
2304 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2306 self.0.request.schema_id = v.into();
2307 self
2308 }
2309 }
2310
2311 #[doc(hidden)]
2312 impl crate::RequestBuilder for CreateSchema {
2313 fn request_options(&mut self) -> &mut crate::RequestOptions {
2314 &mut self.0.options
2315 }
2316 }
2317
2318 #[derive(Clone, Debug)]
2335 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
2336
2337 impl GetSchema {
2338 pub(crate) fn new(
2339 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2340 ) -> Self {
2341 Self(RequestBuilder::new(stub))
2342 }
2343
2344 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
2346 self.0.request = v.into();
2347 self
2348 }
2349
2350 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2352 self.0.options = v.into();
2353 self
2354 }
2355
2356 pub async fn send(self) -> Result<crate::model::Schema> {
2358 (*self.0.stub)
2359 .get_schema(self.0.request, self.0.options)
2360 .await
2361 .map(crate::Response::into_body)
2362 }
2363
2364 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2368 self.0.request.name = v.into();
2369 self
2370 }
2371
2372 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2374 self.0.request.view = v.into();
2375 self
2376 }
2377 }
2378
2379 #[doc(hidden)]
2380 impl crate::RequestBuilder for GetSchema {
2381 fn request_options(&mut self) -> &mut crate::RequestOptions {
2382 &mut self.0.options
2383 }
2384 }
2385
2386 #[derive(Clone, Debug)]
2407 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
2408
2409 impl ListSchemas {
2410 pub(crate) fn new(
2411 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2412 ) -> Self {
2413 Self(RequestBuilder::new(stub))
2414 }
2415
2416 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
2418 self.0.request = v.into();
2419 self
2420 }
2421
2422 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2424 self.0.options = v.into();
2425 self
2426 }
2427
2428 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
2430 (*self.0.stub)
2431 .list_schemas(self.0.request, self.0.options)
2432 .await
2433 .map(crate::Response::into_body)
2434 }
2435
2436 pub fn by_page(
2438 self,
2439 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
2440 {
2441 use std::clone::Clone;
2442 let token = self.0.request.page_token.clone();
2443 let execute = move |token: String| {
2444 let mut builder = self.clone();
2445 builder.0.request = builder.0.request.set_page_token(token);
2446 builder.send()
2447 };
2448 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2449 }
2450
2451 pub fn by_item(
2453 self,
2454 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2455 crate::model::ListSchemasResponse,
2456 crate::Error,
2457 > {
2458 use google_cloud_gax::paginator::Paginator;
2459 self.by_page().items()
2460 }
2461
2462 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2466 self.0.request.parent = v.into();
2467 self
2468 }
2469
2470 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2472 self.0.request.view = v.into();
2473 self
2474 }
2475
2476 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2478 self.0.request.page_size = v.into();
2479 self
2480 }
2481
2482 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2484 self.0.request.page_token = v.into();
2485 self
2486 }
2487 }
2488
2489 #[doc(hidden)]
2490 impl crate::RequestBuilder for ListSchemas {
2491 fn request_options(&mut self) -> &mut crate::RequestOptions {
2492 &mut self.0.options
2493 }
2494 }
2495
2496 #[derive(Clone, Debug)]
2517 pub struct ListSchemaRevisions(RequestBuilder<crate::model::ListSchemaRevisionsRequest>);
2518
2519 impl ListSchemaRevisions {
2520 pub(crate) fn new(
2521 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2522 ) -> Self {
2523 Self(RequestBuilder::new(stub))
2524 }
2525
2526 pub fn with_request<V: Into<crate::model::ListSchemaRevisionsRequest>>(
2528 mut self,
2529 v: V,
2530 ) -> Self {
2531 self.0.request = v.into();
2532 self
2533 }
2534
2535 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2537 self.0.options = v.into();
2538 self
2539 }
2540
2541 pub async fn send(self) -> Result<crate::model::ListSchemaRevisionsResponse> {
2543 (*self.0.stub)
2544 .list_schema_revisions(self.0.request, self.0.options)
2545 .await
2546 .map(crate::Response::into_body)
2547 }
2548
2549 pub fn by_page(
2551 self,
2552 ) -> impl google_cloud_gax::paginator::Paginator<
2553 crate::model::ListSchemaRevisionsResponse,
2554 crate::Error,
2555 > {
2556 use std::clone::Clone;
2557 let token = self.0.request.page_token.clone();
2558 let execute = move |token: String| {
2559 let mut builder = self.clone();
2560 builder.0.request = builder.0.request.set_page_token(token);
2561 builder.send()
2562 };
2563 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2564 }
2565
2566 pub fn by_item(
2568 self,
2569 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2570 crate::model::ListSchemaRevisionsResponse,
2571 crate::Error,
2572 > {
2573 use google_cloud_gax::paginator::Paginator;
2574 self.by_page().items()
2575 }
2576
2577 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2581 self.0.request.name = v.into();
2582 self
2583 }
2584
2585 pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2587 self.0.request.view = v.into();
2588 self
2589 }
2590
2591 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2593 self.0.request.page_size = v.into();
2594 self
2595 }
2596
2597 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2599 self.0.request.page_token = v.into();
2600 self
2601 }
2602 }
2603
2604 #[doc(hidden)]
2605 impl crate::RequestBuilder for ListSchemaRevisions {
2606 fn request_options(&mut self) -> &mut crate::RequestOptions {
2607 &mut self.0.options
2608 }
2609 }
2610
2611 #[derive(Clone, Debug)]
2628 pub struct CommitSchema(RequestBuilder<crate::model::CommitSchemaRequest>);
2629
2630 impl CommitSchema {
2631 pub(crate) fn new(
2632 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2633 ) -> Self {
2634 Self(RequestBuilder::new(stub))
2635 }
2636
2637 pub fn with_request<V: Into<crate::model::CommitSchemaRequest>>(mut self, v: V) -> Self {
2639 self.0.request = v.into();
2640 self
2641 }
2642
2643 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2645 self.0.options = v.into();
2646 self
2647 }
2648
2649 pub async fn send(self) -> Result<crate::model::Schema> {
2651 (*self.0.stub)
2652 .commit_schema(self.0.request, self.0.options)
2653 .await
2654 .map(crate::Response::into_body)
2655 }
2656
2657 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2661 self.0.request.name = v.into();
2662 self
2663 }
2664
2665 pub fn set_schema<T>(mut self, v: T) -> Self
2669 where
2670 T: std::convert::Into<crate::model::Schema>,
2671 {
2672 self.0.request.schema = std::option::Option::Some(v.into());
2673 self
2674 }
2675
2676 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2680 where
2681 T: std::convert::Into<crate::model::Schema>,
2682 {
2683 self.0.request.schema = v.map(|x| x.into());
2684 self
2685 }
2686 }
2687
2688 #[doc(hidden)]
2689 impl crate::RequestBuilder for CommitSchema {
2690 fn request_options(&mut self) -> &mut crate::RequestOptions {
2691 &mut self.0.options
2692 }
2693 }
2694
2695 #[derive(Clone, Debug)]
2712 pub struct RollbackSchema(RequestBuilder<crate::model::RollbackSchemaRequest>);
2713
2714 impl RollbackSchema {
2715 pub(crate) fn new(
2716 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2717 ) -> Self {
2718 Self(RequestBuilder::new(stub))
2719 }
2720
2721 pub fn with_request<V: Into<crate::model::RollbackSchemaRequest>>(mut self, v: V) -> Self {
2723 self.0.request = v.into();
2724 self
2725 }
2726
2727 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2729 self.0.options = v.into();
2730 self
2731 }
2732
2733 pub async fn send(self) -> Result<crate::model::Schema> {
2735 (*self.0.stub)
2736 .rollback_schema(self.0.request, self.0.options)
2737 .await
2738 .map(crate::Response::into_body)
2739 }
2740
2741 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2745 self.0.request.name = v.into();
2746 self
2747 }
2748
2749 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2753 self.0.request.revision_id = v.into();
2754 self
2755 }
2756 }
2757
2758 #[doc(hidden)]
2759 impl crate::RequestBuilder for RollbackSchema {
2760 fn request_options(&mut self) -> &mut crate::RequestOptions {
2761 &mut self.0.options
2762 }
2763 }
2764
2765 #[derive(Clone, Debug)]
2782 pub struct DeleteSchemaRevision(RequestBuilder<crate::model::DeleteSchemaRevisionRequest>);
2783
2784 impl DeleteSchemaRevision {
2785 pub(crate) fn new(
2786 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2787 ) -> Self {
2788 Self(RequestBuilder::new(stub))
2789 }
2790
2791 pub fn with_request<V: Into<crate::model::DeleteSchemaRevisionRequest>>(
2793 mut self,
2794 v: V,
2795 ) -> Self {
2796 self.0.request = v.into();
2797 self
2798 }
2799
2800 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2802 self.0.options = v.into();
2803 self
2804 }
2805
2806 pub async fn send(self) -> Result<crate::model::Schema> {
2808 (*self.0.stub)
2809 .delete_schema_revision(self.0.request, self.0.options)
2810 .await
2811 .map(crate::Response::into_body)
2812 }
2813
2814 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2818 self.0.request.name = v.into();
2819 self
2820 }
2821
2822 #[deprecated]
2824 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2825 self.0.request.revision_id = v.into();
2826 self
2827 }
2828 }
2829
2830 #[doc(hidden)]
2831 impl crate::RequestBuilder for DeleteSchemaRevision {
2832 fn request_options(&mut self) -> &mut crate::RequestOptions {
2833 &mut self.0.options
2834 }
2835 }
2836
2837 #[derive(Clone, Debug)]
2854 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
2855
2856 impl DeleteSchema {
2857 pub(crate) fn new(
2858 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2859 ) -> Self {
2860 Self(RequestBuilder::new(stub))
2861 }
2862
2863 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
2865 self.0.request = v.into();
2866 self
2867 }
2868
2869 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2871 self.0.options = v.into();
2872 self
2873 }
2874
2875 pub async fn send(self) -> Result<()> {
2877 (*self.0.stub)
2878 .delete_schema(self.0.request, self.0.options)
2879 .await
2880 .map(crate::Response::into_body)
2881 }
2882
2883 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2887 self.0.request.name = v.into();
2888 self
2889 }
2890 }
2891
2892 #[doc(hidden)]
2893 impl crate::RequestBuilder for DeleteSchema {
2894 fn request_options(&mut self) -> &mut crate::RequestOptions {
2895 &mut self.0.options
2896 }
2897 }
2898
2899 #[derive(Clone, Debug)]
2916 pub struct ValidateSchema(RequestBuilder<crate::model::ValidateSchemaRequest>);
2917
2918 impl ValidateSchema {
2919 pub(crate) fn new(
2920 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2921 ) -> Self {
2922 Self(RequestBuilder::new(stub))
2923 }
2924
2925 pub fn with_request<V: Into<crate::model::ValidateSchemaRequest>>(mut self, v: V) -> Self {
2927 self.0.request = v.into();
2928 self
2929 }
2930
2931 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2933 self.0.options = v.into();
2934 self
2935 }
2936
2937 pub async fn send(self) -> Result<crate::model::ValidateSchemaResponse> {
2939 (*self.0.stub)
2940 .validate_schema(self.0.request, self.0.options)
2941 .await
2942 .map(crate::Response::into_body)
2943 }
2944
2945 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2949 self.0.request.parent = v.into();
2950 self
2951 }
2952
2953 pub fn set_schema<T>(mut self, v: T) -> Self
2957 where
2958 T: std::convert::Into<crate::model::Schema>,
2959 {
2960 self.0.request.schema = std::option::Option::Some(v.into());
2961 self
2962 }
2963
2964 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2968 where
2969 T: std::convert::Into<crate::model::Schema>,
2970 {
2971 self.0.request.schema = v.map(|x| x.into());
2972 self
2973 }
2974 }
2975
2976 #[doc(hidden)]
2977 impl crate::RequestBuilder for ValidateSchema {
2978 fn request_options(&mut self) -> &mut crate::RequestOptions {
2979 &mut self.0.options
2980 }
2981 }
2982
2983 #[derive(Clone, Debug)]
3000 pub struct ValidateMessage(RequestBuilder<crate::model::ValidateMessageRequest>);
3001
3002 impl ValidateMessage {
3003 pub(crate) fn new(
3004 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3005 ) -> Self {
3006 Self(RequestBuilder::new(stub))
3007 }
3008
3009 pub fn with_request<V: Into<crate::model::ValidateMessageRequest>>(mut self, v: V) -> Self {
3011 self.0.request = v.into();
3012 self
3013 }
3014
3015 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3017 self.0.options = v.into();
3018 self
3019 }
3020
3021 pub async fn send(self) -> Result<crate::model::ValidateMessageResponse> {
3023 (*self.0.stub)
3024 .validate_message(self.0.request, self.0.options)
3025 .await
3026 .map(crate::Response::into_body)
3027 }
3028
3029 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3033 self.0.request.parent = v.into();
3034 self
3035 }
3036
3037 pub fn set_message<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3039 self.0.request.message = v.into();
3040 self
3041 }
3042
3043 pub fn set_encoding<T: Into<crate::model::Encoding>>(mut self, v: T) -> Self {
3045 self.0.request.encoding = v.into();
3046 self
3047 }
3048
3049 pub fn set_schema_spec<
3054 T: Into<Option<crate::model::validate_message_request::SchemaSpec>>,
3055 >(
3056 mut self,
3057 v: T,
3058 ) -> Self {
3059 self.0.request.schema_spec = v.into();
3060 self
3061 }
3062
3063 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3069 self.0.request = self.0.request.set_name(v);
3070 self
3071 }
3072
3073 pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
3079 mut self,
3080 v: T,
3081 ) -> Self {
3082 self.0.request = self.0.request.set_schema(v);
3083 self
3084 }
3085 }
3086
3087 #[doc(hidden)]
3088 impl crate::RequestBuilder for ValidateMessage {
3089 fn request_options(&mut self) -> &mut crate::RequestOptions {
3090 &mut self.0.options
3091 }
3092 }
3093
3094 #[derive(Clone, Debug)]
3111 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3112
3113 impl SetIamPolicy {
3114 pub(crate) fn new(
3115 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3116 ) -> Self {
3117 Self(RequestBuilder::new(stub))
3118 }
3119
3120 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3122 mut self,
3123 v: V,
3124 ) -> Self {
3125 self.0.request = v.into();
3126 self
3127 }
3128
3129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3131 self.0.options = v.into();
3132 self
3133 }
3134
3135 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3137 (*self.0.stub)
3138 .set_iam_policy(self.0.request, self.0.options)
3139 .await
3140 .map(crate::Response::into_body)
3141 }
3142
3143 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3147 self.0.request.resource = v.into();
3148 self
3149 }
3150
3151 pub fn set_policy<T>(mut self, v: T) -> Self
3155 where
3156 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3157 {
3158 self.0.request.policy = std::option::Option::Some(v.into());
3159 self
3160 }
3161
3162 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3166 where
3167 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3168 {
3169 self.0.request.policy = v.map(|x| x.into());
3170 self
3171 }
3172
3173 pub fn set_update_mask<T>(mut self, v: T) -> Self
3175 where
3176 T: std::convert::Into<wkt::FieldMask>,
3177 {
3178 self.0.request.update_mask = std::option::Option::Some(v.into());
3179 self
3180 }
3181
3182 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3184 where
3185 T: std::convert::Into<wkt::FieldMask>,
3186 {
3187 self.0.request.update_mask = v.map(|x| x.into());
3188 self
3189 }
3190 }
3191
3192 #[doc(hidden)]
3193 impl crate::RequestBuilder for SetIamPolicy {
3194 fn request_options(&mut self) -> &mut crate::RequestOptions {
3195 &mut self.0.options
3196 }
3197 }
3198
3199 #[derive(Clone, Debug)]
3216 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3217
3218 impl GetIamPolicy {
3219 pub(crate) fn new(
3220 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3221 ) -> Self {
3222 Self(RequestBuilder::new(stub))
3223 }
3224
3225 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3227 mut self,
3228 v: V,
3229 ) -> Self {
3230 self.0.request = v.into();
3231 self
3232 }
3233
3234 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3236 self.0.options = v.into();
3237 self
3238 }
3239
3240 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3242 (*self.0.stub)
3243 .get_iam_policy(self.0.request, self.0.options)
3244 .await
3245 .map(crate::Response::into_body)
3246 }
3247
3248 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3252 self.0.request.resource = v.into();
3253 self
3254 }
3255
3256 pub fn set_options<T>(mut self, v: T) -> Self
3258 where
3259 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3260 {
3261 self.0.request.options = std::option::Option::Some(v.into());
3262 self
3263 }
3264
3265 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3267 where
3268 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3269 {
3270 self.0.request.options = v.map(|x| x.into());
3271 self
3272 }
3273 }
3274
3275 #[doc(hidden)]
3276 impl crate::RequestBuilder for GetIamPolicy {
3277 fn request_options(&mut self) -> &mut crate::RequestOptions {
3278 &mut self.0.options
3279 }
3280 }
3281
3282 #[derive(Clone, Debug)]
3299 pub struct TestIamPermissions(
3300 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3301 );
3302
3303 impl TestIamPermissions {
3304 pub(crate) fn new(
3305 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3306 ) -> Self {
3307 Self(RequestBuilder::new(stub))
3308 }
3309
3310 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3312 mut self,
3313 v: V,
3314 ) -> Self {
3315 self.0.request = v.into();
3316 self
3317 }
3318
3319 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3321 self.0.options = v.into();
3322 self
3323 }
3324
3325 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3327 (*self.0.stub)
3328 .test_iam_permissions(self.0.request, self.0.options)
3329 .await
3330 .map(crate::Response::into_body)
3331 }
3332
3333 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3337 self.0.request.resource = v.into();
3338 self
3339 }
3340
3341 pub fn set_permissions<T, V>(mut self, v: T) -> Self
3345 where
3346 T: std::iter::IntoIterator<Item = V>,
3347 V: std::convert::Into<std::string::String>,
3348 {
3349 use std::iter::Iterator;
3350 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3351 self
3352 }
3353 }
3354
3355 #[doc(hidden)]
3356 impl crate::RequestBuilder for TestIamPermissions {
3357 fn request_options(&mut self) -> &mut crate::RequestOptions {
3358 &mut self.0.options
3359 }
3360 }
3361}