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