#
google_cloud_pubsub/generated/gapic/
model.rs

    1// Copyright 2025 Google LLC
    2//
    3// Licensed under the Apache License, Version 2.0 (the "License");
    4// you may not use this file except in compliance with the License.
    5// You may obtain a copy of the License at
    6//
    7//     https://www.apache.org/licenses/LICENSE-2.0
    8//
    9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14//
    15// Code generated by sidekick. DO NOT EDIT.
    16
    17#![allow(rustdoc::redundant_explicit_links)]
    18#![allow(rustdoc::broken_intra_doc_links)]
    19
    20mod debug;
    21mod deserialize;
    22mod serialize;
    23
    24/// A policy constraining the storage of messages published to the topic.
    25#[derive(Clone, Default, PartialEq)]
    26#[non_exhaustive]
    27pub struct MessageStoragePolicy {
    28    /// Optional. A list of IDs of Google Cloud regions where messages that are
    29    /// published to the topic may be persisted in storage. Messages published by
    30    /// publishers running in non-allowed Google Cloud regions (or running outside
    31    /// of Google Cloud altogether) are routed for storage in one of the allowed
    32    /// regions. An empty list means that no regions are allowed, and is not a
    33    /// valid configuration.
    34    pub allowed_persistence_regions: std::vec::Vec<std::string::String>,
    35
    36    /// Optional. If true, `allowed_persistence_regions` is also used to enforce
    37    /// in-transit guarantees for messages. That is, Pub/Sub will fail
    38    /// Publish operations on this topic and subscribe operations
    39    /// on any subscription attached to this topic in any region that is
    40    /// not in `allowed_persistence_regions`.
    41    pub enforce_in_transit: bool,
    42
    43    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    44}
    45
    46impl MessageStoragePolicy {
    47    pub fn new() -> Self {
    48        std::default::Default::default()
    49    }
    50
    51    /// Sets the value of [allowed_persistence_regions][crate::model::MessageStoragePolicy::allowed_persistence_regions].
    52    ///
    53    /// # Example
    54    /// ```ignore,no_run
    55    /// # use google_cloud_pubsub::model::MessageStoragePolicy;
    56    /// let x = MessageStoragePolicy::new().set_allowed_persistence_regions(["a", "b", "c"]);
    57    /// ```
    58    pub fn set_allowed_persistence_regions<T, V>(mut self, v: T) -> Self
    59    where
    60        T: std::iter::IntoIterator<Item = V>,
    61        V: std::convert::Into<std::string::String>,
    62    {
    63        use std::iter::Iterator;
    64        self.allowed_persistence_regions = v.into_iter().map(|i| i.into()).collect();
    65        self
    66    }
    67
    68    /// Sets the value of [enforce_in_transit][crate::model::MessageStoragePolicy::enforce_in_transit].
    69    ///
    70    /// # Example
    71    /// ```ignore,no_run
    72    /// # use google_cloud_pubsub::model::MessageStoragePolicy;
    73    /// let x = MessageStoragePolicy::new().set_enforce_in_transit(true);
    74    /// ```
    75    pub fn set_enforce_in_transit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    76        self.enforce_in_transit = v.into();
    77        self
    78    }
    79}
    80
    81impl wkt::message::Message for MessageStoragePolicy {
    82    fn typename() -> &'static str {
    83        "type.googleapis.com/google.pubsub.v1.MessageStoragePolicy"
    84    }
    85}
    86
    87/// Settings for validating messages published against a schema.
    88#[derive(Clone, Default, PartialEq)]
    89#[non_exhaustive]
    90pub struct SchemaSettings {
    91    /// Required. The name of the schema that messages published should be
    92    /// validated against. Format is `projects/{project}/schemas/{schema}`. The
    93    /// value of this field will be `_deleted-schema_` if the schema has been
    94    /// deleted.
    95    pub schema: std::string::String,
    96
    97    /// Optional. The encoding of messages validated against `schema`.
    98    pub encoding: crate::model::Encoding,
    99
    100    /// Optional. The minimum (inclusive) revision allowed for validating messages.
    101    /// If empty or not present, allow any revision to be validated against
    102    /// last_revision or any revision created before.
    103    pub first_revision_id: std::string::String,
    104
    105    /// Optional. The maximum (inclusive) revision allowed for validating messages.
    106    /// If empty or not present, allow any revision to be validated against
    107    /// first_revision or any revision created after.
    108    pub last_revision_id: std::string::String,
    109
    110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    111}
    112
    113impl SchemaSettings {
    114    pub fn new() -> Self {
    115        std::default::Default::default()
    116    }
    117
    118    /// Sets the value of [schema][crate::model::SchemaSettings::schema].
    119    ///
    120    /// # Example
    121    /// ```ignore,no_run
    122    /// # use google_cloud_pubsub::model::SchemaSettings;
    123    /// let x = SchemaSettings::new().set_schema("example");
    124    /// ```
    125    pub fn set_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    126        self.schema = v.into();
    127        self
    128    }
    129
    130    /// Sets the value of [encoding][crate::model::SchemaSettings::encoding].
    131    ///
    132    /// # Example
    133    /// ```ignore,no_run
    134    /// # use google_cloud_pubsub::model::SchemaSettings;
    135    /// use google_cloud_pubsub::model::Encoding;
    136    /// let x0 = SchemaSettings::new().set_encoding(Encoding::Json);
    137    /// let x1 = SchemaSettings::new().set_encoding(Encoding::Binary);
    138    /// ```
    139    pub fn set_encoding<T: std::convert::Into<crate::model::Encoding>>(mut self, v: T) -> Self {
    140        self.encoding = v.into();
    141        self
    142    }
    143
    144    /// Sets the value of [first_revision_id][crate::model::SchemaSettings::first_revision_id].
    145    ///
    146    /// # Example
    147    /// ```ignore,no_run
    148    /// # use google_cloud_pubsub::model::SchemaSettings;
    149    /// let x = SchemaSettings::new().set_first_revision_id("example");
    150    /// ```
    151    pub fn set_first_revision_id<T: std::convert::Into<std::string::String>>(
    152        mut self,
    153        v: T,
    154    ) -> Self {
    155        self.first_revision_id = v.into();
    156        self
    157    }
    158
    159    /// Sets the value of [last_revision_id][crate::model::SchemaSettings::last_revision_id].
    160    ///
    161    /// # Example
    162    /// ```ignore,no_run
    163    /// # use google_cloud_pubsub::model::SchemaSettings;
    164    /// let x = SchemaSettings::new().set_last_revision_id("example");
    165    /// ```
    166    pub fn set_last_revision_id<T: std::convert::Into<std::string::String>>(
    167        mut self,
    168        v: T,
    169    ) -> Self {
    170        self.last_revision_id = v.into();
    171        self
    172    }
    173}
    174
    175impl wkt::message::Message for SchemaSettings {
    176    fn typename() -> &'static str {
    177        "type.googleapis.com/google.pubsub.v1.SchemaSettings"
    178    }
    179}
    180
    181/// Settings for an ingestion data source on a topic.
    182#[derive(Clone, Default, PartialEq)]
    183#[non_exhaustive]
    184pub struct IngestionDataSourceSettings {
    185    /// Optional. Platform Logs settings. If unset, no Platform Logs will be
    186    /// generated.
    187    pub platform_logs_settings: std::option::Option<crate::model::PlatformLogsSettings>,
    188
    189    /// Only one source type can have settings set.
    190    pub source: std::option::Option<crate::model::ingestion_data_source_settings::Source>,
    191
    192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    193}
    194
    195impl IngestionDataSourceSettings {
    196    pub fn new() -> Self {
    197        std::default::Default::default()
    198    }
    199
    200    /// Sets the value of [platform_logs_settings][crate::model::IngestionDataSourceSettings::platform_logs_settings].
    201    ///
    202    /// # Example
    203    /// ```ignore,no_run
    204    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    205    /// use google_cloud_pubsub::model::PlatformLogsSettings;
    206    /// let x = IngestionDataSourceSettings::new().set_platform_logs_settings(PlatformLogsSettings::default()/* use setters */);
    207    /// ```
    208    pub fn set_platform_logs_settings<T>(mut self, v: T) -> Self
    209    where
    210        T: std::convert::Into<crate::model::PlatformLogsSettings>,
    211    {
    212        self.platform_logs_settings = std::option::Option::Some(v.into());
    213        self
    214    }
    215
    216    /// Sets or clears the value of [platform_logs_settings][crate::model::IngestionDataSourceSettings::platform_logs_settings].
    217    ///
    218    /// # Example
    219    /// ```ignore,no_run
    220    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    221    /// use google_cloud_pubsub::model::PlatformLogsSettings;
    222    /// let x = IngestionDataSourceSettings::new().set_or_clear_platform_logs_settings(Some(PlatformLogsSettings::default()/* use setters */));
    223    /// let x = IngestionDataSourceSettings::new().set_or_clear_platform_logs_settings(None::<PlatformLogsSettings>);
    224    /// ```
    225    pub fn set_or_clear_platform_logs_settings<T>(mut self, v: std::option::Option<T>) -> Self
    226    where
    227        T: std::convert::Into<crate::model::PlatformLogsSettings>,
    228    {
    229        self.platform_logs_settings = v.map(|x| x.into());
    230        self
    231    }
    232
    233    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source].
    234    ///
    235    /// Note that all the setters affecting `source` are mutually
    236    /// exclusive.
    237    ///
    238    /// # Example
    239    /// ```ignore,no_run
    240    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    241    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    242    /// let x = IngestionDataSourceSettings::new().set_source(Some(
    243    ///     google_cloud_pubsub::model::ingestion_data_source_settings::Source::AwsKinesis(AwsKinesis::default().into())));
    244    /// ```
    245    pub fn set_source<
    246        T: std::convert::Into<
    247                std::option::Option<crate::model::ingestion_data_source_settings::Source>,
    248            >,
    249    >(
    250        mut self,
    251        v: T,
    252    ) -> Self {
    253        self.source = v.into();
    254        self
    255    }
    256
    257    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
    258    /// if it holds a `AwsKinesis`, `None` if the field is not set or
    259    /// holds a different branch.
    260    pub fn aws_kinesis(
    261        &self,
    262    ) -> std::option::Option<
    263        &std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>,
    264    > {
    265        #[allow(unreachable_patterns)]
    266        self.source.as_ref().and_then(|v| match v {
    267            crate::model::ingestion_data_source_settings::Source::AwsKinesis(v) => {
    268                std::option::Option::Some(v)
    269            }
    270            _ => std::option::Option::None,
    271        })
    272    }
    273
    274    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
    275    /// to hold a `AwsKinesis`.
    276    ///
    277    /// Note that all the setters affecting `source` are
    278    /// mutually exclusive.
    279    ///
    280    /// # Example
    281    /// ```ignore,no_run
    282    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    283    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    284    /// let x = IngestionDataSourceSettings::new().set_aws_kinesis(AwsKinesis::default()/* use setters */);
    285    /// assert!(x.aws_kinesis().is_some());
    286    /// assert!(x.cloud_storage().is_none());
    287    /// assert!(x.azure_event_hubs().is_none());
    288    /// assert!(x.aws_msk().is_none());
    289    /// assert!(x.confluent_cloud().is_none());
    290    /// ```
    291    pub fn set_aws_kinesis<
    292        T: std::convert::Into<
    293                std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>,
    294            >,
    295    >(
    296        mut self,
    297        v: T,
    298    ) -> Self {
    299        self.source = std::option::Option::Some(
    300            crate::model::ingestion_data_source_settings::Source::AwsKinesis(v.into()),
    301        );
    302        self
    303    }
    304
    305    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
    306    /// if it holds a `CloudStorage`, `None` if the field is not set or
    307    /// holds a different branch.
    308    pub fn cloud_storage(
    309        &self,
    310    ) -> std::option::Option<
    311        &std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>,
    312    > {
    313        #[allow(unreachable_patterns)]
    314        self.source.as_ref().and_then(|v| match v {
    315            crate::model::ingestion_data_source_settings::Source::CloudStorage(v) => {
    316                std::option::Option::Some(v)
    317            }
    318            _ => std::option::Option::None,
    319        })
    320    }
    321
    322    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
    323    /// to hold a `CloudStorage`.
    324    ///
    325    /// Note that all the setters affecting `source` are
    326    /// mutually exclusive.
    327    ///
    328    /// # Example
    329    /// ```ignore,no_run
    330    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    331    /// use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    332    /// let x = IngestionDataSourceSettings::new().set_cloud_storage(CloudStorage::default()/* use setters */);
    333    /// assert!(x.cloud_storage().is_some());
    334    /// assert!(x.aws_kinesis().is_none());
    335    /// assert!(x.azure_event_hubs().is_none());
    336    /// assert!(x.aws_msk().is_none());
    337    /// assert!(x.confluent_cloud().is_none());
    338    /// ```
    339    pub fn set_cloud_storage<
    340        T: std::convert::Into<
    341                std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>,
    342            >,
    343    >(
    344        mut self,
    345        v: T,
    346    ) -> Self {
    347        self.source = std::option::Option::Some(
    348            crate::model::ingestion_data_source_settings::Source::CloudStorage(v.into()),
    349        );
    350        self
    351    }
    352
    353    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
    354    /// if it holds a `AzureEventHubs`, `None` if the field is not set or
    355    /// holds a different branch.
    356    pub fn azure_event_hubs(
    357        &self,
    358    ) -> std::option::Option<
    359        &std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
    360    > {
    361        #[allow(unreachable_patterns)]
    362        self.source.as_ref().and_then(|v| match v {
    363            crate::model::ingestion_data_source_settings::Source::AzureEventHubs(v) => {
    364                std::option::Option::Some(v)
    365            }
    366            _ => std::option::Option::None,
    367        })
    368    }
    369
    370    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
    371    /// to hold a `AzureEventHubs`.
    372    ///
    373    /// Note that all the setters affecting `source` are
    374    /// mutually exclusive.
    375    ///
    376    /// # Example
    377    /// ```ignore,no_run
    378    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    379    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    380    /// let x = IngestionDataSourceSettings::new().set_azure_event_hubs(AzureEventHubs::default()/* use setters */);
    381    /// assert!(x.azure_event_hubs().is_some());
    382    /// assert!(x.aws_kinesis().is_none());
    383    /// assert!(x.cloud_storage().is_none());
    384    /// assert!(x.aws_msk().is_none());
    385    /// assert!(x.confluent_cloud().is_none());
    386    /// ```
    387    pub fn set_azure_event_hubs<
    388        T: std::convert::Into<
    389                std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
    390            >,
    391    >(
    392        mut self,
    393        v: T,
    394    ) -> Self {
    395        self.source = std::option::Option::Some(
    396            crate::model::ingestion_data_source_settings::Source::AzureEventHubs(v.into()),
    397        );
    398        self
    399    }
    400
    401    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
    402    /// if it holds a `AwsMsk`, `None` if the field is not set or
    403    /// holds a different branch.
    404    pub fn aws_msk(
    405        &self,
    406    ) -> std::option::Option<&std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>>
    407    {
    408        #[allow(unreachable_patterns)]
    409        self.source.as_ref().and_then(|v| match v {
    410            crate::model::ingestion_data_source_settings::Source::AwsMsk(v) => {
    411                std::option::Option::Some(v)
    412            }
    413            _ => std::option::Option::None,
    414        })
    415    }
    416
    417    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
    418    /// to hold a `AwsMsk`.
    419    ///
    420    /// Note that all the setters affecting `source` are
    421    /// mutually exclusive.
    422    ///
    423    /// # Example
    424    /// ```ignore,no_run
    425    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    426    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    427    /// let x = IngestionDataSourceSettings::new().set_aws_msk(AwsMsk::default()/* use setters */);
    428    /// assert!(x.aws_msk().is_some());
    429    /// assert!(x.aws_kinesis().is_none());
    430    /// assert!(x.cloud_storage().is_none());
    431    /// assert!(x.azure_event_hubs().is_none());
    432    /// assert!(x.confluent_cloud().is_none());
    433    /// ```
    434    pub fn set_aws_msk<
    435        T: std::convert::Into<std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>>,
    436    >(
    437        mut self,
    438        v: T,
    439    ) -> Self {
    440        self.source = std::option::Option::Some(
    441            crate::model::ingestion_data_source_settings::Source::AwsMsk(v.into()),
    442        );
    443        self
    444    }
    445
    446    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
    447    /// if it holds a `ConfluentCloud`, `None` if the field is not set or
    448    /// holds a different branch.
    449    pub fn confluent_cloud(
    450        &self,
    451    ) -> std::option::Option<
    452        &std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
    453    > {
    454        #[allow(unreachable_patterns)]
    455        self.source.as_ref().and_then(|v| match v {
    456            crate::model::ingestion_data_source_settings::Source::ConfluentCloud(v) => {
    457                std::option::Option::Some(v)
    458            }
    459            _ => std::option::Option::None,
    460        })
    461    }
    462
    463    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
    464    /// to hold a `ConfluentCloud`.
    465    ///
    466    /// Note that all the setters affecting `source` are
    467    /// mutually exclusive.
    468    ///
    469    /// # Example
    470    /// ```ignore,no_run
    471    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
    472    /// use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    473    /// let x = IngestionDataSourceSettings::new().set_confluent_cloud(ConfluentCloud::default()/* use setters */);
    474    /// assert!(x.confluent_cloud().is_some());
    475    /// assert!(x.aws_kinesis().is_none());
    476    /// assert!(x.cloud_storage().is_none());
    477    /// assert!(x.azure_event_hubs().is_none());
    478    /// assert!(x.aws_msk().is_none());
    479    /// ```
    480    pub fn set_confluent_cloud<
    481        T: std::convert::Into<
    482                std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
    483            >,
    484    >(
    485        mut self,
    486        v: T,
    487    ) -> Self {
    488        self.source = std::option::Option::Some(
    489            crate::model::ingestion_data_source_settings::Source::ConfluentCloud(v.into()),
    490        );
    491        self
    492    }
    493}
    494
    495impl wkt::message::Message for IngestionDataSourceSettings {
    496    fn typename() -> &'static str {
    497        "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings"
    498    }
    499}
    500
    501/// Defines additional types related to [IngestionDataSourceSettings].
    502pub mod ingestion_data_source_settings {
    503    #[allow(unused_imports)]
    504    use super::*;
    505
    506    /// Ingestion settings for Amazon Kinesis Data Streams.
    507    #[derive(Clone, Default, PartialEq)]
    508    #[non_exhaustive]
    509    pub struct AwsKinesis {
    510        /// Output only. An output-only field that indicates the state of the Kinesis
    511        /// ingestion source.
    512        pub state: crate::model::ingestion_data_source_settings::aws_kinesis::State,
    513
    514        /// Required. The Kinesis stream ARN to ingest data from.
    515        pub stream_arn: std::string::String,
    516
    517        /// Required. The Kinesis consumer ARN to used for ingestion in Enhanced
    518        /// Fan-Out mode. The consumer must be already created and ready to be used.
    519        pub consumer_arn: std::string::String,
    520
    521        /// Required. AWS role ARN to be used for Federated Identity authentication
    522        /// with Kinesis. Check the Pub/Sub docs for how to set up this role and the
    523        /// required permissions that need to be attached to it.
    524        pub aws_role_arn: std::string::String,
    525
    526        /// Required. The GCP service account to be used for Federated Identity
    527        /// authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
    528        /// the provided role). The `aws_role_arn` must be set up with
    529        /// `accounts.google.com:sub` equals to this service account number.
    530        pub gcp_service_account: std::string::String,
    531
    532        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    533    }
    534
    535    impl AwsKinesis {
    536        pub fn new() -> Self {
    537            std::default::Default::default()
    538        }
    539
    540        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AwsKinesis::state].
    541        ///
    542        /// # Example
    543        /// ```ignore,no_run
    544        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    545        /// use google_cloud_pubsub::model::ingestion_data_source_settings::aws_kinesis::State;
    546        /// let x0 = AwsKinesis::new().set_state(State::Active);
    547        /// let x1 = AwsKinesis::new().set_state(State::KinesisPermissionDenied);
    548        /// let x2 = AwsKinesis::new().set_state(State::PublishPermissionDenied);
    549        /// ```
    550        pub fn set_state<
    551            T: std::convert::Into<crate::model::ingestion_data_source_settings::aws_kinesis::State>,
    552        >(
    553            mut self,
    554            v: T,
    555        ) -> Self {
    556            self.state = v.into();
    557            self
    558        }
    559
    560        /// Sets the value of [stream_arn][crate::model::ingestion_data_source_settings::AwsKinesis::stream_arn].
    561        ///
    562        /// # Example
    563        /// ```ignore,no_run
    564        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    565        /// let x = AwsKinesis::new().set_stream_arn("example");
    566        /// ```
    567        pub fn set_stream_arn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    568            self.stream_arn = v.into();
    569            self
    570        }
    571
    572        /// Sets the value of [consumer_arn][crate::model::ingestion_data_source_settings::AwsKinesis::consumer_arn].
    573        ///
    574        /// # Example
    575        /// ```ignore,no_run
    576        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    577        /// let x = AwsKinesis::new().set_consumer_arn("example");
    578        /// ```
    579        pub fn set_consumer_arn<T: std::convert::Into<std::string::String>>(
    580            mut self,
    581            v: T,
    582        ) -> Self {
    583            self.consumer_arn = v.into();
    584            self
    585        }
    586
    587        /// Sets the value of [aws_role_arn][crate::model::ingestion_data_source_settings::AwsKinesis::aws_role_arn].
    588        ///
    589        /// # Example
    590        /// ```ignore,no_run
    591        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    592        /// let x = AwsKinesis::new().set_aws_role_arn("example");
    593        /// ```
    594        pub fn set_aws_role_arn<T: std::convert::Into<std::string::String>>(
    595            mut self,
    596            v: T,
    597        ) -> Self {
    598            self.aws_role_arn = v.into();
    599            self
    600        }
    601
    602        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AwsKinesis::gcp_service_account].
    603        ///
    604        /// # Example
    605        /// ```ignore,no_run
    606        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
    607        /// let x = AwsKinesis::new().set_gcp_service_account("example");
    608        /// ```
    609        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
    610            mut self,
    611            v: T,
    612        ) -> Self {
    613            self.gcp_service_account = v.into();
    614            self
    615        }
    616    }
    617
    618    impl wkt::message::Message for AwsKinesis {
    619        fn typename() -> &'static str {
    620            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis"
    621        }
    622    }
    623
    624    /// Defines additional types related to [AwsKinesis].
    625    pub mod aws_kinesis {
    626        #[allow(unused_imports)]
    627        use super::*;
    628
    629        /// Possible states for ingestion from Amazon Kinesis Data Streams.
    630        ///
    631        /// # Working with unknown values
    632        ///
    633        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    634        /// additional enum variants at any time. Adding new variants is not considered
    635        /// a breaking change. Applications should write their code in anticipation of:
    636        ///
    637        /// - New values appearing in future releases of the client library, **and**
    638        /// - New values received dynamically, without application changes.
    639        ///
    640        /// Please consult the [Working with enums] section in the user guide for some
    641        /// guidelines.
    642        ///
    643        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    644        #[derive(Clone, Debug, PartialEq)]
    645        #[non_exhaustive]
    646        pub enum State {
    647            /// Default value. This value is unused.
    648            Unspecified,
    649            /// Ingestion is active.
    650            Active,
    651            /// Permission denied encountered while consuming data from Kinesis.
    652            /// This can happen if:
    653            ///
    654            /// - The provided `aws_role_arn` does not exist or does not have the
    655            ///   appropriate permissions attached.
    656            /// - The provided `aws_role_arn` is not set up properly for Identity
    657            ///   Federation using `gcp_service_account`.
    658            /// - The Pub/Sub SA is not granted the
    659            ///   `iam.serviceAccounts.getOpenIdToken` permission on
    660            ///   `gcp_service_account`.
    661            KinesisPermissionDenied,
    662            /// Permission denied encountered while publishing to the topic. This can
    663            /// happen if the Pub/Sub SA has not been granted the [appropriate publish
    664            /// permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    665            PublishPermissionDenied,
    666            /// The Kinesis stream does not exist.
    667            StreamNotFound,
    668            /// The Kinesis consumer does not exist.
    669            ConsumerNotFound,
    670            /// If set, the enum was initialized with an unknown value.
    671            ///
    672            /// Applications can examine the value using [State::value] or
    673            /// [State::name].
    674            UnknownValue(state::UnknownValue),
    675        }
    676
    677        #[doc(hidden)]
    678        pub mod state {
    679            #[allow(unused_imports)]
    680            use super::*;
    681            #[derive(Clone, Debug, PartialEq)]
    682            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    683        }
    684
    685        impl State {
    686            /// Gets the enum value.
    687            ///
    688            /// Returns `None` if the enum contains an unknown value deserialized from
    689            /// the string representation of enums.
    690            pub fn value(&self) -> std::option::Option<i32> {
    691                match self {
    692                    Self::Unspecified => std::option::Option::Some(0),
    693                    Self::Active => std::option::Option::Some(1),
    694                    Self::KinesisPermissionDenied => std::option::Option::Some(2),
    695                    Self::PublishPermissionDenied => std::option::Option::Some(3),
    696                    Self::StreamNotFound => std::option::Option::Some(4),
    697                    Self::ConsumerNotFound => std::option::Option::Some(5),
    698                    Self::UnknownValue(u) => u.0.value(),
    699                }
    700            }
    701
    702            /// Gets the enum value as a string.
    703            ///
    704            /// Returns `None` if the enum contains an unknown value deserialized from
    705            /// the integer representation of enums.
    706            pub fn name(&self) -> std::option::Option<&str> {
    707                match self {
    708                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    709                    Self::Active => std::option::Option::Some("ACTIVE"),
    710                    Self::KinesisPermissionDenied => {
    711                        std::option::Option::Some("KINESIS_PERMISSION_DENIED")
    712                    }
    713                    Self::PublishPermissionDenied => {
    714                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
    715                    }
    716                    Self::StreamNotFound => std::option::Option::Some("STREAM_NOT_FOUND"),
    717                    Self::ConsumerNotFound => std::option::Option::Some("CONSUMER_NOT_FOUND"),
    718                    Self::UnknownValue(u) => u.0.name(),
    719                }
    720            }
    721        }
    722
    723        impl std::default::Default for State {
    724            fn default() -> Self {
    725                use std::convert::From;
    726                Self::from(0)
    727            }
    728        }
    729
    730        impl std::fmt::Display for State {
    731            fn fmt(
    732                &self,
    733                f: &mut std::fmt::Formatter<'_>,
    734            ) -> std::result::Result<(), std::fmt::Error> {
    735                wkt::internal::display_enum(f, self.name(), self.value())
    736            }
    737        }
    738
    739        impl std::convert::From<i32> for State {
    740            fn from(value: i32) -> Self {
    741                match value {
    742                    0 => Self::Unspecified,
    743                    1 => Self::Active,
    744                    2 => Self::KinesisPermissionDenied,
    745                    3 => Self::PublishPermissionDenied,
    746                    4 => Self::StreamNotFound,
    747                    5 => Self::ConsumerNotFound,
    748                    _ => Self::UnknownValue(state::UnknownValue(
    749                        wkt::internal::UnknownEnumValue::Integer(value),
    750                    )),
    751                }
    752            }
    753        }
    754
    755        impl std::convert::From<&str> for State {
    756            fn from(value: &str) -> Self {
    757                use std::string::ToString;
    758                match value {
    759                    "STATE_UNSPECIFIED" => Self::Unspecified,
    760                    "ACTIVE" => Self::Active,
    761                    "KINESIS_PERMISSION_DENIED" => Self::KinesisPermissionDenied,
    762                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
    763                    "STREAM_NOT_FOUND" => Self::StreamNotFound,
    764                    "CONSUMER_NOT_FOUND" => Self::ConsumerNotFound,
    765                    _ => Self::UnknownValue(state::UnknownValue(
    766                        wkt::internal::UnknownEnumValue::String(value.to_string()),
    767                    )),
    768                }
    769            }
    770        }
    771
    772        impl serde::ser::Serialize for State {
    773            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    774            where
    775                S: serde::Serializer,
    776            {
    777                match self {
    778                    Self::Unspecified => serializer.serialize_i32(0),
    779                    Self::Active => serializer.serialize_i32(1),
    780                    Self::KinesisPermissionDenied => serializer.serialize_i32(2),
    781                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
    782                    Self::StreamNotFound => serializer.serialize_i32(4),
    783                    Self::ConsumerNotFound => serializer.serialize_i32(5),
    784                    Self::UnknownValue(u) => u.0.serialize(serializer),
    785                }
    786            }
    787        }
    788
    789        impl<'de> serde::de::Deserialize<'de> for State {
    790            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    791            where
    792                D: serde::Deserializer<'de>,
    793            {
    794                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    795                    ".google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State",
    796                ))
    797            }
    798        }
    799    }
    800
    801    /// Ingestion settings for Cloud Storage.
    802    #[derive(Clone, Default, PartialEq)]
    803    #[non_exhaustive]
    804    pub struct CloudStorage {
    805        /// Output only. An output-only field that indicates the state of the Cloud
    806        /// Storage ingestion source.
    807        pub state: crate::model::ingestion_data_source_settings::cloud_storage::State,
    808
    809        /// Optional. Cloud Storage bucket. The bucket name must be without any
    810        /// prefix like "gs://". See the [bucket naming requirements]
    811        /// (<https://cloud.google.com/storage/docs/buckets#naming>).
    812        pub bucket: std::string::String,
    813
    814        /// Optional. Only objects with a larger or equal creation timestamp will be
    815        /// ingested.
    816        pub minimum_object_create_time: std::option::Option<wkt::Timestamp>,
    817
    818        /// Optional. Glob pattern used to match objects that will be ingested. If
    819        /// unset, all objects will be ingested. See the [supported
    820        /// patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
    821        pub match_glob: std::string::String,
    822
    823        /// Defaults to text format.
    824        pub input_format: std::option::Option<
    825            crate::model::ingestion_data_source_settings::cloud_storage::InputFormat,
    826        >,
    827
    828        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    829    }
    830
    831    impl CloudStorage {
    832        pub fn new() -> Self {
    833            std::default::Default::default()
    834        }
    835
    836        /// Sets the value of [state][crate::model::ingestion_data_source_settings::CloudStorage::state].
    837        ///
    838        /// # Example
    839        /// ```ignore,no_run
    840        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    841        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::State;
    842        /// let x0 = CloudStorage::new().set_state(State::Active);
    843        /// let x1 = CloudStorage::new().set_state(State::CloudStoragePermissionDenied);
    844        /// let x2 = CloudStorage::new().set_state(State::PublishPermissionDenied);
    845        /// ```
    846        pub fn set_state<
    847            T: std::convert::Into<crate::model::ingestion_data_source_settings::cloud_storage::State>,
    848        >(
    849            mut self,
    850            v: T,
    851        ) -> Self {
    852            self.state = v.into();
    853            self
    854        }
    855
    856        /// Sets the value of [bucket][crate::model::ingestion_data_source_settings::CloudStorage::bucket].
    857        ///
    858        /// # Example
    859        /// ```ignore,no_run
    860        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    861        /// let x = CloudStorage::new().set_bucket("example");
    862        /// ```
    863        pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    864            self.bucket = v.into();
    865            self
    866        }
    867
    868        /// Sets the value of [minimum_object_create_time][crate::model::ingestion_data_source_settings::CloudStorage::minimum_object_create_time].
    869        ///
    870        /// # Example
    871        /// ```ignore,no_run
    872        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    873        /// use wkt::Timestamp;
    874        /// let x = CloudStorage::new().set_minimum_object_create_time(Timestamp::default()/* use setters */);
    875        /// ```
    876        pub fn set_minimum_object_create_time<T>(mut self, v: T) -> Self
    877        where
    878            T: std::convert::Into<wkt::Timestamp>,
    879        {
    880            self.minimum_object_create_time = std::option::Option::Some(v.into());
    881            self
    882        }
    883
    884        /// Sets or clears the value of [minimum_object_create_time][crate::model::ingestion_data_source_settings::CloudStorage::minimum_object_create_time].
    885        ///
    886        /// # Example
    887        /// ```ignore,no_run
    888        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    889        /// use wkt::Timestamp;
    890        /// let x = CloudStorage::new().set_or_clear_minimum_object_create_time(Some(Timestamp::default()/* use setters */));
    891        /// let x = CloudStorage::new().set_or_clear_minimum_object_create_time(None::<Timestamp>);
    892        /// ```
    893        pub fn set_or_clear_minimum_object_create_time<T>(
    894            mut self,
    895            v: std::option::Option<T>,
    896        ) -> Self
    897        where
    898            T: std::convert::Into<wkt::Timestamp>,
    899        {
    900            self.minimum_object_create_time = v.map(|x| x.into());
    901            self
    902        }
    903
    904        /// Sets the value of [match_glob][crate::model::ingestion_data_source_settings::CloudStorage::match_glob].
    905        ///
    906        /// # Example
    907        /// ```ignore,no_run
    908        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    909        /// let x = CloudStorage::new().set_match_glob("example");
    910        /// ```
    911        pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    912            self.match_glob = v.into();
    913            self
    914        }
    915
    916        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format].
    917        ///
    918        /// Note that all the setters affecting `input_format` are mutually
    919        /// exclusive.
    920        ///
    921        /// # Example
    922        /// ```ignore,no_run
    923        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    924        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
    925        /// let x = CloudStorage::new().set_input_format(Some(
    926        ///     google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(TextFormat::default().into())));
    927        /// ```
    928        pub fn set_input_format<
    929            T: std::convert::Into<
    930                    std::option::Option<
    931                        crate::model::ingestion_data_source_settings::cloud_storage::InputFormat,
    932                    >,
    933                >,
    934        >(
    935            mut self,
    936            v: T,
    937        ) -> Self {
    938            self.input_format = v.into();
    939            self
    940        }
    941
    942        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    943        /// if it holds a `TextFormat`, `None` if the field is not set or
    944        /// holds a different branch.
    945        pub fn text_format(
    946            &self,
    947        ) -> std::option::Option<
    948            &std::boxed::Box<
    949                crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
    950            >,
    951        > {
    952            #[allow(unreachable_patterns)]
    953            self.input_format.as_ref().and_then(|v| match v {
    954                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(v) => std::option::Option::Some(v),
    955                _ => std::option::Option::None,
    956            })
    957        }
    958
    959        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    960        /// to hold a `TextFormat`.
    961        ///
    962        /// Note that all the setters affecting `input_format` are
    963        /// mutually exclusive.
    964        ///
    965        /// # Example
    966        /// ```ignore,no_run
    967        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    968        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
    969        /// let x = CloudStorage::new().set_text_format(TextFormat::default()/* use setters */);
    970        /// assert!(x.text_format().is_some());
    971        /// assert!(x.avro_format().is_none());
    972        /// assert!(x.pubsub_avro_format().is_none());
    973        /// ```
    974        pub fn set_text_format<
    975            T: std::convert::Into<
    976                    std::boxed::Box<
    977                        crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
    978                    >,
    979                >,
    980        >(
    981            mut self,
    982            v: T,
    983        ) -> Self {
    984            self.input_format = std::option::Option::Some(
    985                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(
    986                    v.into()
    987                )
    988            );
    989            self
    990        }
    991
    992        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    993        /// if it holds a `AvroFormat`, `None` if the field is not set or
    994        /// holds a different branch.
    995        pub fn avro_format(
    996            &self,
    997        ) -> std::option::Option<
    998            &std::boxed::Box<
    999                crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
    1000            >,
    1001        > {
    1002            #[allow(unreachable_patterns)]
    1003            self.input_format.as_ref().and_then(|v| match v {
    1004                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::AvroFormat(v) => std::option::Option::Some(v),
    1005                _ => std::option::Option::None,
    1006            })
    1007        }
    1008
    1009        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    1010        /// to hold a `AvroFormat`.
    1011        ///
    1012        /// Note that all the setters affecting `input_format` are
    1013        /// mutually exclusive.
    1014        ///
    1015        /// # Example
    1016        /// ```ignore,no_run
    1017        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    1018        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::AvroFormat;
    1019        /// let x = CloudStorage::new().set_avro_format(AvroFormat::default()/* use setters */);
    1020        /// assert!(x.avro_format().is_some());
    1021        /// assert!(x.text_format().is_none());
    1022        /// assert!(x.pubsub_avro_format().is_none());
    1023        /// ```
    1024        pub fn set_avro_format<
    1025            T: std::convert::Into<
    1026                    std::boxed::Box<
    1027                        crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
    1028                    >,
    1029                >,
    1030        >(
    1031            mut self,
    1032            v: T,
    1033        ) -> Self {
    1034            self.input_format = std::option::Option::Some(
    1035                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::AvroFormat(
    1036                    v.into()
    1037                )
    1038            );
    1039            self
    1040        }
    1041
    1042        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    1043        /// if it holds a `PubsubAvroFormat`, `None` if the field is not set or
    1044        /// holds a different branch.
    1045        pub fn pubsub_avro_format(
    1046            &self,
    1047        ) -> std::option::Option<
    1048            &std::boxed::Box<
    1049                crate::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat,
    1050            >,
    1051        > {
    1052            #[allow(unreachable_patterns)]
    1053            self.input_format.as_ref().and_then(|v| match v {
    1054                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::PubsubAvroFormat(v) => std::option::Option::Some(v),
    1055                _ => std::option::Option::None,
    1056            })
    1057        }
    1058
    1059        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
    1060        /// to hold a `PubsubAvroFormat`.
    1061        ///
    1062        /// Note that all the setters affecting `input_format` are
    1063        /// mutually exclusive.
    1064        ///
    1065        /// # Example
    1066        /// ```ignore,no_run
    1067        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
    1068        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat;
    1069        /// let x = CloudStorage::new().set_pubsub_avro_format(PubSubAvroFormat::default()/* use setters */);
    1070        /// assert!(x.pubsub_avro_format().is_some());
    1071        /// assert!(x.text_format().is_none());
    1072        /// assert!(x.avro_format().is_none());
    1073        /// ```
    1074        pub fn set_pubsub_avro_format<T: std::convert::Into<std::boxed::Box<crate::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat>>>(mut self, v: T) -> Self{
    1075            self.input_format = std::option::Option::Some(
    1076                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::PubsubAvroFormat(
    1077                    v.into()
    1078                )
    1079            );
    1080            self
    1081        }
    1082    }
    1083
    1084    impl wkt::message::Message for CloudStorage {
    1085        fn typename() -> &'static str {
    1086            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage"
    1087        }
    1088    }
    1089
    1090    /// Defines additional types related to [CloudStorage].
    1091    pub mod cloud_storage {
    1092        #[allow(unused_imports)]
    1093        use super::*;
    1094
    1095        /// Configuration for reading Cloud Storage data in text format. Each line of
    1096        /// text as specified by the delimiter will be set to the `data` field of a
    1097        /// Pub/Sub message.
    1098        #[derive(Clone, Default, PartialEq)]
    1099        #[non_exhaustive]
    1100        pub struct TextFormat {
    1101            /// Optional. When unset, '\n' is used.
    1102            pub delimiter: std::option::Option<std::string::String>,
    1103
    1104            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    1105        }
    1106
    1107        impl TextFormat {
    1108            pub fn new() -> Self {
    1109                std::default::Default::default()
    1110            }
    1111
    1112            /// Sets the value of [delimiter][crate::model::ingestion_data_source_settings::cloud_storage::TextFormat::delimiter].
    1113            ///
    1114            /// # Example
    1115            /// ```ignore,no_run
    1116            /// # use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
    1117            /// let x = TextFormat::new().set_delimiter("example");
    1118            /// ```
    1119            pub fn set_delimiter<T>(mut self, v: T) -> Self
    1120            where
    1121                T: std::convert::Into<std::string::String>,
    1122            {
    1123                self.delimiter = std::option::Option::Some(v.into());
    1124                self
    1125            }
    1126
    1127            /// Sets or clears the value of [delimiter][crate::model::ingestion_data_source_settings::cloud_storage::TextFormat::delimiter].
    1128            ///
    1129            /// # Example
    1130            /// ```ignore,no_run
    1131            /// # use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
    1132            /// let x = TextFormat::new().set_or_clear_delimiter(Some("example"));
    1133            /// let x = TextFormat::new().set_or_clear_delimiter(None::<String>);
    1134            /// ```
    1135            pub fn set_or_clear_delimiter<T>(mut self, v: std::option::Option<T>) -> Self
    1136            where
    1137                T: std::convert::Into<std::string::String>,
    1138            {
    1139                self.delimiter = v.map(|x| x.into());
    1140                self
    1141            }
    1142        }
    1143
    1144        impl wkt::message::Message for TextFormat {
    1145            fn typename() -> &'static str {
    1146                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat"
    1147            }
    1148        }
    1149
    1150        /// Configuration for reading Cloud Storage data in Avro binary format. The
    1151        /// bytes of each object will be set to the `data` field of a Pub/Sub
    1152        /// message.
    1153        #[derive(Clone, Default, PartialEq)]
    1154        #[non_exhaustive]
    1155        pub struct AvroFormat {
    1156            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    1157        }
    1158
    1159        impl AvroFormat {
    1160            pub fn new() -> Self {
    1161                std::default::Default::default()
    1162            }
    1163        }
    1164
    1165        impl wkt::message::Message for AvroFormat {
    1166            fn typename() -> &'static str {
    1167                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat"
    1168            }
    1169        }
    1170
    1171        /// Configuration for reading Cloud Storage data written via [Cloud Storage
    1172        /// subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The
    1173        /// data and attributes fields of the originally exported Pub/Sub message
    1174        /// will be restored when publishing.
    1175        #[derive(Clone, Default, PartialEq)]
    1176        #[non_exhaustive]
    1177        pub struct PubSubAvroFormat {
    1178            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    1179        }
    1180
    1181        impl PubSubAvroFormat {
    1182            pub fn new() -> Self {
    1183                std::default::Default::default()
    1184            }
    1185        }
    1186
    1187        impl wkt::message::Message for PubSubAvroFormat {
    1188            fn typename() -> &'static str {
    1189                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat"
    1190            }
    1191        }
    1192
    1193        /// Possible states for ingestion from Cloud Storage.
    1194        ///
    1195        /// # Working with unknown values
    1196        ///
    1197        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    1198        /// additional enum variants at any time. Adding new variants is not considered
    1199        /// a breaking change. Applications should write their code in anticipation of:
    1200        ///
    1201        /// - New values appearing in future releases of the client library, **and**
    1202        /// - New values received dynamically, without application changes.
    1203        ///
    1204        /// Please consult the [Working with enums] section in the user guide for some
    1205        /// guidelines.
    1206        ///
    1207        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    1208        #[derive(Clone, Debug, PartialEq)]
    1209        #[non_exhaustive]
    1210        pub enum State {
    1211            /// Default value. This value is unused.
    1212            Unspecified,
    1213            /// Ingestion is active.
    1214            Active,
    1215            /// Permission denied encountered while calling the Cloud Storage API. This
    1216            /// can happen if the Pub/Sub SA has not been granted the
    1217            /// [appropriate
    1218            /// permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions):
    1219            ///
    1220            /// - storage.objects.list: to list the objects in a bucket.
    1221            /// - storage.objects.get: to read the objects in a bucket.
    1222            /// - storage.buckets.get: to verify the bucket exists.
    1223            CloudStoragePermissionDenied,
    1224            /// Permission denied encountered while publishing to the topic. This can
    1225            /// happen if the Pub/Sub SA has not been granted the [appropriate publish
    1226            /// permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
    1227            PublishPermissionDenied,
    1228            /// The provided Cloud Storage bucket doesn't exist.
    1229            BucketNotFound,
    1230            /// The Cloud Storage bucket has too many objects, ingestion will be
    1231            /// paused.
    1232            TooManyObjects,
    1233            /// If set, the enum was initialized with an unknown value.
    1234            ///
    1235            /// Applications can examine the value using [State::value] or
    1236            /// [State::name].
    1237            UnknownValue(state::UnknownValue),
    1238        }
    1239
    1240        #[doc(hidden)]
    1241        pub mod state {
    1242            #[allow(unused_imports)]
    1243            use super::*;
    1244            #[derive(Clone, Debug, PartialEq)]
    1245            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    1246        }
    1247
    1248        impl State {
    1249            /// Gets the enum value.
    1250            ///
    1251            /// Returns `None` if the enum contains an unknown value deserialized from
    1252            /// the string representation of enums.
    1253            pub fn value(&self) -> std::option::Option<i32> {
    1254                match self {
    1255                    Self::Unspecified => std::option::Option::Some(0),
    1256                    Self::Active => std::option::Option::Some(1),
    1257                    Self::CloudStoragePermissionDenied => std::option::Option::Some(2),
    1258                    Self::PublishPermissionDenied => std::option::Option::Some(3),
    1259                    Self::BucketNotFound => std::option::Option::Some(4),
    1260                    Self::TooManyObjects => std::option::Option::Some(5),
    1261                    Self::UnknownValue(u) => u.0.value(),
    1262                }
    1263            }
    1264
    1265            /// Gets the enum value as a string.
    1266            ///
    1267            /// Returns `None` if the enum contains an unknown value deserialized from
    1268            /// the integer representation of enums.
    1269            pub fn name(&self) -> std::option::Option<&str> {
    1270                match self {
    1271                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    1272                    Self::Active => std::option::Option::Some("ACTIVE"),
    1273                    Self::CloudStoragePermissionDenied => {
    1274                        std::option::Option::Some("CLOUD_STORAGE_PERMISSION_DENIED")
    1275                    }
    1276                    Self::PublishPermissionDenied => {
    1277                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
    1278                    }
    1279                    Self::BucketNotFound => std::option::Option::Some("BUCKET_NOT_FOUND"),
    1280                    Self::TooManyObjects => std::option::Option::Some("TOO_MANY_OBJECTS"),
    1281                    Self::UnknownValue(u) => u.0.name(),
    1282                }
    1283            }
    1284        }
    1285
    1286        impl std::default::Default for State {
    1287            fn default() -> Self {
    1288                use std::convert::From;
    1289                Self::from(0)
    1290            }
    1291        }
    1292
    1293        impl std::fmt::Display for State {
    1294            fn fmt(
    1295                &self,
    1296                f: &mut std::fmt::Formatter<'_>,
    1297            ) -> std::result::Result<(), std::fmt::Error> {
    1298                wkt::internal::display_enum(f, self.name(), self.value())
    1299            }
    1300        }
    1301
    1302        impl std::convert::From<i32> for State {
    1303            fn from(value: i32) -> Self {
    1304                match value {
    1305                    0 => Self::Unspecified,
    1306                    1 => Self::Active,
    1307                    2 => Self::CloudStoragePermissionDenied,
    1308                    3 => Self::PublishPermissionDenied,
    1309                    4 => Self::BucketNotFound,
    1310                    5 => Self::TooManyObjects,
    1311                    _ => Self::UnknownValue(state::UnknownValue(
    1312                        wkt::internal::UnknownEnumValue::Integer(value),
    1313                    )),
    1314                }
    1315            }
    1316        }
    1317
    1318        impl std::convert::From<&str> for State {
    1319            fn from(value: &str) -> Self {
    1320                use std::string::ToString;
    1321                match value {
    1322                    "STATE_UNSPECIFIED" => Self::Unspecified,
    1323                    "ACTIVE" => Self::Active,
    1324                    "CLOUD_STORAGE_PERMISSION_DENIED" => Self::CloudStoragePermissionDenied,
    1325                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
    1326                    "BUCKET_NOT_FOUND" => Self::BucketNotFound,
    1327                    "TOO_MANY_OBJECTS" => Self::TooManyObjects,
    1328                    _ => Self::UnknownValue(state::UnknownValue(
    1329                        wkt::internal::UnknownEnumValue::String(value.to_string()),
    1330                    )),
    1331                }
    1332            }
    1333        }
    1334
    1335        impl serde::ser::Serialize for State {
    1336            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    1337            where
    1338                S: serde::Serializer,
    1339            {
    1340                match self {
    1341                    Self::Unspecified => serializer.serialize_i32(0),
    1342                    Self::Active => serializer.serialize_i32(1),
    1343                    Self::CloudStoragePermissionDenied => serializer.serialize_i32(2),
    1344                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
    1345                    Self::BucketNotFound => serializer.serialize_i32(4),
    1346                    Self::TooManyObjects => serializer.serialize_i32(5),
    1347                    Self::UnknownValue(u) => u.0.serialize(serializer),
    1348                }
    1349            }
    1350        }
    1351
    1352        impl<'de> serde::de::Deserialize<'de> for State {
    1353            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    1354            where
    1355                D: serde::Deserializer<'de>,
    1356            {
    1357                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    1358                    ".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State",
    1359                ))
    1360            }
    1361        }
    1362
    1363        /// Defaults to text format.
    1364        #[derive(Clone, Debug, PartialEq)]
    1365        #[non_exhaustive]
    1366        pub enum InputFormat {
    1367            /// Optional. Data from Cloud Storage will be interpreted as text.
    1368            TextFormat(
    1369                std::boxed::Box<
    1370                    crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
    1371                >,
    1372            ),
    1373            /// Optional. Data from Cloud Storage will be interpreted in Avro format.
    1374            AvroFormat(
    1375                std::boxed::Box<
    1376                    crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
    1377                >,
    1378            ),
    1379            /// Optional. It will be assumed data from Cloud Storage was written via
    1380            /// [Cloud Storage
    1381            /// subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
    1382            PubsubAvroFormat(
    1383                std::boxed::Box<
    1384                    crate::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat,
    1385                >,
    1386            ),
    1387        }
    1388    }
    1389
    1390    /// Ingestion settings for Azure Event Hubs.
    1391    #[derive(Clone, Default, PartialEq)]
    1392    #[non_exhaustive]
    1393    pub struct AzureEventHubs {
    1394        /// Output only. An output-only field that indicates the state of the Event
    1395        /// Hubs ingestion source.
    1396        pub state: crate::model::ingestion_data_source_settings::azure_event_hubs::State,
    1397
    1398        /// Optional. Name of the resource group within the azure subscription.
    1399        pub resource_group: std::string::String,
    1400
    1401        /// Optional. The name of the Event Hubs namespace.
    1402        pub namespace: std::string::String,
    1403
    1404        /// Optional. The name of the Event Hub.
    1405        pub event_hub: std::string::String,
    1406
    1407        /// Optional. The client id of the Azure application that is being used to
    1408        /// authenticate Pub/Sub.
    1409        pub client_id: std::string::String,
    1410
    1411        /// Optional. The tenant id of the Azure application that is being used to
    1412        /// authenticate Pub/Sub.
    1413        pub tenant_id: std::string::String,
    1414
    1415        /// Optional. The Azure subscription id.
    1416        pub subscription_id: std::string::String,
    1417
    1418        /// Optional. The GCP service account to be used for Federated Identity
    1419        /// authentication.
    1420        pub gcp_service_account: std::string::String,
    1421
    1422        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    1423    }
    1424
    1425    impl AzureEventHubs {
    1426        pub fn new() -> Self {
    1427            std::default::Default::default()
    1428        }
    1429
    1430        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AzureEventHubs::state].
    1431        ///
    1432        /// # Example
    1433        /// ```ignore,no_run
    1434        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1435        /// use google_cloud_pubsub::model::ingestion_data_source_settings::azure_event_hubs::State;
    1436        /// let x0 = AzureEventHubs::new().set_state(State::Active);
    1437        /// let x1 = AzureEventHubs::new().set_state(State::EventHubsPermissionDenied);
    1438        /// let x2 = AzureEventHubs::new().set_state(State::PublishPermissionDenied);
    1439        /// ```
    1440        pub fn set_state<
    1441            T: std::convert::Into<
    1442                    crate::model::ingestion_data_source_settings::azure_event_hubs::State,
    1443                >,
    1444        >(
    1445            mut self,
    1446            v: T,
    1447        ) -> Self {
    1448            self.state = v.into();
    1449            self
    1450        }
    1451
    1452        /// Sets the value of [resource_group][crate::model::ingestion_data_source_settings::AzureEventHubs::resource_group].
    1453        ///
    1454        /// # Example
    1455        /// ```ignore,no_run
    1456        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1457        /// let x = AzureEventHubs::new().set_resource_group("example");
    1458        /// ```
    1459        pub fn set_resource_group<T: std::convert::Into<std::string::String>>(
    1460            mut self,
    1461            v: T,
    1462        ) -> Self {
    1463            self.resource_group = v.into();
    1464            self
    1465        }
    1466
    1467        /// Sets the value of [namespace][crate::model::ingestion_data_source_settings::AzureEventHubs::namespace].
    1468        ///
    1469        /// # Example
    1470        /// ```ignore,no_run
    1471        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1472        /// let x = AzureEventHubs::new().set_namespace("example");
    1473        /// ```
    1474        pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1475            self.namespace = v.into();
    1476            self
    1477        }
    1478
    1479        /// Sets the value of [event_hub][crate::model::ingestion_data_source_settings::AzureEventHubs::event_hub].
    1480        ///
    1481        /// # Example
    1482        /// ```ignore,no_run
    1483        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1484        /// let x = AzureEventHubs::new().set_event_hub("example");
    1485        /// ```
    1486        pub fn set_event_hub<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1487            self.event_hub = v.into();
    1488            self
    1489        }
    1490
    1491        /// Sets the value of [client_id][crate::model::ingestion_data_source_settings::AzureEventHubs::client_id].
    1492        ///
    1493        /// # Example
    1494        /// ```ignore,no_run
    1495        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1496        /// let x = AzureEventHubs::new().set_client_id("example");
    1497        /// ```
    1498        pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1499            self.client_id = v.into();
    1500            self
    1501        }
    1502
    1503        /// Sets the value of [tenant_id][crate::model::ingestion_data_source_settings::AzureEventHubs::tenant_id].
    1504        ///
    1505        /// # Example
    1506        /// ```ignore,no_run
    1507        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1508        /// let x = AzureEventHubs::new().set_tenant_id("example");
    1509        /// ```
    1510        pub fn set_tenant_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1511            self.tenant_id = v.into();
    1512            self
    1513        }
    1514
    1515        /// Sets the value of [subscription_id][crate::model::ingestion_data_source_settings::AzureEventHubs::subscription_id].
    1516        ///
    1517        /// # Example
    1518        /// ```ignore,no_run
    1519        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1520        /// let x = AzureEventHubs::new().set_subscription_id("example");
    1521        /// ```
    1522        pub fn set_subscription_id<T: std::convert::Into<std::string::String>>(
    1523            mut self,
    1524            v: T,
    1525        ) -> Self {
    1526            self.subscription_id = v.into();
    1527            self
    1528        }
    1529
    1530        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AzureEventHubs::gcp_service_account].
    1531        ///
    1532        /// # Example
    1533        /// ```ignore,no_run
    1534        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
    1535        /// let x = AzureEventHubs::new().set_gcp_service_account("example");
    1536        /// ```
    1537        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
    1538            mut self,
    1539            v: T,
    1540        ) -> Self {
    1541            self.gcp_service_account = v.into();
    1542            self
    1543        }
    1544    }
    1545
    1546    impl wkt::message::Message for AzureEventHubs {
    1547        fn typename() -> &'static str {
    1548            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs"
    1549        }
    1550    }
    1551
    1552    /// Defines additional types related to [AzureEventHubs].
    1553    pub mod azure_event_hubs {
    1554        #[allow(unused_imports)]
    1555        use super::*;
    1556
    1557        /// Possible states for managed ingestion from Event Hubs.
    1558        ///
    1559        /// # Working with unknown values
    1560        ///
    1561        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    1562        /// additional enum variants at any time. Adding new variants is not considered
    1563        /// a breaking change. Applications should write their code in anticipation of:
    1564        ///
    1565        /// - New values appearing in future releases of the client library, **and**
    1566        /// - New values received dynamically, without application changes.
    1567        ///
    1568        /// Please consult the [Working with enums] section in the user guide for some
    1569        /// guidelines.
    1570        ///
    1571        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    1572        #[derive(Clone, Debug, PartialEq)]
    1573        #[non_exhaustive]
    1574        pub enum State {
    1575            /// Default value. This value is unused.
    1576            Unspecified,
    1577            /// Ingestion is active.
    1578            Active,
    1579            /// Permission denied encountered while consuming data from Event Hubs.
    1580            /// This can happen when `client_id`, or `tenant_id` are invalid. Or the
    1581            /// right permissions haven't been granted.
    1582            EventHubsPermissionDenied,
    1583            /// Permission denied encountered while publishing to the topic.
    1584            PublishPermissionDenied,
    1585            /// The provided Event Hubs namespace couldn't be found.
    1586            NamespaceNotFound,
    1587            /// The provided Event Hub couldn't be found.
    1588            EventHubNotFound,
    1589            /// The provided Event Hubs subscription couldn't be found.
    1590            SubscriptionNotFound,
    1591            /// The provided Event Hubs resource group couldn't be found.
    1592            ResourceGroupNotFound,
    1593            /// If set, the enum was initialized with an unknown value.
    1594            ///
    1595            /// Applications can examine the value using [State::value] or
    1596            /// [State::name].
    1597            UnknownValue(state::UnknownValue),
    1598        }
    1599
    1600        #[doc(hidden)]
    1601        pub mod state {
    1602            #[allow(unused_imports)]
    1603            use super::*;
    1604            #[derive(Clone, Debug, PartialEq)]
    1605            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    1606        }
    1607
    1608        impl State {
    1609            /// Gets the enum value.
    1610            ///
    1611            /// Returns `None` if the enum contains an unknown value deserialized from
    1612            /// the string representation of enums.
    1613            pub fn value(&self) -> std::option::Option<i32> {
    1614                match self {
    1615                    Self::Unspecified => std::option::Option::Some(0),
    1616                    Self::Active => std::option::Option::Some(1),
    1617                    Self::EventHubsPermissionDenied => std::option::Option::Some(2),
    1618                    Self::PublishPermissionDenied => std::option::Option::Some(3),
    1619                    Self::NamespaceNotFound => std::option::Option::Some(4),
    1620                    Self::EventHubNotFound => std::option::Option::Some(5),
    1621                    Self::SubscriptionNotFound => std::option::Option::Some(6),
    1622                    Self::ResourceGroupNotFound => std::option::Option::Some(7),
    1623                    Self::UnknownValue(u) => u.0.value(),
    1624                }
    1625            }
    1626
    1627            /// Gets the enum value as a string.
    1628            ///
    1629            /// Returns `None` if the enum contains an unknown value deserialized from
    1630            /// the integer representation of enums.
    1631            pub fn name(&self) -> std::option::Option<&str> {
    1632                match self {
    1633                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    1634                    Self::Active => std::option::Option::Some("ACTIVE"),
    1635                    Self::EventHubsPermissionDenied => {
    1636                        std::option::Option::Some("EVENT_HUBS_PERMISSION_DENIED")
    1637                    }
    1638                    Self::PublishPermissionDenied => {
    1639                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
    1640                    }
    1641                    Self::NamespaceNotFound => std::option::Option::Some("NAMESPACE_NOT_FOUND"),
    1642                    Self::EventHubNotFound => std::option::Option::Some("EVENT_HUB_NOT_FOUND"),
    1643                    Self::SubscriptionNotFound => {
    1644                        std::option::Option::Some("SUBSCRIPTION_NOT_FOUND")
    1645                    }
    1646                    Self::ResourceGroupNotFound => {
    1647                        std::option::Option::Some("RESOURCE_GROUP_NOT_FOUND")
    1648                    }
    1649                    Self::UnknownValue(u) => u.0.name(),
    1650                }
    1651            }
    1652        }
    1653
    1654        impl std::default::Default for State {
    1655            fn default() -> Self {
    1656                use std::convert::From;
    1657                Self::from(0)
    1658            }
    1659        }
    1660
    1661        impl std::fmt::Display for State {
    1662            fn fmt(
    1663                &self,
    1664                f: &mut std::fmt::Formatter<'_>,
    1665            ) -> std::result::Result<(), std::fmt::Error> {
    1666                wkt::internal::display_enum(f, self.name(), self.value())
    1667            }
    1668        }
    1669
    1670        impl std::convert::From<i32> for State {
    1671            fn from(value: i32) -> Self {
    1672                match value {
    1673                    0 => Self::Unspecified,
    1674                    1 => Self::Active,
    1675                    2 => Self::EventHubsPermissionDenied,
    1676                    3 => Self::PublishPermissionDenied,
    1677                    4 => Self::NamespaceNotFound,
    1678                    5 => Self::EventHubNotFound,
    1679                    6 => Self::SubscriptionNotFound,
    1680                    7 => Self::ResourceGroupNotFound,
    1681                    _ => Self::UnknownValue(state::UnknownValue(
    1682                        wkt::internal::UnknownEnumValue::Integer(value),
    1683                    )),
    1684                }
    1685            }
    1686        }
    1687
    1688        impl std::convert::From<&str> for State {
    1689            fn from(value: &str) -> Self {
    1690                use std::string::ToString;
    1691                match value {
    1692                    "STATE_UNSPECIFIED" => Self::Unspecified,
    1693                    "ACTIVE" => Self::Active,
    1694                    "EVENT_HUBS_PERMISSION_DENIED" => Self::EventHubsPermissionDenied,
    1695                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
    1696                    "NAMESPACE_NOT_FOUND" => Self::NamespaceNotFound,
    1697                    "EVENT_HUB_NOT_FOUND" => Self::EventHubNotFound,
    1698                    "SUBSCRIPTION_NOT_FOUND" => Self::SubscriptionNotFound,
    1699                    "RESOURCE_GROUP_NOT_FOUND" => Self::ResourceGroupNotFound,
    1700                    _ => Self::UnknownValue(state::UnknownValue(
    1701                        wkt::internal::UnknownEnumValue::String(value.to_string()),
    1702                    )),
    1703                }
    1704            }
    1705        }
    1706
    1707        impl serde::ser::Serialize for State {
    1708            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    1709            where
    1710                S: serde::Serializer,
    1711            {
    1712                match self {
    1713                    Self::Unspecified => serializer.serialize_i32(0),
    1714                    Self::Active => serializer.serialize_i32(1),
    1715                    Self::EventHubsPermissionDenied => serializer.serialize_i32(2),
    1716                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
    1717                    Self::NamespaceNotFound => serializer.serialize_i32(4),
    1718                    Self::EventHubNotFound => serializer.serialize_i32(5),
    1719                    Self::SubscriptionNotFound => serializer.serialize_i32(6),
    1720                    Self::ResourceGroupNotFound => serializer.serialize_i32(7),
    1721                    Self::UnknownValue(u) => u.0.serialize(serializer),
    1722                }
    1723            }
    1724        }
    1725
    1726        impl<'de> serde::de::Deserialize<'de> for State {
    1727            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    1728            where
    1729                D: serde::Deserializer<'de>,
    1730            {
    1731                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    1732                    ".google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State",
    1733                ))
    1734            }
    1735        }
    1736    }
    1737
    1738    /// Ingestion settings for Amazon MSK.
    1739    #[derive(Clone, Default, PartialEq)]
    1740    #[non_exhaustive]
    1741    pub struct AwsMsk {
    1742        /// Output only. An output-only field that indicates the state of the Amazon
    1743        /// MSK ingestion source.
    1744        pub state: crate::model::ingestion_data_source_settings::aws_msk::State,
    1745
    1746        /// Required. The Amazon Resource Name (ARN) that uniquely identifies the
    1747        /// cluster.
    1748        pub cluster_arn: std::string::String,
    1749
    1750        /// Required. The name of the topic in the Amazon MSK cluster that Pub/Sub
    1751        /// will import from.
    1752        pub topic: std::string::String,
    1753
    1754        /// Required. AWS role ARN to be used for Federated Identity authentication
    1755        /// with Amazon MSK. Check the Pub/Sub docs for how to set up this role and
    1756        /// the required permissions that need to be attached to it.
    1757        pub aws_role_arn: std::string::String,
    1758
    1759        /// Required. The GCP service account to be used for Federated Identity
    1760        /// authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
    1761        /// for the provided role). The `aws_role_arn` must be set up with
    1762        /// `accounts.google.com:sub` equals to this service account number.
    1763        pub gcp_service_account: std::string::String,
    1764
    1765        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    1766    }
    1767
    1768    impl AwsMsk {
    1769        pub fn new() -> Self {
    1770            std::default::Default::default()
    1771        }
    1772
    1773        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AwsMsk::state].
    1774        ///
    1775        /// # Example
    1776        /// ```ignore,no_run
    1777        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    1778        /// use google_cloud_pubsub::model::ingestion_data_source_settings::aws_msk::State;
    1779        /// let x0 = AwsMsk::new().set_state(State::Active);
    1780        /// let x1 = AwsMsk::new().set_state(State::MskPermissionDenied);
    1781        /// let x2 = AwsMsk::new().set_state(State::PublishPermissionDenied);
    1782        /// ```
    1783        pub fn set_state<
    1784            T: std::convert::Into<crate::model::ingestion_data_source_settings::aws_msk::State>,
    1785        >(
    1786            mut self,
    1787            v: T,
    1788        ) -> Self {
    1789            self.state = v.into();
    1790            self
    1791        }
    1792
    1793        /// Sets the value of [cluster_arn][crate::model::ingestion_data_source_settings::AwsMsk::cluster_arn].
    1794        ///
    1795        /// # Example
    1796        /// ```ignore,no_run
    1797        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    1798        /// let x = AwsMsk::new().set_cluster_arn("example");
    1799        /// ```
    1800        pub fn set_cluster_arn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1801            self.cluster_arn = v.into();
    1802            self
    1803        }
    1804
    1805        /// Sets the value of [topic][crate::model::ingestion_data_source_settings::AwsMsk::topic].
    1806        ///
    1807        /// # Example
    1808        /// ```ignore,no_run
    1809        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    1810        /// let x = AwsMsk::new().set_topic("example");
    1811        /// ```
    1812        pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    1813            self.topic = v.into();
    1814            self
    1815        }
    1816
    1817        /// Sets the value of [aws_role_arn][crate::model::ingestion_data_source_settings::AwsMsk::aws_role_arn].
    1818        ///
    1819        /// # Example
    1820        /// ```ignore,no_run
    1821        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    1822        /// let x = AwsMsk::new().set_aws_role_arn("example");
    1823        /// ```
    1824        pub fn set_aws_role_arn<T: std::convert::Into<std::string::String>>(
    1825            mut self,
    1826            v: T,
    1827        ) -> Self {
    1828            self.aws_role_arn = v.into();
    1829            self
    1830        }
    1831
    1832        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AwsMsk::gcp_service_account].
    1833        ///
    1834        /// # Example
    1835        /// ```ignore,no_run
    1836        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
    1837        /// let x = AwsMsk::new().set_gcp_service_account("example");
    1838        /// ```
    1839        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
    1840            mut self,
    1841            v: T,
    1842        ) -> Self {
    1843            self.gcp_service_account = v.into();
    1844            self
    1845        }
    1846    }
    1847
    1848    impl wkt::message::Message for AwsMsk {
    1849        fn typename() -> &'static str {
    1850            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AwsMsk"
    1851        }
    1852    }
    1853
    1854    /// Defines additional types related to [AwsMsk].
    1855    pub mod aws_msk {
    1856        #[allow(unused_imports)]
    1857        use super::*;
    1858
    1859        /// Possible states for managed ingestion from Amazon MSK.
    1860        ///
    1861        /// # Working with unknown values
    1862        ///
    1863        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    1864        /// additional enum variants at any time. Adding new variants is not considered
    1865        /// a breaking change. Applications should write their code in anticipation of:
    1866        ///
    1867        /// - New values appearing in future releases of the client library, **and**
    1868        /// - New values received dynamically, without application changes.
    1869        ///
    1870        /// Please consult the [Working with enums] section in the user guide for some
    1871        /// guidelines.
    1872        ///
    1873        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    1874        #[derive(Clone, Debug, PartialEq)]
    1875        #[non_exhaustive]
    1876        pub enum State {
    1877            /// Default value. This value is unused.
    1878            Unspecified,
    1879            /// Ingestion is active.
    1880            Active,
    1881            /// Permission denied encountered while consuming data from Amazon MSK.
    1882            MskPermissionDenied,
    1883            /// Permission denied encountered while publishing to the topic.
    1884            PublishPermissionDenied,
    1885            /// The provided MSK cluster wasn't found.
    1886            ClusterNotFound,
    1887            /// The provided topic wasn't found.
    1888            TopicNotFound,
    1889            /// If set, the enum was initialized with an unknown value.
    1890            ///
    1891            /// Applications can examine the value using [State::value] or
    1892            /// [State::name].
    1893            UnknownValue(state::UnknownValue),
    1894        }
    1895
    1896        #[doc(hidden)]
    1897        pub mod state {
    1898            #[allow(unused_imports)]
    1899            use super::*;
    1900            #[derive(Clone, Debug, PartialEq)]
    1901            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    1902        }
    1903
    1904        impl State {
    1905            /// Gets the enum value.
    1906            ///
    1907            /// Returns `None` if the enum contains an unknown value deserialized from
    1908            /// the string representation of enums.
    1909            pub fn value(&self) -> std::option::Option<i32> {
    1910                match self {
    1911                    Self::Unspecified => std::option::Option::Some(0),
    1912                    Self::Active => std::option::Option::Some(1),
    1913                    Self::MskPermissionDenied => std::option::Option::Some(2),
    1914                    Self::PublishPermissionDenied => std::option::Option::Some(3),
    1915                    Self::ClusterNotFound => std::option::Option::Some(4),
    1916                    Self::TopicNotFound => std::option::Option::Some(5),
    1917                    Self::UnknownValue(u) => u.0.value(),
    1918                }
    1919            }
    1920
    1921            /// Gets the enum value as a string.
    1922            ///
    1923            /// Returns `None` if the enum contains an unknown value deserialized from
    1924            /// the integer representation of enums.
    1925            pub fn name(&self) -> std::option::Option<&str> {
    1926                match self {
    1927                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    1928                    Self::Active => std::option::Option::Some("ACTIVE"),
    1929                    Self::MskPermissionDenied => std::option::Option::Some("MSK_PERMISSION_DENIED"),
    1930                    Self::PublishPermissionDenied => {
    1931                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
    1932                    }
    1933                    Self::ClusterNotFound => std::option::Option::Some("CLUSTER_NOT_FOUND"),
    1934                    Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
    1935                    Self::UnknownValue(u) => u.0.name(),
    1936                }
    1937            }
    1938        }
    1939
    1940        impl std::default::Default for State {
    1941            fn default() -> Self {
    1942                use std::convert::From;
    1943                Self::from(0)
    1944            }
    1945        }
    1946
    1947        impl std::fmt::Display for State {
    1948            fn fmt(
    1949                &self,
    1950                f: &mut std::fmt::Formatter<'_>,
    1951            ) -> std::result::Result<(), std::fmt::Error> {
    1952                wkt::internal::display_enum(f, self.name(), self.value())
    1953            }
    1954        }
    1955
    1956        impl std::convert::From<i32> for State {
    1957            fn from(value: i32) -> Self {
    1958                match value {
    1959                    0 => Self::Unspecified,
    1960                    1 => Self::Active,
    1961                    2 => Self::MskPermissionDenied,
    1962                    3 => Self::PublishPermissionDenied,
    1963                    4 => Self::ClusterNotFound,
    1964                    5 => Self::TopicNotFound,
    1965                    _ => Self::UnknownValue(state::UnknownValue(
    1966                        wkt::internal::UnknownEnumValue::Integer(value),
    1967                    )),
    1968                }
    1969            }
    1970        }
    1971
    1972        impl std::convert::From<&str> for State {
    1973            fn from(value: &str) -> Self {
    1974                use std::string::ToString;
    1975                match value {
    1976                    "STATE_UNSPECIFIED" => Self::Unspecified,
    1977                    "ACTIVE" => Self::Active,
    1978                    "MSK_PERMISSION_DENIED" => Self::MskPermissionDenied,
    1979                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
    1980                    "CLUSTER_NOT_FOUND" => Self::ClusterNotFound,
    1981                    "TOPIC_NOT_FOUND" => Self::TopicNotFound,
    1982                    _ => Self::UnknownValue(state::UnknownValue(
    1983                        wkt::internal::UnknownEnumValue::String(value.to_string()),
    1984                    )),
    1985                }
    1986            }
    1987        }
    1988
    1989        impl serde::ser::Serialize for State {
    1990            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    1991            where
    1992                S: serde::Serializer,
    1993            {
    1994                match self {
    1995                    Self::Unspecified => serializer.serialize_i32(0),
    1996                    Self::Active => serializer.serialize_i32(1),
    1997                    Self::MskPermissionDenied => serializer.serialize_i32(2),
    1998                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
    1999                    Self::ClusterNotFound => serializer.serialize_i32(4),
    2000                    Self::TopicNotFound => serializer.serialize_i32(5),
    2001                    Self::UnknownValue(u) => u.0.serialize(serializer),
    2002                }
    2003            }
    2004        }
    2005
    2006        impl<'de> serde::de::Deserialize<'de> for State {
    2007            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    2008            where
    2009                D: serde::Deserializer<'de>,
    2010            {
    2011                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    2012                    ".google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State",
    2013                ))
    2014            }
    2015        }
    2016    }
    2017
    2018    /// Ingestion settings for Confluent Cloud.
    2019    #[derive(Clone, Default, PartialEq)]
    2020    #[non_exhaustive]
    2021    pub struct ConfluentCloud {
    2022        /// Output only. An output-only field that indicates the state of the
    2023        /// Confluent Cloud ingestion source.
    2024        pub state: crate::model::ingestion_data_source_settings::confluent_cloud::State,
    2025
    2026        /// Required. The address of the bootstrap server. The format is url:port.
    2027        pub bootstrap_server: std::string::String,
    2028
    2029        /// Required. The id of the cluster.
    2030        pub cluster_id: std::string::String,
    2031
    2032        /// Required. The name of the topic in the Confluent Cloud cluster that
    2033        /// Pub/Sub will import from.
    2034        pub topic: std::string::String,
    2035
    2036        /// Required. The id of the identity pool to be used for Federated Identity
    2037        /// authentication with Confluent Cloud. See
    2038        /// <https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools>.
    2039        pub identity_pool_id: std::string::String,
    2040
    2041        /// Required. The GCP service account to be used for Federated Identity
    2042        /// authentication with `identity_pool_id`.
    2043        pub gcp_service_account: std::string::String,
    2044
    2045        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    2046    }
    2047
    2048    impl ConfluentCloud {
    2049        pub fn new() -> Self {
    2050            std::default::Default::default()
    2051        }
    2052
    2053        /// Sets the value of [state][crate::model::ingestion_data_source_settings::ConfluentCloud::state].
    2054        ///
    2055        /// # Example
    2056        /// ```ignore,no_run
    2057        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2058        /// use google_cloud_pubsub::model::ingestion_data_source_settings::confluent_cloud::State;
    2059        /// let x0 = ConfluentCloud::new().set_state(State::Active);
    2060        /// let x1 = ConfluentCloud::new().set_state(State::ConfluentCloudPermissionDenied);
    2061        /// let x2 = ConfluentCloud::new().set_state(State::PublishPermissionDenied);
    2062        /// ```
    2063        pub fn set_state<
    2064            T: std::convert::Into<
    2065                    crate::model::ingestion_data_source_settings::confluent_cloud::State,
    2066                >,
    2067        >(
    2068            mut self,
    2069            v: T,
    2070        ) -> Self {
    2071            self.state = v.into();
    2072            self
    2073        }
    2074
    2075        /// Sets the value of [bootstrap_server][crate::model::ingestion_data_source_settings::ConfluentCloud::bootstrap_server].
    2076        ///
    2077        /// # Example
    2078        /// ```ignore,no_run
    2079        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2080        /// let x = ConfluentCloud::new().set_bootstrap_server("example");
    2081        /// ```
    2082        pub fn set_bootstrap_server<T: std::convert::Into<std::string::String>>(
    2083            mut self,
    2084            v: T,
    2085        ) -> Self {
    2086            self.bootstrap_server = v.into();
    2087            self
    2088        }
    2089
    2090        /// Sets the value of [cluster_id][crate::model::ingestion_data_source_settings::ConfluentCloud::cluster_id].
    2091        ///
    2092        /// # Example
    2093        /// ```ignore,no_run
    2094        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2095        /// let x = ConfluentCloud::new().set_cluster_id("example");
    2096        /// ```
    2097        pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2098            self.cluster_id = v.into();
    2099            self
    2100        }
    2101
    2102        /// Sets the value of [topic][crate::model::ingestion_data_source_settings::ConfluentCloud::topic].
    2103        ///
    2104        /// # Example
    2105        /// ```ignore,no_run
    2106        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2107        /// let x = ConfluentCloud::new().set_topic("example");
    2108        /// ```
    2109        pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2110            self.topic = v.into();
    2111            self
    2112        }
    2113
    2114        /// Sets the value of [identity_pool_id][crate::model::ingestion_data_source_settings::ConfluentCloud::identity_pool_id].
    2115        ///
    2116        /// # Example
    2117        /// ```ignore,no_run
    2118        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2119        /// let x = ConfluentCloud::new().set_identity_pool_id("example");
    2120        /// ```
    2121        pub fn set_identity_pool_id<T: std::convert::Into<std::string::String>>(
    2122            mut self,
    2123            v: T,
    2124        ) -> Self {
    2125            self.identity_pool_id = v.into();
    2126            self
    2127        }
    2128
    2129        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::ConfluentCloud::gcp_service_account].
    2130        ///
    2131        /// # Example
    2132        /// ```ignore,no_run
    2133        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
    2134        /// let x = ConfluentCloud::new().set_gcp_service_account("example");
    2135        /// ```
    2136        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
    2137            mut self,
    2138            v: T,
    2139        ) -> Self {
    2140            self.gcp_service_account = v.into();
    2141            self
    2142        }
    2143    }
    2144
    2145    impl wkt::message::Message for ConfluentCloud {
    2146        fn typename() -> &'static str {
    2147            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud"
    2148        }
    2149    }
    2150
    2151    /// Defines additional types related to [ConfluentCloud].
    2152    pub mod confluent_cloud {
    2153        #[allow(unused_imports)]
    2154        use super::*;
    2155
    2156        /// Possible states for managed ingestion from Confluent Cloud.
    2157        ///
    2158        /// # Working with unknown values
    2159        ///
    2160        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    2161        /// additional enum variants at any time. Adding new variants is not considered
    2162        /// a breaking change. Applications should write their code in anticipation of:
    2163        ///
    2164        /// - New values appearing in future releases of the client library, **and**
    2165        /// - New values received dynamically, without application changes.
    2166        ///
    2167        /// Please consult the [Working with enums] section in the user guide for some
    2168        /// guidelines.
    2169        ///
    2170        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    2171        #[derive(Clone, Debug, PartialEq)]
    2172        #[non_exhaustive]
    2173        pub enum State {
    2174            /// Default value. This value is unused.
    2175            Unspecified,
    2176            /// Ingestion is active.
    2177            Active,
    2178            /// Permission denied encountered while consuming data from Confluent
    2179            /// Cloud.
    2180            ConfluentCloudPermissionDenied,
    2181            /// Permission denied encountered while publishing to the topic.
    2182            PublishPermissionDenied,
    2183            /// The provided bootstrap server address is unreachable.
    2184            UnreachableBootstrapServer,
    2185            /// The provided cluster wasn't found.
    2186            ClusterNotFound,
    2187            /// The provided topic wasn't found.
    2188            TopicNotFound,
    2189            /// If set, the enum was initialized with an unknown value.
    2190            ///
    2191            /// Applications can examine the value using [State::value] or
    2192            /// [State::name].
    2193            UnknownValue(state::UnknownValue),
    2194        }
    2195
    2196        #[doc(hidden)]
    2197        pub mod state {
    2198            #[allow(unused_imports)]
    2199            use super::*;
    2200            #[derive(Clone, Debug, PartialEq)]
    2201            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    2202        }
    2203
    2204        impl State {
    2205            /// Gets the enum value.
    2206            ///
    2207            /// Returns `None` if the enum contains an unknown value deserialized from
    2208            /// the string representation of enums.
    2209            pub fn value(&self) -> std::option::Option<i32> {
    2210                match self {
    2211                    Self::Unspecified => std::option::Option::Some(0),
    2212                    Self::Active => std::option::Option::Some(1),
    2213                    Self::ConfluentCloudPermissionDenied => std::option::Option::Some(2),
    2214                    Self::PublishPermissionDenied => std::option::Option::Some(3),
    2215                    Self::UnreachableBootstrapServer => std::option::Option::Some(4),
    2216                    Self::ClusterNotFound => std::option::Option::Some(5),
    2217                    Self::TopicNotFound => std::option::Option::Some(6),
    2218                    Self::UnknownValue(u) => u.0.value(),
    2219                }
    2220            }
    2221
    2222            /// Gets the enum value as a string.
    2223            ///
    2224            /// Returns `None` if the enum contains an unknown value deserialized from
    2225            /// the integer representation of enums.
    2226            pub fn name(&self) -> std::option::Option<&str> {
    2227                match self {
    2228                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    2229                    Self::Active => std::option::Option::Some("ACTIVE"),
    2230                    Self::ConfluentCloudPermissionDenied => {
    2231                        std::option::Option::Some("CONFLUENT_CLOUD_PERMISSION_DENIED")
    2232                    }
    2233                    Self::PublishPermissionDenied => {
    2234                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
    2235                    }
    2236                    Self::UnreachableBootstrapServer => {
    2237                        std::option::Option::Some("UNREACHABLE_BOOTSTRAP_SERVER")
    2238                    }
    2239                    Self::ClusterNotFound => std::option::Option::Some("CLUSTER_NOT_FOUND"),
    2240                    Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
    2241                    Self::UnknownValue(u) => u.0.name(),
    2242                }
    2243            }
    2244        }
    2245
    2246        impl std::default::Default for State {
    2247            fn default() -> Self {
    2248                use std::convert::From;
    2249                Self::from(0)
    2250            }
    2251        }
    2252
    2253        impl std::fmt::Display for State {
    2254            fn fmt(
    2255                &self,
    2256                f: &mut std::fmt::Formatter<'_>,
    2257            ) -> std::result::Result<(), std::fmt::Error> {
    2258                wkt::internal::display_enum(f, self.name(), self.value())
    2259            }
    2260        }
    2261
    2262        impl std::convert::From<i32> for State {
    2263            fn from(value: i32) -> Self {
    2264                match value {
    2265                    0 => Self::Unspecified,
    2266                    1 => Self::Active,
    2267                    2 => Self::ConfluentCloudPermissionDenied,
    2268                    3 => Self::PublishPermissionDenied,
    2269                    4 => Self::UnreachableBootstrapServer,
    2270                    5 => Self::ClusterNotFound,
    2271                    6 => Self::TopicNotFound,
    2272                    _ => Self::UnknownValue(state::UnknownValue(
    2273                        wkt::internal::UnknownEnumValue::Integer(value),
    2274                    )),
    2275                }
    2276            }
    2277        }
    2278
    2279        impl std::convert::From<&str> for State {
    2280            fn from(value: &str) -> Self {
    2281                use std::string::ToString;
    2282                match value {
    2283                    "STATE_UNSPECIFIED" => Self::Unspecified,
    2284                    "ACTIVE" => Self::Active,
    2285                    "CONFLUENT_CLOUD_PERMISSION_DENIED" => Self::ConfluentCloudPermissionDenied,
    2286                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
    2287                    "UNREACHABLE_BOOTSTRAP_SERVER" => Self::UnreachableBootstrapServer,
    2288                    "CLUSTER_NOT_FOUND" => Self::ClusterNotFound,
    2289                    "TOPIC_NOT_FOUND" => Self::TopicNotFound,
    2290                    _ => Self::UnknownValue(state::UnknownValue(
    2291                        wkt::internal::UnknownEnumValue::String(value.to_string()),
    2292                    )),
    2293                }
    2294            }
    2295        }
    2296
    2297        impl serde::ser::Serialize for State {
    2298            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    2299            where
    2300                S: serde::Serializer,
    2301            {
    2302                match self {
    2303                    Self::Unspecified => serializer.serialize_i32(0),
    2304                    Self::Active => serializer.serialize_i32(1),
    2305                    Self::ConfluentCloudPermissionDenied => serializer.serialize_i32(2),
    2306                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
    2307                    Self::UnreachableBootstrapServer => serializer.serialize_i32(4),
    2308                    Self::ClusterNotFound => serializer.serialize_i32(5),
    2309                    Self::TopicNotFound => serializer.serialize_i32(6),
    2310                    Self::UnknownValue(u) => u.0.serialize(serializer),
    2311                }
    2312            }
    2313        }
    2314
    2315        impl<'de> serde::de::Deserialize<'de> for State {
    2316            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    2317            where
    2318                D: serde::Deserializer<'de>,
    2319            {
    2320                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    2321                    ".google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State",
    2322                ))
    2323            }
    2324        }
    2325    }
    2326
    2327    /// Only one source type can have settings set.
    2328    #[derive(Clone, Debug, PartialEq)]
    2329    #[non_exhaustive]
    2330    pub enum Source {
    2331        /// Optional. Amazon Kinesis Data Streams.
    2332        AwsKinesis(std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>),
    2333        /// Optional. Cloud Storage.
    2334        CloudStorage(std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>),
    2335        /// Optional. Azure Event Hubs.
    2336        AzureEventHubs(
    2337            std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
    2338        ),
    2339        /// Optional. Amazon MSK.
    2340        AwsMsk(std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>),
    2341        /// Optional. Confluent Cloud.
    2342        ConfluentCloud(
    2343            std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
    2344        ),
    2345    }
    2346}
    2347
    2348/// Settings for Platform Logs produced by Pub/Sub.
    2349#[derive(Clone, Default, PartialEq)]
    2350#[non_exhaustive]
    2351pub struct PlatformLogsSettings {
    2352    /// Optional. The minimum severity level of Platform Logs that will be written.
    2353    pub severity: crate::model::platform_logs_settings::Severity,
    2354
    2355    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    2356}
    2357
    2358impl PlatformLogsSettings {
    2359    pub fn new() -> Self {
    2360        std::default::Default::default()
    2361    }
    2362
    2363    /// Sets the value of [severity][crate::model::PlatformLogsSettings::severity].
    2364    ///
    2365    /// # Example
    2366    /// ```ignore,no_run
    2367    /// # use google_cloud_pubsub::model::PlatformLogsSettings;
    2368    /// use google_cloud_pubsub::model::platform_logs_settings::Severity;
    2369    /// let x0 = PlatformLogsSettings::new().set_severity(Severity::Disabled);
    2370    /// let x1 = PlatformLogsSettings::new().set_severity(Severity::Debug);
    2371    /// let x2 = PlatformLogsSettings::new().set_severity(Severity::Info);
    2372    /// ```
    2373    pub fn set_severity<T: std::convert::Into<crate::model::platform_logs_settings::Severity>>(
    2374        mut self,
    2375        v: T,
    2376    ) -> Self {
    2377        self.severity = v.into();
    2378        self
    2379    }
    2380}
    2381
    2382impl wkt::message::Message for PlatformLogsSettings {
    2383    fn typename() -> &'static str {
    2384        "type.googleapis.com/google.pubsub.v1.PlatformLogsSettings"
    2385    }
    2386}
    2387
    2388/// Defines additional types related to [PlatformLogsSettings].
    2389pub mod platform_logs_settings {
    2390    #[allow(unused_imports)]
    2391    use super::*;
    2392
    2393    /// Severity levels of Platform Logs.
    2394    ///
    2395    /// # Working with unknown values
    2396    ///
    2397    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    2398    /// additional enum variants at any time. Adding new variants is not considered
    2399    /// a breaking change. Applications should write their code in anticipation of:
    2400    ///
    2401    /// - New values appearing in future releases of the client library, **and**
    2402    /// - New values received dynamically, without application changes.
    2403    ///
    2404    /// Please consult the [Working with enums] section in the user guide for some
    2405    /// guidelines.
    2406    ///
    2407    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    2408    #[derive(Clone, Debug, PartialEq)]
    2409    #[non_exhaustive]
    2410    pub enum Severity {
    2411        /// Default value. Logs level is unspecified. Logs will be disabled.
    2412        Unspecified,
    2413        /// Logs will be disabled.
    2414        Disabled,
    2415        /// Debug logs and higher-severity logs will be written.
    2416        Debug,
    2417        /// Info logs and higher-severity logs will be written.
    2418        Info,
    2419        /// Warning logs and higher-severity logs will be written.
    2420        Warning,
    2421        /// Only error logs will be written.
    2422        Error,
    2423        /// If set, the enum was initialized with an unknown value.
    2424        ///
    2425        /// Applications can examine the value using [Severity::value] or
    2426        /// [Severity::name].
    2427        UnknownValue(severity::UnknownValue),
    2428    }
    2429
    2430    #[doc(hidden)]
    2431    pub mod severity {
    2432        #[allow(unused_imports)]
    2433        use super::*;
    2434        #[derive(Clone, Debug, PartialEq)]
    2435        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    2436    }
    2437
    2438    impl Severity {
    2439        /// Gets the enum value.
    2440        ///
    2441        /// Returns `None` if the enum contains an unknown value deserialized from
    2442        /// the string representation of enums.
    2443        pub fn value(&self) -> std::option::Option<i32> {
    2444            match self {
    2445                Self::Unspecified => std::option::Option::Some(0),
    2446                Self::Disabled => std::option::Option::Some(1),
    2447                Self::Debug => std::option::Option::Some(2),
    2448                Self::Info => std::option::Option::Some(3),
    2449                Self::Warning => std::option::Option::Some(4),
    2450                Self::Error => std::option::Option::Some(5),
    2451                Self::UnknownValue(u) => u.0.value(),
    2452            }
    2453        }
    2454
    2455        /// Gets the enum value as a string.
    2456        ///
    2457        /// Returns `None` if the enum contains an unknown value deserialized from
    2458        /// the integer representation of enums.
    2459        pub fn name(&self) -> std::option::Option<&str> {
    2460            match self {
    2461                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
    2462                Self::Disabled => std::option::Option::Some("DISABLED"),
    2463                Self::Debug => std::option::Option::Some("DEBUG"),
    2464                Self::Info => std::option::Option::Some("INFO"),
    2465                Self::Warning => std::option::Option::Some("WARNING"),
    2466                Self::Error => std::option::Option::Some("ERROR"),
    2467                Self::UnknownValue(u) => u.0.name(),
    2468            }
    2469        }
    2470    }
    2471
    2472    impl std::default::Default for Severity {
    2473        fn default() -> Self {
    2474            use std::convert::From;
    2475            Self::from(0)
    2476        }
    2477    }
    2478
    2479    impl std::fmt::Display for Severity {
    2480        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    2481            wkt::internal::display_enum(f, self.name(), self.value())
    2482        }
    2483    }
    2484
    2485    impl std::convert::From<i32> for Severity {
    2486        fn from(value: i32) -> Self {
    2487            match value {
    2488                0 => Self::Unspecified,
    2489                1 => Self::Disabled,
    2490                2 => Self::Debug,
    2491                3 => Self::Info,
    2492                4 => Self::Warning,
    2493                5 => Self::Error,
    2494                _ => Self::UnknownValue(severity::UnknownValue(
    2495                    wkt::internal::UnknownEnumValue::Integer(value),
    2496                )),
    2497            }
    2498        }
    2499    }
    2500
    2501    impl std::convert::From<&str> for Severity {
    2502        fn from(value: &str) -> Self {
    2503            use std::string::ToString;
    2504            match value {
    2505                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
    2506                "DISABLED" => Self::Disabled,
    2507                "DEBUG" => Self::Debug,
    2508                "INFO" => Self::Info,
    2509                "WARNING" => Self::Warning,
    2510                "ERROR" => Self::Error,
    2511                _ => Self::UnknownValue(severity::UnknownValue(
    2512                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    2513                )),
    2514            }
    2515        }
    2516    }
    2517
    2518    impl serde::ser::Serialize for Severity {
    2519        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    2520        where
    2521            S: serde::Serializer,
    2522        {
    2523            match self {
    2524                Self::Unspecified => serializer.serialize_i32(0),
    2525                Self::Disabled => serializer.serialize_i32(1),
    2526                Self::Debug => serializer.serialize_i32(2),
    2527                Self::Info => serializer.serialize_i32(3),
    2528                Self::Warning => serializer.serialize_i32(4),
    2529                Self::Error => serializer.serialize_i32(5),
    2530                Self::UnknownValue(u) => u.0.serialize(serializer),
    2531            }
    2532        }
    2533    }
    2534
    2535    impl<'de> serde::de::Deserialize<'de> for Severity {
    2536        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    2537        where
    2538            D: serde::Deserializer<'de>,
    2539        {
    2540            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
    2541                ".google.pubsub.v1.PlatformLogsSettings.Severity",
    2542            ))
    2543        }
    2544    }
    2545}
    2546
    2547/// User-defined JavaScript function that can transform or filter a Pub/Sub
    2548/// message.
    2549#[derive(Clone, Default, PartialEq)]
    2550#[non_exhaustive]
    2551pub struct JavaScriptUDF {
    2552    /// Required. Name of the JavasScript function that should applied to Pub/Sub
    2553    /// messages.
    2554    pub function_name: std::string::String,
    2555
    2556    /// Required. JavaScript code that contains a function `function_name` with the
    2557    /// below signature:
    2558    ///
    2559    /// ```norust
    2560    ///   /**
    2561    ///   * Transforms a Pub/Sub message.
    2562    ///
    2563    ///   * @return {(Object<string, (string | Object<string, string>)>|null)} - To
    2564    ///   * filter a message, return `null`. To transform a message return a map
    2565    ///   * with the following keys:
    2566    ///   *   - (required) 'data' : {string}
    2567    ///   *   - (optional) 'attributes' : {Object<string, string>}
    2568    ///   * Returning empty `attributes` will remove all attributes from the
    2569    ///   * message.
    2570    ///   *
    2571    ///   * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
    2572    ///   * message. Keys:
    2573    ///   *   - (required) 'data' : {string}
    2574    ///   *   - (required) 'attributes' : {Object<string, string>}
    2575    ///   *
    2576    ///   * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
    2577    ///   * Keys:
    2578    ///   *   - (optional) 'message_id'  : {string}
    2579    ///   *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
    2580    ///   *   - (optional) 'ordering_key': {string}
    2581    ///   */
    2582    ///
    2583    ///   function <function_name>(message, metadata) {
    2584    ///   }
    2585    /// ```
    2586    pub code: std::string::String,
    2587
    2588    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    2589}
    2590
    2591impl JavaScriptUDF {
    2592    pub fn new() -> Self {
    2593        std::default::Default::default()
    2594    }
    2595
    2596    /// Sets the value of [function_name][crate::model::JavaScriptUDF::function_name].
    2597    ///
    2598    /// # Example
    2599    /// ```ignore,no_run
    2600    /// # use google_cloud_pubsub::model::JavaScriptUDF;
    2601    /// let x = JavaScriptUDF::new().set_function_name("example");
    2602    /// ```
    2603    pub fn set_function_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2604        self.function_name = v.into();
    2605        self
    2606    }
    2607
    2608    /// Sets the value of [code][crate::model::JavaScriptUDF::code].
    2609    ///
    2610    /// # Example
    2611    /// ```ignore,no_run
    2612    /// # use google_cloud_pubsub::model::JavaScriptUDF;
    2613    /// let x = JavaScriptUDF::new().set_code("example");
    2614    /// ```
    2615    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2616        self.code = v.into();
    2617        self
    2618    }
    2619}
    2620
    2621impl wkt::message::Message for JavaScriptUDF {
    2622    fn typename() -> &'static str {
    2623        "type.googleapis.com/google.pubsub.v1.JavaScriptUDF"
    2624    }
    2625}
    2626
    2627/// All supported message transforms types.
    2628#[derive(Clone, Default, PartialEq)]
    2629#[non_exhaustive]
    2630pub struct MessageTransform {
    2631    /// Optional. This field is deprecated, use the `disabled` field to disable
    2632    /// transforms.
    2633    #[deprecated]
    2634    pub enabled: bool,
    2635
    2636    /// Optional. If true, the transform is disabled and will not be applied to
    2637    /// messages. Defaults to `false`.
    2638    pub disabled: bool,
    2639
    2640    /// The type of transform to apply to messages.
    2641    pub transform: std::option::Option<crate::model::message_transform::Transform>,
    2642
    2643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    2644}
    2645
    2646impl MessageTransform {
    2647    pub fn new() -> Self {
    2648        std::default::Default::default()
    2649    }
    2650
    2651    /// Sets the value of [enabled][crate::model::MessageTransform::enabled].
    2652    ///
    2653    /// # Example
    2654    /// ```ignore,no_run
    2655    /// # use google_cloud_pubsub::model::MessageTransform;
    2656    /// let x = MessageTransform::new().set_enabled(true);
    2657    /// ```
    2658    #[deprecated]
    2659    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    2660        self.enabled = v.into();
    2661        self
    2662    }
    2663
    2664    /// Sets the value of [disabled][crate::model::MessageTransform::disabled].
    2665    ///
    2666    /// # Example
    2667    /// ```ignore,no_run
    2668    /// # use google_cloud_pubsub::model::MessageTransform;
    2669    /// let x = MessageTransform::new().set_disabled(true);
    2670    /// ```
    2671    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    2672        self.disabled = v.into();
    2673        self
    2674    }
    2675
    2676    /// Sets the value of [transform][crate::model::MessageTransform::transform].
    2677    ///
    2678    /// Note that all the setters affecting `transform` are mutually
    2679    /// exclusive.
    2680    ///
    2681    /// # Example
    2682    /// ```ignore,no_run
    2683    /// # use google_cloud_pubsub::model::MessageTransform;
    2684    /// use google_cloud_pubsub::model::JavaScriptUDF;
    2685    /// let x = MessageTransform::new().set_transform(Some(
    2686    ///     google_cloud_pubsub::model::message_transform::Transform::JavascriptUdf(JavaScriptUDF::default().into())));
    2687    /// ```
    2688    pub fn set_transform<
    2689        T: std::convert::Into<std::option::Option<crate::model::message_transform::Transform>>,
    2690    >(
    2691        mut self,
    2692        v: T,
    2693    ) -> Self {
    2694        self.transform = v.into();
    2695        self
    2696    }
    2697
    2698    /// The value of [transform][crate::model::MessageTransform::transform]
    2699    /// if it holds a `JavascriptUdf`, `None` if the field is not set or
    2700    /// holds a different branch.
    2701    pub fn javascript_udf(
    2702        &self,
    2703    ) -> std::option::Option<&std::boxed::Box<crate::model::JavaScriptUDF>> {
    2704        #[allow(unreachable_patterns)]
    2705        self.transform.as_ref().and_then(|v| match v {
    2706            crate::model::message_transform::Transform::JavascriptUdf(v) => {
    2707                std::option::Option::Some(v)
    2708            }
    2709            _ => std::option::Option::None,
    2710        })
    2711    }
    2712
    2713    /// Sets the value of [transform][crate::model::MessageTransform::transform]
    2714    /// to hold a `JavascriptUdf`.
    2715    ///
    2716    /// Note that all the setters affecting `transform` are
    2717    /// mutually exclusive.
    2718    ///
    2719    /// # Example
    2720    /// ```ignore,no_run
    2721    /// # use google_cloud_pubsub::model::MessageTransform;
    2722    /// use google_cloud_pubsub::model::JavaScriptUDF;
    2723    /// let x = MessageTransform::new().set_javascript_udf(JavaScriptUDF::default()/* use setters */);
    2724    /// assert!(x.javascript_udf().is_some());
    2725    /// ```
    2726    pub fn set_javascript_udf<
    2727        T: std::convert::Into<std::boxed::Box<crate::model::JavaScriptUDF>>,
    2728    >(
    2729        mut self,
    2730        v: T,
    2731    ) -> Self {
    2732        self.transform = std::option::Option::Some(
    2733            crate::model::message_transform::Transform::JavascriptUdf(v.into()),
    2734        );
    2735        self
    2736    }
    2737}
    2738
    2739impl wkt::message::Message for MessageTransform {
    2740    fn typename() -> &'static str {
    2741        "type.googleapis.com/google.pubsub.v1.MessageTransform"
    2742    }
    2743}
    2744
    2745/// Defines additional types related to [MessageTransform].
    2746pub mod message_transform {
    2747    #[allow(unused_imports)]
    2748    use super::*;
    2749
    2750    /// The type of transform to apply to messages.
    2751    #[derive(Clone, Debug, PartialEq)]
    2752    #[non_exhaustive]
    2753    pub enum Transform {
    2754        /// Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
    2755        /// are specified on a resource, each must have a unique `function_name`.
    2756        JavascriptUdf(std::boxed::Box<crate::model::JavaScriptUDF>),
    2757    }
    2758}
    2759
    2760/// A topic resource.
    2761#[derive(Clone, Default, PartialEq)]
    2762#[non_exhaustive]
    2763pub struct Topic {
    2764    /// Required. Identifier. The name of the topic. It must have the format
    2765    /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
    2766    /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
    2767    /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
    2768    /// signs (`%`). It must be between 3 and 255 characters in length, and it
    2769    /// must not start with `"goog"`.
    2770    pub name: std::string::String,
    2771
    2772    /// Optional. See [Creating and managing labels]
    2773    /// (<https://cloud.google.com/pubsub/docs/labels>).
    2774    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
    2775
    2776    /// Optional. Policy constraining the set of Google Cloud Platform regions
    2777    /// where messages published to the topic may be stored. If not present, then
    2778    /// no constraints are in effect.
    2779    pub message_storage_policy: std::option::Option<crate::model::MessageStoragePolicy>,
    2780
    2781    /// Optional. The resource name of the Cloud KMS CryptoKey to be used to
    2782    /// protect access to messages published on this topic.
    2783    ///
    2784    /// The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
    2785    pub kms_key_name: std::string::String,
    2786
    2787    /// Optional. Settings for validating messages published against a schema.
    2788    pub schema_settings: std::option::Option<crate::model::SchemaSettings>,
    2789
    2790    /// Optional. Reserved for future use. This field is set only in responses from
    2791    /// the server; it is ignored if it is set in any requests.
    2792    pub satisfies_pzs: bool,
    2793
    2794    /// Optional. Indicates the minimum duration to retain a message after it is
    2795    /// published to the topic. If this field is set, messages published to the
    2796    /// topic in the last `message_retention_duration` are always available to
    2797    /// subscribers. For instance, it allows any attached subscription to [seek to
    2798    /// a
    2799    /// timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
    2800    /// that is up to `message_retention_duration` in the past. If this field is
    2801    /// not set, message retention is controlled by settings on individual
    2802    /// subscriptions. Cannot be more than 31 days or less than 10 minutes.
    2803    pub message_retention_duration: std::option::Option<wkt::Duration>,
    2804
    2805    /// Output only. An output-only field indicating the state of the topic.
    2806    pub state: crate::model::topic::State,
    2807
    2808    /// Optional. Settings for ingestion from a data source into this topic.
    2809    pub ingestion_data_source_settings:
    2810        std::option::Option<crate::model::IngestionDataSourceSettings>,
    2811
    2812    /// Optional. Transforms to be applied to messages published to the topic.
    2813    /// Transforms are applied in the order specified.
    2814    pub message_transforms: std::vec::Vec<crate::model::MessageTransform>,
    2815
    2816    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
    2817    /// resource. For example:
    2818    /// "123/environment": "production",
    2819    /// "123/costCenter": "marketing"
    2820    /// See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on
    2821    /// using tags with Pub/Sub resources.
    2822    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
    2823
    2824    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    2825}
    2826
    2827impl Topic {
    2828    pub fn new() -> Self {
    2829        std::default::Default::default()
    2830    }
    2831
    2832    /// Sets the value of [name][crate::model::Topic::name].
    2833    ///
    2834    /// # Example
    2835    /// ```ignore,no_run
    2836    /// # use google_cloud_pubsub::model::Topic;
    2837    /// let x = Topic::new().set_name("example");
    2838    /// ```
    2839    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2840        self.name = v.into();
    2841        self
    2842    }
    2843
    2844    /// Sets the value of [labels][crate::model::Topic::labels].
    2845    ///
    2846    /// # Example
    2847    /// ```ignore,no_run
    2848    /// # use google_cloud_pubsub::model::Topic;
    2849    /// let x = Topic::new().set_labels([
    2850    ///     ("key0", "abc"),
    2851    ///     ("key1", "xyz"),
    2852    /// ]);
    2853    /// ```
    2854    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    2855    where
    2856        T: std::iter::IntoIterator<Item = (K, V)>,
    2857        K: std::convert::Into<std::string::String>,
    2858        V: std::convert::Into<std::string::String>,
    2859    {
    2860        use std::iter::Iterator;
    2861        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    2862        self
    2863    }
    2864
    2865    /// Sets the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
    2866    ///
    2867    /// # Example
    2868    /// ```ignore,no_run
    2869    /// # use google_cloud_pubsub::model::Topic;
    2870    /// use google_cloud_pubsub::model::MessageStoragePolicy;
    2871    /// let x = Topic::new().set_message_storage_policy(MessageStoragePolicy::default()/* use setters */);
    2872    /// ```
    2873    pub fn set_message_storage_policy<T>(mut self, v: T) -> Self
    2874    where
    2875        T: std::convert::Into<crate::model::MessageStoragePolicy>,
    2876    {
    2877        self.message_storage_policy = std::option::Option::Some(v.into());
    2878        self
    2879    }
    2880
    2881    /// Sets or clears the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
    2882    ///
    2883    /// # Example
    2884    /// ```ignore,no_run
    2885    /// # use google_cloud_pubsub::model::Topic;
    2886    /// use google_cloud_pubsub::model::MessageStoragePolicy;
    2887    /// let x = Topic::new().set_or_clear_message_storage_policy(Some(MessageStoragePolicy::default()/* use setters */));
    2888    /// let x = Topic::new().set_or_clear_message_storage_policy(None::<MessageStoragePolicy>);
    2889    /// ```
    2890    pub fn set_or_clear_message_storage_policy<T>(mut self, v: std::option::Option<T>) -> Self
    2891    where
    2892        T: std::convert::Into<crate::model::MessageStoragePolicy>,
    2893    {
    2894        self.message_storage_policy = v.map(|x| x.into());
    2895        self
    2896    }
    2897
    2898    /// Sets the value of [kms_key_name][crate::model::Topic::kms_key_name].
    2899    ///
    2900    /// # Example
    2901    /// ```ignore,no_run
    2902    /// # use google_cloud_pubsub::model::Topic;
    2903    /// let x = Topic::new().set_kms_key_name("example");
    2904    /// ```
    2905    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    2906        self.kms_key_name = v.into();
    2907        self
    2908    }
    2909
    2910    /// Sets the value of [schema_settings][crate::model::Topic::schema_settings].
    2911    ///
    2912    /// # Example
    2913    /// ```ignore,no_run
    2914    /// # use google_cloud_pubsub::model::Topic;
    2915    /// use google_cloud_pubsub::model::SchemaSettings;
    2916    /// let x = Topic::new().set_schema_settings(SchemaSettings::default()/* use setters */);
    2917    /// ```
    2918    pub fn set_schema_settings<T>(mut self, v: T) -> Self
    2919    where
    2920        T: std::convert::Into<crate::model::SchemaSettings>,
    2921    {
    2922        self.schema_settings = std::option::Option::Some(v.into());
    2923        self
    2924    }
    2925
    2926    /// Sets or clears the value of [schema_settings][crate::model::Topic::schema_settings].
    2927    ///
    2928    /// # Example
    2929    /// ```ignore,no_run
    2930    /// # use google_cloud_pubsub::model::Topic;
    2931    /// use google_cloud_pubsub::model::SchemaSettings;
    2932    /// let x = Topic::new().set_or_clear_schema_settings(Some(SchemaSettings::default()/* use setters */));
    2933    /// let x = Topic::new().set_or_clear_schema_settings(None::<SchemaSettings>);
    2934    /// ```
    2935    pub fn set_or_clear_schema_settings<T>(mut self, v: std::option::Option<T>) -> Self
    2936    where
    2937        T: std::convert::Into<crate::model::SchemaSettings>,
    2938    {
    2939        self.schema_settings = v.map(|x| x.into());
    2940        self
    2941    }
    2942
    2943    /// Sets the value of [satisfies_pzs][crate::model::Topic::satisfies_pzs].
    2944    ///
    2945    /// # Example
    2946    /// ```ignore,no_run
    2947    /// # use google_cloud_pubsub::model::Topic;
    2948    /// let x = Topic::new().set_satisfies_pzs(true);
    2949    /// ```
    2950    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    2951        self.satisfies_pzs = v.into();
    2952        self
    2953    }
    2954
    2955    /// Sets the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
    2956    ///
    2957    /// # Example
    2958    /// ```ignore,no_run
    2959    /// # use google_cloud_pubsub::model::Topic;
    2960    /// use wkt::Duration;
    2961    /// let x = Topic::new().set_message_retention_duration(Duration::default()/* use setters */);
    2962    /// ```
    2963    pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
    2964    where
    2965        T: std::convert::Into<wkt::Duration>,
    2966    {
    2967        self.message_retention_duration = std::option::Option::Some(v.into());
    2968        self
    2969    }
    2970
    2971    /// Sets or clears the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
    2972    ///
    2973    /// # Example
    2974    /// ```ignore,no_run
    2975    /// # use google_cloud_pubsub::model::Topic;
    2976    /// use wkt::Duration;
    2977    /// let x = Topic::new().set_or_clear_message_retention_duration(Some(Duration::default()/* use setters */));
    2978    /// let x = Topic::new().set_or_clear_message_retention_duration(None::<Duration>);
    2979    /// ```
    2980    pub fn set_or_clear_message_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
    2981    where
    2982        T: std::convert::Into<wkt::Duration>,
    2983    {
    2984        self.message_retention_duration = v.map(|x| x.into());
    2985        self
    2986    }
    2987
    2988    /// Sets the value of [state][crate::model::Topic::state].
    2989    ///
    2990    /// # Example
    2991    /// ```ignore,no_run
    2992    /// # use google_cloud_pubsub::model::Topic;
    2993    /// use google_cloud_pubsub::model::topic::State;
    2994    /// let x0 = Topic::new().set_state(State::Active);
    2995    /// let x1 = Topic::new().set_state(State::IngestionResourceError);
    2996    /// ```
    2997    pub fn set_state<T: std::convert::Into<crate::model::topic::State>>(mut self, v: T) -> Self {
    2998        self.state = v.into();
    2999        self
    3000    }
    3001
    3002    /// Sets the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
    3003    ///
    3004    /// # Example
    3005    /// ```ignore,no_run
    3006    /// # use google_cloud_pubsub::model::Topic;
    3007    /// use google_cloud_pubsub::model::IngestionDataSourceSettings;
    3008    /// let x = Topic::new().set_ingestion_data_source_settings(IngestionDataSourceSettings::default()/* use setters */);
    3009    /// ```
    3010    pub fn set_ingestion_data_source_settings<T>(mut self, v: T) -> Self
    3011    where
    3012        T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
    3013    {
    3014        self.ingestion_data_source_settings = std::option::Option::Some(v.into());
    3015        self
    3016    }
    3017
    3018    /// Sets or clears the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
    3019    ///
    3020    /// # Example
    3021    /// ```ignore,no_run
    3022    /// # use google_cloud_pubsub::model::Topic;
    3023    /// use google_cloud_pubsub::model::IngestionDataSourceSettings;
    3024    /// let x = Topic::new().set_or_clear_ingestion_data_source_settings(Some(IngestionDataSourceSettings::default()/* use setters */));
    3025    /// let x = Topic::new().set_or_clear_ingestion_data_source_settings(None::<IngestionDataSourceSettings>);
    3026    /// ```
    3027    pub fn set_or_clear_ingestion_data_source_settings<T>(
    3028        mut self,
    3029        v: std::option::Option<T>,
    3030    ) -> Self
    3031    where
    3032        T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
    3033    {
    3034        self.ingestion_data_source_settings = v.map(|x| x.into());
    3035        self
    3036    }
    3037
    3038    /// Sets the value of [message_transforms][crate::model::Topic::message_transforms].
    3039    ///
    3040    /// # Example
    3041    /// ```ignore,no_run
    3042    /// # use google_cloud_pubsub::model::Topic;
    3043    /// use google_cloud_pubsub::model::MessageTransform;
    3044    /// let x = Topic::new()
    3045    ///     .set_message_transforms([
    3046    ///         MessageTransform::default()/* use setters */,
    3047    ///         MessageTransform::default()/* use (different) setters */,
    3048    ///     ]);
    3049    /// ```
    3050    pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
    3051    where
    3052        T: std::iter::IntoIterator<Item = V>,
    3053        V: std::convert::Into<crate::model::MessageTransform>,
    3054    {
    3055        use std::iter::Iterator;
    3056        self.message_transforms = v.into_iter().map(|i| i.into()).collect();
    3057        self
    3058    }
    3059
    3060    /// Sets the value of [tags][crate::model::Topic::tags].
    3061    ///
    3062    /// # Example
    3063    /// ```ignore,no_run
    3064    /// # use google_cloud_pubsub::model::Topic;
    3065    /// let x = Topic::new().set_tags([
    3066    ///     ("key0", "abc"),
    3067    ///     ("key1", "xyz"),
    3068    /// ]);
    3069    /// ```
    3070    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
    3071    where
    3072        T: std::iter::IntoIterator<Item = (K, V)>,
    3073        K: std::convert::Into<std::string::String>,
    3074        V: std::convert::Into<std::string::String>,
    3075    {
    3076        use std::iter::Iterator;
    3077        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    3078        self
    3079    }
    3080}
    3081
    3082impl wkt::message::Message for Topic {
    3083    fn typename() -> &'static str {
    3084        "type.googleapis.com/google.pubsub.v1.Topic"
    3085    }
    3086}
    3087
    3088/// Defines additional types related to [Topic].
    3089pub mod topic {
    3090    #[allow(unused_imports)]
    3091    use super::*;
    3092
    3093    /// The state of the topic.
    3094    ///
    3095    /// # Working with unknown values
    3096    ///
    3097    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    3098    /// additional enum variants at any time. Adding new variants is not considered
    3099    /// a breaking change. Applications should write their code in anticipation of:
    3100    ///
    3101    /// - New values appearing in future releases of the client library, **and**
    3102    /// - New values received dynamically, without application changes.
    3103    ///
    3104    /// Please consult the [Working with enums] section in the user guide for some
    3105    /// guidelines.
    3106    ///
    3107    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    3108    #[derive(Clone, Debug, PartialEq)]
    3109    #[non_exhaustive]
    3110    pub enum State {
    3111        /// Default value. This value is unused.
    3112        Unspecified,
    3113        /// The topic does not have any persistent errors.
    3114        Active,
    3115        /// Ingestion from the data source has encountered a permanent error.
    3116        /// See the more detailed error state in the corresponding ingestion
    3117        /// source configuration.
    3118        IngestionResourceError,
    3119        /// If set, the enum was initialized with an unknown value.
    3120        ///
    3121        /// Applications can examine the value using [State::value] or
    3122        /// [State::name].
    3123        UnknownValue(state::UnknownValue),
    3124    }
    3125
    3126    #[doc(hidden)]
    3127    pub mod state {
    3128        #[allow(unused_imports)]
    3129        use super::*;
    3130        #[derive(Clone, Debug, PartialEq)]
    3131        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    3132    }
    3133
    3134    impl State {
    3135        /// Gets the enum value.
    3136        ///
    3137        /// Returns `None` if the enum contains an unknown value deserialized from
    3138        /// the string representation of enums.
    3139        pub fn value(&self) -> std::option::Option<i32> {
    3140            match self {
    3141                Self::Unspecified => std::option::Option::Some(0),
    3142                Self::Active => std::option::Option::Some(1),
    3143                Self::IngestionResourceError => std::option::Option::Some(2),
    3144                Self::UnknownValue(u) => u.0.value(),
    3145            }
    3146        }
    3147
    3148        /// Gets the enum value as a string.
    3149        ///
    3150        /// Returns `None` if the enum contains an unknown value deserialized from
    3151        /// the integer representation of enums.
    3152        pub fn name(&self) -> std::option::Option<&str> {
    3153            match self {
    3154                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    3155                Self::Active => std::option::Option::Some("ACTIVE"),
    3156                Self::IngestionResourceError => {
    3157                    std::option::Option::Some("INGESTION_RESOURCE_ERROR")
    3158                }
    3159                Self::UnknownValue(u) => u.0.name(),
    3160            }
    3161        }
    3162    }
    3163
    3164    impl std::default::Default for State {
    3165        fn default() -> Self {
    3166            use std::convert::From;
    3167            Self::from(0)
    3168        }
    3169    }
    3170
    3171    impl std::fmt::Display for State {
    3172        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    3173            wkt::internal::display_enum(f, self.name(), self.value())
    3174        }
    3175    }
    3176
    3177    impl std::convert::From<i32> for State {
    3178        fn from(value: i32) -> Self {
    3179            match value {
    3180                0 => Self::Unspecified,
    3181                1 => Self::Active,
    3182                2 => Self::IngestionResourceError,
    3183                _ => Self::UnknownValue(state::UnknownValue(
    3184                    wkt::internal::UnknownEnumValue::Integer(value),
    3185                )),
    3186            }
    3187        }
    3188    }
    3189
    3190    impl std::convert::From<&str> for State {
    3191        fn from(value: &str) -> Self {
    3192            use std::string::ToString;
    3193            match value {
    3194                "STATE_UNSPECIFIED" => Self::Unspecified,
    3195                "ACTIVE" => Self::Active,
    3196                "INGESTION_RESOURCE_ERROR" => Self::IngestionResourceError,
    3197                _ => Self::UnknownValue(state::UnknownValue(
    3198                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    3199                )),
    3200            }
    3201        }
    3202    }
    3203
    3204    impl serde::ser::Serialize for State {
    3205        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    3206        where
    3207            S: serde::Serializer,
    3208        {
    3209            match self {
    3210                Self::Unspecified => serializer.serialize_i32(0),
    3211                Self::Active => serializer.serialize_i32(1),
    3212                Self::IngestionResourceError => serializer.serialize_i32(2),
    3213                Self::UnknownValue(u) => u.0.serialize(serializer),
    3214            }
    3215        }
    3216    }
    3217
    3218    impl<'de> serde::de::Deserialize<'de> for State {
    3219        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    3220        where
    3221            D: serde::Deserializer<'de>,
    3222        {
    3223            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    3224                ".google.pubsub.v1.Topic.State",
    3225            ))
    3226        }
    3227    }
    3228}
    3229
    3230/// Request for the GetTopic method.
    3231#[derive(Clone, Default, PartialEq)]
    3232#[non_exhaustive]
    3233pub struct GetTopicRequest {
    3234    /// Required. Identifier. The name of the topic to get.
    3235    /// Format is `projects/{project}/topics/{topic}`.
    3236    pub topic: std::string::String,
    3237
    3238    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3239}
    3240
    3241impl GetTopicRequest {
    3242    pub fn new() -> Self {
    3243        std::default::Default::default()
    3244    }
    3245
    3246    /// Sets the value of [topic][crate::model::GetTopicRequest::topic].
    3247    ///
    3248    /// # Example
    3249    /// ```ignore,no_run
    3250    /// # use google_cloud_pubsub::model::GetTopicRequest;
    3251    /// let x = GetTopicRequest::new().set_topic("example");
    3252    /// ```
    3253    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3254        self.topic = v.into();
    3255        self
    3256    }
    3257}
    3258
    3259impl wkt::message::Message for GetTopicRequest {
    3260    fn typename() -> &'static str {
    3261        "type.googleapis.com/google.pubsub.v1.GetTopicRequest"
    3262    }
    3263}
    3264
    3265/// Request for the UpdateTopic method.
    3266#[derive(Clone, Default, PartialEq)]
    3267#[non_exhaustive]
    3268pub struct UpdateTopicRequest {
    3269    /// Required. The updated topic object.
    3270    pub topic: std::option::Option<crate::model::Topic>,
    3271
    3272    /// Required. Indicates which fields in the provided topic to update. Must be
    3273    /// specified and non-empty. Note that if `update_mask` contains
    3274    /// "message_storage_policy" but the `message_storage_policy` is not set in
    3275    /// the `topic` provided above, then the updated value is determined by the
    3276    /// policy configured at the project or organization level.
    3277    pub update_mask: std::option::Option<wkt::FieldMask>,
    3278
    3279    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3280}
    3281
    3282impl UpdateTopicRequest {
    3283    pub fn new() -> Self {
    3284        std::default::Default::default()
    3285    }
    3286
    3287    /// Sets the value of [topic][crate::model::UpdateTopicRequest::topic].
    3288    ///
    3289    /// # Example
    3290    /// ```ignore,no_run
    3291    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
    3292    /// use google_cloud_pubsub::model::Topic;
    3293    /// let x = UpdateTopicRequest::new().set_topic(Topic::default()/* use setters */);
    3294    /// ```
    3295    pub fn set_topic<T>(mut self, v: T) -> Self
    3296    where
    3297        T: std::convert::Into<crate::model::Topic>,
    3298    {
    3299        self.topic = std::option::Option::Some(v.into());
    3300        self
    3301    }
    3302
    3303    /// Sets or clears the value of [topic][crate::model::UpdateTopicRequest::topic].
    3304    ///
    3305    /// # Example
    3306    /// ```ignore,no_run
    3307    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
    3308    /// use google_cloud_pubsub::model::Topic;
    3309    /// let x = UpdateTopicRequest::new().set_or_clear_topic(Some(Topic::default()/* use setters */));
    3310    /// let x = UpdateTopicRequest::new().set_or_clear_topic(None::<Topic>);
    3311    /// ```
    3312    pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
    3313    where
    3314        T: std::convert::Into<crate::model::Topic>,
    3315    {
    3316        self.topic = v.map(|x| x.into());
    3317        self
    3318    }
    3319
    3320    /// Sets the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
    3321    ///
    3322    /// # Example
    3323    /// ```ignore,no_run
    3324    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
    3325    /// use wkt::FieldMask;
    3326    /// let x = UpdateTopicRequest::new().set_update_mask(FieldMask::default()/* use setters */);
    3327    /// ```
    3328    pub fn set_update_mask<T>(mut self, v: T) -> Self
    3329    where
    3330        T: std::convert::Into<wkt::FieldMask>,
    3331    {
    3332        self.update_mask = std::option::Option::Some(v.into());
    3333        self
    3334    }
    3335
    3336    /// Sets or clears the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
    3337    ///
    3338    /// # Example
    3339    /// ```ignore,no_run
    3340    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
    3341    /// use wkt::FieldMask;
    3342    /// let x = UpdateTopicRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
    3343    /// let x = UpdateTopicRequest::new().set_or_clear_update_mask(None::<FieldMask>);
    3344    /// ```
    3345    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    3346    where
    3347        T: std::convert::Into<wkt::FieldMask>,
    3348    {
    3349        self.update_mask = v.map(|x| x.into());
    3350        self
    3351    }
    3352}
    3353
    3354impl wkt::message::Message for UpdateTopicRequest {
    3355    fn typename() -> &'static str {
    3356        "type.googleapis.com/google.pubsub.v1.UpdateTopicRequest"
    3357    }
    3358}
    3359
    3360/// Request for the `ListTopics` method.
    3361#[derive(Clone, Default, PartialEq)]
    3362#[non_exhaustive]
    3363pub struct ListTopicsRequest {
    3364    /// Required. Identifier. The name of the project in which to list topics.
    3365    /// Format is `projects/{project-id}`.
    3366    pub project: std::string::String,
    3367
    3368    /// Optional. Maximum number of topics to return.
    3369    pub page_size: i32,
    3370
    3371    /// Optional. The value returned by the last `ListTopicsResponse`; indicates
    3372    /// that this is a continuation of a prior `ListTopics` call, and that the
    3373    /// system should return the next page of data.
    3374    pub page_token: std::string::String,
    3375
    3376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3377}
    3378
    3379impl ListTopicsRequest {
    3380    pub fn new() -> Self {
    3381        std::default::Default::default()
    3382    }
    3383
    3384    /// Sets the value of [project][crate::model::ListTopicsRequest::project].
    3385    ///
    3386    /// # Example
    3387    /// ```ignore,no_run
    3388    /// # use google_cloud_pubsub::model::ListTopicsRequest;
    3389    /// let x = ListTopicsRequest::new().set_project("example");
    3390    /// ```
    3391    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3392        self.project = v.into();
    3393        self
    3394    }
    3395
    3396    /// Sets the value of [page_size][crate::model::ListTopicsRequest::page_size].
    3397    ///
    3398    /// # Example
    3399    /// ```ignore,no_run
    3400    /// # use google_cloud_pubsub::model::ListTopicsRequest;
    3401    /// let x = ListTopicsRequest::new().set_page_size(42);
    3402    /// ```
    3403    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    3404        self.page_size = v.into();
    3405        self
    3406    }
    3407
    3408    /// Sets the value of [page_token][crate::model::ListTopicsRequest::page_token].
    3409    ///
    3410    /// # Example
    3411    /// ```ignore,no_run
    3412    /// # use google_cloud_pubsub::model::ListTopicsRequest;
    3413    /// let x = ListTopicsRequest::new().set_page_token("example");
    3414    /// ```
    3415    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3416        self.page_token = v.into();
    3417        self
    3418    }
    3419}
    3420
    3421impl wkt::message::Message for ListTopicsRequest {
    3422    fn typename() -> &'static str {
    3423        "type.googleapis.com/google.pubsub.v1.ListTopicsRequest"
    3424    }
    3425}
    3426
    3427/// Response for the `ListTopics` method.
    3428#[derive(Clone, Default, PartialEq)]
    3429#[non_exhaustive]
    3430pub struct ListTopicsResponse {
    3431    /// Optional. The resulting topics.
    3432    pub topics: std::vec::Vec<crate::model::Topic>,
    3433
    3434    /// Optional. If not empty, indicates that there may be more topics that match
    3435    /// the request; this value should be passed in a new `ListTopicsRequest`.
    3436    pub next_page_token: std::string::String,
    3437
    3438    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3439}
    3440
    3441impl ListTopicsResponse {
    3442    pub fn new() -> Self {
    3443        std::default::Default::default()
    3444    }
    3445
    3446    /// Sets the value of [topics][crate::model::ListTopicsResponse::topics].
    3447    ///
    3448    /// # Example
    3449    /// ```ignore,no_run
    3450    /// # use google_cloud_pubsub::model::ListTopicsResponse;
    3451    /// use google_cloud_pubsub::model::Topic;
    3452    /// let x = ListTopicsResponse::new()
    3453    ///     .set_topics([
    3454    ///         Topic::default()/* use setters */,
    3455    ///         Topic::default()/* use (different) setters */,
    3456    ///     ]);
    3457    /// ```
    3458    pub fn set_topics<T, V>(mut self, v: T) -> Self
    3459    where
    3460        T: std::iter::IntoIterator<Item = V>,
    3461        V: std::convert::Into<crate::model::Topic>,
    3462    {
    3463        use std::iter::Iterator;
    3464        self.topics = v.into_iter().map(|i| i.into()).collect();
    3465        self
    3466    }
    3467
    3468    /// Sets the value of [next_page_token][crate::model::ListTopicsResponse::next_page_token].
    3469    ///
    3470    /// # Example
    3471    /// ```ignore,no_run
    3472    /// # use google_cloud_pubsub::model::ListTopicsResponse;
    3473    /// let x = ListTopicsResponse::new().set_next_page_token("example");
    3474    /// ```
    3475    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3476        self.next_page_token = v.into();
    3477        self
    3478    }
    3479}
    3480
    3481impl wkt::message::Message for ListTopicsResponse {
    3482    fn typename() -> &'static str {
    3483        "type.googleapis.com/google.pubsub.v1.ListTopicsResponse"
    3484    }
    3485}
    3486
    3487#[doc(hidden)]
    3488impl gax::paginator::internal::PageableResponse for ListTopicsResponse {
    3489    type PageItem = crate::model::Topic;
    3490
    3491    fn items(self) -> std::vec::Vec<Self::PageItem> {
    3492        self.topics
    3493    }
    3494
    3495    fn next_page_token(&self) -> std::string::String {
    3496        use std::clone::Clone;
    3497        self.next_page_token.clone()
    3498    }
    3499}
    3500
    3501/// Request for the `ListTopicSubscriptions` method.
    3502#[derive(Clone, Default, PartialEq)]
    3503#[non_exhaustive]
    3504pub struct ListTopicSubscriptionsRequest {
    3505    /// Required. The name of the topic that subscriptions are attached to.
    3506    /// Format is `projects/{project}/topics/{topic}`.
    3507    pub topic: std::string::String,
    3508
    3509    /// Optional. Maximum number of subscription names to return.
    3510    pub page_size: i32,
    3511
    3512    /// Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
    3513    /// indicates that this is a continuation of a prior `ListTopicSubscriptions`
    3514    /// call, and that the system should return the next page of data.
    3515    pub page_token: std::string::String,
    3516
    3517    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3518}
    3519
    3520impl ListTopicSubscriptionsRequest {
    3521    pub fn new() -> Self {
    3522        std::default::Default::default()
    3523    }
    3524
    3525    /// Sets the value of [topic][crate::model::ListTopicSubscriptionsRequest::topic].
    3526    ///
    3527    /// # Example
    3528    /// ```ignore,no_run
    3529    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
    3530    /// let x = ListTopicSubscriptionsRequest::new().set_topic("example");
    3531    /// ```
    3532    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3533        self.topic = v.into();
    3534        self
    3535    }
    3536
    3537    /// Sets the value of [page_size][crate::model::ListTopicSubscriptionsRequest::page_size].
    3538    ///
    3539    /// # Example
    3540    /// ```ignore,no_run
    3541    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
    3542    /// let x = ListTopicSubscriptionsRequest::new().set_page_size(42);
    3543    /// ```
    3544    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    3545        self.page_size = v.into();
    3546        self
    3547    }
    3548
    3549    /// Sets the value of [page_token][crate::model::ListTopicSubscriptionsRequest::page_token].
    3550    ///
    3551    /// # Example
    3552    /// ```ignore,no_run
    3553    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
    3554    /// let x = ListTopicSubscriptionsRequest::new().set_page_token("example");
    3555    /// ```
    3556    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3557        self.page_token = v.into();
    3558        self
    3559    }
    3560}
    3561
    3562impl wkt::message::Message for ListTopicSubscriptionsRequest {
    3563    fn typename() -> &'static str {
    3564        "type.googleapis.com/google.pubsub.v1.ListTopicSubscriptionsRequest"
    3565    }
    3566}
    3567
    3568/// Response for the `ListTopicSubscriptions` method.
    3569#[derive(Clone, Default, PartialEq)]
    3570#[non_exhaustive]
    3571pub struct ListTopicSubscriptionsResponse {
    3572    /// Optional. The names of subscriptions attached to the topic specified in the
    3573    /// request.
    3574    pub subscriptions: std::vec::Vec<std::string::String>,
    3575
    3576    /// Optional. If not empty, indicates that there may be more subscriptions that
    3577    /// match the request; this value should be passed in a new
    3578    /// `ListTopicSubscriptionsRequest` to get more subscriptions.
    3579    pub next_page_token: std::string::String,
    3580
    3581    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3582}
    3583
    3584impl ListTopicSubscriptionsResponse {
    3585    pub fn new() -> Self {
    3586        std::default::Default::default()
    3587    }
    3588
    3589    /// Sets the value of [subscriptions][crate::model::ListTopicSubscriptionsResponse::subscriptions].
    3590    ///
    3591    /// # Example
    3592    /// ```ignore,no_run
    3593    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsResponse;
    3594    /// let x = ListTopicSubscriptionsResponse::new().set_subscriptions(["a", "b", "c"]);
    3595    /// ```
    3596    pub fn set_subscriptions<T, V>(mut self, v: T) -> Self
    3597    where
    3598        T: std::iter::IntoIterator<Item = V>,
    3599        V: std::convert::Into<std::string::String>,
    3600    {
    3601        use std::iter::Iterator;
    3602        self.subscriptions = v.into_iter().map(|i| i.into()).collect();
    3603        self
    3604    }
    3605
    3606    /// Sets the value of [next_page_token][crate::model::ListTopicSubscriptionsResponse::next_page_token].
    3607    ///
    3608    /// # Example
    3609    /// ```ignore,no_run
    3610    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsResponse;
    3611    /// let x = ListTopicSubscriptionsResponse::new().set_next_page_token("example");
    3612    /// ```
    3613    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3614        self.next_page_token = v.into();
    3615        self
    3616    }
    3617}
    3618
    3619impl wkt::message::Message for ListTopicSubscriptionsResponse {
    3620    fn typename() -> &'static str {
    3621        "type.googleapis.com/google.pubsub.v1.ListTopicSubscriptionsResponse"
    3622    }
    3623}
    3624
    3625/// Request for the `ListTopicSnapshots` method.
    3626#[derive(Clone, Default, PartialEq)]
    3627#[non_exhaustive]
    3628pub struct ListTopicSnapshotsRequest {
    3629    /// Required. The name of the topic that snapshots are attached to.
    3630    /// Format is `projects/{project}/topics/{topic}`.
    3631    pub topic: std::string::String,
    3632
    3633    /// Optional. Maximum number of snapshot names to return.
    3634    pub page_size: i32,
    3635
    3636    /// Optional. The value returned by the last `ListTopicSnapshotsResponse`;
    3637    /// indicates that this is a continuation of a prior `ListTopicSnapshots` call,
    3638    /// and that the system should return the next page of data.
    3639    pub page_token: std::string::String,
    3640
    3641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3642}
    3643
    3644impl ListTopicSnapshotsRequest {
    3645    pub fn new() -> Self {
    3646        std::default::Default::default()
    3647    }
    3648
    3649    /// Sets the value of [topic][crate::model::ListTopicSnapshotsRequest::topic].
    3650    ///
    3651    /// # Example
    3652    /// ```ignore,no_run
    3653    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
    3654    /// let x = ListTopicSnapshotsRequest::new().set_topic("example");
    3655    /// ```
    3656    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3657        self.topic = v.into();
    3658        self
    3659    }
    3660
    3661    /// Sets the value of [page_size][crate::model::ListTopicSnapshotsRequest::page_size].
    3662    ///
    3663    /// # Example
    3664    /// ```ignore,no_run
    3665    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
    3666    /// let x = ListTopicSnapshotsRequest::new().set_page_size(42);
    3667    /// ```
    3668    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    3669        self.page_size = v.into();
    3670        self
    3671    }
    3672
    3673    /// Sets the value of [page_token][crate::model::ListTopicSnapshotsRequest::page_token].
    3674    ///
    3675    /// # Example
    3676    /// ```ignore,no_run
    3677    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
    3678    /// let x = ListTopicSnapshotsRequest::new().set_page_token("example");
    3679    /// ```
    3680    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3681        self.page_token = v.into();
    3682        self
    3683    }
    3684}
    3685
    3686impl wkt::message::Message for ListTopicSnapshotsRequest {
    3687    fn typename() -> &'static str {
    3688        "type.googleapis.com/google.pubsub.v1.ListTopicSnapshotsRequest"
    3689    }
    3690}
    3691
    3692/// Response for the `ListTopicSnapshots` method.
    3693#[derive(Clone, Default, PartialEq)]
    3694#[non_exhaustive]
    3695pub struct ListTopicSnapshotsResponse {
    3696    /// Optional. The names of the snapshots that match the request.
    3697    pub snapshots: std::vec::Vec<std::string::String>,
    3698
    3699    /// Optional. If not empty, indicates that there may be more snapshots that
    3700    /// match the request; this value should be passed in a new
    3701    /// `ListTopicSnapshotsRequest` to get more snapshots.
    3702    pub next_page_token: std::string::String,
    3703
    3704    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3705}
    3706
    3707impl ListTopicSnapshotsResponse {
    3708    pub fn new() -> Self {
    3709        std::default::Default::default()
    3710    }
    3711
    3712    /// Sets the value of [snapshots][crate::model::ListTopicSnapshotsResponse::snapshots].
    3713    ///
    3714    /// # Example
    3715    /// ```ignore,no_run
    3716    /// # use google_cloud_pubsub::model::ListTopicSnapshotsResponse;
    3717    /// let x = ListTopicSnapshotsResponse::new().set_snapshots(["a", "b", "c"]);
    3718    /// ```
    3719    pub fn set_snapshots<T, V>(mut self, v: T) -> Self
    3720    where
    3721        T: std::iter::IntoIterator<Item = V>,
    3722        V: std::convert::Into<std::string::String>,
    3723    {
    3724        use std::iter::Iterator;
    3725        self.snapshots = v.into_iter().map(|i| i.into()).collect();
    3726        self
    3727    }
    3728
    3729    /// Sets the value of [next_page_token][crate::model::ListTopicSnapshotsResponse::next_page_token].
    3730    ///
    3731    /// # Example
    3732    /// ```ignore,no_run
    3733    /// # use google_cloud_pubsub::model::ListTopicSnapshotsResponse;
    3734    /// let x = ListTopicSnapshotsResponse::new().set_next_page_token("example");
    3735    /// ```
    3736    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3737        self.next_page_token = v.into();
    3738        self
    3739    }
    3740}
    3741
    3742impl wkt::message::Message for ListTopicSnapshotsResponse {
    3743    fn typename() -> &'static str {
    3744        "type.googleapis.com/google.pubsub.v1.ListTopicSnapshotsResponse"
    3745    }
    3746}
    3747
    3748/// Request for the `DeleteTopic` method.
    3749#[derive(Clone, Default, PartialEq)]
    3750#[non_exhaustive]
    3751pub struct DeleteTopicRequest {
    3752    /// Required. Identifier. Name of the topic to delete.
    3753    /// Format is `projects/{project}/topics/{topic}`.
    3754    pub topic: std::string::String,
    3755
    3756    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3757}
    3758
    3759impl DeleteTopicRequest {
    3760    pub fn new() -> Self {
    3761        std::default::Default::default()
    3762    }
    3763
    3764    /// Sets the value of [topic][crate::model::DeleteTopicRequest::topic].
    3765    ///
    3766    /// # Example
    3767    /// ```ignore,no_run
    3768    /// # use google_cloud_pubsub::model::DeleteTopicRequest;
    3769    /// let x = DeleteTopicRequest::new().set_topic("example");
    3770    /// ```
    3771    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3772        self.topic = v.into();
    3773        self
    3774    }
    3775}
    3776
    3777impl wkt::message::Message for DeleteTopicRequest {
    3778    fn typename() -> &'static str {
    3779        "type.googleapis.com/google.pubsub.v1.DeleteTopicRequest"
    3780    }
    3781}
    3782
    3783/// Request for the DetachSubscription method.
    3784#[derive(Clone, Default, PartialEq)]
    3785#[non_exhaustive]
    3786pub struct DetachSubscriptionRequest {
    3787    /// Required. The subscription to detach.
    3788    /// Format is `projects/{project}/subscriptions/{subscription}`.
    3789    pub subscription: std::string::String,
    3790
    3791    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3792}
    3793
    3794impl DetachSubscriptionRequest {
    3795    pub fn new() -> Self {
    3796        std::default::Default::default()
    3797    }
    3798
    3799    /// Sets the value of [subscription][crate::model::DetachSubscriptionRequest::subscription].
    3800    ///
    3801    /// # Example
    3802    /// ```ignore,no_run
    3803    /// # use google_cloud_pubsub::model::DetachSubscriptionRequest;
    3804    /// let x = DetachSubscriptionRequest::new().set_subscription("example");
    3805    /// ```
    3806    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    3807        self.subscription = v.into();
    3808        self
    3809    }
    3810}
    3811
    3812impl wkt::message::Message for DetachSubscriptionRequest {
    3813    fn typename() -> &'static str {
    3814        "type.googleapis.com/google.pubsub.v1.DetachSubscriptionRequest"
    3815    }
    3816}
    3817
    3818/// Response for the DetachSubscription method.
    3819/// Reserved for future use.
    3820#[derive(Clone, Default, PartialEq)]
    3821#[non_exhaustive]
    3822pub struct DetachSubscriptionResponse {
    3823    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    3824}
    3825
    3826impl DetachSubscriptionResponse {
    3827    pub fn new() -> Self {
    3828        std::default::Default::default()
    3829    }
    3830}
    3831
    3832impl wkt::message::Message for DetachSubscriptionResponse {
    3833    fn typename() -> &'static str {
    3834        "type.googleapis.com/google.pubsub.v1.DetachSubscriptionResponse"
    3835    }
    3836}
    3837
    3838/// A subscription resource. If none of `push_config`, `bigquery_config`, or
    3839/// `cloud_storage_config` is set, then the subscriber will pull and ack messages
    3840/// using API methods. At most one of these fields may be set.
    3841#[derive(Clone, Default, PartialEq)]
    3842#[non_exhaustive]
    3843pub struct Subscription {
    3844    /// Required. Identifier. The name of the subscription. It must have the format
    3845    /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
    3846    /// start with a letter, and contain only letters (`[A-Za-z]`), numbers
    3847    /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
    3848    /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
    3849    /// in length, and it must not start with `"goog"`.
    3850    pub name: std::string::String,
    3851
    3852    /// Required. The name of the topic from which this subscription is receiving
    3853    /// messages. Format is `projects/{project}/topics/{topic}`. The value of this
    3854    /// field will be `_deleted-topic_` if the topic has been deleted.
    3855    pub topic: std::string::String,
    3856
    3857    /// Optional. If push delivery is used with this subscription, this field is
    3858    /// used to configure it.
    3859    pub push_config: std::option::Option<crate::model::PushConfig>,
    3860
    3861    /// Optional. If delivery to BigQuery is used with this subscription, this
    3862    /// field is used to configure it.
    3863    pub bigquery_config: std::option::Option<crate::model::BigQueryConfig>,
    3864
    3865    /// Optional. If delivery to Google Cloud Storage is used with this
    3866    /// subscription, this field is used to configure it.
    3867    pub cloud_storage_config: std::option::Option<crate::model::CloudStorageConfig>,
    3868
    3869    /// Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
    3870    /// waits for the subscriber to acknowledge receipt before resending the
    3871    /// message. In the interval after the message is delivered and before it is
    3872    /// acknowledged, it is considered to be _outstanding_. During that time
    3873    /// period, the message will not be redelivered (on a best-effort basis).
    3874    ///
    3875    /// For pull subscriptions, this value is used as the initial value for the ack
    3876    /// deadline. To override this value for a given message, call
    3877    /// `ModifyAckDeadline` with the corresponding `ack_id` if using
    3878    /// non-streaming pull or send the `ack_id` in a
    3879    /// `StreamingModifyAckDeadlineRequest` if using streaming pull.
    3880    /// The minimum custom deadline you can specify is 10 seconds.
    3881    /// The maximum custom deadline you can specify is 600 seconds (10 minutes).
    3882    /// If this parameter is 0, a default value of 10 seconds is used.
    3883    ///
    3884    /// For push delivery, this value is also used to set the request timeout for
    3885    /// the call to the push endpoint.
    3886    ///
    3887    /// If the subscriber never acknowledges the message, the Pub/Sub
    3888    /// system will eventually redeliver the message.
    3889    pub ack_deadline_seconds: i32,
    3890
    3891    /// Optional. Indicates whether to retain acknowledged messages. If true, then
    3892    /// messages are not expunged from the subscription's backlog, even if they are
    3893    /// acknowledged, until they fall out of the `message_retention_duration`
    3894    /// window. This must be true if you would like to [`Seek` to a timestamp]
    3895    /// (<https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>) in
    3896    /// the past to replay previously-acknowledged messages.
    3897    pub retain_acked_messages: bool,
    3898
    3899    /// Optional. How long to retain unacknowledged messages in the subscription's
    3900    /// backlog, from the moment a message is published. If `retain_acked_messages`
    3901    /// is true, then this also configures the retention of acknowledged messages,
    3902    /// and thus configures how far back in time a `Seek` can be done. Defaults to
    3903    /// 7 days. Cannot be more than 31 days or less than 10 minutes.
    3904    pub message_retention_duration: std::option::Option<wkt::Duration>,
    3905
    3906    /// Optional. See [Creating and managing
    3907    /// labels](https://cloud.google.com/pubsub/docs/labels).
    3908    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
    3909
    3910    /// Optional. If true, messages published with the same `ordering_key` in
    3911    /// `PubsubMessage` will be delivered to the subscribers in the order in which
    3912    /// they are received by the Pub/Sub system. Otherwise, they may be delivered
    3913    /// in any order.
    3914    pub enable_message_ordering: bool,
    3915
    3916    /// Optional. A policy that specifies the conditions for this subscription's
    3917    /// expiration. A subscription is considered active as long as any connected
    3918    /// subscriber is successfully consuming messages from the subscription or is
    3919    /// issuing operations on the subscription. If `expiration_policy` is not set,
    3920    /// a *default policy* with `ttl` of 31 days will be used. The minimum allowed
    3921    /// value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
    3922    /// but `expiration_policy.ttl` is not set, the subscription never expires.
    3923    pub expiration_policy: std::option::Option<crate::model::ExpirationPolicy>,
    3924
    3925    /// Optional. An expression written in the Pub/Sub [filter
    3926    /// language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
    3927    /// then only `PubsubMessage`s whose `attributes` field matches the filter are
    3928    /// delivered on this subscription. If empty, then no messages are filtered
    3929    /// out.
    3930    pub filter: std::string::String,
    3931
    3932    /// Optional. A policy that specifies the conditions for dead lettering
    3933    /// messages in this subscription. If dead_letter_policy is not set, dead
    3934    /// lettering is disabled.
    3935    ///
    3936    /// The Pub/Sub service account associated with this subscriptions's
    3937    /// parent project (i.e.,
    3938    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
    3939    /// permission to Acknowledge() messages on this subscription.
    3940    pub dead_letter_policy: std::option::Option<crate::model::DeadLetterPolicy>,
    3941
    3942    /// Optional. A policy that specifies how Pub/Sub retries message delivery for
    3943    /// this subscription.
    3944    ///
    3945    /// If not set, the default retry policy is applied. This generally implies
    3946    /// that messages will be retried as soon as possible for healthy subscribers.
    3947    /// RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    3948    /// events for a given message.
    3949    pub retry_policy: std::option::Option<crate::model::RetryPolicy>,
    3950
    3951    /// Optional. Indicates whether the subscription is detached from its topic.
    3952    /// Detached subscriptions don't receive messages from their topic and don't
    3953    /// retain any backlog. `Pull` and `StreamingPull` requests will return
    3954    /// FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
    3955    /// the endpoint will not be made.
    3956    pub detached: bool,
    3957
    3958    /// Optional. If true, Pub/Sub provides the following guarantees for the
    3959    /// delivery of a message with a given value of `message_id` on this
    3960    /// subscription:
    3961    ///
    3962    /// * The message sent to a subscriber is guaranteed not to be resent
    3963    ///   before the message's acknowledgment deadline expires.
    3964    /// * An acknowledged message will not be resent to a subscriber.
    3965    ///
    3966    /// Note that subscribers may still receive multiple copies of a message
    3967    /// when `enable_exactly_once_delivery` is true if the message was published
    3968    /// multiple times by a publisher client. These copies are  considered distinct
    3969    /// by Pub/Sub and have distinct `message_id` values.
    3970    pub enable_exactly_once_delivery: bool,
    3971
    3972    /// Output only. Indicates the minimum duration for which a message is retained
    3973    /// after it is published to the subscription's topic. If this field is set,
    3974    /// messages published to the subscription's topic in the last
    3975    /// `topic_message_retention_duration` are always available to subscribers. See
    3976    /// the `message_retention_duration` field in `Topic`. This field is set only
    3977    /// in responses from the server; it is ignored if it is set in any requests.
    3978    pub topic_message_retention_duration: std::option::Option<wkt::Duration>,
    3979
    3980    /// Output only. An output-only field indicating whether or not the
    3981    /// subscription can receive messages.
    3982    pub state: crate::model::subscription::State,
    3983
    3984    /// Output only. Information about the associated Analytics Hub subscription.
    3985    /// Only set if the subscritpion is created by Analytics Hub.
    3986    pub analytics_hub_subscription_info:
    3987        std::option::Option<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
    3988
    3989    /// Optional. Transforms to be applied to messages before they are delivered to
    3990    /// subscribers. Transforms are applied in the order specified.
    3991    pub message_transforms: std::vec::Vec<crate::model::MessageTransform>,
    3992
    3993    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
    3994    /// resource. For example:
    3995    /// "123/environment": "production",
    3996    /// "123/costCenter": "marketing"
    3997    /// See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on
    3998    /// using tags with Pub/Sub resources.
    3999    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
    4000
    4001    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4002}
    4003
    4004impl Subscription {
    4005    pub fn new() -> Self {
    4006        std::default::Default::default()
    4007    }
    4008
    4009    /// Sets the value of [name][crate::model::Subscription::name].
    4010    ///
    4011    /// # Example
    4012    /// ```ignore,no_run
    4013    /// # use google_cloud_pubsub::model::Subscription;
    4014    /// let x = Subscription::new().set_name("example");
    4015    /// ```
    4016    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    4017        self.name = v.into();
    4018        self
    4019    }
    4020
    4021    /// Sets the value of [topic][crate::model::Subscription::topic].
    4022    ///
    4023    /// # Example
    4024    /// ```ignore,no_run
    4025    /// # use google_cloud_pubsub::model::Subscription;
    4026    /// let x = Subscription::new().set_topic("example");
    4027    /// ```
    4028    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    4029        self.topic = v.into();
    4030        self
    4031    }
    4032
    4033    /// Sets the value of [push_config][crate::model::Subscription::push_config].
    4034    ///
    4035    /// # Example
    4036    /// ```ignore,no_run
    4037    /// # use google_cloud_pubsub::model::Subscription;
    4038    /// use google_cloud_pubsub::model::PushConfig;
    4039    /// let x = Subscription::new().set_push_config(PushConfig::default()/* use setters */);
    4040    /// ```
    4041    pub fn set_push_config<T>(mut self, v: T) -> Self
    4042    where
    4043        T: std::convert::Into<crate::model::PushConfig>,
    4044    {
    4045        self.push_config = std::option::Option::Some(v.into());
    4046        self
    4047    }
    4048
    4049    /// Sets or clears the value of [push_config][crate::model::Subscription::push_config].
    4050    ///
    4051    /// # Example
    4052    /// ```ignore,no_run
    4053    /// # use google_cloud_pubsub::model::Subscription;
    4054    /// use google_cloud_pubsub::model::PushConfig;
    4055    /// let x = Subscription::new().set_or_clear_push_config(Some(PushConfig::default()/* use setters */));
    4056    /// let x = Subscription::new().set_or_clear_push_config(None::<PushConfig>);
    4057    /// ```
    4058    pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
    4059    where
    4060        T: std::convert::Into<crate::model::PushConfig>,
    4061    {
    4062        self.push_config = v.map(|x| x.into());
    4063        self
    4064    }
    4065
    4066    /// Sets the value of [bigquery_config][crate::model::Subscription::bigquery_config].
    4067    ///
    4068    /// # Example
    4069    /// ```ignore,no_run
    4070    /// # use google_cloud_pubsub::model::Subscription;
    4071    /// use google_cloud_pubsub::model::BigQueryConfig;
    4072    /// let x = Subscription::new().set_bigquery_config(BigQueryConfig::default()/* use setters */);
    4073    /// ```
    4074    pub fn set_bigquery_config<T>(mut self, v: T) -> Self
    4075    where
    4076        T: std::convert::Into<crate::model::BigQueryConfig>,
    4077    {
    4078        self.bigquery_config = std::option::Option::Some(v.into());
    4079        self
    4080    }
    4081
    4082    /// Sets or clears the value of [bigquery_config][crate::model::Subscription::bigquery_config].
    4083    ///
    4084    /// # Example
    4085    /// ```ignore,no_run
    4086    /// # use google_cloud_pubsub::model::Subscription;
    4087    /// use google_cloud_pubsub::model::BigQueryConfig;
    4088    /// let x = Subscription::new().set_or_clear_bigquery_config(Some(BigQueryConfig::default()/* use setters */));
    4089    /// let x = Subscription::new().set_or_clear_bigquery_config(None::<BigQueryConfig>);
    4090    /// ```
    4091    pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
    4092    where
    4093        T: std::convert::Into<crate::model::BigQueryConfig>,
    4094    {
    4095        self.bigquery_config = v.map(|x| x.into());
    4096        self
    4097    }
    4098
    4099    /// Sets the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
    4100    ///
    4101    /// # Example
    4102    /// ```ignore,no_run
    4103    /// # use google_cloud_pubsub::model::Subscription;
    4104    /// use google_cloud_pubsub::model::CloudStorageConfig;
    4105    /// let x = Subscription::new().set_cloud_storage_config(CloudStorageConfig::default()/* use setters */);
    4106    /// ```
    4107    pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
    4108    where
    4109        T: std::convert::Into<crate::model::CloudStorageConfig>,
    4110    {
    4111        self.cloud_storage_config = std::option::Option::Some(v.into());
    4112        self
    4113    }
    4114
    4115    /// Sets or clears the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
    4116    ///
    4117    /// # Example
    4118    /// ```ignore,no_run
    4119    /// # use google_cloud_pubsub::model::Subscription;
    4120    /// use google_cloud_pubsub::model::CloudStorageConfig;
    4121    /// let x = Subscription::new().set_or_clear_cloud_storage_config(Some(CloudStorageConfig::default()/* use setters */));
    4122    /// let x = Subscription::new().set_or_clear_cloud_storage_config(None::<CloudStorageConfig>);
    4123    /// ```
    4124    pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
    4125    where
    4126        T: std::convert::Into<crate::model::CloudStorageConfig>,
    4127    {
    4128        self.cloud_storage_config = v.map(|x| x.into());
    4129        self
    4130    }
    4131
    4132    /// Sets the value of [ack_deadline_seconds][crate::model::Subscription::ack_deadline_seconds].
    4133    ///
    4134    /// # Example
    4135    /// ```ignore,no_run
    4136    /// # use google_cloud_pubsub::model::Subscription;
    4137    /// let x = Subscription::new().set_ack_deadline_seconds(42);
    4138    /// ```
    4139    pub fn set_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    4140        self.ack_deadline_seconds = v.into();
    4141        self
    4142    }
    4143
    4144    /// Sets the value of [retain_acked_messages][crate::model::Subscription::retain_acked_messages].
    4145    ///
    4146    /// # Example
    4147    /// ```ignore,no_run
    4148    /// # use google_cloud_pubsub::model::Subscription;
    4149    /// let x = Subscription::new().set_retain_acked_messages(true);
    4150    /// ```
    4151    pub fn set_retain_acked_messages<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    4152        self.retain_acked_messages = v.into();
    4153        self
    4154    }
    4155
    4156    /// Sets the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
    4157    ///
    4158    /// # Example
    4159    /// ```ignore,no_run
    4160    /// # use google_cloud_pubsub::model::Subscription;
    4161    /// use wkt::Duration;
    4162    /// let x = Subscription::new().set_message_retention_duration(Duration::default()/* use setters */);
    4163    /// ```
    4164    pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
    4165    where
    4166        T: std::convert::Into<wkt::Duration>,
    4167    {
    4168        self.message_retention_duration = std::option::Option::Some(v.into());
    4169        self
    4170    }
    4171
    4172    /// Sets or clears the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
    4173    ///
    4174    /// # Example
    4175    /// ```ignore,no_run
    4176    /// # use google_cloud_pubsub::model::Subscription;
    4177    /// use wkt::Duration;
    4178    /// let x = Subscription::new().set_or_clear_message_retention_duration(Some(Duration::default()/* use setters */));
    4179    /// let x = Subscription::new().set_or_clear_message_retention_duration(None::<Duration>);
    4180    /// ```
    4181    pub fn set_or_clear_message_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
    4182    where
    4183        T: std::convert::Into<wkt::Duration>,
    4184    {
    4185        self.message_retention_duration = v.map(|x| x.into());
    4186        self
    4187    }
    4188
    4189    /// Sets the value of [labels][crate::model::Subscription::labels].
    4190    ///
    4191    /// # Example
    4192    /// ```ignore,no_run
    4193    /// # use google_cloud_pubsub::model::Subscription;
    4194    /// let x = Subscription::new().set_labels([
    4195    ///     ("key0", "abc"),
    4196    ///     ("key1", "xyz"),
    4197    /// ]);
    4198    /// ```
    4199    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    4200    where
    4201        T: std::iter::IntoIterator<Item = (K, V)>,
    4202        K: std::convert::Into<std::string::String>,
    4203        V: std::convert::Into<std::string::String>,
    4204    {
    4205        use std::iter::Iterator;
    4206        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    4207        self
    4208    }
    4209
    4210    /// Sets the value of [enable_message_ordering][crate::model::Subscription::enable_message_ordering].
    4211    ///
    4212    /// # Example
    4213    /// ```ignore,no_run
    4214    /// # use google_cloud_pubsub::model::Subscription;
    4215    /// let x = Subscription::new().set_enable_message_ordering(true);
    4216    /// ```
    4217    pub fn set_enable_message_ordering<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    4218        self.enable_message_ordering = v.into();
    4219        self
    4220    }
    4221
    4222    /// Sets the value of [expiration_policy][crate::model::Subscription::expiration_policy].
    4223    ///
    4224    /// # Example
    4225    /// ```ignore,no_run
    4226    /// # use google_cloud_pubsub::model::Subscription;
    4227    /// use google_cloud_pubsub::model::ExpirationPolicy;
    4228    /// let x = Subscription::new().set_expiration_policy(ExpirationPolicy::default()/* use setters */);
    4229    /// ```
    4230    pub fn set_expiration_policy<T>(mut self, v: T) -> Self
    4231    where
    4232        T: std::convert::Into<crate::model::ExpirationPolicy>,
    4233    {
    4234        self.expiration_policy = std::option::Option::Some(v.into());
    4235        self
    4236    }
    4237
    4238    /// Sets or clears the value of [expiration_policy][crate::model::Subscription::expiration_policy].
    4239    ///
    4240    /// # Example
    4241    /// ```ignore,no_run
    4242    /// # use google_cloud_pubsub::model::Subscription;
    4243    /// use google_cloud_pubsub::model::ExpirationPolicy;
    4244    /// let x = Subscription::new().set_or_clear_expiration_policy(Some(ExpirationPolicy::default()/* use setters */));
    4245    /// let x = Subscription::new().set_or_clear_expiration_policy(None::<ExpirationPolicy>);
    4246    /// ```
    4247    pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
    4248    where
    4249        T: std::convert::Into<crate::model::ExpirationPolicy>,
    4250    {
    4251        self.expiration_policy = v.map(|x| x.into());
    4252        self
    4253    }
    4254
    4255    /// Sets the value of [filter][crate::model::Subscription::filter].
    4256    ///
    4257    /// # Example
    4258    /// ```ignore,no_run
    4259    /// # use google_cloud_pubsub::model::Subscription;
    4260    /// let x = Subscription::new().set_filter("example");
    4261    /// ```
    4262    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    4263        self.filter = v.into();
    4264        self
    4265    }
    4266
    4267    /// Sets the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
    4268    ///
    4269    /// # Example
    4270    /// ```ignore,no_run
    4271    /// # use google_cloud_pubsub::model::Subscription;
    4272    /// use google_cloud_pubsub::model::DeadLetterPolicy;
    4273    /// let x = Subscription::new().set_dead_letter_policy(DeadLetterPolicy::default()/* use setters */);
    4274    /// ```
    4275    pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
    4276    where
    4277        T: std::convert::Into<crate::model::DeadLetterPolicy>,
    4278    {
    4279        self.dead_letter_policy = std::option::Option::Some(v.into());
    4280        self
    4281    }
    4282
    4283    /// Sets or clears the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
    4284    ///
    4285    /// # Example
    4286    /// ```ignore,no_run
    4287    /// # use google_cloud_pubsub::model::Subscription;
    4288    /// use google_cloud_pubsub::model::DeadLetterPolicy;
    4289    /// let x = Subscription::new().set_or_clear_dead_letter_policy(Some(DeadLetterPolicy::default()/* use setters */));
    4290    /// let x = Subscription::new().set_or_clear_dead_letter_policy(None::<DeadLetterPolicy>);
    4291    /// ```
    4292    pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
    4293    where
    4294        T: std::convert::Into<crate::model::DeadLetterPolicy>,
    4295    {
    4296        self.dead_letter_policy = v.map(|x| x.into());
    4297        self
    4298    }
    4299
    4300    /// Sets the value of [retry_policy][crate::model::Subscription::retry_policy].
    4301    ///
    4302    /// # Example
    4303    /// ```ignore,no_run
    4304    /// # use google_cloud_pubsub::model::Subscription;
    4305    /// use google_cloud_pubsub::model::RetryPolicy;
    4306    /// let x = Subscription::new().set_retry_policy(RetryPolicy::default()/* use setters */);
    4307    /// ```
    4308    pub fn set_retry_policy<T>(mut self, v: T) -> Self
    4309    where
    4310        T: std::convert::Into<crate::model::RetryPolicy>,
    4311    {
    4312        self.retry_policy = std::option::Option::Some(v.into());
    4313        self
    4314    }
    4315
    4316    /// Sets or clears the value of [retry_policy][crate::model::Subscription::retry_policy].
    4317    ///
    4318    /// # Example
    4319    /// ```ignore,no_run
    4320    /// # use google_cloud_pubsub::model::Subscription;
    4321    /// use google_cloud_pubsub::model::RetryPolicy;
    4322    /// let x = Subscription::new().set_or_clear_retry_policy(Some(RetryPolicy::default()/* use setters */));
    4323    /// let x = Subscription::new().set_or_clear_retry_policy(None::<RetryPolicy>);
    4324    /// ```
    4325    pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
    4326    where
    4327        T: std::convert::Into<crate::model::RetryPolicy>,
    4328    {
    4329        self.retry_policy = v.map(|x| x.into());
    4330        self
    4331    }
    4332
    4333    /// Sets the value of [detached][crate::model::Subscription::detached].
    4334    ///
    4335    /// # Example
    4336    /// ```ignore,no_run
    4337    /// # use google_cloud_pubsub::model::Subscription;
    4338    /// let x = Subscription::new().set_detached(true);
    4339    /// ```
    4340    pub fn set_detached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    4341        self.detached = v.into();
    4342        self
    4343    }
    4344
    4345    /// Sets the value of [enable_exactly_once_delivery][crate::model::Subscription::enable_exactly_once_delivery].
    4346    ///
    4347    /// # Example
    4348    /// ```ignore,no_run
    4349    /// # use google_cloud_pubsub::model::Subscription;
    4350    /// let x = Subscription::new().set_enable_exactly_once_delivery(true);
    4351    /// ```
    4352    pub fn set_enable_exactly_once_delivery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    4353        self.enable_exactly_once_delivery = v.into();
    4354        self
    4355    }
    4356
    4357    /// Sets the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
    4358    ///
    4359    /// # Example
    4360    /// ```ignore,no_run
    4361    /// # use google_cloud_pubsub::model::Subscription;
    4362    /// use wkt::Duration;
    4363    /// let x = Subscription::new().set_topic_message_retention_duration(Duration::default()/* use setters */);
    4364    /// ```
    4365    pub fn set_topic_message_retention_duration<T>(mut self, v: T) -> Self
    4366    where
    4367        T: std::convert::Into<wkt::Duration>,
    4368    {
    4369        self.topic_message_retention_duration = std::option::Option::Some(v.into());
    4370        self
    4371    }
    4372
    4373    /// Sets or clears the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
    4374    ///
    4375    /// # Example
    4376    /// ```ignore,no_run
    4377    /// # use google_cloud_pubsub::model::Subscription;
    4378    /// use wkt::Duration;
    4379    /// let x = Subscription::new().set_or_clear_topic_message_retention_duration(Some(Duration::default()/* use setters */));
    4380    /// let x = Subscription::new().set_or_clear_topic_message_retention_duration(None::<Duration>);
    4381    /// ```
    4382    pub fn set_or_clear_topic_message_retention_duration<T>(
    4383        mut self,
    4384        v: std::option::Option<T>,
    4385    ) -> Self
    4386    where
    4387        T: std::convert::Into<wkt::Duration>,
    4388    {
    4389        self.topic_message_retention_duration = v.map(|x| x.into());
    4390        self
    4391    }
    4392
    4393    /// Sets the value of [state][crate::model::Subscription::state].
    4394    ///
    4395    /// # Example
    4396    /// ```ignore,no_run
    4397    /// # use google_cloud_pubsub::model::Subscription;
    4398    /// use google_cloud_pubsub::model::subscription::State;
    4399    /// let x0 = Subscription::new().set_state(State::Active);
    4400    /// let x1 = Subscription::new().set_state(State::ResourceError);
    4401    /// ```
    4402    pub fn set_state<T: std::convert::Into<crate::model::subscription::State>>(
    4403        mut self,
    4404        v: T,
    4405    ) -> Self {
    4406        self.state = v.into();
    4407        self
    4408    }
    4409
    4410    /// Sets the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
    4411    ///
    4412    /// # Example
    4413    /// ```ignore,no_run
    4414    /// # use google_cloud_pubsub::model::Subscription;
    4415    /// use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
    4416    /// let x = Subscription::new().set_analytics_hub_subscription_info(AnalyticsHubSubscriptionInfo::default()/* use setters */);
    4417    /// ```
    4418    pub fn set_analytics_hub_subscription_info<T>(mut self, v: T) -> Self
    4419    where
    4420        T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
    4421    {
    4422        self.analytics_hub_subscription_info = std::option::Option::Some(v.into());
    4423        self
    4424    }
    4425
    4426    /// Sets or clears the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
    4427    ///
    4428    /// # Example
    4429    /// ```ignore,no_run
    4430    /// # use google_cloud_pubsub::model::Subscription;
    4431    /// use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
    4432    /// let x = Subscription::new().set_or_clear_analytics_hub_subscription_info(Some(AnalyticsHubSubscriptionInfo::default()/* use setters */));
    4433    /// let x = Subscription::new().set_or_clear_analytics_hub_subscription_info(None::<AnalyticsHubSubscriptionInfo>);
    4434    /// ```
    4435    pub fn set_or_clear_analytics_hub_subscription_info<T>(
    4436        mut self,
    4437        v: std::option::Option<T>,
    4438    ) -> Self
    4439    where
    4440        T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
    4441    {
    4442        self.analytics_hub_subscription_info = v.map(|x| x.into());
    4443        self
    4444    }
    4445
    4446    /// Sets the value of [message_transforms][crate::model::Subscription::message_transforms].
    4447    ///
    4448    /// # Example
    4449    /// ```ignore,no_run
    4450    /// # use google_cloud_pubsub::model::Subscription;
    4451    /// use google_cloud_pubsub::model::MessageTransform;
    4452    /// let x = Subscription::new()
    4453    ///     .set_message_transforms([
    4454    ///         MessageTransform::default()/* use setters */,
    4455    ///         MessageTransform::default()/* use (different) setters */,
    4456    ///     ]);
    4457    /// ```
    4458    pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
    4459    where
    4460        T: std::iter::IntoIterator<Item = V>,
    4461        V: std::convert::Into<crate::model::MessageTransform>,
    4462    {
    4463        use std::iter::Iterator;
    4464        self.message_transforms = v.into_iter().map(|i| i.into()).collect();
    4465        self
    4466    }
    4467
    4468    /// Sets the value of [tags][crate::model::Subscription::tags].
    4469    ///
    4470    /// # Example
    4471    /// ```ignore,no_run
    4472    /// # use google_cloud_pubsub::model::Subscription;
    4473    /// let x = Subscription::new().set_tags([
    4474    ///     ("key0", "abc"),
    4475    ///     ("key1", "xyz"),
    4476    /// ]);
    4477    /// ```
    4478    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
    4479    where
    4480        T: std::iter::IntoIterator<Item = (K, V)>,
    4481        K: std::convert::Into<std::string::String>,
    4482        V: std::convert::Into<std::string::String>,
    4483    {
    4484        use std::iter::Iterator;
    4485        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    4486        self
    4487    }
    4488}
    4489
    4490impl wkt::message::Message for Subscription {
    4491    fn typename() -> &'static str {
    4492        "type.googleapis.com/google.pubsub.v1.Subscription"
    4493    }
    4494}
    4495
    4496/// Defines additional types related to [Subscription].
    4497pub mod subscription {
    4498    #[allow(unused_imports)]
    4499    use super::*;
    4500
    4501    /// Information about an associated [Analytics Hub
    4502    /// subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
    4503    #[derive(Clone, Default, PartialEq)]
    4504    #[non_exhaustive]
    4505    pub struct AnalyticsHubSubscriptionInfo {
    4506        /// Optional. The name of the associated Analytics Hub listing resource.
    4507        /// Pattern:
    4508        /// "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
    4509        pub listing: std::string::String,
    4510
    4511        /// Optional. The name of the associated Analytics Hub subscription resource.
    4512        /// Pattern:
    4513        /// "projects/{project}/locations/{location}/subscriptions/{subscription}"
    4514        pub subscription: std::string::String,
    4515
    4516        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4517    }
    4518
    4519    impl AnalyticsHubSubscriptionInfo {
    4520        pub fn new() -> Self {
    4521            std::default::Default::default()
    4522        }
    4523
    4524        /// Sets the value of [listing][crate::model::subscription::AnalyticsHubSubscriptionInfo::listing].
    4525        ///
    4526        /// # Example
    4527        /// ```ignore,no_run
    4528        /// # use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
    4529        /// let x = AnalyticsHubSubscriptionInfo::new().set_listing("example");
    4530        /// ```
    4531        pub fn set_listing<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    4532            self.listing = v.into();
    4533            self
    4534        }
    4535
    4536        /// Sets the value of [subscription][crate::model::subscription::AnalyticsHubSubscriptionInfo::subscription].
    4537        ///
    4538        /// # Example
    4539        /// ```ignore,no_run
    4540        /// # use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
    4541        /// let x = AnalyticsHubSubscriptionInfo::new().set_subscription("example");
    4542        /// ```
    4543        pub fn set_subscription<T: std::convert::Into<std::string::String>>(
    4544            mut self,
    4545            v: T,
    4546        ) -> Self {
    4547            self.subscription = v.into();
    4548            self
    4549        }
    4550    }
    4551
    4552    impl wkt::message::Message for AnalyticsHubSubscriptionInfo {
    4553        fn typename() -> &'static str {
    4554            "type.googleapis.com/google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo"
    4555        }
    4556    }
    4557
    4558    /// Possible states for a subscription.
    4559    ///
    4560    /// # Working with unknown values
    4561    ///
    4562    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    4563    /// additional enum variants at any time. Adding new variants is not considered
    4564    /// a breaking change. Applications should write their code in anticipation of:
    4565    ///
    4566    /// - New values appearing in future releases of the client library, **and**
    4567    /// - New values received dynamically, without application changes.
    4568    ///
    4569    /// Please consult the [Working with enums] section in the user guide for some
    4570    /// guidelines.
    4571    ///
    4572    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    4573    #[derive(Clone, Debug, PartialEq)]
    4574    #[non_exhaustive]
    4575    pub enum State {
    4576        /// Default value. This value is unused.
    4577        Unspecified,
    4578        /// The subscription can actively receive messages
    4579        Active,
    4580        /// The subscription cannot receive messages because of an error with the
    4581        /// resource to which it pushes messages. See the more detailed error state
    4582        /// in the corresponding configuration.
    4583        ResourceError,
    4584        /// If set, the enum was initialized with an unknown value.
    4585        ///
    4586        /// Applications can examine the value using [State::value] or
    4587        /// [State::name].
    4588        UnknownValue(state::UnknownValue),
    4589    }
    4590
    4591    #[doc(hidden)]
    4592    pub mod state {
    4593        #[allow(unused_imports)]
    4594        use super::*;
    4595        #[derive(Clone, Debug, PartialEq)]
    4596        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    4597    }
    4598
    4599    impl State {
    4600        /// Gets the enum value.
    4601        ///
    4602        /// Returns `None` if the enum contains an unknown value deserialized from
    4603        /// the string representation of enums.
    4604        pub fn value(&self) -> std::option::Option<i32> {
    4605            match self {
    4606                Self::Unspecified => std::option::Option::Some(0),
    4607                Self::Active => std::option::Option::Some(1),
    4608                Self::ResourceError => std::option::Option::Some(2),
    4609                Self::UnknownValue(u) => u.0.value(),
    4610            }
    4611        }
    4612
    4613        /// Gets the enum value as a string.
    4614        ///
    4615        /// Returns `None` if the enum contains an unknown value deserialized from
    4616        /// the integer representation of enums.
    4617        pub fn name(&self) -> std::option::Option<&str> {
    4618            match self {
    4619                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    4620                Self::Active => std::option::Option::Some("ACTIVE"),
    4621                Self::ResourceError => std::option::Option::Some("RESOURCE_ERROR"),
    4622                Self::UnknownValue(u) => u.0.name(),
    4623            }
    4624        }
    4625    }
    4626
    4627    impl std::default::Default for State {
    4628        fn default() -> Self {
    4629            use std::convert::From;
    4630            Self::from(0)
    4631        }
    4632    }
    4633
    4634    impl std::fmt::Display for State {
    4635        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    4636            wkt::internal::display_enum(f, self.name(), self.value())
    4637        }
    4638    }
    4639
    4640    impl std::convert::From<i32> for State {
    4641        fn from(value: i32) -> Self {
    4642            match value {
    4643                0 => Self::Unspecified,
    4644                1 => Self::Active,
    4645                2 => Self::ResourceError,
    4646                _ => Self::UnknownValue(state::UnknownValue(
    4647                    wkt::internal::UnknownEnumValue::Integer(value),
    4648                )),
    4649            }
    4650        }
    4651    }
    4652
    4653    impl std::convert::From<&str> for State {
    4654        fn from(value: &str) -> Self {
    4655            use std::string::ToString;
    4656            match value {
    4657                "STATE_UNSPECIFIED" => Self::Unspecified,
    4658                "ACTIVE" => Self::Active,
    4659                "RESOURCE_ERROR" => Self::ResourceError,
    4660                _ => Self::UnknownValue(state::UnknownValue(
    4661                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    4662                )),
    4663            }
    4664        }
    4665    }
    4666
    4667    impl serde::ser::Serialize for State {
    4668        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    4669        where
    4670            S: serde::Serializer,
    4671        {
    4672            match self {
    4673                Self::Unspecified => serializer.serialize_i32(0),
    4674                Self::Active => serializer.serialize_i32(1),
    4675                Self::ResourceError => serializer.serialize_i32(2),
    4676                Self::UnknownValue(u) => u.0.serialize(serializer),
    4677            }
    4678        }
    4679    }
    4680
    4681    impl<'de> serde::de::Deserialize<'de> for State {
    4682        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    4683        where
    4684            D: serde::Deserializer<'de>,
    4685        {
    4686            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    4687                ".google.pubsub.v1.Subscription.State",
    4688            ))
    4689        }
    4690    }
    4691}
    4692
    4693/// A policy that specifies how Pub/Sub retries message delivery.
    4694///
    4695/// Retry delay will be exponential based on provided minimum and maximum
    4696/// backoffs. <https://en.wikipedia.org/wiki/Exponential_backoff>.
    4697///
    4698/// RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
    4699/// events for a given message.
    4700///
    4701/// Retry Policy is implemented on a best effort basis. At times, the delay
    4702/// between consecutive deliveries may not match the configuration. That is,
    4703/// delay can be more or less than configured backoff.
    4704#[derive(Clone, Default, PartialEq)]
    4705#[non_exhaustive]
    4706pub struct RetryPolicy {
    4707    /// Optional. The minimum delay between consecutive deliveries of a given
    4708    /// message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
    4709    pub minimum_backoff: std::option::Option<wkt::Duration>,
    4710
    4711    /// Optional. The maximum delay between consecutive deliveries of a given
    4712    /// message. Value should be between 0 and 600 seconds. Defaults to 600
    4713    /// seconds.
    4714    pub maximum_backoff: std::option::Option<wkt::Duration>,
    4715
    4716    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4717}
    4718
    4719impl RetryPolicy {
    4720    pub fn new() -> Self {
    4721        std::default::Default::default()
    4722    }
    4723
    4724    /// Sets the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
    4725    ///
    4726    /// # Example
    4727    /// ```ignore,no_run
    4728    /// # use google_cloud_pubsub::model::RetryPolicy;
    4729    /// use wkt::Duration;
    4730    /// let x = RetryPolicy::new().set_minimum_backoff(Duration::default()/* use setters */);
    4731    /// ```
    4732    pub fn set_minimum_backoff<T>(mut self, v: T) -> Self
    4733    where
    4734        T: std::convert::Into<wkt::Duration>,
    4735    {
    4736        self.minimum_backoff = std::option::Option::Some(v.into());
    4737        self
    4738    }
    4739
    4740    /// Sets or clears the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
    4741    ///
    4742    /// # Example
    4743    /// ```ignore,no_run
    4744    /// # use google_cloud_pubsub::model::RetryPolicy;
    4745    /// use wkt::Duration;
    4746    /// let x = RetryPolicy::new().set_or_clear_minimum_backoff(Some(Duration::default()/* use setters */));
    4747    /// let x = RetryPolicy::new().set_or_clear_minimum_backoff(None::<Duration>);
    4748    /// ```
    4749    pub fn set_or_clear_minimum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
    4750    where
    4751        T: std::convert::Into<wkt::Duration>,
    4752    {
    4753        self.minimum_backoff = v.map(|x| x.into());
    4754        self
    4755    }
    4756
    4757    /// Sets the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
    4758    ///
    4759    /// # Example
    4760    /// ```ignore,no_run
    4761    /// # use google_cloud_pubsub::model::RetryPolicy;
    4762    /// use wkt::Duration;
    4763    /// let x = RetryPolicy::new().set_maximum_backoff(Duration::default()/* use setters */);
    4764    /// ```
    4765    pub fn set_maximum_backoff<T>(mut self, v: T) -> Self
    4766    where
    4767        T: std::convert::Into<wkt::Duration>,
    4768    {
    4769        self.maximum_backoff = std::option::Option::Some(v.into());
    4770        self
    4771    }
    4772
    4773    /// Sets or clears the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
    4774    ///
    4775    /// # Example
    4776    /// ```ignore,no_run
    4777    /// # use google_cloud_pubsub::model::RetryPolicy;
    4778    /// use wkt::Duration;
    4779    /// let x = RetryPolicy::new().set_or_clear_maximum_backoff(Some(Duration::default()/* use setters */));
    4780    /// let x = RetryPolicy::new().set_or_clear_maximum_backoff(None::<Duration>);
    4781    /// ```
    4782    pub fn set_or_clear_maximum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
    4783    where
    4784        T: std::convert::Into<wkt::Duration>,
    4785    {
    4786        self.maximum_backoff = v.map(|x| x.into());
    4787        self
    4788    }
    4789}
    4790
    4791impl wkt::message::Message for RetryPolicy {
    4792    fn typename() -> &'static str {
    4793        "type.googleapis.com/google.pubsub.v1.RetryPolicy"
    4794    }
    4795}
    4796
    4797/// Dead lettering is done on a best effort basis. The same message might be
    4798/// dead lettered multiple times.
    4799///
    4800/// If validation on any of the fields fails at subscription creation/updation,
    4801/// the create/update subscription request will fail.
    4802#[derive(Clone, Default, PartialEq)]
    4803#[non_exhaustive]
    4804pub struct DeadLetterPolicy {
    4805    /// Optional. The name of the topic to which dead letter messages should be
    4806    /// published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
    4807    /// service account associated with the enclosing subscription's parent project
    4808    /// (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
    4809    /// have permission to Publish() to this topic.
    4810    ///
    4811    /// The operation will fail if the topic does not exist.
    4812    /// Users should ensure that there is a subscription attached to this topic
    4813    /// since messages published to a topic with no subscriptions are lost.
    4814    pub dead_letter_topic: std::string::String,
    4815
    4816    /// Optional. The maximum number of delivery attempts for any message. The
    4817    /// value must be between 5 and 100.
    4818    ///
    4819    /// The number of delivery attempts is defined as 1 + (the sum of number of
    4820    /// NACKs and number of times the acknowledgment deadline has been exceeded
    4821    /// for the message).
    4822    ///
    4823    /// A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
    4824    /// client libraries may automatically extend ack_deadlines.
    4825    ///
    4826    /// This field will be honored on a best effort basis.
    4827    ///
    4828    /// If this parameter is 0, a default value of 5 is used.
    4829    pub max_delivery_attempts: i32,
    4830
    4831    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4832}
    4833
    4834impl DeadLetterPolicy {
    4835    pub fn new() -> Self {
    4836        std::default::Default::default()
    4837    }
    4838
    4839    /// Sets the value of [dead_letter_topic][crate::model::DeadLetterPolicy::dead_letter_topic].
    4840    ///
    4841    /// # Example
    4842    /// ```ignore,no_run
    4843    /// # use google_cloud_pubsub::model::DeadLetterPolicy;
    4844    /// let x = DeadLetterPolicy::new().set_dead_letter_topic("example");
    4845    /// ```
    4846    pub fn set_dead_letter_topic<T: std::convert::Into<std::string::String>>(
    4847        mut self,
    4848        v: T,
    4849    ) -> Self {
    4850        self.dead_letter_topic = v.into();
    4851        self
    4852    }
    4853
    4854    /// Sets the value of [max_delivery_attempts][crate::model::DeadLetterPolicy::max_delivery_attempts].
    4855    ///
    4856    /// # Example
    4857    /// ```ignore,no_run
    4858    /// # use google_cloud_pubsub::model::DeadLetterPolicy;
    4859    /// let x = DeadLetterPolicy::new().set_max_delivery_attempts(42);
    4860    /// ```
    4861    pub fn set_max_delivery_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    4862        self.max_delivery_attempts = v.into();
    4863        self
    4864    }
    4865}
    4866
    4867impl wkt::message::Message for DeadLetterPolicy {
    4868    fn typename() -> &'static str {
    4869        "type.googleapis.com/google.pubsub.v1.DeadLetterPolicy"
    4870    }
    4871}
    4872
    4873/// A policy that specifies the conditions for resource expiration (i.e.,
    4874/// automatic resource deletion).
    4875#[derive(Clone, Default, PartialEq)]
    4876#[non_exhaustive]
    4877pub struct ExpirationPolicy {
    4878    /// Optional. Specifies the "time-to-live" duration for an associated resource.
    4879    /// The resource expires if it is not active for a period of `ttl`. The
    4880    /// definition of "activity" depends on the type of the associated resource.
    4881    /// The minimum and maximum allowed values for `ttl` depend on the type of the
    4882    /// associated resource, as well. If `ttl` is not set, the associated resource
    4883    /// never expires.
    4884    pub ttl: std::option::Option<wkt::Duration>,
    4885
    4886    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4887}
    4888
    4889impl ExpirationPolicy {
    4890    pub fn new() -> Self {
    4891        std::default::Default::default()
    4892    }
    4893
    4894    /// Sets the value of [ttl][crate::model::ExpirationPolicy::ttl].
    4895    ///
    4896    /// # Example
    4897    /// ```ignore,no_run
    4898    /// # use google_cloud_pubsub::model::ExpirationPolicy;
    4899    /// use wkt::Duration;
    4900    /// let x = ExpirationPolicy::new().set_ttl(Duration::default()/* use setters */);
    4901    /// ```
    4902    pub fn set_ttl<T>(mut self, v: T) -> Self
    4903    where
    4904        T: std::convert::Into<wkt::Duration>,
    4905    {
    4906        self.ttl = std::option::Option::Some(v.into());
    4907        self
    4908    }
    4909
    4910    /// Sets or clears the value of [ttl][crate::model::ExpirationPolicy::ttl].
    4911    ///
    4912    /// # Example
    4913    /// ```ignore,no_run
    4914    /// # use google_cloud_pubsub::model::ExpirationPolicy;
    4915    /// use wkt::Duration;
    4916    /// let x = ExpirationPolicy::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
    4917    /// let x = ExpirationPolicy::new().set_or_clear_ttl(None::<Duration>);
    4918    /// ```
    4919    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
    4920    where
    4921        T: std::convert::Into<wkt::Duration>,
    4922    {
    4923        self.ttl = v.map(|x| x.into());
    4924        self
    4925    }
    4926}
    4927
    4928impl wkt::message::Message for ExpirationPolicy {
    4929    fn typename() -> &'static str {
    4930        "type.googleapis.com/google.pubsub.v1.ExpirationPolicy"
    4931    }
    4932}
    4933
    4934/// Configuration for a push delivery endpoint.
    4935#[derive(Clone, Default, PartialEq)]
    4936#[non_exhaustive]
    4937pub struct PushConfig {
    4938    /// Optional. A URL locating the endpoint to which messages should be pushed.
    4939    /// For example, a Webhook endpoint might use `<https://example.com/push>`.
    4940    pub push_endpoint: std::string::String,
    4941
    4942    /// Optional. Endpoint configuration attributes that can be used to control
    4943    /// different aspects of the message delivery.
    4944    ///
    4945    /// The only currently supported attribute is `x-goog-version`, which you can
    4946    /// use to change the format of the pushed message. This attribute
    4947    /// indicates the version of the data expected by the endpoint. This
    4948    /// controls the shape of the pushed message (i.e., its fields and metadata).
    4949    ///
    4950    /// If not present during the `CreateSubscription` call, it will default to
    4951    /// the version of the Pub/Sub API used to make such call. If not present in a
    4952    /// `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
    4953    /// calls will always return a valid version, even if the subscription was
    4954    /// created without this attribute.
    4955    ///
    4956    /// The only supported values for the `x-goog-version` attribute are:
    4957    ///
    4958    /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
    4959    /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
    4960    ///
    4961    /// For example:
    4962    /// `attributes { "x-goog-version": "v1" }`
    4963    pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
    4964
    4965    /// An authentication method used by push endpoints to verify the source of
    4966    /// push requests. This can be used with push endpoints that are private by
    4967    /// default to allow requests only from the Pub/Sub system, for example.
    4968    /// This field is optional and should be set only by users interested in
    4969    /// authenticated push.
    4970    pub authentication_method: std::option::Option<crate::model::push_config::AuthenticationMethod>,
    4971
    4972    /// The format of the delivered message to the push endpoint is defined by
    4973    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
    4974    pub wrapper: std::option::Option<crate::model::push_config::Wrapper>,
    4975
    4976    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    4977}
    4978
    4979impl PushConfig {
    4980    pub fn new() -> Self {
    4981        std::default::Default::default()
    4982    }
    4983
    4984    /// Sets the value of [push_endpoint][crate::model::PushConfig::push_endpoint].
    4985    ///
    4986    /// # Example
    4987    /// ```ignore,no_run
    4988    /// # use google_cloud_pubsub::model::PushConfig;
    4989    /// let x = PushConfig::new().set_push_endpoint("example");
    4990    /// ```
    4991    pub fn set_push_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    4992        self.push_endpoint = v.into();
    4993        self
    4994    }
    4995
    4996    /// Sets the value of [attributes][crate::model::PushConfig::attributes].
    4997    ///
    4998    /// # Example
    4999    /// ```ignore,no_run
    5000    /// # use google_cloud_pubsub::model::PushConfig;
    5001    /// let x = PushConfig::new().set_attributes([
    5002    ///     ("key0", "abc"),
    5003    ///     ("key1", "xyz"),
    5004    /// ]);
    5005    /// ```
    5006    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
    5007    where
    5008        T: std::iter::IntoIterator<Item = (K, V)>,
    5009        K: std::convert::Into<std::string::String>,
    5010        V: std::convert::Into<std::string::String>,
    5011    {
    5012        use std::iter::Iterator;
    5013        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    5014        self
    5015    }
    5016
    5017    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method].
    5018    ///
    5019    /// Note that all the setters affecting `authentication_method` are mutually
    5020    /// exclusive.
    5021    ///
    5022    /// # Example
    5023    /// ```ignore,no_run
    5024    /// # use google_cloud_pubsub::model::PushConfig;
    5025    /// use google_cloud_pubsub::model::push_config::OidcToken;
    5026    /// let x = PushConfig::new().set_authentication_method(Some(
    5027    ///     google_cloud_pubsub::model::push_config::AuthenticationMethod::OidcToken(OidcToken::default().into())));
    5028    /// ```
    5029    pub fn set_authentication_method<
    5030        T: std::convert::Into<std::option::Option<crate::model::push_config::AuthenticationMethod>>,
    5031    >(
    5032        mut self,
    5033        v: T,
    5034    ) -> Self {
    5035        self.authentication_method = v.into();
    5036        self
    5037    }
    5038
    5039    /// The value of [authentication_method][crate::model::PushConfig::authentication_method]
    5040    /// if it holds a `OidcToken`, `None` if the field is not set or
    5041    /// holds a different branch.
    5042    pub fn oidc_token(
    5043        &self,
    5044    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::OidcToken>> {
    5045        #[allow(unreachable_patterns)]
    5046        self.authentication_method.as_ref().and_then(|v| match v {
    5047            crate::model::push_config::AuthenticationMethod::OidcToken(v) => {
    5048                std::option::Option::Some(v)
    5049            }
    5050            _ => std::option::Option::None,
    5051        })
    5052    }
    5053
    5054    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method]
    5055    /// to hold a `OidcToken`.
    5056    ///
    5057    /// Note that all the setters affecting `authentication_method` are
    5058    /// mutually exclusive.
    5059    ///
    5060    /// # Example
    5061    /// ```ignore,no_run
    5062    /// # use google_cloud_pubsub::model::PushConfig;
    5063    /// use google_cloud_pubsub::model::push_config::OidcToken;
    5064    /// let x = PushConfig::new().set_oidc_token(OidcToken::default()/* use setters */);
    5065    /// assert!(x.oidc_token().is_some());
    5066    /// ```
    5067    pub fn set_oidc_token<
    5068        T: std::convert::Into<std::boxed::Box<crate::model::push_config::OidcToken>>,
    5069    >(
    5070        mut self,
    5071        v: T,
    5072    ) -> Self {
    5073        self.authentication_method = std::option::Option::Some(
    5074            crate::model::push_config::AuthenticationMethod::OidcToken(v.into()),
    5075        );
    5076        self
    5077    }
    5078
    5079    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper].
    5080    ///
    5081    /// Note that all the setters affecting `wrapper` are mutually
    5082    /// exclusive.
    5083    ///
    5084    /// # Example
    5085    /// ```ignore,no_run
    5086    /// # use google_cloud_pubsub::model::PushConfig;
    5087    /// use google_cloud_pubsub::model::push_config::PubsubWrapper;
    5088    /// let x = PushConfig::new().set_wrapper(Some(
    5089    ///     google_cloud_pubsub::model::push_config::Wrapper::PubsubWrapper(PubsubWrapper::default().into())));
    5090    /// ```
    5091    pub fn set_wrapper<
    5092        T: std::convert::Into<std::option::Option<crate::model::push_config::Wrapper>>,
    5093    >(
    5094        mut self,
    5095        v: T,
    5096    ) -> Self {
    5097        self.wrapper = v.into();
    5098        self
    5099    }
    5100
    5101    /// The value of [wrapper][crate::model::PushConfig::wrapper]
    5102    /// if it holds a `PubsubWrapper`, `None` if the field is not set or
    5103    /// holds a different branch.
    5104    pub fn pubsub_wrapper(
    5105        &self,
    5106    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::PubsubWrapper>> {
    5107        #[allow(unreachable_patterns)]
    5108        self.wrapper.as_ref().and_then(|v| match v {
    5109            crate::model::push_config::Wrapper::PubsubWrapper(v) => std::option::Option::Some(v),
    5110            _ => std::option::Option::None,
    5111        })
    5112    }
    5113
    5114    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
    5115    /// to hold a `PubsubWrapper`.
    5116    ///
    5117    /// Note that all the setters affecting `wrapper` are
    5118    /// mutually exclusive.
    5119    ///
    5120    /// # Example
    5121    /// ```ignore,no_run
    5122    /// # use google_cloud_pubsub::model::PushConfig;
    5123    /// use google_cloud_pubsub::model::push_config::PubsubWrapper;
    5124    /// let x = PushConfig::new().set_pubsub_wrapper(PubsubWrapper::default()/* use setters */);
    5125    /// assert!(x.pubsub_wrapper().is_some());
    5126    /// assert!(x.no_wrapper().is_none());
    5127    /// ```
    5128    pub fn set_pubsub_wrapper<
    5129        T: std::convert::Into<std::boxed::Box<crate::model::push_config::PubsubWrapper>>,
    5130    >(
    5131        mut self,
    5132        v: T,
    5133    ) -> Self {
    5134        self.wrapper =
    5135            std::option::Option::Some(crate::model::push_config::Wrapper::PubsubWrapper(v.into()));
    5136        self
    5137    }
    5138
    5139    /// The value of [wrapper][crate::model::PushConfig::wrapper]
    5140    /// if it holds a `NoWrapper`, `None` if the field is not set or
    5141    /// holds a different branch.
    5142    pub fn no_wrapper(
    5143        &self,
    5144    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::NoWrapper>> {
    5145        #[allow(unreachable_patterns)]
    5146        self.wrapper.as_ref().and_then(|v| match v {
    5147            crate::model::push_config::Wrapper::NoWrapper(v) => std::option::Option::Some(v),
    5148            _ => std::option::Option::None,
    5149        })
    5150    }
    5151
    5152    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
    5153    /// to hold a `NoWrapper`.
    5154    ///
    5155    /// Note that all the setters affecting `wrapper` are
    5156    /// mutually exclusive.
    5157    ///
    5158    /// # Example
    5159    /// ```ignore,no_run
    5160    /// # use google_cloud_pubsub::model::PushConfig;
    5161    /// use google_cloud_pubsub::model::push_config::NoWrapper;
    5162    /// let x = PushConfig::new().set_no_wrapper(NoWrapper::default()/* use setters */);
    5163    /// assert!(x.no_wrapper().is_some());
    5164    /// assert!(x.pubsub_wrapper().is_none());
    5165    /// ```
    5166    pub fn set_no_wrapper<
    5167        T: std::convert::Into<std::boxed::Box<crate::model::push_config::NoWrapper>>,
    5168    >(
    5169        mut self,
    5170        v: T,
    5171    ) -> Self {
    5172        self.wrapper =
    5173            std::option::Option::Some(crate::model::push_config::Wrapper::NoWrapper(v.into()));
    5174        self
    5175    }
    5176}
    5177
    5178impl wkt::message::Message for PushConfig {
    5179    fn typename() -> &'static str {
    5180        "type.googleapis.com/google.pubsub.v1.PushConfig"
    5181    }
    5182}
    5183
    5184/// Defines additional types related to [PushConfig].
    5185pub mod push_config {
    5186    #[allow(unused_imports)]
    5187    use super::*;
    5188
    5189    /// Contains information needed for generating an
    5190    /// [OpenID Connect
    5191    /// token](https://developers.google.com/identity/protocols/OpenIDConnect).
    5192    #[derive(Clone, Default, PartialEq)]
    5193    #[non_exhaustive]
    5194    pub struct OidcToken {
    5195        /// Optional. [Service account
    5196        /// email](https://cloud.google.com/iam/docs/service-accounts)
    5197        /// used for generating the OIDC token. For more information
    5198        /// on setting up authentication, see
    5199        /// [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
    5200        pub service_account_email: std::string::String,
    5201
    5202        /// Optional. Audience to be used when generating OIDC token. The audience
    5203        /// claim identifies the recipients that the JWT is intended for. The
    5204        /// audience value is a single case-sensitive string. Having multiple values
    5205        /// (array) for the audience field is not supported. More info about the OIDC
    5206        /// JWT token audience here:
    5207        /// <https://tools.ietf.org/html/rfc7519#section-4.1.3> Note: if not specified,
    5208        /// the Push endpoint URL will be used.
    5209        pub audience: std::string::String,
    5210
    5211        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5212    }
    5213
    5214    impl OidcToken {
    5215        pub fn new() -> Self {
    5216            std::default::Default::default()
    5217        }
    5218
    5219        /// Sets the value of [service_account_email][crate::model::push_config::OidcToken::service_account_email].
    5220        ///
    5221        /// # Example
    5222        /// ```ignore,no_run
    5223        /// # use google_cloud_pubsub::model::push_config::OidcToken;
    5224        /// let x = OidcToken::new().set_service_account_email("example");
    5225        /// ```
    5226        pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
    5227            mut self,
    5228            v: T,
    5229        ) -> Self {
    5230            self.service_account_email = v.into();
    5231            self
    5232        }
    5233
    5234        /// Sets the value of [audience][crate::model::push_config::OidcToken::audience].
    5235        ///
    5236        /// # Example
    5237        /// ```ignore,no_run
    5238        /// # use google_cloud_pubsub::model::push_config::OidcToken;
    5239        /// let x = OidcToken::new().set_audience("example");
    5240        /// ```
    5241        pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    5242            self.audience = v.into();
    5243            self
    5244        }
    5245    }
    5246
    5247    impl wkt::message::Message for OidcToken {
    5248        fn typename() -> &'static str {
    5249            "type.googleapis.com/google.pubsub.v1.PushConfig.OidcToken"
    5250        }
    5251    }
    5252
    5253    /// The payload to the push endpoint is in the form of the JSON representation
    5254    /// of a PubsubMessage
    5255    /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
    5256    #[derive(Clone, Default, PartialEq)]
    5257    #[non_exhaustive]
    5258    pub struct PubsubWrapper {
    5259        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5260    }
    5261
    5262    impl PubsubWrapper {
    5263        pub fn new() -> Self {
    5264            std::default::Default::default()
    5265        }
    5266    }
    5267
    5268    impl wkt::message::Message for PubsubWrapper {
    5269        fn typename() -> &'static str {
    5270            "type.googleapis.com/google.pubsub.v1.PushConfig.PubsubWrapper"
    5271        }
    5272    }
    5273
    5274    /// Sets the `data` field as the HTTP body for delivery.
    5275    #[derive(Clone, Default, PartialEq)]
    5276    #[non_exhaustive]
    5277    pub struct NoWrapper {
    5278        /// Optional. When true, writes the Pub/Sub message metadata to
    5279        /// `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
    5280        /// Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
    5281        pub write_metadata: bool,
    5282
    5283        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5284    }
    5285
    5286    impl NoWrapper {
    5287        pub fn new() -> Self {
    5288            std::default::Default::default()
    5289        }
    5290
    5291        /// Sets the value of [write_metadata][crate::model::push_config::NoWrapper::write_metadata].
    5292        ///
    5293        /// # Example
    5294        /// ```ignore,no_run
    5295        /// # use google_cloud_pubsub::model::push_config::NoWrapper;
    5296        /// let x = NoWrapper::new().set_write_metadata(true);
    5297        /// ```
    5298        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    5299            self.write_metadata = v.into();
    5300            self
    5301        }
    5302    }
    5303
    5304    impl wkt::message::Message for NoWrapper {
    5305        fn typename() -> &'static str {
    5306            "type.googleapis.com/google.pubsub.v1.PushConfig.NoWrapper"
    5307        }
    5308    }
    5309
    5310    /// An authentication method used by push endpoints to verify the source of
    5311    /// push requests. This can be used with push endpoints that are private by
    5312    /// default to allow requests only from the Pub/Sub system, for example.
    5313    /// This field is optional and should be set only by users interested in
    5314    /// authenticated push.
    5315    #[derive(Clone, Debug, PartialEq)]
    5316    #[non_exhaustive]
    5317    pub enum AuthenticationMethod {
    5318        /// Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
    5319        /// token as an `Authorization` header in the HTTP request for every pushed
    5320        /// message.
    5321        OidcToken(std::boxed::Box<crate::model::push_config::OidcToken>),
    5322    }
    5323
    5324    /// The format of the delivered message to the push endpoint is defined by
    5325    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
    5326    #[derive(Clone, Debug, PartialEq)]
    5327    #[non_exhaustive]
    5328    pub enum Wrapper {
    5329        /// Optional. When set, the payload to the push endpoint is in the form of
    5330        /// the JSON representation of a PubsubMessage
    5331        /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
    5332        PubsubWrapper(std::boxed::Box<crate::model::push_config::PubsubWrapper>),
    5333        /// Optional. When set, the payload to the push endpoint is not wrapped.
    5334        NoWrapper(std::boxed::Box<crate::model::push_config::NoWrapper>),
    5335    }
    5336}
    5337
    5338/// Configuration for a BigQuery subscription.
    5339#[derive(Clone, Default, PartialEq)]
    5340#[non_exhaustive]
    5341pub struct BigQueryConfig {
    5342    /// Optional. The name of the table to which to write data, of the form
    5343    /// {projectId}.{datasetId}.{tableId}
    5344    pub table: std::string::String,
    5345
    5346    /// Optional. When true, use the topic's schema as the columns to write to in
    5347    /// BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
    5348    /// enabled at the same time.
    5349    pub use_topic_schema: bool,
    5350
    5351    /// Optional. When true, write the subscription name, message_id, publish_time,
    5352    /// attributes, and ordering_key to additional columns in the table. The
    5353    /// subscription name, message_id, and publish_time fields are put in their own
    5354    /// columns while all other message properties (other than data) are written to
    5355    /// a JSON object in the attributes column.
    5356    pub write_metadata: bool,
    5357
    5358    /// Optional. When true and use_topic_schema is true, any fields that are a
    5359    /// part of the topic schema that are not part of the BigQuery table schema are
    5360    /// dropped when writing to BigQuery. Otherwise, the schemas must be kept in
    5361    /// sync and any messages with extra fields are not written and remain in the
    5362    /// subscription's backlog.
    5363    pub drop_unknown_fields: bool,
    5364
    5365    /// Output only. An output-only field that indicates whether or not the
    5366    /// subscription can receive messages.
    5367    pub state: crate::model::big_query_config::State,
    5368
    5369    /// Optional. When true, use the BigQuery table's schema as the columns to
    5370    /// write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
    5371    /// enabled at the same time.
    5372    pub use_table_schema: bool,
    5373
    5374    /// Optional. The service account to use to write to BigQuery. The subscription
    5375    /// creator or updater that specifies this field must have
    5376    /// `iam.serviceAccounts.actAs` permission on the service account. If not
    5377    /// specified, the Pub/Sub [service
    5378    /// agent](https://cloud.google.com/iam/docs/service-agents),
    5379    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    5380    pub service_account_email: std::string::String,
    5381
    5382    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5383}
    5384
    5385impl BigQueryConfig {
    5386    pub fn new() -> Self {
    5387        std::default::Default::default()
    5388    }
    5389
    5390    /// Sets the value of [table][crate::model::BigQueryConfig::table].
    5391    ///
    5392    /// # Example
    5393    /// ```ignore,no_run
    5394    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5395    /// let x = BigQueryConfig::new().set_table("example");
    5396    /// ```
    5397    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    5398        self.table = v.into();
    5399        self
    5400    }
    5401
    5402    /// Sets the value of [use_topic_schema][crate::model::BigQueryConfig::use_topic_schema].
    5403    ///
    5404    /// # Example
    5405    /// ```ignore,no_run
    5406    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5407    /// let x = BigQueryConfig::new().set_use_topic_schema(true);
    5408    /// ```
    5409    pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    5410        self.use_topic_schema = v.into();
    5411        self
    5412    }
    5413
    5414    /// Sets the value of [write_metadata][crate::model::BigQueryConfig::write_metadata].
    5415    ///
    5416    /// # Example
    5417    /// ```ignore,no_run
    5418    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5419    /// let x = BigQueryConfig::new().set_write_metadata(true);
    5420    /// ```
    5421    pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    5422        self.write_metadata = v.into();
    5423        self
    5424    }
    5425
    5426    /// Sets the value of [drop_unknown_fields][crate::model::BigQueryConfig::drop_unknown_fields].
    5427    ///
    5428    /// # Example
    5429    /// ```ignore,no_run
    5430    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5431    /// let x = BigQueryConfig::new().set_drop_unknown_fields(true);
    5432    /// ```
    5433    pub fn set_drop_unknown_fields<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    5434        self.drop_unknown_fields = v.into();
    5435        self
    5436    }
    5437
    5438    /// Sets the value of [state][crate::model::BigQueryConfig::state].
    5439    ///
    5440    /// # Example
    5441    /// ```ignore,no_run
    5442    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5443    /// use google_cloud_pubsub::model::big_query_config::State;
    5444    /// let x0 = BigQueryConfig::new().set_state(State::Active);
    5445    /// let x1 = BigQueryConfig::new().set_state(State::PermissionDenied);
    5446    /// let x2 = BigQueryConfig::new().set_state(State::NotFound);
    5447    /// ```
    5448    pub fn set_state<T: std::convert::Into<crate::model::big_query_config::State>>(
    5449        mut self,
    5450        v: T,
    5451    ) -> Self {
    5452        self.state = v.into();
    5453        self
    5454    }
    5455
    5456    /// Sets the value of [use_table_schema][crate::model::BigQueryConfig::use_table_schema].
    5457    ///
    5458    /// # Example
    5459    /// ```ignore,no_run
    5460    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5461    /// let x = BigQueryConfig::new().set_use_table_schema(true);
    5462    /// ```
    5463    pub fn set_use_table_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    5464        self.use_table_schema = v.into();
    5465        self
    5466    }
    5467
    5468    /// Sets the value of [service_account_email][crate::model::BigQueryConfig::service_account_email].
    5469    ///
    5470    /// # Example
    5471    /// ```ignore,no_run
    5472    /// # use google_cloud_pubsub::model::BigQueryConfig;
    5473    /// let x = BigQueryConfig::new().set_service_account_email("example");
    5474    /// ```
    5475    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
    5476        mut self,
    5477        v: T,
    5478    ) -> Self {
    5479        self.service_account_email = v.into();
    5480        self
    5481    }
    5482}
    5483
    5484impl wkt::message::Message for BigQueryConfig {
    5485    fn typename() -> &'static str {
    5486        "type.googleapis.com/google.pubsub.v1.BigQueryConfig"
    5487    }
    5488}
    5489
    5490/// Defines additional types related to [BigQueryConfig].
    5491pub mod big_query_config {
    5492    #[allow(unused_imports)]
    5493    use super::*;
    5494
    5495    /// Possible states for a BigQuery subscription.
    5496    ///
    5497    /// # Working with unknown values
    5498    ///
    5499    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    5500    /// additional enum variants at any time. Adding new variants is not considered
    5501    /// a breaking change. Applications should write their code in anticipation of:
    5502    ///
    5503    /// - New values appearing in future releases of the client library, **and**
    5504    /// - New values received dynamically, without application changes.
    5505    ///
    5506    /// Please consult the [Working with enums] section in the user guide for some
    5507    /// guidelines.
    5508    ///
    5509    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    5510    #[derive(Clone, Debug, PartialEq)]
    5511    #[non_exhaustive]
    5512    pub enum State {
    5513        /// Default value. This value is unused.
    5514        Unspecified,
    5515        /// The subscription can actively send messages to BigQuery
    5516        Active,
    5517        /// Cannot write to the BigQuery table because of permission denied errors.
    5518        /// This can happen if
    5519        ///
    5520        /// - Pub/Sub SA has not been granted the [appropriate BigQuery IAM
    5521        ///   permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account)
    5522        /// - bigquery.googleapis.com API is not enabled for the project
    5523        ///   ([instructions](https://cloud.google.com/service-usage/docs/enable-disable))
    5524        PermissionDenied,
    5525        /// Cannot write to the BigQuery table because it does not exist.
    5526        NotFound,
    5527        /// Cannot write to the BigQuery table due to a schema mismatch.
    5528        SchemaMismatch,
    5529        /// Cannot write to the destination because enforce_in_transit is set to true
    5530        /// and the destination locations are not in the allowed regions.
    5531        InTransitLocationRestriction,
    5532        /// If set, the enum was initialized with an unknown value.
    5533        ///
    5534        /// Applications can examine the value using [State::value] or
    5535        /// [State::name].
    5536        UnknownValue(state::UnknownValue),
    5537    }
    5538
    5539    #[doc(hidden)]
    5540    pub mod state {
    5541        #[allow(unused_imports)]
    5542        use super::*;
    5543        #[derive(Clone, Debug, PartialEq)]
    5544        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    5545    }
    5546
    5547    impl State {
    5548        /// Gets the enum value.
    5549        ///
    5550        /// Returns `None` if the enum contains an unknown value deserialized from
    5551        /// the string representation of enums.
    5552        pub fn value(&self) -> std::option::Option<i32> {
    5553            match self {
    5554                Self::Unspecified => std::option::Option::Some(0),
    5555                Self::Active => std::option::Option::Some(1),
    5556                Self::PermissionDenied => std::option::Option::Some(2),
    5557                Self::NotFound => std::option::Option::Some(3),
    5558                Self::SchemaMismatch => std::option::Option::Some(4),
    5559                Self::InTransitLocationRestriction => std::option::Option::Some(5),
    5560                Self::UnknownValue(u) => u.0.value(),
    5561            }
    5562        }
    5563
    5564        /// Gets the enum value as a string.
    5565        ///
    5566        /// Returns `None` if the enum contains an unknown value deserialized from
    5567        /// the integer representation of enums.
    5568        pub fn name(&self) -> std::option::Option<&str> {
    5569            match self {
    5570                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    5571                Self::Active => std::option::Option::Some("ACTIVE"),
    5572                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
    5573                Self::NotFound => std::option::Option::Some("NOT_FOUND"),
    5574                Self::SchemaMismatch => std::option::Option::Some("SCHEMA_MISMATCH"),
    5575                Self::InTransitLocationRestriction => {
    5576                    std::option::Option::Some("IN_TRANSIT_LOCATION_RESTRICTION")
    5577                }
    5578                Self::UnknownValue(u) => u.0.name(),
    5579            }
    5580        }
    5581    }
    5582
    5583    impl std::default::Default for State {
    5584        fn default() -> Self {
    5585            use std::convert::From;
    5586            Self::from(0)
    5587        }
    5588    }
    5589
    5590    impl std::fmt::Display for State {
    5591        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    5592            wkt::internal::display_enum(f, self.name(), self.value())
    5593        }
    5594    }
    5595
    5596    impl std::convert::From<i32> for State {
    5597        fn from(value: i32) -> Self {
    5598            match value {
    5599                0 => Self::Unspecified,
    5600                1 => Self::Active,
    5601                2 => Self::PermissionDenied,
    5602                3 => Self::NotFound,
    5603                4 => Self::SchemaMismatch,
    5604                5 => Self::InTransitLocationRestriction,
    5605                _ => Self::UnknownValue(state::UnknownValue(
    5606                    wkt::internal::UnknownEnumValue::Integer(value),
    5607                )),
    5608            }
    5609        }
    5610    }
    5611
    5612    impl std::convert::From<&str> for State {
    5613        fn from(value: &str) -> Self {
    5614            use std::string::ToString;
    5615            match value {
    5616                "STATE_UNSPECIFIED" => Self::Unspecified,
    5617                "ACTIVE" => Self::Active,
    5618                "PERMISSION_DENIED" => Self::PermissionDenied,
    5619                "NOT_FOUND" => Self::NotFound,
    5620                "SCHEMA_MISMATCH" => Self::SchemaMismatch,
    5621                "IN_TRANSIT_LOCATION_RESTRICTION" => Self::InTransitLocationRestriction,
    5622                _ => Self::UnknownValue(state::UnknownValue(
    5623                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    5624                )),
    5625            }
    5626        }
    5627    }
    5628
    5629    impl serde::ser::Serialize for State {
    5630        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    5631        where
    5632            S: serde::Serializer,
    5633        {
    5634            match self {
    5635                Self::Unspecified => serializer.serialize_i32(0),
    5636                Self::Active => serializer.serialize_i32(1),
    5637                Self::PermissionDenied => serializer.serialize_i32(2),
    5638                Self::NotFound => serializer.serialize_i32(3),
    5639                Self::SchemaMismatch => serializer.serialize_i32(4),
    5640                Self::InTransitLocationRestriction => serializer.serialize_i32(5),
    5641                Self::UnknownValue(u) => u.0.serialize(serializer),
    5642            }
    5643        }
    5644    }
    5645
    5646    impl<'de> serde::de::Deserialize<'de> for State {
    5647        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    5648        where
    5649            D: serde::Deserializer<'de>,
    5650        {
    5651            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    5652                ".google.pubsub.v1.BigQueryConfig.State",
    5653            ))
    5654        }
    5655    }
    5656}
    5657
    5658/// Configuration for a Cloud Storage subscription.
    5659#[derive(Clone, Default, PartialEq)]
    5660#[non_exhaustive]
    5661pub struct CloudStorageConfig {
    5662    /// Required. User-provided name for the Cloud Storage bucket.
    5663    /// The bucket must be created by the user. The bucket name must be without
    5664    /// any prefix like "gs://". See the [bucket naming
    5665    /// requirements] (<https://cloud.google.com/storage/docs/buckets#naming>).
    5666    pub bucket: std::string::String,
    5667
    5668    /// Optional. User-provided prefix for Cloud Storage filename. See the [object
    5669    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    5670    pub filename_prefix: std::string::String,
    5671
    5672    /// Optional. User-provided suffix for Cloud Storage filename. See the [object
    5673    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
    5674    /// Must not end in "/".
    5675    pub filename_suffix: std::string::String,
    5676
    5677    /// Optional. User-provided format string specifying how to represent datetimes
    5678    /// in Cloud Storage filenames. See the [datetime format
    5679    /// guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
    5680    pub filename_datetime_format: std::string::String,
    5681
    5682    /// Optional. The maximum duration that can elapse before a new Cloud Storage
    5683    /// file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
    5684    /// exceed the subscription's acknowledgment deadline.
    5685    pub max_duration: std::option::Option<wkt::Duration>,
    5686
    5687    /// Optional. The maximum bytes that can be written to a Cloud Storage file
    5688    /// before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
    5689    /// be exceeded in cases where messages are larger than the limit.
    5690    pub max_bytes: i64,
    5691
    5692    /// Optional. The maximum number of messages that can be written to a Cloud
    5693    /// Storage file before a new file is created. Min 1000 messages.
    5694    pub max_messages: i64,
    5695
    5696    /// Output only. An output-only field that indicates whether or not the
    5697    /// subscription can receive messages.
    5698    pub state: crate::model::cloud_storage_config::State,
    5699
    5700    /// Optional. The service account to use to write to Cloud Storage. The
    5701    /// subscription creator or updater that specifies this field must have
    5702    /// `iam.serviceAccounts.actAs` permission on the service account. If not
    5703    /// specified, the Pub/Sub
    5704    /// [service agent](https://cloud.google.com/iam/docs/service-agents),
    5705    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
    5706    pub service_account_email: std::string::String,
    5707
    5708    /// Defaults to text format.
    5709    pub output_format: std::option::Option<crate::model::cloud_storage_config::OutputFormat>,
    5710
    5711    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5712}
    5713
    5714impl CloudStorageConfig {
    5715    pub fn new() -> Self {
    5716        std::default::Default::default()
    5717    }
    5718
    5719    /// Sets the value of [bucket][crate::model::CloudStorageConfig::bucket].
    5720    ///
    5721    /// # Example
    5722    /// ```ignore,no_run
    5723    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5724    /// let x = CloudStorageConfig::new().set_bucket("example");
    5725    /// ```
    5726    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    5727        self.bucket = v.into();
    5728        self
    5729    }
    5730
    5731    /// Sets the value of [filename_prefix][crate::model::CloudStorageConfig::filename_prefix].
    5732    ///
    5733    /// # Example
    5734    /// ```ignore,no_run
    5735    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5736    /// let x = CloudStorageConfig::new().set_filename_prefix("example");
    5737    /// ```
    5738    pub fn set_filename_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    5739        self.filename_prefix = v.into();
    5740        self
    5741    }
    5742
    5743    /// Sets the value of [filename_suffix][crate::model::CloudStorageConfig::filename_suffix].
    5744    ///
    5745    /// # Example
    5746    /// ```ignore,no_run
    5747    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5748    /// let x = CloudStorageConfig::new().set_filename_suffix("example");
    5749    /// ```
    5750    pub fn set_filename_suffix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    5751        self.filename_suffix = v.into();
    5752        self
    5753    }
    5754
    5755    /// Sets the value of [filename_datetime_format][crate::model::CloudStorageConfig::filename_datetime_format].
    5756    ///
    5757    /// # Example
    5758    /// ```ignore,no_run
    5759    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5760    /// let x = CloudStorageConfig::new().set_filename_datetime_format("example");
    5761    /// ```
    5762    pub fn set_filename_datetime_format<T: std::convert::Into<std::string::String>>(
    5763        mut self,
    5764        v: T,
    5765    ) -> Self {
    5766        self.filename_datetime_format = v.into();
    5767        self
    5768    }
    5769
    5770    /// Sets the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
    5771    ///
    5772    /// # Example
    5773    /// ```ignore,no_run
    5774    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5775    /// use wkt::Duration;
    5776    /// let x = CloudStorageConfig::new().set_max_duration(Duration::default()/* use setters */);
    5777    /// ```
    5778    pub fn set_max_duration<T>(mut self, v: T) -> Self
    5779    where
    5780        T: std::convert::Into<wkt::Duration>,
    5781    {
    5782        self.max_duration = std::option::Option::Some(v.into());
    5783        self
    5784    }
    5785
    5786    /// Sets or clears the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
    5787    ///
    5788    /// # Example
    5789    /// ```ignore,no_run
    5790    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5791    /// use wkt::Duration;
    5792    /// let x = CloudStorageConfig::new().set_or_clear_max_duration(Some(Duration::default()/* use setters */));
    5793    /// let x = CloudStorageConfig::new().set_or_clear_max_duration(None::<Duration>);
    5794    /// ```
    5795    pub fn set_or_clear_max_duration<T>(mut self, v: std::option::Option<T>) -> Self
    5796    where
    5797        T: std::convert::Into<wkt::Duration>,
    5798    {
    5799        self.max_duration = v.map(|x| x.into());
    5800        self
    5801    }
    5802
    5803    /// Sets the value of [max_bytes][crate::model::CloudStorageConfig::max_bytes].
    5804    ///
    5805    /// # Example
    5806    /// ```ignore,no_run
    5807    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5808    /// let x = CloudStorageConfig::new().set_max_bytes(42);
    5809    /// ```
    5810    pub fn set_max_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
    5811        self.max_bytes = v.into();
    5812        self
    5813    }
    5814
    5815    /// Sets the value of [max_messages][crate::model::CloudStorageConfig::max_messages].
    5816    ///
    5817    /// # Example
    5818    /// ```ignore,no_run
    5819    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5820    /// let x = CloudStorageConfig::new().set_max_messages(42);
    5821    /// ```
    5822    pub fn set_max_messages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
    5823        self.max_messages = v.into();
    5824        self
    5825    }
    5826
    5827    /// Sets the value of [state][crate::model::CloudStorageConfig::state].
    5828    ///
    5829    /// # Example
    5830    /// ```ignore,no_run
    5831    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5832    /// use google_cloud_pubsub::model::cloud_storage_config::State;
    5833    /// let x0 = CloudStorageConfig::new().set_state(State::Active);
    5834    /// let x1 = CloudStorageConfig::new().set_state(State::PermissionDenied);
    5835    /// let x2 = CloudStorageConfig::new().set_state(State::NotFound);
    5836    /// ```
    5837    pub fn set_state<T: std::convert::Into<crate::model::cloud_storage_config::State>>(
    5838        mut self,
    5839        v: T,
    5840    ) -> Self {
    5841        self.state = v.into();
    5842        self
    5843    }
    5844
    5845    /// Sets the value of [service_account_email][crate::model::CloudStorageConfig::service_account_email].
    5846    ///
    5847    /// # Example
    5848    /// ```ignore,no_run
    5849    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5850    /// let x = CloudStorageConfig::new().set_service_account_email("example");
    5851    /// ```
    5852    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
    5853        mut self,
    5854        v: T,
    5855    ) -> Self {
    5856        self.service_account_email = v.into();
    5857        self
    5858    }
    5859
    5860    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format].
    5861    ///
    5862    /// Note that all the setters affecting `output_format` are mutually
    5863    /// exclusive.
    5864    ///
    5865    /// # Example
    5866    /// ```ignore,no_run
    5867    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5868    /// use google_cloud_pubsub::model::cloud_storage_config::TextConfig;
    5869    /// let x = CloudStorageConfig::new().set_output_format(Some(
    5870    ///     google_cloud_pubsub::model::cloud_storage_config::OutputFormat::TextConfig(TextConfig::default().into())));
    5871    /// ```
    5872    pub fn set_output_format<
    5873        T: std::convert::Into<std::option::Option<crate::model::cloud_storage_config::OutputFormat>>,
    5874    >(
    5875        mut self,
    5876        v: T,
    5877    ) -> Self {
    5878        self.output_format = v.into();
    5879        self
    5880    }
    5881
    5882    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
    5883    /// if it holds a `TextConfig`, `None` if the field is not set or
    5884    /// holds a different branch.
    5885    pub fn text_config(
    5886        &self,
    5887    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::TextConfig>> {
    5888        #[allow(unreachable_patterns)]
    5889        self.output_format.as_ref().and_then(|v| match v {
    5890            crate::model::cloud_storage_config::OutputFormat::TextConfig(v) => {
    5891                std::option::Option::Some(v)
    5892            }
    5893            _ => std::option::Option::None,
    5894        })
    5895    }
    5896
    5897    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
    5898    /// to hold a `TextConfig`.
    5899    ///
    5900    /// Note that all the setters affecting `output_format` are
    5901    /// mutually exclusive.
    5902    ///
    5903    /// # Example
    5904    /// ```ignore,no_run
    5905    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5906    /// use google_cloud_pubsub::model::cloud_storage_config::TextConfig;
    5907    /// let x = CloudStorageConfig::new().set_text_config(TextConfig::default()/* use setters */);
    5908    /// assert!(x.text_config().is_some());
    5909    /// assert!(x.avro_config().is_none());
    5910    /// ```
    5911    pub fn set_text_config<
    5912        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::TextConfig>>,
    5913    >(
    5914        mut self,
    5915        v: T,
    5916    ) -> Self {
    5917        self.output_format = std::option::Option::Some(
    5918            crate::model::cloud_storage_config::OutputFormat::TextConfig(v.into()),
    5919        );
    5920        self
    5921    }
    5922
    5923    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
    5924    /// if it holds a `AvroConfig`, `None` if the field is not set or
    5925    /// holds a different branch.
    5926    pub fn avro_config(
    5927        &self,
    5928    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>> {
    5929        #[allow(unreachable_patterns)]
    5930        self.output_format.as_ref().and_then(|v| match v {
    5931            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v) => {
    5932                std::option::Option::Some(v)
    5933            }
    5934            _ => std::option::Option::None,
    5935        })
    5936    }
    5937
    5938    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
    5939    /// to hold a `AvroConfig`.
    5940    ///
    5941    /// Note that all the setters affecting `output_format` are
    5942    /// mutually exclusive.
    5943    ///
    5944    /// # Example
    5945    /// ```ignore,no_run
    5946    /// # use google_cloud_pubsub::model::CloudStorageConfig;
    5947    /// use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
    5948    /// let x = CloudStorageConfig::new().set_avro_config(AvroConfig::default()/* use setters */);
    5949    /// assert!(x.avro_config().is_some());
    5950    /// assert!(x.text_config().is_none());
    5951    /// ```
    5952    pub fn set_avro_config<
    5953        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>>,
    5954    >(
    5955        mut self,
    5956        v: T,
    5957    ) -> Self {
    5958        self.output_format = std::option::Option::Some(
    5959            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v.into()),
    5960        );
    5961        self
    5962    }
    5963}
    5964
    5965impl wkt::message::Message for CloudStorageConfig {
    5966    fn typename() -> &'static str {
    5967        "type.googleapis.com/google.pubsub.v1.CloudStorageConfig"
    5968    }
    5969}
    5970
    5971/// Defines additional types related to [CloudStorageConfig].
    5972pub mod cloud_storage_config {
    5973    #[allow(unused_imports)]
    5974    use super::*;
    5975
    5976    /// Configuration for writing message data in text format.
    5977    /// Message payloads will be written to files as raw text, separated by a
    5978    /// newline.
    5979    #[derive(Clone, Default, PartialEq)]
    5980    #[non_exhaustive]
    5981    pub struct TextConfig {
    5982        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    5983    }
    5984
    5985    impl TextConfig {
    5986        pub fn new() -> Self {
    5987            std::default::Default::default()
    5988        }
    5989    }
    5990
    5991    impl wkt::message::Message for TextConfig {
    5992        fn typename() -> &'static str {
    5993            "type.googleapis.com/google.pubsub.v1.CloudStorageConfig.TextConfig"
    5994        }
    5995    }
    5996
    5997    /// Configuration for writing message data in Avro format.
    5998    /// Message payloads and metadata will be written to files as an Avro binary.
    5999    #[derive(Clone, Default, PartialEq)]
    6000    #[non_exhaustive]
    6001    pub struct AvroConfig {
    6002        /// Optional. When true, write the subscription name, message_id,
    6003        /// publish_time, attributes, and ordering_key as additional fields in the
    6004        /// output. The subscription name, message_id, and publish_time fields are
    6005        /// put in their own fields while all other message properties other than
    6006        /// data (for example, an ordering_key, if present) are added as entries in
    6007        /// the attributes map.
    6008        pub write_metadata: bool,
    6009
    6010        /// Optional. When true, the output Cloud Storage file will be serialized
    6011        /// using the topic schema, if it exists.
    6012        pub use_topic_schema: bool,
    6013
    6014        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6015    }
    6016
    6017    impl AvroConfig {
    6018        pub fn new() -> Self {
    6019            std::default::Default::default()
    6020        }
    6021
    6022        /// Sets the value of [write_metadata][crate::model::cloud_storage_config::AvroConfig::write_metadata].
    6023        ///
    6024        /// # Example
    6025        /// ```ignore,no_run
    6026        /// # use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
    6027        /// let x = AvroConfig::new().set_write_metadata(true);
    6028        /// ```
    6029        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    6030            self.write_metadata = v.into();
    6031            self
    6032        }
    6033
    6034        /// Sets the value of [use_topic_schema][crate::model::cloud_storage_config::AvroConfig::use_topic_schema].
    6035        ///
    6036        /// # Example
    6037        /// ```ignore,no_run
    6038        /// # use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
    6039        /// let x = AvroConfig::new().set_use_topic_schema(true);
    6040        /// ```
    6041        pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
    6042            self.use_topic_schema = v.into();
    6043            self
    6044        }
    6045    }
    6046
    6047    impl wkt::message::Message for AvroConfig {
    6048        fn typename() -> &'static str {
    6049            "type.googleapis.com/google.pubsub.v1.CloudStorageConfig.AvroConfig"
    6050        }
    6051    }
    6052
    6053    /// Possible states for a Cloud Storage subscription.
    6054    ///
    6055    /// # Working with unknown values
    6056    ///
    6057    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    6058    /// additional enum variants at any time. Adding new variants is not considered
    6059    /// a breaking change. Applications should write their code in anticipation of:
    6060    ///
    6061    /// - New values appearing in future releases of the client library, **and**
    6062    /// - New values received dynamically, without application changes.
    6063    ///
    6064    /// Please consult the [Working with enums] section in the user guide for some
    6065    /// guidelines.
    6066    ///
    6067    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    6068    #[derive(Clone, Debug, PartialEq)]
    6069    #[non_exhaustive]
    6070    pub enum State {
    6071        /// Default value. This value is unused.
    6072        Unspecified,
    6073        /// The subscription can actively send messages to Cloud Storage.
    6074        Active,
    6075        /// Cannot write to the Cloud Storage bucket because of permission denied
    6076        /// errors.
    6077        PermissionDenied,
    6078        /// Cannot write to the Cloud Storage bucket because it does not exist.
    6079        NotFound,
    6080        /// Cannot write to the destination because enforce_in_transit is set to true
    6081        /// and the destination locations are not in the allowed regions.
    6082        InTransitLocationRestriction,
    6083        /// Cannot write to the Cloud Storage bucket due to an incompatibility
    6084        /// between the topic schema and subscription settings.
    6085        SchemaMismatch,
    6086        /// If set, the enum was initialized with an unknown value.
    6087        ///
    6088        /// Applications can examine the value using [State::value] or
    6089        /// [State::name].
    6090        UnknownValue(state::UnknownValue),
    6091    }
    6092
    6093    #[doc(hidden)]
    6094    pub mod state {
    6095        #[allow(unused_imports)]
    6096        use super::*;
    6097        #[derive(Clone, Debug, PartialEq)]
    6098        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    6099    }
    6100
    6101    impl State {
    6102        /// Gets the enum value.
    6103        ///
    6104        /// Returns `None` if the enum contains an unknown value deserialized from
    6105        /// the string representation of enums.
    6106        pub fn value(&self) -> std::option::Option<i32> {
    6107            match self {
    6108                Self::Unspecified => std::option::Option::Some(0),
    6109                Self::Active => std::option::Option::Some(1),
    6110                Self::PermissionDenied => std::option::Option::Some(2),
    6111                Self::NotFound => std::option::Option::Some(3),
    6112                Self::InTransitLocationRestriction => std::option::Option::Some(4),
    6113                Self::SchemaMismatch => std::option::Option::Some(5),
    6114                Self::UnknownValue(u) => u.0.value(),
    6115            }
    6116        }
    6117
    6118        /// Gets the enum value as a string.
    6119        ///
    6120        /// Returns `None` if the enum contains an unknown value deserialized from
    6121        /// the integer representation of enums.
    6122        pub fn name(&self) -> std::option::Option<&str> {
    6123            match self {
    6124                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
    6125                Self::Active => std::option::Option::Some("ACTIVE"),
    6126                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
    6127                Self::NotFound => std::option::Option::Some("NOT_FOUND"),
    6128                Self::InTransitLocationRestriction => {
    6129                    std::option::Option::Some("IN_TRANSIT_LOCATION_RESTRICTION")
    6130                }
    6131                Self::SchemaMismatch => std::option::Option::Some("SCHEMA_MISMATCH"),
    6132                Self::UnknownValue(u) => u.0.name(),
    6133            }
    6134        }
    6135    }
    6136
    6137    impl std::default::Default for State {
    6138        fn default() -> Self {
    6139            use std::convert::From;
    6140            Self::from(0)
    6141        }
    6142    }
    6143
    6144    impl std::fmt::Display for State {
    6145        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    6146            wkt::internal::display_enum(f, self.name(), self.value())
    6147        }
    6148    }
    6149
    6150    impl std::convert::From<i32> for State {
    6151        fn from(value: i32) -> Self {
    6152            match value {
    6153                0 => Self::Unspecified,
    6154                1 => Self::Active,
    6155                2 => Self::PermissionDenied,
    6156                3 => Self::NotFound,
    6157                4 => Self::InTransitLocationRestriction,
    6158                5 => Self::SchemaMismatch,
    6159                _ => Self::UnknownValue(state::UnknownValue(
    6160                    wkt::internal::UnknownEnumValue::Integer(value),
    6161                )),
    6162            }
    6163        }
    6164    }
    6165
    6166    impl std::convert::From<&str> for State {
    6167        fn from(value: &str) -> Self {
    6168            use std::string::ToString;
    6169            match value {
    6170                "STATE_UNSPECIFIED" => Self::Unspecified,
    6171                "ACTIVE" => Self::Active,
    6172                "PERMISSION_DENIED" => Self::PermissionDenied,
    6173                "NOT_FOUND" => Self::NotFound,
    6174                "IN_TRANSIT_LOCATION_RESTRICTION" => Self::InTransitLocationRestriction,
    6175                "SCHEMA_MISMATCH" => Self::SchemaMismatch,
    6176                _ => Self::UnknownValue(state::UnknownValue(
    6177                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    6178                )),
    6179            }
    6180        }
    6181    }
    6182
    6183    impl serde::ser::Serialize for State {
    6184        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    6185        where
    6186            S: serde::Serializer,
    6187        {
    6188            match self {
    6189                Self::Unspecified => serializer.serialize_i32(0),
    6190                Self::Active => serializer.serialize_i32(1),
    6191                Self::PermissionDenied => serializer.serialize_i32(2),
    6192                Self::NotFound => serializer.serialize_i32(3),
    6193                Self::InTransitLocationRestriction => serializer.serialize_i32(4),
    6194                Self::SchemaMismatch => serializer.serialize_i32(5),
    6195                Self::UnknownValue(u) => u.0.serialize(serializer),
    6196            }
    6197        }
    6198    }
    6199
    6200    impl<'de> serde::de::Deserialize<'de> for State {
    6201        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    6202        where
    6203            D: serde::Deserializer<'de>,
    6204        {
    6205            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
    6206                ".google.pubsub.v1.CloudStorageConfig.State",
    6207            ))
    6208        }
    6209    }
    6210
    6211    /// Defaults to text format.
    6212    #[derive(Clone, Debug, PartialEq)]
    6213    #[non_exhaustive]
    6214    pub enum OutputFormat {
    6215        /// Optional. If set, message data will be written to Cloud Storage in text
    6216        /// format.
    6217        TextConfig(std::boxed::Box<crate::model::cloud_storage_config::TextConfig>),
    6218        /// Optional. If set, message data will be written to Cloud Storage in Avro
    6219        /// format.
    6220        AvroConfig(std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>),
    6221    }
    6222}
    6223
    6224/// Request for the GetSubscription method.
    6225#[derive(Clone, Default, PartialEq)]
    6226#[non_exhaustive]
    6227pub struct GetSubscriptionRequest {
    6228    /// Required. Identifier. The name of the subscription to get.
    6229    /// Format is `projects/{project}/subscriptions/{sub}`.
    6230    pub subscription: std::string::String,
    6231
    6232    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6233}
    6234
    6235impl GetSubscriptionRequest {
    6236    pub fn new() -> Self {
    6237        std::default::Default::default()
    6238    }
    6239
    6240    /// Sets the value of [subscription][crate::model::GetSubscriptionRequest::subscription].
    6241    ///
    6242    /// # Example
    6243    /// ```ignore,no_run
    6244    /// # use google_cloud_pubsub::model::GetSubscriptionRequest;
    6245    /// let x = GetSubscriptionRequest::new().set_subscription("example");
    6246    /// ```
    6247    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6248        self.subscription = v.into();
    6249        self
    6250    }
    6251}
    6252
    6253impl wkt::message::Message for GetSubscriptionRequest {
    6254    fn typename() -> &'static str {
    6255        "type.googleapis.com/google.pubsub.v1.GetSubscriptionRequest"
    6256    }
    6257}
    6258
    6259/// Request for the UpdateSubscription method.
    6260#[derive(Clone, Default, PartialEq)]
    6261#[non_exhaustive]
    6262pub struct UpdateSubscriptionRequest {
    6263    /// Required. The updated subscription object.
    6264    pub subscription: std::option::Option<crate::model::Subscription>,
    6265
    6266    /// Required. Indicates which fields in the provided subscription to update.
    6267    /// Must be specified and non-empty.
    6268    pub update_mask: std::option::Option<wkt::FieldMask>,
    6269
    6270    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6271}
    6272
    6273impl UpdateSubscriptionRequest {
    6274    pub fn new() -> Self {
    6275        std::default::Default::default()
    6276    }
    6277
    6278    /// Sets the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
    6279    ///
    6280    /// # Example
    6281    /// ```ignore,no_run
    6282    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
    6283    /// use google_cloud_pubsub::model::Subscription;
    6284    /// let x = UpdateSubscriptionRequest::new().set_subscription(Subscription::default()/* use setters */);
    6285    /// ```
    6286    pub fn set_subscription<T>(mut self, v: T) -> Self
    6287    where
    6288        T: std::convert::Into<crate::model::Subscription>,
    6289    {
    6290        self.subscription = std::option::Option::Some(v.into());
    6291        self
    6292    }
    6293
    6294    /// Sets or clears the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
    6295    ///
    6296    /// # Example
    6297    /// ```ignore,no_run
    6298    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
    6299    /// use google_cloud_pubsub::model::Subscription;
    6300    /// let x = UpdateSubscriptionRequest::new().set_or_clear_subscription(Some(Subscription::default()/* use setters */));
    6301    /// let x = UpdateSubscriptionRequest::new().set_or_clear_subscription(None::<Subscription>);
    6302    /// ```
    6303    pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
    6304    where
    6305        T: std::convert::Into<crate::model::Subscription>,
    6306    {
    6307        self.subscription = v.map(|x| x.into());
    6308        self
    6309    }
    6310
    6311    /// Sets the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
    6312    ///
    6313    /// # Example
    6314    /// ```ignore,no_run
    6315    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
    6316    /// use wkt::FieldMask;
    6317    /// let x = UpdateSubscriptionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
    6318    /// ```
    6319    pub fn set_update_mask<T>(mut self, v: T) -> Self
    6320    where
    6321        T: std::convert::Into<wkt::FieldMask>,
    6322    {
    6323        self.update_mask = std::option::Option::Some(v.into());
    6324        self
    6325    }
    6326
    6327    /// Sets or clears the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
    6328    ///
    6329    /// # Example
    6330    /// ```ignore,no_run
    6331    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
    6332    /// use wkt::FieldMask;
    6333    /// let x = UpdateSubscriptionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
    6334    /// let x = UpdateSubscriptionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
    6335    /// ```
    6336    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    6337    where
    6338        T: std::convert::Into<wkt::FieldMask>,
    6339    {
    6340        self.update_mask = v.map(|x| x.into());
    6341        self
    6342    }
    6343}
    6344
    6345impl wkt::message::Message for UpdateSubscriptionRequest {
    6346    fn typename() -> &'static str {
    6347        "type.googleapis.com/google.pubsub.v1.UpdateSubscriptionRequest"
    6348    }
    6349}
    6350
    6351/// Request for the `ListSubscriptions` method.
    6352#[derive(Clone, Default, PartialEq)]
    6353#[non_exhaustive]
    6354pub struct ListSubscriptionsRequest {
    6355    /// Required. Identifier. The name of the project in which to list
    6356    /// subscriptions. Format is `projects/{project-id}`.
    6357    pub project: std::string::String,
    6358
    6359    /// Optional. Maximum number of subscriptions to return.
    6360    pub page_size: i32,
    6361
    6362    /// Optional. The value returned by the last `ListSubscriptionsResponse`;
    6363    /// indicates that this is a continuation of a prior `ListSubscriptions` call,
    6364    /// and that the system should return the next page of data.
    6365    pub page_token: std::string::String,
    6366
    6367    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6368}
    6369
    6370impl ListSubscriptionsRequest {
    6371    pub fn new() -> Self {
    6372        std::default::Default::default()
    6373    }
    6374
    6375    /// Sets the value of [project][crate::model::ListSubscriptionsRequest::project].
    6376    ///
    6377    /// # Example
    6378    /// ```ignore,no_run
    6379    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
    6380    /// let x = ListSubscriptionsRequest::new().set_project("example");
    6381    /// ```
    6382    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6383        self.project = v.into();
    6384        self
    6385    }
    6386
    6387    /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
    6388    ///
    6389    /// # Example
    6390    /// ```ignore,no_run
    6391    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
    6392    /// let x = ListSubscriptionsRequest::new().set_page_size(42);
    6393    /// ```
    6394    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    6395        self.page_size = v.into();
    6396        self
    6397    }
    6398
    6399    /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
    6400    ///
    6401    /// # Example
    6402    /// ```ignore,no_run
    6403    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
    6404    /// let x = ListSubscriptionsRequest::new().set_page_token("example");
    6405    /// ```
    6406    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6407        self.page_token = v.into();
    6408        self
    6409    }
    6410}
    6411
    6412impl wkt::message::Message for ListSubscriptionsRequest {
    6413    fn typename() -> &'static str {
    6414        "type.googleapis.com/google.pubsub.v1.ListSubscriptionsRequest"
    6415    }
    6416}
    6417
    6418/// Response for the `ListSubscriptions` method.
    6419#[derive(Clone, Default, PartialEq)]
    6420#[non_exhaustive]
    6421pub struct ListSubscriptionsResponse {
    6422    /// Optional. The subscriptions that match the request.
    6423    pub subscriptions: std::vec::Vec<crate::model::Subscription>,
    6424
    6425    /// Optional. If not empty, indicates that there may be more subscriptions that
    6426    /// match the request; this value should be passed in a new
    6427    /// `ListSubscriptionsRequest` to get more subscriptions.
    6428    pub next_page_token: std::string::String,
    6429
    6430    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6431}
    6432
    6433impl ListSubscriptionsResponse {
    6434    pub fn new() -> Self {
    6435        std::default::Default::default()
    6436    }
    6437
    6438    /// Sets the value of [subscriptions][crate::model::ListSubscriptionsResponse::subscriptions].
    6439    ///
    6440    /// # Example
    6441    /// ```ignore,no_run
    6442    /// # use google_cloud_pubsub::model::ListSubscriptionsResponse;
    6443    /// use google_cloud_pubsub::model::Subscription;
    6444    /// let x = ListSubscriptionsResponse::new()
    6445    ///     .set_subscriptions([
    6446    ///         Subscription::default()/* use setters */,
    6447    ///         Subscription::default()/* use (different) setters */,
    6448    ///     ]);
    6449    /// ```
    6450    pub fn set_subscriptions<T, V>(mut self, v: T) -> Self
    6451    where
    6452        T: std::iter::IntoIterator<Item = V>,
    6453        V: std::convert::Into<crate::model::Subscription>,
    6454    {
    6455        use std::iter::Iterator;
    6456        self.subscriptions = v.into_iter().map(|i| i.into()).collect();
    6457        self
    6458    }
    6459
    6460    /// Sets the value of [next_page_token][crate::model::ListSubscriptionsResponse::next_page_token].
    6461    ///
    6462    /// # Example
    6463    /// ```ignore,no_run
    6464    /// # use google_cloud_pubsub::model::ListSubscriptionsResponse;
    6465    /// let x = ListSubscriptionsResponse::new().set_next_page_token("example");
    6466    /// ```
    6467    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6468        self.next_page_token = v.into();
    6469        self
    6470    }
    6471}
    6472
    6473impl wkt::message::Message for ListSubscriptionsResponse {
    6474    fn typename() -> &'static str {
    6475        "type.googleapis.com/google.pubsub.v1.ListSubscriptionsResponse"
    6476    }
    6477}
    6478
    6479#[doc(hidden)]
    6480impl gax::paginator::internal::PageableResponse for ListSubscriptionsResponse {
    6481    type PageItem = crate::model::Subscription;
    6482
    6483    fn items(self) -> std::vec::Vec<Self::PageItem> {
    6484        self.subscriptions
    6485    }
    6486
    6487    fn next_page_token(&self) -> std::string::String {
    6488        use std::clone::Clone;
    6489        self.next_page_token.clone()
    6490    }
    6491}
    6492
    6493/// Request for the DeleteSubscription method.
    6494#[derive(Clone, Default, PartialEq)]
    6495#[non_exhaustive]
    6496pub struct DeleteSubscriptionRequest {
    6497    /// Required. Identifier. The subscription to delete.
    6498    /// Format is `projects/{project}/subscriptions/{sub}`.
    6499    pub subscription: std::string::String,
    6500
    6501    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6502}
    6503
    6504impl DeleteSubscriptionRequest {
    6505    pub fn new() -> Self {
    6506        std::default::Default::default()
    6507    }
    6508
    6509    /// Sets the value of [subscription][crate::model::DeleteSubscriptionRequest::subscription].
    6510    ///
    6511    /// # Example
    6512    /// ```ignore,no_run
    6513    /// # use google_cloud_pubsub::model::DeleteSubscriptionRequest;
    6514    /// let x = DeleteSubscriptionRequest::new().set_subscription("example");
    6515    /// ```
    6516    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6517        self.subscription = v.into();
    6518        self
    6519    }
    6520}
    6521
    6522impl wkt::message::Message for DeleteSubscriptionRequest {
    6523    fn typename() -> &'static str {
    6524        "type.googleapis.com/google.pubsub.v1.DeleteSubscriptionRequest"
    6525    }
    6526}
    6527
    6528/// Request for the ModifyPushConfig method.
    6529#[derive(Clone, Default, PartialEq)]
    6530#[non_exhaustive]
    6531pub struct ModifyPushConfigRequest {
    6532    /// Required. The name of the subscription.
    6533    /// Format is `projects/{project}/subscriptions/{sub}`.
    6534    pub subscription: std::string::String,
    6535
    6536    /// Required. The push configuration for future deliveries.
    6537    ///
    6538    /// An empty `pushConfig` indicates that the Pub/Sub system should
    6539    /// stop pushing messages from the given subscription and allow
    6540    /// messages to be pulled and acknowledged - effectively pausing
    6541    /// the subscription if `Pull` or `StreamingPull` is not called.
    6542    pub push_config: std::option::Option<crate::model::PushConfig>,
    6543
    6544    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6545}
    6546
    6547impl ModifyPushConfigRequest {
    6548    pub fn new() -> Self {
    6549        std::default::Default::default()
    6550    }
    6551
    6552    /// Sets the value of [subscription][crate::model::ModifyPushConfigRequest::subscription].
    6553    ///
    6554    /// # Example
    6555    /// ```ignore,no_run
    6556    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
    6557    /// let x = ModifyPushConfigRequest::new().set_subscription("example");
    6558    /// ```
    6559    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6560        self.subscription = v.into();
    6561        self
    6562    }
    6563
    6564    /// Sets the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
    6565    ///
    6566    /// # Example
    6567    /// ```ignore,no_run
    6568    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
    6569    /// use google_cloud_pubsub::model::PushConfig;
    6570    /// let x = ModifyPushConfigRequest::new().set_push_config(PushConfig::default()/* use setters */);
    6571    /// ```
    6572    pub fn set_push_config<T>(mut self, v: T) -> Self
    6573    where
    6574        T: std::convert::Into<crate::model::PushConfig>,
    6575    {
    6576        self.push_config = std::option::Option::Some(v.into());
    6577        self
    6578    }
    6579
    6580    /// Sets or clears the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
    6581    ///
    6582    /// # Example
    6583    /// ```ignore,no_run
    6584    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
    6585    /// use google_cloud_pubsub::model::PushConfig;
    6586    /// let x = ModifyPushConfigRequest::new().set_or_clear_push_config(Some(PushConfig::default()/* use setters */));
    6587    /// let x = ModifyPushConfigRequest::new().set_or_clear_push_config(None::<PushConfig>);
    6588    /// ```
    6589    pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
    6590    where
    6591        T: std::convert::Into<crate::model::PushConfig>,
    6592    {
    6593        self.push_config = v.map(|x| x.into());
    6594        self
    6595    }
    6596}
    6597
    6598impl wkt::message::Message for ModifyPushConfigRequest {
    6599    fn typename() -> &'static str {
    6600        "type.googleapis.com/google.pubsub.v1.ModifyPushConfigRequest"
    6601    }
    6602}
    6603
    6604/// Request for the `CreateSnapshot` method.
    6605#[derive(Clone, Default, PartialEq)]
    6606#[non_exhaustive]
    6607pub struct CreateSnapshotRequest {
    6608    /// Required. Identifier. User-provided name for this snapshot. If the name is
    6609    /// not provided in the request, the server will assign a random name for this
    6610    /// snapshot on the same project as the subscription. Note that for REST API
    6611    /// requests, you must specify a name.  See the [resource name
    6612    /// rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
    6613    /// Format is `projects/{project}/snapshots/{snap}`.
    6614    pub name: std::string::String,
    6615
    6616    /// Required. The subscription whose backlog the snapshot retains.
    6617    /// Specifically, the created snapshot is guaranteed to retain:
    6618    /// (a) The existing backlog on the subscription. More precisely, this is
    6619    /// defined as the messages in the subscription's backlog that are
    6620    /// unacknowledged upon the successful completion of the
    6621    /// `CreateSnapshot` request; as well as:
    6622    /// (b) Any messages published to the subscription's topic following the
    6623    /// successful completion of the CreateSnapshot request.
    6624    /// Format is `projects/{project}/subscriptions/{sub}`.
    6625    pub subscription: std::string::String,
    6626
    6627    /// Optional. See [Creating and managing
    6628    /// labels](https://cloud.google.com/pubsub/docs/labels).
    6629    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
    6630
    6631    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
    6632    /// resource. For example:
    6633    /// "123/environment": "production",
    6634    /// "123/costCenter": "marketing"
    6635    /// See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on
    6636    /// using tags with Pub/Sub resources.
    6637    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
    6638
    6639    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6640}
    6641
    6642impl CreateSnapshotRequest {
    6643    pub fn new() -> Self {
    6644        std::default::Default::default()
    6645    }
    6646
    6647    /// Sets the value of [name][crate::model::CreateSnapshotRequest::name].
    6648    ///
    6649    /// # Example
    6650    /// ```ignore,no_run
    6651    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
    6652    /// let x = CreateSnapshotRequest::new().set_name("example");
    6653    /// ```
    6654    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6655        self.name = v.into();
    6656        self
    6657    }
    6658
    6659    /// Sets the value of [subscription][crate::model::CreateSnapshotRequest::subscription].
    6660    ///
    6661    /// # Example
    6662    /// ```ignore,no_run
    6663    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
    6664    /// let x = CreateSnapshotRequest::new().set_subscription("example");
    6665    /// ```
    6666    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6667        self.subscription = v.into();
    6668        self
    6669    }
    6670
    6671    /// Sets the value of [labels][crate::model::CreateSnapshotRequest::labels].
    6672    ///
    6673    /// # Example
    6674    /// ```ignore,no_run
    6675    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
    6676    /// let x = CreateSnapshotRequest::new().set_labels([
    6677    ///     ("key0", "abc"),
    6678    ///     ("key1", "xyz"),
    6679    /// ]);
    6680    /// ```
    6681    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    6682    where
    6683        T: std::iter::IntoIterator<Item = (K, V)>,
    6684        K: std::convert::Into<std::string::String>,
    6685        V: std::convert::Into<std::string::String>,
    6686    {
    6687        use std::iter::Iterator;
    6688        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    6689        self
    6690    }
    6691
    6692    /// Sets the value of [tags][crate::model::CreateSnapshotRequest::tags].
    6693    ///
    6694    /// # Example
    6695    /// ```ignore,no_run
    6696    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
    6697    /// let x = CreateSnapshotRequest::new().set_tags([
    6698    ///     ("key0", "abc"),
    6699    ///     ("key1", "xyz"),
    6700    /// ]);
    6701    /// ```
    6702    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
    6703    where
    6704        T: std::iter::IntoIterator<Item = (K, V)>,
    6705        K: std::convert::Into<std::string::String>,
    6706        V: std::convert::Into<std::string::String>,
    6707    {
    6708        use std::iter::Iterator;
    6709        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    6710        self
    6711    }
    6712}
    6713
    6714impl wkt::message::Message for CreateSnapshotRequest {
    6715    fn typename() -> &'static str {
    6716        "type.googleapis.com/google.pubsub.v1.CreateSnapshotRequest"
    6717    }
    6718}
    6719
    6720/// Request for the UpdateSnapshot method.
    6721#[derive(Clone, Default, PartialEq)]
    6722#[non_exhaustive]
    6723pub struct UpdateSnapshotRequest {
    6724    /// Required. The updated snapshot object.
    6725    pub snapshot: std::option::Option<crate::model::Snapshot>,
    6726
    6727    /// Required. Indicates which fields in the provided snapshot to update.
    6728    /// Must be specified and non-empty.
    6729    pub update_mask: std::option::Option<wkt::FieldMask>,
    6730
    6731    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6732}
    6733
    6734impl UpdateSnapshotRequest {
    6735    pub fn new() -> Self {
    6736        std::default::Default::default()
    6737    }
    6738
    6739    /// Sets the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
    6740    ///
    6741    /// # Example
    6742    /// ```ignore,no_run
    6743    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
    6744    /// use google_cloud_pubsub::model::Snapshot;
    6745    /// let x = UpdateSnapshotRequest::new().set_snapshot(Snapshot::default()/* use setters */);
    6746    /// ```
    6747    pub fn set_snapshot<T>(mut self, v: T) -> Self
    6748    where
    6749        T: std::convert::Into<crate::model::Snapshot>,
    6750    {
    6751        self.snapshot = std::option::Option::Some(v.into());
    6752        self
    6753    }
    6754
    6755    /// Sets or clears the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
    6756    ///
    6757    /// # Example
    6758    /// ```ignore,no_run
    6759    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
    6760    /// use google_cloud_pubsub::model::Snapshot;
    6761    /// let x = UpdateSnapshotRequest::new().set_or_clear_snapshot(Some(Snapshot::default()/* use setters */));
    6762    /// let x = UpdateSnapshotRequest::new().set_or_clear_snapshot(None::<Snapshot>);
    6763    /// ```
    6764    pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
    6765    where
    6766        T: std::convert::Into<crate::model::Snapshot>,
    6767    {
    6768        self.snapshot = v.map(|x| x.into());
    6769        self
    6770    }
    6771
    6772    /// Sets the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
    6773    ///
    6774    /// # Example
    6775    /// ```ignore,no_run
    6776    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
    6777    /// use wkt::FieldMask;
    6778    /// let x = UpdateSnapshotRequest::new().set_update_mask(FieldMask::default()/* use setters */);
    6779    /// ```
    6780    pub fn set_update_mask<T>(mut self, v: T) -> Self
    6781    where
    6782        T: std::convert::Into<wkt::FieldMask>,
    6783    {
    6784        self.update_mask = std::option::Option::Some(v.into());
    6785        self
    6786    }
    6787
    6788    /// Sets or clears the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
    6789    ///
    6790    /// # Example
    6791    /// ```ignore,no_run
    6792    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
    6793    /// use wkt::FieldMask;
    6794    /// let x = UpdateSnapshotRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
    6795    /// let x = UpdateSnapshotRequest::new().set_or_clear_update_mask(None::<FieldMask>);
    6796    /// ```
    6797    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    6798    where
    6799        T: std::convert::Into<wkt::FieldMask>,
    6800    {
    6801        self.update_mask = v.map(|x| x.into());
    6802        self
    6803    }
    6804}
    6805
    6806impl wkt::message::Message for UpdateSnapshotRequest {
    6807    fn typename() -> &'static str {
    6808        "type.googleapis.com/google.pubsub.v1.UpdateSnapshotRequest"
    6809    }
    6810}
    6811
    6812/// A snapshot resource. Snapshots are used in
    6813/// [Seek](https://cloud.google.com/pubsub/docs/replay-overview)
    6814/// operations, which allow you to manage message acknowledgments in bulk. That
    6815/// is, you can set the acknowledgment state of messages in an existing
    6816/// subscription to the state captured by a snapshot.
    6817#[derive(Clone, Default, PartialEq)]
    6818#[non_exhaustive]
    6819pub struct Snapshot {
    6820    /// Optional. The name of the snapshot.
    6821    pub name: std::string::String,
    6822
    6823    /// Optional. The name of the topic from which this snapshot is retaining
    6824    /// messages.
    6825    pub topic: std::string::String,
    6826
    6827    /// Optional. The snapshot is guaranteed to exist up until this time.
    6828    /// A newly-created snapshot expires no later than 7 days from the time of its
    6829    /// creation. Its exact lifetime is determined at creation by the existing
    6830    /// backlog in the source subscription. Specifically, the lifetime of the
    6831    /// snapshot is `7 days - (age of oldest unacked message in the subscription)`.
    6832    /// For example, consider a subscription whose oldest unacked message is 3 days
    6833    /// old. If a snapshot is created from this subscription, the snapshot -- which
    6834    /// will always capture this 3-day-old backlog as long as the snapshot
    6835    /// exists -- will expire in 4 days. The service will refuse to create a
    6836    /// snapshot that would expire in less than 1 hour after creation.
    6837    pub expire_time: std::option::Option<wkt::Timestamp>,
    6838
    6839    /// Optional. See [Creating and managing labels]
    6840    /// (<https://cloud.google.com/pubsub/docs/labels>).
    6841    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
    6842
    6843    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6844}
    6845
    6846impl Snapshot {
    6847    pub fn new() -> Self {
    6848        std::default::Default::default()
    6849    }
    6850
    6851    /// Sets the value of [name][crate::model::Snapshot::name].
    6852    ///
    6853    /// # Example
    6854    /// ```ignore,no_run
    6855    /// # use google_cloud_pubsub::model::Snapshot;
    6856    /// let x = Snapshot::new().set_name("example");
    6857    /// ```
    6858    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6859        self.name = v.into();
    6860        self
    6861    }
    6862
    6863    /// Sets the value of [topic][crate::model::Snapshot::topic].
    6864    ///
    6865    /// # Example
    6866    /// ```ignore,no_run
    6867    /// # use google_cloud_pubsub::model::Snapshot;
    6868    /// let x = Snapshot::new().set_topic("example");
    6869    /// ```
    6870    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6871        self.topic = v.into();
    6872        self
    6873    }
    6874
    6875    /// Sets the value of [expire_time][crate::model::Snapshot::expire_time].
    6876    ///
    6877    /// # Example
    6878    /// ```ignore,no_run
    6879    /// # use google_cloud_pubsub::model::Snapshot;
    6880    /// use wkt::Timestamp;
    6881    /// let x = Snapshot::new().set_expire_time(Timestamp::default()/* use setters */);
    6882    /// ```
    6883    pub fn set_expire_time<T>(mut self, v: T) -> Self
    6884    where
    6885        T: std::convert::Into<wkt::Timestamp>,
    6886    {
    6887        self.expire_time = std::option::Option::Some(v.into());
    6888        self
    6889    }
    6890
    6891    /// Sets or clears the value of [expire_time][crate::model::Snapshot::expire_time].
    6892    ///
    6893    /// # Example
    6894    /// ```ignore,no_run
    6895    /// # use google_cloud_pubsub::model::Snapshot;
    6896    /// use wkt::Timestamp;
    6897    /// let x = Snapshot::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
    6898    /// let x = Snapshot::new().set_or_clear_expire_time(None::<Timestamp>);
    6899    /// ```
    6900    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
    6901    where
    6902        T: std::convert::Into<wkt::Timestamp>,
    6903    {
    6904        self.expire_time = v.map(|x| x.into());
    6905        self
    6906    }
    6907
    6908    /// Sets the value of [labels][crate::model::Snapshot::labels].
    6909    ///
    6910    /// # Example
    6911    /// ```ignore,no_run
    6912    /// # use google_cloud_pubsub::model::Snapshot;
    6913    /// let x = Snapshot::new().set_labels([
    6914    ///     ("key0", "abc"),
    6915    ///     ("key1", "xyz"),
    6916    /// ]);
    6917    /// ```
    6918    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    6919    where
    6920        T: std::iter::IntoIterator<Item = (K, V)>,
    6921        K: std::convert::Into<std::string::String>,
    6922        V: std::convert::Into<std::string::String>,
    6923    {
    6924        use std::iter::Iterator;
    6925        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
    6926        self
    6927    }
    6928}
    6929
    6930impl wkt::message::Message for Snapshot {
    6931    fn typename() -> &'static str {
    6932        "type.googleapis.com/google.pubsub.v1.Snapshot"
    6933    }
    6934}
    6935
    6936/// Request for the GetSnapshot method.
    6937#[derive(Clone, Default, PartialEq)]
    6938#[non_exhaustive]
    6939pub struct GetSnapshotRequest {
    6940    /// Required. Identifier. The name of the snapshot to get.
    6941    /// Format is `projects/{project}/snapshots/{snap}`.
    6942    pub snapshot: std::string::String,
    6943
    6944    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6945}
    6946
    6947impl GetSnapshotRequest {
    6948    pub fn new() -> Self {
    6949        std::default::Default::default()
    6950    }
    6951
    6952    /// Sets the value of [snapshot][crate::model::GetSnapshotRequest::snapshot].
    6953    ///
    6954    /// # Example
    6955    /// ```ignore,no_run
    6956    /// # use google_cloud_pubsub::model::GetSnapshotRequest;
    6957    /// let x = GetSnapshotRequest::new().set_snapshot("example");
    6958    /// ```
    6959    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    6960        self.snapshot = v.into();
    6961        self
    6962    }
    6963}
    6964
    6965impl wkt::message::Message for GetSnapshotRequest {
    6966    fn typename() -> &'static str {
    6967        "type.googleapis.com/google.pubsub.v1.GetSnapshotRequest"
    6968    }
    6969}
    6970
    6971/// Request for the `ListSnapshots` method.
    6972#[derive(Clone, Default, PartialEq)]
    6973#[non_exhaustive]
    6974pub struct ListSnapshotsRequest {
    6975    /// Required. Identifier. The name of the project in which to list snapshots.
    6976    /// Format is `projects/{project-id}`.
    6977    pub project: std::string::String,
    6978
    6979    /// Optional. Maximum number of snapshots to return.
    6980    pub page_size: i32,
    6981
    6982    /// Optional. The value returned by the last `ListSnapshotsResponse`; indicates
    6983    /// that this is a continuation of a prior `ListSnapshots` call, and that the
    6984    /// system should return the next page of data.
    6985    pub page_token: std::string::String,
    6986
    6987    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    6988}
    6989
    6990impl ListSnapshotsRequest {
    6991    pub fn new() -> Self {
    6992        std::default::Default::default()
    6993    }
    6994
    6995    /// Sets the value of [project][crate::model::ListSnapshotsRequest::project].
    6996    ///
    6997    /// # Example
    6998    /// ```ignore,no_run
    6999    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
    7000    /// let x = ListSnapshotsRequest::new().set_project("example");
    7001    /// ```
    7002    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7003        self.project = v.into();
    7004        self
    7005    }
    7006
    7007    /// Sets the value of [page_size][crate::model::ListSnapshotsRequest::page_size].
    7008    ///
    7009    /// # Example
    7010    /// ```ignore,no_run
    7011    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
    7012    /// let x = ListSnapshotsRequest::new().set_page_size(42);
    7013    /// ```
    7014    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    7015        self.page_size = v.into();
    7016        self
    7017    }
    7018
    7019    /// Sets the value of [page_token][crate::model::ListSnapshotsRequest::page_token].
    7020    ///
    7021    /// # Example
    7022    /// ```ignore,no_run
    7023    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
    7024    /// let x = ListSnapshotsRequest::new().set_page_token("example");
    7025    /// ```
    7026    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7027        self.page_token = v.into();
    7028        self
    7029    }
    7030}
    7031
    7032impl wkt::message::Message for ListSnapshotsRequest {
    7033    fn typename() -> &'static str {
    7034        "type.googleapis.com/google.pubsub.v1.ListSnapshotsRequest"
    7035    }
    7036}
    7037
    7038/// Response for the `ListSnapshots` method.
    7039#[derive(Clone, Default, PartialEq)]
    7040#[non_exhaustive]
    7041pub struct ListSnapshotsResponse {
    7042    /// Optional. The resulting snapshots.
    7043    pub snapshots: std::vec::Vec<crate::model::Snapshot>,
    7044
    7045    /// Optional. If not empty, indicates that there may be more snapshot that
    7046    /// match the request; this value should be passed in a new
    7047    /// `ListSnapshotsRequest`.
    7048    pub next_page_token: std::string::String,
    7049
    7050    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7051}
    7052
    7053impl ListSnapshotsResponse {
    7054    pub fn new() -> Self {
    7055        std::default::Default::default()
    7056    }
    7057
    7058    /// Sets the value of [snapshots][crate::model::ListSnapshotsResponse::snapshots].
    7059    ///
    7060    /// # Example
    7061    /// ```ignore,no_run
    7062    /// # use google_cloud_pubsub::model::ListSnapshotsResponse;
    7063    /// use google_cloud_pubsub::model::Snapshot;
    7064    /// let x = ListSnapshotsResponse::new()
    7065    ///     .set_snapshots([
    7066    ///         Snapshot::default()/* use setters */,
    7067    ///         Snapshot::default()/* use (different) setters */,
    7068    ///     ]);
    7069    /// ```
    7070    pub fn set_snapshots<T, V>(mut self, v: T) -> Self
    7071    where
    7072        T: std::iter::IntoIterator<Item = V>,
    7073        V: std::convert::Into<crate::model::Snapshot>,
    7074    {
    7075        use std::iter::Iterator;
    7076        self.snapshots = v.into_iter().map(|i| i.into()).collect();
    7077        self
    7078    }
    7079
    7080    /// Sets the value of [next_page_token][crate::model::ListSnapshotsResponse::next_page_token].
    7081    ///
    7082    /// # Example
    7083    /// ```ignore,no_run
    7084    /// # use google_cloud_pubsub::model::ListSnapshotsResponse;
    7085    /// let x = ListSnapshotsResponse::new().set_next_page_token("example");
    7086    /// ```
    7087    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7088        self.next_page_token = v.into();
    7089        self
    7090    }
    7091}
    7092
    7093impl wkt::message::Message for ListSnapshotsResponse {
    7094    fn typename() -> &'static str {
    7095        "type.googleapis.com/google.pubsub.v1.ListSnapshotsResponse"
    7096    }
    7097}
    7098
    7099#[doc(hidden)]
    7100impl gax::paginator::internal::PageableResponse for ListSnapshotsResponse {
    7101    type PageItem = crate::model::Snapshot;
    7102
    7103    fn items(self) -> std::vec::Vec<Self::PageItem> {
    7104        self.snapshots
    7105    }
    7106
    7107    fn next_page_token(&self) -> std::string::String {
    7108        use std::clone::Clone;
    7109        self.next_page_token.clone()
    7110    }
    7111}
    7112
    7113/// Request for the `DeleteSnapshot` method.
    7114#[derive(Clone, Default, PartialEq)]
    7115#[non_exhaustive]
    7116pub struct DeleteSnapshotRequest {
    7117    /// Required. Identifier. The name of the snapshot to delete.
    7118    /// Format is `projects/{project}/snapshots/{snap}`.
    7119    pub snapshot: std::string::String,
    7120
    7121    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7122}
    7123
    7124impl DeleteSnapshotRequest {
    7125    pub fn new() -> Self {
    7126        std::default::Default::default()
    7127    }
    7128
    7129    /// Sets the value of [snapshot][crate::model::DeleteSnapshotRequest::snapshot].
    7130    ///
    7131    /// # Example
    7132    /// ```ignore,no_run
    7133    /// # use google_cloud_pubsub::model::DeleteSnapshotRequest;
    7134    /// let x = DeleteSnapshotRequest::new().set_snapshot("example");
    7135    /// ```
    7136    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7137        self.snapshot = v.into();
    7138        self
    7139    }
    7140}
    7141
    7142impl wkt::message::Message for DeleteSnapshotRequest {
    7143    fn typename() -> &'static str {
    7144        "type.googleapis.com/google.pubsub.v1.DeleteSnapshotRequest"
    7145    }
    7146}
    7147
    7148/// Request for the `Seek` method.
    7149#[derive(Clone, Default, PartialEq)]
    7150#[non_exhaustive]
    7151pub struct SeekRequest {
    7152    /// Required. The subscription to affect.
    7153    pub subscription: std::string::String,
    7154
    7155    pub target: std::option::Option<crate::model::seek_request::Target>,
    7156
    7157    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7158}
    7159
    7160impl SeekRequest {
    7161    pub fn new() -> Self {
    7162        std::default::Default::default()
    7163    }
    7164
    7165    /// Sets the value of [subscription][crate::model::SeekRequest::subscription].
    7166    ///
    7167    /// # Example
    7168    /// ```ignore,no_run
    7169    /// # use google_cloud_pubsub::model::SeekRequest;
    7170    /// let x = SeekRequest::new().set_subscription("example");
    7171    /// ```
    7172    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7173        self.subscription = v.into();
    7174        self
    7175    }
    7176
    7177    /// Sets the value of [target][crate::model::SeekRequest::target].
    7178    ///
    7179    /// Note that all the setters affecting `target` are mutually
    7180    /// exclusive.
    7181    ///
    7182    /// # Example
    7183    /// ```ignore,no_run
    7184    /// # use google_cloud_pubsub::model::SeekRequest;
    7185    /// use google_cloud_pubsub::model::seek_request::Target;
    7186    /// let x = SeekRequest::new().set_target(Some(Target::Snapshot("example".to_string())));
    7187    /// ```
    7188    pub fn set_target<
    7189        T: std::convert::Into<std::option::Option<crate::model::seek_request::Target>>,
    7190    >(
    7191        mut self,
    7192        v: T,
    7193    ) -> Self {
    7194        self.target = v.into();
    7195        self
    7196    }
    7197
    7198    /// The value of [target][crate::model::SeekRequest::target]
    7199    /// if it holds a `Time`, `None` if the field is not set or
    7200    /// holds a different branch.
    7201    pub fn time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
    7202        #[allow(unreachable_patterns)]
    7203        self.target.as_ref().and_then(|v| match v {
    7204            crate::model::seek_request::Target::Time(v) => std::option::Option::Some(v),
    7205            _ => std::option::Option::None,
    7206        })
    7207    }
    7208
    7209    /// Sets the value of [target][crate::model::SeekRequest::target]
    7210    /// to hold a `Time`.
    7211    ///
    7212    /// Note that all the setters affecting `target` are
    7213    /// mutually exclusive.
    7214    ///
    7215    /// # Example
    7216    /// ```ignore,no_run
    7217    /// # use google_cloud_pubsub::model::SeekRequest;
    7218    /// use wkt::Timestamp;
    7219    /// let x = SeekRequest::new().set_time(Timestamp::default()/* use setters */);
    7220    /// assert!(x.time().is_some());
    7221    /// assert!(x.snapshot().is_none());
    7222    /// ```
    7223    pub fn set_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
    7224        mut self,
    7225        v: T,
    7226    ) -> Self {
    7227        self.target = std::option::Option::Some(crate::model::seek_request::Target::Time(v.into()));
    7228        self
    7229    }
    7230
    7231    /// The value of [target][crate::model::SeekRequest::target]
    7232    /// if it holds a `Snapshot`, `None` if the field is not set or
    7233    /// holds a different branch.
    7234    pub fn snapshot(&self) -> std::option::Option<&std::string::String> {
    7235        #[allow(unreachable_patterns)]
    7236        self.target.as_ref().and_then(|v| match v {
    7237            crate::model::seek_request::Target::Snapshot(v) => std::option::Option::Some(v),
    7238            _ => std::option::Option::None,
    7239        })
    7240    }
    7241
    7242    /// Sets the value of [target][crate::model::SeekRequest::target]
    7243    /// to hold a `Snapshot`.
    7244    ///
    7245    /// Note that all the setters affecting `target` are
    7246    /// mutually exclusive.
    7247    ///
    7248    /// # Example
    7249    /// ```ignore,no_run
    7250    /// # use google_cloud_pubsub::model::SeekRequest;
    7251    /// let x = SeekRequest::new().set_snapshot("example");
    7252    /// assert!(x.snapshot().is_some());
    7253    /// assert!(x.time().is_none());
    7254    /// ```
    7255    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7256        self.target =
    7257            std::option::Option::Some(crate::model::seek_request::Target::Snapshot(v.into()));
    7258        self
    7259    }
    7260}
    7261
    7262impl wkt::message::Message for SeekRequest {
    7263    fn typename() -> &'static str {
    7264        "type.googleapis.com/google.pubsub.v1.SeekRequest"
    7265    }
    7266}
    7267
    7268/// Defines additional types related to [SeekRequest].
    7269pub mod seek_request {
    7270    #[allow(unused_imports)]
    7271    use super::*;
    7272
    7273    #[derive(Clone, Debug, PartialEq)]
    7274    #[non_exhaustive]
    7275    pub enum Target {
    7276        /// Optional. The time to seek to.
    7277        /// Messages retained in the subscription that were published before this
    7278        /// time are marked as acknowledged, and messages retained in the
    7279        /// subscription that were published after this time are marked as
    7280        /// unacknowledged. Note that this operation affects only those messages
    7281        /// retained in the subscription (configured by the combination of
    7282        /// `message_retention_duration` and `retain_acked_messages`). For example,
    7283        /// if `time` corresponds to a point before the message retention
    7284        /// window (or to a point before the system's notion of the subscription
    7285        /// creation time), only retained messages will be marked as unacknowledged,
    7286        /// and already-expunged messages will not be restored.
    7287        Time(std::boxed::Box<wkt::Timestamp>),
    7288        /// Optional. The snapshot to seek to. The snapshot's topic must be the same
    7289        /// as that of the provided subscription. Format is
    7290        /// `projects/{project}/snapshots/{snap}`.
    7291        Snapshot(std::string::String),
    7292    }
    7293}
    7294
    7295/// Response for the `Seek` method (this response is empty).
    7296#[derive(Clone, Default, PartialEq)]
    7297#[non_exhaustive]
    7298pub struct SeekResponse {
    7299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7300}
    7301
    7302impl SeekResponse {
    7303    pub fn new() -> Self {
    7304        std::default::Default::default()
    7305    }
    7306}
    7307
    7308impl wkt::message::Message for SeekResponse {
    7309    fn typename() -> &'static str {
    7310        "type.googleapis.com/google.pubsub.v1.SeekResponse"
    7311    }
    7312}
    7313
    7314/// A schema resource.
    7315#[derive(Clone, Default, PartialEq)]
    7316#[non_exhaustive]
    7317pub struct Schema {
    7318    /// Required. Name of the schema.
    7319    /// Format is `projects/{project}/schemas/{schema}`.
    7320    pub name: std::string::String,
    7321
    7322    /// The type of the schema definition.
    7323    pub r#type: crate::model::schema::Type,
    7324
    7325    /// The definition of the schema. This should contain a string representing
    7326    /// the full definition of the schema that is a valid schema definition of
    7327    /// the type specified in `type`.
    7328    pub definition: std::string::String,
    7329
    7330    /// Output only. Immutable. The revision ID of the schema.
    7331    pub revision_id: std::string::String,
    7332
    7333    /// Output only. The timestamp that the revision was created.
    7334    pub revision_create_time: std::option::Option<wkt::Timestamp>,
    7335
    7336    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7337}
    7338
    7339impl Schema {
    7340    pub fn new() -> Self {
    7341        std::default::Default::default()
    7342    }
    7343
    7344    /// Sets the value of [name][crate::model::Schema::name].
    7345    ///
    7346    /// # Example
    7347    /// ```ignore,no_run
    7348    /// # use google_cloud_pubsub::model::Schema;
    7349    /// let x = Schema::new().set_name("example");
    7350    /// ```
    7351    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7352        self.name = v.into();
    7353        self
    7354    }
    7355
    7356    /// Sets the value of [r#type][crate::model::Schema::type].
    7357    ///
    7358    /// # Example
    7359    /// ```ignore,no_run
    7360    /// # use google_cloud_pubsub::model::Schema;
    7361    /// use google_cloud_pubsub::model::schema::Type;
    7362    /// let x0 = Schema::new().set_type(Type::ProtocolBuffer);
    7363    /// let x1 = Schema::new().set_type(Type::Avro);
    7364    /// ```
    7365    pub fn set_type<T: std::convert::Into<crate::model::schema::Type>>(mut self, v: T) -> Self {
    7366        self.r#type = v.into();
    7367        self
    7368    }
    7369
    7370    /// Sets the value of [definition][crate::model::Schema::definition].
    7371    ///
    7372    /// # Example
    7373    /// ```ignore,no_run
    7374    /// # use google_cloud_pubsub::model::Schema;
    7375    /// let x = Schema::new().set_definition("example");
    7376    /// ```
    7377    pub fn set_definition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7378        self.definition = v.into();
    7379        self
    7380    }
    7381
    7382    /// Sets the value of [revision_id][crate::model::Schema::revision_id].
    7383    ///
    7384    /// # Example
    7385    /// ```ignore,no_run
    7386    /// # use google_cloud_pubsub::model::Schema;
    7387    /// let x = Schema::new().set_revision_id("example");
    7388    /// ```
    7389    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7390        self.revision_id = v.into();
    7391        self
    7392    }
    7393
    7394    /// Sets the value of [revision_create_time][crate::model::Schema::revision_create_time].
    7395    ///
    7396    /// # Example
    7397    /// ```ignore,no_run
    7398    /// # use google_cloud_pubsub::model::Schema;
    7399    /// use wkt::Timestamp;
    7400    /// let x = Schema::new().set_revision_create_time(Timestamp::default()/* use setters */);
    7401    /// ```
    7402    pub fn set_revision_create_time<T>(mut self, v: T) -> Self
    7403    where
    7404        T: std::convert::Into<wkt::Timestamp>,
    7405    {
    7406        self.revision_create_time = std::option::Option::Some(v.into());
    7407        self
    7408    }
    7409
    7410    /// Sets or clears the value of [revision_create_time][crate::model::Schema::revision_create_time].
    7411    ///
    7412    /// # Example
    7413    /// ```ignore,no_run
    7414    /// # use google_cloud_pubsub::model::Schema;
    7415    /// use wkt::Timestamp;
    7416    /// let x = Schema::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
    7417    /// let x = Schema::new().set_or_clear_revision_create_time(None::<Timestamp>);
    7418    /// ```
    7419    pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    7420    where
    7421        T: std::convert::Into<wkt::Timestamp>,
    7422    {
    7423        self.revision_create_time = v.map(|x| x.into());
    7424        self
    7425    }
    7426}
    7427
    7428impl wkt::message::Message for Schema {
    7429    fn typename() -> &'static str {
    7430        "type.googleapis.com/google.pubsub.v1.Schema"
    7431    }
    7432}
    7433
    7434/// Defines additional types related to [Schema].
    7435pub mod schema {
    7436    #[allow(unused_imports)]
    7437    use super::*;
    7438
    7439    /// Possible schema definition types.
    7440    ///
    7441    /// # Working with unknown values
    7442    ///
    7443    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    7444    /// additional enum variants at any time. Adding new variants is not considered
    7445    /// a breaking change. Applications should write their code in anticipation of:
    7446    ///
    7447    /// - New values appearing in future releases of the client library, **and**
    7448    /// - New values received dynamically, without application changes.
    7449    ///
    7450    /// Please consult the [Working with enums] section in the user guide for some
    7451    /// guidelines.
    7452    ///
    7453    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    7454    #[derive(Clone, Debug, PartialEq)]
    7455    #[non_exhaustive]
    7456    pub enum Type {
    7457        /// Default value. This value is unused.
    7458        Unspecified,
    7459        /// A Protocol Buffer schema definition.
    7460        ProtocolBuffer,
    7461        /// An Avro schema definition.
    7462        Avro,
    7463        /// If set, the enum was initialized with an unknown value.
    7464        ///
    7465        /// Applications can examine the value using [Type::value] or
    7466        /// [Type::name].
    7467        UnknownValue(r#type::UnknownValue),
    7468    }
    7469
    7470    #[doc(hidden)]
    7471    pub mod r#type {
    7472        #[allow(unused_imports)]
    7473        use super::*;
    7474        #[derive(Clone, Debug, PartialEq)]
    7475        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    7476    }
    7477
    7478    impl Type {
    7479        /// Gets the enum value.
    7480        ///
    7481        /// Returns `None` if the enum contains an unknown value deserialized from
    7482        /// the string representation of enums.
    7483        pub fn value(&self) -> std::option::Option<i32> {
    7484            match self {
    7485                Self::Unspecified => std::option::Option::Some(0),
    7486                Self::ProtocolBuffer => std::option::Option::Some(1),
    7487                Self::Avro => std::option::Option::Some(2),
    7488                Self::UnknownValue(u) => u.0.value(),
    7489            }
    7490        }
    7491
    7492        /// Gets the enum value as a string.
    7493        ///
    7494        /// Returns `None` if the enum contains an unknown value deserialized from
    7495        /// the integer representation of enums.
    7496        pub fn name(&self) -> std::option::Option<&str> {
    7497            match self {
    7498                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
    7499                Self::ProtocolBuffer => std::option::Option::Some("PROTOCOL_BUFFER"),
    7500                Self::Avro => std::option::Option::Some("AVRO"),
    7501                Self::UnknownValue(u) => u.0.name(),
    7502            }
    7503        }
    7504    }
    7505
    7506    impl std::default::Default for Type {
    7507        fn default() -> Self {
    7508            use std::convert::From;
    7509            Self::from(0)
    7510        }
    7511    }
    7512
    7513    impl std::fmt::Display for Type {
    7514        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    7515            wkt::internal::display_enum(f, self.name(), self.value())
    7516        }
    7517    }
    7518
    7519    impl std::convert::From<i32> for Type {
    7520        fn from(value: i32) -> Self {
    7521            match value {
    7522                0 => Self::Unspecified,
    7523                1 => Self::ProtocolBuffer,
    7524                2 => Self::Avro,
    7525                _ => Self::UnknownValue(r#type::UnknownValue(
    7526                    wkt::internal::UnknownEnumValue::Integer(value),
    7527                )),
    7528            }
    7529        }
    7530    }
    7531
    7532    impl std::convert::From<&str> for Type {
    7533        fn from(value: &str) -> Self {
    7534            use std::string::ToString;
    7535            match value {
    7536                "TYPE_UNSPECIFIED" => Self::Unspecified,
    7537                "PROTOCOL_BUFFER" => Self::ProtocolBuffer,
    7538                "AVRO" => Self::Avro,
    7539                _ => Self::UnknownValue(r#type::UnknownValue(
    7540                    wkt::internal::UnknownEnumValue::String(value.to_string()),
    7541                )),
    7542            }
    7543        }
    7544    }
    7545
    7546    impl serde::ser::Serialize for Type {
    7547        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    7548        where
    7549            S: serde::Serializer,
    7550        {
    7551            match self {
    7552                Self::Unspecified => serializer.serialize_i32(0),
    7553                Self::ProtocolBuffer => serializer.serialize_i32(1),
    7554                Self::Avro => serializer.serialize_i32(2),
    7555                Self::UnknownValue(u) => u.0.serialize(serializer),
    7556            }
    7557        }
    7558    }
    7559
    7560    impl<'de> serde::de::Deserialize<'de> for Type {
    7561        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    7562        where
    7563            D: serde::Deserializer<'de>,
    7564        {
    7565            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
    7566                ".google.pubsub.v1.Schema.Type",
    7567            ))
    7568        }
    7569    }
    7570}
    7571
    7572/// Request for the CreateSchema method.
    7573#[derive(Clone, Default, PartialEq)]
    7574#[non_exhaustive]
    7575pub struct CreateSchemaRequest {
    7576    /// Required. The name of the project in which to create the schema.
    7577    /// Format is `projects/{project-id}`.
    7578    pub parent: std::string::String,
    7579
    7580    /// Required. The schema object to create.
    7581    ///
    7582    /// This schema's `name` parameter is ignored. The schema object returned
    7583    /// by CreateSchema will have a `name` made using the given `parent` and
    7584    /// `schema_id`.
    7585    pub schema: std::option::Option<crate::model::Schema>,
    7586
    7587    /// The ID to use for the schema, which will become the final component of
    7588    /// the schema's resource name.
    7589    ///
    7590    /// See <https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names> for
    7591    /// resource name constraints.
    7592    pub schema_id: std::string::String,
    7593
    7594    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7595}
    7596
    7597impl CreateSchemaRequest {
    7598    pub fn new() -> Self {
    7599        std::default::Default::default()
    7600    }
    7601
    7602    /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
    7603    ///
    7604    /// # Example
    7605    /// ```ignore,no_run
    7606    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
    7607    /// let x = CreateSchemaRequest::new().set_parent("example");
    7608    /// ```
    7609    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7610        self.parent = v.into();
    7611        self
    7612    }
    7613
    7614    /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
    7615    ///
    7616    /// # Example
    7617    /// ```ignore,no_run
    7618    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
    7619    /// use google_cloud_pubsub::model::Schema;
    7620    /// let x = CreateSchemaRequest::new().set_schema(Schema::default()/* use setters */);
    7621    /// ```
    7622    pub fn set_schema<T>(mut self, v: T) -> Self
    7623    where
    7624        T: std::convert::Into<crate::model::Schema>,
    7625    {
    7626        self.schema = std::option::Option::Some(v.into());
    7627        self
    7628    }
    7629
    7630    /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
    7631    ///
    7632    /// # Example
    7633    /// ```ignore,no_run
    7634    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
    7635    /// use google_cloud_pubsub::model::Schema;
    7636    /// let x = CreateSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
    7637    /// let x = CreateSchemaRequest::new().set_or_clear_schema(None::<Schema>);
    7638    /// ```
    7639    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
    7640    where
    7641        T: std::convert::Into<crate::model::Schema>,
    7642    {
    7643        self.schema = v.map(|x| x.into());
    7644        self
    7645    }
    7646
    7647    /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
    7648    ///
    7649    /// # Example
    7650    /// ```ignore,no_run
    7651    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
    7652    /// let x = CreateSchemaRequest::new().set_schema_id("example");
    7653    /// ```
    7654    pub fn set_schema_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7655        self.schema_id = v.into();
    7656        self
    7657    }
    7658}
    7659
    7660impl wkt::message::Message for CreateSchemaRequest {
    7661    fn typename() -> &'static str {
    7662        "type.googleapis.com/google.pubsub.v1.CreateSchemaRequest"
    7663    }
    7664}
    7665
    7666/// Request for the GetSchema method.
    7667#[derive(Clone, Default, PartialEq)]
    7668#[non_exhaustive]
    7669pub struct GetSchemaRequest {
    7670    /// Required. The name of the schema to get.
    7671    /// Format is `projects/{project}/schemas/{schema}`.
    7672    pub name: std::string::String,
    7673
    7674    /// The set of fields to return in the response. If not set, returns a Schema
    7675    /// with all fields filled out. Set to `BASIC` to omit the `definition`.
    7676    pub view: crate::model::SchemaView,
    7677
    7678    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7679}
    7680
    7681impl GetSchemaRequest {
    7682    pub fn new() -> Self {
    7683        std::default::Default::default()
    7684    }
    7685
    7686    /// Sets the value of [name][crate::model::GetSchemaRequest::name].
    7687    ///
    7688    /// # Example
    7689    /// ```ignore,no_run
    7690    /// # use google_cloud_pubsub::model::GetSchemaRequest;
    7691    /// let x = GetSchemaRequest::new().set_name("example");
    7692    /// ```
    7693    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7694        self.name = v.into();
    7695        self
    7696    }
    7697
    7698    /// Sets the value of [view][crate::model::GetSchemaRequest::view].
    7699    ///
    7700    /// # Example
    7701    /// ```ignore,no_run
    7702    /// # use google_cloud_pubsub::model::GetSchemaRequest;
    7703    /// use google_cloud_pubsub::model::SchemaView;
    7704    /// let x0 = GetSchemaRequest::new().set_view(SchemaView::Basic);
    7705    /// let x1 = GetSchemaRequest::new().set_view(SchemaView::Full);
    7706    /// ```
    7707    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
    7708        self.view = v.into();
    7709        self
    7710    }
    7711}
    7712
    7713impl wkt::message::Message for GetSchemaRequest {
    7714    fn typename() -> &'static str {
    7715        "type.googleapis.com/google.pubsub.v1.GetSchemaRequest"
    7716    }
    7717}
    7718
    7719/// Request for the `ListSchemas` method.
    7720#[derive(Clone, Default, PartialEq)]
    7721#[non_exhaustive]
    7722pub struct ListSchemasRequest {
    7723    /// Required. The name of the project in which to list schemas.
    7724    /// Format is `projects/{project-id}`.
    7725    pub parent: std::string::String,
    7726
    7727    /// The set of Schema fields to return in the response. If not set, returns
    7728    /// Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    7729    /// retrieve all fields.
    7730    pub view: crate::model::SchemaView,
    7731
    7732    /// Maximum number of schemas to return.
    7733    pub page_size: i32,
    7734
    7735    /// The value returned by the last `ListSchemasResponse`; indicates that
    7736    /// this is a continuation of a prior `ListSchemas` call, and that the
    7737    /// system should return the next page of data.
    7738    pub page_token: std::string::String,
    7739
    7740    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7741}
    7742
    7743impl ListSchemasRequest {
    7744    pub fn new() -> Self {
    7745        std::default::Default::default()
    7746    }
    7747
    7748    /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
    7749    ///
    7750    /// # Example
    7751    /// ```ignore,no_run
    7752    /// # use google_cloud_pubsub::model::ListSchemasRequest;
    7753    /// let x = ListSchemasRequest::new().set_parent("example");
    7754    /// ```
    7755    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7756        self.parent = v.into();
    7757        self
    7758    }
    7759
    7760    /// Sets the value of [view][crate::model::ListSchemasRequest::view].
    7761    ///
    7762    /// # Example
    7763    /// ```ignore,no_run
    7764    /// # use google_cloud_pubsub::model::ListSchemasRequest;
    7765    /// use google_cloud_pubsub::model::SchemaView;
    7766    /// let x0 = ListSchemasRequest::new().set_view(SchemaView::Basic);
    7767    /// let x1 = ListSchemasRequest::new().set_view(SchemaView::Full);
    7768    /// ```
    7769    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
    7770        self.view = v.into();
    7771        self
    7772    }
    7773
    7774    /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
    7775    ///
    7776    /// # Example
    7777    /// ```ignore,no_run
    7778    /// # use google_cloud_pubsub::model::ListSchemasRequest;
    7779    /// let x = ListSchemasRequest::new().set_page_size(42);
    7780    /// ```
    7781    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    7782        self.page_size = v.into();
    7783        self
    7784    }
    7785
    7786    /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
    7787    ///
    7788    /// # Example
    7789    /// ```ignore,no_run
    7790    /// # use google_cloud_pubsub::model::ListSchemasRequest;
    7791    /// let x = ListSchemasRequest::new().set_page_token("example");
    7792    /// ```
    7793    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7794        self.page_token = v.into();
    7795        self
    7796    }
    7797}
    7798
    7799impl wkt::message::Message for ListSchemasRequest {
    7800    fn typename() -> &'static str {
    7801        "type.googleapis.com/google.pubsub.v1.ListSchemasRequest"
    7802    }
    7803}
    7804
    7805/// Response for the `ListSchemas` method.
    7806#[derive(Clone, Default, PartialEq)]
    7807#[non_exhaustive]
    7808pub struct ListSchemasResponse {
    7809    /// The resulting schemas.
    7810    pub schemas: std::vec::Vec<crate::model::Schema>,
    7811
    7812    /// If not empty, indicates that there may be more schemas that match the
    7813    /// request; this value should be passed in a new `ListSchemasRequest`.
    7814    pub next_page_token: std::string::String,
    7815
    7816    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7817}
    7818
    7819impl ListSchemasResponse {
    7820    pub fn new() -> Self {
    7821        std::default::Default::default()
    7822    }
    7823
    7824    /// Sets the value of [schemas][crate::model::ListSchemasResponse::schemas].
    7825    ///
    7826    /// # Example
    7827    /// ```ignore,no_run
    7828    /// # use google_cloud_pubsub::model::ListSchemasResponse;
    7829    /// use google_cloud_pubsub::model::Schema;
    7830    /// let x = ListSchemasResponse::new()
    7831    ///     .set_schemas([
    7832    ///         Schema::default()/* use setters */,
    7833    ///         Schema::default()/* use (different) setters */,
    7834    ///     ]);
    7835    /// ```
    7836    pub fn set_schemas<T, V>(mut self, v: T) -> Self
    7837    where
    7838        T: std::iter::IntoIterator<Item = V>,
    7839        V: std::convert::Into<crate::model::Schema>,
    7840    {
    7841        use std::iter::Iterator;
    7842        self.schemas = v.into_iter().map(|i| i.into()).collect();
    7843        self
    7844    }
    7845
    7846    /// Sets the value of [next_page_token][crate::model::ListSchemasResponse::next_page_token].
    7847    ///
    7848    /// # Example
    7849    /// ```ignore,no_run
    7850    /// # use google_cloud_pubsub::model::ListSchemasResponse;
    7851    /// let x = ListSchemasResponse::new().set_next_page_token("example");
    7852    /// ```
    7853    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7854        self.next_page_token = v.into();
    7855        self
    7856    }
    7857}
    7858
    7859impl wkt::message::Message for ListSchemasResponse {
    7860    fn typename() -> &'static str {
    7861        "type.googleapis.com/google.pubsub.v1.ListSchemasResponse"
    7862    }
    7863}
    7864
    7865#[doc(hidden)]
    7866impl gax::paginator::internal::PageableResponse for ListSchemasResponse {
    7867    type PageItem = crate::model::Schema;
    7868
    7869    fn items(self) -> std::vec::Vec<Self::PageItem> {
    7870        self.schemas
    7871    }
    7872
    7873    fn next_page_token(&self) -> std::string::String {
    7874        use std::clone::Clone;
    7875        self.next_page_token.clone()
    7876    }
    7877}
    7878
    7879/// Request for the `ListSchemaRevisions` method.
    7880#[derive(Clone, Default, PartialEq)]
    7881#[non_exhaustive]
    7882pub struct ListSchemaRevisionsRequest {
    7883    /// Required. The name of the schema to list revisions for.
    7884    pub name: std::string::String,
    7885
    7886    /// The set of Schema fields to return in the response. If not set, returns
    7887    /// Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
    7888    /// retrieve all fields.
    7889    pub view: crate::model::SchemaView,
    7890
    7891    /// The maximum number of revisions to return per page.
    7892    pub page_size: i32,
    7893
    7894    /// The page token, received from a previous ListSchemaRevisions call.
    7895    /// Provide this to retrieve the subsequent page.
    7896    pub page_token: std::string::String,
    7897
    7898    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7899}
    7900
    7901impl ListSchemaRevisionsRequest {
    7902    pub fn new() -> Self {
    7903        std::default::Default::default()
    7904    }
    7905
    7906    /// Sets the value of [name][crate::model::ListSchemaRevisionsRequest::name].
    7907    ///
    7908    /// # Example
    7909    /// ```ignore,no_run
    7910    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
    7911    /// let x = ListSchemaRevisionsRequest::new().set_name("example");
    7912    /// ```
    7913    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7914        self.name = v.into();
    7915        self
    7916    }
    7917
    7918    /// Sets the value of [view][crate::model::ListSchemaRevisionsRequest::view].
    7919    ///
    7920    /// # Example
    7921    /// ```ignore,no_run
    7922    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
    7923    /// use google_cloud_pubsub::model::SchemaView;
    7924    /// let x0 = ListSchemaRevisionsRequest::new().set_view(SchemaView::Basic);
    7925    /// let x1 = ListSchemaRevisionsRequest::new().set_view(SchemaView::Full);
    7926    /// ```
    7927    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
    7928        self.view = v.into();
    7929        self
    7930    }
    7931
    7932    /// Sets the value of [page_size][crate::model::ListSchemaRevisionsRequest::page_size].
    7933    ///
    7934    /// # Example
    7935    /// ```ignore,no_run
    7936    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
    7937    /// let x = ListSchemaRevisionsRequest::new().set_page_size(42);
    7938    /// ```
    7939    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
    7940        self.page_size = v.into();
    7941        self
    7942    }
    7943
    7944    /// Sets the value of [page_token][crate::model::ListSchemaRevisionsRequest::page_token].
    7945    ///
    7946    /// # Example
    7947    /// ```ignore,no_run
    7948    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
    7949    /// let x = ListSchemaRevisionsRequest::new().set_page_token("example");
    7950    /// ```
    7951    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    7952        self.page_token = v.into();
    7953        self
    7954    }
    7955}
    7956
    7957impl wkt::message::Message for ListSchemaRevisionsRequest {
    7958    fn typename() -> &'static str {
    7959        "type.googleapis.com/google.pubsub.v1.ListSchemaRevisionsRequest"
    7960    }
    7961}
    7962
    7963/// Response for the `ListSchemaRevisions` method.
    7964#[derive(Clone, Default, PartialEq)]
    7965#[non_exhaustive]
    7966pub struct ListSchemaRevisionsResponse {
    7967    /// The revisions of the schema.
    7968    pub schemas: std::vec::Vec<crate::model::Schema>,
    7969
    7970    /// A token that can be sent as `page_token` to retrieve the next page.
    7971    /// If this field is empty, there are no subsequent pages.
    7972    pub next_page_token: std::string::String,
    7973
    7974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    7975}
    7976
    7977impl ListSchemaRevisionsResponse {
    7978    pub fn new() -> Self {
    7979        std::default::Default::default()
    7980    }
    7981
    7982    /// Sets the value of [schemas][crate::model::ListSchemaRevisionsResponse::schemas].
    7983    ///
    7984    /// # Example
    7985    /// ```ignore,no_run
    7986    /// # use google_cloud_pubsub::model::ListSchemaRevisionsResponse;
    7987    /// use google_cloud_pubsub::model::Schema;
    7988    /// let x = ListSchemaRevisionsResponse::new()
    7989    ///     .set_schemas([
    7990    ///         Schema::default()/* use setters */,
    7991    ///         Schema::default()/* use (different) setters */,
    7992    ///     ]);
    7993    /// ```
    7994    pub fn set_schemas<T, V>(mut self, v: T) -> Self
    7995    where
    7996        T: std::iter::IntoIterator<Item = V>,
    7997        V: std::convert::Into<crate::model::Schema>,
    7998    {
    7999        use std::iter::Iterator;
    8000        self.schemas = v.into_iter().map(|i| i.into()).collect();
    8001        self
    8002    }
    8003
    8004    /// Sets the value of [next_page_token][crate::model::ListSchemaRevisionsResponse::next_page_token].
    8005    ///
    8006    /// # Example
    8007    /// ```ignore,no_run
    8008    /// # use google_cloud_pubsub::model::ListSchemaRevisionsResponse;
    8009    /// let x = ListSchemaRevisionsResponse::new().set_next_page_token("example");
    8010    /// ```
    8011    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8012        self.next_page_token = v.into();
    8013        self
    8014    }
    8015}
    8016
    8017impl wkt::message::Message for ListSchemaRevisionsResponse {
    8018    fn typename() -> &'static str {
    8019        "type.googleapis.com/google.pubsub.v1.ListSchemaRevisionsResponse"
    8020    }
    8021}
    8022
    8023#[doc(hidden)]
    8024impl gax::paginator::internal::PageableResponse for ListSchemaRevisionsResponse {
    8025    type PageItem = crate::model::Schema;
    8026
    8027    fn items(self) -> std::vec::Vec<Self::PageItem> {
    8028        self.schemas
    8029    }
    8030
    8031    fn next_page_token(&self) -> std::string::String {
    8032        use std::clone::Clone;
    8033        self.next_page_token.clone()
    8034    }
    8035}
    8036
    8037/// Request for CommitSchema method.
    8038#[derive(Clone, Default, PartialEq)]
    8039#[non_exhaustive]
    8040pub struct CommitSchemaRequest {
    8041    /// Required. The name of the schema we are revising.
    8042    /// Format is `projects/{project}/schemas/{schema}`.
    8043    pub name: std::string::String,
    8044
    8045    /// Required. The schema revision to commit.
    8046    pub schema: std::option::Option<crate::model::Schema>,
    8047
    8048    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8049}
    8050
    8051impl CommitSchemaRequest {
    8052    pub fn new() -> Self {
    8053        std::default::Default::default()
    8054    }
    8055
    8056    /// Sets the value of [name][crate::model::CommitSchemaRequest::name].
    8057    ///
    8058    /// # Example
    8059    /// ```ignore,no_run
    8060    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
    8061    /// let x = CommitSchemaRequest::new().set_name("example");
    8062    /// ```
    8063    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8064        self.name = v.into();
    8065        self
    8066    }
    8067
    8068    /// Sets the value of [schema][crate::model::CommitSchemaRequest::schema].
    8069    ///
    8070    /// # Example
    8071    /// ```ignore,no_run
    8072    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
    8073    /// use google_cloud_pubsub::model::Schema;
    8074    /// let x = CommitSchemaRequest::new().set_schema(Schema::default()/* use setters */);
    8075    /// ```
    8076    pub fn set_schema<T>(mut self, v: T) -> Self
    8077    where
    8078        T: std::convert::Into<crate::model::Schema>,
    8079    {
    8080        self.schema = std::option::Option::Some(v.into());
    8081        self
    8082    }
    8083
    8084    /// Sets or clears the value of [schema][crate::model::CommitSchemaRequest::schema].
    8085    ///
    8086    /// # Example
    8087    /// ```ignore,no_run
    8088    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
    8089    /// use google_cloud_pubsub::model::Schema;
    8090    /// let x = CommitSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
    8091    /// let x = CommitSchemaRequest::new().set_or_clear_schema(None::<Schema>);
    8092    /// ```
    8093    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
    8094    where
    8095        T: std::convert::Into<crate::model::Schema>,
    8096    {
    8097        self.schema = v.map(|x| x.into());
    8098        self
    8099    }
    8100}
    8101
    8102impl wkt::message::Message for CommitSchemaRequest {
    8103    fn typename() -> &'static str {
    8104        "type.googleapis.com/google.pubsub.v1.CommitSchemaRequest"
    8105    }
    8106}
    8107
    8108/// Request for the `RollbackSchema` method.
    8109#[derive(Clone, Default, PartialEq)]
    8110#[non_exhaustive]
    8111pub struct RollbackSchemaRequest {
    8112    /// Required. The schema being rolled back with revision id.
    8113    pub name: std::string::String,
    8114
    8115    /// Required. The revision ID to roll back to.
    8116    /// It must be a revision of the same schema.
    8117    ///
    8118    /// Example: c7cfa2a8
    8119    pub revision_id: std::string::String,
    8120
    8121    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8122}
    8123
    8124impl RollbackSchemaRequest {
    8125    pub fn new() -> Self {
    8126        std::default::Default::default()
    8127    }
    8128
    8129    /// Sets the value of [name][crate::model::RollbackSchemaRequest::name].
    8130    ///
    8131    /// # Example
    8132    /// ```ignore,no_run
    8133    /// # use google_cloud_pubsub::model::RollbackSchemaRequest;
    8134    /// let x = RollbackSchemaRequest::new().set_name("example");
    8135    /// ```
    8136    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8137        self.name = v.into();
    8138        self
    8139    }
    8140
    8141    /// Sets the value of [revision_id][crate::model::RollbackSchemaRequest::revision_id].
    8142    ///
    8143    /// # Example
    8144    /// ```ignore,no_run
    8145    /// # use google_cloud_pubsub::model::RollbackSchemaRequest;
    8146    /// let x = RollbackSchemaRequest::new().set_revision_id("example");
    8147    /// ```
    8148    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8149        self.revision_id = v.into();
    8150        self
    8151    }
    8152}
    8153
    8154impl wkt::message::Message for RollbackSchemaRequest {
    8155    fn typename() -> &'static str {
    8156        "type.googleapis.com/google.pubsub.v1.RollbackSchemaRequest"
    8157    }
    8158}
    8159
    8160/// Request for the `DeleteSchemaRevision` method.
    8161#[derive(Clone, Default, PartialEq)]
    8162#[non_exhaustive]
    8163pub struct DeleteSchemaRevisionRequest {
    8164    /// Required. The name of the schema revision to be deleted, with a revision ID
    8165    /// explicitly included.
    8166    ///
    8167    /// Example: `projects/123/schemas/my-schema@c7cfa2a8`
    8168    pub name: std::string::String,
    8169
    8170    /// Optional. This field is deprecated and should not be used for specifying
    8171    /// the revision ID. The revision ID should be specified via the `name`
    8172    /// parameter.
    8173    #[deprecated]
    8174    pub revision_id: std::string::String,
    8175
    8176    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8177}
    8178
    8179impl DeleteSchemaRevisionRequest {
    8180    pub fn new() -> Self {
    8181        std::default::Default::default()
    8182    }
    8183
    8184    /// Sets the value of [name][crate::model::DeleteSchemaRevisionRequest::name].
    8185    ///
    8186    /// # Example
    8187    /// ```ignore,no_run
    8188    /// # use google_cloud_pubsub::model::DeleteSchemaRevisionRequest;
    8189    /// let x = DeleteSchemaRevisionRequest::new().set_name("example");
    8190    /// ```
    8191    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8192        self.name = v.into();
    8193        self
    8194    }
    8195
    8196    /// Sets the value of [revision_id][crate::model::DeleteSchemaRevisionRequest::revision_id].
    8197    ///
    8198    /// # Example
    8199    /// ```ignore,no_run
    8200    /// # use google_cloud_pubsub::model::DeleteSchemaRevisionRequest;
    8201    /// let x = DeleteSchemaRevisionRequest::new().set_revision_id("example");
    8202    /// ```
    8203    #[deprecated]
    8204    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8205        self.revision_id = v.into();
    8206        self
    8207    }
    8208}
    8209
    8210impl wkt::message::Message for DeleteSchemaRevisionRequest {
    8211    fn typename() -> &'static str {
    8212        "type.googleapis.com/google.pubsub.v1.DeleteSchemaRevisionRequest"
    8213    }
    8214}
    8215
    8216/// Request for the `DeleteSchema` method.
    8217#[derive(Clone, Default, PartialEq)]
    8218#[non_exhaustive]
    8219pub struct DeleteSchemaRequest {
    8220    /// Required. Name of the schema to delete.
    8221    /// Format is `projects/{project}/schemas/{schema}`.
    8222    pub name: std::string::String,
    8223
    8224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8225}
    8226
    8227impl DeleteSchemaRequest {
    8228    pub fn new() -> Self {
    8229        std::default::Default::default()
    8230    }
    8231
    8232    /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
    8233    ///
    8234    /// # Example
    8235    /// ```ignore,no_run
    8236    /// # use google_cloud_pubsub::model::DeleteSchemaRequest;
    8237    /// let x = DeleteSchemaRequest::new().set_name("example");
    8238    /// ```
    8239    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8240        self.name = v.into();
    8241        self
    8242    }
    8243}
    8244
    8245impl wkt::message::Message for DeleteSchemaRequest {
    8246    fn typename() -> &'static str {
    8247        "type.googleapis.com/google.pubsub.v1.DeleteSchemaRequest"
    8248    }
    8249}
    8250
    8251/// Request for the `ValidateSchema` method.
    8252#[derive(Clone, Default, PartialEq)]
    8253#[non_exhaustive]
    8254pub struct ValidateSchemaRequest {
    8255    /// Required. The name of the project in which to validate schemas.
    8256    /// Format is `projects/{project-id}`.
    8257    pub parent: std::string::String,
    8258
    8259    /// Required. The schema object to validate.
    8260    pub schema: std::option::Option<crate::model::Schema>,
    8261
    8262    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8263}
    8264
    8265impl ValidateSchemaRequest {
    8266    pub fn new() -> Self {
    8267        std::default::Default::default()
    8268    }
    8269
    8270    /// Sets the value of [parent][crate::model::ValidateSchemaRequest::parent].
    8271    ///
    8272    /// # Example
    8273    /// ```ignore,no_run
    8274    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
    8275    /// let x = ValidateSchemaRequest::new().set_parent("example");
    8276    /// ```
    8277    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8278        self.parent = v.into();
    8279        self
    8280    }
    8281
    8282    /// Sets the value of [schema][crate::model::ValidateSchemaRequest::schema].
    8283    ///
    8284    /// # Example
    8285    /// ```ignore,no_run
    8286    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
    8287    /// use google_cloud_pubsub::model::Schema;
    8288    /// let x = ValidateSchemaRequest::new().set_schema(Schema::default()/* use setters */);
    8289    /// ```
    8290    pub fn set_schema<T>(mut self, v: T) -> Self
    8291    where
    8292        T: std::convert::Into<crate::model::Schema>,
    8293    {
    8294        self.schema = std::option::Option::Some(v.into());
    8295        self
    8296    }
    8297
    8298    /// Sets or clears the value of [schema][crate::model::ValidateSchemaRequest::schema].
    8299    ///
    8300    /// # Example
    8301    /// ```ignore,no_run
    8302    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
    8303    /// use google_cloud_pubsub::model::Schema;
    8304    /// let x = ValidateSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
    8305    /// let x = ValidateSchemaRequest::new().set_or_clear_schema(None::<Schema>);
    8306    /// ```
    8307    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
    8308    where
    8309        T: std::convert::Into<crate::model::Schema>,
    8310    {
    8311        self.schema = v.map(|x| x.into());
    8312        self
    8313    }
    8314}
    8315
    8316impl wkt::message::Message for ValidateSchemaRequest {
    8317    fn typename() -> &'static str {
    8318        "type.googleapis.com/google.pubsub.v1.ValidateSchemaRequest"
    8319    }
    8320}
    8321
    8322/// Response for the `ValidateSchema` method.
    8323/// Empty for now.
    8324#[derive(Clone, Default, PartialEq)]
    8325#[non_exhaustive]
    8326pub struct ValidateSchemaResponse {
    8327    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8328}
    8329
    8330impl ValidateSchemaResponse {
    8331    pub fn new() -> Self {
    8332        std::default::Default::default()
    8333    }
    8334}
    8335
    8336impl wkt::message::Message for ValidateSchemaResponse {
    8337    fn typename() -> &'static str {
    8338        "type.googleapis.com/google.pubsub.v1.ValidateSchemaResponse"
    8339    }
    8340}
    8341
    8342/// Request for the `ValidateMessage` method.
    8343#[derive(Clone, Default, PartialEq)]
    8344#[non_exhaustive]
    8345pub struct ValidateMessageRequest {
    8346    /// Required. The name of the project in which to validate schemas.
    8347    /// Format is `projects/{project-id}`.
    8348    pub parent: std::string::String,
    8349
    8350    /// Message to validate against the provided `schema_spec`.
    8351    pub message: ::bytes::Bytes,
    8352
    8353    /// The encoding expected for messages
    8354    pub encoding: crate::model::Encoding,
    8355
    8356    pub schema_spec: std::option::Option<crate::model::validate_message_request::SchemaSpec>,
    8357
    8358    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8359}
    8360
    8361impl ValidateMessageRequest {
    8362    pub fn new() -> Self {
    8363        std::default::Default::default()
    8364    }
    8365
    8366    /// Sets the value of [parent][crate::model::ValidateMessageRequest::parent].
    8367    ///
    8368    /// # Example
    8369    /// ```ignore,no_run
    8370    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8371    /// let x = ValidateMessageRequest::new().set_parent("example");
    8372    /// ```
    8373    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8374        self.parent = v.into();
    8375        self
    8376    }
    8377
    8378    /// Sets the value of [message][crate::model::ValidateMessageRequest::message].
    8379    ///
    8380    /// # Example
    8381    /// ```ignore,no_run
    8382    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8383    /// let x = ValidateMessageRequest::new().set_message(bytes::Bytes::from_static(b"example"));
    8384    /// ```
    8385    pub fn set_message<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
    8386        self.message = v.into();
    8387        self
    8388    }
    8389
    8390    /// Sets the value of [encoding][crate::model::ValidateMessageRequest::encoding].
    8391    ///
    8392    /// # Example
    8393    /// ```ignore,no_run
    8394    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8395    /// use google_cloud_pubsub::model::Encoding;
    8396    /// let x0 = ValidateMessageRequest::new().set_encoding(Encoding::Json);
    8397    /// let x1 = ValidateMessageRequest::new().set_encoding(Encoding::Binary);
    8398    /// ```
    8399    pub fn set_encoding<T: std::convert::Into<crate::model::Encoding>>(mut self, v: T) -> Self {
    8400        self.encoding = v.into();
    8401        self
    8402    }
    8403
    8404    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec].
    8405    ///
    8406    /// Note that all the setters affecting `schema_spec` are mutually
    8407    /// exclusive.
    8408    ///
    8409    /// # Example
    8410    /// ```ignore,no_run
    8411    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8412    /// use google_cloud_pubsub::model::validate_message_request::SchemaSpec;
    8413    /// let x = ValidateMessageRequest::new().set_schema_spec(Some(SchemaSpec::Name("example".to_string())));
    8414    /// ```
    8415    pub fn set_schema_spec<
    8416        T: std::convert::Into<std::option::Option<crate::model::validate_message_request::SchemaSpec>>,
    8417    >(
    8418        mut self,
    8419        v: T,
    8420    ) -> Self {
    8421        self.schema_spec = v.into();
    8422        self
    8423    }
    8424
    8425    /// The value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
    8426    /// if it holds a `Name`, `None` if the field is not set or
    8427    /// holds a different branch.
    8428    pub fn name(&self) -> std::option::Option<&std::string::String> {
    8429        #[allow(unreachable_patterns)]
    8430        self.schema_spec.as_ref().and_then(|v| match v {
    8431            crate::model::validate_message_request::SchemaSpec::Name(v) => {
    8432                std::option::Option::Some(v)
    8433            }
    8434            _ => std::option::Option::None,
    8435        })
    8436    }
    8437
    8438    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
    8439    /// to hold a `Name`.
    8440    ///
    8441    /// Note that all the setters affecting `schema_spec` are
    8442    /// mutually exclusive.
    8443    ///
    8444    /// # Example
    8445    /// ```ignore,no_run
    8446    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8447    /// let x = ValidateMessageRequest::new().set_name("example");
    8448    /// assert!(x.name().is_some());
    8449    /// assert!(x.schema().is_none());
    8450    /// ```
    8451    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
    8452        self.schema_spec = std::option::Option::Some(
    8453            crate::model::validate_message_request::SchemaSpec::Name(v.into()),
    8454        );
    8455        self
    8456    }
    8457
    8458    /// The value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
    8459    /// if it holds a `Schema`, `None` if the field is not set or
    8460    /// holds a different branch.
    8461    pub fn schema(&self) -> std::option::Option<&std::boxed::Box<crate::model::Schema>> {
    8462        #[allow(unreachable_patterns)]
    8463        self.schema_spec.as_ref().and_then(|v| match v {
    8464            crate::model::validate_message_request::SchemaSpec::Schema(v) => {
    8465                std::option::Option::Some(v)
    8466            }
    8467            _ => std::option::Option::None,
    8468        })
    8469    }
    8470
    8471    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
    8472    /// to hold a `Schema`.
    8473    ///
    8474    /// Note that all the setters affecting `schema_spec` are
    8475    /// mutually exclusive.
    8476    ///
    8477    /// # Example
    8478    /// ```ignore,no_run
    8479    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
    8480    /// use google_cloud_pubsub::model::Schema;
    8481    /// let x = ValidateMessageRequest::new().set_schema(Schema::default()/* use setters */);
    8482    /// assert!(x.schema().is_some());
    8483    /// assert!(x.name().is_none());
    8484    /// ```
    8485    pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
    8486        mut self,
    8487        v: T,
    8488    ) -> Self {
    8489        self.schema_spec = std::option::Option::Some(
    8490            crate::model::validate_message_request::SchemaSpec::Schema(v.into()),
    8491        );
    8492        self
    8493    }
    8494}
    8495
    8496impl wkt::message::Message for ValidateMessageRequest {
    8497    fn typename() -> &'static str {
    8498        "type.googleapis.com/google.pubsub.v1.ValidateMessageRequest"
    8499    }
    8500}
    8501
    8502/// Defines additional types related to [ValidateMessageRequest].
    8503pub mod validate_message_request {
    8504    #[allow(unused_imports)]
    8505    use super::*;
    8506
    8507    #[derive(Clone, Debug, PartialEq)]
    8508    #[non_exhaustive]
    8509    pub enum SchemaSpec {
    8510        /// Name of the schema against which to validate.
    8511        ///
    8512        /// Format is `projects/{project}/schemas/{schema}`.
    8513        Name(std::string::String),
    8514        /// Ad-hoc schema against which to validate
    8515        Schema(std::boxed::Box<crate::model::Schema>),
    8516    }
    8517}
    8518
    8519/// Response for the `ValidateMessage` method.
    8520/// Empty for now.
    8521#[derive(Clone, Default, PartialEq)]
    8522#[non_exhaustive]
    8523pub struct ValidateMessageResponse {
    8524    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    8525}
    8526
    8527impl ValidateMessageResponse {
    8528    pub fn new() -> Self {
    8529        std::default::Default::default()
    8530    }
    8531}
    8532
    8533impl wkt::message::Message for ValidateMessageResponse {
    8534    fn typename() -> &'static str {
    8535        "type.googleapis.com/google.pubsub.v1.ValidateMessageResponse"
    8536    }
    8537}
    8538
    8539/// View of Schema object fields to be returned by GetSchema and ListSchemas.
    8540///
    8541/// # Working with unknown values
    8542///
    8543/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    8544/// additional enum variants at any time. Adding new variants is not considered
    8545/// a breaking change. Applications should write their code in anticipation of:
    8546///
    8547/// - New values appearing in future releases of the client library, **and**
    8548/// - New values received dynamically, without application changes.
    8549///
    8550/// Please consult the [Working with enums] section in the user guide for some
    8551/// guidelines.
    8552///
    8553/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    8554#[derive(Clone, Debug, PartialEq)]
    8555#[non_exhaustive]
    8556pub enum SchemaView {
    8557    /// The default / unset value.
    8558    /// The API will default to the BASIC view.
    8559    Unspecified,
    8560    /// Include the name and type of the schema, but not the definition.
    8561    Basic,
    8562    /// Include all Schema object fields.
    8563    Full,
    8564    /// If set, the enum was initialized with an unknown value.
    8565    ///
    8566    /// Applications can examine the value using [SchemaView::value] or
    8567    /// [SchemaView::name].
    8568    UnknownValue(schema_view::UnknownValue),
    8569}
    8570
    8571#[doc(hidden)]
    8572pub mod schema_view {
    8573    #[allow(unused_imports)]
    8574    use super::*;
    8575    #[derive(Clone, Debug, PartialEq)]
    8576    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    8577}
    8578
    8579impl SchemaView {
    8580    /// Gets the enum value.
    8581    ///
    8582    /// Returns `None` if the enum contains an unknown value deserialized from
    8583    /// the string representation of enums.
    8584    pub fn value(&self) -> std::option::Option<i32> {
    8585        match self {
    8586            Self::Unspecified => std::option::Option::Some(0),
    8587            Self::Basic => std::option::Option::Some(1),
    8588            Self::Full => std::option::Option::Some(2),
    8589            Self::UnknownValue(u) => u.0.value(),
    8590        }
    8591    }
    8592
    8593    /// Gets the enum value as a string.
    8594    ///
    8595    /// Returns `None` if the enum contains an unknown value deserialized from
    8596    /// the integer representation of enums.
    8597    pub fn name(&self) -> std::option::Option<&str> {
    8598        match self {
    8599            Self::Unspecified => std::option::Option::Some("SCHEMA_VIEW_UNSPECIFIED"),
    8600            Self::Basic => std::option::Option::Some("BASIC"),
    8601            Self::Full => std::option::Option::Some("FULL"),
    8602            Self::UnknownValue(u) => u.0.name(),
    8603        }
    8604    }
    8605}
    8606
    8607impl std::default::Default for SchemaView {
    8608    fn default() -> Self {
    8609        use std::convert::From;
    8610        Self::from(0)
    8611    }
    8612}
    8613
    8614impl std::fmt::Display for SchemaView {
    8615    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    8616        wkt::internal::display_enum(f, self.name(), self.value())
    8617    }
    8618}
    8619
    8620impl std::convert::From<i32> for SchemaView {
    8621    fn from(value: i32) -> Self {
    8622        match value {
    8623            0 => Self::Unspecified,
    8624            1 => Self::Basic,
    8625            2 => Self::Full,
    8626            _ => Self::UnknownValue(schema_view::UnknownValue(
    8627                wkt::internal::UnknownEnumValue::Integer(value),
    8628            )),
    8629        }
    8630    }
    8631}
    8632
    8633impl std::convert::From<&str> for SchemaView {
    8634    fn from(value: &str) -> Self {
    8635        use std::string::ToString;
    8636        match value {
    8637            "SCHEMA_VIEW_UNSPECIFIED" => Self::Unspecified,
    8638            "BASIC" => Self::Basic,
    8639            "FULL" => Self::Full,
    8640            _ => Self::UnknownValue(schema_view::UnknownValue(
    8641                wkt::internal::UnknownEnumValue::String(value.to_string()),
    8642            )),
    8643        }
    8644    }
    8645}
    8646
    8647impl serde::ser::Serialize for SchemaView {
    8648    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    8649    where
    8650        S: serde::Serializer,
    8651    {
    8652        match self {
    8653            Self::Unspecified => serializer.serialize_i32(0),
    8654            Self::Basic => serializer.serialize_i32(1),
    8655            Self::Full => serializer.serialize_i32(2),
    8656            Self::UnknownValue(u) => u.0.serialize(serializer),
    8657        }
    8658    }
    8659}
    8660
    8661impl<'de> serde::de::Deserialize<'de> for SchemaView {
    8662    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    8663    where
    8664        D: serde::Deserializer<'de>,
    8665    {
    8666        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SchemaView>::new(
    8667            ".google.pubsub.v1.SchemaView",
    8668        ))
    8669    }
    8670}
    8671
    8672/// Possible encoding types for messages.
    8673///
    8674/// # Working with unknown values
    8675///
    8676/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    8677/// additional enum variants at any time. Adding new variants is not considered
    8678/// a breaking change. Applications should write their code in anticipation of:
    8679///
    8680/// - New values appearing in future releases of the client library, **and**
    8681/// - New values received dynamically, without application changes.
    8682///
    8683/// Please consult the [Working with enums] section in the user guide for some
    8684/// guidelines.
    8685///
    8686/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    8687#[derive(Clone, Debug, PartialEq)]
    8688#[non_exhaustive]
    8689pub enum Encoding {
    8690    /// Unspecified
    8691    Unspecified,
    8692    /// JSON encoding
    8693    Json,
    8694    /// Binary encoding, as defined by the schema type. For some schema types,
    8695    /// binary encoding may not be available.
    8696    Binary,
    8697    /// If set, the enum was initialized with an unknown value.
    8698    ///
    8699    /// Applications can examine the value using [Encoding::value] or
    8700    /// [Encoding::name].
    8701    UnknownValue(encoding::UnknownValue),
    8702}
    8703
    8704#[doc(hidden)]
    8705pub mod encoding {
    8706    #[allow(unused_imports)]
    8707    use super::*;
    8708    #[derive(Clone, Debug, PartialEq)]
    8709    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    8710}
    8711
    8712impl Encoding {
    8713    /// Gets the enum value.
    8714    ///
    8715    /// Returns `None` if the enum contains an unknown value deserialized from
    8716    /// the string representation of enums.
    8717    pub fn value(&self) -> std::option::Option<i32> {
    8718        match self {
    8719            Self::Unspecified => std::option::Option::Some(0),
    8720            Self::Json => std::option::Option::Some(1),
    8721            Self::Binary => std::option::Option::Some(2),
    8722            Self::UnknownValue(u) => u.0.value(),
    8723        }
    8724    }
    8725
    8726    /// Gets the enum value as a string.
    8727    ///
    8728    /// Returns `None` if the enum contains an unknown value deserialized from
    8729    /// the integer representation of enums.
    8730    pub fn name(&self) -> std::option::Option<&str> {
    8731        match self {
    8732            Self::Unspecified => std::option::Option::Some("ENCODING_UNSPECIFIED"),
    8733            Self::Json => std::option::Option::Some("JSON"),
    8734            Self::Binary => std::option::Option::Some("BINARY"),
    8735            Self::UnknownValue(u) => u.0.name(),
    8736        }
    8737    }
    8738}
    8739
    8740impl std::default::Default for Encoding {
    8741    fn default() -> Self {
    8742        use std::convert::From;
    8743        Self::from(0)
    8744    }
    8745}
    8746
    8747impl std::fmt::Display for Encoding {
    8748    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
    8749        wkt::internal::display_enum(f, self.name(), self.value())
    8750    }
    8751}
    8752
    8753impl std::convert::From<i32> for Encoding {
    8754    fn from(value: i32) -> Self {
    8755        match value {
    8756            0 => Self::Unspecified,
    8757            1 => Self::Json,
    8758            2 => Self::Binary,
    8759            _ => Self::UnknownValue(encoding::UnknownValue(
    8760                wkt::internal::UnknownEnumValue::Integer(value),
    8761            )),
    8762        }
    8763    }
    8764}
    8765
    8766impl std::convert::From<&str> for Encoding {
    8767    fn from(value: &str) -> Self {
    8768        use std::string::ToString;
    8769        match value {
    8770            "ENCODING_UNSPECIFIED" => Self::Unspecified,
    8771            "JSON" => Self::Json,
    8772            "BINARY" => Self::Binary,
    8773            _ => Self::UnknownValue(encoding::UnknownValue(
    8774                wkt::internal::UnknownEnumValue::String(value.to_string()),
    8775            )),
    8776        }
    8777    }
    8778}
    8779
    8780impl serde::ser::Serialize for Encoding {
    8781    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    8782    where
    8783        S: serde::Serializer,
    8784    {
    8785        match self {
    8786            Self::Unspecified => serializer.serialize_i32(0),
    8787            Self::Json => serializer.serialize_i32(1),
    8788            Self::Binary => serializer.serialize_i32(2),
    8789            Self::UnknownValue(u) => u.0.serialize(serializer),
    8790        }
    8791    }
    8792}
    8793
    8794impl<'de> serde::de::Deserialize<'de> for Encoding {
    8795    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    8796    where
    8797        D: serde::Deserializer<'de>,
    8798    {
    8799        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Encoding>::new(
    8800            ".google.pubsub.v1.Encoding",
    8801        ))
    8802    }
    8803}