Skip to main content

google_cloud_pubsub/generated/gapic/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17/// Request and client builders for [TopicAdmin][crate::client::TopicAdmin].
18pub mod topic_admin {
19    use crate::Result;
20
21    /// A builder for [TopicAdmin][crate::client::TopicAdmin].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_pubsub::*;
26    /// # use builder::topic_admin::ClientBuilder;
27    /// # use client::TopicAdmin;
28    /// let builder : ClientBuilder = TopicAdmin::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://pubsub.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    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    /// Common implementation for [crate::client::TopicAdmin] request builders.
52    #[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    /// The request builder for [TopicAdmin::create_topic][crate::client::TopicAdmin::create_topic] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_pubsub::builder::topic_admin::CreateTopic;
79    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> CreateTopic {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[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        /// Sets the full request, replacing any prior values.
101        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        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        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        /// Sets the value of [name][crate::model::Topic::name].
121        ///
122        /// This is a **required** field for requests.
123        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        /// Sets the value of [labels][crate::model::Topic::labels].
129        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        /// Sets the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
140        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        /// Sets or clears the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
149        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        /// Sets the value of [kms_key_name][crate::model::Topic::kms_key_name].
158        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        /// Sets the value of [schema_settings][crate::model::Topic::schema_settings].
164        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        /// Sets or clears the value of [schema_settings][crate::model::Topic::schema_settings].
173        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        /// Sets the value of [satisfies_pzs][crate::model::Topic::satisfies_pzs].
182        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        /// Sets the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
188        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        /// Sets or clears the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
197        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        /// Sets the value of [state][crate::model::Topic::state].
209        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        /// Sets the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
215        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        /// Sets or clears the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
224        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        /// Sets the value of [message_transforms][crate::model::Topic::message_transforms].
236        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        /// Sets the value of [tags][crate::model::Topic::tags].
247        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    /// The request builder for [TopicAdmin::update_topic][crate::client::TopicAdmin::update_topic] calls.
266    ///
267    /// # Example
268    /// ```
269    /// # use google_cloud_pubsub::builder::topic_admin::UpdateTopic;
270    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
271    ///
272    /// let builder = prepare_request_builder();
273    /// let response = builder.send().await?;
274    /// # Ok(()) }
275    ///
276    /// fn prepare_request_builder() -> UpdateTopic {
277    ///   # panic!();
278    ///   // ... details omitted ...
279    /// }
280    /// ```
281    #[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        /// Sets the full request, replacing any prior values.
292        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        /// Sets all the options, replacing any prior values.
298        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299            self.0.options = v.into();
300            self
301        }
302
303        /// Sends the request.
304        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        /// Sets the value of [topic][crate::model::UpdateTopicRequest::topic].
312        ///
313        /// This is a **required** field for requests.
314        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        /// Sets or clears the value of [topic][crate::model::UpdateTopicRequest::topic].
323        ///
324        /// This is a **required** field for requests.
325        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        /// Sets the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
334        ///
335        /// This is a **required** field for requests.
336        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        /// Sets or clears the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
345        ///
346        /// This is a **required** field for requests.
347        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    /// The request builder for [TopicAdmin::get_topic][crate::client::TopicAdmin::get_topic] calls.
364    ///
365    /// # Example
366    /// ```
367    /// # use google_cloud_pubsub::builder::topic_admin::GetTopic;
368    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
369    ///
370    /// let builder = prepare_request_builder();
371    /// let response = builder.send().await?;
372    /// # Ok(()) }
373    ///
374    /// fn prepare_request_builder() -> GetTopic {
375    ///   # panic!();
376    ///   // ... details omitted ...
377    /// }
378    /// ```
379    #[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        /// Sets the full request, replacing any prior values.
390        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        /// Sets all the options, replacing any prior values.
396        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
397            self.0.options = v.into();
398            self
399        }
400
401        /// Sends the request.
402        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        /// Sets the value of [topic][crate::model::GetTopicRequest::topic].
410        ///
411        /// This is a **required** field for requests.
412        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    /// The request builder for [TopicAdmin::list_topics][crate::client::TopicAdmin::list_topics] calls.
426    ///
427    /// # Example
428    /// ```
429    /// # use google_cloud_pubsub::builder::topic_admin::ListTopics;
430    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
431    /// use google_cloud_gax::paginator::ItemPaginator;
432    ///
433    /// let builder = prepare_request_builder();
434    /// let mut items = builder.by_item();
435    /// while let Some(result) = items.next().await {
436    ///   let item = result?;
437    /// }
438    /// # Ok(()) }
439    ///
440    /// fn prepare_request_builder() -> ListTopics {
441    ///   # panic!();
442    ///   // ... details omitted ...
443    /// }
444    /// ```
445    #[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        /// Sets the full request, replacing any prior values.
456        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        /// Sets all the options, replacing any prior values.
462        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
463            self.0.options = v.into();
464            self
465        }
466
467        /// Sends the request.
468        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        /// Streams each page in the collection.
476        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        /// Streams each item in the collection.
491        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        /// Sets the value of [project][crate::model::ListTopicsRequest::project].
502        ///
503        /// This is a **required** field for requests.
504        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        /// Sets the value of [page_size][crate::model::ListTopicsRequest::page_size].
510        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        /// Sets the value of [page_token][crate::model::ListTopicsRequest::page_token].
516        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    /// The request builder for [TopicAdmin::list_topic_subscriptions][crate::client::TopicAdmin::list_topic_subscriptions] calls.
530    ///
531    /// # Example
532    /// ```
533    /// # use google_cloud_pubsub::builder::topic_admin::ListTopicSubscriptions;
534    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
535    /// use google_cloud_gax::paginator::ItemPaginator;
536    ///
537    /// let builder = prepare_request_builder();
538    /// let mut items = builder.by_item();
539    /// while let Some(result) = items.next().await {
540    ///   let item = result?;
541    /// }
542    /// # Ok(()) }
543    ///
544    /// fn prepare_request_builder() -> ListTopicSubscriptions {
545    ///   # panic!();
546    ///   // ... details omitted ...
547    /// }
548    /// ```
549    #[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        /// Sets the full request, replacing any prior values.
560        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        /// Sets all the options, replacing any prior values.
569        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
570            self.0.options = v.into();
571            self
572        }
573
574        /// Sends the request.
575        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        /// Streams each page in the collection.
583        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        /// Streams each item in the collection.
600        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        /// Sets the value of [topic][crate::model::ListTopicSubscriptionsRequest::topic].
611        ///
612        /// This is a **required** field for requests.
613        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        /// Sets the value of [page_size][crate::model::ListTopicSubscriptionsRequest::page_size].
619        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        /// Sets the value of [page_token][crate::model::ListTopicSubscriptionsRequest::page_token].
625        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    /// The request builder for [TopicAdmin::list_topic_snapshots][crate::client::TopicAdmin::list_topic_snapshots] calls.
639    ///
640    /// # Example
641    /// ```
642    /// # use google_cloud_pubsub::builder::topic_admin::ListTopicSnapshots;
643    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
644    ///
645    /// let builder = prepare_request_builder();
646    /// let response = builder.send().await?;
647    /// # Ok(()) }
648    ///
649    /// fn prepare_request_builder() -> ListTopicSnapshots {
650    ///   # panic!();
651    ///   // ... details omitted ...
652    /// }
653    /// ```
654    #[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        /// Sets the full request, replacing any prior values.
665        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        /// Sets all the options, replacing any prior values.
674        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
675            self.0.options = v.into();
676            self
677        }
678
679        /// Sends the request.
680        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        /// Sets the value of [topic][crate::model::ListTopicSnapshotsRequest::topic].
688        ///
689        /// This is a **required** field for requests.
690        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        /// Sets the value of [page_size][crate::model::ListTopicSnapshotsRequest::page_size].
696        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        /// Sets the value of [page_token][crate::model::ListTopicSnapshotsRequest::page_token].
702        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    /// The request builder for [TopicAdmin::delete_topic][crate::client::TopicAdmin::delete_topic] calls.
716    ///
717    /// # Example
718    /// ```
719    /// # use google_cloud_pubsub::builder::topic_admin::DeleteTopic;
720    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
721    ///
722    /// let builder = prepare_request_builder();
723    /// let response = builder.send().await?;
724    /// # Ok(()) }
725    ///
726    /// fn prepare_request_builder() -> DeleteTopic {
727    ///   # panic!();
728    ///   // ... details omitted ...
729    /// }
730    /// ```
731    #[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        /// Sets the full request, replacing any prior values.
742        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        /// Sets all the options, replacing any prior values.
748        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
749            self.0.options = v.into();
750            self
751        }
752
753        /// Sends the request.
754        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        /// Sets the value of [topic][crate::model::DeleteTopicRequest::topic].
762        ///
763        /// This is a **required** field for requests.
764        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    /// The request builder for [TopicAdmin::detach_subscription][crate::client::TopicAdmin::detach_subscription] calls.
778    ///
779    /// # Example
780    /// ```
781    /// # use google_cloud_pubsub::builder::topic_admin::DetachSubscription;
782    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
783    ///
784    /// let builder = prepare_request_builder();
785    /// let response = builder.send().await?;
786    /// # Ok(()) }
787    ///
788    /// fn prepare_request_builder() -> DetachSubscription {
789    ///   # panic!();
790    ///   // ... details omitted ...
791    /// }
792    /// ```
793    #[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        /// Sets the full request, replacing any prior values.
804        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        /// Sets all the options, replacing any prior values.
813        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
814            self.0.options = v.into();
815            self
816        }
817
818        /// Sends the request.
819        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        /// Sets the value of [subscription][crate::model::DetachSubscriptionRequest::subscription].
827        ///
828        /// This is a **required** field for requests.
829        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
843/// Request and client builders for [SubscriptionAdmin][crate::client::SubscriptionAdmin].
844pub mod subscription_admin {
845    use crate::Result;
846
847    /// A builder for [SubscriptionAdmin][crate::client::SubscriptionAdmin].
848    ///
849    /// ```
850    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
851    /// # use google_cloud_pubsub::*;
852    /// # use builder::subscription_admin::ClientBuilder;
853    /// # use client::SubscriptionAdmin;
854    /// let builder : ClientBuilder = SubscriptionAdmin::builder();
855    /// let client = builder
856    ///     .with_endpoint("https://pubsub.googleapis.com")
857    ///     .build().await?;
858    /// # Ok(()) }
859    /// ```
860    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    /// Common implementation for [crate::client::SubscriptionAdmin] request builders.
878    #[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    /// The request builder for [SubscriptionAdmin::create_subscription][crate::client::SubscriptionAdmin::create_subscription] calls.
901    ///
902    /// # Example
903    /// ```
904    /// # use google_cloud_pubsub::builder::subscription_admin::CreateSubscription;
905    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
906    ///
907    /// let builder = prepare_request_builder();
908    /// let response = builder.send().await?;
909    /// # Ok(()) }
910    ///
911    /// fn prepare_request_builder() -> CreateSubscription {
912    ///   # panic!();
913    ///   // ... details omitted ...
914    /// }
915    /// ```
916    #[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        /// Sets the full request, replacing any prior values.
927        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        /// Sets all the options, replacing any prior values.
933        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
934            self.0.options = v.into();
935            self
936        }
937
938        /// Sends the request.
939        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        /// Sets the value of [name][crate::model::Subscription::name].
947        ///
948        /// This is a **required** field for requests.
949        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        /// Sets the value of [topic][crate::model::Subscription::topic].
955        ///
956        /// This is a **required** field for requests.
957        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        /// Sets the value of [push_config][crate::model::Subscription::push_config].
963        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        /// Sets or clears the value of [push_config][crate::model::Subscription::push_config].
972        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        /// Sets the value of [bigquery_config][crate::model::Subscription::bigquery_config].
981        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        /// Sets or clears the value of [bigquery_config][crate::model::Subscription::bigquery_config].
990        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        /// Sets the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
999        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        /// Sets or clears the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
1008        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        /// Sets the value of [bigtable_config][crate::model::Subscription::bigtable_config].
1017        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        /// Sets or clears the value of [bigtable_config][crate::model::Subscription::bigtable_config].
1026        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        /// Sets the value of [ack_deadline_seconds][crate::model::Subscription::ack_deadline_seconds].
1035        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        /// Sets the value of [retain_acked_messages][crate::model::Subscription::retain_acked_messages].
1041        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        /// Sets the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
1047        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        /// Sets or clears the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
1056        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        /// Sets the value of [labels][crate::model::Subscription::labels].
1068        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        /// Sets the value of [enable_message_ordering][crate::model::Subscription::enable_message_ordering].
1079        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        /// Sets the value of [expiration_policy][crate::model::Subscription::expiration_policy].
1085        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        /// Sets or clears the value of [expiration_policy][crate::model::Subscription::expiration_policy].
1094        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        /// Sets the value of [filter][crate::model::Subscription::filter].
1103        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        /// Sets the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
1109        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        /// Sets or clears the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
1118        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        /// Sets the value of [retry_policy][crate::model::Subscription::retry_policy].
1127        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        /// Sets or clears the value of [retry_policy][crate::model::Subscription::retry_policy].
1136        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        /// Sets the value of [detached][crate::model::Subscription::detached].
1145        pub fn set_detached<T: Into<bool>>(mut self, v: T) -> Self {
1146            self.0.request.detached = v.into();
1147            self
1148        }
1149
1150        /// Sets the value of [enable_exactly_once_delivery][crate::model::Subscription::enable_exactly_once_delivery].
1151        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        /// Sets the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
1157        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        /// Sets or clears the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
1166        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        /// Sets the value of [state][crate::model::Subscription::state].
1178        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        /// Sets the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
1184        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        /// Sets or clears the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
1193        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        /// Sets the value of [message_transforms][crate::model::Subscription::message_transforms].
1205        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        /// Sets the value of [tags][crate::model::Subscription::tags].
1216        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    /// The request builder for [SubscriptionAdmin::get_subscription][crate::client::SubscriptionAdmin::get_subscription] calls.
1235    ///
1236    /// # Example
1237    /// ```
1238    /// # use google_cloud_pubsub::builder::subscription_admin::GetSubscription;
1239    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1240    ///
1241    /// let builder = prepare_request_builder();
1242    /// let response = builder.send().await?;
1243    /// # Ok(()) }
1244    ///
1245    /// fn prepare_request_builder() -> GetSubscription {
1246    ///   # panic!();
1247    ///   // ... details omitted ...
1248    /// }
1249    /// ```
1250    #[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        /// Sets the full request, replacing any prior values.
1261        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        /// Sets all the options, replacing any prior values.
1267        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1268            self.0.options = v.into();
1269            self
1270        }
1271
1272        /// Sends the request.
1273        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        /// Sets the value of [subscription][crate::model::GetSubscriptionRequest::subscription].
1281        ///
1282        /// This is a **required** field for requests.
1283        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    /// The request builder for [SubscriptionAdmin::update_subscription][crate::client::SubscriptionAdmin::update_subscription] calls.
1297    ///
1298    /// # Example
1299    /// ```
1300    /// # use google_cloud_pubsub::builder::subscription_admin::UpdateSubscription;
1301    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1302    ///
1303    /// let builder = prepare_request_builder();
1304    /// let response = builder.send().await?;
1305    /// # Ok(()) }
1306    ///
1307    /// fn prepare_request_builder() -> UpdateSubscription {
1308    ///   # panic!();
1309    ///   // ... details omitted ...
1310    /// }
1311    /// ```
1312    #[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        /// Sets the full request, replacing any prior values.
1323        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        /// Sets all the options, replacing any prior values.
1332        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1333            self.0.options = v.into();
1334            self
1335        }
1336
1337        /// Sends the request.
1338        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        /// Sets the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
1346        ///
1347        /// This is a **required** field for requests.
1348        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        /// Sets or clears the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
1357        ///
1358        /// This is a **required** field for requests.
1359        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        /// Sets the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
1368        ///
1369        /// This is a **required** field for requests.
1370        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        /// Sets or clears the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
1379        ///
1380        /// This is a **required** field for requests.
1381        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    /// The request builder for [SubscriptionAdmin::list_subscriptions][crate::client::SubscriptionAdmin::list_subscriptions] calls.
1398    ///
1399    /// # Example
1400    /// ```
1401    /// # use google_cloud_pubsub::builder::subscription_admin::ListSubscriptions;
1402    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1403    /// use google_cloud_gax::paginator::ItemPaginator;
1404    ///
1405    /// let builder = prepare_request_builder();
1406    /// let mut items = builder.by_item();
1407    /// while let Some(result) = items.next().await {
1408    ///   let item = result?;
1409    /// }
1410    /// # Ok(()) }
1411    ///
1412    /// fn prepare_request_builder() -> ListSubscriptions {
1413    ///   # panic!();
1414    ///   // ... details omitted ...
1415    /// }
1416    /// ```
1417    #[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        /// Sets the full request, replacing any prior values.
1428        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        /// Sets all the options, replacing any prior values.
1437        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1438            self.0.options = v.into();
1439            self
1440        }
1441
1442        /// Sends the request.
1443        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        /// Streams each page in the collection.
1451        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        /// Streams each item in the collection.
1468        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        /// Sets the value of [project][crate::model::ListSubscriptionsRequest::project].
1479        ///
1480        /// This is a **required** field for requests.
1481        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        /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
1487        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        /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
1493        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    /// The request builder for [SubscriptionAdmin::delete_subscription][crate::client::SubscriptionAdmin::delete_subscription] calls.
1507    ///
1508    /// # Example
1509    /// ```
1510    /// # use google_cloud_pubsub::builder::subscription_admin::DeleteSubscription;
1511    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1512    ///
1513    /// let builder = prepare_request_builder();
1514    /// let response = builder.send().await?;
1515    /// # Ok(()) }
1516    ///
1517    /// fn prepare_request_builder() -> DeleteSubscription {
1518    ///   # panic!();
1519    ///   // ... details omitted ...
1520    /// }
1521    /// ```
1522    #[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        /// Sets the full request, replacing any prior values.
1533        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        /// Sets all the options, replacing any prior values.
1542        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1543            self.0.options = v.into();
1544            self
1545        }
1546
1547        /// Sends the request.
1548        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        /// Sets the value of [subscription][crate::model::DeleteSubscriptionRequest::subscription].
1556        ///
1557        /// This is a **required** field for requests.
1558        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    /// The request builder for [SubscriptionAdmin::modify_push_config][crate::client::SubscriptionAdmin::modify_push_config] calls.
1572    ///
1573    /// # Example
1574    /// ```
1575    /// # use google_cloud_pubsub::builder::subscription_admin::ModifyPushConfig;
1576    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1577    ///
1578    /// let builder = prepare_request_builder();
1579    /// let response = builder.send().await?;
1580    /// # Ok(()) }
1581    ///
1582    /// fn prepare_request_builder() -> ModifyPushConfig {
1583    ///   # panic!();
1584    ///   // ... details omitted ...
1585    /// }
1586    /// ```
1587    #[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        /// Sets the full request, replacing any prior values.
1598        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        /// Sets all the options, replacing any prior values.
1607        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1608            self.0.options = v.into();
1609            self
1610        }
1611
1612        /// Sends the request.
1613        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        /// Sets the value of [subscription][crate::model::ModifyPushConfigRequest::subscription].
1621        ///
1622        /// This is a **required** field for requests.
1623        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        /// Sets the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
1629        ///
1630        /// This is a **required** field for requests.
1631        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        /// Sets or clears the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
1640        ///
1641        /// This is a **required** field for requests.
1642        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    /// The request builder for [SubscriptionAdmin::get_snapshot][crate::client::SubscriptionAdmin::get_snapshot] calls.
1659    ///
1660    /// # Example
1661    /// ```
1662    /// # use google_cloud_pubsub::builder::subscription_admin::GetSnapshot;
1663    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1664    ///
1665    /// let builder = prepare_request_builder();
1666    /// let response = builder.send().await?;
1667    /// # Ok(()) }
1668    ///
1669    /// fn prepare_request_builder() -> GetSnapshot {
1670    ///   # panic!();
1671    ///   // ... details omitted ...
1672    /// }
1673    /// ```
1674    #[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        /// Sets the full request, replacing any prior values.
1685        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        /// Sets all the options, replacing any prior values.
1691        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1692            self.0.options = v.into();
1693            self
1694        }
1695
1696        /// Sends the request.
1697        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        /// Sets the value of [snapshot][crate::model::GetSnapshotRequest::snapshot].
1705        ///
1706        /// This is a **required** field for requests.
1707        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    /// The request builder for [SubscriptionAdmin::list_snapshots][crate::client::SubscriptionAdmin::list_snapshots] calls.
1721    ///
1722    /// # Example
1723    /// ```
1724    /// # use google_cloud_pubsub::builder::subscription_admin::ListSnapshots;
1725    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1726    /// use google_cloud_gax::paginator::ItemPaginator;
1727    ///
1728    /// let builder = prepare_request_builder();
1729    /// let mut items = builder.by_item();
1730    /// while let Some(result) = items.next().await {
1731    ///   let item = result?;
1732    /// }
1733    /// # Ok(()) }
1734    ///
1735    /// fn prepare_request_builder() -> ListSnapshots {
1736    ///   # panic!();
1737    ///   // ... details omitted ...
1738    /// }
1739    /// ```
1740    #[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        /// Sets the full request, replacing any prior values.
1751        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        /// Sets all the options, replacing any prior values.
1757        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1758            self.0.options = v.into();
1759            self
1760        }
1761
1762        /// Sends the request.
1763        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        /// Streams each page in the collection.
1771        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        /// Streams each item in the collection.
1786        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        /// Sets the value of [project][crate::model::ListSnapshotsRequest::project].
1797        ///
1798        /// This is a **required** field for requests.
1799        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        /// Sets the value of [page_size][crate::model::ListSnapshotsRequest::page_size].
1805        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        /// Sets the value of [page_token][crate::model::ListSnapshotsRequest::page_token].
1811        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    /// The request builder for [SubscriptionAdmin::create_snapshot][crate::client::SubscriptionAdmin::create_snapshot] calls.
1825    ///
1826    /// # Example
1827    /// ```
1828    /// # use google_cloud_pubsub::builder::subscription_admin::CreateSnapshot;
1829    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1830    ///
1831    /// let builder = prepare_request_builder();
1832    /// let response = builder.send().await?;
1833    /// # Ok(()) }
1834    ///
1835    /// fn prepare_request_builder() -> CreateSnapshot {
1836    ///   # panic!();
1837    ///   // ... details omitted ...
1838    /// }
1839    /// ```
1840    #[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        /// Sets the full request, replacing any prior values.
1851        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        /// Sets all the options, replacing any prior values.
1857        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1858            self.0.options = v.into();
1859            self
1860        }
1861
1862        /// Sends the request.
1863        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        /// Sets the value of [name][crate::model::CreateSnapshotRequest::name].
1871        ///
1872        /// This is a **required** field for requests.
1873        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        /// Sets the value of [subscription][crate::model::CreateSnapshotRequest::subscription].
1879        ///
1880        /// This is a **required** field for requests.
1881        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        /// Sets the value of [labels][crate::model::CreateSnapshotRequest::labels].
1887        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        /// Sets the value of [tags][crate::model::CreateSnapshotRequest::tags].
1898        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    /// The request builder for [SubscriptionAdmin::update_snapshot][crate::client::SubscriptionAdmin::update_snapshot] calls.
1917    ///
1918    /// # Example
1919    /// ```
1920    /// # use google_cloud_pubsub::builder::subscription_admin::UpdateSnapshot;
1921    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1922    ///
1923    /// let builder = prepare_request_builder();
1924    /// let response = builder.send().await?;
1925    /// # Ok(()) }
1926    ///
1927    /// fn prepare_request_builder() -> UpdateSnapshot {
1928    ///   # panic!();
1929    ///   // ... details omitted ...
1930    /// }
1931    /// ```
1932    #[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        /// Sets the full request, replacing any prior values.
1943        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        /// Sets all the options, replacing any prior values.
1949        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1950            self.0.options = v.into();
1951            self
1952        }
1953
1954        /// Sends the request.
1955        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        /// Sets the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
1963        ///
1964        /// This is a **required** field for requests.
1965        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        /// Sets or clears the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
1974        ///
1975        /// This is a **required** field for requests.
1976        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        /// Sets the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
1985        ///
1986        /// This is a **required** field for requests.
1987        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        /// Sets or clears the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
1996        ///
1997        /// This is a **required** field for requests.
1998        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    /// The request builder for [SubscriptionAdmin::delete_snapshot][crate::client::SubscriptionAdmin::delete_snapshot] calls.
2015    ///
2016    /// # Example
2017    /// ```
2018    /// # use google_cloud_pubsub::builder::subscription_admin::DeleteSnapshot;
2019    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2020    ///
2021    /// let builder = prepare_request_builder();
2022    /// let response = builder.send().await?;
2023    /// # Ok(()) }
2024    ///
2025    /// fn prepare_request_builder() -> DeleteSnapshot {
2026    ///   # panic!();
2027    ///   // ... details omitted ...
2028    /// }
2029    /// ```
2030    #[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        /// Sets the full request, replacing any prior values.
2041        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        /// Sets all the options, replacing any prior values.
2047        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2048            self.0.options = v.into();
2049            self
2050        }
2051
2052        /// Sends the request.
2053        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        /// Sets the value of [snapshot][crate::model::DeleteSnapshotRequest::snapshot].
2061        ///
2062        /// This is a **required** field for requests.
2063        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    /// The request builder for [SubscriptionAdmin::seek][crate::client::SubscriptionAdmin::seek] calls.
2077    ///
2078    /// # Example
2079    /// ```
2080    /// # use google_cloud_pubsub::builder::subscription_admin::Seek;
2081    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2082    ///
2083    /// let builder = prepare_request_builder();
2084    /// let response = builder.send().await?;
2085    /// # Ok(()) }
2086    ///
2087    /// fn prepare_request_builder() -> Seek {
2088    ///   # panic!();
2089    ///   // ... details omitted ...
2090    /// }
2091    /// ```
2092    #[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        /// Sets the full request, replacing any prior values.
2103        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        /// Sets all the options, replacing any prior values.
2109        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2110            self.0.options = v.into();
2111            self
2112        }
2113
2114        /// Sends the request.
2115        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        /// Sets the value of [subscription][crate::model::SeekRequest::subscription].
2123        ///
2124        /// This is a **required** field for requests.
2125        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        /// Sets the value of [target][crate::model::SeekRequest::target].
2131        ///
2132        /// Note that all the setters affecting `target` are
2133        /// mutually exclusive.
2134        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        /// Sets the value of [target][crate::model::SeekRequest::target]
2143        /// to hold a `Time`.
2144        ///
2145        /// Note that all the setters affecting `target` are
2146        /// mutually exclusive.
2147        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        /// Sets the value of [target][crate::model::SeekRequest::target]
2156        /// to hold a `Snapshot`.
2157        ///
2158        /// Note that all the setters affecting `target` are
2159        /// mutually exclusive.
2160        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
2174/// Request and client builders for [SchemaService][crate::client::SchemaService].
2175pub mod schema_service {
2176    use crate::Result;
2177
2178    /// A builder for [SchemaService][crate::client::SchemaService].
2179    ///
2180    /// ```
2181    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2182    /// # use google_cloud_pubsub::*;
2183    /// # use builder::schema_service::ClientBuilder;
2184    /// # use client::SchemaService;
2185    /// let builder : ClientBuilder = SchemaService::builder();
2186    /// let client = builder
2187    ///     .with_endpoint("https://pubsub.googleapis.com")
2188    ///     .build().await?;
2189    /// # Ok(()) }
2190    /// ```
2191    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    /// Common implementation for [crate::client::SchemaService] request builders.
2209    #[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    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
2232    ///
2233    /// # Example
2234    /// ```
2235    /// # use google_cloud_pubsub::builder::schema_service::CreateSchema;
2236    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2237    ///
2238    /// let builder = prepare_request_builder();
2239    /// let response = builder.send().await?;
2240    /// # Ok(()) }
2241    ///
2242    /// fn prepare_request_builder() -> CreateSchema {
2243    ///   # panic!();
2244    ///   // ... details omitted ...
2245    /// }
2246    /// ```
2247    #[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        /// Sets the full request, replacing any prior values.
2258        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        /// Sets all the options, replacing any prior values.
2264        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2265            self.0.options = v.into();
2266            self
2267        }
2268
2269        /// Sends the request.
2270        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        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
2278        ///
2279        /// This is a **required** field for requests.
2280        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        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
2286        ///
2287        /// This is a **required** field for requests.
2288        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        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
2297        ///
2298        /// This is a **required** field for requests.
2299        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        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
2308        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    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
2322    ///
2323    /// # Example
2324    /// ```
2325    /// # use google_cloud_pubsub::builder::schema_service::GetSchema;
2326    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2327    ///
2328    /// let builder = prepare_request_builder();
2329    /// let response = builder.send().await?;
2330    /// # Ok(()) }
2331    ///
2332    /// fn prepare_request_builder() -> GetSchema {
2333    ///   # panic!();
2334    ///   // ... details omitted ...
2335    /// }
2336    /// ```
2337    #[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        /// Sets the full request, replacing any prior values.
2348        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        /// Sets all the options, replacing any prior values.
2354        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2355            self.0.options = v.into();
2356            self
2357        }
2358
2359        /// Sends the request.
2360        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        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
2368        ///
2369        /// This is a **required** field for requests.
2370        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        /// Sets the value of [view][crate::model::GetSchemaRequest::view].
2376        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    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
2390    ///
2391    /// # Example
2392    /// ```
2393    /// # use google_cloud_pubsub::builder::schema_service::ListSchemas;
2394    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2395    /// use google_cloud_gax::paginator::ItemPaginator;
2396    ///
2397    /// let builder = prepare_request_builder();
2398    /// let mut items = builder.by_item();
2399    /// while let Some(result) = items.next().await {
2400    ///   let item = result?;
2401    /// }
2402    /// # Ok(()) }
2403    ///
2404    /// fn prepare_request_builder() -> ListSchemas {
2405    ///   # panic!();
2406    ///   // ... details omitted ...
2407    /// }
2408    /// ```
2409    #[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        /// Sets the full request, replacing any prior values.
2420        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        /// Sets all the options, replacing any prior values.
2426        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2427            self.0.options = v.into();
2428            self
2429        }
2430
2431        /// Sends the request.
2432        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        /// Streams each page in the collection.
2440        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        /// Streams each item in the collection.
2455        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        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
2466        ///
2467        /// This is a **required** field for requests.
2468        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        /// Sets the value of [view][crate::model::ListSchemasRequest::view].
2474        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        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
2480        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        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
2486        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    /// The request builder for [SchemaService::list_schema_revisions][crate::client::SchemaService::list_schema_revisions] calls.
2500    ///
2501    /// # Example
2502    /// ```
2503    /// # use google_cloud_pubsub::builder::schema_service::ListSchemaRevisions;
2504    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2505    /// use google_cloud_gax::paginator::ItemPaginator;
2506    ///
2507    /// let builder = prepare_request_builder();
2508    /// let mut items = builder.by_item();
2509    /// while let Some(result) = items.next().await {
2510    ///   let item = result?;
2511    /// }
2512    /// # Ok(()) }
2513    ///
2514    /// fn prepare_request_builder() -> ListSchemaRevisions {
2515    ///   # panic!();
2516    ///   // ... details omitted ...
2517    /// }
2518    /// ```
2519    #[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        /// Sets the full request, replacing any prior values.
2530        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        /// Sets all the options, replacing any prior values.
2539        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2540            self.0.options = v.into();
2541            self
2542        }
2543
2544        /// Sends the request.
2545        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        /// Streams each page in the collection.
2553        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        /// Streams each item in the collection.
2570        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        /// Sets the value of [name][crate::model::ListSchemaRevisionsRequest::name].
2581        ///
2582        /// This is a **required** field for requests.
2583        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        /// Sets the value of [view][crate::model::ListSchemaRevisionsRequest::view].
2589        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        /// Sets the value of [page_size][crate::model::ListSchemaRevisionsRequest::page_size].
2595        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        /// Sets the value of [page_token][crate::model::ListSchemaRevisionsRequest::page_token].
2601        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    /// The request builder for [SchemaService::commit_schema][crate::client::SchemaService::commit_schema] calls.
2615    ///
2616    /// # Example
2617    /// ```
2618    /// # use google_cloud_pubsub::builder::schema_service::CommitSchema;
2619    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2620    ///
2621    /// let builder = prepare_request_builder();
2622    /// let response = builder.send().await?;
2623    /// # Ok(()) }
2624    ///
2625    /// fn prepare_request_builder() -> CommitSchema {
2626    ///   # panic!();
2627    ///   // ... details omitted ...
2628    /// }
2629    /// ```
2630    #[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        /// Sets the full request, replacing any prior values.
2641        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        /// Sets all the options, replacing any prior values.
2647        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2648            self.0.options = v.into();
2649            self
2650        }
2651
2652        /// Sends the request.
2653        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        /// Sets the value of [name][crate::model::CommitSchemaRequest::name].
2661        ///
2662        /// This is a **required** field for requests.
2663        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        /// Sets the value of [schema][crate::model::CommitSchemaRequest::schema].
2669        ///
2670        /// This is a **required** field for requests.
2671        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        /// Sets or clears the value of [schema][crate::model::CommitSchemaRequest::schema].
2680        ///
2681        /// This is a **required** field for requests.
2682        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    /// The request builder for [SchemaService::rollback_schema][crate::client::SchemaService::rollback_schema] calls.
2699    ///
2700    /// # Example
2701    /// ```
2702    /// # use google_cloud_pubsub::builder::schema_service::RollbackSchema;
2703    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2704    ///
2705    /// let builder = prepare_request_builder();
2706    /// let response = builder.send().await?;
2707    /// # Ok(()) }
2708    ///
2709    /// fn prepare_request_builder() -> RollbackSchema {
2710    ///   # panic!();
2711    ///   // ... details omitted ...
2712    /// }
2713    /// ```
2714    #[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        /// Sets the full request, replacing any prior values.
2725        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        /// Sets all the options, replacing any prior values.
2731        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2732            self.0.options = v.into();
2733            self
2734        }
2735
2736        /// Sends the request.
2737        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        /// Sets the value of [name][crate::model::RollbackSchemaRequest::name].
2745        ///
2746        /// This is a **required** field for requests.
2747        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        /// Sets the value of [revision_id][crate::model::RollbackSchemaRequest::revision_id].
2753        ///
2754        /// This is a **required** field for requests.
2755        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    /// The request builder for [SchemaService::delete_schema_revision][crate::client::SchemaService::delete_schema_revision] calls.
2769    ///
2770    /// # Example
2771    /// ```
2772    /// # use google_cloud_pubsub::builder::schema_service::DeleteSchemaRevision;
2773    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2774    ///
2775    /// let builder = prepare_request_builder();
2776    /// let response = builder.send().await?;
2777    /// # Ok(()) }
2778    ///
2779    /// fn prepare_request_builder() -> DeleteSchemaRevision {
2780    ///   # panic!();
2781    ///   // ... details omitted ...
2782    /// }
2783    /// ```
2784    #[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        /// Sets the full request, replacing any prior values.
2795        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        /// Sets all the options, replacing any prior values.
2804        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2805            self.0.options = v.into();
2806            self
2807        }
2808
2809        /// Sends the request.
2810        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        /// Sets the value of [name][crate::model::DeleteSchemaRevisionRequest::name].
2818        ///
2819        /// This is a **required** field for requests.
2820        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        /// Sets the value of [revision_id][crate::model::DeleteSchemaRevisionRequest::revision_id].
2826        #[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    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
2841    ///
2842    /// # Example
2843    /// ```
2844    /// # use google_cloud_pubsub::builder::schema_service::DeleteSchema;
2845    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2846    ///
2847    /// let builder = prepare_request_builder();
2848    /// let response = builder.send().await?;
2849    /// # Ok(()) }
2850    ///
2851    /// fn prepare_request_builder() -> DeleteSchema {
2852    ///   # panic!();
2853    ///   // ... details omitted ...
2854    /// }
2855    /// ```
2856    #[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        /// Sets the full request, replacing any prior values.
2867        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        /// Sets all the options, replacing any prior values.
2873        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2874            self.0.options = v.into();
2875            self
2876        }
2877
2878        /// Sends the request.
2879        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        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
2887        ///
2888        /// This is a **required** field for requests.
2889        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    /// The request builder for [SchemaService::validate_schema][crate::client::SchemaService::validate_schema] calls.
2903    ///
2904    /// # Example
2905    /// ```
2906    /// # use google_cloud_pubsub::builder::schema_service::ValidateSchema;
2907    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2908    ///
2909    /// let builder = prepare_request_builder();
2910    /// let response = builder.send().await?;
2911    /// # Ok(()) }
2912    ///
2913    /// fn prepare_request_builder() -> ValidateSchema {
2914    ///   # panic!();
2915    ///   // ... details omitted ...
2916    /// }
2917    /// ```
2918    #[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        /// Sets the full request, replacing any prior values.
2929        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        /// Sets all the options, replacing any prior values.
2935        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2936            self.0.options = v.into();
2937            self
2938        }
2939
2940        /// Sends the request.
2941        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        /// Sets the value of [parent][crate::model::ValidateSchemaRequest::parent].
2949        ///
2950        /// This is a **required** field for requests.
2951        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        /// Sets the value of [schema][crate::model::ValidateSchemaRequest::schema].
2957        ///
2958        /// This is a **required** field for requests.
2959        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        /// Sets or clears the value of [schema][crate::model::ValidateSchemaRequest::schema].
2968        ///
2969        /// This is a **required** field for requests.
2970        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    /// The request builder for [SchemaService::validate_message][crate::client::SchemaService::validate_message] calls.
2987    ///
2988    /// # Example
2989    /// ```
2990    /// # use google_cloud_pubsub::builder::schema_service::ValidateMessage;
2991    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2992    ///
2993    /// let builder = prepare_request_builder();
2994    /// let response = builder.send().await?;
2995    /// # Ok(()) }
2996    ///
2997    /// fn prepare_request_builder() -> ValidateMessage {
2998    ///   # panic!();
2999    ///   // ... details omitted ...
3000    /// }
3001    /// ```
3002    #[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        /// Sets the full request, replacing any prior values.
3013        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        /// Sets all the options, replacing any prior values.
3019        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3020            self.0.options = v.into();
3021            self
3022        }
3023
3024        /// Sends the request.
3025        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        /// Sets the value of [parent][crate::model::ValidateMessageRequest::parent].
3033        ///
3034        /// This is a **required** field for requests.
3035        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        /// Sets the value of [message][crate::model::ValidateMessageRequest::message].
3041        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        /// Sets the value of [encoding][crate::model::ValidateMessageRequest::encoding].
3047        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        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec].
3053        ///
3054        /// Note that all the setters affecting `schema_spec` are
3055        /// mutually exclusive.
3056        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        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
3067        /// to hold a `Name`.
3068        ///
3069        /// Note that all the setters affecting `schema_spec` are
3070        /// mutually exclusive.
3071        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        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
3077        /// to hold a `Schema`.
3078        ///
3079        /// Note that all the setters affecting `schema_spec` are
3080        /// mutually exclusive.
3081        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    /// The request builder for [SchemaService::set_iam_policy][crate::client::SchemaService::set_iam_policy] calls.
3098    ///
3099    /// # Example
3100    /// ```
3101    /// # use google_cloud_pubsub::builder::schema_service::SetIamPolicy;
3102    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3103    ///
3104    /// let builder = prepare_request_builder();
3105    /// let response = builder.send().await?;
3106    /// # Ok(()) }
3107    ///
3108    /// fn prepare_request_builder() -> SetIamPolicy {
3109    ///   # panic!();
3110    ///   // ... details omitted ...
3111    /// }
3112    /// ```
3113    #[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        /// Sets the full request, replacing any prior values.
3124        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        /// Sets all the options, replacing any prior values.
3133        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3134            self.0.options = v.into();
3135            self
3136        }
3137
3138        /// Sends the request.
3139        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        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
3147        ///
3148        /// This is a **required** field for requests.
3149        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        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
3155        ///
3156        /// This is a **required** field for requests.
3157        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        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
3166        ///
3167        /// This is a **required** field for requests.
3168        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        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
3177        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        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
3186        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    /// The request builder for [SchemaService::get_iam_policy][crate::client::SchemaService::get_iam_policy] calls.
3203    ///
3204    /// # Example
3205    /// ```
3206    /// # use google_cloud_pubsub::builder::schema_service::GetIamPolicy;
3207    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3208    ///
3209    /// let builder = prepare_request_builder();
3210    /// let response = builder.send().await?;
3211    /// # Ok(()) }
3212    ///
3213    /// fn prepare_request_builder() -> GetIamPolicy {
3214    ///   # panic!();
3215    ///   // ... details omitted ...
3216    /// }
3217    /// ```
3218    #[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        /// Sets the full request, replacing any prior values.
3229        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        /// Sets all the options, replacing any prior values.
3238        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3239            self.0.options = v.into();
3240            self
3241        }
3242
3243        /// Sends the request.
3244        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        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
3252        ///
3253        /// This is a **required** field for requests.
3254        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        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
3260        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        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
3269        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    /// The request builder for [SchemaService::test_iam_permissions][crate::client::SchemaService::test_iam_permissions] calls.
3286    ///
3287    /// # Example
3288    /// ```
3289    /// # use google_cloud_pubsub::builder::schema_service::TestIamPermissions;
3290    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3291    ///
3292    /// let builder = prepare_request_builder();
3293    /// let response = builder.send().await?;
3294    /// # Ok(()) }
3295    ///
3296    /// fn prepare_request_builder() -> TestIamPermissions {
3297    ///   # panic!();
3298    ///   // ... details omitted ...
3299    /// }
3300    /// ```
3301    #[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        /// Sets the full request, replacing any prior values.
3314        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        /// Sets all the options, replacing any prior values.
3323        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3324            self.0.options = v.into();
3325            self
3326        }
3327
3328        /// Sends the request.
3329        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        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
3337        ///
3338        /// This is a **required** field for requests.
3339        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        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
3345        ///
3346        /// This is a **required** field for requests.
3347        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}