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
17pub mod topic_admin {
18    use crate::Result;
19
20    /// A builder for [TopicAdmin][crate::client::TopicAdmin].
21    ///
22    /// ```
23    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24    /// # use google_cloud_pubsub::*;
25    /// # use builder::topic_admin::ClientBuilder;
26    /// # use client::TopicAdmin;
27    /// let builder : ClientBuilder = TopicAdmin::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://pubsub.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35    pub(crate) mod client {
36        use super::super::super::client::TopicAdmin;
37        pub struct Factory;
38        impl crate::ClientFactory for Factory {
39            type Client = TopicAdmin;
40            type Credentials = gaxi::options::Credentials;
41            async fn build(
42                self,
43                config: gaxi::options::ClientConfig,
44            ) -> crate::ClientBuilderResult<Self::Client> {
45                Self::Client::new(config).await
46            }
47        }
48    }
49
50    /// Common implementation for [crate::client::TopicAdmin] request builders.
51    #[derive(Clone, Debug)]
52    pub(crate) struct RequestBuilder<R: std::default::Default> {
53        stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
54        request: R,
55        options: crate::RequestOptions,
56    }
57
58    impl<R> RequestBuilder<R>
59    where
60        R: std::default::Default,
61    {
62        pub(crate) fn new(
63            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
64        ) -> Self {
65            Self {
66                stub,
67                request: R::default(),
68                options: crate::RequestOptions::default(),
69            }
70        }
71    }
72
73    /// The request builder for [TopicAdmin::create_topic][crate::client::TopicAdmin::create_topic] calls.
74    ///
75    /// # Example
76    /// ```
77    /// # use google_cloud_pubsub::builder::topic_admin::CreateTopic;
78    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.send().await?;
82    /// # Ok(()) }
83    ///
84    /// fn prepare_request_builder() -> CreateTopic {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct CreateTopic(RequestBuilder<crate::model::Topic>);
91
92    impl CreateTopic {
93        pub(crate) fn new(
94            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
95        ) -> Self {
96            Self(RequestBuilder::new(stub))
97        }
98
99        /// Sets the full request, replacing any prior values.
100        pub fn with_request<V: Into<crate::model::Topic>>(mut self, v: V) -> Self {
101            self.0.request = v.into();
102            self
103        }
104
105        /// Sets all the options, replacing any prior values.
106        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107            self.0.options = v.into();
108            self
109        }
110
111        /// Sends the request.
112        pub async fn send(self) -> Result<crate::model::Topic> {
113            (*self.0.stub)
114                .create_topic(self.0.request, self.0.options)
115                .await
116                .map(crate::Response::into_body)
117        }
118
119        /// Sets the value of [name][crate::model::Topic::name].
120        ///
121        /// This is a **required** field for requests.
122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
123            self.0.request.name = v.into();
124            self
125        }
126
127        /// Sets the value of [labels][crate::model::Topic::labels].
128        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
129        where
130            T: std::iter::IntoIterator<Item = (K, V)>,
131            K: std::convert::Into<std::string::String>,
132            V: std::convert::Into<std::string::String>,
133        {
134            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
135            self
136        }
137
138        /// Sets the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
139        pub fn set_message_storage_policy<T>(mut self, v: T) -> Self
140        where
141            T: std::convert::Into<crate::model::MessageStoragePolicy>,
142        {
143            self.0.request.message_storage_policy = std::option::Option::Some(v.into());
144            self
145        }
146
147        /// Sets or clears the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
148        pub fn set_or_clear_message_storage_policy<T>(mut self, v: std::option::Option<T>) -> Self
149        where
150            T: std::convert::Into<crate::model::MessageStoragePolicy>,
151        {
152            self.0.request.message_storage_policy = v.map(|x| x.into());
153            self
154        }
155
156        /// Sets the value of [kms_key_name][crate::model::Topic::kms_key_name].
157        pub fn set_kms_key_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
158            self.0.request.kms_key_name = v.into();
159            self
160        }
161
162        /// Sets the value of [schema_settings][crate::model::Topic::schema_settings].
163        pub fn set_schema_settings<T>(mut self, v: T) -> Self
164        where
165            T: std::convert::Into<crate::model::SchemaSettings>,
166        {
167            self.0.request.schema_settings = std::option::Option::Some(v.into());
168            self
169        }
170
171        /// Sets or clears the value of [schema_settings][crate::model::Topic::schema_settings].
172        pub fn set_or_clear_schema_settings<T>(mut self, v: std::option::Option<T>) -> Self
173        where
174            T: std::convert::Into<crate::model::SchemaSettings>,
175        {
176            self.0.request.schema_settings = v.map(|x| x.into());
177            self
178        }
179
180        /// Sets the value of [satisfies_pzs][crate::model::Topic::satisfies_pzs].
181        pub fn set_satisfies_pzs<T: Into<bool>>(mut self, v: T) -> Self {
182            self.0.request.satisfies_pzs = v.into();
183            self
184        }
185
186        /// Sets the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
187        pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
188        where
189            T: std::convert::Into<wkt::Duration>,
190        {
191            self.0.request.message_retention_duration = std::option::Option::Some(v.into());
192            self
193        }
194
195        /// Sets or clears the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
196        pub fn set_or_clear_message_retention_duration<T>(
197            mut self,
198            v: std::option::Option<T>,
199        ) -> Self
200        where
201            T: std::convert::Into<wkt::Duration>,
202        {
203            self.0.request.message_retention_duration = v.map(|x| x.into());
204            self
205        }
206
207        /// Sets the value of [state][crate::model::Topic::state].
208        pub fn set_state<T: Into<crate::model::topic::State>>(mut self, v: T) -> Self {
209            self.0.request.state = v.into();
210            self
211        }
212
213        /// Sets the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
214        pub fn set_ingestion_data_source_settings<T>(mut self, v: T) -> Self
215        where
216            T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
217        {
218            self.0.request.ingestion_data_source_settings = std::option::Option::Some(v.into());
219            self
220        }
221
222        /// Sets or clears the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
223        pub fn set_or_clear_ingestion_data_source_settings<T>(
224            mut self,
225            v: std::option::Option<T>,
226        ) -> Self
227        where
228            T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
229        {
230            self.0.request.ingestion_data_source_settings = v.map(|x| x.into());
231            self
232        }
233
234        /// Sets the value of [message_transforms][crate::model::Topic::message_transforms].
235        pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
236        where
237            T: std::iter::IntoIterator<Item = V>,
238            V: std::convert::Into<crate::model::MessageTransform>,
239        {
240            use std::iter::Iterator;
241            self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
242            self
243        }
244
245        /// Sets the value of [tags][crate::model::Topic::tags].
246        pub fn set_tags<T, K, V>(mut self, v: T) -> Self
247        where
248            T: std::iter::IntoIterator<Item = (K, V)>,
249            K: std::convert::Into<std::string::String>,
250            V: std::convert::Into<std::string::String>,
251        {
252            self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
253            self
254        }
255    }
256
257    #[doc(hidden)]
258    impl crate::RequestBuilder for CreateTopic {
259        fn request_options(&mut self) -> &mut crate::RequestOptions {
260            &mut self.0.options
261        }
262    }
263
264    /// The request builder for [TopicAdmin::update_topic][crate::client::TopicAdmin::update_topic] calls.
265    ///
266    /// # Example
267    /// ```
268    /// # use google_cloud_pubsub::builder::topic_admin::UpdateTopic;
269    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
270    ///
271    /// let builder = prepare_request_builder();
272    /// let response = builder.send().await?;
273    /// # Ok(()) }
274    ///
275    /// fn prepare_request_builder() -> UpdateTopic {
276    ///   # panic!();
277    ///   // ... details omitted ...
278    /// }
279    /// ```
280    #[derive(Clone, Debug)]
281    pub struct UpdateTopic(RequestBuilder<crate::model::UpdateTopicRequest>);
282
283    impl UpdateTopic {
284        pub(crate) fn new(
285            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
286        ) -> Self {
287            Self(RequestBuilder::new(stub))
288        }
289
290        /// Sets the full request, replacing any prior values.
291        pub fn with_request<V: Into<crate::model::UpdateTopicRequest>>(mut self, v: V) -> Self {
292            self.0.request = v.into();
293            self
294        }
295
296        /// Sets all the options, replacing any prior values.
297        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
298            self.0.options = v.into();
299            self
300        }
301
302        /// Sends the request.
303        pub async fn send(self) -> Result<crate::model::Topic> {
304            (*self.0.stub)
305                .update_topic(self.0.request, self.0.options)
306                .await
307                .map(crate::Response::into_body)
308        }
309
310        /// Sets the value of [topic][crate::model::UpdateTopicRequest::topic].
311        ///
312        /// This is a **required** field for requests.
313        pub fn set_topic<T>(mut self, v: T) -> Self
314        where
315            T: std::convert::Into<crate::model::Topic>,
316        {
317            self.0.request.topic = std::option::Option::Some(v.into());
318            self
319        }
320
321        /// Sets or clears the value of [topic][crate::model::UpdateTopicRequest::topic].
322        ///
323        /// This is a **required** field for requests.
324        pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
325        where
326            T: std::convert::Into<crate::model::Topic>,
327        {
328            self.0.request.topic = v.map(|x| x.into());
329            self
330        }
331
332        /// Sets the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
333        ///
334        /// This is a **required** field for requests.
335        pub fn set_update_mask<T>(mut self, v: T) -> Self
336        where
337            T: std::convert::Into<wkt::FieldMask>,
338        {
339            self.0.request.update_mask = std::option::Option::Some(v.into());
340            self
341        }
342
343        /// Sets or clears the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
344        ///
345        /// This is a **required** field for requests.
346        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
347        where
348            T: std::convert::Into<wkt::FieldMask>,
349        {
350            self.0.request.update_mask = v.map(|x| x.into());
351            self
352        }
353    }
354
355    #[doc(hidden)]
356    impl crate::RequestBuilder for UpdateTopic {
357        fn request_options(&mut self) -> &mut crate::RequestOptions {
358            &mut self.0.options
359        }
360    }
361
362    /// The request builder for [TopicAdmin::get_topic][crate::client::TopicAdmin::get_topic] calls.
363    ///
364    /// # Example
365    /// ```
366    /// # use google_cloud_pubsub::builder::topic_admin::GetTopic;
367    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
368    ///
369    /// let builder = prepare_request_builder();
370    /// let response = builder.send().await?;
371    /// # Ok(()) }
372    ///
373    /// fn prepare_request_builder() -> GetTopic {
374    ///   # panic!();
375    ///   // ... details omitted ...
376    /// }
377    /// ```
378    #[derive(Clone, Debug)]
379    pub struct GetTopic(RequestBuilder<crate::model::GetTopicRequest>);
380
381    impl GetTopic {
382        pub(crate) fn new(
383            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
384        ) -> Self {
385            Self(RequestBuilder::new(stub))
386        }
387
388        /// Sets the full request, replacing any prior values.
389        pub fn with_request<V: Into<crate::model::GetTopicRequest>>(mut self, v: V) -> Self {
390            self.0.request = v.into();
391            self
392        }
393
394        /// Sets all the options, replacing any prior values.
395        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
396            self.0.options = v.into();
397            self
398        }
399
400        /// Sends the request.
401        pub async fn send(self) -> Result<crate::model::Topic> {
402            (*self.0.stub)
403                .get_topic(self.0.request, self.0.options)
404                .await
405                .map(crate::Response::into_body)
406        }
407
408        /// Sets the value of [topic][crate::model::GetTopicRequest::topic].
409        ///
410        /// This is a **required** field for requests.
411        pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
412            self.0.request.topic = v.into();
413            self
414        }
415    }
416
417    #[doc(hidden)]
418    impl crate::RequestBuilder for GetTopic {
419        fn request_options(&mut self) -> &mut crate::RequestOptions {
420            &mut self.0.options
421        }
422    }
423
424    /// The request builder for [TopicAdmin::list_topics][crate::client::TopicAdmin::list_topics] calls.
425    ///
426    /// # Example
427    /// ```
428    /// # use google_cloud_pubsub::builder::topic_admin::ListTopics;
429    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
430    /// use google_cloud_gax::paginator::ItemPaginator;
431    ///
432    /// let builder = prepare_request_builder();
433    /// let mut items = builder.by_item();
434    /// while let Some(result) = items.next().await {
435    ///   let item = result?;
436    /// }
437    /// # Ok(()) }
438    ///
439    /// fn prepare_request_builder() -> ListTopics {
440    ///   # panic!();
441    ///   // ... details omitted ...
442    /// }
443    /// ```
444    #[derive(Clone, Debug)]
445    pub struct ListTopics(RequestBuilder<crate::model::ListTopicsRequest>);
446
447    impl ListTopics {
448        pub(crate) fn new(
449            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
450        ) -> Self {
451            Self(RequestBuilder::new(stub))
452        }
453
454        /// Sets the full request, replacing any prior values.
455        pub fn with_request<V: Into<crate::model::ListTopicsRequest>>(mut self, v: V) -> Self {
456            self.0.request = v.into();
457            self
458        }
459
460        /// Sets all the options, replacing any prior values.
461        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
462            self.0.options = v.into();
463            self
464        }
465
466        /// Sends the request.
467        pub async fn send(self) -> Result<crate::model::ListTopicsResponse> {
468            (*self.0.stub)
469                .list_topics(self.0.request, self.0.options)
470                .await
471                .map(crate::Response::into_body)
472        }
473
474        /// Streams each page in the collection.
475        pub fn by_page(
476            self,
477        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTopicsResponse, crate::Error>
478        {
479            use std::clone::Clone;
480            let token = self.0.request.page_token.clone();
481            let execute = move |token: String| {
482                let mut builder = self.clone();
483                builder.0.request = builder.0.request.set_page_token(token);
484                builder.send()
485            };
486            google_cloud_gax::paginator::internal::new_paginator(token, execute)
487        }
488
489        /// Streams each item in the collection.
490        pub fn by_item(
491            self,
492        ) -> impl google_cloud_gax::paginator::ItemPaginator<
493            crate::model::ListTopicsResponse,
494            crate::Error,
495        > {
496            use google_cloud_gax::paginator::Paginator;
497            self.by_page().items()
498        }
499
500        /// Sets the value of [project][crate::model::ListTopicsRequest::project].
501        ///
502        /// This is a **required** field for requests.
503        pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
504            self.0.request.project = v.into();
505            self
506        }
507
508        /// Sets the value of [page_size][crate::model::ListTopicsRequest::page_size].
509        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
510            self.0.request.page_size = v.into();
511            self
512        }
513
514        /// Sets the value of [page_token][crate::model::ListTopicsRequest::page_token].
515        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
516            self.0.request.page_token = v.into();
517            self
518        }
519    }
520
521    #[doc(hidden)]
522    impl crate::RequestBuilder for ListTopics {
523        fn request_options(&mut self) -> &mut crate::RequestOptions {
524            &mut self.0.options
525        }
526    }
527
528    /// The request builder for [TopicAdmin::list_topic_subscriptions][crate::client::TopicAdmin::list_topic_subscriptions] calls.
529    ///
530    /// # Example
531    /// ```
532    /// # use google_cloud_pubsub::builder::topic_admin::ListTopicSubscriptions;
533    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
534    /// use google_cloud_gax::paginator::ItemPaginator;
535    ///
536    /// let builder = prepare_request_builder();
537    /// let mut items = builder.by_item();
538    /// while let Some(result) = items.next().await {
539    ///   let item = result?;
540    /// }
541    /// # Ok(()) }
542    ///
543    /// fn prepare_request_builder() -> ListTopicSubscriptions {
544    ///   # panic!();
545    ///   // ... details omitted ...
546    /// }
547    /// ```
548    #[derive(Clone, Debug)]
549    pub struct ListTopicSubscriptions(RequestBuilder<crate::model::ListTopicSubscriptionsRequest>);
550
551    impl ListTopicSubscriptions {
552        pub(crate) fn new(
553            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
554        ) -> Self {
555            Self(RequestBuilder::new(stub))
556        }
557
558        /// Sets the full request, replacing any prior values.
559        pub fn with_request<V: Into<crate::model::ListTopicSubscriptionsRequest>>(
560            mut self,
561            v: V,
562        ) -> Self {
563            self.0.request = v.into();
564            self
565        }
566
567        /// Sets all the options, replacing any prior values.
568        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
569            self.0.options = v.into();
570            self
571        }
572
573        /// Sends the request.
574        pub async fn send(self) -> Result<crate::model::ListTopicSubscriptionsResponse> {
575            (*self.0.stub)
576                .list_topic_subscriptions(self.0.request, self.0.options)
577                .await
578                .map(crate::Response::into_body)
579        }
580
581        /// Streams each page in the collection.
582        pub fn by_page(
583            self,
584        ) -> impl google_cloud_gax::paginator::Paginator<
585            crate::model::ListTopicSubscriptionsResponse,
586            crate::Error,
587        > {
588            use std::clone::Clone;
589            let token = self.0.request.page_token.clone();
590            let execute = move |token: String| {
591                let mut builder = self.clone();
592                builder.0.request = builder.0.request.set_page_token(token);
593                builder.send()
594            };
595            google_cloud_gax::paginator::internal::new_paginator(token, execute)
596        }
597
598        /// Streams each item in the collection.
599        pub fn by_item(
600            self,
601        ) -> impl google_cloud_gax::paginator::ItemPaginator<
602            crate::model::ListTopicSubscriptionsResponse,
603            crate::Error,
604        > {
605            use google_cloud_gax::paginator::Paginator;
606            self.by_page().items()
607        }
608
609        /// Sets the value of [topic][crate::model::ListTopicSubscriptionsRequest::topic].
610        ///
611        /// This is a **required** field for requests.
612        pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
613            self.0.request.topic = v.into();
614            self
615        }
616
617        /// Sets the value of [page_size][crate::model::ListTopicSubscriptionsRequest::page_size].
618        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
619            self.0.request.page_size = v.into();
620            self
621        }
622
623        /// Sets the value of [page_token][crate::model::ListTopicSubscriptionsRequest::page_token].
624        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
625            self.0.request.page_token = v.into();
626            self
627        }
628    }
629
630    #[doc(hidden)]
631    impl crate::RequestBuilder for ListTopicSubscriptions {
632        fn request_options(&mut self) -> &mut crate::RequestOptions {
633            &mut self.0.options
634        }
635    }
636
637    /// The request builder for [TopicAdmin::list_topic_snapshots][crate::client::TopicAdmin::list_topic_snapshots] calls.
638    ///
639    /// # Example
640    /// ```
641    /// # use google_cloud_pubsub::builder::topic_admin::ListTopicSnapshots;
642    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
643    ///
644    /// let builder = prepare_request_builder();
645    /// let response = builder.send().await?;
646    /// # Ok(()) }
647    ///
648    /// fn prepare_request_builder() -> ListTopicSnapshots {
649    ///   # panic!();
650    ///   // ... details omitted ...
651    /// }
652    /// ```
653    #[derive(Clone, Debug)]
654    pub struct ListTopicSnapshots(RequestBuilder<crate::model::ListTopicSnapshotsRequest>);
655
656    impl ListTopicSnapshots {
657        pub(crate) fn new(
658            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
659        ) -> Self {
660            Self(RequestBuilder::new(stub))
661        }
662
663        /// Sets the full request, replacing any prior values.
664        pub fn with_request<V: Into<crate::model::ListTopicSnapshotsRequest>>(
665            mut self,
666            v: V,
667        ) -> Self {
668            self.0.request = v.into();
669            self
670        }
671
672        /// Sets all the options, replacing any prior values.
673        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
674            self.0.options = v.into();
675            self
676        }
677
678        /// Sends the request.
679        pub async fn send(self) -> Result<crate::model::ListTopicSnapshotsResponse> {
680            (*self.0.stub)
681                .list_topic_snapshots(self.0.request, self.0.options)
682                .await
683                .map(crate::Response::into_body)
684        }
685
686        /// Sets the value of [topic][crate::model::ListTopicSnapshotsRequest::topic].
687        ///
688        /// This is a **required** field for requests.
689        pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
690            self.0.request.topic = v.into();
691            self
692        }
693
694        /// Sets the value of [page_size][crate::model::ListTopicSnapshotsRequest::page_size].
695        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
696            self.0.request.page_size = v.into();
697            self
698        }
699
700        /// Sets the value of [page_token][crate::model::ListTopicSnapshotsRequest::page_token].
701        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
702            self.0.request.page_token = v.into();
703            self
704        }
705    }
706
707    #[doc(hidden)]
708    impl crate::RequestBuilder for ListTopicSnapshots {
709        fn request_options(&mut self) -> &mut crate::RequestOptions {
710            &mut self.0.options
711        }
712    }
713
714    /// The request builder for [TopicAdmin::delete_topic][crate::client::TopicAdmin::delete_topic] calls.
715    ///
716    /// # Example
717    /// ```
718    /// # use google_cloud_pubsub::builder::topic_admin::DeleteTopic;
719    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
720    ///
721    /// let builder = prepare_request_builder();
722    /// let response = builder.send().await?;
723    /// # Ok(()) }
724    ///
725    /// fn prepare_request_builder() -> DeleteTopic {
726    ///   # panic!();
727    ///   // ... details omitted ...
728    /// }
729    /// ```
730    #[derive(Clone, Debug)]
731    pub struct DeleteTopic(RequestBuilder<crate::model::DeleteTopicRequest>);
732
733    impl DeleteTopic {
734        pub(crate) fn new(
735            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
736        ) -> Self {
737            Self(RequestBuilder::new(stub))
738        }
739
740        /// Sets the full request, replacing any prior values.
741        pub fn with_request<V: Into<crate::model::DeleteTopicRequest>>(mut self, v: V) -> Self {
742            self.0.request = v.into();
743            self
744        }
745
746        /// Sets all the options, replacing any prior values.
747        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
748            self.0.options = v.into();
749            self
750        }
751
752        /// Sends the request.
753        pub async fn send(self) -> Result<()> {
754            (*self.0.stub)
755                .delete_topic(self.0.request, self.0.options)
756                .await
757                .map(crate::Response::into_body)
758        }
759
760        /// Sets the value of [topic][crate::model::DeleteTopicRequest::topic].
761        ///
762        /// This is a **required** field for requests.
763        pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
764            self.0.request.topic = v.into();
765            self
766        }
767    }
768
769    #[doc(hidden)]
770    impl crate::RequestBuilder for DeleteTopic {
771        fn request_options(&mut self) -> &mut crate::RequestOptions {
772            &mut self.0.options
773        }
774    }
775
776    /// The request builder for [TopicAdmin::detach_subscription][crate::client::TopicAdmin::detach_subscription] calls.
777    ///
778    /// # Example
779    /// ```
780    /// # use google_cloud_pubsub::builder::topic_admin::DetachSubscription;
781    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
782    ///
783    /// let builder = prepare_request_builder();
784    /// let response = builder.send().await?;
785    /// # Ok(()) }
786    ///
787    /// fn prepare_request_builder() -> DetachSubscription {
788    ///   # panic!();
789    ///   // ... details omitted ...
790    /// }
791    /// ```
792    #[derive(Clone, Debug)]
793    pub struct DetachSubscription(RequestBuilder<crate::model::DetachSubscriptionRequest>);
794
795    impl DetachSubscription {
796        pub(crate) fn new(
797            stub: std::sync::Arc<dyn super::super::stub::dynamic::TopicAdmin>,
798        ) -> Self {
799            Self(RequestBuilder::new(stub))
800        }
801
802        /// Sets the full request, replacing any prior values.
803        pub fn with_request<V: Into<crate::model::DetachSubscriptionRequest>>(
804            mut self,
805            v: V,
806        ) -> Self {
807            self.0.request = v.into();
808            self
809        }
810
811        /// Sets all the options, replacing any prior values.
812        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
813            self.0.options = v.into();
814            self
815        }
816
817        /// Sends the request.
818        pub async fn send(self) -> Result<crate::model::DetachSubscriptionResponse> {
819            (*self.0.stub)
820                .detach_subscription(self.0.request, self.0.options)
821                .await
822                .map(crate::Response::into_body)
823        }
824
825        /// Sets the value of [subscription][crate::model::DetachSubscriptionRequest::subscription].
826        ///
827        /// This is a **required** field for requests.
828        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
829            self.0.request.subscription = v.into();
830            self
831        }
832    }
833
834    #[doc(hidden)]
835    impl crate::RequestBuilder for DetachSubscription {
836        fn request_options(&mut self) -> &mut crate::RequestOptions {
837            &mut self.0.options
838        }
839    }
840}
841
842pub mod subscription_admin {
843    use crate::Result;
844
845    /// A builder for [SubscriptionAdmin][crate::client::SubscriptionAdmin].
846    ///
847    /// ```
848    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
849    /// # use google_cloud_pubsub::*;
850    /// # use builder::subscription_admin::ClientBuilder;
851    /// # use client::SubscriptionAdmin;
852    /// let builder : ClientBuilder = SubscriptionAdmin::builder();
853    /// let client = builder
854    ///     .with_endpoint("https://pubsub.googleapis.com")
855    ///     .build().await?;
856    /// # Ok(()) }
857    /// ```
858    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
859
860    pub(crate) mod client {
861        use super::super::super::client::SubscriptionAdmin;
862        pub struct Factory;
863        impl crate::ClientFactory for Factory {
864            type Client = SubscriptionAdmin;
865            type Credentials = gaxi::options::Credentials;
866            async fn build(
867                self,
868                config: gaxi::options::ClientConfig,
869            ) -> crate::ClientBuilderResult<Self::Client> {
870                Self::Client::new(config).await
871            }
872        }
873    }
874
875    /// Common implementation for [crate::client::SubscriptionAdmin] request builders.
876    #[derive(Clone, Debug)]
877    pub(crate) struct RequestBuilder<R: std::default::Default> {
878        stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
879        request: R,
880        options: crate::RequestOptions,
881    }
882
883    impl<R> RequestBuilder<R>
884    where
885        R: std::default::Default,
886    {
887        pub(crate) fn new(
888            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
889        ) -> Self {
890            Self {
891                stub,
892                request: R::default(),
893                options: crate::RequestOptions::default(),
894            }
895        }
896    }
897
898    /// The request builder for [SubscriptionAdmin::create_subscription][crate::client::SubscriptionAdmin::create_subscription] calls.
899    ///
900    /// # Example
901    /// ```
902    /// # use google_cloud_pubsub::builder::subscription_admin::CreateSubscription;
903    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
904    ///
905    /// let builder = prepare_request_builder();
906    /// let response = builder.send().await?;
907    /// # Ok(()) }
908    ///
909    /// fn prepare_request_builder() -> CreateSubscription {
910    ///   # panic!();
911    ///   // ... details omitted ...
912    /// }
913    /// ```
914    #[derive(Clone, Debug)]
915    pub struct CreateSubscription(RequestBuilder<crate::model::Subscription>);
916
917    impl CreateSubscription {
918        pub(crate) fn new(
919            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
920        ) -> Self {
921            Self(RequestBuilder::new(stub))
922        }
923
924        /// Sets the full request, replacing any prior values.
925        pub fn with_request<V: Into<crate::model::Subscription>>(mut self, v: V) -> Self {
926            self.0.request = v.into();
927            self
928        }
929
930        /// Sets all the options, replacing any prior values.
931        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
932            self.0.options = v.into();
933            self
934        }
935
936        /// Sends the request.
937        pub async fn send(self) -> Result<crate::model::Subscription> {
938            (*self.0.stub)
939                .create_subscription(self.0.request, self.0.options)
940                .await
941                .map(crate::Response::into_body)
942        }
943
944        /// Sets the value of [name][crate::model::Subscription::name].
945        ///
946        /// This is a **required** field for requests.
947        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948            self.0.request.name = v.into();
949            self
950        }
951
952        /// Sets the value of [topic][crate::model::Subscription::topic].
953        ///
954        /// This is a **required** field for requests.
955        pub fn set_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
956            self.0.request.topic = v.into();
957            self
958        }
959
960        /// Sets the value of [push_config][crate::model::Subscription::push_config].
961        pub fn set_push_config<T>(mut self, v: T) -> Self
962        where
963            T: std::convert::Into<crate::model::PushConfig>,
964        {
965            self.0.request.push_config = std::option::Option::Some(v.into());
966            self
967        }
968
969        /// Sets or clears the value of [push_config][crate::model::Subscription::push_config].
970        pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
971        where
972            T: std::convert::Into<crate::model::PushConfig>,
973        {
974            self.0.request.push_config = v.map(|x| x.into());
975            self
976        }
977
978        /// Sets the value of [bigquery_config][crate::model::Subscription::bigquery_config].
979        pub fn set_bigquery_config<T>(mut self, v: T) -> Self
980        where
981            T: std::convert::Into<crate::model::BigQueryConfig>,
982        {
983            self.0.request.bigquery_config = std::option::Option::Some(v.into());
984            self
985        }
986
987        /// Sets or clears the value of [bigquery_config][crate::model::Subscription::bigquery_config].
988        pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
989        where
990            T: std::convert::Into<crate::model::BigQueryConfig>,
991        {
992            self.0.request.bigquery_config = v.map(|x| x.into());
993            self
994        }
995
996        /// Sets the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
997        pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
998        where
999            T: std::convert::Into<crate::model::CloudStorageConfig>,
1000        {
1001            self.0.request.cloud_storage_config = std::option::Option::Some(v.into());
1002            self
1003        }
1004
1005        /// Sets or clears the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
1006        pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
1007        where
1008            T: std::convert::Into<crate::model::CloudStorageConfig>,
1009        {
1010            self.0.request.cloud_storage_config = v.map(|x| x.into());
1011            self
1012        }
1013
1014        /// Sets the value of [bigtable_config][crate::model::Subscription::bigtable_config].
1015        pub fn set_bigtable_config<T>(mut self, v: T) -> Self
1016        where
1017            T: std::convert::Into<crate::model::BigtableConfig>,
1018        {
1019            self.0.request.bigtable_config = std::option::Option::Some(v.into());
1020            self
1021        }
1022
1023        /// Sets or clears the value of [bigtable_config][crate::model::Subscription::bigtable_config].
1024        pub fn set_or_clear_bigtable_config<T>(mut self, v: std::option::Option<T>) -> Self
1025        where
1026            T: std::convert::Into<crate::model::BigtableConfig>,
1027        {
1028            self.0.request.bigtable_config = v.map(|x| x.into());
1029            self
1030        }
1031
1032        /// Sets the value of [ack_deadline_seconds][crate::model::Subscription::ack_deadline_seconds].
1033        pub fn set_ack_deadline_seconds<T: Into<i32>>(mut self, v: T) -> Self {
1034            self.0.request.ack_deadline_seconds = v.into();
1035            self
1036        }
1037
1038        /// Sets the value of [retain_acked_messages][crate::model::Subscription::retain_acked_messages].
1039        pub fn set_retain_acked_messages<T: Into<bool>>(mut self, v: T) -> Self {
1040            self.0.request.retain_acked_messages = v.into();
1041            self
1042        }
1043
1044        /// Sets the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
1045        pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
1046        where
1047            T: std::convert::Into<wkt::Duration>,
1048        {
1049            self.0.request.message_retention_duration = std::option::Option::Some(v.into());
1050            self
1051        }
1052
1053        /// Sets or clears the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
1054        pub fn set_or_clear_message_retention_duration<T>(
1055            mut self,
1056            v: std::option::Option<T>,
1057        ) -> Self
1058        where
1059            T: std::convert::Into<wkt::Duration>,
1060        {
1061            self.0.request.message_retention_duration = v.map(|x| x.into());
1062            self
1063        }
1064
1065        /// Sets the value of [labels][crate::model::Subscription::labels].
1066        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1067        where
1068            T: std::iter::IntoIterator<Item = (K, V)>,
1069            K: std::convert::Into<std::string::String>,
1070            V: std::convert::Into<std::string::String>,
1071        {
1072            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1073            self
1074        }
1075
1076        /// Sets the value of [enable_message_ordering][crate::model::Subscription::enable_message_ordering].
1077        pub fn set_enable_message_ordering<T: Into<bool>>(mut self, v: T) -> Self {
1078            self.0.request.enable_message_ordering = v.into();
1079            self
1080        }
1081
1082        /// Sets the value of [expiration_policy][crate::model::Subscription::expiration_policy].
1083        pub fn set_expiration_policy<T>(mut self, v: T) -> Self
1084        where
1085            T: std::convert::Into<crate::model::ExpirationPolicy>,
1086        {
1087            self.0.request.expiration_policy = std::option::Option::Some(v.into());
1088            self
1089        }
1090
1091        /// Sets or clears the value of [expiration_policy][crate::model::Subscription::expiration_policy].
1092        pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
1093        where
1094            T: std::convert::Into<crate::model::ExpirationPolicy>,
1095        {
1096            self.0.request.expiration_policy = v.map(|x| x.into());
1097            self
1098        }
1099
1100        /// Sets the value of [filter][crate::model::Subscription::filter].
1101        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1102            self.0.request.filter = v.into();
1103            self
1104        }
1105
1106        /// Sets the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
1107        pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
1108        where
1109            T: std::convert::Into<crate::model::DeadLetterPolicy>,
1110        {
1111            self.0.request.dead_letter_policy = std::option::Option::Some(v.into());
1112            self
1113        }
1114
1115        /// Sets or clears the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
1116        pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
1117        where
1118            T: std::convert::Into<crate::model::DeadLetterPolicy>,
1119        {
1120            self.0.request.dead_letter_policy = v.map(|x| x.into());
1121            self
1122        }
1123
1124        /// Sets the value of [retry_policy][crate::model::Subscription::retry_policy].
1125        pub fn set_retry_policy<T>(mut self, v: T) -> Self
1126        where
1127            T: std::convert::Into<crate::model::RetryPolicy>,
1128        {
1129            self.0.request.retry_policy = std::option::Option::Some(v.into());
1130            self
1131        }
1132
1133        /// Sets or clears the value of [retry_policy][crate::model::Subscription::retry_policy].
1134        pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
1135        where
1136            T: std::convert::Into<crate::model::RetryPolicy>,
1137        {
1138            self.0.request.retry_policy = v.map(|x| x.into());
1139            self
1140        }
1141
1142        /// Sets the value of [detached][crate::model::Subscription::detached].
1143        pub fn set_detached<T: Into<bool>>(mut self, v: T) -> Self {
1144            self.0.request.detached = v.into();
1145            self
1146        }
1147
1148        /// Sets the value of [enable_exactly_once_delivery][crate::model::Subscription::enable_exactly_once_delivery].
1149        pub fn set_enable_exactly_once_delivery<T: Into<bool>>(mut self, v: T) -> Self {
1150            self.0.request.enable_exactly_once_delivery = v.into();
1151            self
1152        }
1153
1154        /// Sets the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
1155        pub fn set_topic_message_retention_duration<T>(mut self, v: T) -> Self
1156        where
1157            T: std::convert::Into<wkt::Duration>,
1158        {
1159            self.0.request.topic_message_retention_duration = std::option::Option::Some(v.into());
1160            self
1161        }
1162
1163        /// Sets or clears the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
1164        pub fn set_or_clear_topic_message_retention_duration<T>(
1165            mut self,
1166            v: std::option::Option<T>,
1167        ) -> Self
1168        where
1169            T: std::convert::Into<wkt::Duration>,
1170        {
1171            self.0.request.topic_message_retention_duration = v.map(|x| x.into());
1172            self
1173        }
1174
1175        /// Sets the value of [state][crate::model::Subscription::state].
1176        pub fn set_state<T: Into<crate::model::subscription::State>>(mut self, v: T) -> Self {
1177            self.0.request.state = v.into();
1178            self
1179        }
1180
1181        /// Sets the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
1182        pub fn set_analytics_hub_subscription_info<T>(mut self, v: T) -> Self
1183        where
1184            T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1185        {
1186            self.0.request.analytics_hub_subscription_info = std::option::Option::Some(v.into());
1187            self
1188        }
1189
1190        /// Sets or clears the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
1191        pub fn set_or_clear_analytics_hub_subscription_info<T>(
1192            mut self,
1193            v: std::option::Option<T>,
1194        ) -> Self
1195        where
1196            T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
1197        {
1198            self.0.request.analytics_hub_subscription_info = v.map(|x| x.into());
1199            self
1200        }
1201
1202        /// Sets the value of [message_transforms][crate::model::Subscription::message_transforms].
1203        pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
1204        where
1205            T: std::iter::IntoIterator<Item = V>,
1206            V: std::convert::Into<crate::model::MessageTransform>,
1207        {
1208            use std::iter::Iterator;
1209            self.0.request.message_transforms = v.into_iter().map(|i| i.into()).collect();
1210            self
1211        }
1212
1213        /// Sets the value of [tags][crate::model::Subscription::tags].
1214        pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1215        where
1216            T: std::iter::IntoIterator<Item = (K, V)>,
1217            K: std::convert::Into<std::string::String>,
1218            V: std::convert::Into<std::string::String>,
1219        {
1220            self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1221            self
1222        }
1223    }
1224
1225    #[doc(hidden)]
1226    impl crate::RequestBuilder for CreateSubscription {
1227        fn request_options(&mut self) -> &mut crate::RequestOptions {
1228            &mut self.0.options
1229        }
1230    }
1231
1232    /// The request builder for [SubscriptionAdmin::get_subscription][crate::client::SubscriptionAdmin::get_subscription] calls.
1233    ///
1234    /// # Example
1235    /// ```
1236    /// # use google_cloud_pubsub::builder::subscription_admin::GetSubscription;
1237    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1238    ///
1239    /// let builder = prepare_request_builder();
1240    /// let response = builder.send().await?;
1241    /// # Ok(()) }
1242    ///
1243    /// fn prepare_request_builder() -> GetSubscription {
1244    ///   # panic!();
1245    ///   // ... details omitted ...
1246    /// }
1247    /// ```
1248    #[derive(Clone, Debug)]
1249    pub struct GetSubscription(RequestBuilder<crate::model::GetSubscriptionRequest>);
1250
1251    impl GetSubscription {
1252        pub(crate) fn new(
1253            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1254        ) -> Self {
1255            Self(RequestBuilder::new(stub))
1256        }
1257
1258        /// Sets the full request, replacing any prior values.
1259        pub fn with_request<V: Into<crate::model::GetSubscriptionRequest>>(mut self, v: V) -> Self {
1260            self.0.request = v.into();
1261            self
1262        }
1263
1264        /// Sets all the options, replacing any prior values.
1265        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1266            self.0.options = v.into();
1267            self
1268        }
1269
1270        /// Sends the request.
1271        pub async fn send(self) -> Result<crate::model::Subscription> {
1272            (*self.0.stub)
1273                .get_subscription(self.0.request, self.0.options)
1274                .await
1275                .map(crate::Response::into_body)
1276        }
1277
1278        /// Sets the value of [subscription][crate::model::GetSubscriptionRequest::subscription].
1279        ///
1280        /// This is a **required** field for requests.
1281        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1282            self.0.request.subscription = v.into();
1283            self
1284        }
1285    }
1286
1287    #[doc(hidden)]
1288    impl crate::RequestBuilder for GetSubscription {
1289        fn request_options(&mut self) -> &mut crate::RequestOptions {
1290            &mut self.0.options
1291        }
1292    }
1293
1294    /// The request builder for [SubscriptionAdmin::update_subscription][crate::client::SubscriptionAdmin::update_subscription] calls.
1295    ///
1296    /// # Example
1297    /// ```
1298    /// # use google_cloud_pubsub::builder::subscription_admin::UpdateSubscription;
1299    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1300    ///
1301    /// let builder = prepare_request_builder();
1302    /// let response = builder.send().await?;
1303    /// # Ok(()) }
1304    ///
1305    /// fn prepare_request_builder() -> UpdateSubscription {
1306    ///   # panic!();
1307    ///   // ... details omitted ...
1308    /// }
1309    /// ```
1310    #[derive(Clone, Debug)]
1311    pub struct UpdateSubscription(RequestBuilder<crate::model::UpdateSubscriptionRequest>);
1312
1313    impl UpdateSubscription {
1314        pub(crate) fn new(
1315            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1316        ) -> Self {
1317            Self(RequestBuilder::new(stub))
1318        }
1319
1320        /// Sets the full request, replacing any prior values.
1321        pub fn with_request<V: Into<crate::model::UpdateSubscriptionRequest>>(
1322            mut self,
1323            v: V,
1324        ) -> Self {
1325            self.0.request = v.into();
1326            self
1327        }
1328
1329        /// Sets all the options, replacing any prior values.
1330        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1331            self.0.options = v.into();
1332            self
1333        }
1334
1335        /// Sends the request.
1336        pub async fn send(self) -> Result<crate::model::Subscription> {
1337            (*self.0.stub)
1338                .update_subscription(self.0.request, self.0.options)
1339                .await
1340                .map(crate::Response::into_body)
1341        }
1342
1343        /// Sets the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
1344        ///
1345        /// This is a **required** field for requests.
1346        pub fn set_subscription<T>(mut self, v: T) -> Self
1347        where
1348            T: std::convert::Into<crate::model::Subscription>,
1349        {
1350            self.0.request.subscription = std::option::Option::Some(v.into());
1351            self
1352        }
1353
1354        /// Sets or clears the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
1355        ///
1356        /// This is a **required** field for requests.
1357        pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
1358        where
1359            T: std::convert::Into<crate::model::Subscription>,
1360        {
1361            self.0.request.subscription = v.map(|x| x.into());
1362            self
1363        }
1364
1365        /// Sets the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
1366        ///
1367        /// This is a **required** field for requests.
1368        pub fn set_update_mask<T>(mut self, v: T) -> Self
1369        where
1370            T: std::convert::Into<wkt::FieldMask>,
1371        {
1372            self.0.request.update_mask = std::option::Option::Some(v.into());
1373            self
1374        }
1375
1376        /// Sets or clears the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
1377        ///
1378        /// This is a **required** field for requests.
1379        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1380        where
1381            T: std::convert::Into<wkt::FieldMask>,
1382        {
1383            self.0.request.update_mask = v.map(|x| x.into());
1384            self
1385        }
1386    }
1387
1388    #[doc(hidden)]
1389    impl crate::RequestBuilder for UpdateSubscription {
1390        fn request_options(&mut self) -> &mut crate::RequestOptions {
1391            &mut self.0.options
1392        }
1393    }
1394
1395    /// The request builder for [SubscriptionAdmin::list_subscriptions][crate::client::SubscriptionAdmin::list_subscriptions] calls.
1396    ///
1397    /// # Example
1398    /// ```
1399    /// # use google_cloud_pubsub::builder::subscription_admin::ListSubscriptions;
1400    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1401    /// use google_cloud_gax::paginator::ItemPaginator;
1402    ///
1403    /// let builder = prepare_request_builder();
1404    /// let mut items = builder.by_item();
1405    /// while let Some(result) = items.next().await {
1406    ///   let item = result?;
1407    /// }
1408    /// # Ok(()) }
1409    ///
1410    /// fn prepare_request_builder() -> ListSubscriptions {
1411    ///   # panic!();
1412    ///   // ... details omitted ...
1413    /// }
1414    /// ```
1415    #[derive(Clone, Debug)]
1416    pub struct ListSubscriptions(RequestBuilder<crate::model::ListSubscriptionsRequest>);
1417
1418    impl ListSubscriptions {
1419        pub(crate) fn new(
1420            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1421        ) -> Self {
1422            Self(RequestBuilder::new(stub))
1423        }
1424
1425        /// Sets the full request, replacing any prior values.
1426        pub fn with_request<V: Into<crate::model::ListSubscriptionsRequest>>(
1427            mut self,
1428            v: V,
1429        ) -> Self {
1430            self.0.request = v.into();
1431            self
1432        }
1433
1434        /// Sets all the options, replacing any prior values.
1435        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1436            self.0.options = v.into();
1437            self
1438        }
1439
1440        /// Sends the request.
1441        pub async fn send(self) -> Result<crate::model::ListSubscriptionsResponse> {
1442            (*self.0.stub)
1443                .list_subscriptions(self.0.request, self.0.options)
1444                .await
1445                .map(crate::Response::into_body)
1446        }
1447
1448        /// Streams each page in the collection.
1449        pub fn by_page(
1450            self,
1451        ) -> impl google_cloud_gax::paginator::Paginator<
1452            crate::model::ListSubscriptionsResponse,
1453            crate::Error,
1454        > {
1455            use std::clone::Clone;
1456            let token = self.0.request.page_token.clone();
1457            let execute = move |token: String| {
1458                let mut builder = self.clone();
1459                builder.0.request = builder.0.request.set_page_token(token);
1460                builder.send()
1461            };
1462            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1463        }
1464
1465        /// Streams each item in the collection.
1466        pub fn by_item(
1467            self,
1468        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1469            crate::model::ListSubscriptionsResponse,
1470            crate::Error,
1471        > {
1472            use google_cloud_gax::paginator::Paginator;
1473            self.by_page().items()
1474        }
1475
1476        /// Sets the value of [project][crate::model::ListSubscriptionsRequest::project].
1477        ///
1478        /// This is a **required** field for requests.
1479        pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1480            self.0.request.project = v.into();
1481            self
1482        }
1483
1484        /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
1485        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1486            self.0.request.page_size = v.into();
1487            self
1488        }
1489
1490        /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
1491        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1492            self.0.request.page_token = v.into();
1493            self
1494        }
1495    }
1496
1497    #[doc(hidden)]
1498    impl crate::RequestBuilder for ListSubscriptions {
1499        fn request_options(&mut self) -> &mut crate::RequestOptions {
1500            &mut self.0.options
1501        }
1502    }
1503
1504    /// The request builder for [SubscriptionAdmin::delete_subscription][crate::client::SubscriptionAdmin::delete_subscription] calls.
1505    ///
1506    /// # Example
1507    /// ```
1508    /// # use google_cloud_pubsub::builder::subscription_admin::DeleteSubscription;
1509    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1510    ///
1511    /// let builder = prepare_request_builder();
1512    /// let response = builder.send().await?;
1513    /// # Ok(()) }
1514    ///
1515    /// fn prepare_request_builder() -> DeleteSubscription {
1516    ///   # panic!();
1517    ///   // ... details omitted ...
1518    /// }
1519    /// ```
1520    #[derive(Clone, Debug)]
1521    pub struct DeleteSubscription(RequestBuilder<crate::model::DeleteSubscriptionRequest>);
1522
1523    impl DeleteSubscription {
1524        pub(crate) fn new(
1525            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1526        ) -> Self {
1527            Self(RequestBuilder::new(stub))
1528        }
1529
1530        /// Sets the full request, replacing any prior values.
1531        pub fn with_request<V: Into<crate::model::DeleteSubscriptionRequest>>(
1532            mut self,
1533            v: V,
1534        ) -> Self {
1535            self.0.request = v.into();
1536            self
1537        }
1538
1539        /// Sets all the options, replacing any prior values.
1540        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1541            self.0.options = v.into();
1542            self
1543        }
1544
1545        /// Sends the request.
1546        pub async fn send(self) -> Result<()> {
1547            (*self.0.stub)
1548                .delete_subscription(self.0.request, self.0.options)
1549                .await
1550                .map(crate::Response::into_body)
1551        }
1552
1553        /// Sets the value of [subscription][crate::model::DeleteSubscriptionRequest::subscription].
1554        ///
1555        /// This is a **required** field for requests.
1556        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1557            self.0.request.subscription = v.into();
1558            self
1559        }
1560    }
1561
1562    #[doc(hidden)]
1563    impl crate::RequestBuilder for DeleteSubscription {
1564        fn request_options(&mut self) -> &mut crate::RequestOptions {
1565            &mut self.0.options
1566        }
1567    }
1568
1569    /// The request builder for [SubscriptionAdmin::modify_push_config][crate::client::SubscriptionAdmin::modify_push_config] calls.
1570    ///
1571    /// # Example
1572    /// ```
1573    /// # use google_cloud_pubsub::builder::subscription_admin::ModifyPushConfig;
1574    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1575    ///
1576    /// let builder = prepare_request_builder();
1577    /// let response = builder.send().await?;
1578    /// # Ok(()) }
1579    ///
1580    /// fn prepare_request_builder() -> ModifyPushConfig {
1581    ///   # panic!();
1582    ///   // ... details omitted ...
1583    /// }
1584    /// ```
1585    #[derive(Clone, Debug)]
1586    pub struct ModifyPushConfig(RequestBuilder<crate::model::ModifyPushConfigRequest>);
1587
1588    impl ModifyPushConfig {
1589        pub(crate) fn new(
1590            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1591        ) -> Self {
1592            Self(RequestBuilder::new(stub))
1593        }
1594
1595        /// Sets the full request, replacing any prior values.
1596        pub fn with_request<V: Into<crate::model::ModifyPushConfigRequest>>(
1597            mut self,
1598            v: V,
1599        ) -> Self {
1600            self.0.request = v.into();
1601            self
1602        }
1603
1604        /// Sets all the options, replacing any prior values.
1605        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1606            self.0.options = v.into();
1607            self
1608        }
1609
1610        /// Sends the request.
1611        pub async fn send(self) -> Result<()> {
1612            (*self.0.stub)
1613                .modify_push_config(self.0.request, self.0.options)
1614                .await
1615                .map(crate::Response::into_body)
1616        }
1617
1618        /// Sets the value of [subscription][crate::model::ModifyPushConfigRequest::subscription].
1619        ///
1620        /// This is a **required** field for requests.
1621        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1622            self.0.request.subscription = v.into();
1623            self
1624        }
1625
1626        /// Sets the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
1627        ///
1628        /// This is a **required** field for requests.
1629        pub fn set_push_config<T>(mut self, v: T) -> Self
1630        where
1631            T: std::convert::Into<crate::model::PushConfig>,
1632        {
1633            self.0.request.push_config = std::option::Option::Some(v.into());
1634            self
1635        }
1636
1637        /// Sets or clears the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
1638        ///
1639        /// This is a **required** field for requests.
1640        pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
1641        where
1642            T: std::convert::Into<crate::model::PushConfig>,
1643        {
1644            self.0.request.push_config = v.map(|x| x.into());
1645            self
1646        }
1647    }
1648
1649    #[doc(hidden)]
1650    impl crate::RequestBuilder for ModifyPushConfig {
1651        fn request_options(&mut self) -> &mut crate::RequestOptions {
1652            &mut self.0.options
1653        }
1654    }
1655
1656    /// The request builder for [SubscriptionAdmin::get_snapshot][crate::client::SubscriptionAdmin::get_snapshot] calls.
1657    ///
1658    /// # Example
1659    /// ```
1660    /// # use google_cloud_pubsub::builder::subscription_admin::GetSnapshot;
1661    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1662    ///
1663    /// let builder = prepare_request_builder();
1664    /// let response = builder.send().await?;
1665    /// # Ok(()) }
1666    ///
1667    /// fn prepare_request_builder() -> GetSnapshot {
1668    ///   # panic!();
1669    ///   // ... details omitted ...
1670    /// }
1671    /// ```
1672    #[derive(Clone, Debug)]
1673    pub struct GetSnapshot(RequestBuilder<crate::model::GetSnapshotRequest>);
1674
1675    impl GetSnapshot {
1676        pub(crate) fn new(
1677            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1678        ) -> Self {
1679            Self(RequestBuilder::new(stub))
1680        }
1681
1682        /// Sets the full request, replacing any prior values.
1683        pub fn with_request<V: Into<crate::model::GetSnapshotRequest>>(mut self, v: V) -> Self {
1684            self.0.request = v.into();
1685            self
1686        }
1687
1688        /// Sets all the options, replacing any prior values.
1689        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1690            self.0.options = v.into();
1691            self
1692        }
1693
1694        /// Sends the request.
1695        pub async fn send(self) -> Result<crate::model::Snapshot> {
1696            (*self.0.stub)
1697                .get_snapshot(self.0.request, self.0.options)
1698                .await
1699                .map(crate::Response::into_body)
1700        }
1701
1702        /// Sets the value of [snapshot][crate::model::GetSnapshotRequest::snapshot].
1703        ///
1704        /// This is a **required** field for requests.
1705        pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1706            self.0.request.snapshot = v.into();
1707            self
1708        }
1709    }
1710
1711    #[doc(hidden)]
1712    impl crate::RequestBuilder for GetSnapshot {
1713        fn request_options(&mut self) -> &mut crate::RequestOptions {
1714            &mut self.0.options
1715        }
1716    }
1717
1718    /// The request builder for [SubscriptionAdmin::list_snapshots][crate::client::SubscriptionAdmin::list_snapshots] calls.
1719    ///
1720    /// # Example
1721    /// ```
1722    /// # use google_cloud_pubsub::builder::subscription_admin::ListSnapshots;
1723    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1724    /// use google_cloud_gax::paginator::ItemPaginator;
1725    ///
1726    /// let builder = prepare_request_builder();
1727    /// let mut items = builder.by_item();
1728    /// while let Some(result) = items.next().await {
1729    ///   let item = result?;
1730    /// }
1731    /// # Ok(()) }
1732    ///
1733    /// fn prepare_request_builder() -> ListSnapshots {
1734    ///   # panic!();
1735    ///   // ... details omitted ...
1736    /// }
1737    /// ```
1738    #[derive(Clone, Debug)]
1739    pub struct ListSnapshots(RequestBuilder<crate::model::ListSnapshotsRequest>);
1740
1741    impl ListSnapshots {
1742        pub(crate) fn new(
1743            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1744        ) -> Self {
1745            Self(RequestBuilder::new(stub))
1746        }
1747
1748        /// Sets the full request, replacing any prior values.
1749        pub fn with_request<V: Into<crate::model::ListSnapshotsRequest>>(mut self, v: V) -> Self {
1750            self.0.request = v.into();
1751            self
1752        }
1753
1754        /// Sets all the options, replacing any prior values.
1755        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1756            self.0.options = v.into();
1757            self
1758        }
1759
1760        /// Sends the request.
1761        pub async fn send(self) -> Result<crate::model::ListSnapshotsResponse> {
1762            (*self.0.stub)
1763                .list_snapshots(self.0.request, self.0.options)
1764                .await
1765                .map(crate::Response::into_body)
1766        }
1767
1768        /// Streams each page in the collection.
1769        pub fn by_page(
1770            self,
1771        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSnapshotsResponse, crate::Error>
1772        {
1773            use std::clone::Clone;
1774            let token = self.0.request.page_token.clone();
1775            let execute = move |token: String| {
1776                let mut builder = self.clone();
1777                builder.0.request = builder.0.request.set_page_token(token);
1778                builder.send()
1779            };
1780            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1781        }
1782
1783        /// Streams each item in the collection.
1784        pub fn by_item(
1785            self,
1786        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1787            crate::model::ListSnapshotsResponse,
1788            crate::Error,
1789        > {
1790            use google_cloud_gax::paginator::Paginator;
1791            self.by_page().items()
1792        }
1793
1794        /// Sets the value of [project][crate::model::ListSnapshotsRequest::project].
1795        ///
1796        /// This is a **required** field for requests.
1797        pub fn set_project<T: Into<std::string::String>>(mut self, v: T) -> Self {
1798            self.0.request.project = v.into();
1799            self
1800        }
1801
1802        /// Sets the value of [page_size][crate::model::ListSnapshotsRequest::page_size].
1803        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1804            self.0.request.page_size = v.into();
1805            self
1806        }
1807
1808        /// Sets the value of [page_token][crate::model::ListSnapshotsRequest::page_token].
1809        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1810            self.0.request.page_token = v.into();
1811            self
1812        }
1813    }
1814
1815    #[doc(hidden)]
1816    impl crate::RequestBuilder for ListSnapshots {
1817        fn request_options(&mut self) -> &mut crate::RequestOptions {
1818            &mut self.0.options
1819        }
1820    }
1821
1822    /// The request builder for [SubscriptionAdmin::create_snapshot][crate::client::SubscriptionAdmin::create_snapshot] calls.
1823    ///
1824    /// # Example
1825    /// ```
1826    /// # use google_cloud_pubsub::builder::subscription_admin::CreateSnapshot;
1827    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1828    ///
1829    /// let builder = prepare_request_builder();
1830    /// let response = builder.send().await?;
1831    /// # Ok(()) }
1832    ///
1833    /// fn prepare_request_builder() -> CreateSnapshot {
1834    ///   # panic!();
1835    ///   // ... details omitted ...
1836    /// }
1837    /// ```
1838    #[derive(Clone, Debug)]
1839    pub struct CreateSnapshot(RequestBuilder<crate::model::CreateSnapshotRequest>);
1840
1841    impl CreateSnapshot {
1842        pub(crate) fn new(
1843            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1844        ) -> Self {
1845            Self(RequestBuilder::new(stub))
1846        }
1847
1848        /// Sets the full request, replacing any prior values.
1849        pub fn with_request<V: Into<crate::model::CreateSnapshotRequest>>(mut self, v: V) -> Self {
1850            self.0.request = v.into();
1851            self
1852        }
1853
1854        /// Sets all the options, replacing any prior values.
1855        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1856            self.0.options = v.into();
1857            self
1858        }
1859
1860        /// Sends the request.
1861        pub async fn send(self) -> Result<crate::model::Snapshot> {
1862            (*self.0.stub)
1863                .create_snapshot(self.0.request, self.0.options)
1864                .await
1865                .map(crate::Response::into_body)
1866        }
1867
1868        /// Sets the value of [name][crate::model::CreateSnapshotRequest::name].
1869        ///
1870        /// This is a **required** field for requests.
1871        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1872            self.0.request.name = v.into();
1873            self
1874        }
1875
1876        /// Sets the value of [subscription][crate::model::CreateSnapshotRequest::subscription].
1877        ///
1878        /// This is a **required** field for requests.
1879        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
1880            self.0.request.subscription = v.into();
1881            self
1882        }
1883
1884        /// Sets the value of [labels][crate::model::CreateSnapshotRequest::labels].
1885        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1886        where
1887            T: std::iter::IntoIterator<Item = (K, V)>,
1888            K: std::convert::Into<std::string::String>,
1889            V: std::convert::Into<std::string::String>,
1890        {
1891            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1892            self
1893        }
1894
1895        /// Sets the value of [tags][crate::model::CreateSnapshotRequest::tags].
1896        pub fn set_tags<T, K, V>(mut self, v: T) -> Self
1897        where
1898            T: std::iter::IntoIterator<Item = (K, V)>,
1899            K: std::convert::Into<std::string::String>,
1900            V: std::convert::Into<std::string::String>,
1901        {
1902            self.0.request.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1903            self
1904        }
1905    }
1906
1907    #[doc(hidden)]
1908    impl crate::RequestBuilder for CreateSnapshot {
1909        fn request_options(&mut self) -> &mut crate::RequestOptions {
1910            &mut self.0.options
1911        }
1912    }
1913
1914    /// The request builder for [SubscriptionAdmin::update_snapshot][crate::client::SubscriptionAdmin::update_snapshot] calls.
1915    ///
1916    /// # Example
1917    /// ```
1918    /// # use google_cloud_pubsub::builder::subscription_admin::UpdateSnapshot;
1919    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
1920    ///
1921    /// let builder = prepare_request_builder();
1922    /// let response = builder.send().await?;
1923    /// # Ok(()) }
1924    ///
1925    /// fn prepare_request_builder() -> UpdateSnapshot {
1926    ///   # panic!();
1927    ///   // ... details omitted ...
1928    /// }
1929    /// ```
1930    #[derive(Clone, Debug)]
1931    pub struct UpdateSnapshot(RequestBuilder<crate::model::UpdateSnapshotRequest>);
1932
1933    impl UpdateSnapshot {
1934        pub(crate) fn new(
1935            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
1936        ) -> Self {
1937            Self(RequestBuilder::new(stub))
1938        }
1939
1940        /// Sets the full request, replacing any prior values.
1941        pub fn with_request<V: Into<crate::model::UpdateSnapshotRequest>>(mut self, v: V) -> Self {
1942            self.0.request = v.into();
1943            self
1944        }
1945
1946        /// Sets all the options, replacing any prior values.
1947        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1948            self.0.options = v.into();
1949            self
1950        }
1951
1952        /// Sends the request.
1953        pub async fn send(self) -> Result<crate::model::Snapshot> {
1954            (*self.0.stub)
1955                .update_snapshot(self.0.request, self.0.options)
1956                .await
1957                .map(crate::Response::into_body)
1958        }
1959
1960        /// Sets the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
1961        ///
1962        /// This is a **required** field for requests.
1963        pub fn set_snapshot<T>(mut self, v: T) -> Self
1964        where
1965            T: std::convert::Into<crate::model::Snapshot>,
1966        {
1967            self.0.request.snapshot = std::option::Option::Some(v.into());
1968            self
1969        }
1970
1971        /// Sets or clears the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
1972        ///
1973        /// This is a **required** field for requests.
1974        pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
1975        where
1976            T: std::convert::Into<crate::model::Snapshot>,
1977        {
1978            self.0.request.snapshot = v.map(|x| x.into());
1979            self
1980        }
1981
1982        /// Sets the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
1983        ///
1984        /// This is a **required** field for requests.
1985        pub fn set_update_mask<T>(mut self, v: T) -> Self
1986        where
1987            T: std::convert::Into<wkt::FieldMask>,
1988        {
1989            self.0.request.update_mask = std::option::Option::Some(v.into());
1990            self
1991        }
1992
1993        /// Sets or clears the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
1994        ///
1995        /// This is a **required** field for requests.
1996        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1997        where
1998            T: std::convert::Into<wkt::FieldMask>,
1999        {
2000            self.0.request.update_mask = v.map(|x| x.into());
2001            self
2002        }
2003    }
2004
2005    #[doc(hidden)]
2006    impl crate::RequestBuilder for UpdateSnapshot {
2007        fn request_options(&mut self) -> &mut crate::RequestOptions {
2008            &mut self.0.options
2009        }
2010    }
2011
2012    /// The request builder for [SubscriptionAdmin::delete_snapshot][crate::client::SubscriptionAdmin::delete_snapshot] calls.
2013    ///
2014    /// # Example
2015    /// ```
2016    /// # use google_cloud_pubsub::builder::subscription_admin::DeleteSnapshot;
2017    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2018    ///
2019    /// let builder = prepare_request_builder();
2020    /// let response = builder.send().await?;
2021    /// # Ok(()) }
2022    ///
2023    /// fn prepare_request_builder() -> DeleteSnapshot {
2024    ///   # panic!();
2025    ///   // ... details omitted ...
2026    /// }
2027    /// ```
2028    #[derive(Clone, Debug)]
2029    pub struct DeleteSnapshot(RequestBuilder<crate::model::DeleteSnapshotRequest>);
2030
2031    impl DeleteSnapshot {
2032        pub(crate) fn new(
2033            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2034        ) -> Self {
2035            Self(RequestBuilder::new(stub))
2036        }
2037
2038        /// Sets the full request, replacing any prior values.
2039        pub fn with_request<V: Into<crate::model::DeleteSnapshotRequest>>(mut self, v: V) -> Self {
2040            self.0.request = v.into();
2041            self
2042        }
2043
2044        /// Sets all the options, replacing any prior values.
2045        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2046            self.0.options = v.into();
2047            self
2048        }
2049
2050        /// Sends the request.
2051        pub async fn send(self) -> Result<()> {
2052            (*self.0.stub)
2053                .delete_snapshot(self.0.request, self.0.options)
2054                .await
2055                .map(crate::Response::into_body)
2056        }
2057
2058        /// Sets the value of [snapshot][crate::model::DeleteSnapshotRequest::snapshot].
2059        ///
2060        /// This is a **required** field for requests.
2061        pub fn set_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
2062            self.0.request.snapshot = v.into();
2063            self
2064        }
2065    }
2066
2067    #[doc(hidden)]
2068    impl crate::RequestBuilder for DeleteSnapshot {
2069        fn request_options(&mut self) -> &mut crate::RequestOptions {
2070            &mut self.0.options
2071        }
2072    }
2073
2074    /// The request builder for [SubscriptionAdmin::seek][crate::client::SubscriptionAdmin::seek] calls.
2075    ///
2076    /// # Example
2077    /// ```
2078    /// # use google_cloud_pubsub::builder::subscription_admin::Seek;
2079    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2080    ///
2081    /// let builder = prepare_request_builder();
2082    /// let response = builder.send().await?;
2083    /// # Ok(()) }
2084    ///
2085    /// fn prepare_request_builder() -> Seek {
2086    ///   # panic!();
2087    ///   // ... details omitted ...
2088    /// }
2089    /// ```
2090    #[derive(Clone, Debug)]
2091    pub struct Seek(RequestBuilder<crate::model::SeekRequest>);
2092
2093    impl Seek {
2094        pub(crate) fn new(
2095            stub: std::sync::Arc<dyn super::super::stub::dynamic::SubscriptionAdmin>,
2096        ) -> Self {
2097            Self(RequestBuilder::new(stub))
2098        }
2099
2100        /// Sets the full request, replacing any prior values.
2101        pub fn with_request<V: Into<crate::model::SeekRequest>>(mut self, v: V) -> Self {
2102            self.0.request = v.into();
2103            self
2104        }
2105
2106        /// Sets all the options, replacing any prior values.
2107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2108            self.0.options = v.into();
2109            self
2110        }
2111
2112        /// Sends the request.
2113        pub async fn send(self) -> Result<crate::model::SeekResponse> {
2114            (*self.0.stub)
2115                .seek(self.0.request, self.0.options)
2116                .await
2117                .map(crate::Response::into_body)
2118        }
2119
2120        /// Sets the value of [subscription][crate::model::SeekRequest::subscription].
2121        ///
2122        /// This is a **required** field for requests.
2123        pub fn set_subscription<T: Into<std::string::String>>(mut self, v: T) -> Self {
2124            self.0.request.subscription = v.into();
2125            self
2126        }
2127
2128        /// Sets the value of [target][crate::model::SeekRequest::target].
2129        ///
2130        /// Note that all the setters affecting `target` are
2131        /// mutually exclusive.
2132        pub fn set_target<T: Into<Option<crate::model::seek_request::Target>>>(
2133            mut self,
2134            v: T,
2135        ) -> Self {
2136            self.0.request.target = v.into();
2137            self
2138        }
2139
2140        /// Sets the value of [target][crate::model::SeekRequest::target]
2141        /// to hold a `Time`.
2142        ///
2143        /// Note that all the setters affecting `target` are
2144        /// mutually exclusive.
2145        pub fn set_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2146            mut self,
2147            v: T,
2148        ) -> Self {
2149            self.0.request = self.0.request.set_time(v);
2150            self
2151        }
2152
2153        /// Sets the value of [target][crate::model::SeekRequest::target]
2154        /// to hold a `Snapshot`.
2155        ///
2156        /// Note that all the setters affecting `target` are
2157        /// mutually exclusive.
2158        pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2159            self.0.request = self.0.request.set_snapshot(v);
2160            self
2161        }
2162    }
2163
2164    #[doc(hidden)]
2165    impl crate::RequestBuilder for Seek {
2166        fn request_options(&mut self) -> &mut crate::RequestOptions {
2167            &mut self.0.options
2168        }
2169    }
2170}
2171
2172pub mod schema_service {
2173    use crate::Result;
2174
2175    /// A builder for [SchemaService][crate::client::SchemaService].
2176    ///
2177    /// ```
2178    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2179    /// # use google_cloud_pubsub::*;
2180    /// # use builder::schema_service::ClientBuilder;
2181    /// # use client::SchemaService;
2182    /// let builder : ClientBuilder = SchemaService::builder();
2183    /// let client = builder
2184    ///     .with_endpoint("https://pubsub.googleapis.com")
2185    ///     .build().await?;
2186    /// # Ok(()) }
2187    /// ```
2188    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2189
2190    pub(crate) mod client {
2191        use super::super::super::client::SchemaService;
2192        pub struct Factory;
2193        impl crate::ClientFactory for Factory {
2194            type Client = SchemaService;
2195            type Credentials = gaxi::options::Credentials;
2196            async fn build(
2197                self,
2198                config: gaxi::options::ClientConfig,
2199            ) -> crate::ClientBuilderResult<Self::Client> {
2200                Self::Client::new(config).await
2201            }
2202        }
2203    }
2204
2205    /// Common implementation for [crate::client::SchemaService] request builders.
2206    #[derive(Clone, Debug)]
2207    pub(crate) struct RequestBuilder<R: std::default::Default> {
2208        stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2209        request: R,
2210        options: crate::RequestOptions,
2211    }
2212
2213    impl<R> RequestBuilder<R>
2214    where
2215        R: std::default::Default,
2216    {
2217        pub(crate) fn new(
2218            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2219        ) -> Self {
2220            Self {
2221                stub,
2222                request: R::default(),
2223                options: crate::RequestOptions::default(),
2224            }
2225        }
2226    }
2227
2228    /// The request builder for [SchemaService::create_schema][crate::client::SchemaService::create_schema] calls.
2229    ///
2230    /// # Example
2231    /// ```
2232    /// # use google_cloud_pubsub::builder::schema_service::CreateSchema;
2233    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2234    ///
2235    /// let builder = prepare_request_builder();
2236    /// let response = builder.send().await?;
2237    /// # Ok(()) }
2238    ///
2239    /// fn prepare_request_builder() -> CreateSchema {
2240    ///   # panic!();
2241    ///   // ... details omitted ...
2242    /// }
2243    /// ```
2244    #[derive(Clone, Debug)]
2245    pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
2246
2247    impl CreateSchema {
2248        pub(crate) fn new(
2249            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2250        ) -> Self {
2251            Self(RequestBuilder::new(stub))
2252        }
2253
2254        /// Sets the full request, replacing any prior values.
2255        pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
2256            self.0.request = v.into();
2257            self
2258        }
2259
2260        /// Sets all the options, replacing any prior values.
2261        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2262            self.0.options = v.into();
2263            self
2264        }
2265
2266        /// Sends the request.
2267        pub async fn send(self) -> Result<crate::model::Schema> {
2268            (*self.0.stub)
2269                .create_schema(self.0.request, self.0.options)
2270                .await
2271                .map(crate::Response::into_body)
2272        }
2273
2274        /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
2275        ///
2276        /// This is a **required** field for requests.
2277        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278            self.0.request.parent = v.into();
2279            self
2280        }
2281
2282        /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
2283        ///
2284        /// This is a **required** field for requests.
2285        pub fn set_schema<T>(mut self, v: T) -> Self
2286        where
2287            T: std::convert::Into<crate::model::Schema>,
2288        {
2289            self.0.request.schema = std::option::Option::Some(v.into());
2290            self
2291        }
2292
2293        /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
2294        ///
2295        /// This is a **required** field for requests.
2296        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2297        where
2298            T: std::convert::Into<crate::model::Schema>,
2299        {
2300            self.0.request.schema = v.map(|x| x.into());
2301            self
2302        }
2303
2304        /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
2305        pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2306            self.0.request.schema_id = v.into();
2307            self
2308        }
2309    }
2310
2311    #[doc(hidden)]
2312    impl crate::RequestBuilder for CreateSchema {
2313        fn request_options(&mut self) -> &mut crate::RequestOptions {
2314            &mut self.0.options
2315        }
2316    }
2317
2318    /// The request builder for [SchemaService::get_schema][crate::client::SchemaService::get_schema] calls.
2319    ///
2320    /// # Example
2321    /// ```
2322    /// # use google_cloud_pubsub::builder::schema_service::GetSchema;
2323    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2324    ///
2325    /// let builder = prepare_request_builder();
2326    /// let response = builder.send().await?;
2327    /// # Ok(()) }
2328    ///
2329    /// fn prepare_request_builder() -> GetSchema {
2330    ///   # panic!();
2331    ///   // ... details omitted ...
2332    /// }
2333    /// ```
2334    #[derive(Clone, Debug)]
2335    pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
2336
2337    impl GetSchema {
2338        pub(crate) fn new(
2339            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2340        ) -> Self {
2341            Self(RequestBuilder::new(stub))
2342        }
2343
2344        /// Sets the full request, replacing any prior values.
2345        pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
2346            self.0.request = v.into();
2347            self
2348        }
2349
2350        /// Sets all the options, replacing any prior values.
2351        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2352            self.0.options = v.into();
2353            self
2354        }
2355
2356        /// Sends the request.
2357        pub async fn send(self) -> Result<crate::model::Schema> {
2358            (*self.0.stub)
2359                .get_schema(self.0.request, self.0.options)
2360                .await
2361                .map(crate::Response::into_body)
2362        }
2363
2364        /// Sets the value of [name][crate::model::GetSchemaRequest::name].
2365        ///
2366        /// This is a **required** field for requests.
2367        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2368            self.0.request.name = v.into();
2369            self
2370        }
2371
2372        /// Sets the value of [view][crate::model::GetSchemaRequest::view].
2373        pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2374            self.0.request.view = v.into();
2375            self
2376        }
2377    }
2378
2379    #[doc(hidden)]
2380    impl crate::RequestBuilder for GetSchema {
2381        fn request_options(&mut self) -> &mut crate::RequestOptions {
2382            &mut self.0.options
2383        }
2384    }
2385
2386    /// The request builder for [SchemaService::list_schemas][crate::client::SchemaService::list_schemas] calls.
2387    ///
2388    /// # Example
2389    /// ```
2390    /// # use google_cloud_pubsub::builder::schema_service::ListSchemas;
2391    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2392    /// use google_cloud_gax::paginator::ItemPaginator;
2393    ///
2394    /// let builder = prepare_request_builder();
2395    /// let mut items = builder.by_item();
2396    /// while let Some(result) = items.next().await {
2397    ///   let item = result?;
2398    /// }
2399    /// # Ok(()) }
2400    ///
2401    /// fn prepare_request_builder() -> ListSchemas {
2402    ///   # panic!();
2403    ///   // ... details omitted ...
2404    /// }
2405    /// ```
2406    #[derive(Clone, Debug)]
2407    pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
2408
2409    impl ListSchemas {
2410        pub(crate) fn new(
2411            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2412        ) -> Self {
2413            Self(RequestBuilder::new(stub))
2414        }
2415
2416        /// Sets the full request, replacing any prior values.
2417        pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
2418            self.0.request = v.into();
2419            self
2420        }
2421
2422        /// Sets all the options, replacing any prior values.
2423        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2424            self.0.options = v.into();
2425            self
2426        }
2427
2428        /// Sends the request.
2429        pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
2430            (*self.0.stub)
2431                .list_schemas(self.0.request, self.0.options)
2432                .await
2433                .map(crate::Response::into_body)
2434        }
2435
2436        /// Streams each page in the collection.
2437        pub fn by_page(
2438            self,
2439        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
2440        {
2441            use std::clone::Clone;
2442            let token = self.0.request.page_token.clone();
2443            let execute = move |token: String| {
2444                let mut builder = self.clone();
2445                builder.0.request = builder.0.request.set_page_token(token);
2446                builder.send()
2447            };
2448            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2449        }
2450
2451        /// Streams each item in the collection.
2452        pub fn by_item(
2453            self,
2454        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2455            crate::model::ListSchemasResponse,
2456            crate::Error,
2457        > {
2458            use google_cloud_gax::paginator::Paginator;
2459            self.by_page().items()
2460        }
2461
2462        /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
2463        ///
2464        /// This is a **required** field for requests.
2465        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2466            self.0.request.parent = v.into();
2467            self
2468        }
2469
2470        /// Sets the value of [view][crate::model::ListSchemasRequest::view].
2471        pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2472            self.0.request.view = v.into();
2473            self
2474        }
2475
2476        /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
2477        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2478            self.0.request.page_size = v.into();
2479            self
2480        }
2481
2482        /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
2483        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2484            self.0.request.page_token = v.into();
2485            self
2486        }
2487    }
2488
2489    #[doc(hidden)]
2490    impl crate::RequestBuilder for ListSchemas {
2491        fn request_options(&mut self) -> &mut crate::RequestOptions {
2492            &mut self.0.options
2493        }
2494    }
2495
2496    /// The request builder for [SchemaService::list_schema_revisions][crate::client::SchemaService::list_schema_revisions] calls.
2497    ///
2498    /// # Example
2499    /// ```
2500    /// # use google_cloud_pubsub::builder::schema_service::ListSchemaRevisions;
2501    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2502    /// use google_cloud_gax::paginator::ItemPaginator;
2503    ///
2504    /// let builder = prepare_request_builder();
2505    /// let mut items = builder.by_item();
2506    /// while let Some(result) = items.next().await {
2507    ///   let item = result?;
2508    /// }
2509    /// # Ok(()) }
2510    ///
2511    /// fn prepare_request_builder() -> ListSchemaRevisions {
2512    ///   # panic!();
2513    ///   // ... details omitted ...
2514    /// }
2515    /// ```
2516    #[derive(Clone, Debug)]
2517    pub struct ListSchemaRevisions(RequestBuilder<crate::model::ListSchemaRevisionsRequest>);
2518
2519    impl ListSchemaRevisions {
2520        pub(crate) fn new(
2521            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2522        ) -> Self {
2523            Self(RequestBuilder::new(stub))
2524        }
2525
2526        /// Sets the full request, replacing any prior values.
2527        pub fn with_request<V: Into<crate::model::ListSchemaRevisionsRequest>>(
2528            mut self,
2529            v: V,
2530        ) -> Self {
2531            self.0.request = v.into();
2532            self
2533        }
2534
2535        /// Sets all the options, replacing any prior values.
2536        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2537            self.0.options = v.into();
2538            self
2539        }
2540
2541        /// Sends the request.
2542        pub async fn send(self) -> Result<crate::model::ListSchemaRevisionsResponse> {
2543            (*self.0.stub)
2544                .list_schema_revisions(self.0.request, self.0.options)
2545                .await
2546                .map(crate::Response::into_body)
2547        }
2548
2549        /// Streams each page in the collection.
2550        pub fn by_page(
2551            self,
2552        ) -> impl google_cloud_gax::paginator::Paginator<
2553            crate::model::ListSchemaRevisionsResponse,
2554            crate::Error,
2555        > {
2556            use std::clone::Clone;
2557            let token = self.0.request.page_token.clone();
2558            let execute = move |token: String| {
2559                let mut builder = self.clone();
2560                builder.0.request = builder.0.request.set_page_token(token);
2561                builder.send()
2562            };
2563            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2564        }
2565
2566        /// Streams each item in the collection.
2567        pub fn by_item(
2568            self,
2569        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2570            crate::model::ListSchemaRevisionsResponse,
2571            crate::Error,
2572        > {
2573            use google_cloud_gax::paginator::Paginator;
2574            self.by_page().items()
2575        }
2576
2577        /// Sets the value of [name][crate::model::ListSchemaRevisionsRequest::name].
2578        ///
2579        /// This is a **required** field for requests.
2580        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2581            self.0.request.name = v.into();
2582            self
2583        }
2584
2585        /// Sets the value of [view][crate::model::ListSchemaRevisionsRequest::view].
2586        pub fn set_view<T: Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
2587            self.0.request.view = v.into();
2588            self
2589        }
2590
2591        /// Sets the value of [page_size][crate::model::ListSchemaRevisionsRequest::page_size].
2592        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2593            self.0.request.page_size = v.into();
2594            self
2595        }
2596
2597        /// Sets the value of [page_token][crate::model::ListSchemaRevisionsRequest::page_token].
2598        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2599            self.0.request.page_token = v.into();
2600            self
2601        }
2602    }
2603
2604    #[doc(hidden)]
2605    impl crate::RequestBuilder for ListSchemaRevisions {
2606        fn request_options(&mut self) -> &mut crate::RequestOptions {
2607            &mut self.0.options
2608        }
2609    }
2610
2611    /// The request builder for [SchemaService::commit_schema][crate::client::SchemaService::commit_schema] calls.
2612    ///
2613    /// # Example
2614    /// ```
2615    /// # use google_cloud_pubsub::builder::schema_service::CommitSchema;
2616    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2617    ///
2618    /// let builder = prepare_request_builder();
2619    /// let response = builder.send().await?;
2620    /// # Ok(()) }
2621    ///
2622    /// fn prepare_request_builder() -> CommitSchema {
2623    ///   # panic!();
2624    ///   // ... details omitted ...
2625    /// }
2626    /// ```
2627    #[derive(Clone, Debug)]
2628    pub struct CommitSchema(RequestBuilder<crate::model::CommitSchemaRequest>);
2629
2630    impl CommitSchema {
2631        pub(crate) fn new(
2632            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2633        ) -> Self {
2634            Self(RequestBuilder::new(stub))
2635        }
2636
2637        /// Sets the full request, replacing any prior values.
2638        pub fn with_request<V: Into<crate::model::CommitSchemaRequest>>(mut self, v: V) -> Self {
2639            self.0.request = v.into();
2640            self
2641        }
2642
2643        /// Sets all the options, replacing any prior values.
2644        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2645            self.0.options = v.into();
2646            self
2647        }
2648
2649        /// Sends the request.
2650        pub async fn send(self) -> Result<crate::model::Schema> {
2651            (*self.0.stub)
2652                .commit_schema(self.0.request, self.0.options)
2653                .await
2654                .map(crate::Response::into_body)
2655        }
2656
2657        /// Sets the value of [name][crate::model::CommitSchemaRequest::name].
2658        ///
2659        /// This is a **required** field for requests.
2660        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2661            self.0.request.name = v.into();
2662            self
2663        }
2664
2665        /// Sets the value of [schema][crate::model::CommitSchemaRequest::schema].
2666        ///
2667        /// This is a **required** field for requests.
2668        pub fn set_schema<T>(mut self, v: T) -> Self
2669        where
2670            T: std::convert::Into<crate::model::Schema>,
2671        {
2672            self.0.request.schema = std::option::Option::Some(v.into());
2673            self
2674        }
2675
2676        /// Sets or clears the value of [schema][crate::model::CommitSchemaRequest::schema].
2677        ///
2678        /// This is a **required** field for requests.
2679        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2680        where
2681            T: std::convert::Into<crate::model::Schema>,
2682        {
2683            self.0.request.schema = v.map(|x| x.into());
2684            self
2685        }
2686    }
2687
2688    #[doc(hidden)]
2689    impl crate::RequestBuilder for CommitSchema {
2690        fn request_options(&mut self) -> &mut crate::RequestOptions {
2691            &mut self.0.options
2692        }
2693    }
2694
2695    /// The request builder for [SchemaService::rollback_schema][crate::client::SchemaService::rollback_schema] calls.
2696    ///
2697    /// # Example
2698    /// ```
2699    /// # use google_cloud_pubsub::builder::schema_service::RollbackSchema;
2700    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2701    ///
2702    /// let builder = prepare_request_builder();
2703    /// let response = builder.send().await?;
2704    /// # Ok(()) }
2705    ///
2706    /// fn prepare_request_builder() -> RollbackSchema {
2707    ///   # panic!();
2708    ///   // ... details omitted ...
2709    /// }
2710    /// ```
2711    #[derive(Clone, Debug)]
2712    pub struct RollbackSchema(RequestBuilder<crate::model::RollbackSchemaRequest>);
2713
2714    impl RollbackSchema {
2715        pub(crate) fn new(
2716            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2717        ) -> Self {
2718            Self(RequestBuilder::new(stub))
2719        }
2720
2721        /// Sets the full request, replacing any prior values.
2722        pub fn with_request<V: Into<crate::model::RollbackSchemaRequest>>(mut self, v: V) -> Self {
2723            self.0.request = v.into();
2724            self
2725        }
2726
2727        /// Sets all the options, replacing any prior values.
2728        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2729            self.0.options = v.into();
2730            self
2731        }
2732
2733        /// Sends the request.
2734        pub async fn send(self) -> Result<crate::model::Schema> {
2735            (*self.0.stub)
2736                .rollback_schema(self.0.request, self.0.options)
2737                .await
2738                .map(crate::Response::into_body)
2739        }
2740
2741        /// Sets the value of [name][crate::model::RollbackSchemaRequest::name].
2742        ///
2743        /// This is a **required** field for requests.
2744        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2745            self.0.request.name = v.into();
2746            self
2747        }
2748
2749        /// Sets the value of [revision_id][crate::model::RollbackSchemaRequest::revision_id].
2750        ///
2751        /// This is a **required** field for requests.
2752        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2753            self.0.request.revision_id = v.into();
2754            self
2755        }
2756    }
2757
2758    #[doc(hidden)]
2759    impl crate::RequestBuilder for RollbackSchema {
2760        fn request_options(&mut self) -> &mut crate::RequestOptions {
2761            &mut self.0.options
2762        }
2763    }
2764
2765    /// The request builder for [SchemaService::delete_schema_revision][crate::client::SchemaService::delete_schema_revision] calls.
2766    ///
2767    /// # Example
2768    /// ```
2769    /// # use google_cloud_pubsub::builder::schema_service::DeleteSchemaRevision;
2770    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2771    ///
2772    /// let builder = prepare_request_builder();
2773    /// let response = builder.send().await?;
2774    /// # Ok(()) }
2775    ///
2776    /// fn prepare_request_builder() -> DeleteSchemaRevision {
2777    ///   # panic!();
2778    ///   // ... details omitted ...
2779    /// }
2780    /// ```
2781    #[derive(Clone, Debug)]
2782    pub struct DeleteSchemaRevision(RequestBuilder<crate::model::DeleteSchemaRevisionRequest>);
2783
2784    impl DeleteSchemaRevision {
2785        pub(crate) fn new(
2786            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2787        ) -> Self {
2788            Self(RequestBuilder::new(stub))
2789        }
2790
2791        /// Sets the full request, replacing any prior values.
2792        pub fn with_request<V: Into<crate::model::DeleteSchemaRevisionRequest>>(
2793            mut self,
2794            v: V,
2795        ) -> Self {
2796            self.0.request = v.into();
2797            self
2798        }
2799
2800        /// Sets all the options, replacing any prior values.
2801        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2802            self.0.options = v.into();
2803            self
2804        }
2805
2806        /// Sends the request.
2807        pub async fn send(self) -> Result<crate::model::Schema> {
2808            (*self.0.stub)
2809                .delete_schema_revision(self.0.request, self.0.options)
2810                .await
2811                .map(crate::Response::into_body)
2812        }
2813
2814        /// Sets the value of [name][crate::model::DeleteSchemaRevisionRequest::name].
2815        ///
2816        /// This is a **required** field for requests.
2817        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2818            self.0.request.name = v.into();
2819            self
2820        }
2821
2822        /// Sets the value of [revision_id][crate::model::DeleteSchemaRevisionRequest::revision_id].
2823        #[deprecated]
2824        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2825            self.0.request.revision_id = v.into();
2826            self
2827        }
2828    }
2829
2830    #[doc(hidden)]
2831    impl crate::RequestBuilder for DeleteSchemaRevision {
2832        fn request_options(&mut self) -> &mut crate::RequestOptions {
2833            &mut self.0.options
2834        }
2835    }
2836
2837    /// The request builder for [SchemaService::delete_schema][crate::client::SchemaService::delete_schema] calls.
2838    ///
2839    /// # Example
2840    /// ```
2841    /// # use google_cloud_pubsub::builder::schema_service::DeleteSchema;
2842    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2843    ///
2844    /// let builder = prepare_request_builder();
2845    /// let response = builder.send().await?;
2846    /// # Ok(()) }
2847    ///
2848    /// fn prepare_request_builder() -> DeleteSchema {
2849    ///   # panic!();
2850    ///   // ... details omitted ...
2851    /// }
2852    /// ```
2853    #[derive(Clone, Debug)]
2854    pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
2855
2856    impl DeleteSchema {
2857        pub(crate) fn new(
2858            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2859        ) -> Self {
2860            Self(RequestBuilder::new(stub))
2861        }
2862
2863        /// Sets the full request, replacing any prior values.
2864        pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
2865            self.0.request = v.into();
2866            self
2867        }
2868
2869        /// Sets all the options, replacing any prior values.
2870        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2871            self.0.options = v.into();
2872            self
2873        }
2874
2875        /// Sends the request.
2876        pub async fn send(self) -> Result<()> {
2877            (*self.0.stub)
2878                .delete_schema(self.0.request, self.0.options)
2879                .await
2880                .map(crate::Response::into_body)
2881        }
2882
2883        /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
2884        ///
2885        /// This is a **required** field for requests.
2886        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2887            self.0.request.name = v.into();
2888            self
2889        }
2890    }
2891
2892    #[doc(hidden)]
2893    impl crate::RequestBuilder for DeleteSchema {
2894        fn request_options(&mut self) -> &mut crate::RequestOptions {
2895            &mut self.0.options
2896        }
2897    }
2898
2899    /// The request builder for [SchemaService::validate_schema][crate::client::SchemaService::validate_schema] calls.
2900    ///
2901    /// # Example
2902    /// ```
2903    /// # use google_cloud_pubsub::builder::schema_service::ValidateSchema;
2904    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2905    ///
2906    /// let builder = prepare_request_builder();
2907    /// let response = builder.send().await?;
2908    /// # Ok(()) }
2909    ///
2910    /// fn prepare_request_builder() -> ValidateSchema {
2911    ///   # panic!();
2912    ///   // ... details omitted ...
2913    /// }
2914    /// ```
2915    #[derive(Clone, Debug)]
2916    pub struct ValidateSchema(RequestBuilder<crate::model::ValidateSchemaRequest>);
2917
2918    impl ValidateSchema {
2919        pub(crate) fn new(
2920            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
2921        ) -> Self {
2922            Self(RequestBuilder::new(stub))
2923        }
2924
2925        /// Sets the full request, replacing any prior values.
2926        pub fn with_request<V: Into<crate::model::ValidateSchemaRequest>>(mut self, v: V) -> Self {
2927            self.0.request = v.into();
2928            self
2929        }
2930
2931        /// Sets all the options, replacing any prior values.
2932        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2933            self.0.options = v.into();
2934            self
2935        }
2936
2937        /// Sends the request.
2938        pub async fn send(self) -> Result<crate::model::ValidateSchemaResponse> {
2939            (*self.0.stub)
2940                .validate_schema(self.0.request, self.0.options)
2941                .await
2942                .map(crate::Response::into_body)
2943        }
2944
2945        /// Sets the value of [parent][crate::model::ValidateSchemaRequest::parent].
2946        ///
2947        /// This is a **required** field for requests.
2948        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2949            self.0.request.parent = v.into();
2950            self
2951        }
2952
2953        /// Sets the value of [schema][crate::model::ValidateSchemaRequest::schema].
2954        ///
2955        /// This is a **required** field for requests.
2956        pub fn set_schema<T>(mut self, v: T) -> Self
2957        where
2958            T: std::convert::Into<crate::model::Schema>,
2959        {
2960            self.0.request.schema = std::option::Option::Some(v.into());
2961            self
2962        }
2963
2964        /// Sets or clears the value of [schema][crate::model::ValidateSchemaRequest::schema].
2965        ///
2966        /// This is a **required** field for requests.
2967        pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
2968        where
2969            T: std::convert::Into<crate::model::Schema>,
2970        {
2971            self.0.request.schema = v.map(|x| x.into());
2972            self
2973        }
2974    }
2975
2976    #[doc(hidden)]
2977    impl crate::RequestBuilder for ValidateSchema {
2978        fn request_options(&mut self) -> &mut crate::RequestOptions {
2979            &mut self.0.options
2980        }
2981    }
2982
2983    /// The request builder for [SchemaService::validate_message][crate::client::SchemaService::validate_message] calls.
2984    ///
2985    /// # Example
2986    /// ```
2987    /// # use google_cloud_pubsub::builder::schema_service::ValidateMessage;
2988    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
2989    ///
2990    /// let builder = prepare_request_builder();
2991    /// let response = builder.send().await?;
2992    /// # Ok(()) }
2993    ///
2994    /// fn prepare_request_builder() -> ValidateMessage {
2995    ///   # panic!();
2996    ///   // ... details omitted ...
2997    /// }
2998    /// ```
2999    #[derive(Clone, Debug)]
3000    pub struct ValidateMessage(RequestBuilder<crate::model::ValidateMessageRequest>);
3001
3002    impl ValidateMessage {
3003        pub(crate) fn new(
3004            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3005        ) -> Self {
3006            Self(RequestBuilder::new(stub))
3007        }
3008
3009        /// Sets the full request, replacing any prior values.
3010        pub fn with_request<V: Into<crate::model::ValidateMessageRequest>>(mut self, v: V) -> Self {
3011            self.0.request = v.into();
3012            self
3013        }
3014
3015        /// Sets all the options, replacing any prior values.
3016        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3017            self.0.options = v.into();
3018            self
3019        }
3020
3021        /// Sends the request.
3022        pub async fn send(self) -> Result<crate::model::ValidateMessageResponse> {
3023            (*self.0.stub)
3024                .validate_message(self.0.request, self.0.options)
3025                .await
3026                .map(crate::Response::into_body)
3027        }
3028
3029        /// Sets the value of [parent][crate::model::ValidateMessageRequest::parent].
3030        ///
3031        /// This is a **required** field for requests.
3032        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3033            self.0.request.parent = v.into();
3034            self
3035        }
3036
3037        /// Sets the value of [message][crate::model::ValidateMessageRequest::message].
3038        pub fn set_message<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3039            self.0.request.message = v.into();
3040            self
3041        }
3042
3043        /// Sets the value of [encoding][crate::model::ValidateMessageRequest::encoding].
3044        pub fn set_encoding<T: Into<crate::model::Encoding>>(mut self, v: T) -> Self {
3045            self.0.request.encoding = v.into();
3046            self
3047        }
3048
3049        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec].
3050        ///
3051        /// Note that all the setters affecting `schema_spec` are
3052        /// mutually exclusive.
3053        pub fn set_schema_spec<
3054            T: Into<Option<crate::model::validate_message_request::SchemaSpec>>,
3055        >(
3056            mut self,
3057            v: T,
3058        ) -> Self {
3059            self.0.request.schema_spec = v.into();
3060            self
3061        }
3062
3063        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
3064        /// to hold a `Name`.
3065        ///
3066        /// Note that all the setters affecting `schema_spec` are
3067        /// mutually exclusive.
3068        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3069            self.0.request = self.0.request.set_name(v);
3070            self
3071        }
3072
3073        /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
3074        /// to hold a `Schema`.
3075        ///
3076        /// Note that all the setters affecting `schema_spec` are
3077        /// mutually exclusive.
3078        pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
3079            mut self,
3080            v: T,
3081        ) -> Self {
3082            self.0.request = self.0.request.set_schema(v);
3083            self
3084        }
3085    }
3086
3087    #[doc(hidden)]
3088    impl crate::RequestBuilder for ValidateMessage {
3089        fn request_options(&mut self) -> &mut crate::RequestOptions {
3090            &mut self.0.options
3091        }
3092    }
3093
3094    /// The request builder for [SchemaService::set_iam_policy][crate::client::SchemaService::set_iam_policy] calls.
3095    ///
3096    /// # Example
3097    /// ```
3098    /// # use google_cloud_pubsub::builder::schema_service::SetIamPolicy;
3099    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3100    ///
3101    /// let builder = prepare_request_builder();
3102    /// let response = builder.send().await?;
3103    /// # Ok(()) }
3104    ///
3105    /// fn prepare_request_builder() -> SetIamPolicy {
3106    ///   # panic!();
3107    ///   // ... details omitted ...
3108    /// }
3109    /// ```
3110    #[derive(Clone, Debug)]
3111    pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
3112
3113    impl SetIamPolicy {
3114        pub(crate) fn new(
3115            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3116        ) -> Self {
3117            Self(RequestBuilder::new(stub))
3118        }
3119
3120        /// Sets the full request, replacing any prior values.
3121        pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
3122            mut self,
3123            v: V,
3124        ) -> Self {
3125            self.0.request = v.into();
3126            self
3127        }
3128
3129        /// Sets all the options, replacing any prior values.
3130        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3131            self.0.options = v.into();
3132            self
3133        }
3134
3135        /// Sends the request.
3136        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3137            (*self.0.stub)
3138                .set_iam_policy(self.0.request, self.0.options)
3139                .await
3140                .map(crate::Response::into_body)
3141        }
3142
3143        /// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
3144        ///
3145        /// This is a **required** field for requests.
3146        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3147            self.0.request.resource = v.into();
3148            self
3149        }
3150
3151        /// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
3152        ///
3153        /// This is a **required** field for requests.
3154        pub fn set_policy<T>(mut self, v: T) -> Self
3155        where
3156            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3157        {
3158            self.0.request.policy = std::option::Option::Some(v.into());
3159            self
3160        }
3161
3162        /// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
3163        ///
3164        /// This is a **required** field for requests.
3165        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
3166        where
3167            T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
3168        {
3169            self.0.request.policy = v.map(|x| x.into());
3170            self
3171        }
3172
3173        /// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
3174        pub fn set_update_mask<T>(mut self, v: T) -> Self
3175        where
3176            T: std::convert::Into<wkt::FieldMask>,
3177        {
3178            self.0.request.update_mask = std::option::Option::Some(v.into());
3179            self
3180        }
3181
3182        /// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
3183        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3184        where
3185            T: std::convert::Into<wkt::FieldMask>,
3186        {
3187            self.0.request.update_mask = v.map(|x| x.into());
3188            self
3189        }
3190    }
3191
3192    #[doc(hidden)]
3193    impl crate::RequestBuilder for SetIamPolicy {
3194        fn request_options(&mut self) -> &mut crate::RequestOptions {
3195            &mut self.0.options
3196        }
3197    }
3198
3199    /// The request builder for [SchemaService::get_iam_policy][crate::client::SchemaService::get_iam_policy] calls.
3200    ///
3201    /// # Example
3202    /// ```
3203    /// # use google_cloud_pubsub::builder::schema_service::GetIamPolicy;
3204    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3205    ///
3206    /// let builder = prepare_request_builder();
3207    /// let response = builder.send().await?;
3208    /// # Ok(()) }
3209    ///
3210    /// fn prepare_request_builder() -> GetIamPolicy {
3211    ///   # panic!();
3212    ///   // ... details omitted ...
3213    /// }
3214    /// ```
3215    #[derive(Clone, Debug)]
3216    pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
3217
3218    impl GetIamPolicy {
3219        pub(crate) fn new(
3220            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3221        ) -> Self {
3222            Self(RequestBuilder::new(stub))
3223        }
3224
3225        /// Sets the full request, replacing any prior values.
3226        pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
3227            mut self,
3228            v: V,
3229        ) -> Self {
3230            self.0.request = v.into();
3231            self
3232        }
3233
3234        /// Sets all the options, replacing any prior values.
3235        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3236            self.0.options = v.into();
3237            self
3238        }
3239
3240        /// Sends the request.
3241        pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
3242            (*self.0.stub)
3243                .get_iam_policy(self.0.request, self.0.options)
3244                .await
3245                .map(crate::Response::into_body)
3246        }
3247
3248        /// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
3249        ///
3250        /// This is a **required** field for requests.
3251        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3252            self.0.request.resource = v.into();
3253            self
3254        }
3255
3256        /// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
3257        pub fn set_options<T>(mut self, v: T) -> Self
3258        where
3259            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3260        {
3261            self.0.request.options = std::option::Option::Some(v.into());
3262            self
3263        }
3264
3265        /// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
3266        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3267        where
3268            T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
3269        {
3270            self.0.request.options = v.map(|x| x.into());
3271            self
3272        }
3273    }
3274
3275    #[doc(hidden)]
3276    impl crate::RequestBuilder for GetIamPolicy {
3277        fn request_options(&mut self) -> &mut crate::RequestOptions {
3278            &mut self.0.options
3279        }
3280    }
3281
3282    /// The request builder for [SchemaService::test_iam_permissions][crate::client::SchemaService::test_iam_permissions] calls.
3283    ///
3284    /// # Example
3285    /// ```
3286    /// # use google_cloud_pubsub::builder::schema_service::TestIamPermissions;
3287    /// # async fn sample() -> google_cloud_pubsub::Result<()> {
3288    ///
3289    /// let builder = prepare_request_builder();
3290    /// let response = builder.send().await?;
3291    /// # Ok(()) }
3292    ///
3293    /// fn prepare_request_builder() -> TestIamPermissions {
3294    ///   # panic!();
3295    ///   // ... details omitted ...
3296    /// }
3297    /// ```
3298    #[derive(Clone, Debug)]
3299    pub struct TestIamPermissions(
3300        RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
3301    );
3302
3303    impl TestIamPermissions {
3304        pub(crate) fn new(
3305            stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
3306        ) -> Self {
3307            Self(RequestBuilder::new(stub))
3308        }
3309
3310        /// Sets the full request, replacing any prior values.
3311        pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
3312            mut self,
3313            v: V,
3314        ) -> Self {
3315            self.0.request = v.into();
3316            self
3317        }
3318
3319        /// Sets all the options, replacing any prior values.
3320        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3321            self.0.options = v.into();
3322            self
3323        }
3324
3325        /// Sends the request.
3326        pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
3327            (*self.0.stub)
3328                .test_iam_permissions(self.0.request, self.0.options)
3329                .await
3330                .map(crate::Response::into_body)
3331        }
3332
3333        /// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
3334        ///
3335        /// This is a **required** field for requests.
3336        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3337            self.0.request.resource = v.into();
3338            self
3339        }
3340
3341        /// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
3342        ///
3343        /// This is a **required** field for requests.
3344        pub fn set_permissions<T, V>(mut self, v: T) -> Self
3345        where
3346            T: std::iter::IntoIterator<Item = V>,
3347            V: std::convert::Into<std::string::String>,
3348        {
3349            use std::iter::Iterator;
3350            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3351            self
3352        }
3353    }
3354
3355    #[doc(hidden)]
3356    impl crate::RequestBuilder for TestIamPermissions {
3357        fn request_options(&mut self) -> &mut crate::RequestOptions {
3358            &mut self.0.options
3359        }
3360    }
3361}