Skip to main content

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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22mod debug;
23mod deserialize;
24mod serialize;
25
26/// A policy constraining the storage of messages published to the topic.
27#[derive(Clone, Default, PartialEq)]
28#[non_exhaustive]
29pub struct MessageStoragePolicy {
30    /// Optional. A list of IDs of Google Cloud regions where messages that are
31    /// published to the topic may be persisted in storage. Messages published by
32    /// publishers running in non-allowed Google Cloud regions (or running outside
33    /// of Google Cloud altogether) are routed for storage in one of the allowed
34    /// regions. An empty list means that no regions are allowed, and is not a
35    /// valid configuration.
36    pub allowed_persistence_regions: std::vec::Vec<std::string::String>,
37
38    /// Optional. If true, `allowed_persistence_regions` is also used to enforce
39    /// in-transit guarantees for messages. That is, Pub/Sub will fail
40    /// Publish operations on this topic and subscribe operations
41    /// on any subscription attached to this topic in any region that is
42    /// not in `allowed_persistence_regions`.
43    pub enforce_in_transit: bool,
44
45    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
46}
47
48impl MessageStoragePolicy {
49    /// Creates a new default instance.
50    pub fn new() -> Self {
51        std::default::Default::default()
52    }
53
54    /// Sets the value of [allowed_persistence_regions][crate::model::MessageStoragePolicy::allowed_persistence_regions].
55    ///
56    /// # Example
57    /// ```ignore,no_run
58    /// # use google_cloud_pubsub::model::MessageStoragePolicy;
59    /// let x = MessageStoragePolicy::new().set_allowed_persistence_regions(["a", "b", "c"]);
60    /// ```
61    pub fn set_allowed_persistence_regions<T, V>(mut self, v: T) -> Self
62    where
63        T: std::iter::IntoIterator<Item = V>,
64        V: std::convert::Into<std::string::String>,
65    {
66        use std::iter::Iterator;
67        self.allowed_persistence_regions = v.into_iter().map(|i| i.into()).collect();
68        self
69    }
70
71    /// Sets the value of [enforce_in_transit][crate::model::MessageStoragePolicy::enforce_in_transit].
72    ///
73    /// # Example
74    /// ```ignore,no_run
75    /// # use google_cloud_pubsub::model::MessageStoragePolicy;
76    /// let x = MessageStoragePolicy::new().set_enforce_in_transit(true);
77    /// ```
78    pub fn set_enforce_in_transit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
79        self.enforce_in_transit = v.into();
80        self
81    }
82}
83
84impl wkt::message::Message for MessageStoragePolicy {
85    fn typename() -> &'static str {
86        "type.googleapis.com/google.pubsub.v1.MessageStoragePolicy"
87    }
88}
89
90/// Settings for validating messages published against a schema.
91#[derive(Clone, Default, PartialEq)]
92#[non_exhaustive]
93pub struct SchemaSettings {
94    /// Required. The name of the schema that messages published should be
95    /// validated against. Format is `projects/{project}/schemas/{schema}`. The
96    /// value of this field will be `_deleted-schema_` if the schema has been
97    /// deleted.
98    pub schema: std::string::String,
99
100    /// Optional. The encoding of messages validated against `schema`.
101    pub encoding: crate::model::Encoding,
102
103    /// Optional. The minimum (inclusive) revision allowed for validating messages.
104    /// If empty or not present, allow any revision to be validated against
105    /// last_revision or any revision created before.
106    pub first_revision_id: std::string::String,
107
108    /// Optional. The maximum (inclusive) revision allowed for validating messages.
109    /// If empty or not present, allow any revision to be validated against
110    /// first_revision or any revision created after.
111    pub last_revision_id: std::string::String,
112
113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
114}
115
116impl SchemaSettings {
117    /// Creates a new default instance.
118    pub fn new() -> Self {
119        std::default::Default::default()
120    }
121
122    /// Sets the value of [schema][crate::model::SchemaSettings::schema].
123    ///
124    /// # Example
125    /// ```ignore,no_run
126    /// # use google_cloud_pubsub::model::SchemaSettings;
127    /// # let project_id = "project_id";
128    /// # let schema_id = "schema_id";
129    /// let x = SchemaSettings::new().set_schema(format!("projects/{project_id}/schemas/{schema_id}"));
130    /// ```
131    pub fn set_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
132        self.schema = v.into();
133        self
134    }
135
136    /// Sets the value of [encoding][crate::model::SchemaSettings::encoding].
137    ///
138    /// # Example
139    /// ```ignore,no_run
140    /// # use google_cloud_pubsub::model::SchemaSettings;
141    /// use google_cloud_pubsub::model::Encoding;
142    /// let x0 = SchemaSettings::new().set_encoding(Encoding::Json);
143    /// let x1 = SchemaSettings::new().set_encoding(Encoding::Binary);
144    /// ```
145    pub fn set_encoding<T: std::convert::Into<crate::model::Encoding>>(mut self, v: T) -> Self {
146        self.encoding = v.into();
147        self
148    }
149
150    /// Sets the value of [first_revision_id][crate::model::SchemaSettings::first_revision_id].
151    ///
152    /// # Example
153    /// ```ignore,no_run
154    /// # use google_cloud_pubsub::model::SchemaSettings;
155    /// let x = SchemaSettings::new().set_first_revision_id("example");
156    /// ```
157    pub fn set_first_revision_id<T: std::convert::Into<std::string::String>>(
158        mut self,
159        v: T,
160    ) -> Self {
161        self.first_revision_id = v.into();
162        self
163    }
164
165    /// Sets the value of [last_revision_id][crate::model::SchemaSettings::last_revision_id].
166    ///
167    /// # Example
168    /// ```ignore,no_run
169    /// # use google_cloud_pubsub::model::SchemaSettings;
170    /// let x = SchemaSettings::new().set_last_revision_id("example");
171    /// ```
172    pub fn set_last_revision_id<T: std::convert::Into<std::string::String>>(
173        mut self,
174        v: T,
175    ) -> Self {
176        self.last_revision_id = v.into();
177        self
178    }
179}
180
181impl wkt::message::Message for SchemaSettings {
182    fn typename() -> &'static str {
183        "type.googleapis.com/google.pubsub.v1.SchemaSettings"
184    }
185}
186
187/// Settings for an ingestion data source on a topic.
188#[derive(Clone, Default, PartialEq)]
189#[non_exhaustive]
190pub struct IngestionDataSourceSettings {
191    /// Optional. Platform Logs settings. If unset, no Platform Logs will be
192    /// generated.
193    pub platform_logs_settings: std::option::Option<crate::model::PlatformLogsSettings>,
194
195    /// Only one source type can have settings set.
196    pub source: std::option::Option<crate::model::ingestion_data_source_settings::Source>,
197
198    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
199}
200
201impl IngestionDataSourceSettings {
202    /// Creates a new default instance.
203    pub fn new() -> Self {
204        std::default::Default::default()
205    }
206
207    /// Sets the value of [platform_logs_settings][crate::model::IngestionDataSourceSettings::platform_logs_settings].
208    ///
209    /// # Example
210    /// ```ignore,no_run
211    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
212    /// use google_cloud_pubsub::model::PlatformLogsSettings;
213    /// let x = IngestionDataSourceSettings::new().set_platform_logs_settings(PlatformLogsSettings::default()/* use setters */);
214    /// ```
215    pub fn set_platform_logs_settings<T>(mut self, v: T) -> Self
216    where
217        T: std::convert::Into<crate::model::PlatformLogsSettings>,
218    {
219        self.platform_logs_settings = std::option::Option::Some(v.into());
220        self
221    }
222
223    /// Sets or clears the value of [platform_logs_settings][crate::model::IngestionDataSourceSettings::platform_logs_settings].
224    ///
225    /// # Example
226    /// ```ignore,no_run
227    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
228    /// use google_cloud_pubsub::model::PlatformLogsSettings;
229    /// let x = IngestionDataSourceSettings::new().set_or_clear_platform_logs_settings(Some(PlatformLogsSettings::default()/* use setters */));
230    /// let x = IngestionDataSourceSettings::new().set_or_clear_platform_logs_settings(None::<PlatformLogsSettings>);
231    /// ```
232    pub fn set_or_clear_platform_logs_settings<T>(mut self, v: std::option::Option<T>) -> Self
233    where
234        T: std::convert::Into<crate::model::PlatformLogsSettings>,
235    {
236        self.platform_logs_settings = v.map(|x| x.into());
237        self
238    }
239
240    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source].
241    ///
242    /// Note that all the setters affecting `source` are mutually
243    /// exclusive.
244    ///
245    /// # Example
246    /// ```ignore,no_run
247    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
248    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
249    /// let x = IngestionDataSourceSettings::new().set_source(Some(
250    ///     google_cloud_pubsub::model::ingestion_data_source_settings::Source::AwsKinesis(AwsKinesis::default().into())));
251    /// ```
252    pub fn set_source<
253        T: std::convert::Into<
254                std::option::Option<crate::model::ingestion_data_source_settings::Source>,
255            >,
256    >(
257        mut self,
258        v: T,
259    ) -> Self {
260        self.source = v.into();
261        self
262    }
263
264    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
265    /// if it holds a `AwsKinesis`, `None` if the field is not set or
266    /// holds a different branch.
267    pub fn aws_kinesis(
268        &self,
269    ) -> std::option::Option<
270        &std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>,
271    > {
272        #[allow(unreachable_patterns)]
273        self.source.as_ref().and_then(|v| match v {
274            crate::model::ingestion_data_source_settings::Source::AwsKinesis(v) => {
275                std::option::Option::Some(v)
276            }
277            _ => std::option::Option::None,
278        })
279    }
280
281    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
282    /// to hold a `AwsKinesis`.
283    ///
284    /// Note that all the setters affecting `source` are
285    /// mutually exclusive.
286    ///
287    /// # Example
288    /// ```ignore,no_run
289    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
290    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
291    /// let x = IngestionDataSourceSettings::new().set_aws_kinesis(AwsKinesis::default()/* use setters */);
292    /// assert!(x.aws_kinesis().is_some());
293    /// assert!(x.cloud_storage().is_none());
294    /// assert!(x.azure_event_hubs().is_none());
295    /// assert!(x.aws_msk().is_none());
296    /// assert!(x.confluent_cloud().is_none());
297    /// ```
298    pub fn set_aws_kinesis<
299        T: std::convert::Into<
300                std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>,
301            >,
302    >(
303        mut self,
304        v: T,
305    ) -> Self {
306        self.source = std::option::Option::Some(
307            crate::model::ingestion_data_source_settings::Source::AwsKinesis(v.into()),
308        );
309        self
310    }
311
312    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
313    /// if it holds a `CloudStorage`, `None` if the field is not set or
314    /// holds a different branch.
315    pub fn cloud_storage(
316        &self,
317    ) -> std::option::Option<
318        &std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>,
319    > {
320        #[allow(unreachable_patterns)]
321        self.source.as_ref().and_then(|v| match v {
322            crate::model::ingestion_data_source_settings::Source::CloudStorage(v) => {
323                std::option::Option::Some(v)
324            }
325            _ => std::option::Option::None,
326        })
327    }
328
329    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
330    /// to hold a `CloudStorage`.
331    ///
332    /// Note that all the setters affecting `source` are
333    /// mutually exclusive.
334    ///
335    /// # Example
336    /// ```ignore,no_run
337    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
338    /// use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
339    /// let x = IngestionDataSourceSettings::new().set_cloud_storage(CloudStorage::default()/* use setters */);
340    /// assert!(x.cloud_storage().is_some());
341    /// assert!(x.aws_kinesis().is_none());
342    /// assert!(x.azure_event_hubs().is_none());
343    /// assert!(x.aws_msk().is_none());
344    /// assert!(x.confluent_cloud().is_none());
345    /// ```
346    pub fn set_cloud_storage<
347        T: std::convert::Into<
348                std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>,
349            >,
350    >(
351        mut self,
352        v: T,
353    ) -> Self {
354        self.source = std::option::Option::Some(
355            crate::model::ingestion_data_source_settings::Source::CloudStorage(v.into()),
356        );
357        self
358    }
359
360    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
361    /// if it holds a `AzureEventHubs`, `None` if the field is not set or
362    /// holds a different branch.
363    pub fn azure_event_hubs(
364        &self,
365    ) -> std::option::Option<
366        &std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
367    > {
368        #[allow(unreachable_patterns)]
369        self.source.as_ref().and_then(|v| match v {
370            crate::model::ingestion_data_source_settings::Source::AzureEventHubs(v) => {
371                std::option::Option::Some(v)
372            }
373            _ => std::option::Option::None,
374        })
375    }
376
377    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
378    /// to hold a `AzureEventHubs`.
379    ///
380    /// Note that all the setters affecting `source` are
381    /// mutually exclusive.
382    ///
383    /// # Example
384    /// ```ignore,no_run
385    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
386    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
387    /// let x = IngestionDataSourceSettings::new().set_azure_event_hubs(AzureEventHubs::default()/* use setters */);
388    /// assert!(x.azure_event_hubs().is_some());
389    /// assert!(x.aws_kinesis().is_none());
390    /// assert!(x.cloud_storage().is_none());
391    /// assert!(x.aws_msk().is_none());
392    /// assert!(x.confluent_cloud().is_none());
393    /// ```
394    pub fn set_azure_event_hubs<
395        T: std::convert::Into<
396                std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
397            >,
398    >(
399        mut self,
400        v: T,
401    ) -> Self {
402        self.source = std::option::Option::Some(
403            crate::model::ingestion_data_source_settings::Source::AzureEventHubs(v.into()),
404        );
405        self
406    }
407
408    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
409    /// if it holds a `AwsMsk`, `None` if the field is not set or
410    /// holds a different branch.
411    pub fn aws_msk(
412        &self,
413    ) -> std::option::Option<&std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>>
414    {
415        #[allow(unreachable_patterns)]
416        self.source.as_ref().and_then(|v| match v {
417            crate::model::ingestion_data_source_settings::Source::AwsMsk(v) => {
418                std::option::Option::Some(v)
419            }
420            _ => std::option::Option::None,
421        })
422    }
423
424    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
425    /// to hold a `AwsMsk`.
426    ///
427    /// Note that all the setters affecting `source` are
428    /// mutually exclusive.
429    ///
430    /// # Example
431    /// ```ignore,no_run
432    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
433    /// use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
434    /// let x = IngestionDataSourceSettings::new().set_aws_msk(AwsMsk::default()/* use setters */);
435    /// assert!(x.aws_msk().is_some());
436    /// assert!(x.aws_kinesis().is_none());
437    /// assert!(x.cloud_storage().is_none());
438    /// assert!(x.azure_event_hubs().is_none());
439    /// assert!(x.confluent_cloud().is_none());
440    /// ```
441    pub fn set_aws_msk<
442        T: std::convert::Into<std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>>,
443    >(
444        mut self,
445        v: T,
446    ) -> Self {
447        self.source = std::option::Option::Some(
448            crate::model::ingestion_data_source_settings::Source::AwsMsk(v.into()),
449        );
450        self
451    }
452
453    /// The value of [source][crate::model::IngestionDataSourceSettings::source]
454    /// if it holds a `ConfluentCloud`, `None` if the field is not set or
455    /// holds a different branch.
456    pub fn confluent_cloud(
457        &self,
458    ) -> std::option::Option<
459        &std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
460    > {
461        #[allow(unreachable_patterns)]
462        self.source.as_ref().and_then(|v| match v {
463            crate::model::ingestion_data_source_settings::Source::ConfluentCloud(v) => {
464                std::option::Option::Some(v)
465            }
466            _ => std::option::Option::None,
467        })
468    }
469
470    /// Sets the value of [source][crate::model::IngestionDataSourceSettings::source]
471    /// to hold a `ConfluentCloud`.
472    ///
473    /// Note that all the setters affecting `source` are
474    /// mutually exclusive.
475    ///
476    /// # Example
477    /// ```ignore,no_run
478    /// # use google_cloud_pubsub::model::IngestionDataSourceSettings;
479    /// use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
480    /// let x = IngestionDataSourceSettings::new().set_confluent_cloud(ConfluentCloud::default()/* use setters */);
481    /// assert!(x.confluent_cloud().is_some());
482    /// assert!(x.aws_kinesis().is_none());
483    /// assert!(x.cloud_storage().is_none());
484    /// assert!(x.azure_event_hubs().is_none());
485    /// assert!(x.aws_msk().is_none());
486    /// ```
487    pub fn set_confluent_cloud<
488        T: std::convert::Into<
489                std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
490            >,
491    >(
492        mut self,
493        v: T,
494    ) -> Self {
495        self.source = std::option::Option::Some(
496            crate::model::ingestion_data_source_settings::Source::ConfluentCloud(v.into()),
497        );
498        self
499    }
500}
501
502impl wkt::message::Message for IngestionDataSourceSettings {
503    fn typename() -> &'static str {
504        "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings"
505    }
506}
507
508/// Defines additional types related to [IngestionDataSourceSettings].
509pub mod ingestion_data_source_settings {
510    #[allow(unused_imports)]
511    use super::*;
512
513    /// Ingestion settings for Amazon Kinesis Data Streams.
514    #[derive(Clone, Default, PartialEq)]
515    #[non_exhaustive]
516    pub struct AwsKinesis {
517        /// Output only. An output-only field that indicates the state of the Kinesis
518        /// ingestion source.
519        pub state: crate::model::ingestion_data_source_settings::aws_kinesis::State,
520
521        /// Required. The Kinesis stream ARN to ingest data from.
522        pub stream_arn: std::string::String,
523
524        /// Required. The Kinesis consumer ARN to used for ingestion in Enhanced
525        /// Fan-Out mode. The consumer must be already created and ready to be used.
526        pub consumer_arn: std::string::String,
527
528        /// Required. AWS role ARN to be used for Federated Identity authentication
529        /// with Kinesis. Check the Pub/Sub docs for how to set up this role and the
530        /// required permissions that need to be attached to it.
531        pub aws_role_arn: std::string::String,
532
533        /// Required. The GCP service account to be used for Federated Identity
534        /// authentication with Kinesis (via a `AssumeRoleWithWebIdentity` call for
535        /// the provided role). The `aws_role_arn` must be set up with
536        /// `accounts.google.com:sub` equals to this service account number.
537        pub gcp_service_account: std::string::String,
538
539        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
540    }
541
542    impl AwsKinesis {
543        /// Creates a new default instance.
544        pub fn new() -> Self {
545            std::default::Default::default()
546        }
547
548        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AwsKinesis::state].
549        ///
550        /// # Example
551        /// ```ignore,no_run
552        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
553        /// use google_cloud_pubsub::model::ingestion_data_source_settings::aws_kinesis::State;
554        /// let x0 = AwsKinesis::new().set_state(State::Active);
555        /// let x1 = AwsKinesis::new().set_state(State::KinesisPermissionDenied);
556        /// let x2 = AwsKinesis::new().set_state(State::PublishPermissionDenied);
557        /// ```
558        pub fn set_state<
559            T: std::convert::Into<crate::model::ingestion_data_source_settings::aws_kinesis::State>,
560        >(
561            mut self,
562            v: T,
563        ) -> Self {
564            self.state = v.into();
565            self
566        }
567
568        /// Sets the value of [stream_arn][crate::model::ingestion_data_source_settings::AwsKinesis::stream_arn].
569        ///
570        /// # Example
571        /// ```ignore,no_run
572        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
573        /// let x = AwsKinesis::new().set_stream_arn("example");
574        /// ```
575        pub fn set_stream_arn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
576            self.stream_arn = v.into();
577            self
578        }
579
580        /// Sets the value of [consumer_arn][crate::model::ingestion_data_source_settings::AwsKinesis::consumer_arn].
581        ///
582        /// # Example
583        /// ```ignore,no_run
584        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
585        /// let x = AwsKinesis::new().set_consumer_arn("example");
586        /// ```
587        pub fn set_consumer_arn<T: std::convert::Into<std::string::String>>(
588            mut self,
589            v: T,
590        ) -> Self {
591            self.consumer_arn = v.into();
592            self
593        }
594
595        /// Sets the value of [aws_role_arn][crate::model::ingestion_data_source_settings::AwsKinesis::aws_role_arn].
596        ///
597        /// # Example
598        /// ```ignore,no_run
599        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
600        /// let x = AwsKinesis::new().set_aws_role_arn("example");
601        /// ```
602        pub fn set_aws_role_arn<T: std::convert::Into<std::string::String>>(
603            mut self,
604            v: T,
605        ) -> Self {
606            self.aws_role_arn = v.into();
607            self
608        }
609
610        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AwsKinesis::gcp_service_account].
611        ///
612        /// # Example
613        /// ```ignore,no_run
614        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsKinesis;
615        /// let x = AwsKinesis::new().set_gcp_service_account("example");
616        /// ```
617        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
618            mut self,
619            v: T,
620        ) -> Self {
621            self.gcp_service_account = v.into();
622            self
623        }
624    }
625
626    impl wkt::message::Message for AwsKinesis {
627        fn typename() -> &'static str {
628            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis"
629        }
630    }
631
632    /// Defines additional types related to [AwsKinesis].
633    pub mod aws_kinesis {
634        #[allow(unused_imports)]
635        use super::*;
636
637        /// Possible states for ingestion from Amazon Kinesis Data Streams.
638        ///
639        /// # Working with unknown values
640        ///
641        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
642        /// additional enum variants at any time. Adding new variants is not considered
643        /// a breaking change. Applications should write their code in anticipation of:
644        ///
645        /// - New values appearing in future releases of the client library, **and**
646        /// - New values received dynamically, without application changes.
647        ///
648        /// Please consult the [Working with enums] section in the user guide for some
649        /// guidelines.
650        ///
651        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
652        #[derive(Clone, Debug, PartialEq)]
653        #[non_exhaustive]
654        pub enum State {
655            /// Default value. This value is unused.
656            Unspecified,
657            /// Ingestion is active.
658            Active,
659            /// Permission denied encountered while consuming data from Kinesis.
660            /// This can happen if:
661            ///
662            /// - The provided `aws_role_arn` does not exist or does not have the
663            ///   appropriate permissions attached.
664            /// - The provided `aws_role_arn` is not set up properly for Identity
665            ///   Federation using `gcp_service_account`.
666            /// - The Pub/Sub SA is not granted the
667            ///   `iam.serviceAccounts.getOpenIdToken` permission on
668            ///   `gcp_service_account`.
669            KinesisPermissionDenied,
670            /// Permission denied encountered while publishing to the topic. This can
671            /// happen if the Pub/Sub SA has not been granted the [appropriate publish
672            /// permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
673            PublishPermissionDenied,
674            /// The Kinesis stream does not exist.
675            StreamNotFound,
676            /// The Kinesis consumer does not exist.
677            ConsumerNotFound,
678            /// Indicates an error state where the ingestion source cannot be
679            /// processed because the selected ingestion region is not permitted
680            /// by the Regional Access Boundary (RAB) restrictions on the project's
681            /// service account.
682            ConflictingRegionConstraints,
683            /// If set, the enum was initialized with an unknown value.
684            ///
685            /// Applications can examine the value using [State::value] or
686            /// [State::name].
687            UnknownValue(state::UnknownValue),
688        }
689
690        #[doc(hidden)]
691        pub mod state {
692            #[allow(unused_imports)]
693            use super::*;
694            #[derive(Clone, Debug, PartialEq)]
695            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
696        }
697
698        impl State {
699            /// Gets the enum value.
700            ///
701            /// Returns `None` if the enum contains an unknown value deserialized from
702            /// the string representation of enums.
703            pub fn value(&self) -> std::option::Option<i32> {
704                match self {
705                    Self::Unspecified => std::option::Option::Some(0),
706                    Self::Active => std::option::Option::Some(1),
707                    Self::KinesisPermissionDenied => std::option::Option::Some(2),
708                    Self::PublishPermissionDenied => std::option::Option::Some(3),
709                    Self::StreamNotFound => std::option::Option::Some(4),
710                    Self::ConsumerNotFound => std::option::Option::Some(5),
711                    Self::ConflictingRegionConstraints => std::option::Option::Some(6),
712                    Self::UnknownValue(u) => u.0.value(),
713                }
714            }
715
716            /// Gets the enum value as a string.
717            ///
718            /// Returns `None` if the enum contains an unknown value deserialized from
719            /// the integer representation of enums.
720            pub fn name(&self) -> std::option::Option<&str> {
721                match self {
722                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
723                    Self::Active => std::option::Option::Some("ACTIVE"),
724                    Self::KinesisPermissionDenied => {
725                        std::option::Option::Some("KINESIS_PERMISSION_DENIED")
726                    }
727                    Self::PublishPermissionDenied => {
728                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
729                    }
730                    Self::StreamNotFound => std::option::Option::Some("STREAM_NOT_FOUND"),
731                    Self::ConsumerNotFound => std::option::Option::Some("CONSUMER_NOT_FOUND"),
732                    Self::ConflictingRegionConstraints => {
733                        std::option::Option::Some("CONFLICTING_REGION_CONSTRAINTS")
734                    }
735                    Self::UnknownValue(u) => u.0.name(),
736                }
737            }
738        }
739
740        impl std::default::Default for State {
741            fn default() -> Self {
742                use std::convert::From;
743                Self::from(0)
744            }
745        }
746
747        impl std::fmt::Display for State {
748            fn fmt(
749                &self,
750                f: &mut std::fmt::Formatter<'_>,
751            ) -> std::result::Result<(), std::fmt::Error> {
752                wkt::internal::display_enum(f, self.name(), self.value())
753            }
754        }
755
756        impl std::convert::From<i32> for State {
757            fn from(value: i32) -> Self {
758                match value {
759                    0 => Self::Unspecified,
760                    1 => Self::Active,
761                    2 => Self::KinesisPermissionDenied,
762                    3 => Self::PublishPermissionDenied,
763                    4 => Self::StreamNotFound,
764                    5 => Self::ConsumerNotFound,
765                    6 => Self::ConflictingRegionConstraints,
766                    _ => Self::UnknownValue(state::UnknownValue(
767                        wkt::internal::UnknownEnumValue::Integer(value),
768                    )),
769                }
770            }
771        }
772
773        impl std::convert::From<&str> for State {
774            fn from(value: &str) -> Self {
775                use std::string::ToString;
776                match value {
777                    "STATE_UNSPECIFIED" => Self::Unspecified,
778                    "ACTIVE" => Self::Active,
779                    "KINESIS_PERMISSION_DENIED" => Self::KinesisPermissionDenied,
780                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
781                    "STREAM_NOT_FOUND" => Self::StreamNotFound,
782                    "CONSUMER_NOT_FOUND" => Self::ConsumerNotFound,
783                    "CONFLICTING_REGION_CONSTRAINTS" => Self::ConflictingRegionConstraints,
784                    _ => Self::UnknownValue(state::UnknownValue(
785                        wkt::internal::UnknownEnumValue::String(value.to_string()),
786                    )),
787                }
788            }
789        }
790
791        impl serde::ser::Serialize for State {
792            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
793            where
794                S: serde::Serializer,
795            {
796                match self {
797                    Self::Unspecified => serializer.serialize_i32(0),
798                    Self::Active => serializer.serialize_i32(1),
799                    Self::KinesisPermissionDenied => serializer.serialize_i32(2),
800                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
801                    Self::StreamNotFound => serializer.serialize_i32(4),
802                    Self::ConsumerNotFound => serializer.serialize_i32(5),
803                    Self::ConflictingRegionConstraints => serializer.serialize_i32(6),
804                    Self::UnknownValue(u) => u.0.serialize(serializer),
805                }
806            }
807        }
808
809        impl<'de> serde::de::Deserialize<'de> for State {
810            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
811            where
812                D: serde::Deserializer<'de>,
813            {
814                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
815                    ".google.pubsub.v1.IngestionDataSourceSettings.AwsKinesis.State",
816                ))
817            }
818        }
819    }
820
821    /// Ingestion settings for Cloud Storage.
822    #[derive(Clone, Default, PartialEq)]
823    #[non_exhaustive]
824    pub struct CloudStorage {
825        /// Output only. An output-only field that indicates the state of the Cloud
826        /// Storage ingestion source.
827        pub state: crate::model::ingestion_data_source_settings::cloud_storage::State,
828
829        /// Optional. Cloud Storage bucket. The bucket name must be without any
830        /// prefix like "gs://". See the [bucket naming requirements]
831        /// (<https://cloud.google.com/storage/docs/buckets#naming>).
832        pub bucket: std::string::String,
833
834        /// Optional. Only objects with a larger or equal creation timestamp will be
835        /// ingested.
836        pub minimum_object_create_time: std::option::Option<wkt::Timestamp>,
837
838        /// Optional. Glob pattern used to match objects that will be ingested. If
839        /// unset, all objects will be ingested. See the [supported
840        /// patterns](https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob).
841        pub match_glob: std::string::String,
842
843        /// Defaults to text format.
844        pub input_format: std::option::Option<
845            crate::model::ingestion_data_source_settings::cloud_storage::InputFormat,
846        >,
847
848        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
849    }
850
851    impl CloudStorage {
852        /// Creates a new default instance.
853        pub fn new() -> Self {
854            std::default::Default::default()
855        }
856
857        /// Sets the value of [state][crate::model::ingestion_data_source_settings::CloudStorage::state].
858        ///
859        /// # Example
860        /// ```ignore,no_run
861        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
862        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::State;
863        /// let x0 = CloudStorage::new().set_state(State::Active);
864        /// let x1 = CloudStorage::new().set_state(State::CloudStoragePermissionDenied);
865        /// let x2 = CloudStorage::new().set_state(State::PublishPermissionDenied);
866        /// ```
867        pub fn set_state<
868            T: std::convert::Into<crate::model::ingestion_data_source_settings::cloud_storage::State>,
869        >(
870            mut self,
871            v: T,
872        ) -> Self {
873            self.state = v.into();
874            self
875        }
876
877        /// Sets the value of [bucket][crate::model::ingestion_data_source_settings::CloudStorage::bucket].
878        ///
879        /// # Example
880        /// ```ignore,no_run
881        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
882        /// let x = CloudStorage::new().set_bucket("example");
883        /// ```
884        pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
885            self.bucket = v.into();
886            self
887        }
888
889        /// Sets the value of [minimum_object_create_time][crate::model::ingestion_data_source_settings::CloudStorage::minimum_object_create_time].
890        ///
891        /// # Example
892        /// ```ignore,no_run
893        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
894        /// use wkt::Timestamp;
895        /// let x = CloudStorage::new().set_minimum_object_create_time(Timestamp::default()/* use setters */);
896        /// ```
897        pub fn set_minimum_object_create_time<T>(mut self, v: T) -> Self
898        where
899            T: std::convert::Into<wkt::Timestamp>,
900        {
901            self.minimum_object_create_time = std::option::Option::Some(v.into());
902            self
903        }
904
905        /// Sets or clears the value of [minimum_object_create_time][crate::model::ingestion_data_source_settings::CloudStorage::minimum_object_create_time].
906        ///
907        /// # Example
908        /// ```ignore,no_run
909        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
910        /// use wkt::Timestamp;
911        /// let x = CloudStorage::new().set_or_clear_minimum_object_create_time(Some(Timestamp::default()/* use setters */));
912        /// let x = CloudStorage::new().set_or_clear_minimum_object_create_time(None::<Timestamp>);
913        /// ```
914        pub fn set_or_clear_minimum_object_create_time<T>(
915            mut self,
916            v: std::option::Option<T>,
917        ) -> Self
918        where
919            T: std::convert::Into<wkt::Timestamp>,
920        {
921            self.minimum_object_create_time = v.map(|x| x.into());
922            self
923        }
924
925        /// Sets the value of [match_glob][crate::model::ingestion_data_source_settings::CloudStorage::match_glob].
926        ///
927        /// # Example
928        /// ```ignore,no_run
929        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
930        /// let x = CloudStorage::new().set_match_glob("example");
931        /// ```
932        pub fn set_match_glob<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
933            self.match_glob = v.into();
934            self
935        }
936
937        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format].
938        ///
939        /// Note that all the setters affecting `input_format` are mutually
940        /// exclusive.
941        ///
942        /// # Example
943        /// ```ignore,no_run
944        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
945        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
946        /// let x = CloudStorage::new().set_input_format(Some(
947        ///     google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(TextFormat::default().into())));
948        /// ```
949        pub fn set_input_format<
950            T: std::convert::Into<
951                    std::option::Option<
952                        crate::model::ingestion_data_source_settings::cloud_storage::InputFormat,
953                    >,
954                >,
955        >(
956            mut self,
957            v: T,
958        ) -> Self {
959            self.input_format = v.into();
960            self
961        }
962
963        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
964        /// if it holds a `TextFormat`, `None` if the field is not set or
965        /// holds a different branch.
966        pub fn text_format(
967            &self,
968        ) -> std::option::Option<
969            &std::boxed::Box<
970                crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
971            >,
972        > {
973            #[allow(unreachable_patterns)]
974            self.input_format.as_ref().and_then(|v| match v {
975                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(v) => std::option::Option::Some(v),
976                _ => std::option::Option::None,
977            })
978        }
979
980        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
981        /// to hold a `TextFormat`.
982        ///
983        /// Note that all the setters affecting `input_format` are
984        /// mutually exclusive.
985        ///
986        /// # Example
987        /// ```ignore,no_run
988        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
989        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
990        /// let x = CloudStorage::new().set_text_format(TextFormat::default()/* use setters */);
991        /// assert!(x.text_format().is_some());
992        /// assert!(x.avro_format().is_none());
993        /// assert!(x.pubsub_avro_format().is_none());
994        /// ```
995        pub fn set_text_format<
996            T: std::convert::Into<
997                    std::boxed::Box<
998                        crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
999                    >,
1000                >,
1001        >(
1002            mut self,
1003            v: T,
1004        ) -> Self {
1005            self.input_format = std::option::Option::Some(
1006                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::TextFormat(
1007                    v.into()
1008                )
1009            );
1010            self
1011        }
1012
1013        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
1014        /// if it holds a `AvroFormat`, `None` if the field is not set or
1015        /// holds a different branch.
1016        pub fn avro_format(
1017            &self,
1018        ) -> std::option::Option<
1019            &std::boxed::Box<
1020                crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
1021            >,
1022        > {
1023            #[allow(unreachable_patterns)]
1024            self.input_format.as_ref().and_then(|v| match v {
1025                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::AvroFormat(v) => std::option::Option::Some(v),
1026                _ => std::option::Option::None,
1027            })
1028        }
1029
1030        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
1031        /// to hold a `AvroFormat`.
1032        ///
1033        /// Note that all the setters affecting `input_format` are
1034        /// mutually exclusive.
1035        ///
1036        /// # Example
1037        /// ```ignore,no_run
1038        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
1039        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::AvroFormat;
1040        /// let x = CloudStorage::new().set_avro_format(AvroFormat::default()/* use setters */);
1041        /// assert!(x.avro_format().is_some());
1042        /// assert!(x.text_format().is_none());
1043        /// assert!(x.pubsub_avro_format().is_none());
1044        /// ```
1045        pub fn set_avro_format<
1046            T: std::convert::Into<
1047                    std::boxed::Box<
1048                        crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
1049                    >,
1050                >,
1051        >(
1052            mut self,
1053            v: T,
1054        ) -> Self {
1055            self.input_format = std::option::Option::Some(
1056                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::AvroFormat(
1057                    v.into()
1058                )
1059            );
1060            self
1061        }
1062
1063        /// The value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
1064        /// if it holds a `PubsubAvroFormat`, `None` if the field is not set or
1065        /// holds a different branch.
1066        pub fn pubsub_avro_format(
1067            &self,
1068        ) -> std::option::Option<
1069            &std::boxed::Box<
1070                crate::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat,
1071            >,
1072        > {
1073            #[allow(unreachable_patterns)]
1074            self.input_format.as_ref().and_then(|v| match v {
1075                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::PubsubAvroFormat(v) => std::option::Option::Some(v),
1076                _ => std::option::Option::None,
1077            })
1078        }
1079
1080        /// Sets the value of [input_format][crate::model::ingestion_data_source_settings::CloudStorage::input_format]
1081        /// to hold a `PubsubAvroFormat`.
1082        ///
1083        /// Note that all the setters affecting `input_format` are
1084        /// mutually exclusive.
1085        ///
1086        /// # Example
1087        /// ```ignore,no_run
1088        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::CloudStorage;
1089        /// use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat;
1090        /// let x = CloudStorage::new().set_pubsub_avro_format(PubSubAvroFormat::default()/* use setters */);
1091        /// assert!(x.pubsub_avro_format().is_some());
1092        /// assert!(x.text_format().is_none());
1093        /// assert!(x.avro_format().is_none());
1094        /// ```
1095        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{
1096            self.input_format = std::option::Option::Some(
1097                crate::model::ingestion_data_source_settings::cloud_storage::InputFormat::PubsubAvroFormat(
1098                    v.into()
1099                )
1100            );
1101            self
1102        }
1103    }
1104
1105    impl wkt::message::Message for CloudStorage {
1106        fn typename() -> &'static str {
1107            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage"
1108        }
1109    }
1110
1111    /// Defines additional types related to [CloudStorage].
1112    pub mod cloud_storage {
1113        #[allow(unused_imports)]
1114        use super::*;
1115
1116        /// Configuration for reading Cloud Storage data in text format. Each line of
1117        /// text as specified by the delimiter will be set to the `data` field of a
1118        /// Pub/Sub message.
1119        #[derive(Clone, Default, PartialEq)]
1120        #[non_exhaustive]
1121        pub struct TextFormat {
1122            /// Optional. When unset, '\n' is used.
1123            pub delimiter: std::option::Option<std::string::String>,
1124
1125            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1126        }
1127
1128        impl TextFormat {
1129            /// Creates a new default instance.
1130            pub fn new() -> Self {
1131                std::default::Default::default()
1132            }
1133
1134            /// Sets the value of [delimiter][crate::model::ingestion_data_source_settings::cloud_storage::TextFormat::delimiter].
1135            ///
1136            /// # Example
1137            /// ```ignore,no_run
1138            /// # use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
1139            /// let x = TextFormat::new().set_delimiter("example");
1140            /// ```
1141            pub fn set_delimiter<T>(mut self, v: T) -> Self
1142            where
1143                T: std::convert::Into<std::string::String>,
1144            {
1145                self.delimiter = std::option::Option::Some(v.into());
1146                self
1147            }
1148
1149            /// Sets or clears the value of [delimiter][crate::model::ingestion_data_source_settings::cloud_storage::TextFormat::delimiter].
1150            ///
1151            /// # Example
1152            /// ```ignore,no_run
1153            /// # use google_cloud_pubsub::model::ingestion_data_source_settings::cloud_storage::TextFormat;
1154            /// let x = TextFormat::new().set_or_clear_delimiter(Some("example"));
1155            /// let x = TextFormat::new().set_or_clear_delimiter(None::<String>);
1156            /// ```
1157            pub fn set_or_clear_delimiter<T>(mut self, v: std::option::Option<T>) -> Self
1158            where
1159                T: std::convert::Into<std::string::String>,
1160            {
1161                self.delimiter = v.map(|x| x.into());
1162                self
1163            }
1164        }
1165
1166        impl wkt::message::Message for TextFormat {
1167            fn typename() -> &'static str {
1168                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.TextFormat"
1169            }
1170        }
1171
1172        /// Configuration for reading Cloud Storage data in Avro binary format. The
1173        /// bytes of each object will be set to the `data` field of a Pub/Sub
1174        /// message.
1175        #[derive(Clone, Default, PartialEq)]
1176        #[non_exhaustive]
1177        pub struct AvroFormat {
1178            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1179        }
1180
1181        impl AvroFormat {
1182            /// Creates a new default instance.
1183            pub fn new() -> Self {
1184                std::default::Default::default()
1185            }
1186        }
1187
1188        impl wkt::message::Message for AvroFormat {
1189            fn typename() -> &'static str {
1190                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.AvroFormat"
1191            }
1192        }
1193
1194        /// Configuration for reading Cloud Storage data written via [Cloud Storage
1195        /// subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage). The
1196        /// data and attributes fields of the originally exported Pub/Sub message
1197        /// will be restored when publishing.
1198        #[derive(Clone, Default, PartialEq)]
1199        #[non_exhaustive]
1200        pub struct PubSubAvroFormat {
1201            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1202        }
1203
1204        impl PubSubAvroFormat {
1205            /// Creates a new default instance.
1206            pub fn new() -> Self {
1207                std::default::Default::default()
1208            }
1209        }
1210
1211        impl wkt::message::Message for PubSubAvroFormat {
1212            fn typename() -> &'static str {
1213                "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat"
1214            }
1215        }
1216
1217        /// Possible states for ingestion from Cloud Storage.
1218        ///
1219        /// # Working with unknown values
1220        ///
1221        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1222        /// additional enum variants at any time. Adding new variants is not considered
1223        /// a breaking change. Applications should write their code in anticipation of:
1224        ///
1225        /// - New values appearing in future releases of the client library, **and**
1226        /// - New values received dynamically, without application changes.
1227        ///
1228        /// Please consult the [Working with enums] section in the user guide for some
1229        /// guidelines.
1230        ///
1231        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1232        #[derive(Clone, Debug, PartialEq)]
1233        #[non_exhaustive]
1234        pub enum State {
1235            /// Default value. This value is unused.
1236            Unspecified,
1237            /// Ingestion is active.
1238            Active,
1239            /// Permission denied encountered while calling the Cloud Storage API. This
1240            /// can happen if the Pub/Sub SA has not been granted the
1241            /// [appropriate
1242            /// permissions](https://cloud.google.com/storage/docs/access-control/iam-permissions):
1243            ///
1244            /// - storage.objects.list: to list the objects in a bucket.
1245            /// - storage.objects.get: to read the objects in a bucket.
1246            /// - storage.buckets.get: to verify the bucket exists.
1247            CloudStoragePermissionDenied,
1248            /// Permission denied encountered while publishing to the topic. This can
1249            /// happen if the Pub/Sub SA has not been granted the [appropriate publish
1250            /// permissions](https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher)
1251            PublishPermissionDenied,
1252            /// The provided Cloud Storage bucket doesn't exist.
1253            BucketNotFound,
1254            /// The Cloud Storage bucket has too many objects, ingestion will be
1255            /// paused.
1256            TooManyObjects,
1257            /// Indicates an error state where the ingestion source cannot be
1258            /// processed because the selected ingestion region is not permitted
1259            /// by the Regional Access Boundary (RAB) restrictions on the project's
1260            /// service account.
1261            ConflictingRegionConstraints,
1262            /// If set, the enum was initialized with an unknown value.
1263            ///
1264            /// Applications can examine the value using [State::value] or
1265            /// [State::name].
1266            UnknownValue(state::UnknownValue),
1267        }
1268
1269        #[doc(hidden)]
1270        pub mod state {
1271            #[allow(unused_imports)]
1272            use super::*;
1273            #[derive(Clone, Debug, PartialEq)]
1274            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1275        }
1276
1277        impl State {
1278            /// Gets the enum value.
1279            ///
1280            /// Returns `None` if the enum contains an unknown value deserialized from
1281            /// the string representation of enums.
1282            pub fn value(&self) -> std::option::Option<i32> {
1283                match self {
1284                    Self::Unspecified => std::option::Option::Some(0),
1285                    Self::Active => std::option::Option::Some(1),
1286                    Self::CloudStoragePermissionDenied => std::option::Option::Some(2),
1287                    Self::PublishPermissionDenied => std::option::Option::Some(3),
1288                    Self::BucketNotFound => std::option::Option::Some(4),
1289                    Self::TooManyObjects => std::option::Option::Some(5),
1290                    Self::ConflictingRegionConstraints => std::option::Option::Some(8),
1291                    Self::UnknownValue(u) => u.0.value(),
1292                }
1293            }
1294
1295            /// Gets the enum value as a string.
1296            ///
1297            /// Returns `None` if the enum contains an unknown value deserialized from
1298            /// the integer representation of enums.
1299            pub fn name(&self) -> std::option::Option<&str> {
1300                match self {
1301                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1302                    Self::Active => std::option::Option::Some("ACTIVE"),
1303                    Self::CloudStoragePermissionDenied => {
1304                        std::option::Option::Some("CLOUD_STORAGE_PERMISSION_DENIED")
1305                    }
1306                    Self::PublishPermissionDenied => {
1307                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
1308                    }
1309                    Self::BucketNotFound => std::option::Option::Some("BUCKET_NOT_FOUND"),
1310                    Self::TooManyObjects => std::option::Option::Some("TOO_MANY_OBJECTS"),
1311                    Self::ConflictingRegionConstraints => {
1312                        std::option::Option::Some("CONFLICTING_REGION_CONSTRAINTS")
1313                    }
1314                    Self::UnknownValue(u) => u.0.name(),
1315                }
1316            }
1317        }
1318
1319        impl std::default::Default for State {
1320            fn default() -> Self {
1321                use std::convert::From;
1322                Self::from(0)
1323            }
1324        }
1325
1326        impl std::fmt::Display for State {
1327            fn fmt(
1328                &self,
1329                f: &mut std::fmt::Formatter<'_>,
1330            ) -> std::result::Result<(), std::fmt::Error> {
1331                wkt::internal::display_enum(f, self.name(), self.value())
1332            }
1333        }
1334
1335        impl std::convert::From<i32> for State {
1336            fn from(value: i32) -> Self {
1337                match value {
1338                    0 => Self::Unspecified,
1339                    1 => Self::Active,
1340                    2 => Self::CloudStoragePermissionDenied,
1341                    3 => Self::PublishPermissionDenied,
1342                    4 => Self::BucketNotFound,
1343                    5 => Self::TooManyObjects,
1344                    8 => Self::ConflictingRegionConstraints,
1345                    _ => Self::UnknownValue(state::UnknownValue(
1346                        wkt::internal::UnknownEnumValue::Integer(value),
1347                    )),
1348                }
1349            }
1350        }
1351
1352        impl std::convert::From<&str> for State {
1353            fn from(value: &str) -> Self {
1354                use std::string::ToString;
1355                match value {
1356                    "STATE_UNSPECIFIED" => Self::Unspecified,
1357                    "ACTIVE" => Self::Active,
1358                    "CLOUD_STORAGE_PERMISSION_DENIED" => Self::CloudStoragePermissionDenied,
1359                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
1360                    "BUCKET_NOT_FOUND" => Self::BucketNotFound,
1361                    "TOO_MANY_OBJECTS" => Self::TooManyObjects,
1362                    "CONFLICTING_REGION_CONSTRAINTS" => Self::ConflictingRegionConstraints,
1363                    _ => Self::UnknownValue(state::UnknownValue(
1364                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1365                    )),
1366                }
1367            }
1368        }
1369
1370        impl serde::ser::Serialize for State {
1371            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1372            where
1373                S: serde::Serializer,
1374            {
1375                match self {
1376                    Self::Unspecified => serializer.serialize_i32(0),
1377                    Self::Active => serializer.serialize_i32(1),
1378                    Self::CloudStoragePermissionDenied => serializer.serialize_i32(2),
1379                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
1380                    Self::BucketNotFound => serializer.serialize_i32(4),
1381                    Self::TooManyObjects => serializer.serialize_i32(5),
1382                    Self::ConflictingRegionConstraints => serializer.serialize_i32(8),
1383                    Self::UnknownValue(u) => u.0.serialize(serializer),
1384                }
1385            }
1386        }
1387
1388        impl<'de> serde::de::Deserialize<'de> for State {
1389            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1390            where
1391                D: serde::Deserializer<'de>,
1392            {
1393                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1394                    ".google.pubsub.v1.IngestionDataSourceSettings.CloudStorage.State",
1395                ))
1396            }
1397        }
1398
1399        /// Defaults to text format.
1400        #[derive(Clone, Debug, PartialEq)]
1401        #[non_exhaustive]
1402        pub enum InputFormat {
1403            /// Optional. Data from Cloud Storage will be interpreted as text.
1404            TextFormat(
1405                std::boxed::Box<
1406                    crate::model::ingestion_data_source_settings::cloud_storage::TextFormat,
1407                >,
1408            ),
1409            /// Optional. Data from Cloud Storage will be interpreted in Avro format.
1410            AvroFormat(
1411                std::boxed::Box<
1412                    crate::model::ingestion_data_source_settings::cloud_storage::AvroFormat,
1413                >,
1414            ),
1415            /// Optional. It will be assumed data from Cloud Storage was written via
1416            /// [Cloud Storage
1417            /// subscriptions](https://cloud.google.com/pubsub/docs/cloudstorage).
1418            PubsubAvroFormat(
1419                std::boxed::Box<
1420                    crate::model::ingestion_data_source_settings::cloud_storage::PubSubAvroFormat,
1421                >,
1422            ),
1423        }
1424    }
1425
1426    /// Ingestion settings for Azure Event Hubs.
1427    #[derive(Clone, Default, PartialEq)]
1428    #[non_exhaustive]
1429    pub struct AzureEventHubs {
1430        /// Output only. An output-only field that indicates the state of the Event
1431        /// Hubs ingestion source.
1432        pub state: crate::model::ingestion_data_source_settings::azure_event_hubs::State,
1433
1434        /// Optional. Name of the resource group within the azure subscription.
1435        pub resource_group: std::string::String,
1436
1437        /// Optional. The name of the Event Hubs namespace.
1438        pub namespace: std::string::String,
1439
1440        /// Optional. The name of the Event Hub.
1441        pub event_hub: std::string::String,
1442
1443        /// Optional. The client id of the Azure application that is being used to
1444        /// authenticate Pub/Sub.
1445        pub client_id: std::string::String,
1446
1447        /// Optional. The tenant id of the Azure application that is being used to
1448        /// authenticate Pub/Sub.
1449        pub tenant_id: std::string::String,
1450
1451        /// Optional. The Azure subscription id.
1452        pub subscription_id: std::string::String,
1453
1454        /// Optional. The GCP service account to be used for Federated Identity
1455        /// authentication.
1456        pub gcp_service_account: std::string::String,
1457
1458        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1459    }
1460
1461    impl AzureEventHubs {
1462        /// Creates a new default instance.
1463        pub fn new() -> Self {
1464            std::default::Default::default()
1465        }
1466
1467        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AzureEventHubs::state].
1468        ///
1469        /// # Example
1470        /// ```ignore,no_run
1471        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1472        /// use google_cloud_pubsub::model::ingestion_data_source_settings::azure_event_hubs::State;
1473        /// let x0 = AzureEventHubs::new().set_state(State::Active);
1474        /// let x1 = AzureEventHubs::new().set_state(State::EventHubsPermissionDenied);
1475        /// let x2 = AzureEventHubs::new().set_state(State::PublishPermissionDenied);
1476        /// ```
1477        pub fn set_state<
1478            T: std::convert::Into<
1479                    crate::model::ingestion_data_source_settings::azure_event_hubs::State,
1480                >,
1481        >(
1482            mut self,
1483            v: T,
1484        ) -> Self {
1485            self.state = v.into();
1486            self
1487        }
1488
1489        /// Sets the value of [resource_group][crate::model::ingestion_data_source_settings::AzureEventHubs::resource_group].
1490        ///
1491        /// # Example
1492        /// ```ignore,no_run
1493        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1494        /// let x = AzureEventHubs::new().set_resource_group("example");
1495        /// ```
1496        pub fn set_resource_group<T: std::convert::Into<std::string::String>>(
1497            mut self,
1498            v: T,
1499        ) -> Self {
1500            self.resource_group = v.into();
1501            self
1502        }
1503
1504        /// Sets the value of [namespace][crate::model::ingestion_data_source_settings::AzureEventHubs::namespace].
1505        ///
1506        /// # Example
1507        /// ```ignore,no_run
1508        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1509        /// let x = AzureEventHubs::new().set_namespace("example");
1510        /// ```
1511        pub fn set_namespace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1512            self.namespace = v.into();
1513            self
1514        }
1515
1516        /// Sets the value of [event_hub][crate::model::ingestion_data_source_settings::AzureEventHubs::event_hub].
1517        ///
1518        /// # Example
1519        /// ```ignore,no_run
1520        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1521        /// let x = AzureEventHubs::new().set_event_hub("example");
1522        /// ```
1523        pub fn set_event_hub<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1524            self.event_hub = v.into();
1525            self
1526        }
1527
1528        /// Sets the value of [client_id][crate::model::ingestion_data_source_settings::AzureEventHubs::client_id].
1529        ///
1530        /// # Example
1531        /// ```ignore,no_run
1532        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1533        /// let x = AzureEventHubs::new().set_client_id("example");
1534        /// ```
1535        pub fn set_client_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1536            self.client_id = v.into();
1537            self
1538        }
1539
1540        /// Sets the value of [tenant_id][crate::model::ingestion_data_source_settings::AzureEventHubs::tenant_id].
1541        ///
1542        /// # Example
1543        /// ```ignore,no_run
1544        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1545        /// let x = AzureEventHubs::new().set_tenant_id("example");
1546        /// ```
1547        pub fn set_tenant_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1548            self.tenant_id = v.into();
1549            self
1550        }
1551
1552        /// Sets the value of [subscription_id][crate::model::ingestion_data_source_settings::AzureEventHubs::subscription_id].
1553        ///
1554        /// # Example
1555        /// ```ignore,no_run
1556        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1557        /// let x = AzureEventHubs::new().set_subscription_id("example");
1558        /// ```
1559        pub fn set_subscription_id<T: std::convert::Into<std::string::String>>(
1560            mut self,
1561            v: T,
1562        ) -> Self {
1563            self.subscription_id = v.into();
1564            self
1565        }
1566
1567        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AzureEventHubs::gcp_service_account].
1568        ///
1569        /// # Example
1570        /// ```ignore,no_run
1571        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AzureEventHubs;
1572        /// let x = AzureEventHubs::new().set_gcp_service_account("example");
1573        /// ```
1574        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
1575            mut self,
1576            v: T,
1577        ) -> Self {
1578            self.gcp_service_account = v.into();
1579            self
1580        }
1581    }
1582
1583    impl wkt::message::Message for AzureEventHubs {
1584        fn typename() -> &'static str {
1585            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs"
1586        }
1587    }
1588
1589    /// Defines additional types related to [AzureEventHubs].
1590    pub mod azure_event_hubs {
1591        #[allow(unused_imports)]
1592        use super::*;
1593
1594        /// Possible states for managed ingestion from Event Hubs.
1595        ///
1596        /// # Working with unknown values
1597        ///
1598        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1599        /// additional enum variants at any time. Adding new variants is not considered
1600        /// a breaking change. Applications should write their code in anticipation of:
1601        ///
1602        /// - New values appearing in future releases of the client library, **and**
1603        /// - New values received dynamically, without application changes.
1604        ///
1605        /// Please consult the [Working with enums] section in the user guide for some
1606        /// guidelines.
1607        ///
1608        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1609        #[derive(Clone, Debug, PartialEq)]
1610        #[non_exhaustive]
1611        pub enum State {
1612            /// Default value. This value is unused.
1613            Unspecified,
1614            /// Ingestion is active.
1615            Active,
1616            /// Permission denied encountered while consuming data from Event Hubs.
1617            /// This can happen when `client_id`, or `tenant_id` are invalid. Or the
1618            /// right permissions haven't been granted.
1619            EventHubsPermissionDenied,
1620            /// Permission denied encountered while publishing to the topic.
1621            PublishPermissionDenied,
1622            /// The provided Event Hubs namespace couldn't be found.
1623            NamespaceNotFound,
1624            /// The provided Event Hub couldn't be found.
1625            EventHubNotFound,
1626            /// The provided Event Hubs subscription couldn't be found.
1627            SubscriptionNotFound,
1628            /// The provided Event Hubs resource group couldn't be found.
1629            ResourceGroupNotFound,
1630            /// Indicates an error state where the ingestion source cannot be
1631            /// processed because the selected ingestion region is not permitted
1632            /// by the Regional Access Boundary (RAB) restrictions on the project's
1633            /// service account.
1634            ConflictingRegionConstraints,
1635            /// If set, the enum was initialized with an unknown value.
1636            ///
1637            /// Applications can examine the value using [State::value] or
1638            /// [State::name].
1639            UnknownValue(state::UnknownValue),
1640        }
1641
1642        #[doc(hidden)]
1643        pub mod state {
1644            #[allow(unused_imports)]
1645            use super::*;
1646            #[derive(Clone, Debug, PartialEq)]
1647            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1648        }
1649
1650        impl State {
1651            /// Gets the enum value.
1652            ///
1653            /// Returns `None` if the enum contains an unknown value deserialized from
1654            /// the string representation of enums.
1655            pub fn value(&self) -> std::option::Option<i32> {
1656                match self {
1657                    Self::Unspecified => std::option::Option::Some(0),
1658                    Self::Active => std::option::Option::Some(1),
1659                    Self::EventHubsPermissionDenied => std::option::Option::Some(2),
1660                    Self::PublishPermissionDenied => std::option::Option::Some(3),
1661                    Self::NamespaceNotFound => std::option::Option::Some(4),
1662                    Self::EventHubNotFound => std::option::Option::Some(5),
1663                    Self::SubscriptionNotFound => std::option::Option::Some(6),
1664                    Self::ResourceGroupNotFound => std::option::Option::Some(7),
1665                    Self::ConflictingRegionConstraints => std::option::Option::Some(8),
1666                    Self::UnknownValue(u) => u.0.value(),
1667                }
1668            }
1669
1670            /// Gets the enum value as a string.
1671            ///
1672            /// Returns `None` if the enum contains an unknown value deserialized from
1673            /// the integer representation of enums.
1674            pub fn name(&self) -> std::option::Option<&str> {
1675                match self {
1676                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1677                    Self::Active => std::option::Option::Some("ACTIVE"),
1678                    Self::EventHubsPermissionDenied => {
1679                        std::option::Option::Some("EVENT_HUBS_PERMISSION_DENIED")
1680                    }
1681                    Self::PublishPermissionDenied => {
1682                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
1683                    }
1684                    Self::NamespaceNotFound => std::option::Option::Some("NAMESPACE_NOT_FOUND"),
1685                    Self::EventHubNotFound => std::option::Option::Some("EVENT_HUB_NOT_FOUND"),
1686                    Self::SubscriptionNotFound => {
1687                        std::option::Option::Some("SUBSCRIPTION_NOT_FOUND")
1688                    }
1689                    Self::ResourceGroupNotFound => {
1690                        std::option::Option::Some("RESOURCE_GROUP_NOT_FOUND")
1691                    }
1692                    Self::ConflictingRegionConstraints => {
1693                        std::option::Option::Some("CONFLICTING_REGION_CONSTRAINTS")
1694                    }
1695                    Self::UnknownValue(u) => u.0.name(),
1696                }
1697            }
1698        }
1699
1700        impl std::default::Default for State {
1701            fn default() -> Self {
1702                use std::convert::From;
1703                Self::from(0)
1704            }
1705        }
1706
1707        impl std::fmt::Display for State {
1708            fn fmt(
1709                &self,
1710                f: &mut std::fmt::Formatter<'_>,
1711            ) -> std::result::Result<(), std::fmt::Error> {
1712                wkt::internal::display_enum(f, self.name(), self.value())
1713            }
1714        }
1715
1716        impl std::convert::From<i32> for State {
1717            fn from(value: i32) -> Self {
1718                match value {
1719                    0 => Self::Unspecified,
1720                    1 => Self::Active,
1721                    2 => Self::EventHubsPermissionDenied,
1722                    3 => Self::PublishPermissionDenied,
1723                    4 => Self::NamespaceNotFound,
1724                    5 => Self::EventHubNotFound,
1725                    6 => Self::SubscriptionNotFound,
1726                    7 => Self::ResourceGroupNotFound,
1727                    8 => Self::ConflictingRegionConstraints,
1728                    _ => Self::UnknownValue(state::UnknownValue(
1729                        wkt::internal::UnknownEnumValue::Integer(value),
1730                    )),
1731                }
1732            }
1733        }
1734
1735        impl std::convert::From<&str> for State {
1736            fn from(value: &str) -> Self {
1737                use std::string::ToString;
1738                match value {
1739                    "STATE_UNSPECIFIED" => Self::Unspecified,
1740                    "ACTIVE" => Self::Active,
1741                    "EVENT_HUBS_PERMISSION_DENIED" => Self::EventHubsPermissionDenied,
1742                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
1743                    "NAMESPACE_NOT_FOUND" => Self::NamespaceNotFound,
1744                    "EVENT_HUB_NOT_FOUND" => Self::EventHubNotFound,
1745                    "SUBSCRIPTION_NOT_FOUND" => Self::SubscriptionNotFound,
1746                    "RESOURCE_GROUP_NOT_FOUND" => Self::ResourceGroupNotFound,
1747                    "CONFLICTING_REGION_CONSTRAINTS" => Self::ConflictingRegionConstraints,
1748                    _ => Self::UnknownValue(state::UnknownValue(
1749                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1750                    )),
1751                }
1752            }
1753        }
1754
1755        impl serde::ser::Serialize for State {
1756            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1757            where
1758                S: serde::Serializer,
1759            {
1760                match self {
1761                    Self::Unspecified => serializer.serialize_i32(0),
1762                    Self::Active => serializer.serialize_i32(1),
1763                    Self::EventHubsPermissionDenied => serializer.serialize_i32(2),
1764                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
1765                    Self::NamespaceNotFound => serializer.serialize_i32(4),
1766                    Self::EventHubNotFound => serializer.serialize_i32(5),
1767                    Self::SubscriptionNotFound => serializer.serialize_i32(6),
1768                    Self::ResourceGroupNotFound => serializer.serialize_i32(7),
1769                    Self::ConflictingRegionConstraints => serializer.serialize_i32(8),
1770                    Self::UnknownValue(u) => u.0.serialize(serializer),
1771                }
1772            }
1773        }
1774
1775        impl<'de> serde::de::Deserialize<'de> for State {
1776            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1777            where
1778                D: serde::Deserializer<'de>,
1779            {
1780                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1781                    ".google.pubsub.v1.IngestionDataSourceSettings.AzureEventHubs.State",
1782                ))
1783            }
1784        }
1785    }
1786
1787    /// Ingestion settings for Amazon MSK.
1788    #[derive(Clone, Default, PartialEq)]
1789    #[non_exhaustive]
1790    pub struct AwsMsk {
1791        /// Output only. An output-only field that indicates the state of the Amazon
1792        /// MSK ingestion source.
1793        pub state: crate::model::ingestion_data_source_settings::aws_msk::State,
1794
1795        /// Required. The Amazon Resource Name (ARN) that uniquely identifies the
1796        /// cluster.
1797        pub cluster_arn: std::string::String,
1798
1799        /// Required. The name of the topic in the Amazon MSK cluster that Pub/Sub
1800        /// will import from.
1801        pub topic: std::string::String,
1802
1803        /// Required. AWS role ARN to be used for Federated Identity authentication
1804        /// with Amazon MSK. Check the Pub/Sub docs for how to set up this role and
1805        /// the required permissions that need to be attached to it.
1806        pub aws_role_arn: std::string::String,
1807
1808        /// Required. The GCP service account to be used for Federated Identity
1809        /// authentication with Amazon MSK (via a `AssumeRoleWithWebIdentity` call
1810        /// for the provided role). The `aws_role_arn` must be set up with
1811        /// `accounts.google.com:sub` equals to this service account number.
1812        pub gcp_service_account: std::string::String,
1813
1814        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1815    }
1816
1817    impl AwsMsk {
1818        /// Creates a new default instance.
1819        pub fn new() -> Self {
1820            std::default::Default::default()
1821        }
1822
1823        /// Sets the value of [state][crate::model::ingestion_data_source_settings::AwsMsk::state].
1824        ///
1825        /// # Example
1826        /// ```ignore,no_run
1827        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
1828        /// use google_cloud_pubsub::model::ingestion_data_source_settings::aws_msk::State;
1829        /// let x0 = AwsMsk::new().set_state(State::Active);
1830        /// let x1 = AwsMsk::new().set_state(State::MskPermissionDenied);
1831        /// let x2 = AwsMsk::new().set_state(State::PublishPermissionDenied);
1832        /// ```
1833        pub fn set_state<
1834            T: std::convert::Into<crate::model::ingestion_data_source_settings::aws_msk::State>,
1835        >(
1836            mut self,
1837            v: T,
1838        ) -> Self {
1839            self.state = v.into();
1840            self
1841        }
1842
1843        /// Sets the value of [cluster_arn][crate::model::ingestion_data_source_settings::AwsMsk::cluster_arn].
1844        ///
1845        /// # Example
1846        /// ```ignore,no_run
1847        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
1848        /// let x = AwsMsk::new().set_cluster_arn("example");
1849        /// ```
1850        pub fn set_cluster_arn<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1851            self.cluster_arn = v.into();
1852            self
1853        }
1854
1855        /// Sets the value of [topic][crate::model::ingestion_data_source_settings::AwsMsk::topic].
1856        ///
1857        /// # Example
1858        /// ```ignore,no_run
1859        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
1860        /// # let project_id = "project_id";
1861        /// # let topic_id = "topic_id";
1862        /// let x = AwsMsk::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
1863        /// ```
1864        pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1865            self.topic = v.into();
1866            self
1867        }
1868
1869        /// Sets the value of [aws_role_arn][crate::model::ingestion_data_source_settings::AwsMsk::aws_role_arn].
1870        ///
1871        /// # Example
1872        /// ```ignore,no_run
1873        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
1874        /// let x = AwsMsk::new().set_aws_role_arn("example");
1875        /// ```
1876        pub fn set_aws_role_arn<T: std::convert::Into<std::string::String>>(
1877            mut self,
1878            v: T,
1879        ) -> Self {
1880            self.aws_role_arn = v.into();
1881            self
1882        }
1883
1884        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::AwsMsk::gcp_service_account].
1885        ///
1886        /// # Example
1887        /// ```ignore,no_run
1888        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::AwsMsk;
1889        /// let x = AwsMsk::new().set_gcp_service_account("example");
1890        /// ```
1891        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
1892            mut self,
1893            v: T,
1894        ) -> Self {
1895            self.gcp_service_account = v.into();
1896            self
1897        }
1898    }
1899
1900    impl wkt::message::Message for AwsMsk {
1901        fn typename() -> &'static str {
1902            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.AwsMsk"
1903        }
1904    }
1905
1906    /// Defines additional types related to [AwsMsk].
1907    pub mod aws_msk {
1908        #[allow(unused_imports)]
1909        use super::*;
1910
1911        /// Possible states for managed ingestion from Amazon MSK.
1912        ///
1913        /// # Working with unknown values
1914        ///
1915        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1916        /// additional enum variants at any time. Adding new variants is not considered
1917        /// a breaking change. Applications should write their code in anticipation of:
1918        ///
1919        /// - New values appearing in future releases of the client library, **and**
1920        /// - New values received dynamically, without application changes.
1921        ///
1922        /// Please consult the [Working with enums] section in the user guide for some
1923        /// guidelines.
1924        ///
1925        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1926        #[derive(Clone, Debug, PartialEq)]
1927        #[non_exhaustive]
1928        pub enum State {
1929            /// Default value. This value is unused.
1930            Unspecified,
1931            /// Ingestion is active.
1932            Active,
1933            /// Permission denied encountered while consuming data from Amazon MSK.
1934            MskPermissionDenied,
1935            /// Permission denied encountered while publishing to the topic.
1936            PublishPermissionDenied,
1937            /// The provided MSK cluster wasn't found.
1938            ClusterNotFound,
1939            /// The provided topic wasn't found.
1940            TopicNotFound,
1941            /// Indicates an error state where the ingestion source cannot be
1942            /// processed because the selected ingestion region is not permitted
1943            /// by the Regional Access Boundary (RAB) restrictions on the project's
1944            /// service account.
1945            ConflictingRegionConstraints,
1946            /// If set, the enum was initialized with an unknown value.
1947            ///
1948            /// Applications can examine the value using [State::value] or
1949            /// [State::name].
1950            UnknownValue(state::UnknownValue),
1951        }
1952
1953        #[doc(hidden)]
1954        pub mod state {
1955            #[allow(unused_imports)]
1956            use super::*;
1957            #[derive(Clone, Debug, PartialEq)]
1958            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1959        }
1960
1961        impl State {
1962            /// Gets the enum value.
1963            ///
1964            /// Returns `None` if the enum contains an unknown value deserialized from
1965            /// the string representation of enums.
1966            pub fn value(&self) -> std::option::Option<i32> {
1967                match self {
1968                    Self::Unspecified => std::option::Option::Some(0),
1969                    Self::Active => std::option::Option::Some(1),
1970                    Self::MskPermissionDenied => std::option::Option::Some(2),
1971                    Self::PublishPermissionDenied => std::option::Option::Some(3),
1972                    Self::ClusterNotFound => std::option::Option::Some(4),
1973                    Self::TopicNotFound => std::option::Option::Some(5),
1974                    Self::ConflictingRegionConstraints => std::option::Option::Some(6),
1975                    Self::UnknownValue(u) => u.0.value(),
1976                }
1977            }
1978
1979            /// Gets the enum value as a string.
1980            ///
1981            /// Returns `None` if the enum contains an unknown value deserialized from
1982            /// the integer representation of enums.
1983            pub fn name(&self) -> std::option::Option<&str> {
1984                match self {
1985                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1986                    Self::Active => std::option::Option::Some("ACTIVE"),
1987                    Self::MskPermissionDenied => std::option::Option::Some("MSK_PERMISSION_DENIED"),
1988                    Self::PublishPermissionDenied => {
1989                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
1990                    }
1991                    Self::ClusterNotFound => std::option::Option::Some("CLUSTER_NOT_FOUND"),
1992                    Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
1993                    Self::ConflictingRegionConstraints => {
1994                        std::option::Option::Some("CONFLICTING_REGION_CONSTRAINTS")
1995                    }
1996                    Self::UnknownValue(u) => u.0.name(),
1997                }
1998            }
1999        }
2000
2001        impl std::default::Default for State {
2002            fn default() -> Self {
2003                use std::convert::From;
2004                Self::from(0)
2005            }
2006        }
2007
2008        impl std::fmt::Display for State {
2009            fn fmt(
2010                &self,
2011                f: &mut std::fmt::Formatter<'_>,
2012            ) -> std::result::Result<(), std::fmt::Error> {
2013                wkt::internal::display_enum(f, self.name(), self.value())
2014            }
2015        }
2016
2017        impl std::convert::From<i32> for State {
2018            fn from(value: i32) -> Self {
2019                match value {
2020                    0 => Self::Unspecified,
2021                    1 => Self::Active,
2022                    2 => Self::MskPermissionDenied,
2023                    3 => Self::PublishPermissionDenied,
2024                    4 => Self::ClusterNotFound,
2025                    5 => Self::TopicNotFound,
2026                    6 => Self::ConflictingRegionConstraints,
2027                    _ => Self::UnknownValue(state::UnknownValue(
2028                        wkt::internal::UnknownEnumValue::Integer(value),
2029                    )),
2030                }
2031            }
2032        }
2033
2034        impl std::convert::From<&str> for State {
2035            fn from(value: &str) -> Self {
2036                use std::string::ToString;
2037                match value {
2038                    "STATE_UNSPECIFIED" => Self::Unspecified,
2039                    "ACTIVE" => Self::Active,
2040                    "MSK_PERMISSION_DENIED" => Self::MskPermissionDenied,
2041                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
2042                    "CLUSTER_NOT_FOUND" => Self::ClusterNotFound,
2043                    "TOPIC_NOT_FOUND" => Self::TopicNotFound,
2044                    "CONFLICTING_REGION_CONSTRAINTS" => Self::ConflictingRegionConstraints,
2045                    _ => Self::UnknownValue(state::UnknownValue(
2046                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2047                    )),
2048                }
2049            }
2050        }
2051
2052        impl serde::ser::Serialize for State {
2053            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2054            where
2055                S: serde::Serializer,
2056            {
2057                match self {
2058                    Self::Unspecified => serializer.serialize_i32(0),
2059                    Self::Active => serializer.serialize_i32(1),
2060                    Self::MskPermissionDenied => serializer.serialize_i32(2),
2061                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
2062                    Self::ClusterNotFound => serializer.serialize_i32(4),
2063                    Self::TopicNotFound => serializer.serialize_i32(5),
2064                    Self::ConflictingRegionConstraints => serializer.serialize_i32(6),
2065                    Self::UnknownValue(u) => u.0.serialize(serializer),
2066                }
2067            }
2068        }
2069
2070        impl<'de> serde::de::Deserialize<'de> for State {
2071            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2072            where
2073                D: serde::Deserializer<'de>,
2074            {
2075                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2076                    ".google.pubsub.v1.IngestionDataSourceSettings.AwsMsk.State",
2077                ))
2078            }
2079        }
2080    }
2081
2082    /// Ingestion settings for Confluent Cloud.
2083    #[derive(Clone, Default, PartialEq)]
2084    #[non_exhaustive]
2085    pub struct ConfluentCloud {
2086        /// Output only. An output-only field that indicates the state of the
2087        /// Confluent Cloud ingestion source.
2088        pub state: crate::model::ingestion_data_source_settings::confluent_cloud::State,
2089
2090        /// Required. The address of the bootstrap server. The format is url:port.
2091        pub bootstrap_server: std::string::String,
2092
2093        /// Required. The id of the cluster.
2094        pub cluster_id: std::string::String,
2095
2096        /// Required. The name of the topic in the Confluent Cloud cluster that
2097        /// Pub/Sub will import from.
2098        pub topic: std::string::String,
2099
2100        /// Required. The id of the identity pool to be used for Federated Identity
2101        /// authentication with Confluent Cloud. See
2102        /// <https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools>.
2103        pub identity_pool_id: std::string::String,
2104
2105        /// Required. The GCP service account to be used for Federated Identity
2106        /// authentication with `identity_pool_id`.
2107        pub gcp_service_account: std::string::String,
2108
2109        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2110    }
2111
2112    impl ConfluentCloud {
2113        /// Creates a new default instance.
2114        pub fn new() -> Self {
2115            std::default::Default::default()
2116        }
2117
2118        /// Sets the value of [state][crate::model::ingestion_data_source_settings::ConfluentCloud::state].
2119        ///
2120        /// # Example
2121        /// ```ignore,no_run
2122        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2123        /// use google_cloud_pubsub::model::ingestion_data_source_settings::confluent_cloud::State;
2124        /// let x0 = ConfluentCloud::new().set_state(State::Active);
2125        /// let x1 = ConfluentCloud::new().set_state(State::ConfluentCloudPermissionDenied);
2126        /// let x2 = ConfluentCloud::new().set_state(State::PublishPermissionDenied);
2127        /// ```
2128        pub fn set_state<
2129            T: std::convert::Into<
2130                    crate::model::ingestion_data_source_settings::confluent_cloud::State,
2131                >,
2132        >(
2133            mut self,
2134            v: T,
2135        ) -> Self {
2136            self.state = v.into();
2137            self
2138        }
2139
2140        /// Sets the value of [bootstrap_server][crate::model::ingestion_data_source_settings::ConfluentCloud::bootstrap_server].
2141        ///
2142        /// # Example
2143        /// ```ignore,no_run
2144        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2145        /// let x = ConfluentCloud::new().set_bootstrap_server("example");
2146        /// ```
2147        pub fn set_bootstrap_server<T: std::convert::Into<std::string::String>>(
2148            mut self,
2149            v: T,
2150        ) -> Self {
2151            self.bootstrap_server = v.into();
2152            self
2153        }
2154
2155        /// Sets the value of [cluster_id][crate::model::ingestion_data_source_settings::ConfluentCloud::cluster_id].
2156        ///
2157        /// # Example
2158        /// ```ignore,no_run
2159        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2160        /// let x = ConfluentCloud::new().set_cluster_id("example");
2161        /// ```
2162        pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2163            self.cluster_id = v.into();
2164            self
2165        }
2166
2167        /// Sets the value of [topic][crate::model::ingestion_data_source_settings::ConfluentCloud::topic].
2168        ///
2169        /// # Example
2170        /// ```ignore,no_run
2171        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2172        /// let x = ConfluentCloud::new().set_topic("example");
2173        /// ```
2174        pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2175            self.topic = v.into();
2176            self
2177        }
2178
2179        /// Sets the value of [identity_pool_id][crate::model::ingestion_data_source_settings::ConfluentCloud::identity_pool_id].
2180        ///
2181        /// # Example
2182        /// ```ignore,no_run
2183        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2184        /// let x = ConfluentCloud::new().set_identity_pool_id("example");
2185        /// ```
2186        pub fn set_identity_pool_id<T: std::convert::Into<std::string::String>>(
2187            mut self,
2188            v: T,
2189        ) -> Self {
2190            self.identity_pool_id = v.into();
2191            self
2192        }
2193
2194        /// Sets the value of [gcp_service_account][crate::model::ingestion_data_source_settings::ConfluentCloud::gcp_service_account].
2195        ///
2196        /// # Example
2197        /// ```ignore,no_run
2198        /// # use google_cloud_pubsub::model::ingestion_data_source_settings::ConfluentCloud;
2199        /// let x = ConfluentCloud::new().set_gcp_service_account("example");
2200        /// ```
2201        pub fn set_gcp_service_account<T: std::convert::Into<std::string::String>>(
2202            mut self,
2203            v: T,
2204        ) -> Self {
2205            self.gcp_service_account = v.into();
2206            self
2207        }
2208    }
2209
2210    impl wkt::message::Message for ConfluentCloud {
2211        fn typename() -> &'static str {
2212            "type.googleapis.com/google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud"
2213        }
2214    }
2215
2216    /// Defines additional types related to [ConfluentCloud].
2217    pub mod confluent_cloud {
2218        #[allow(unused_imports)]
2219        use super::*;
2220
2221        /// Possible states for managed ingestion from Confluent Cloud.
2222        ///
2223        /// # Working with unknown values
2224        ///
2225        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2226        /// additional enum variants at any time. Adding new variants is not considered
2227        /// a breaking change. Applications should write their code in anticipation of:
2228        ///
2229        /// - New values appearing in future releases of the client library, **and**
2230        /// - New values received dynamically, without application changes.
2231        ///
2232        /// Please consult the [Working with enums] section in the user guide for some
2233        /// guidelines.
2234        ///
2235        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2236        #[derive(Clone, Debug, PartialEq)]
2237        #[non_exhaustive]
2238        pub enum State {
2239            /// Default value. This value is unused.
2240            Unspecified,
2241            /// Ingestion is active.
2242            Active,
2243            /// Permission denied encountered while consuming data from Confluent
2244            /// Cloud.
2245            ConfluentCloudPermissionDenied,
2246            /// Permission denied encountered while publishing to the topic.
2247            PublishPermissionDenied,
2248            /// The provided bootstrap server address is unreachable.
2249            UnreachableBootstrapServer,
2250            /// The provided cluster wasn't found.
2251            ClusterNotFound,
2252            /// The provided topic wasn't found.
2253            TopicNotFound,
2254            /// Indicates an error state where the ingestion source cannot be
2255            /// processed because the selected ingestion region is not permitted
2256            /// by the Regional Access Boundary (RAB) restrictions on the project's
2257            /// service account.
2258            ConflictingRegionConstraints,
2259            /// If set, the enum was initialized with an unknown value.
2260            ///
2261            /// Applications can examine the value using [State::value] or
2262            /// [State::name].
2263            UnknownValue(state::UnknownValue),
2264        }
2265
2266        #[doc(hidden)]
2267        pub mod state {
2268            #[allow(unused_imports)]
2269            use super::*;
2270            #[derive(Clone, Debug, PartialEq)]
2271            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2272        }
2273
2274        impl State {
2275            /// Gets the enum value.
2276            ///
2277            /// Returns `None` if the enum contains an unknown value deserialized from
2278            /// the string representation of enums.
2279            pub fn value(&self) -> std::option::Option<i32> {
2280                match self {
2281                    Self::Unspecified => std::option::Option::Some(0),
2282                    Self::Active => std::option::Option::Some(1),
2283                    Self::ConfluentCloudPermissionDenied => std::option::Option::Some(2),
2284                    Self::PublishPermissionDenied => std::option::Option::Some(3),
2285                    Self::UnreachableBootstrapServer => std::option::Option::Some(4),
2286                    Self::ClusterNotFound => std::option::Option::Some(5),
2287                    Self::TopicNotFound => std::option::Option::Some(6),
2288                    Self::ConflictingRegionConstraints => std::option::Option::Some(7),
2289                    Self::UnknownValue(u) => u.0.value(),
2290                }
2291            }
2292
2293            /// Gets the enum value as a string.
2294            ///
2295            /// Returns `None` if the enum contains an unknown value deserialized from
2296            /// the integer representation of enums.
2297            pub fn name(&self) -> std::option::Option<&str> {
2298                match self {
2299                    Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2300                    Self::Active => std::option::Option::Some("ACTIVE"),
2301                    Self::ConfluentCloudPermissionDenied => {
2302                        std::option::Option::Some("CONFLUENT_CLOUD_PERMISSION_DENIED")
2303                    }
2304                    Self::PublishPermissionDenied => {
2305                        std::option::Option::Some("PUBLISH_PERMISSION_DENIED")
2306                    }
2307                    Self::UnreachableBootstrapServer => {
2308                        std::option::Option::Some("UNREACHABLE_BOOTSTRAP_SERVER")
2309                    }
2310                    Self::ClusterNotFound => std::option::Option::Some("CLUSTER_NOT_FOUND"),
2311                    Self::TopicNotFound => std::option::Option::Some("TOPIC_NOT_FOUND"),
2312                    Self::ConflictingRegionConstraints => {
2313                        std::option::Option::Some("CONFLICTING_REGION_CONSTRAINTS")
2314                    }
2315                    Self::UnknownValue(u) => u.0.name(),
2316                }
2317            }
2318        }
2319
2320        impl std::default::Default for State {
2321            fn default() -> Self {
2322                use std::convert::From;
2323                Self::from(0)
2324            }
2325        }
2326
2327        impl std::fmt::Display for State {
2328            fn fmt(
2329                &self,
2330                f: &mut std::fmt::Formatter<'_>,
2331            ) -> std::result::Result<(), std::fmt::Error> {
2332                wkt::internal::display_enum(f, self.name(), self.value())
2333            }
2334        }
2335
2336        impl std::convert::From<i32> for State {
2337            fn from(value: i32) -> Self {
2338                match value {
2339                    0 => Self::Unspecified,
2340                    1 => Self::Active,
2341                    2 => Self::ConfluentCloudPermissionDenied,
2342                    3 => Self::PublishPermissionDenied,
2343                    4 => Self::UnreachableBootstrapServer,
2344                    5 => Self::ClusterNotFound,
2345                    6 => Self::TopicNotFound,
2346                    7 => Self::ConflictingRegionConstraints,
2347                    _ => Self::UnknownValue(state::UnknownValue(
2348                        wkt::internal::UnknownEnumValue::Integer(value),
2349                    )),
2350                }
2351            }
2352        }
2353
2354        impl std::convert::From<&str> for State {
2355            fn from(value: &str) -> Self {
2356                use std::string::ToString;
2357                match value {
2358                    "STATE_UNSPECIFIED" => Self::Unspecified,
2359                    "ACTIVE" => Self::Active,
2360                    "CONFLUENT_CLOUD_PERMISSION_DENIED" => Self::ConfluentCloudPermissionDenied,
2361                    "PUBLISH_PERMISSION_DENIED" => Self::PublishPermissionDenied,
2362                    "UNREACHABLE_BOOTSTRAP_SERVER" => Self::UnreachableBootstrapServer,
2363                    "CLUSTER_NOT_FOUND" => Self::ClusterNotFound,
2364                    "TOPIC_NOT_FOUND" => Self::TopicNotFound,
2365                    "CONFLICTING_REGION_CONSTRAINTS" => Self::ConflictingRegionConstraints,
2366                    _ => Self::UnknownValue(state::UnknownValue(
2367                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2368                    )),
2369                }
2370            }
2371        }
2372
2373        impl serde::ser::Serialize for State {
2374            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2375            where
2376                S: serde::Serializer,
2377            {
2378                match self {
2379                    Self::Unspecified => serializer.serialize_i32(0),
2380                    Self::Active => serializer.serialize_i32(1),
2381                    Self::ConfluentCloudPermissionDenied => serializer.serialize_i32(2),
2382                    Self::PublishPermissionDenied => serializer.serialize_i32(3),
2383                    Self::UnreachableBootstrapServer => serializer.serialize_i32(4),
2384                    Self::ClusterNotFound => serializer.serialize_i32(5),
2385                    Self::TopicNotFound => serializer.serialize_i32(6),
2386                    Self::ConflictingRegionConstraints => serializer.serialize_i32(7),
2387                    Self::UnknownValue(u) => u.0.serialize(serializer),
2388                }
2389            }
2390        }
2391
2392        impl<'de> serde::de::Deserialize<'de> for State {
2393            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2394            where
2395                D: serde::Deserializer<'de>,
2396            {
2397                deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2398                    ".google.pubsub.v1.IngestionDataSourceSettings.ConfluentCloud.State",
2399                ))
2400            }
2401        }
2402    }
2403
2404    /// Only one source type can have settings set.
2405    #[derive(Clone, Debug, PartialEq)]
2406    #[non_exhaustive]
2407    pub enum Source {
2408        /// Optional. Amazon Kinesis Data Streams.
2409        AwsKinesis(std::boxed::Box<crate::model::ingestion_data_source_settings::AwsKinesis>),
2410        /// Optional. Cloud Storage.
2411        CloudStorage(std::boxed::Box<crate::model::ingestion_data_source_settings::CloudStorage>),
2412        /// Optional. Azure Event Hubs.
2413        AzureEventHubs(
2414            std::boxed::Box<crate::model::ingestion_data_source_settings::AzureEventHubs>,
2415        ),
2416        /// Optional. Amazon MSK.
2417        AwsMsk(std::boxed::Box<crate::model::ingestion_data_source_settings::AwsMsk>),
2418        /// Optional. Confluent Cloud.
2419        ConfluentCloud(
2420            std::boxed::Box<crate::model::ingestion_data_source_settings::ConfluentCloud>,
2421        ),
2422    }
2423}
2424
2425/// Settings for Platform Logs produced by Pub/Sub.
2426#[derive(Clone, Default, PartialEq)]
2427#[non_exhaustive]
2428pub struct PlatformLogsSettings {
2429    /// Optional. The minimum severity level of Platform Logs that will be written.
2430    pub severity: crate::model::platform_logs_settings::Severity,
2431
2432    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2433}
2434
2435impl PlatformLogsSettings {
2436    /// Creates a new default instance.
2437    pub fn new() -> Self {
2438        std::default::Default::default()
2439    }
2440
2441    /// Sets the value of [severity][crate::model::PlatformLogsSettings::severity].
2442    ///
2443    /// # Example
2444    /// ```ignore,no_run
2445    /// # use google_cloud_pubsub::model::PlatformLogsSettings;
2446    /// use google_cloud_pubsub::model::platform_logs_settings::Severity;
2447    /// let x0 = PlatformLogsSettings::new().set_severity(Severity::Disabled);
2448    /// let x1 = PlatformLogsSettings::new().set_severity(Severity::Debug);
2449    /// let x2 = PlatformLogsSettings::new().set_severity(Severity::Info);
2450    /// ```
2451    pub fn set_severity<T: std::convert::Into<crate::model::platform_logs_settings::Severity>>(
2452        mut self,
2453        v: T,
2454    ) -> Self {
2455        self.severity = v.into();
2456        self
2457    }
2458}
2459
2460impl wkt::message::Message for PlatformLogsSettings {
2461    fn typename() -> &'static str {
2462        "type.googleapis.com/google.pubsub.v1.PlatformLogsSettings"
2463    }
2464}
2465
2466/// Defines additional types related to [PlatformLogsSettings].
2467pub mod platform_logs_settings {
2468    #[allow(unused_imports)]
2469    use super::*;
2470
2471    /// Severity levels of Platform Logs.
2472    ///
2473    /// # Working with unknown values
2474    ///
2475    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2476    /// additional enum variants at any time. Adding new variants is not considered
2477    /// a breaking change. Applications should write their code in anticipation of:
2478    ///
2479    /// - New values appearing in future releases of the client library, **and**
2480    /// - New values received dynamically, without application changes.
2481    ///
2482    /// Please consult the [Working with enums] section in the user guide for some
2483    /// guidelines.
2484    ///
2485    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2486    #[derive(Clone, Debug, PartialEq)]
2487    #[non_exhaustive]
2488    pub enum Severity {
2489        /// Default value. Logs level is unspecified. Logs will be disabled.
2490        Unspecified,
2491        /// Logs will be disabled.
2492        Disabled,
2493        /// Debug logs and higher-severity logs will be written.
2494        Debug,
2495        /// Info logs and higher-severity logs will be written.
2496        Info,
2497        /// Warning logs and higher-severity logs will be written.
2498        Warning,
2499        /// Only error logs will be written.
2500        Error,
2501        /// If set, the enum was initialized with an unknown value.
2502        ///
2503        /// Applications can examine the value using [Severity::value] or
2504        /// [Severity::name].
2505        UnknownValue(severity::UnknownValue),
2506    }
2507
2508    #[doc(hidden)]
2509    pub mod severity {
2510        #[allow(unused_imports)]
2511        use super::*;
2512        #[derive(Clone, Debug, PartialEq)]
2513        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2514    }
2515
2516    impl Severity {
2517        /// Gets the enum value.
2518        ///
2519        /// Returns `None` if the enum contains an unknown value deserialized from
2520        /// the string representation of enums.
2521        pub fn value(&self) -> std::option::Option<i32> {
2522            match self {
2523                Self::Unspecified => std::option::Option::Some(0),
2524                Self::Disabled => std::option::Option::Some(1),
2525                Self::Debug => std::option::Option::Some(2),
2526                Self::Info => std::option::Option::Some(3),
2527                Self::Warning => std::option::Option::Some(4),
2528                Self::Error => std::option::Option::Some(5),
2529                Self::UnknownValue(u) => u.0.value(),
2530            }
2531        }
2532
2533        /// Gets the enum value as a string.
2534        ///
2535        /// Returns `None` if the enum contains an unknown value deserialized from
2536        /// the integer representation of enums.
2537        pub fn name(&self) -> std::option::Option<&str> {
2538            match self {
2539                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
2540                Self::Disabled => std::option::Option::Some("DISABLED"),
2541                Self::Debug => std::option::Option::Some("DEBUG"),
2542                Self::Info => std::option::Option::Some("INFO"),
2543                Self::Warning => std::option::Option::Some("WARNING"),
2544                Self::Error => std::option::Option::Some("ERROR"),
2545                Self::UnknownValue(u) => u.0.name(),
2546            }
2547        }
2548    }
2549
2550    impl std::default::Default for Severity {
2551        fn default() -> Self {
2552            use std::convert::From;
2553            Self::from(0)
2554        }
2555    }
2556
2557    impl std::fmt::Display for Severity {
2558        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2559            wkt::internal::display_enum(f, self.name(), self.value())
2560        }
2561    }
2562
2563    impl std::convert::From<i32> for Severity {
2564        fn from(value: i32) -> Self {
2565            match value {
2566                0 => Self::Unspecified,
2567                1 => Self::Disabled,
2568                2 => Self::Debug,
2569                3 => Self::Info,
2570                4 => Self::Warning,
2571                5 => Self::Error,
2572                _ => Self::UnknownValue(severity::UnknownValue(
2573                    wkt::internal::UnknownEnumValue::Integer(value),
2574                )),
2575            }
2576        }
2577    }
2578
2579    impl std::convert::From<&str> for Severity {
2580        fn from(value: &str) -> Self {
2581            use std::string::ToString;
2582            match value {
2583                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
2584                "DISABLED" => Self::Disabled,
2585                "DEBUG" => Self::Debug,
2586                "INFO" => Self::Info,
2587                "WARNING" => Self::Warning,
2588                "ERROR" => Self::Error,
2589                _ => Self::UnknownValue(severity::UnknownValue(
2590                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2591                )),
2592            }
2593        }
2594    }
2595
2596    impl serde::ser::Serialize for Severity {
2597        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2598        where
2599            S: serde::Serializer,
2600        {
2601            match self {
2602                Self::Unspecified => serializer.serialize_i32(0),
2603                Self::Disabled => serializer.serialize_i32(1),
2604                Self::Debug => serializer.serialize_i32(2),
2605                Self::Info => serializer.serialize_i32(3),
2606                Self::Warning => serializer.serialize_i32(4),
2607                Self::Error => serializer.serialize_i32(5),
2608                Self::UnknownValue(u) => u.0.serialize(serializer),
2609            }
2610        }
2611    }
2612
2613    impl<'de> serde::de::Deserialize<'de> for Severity {
2614        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2615        where
2616            D: serde::Deserializer<'de>,
2617        {
2618            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
2619                ".google.pubsub.v1.PlatformLogsSettings.Severity",
2620            ))
2621        }
2622    }
2623}
2624
2625/// User-defined JavaScript function that can transform or filter a Pub/Sub
2626/// message.
2627#[derive(Clone, Default, PartialEq)]
2628#[non_exhaustive]
2629pub struct JavaScriptUDF {
2630    /// Required. Name of the JavasScript function that should applied to Pub/Sub
2631    /// messages.
2632    pub function_name: std::string::String,
2633
2634    /// Required. JavaScript code that contains a function `function_name` with the
2635    /// below signature:
2636    ///
2637    /// ```norust
2638    ///   /**
2639    ///   * Transforms a Pub/Sub message.
2640    ///
2641    ///   * @return {(Object<string, (string | Object<string, string>)>|null)} - To
2642    ///   * filter a message, return `null`. To transform a message return a map
2643    ///   * with the following keys:
2644    ///   *   - (required) 'data' : {string}
2645    ///   *   - (optional) 'attributes' : {Object<string, string>}
2646    ///   * Returning empty `attributes` will remove all attributes from the
2647    ///   * message.
2648    ///   *
2649    ///   * @param  {(Object<string, (string | Object<string, string>)>} Pub/Sub
2650    ///   * message. Keys:
2651    ///   *   - (required) 'data' : {string}
2652    ///   *   - (required) 'attributes' : {Object<string, string>}
2653    ///   *
2654    ///   * @param  {Object<string, any>} metadata - Pub/Sub message metadata.
2655    ///   * Keys:
2656    ///   *   - (optional) 'message_id'  : {string}
2657    ///   *   - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
2658    ///   *   - (optional) 'ordering_key': {string}
2659    ///   */
2660    ///
2661    ///   function <function_name>(message, metadata) {
2662    ///   }
2663    /// ```
2664    pub code: std::string::String,
2665
2666    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2667}
2668
2669impl JavaScriptUDF {
2670    /// Creates a new default instance.
2671    pub fn new() -> Self {
2672        std::default::Default::default()
2673    }
2674
2675    /// Sets the value of [function_name][crate::model::JavaScriptUDF::function_name].
2676    ///
2677    /// # Example
2678    /// ```ignore,no_run
2679    /// # use google_cloud_pubsub::model::JavaScriptUDF;
2680    /// let x = JavaScriptUDF::new().set_function_name("example");
2681    /// ```
2682    pub fn set_function_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2683        self.function_name = v.into();
2684        self
2685    }
2686
2687    /// Sets the value of [code][crate::model::JavaScriptUDF::code].
2688    ///
2689    /// # Example
2690    /// ```ignore,no_run
2691    /// # use google_cloud_pubsub::model::JavaScriptUDF;
2692    /// let x = JavaScriptUDF::new().set_code("example");
2693    /// ```
2694    pub fn set_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2695        self.code = v.into();
2696        self
2697    }
2698}
2699
2700impl wkt::message::Message for JavaScriptUDF {
2701    fn typename() -> &'static str {
2702        "type.googleapis.com/google.pubsub.v1.JavaScriptUDF"
2703    }
2704}
2705
2706/// Configuration for compressing/decompressing message data using a
2707/// user-specified compression algorithm.
2708#[derive(Clone, Default, PartialEq)]
2709#[non_exhaustive]
2710pub struct Compression {
2711    /// Required. Specifies the compression algorithm to use.
2712    pub compression_algorithm: crate::model::compression::CompressionAlgorithm,
2713
2714    /// Required. Specifies whether to compress or decompress the message.
2715    pub compression_mode: crate::model::compression::CompressionMode,
2716
2717    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2718}
2719
2720impl Compression {
2721    /// Creates a new default instance.
2722    pub fn new() -> Self {
2723        std::default::Default::default()
2724    }
2725
2726    /// Sets the value of [compression_algorithm][crate::model::Compression::compression_algorithm].
2727    ///
2728    /// # Example
2729    /// ```ignore,no_run
2730    /// # use google_cloud_pubsub::model::Compression;
2731    /// use google_cloud_pubsub::model::compression::CompressionAlgorithm;
2732    /// let x0 = Compression::new().set_compression_algorithm(CompressionAlgorithm::Zlib);
2733    /// ```
2734    pub fn set_compression_algorithm<
2735        T: std::convert::Into<crate::model::compression::CompressionAlgorithm>,
2736    >(
2737        mut self,
2738        v: T,
2739    ) -> Self {
2740        self.compression_algorithm = v.into();
2741        self
2742    }
2743
2744    /// Sets the value of [compression_mode][crate::model::Compression::compression_mode].
2745    ///
2746    /// # Example
2747    /// ```ignore,no_run
2748    /// # use google_cloud_pubsub::model::Compression;
2749    /// use google_cloud_pubsub::model::compression::CompressionMode;
2750    /// let x0 = Compression::new().set_compression_mode(CompressionMode::Compress);
2751    /// let x1 = Compression::new().set_compression_mode(CompressionMode::Decompress);
2752    /// ```
2753    pub fn set_compression_mode<
2754        T: std::convert::Into<crate::model::compression::CompressionMode>,
2755    >(
2756        mut self,
2757        v: T,
2758    ) -> Self {
2759        self.compression_mode = v.into();
2760        self
2761    }
2762}
2763
2764impl wkt::message::Message for Compression {
2765    fn typename() -> &'static str {
2766        "type.googleapis.com/google.pubsub.v1.Compression"
2767    }
2768}
2769
2770/// Defines additional types related to [Compression].
2771pub mod compression {
2772    #[allow(unused_imports)]
2773    use super::*;
2774
2775    /// The compression algorithm to use.
2776    ///
2777    /// # Working with unknown values
2778    ///
2779    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2780    /// additional enum variants at any time. Adding new variants is not considered
2781    /// a breaking change. Applications should write their code in anticipation of:
2782    ///
2783    /// - New values appearing in future releases of the client library, **and**
2784    /// - New values received dynamically, without application changes.
2785    ///
2786    /// Please consult the [Working with enums] section in the user guide for some
2787    /// guidelines.
2788    ///
2789    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2790    #[derive(Clone, Debug, PartialEq)]
2791    #[non_exhaustive]
2792    pub enum CompressionAlgorithm {
2793        /// Unspecified algorithm.
2794        Unspecified,
2795        /// ZLIB compression.
2796        Zlib,
2797        /// If set, the enum was initialized with an unknown value.
2798        ///
2799        /// Applications can examine the value using [CompressionAlgorithm::value] or
2800        /// [CompressionAlgorithm::name].
2801        UnknownValue(compression_algorithm::UnknownValue),
2802    }
2803
2804    #[doc(hidden)]
2805    pub mod compression_algorithm {
2806        #[allow(unused_imports)]
2807        use super::*;
2808        #[derive(Clone, Debug, PartialEq)]
2809        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2810    }
2811
2812    impl CompressionAlgorithm {
2813        /// Gets the enum value.
2814        ///
2815        /// Returns `None` if the enum contains an unknown value deserialized from
2816        /// the string representation of enums.
2817        pub fn value(&self) -> std::option::Option<i32> {
2818            match self {
2819                Self::Unspecified => std::option::Option::Some(0),
2820                Self::Zlib => std::option::Option::Some(1),
2821                Self::UnknownValue(u) => u.0.value(),
2822            }
2823        }
2824
2825        /// Gets the enum value as a string.
2826        ///
2827        /// Returns `None` if the enum contains an unknown value deserialized from
2828        /// the integer representation of enums.
2829        pub fn name(&self) -> std::option::Option<&str> {
2830            match self {
2831                Self::Unspecified => std::option::Option::Some("COMPRESSION_ALGORITHM_UNSPECIFIED"),
2832                Self::Zlib => std::option::Option::Some("ZLIB"),
2833                Self::UnknownValue(u) => u.0.name(),
2834            }
2835        }
2836    }
2837
2838    impl std::default::Default for CompressionAlgorithm {
2839        fn default() -> Self {
2840            use std::convert::From;
2841            Self::from(0)
2842        }
2843    }
2844
2845    impl std::fmt::Display for CompressionAlgorithm {
2846        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2847            wkt::internal::display_enum(f, self.name(), self.value())
2848        }
2849    }
2850
2851    impl std::convert::From<i32> for CompressionAlgorithm {
2852        fn from(value: i32) -> Self {
2853            match value {
2854                0 => Self::Unspecified,
2855                1 => Self::Zlib,
2856                _ => Self::UnknownValue(compression_algorithm::UnknownValue(
2857                    wkt::internal::UnknownEnumValue::Integer(value),
2858                )),
2859            }
2860        }
2861    }
2862
2863    impl std::convert::From<&str> for CompressionAlgorithm {
2864        fn from(value: &str) -> Self {
2865            use std::string::ToString;
2866            match value {
2867                "COMPRESSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
2868                "ZLIB" => Self::Zlib,
2869                _ => Self::UnknownValue(compression_algorithm::UnknownValue(
2870                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2871                )),
2872            }
2873        }
2874    }
2875
2876    impl serde::ser::Serialize for CompressionAlgorithm {
2877        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2878        where
2879            S: serde::Serializer,
2880        {
2881            match self {
2882                Self::Unspecified => serializer.serialize_i32(0),
2883                Self::Zlib => serializer.serialize_i32(1),
2884                Self::UnknownValue(u) => u.0.serialize(serializer),
2885            }
2886        }
2887    }
2888
2889    impl<'de> serde::de::Deserialize<'de> for CompressionAlgorithm {
2890        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2891        where
2892            D: serde::Deserializer<'de>,
2893        {
2894            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionAlgorithm>::new(
2895                ".google.pubsub.v1.Compression.CompressionAlgorithm",
2896            ))
2897        }
2898    }
2899
2900    /// The mode of the compression SMT.
2901    ///
2902    /// # Working with unknown values
2903    ///
2904    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2905    /// additional enum variants at any time. Adding new variants is not considered
2906    /// a breaking change. Applications should write their code in anticipation of:
2907    ///
2908    /// - New values appearing in future releases of the client library, **and**
2909    /// - New values received dynamically, without application changes.
2910    ///
2911    /// Please consult the [Working with enums] section in the user guide for some
2912    /// guidelines.
2913    ///
2914    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2915    #[derive(Clone, Debug, PartialEq)]
2916    #[non_exhaustive]
2917    pub enum CompressionMode {
2918        /// Unspecified mode.
2919        Unspecified,
2920        /// Compress.
2921        Compress,
2922        /// Decompress.
2923        Decompress,
2924        /// If set, the enum was initialized with an unknown value.
2925        ///
2926        /// Applications can examine the value using [CompressionMode::value] or
2927        /// [CompressionMode::name].
2928        UnknownValue(compression_mode::UnknownValue),
2929    }
2930
2931    #[doc(hidden)]
2932    pub mod compression_mode {
2933        #[allow(unused_imports)]
2934        use super::*;
2935        #[derive(Clone, Debug, PartialEq)]
2936        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2937    }
2938
2939    impl CompressionMode {
2940        /// Gets the enum value.
2941        ///
2942        /// Returns `None` if the enum contains an unknown value deserialized from
2943        /// the string representation of enums.
2944        pub fn value(&self) -> std::option::Option<i32> {
2945            match self {
2946                Self::Unspecified => std::option::Option::Some(0),
2947                Self::Compress => std::option::Option::Some(1),
2948                Self::Decompress => std::option::Option::Some(2),
2949                Self::UnknownValue(u) => u.0.value(),
2950            }
2951        }
2952
2953        /// Gets the enum value as a string.
2954        ///
2955        /// Returns `None` if the enum contains an unknown value deserialized from
2956        /// the integer representation of enums.
2957        pub fn name(&self) -> std::option::Option<&str> {
2958            match self {
2959                Self::Unspecified => std::option::Option::Some("COMPRESSION_MODE_UNSPECIFIED"),
2960                Self::Compress => std::option::Option::Some("COMPRESS"),
2961                Self::Decompress => std::option::Option::Some("DECOMPRESS"),
2962                Self::UnknownValue(u) => u.0.name(),
2963            }
2964        }
2965    }
2966
2967    impl std::default::Default for CompressionMode {
2968        fn default() -> Self {
2969            use std::convert::From;
2970            Self::from(0)
2971        }
2972    }
2973
2974    impl std::fmt::Display for CompressionMode {
2975        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2976            wkt::internal::display_enum(f, self.name(), self.value())
2977        }
2978    }
2979
2980    impl std::convert::From<i32> for CompressionMode {
2981        fn from(value: i32) -> Self {
2982            match value {
2983                0 => Self::Unspecified,
2984                1 => Self::Compress,
2985                2 => Self::Decompress,
2986                _ => Self::UnknownValue(compression_mode::UnknownValue(
2987                    wkt::internal::UnknownEnumValue::Integer(value),
2988                )),
2989            }
2990        }
2991    }
2992
2993    impl std::convert::From<&str> for CompressionMode {
2994        fn from(value: &str) -> Self {
2995            use std::string::ToString;
2996            match value {
2997                "COMPRESSION_MODE_UNSPECIFIED" => Self::Unspecified,
2998                "COMPRESS" => Self::Compress,
2999                "DECOMPRESS" => Self::Decompress,
3000                _ => Self::UnknownValue(compression_mode::UnknownValue(
3001                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3002                )),
3003            }
3004        }
3005    }
3006
3007    impl serde::ser::Serialize for CompressionMode {
3008        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3009        where
3010            S: serde::Serializer,
3011        {
3012            match self {
3013                Self::Unspecified => serializer.serialize_i32(0),
3014                Self::Compress => serializer.serialize_i32(1),
3015                Self::Decompress => serializer.serialize_i32(2),
3016                Self::UnknownValue(u) => u.0.serialize(serializer),
3017            }
3018        }
3019    }
3020
3021    impl<'de> serde::de::Deserialize<'de> for CompressionMode {
3022        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3023        where
3024            D: serde::Deserializer<'de>,
3025        {
3026            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionMode>::new(
3027                ".google.pubsub.v1.Compression.CompressionMode",
3028            ))
3029        }
3030    }
3031}
3032
3033/// Configuration for making inference requests against Vertex AI models.
3034#[derive(Clone, Default, PartialEq)]
3035#[non_exhaustive]
3036pub struct AIInference {
3037    /// Required. An endpoint to a Vertex AI model of the form
3038    /// `projects/{project}/locations/{location}/endpoints/{endpoint}` or
3039    /// `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`.
3040    /// Vertex AI API requests will be sent to this endpoint.
3041    pub endpoint: std::string::String,
3042
3043    /// Optional. The service account to use to make prediction requests against
3044    /// endpoints. The resource creator or updater that specifies this field must
3045    /// have `iam.serviceAccounts.actAs` permission on the service account. If not
3046    /// specified, the Pub/Sub [service
3047    /// agent](https://cloud.google.com/iam/docs/service-agents),
3048    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
3049    pub service_account_email: std::string::String,
3050
3051    /// The format of inference requests made to the endpoint.
3052    pub inference_mode: std::option::Option<crate::model::ai_inference::InferenceMode>,
3053
3054    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3055}
3056
3057impl AIInference {
3058    /// Creates a new default instance.
3059    pub fn new() -> Self {
3060        std::default::Default::default()
3061    }
3062
3063    /// Sets the value of [endpoint][crate::model::AIInference::endpoint].
3064    ///
3065    /// # Example
3066    /// ```ignore,no_run
3067    /// # use google_cloud_pubsub::model::AIInference;
3068    /// let x = AIInference::new().set_endpoint("example");
3069    /// ```
3070    pub fn set_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3071        self.endpoint = v.into();
3072        self
3073    }
3074
3075    /// Sets the value of [service_account_email][crate::model::AIInference::service_account_email].
3076    ///
3077    /// # Example
3078    /// ```ignore,no_run
3079    /// # use google_cloud_pubsub::model::AIInference;
3080    /// let x = AIInference::new().set_service_account_email("example");
3081    /// ```
3082    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
3083        mut self,
3084        v: T,
3085    ) -> Self {
3086        self.service_account_email = v.into();
3087        self
3088    }
3089
3090    /// Sets the value of [inference_mode][crate::model::AIInference::inference_mode].
3091    ///
3092    /// Note that all the setters affecting `inference_mode` are mutually
3093    /// exclusive.
3094    ///
3095    /// # Example
3096    /// ```ignore,no_run
3097    /// # use google_cloud_pubsub::model::AIInference;
3098    /// use google_cloud_pubsub::model::ai_inference::UnstructuredInference;
3099    /// let x = AIInference::new().set_inference_mode(Some(
3100    ///     google_cloud_pubsub::model::ai_inference::InferenceMode::UnstructuredInference(UnstructuredInference::default().into())));
3101    /// ```
3102    pub fn set_inference_mode<
3103        T: std::convert::Into<std::option::Option<crate::model::ai_inference::InferenceMode>>,
3104    >(
3105        mut self,
3106        v: T,
3107    ) -> Self {
3108        self.inference_mode = v.into();
3109        self
3110    }
3111
3112    /// The value of [inference_mode][crate::model::AIInference::inference_mode]
3113    /// if it holds a `UnstructuredInference`, `None` if the field is not set or
3114    /// holds a different branch.
3115    pub fn unstructured_inference(
3116        &self,
3117    ) -> std::option::Option<&std::boxed::Box<crate::model::ai_inference::UnstructuredInference>>
3118    {
3119        #[allow(unreachable_patterns)]
3120        self.inference_mode.as_ref().and_then(|v| match v {
3121            crate::model::ai_inference::InferenceMode::UnstructuredInference(v) => {
3122                std::option::Option::Some(v)
3123            }
3124            _ => std::option::Option::None,
3125        })
3126    }
3127
3128    /// Sets the value of [inference_mode][crate::model::AIInference::inference_mode]
3129    /// to hold a `UnstructuredInference`.
3130    ///
3131    /// Note that all the setters affecting `inference_mode` are
3132    /// mutually exclusive.
3133    ///
3134    /// # Example
3135    /// ```ignore,no_run
3136    /// # use google_cloud_pubsub::model::AIInference;
3137    /// use google_cloud_pubsub::model::ai_inference::UnstructuredInference;
3138    /// let x = AIInference::new().set_unstructured_inference(UnstructuredInference::default()/* use setters */);
3139    /// assert!(x.unstructured_inference().is_some());
3140    /// ```
3141    pub fn set_unstructured_inference<
3142        T: std::convert::Into<std::boxed::Box<crate::model::ai_inference::UnstructuredInference>>,
3143    >(
3144        mut self,
3145        v: T,
3146    ) -> Self {
3147        self.inference_mode = std::option::Option::Some(
3148            crate::model::ai_inference::InferenceMode::UnstructuredInference(v.into()),
3149        );
3150        self
3151    }
3152}
3153
3154impl wkt::message::Message for AIInference {
3155    fn typename() -> &'static str {
3156        "type.googleapis.com/google.pubsub.v1.AIInference"
3157    }
3158}
3159
3160/// Defines additional types related to [AIInference].
3161pub mod ai_inference {
3162    #[allow(unused_imports)]
3163    use super::*;
3164
3165    /// Configuration for making inferences using arbitrary JSON payloads.
3166    #[derive(Clone, Default, PartialEq)]
3167    #[non_exhaustive]
3168    pub struct UnstructuredInference {
3169        /// Optional. A parameters object to be included in each inference request.
3170        /// The parameters object is combined with the data field of the Pub/Sub
3171        /// message to form the inference request.
3172        pub parameters: std::option::Option<wkt::Struct>,
3173
3174        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3175    }
3176
3177    impl UnstructuredInference {
3178        /// Creates a new default instance.
3179        pub fn new() -> Self {
3180            std::default::Default::default()
3181        }
3182
3183        /// Sets the value of [parameters][crate::model::ai_inference::UnstructuredInference::parameters].
3184        ///
3185        /// # Example
3186        /// ```ignore,no_run
3187        /// # use google_cloud_pubsub::model::ai_inference::UnstructuredInference;
3188        /// use wkt::Struct;
3189        /// let x = UnstructuredInference::new().set_parameters(Struct::default()/* use setters */);
3190        /// ```
3191        pub fn set_parameters<T>(mut self, v: T) -> Self
3192        where
3193            T: std::convert::Into<wkt::Struct>,
3194        {
3195            self.parameters = std::option::Option::Some(v.into());
3196            self
3197        }
3198
3199        /// Sets or clears the value of [parameters][crate::model::ai_inference::UnstructuredInference::parameters].
3200        ///
3201        /// # Example
3202        /// ```ignore,no_run
3203        /// # use google_cloud_pubsub::model::ai_inference::UnstructuredInference;
3204        /// use wkt::Struct;
3205        /// let x = UnstructuredInference::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
3206        /// let x = UnstructuredInference::new().set_or_clear_parameters(None::<Struct>);
3207        /// ```
3208        pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
3209        where
3210            T: std::convert::Into<wkt::Struct>,
3211        {
3212            self.parameters = v.map(|x| x.into());
3213            self
3214        }
3215    }
3216
3217    impl wkt::message::Message for UnstructuredInference {
3218        fn typename() -> &'static str {
3219            "type.googleapis.com/google.pubsub.v1.AIInference.UnstructuredInference"
3220        }
3221    }
3222
3223    /// The format of inference requests made to the endpoint.
3224    #[derive(Clone, Debug, PartialEq)]
3225    #[non_exhaustive]
3226    pub enum InferenceMode {
3227        /// Optional. Requests and responses can be any arbitrary JSON object.
3228        UnstructuredInference(std::boxed::Box<crate::model::ai_inference::UnstructuredInference>),
3229    }
3230}
3231
3232/// All supported message transforms types.
3233#[derive(Clone, Default, PartialEq)]
3234#[non_exhaustive]
3235pub struct MessageTransform {
3236    /// Optional. This field is deprecated, use the `disabled` field to disable
3237    /// transforms.
3238    #[deprecated]
3239    pub enabled: bool,
3240
3241    /// Optional. If true, the transform is disabled and will not be applied to
3242    /// messages. Defaults to `false`.
3243    pub disabled: bool,
3244
3245    /// The type of transform to apply to messages.
3246    pub transform: std::option::Option<crate::model::message_transform::Transform>,
3247
3248    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3249}
3250
3251impl MessageTransform {
3252    /// Creates a new default instance.
3253    pub fn new() -> Self {
3254        std::default::Default::default()
3255    }
3256
3257    /// Sets the value of [enabled][crate::model::MessageTransform::enabled].
3258    ///
3259    /// # Example
3260    /// ```ignore,no_run
3261    /// # use google_cloud_pubsub::model::MessageTransform;
3262    /// let x = MessageTransform::new().set_enabled(true);
3263    /// ```
3264    #[deprecated]
3265    pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3266        self.enabled = v.into();
3267        self
3268    }
3269
3270    /// Sets the value of [disabled][crate::model::MessageTransform::disabled].
3271    ///
3272    /// # Example
3273    /// ```ignore,no_run
3274    /// # use google_cloud_pubsub::model::MessageTransform;
3275    /// let x = MessageTransform::new().set_disabled(true);
3276    /// ```
3277    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3278        self.disabled = v.into();
3279        self
3280    }
3281
3282    /// Sets the value of [transform][crate::model::MessageTransform::transform].
3283    ///
3284    /// Note that all the setters affecting `transform` are mutually
3285    /// exclusive.
3286    ///
3287    /// # Example
3288    /// ```ignore,no_run
3289    /// # use google_cloud_pubsub::model::MessageTransform;
3290    /// use google_cloud_pubsub::model::JavaScriptUDF;
3291    /// let x = MessageTransform::new().set_transform(Some(
3292    ///     google_cloud_pubsub::model::message_transform::Transform::JavascriptUdf(JavaScriptUDF::default().into())));
3293    /// ```
3294    pub fn set_transform<
3295        T: std::convert::Into<std::option::Option<crate::model::message_transform::Transform>>,
3296    >(
3297        mut self,
3298        v: T,
3299    ) -> Self {
3300        self.transform = v.into();
3301        self
3302    }
3303
3304    /// The value of [transform][crate::model::MessageTransform::transform]
3305    /// if it holds a `JavascriptUdf`, `None` if the field is not set or
3306    /// holds a different branch.
3307    pub fn javascript_udf(
3308        &self,
3309    ) -> std::option::Option<&std::boxed::Box<crate::model::JavaScriptUDF>> {
3310        #[allow(unreachable_patterns)]
3311        self.transform.as_ref().and_then(|v| match v {
3312            crate::model::message_transform::Transform::JavascriptUdf(v) => {
3313                std::option::Option::Some(v)
3314            }
3315            _ => std::option::Option::None,
3316        })
3317    }
3318
3319    /// Sets the value of [transform][crate::model::MessageTransform::transform]
3320    /// to hold a `JavascriptUdf`.
3321    ///
3322    /// Note that all the setters affecting `transform` are
3323    /// mutually exclusive.
3324    ///
3325    /// # Example
3326    /// ```ignore,no_run
3327    /// # use google_cloud_pubsub::model::MessageTransform;
3328    /// use google_cloud_pubsub::model::JavaScriptUDF;
3329    /// let x = MessageTransform::new().set_javascript_udf(JavaScriptUDF::default()/* use setters */);
3330    /// assert!(x.javascript_udf().is_some());
3331    /// assert!(x.compression().is_none());
3332    /// assert!(x.ai_inference().is_none());
3333    /// ```
3334    pub fn set_javascript_udf<
3335        T: std::convert::Into<std::boxed::Box<crate::model::JavaScriptUDF>>,
3336    >(
3337        mut self,
3338        v: T,
3339    ) -> Self {
3340        self.transform = std::option::Option::Some(
3341            crate::model::message_transform::Transform::JavascriptUdf(v.into()),
3342        );
3343        self
3344    }
3345
3346    /// The value of [transform][crate::model::MessageTransform::transform]
3347    /// if it holds a `Compression`, `None` if the field is not set or
3348    /// holds a different branch.
3349    pub fn compression(&self) -> std::option::Option<&std::boxed::Box<crate::model::Compression>> {
3350        #[allow(unreachable_patterns)]
3351        self.transform.as_ref().and_then(|v| match v {
3352            crate::model::message_transform::Transform::Compression(v) => {
3353                std::option::Option::Some(v)
3354            }
3355            _ => std::option::Option::None,
3356        })
3357    }
3358
3359    /// Sets the value of [transform][crate::model::MessageTransform::transform]
3360    /// to hold a `Compression`.
3361    ///
3362    /// Note that all the setters affecting `transform` are
3363    /// mutually exclusive.
3364    ///
3365    /// # Example
3366    /// ```ignore,no_run
3367    /// # use google_cloud_pubsub::model::MessageTransform;
3368    /// use google_cloud_pubsub::model::Compression;
3369    /// let x = MessageTransform::new().set_compression(Compression::default()/* use setters */);
3370    /// assert!(x.compression().is_some());
3371    /// assert!(x.javascript_udf().is_none());
3372    /// assert!(x.ai_inference().is_none());
3373    /// ```
3374    pub fn set_compression<T: std::convert::Into<std::boxed::Box<crate::model::Compression>>>(
3375        mut self,
3376        v: T,
3377    ) -> Self {
3378        self.transform = std::option::Option::Some(
3379            crate::model::message_transform::Transform::Compression(v.into()),
3380        );
3381        self
3382    }
3383
3384    /// The value of [transform][crate::model::MessageTransform::transform]
3385    /// if it holds a `AiInference`, `None` if the field is not set or
3386    /// holds a different branch.
3387    pub fn ai_inference(&self) -> std::option::Option<&std::boxed::Box<crate::model::AIInference>> {
3388        #[allow(unreachable_patterns)]
3389        self.transform.as_ref().and_then(|v| match v {
3390            crate::model::message_transform::Transform::AiInference(v) => {
3391                std::option::Option::Some(v)
3392            }
3393            _ => std::option::Option::None,
3394        })
3395    }
3396
3397    /// Sets the value of [transform][crate::model::MessageTransform::transform]
3398    /// to hold a `AiInference`.
3399    ///
3400    /// Note that all the setters affecting `transform` are
3401    /// mutually exclusive.
3402    ///
3403    /// # Example
3404    /// ```ignore,no_run
3405    /// # use google_cloud_pubsub::model::MessageTransform;
3406    /// use google_cloud_pubsub::model::AIInference;
3407    /// let x = MessageTransform::new().set_ai_inference(AIInference::default()/* use setters */);
3408    /// assert!(x.ai_inference().is_some());
3409    /// assert!(x.javascript_udf().is_none());
3410    /// assert!(x.compression().is_none());
3411    /// ```
3412    pub fn set_ai_inference<T: std::convert::Into<std::boxed::Box<crate::model::AIInference>>>(
3413        mut self,
3414        v: T,
3415    ) -> Self {
3416        self.transform = std::option::Option::Some(
3417            crate::model::message_transform::Transform::AiInference(v.into()),
3418        );
3419        self
3420    }
3421}
3422
3423impl wkt::message::Message for MessageTransform {
3424    fn typename() -> &'static str {
3425        "type.googleapis.com/google.pubsub.v1.MessageTransform"
3426    }
3427}
3428
3429/// Defines additional types related to [MessageTransform].
3430pub mod message_transform {
3431    #[allow(unused_imports)]
3432    use super::*;
3433
3434    /// The type of transform to apply to messages.
3435    #[derive(Clone, Debug, PartialEq)]
3436    #[non_exhaustive]
3437    pub enum Transform {
3438        /// Optional. JavaScript User Defined Function. If multiple JavaScriptUDF's
3439        /// are specified on a resource, each must have a unique `function_name`.
3440        JavascriptUdf(std::boxed::Box<crate::model::JavaScriptUDF>),
3441        /// Optional. Compression/Decompression.
3442        Compression(std::boxed::Box<crate::model::Compression>),
3443        /// Optional. AI Inference. Specifies the Vertex AI endpoint that inference
3444        /// requests built from the Pub/Sub message data and provided parameters will
3445        /// be sent to.
3446        AiInference(std::boxed::Box<crate::model::AIInference>),
3447    }
3448}
3449
3450/// A topic resource.
3451#[derive(Clone, Default, PartialEq)]
3452#[non_exhaustive]
3453pub struct Topic {
3454    /// Required. Identifier. The name of the topic. It must have the format
3455    /// `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter,
3456    /// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),
3457    /// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent
3458    /// signs (`%`). It must be between 3 and 255 characters in length, and it
3459    /// must not start with `"goog"`.
3460    pub name: std::string::String,
3461
3462    /// Optional. See [Creating and managing labels]
3463    /// (<https://cloud.google.com/pubsub/docs/labels>).
3464    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3465
3466    /// Optional. Policy constraining the set of Google Cloud Platform regions
3467    /// where messages published to the topic may be stored. If not present, then
3468    /// no constraints are in effect.
3469    pub message_storage_policy: std::option::Option<crate::model::MessageStoragePolicy>,
3470
3471    /// Optional. The resource name of the Cloud KMS CryptoKey to be used to
3472    /// protect access to messages published on this topic.
3473    ///
3474    /// The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
3475    pub kms_key_name: std::string::String,
3476
3477    /// Optional. Settings for validating messages published against a schema.
3478    pub schema_settings: std::option::Option<crate::model::SchemaSettings>,
3479
3480    /// Optional. Reserved for future use. This field is set only in responses from
3481    /// the server; it is ignored if it is set in any requests.
3482    pub satisfies_pzs: bool,
3483
3484    /// Optional. Indicates the minimum duration to retain a message after it is
3485    /// published to the topic. If this field is set, messages published to the
3486    /// topic in the last `message_retention_duration` are always available to
3487    /// subscribers. For instance, it allows any attached subscription to [seek to
3488    /// a
3489    /// timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
3490    /// that is up to `message_retention_duration` in the past. If this field is
3491    /// not set, message retention is controlled by settings on individual
3492    /// subscriptions. Cannot be more than 31 days or less than 10 minutes.
3493    pub message_retention_duration: std::option::Option<wkt::Duration>,
3494
3495    /// Output only. An output-only field indicating the state of the topic.
3496    pub state: crate::model::topic::State,
3497
3498    /// Optional. Settings for ingestion from a data source into this topic.
3499    pub ingestion_data_source_settings:
3500        std::option::Option<crate::model::IngestionDataSourceSettings>,
3501
3502    /// Optional. Transforms to be applied to messages published to the topic.
3503    /// Transforms are applied in the order specified.
3504    pub message_transforms: std::vec::Vec<crate::model::MessageTransform>,
3505
3506    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
3507    /// resource. For example:
3508    /// "123/environment": "production",
3509    /// "123/costCenter": "marketing"
3510    /// See
3511    /// https://{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
3512    /// for more information on using tags with Pub/Sub resources.
3513    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
3514
3515    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3516}
3517
3518impl Topic {
3519    /// Creates a new default instance.
3520    pub fn new() -> Self {
3521        std::default::Default::default()
3522    }
3523
3524    /// Sets the value of [name][crate::model::Topic::name].
3525    ///
3526    /// # Example
3527    /// ```ignore,no_run
3528    /// # use google_cloud_pubsub::model::Topic;
3529    /// # let project_id = "project_id";
3530    /// # let topic_id = "topic_id";
3531    /// let x = Topic::new().set_name(format!("projects/{project_id}/topics/{topic_id}"));
3532    /// ```
3533    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3534        self.name = v.into();
3535        self
3536    }
3537
3538    /// Sets the value of [labels][crate::model::Topic::labels].
3539    ///
3540    /// # Example
3541    /// ```ignore,no_run
3542    /// # use google_cloud_pubsub::model::Topic;
3543    /// let x = Topic::new().set_labels([
3544    ///     ("key0", "abc"),
3545    ///     ("key1", "xyz"),
3546    /// ]);
3547    /// ```
3548    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3549    where
3550        T: std::iter::IntoIterator<Item = (K, V)>,
3551        K: std::convert::Into<std::string::String>,
3552        V: std::convert::Into<std::string::String>,
3553    {
3554        use std::iter::Iterator;
3555        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3556        self
3557    }
3558
3559    /// Sets the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
3560    ///
3561    /// # Example
3562    /// ```ignore,no_run
3563    /// # use google_cloud_pubsub::model::Topic;
3564    /// use google_cloud_pubsub::model::MessageStoragePolicy;
3565    /// let x = Topic::new().set_message_storage_policy(MessageStoragePolicy::default()/* use setters */);
3566    /// ```
3567    pub fn set_message_storage_policy<T>(mut self, v: T) -> Self
3568    where
3569        T: std::convert::Into<crate::model::MessageStoragePolicy>,
3570    {
3571        self.message_storage_policy = std::option::Option::Some(v.into());
3572        self
3573    }
3574
3575    /// Sets or clears the value of [message_storage_policy][crate::model::Topic::message_storage_policy].
3576    ///
3577    /// # Example
3578    /// ```ignore,no_run
3579    /// # use google_cloud_pubsub::model::Topic;
3580    /// use google_cloud_pubsub::model::MessageStoragePolicy;
3581    /// let x = Topic::new().set_or_clear_message_storage_policy(Some(MessageStoragePolicy::default()/* use setters */));
3582    /// let x = Topic::new().set_or_clear_message_storage_policy(None::<MessageStoragePolicy>);
3583    /// ```
3584    pub fn set_or_clear_message_storage_policy<T>(mut self, v: std::option::Option<T>) -> Self
3585    where
3586        T: std::convert::Into<crate::model::MessageStoragePolicy>,
3587    {
3588        self.message_storage_policy = v.map(|x| x.into());
3589        self
3590    }
3591
3592    /// Sets the value of [kms_key_name][crate::model::Topic::kms_key_name].
3593    ///
3594    /// # Example
3595    /// ```ignore,no_run
3596    /// # use google_cloud_pubsub::model::Topic;
3597    /// let x = Topic::new().set_kms_key_name("example");
3598    /// ```
3599    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3600        self.kms_key_name = v.into();
3601        self
3602    }
3603
3604    /// Sets the value of [schema_settings][crate::model::Topic::schema_settings].
3605    ///
3606    /// # Example
3607    /// ```ignore,no_run
3608    /// # use google_cloud_pubsub::model::Topic;
3609    /// use google_cloud_pubsub::model::SchemaSettings;
3610    /// let x = Topic::new().set_schema_settings(SchemaSettings::default()/* use setters */);
3611    /// ```
3612    pub fn set_schema_settings<T>(mut self, v: T) -> Self
3613    where
3614        T: std::convert::Into<crate::model::SchemaSettings>,
3615    {
3616        self.schema_settings = std::option::Option::Some(v.into());
3617        self
3618    }
3619
3620    /// Sets or clears the value of [schema_settings][crate::model::Topic::schema_settings].
3621    ///
3622    /// # Example
3623    /// ```ignore,no_run
3624    /// # use google_cloud_pubsub::model::Topic;
3625    /// use google_cloud_pubsub::model::SchemaSettings;
3626    /// let x = Topic::new().set_or_clear_schema_settings(Some(SchemaSettings::default()/* use setters */));
3627    /// let x = Topic::new().set_or_clear_schema_settings(None::<SchemaSettings>);
3628    /// ```
3629    pub fn set_or_clear_schema_settings<T>(mut self, v: std::option::Option<T>) -> Self
3630    where
3631        T: std::convert::Into<crate::model::SchemaSettings>,
3632    {
3633        self.schema_settings = v.map(|x| x.into());
3634        self
3635    }
3636
3637    /// Sets the value of [satisfies_pzs][crate::model::Topic::satisfies_pzs].
3638    ///
3639    /// # Example
3640    /// ```ignore,no_run
3641    /// # use google_cloud_pubsub::model::Topic;
3642    /// let x = Topic::new().set_satisfies_pzs(true);
3643    /// ```
3644    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3645        self.satisfies_pzs = v.into();
3646        self
3647    }
3648
3649    /// Sets the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
3650    ///
3651    /// # Example
3652    /// ```ignore,no_run
3653    /// # use google_cloud_pubsub::model::Topic;
3654    /// use wkt::Duration;
3655    /// let x = Topic::new().set_message_retention_duration(Duration::default()/* use setters */);
3656    /// ```
3657    pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
3658    where
3659        T: std::convert::Into<wkt::Duration>,
3660    {
3661        self.message_retention_duration = std::option::Option::Some(v.into());
3662        self
3663    }
3664
3665    /// Sets or clears the value of [message_retention_duration][crate::model::Topic::message_retention_duration].
3666    ///
3667    /// # Example
3668    /// ```ignore,no_run
3669    /// # use google_cloud_pubsub::model::Topic;
3670    /// use wkt::Duration;
3671    /// let x = Topic::new().set_or_clear_message_retention_duration(Some(Duration::default()/* use setters */));
3672    /// let x = Topic::new().set_or_clear_message_retention_duration(None::<Duration>);
3673    /// ```
3674    pub fn set_or_clear_message_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
3675    where
3676        T: std::convert::Into<wkt::Duration>,
3677    {
3678        self.message_retention_duration = v.map(|x| x.into());
3679        self
3680    }
3681
3682    /// Sets the value of [state][crate::model::Topic::state].
3683    ///
3684    /// # Example
3685    /// ```ignore,no_run
3686    /// # use google_cloud_pubsub::model::Topic;
3687    /// use google_cloud_pubsub::model::topic::State;
3688    /// let x0 = Topic::new().set_state(State::Active);
3689    /// let x1 = Topic::new().set_state(State::IngestionResourceError);
3690    /// ```
3691    pub fn set_state<T: std::convert::Into<crate::model::topic::State>>(mut self, v: T) -> Self {
3692        self.state = v.into();
3693        self
3694    }
3695
3696    /// Sets the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
3697    ///
3698    /// # Example
3699    /// ```ignore,no_run
3700    /// # use google_cloud_pubsub::model::Topic;
3701    /// use google_cloud_pubsub::model::IngestionDataSourceSettings;
3702    /// let x = Topic::new().set_ingestion_data_source_settings(IngestionDataSourceSettings::default()/* use setters */);
3703    /// ```
3704    pub fn set_ingestion_data_source_settings<T>(mut self, v: T) -> Self
3705    where
3706        T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
3707    {
3708        self.ingestion_data_source_settings = std::option::Option::Some(v.into());
3709        self
3710    }
3711
3712    /// Sets or clears the value of [ingestion_data_source_settings][crate::model::Topic::ingestion_data_source_settings].
3713    ///
3714    /// # Example
3715    /// ```ignore,no_run
3716    /// # use google_cloud_pubsub::model::Topic;
3717    /// use google_cloud_pubsub::model::IngestionDataSourceSettings;
3718    /// let x = Topic::new().set_or_clear_ingestion_data_source_settings(Some(IngestionDataSourceSettings::default()/* use setters */));
3719    /// let x = Topic::new().set_or_clear_ingestion_data_source_settings(None::<IngestionDataSourceSettings>);
3720    /// ```
3721    pub fn set_or_clear_ingestion_data_source_settings<T>(
3722        mut self,
3723        v: std::option::Option<T>,
3724    ) -> Self
3725    where
3726        T: std::convert::Into<crate::model::IngestionDataSourceSettings>,
3727    {
3728        self.ingestion_data_source_settings = v.map(|x| x.into());
3729        self
3730    }
3731
3732    /// Sets the value of [message_transforms][crate::model::Topic::message_transforms].
3733    ///
3734    /// # Example
3735    /// ```ignore,no_run
3736    /// # use google_cloud_pubsub::model::Topic;
3737    /// use google_cloud_pubsub::model::MessageTransform;
3738    /// let x = Topic::new()
3739    ///     .set_message_transforms([
3740    ///         MessageTransform::default()/* use setters */,
3741    ///         MessageTransform::default()/* use (different) setters */,
3742    ///     ]);
3743    /// ```
3744    pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
3745    where
3746        T: std::iter::IntoIterator<Item = V>,
3747        V: std::convert::Into<crate::model::MessageTransform>,
3748    {
3749        use std::iter::Iterator;
3750        self.message_transforms = v.into_iter().map(|i| i.into()).collect();
3751        self
3752    }
3753
3754    /// Sets the value of [tags][crate::model::Topic::tags].
3755    ///
3756    /// # Example
3757    /// ```ignore,no_run
3758    /// # use google_cloud_pubsub::model::Topic;
3759    /// let x = Topic::new().set_tags([
3760    ///     ("key0", "abc"),
3761    ///     ("key1", "xyz"),
3762    /// ]);
3763    /// ```
3764    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
3765    where
3766        T: std::iter::IntoIterator<Item = (K, V)>,
3767        K: std::convert::Into<std::string::String>,
3768        V: std::convert::Into<std::string::String>,
3769    {
3770        use std::iter::Iterator;
3771        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3772        self
3773    }
3774}
3775
3776impl wkt::message::Message for Topic {
3777    fn typename() -> &'static str {
3778        "type.googleapis.com/google.pubsub.v1.Topic"
3779    }
3780}
3781
3782/// Defines additional types related to [Topic].
3783pub mod topic {
3784    #[allow(unused_imports)]
3785    use super::*;
3786
3787    /// The state of the topic.
3788    ///
3789    /// # Working with unknown values
3790    ///
3791    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3792    /// additional enum variants at any time. Adding new variants is not considered
3793    /// a breaking change. Applications should write their code in anticipation of:
3794    ///
3795    /// - New values appearing in future releases of the client library, **and**
3796    /// - New values received dynamically, without application changes.
3797    ///
3798    /// Please consult the [Working with enums] section in the user guide for some
3799    /// guidelines.
3800    ///
3801    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3802    #[derive(Clone, Debug, PartialEq)]
3803    #[non_exhaustive]
3804    pub enum State {
3805        /// Default value. This value is unused.
3806        Unspecified,
3807        /// The topic does not have any persistent errors.
3808        Active,
3809        /// Ingestion from the data source has encountered a permanent error.
3810        /// See the more detailed error state in the corresponding ingestion
3811        /// source configuration.
3812        IngestionResourceError,
3813        /// If set, the enum was initialized with an unknown value.
3814        ///
3815        /// Applications can examine the value using [State::value] or
3816        /// [State::name].
3817        UnknownValue(state::UnknownValue),
3818    }
3819
3820    #[doc(hidden)]
3821    pub mod state {
3822        #[allow(unused_imports)]
3823        use super::*;
3824        #[derive(Clone, Debug, PartialEq)]
3825        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3826    }
3827
3828    impl State {
3829        /// Gets the enum value.
3830        ///
3831        /// Returns `None` if the enum contains an unknown value deserialized from
3832        /// the string representation of enums.
3833        pub fn value(&self) -> std::option::Option<i32> {
3834            match self {
3835                Self::Unspecified => std::option::Option::Some(0),
3836                Self::Active => std::option::Option::Some(1),
3837                Self::IngestionResourceError => std::option::Option::Some(2),
3838                Self::UnknownValue(u) => u.0.value(),
3839            }
3840        }
3841
3842        /// Gets the enum value as a string.
3843        ///
3844        /// Returns `None` if the enum contains an unknown value deserialized from
3845        /// the integer representation of enums.
3846        pub fn name(&self) -> std::option::Option<&str> {
3847            match self {
3848                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3849                Self::Active => std::option::Option::Some("ACTIVE"),
3850                Self::IngestionResourceError => {
3851                    std::option::Option::Some("INGESTION_RESOURCE_ERROR")
3852                }
3853                Self::UnknownValue(u) => u.0.name(),
3854            }
3855        }
3856    }
3857
3858    impl std::default::Default for State {
3859        fn default() -> Self {
3860            use std::convert::From;
3861            Self::from(0)
3862        }
3863    }
3864
3865    impl std::fmt::Display for State {
3866        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3867            wkt::internal::display_enum(f, self.name(), self.value())
3868        }
3869    }
3870
3871    impl std::convert::From<i32> for State {
3872        fn from(value: i32) -> Self {
3873            match value {
3874                0 => Self::Unspecified,
3875                1 => Self::Active,
3876                2 => Self::IngestionResourceError,
3877                _ => Self::UnknownValue(state::UnknownValue(
3878                    wkt::internal::UnknownEnumValue::Integer(value),
3879                )),
3880            }
3881        }
3882    }
3883
3884    impl std::convert::From<&str> for State {
3885        fn from(value: &str) -> Self {
3886            use std::string::ToString;
3887            match value {
3888                "STATE_UNSPECIFIED" => Self::Unspecified,
3889                "ACTIVE" => Self::Active,
3890                "INGESTION_RESOURCE_ERROR" => Self::IngestionResourceError,
3891                _ => Self::UnknownValue(state::UnknownValue(
3892                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3893                )),
3894            }
3895        }
3896    }
3897
3898    impl serde::ser::Serialize for State {
3899        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3900        where
3901            S: serde::Serializer,
3902        {
3903            match self {
3904                Self::Unspecified => serializer.serialize_i32(0),
3905                Self::Active => serializer.serialize_i32(1),
3906                Self::IngestionResourceError => serializer.serialize_i32(2),
3907                Self::UnknownValue(u) => u.0.serialize(serializer),
3908            }
3909        }
3910    }
3911
3912    impl<'de> serde::de::Deserialize<'de> for State {
3913        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3914        where
3915            D: serde::Deserializer<'de>,
3916        {
3917            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3918                ".google.pubsub.v1.Topic.State",
3919            ))
3920        }
3921    }
3922}
3923
3924/// Request for the GetTopic method.
3925#[derive(Clone, Default, PartialEq)]
3926#[non_exhaustive]
3927pub struct GetTopicRequest {
3928    /// Required. The name of the topic to get.
3929    /// Format is `projects/{project}/topics/{topic}`.
3930    pub topic: std::string::String,
3931
3932    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3933}
3934
3935impl GetTopicRequest {
3936    /// Creates a new default instance.
3937    pub fn new() -> Self {
3938        std::default::Default::default()
3939    }
3940
3941    /// Sets the value of [topic][crate::model::GetTopicRequest::topic].
3942    ///
3943    /// # Example
3944    /// ```ignore,no_run
3945    /// # use google_cloud_pubsub::model::GetTopicRequest;
3946    /// # let project_id = "project_id";
3947    /// # let topic_id = "topic_id";
3948    /// let x = GetTopicRequest::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
3949    /// ```
3950    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3951        self.topic = v.into();
3952        self
3953    }
3954}
3955
3956impl wkt::message::Message for GetTopicRequest {
3957    fn typename() -> &'static str {
3958        "type.googleapis.com/google.pubsub.v1.GetTopicRequest"
3959    }
3960}
3961
3962/// Request for the UpdateTopic method.
3963#[derive(Clone, Default, PartialEq)]
3964#[non_exhaustive]
3965pub struct UpdateTopicRequest {
3966    /// Required. The updated topic object.
3967    pub topic: std::option::Option<crate::model::Topic>,
3968
3969    /// Required. Indicates which fields in the provided topic to update. Must be
3970    /// specified and non-empty. Note that if `update_mask` contains
3971    /// "message_storage_policy" but the `message_storage_policy` is not set in
3972    /// the `topic` provided above, then the updated value is determined by the
3973    /// policy configured at the project or organization level.
3974    pub update_mask: std::option::Option<wkt::FieldMask>,
3975
3976    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3977}
3978
3979impl UpdateTopicRequest {
3980    /// Creates a new default instance.
3981    pub fn new() -> Self {
3982        std::default::Default::default()
3983    }
3984
3985    /// Sets the value of [topic][crate::model::UpdateTopicRequest::topic].
3986    ///
3987    /// # Example
3988    /// ```ignore,no_run
3989    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
3990    /// use google_cloud_pubsub::model::Topic;
3991    /// let x = UpdateTopicRequest::new().set_topic(Topic::default()/* use setters */);
3992    /// ```
3993    pub fn set_topic<T>(mut self, v: T) -> Self
3994    where
3995        T: std::convert::Into<crate::model::Topic>,
3996    {
3997        self.topic = std::option::Option::Some(v.into());
3998        self
3999    }
4000
4001    /// Sets or clears the value of [topic][crate::model::UpdateTopicRequest::topic].
4002    ///
4003    /// # Example
4004    /// ```ignore,no_run
4005    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
4006    /// use google_cloud_pubsub::model::Topic;
4007    /// let x = UpdateTopicRequest::new().set_or_clear_topic(Some(Topic::default()/* use setters */));
4008    /// let x = UpdateTopicRequest::new().set_or_clear_topic(None::<Topic>);
4009    /// ```
4010    pub fn set_or_clear_topic<T>(mut self, v: std::option::Option<T>) -> Self
4011    where
4012        T: std::convert::Into<crate::model::Topic>,
4013    {
4014        self.topic = v.map(|x| x.into());
4015        self
4016    }
4017
4018    /// Sets the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
4019    ///
4020    /// # Example
4021    /// ```ignore,no_run
4022    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
4023    /// use wkt::FieldMask;
4024    /// let x = UpdateTopicRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4025    /// ```
4026    pub fn set_update_mask<T>(mut self, v: T) -> Self
4027    where
4028        T: std::convert::Into<wkt::FieldMask>,
4029    {
4030        self.update_mask = std::option::Option::Some(v.into());
4031        self
4032    }
4033
4034    /// Sets or clears the value of [update_mask][crate::model::UpdateTopicRequest::update_mask].
4035    ///
4036    /// # Example
4037    /// ```ignore,no_run
4038    /// # use google_cloud_pubsub::model::UpdateTopicRequest;
4039    /// use wkt::FieldMask;
4040    /// let x = UpdateTopicRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4041    /// let x = UpdateTopicRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4042    /// ```
4043    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4044    where
4045        T: std::convert::Into<wkt::FieldMask>,
4046    {
4047        self.update_mask = v.map(|x| x.into());
4048        self
4049    }
4050}
4051
4052impl wkt::message::Message for UpdateTopicRequest {
4053    fn typename() -> &'static str {
4054        "type.googleapis.com/google.pubsub.v1.UpdateTopicRequest"
4055    }
4056}
4057
4058/// Request for the `ListTopics` method.
4059#[derive(Clone, Default, PartialEq)]
4060#[non_exhaustive]
4061pub struct ListTopicsRequest {
4062    /// Required. The name of the project in which to list topics.
4063    /// Format is `projects/{project-id}`.
4064    pub project: std::string::String,
4065
4066    /// Optional. Maximum number of topics to return.
4067    pub page_size: i32,
4068
4069    /// Optional. The value returned by the last `ListTopicsResponse`; indicates
4070    /// that this is a continuation of a prior `ListTopics` call, and that the
4071    /// system should return the next page of data.
4072    pub page_token: std::string::String,
4073
4074    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4075}
4076
4077impl ListTopicsRequest {
4078    /// Creates a new default instance.
4079    pub fn new() -> Self {
4080        std::default::Default::default()
4081    }
4082
4083    /// Sets the value of [project][crate::model::ListTopicsRequest::project].
4084    ///
4085    /// # Example
4086    /// ```ignore,no_run
4087    /// # use google_cloud_pubsub::model::ListTopicsRequest;
4088    /// let x = ListTopicsRequest::new().set_project("example");
4089    /// ```
4090    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4091        self.project = v.into();
4092        self
4093    }
4094
4095    /// Sets the value of [page_size][crate::model::ListTopicsRequest::page_size].
4096    ///
4097    /// # Example
4098    /// ```ignore,no_run
4099    /// # use google_cloud_pubsub::model::ListTopicsRequest;
4100    /// let x = ListTopicsRequest::new().set_page_size(42);
4101    /// ```
4102    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4103        self.page_size = v.into();
4104        self
4105    }
4106
4107    /// Sets the value of [page_token][crate::model::ListTopicsRequest::page_token].
4108    ///
4109    /// # Example
4110    /// ```ignore,no_run
4111    /// # use google_cloud_pubsub::model::ListTopicsRequest;
4112    /// let x = ListTopicsRequest::new().set_page_token("example");
4113    /// ```
4114    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4115        self.page_token = v.into();
4116        self
4117    }
4118}
4119
4120impl wkt::message::Message for ListTopicsRequest {
4121    fn typename() -> &'static str {
4122        "type.googleapis.com/google.pubsub.v1.ListTopicsRequest"
4123    }
4124}
4125
4126/// Response for the `ListTopics` method.
4127#[derive(Clone, Default, PartialEq)]
4128#[non_exhaustive]
4129pub struct ListTopicsResponse {
4130    /// Optional. The resulting topics.
4131    pub topics: std::vec::Vec<crate::model::Topic>,
4132
4133    /// Optional. If not empty, indicates that there may be more topics that match
4134    /// the request; this value should be passed in a new `ListTopicsRequest`.
4135    pub next_page_token: std::string::String,
4136
4137    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4138}
4139
4140impl ListTopicsResponse {
4141    /// Creates a new default instance.
4142    pub fn new() -> Self {
4143        std::default::Default::default()
4144    }
4145
4146    /// Sets the value of [topics][crate::model::ListTopicsResponse::topics].
4147    ///
4148    /// # Example
4149    /// ```ignore,no_run
4150    /// # use google_cloud_pubsub::model::ListTopicsResponse;
4151    /// use google_cloud_pubsub::model::Topic;
4152    /// let x = ListTopicsResponse::new()
4153    ///     .set_topics([
4154    ///         Topic::default()/* use setters */,
4155    ///         Topic::default()/* use (different) setters */,
4156    ///     ]);
4157    /// ```
4158    pub fn set_topics<T, V>(mut self, v: T) -> Self
4159    where
4160        T: std::iter::IntoIterator<Item = V>,
4161        V: std::convert::Into<crate::model::Topic>,
4162    {
4163        use std::iter::Iterator;
4164        self.topics = v.into_iter().map(|i| i.into()).collect();
4165        self
4166    }
4167
4168    /// Sets the value of [next_page_token][crate::model::ListTopicsResponse::next_page_token].
4169    ///
4170    /// # Example
4171    /// ```ignore,no_run
4172    /// # use google_cloud_pubsub::model::ListTopicsResponse;
4173    /// let x = ListTopicsResponse::new().set_next_page_token("example");
4174    /// ```
4175    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4176        self.next_page_token = v.into();
4177        self
4178    }
4179}
4180
4181impl wkt::message::Message for ListTopicsResponse {
4182    fn typename() -> &'static str {
4183        "type.googleapis.com/google.pubsub.v1.ListTopicsResponse"
4184    }
4185}
4186
4187#[doc(hidden)]
4188impl google_cloud_gax::paginator::internal::PageableResponse for ListTopicsResponse {
4189    type PageItem = crate::model::Topic;
4190
4191    fn items(self) -> std::vec::Vec<Self::PageItem> {
4192        self.topics
4193    }
4194
4195    fn next_page_token(&self) -> std::string::String {
4196        use std::clone::Clone;
4197        self.next_page_token.clone()
4198    }
4199}
4200
4201/// Request for the `ListTopicSubscriptions` method.
4202#[derive(Clone, Default, PartialEq)]
4203#[non_exhaustive]
4204pub struct ListTopicSubscriptionsRequest {
4205    /// Required. The name of the topic that subscriptions are attached to.
4206    /// Format is `projects/{project}/topics/{topic}`.
4207    pub topic: std::string::String,
4208
4209    /// Optional. Maximum number of subscription names to return.
4210    pub page_size: i32,
4211
4212    /// Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
4213    /// indicates that this is a continuation of a prior `ListTopicSubscriptions`
4214    /// call, and that the system should return the next page of data.
4215    pub page_token: std::string::String,
4216
4217    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4218}
4219
4220impl ListTopicSubscriptionsRequest {
4221    /// Creates a new default instance.
4222    pub fn new() -> Self {
4223        std::default::Default::default()
4224    }
4225
4226    /// Sets the value of [topic][crate::model::ListTopicSubscriptionsRequest::topic].
4227    ///
4228    /// # Example
4229    /// ```ignore,no_run
4230    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
4231    /// # let project_id = "project_id";
4232    /// # let topic_id = "topic_id";
4233    /// let x = ListTopicSubscriptionsRequest::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
4234    /// ```
4235    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4236        self.topic = v.into();
4237        self
4238    }
4239
4240    /// Sets the value of [page_size][crate::model::ListTopicSubscriptionsRequest::page_size].
4241    ///
4242    /// # Example
4243    /// ```ignore,no_run
4244    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
4245    /// let x = ListTopicSubscriptionsRequest::new().set_page_size(42);
4246    /// ```
4247    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4248        self.page_size = v.into();
4249        self
4250    }
4251
4252    /// Sets the value of [page_token][crate::model::ListTopicSubscriptionsRequest::page_token].
4253    ///
4254    /// # Example
4255    /// ```ignore,no_run
4256    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsRequest;
4257    /// let x = ListTopicSubscriptionsRequest::new().set_page_token("example");
4258    /// ```
4259    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4260        self.page_token = v.into();
4261        self
4262    }
4263}
4264
4265impl wkt::message::Message for ListTopicSubscriptionsRequest {
4266    fn typename() -> &'static str {
4267        "type.googleapis.com/google.pubsub.v1.ListTopicSubscriptionsRequest"
4268    }
4269}
4270
4271/// Response for the `ListTopicSubscriptions` method.
4272#[derive(Clone, Default, PartialEq)]
4273#[non_exhaustive]
4274pub struct ListTopicSubscriptionsResponse {
4275    /// Optional. The names of subscriptions attached to the topic specified in the
4276    /// request.
4277    pub subscriptions: std::vec::Vec<std::string::String>,
4278
4279    /// Optional. If not empty, indicates that there may be more subscriptions that
4280    /// match the request; this value should be passed in a new
4281    /// `ListTopicSubscriptionsRequest` to get more subscriptions.
4282    pub next_page_token: std::string::String,
4283
4284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4285}
4286
4287impl ListTopicSubscriptionsResponse {
4288    /// Creates a new default instance.
4289    pub fn new() -> Self {
4290        std::default::Default::default()
4291    }
4292
4293    /// Sets the value of [subscriptions][crate::model::ListTopicSubscriptionsResponse::subscriptions].
4294    ///
4295    /// # Example
4296    /// ```ignore,no_run
4297    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsResponse;
4298    /// let x = ListTopicSubscriptionsResponse::new().set_subscriptions(["a", "b", "c"]);
4299    /// ```
4300    pub fn set_subscriptions<T, V>(mut self, v: T) -> Self
4301    where
4302        T: std::iter::IntoIterator<Item = V>,
4303        V: std::convert::Into<std::string::String>,
4304    {
4305        use std::iter::Iterator;
4306        self.subscriptions = v.into_iter().map(|i| i.into()).collect();
4307        self
4308    }
4309
4310    /// Sets the value of [next_page_token][crate::model::ListTopicSubscriptionsResponse::next_page_token].
4311    ///
4312    /// # Example
4313    /// ```ignore,no_run
4314    /// # use google_cloud_pubsub::model::ListTopicSubscriptionsResponse;
4315    /// let x = ListTopicSubscriptionsResponse::new().set_next_page_token("example");
4316    /// ```
4317    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4318        self.next_page_token = v.into();
4319        self
4320    }
4321}
4322
4323impl wkt::message::Message for ListTopicSubscriptionsResponse {
4324    fn typename() -> &'static str {
4325        "type.googleapis.com/google.pubsub.v1.ListTopicSubscriptionsResponse"
4326    }
4327}
4328
4329#[doc(hidden)]
4330impl google_cloud_gax::paginator::internal::PageableResponse for ListTopicSubscriptionsResponse {
4331    type PageItem = std::string::String;
4332
4333    fn items(self) -> std::vec::Vec<Self::PageItem> {
4334        self.subscriptions
4335    }
4336
4337    fn next_page_token(&self) -> std::string::String {
4338        use std::clone::Clone;
4339        self.next_page_token.clone()
4340    }
4341}
4342
4343/// Request for the `ListTopicSnapshots` method.
4344#[derive(Clone, Default, PartialEq)]
4345#[non_exhaustive]
4346pub struct ListTopicSnapshotsRequest {
4347    /// Required. The name of the topic that snapshots are attached to.
4348    /// Format is `projects/{project}/topics/{topic}`.
4349    pub topic: std::string::String,
4350
4351    /// Optional. Maximum number of snapshot names to return.
4352    pub page_size: i32,
4353
4354    /// Optional. The value returned by the last `ListTopicSnapshotsResponse`;
4355    /// indicates that this is a continuation of a prior `ListTopicSnapshots` call,
4356    /// and that the system should return the next page of data.
4357    pub page_token: std::string::String,
4358
4359    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4360}
4361
4362impl ListTopicSnapshotsRequest {
4363    /// Creates a new default instance.
4364    pub fn new() -> Self {
4365        std::default::Default::default()
4366    }
4367
4368    /// Sets the value of [topic][crate::model::ListTopicSnapshotsRequest::topic].
4369    ///
4370    /// # Example
4371    /// ```ignore,no_run
4372    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
4373    /// # let project_id = "project_id";
4374    /// # let topic_id = "topic_id";
4375    /// let x = ListTopicSnapshotsRequest::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
4376    /// ```
4377    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4378        self.topic = v.into();
4379        self
4380    }
4381
4382    /// Sets the value of [page_size][crate::model::ListTopicSnapshotsRequest::page_size].
4383    ///
4384    /// # Example
4385    /// ```ignore,no_run
4386    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
4387    /// let x = ListTopicSnapshotsRequest::new().set_page_size(42);
4388    /// ```
4389    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4390        self.page_size = v.into();
4391        self
4392    }
4393
4394    /// Sets the value of [page_token][crate::model::ListTopicSnapshotsRequest::page_token].
4395    ///
4396    /// # Example
4397    /// ```ignore,no_run
4398    /// # use google_cloud_pubsub::model::ListTopicSnapshotsRequest;
4399    /// let x = ListTopicSnapshotsRequest::new().set_page_token("example");
4400    /// ```
4401    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4402        self.page_token = v.into();
4403        self
4404    }
4405}
4406
4407impl wkt::message::Message for ListTopicSnapshotsRequest {
4408    fn typename() -> &'static str {
4409        "type.googleapis.com/google.pubsub.v1.ListTopicSnapshotsRequest"
4410    }
4411}
4412
4413/// Response for the `ListTopicSnapshots` method.
4414#[derive(Clone, Default, PartialEq)]
4415#[non_exhaustive]
4416pub struct ListTopicSnapshotsResponse {
4417    /// Optional. The names of the snapshots that match the request.
4418    pub snapshots: std::vec::Vec<std::string::String>,
4419
4420    /// Optional. If not empty, indicates that there may be more snapshots that
4421    /// match the request; this value should be passed in a new
4422    /// `ListTopicSnapshotsRequest` to get more snapshots.
4423    pub next_page_token: std::string::String,
4424
4425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4426}
4427
4428impl ListTopicSnapshotsResponse {
4429    /// Creates a new default instance.
4430    pub fn new() -> Self {
4431        std::default::Default::default()
4432    }
4433
4434    /// Sets the value of [snapshots][crate::model::ListTopicSnapshotsResponse::snapshots].
4435    ///
4436    /// # Example
4437    /// ```ignore,no_run
4438    /// # use google_cloud_pubsub::model::ListTopicSnapshotsResponse;
4439    /// let x = ListTopicSnapshotsResponse::new().set_snapshots(["a", "b", "c"]);
4440    /// ```
4441    pub fn set_snapshots<T, V>(mut self, v: T) -> Self
4442    where
4443        T: std::iter::IntoIterator<Item = V>,
4444        V: std::convert::Into<std::string::String>,
4445    {
4446        use std::iter::Iterator;
4447        self.snapshots = v.into_iter().map(|i| i.into()).collect();
4448        self
4449    }
4450
4451    /// Sets the value of [next_page_token][crate::model::ListTopicSnapshotsResponse::next_page_token].
4452    ///
4453    /// # Example
4454    /// ```ignore,no_run
4455    /// # use google_cloud_pubsub::model::ListTopicSnapshotsResponse;
4456    /// let x = ListTopicSnapshotsResponse::new().set_next_page_token("example");
4457    /// ```
4458    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4459        self.next_page_token = v.into();
4460        self
4461    }
4462}
4463
4464impl wkt::message::Message for ListTopicSnapshotsResponse {
4465    fn typename() -> &'static str {
4466        "type.googleapis.com/google.pubsub.v1.ListTopicSnapshotsResponse"
4467    }
4468}
4469
4470/// Request for the `DeleteTopic` method.
4471#[derive(Clone, Default, PartialEq)]
4472#[non_exhaustive]
4473pub struct DeleteTopicRequest {
4474    /// Required. Name of the topic to delete.
4475    /// Format is `projects/{project}/topics/{topic}`.
4476    pub topic: std::string::String,
4477
4478    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4479}
4480
4481impl DeleteTopicRequest {
4482    /// Creates a new default instance.
4483    pub fn new() -> Self {
4484        std::default::Default::default()
4485    }
4486
4487    /// Sets the value of [topic][crate::model::DeleteTopicRequest::topic].
4488    ///
4489    /// # Example
4490    /// ```ignore,no_run
4491    /// # use google_cloud_pubsub::model::DeleteTopicRequest;
4492    /// # let project_id = "project_id";
4493    /// # let topic_id = "topic_id";
4494    /// let x = DeleteTopicRequest::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
4495    /// ```
4496    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4497        self.topic = v.into();
4498        self
4499    }
4500}
4501
4502impl wkt::message::Message for DeleteTopicRequest {
4503    fn typename() -> &'static str {
4504        "type.googleapis.com/google.pubsub.v1.DeleteTopicRequest"
4505    }
4506}
4507
4508/// Request for the DetachSubscription method.
4509#[derive(Clone, Default, PartialEq)]
4510#[non_exhaustive]
4511pub struct DetachSubscriptionRequest {
4512    /// Required. The subscription to detach.
4513    /// Format is `projects/{project}/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
4519impl DetachSubscriptionRequest {
4520    /// Creates a new default instance.
4521    pub fn new() -> Self {
4522        std::default::Default::default()
4523    }
4524
4525    /// Sets the value of [subscription][crate::model::DetachSubscriptionRequest::subscription].
4526    ///
4527    /// # Example
4528    /// ```ignore,no_run
4529    /// # use google_cloud_pubsub::model::DetachSubscriptionRequest;
4530    /// # let project_id = "project_id";
4531    /// # let subscription_id = "subscription_id";
4532    /// let x = DetachSubscriptionRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
4533    /// ```
4534    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4535        self.subscription = v.into();
4536        self
4537    }
4538}
4539
4540impl wkt::message::Message for DetachSubscriptionRequest {
4541    fn typename() -> &'static str {
4542        "type.googleapis.com/google.pubsub.v1.DetachSubscriptionRequest"
4543    }
4544}
4545
4546/// Response for the DetachSubscription method.
4547/// Reserved for future use.
4548#[derive(Clone, Default, PartialEq)]
4549#[non_exhaustive]
4550pub struct DetachSubscriptionResponse {
4551    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4552}
4553
4554impl DetachSubscriptionResponse {
4555    /// Creates a new default instance.
4556    pub fn new() -> Self {
4557        std::default::Default::default()
4558    }
4559}
4560
4561impl wkt::message::Message for DetachSubscriptionResponse {
4562    fn typename() -> &'static str {
4563        "type.googleapis.com/google.pubsub.v1.DetachSubscriptionResponse"
4564    }
4565}
4566
4567/// A subscription resource. If none of `push_config`, `bigquery_config`,
4568/// `cloud_storage_config`, or `bigtable_config` is set, then the subscriber will
4569/// pull and ack messages using API methods. At most one of these fields may be
4570/// set.
4571#[derive(Clone, Default, PartialEq)]
4572#[non_exhaustive]
4573pub struct Subscription {
4574    /// Required. Identifier. The name of the subscription. It must have the format
4575    /// `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
4576    /// start with a letter, and contain only letters (`[A-Za-z]`), numbers
4577    /// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
4578    /// plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
4579    /// in length, and it must not start with `"goog"`.
4580    pub name: std::string::String,
4581
4582    /// Required. The name of the topic from which this subscription is receiving
4583    /// messages. Format is `projects/{project}/topics/{topic}`. The value of this
4584    /// field will be `_deleted-topic_` if the topic has been deleted.
4585    pub topic: std::string::String,
4586
4587    /// Optional. If push delivery is used with this subscription, this field is
4588    /// used to configure it.
4589    pub push_config: std::option::Option<crate::model::PushConfig>,
4590
4591    /// Optional. If delivery to BigQuery is used with this subscription, this
4592    /// field is used to configure it.
4593    pub bigquery_config: std::option::Option<crate::model::BigQueryConfig>,
4594
4595    /// Optional. If delivery to Google Cloud Storage is used with this
4596    /// subscription, this field is used to configure it.
4597    pub cloud_storage_config: std::option::Option<crate::model::CloudStorageConfig>,
4598
4599    /// Optional. If delivery to Bigtable is used with this subscription, this
4600    /// field is used to configure it.
4601    pub bigtable_config: std::option::Option<crate::model::BigtableConfig>,
4602
4603    /// Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
4604    /// waits for the subscriber to acknowledge receipt before resending the
4605    /// message. In the interval after the message is delivered and before it is
4606    /// acknowledged, it is considered to be _outstanding_. During that time
4607    /// period, the message will not be redelivered (on a best-effort basis).
4608    ///
4609    /// For pull subscriptions, this value is used as the initial value for the ack
4610    /// deadline. To override this value for a given message, call
4611    /// `ModifyAckDeadline` with the corresponding `ack_id` if using
4612    /// non-streaming pull or send the `ack_id` in a
4613    /// `StreamingModifyAckDeadlineRequest` if using streaming pull.
4614    /// The minimum custom deadline you can specify is 10 seconds.
4615    /// The maximum custom deadline you can specify is 600 seconds (10 minutes).
4616    /// If this parameter is 0, a default value of 10 seconds is used.
4617    ///
4618    /// For push delivery, this value is also used to set the request timeout for
4619    /// the call to the push endpoint.
4620    ///
4621    /// If the subscriber never acknowledges the message, the Pub/Sub
4622    /// system will eventually redeliver the message.
4623    pub ack_deadline_seconds: i32,
4624
4625    /// Optional. Indicates whether to retain acknowledged messages. If true, then
4626    /// messages are not expunged from the subscription's backlog, even if they are
4627    /// acknowledged, until they fall out of the `message_retention_duration`
4628    /// window. This must be true if you would like to [`Seek` to a timestamp]
4629    /// (<https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>) in
4630    /// the past to replay previously-acknowledged messages.
4631    pub retain_acked_messages: bool,
4632
4633    /// Optional. How long to retain unacknowledged messages in the subscription's
4634    /// backlog, from the moment a message is published. If `retain_acked_messages`
4635    /// is true, then this also configures the retention of acknowledged messages,
4636    /// and thus configures how far back in time a `Seek` can be done. Defaults to
4637    /// 7 days. Cannot be more than 31 days or less than 10 minutes.
4638    pub message_retention_duration: std::option::Option<wkt::Duration>,
4639
4640    /// Optional. See [Creating and managing
4641    /// labels](https://cloud.google.com/pubsub/docs/labels).
4642    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4643
4644    /// Optional. If true, messages published with the same `ordering_key` in
4645    /// `PubsubMessage` will be delivered to the subscribers in the order in which
4646    /// they are received by the Pub/Sub system. Otherwise, they may be delivered
4647    /// in any order.
4648    pub enable_message_ordering: bool,
4649
4650    /// Optional. A policy that specifies the conditions for this subscription's
4651    /// expiration. A subscription is considered active as long as any connected
4652    /// subscriber is successfully consuming messages from the subscription or is
4653    /// issuing operations on the subscription. If `expiration_policy` is not set,
4654    /// a *default policy* with `ttl` of 31 days will be used. The minimum allowed
4655    /// value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
4656    /// but `expiration_policy.ttl` is not set, the subscription never expires.
4657    pub expiration_policy: std::option::Option<crate::model::ExpirationPolicy>,
4658
4659    /// Optional. An expression written in the Pub/Sub [filter
4660    /// language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
4661    /// then only `PubsubMessage`s whose `attributes` field matches the filter are
4662    /// delivered on this subscription. If empty, then no messages are filtered
4663    /// out.
4664    pub filter: std::string::String,
4665
4666    /// Optional. A policy that specifies the conditions for dead lettering
4667    /// messages in this subscription. If dead_letter_policy is not set, dead
4668    /// lettering is disabled.
4669    ///
4670    /// The Pub/Sub service account associated with this subscriptions's
4671    /// parent project (i.e.,
4672    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
4673    /// permission to Acknowledge() messages on this subscription.
4674    pub dead_letter_policy: std::option::Option<crate::model::DeadLetterPolicy>,
4675
4676    /// Optional. A policy that specifies how Pub/Sub retries message delivery for
4677    /// this subscription.
4678    ///
4679    /// If not set, the default retry policy is applied. This generally implies
4680    /// that messages will be retried as soon as possible for healthy subscribers.
4681    /// RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
4682    /// events for a given message.
4683    pub retry_policy: std::option::Option<crate::model::RetryPolicy>,
4684
4685    /// Optional. Indicates whether the subscription is detached from its topic.
4686    /// Detached subscriptions don't receive messages from their topic and don't
4687    /// retain any backlog. `Pull` and `StreamingPull` requests will return
4688    /// FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
4689    /// the endpoint will not be made.
4690    pub detached: bool,
4691
4692    /// Optional. If true, Pub/Sub provides the following guarantees for the
4693    /// delivery of a message with a given value of `message_id` on this
4694    /// subscription:
4695    ///
4696    /// * The message sent to a subscriber is guaranteed not to be resent
4697    ///   before the message's acknowledgment deadline expires.
4698    /// * An acknowledged message will not be resent to a subscriber.
4699    ///
4700    /// Note that subscribers may still receive multiple copies of a message
4701    /// when `enable_exactly_once_delivery` is true if the message was published
4702    /// multiple times by a publisher client. These copies are  considered distinct
4703    /// by Pub/Sub and have distinct `message_id` values.
4704    pub enable_exactly_once_delivery: bool,
4705
4706    /// Output only. Indicates the minimum duration for which a message is retained
4707    /// after it is published to the subscription's topic. If this field is set,
4708    /// messages published to the subscription's topic in the last
4709    /// `topic_message_retention_duration` are always available to subscribers. See
4710    /// the `message_retention_duration` field in `Topic`. This field is set only
4711    /// in responses from the server; it is ignored if it is set in any requests.
4712    pub topic_message_retention_duration: std::option::Option<wkt::Duration>,
4713
4714    /// Output only. An output-only field indicating whether or not the
4715    /// subscription can receive messages.
4716    pub state: crate::model::subscription::State,
4717
4718    /// Output only. Information about the associated Analytics Hub subscription.
4719    /// Only set if the subscription is created by Analytics Hub.
4720    pub analytics_hub_subscription_info:
4721        std::option::Option<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
4722
4723    /// Optional. Transforms to be applied to messages before they are delivered to
4724    /// subscribers. Transforms are applied in the order specified.
4725    pub message_transforms: std::vec::Vec<crate::model::MessageTransform>,
4726
4727    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
4728    /// resource. For example:
4729    /// "123/environment": "production",
4730    /// "123/costCenter": "marketing"
4731    /// See
4732    /// https://{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
4733    /// for more information on using tags with Pub/Sub resources.
4734    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
4735
4736    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4737}
4738
4739impl Subscription {
4740    /// Creates a new default instance.
4741    pub fn new() -> Self {
4742        std::default::Default::default()
4743    }
4744
4745    /// Sets the value of [name][crate::model::Subscription::name].
4746    ///
4747    /// # Example
4748    /// ```ignore,no_run
4749    /// # use google_cloud_pubsub::model::Subscription;
4750    /// # let project_id = "project_id";
4751    /// # let subscription_id = "subscription_id";
4752    /// let x = Subscription::new().set_name(format!("projects/{project_id}/subscriptions/{subscription_id}"));
4753    /// ```
4754    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4755        self.name = v.into();
4756        self
4757    }
4758
4759    /// Sets the value of [topic][crate::model::Subscription::topic].
4760    ///
4761    /// # Example
4762    /// ```ignore,no_run
4763    /// # use google_cloud_pubsub::model::Subscription;
4764    /// # let project_id = "project_id";
4765    /// # let topic_id = "topic_id";
4766    /// let x = Subscription::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
4767    /// ```
4768    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4769        self.topic = v.into();
4770        self
4771    }
4772
4773    /// Sets the value of [push_config][crate::model::Subscription::push_config].
4774    ///
4775    /// # Example
4776    /// ```ignore,no_run
4777    /// # use google_cloud_pubsub::model::Subscription;
4778    /// use google_cloud_pubsub::model::PushConfig;
4779    /// let x = Subscription::new().set_push_config(PushConfig::default()/* use setters */);
4780    /// ```
4781    pub fn set_push_config<T>(mut self, v: T) -> Self
4782    where
4783        T: std::convert::Into<crate::model::PushConfig>,
4784    {
4785        self.push_config = std::option::Option::Some(v.into());
4786        self
4787    }
4788
4789    /// Sets or clears the value of [push_config][crate::model::Subscription::push_config].
4790    ///
4791    /// # Example
4792    /// ```ignore,no_run
4793    /// # use google_cloud_pubsub::model::Subscription;
4794    /// use google_cloud_pubsub::model::PushConfig;
4795    /// let x = Subscription::new().set_or_clear_push_config(Some(PushConfig::default()/* use setters */));
4796    /// let x = Subscription::new().set_or_clear_push_config(None::<PushConfig>);
4797    /// ```
4798    pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
4799    where
4800        T: std::convert::Into<crate::model::PushConfig>,
4801    {
4802        self.push_config = v.map(|x| x.into());
4803        self
4804    }
4805
4806    /// Sets the value of [bigquery_config][crate::model::Subscription::bigquery_config].
4807    ///
4808    /// # Example
4809    /// ```ignore,no_run
4810    /// # use google_cloud_pubsub::model::Subscription;
4811    /// use google_cloud_pubsub::model::BigQueryConfig;
4812    /// let x = Subscription::new().set_bigquery_config(BigQueryConfig::default()/* use setters */);
4813    /// ```
4814    pub fn set_bigquery_config<T>(mut self, v: T) -> Self
4815    where
4816        T: std::convert::Into<crate::model::BigQueryConfig>,
4817    {
4818        self.bigquery_config = std::option::Option::Some(v.into());
4819        self
4820    }
4821
4822    /// Sets or clears the value of [bigquery_config][crate::model::Subscription::bigquery_config].
4823    ///
4824    /// # Example
4825    /// ```ignore,no_run
4826    /// # use google_cloud_pubsub::model::Subscription;
4827    /// use google_cloud_pubsub::model::BigQueryConfig;
4828    /// let x = Subscription::new().set_or_clear_bigquery_config(Some(BigQueryConfig::default()/* use setters */));
4829    /// let x = Subscription::new().set_or_clear_bigquery_config(None::<BigQueryConfig>);
4830    /// ```
4831    pub fn set_or_clear_bigquery_config<T>(mut self, v: std::option::Option<T>) -> Self
4832    where
4833        T: std::convert::Into<crate::model::BigQueryConfig>,
4834    {
4835        self.bigquery_config = v.map(|x| x.into());
4836        self
4837    }
4838
4839    /// Sets the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
4840    ///
4841    /// # Example
4842    /// ```ignore,no_run
4843    /// # use google_cloud_pubsub::model::Subscription;
4844    /// use google_cloud_pubsub::model::CloudStorageConfig;
4845    /// let x = Subscription::new().set_cloud_storage_config(CloudStorageConfig::default()/* use setters */);
4846    /// ```
4847    pub fn set_cloud_storage_config<T>(mut self, v: T) -> Self
4848    where
4849        T: std::convert::Into<crate::model::CloudStorageConfig>,
4850    {
4851        self.cloud_storage_config = std::option::Option::Some(v.into());
4852        self
4853    }
4854
4855    /// Sets or clears the value of [cloud_storage_config][crate::model::Subscription::cloud_storage_config].
4856    ///
4857    /// # Example
4858    /// ```ignore,no_run
4859    /// # use google_cloud_pubsub::model::Subscription;
4860    /// use google_cloud_pubsub::model::CloudStorageConfig;
4861    /// let x = Subscription::new().set_or_clear_cloud_storage_config(Some(CloudStorageConfig::default()/* use setters */));
4862    /// let x = Subscription::new().set_or_clear_cloud_storage_config(None::<CloudStorageConfig>);
4863    /// ```
4864    pub fn set_or_clear_cloud_storage_config<T>(mut self, v: std::option::Option<T>) -> Self
4865    where
4866        T: std::convert::Into<crate::model::CloudStorageConfig>,
4867    {
4868        self.cloud_storage_config = v.map(|x| x.into());
4869        self
4870    }
4871
4872    /// Sets the value of [bigtable_config][crate::model::Subscription::bigtable_config].
4873    ///
4874    /// # Example
4875    /// ```ignore,no_run
4876    /// # use google_cloud_pubsub::model::Subscription;
4877    /// use google_cloud_pubsub::model::BigtableConfig;
4878    /// let x = Subscription::new().set_bigtable_config(BigtableConfig::default()/* use setters */);
4879    /// ```
4880    pub fn set_bigtable_config<T>(mut self, v: T) -> Self
4881    where
4882        T: std::convert::Into<crate::model::BigtableConfig>,
4883    {
4884        self.bigtable_config = std::option::Option::Some(v.into());
4885        self
4886    }
4887
4888    /// Sets or clears the value of [bigtable_config][crate::model::Subscription::bigtable_config].
4889    ///
4890    /// # Example
4891    /// ```ignore,no_run
4892    /// # use google_cloud_pubsub::model::Subscription;
4893    /// use google_cloud_pubsub::model::BigtableConfig;
4894    /// let x = Subscription::new().set_or_clear_bigtable_config(Some(BigtableConfig::default()/* use setters */));
4895    /// let x = Subscription::new().set_or_clear_bigtable_config(None::<BigtableConfig>);
4896    /// ```
4897    pub fn set_or_clear_bigtable_config<T>(mut self, v: std::option::Option<T>) -> Self
4898    where
4899        T: std::convert::Into<crate::model::BigtableConfig>,
4900    {
4901        self.bigtable_config = v.map(|x| x.into());
4902        self
4903    }
4904
4905    /// Sets the value of [ack_deadline_seconds][crate::model::Subscription::ack_deadline_seconds].
4906    ///
4907    /// # Example
4908    /// ```ignore,no_run
4909    /// # use google_cloud_pubsub::model::Subscription;
4910    /// let x = Subscription::new().set_ack_deadline_seconds(42);
4911    /// ```
4912    pub fn set_ack_deadline_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4913        self.ack_deadline_seconds = v.into();
4914        self
4915    }
4916
4917    /// Sets the value of [retain_acked_messages][crate::model::Subscription::retain_acked_messages].
4918    ///
4919    /// # Example
4920    /// ```ignore,no_run
4921    /// # use google_cloud_pubsub::model::Subscription;
4922    /// let x = Subscription::new().set_retain_acked_messages(true);
4923    /// ```
4924    pub fn set_retain_acked_messages<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4925        self.retain_acked_messages = v.into();
4926        self
4927    }
4928
4929    /// Sets the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
4930    ///
4931    /// # Example
4932    /// ```ignore,no_run
4933    /// # use google_cloud_pubsub::model::Subscription;
4934    /// use wkt::Duration;
4935    /// let x = Subscription::new().set_message_retention_duration(Duration::default()/* use setters */);
4936    /// ```
4937    pub fn set_message_retention_duration<T>(mut self, v: T) -> Self
4938    where
4939        T: std::convert::Into<wkt::Duration>,
4940    {
4941        self.message_retention_duration = std::option::Option::Some(v.into());
4942        self
4943    }
4944
4945    /// Sets or clears the value of [message_retention_duration][crate::model::Subscription::message_retention_duration].
4946    ///
4947    /// # Example
4948    /// ```ignore,no_run
4949    /// # use google_cloud_pubsub::model::Subscription;
4950    /// use wkt::Duration;
4951    /// let x = Subscription::new().set_or_clear_message_retention_duration(Some(Duration::default()/* use setters */));
4952    /// let x = Subscription::new().set_or_clear_message_retention_duration(None::<Duration>);
4953    /// ```
4954    pub fn set_or_clear_message_retention_duration<T>(mut self, v: std::option::Option<T>) -> Self
4955    where
4956        T: std::convert::Into<wkt::Duration>,
4957    {
4958        self.message_retention_duration = v.map(|x| x.into());
4959        self
4960    }
4961
4962    /// Sets the value of [labels][crate::model::Subscription::labels].
4963    ///
4964    /// # Example
4965    /// ```ignore,no_run
4966    /// # use google_cloud_pubsub::model::Subscription;
4967    /// let x = Subscription::new().set_labels([
4968    ///     ("key0", "abc"),
4969    ///     ("key1", "xyz"),
4970    /// ]);
4971    /// ```
4972    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4973    where
4974        T: std::iter::IntoIterator<Item = (K, V)>,
4975        K: std::convert::Into<std::string::String>,
4976        V: std::convert::Into<std::string::String>,
4977    {
4978        use std::iter::Iterator;
4979        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4980        self
4981    }
4982
4983    /// Sets the value of [enable_message_ordering][crate::model::Subscription::enable_message_ordering].
4984    ///
4985    /// # Example
4986    /// ```ignore,no_run
4987    /// # use google_cloud_pubsub::model::Subscription;
4988    /// let x = Subscription::new().set_enable_message_ordering(true);
4989    /// ```
4990    pub fn set_enable_message_ordering<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4991        self.enable_message_ordering = v.into();
4992        self
4993    }
4994
4995    /// Sets the value of [expiration_policy][crate::model::Subscription::expiration_policy].
4996    ///
4997    /// # Example
4998    /// ```ignore,no_run
4999    /// # use google_cloud_pubsub::model::Subscription;
5000    /// use google_cloud_pubsub::model::ExpirationPolicy;
5001    /// let x = Subscription::new().set_expiration_policy(ExpirationPolicy::default()/* use setters */);
5002    /// ```
5003    pub fn set_expiration_policy<T>(mut self, v: T) -> Self
5004    where
5005        T: std::convert::Into<crate::model::ExpirationPolicy>,
5006    {
5007        self.expiration_policy = std::option::Option::Some(v.into());
5008        self
5009    }
5010
5011    /// Sets or clears the value of [expiration_policy][crate::model::Subscription::expiration_policy].
5012    ///
5013    /// # Example
5014    /// ```ignore,no_run
5015    /// # use google_cloud_pubsub::model::Subscription;
5016    /// use google_cloud_pubsub::model::ExpirationPolicy;
5017    /// let x = Subscription::new().set_or_clear_expiration_policy(Some(ExpirationPolicy::default()/* use setters */));
5018    /// let x = Subscription::new().set_or_clear_expiration_policy(None::<ExpirationPolicy>);
5019    /// ```
5020    pub fn set_or_clear_expiration_policy<T>(mut self, v: std::option::Option<T>) -> Self
5021    where
5022        T: std::convert::Into<crate::model::ExpirationPolicy>,
5023    {
5024        self.expiration_policy = v.map(|x| x.into());
5025        self
5026    }
5027
5028    /// Sets the value of [filter][crate::model::Subscription::filter].
5029    ///
5030    /// # Example
5031    /// ```ignore,no_run
5032    /// # use google_cloud_pubsub::model::Subscription;
5033    /// let x = Subscription::new().set_filter("example");
5034    /// ```
5035    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5036        self.filter = v.into();
5037        self
5038    }
5039
5040    /// Sets the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
5041    ///
5042    /// # Example
5043    /// ```ignore,no_run
5044    /// # use google_cloud_pubsub::model::Subscription;
5045    /// use google_cloud_pubsub::model::DeadLetterPolicy;
5046    /// let x = Subscription::new().set_dead_letter_policy(DeadLetterPolicy::default()/* use setters */);
5047    /// ```
5048    pub fn set_dead_letter_policy<T>(mut self, v: T) -> Self
5049    where
5050        T: std::convert::Into<crate::model::DeadLetterPolicy>,
5051    {
5052        self.dead_letter_policy = std::option::Option::Some(v.into());
5053        self
5054    }
5055
5056    /// Sets or clears the value of [dead_letter_policy][crate::model::Subscription::dead_letter_policy].
5057    ///
5058    /// # Example
5059    /// ```ignore,no_run
5060    /// # use google_cloud_pubsub::model::Subscription;
5061    /// use google_cloud_pubsub::model::DeadLetterPolicy;
5062    /// let x = Subscription::new().set_or_clear_dead_letter_policy(Some(DeadLetterPolicy::default()/* use setters */));
5063    /// let x = Subscription::new().set_or_clear_dead_letter_policy(None::<DeadLetterPolicy>);
5064    /// ```
5065    pub fn set_or_clear_dead_letter_policy<T>(mut self, v: std::option::Option<T>) -> Self
5066    where
5067        T: std::convert::Into<crate::model::DeadLetterPolicy>,
5068    {
5069        self.dead_letter_policy = v.map(|x| x.into());
5070        self
5071    }
5072
5073    /// Sets the value of [retry_policy][crate::model::Subscription::retry_policy].
5074    ///
5075    /// # Example
5076    /// ```ignore,no_run
5077    /// # use google_cloud_pubsub::model::Subscription;
5078    /// use google_cloud_pubsub::model::RetryPolicy;
5079    /// let x = Subscription::new().set_retry_policy(RetryPolicy::default()/* use setters */);
5080    /// ```
5081    pub fn set_retry_policy<T>(mut self, v: T) -> Self
5082    where
5083        T: std::convert::Into<crate::model::RetryPolicy>,
5084    {
5085        self.retry_policy = std::option::Option::Some(v.into());
5086        self
5087    }
5088
5089    /// Sets or clears the value of [retry_policy][crate::model::Subscription::retry_policy].
5090    ///
5091    /// # Example
5092    /// ```ignore,no_run
5093    /// # use google_cloud_pubsub::model::Subscription;
5094    /// use google_cloud_pubsub::model::RetryPolicy;
5095    /// let x = Subscription::new().set_or_clear_retry_policy(Some(RetryPolicy::default()/* use setters */));
5096    /// let x = Subscription::new().set_or_clear_retry_policy(None::<RetryPolicy>);
5097    /// ```
5098    pub fn set_or_clear_retry_policy<T>(mut self, v: std::option::Option<T>) -> Self
5099    where
5100        T: std::convert::Into<crate::model::RetryPolicy>,
5101    {
5102        self.retry_policy = v.map(|x| x.into());
5103        self
5104    }
5105
5106    /// Sets the value of [detached][crate::model::Subscription::detached].
5107    ///
5108    /// # Example
5109    /// ```ignore,no_run
5110    /// # use google_cloud_pubsub::model::Subscription;
5111    /// let x = Subscription::new().set_detached(true);
5112    /// ```
5113    pub fn set_detached<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5114        self.detached = v.into();
5115        self
5116    }
5117
5118    /// Sets the value of [enable_exactly_once_delivery][crate::model::Subscription::enable_exactly_once_delivery].
5119    ///
5120    /// # Example
5121    /// ```ignore,no_run
5122    /// # use google_cloud_pubsub::model::Subscription;
5123    /// let x = Subscription::new().set_enable_exactly_once_delivery(true);
5124    /// ```
5125    pub fn set_enable_exactly_once_delivery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5126        self.enable_exactly_once_delivery = v.into();
5127        self
5128    }
5129
5130    /// Sets the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
5131    ///
5132    /// # Example
5133    /// ```ignore,no_run
5134    /// # use google_cloud_pubsub::model::Subscription;
5135    /// use wkt::Duration;
5136    /// let x = Subscription::new().set_topic_message_retention_duration(Duration::default()/* use setters */);
5137    /// ```
5138    pub fn set_topic_message_retention_duration<T>(mut self, v: T) -> Self
5139    where
5140        T: std::convert::Into<wkt::Duration>,
5141    {
5142        self.topic_message_retention_duration = std::option::Option::Some(v.into());
5143        self
5144    }
5145
5146    /// Sets or clears the value of [topic_message_retention_duration][crate::model::Subscription::topic_message_retention_duration].
5147    ///
5148    /// # Example
5149    /// ```ignore,no_run
5150    /// # use google_cloud_pubsub::model::Subscription;
5151    /// use wkt::Duration;
5152    /// let x = Subscription::new().set_or_clear_topic_message_retention_duration(Some(Duration::default()/* use setters */));
5153    /// let x = Subscription::new().set_or_clear_topic_message_retention_duration(None::<Duration>);
5154    /// ```
5155    pub fn set_or_clear_topic_message_retention_duration<T>(
5156        mut self,
5157        v: std::option::Option<T>,
5158    ) -> Self
5159    where
5160        T: std::convert::Into<wkt::Duration>,
5161    {
5162        self.topic_message_retention_duration = v.map(|x| x.into());
5163        self
5164    }
5165
5166    /// Sets the value of [state][crate::model::Subscription::state].
5167    ///
5168    /// # Example
5169    /// ```ignore,no_run
5170    /// # use google_cloud_pubsub::model::Subscription;
5171    /// use google_cloud_pubsub::model::subscription::State;
5172    /// let x0 = Subscription::new().set_state(State::Active);
5173    /// let x1 = Subscription::new().set_state(State::ResourceError);
5174    /// ```
5175    pub fn set_state<T: std::convert::Into<crate::model::subscription::State>>(
5176        mut self,
5177        v: T,
5178    ) -> Self {
5179        self.state = v.into();
5180        self
5181    }
5182
5183    /// Sets the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
5184    ///
5185    /// # Example
5186    /// ```ignore,no_run
5187    /// # use google_cloud_pubsub::model::Subscription;
5188    /// use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
5189    /// let x = Subscription::new().set_analytics_hub_subscription_info(AnalyticsHubSubscriptionInfo::default()/* use setters */);
5190    /// ```
5191    pub fn set_analytics_hub_subscription_info<T>(mut self, v: T) -> Self
5192    where
5193        T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
5194    {
5195        self.analytics_hub_subscription_info = std::option::Option::Some(v.into());
5196        self
5197    }
5198
5199    /// Sets or clears the value of [analytics_hub_subscription_info][crate::model::Subscription::analytics_hub_subscription_info].
5200    ///
5201    /// # Example
5202    /// ```ignore,no_run
5203    /// # use google_cloud_pubsub::model::Subscription;
5204    /// use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
5205    /// let x = Subscription::new().set_or_clear_analytics_hub_subscription_info(Some(AnalyticsHubSubscriptionInfo::default()/* use setters */));
5206    /// let x = Subscription::new().set_or_clear_analytics_hub_subscription_info(None::<AnalyticsHubSubscriptionInfo>);
5207    /// ```
5208    pub fn set_or_clear_analytics_hub_subscription_info<T>(
5209        mut self,
5210        v: std::option::Option<T>,
5211    ) -> Self
5212    where
5213        T: std::convert::Into<crate::model::subscription::AnalyticsHubSubscriptionInfo>,
5214    {
5215        self.analytics_hub_subscription_info = v.map(|x| x.into());
5216        self
5217    }
5218
5219    /// Sets the value of [message_transforms][crate::model::Subscription::message_transforms].
5220    ///
5221    /// # Example
5222    /// ```ignore,no_run
5223    /// # use google_cloud_pubsub::model::Subscription;
5224    /// use google_cloud_pubsub::model::MessageTransform;
5225    /// let x = Subscription::new()
5226    ///     .set_message_transforms([
5227    ///         MessageTransform::default()/* use setters */,
5228    ///         MessageTransform::default()/* use (different) setters */,
5229    ///     ]);
5230    /// ```
5231    pub fn set_message_transforms<T, V>(mut self, v: T) -> Self
5232    where
5233        T: std::iter::IntoIterator<Item = V>,
5234        V: std::convert::Into<crate::model::MessageTransform>,
5235    {
5236        use std::iter::Iterator;
5237        self.message_transforms = v.into_iter().map(|i| i.into()).collect();
5238        self
5239    }
5240
5241    /// Sets the value of [tags][crate::model::Subscription::tags].
5242    ///
5243    /// # Example
5244    /// ```ignore,no_run
5245    /// # use google_cloud_pubsub::model::Subscription;
5246    /// let x = Subscription::new().set_tags([
5247    ///     ("key0", "abc"),
5248    ///     ("key1", "xyz"),
5249    /// ]);
5250    /// ```
5251    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
5252    where
5253        T: std::iter::IntoIterator<Item = (K, V)>,
5254        K: std::convert::Into<std::string::String>,
5255        V: std::convert::Into<std::string::String>,
5256    {
5257        use std::iter::Iterator;
5258        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5259        self
5260    }
5261}
5262
5263impl wkt::message::Message for Subscription {
5264    fn typename() -> &'static str {
5265        "type.googleapis.com/google.pubsub.v1.Subscription"
5266    }
5267}
5268
5269/// Defines additional types related to [Subscription].
5270pub mod subscription {
5271    #[allow(unused_imports)]
5272    use super::*;
5273
5274    /// Information about an associated [Analytics Hub
5275    /// subscription](https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions).
5276    #[derive(Clone, Default, PartialEq)]
5277    #[non_exhaustive]
5278    pub struct AnalyticsHubSubscriptionInfo {
5279        /// Optional. The name of the associated Analytics Hub listing resource.
5280        /// Pattern:
5281        /// "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}"
5282        pub listing: std::string::String,
5283
5284        /// Optional. The name of the associated Analytics Hub subscription resource.
5285        /// Pattern:
5286        /// "projects/{project}/locations/{location}/subscriptions/{subscription}"
5287        pub subscription: std::string::String,
5288
5289        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5290    }
5291
5292    impl AnalyticsHubSubscriptionInfo {
5293        /// Creates a new default instance.
5294        pub fn new() -> Self {
5295            std::default::Default::default()
5296        }
5297
5298        /// Sets the value of [listing][crate::model::subscription::AnalyticsHubSubscriptionInfo::listing].
5299        ///
5300        /// # Example
5301        /// ```ignore,no_run
5302        /// # use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
5303        /// let x = AnalyticsHubSubscriptionInfo::new().set_listing("example");
5304        /// ```
5305        pub fn set_listing<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5306            self.listing = v.into();
5307            self
5308        }
5309
5310        /// Sets the value of [subscription][crate::model::subscription::AnalyticsHubSubscriptionInfo::subscription].
5311        ///
5312        /// # Example
5313        /// ```ignore,no_run
5314        /// # use google_cloud_pubsub::model::subscription::AnalyticsHubSubscriptionInfo;
5315        /// let x = AnalyticsHubSubscriptionInfo::new().set_subscription("example");
5316        /// ```
5317        pub fn set_subscription<T: std::convert::Into<std::string::String>>(
5318            mut self,
5319            v: T,
5320        ) -> Self {
5321            self.subscription = v.into();
5322            self
5323        }
5324    }
5325
5326    impl wkt::message::Message for AnalyticsHubSubscriptionInfo {
5327        fn typename() -> &'static str {
5328            "type.googleapis.com/google.pubsub.v1.Subscription.AnalyticsHubSubscriptionInfo"
5329        }
5330    }
5331
5332    /// Possible states for a subscription.
5333    ///
5334    /// # Working with unknown values
5335    ///
5336    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5337    /// additional enum variants at any time. Adding new variants is not considered
5338    /// a breaking change. Applications should write their code in anticipation of:
5339    ///
5340    /// - New values appearing in future releases of the client library, **and**
5341    /// - New values received dynamically, without application changes.
5342    ///
5343    /// Please consult the [Working with enums] section in the user guide for some
5344    /// guidelines.
5345    ///
5346    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5347    #[derive(Clone, Debug, PartialEq)]
5348    #[non_exhaustive]
5349    pub enum State {
5350        /// Default value. This value is unused.
5351        Unspecified,
5352        /// The subscription can actively receive messages
5353        Active,
5354        /// The subscription cannot receive messages because of an error with the
5355        /// resource to which it pushes messages. See the more detailed error state
5356        /// in the corresponding configuration.
5357        ResourceError,
5358        /// If set, the enum was initialized with an unknown value.
5359        ///
5360        /// Applications can examine the value using [State::value] or
5361        /// [State::name].
5362        UnknownValue(state::UnknownValue),
5363    }
5364
5365    #[doc(hidden)]
5366    pub mod state {
5367        #[allow(unused_imports)]
5368        use super::*;
5369        #[derive(Clone, Debug, PartialEq)]
5370        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5371    }
5372
5373    impl State {
5374        /// Gets the enum value.
5375        ///
5376        /// Returns `None` if the enum contains an unknown value deserialized from
5377        /// the string representation of enums.
5378        pub fn value(&self) -> std::option::Option<i32> {
5379            match self {
5380                Self::Unspecified => std::option::Option::Some(0),
5381                Self::Active => std::option::Option::Some(1),
5382                Self::ResourceError => std::option::Option::Some(2),
5383                Self::UnknownValue(u) => u.0.value(),
5384            }
5385        }
5386
5387        /// Gets the enum value as a string.
5388        ///
5389        /// Returns `None` if the enum contains an unknown value deserialized from
5390        /// the integer representation of enums.
5391        pub fn name(&self) -> std::option::Option<&str> {
5392            match self {
5393                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5394                Self::Active => std::option::Option::Some("ACTIVE"),
5395                Self::ResourceError => std::option::Option::Some("RESOURCE_ERROR"),
5396                Self::UnknownValue(u) => u.0.name(),
5397            }
5398        }
5399    }
5400
5401    impl std::default::Default for State {
5402        fn default() -> Self {
5403            use std::convert::From;
5404            Self::from(0)
5405        }
5406    }
5407
5408    impl std::fmt::Display for State {
5409        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5410            wkt::internal::display_enum(f, self.name(), self.value())
5411        }
5412    }
5413
5414    impl std::convert::From<i32> for State {
5415        fn from(value: i32) -> Self {
5416            match value {
5417                0 => Self::Unspecified,
5418                1 => Self::Active,
5419                2 => Self::ResourceError,
5420                _ => Self::UnknownValue(state::UnknownValue(
5421                    wkt::internal::UnknownEnumValue::Integer(value),
5422                )),
5423            }
5424        }
5425    }
5426
5427    impl std::convert::From<&str> for State {
5428        fn from(value: &str) -> Self {
5429            use std::string::ToString;
5430            match value {
5431                "STATE_UNSPECIFIED" => Self::Unspecified,
5432                "ACTIVE" => Self::Active,
5433                "RESOURCE_ERROR" => Self::ResourceError,
5434                _ => Self::UnknownValue(state::UnknownValue(
5435                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5436                )),
5437            }
5438        }
5439    }
5440
5441    impl serde::ser::Serialize for State {
5442        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5443        where
5444            S: serde::Serializer,
5445        {
5446            match self {
5447                Self::Unspecified => serializer.serialize_i32(0),
5448                Self::Active => serializer.serialize_i32(1),
5449                Self::ResourceError => serializer.serialize_i32(2),
5450                Self::UnknownValue(u) => u.0.serialize(serializer),
5451            }
5452        }
5453    }
5454
5455    impl<'de> serde::de::Deserialize<'de> for State {
5456        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5457        where
5458            D: serde::Deserializer<'de>,
5459        {
5460            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5461                ".google.pubsub.v1.Subscription.State",
5462            ))
5463        }
5464    }
5465}
5466
5467/// A policy that specifies how Pub/Sub retries message delivery.
5468///
5469/// Retry delay will be exponential based on provided minimum and maximum
5470/// backoffs. <https://en.wikipedia.org/wiki/Exponential_backoff>.
5471///
5472/// RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
5473/// events for a given message.
5474///
5475/// Retry Policy is implemented on a best effort basis. At times, the delay
5476/// between consecutive deliveries may not match the configuration. That is,
5477/// delay can be more or less than configured backoff.
5478#[derive(Clone, Default, PartialEq)]
5479#[non_exhaustive]
5480pub struct RetryPolicy {
5481    /// Optional. The minimum delay between consecutive deliveries of a given
5482    /// message. Value should be between 0 and 600 seconds. Defaults to 10 seconds.
5483    pub minimum_backoff: std::option::Option<wkt::Duration>,
5484
5485    /// Optional. The maximum delay between consecutive deliveries of a given
5486    /// message. Value should be between 0 and 600 seconds. Defaults to 600
5487    /// seconds.
5488    pub maximum_backoff: std::option::Option<wkt::Duration>,
5489
5490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5491}
5492
5493impl RetryPolicy {
5494    /// Creates a new default instance.
5495    pub fn new() -> Self {
5496        std::default::Default::default()
5497    }
5498
5499    /// Sets the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
5500    ///
5501    /// # Example
5502    /// ```ignore,no_run
5503    /// # use google_cloud_pubsub::model::RetryPolicy;
5504    /// use wkt::Duration;
5505    /// let x = RetryPolicy::new().set_minimum_backoff(Duration::default()/* use setters */);
5506    /// ```
5507    pub fn set_minimum_backoff<T>(mut self, v: T) -> Self
5508    where
5509        T: std::convert::Into<wkt::Duration>,
5510    {
5511        self.minimum_backoff = std::option::Option::Some(v.into());
5512        self
5513    }
5514
5515    /// Sets or clears the value of [minimum_backoff][crate::model::RetryPolicy::minimum_backoff].
5516    ///
5517    /// # Example
5518    /// ```ignore,no_run
5519    /// # use google_cloud_pubsub::model::RetryPolicy;
5520    /// use wkt::Duration;
5521    /// let x = RetryPolicy::new().set_or_clear_minimum_backoff(Some(Duration::default()/* use setters */));
5522    /// let x = RetryPolicy::new().set_or_clear_minimum_backoff(None::<Duration>);
5523    /// ```
5524    pub fn set_or_clear_minimum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
5525    where
5526        T: std::convert::Into<wkt::Duration>,
5527    {
5528        self.minimum_backoff = v.map(|x| x.into());
5529        self
5530    }
5531
5532    /// Sets the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
5533    ///
5534    /// # Example
5535    /// ```ignore,no_run
5536    /// # use google_cloud_pubsub::model::RetryPolicy;
5537    /// use wkt::Duration;
5538    /// let x = RetryPolicy::new().set_maximum_backoff(Duration::default()/* use setters */);
5539    /// ```
5540    pub fn set_maximum_backoff<T>(mut self, v: T) -> Self
5541    where
5542        T: std::convert::Into<wkt::Duration>,
5543    {
5544        self.maximum_backoff = std::option::Option::Some(v.into());
5545        self
5546    }
5547
5548    /// Sets or clears the value of [maximum_backoff][crate::model::RetryPolicy::maximum_backoff].
5549    ///
5550    /// # Example
5551    /// ```ignore,no_run
5552    /// # use google_cloud_pubsub::model::RetryPolicy;
5553    /// use wkt::Duration;
5554    /// let x = RetryPolicy::new().set_or_clear_maximum_backoff(Some(Duration::default()/* use setters */));
5555    /// let x = RetryPolicy::new().set_or_clear_maximum_backoff(None::<Duration>);
5556    /// ```
5557    pub fn set_or_clear_maximum_backoff<T>(mut self, v: std::option::Option<T>) -> Self
5558    where
5559        T: std::convert::Into<wkt::Duration>,
5560    {
5561        self.maximum_backoff = v.map(|x| x.into());
5562        self
5563    }
5564}
5565
5566impl wkt::message::Message for RetryPolicy {
5567    fn typename() -> &'static str {
5568        "type.googleapis.com/google.pubsub.v1.RetryPolicy"
5569    }
5570}
5571
5572/// Dead lettering is done on a best effort basis. The same message might be
5573/// dead lettered multiple times.
5574///
5575/// If validation on any of the fields fails at subscription creation/updation,
5576/// the create/update subscription request will fail.
5577#[derive(Clone, Default, PartialEq)]
5578#[non_exhaustive]
5579pub struct DeadLetterPolicy {
5580    /// Optional. The name of the topic to which dead letter messages should be
5581    /// published. Format is `projects/{project}/topics/{topic}`.The Pub/Sub
5582    /// service account associated with the enclosing subscription's parent project
5583    /// (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must
5584    /// have permission to Publish() to this topic.
5585    ///
5586    /// The operation will fail if the topic does not exist.
5587    /// Users should ensure that there is a subscription attached to this topic
5588    /// since messages published to a topic with no subscriptions are lost.
5589    pub dead_letter_topic: std::string::String,
5590
5591    /// Optional. The maximum number of delivery attempts for any message. The
5592    /// value must be between 5 and 100.
5593    ///
5594    /// The number of delivery attempts is defined as 1 + (the sum of number of
5595    /// NACKs and number of times the acknowledgment deadline has been exceeded
5596    /// for the message).
5597    ///
5598    /// A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that
5599    /// client libraries may automatically extend ack_deadlines.
5600    ///
5601    /// This field will be honored on a best effort basis.
5602    ///
5603    /// If this parameter is 0, a default value of 5 is used.
5604    pub max_delivery_attempts: i32,
5605
5606    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5607}
5608
5609impl DeadLetterPolicy {
5610    /// Creates a new default instance.
5611    pub fn new() -> Self {
5612        std::default::Default::default()
5613    }
5614
5615    /// Sets the value of [dead_letter_topic][crate::model::DeadLetterPolicy::dead_letter_topic].
5616    ///
5617    /// # Example
5618    /// ```ignore,no_run
5619    /// # use google_cloud_pubsub::model::DeadLetterPolicy;
5620    /// # let project_id = "project_id";
5621    /// # let topic_id = "topic_id";
5622    /// let x = DeadLetterPolicy::new().set_dead_letter_topic(format!("projects/{project_id}/topics/{topic_id}"));
5623    /// ```
5624    pub fn set_dead_letter_topic<T: std::convert::Into<std::string::String>>(
5625        mut self,
5626        v: T,
5627    ) -> Self {
5628        self.dead_letter_topic = v.into();
5629        self
5630    }
5631
5632    /// Sets the value of [max_delivery_attempts][crate::model::DeadLetterPolicy::max_delivery_attempts].
5633    ///
5634    /// # Example
5635    /// ```ignore,no_run
5636    /// # use google_cloud_pubsub::model::DeadLetterPolicy;
5637    /// let x = DeadLetterPolicy::new().set_max_delivery_attempts(42);
5638    /// ```
5639    pub fn set_max_delivery_attempts<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5640        self.max_delivery_attempts = v.into();
5641        self
5642    }
5643}
5644
5645impl wkt::message::Message for DeadLetterPolicy {
5646    fn typename() -> &'static str {
5647        "type.googleapis.com/google.pubsub.v1.DeadLetterPolicy"
5648    }
5649}
5650
5651/// A policy that specifies the conditions for resource expiration (i.e.,
5652/// automatic resource deletion).
5653#[derive(Clone, Default, PartialEq)]
5654#[non_exhaustive]
5655pub struct ExpirationPolicy {
5656    /// Optional. Specifies the "time-to-live" duration for an associated resource.
5657    /// The resource expires if it is not active for a period of `ttl`. The
5658    /// definition of "activity" depends on the type of the associated resource.
5659    /// The minimum and maximum allowed values for `ttl` depend on the type of the
5660    /// associated resource, as well. If `ttl` is not set, the associated resource
5661    /// never expires.
5662    pub ttl: std::option::Option<wkt::Duration>,
5663
5664    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5665}
5666
5667impl ExpirationPolicy {
5668    /// Creates a new default instance.
5669    pub fn new() -> Self {
5670        std::default::Default::default()
5671    }
5672
5673    /// Sets the value of [ttl][crate::model::ExpirationPolicy::ttl].
5674    ///
5675    /// # Example
5676    /// ```ignore,no_run
5677    /// # use google_cloud_pubsub::model::ExpirationPolicy;
5678    /// use wkt::Duration;
5679    /// let x = ExpirationPolicy::new().set_ttl(Duration::default()/* use setters */);
5680    /// ```
5681    pub fn set_ttl<T>(mut self, v: T) -> Self
5682    where
5683        T: std::convert::Into<wkt::Duration>,
5684    {
5685        self.ttl = std::option::Option::Some(v.into());
5686        self
5687    }
5688
5689    /// Sets or clears the value of [ttl][crate::model::ExpirationPolicy::ttl].
5690    ///
5691    /// # Example
5692    /// ```ignore,no_run
5693    /// # use google_cloud_pubsub::model::ExpirationPolicy;
5694    /// use wkt::Duration;
5695    /// let x = ExpirationPolicy::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
5696    /// let x = ExpirationPolicy::new().set_or_clear_ttl(None::<Duration>);
5697    /// ```
5698    pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
5699    where
5700        T: std::convert::Into<wkt::Duration>,
5701    {
5702        self.ttl = v.map(|x| x.into());
5703        self
5704    }
5705}
5706
5707impl wkt::message::Message for ExpirationPolicy {
5708    fn typename() -> &'static str {
5709        "type.googleapis.com/google.pubsub.v1.ExpirationPolicy"
5710    }
5711}
5712
5713/// Configuration for a push delivery endpoint.
5714#[derive(Clone, Default, PartialEq)]
5715#[non_exhaustive]
5716pub struct PushConfig {
5717    /// Optional. A URL locating the endpoint to which messages should be pushed.
5718    /// For example, a Webhook endpoint might use `<https://example.com/push>`.
5719    pub push_endpoint: std::string::String,
5720
5721    /// Optional. Endpoint configuration attributes that can be used to control
5722    /// different aspects of the message delivery.
5723    ///
5724    /// The only currently supported attribute is `x-goog-version`, which you can
5725    /// use to change the format of the pushed message. This attribute
5726    /// indicates the version of the data expected by the endpoint. This
5727    /// controls the shape of the pushed message (i.e., its fields and metadata).
5728    ///
5729    /// If not present during the `CreateSubscription` call, it will default to
5730    /// the version of the Pub/Sub API used to make such call. If not present in a
5731    /// `ModifyPushConfig` call, its value will not be changed. `GetSubscription`
5732    /// calls will always return a valid version, even if the subscription was
5733    /// created without this attribute.
5734    ///
5735    /// The only supported values for the `x-goog-version` attribute are:
5736    ///
5737    /// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.
5738    /// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.
5739    ///
5740    /// For example:
5741    /// `attributes { "x-goog-version": "v1" }`
5742    pub attributes: std::collections::HashMap<std::string::String, std::string::String>,
5743
5744    /// An authentication method used by push endpoints to verify the source of
5745    /// push requests. This can be used with push endpoints that are private by
5746    /// default to allow requests only from the Pub/Sub system, for example.
5747    /// This field is optional and should be set only by users interested in
5748    /// authenticated push.
5749    pub authentication_method: std::option::Option<crate::model::push_config::AuthenticationMethod>,
5750
5751    /// The format of the delivered message to the push endpoint is defined by
5752    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
5753    pub wrapper: std::option::Option<crate::model::push_config::Wrapper>,
5754
5755    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5756}
5757
5758impl PushConfig {
5759    /// Creates a new default instance.
5760    pub fn new() -> Self {
5761        std::default::Default::default()
5762    }
5763
5764    /// Sets the value of [push_endpoint][crate::model::PushConfig::push_endpoint].
5765    ///
5766    /// # Example
5767    /// ```ignore,no_run
5768    /// # use google_cloud_pubsub::model::PushConfig;
5769    /// let x = PushConfig::new().set_push_endpoint("example");
5770    /// ```
5771    pub fn set_push_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5772        self.push_endpoint = v.into();
5773        self
5774    }
5775
5776    /// Sets the value of [attributes][crate::model::PushConfig::attributes].
5777    ///
5778    /// # Example
5779    /// ```ignore,no_run
5780    /// # use google_cloud_pubsub::model::PushConfig;
5781    /// let x = PushConfig::new().set_attributes([
5782    ///     ("key0", "abc"),
5783    ///     ("key1", "xyz"),
5784    /// ]);
5785    /// ```
5786    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
5787    where
5788        T: std::iter::IntoIterator<Item = (K, V)>,
5789        K: std::convert::Into<std::string::String>,
5790        V: std::convert::Into<std::string::String>,
5791    {
5792        use std::iter::Iterator;
5793        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5794        self
5795    }
5796
5797    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method].
5798    ///
5799    /// Note that all the setters affecting `authentication_method` are mutually
5800    /// exclusive.
5801    ///
5802    /// # Example
5803    /// ```ignore,no_run
5804    /// # use google_cloud_pubsub::model::PushConfig;
5805    /// use google_cloud_pubsub::model::push_config::OidcToken;
5806    /// let x = PushConfig::new().set_authentication_method(Some(
5807    ///     google_cloud_pubsub::model::push_config::AuthenticationMethod::OidcToken(OidcToken::default().into())));
5808    /// ```
5809    pub fn set_authentication_method<
5810        T: std::convert::Into<std::option::Option<crate::model::push_config::AuthenticationMethod>>,
5811    >(
5812        mut self,
5813        v: T,
5814    ) -> Self {
5815        self.authentication_method = v.into();
5816        self
5817    }
5818
5819    /// The value of [authentication_method][crate::model::PushConfig::authentication_method]
5820    /// if it holds a `OidcToken`, `None` if the field is not set or
5821    /// holds a different branch.
5822    pub fn oidc_token(
5823        &self,
5824    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::OidcToken>> {
5825        #[allow(unreachable_patterns)]
5826        self.authentication_method.as_ref().and_then(|v| match v {
5827            crate::model::push_config::AuthenticationMethod::OidcToken(v) => {
5828                std::option::Option::Some(v)
5829            }
5830            _ => std::option::Option::None,
5831        })
5832    }
5833
5834    /// Sets the value of [authentication_method][crate::model::PushConfig::authentication_method]
5835    /// to hold a `OidcToken`.
5836    ///
5837    /// Note that all the setters affecting `authentication_method` are
5838    /// mutually exclusive.
5839    ///
5840    /// # Example
5841    /// ```ignore,no_run
5842    /// # use google_cloud_pubsub::model::PushConfig;
5843    /// use google_cloud_pubsub::model::push_config::OidcToken;
5844    /// let x = PushConfig::new().set_oidc_token(OidcToken::default()/* use setters */);
5845    /// assert!(x.oidc_token().is_some());
5846    /// ```
5847    pub fn set_oidc_token<
5848        T: std::convert::Into<std::boxed::Box<crate::model::push_config::OidcToken>>,
5849    >(
5850        mut self,
5851        v: T,
5852    ) -> Self {
5853        self.authentication_method = std::option::Option::Some(
5854            crate::model::push_config::AuthenticationMethod::OidcToken(v.into()),
5855        );
5856        self
5857    }
5858
5859    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper].
5860    ///
5861    /// Note that all the setters affecting `wrapper` are mutually
5862    /// exclusive.
5863    ///
5864    /// # Example
5865    /// ```ignore,no_run
5866    /// # use google_cloud_pubsub::model::PushConfig;
5867    /// use google_cloud_pubsub::model::push_config::PubsubWrapper;
5868    /// let x = PushConfig::new().set_wrapper(Some(
5869    ///     google_cloud_pubsub::model::push_config::Wrapper::PubsubWrapper(PubsubWrapper::default().into())));
5870    /// ```
5871    pub fn set_wrapper<
5872        T: std::convert::Into<std::option::Option<crate::model::push_config::Wrapper>>,
5873    >(
5874        mut self,
5875        v: T,
5876    ) -> Self {
5877        self.wrapper = v.into();
5878        self
5879    }
5880
5881    /// The value of [wrapper][crate::model::PushConfig::wrapper]
5882    /// if it holds a `PubsubWrapper`, `None` if the field is not set or
5883    /// holds a different branch.
5884    pub fn pubsub_wrapper(
5885        &self,
5886    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::PubsubWrapper>> {
5887        #[allow(unreachable_patterns)]
5888        self.wrapper.as_ref().and_then(|v| match v {
5889            crate::model::push_config::Wrapper::PubsubWrapper(v) => std::option::Option::Some(v),
5890            _ => std::option::Option::None,
5891        })
5892    }
5893
5894    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
5895    /// to hold a `PubsubWrapper`.
5896    ///
5897    /// Note that all the setters affecting `wrapper` are
5898    /// mutually exclusive.
5899    ///
5900    /// # Example
5901    /// ```ignore,no_run
5902    /// # use google_cloud_pubsub::model::PushConfig;
5903    /// use google_cloud_pubsub::model::push_config::PubsubWrapper;
5904    /// let x = PushConfig::new().set_pubsub_wrapper(PubsubWrapper::default()/* use setters */);
5905    /// assert!(x.pubsub_wrapper().is_some());
5906    /// assert!(x.no_wrapper().is_none());
5907    /// ```
5908    pub fn set_pubsub_wrapper<
5909        T: std::convert::Into<std::boxed::Box<crate::model::push_config::PubsubWrapper>>,
5910    >(
5911        mut self,
5912        v: T,
5913    ) -> Self {
5914        self.wrapper =
5915            std::option::Option::Some(crate::model::push_config::Wrapper::PubsubWrapper(v.into()));
5916        self
5917    }
5918
5919    /// The value of [wrapper][crate::model::PushConfig::wrapper]
5920    /// if it holds a `NoWrapper`, `None` if the field is not set or
5921    /// holds a different branch.
5922    pub fn no_wrapper(
5923        &self,
5924    ) -> std::option::Option<&std::boxed::Box<crate::model::push_config::NoWrapper>> {
5925        #[allow(unreachable_patterns)]
5926        self.wrapper.as_ref().and_then(|v| match v {
5927            crate::model::push_config::Wrapper::NoWrapper(v) => std::option::Option::Some(v),
5928            _ => std::option::Option::None,
5929        })
5930    }
5931
5932    /// Sets the value of [wrapper][crate::model::PushConfig::wrapper]
5933    /// to hold a `NoWrapper`.
5934    ///
5935    /// Note that all the setters affecting `wrapper` are
5936    /// mutually exclusive.
5937    ///
5938    /// # Example
5939    /// ```ignore,no_run
5940    /// # use google_cloud_pubsub::model::PushConfig;
5941    /// use google_cloud_pubsub::model::push_config::NoWrapper;
5942    /// let x = PushConfig::new().set_no_wrapper(NoWrapper::default()/* use setters */);
5943    /// assert!(x.no_wrapper().is_some());
5944    /// assert!(x.pubsub_wrapper().is_none());
5945    /// ```
5946    pub fn set_no_wrapper<
5947        T: std::convert::Into<std::boxed::Box<crate::model::push_config::NoWrapper>>,
5948    >(
5949        mut self,
5950        v: T,
5951    ) -> Self {
5952        self.wrapper =
5953            std::option::Option::Some(crate::model::push_config::Wrapper::NoWrapper(v.into()));
5954        self
5955    }
5956}
5957
5958impl wkt::message::Message for PushConfig {
5959    fn typename() -> &'static str {
5960        "type.googleapis.com/google.pubsub.v1.PushConfig"
5961    }
5962}
5963
5964/// Defines additional types related to [PushConfig].
5965pub mod push_config {
5966    #[allow(unused_imports)]
5967    use super::*;
5968
5969    /// Contains information needed for generating an
5970    /// [OpenID Connect
5971    /// token](https://developers.google.com/identity/protocols/OpenIDConnect).
5972    #[derive(Clone, Default, PartialEq)]
5973    #[non_exhaustive]
5974    pub struct OidcToken {
5975        /// Optional. [Service account
5976        /// email](https://cloud.google.com/iam/docs/service-accounts)
5977        /// used for generating the OIDC token. For more information
5978        /// on setting up authentication, see
5979        /// [Push subscriptions](https://cloud.google.com/pubsub/docs/push).
5980        pub service_account_email: std::string::String,
5981
5982        /// Optional. Audience to be used when generating OIDC token. The audience
5983        /// claim identifies the recipients that the JWT is intended for. The
5984        /// audience value is a single case-sensitive string. Having multiple values
5985        /// (array) for the audience field is not supported. More info about the OIDC
5986        /// JWT token audience here:
5987        /// <https://tools.ietf.org/html/rfc7519#section-4.1.3> Note: if not specified,
5988        /// the Push endpoint URL will be used.
5989        pub audience: std::string::String,
5990
5991        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5992    }
5993
5994    impl OidcToken {
5995        /// Creates a new default instance.
5996        pub fn new() -> Self {
5997            std::default::Default::default()
5998        }
5999
6000        /// Sets the value of [service_account_email][crate::model::push_config::OidcToken::service_account_email].
6001        ///
6002        /// # Example
6003        /// ```ignore,no_run
6004        /// # use google_cloud_pubsub::model::push_config::OidcToken;
6005        /// let x = OidcToken::new().set_service_account_email("example");
6006        /// ```
6007        pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
6008            mut self,
6009            v: T,
6010        ) -> Self {
6011            self.service_account_email = v.into();
6012            self
6013        }
6014
6015        /// Sets the value of [audience][crate::model::push_config::OidcToken::audience].
6016        ///
6017        /// # Example
6018        /// ```ignore,no_run
6019        /// # use google_cloud_pubsub::model::push_config::OidcToken;
6020        /// let x = OidcToken::new().set_audience("example");
6021        /// ```
6022        pub fn set_audience<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6023            self.audience = v.into();
6024            self
6025        }
6026    }
6027
6028    impl wkt::message::Message for OidcToken {
6029        fn typename() -> &'static str {
6030            "type.googleapis.com/google.pubsub.v1.PushConfig.OidcToken"
6031        }
6032    }
6033
6034    /// The payload to the push endpoint is in the form of the JSON representation
6035    /// of a PubsubMessage
6036    /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
6037    #[derive(Clone, Default, PartialEq)]
6038    #[non_exhaustive]
6039    pub struct PubsubWrapper {
6040        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6041    }
6042
6043    impl PubsubWrapper {
6044        /// Creates a new default instance.
6045        pub fn new() -> Self {
6046            std::default::Default::default()
6047        }
6048    }
6049
6050    impl wkt::message::Message for PubsubWrapper {
6051        fn typename() -> &'static str {
6052            "type.googleapis.com/google.pubsub.v1.PushConfig.PubsubWrapper"
6053        }
6054    }
6055
6056    /// Sets the `data` field as the HTTP body for delivery.
6057    #[derive(Clone, Default, PartialEq)]
6058    #[non_exhaustive]
6059    pub struct NoWrapper {
6060        /// Optional. When true, writes the Pub/Sub message metadata to
6061        /// `x-goog-pubsub-<KEY>:<VAL>` headers of the HTTP request. Writes the
6062        /// Pub/Sub message attributes to `<KEY>:<VAL>` headers of the HTTP request.
6063        pub write_metadata: bool,
6064
6065        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6066    }
6067
6068    impl NoWrapper {
6069        /// Creates a new default instance.
6070        pub fn new() -> Self {
6071            std::default::Default::default()
6072        }
6073
6074        /// Sets the value of [write_metadata][crate::model::push_config::NoWrapper::write_metadata].
6075        ///
6076        /// # Example
6077        /// ```ignore,no_run
6078        /// # use google_cloud_pubsub::model::push_config::NoWrapper;
6079        /// let x = NoWrapper::new().set_write_metadata(true);
6080        /// ```
6081        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6082            self.write_metadata = v.into();
6083            self
6084        }
6085    }
6086
6087    impl wkt::message::Message for NoWrapper {
6088        fn typename() -> &'static str {
6089            "type.googleapis.com/google.pubsub.v1.PushConfig.NoWrapper"
6090        }
6091    }
6092
6093    /// An authentication method used by push endpoints to verify the source of
6094    /// push requests. This can be used with push endpoints that are private by
6095    /// default to allow requests only from the Pub/Sub system, for example.
6096    /// This field is optional and should be set only by users interested in
6097    /// authenticated push.
6098    #[derive(Clone, Debug, PartialEq)]
6099    #[non_exhaustive]
6100    pub enum AuthenticationMethod {
6101        /// Optional. If specified, Pub/Sub will generate and attach an OIDC JWT
6102        /// token as an `Authorization` header in the HTTP request for every pushed
6103        /// message.
6104        OidcToken(std::boxed::Box<crate::model::push_config::OidcToken>),
6105    }
6106
6107    /// The format of the delivered message to the push endpoint is defined by
6108    /// the chosen wrapper. When unset, `PubsubWrapper` is used.
6109    #[derive(Clone, Debug, PartialEq)]
6110    #[non_exhaustive]
6111    pub enum Wrapper {
6112        /// Optional. When set, the payload to the push endpoint is in the form of
6113        /// the JSON representation of a PubsubMessage
6114        /// (<https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage>).
6115        PubsubWrapper(std::boxed::Box<crate::model::push_config::PubsubWrapper>),
6116        /// Optional. When set, the payload to the push endpoint is not wrapped.
6117        NoWrapper(std::boxed::Box<crate::model::push_config::NoWrapper>),
6118    }
6119}
6120
6121/// Configuration for a BigQuery subscription.
6122#[derive(Clone, Default, PartialEq)]
6123#[non_exhaustive]
6124pub struct BigQueryConfig {
6125    /// Optional. The name of the table to which to write data, of the form
6126    /// {projectId}.{datasetId}.{tableId}
6127    pub table: std::string::String,
6128
6129    /// Optional. When true, use the topic's schema as the columns to write to in
6130    /// BigQuery, if it exists. `use_topic_schema` and `use_table_schema` cannot be
6131    /// enabled at the same time.
6132    pub use_topic_schema: bool,
6133
6134    /// Optional. When true, write the subscription name, message_id, publish_time,
6135    /// attributes, and ordering_key to additional columns in the table. The
6136    /// subscription name, message_id, and publish_time fields are put in their own
6137    /// columns while all other message properties (other than data) are written to
6138    /// a JSON object in the attributes column.
6139    pub write_metadata: bool,
6140
6141    /// Optional. If true and `use_topic_schema` is true, drops any fields that are
6142    /// part of the topic schema that are not part of the BigQuery table schema
6143    /// when writing to BigQuery. Otherwise, the schemas must be kept in sync and
6144    /// any messages with extra fields are not written and remain in the
6145    /// subscription's backlog. If true and `use_table_schema` is true, drops any
6146    /// fields in the message that are not part of the BigQuery table schema when
6147    /// writing to BigQuery. Otherwise, the write to BigQuery will fail.
6148    pub drop_unknown_fields: bool,
6149
6150    /// Output only. An output-only field that indicates whether or not the
6151    /// subscription can receive messages.
6152    pub state: crate::model::big_query_config::State,
6153
6154    /// Optional. When true, use the BigQuery table's schema as the columns to
6155    /// write to in BigQuery. `use_table_schema` and `use_topic_schema` cannot be
6156    /// enabled at the same time.
6157    pub use_table_schema: bool,
6158
6159    /// Optional. The service account to use to write to BigQuery. The subscription
6160    /// creator or updater that specifies this field must have
6161    /// `iam.serviceAccounts.actAs` permission on the service account. If not
6162    /// specified, the Pub/Sub [service
6163    /// agent](https://cloud.google.com/iam/docs/service-agents),
6164    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
6165    pub service_account_email: std::string::String,
6166
6167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6168}
6169
6170impl BigQueryConfig {
6171    /// Creates a new default instance.
6172    pub fn new() -> Self {
6173        std::default::Default::default()
6174    }
6175
6176    /// Sets the value of [table][crate::model::BigQueryConfig::table].
6177    ///
6178    /// # Example
6179    /// ```ignore,no_run
6180    /// # use google_cloud_pubsub::model::BigQueryConfig;
6181    /// let x = BigQueryConfig::new().set_table("example");
6182    /// ```
6183    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6184        self.table = v.into();
6185        self
6186    }
6187
6188    /// Sets the value of [use_topic_schema][crate::model::BigQueryConfig::use_topic_schema].
6189    ///
6190    /// # Example
6191    /// ```ignore,no_run
6192    /// # use google_cloud_pubsub::model::BigQueryConfig;
6193    /// let x = BigQueryConfig::new().set_use_topic_schema(true);
6194    /// ```
6195    pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6196        self.use_topic_schema = v.into();
6197        self
6198    }
6199
6200    /// Sets the value of [write_metadata][crate::model::BigQueryConfig::write_metadata].
6201    ///
6202    /// # Example
6203    /// ```ignore,no_run
6204    /// # use google_cloud_pubsub::model::BigQueryConfig;
6205    /// let x = BigQueryConfig::new().set_write_metadata(true);
6206    /// ```
6207    pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6208        self.write_metadata = v.into();
6209        self
6210    }
6211
6212    /// Sets the value of [drop_unknown_fields][crate::model::BigQueryConfig::drop_unknown_fields].
6213    ///
6214    /// # Example
6215    /// ```ignore,no_run
6216    /// # use google_cloud_pubsub::model::BigQueryConfig;
6217    /// let x = BigQueryConfig::new().set_drop_unknown_fields(true);
6218    /// ```
6219    pub fn set_drop_unknown_fields<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6220        self.drop_unknown_fields = v.into();
6221        self
6222    }
6223
6224    /// Sets the value of [state][crate::model::BigQueryConfig::state].
6225    ///
6226    /// # Example
6227    /// ```ignore,no_run
6228    /// # use google_cloud_pubsub::model::BigQueryConfig;
6229    /// use google_cloud_pubsub::model::big_query_config::State;
6230    /// let x0 = BigQueryConfig::new().set_state(State::Active);
6231    /// let x1 = BigQueryConfig::new().set_state(State::PermissionDenied);
6232    /// let x2 = BigQueryConfig::new().set_state(State::NotFound);
6233    /// ```
6234    pub fn set_state<T: std::convert::Into<crate::model::big_query_config::State>>(
6235        mut self,
6236        v: T,
6237    ) -> Self {
6238        self.state = v.into();
6239        self
6240    }
6241
6242    /// Sets the value of [use_table_schema][crate::model::BigQueryConfig::use_table_schema].
6243    ///
6244    /// # Example
6245    /// ```ignore,no_run
6246    /// # use google_cloud_pubsub::model::BigQueryConfig;
6247    /// let x = BigQueryConfig::new().set_use_table_schema(true);
6248    /// ```
6249    pub fn set_use_table_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6250        self.use_table_schema = v.into();
6251        self
6252    }
6253
6254    /// Sets the value of [service_account_email][crate::model::BigQueryConfig::service_account_email].
6255    ///
6256    /// # Example
6257    /// ```ignore,no_run
6258    /// # use google_cloud_pubsub::model::BigQueryConfig;
6259    /// let x = BigQueryConfig::new().set_service_account_email("example");
6260    /// ```
6261    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
6262        mut self,
6263        v: T,
6264    ) -> Self {
6265        self.service_account_email = v.into();
6266        self
6267    }
6268}
6269
6270impl wkt::message::Message for BigQueryConfig {
6271    fn typename() -> &'static str {
6272        "type.googleapis.com/google.pubsub.v1.BigQueryConfig"
6273    }
6274}
6275
6276/// Defines additional types related to [BigQueryConfig].
6277pub mod big_query_config {
6278    #[allow(unused_imports)]
6279    use super::*;
6280
6281    /// Possible states for a BigQuery subscription.
6282    ///
6283    /// # Working with unknown values
6284    ///
6285    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6286    /// additional enum variants at any time. Adding new variants is not considered
6287    /// a breaking change. Applications should write their code in anticipation of:
6288    ///
6289    /// - New values appearing in future releases of the client library, **and**
6290    /// - New values received dynamically, without application changes.
6291    ///
6292    /// Please consult the [Working with enums] section in the user guide for some
6293    /// guidelines.
6294    ///
6295    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6296    #[derive(Clone, Debug, PartialEq)]
6297    #[non_exhaustive]
6298    pub enum State {
6299        /// Default value. This value is unused.
6300        Unspecified,
6301        /// The subscription can actively send messages to BigQuery
6302        Active,
6303        /// Cannot write to the BigQuery table because of permission denied errors.
6304        /// This can happen if
6305        ///
6306        /// - Pub/Sub SA has not been granted the [appropriate BigQuery IAM
6307        ///   permissions](https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account)
6308        /// - bigquery.googleapis.com API is not enabled for the project
6309        ///   ([instructions](https://cloud.google.com/service-usage/docs/enable-disable))
6310        PermissionDenied,
6311        /// Cannot write to the BigQuery table because it does not exist.
6312        NotFound,
6313        /// Cannot write to the BigQuery table due to a schema mismatch.
6314        SchemaMismatch,
6315        /// Cannot write to the destination because enforce_in_transit is set to true
6316        /// and the destination locations are not in the allowed regions.
6317        InTransitLocationRestriction,
6318        /// Cannot write to the BigQuery table because the table is not in the same
6319        /// location as where Vertex AI models used in `message_transform`s are
6320        /// deployed.
6321        VertexAiLocationRestriction,
6322        /// If set, the enum was initialized with an unknown value.
6323        ///
6324        /// Applications can examine the value using [State::value] or
6325        /// [State::name].
6326        UnknownValue(state::UnknownValue),
6327    }
6328
6329    #[doc(hidden)]
6330    pub mod state {
6331        #[allow(unused_imports)]
6332        use super::*;
6333        #[derive(Clone, Debug, PartialEq)]
6334        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6335    }
6336
6337    impl State {
6338        /// Gets the enum value.
6339        ///
6340        /// Returns `None` if the enum contains an unknown value deserialized from
6341        /// the string representation of enums.
6342        pub fn value(&self) -> std::option::Option<i32> {
6343            match self {
6344                Self::Unspecified => std::option::Option::Some(0),
6345                Self::Active => std::option::Option::Some(1),
6346                Self::PermissionDenied => std::option::Option::Some(2),
6347                Self::NotFound => std::option::Option::Some(3),
6348                Self::SchemaMismatch => std::option::Option::Some(4),
6349                Self::InTransitLocationRestriction => std::option::Option::Some(5),
6350                Self::VertexAiLocationRestriction => std::option::Option::Some(6),
6351                Self::UnknownValue(u) => u.0.value(),
6352            }
6353        }
6354
6355        /// Gets the enum value as a string.
6356        ///
6357        /// Returns `None` if the enum contains an unknown value deserialized from
6358        /// the integer representation of enums.
6359        pub fn name(&self) -> std::option::Option<&str> {
6360            match self {
6361                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6362                Self::Active => std::option::Option::Some("ACTIVE"),
6363                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
6364                Self::NotFound => std::option::Option::Some("NOT_FOUND"),
6365                Self::SchemaMismatch => std::option::Option::Some("SCHEMA_MISMATCH"),
6366                Self::InTransitLocationRestriction => {
6367                    std::option::Option::Some("IN_TRANSIT_LOCATION_RESTRICTION")
6368                }
6369                Self::VertexAiLocationRestriction => {
6370                    std::option::Option::Some("VERTEX_AI_LOCATION_RESTRICTION")
6371                }
6372                Self::UnknownValue(u) => u.0.name(),
6373            }
6374        }
6375    }
6376
6377    impl std::default::Default for State {
6378        fn default() -> Self {
6379            use std::convert::From;
6380            Self::from(0)
6381        }
6382    }
6383
6384    impl std::fmt::Display for State {
6385        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6386            wkt::internal::display_enum(f, self.name(), self.value())
6387        }
6388    }
6389
6390    impl std::convert::From<i32> for State {
6391        fn from(value: i32) -> Self {
6392            match value {
6393                0 => Self::Unspecified,
6394                1 => Self::Active,
6395                2 => Self::PermissionDenied,
6396                3 => Self::NotFound,
6397                4 => Self::SchemaMismatch,
6398                5 => Self::InTransitLocationRestriction,
6399                6 => Self::VertexAiLocationRestriction,
6400                _ => Self::UnknownValue(state::UnknownValue(
6401                    wkt::internal::UnknownEnumValue::Integer(value),
6402                )),
6403            }
6404        }
6405    }
6406
6407    impl std::convert::From<&str> for State {
6408        fn from(value: &str) -> Self {
6409            use std::string::ToString;
6410            match value {
6411                "STATE_UNSPECIFIED" => Self::Unspecified,
6412                "ACTIVE" => Self::Active,
6413                "PERMISSION_DENIED" => Self::PermissionDenied,
6414                "NOT_FOUND" => Self::NotFound,
6415                "SCHEMA_MISMATCH" => Self::SchemaMismatch,
6416                "IN_TRANSIT_LOCATION_RESTRICTION" => Self::InTransitLocationRestriction,
6417                "VERTEX_AI_LOCATION_RESTRICTION" => Self::VertexAiLocationRestriction,
6418                _ => Self::UnknownValue(state::UnknownValue(
6419                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6420                )),
6421            }
6422        }
6423    }
6424
6425    impl serde::ser::Serialize for State {
6426        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6427        where
6428            S: serde::Serializer,
6429        {
6430            match self {
6431                Self::Unspecified => serializer.serialize_i32(0),
6432                Self::Active => serializer.serialize_i32(1),
6433                Self::PermissionDenied => serializer.serialize_i32(2),
6434                Self::NotFound => serializer.serialize_i32(3),
6435                Self::SchemaMismatch => serializer.serialize_i32(4),
6436                Self::InTransitLocationRestriction => serializer.serialize_i32(5),
6437                Self::VertexAiLocationRestriction => serializer.serialize_i32(6),
6438                Self::UnknownValue(u) => u.0.serialize(serializer),
6439            }
6440        }
6441    }
6442
6443    impl<'de> serde::de::Deserialize<'de> for State {
6444        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6445        where
6446            D: serde::Deserializer<'de>,
6447        {
6448            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6449                ".google.pubsub.v1.BigQueryConfig.State",
6450            ))
6451        }
6452    }
6453}
6454
6455/// Configuration for a Bigtable subscription, which will write a Pub/Sub message
6456/// to a Bigtable row. See the ColumnFamilyMapping documentation below for
6457/// details on how the row keys and columns will be written.
6458#[derive(Clone, Default, PartialEq)]
6459#[non_exhaustive]
6460pub struct BigtableConfig {
6461    /// Optional. The unique name of the table to write messages to.
6462    ///
6463    /// Values are of the form
6464    /// `projects/<project>/instances/<instance>/tables/<table>`.
6465    pub table: std::string::String,
6466
6467    /// Optional. The app profile to use for the Bigtable writes. If not specified,
6468    /// the "default" application profile will be used. The app profile must use
6469    /// single-cluster routing.
6470    pub app_profile_id: std::string::String,
6471
6472    /// Optional. The service account to use to write to Bigtable. The subscription
6473    /// creator or updater that specifies this field must have
6474    /// `iam.serviceAccounts.actAs` permission on the service account. If not
6475    /// specified, the Pub/Sub [service
6476    /// agent](https://cloud.google.com/iam/docs/service-agents),
6477    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
6478    pub service_account_email: std::string::String,
6479
6480    /// Optional. When true, write the subscription name, message_id, publish_time,
6481    /// attributes, and ordering_key to additional columns in the table under the
6482    /// pubsub_metadata column family. The subscription name, message_id, and
6483    /// publish_time fields are put in their own columns while all other message
6484    /// properties (other than data) are written to a JSON object in the attributes
6485    /// column.
6486    pub write_metadata: bool,
6487
6488    /// Output only. An output-only field that indicates whether or not the
6489    /// subscription can receive messages.
6490    pub state: crate::model::bigtable_config::State,
6491
6492    /// How to write a Pub/Sub message to a Bigtable row, notably for defining keys
6493    /// and columns.
6494    ///
6495    /// If not specified, the default is the following:
6496    ///
6497    /// - row key: subscription name, message ID hash, and message ID delimited by
6498    ///   `#`.
6499    /// - columns: message bytes written to a single column family `data` with an
6500    ///   empty-string column qualifier.
6501    /// - cell timestamp: the message publish timestamp.
6502    pub message_mapping: std::option::Option<crate::model::bigtable_config::MessageMapping>,
6503
6504    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6505}
6506
6507impl BigtableConfig {
6508    /// Creates a new default instance.
6509    pub fn new() -> Self {
6510        std::default::Default::default()
6511    }
6512
6513    /// Sets the value of [table][crate::model::BigtableConfig::table].
6514    ///
6515    /// # Example
6516    /// ```ignore,no_run
6517    /// # use google_cloud_pubsub::model::BigtableConfig;
6518    /// let x = BigtableConfig::new().set_table("example");
6519    /// ```
6520    pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6521        self.table = v.into();
6522        self
6523    }
6524
6525    /// Sets the value of [app_profile_id][crate::model::BigtableConfig::app_profile_id].
6526    ///
6527    /// # Example
6528    /// ```ignore,no_run
6529    /// # use google_cloud_pubsub::model::BigtableConfig;
6530    /// let x = BigtableConfig::new().set_app_profile_id("example");
6531    /// ```
6532    pub fn set_app_profile_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6533        self.app_profile_id = v.into();
6534        self
6535    }
6536
6537    /// Sets the value of [service_account_email][crate::model::BigtableConfig::service_account_email].
6538    ///
6539    /// # Example
6540    /// ```ignore,no_run
6541    /// # use google_cloud_pubsub::model::BigtableConfig;
6542    /// let x = BigtableConfig::new().set_service_account_email("example");
6543    /// ```
6544    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
6545        mut self,
6546        v: T,
6547    ) -> Self {
6548        self.service_account_email = v.into();
6549        self
6550    }
6551
6552    /// Sets the value of [write_metadata][crate::model::BigtableConfig::write_metadata].
6553    ///
6554    /// # Example
6555    /// ```ignore,no_run
6556    /// # use google_cloud_pubsub::model::BigtableConfig;
6557    /// let x = BigtableConfig::new().set_write_metadata(true);
6558    /// ```
6559    pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6560        self.write_metadata = v.into();
6561        self
6562    }
6563
6564    /// Sets the value of [state][crate::model::BigtableConfig::state].
6565    ///
6566    /// # Example
6567    /// ```ignore,no_run
6568    /// # use google_cloud_pubsub::model::BigtableConfig;
6569    /// use google_cloud_pubsub::model::bigtable_config::State;
6570    /// let x0 = BigtableConfig::new().set_state(State::Active);
6571    /// let x1 = BigtableConfig::new().set_state(State::NotFound);
6572    /// let x2 = BigtableConfig::new().set_state(State::AppProfileMisconfigured);
6573    /// ```
6574    pub fn set_state<T: std::convert::Into<crate::model::bigtable_config::State>>(
6575        mut self,
6576        v: T,
6577    ) -> Self {
6578        self.state = v.into();
6579        self
6580    }
6581
6582    /// Sets the value of [message_mapping][crate::model::BigtableConfig::message_mapping].
6583    ///
6584    /// Note that all the setters affecting `message_mapping` are mutually
6585    /// exclusive.
6586    ///
6587    /// # Example
6588    /// ```ignore,no_run
6589    /// # use google_cloud_pubsub::model::BigtableConfig;
6590    /// use google_cloud_pubsub::model::bigtable_config::ColumnFamilyMapping;
6591    /// let x = BigtableConfig::new().set_message_mapping(Some(
6592    ///     google_cloud_pubsub::model::bigtable_config::MessageMapping::ColumnFamilyMapping(ColumnFamilyMapping::default().into())));
6593    /// ```
6594    pub fn set_message_mapping<
6595        T: std::convert::Into<std::option::Option<crate::model::bigtable_config::MessageMapping>>,
6596    >(
6597        mut self,
6598        v: T,
6599    ) -> Self {
6600        self.message_mapping = v.into();
6601        self
6602    }
6603
6604    /// The value of [message_mapping][crate::model::BigtableConfig::message_mapping]
6605    /// if it holds a `ColumnFamilyMapping`, `None` if the field is not set or
6606    /// holds a different branch.
6607    pub fn column_family_mapping(
6608        &self,
6609    ) -> std::option::Option<&std::boxed::Box<crate::model::bigtable_config::ColumnFamilyMapping>>
6610    {
6611        #[allow(unreachable_patterns)]
6612        self.message_mapping.as_ref().and_then(|v| match v {
6613            crate::model::bigtable_config::MessageMapping::ColumnFamilyMapping(v) => {
6614                std::option::Option::Some(v)
6615            }
6616            _ => std::option::Option::None,
6617        })
6618    }
6619
6620    /// Sets the value of [message_mapping][crate::model::BigtableConfig::message_mapping]
6621    /// to hold a `ColumnFamilyMapping`.
6622    ///
6623    /// Note that all the setters affecting `message_mapping` are
6624    /// mutually exclusive.
6625    ///
6626    /// # Example
6627    /// ```ignore,no_run
6628    /// # use google_cloud_pubsub::model::BigtableConfig;
6629    /// use google_cloud_pubsub::model::bigtable_config::ColumnFamilyMapping;
6630    /// let x = BigtableConfig::new().set_column_family_mapping(ColumnFamilyMapping::default()/* use setters */);
6631    /// assert!(x.column_family_mapping().is_some());
6632    /// ```
6633    pub fn set_column_family_mapping<
6634        T: std::convert::Into<std::boxed::Box<crate::model::bigtable_config::ColumnFamilyMapping>>,
6635    >(
6636        mut self,
6637        v: T,
6638    ) -> Self {
6639        self.message_mapping = std::option::Option::Some(
6640            crate::model::bigtable_config::MessageMapping::ColumnFamilyMapping(v.into()),
6641        );
6642        self
6643    }
6644}
6645
6646impl wkt::message::Message for BigtableConfig {
6647    fn typename() -> &'static str {
6648        "type.googleapis.com/google.pubsub.v1.BigtableConfig"
6649    }
6650}
6651
6652/// Defines additional types related to [BigtableConfig].
6653pub mod bigtable_config {
6654    #[allow(unused_imports)]
6655    use super::*;
6656
6657    /// Configuration for writing a Pub/Sub message to a Bigtable row with a
6658    /// user-defined key and writing to column families.
6659    ///
6660    /// If this field is set:
6661    ///
6662    /// - The subscription messages must be formatted as JSON.
6663    /// - The row key mapping is configured in the `key_definition` section.
6664    /// - The top-level fields will be written either:
6665    ///   - By default, they will be written to the `data` column family with the
6666    ///     field name as the column qualifier.
6667    ///   - But if the field name matches an existing column family (except for
6668    ///     the default `data` column), then that field will be written to that
6669    ///     column family, either as a scalar or its next level nested fields if
6670    ///     it's a JSON object.
6671    /// - The cell timestamp will be the message publish timestamp.
6672    ///
6673    /// If the field is not set, the default behavior is to write:
6674    ///
6675    /// - row key: subscription name, message ID hash, and message ID delimited by
6676    ///   `#`.
6677    /// - columns: message bytes written to a single column family `data` with an
6678    ///   empty-string column qualifier.
6679    /// - cell timestamp: the message publish timestamp.
6680    #[derive(Clone, Default, PartialEq)]
6681    #[non_exhaustive]
6682    pub struct ColumnFamilyMapping {
6683        /// How to construct the row key from the Pub/Sub message.
6684        /// If not specified, the default behavior is to construct the row key from
6685        /// the subscription name, message ID hash, and message ID delimited by `#`.
6686        pub key_definition: std::option::Option<
6687            crate::model::bigtable_config::column_family_mapping::KeyDefinition,
6688        >,
6689
6690        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6691    }
6692
6693    impl ColumnFamilyMapping {
6694        /// Creates a new default instance.
6695        pub fn new() -> Self {
6696            std::default::Default::default()
6697        }
6698
6699        /// Sets the value of [key_definition][crate::model::bigtable_config::ColumnFamilyMapping::key_definition].
6700        ///
6701        /// Note that all the setters affecting `key_definition` are mutually
6702        /// exclusive.
6703        ///
6704        /// # Example
6705        /// ```ignore,no_run
6706        /// # use google_cloud_pubsub::model::bigtable_config::ColumnFamilyMapping;
6707        /// use google_cloud_pubsub::model::bigtable_config::column_family_mapping::RowKeySchema;
6708        /// let x = ColumnFamilyMapping::new().set_key_definition(Some(
6709        ///     google_cloud_pubsub::model::bigtable_config::column_family_mapping::KeyDefinition::RowKeySchema(RowKeySchema::default().into())));
6710        /// ```
6711        pub fn set_key_definition<
6712            T: std::convert::Into<
6713                    std::option::Option<
6714                        crate::model::bigtable_config::column_family_mapping::KeyDefinition,
6715                    >,
6716                >,
6717        >(
6718            mut self,
6719            v: T,
6720        ) -> Self {
6721            self.key_definition = v.into();
6722            self
6723        }
6724
6725        /// The value of [key_definition][crate::model::bigtable_config::ColumnFamilyMapping::key_definition]
6726        /// if it holds a `RowKeySchema`, `None` if the field is not set or
6727        /// holds a different branch.
6728        pub fn row_key_schema(
6729            &self,
6730        ) -> std::option::Option<
6731            &std::boxed::Box<crate::model::bigtable_config::column_family_mapping::RowKeySchema>,
6732        > {
6733            #[allow(unreachable_patterns)]
6734            self.key_definition.as_ref().and_then(|v| match v {
6735                crate::model::bigtable_config::column_family_mapping::KeyDefinition::RowKeySchema(v) => std::option::Option::Some(v),
6736                _ => std::option::Option::None,
6737            })
6738        }
6739
6740        /// Sets the value of [key_definition][crate::model::bigtable_config::ColumnFamilyMapping::key_definition]
6741        /// to hold a `RowKeySchema`.
6742        ///
6743        /// Note that all the setters affecting `key_definition` are
6744        /// mutually exclusive.
6745        ///
6746        /// # Example
6747        /// ```ignore,no_run
6748        /// # use google_cloud_pubsub::model::bigtable_config::ColumnFamilyMapping;
6749        /// use google_cloud_pubsub::model::bigtable_config::column_family_mapping::RowKeySchema;
6750        /// let x = ColumnFamilyMapping::new().set_row_key_schema(RowKeySchema::default()/* use setters */);
6751        /// assert!(x.row_key_schema().is_some());
6752        /// assert!(x.delimited_key().is_none());
6753        /// ```
6754        pub fn set_row_key_schema<
6755            T: std::convert::Into<
6756                    std::boxed::Box<
6757                        crate::model::bigtable_config::column_family_mapping::RowKeySchema,
6758                    >,
6759                >,
6760        >(
6761            mut self,
6762            v: T,
6763        ) -> Self {
6764            self.key_definition = std::option::Option::Some(
6765                crate::model::bigtable_config::column_family_mapping::KeyDefinition::RowKeySchema(
6766                    v.into(),
6767                ),
6768            );
6769            self
6770        }
6771
6772        /// The value of [key_definition][crate::model::bigtable_config::ColumnFamilyMapping::key_definition]
6773        /// if it holds a `DelimitedKey`, `None` if the field is not set or
6774        /// holds a different branch.
6775        pub fn delimited_key(
6776            &self,
6777        ) -> std::option::Option<
6778            &std::boxed::Box<crate::model::bigtable_config::column_family_mapping::DelimitedKey>,
6779        > {
6780            #[allow(unreachable_patterns)]
6781            self.key_definition.as_ref().and_then(|v| match v {
6782                crate::model::bigtable_config::column_family_mapping::KeyDefinition::DelimitedKey(v) => std::option::Option::Some(v),
6783                _ => std::option::Option::None,
6784            })
6785        }
6786
6787        /// Sets the value of [key_definition][crate::model::bigtable_config::ColumnFamilyMapping::key_definition]
6788        /// to hold a `DelimitedKey`.
6789        ///
6790        /// Note that all the setters affecting `key_definition` are
6791        /// mutually exclusive.
6792        ///
6793        /// # Example
6794        /// ```ignore,no_run
6795        /// # use google_cloud_pubsub::model::bigtable_config::ColumnFamilyMapping;
6796        /// use google_cloud_pubsub::model::bigtable_config::column_family_mapping::DelimitedKey;
6797        /// let x = ColumnFamilyMapping::new().set_delimited_key(DelimitedKey::default()/* use setters */);
6798        /// assert!(x.delimited_key().is_some());
6799        /// assert!(x.row_key_schema().is_none());
6800        /// ```
6801        pub fn set_delimited_key<
6802            T: std::convert::Into<
6803                    std::boxed::Box<
6804                        crate::model::bigtable_config::column_family_mapping::DelimitedKey,
6805                    >,
6806                >,
6807        >(
6808            mut self,
6809            v: T,
6810        ) -> Self {
6811            self.key_definition = std::option::Option::Some(
6812                crate::model::bigtable_config::column_family_mapping::KeyDefinition::DelimitedKey(
6813                    v.into(),
6814                ),
6815            );
6816            self
6817        }
6818    }
6819
6820    impl wkt::message::Message for ColumnFamilyMapping {
6821        fn typename() -> &'static str {
6822            "type.googleapis.com/google.pubsub.v1.BigtableConfig.ColumnFamilyMapping"
6823        }
6824    }
6825
6826    /// Defines additional types related to [ColumnFamilyMapping].
6827    pub mod column_family_mapping {
6828        #[allow(unused_imports)]
6829        use super::*;
6830
6831        /// Row key definition that reads the input message fields based on the field
6832        /// names of the table's structured row key
6833        /// ({$universe.dns_names.final_documentation_domain}/bigtable/docs/manage-row-key-schemas).
6834        /// Note that if the field is nullable in the structured row key, then it
6835        /// need not be present in the message; null will be used instead.
6836        #[derive(Clone, Default, PartialEq)]
6837        #[non_exhaustive]
6838        pub struct RowKeySchema {
6839            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6840        }
6841
6842        impl RowKeySchema {
6843            /// Creates a new default instance.
6844            pub fn new() -> Self {
6845                std::default::Default::default()
6846            }
6847        }
6848
6849        impl wkt::message::Message for RowKeySchema {
6850            fn typename() -> &'static str {
6851                "type.googleapis.com/google.pubsub.v1.BigtableConfig.ColumnFamilyMapping.RowKeySchema"
6852            }
6853        }
6854
6855        /// Row key definition based on fields from the message.
6856        #[derive(Clone, Default, PartialEq)]
6857        #[non_exhaustive]
6858        pub struct DelimitedKey {
6859            /// Required. The key fields to construct from the row key. The fields must
6860            /// be present in the message as a top-level field, i.e. JSON path
6861            /// expressions will not traverse into nested objects.
6862            pub key_fields: std::vec::Vec<std::string::String>,
6863
6864            /// Optional. Byte sequence used to delimit concatenated fields. Must be
6865            /// specified if multiple key fields are used. The delimiter must contain
6866            /// at least 1 character and at most 50 characters.
6867            pub delimiter: ::bytes::Bytes,
6868
6869            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6870        }
6871
6872        impl DelimitedKey {
6873            /// Creates a new default instance.
6874            pub fn new() -> Self {
6875                std::default::Default::default()
6876            }
6877
6878            /// Sets the value of [key_fields][crate::model::bigtable_config::column_family_mapping::DelimitedKey::key_fields].
6879            ///
6880            /// # Example
6881            /// ```ignore,no_run
6882            /// # use google_cloud_pubsub::model::bigtable_config::column_family_mapping::DelimitedKey;
6883            /// let x = DelimitedKey::new().set_key_fields(["a", "b", "c"]);
6884            /// ```
6885            pub fn set_key_fields<T, V>(mut self, v: T) -> Self
6886            where
6887                T: std::iter::IntoIterator<Item = V>,
6888                V: std::convert::Into<std::string::String>,
6889            {
6890                use std::iter::Iterator;
6891                self.key_fields = v.into_iter().map(|i| i.into()).collect();
6892                self
6893            }
6894
6895            /// Sets the value of [delimiter][crate::model::bigtable_config::column_family_mapping::DelimitedKey::delimiter].
6896            ///
6897            /// # Example
6898            /// ```ignore,no_run
6899            /// # use google_cloud_pubsub::model::bigtable_config::column_family_mapping::DelimitedKey;
6900            /// let x = DelimitedKey::new().set_delimiter(bytes::Bytes::from_static(b"example"));
6901            /// ```
6902            pub fn set_delimiter<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6903                self.delimiter = v.into();
6904                self
6905            }
6906        }
6907
6908        impl wkt::message::Message for DelimitedKey {
6909            fn typename() -> &'static str {
6910                "type.googleapis.com/google.pubsub.v1.BigtableConfig.ColumnFamilyMapping.DelimitedKey"
6911            }
6912        }
6913
6914        /// How to construct the row key from the Pub/Sub message.
6915        /// If not specified, the default behavior is to construct the row key from
6916        /// the subscription name, message ID hash, and message ID delimited by `#`.
6917        #[derive(Clone, Debug, PartialEq)]
6918        #[non_exhaustive]
6919        pub enum KeyDefinition {
6920            /// Optional. If set, the row key is constructed from the field names of
6921            /// the table's structured row key
6922            /// ({$universe.dns_names.final_documentation_domain}/bigtable/docs/manage-row-key-schemas).
6923            /// Note that if the field is nullable in the structured row key, then it
6924            /// need not be present in the message; null will be used instead.
6925            RowKeySchema(
6926                std::boxed::Box<crate::model::bigtable_config::column_family_mapping::RowKeySchema>,
6927            ),
6928            /// Optional. If set, the row key is constructed from the given key fields
6929            /// and delimiter. All key fields must be present in the message;
6930            /// otherwise, the message remains in the subscription backlog.
6931            DelimitedKey(
6932                std::boxed::Box<crate::model::bigtable_config::column_family_mapping::DelimitedKey>,
6933            ),
6934        }
6935    }
6936
6937    /// Possible states for a Bigtable subscription.
6938    /// Note: more states could be added in the future. Please code accordingly.
6939    ///
6940    /// # Working with unknown values
6941    ///
6942    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6943    /// additional enum variants at any time. Adding new variants is not considered
6944    /// a breaking change. Applications should write their code in anticipation of:
6945    ///
6946    /// - New values appearing in future releases of the client library, **and**
6947    /// - New values received dynamically, without application changes.
6948    ///
6949    /// Please consult the [Working with enums] section in the user guide for some
6950    /// guidelines.
6951    ///
6952    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6953    #[derive(Clone, Debug, PartialEq)]
6954    #[non_exhaustive]
6955    pub enum State {
6956        /// Default value. This value is unused.
6957        Unspecified,
6958        /// The subscription can actively send messages to Bigtable.
6959        Active,
6960        /// Unused in the current implementation. Placeholder for future use.
6961        NotFound,
6962        /// Unused in the current implementation. Placeholder for future use.
6963        AppProfileMisconfigured,
6964        /// Cannot write to Bigtable because of permission denied errors.
6965        /// This can happen if:
6966        ///
6967        /// - The Bigtable instance, table, or app profile does not exist.
6968        /// - The Pub/Sub service agent has not been granted the
6969        ///   [appropriate Bigtable IAM permission
6970        ///   bigtable.tables.mutateRows]({$universe.dns_names.final_documentation_domain}/bigtable/docs/access-control#permissions)
6971        /// - The bigtable.googleapis.com API is not enabled for the project
6972        ///   ([instructions]({$universe.dns_names.final_documentation_domain}/service-usage/docs/enable-disable))
6973        PermissionDenied,
6974        /// Cannot write to Bigtable because of a missing column family (`data`), or
6975        /// if there is no structured row key for the subscription name + message ID,
6976        /// if because the app profile is not configured for single-cluster routing.
6977        SchemaMismatch,
6978        /// Cannot write to the destination because enforce_in_transit is set to true
6979        /// and the destination locations are not in the allowed regions.
6980        InTransitLocationRestriction,
6981        /// Cannot write to Bigtable because the table is not in the same location as
6982        /// where Vertex AI models used in `message_transform`s are deployed.
6983        VertexAiLocationRestriction,
6984        /// If set, the enum was initialized with an unknown value.
6985        ///
6986        /// Applications can examine the value using [State::value] or
6987        /// [State::name].
6988        UnknownValue(state::UnknownValue),
6989    }
6990
6991    #[doc(hidden)]
6992    pub mod state {
6993        #[allow(unused_imports)]
6994        use super::*;
6995        #[derive(Clone, Debug, PartialEq)]
6996        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6997    }
6998
6999    impl State {
7000        /// Gets the enum value.
7001        ///
7002        /// Returns `None` if the enum contains an unknown value deserialized from
7003        /// the string representation of enums.
7004        pub fn value(&self) -> std::option::Option<i32> {
7005            match self {
7006                Self::Unspecified => std::option::Option::Some(0),
7007                Self::Active => std::option::Option::Some(1),
7008                Self::NotFound => std::option::Option::Some(2),
7009                Self::AppProfileMisconfigured => std::option::Option::Some(3),
7010                Self::PermissionDenied => std::option::Option::Some(4),
7011                Self::SchemaMismatch => std::option::Option::Some(5),
7012                Self::InTransitLocationRestriction => std::option::Option::Some(6),
7013                Self::VertexAiLocationRestriction => std::option::Option::Some(7),
7014                Self::UnknownValue(u) => u.0.value(),
7015            }
7016        }
7017
7018        /// Gets the enum value as a string.
7019        ///
7020        /// Returns `None` if the enum contains an unknown value deserialized from
7021        /// the integer representation of enums.
7022        pub fn name(&self) -> std::option::Option<&str> {
7023            match self {
7024                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7025                Self::Active => std::option::Option::Some("ACTIVE"),
7026                Self::NotFound => std::option::Option::Some("NOT_FOUND"),
7027                Self::AppProfileMisconfigured => {
7028                    std::option::Option::Some("APP_PROFILE_MISCONFIGURED")
7029                }
7030                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
7031                Self::SchemaMismatch => std::option::Option::Some("SCHEMA_MISMATCH"),
7032                Self::InTransitLocationRestriction => {
7033                    std::option::Option::Some("IN_TRANSIT_LOCATION_RESTRICTION")
7034                }
7035                Self::VertexAiLocationRestriction => {
7036                    std::option::Option::Some("VERTEX_AI_LOCATION_RESTRICTION")
7037                }
7038                Self::UnknownValue(u) => u.0.name(),
7039            }
7040        }
7041    }
7042
7043    impl std::default::Default for State {
7044        fn default() -> Self {
7045            use std::convert::From;
7046            Self::from(0)
7047        }
7048    }
7049
7050    impl std::fmt::Display for State {
7051        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7052            wkt::internal::display_enum(f, self.name(), self.value())
7053        }
7054    }
7055
7056    impl std::convert::From<i32> for State {
7057        fn from(value: i32) -> Self {
7058            match value {
7059                0 => Self::Unspecified,
7060                1 => Self::Active,
7061                2 => Self::NotFound,
7062                3 => Self::AppProfileMisconfigured,
7063                4 => Self::PermissionDenied,
7064                5 => Self::SchemaMismatch,
7065                6 => Self::InTransitLocationRestriction,
7066                7 => Self::VertexAiLocationRestriction,
7067                _ => Self::UnknownValue(state::UnknownValue(
7068                    wkt::internal::UnknownEnumValue::Integer(value),
7069                )),
7070            }
7071        }
7072    }
7073
7074    impl std::convert::From<&str> for State {
7075        fn from(value: &str) -> Self {
7076            use std::string::ToString;
7077            match value {
7078                "STATE_UNSPECIFIED" => Self::Unspecified,
7079                "ACTIVE" => Self::Active,
7080                "NOT_FOUND" => Self::NotFound,
7081                "APP_PROFILE_MISCONFIGURED" => Self::AppProfileMisconfigured,
7082                "PERMISSION_DENIED" => Self::PermissionDenied,
7083                "SCHEMA_MISMATCH" => Self::SchemaMismatch,
7084                "IN_TRANSIT_LOCATION_RESTRICTION" => Self::InTransitLocationRestriction,
7085                "VERTEX_AI_LOCATION_RESTRICTION" => Self::VertexAiLocationRestriction,
7086                _ => Self::UnknownValue(state::UnknownValue(
7087                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7088                )),
7089            }
7090        }
7091    }
7092
7093    impl serde::ser::Serialize for State {
7094        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7095        where
7096            S: serde::Serializer,
7097        {
7098            match self {
7099                Self::Unspecified => serializer.serialize_i32(0),
7100                Self::Active => serializer.serialize_i32(1),
7101                Self::NotFound => serializer.serialize_i32(2),
7102                Self::AppProfileMisconfigured => serializer.serialize_i32(3),
7103                Self::PermissionDenied => serializer.serialize_i32(4),
7104                Self::SchemaMismatch => serializer.serialize_i32(5),
7105                Self::InTransitLocationRestriction => serializer.serialize_i32(6),
7106                Self::VertexAiLocationRestriction => serializer.serialize_i32(7),
7107                Self::UnknownValue(u) => u.0.serialize(serializer),
7108            }
7109        }
7110    }
7111
7112    impl<'de> serde::de::Deserialize<'de> for State {
7113        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7114        where
7115            D: serde::Deserializer<'de>,
7116        {
7117            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7118                ".google.pubsub.v1.BigtableConfig.State",
7119            ))
7120        }
7121    }
7122
7123    /// How to write a Pub/Sub message to a Bigtable row, notably for defining keys
7124    /// and columns.
7125    ///
7126    /// If not specified, the default is the following:
7127    ///
7128    /// - row key: subscription name, message ID hash, and message ID delimited by
7129    ///   `#`.
7130    /// - columns: message bytes written to a single column family `data` with an
7131    ///   empty-string column qualifier.
7132    /// - cell timestamp: the message publish timestamp.
7133    #[derive(Clone, Debug, PartialEq)]
7134    #[non_exhaustive]
7135    pub enum MessageMapping {
7136        /// Optional. Configuration that allows writing row keys and/or columns based
7137        /// on fields in the input message. The input message format must be JSON if
7138        /// this field is set.
7139        ColumnFamilyMapping(std::boxed::Box<crate::model::bigtable_config::ColumnFamilyMapping>),
7140    }
7141}
7142
7143/// Configuration for a Cloud Storage subscription.
7144#[derive(Clone, Default, PartialEq)]
7145#[non_exhaustive]
7146pub struct CloudStorageConfig {
7147    /// Required. User-provided name for the Cloud Storage bucket.
7148    /// The bucket must be created by the user. The bucket name must be without
7149    /// any prefix like "gs://". See the [bucket naming
7150    /// requirements] (<https://cloud.google.com/storage/docs/buckets#naming>).
7151    pub bucket: std::string::String,
7152
7153    /// Optional. User-provided prefix for Cloud Storage filename. See the [object
7154    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
7155    pub filename_prefix: std::string::String,
7156
7157    /// Optional. User-provided suffix for Cloud Storage filename. See the [object
7158    /// naming requirements](https://cloud.google.com/storage/docs/objects#naming).
7159    /// Must not end in "/".
7160    pub filename_suffix: std::string::String,
7161
7162    /// Optional. User-provided format string specifying how to represent datetimes
7163    /// in Cloud Storage filenames. See the [datetime format
7164    /// guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).
7165    pub filename_datetime_format: std::string::String,
7166
7167    /// Optional. The maximum duration that can elapse before a new Cloud Storage
7168    /// file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
7169    /// exceed the subscription's acknowledgment deadline.
7170    pub max_duration: std::option::Option<wkt::Duration>,
7171
7172    /// Optional. The maximum bytes that can be written to a Cloud Storage file
7173    /// before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
7174    /// be exceeded in cases where messages are larger than the limit.
7175    pub max_bytes: i64,
7176
7177    /// Optional. The maximum number of messages that can be written to a Cloud
7178    /// Storage file before a new file is created. Min 1000 messages.
7179    pub max_messages: i64,
7180
7181    /// Output only. An output-only field that indicates whether or not the
7182    /// subscription can receive messages.
7183    pub state: crate::model::cloud_storage_config::State,
7184
7185    /// Optional. The service account to use to write to Cloud Storage. The
7186    /// subscription creator or updater that specifies this field must have
7187    /// `iam.serviceAccounts.actAs` permission on the service account. If not
7188    /// specified, the Pub/Sub
7189    /// [service agent](https://cloud.google.com/iam/docs/service-agents),
7190    /// service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
7191    pub service_account_email: std::string::String,
7192
7193    /// Defaults to text format.
7194    pub output_format: std::option::Option<crate::model::cloud_storage_config::OutputFormat>,
7195
7196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7197}
7198
7199impl CloudStorageConfig {
7200    /// Creates a new default instance.
7201    pub fn new() -> Self {
7202        std::default::Default::default()
7203    }
7204
7205    /// Sets the value of [bucket][crate::model::CloudStorageConfig::bucket].
7206    ///
7207    /// # Example
7208    /// ```ignore,no_run
7209    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7210    /// let x = CloudStorageConfig::new().set_bucket("example");
7211    /// ```
7212    pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7213        self.bucket = v.into();
7214        self
7215    }
7216
7217    /// Sets the value of [filename_prefix][crate::model::CloudStorageConfig::filename_prefix].
7218    ///
7219    /// # Example
7220    /// ```ignore,no_run
7221    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7222    /// let x = CloudStorageConfig::new().set_filename_prefix("example");
7223    /// ```
7224    pub fn set_filename_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7225        self.filename_prefix = v.into();
7226        self
7227    }
7228
7229    /// Sets the value of [filename_suffix][crate::model::CloudStorageConfig::filename_suffix].
7230    ///
7231    /// # Example
7232    /// ```ignore,no_run
7233    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7234    /// let x = CloudStorageConfig::new().set_filename_suffix("example");
7235    /// ```
7236    pub fn set_filename_suffix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7237        self.filename_suffix = v.into();
7238        self
7239    }
7240
7241    /// Sets the value of [filename_datetime_format][crate::model::CloudStorageConfig::filename_datetime_format].
7242    ///
7243    /// # Example
7244    /// ```ignore,no_run
7245    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7246    /// let x = CloudStorageConfig::new().set_filename_datetime_format("example");
7247    /// ```
7248    pub fn set_filename_datetime_format<T: std::convert::Into<std::string::String>>(
7249        mut self,
7250        v: T,
7251    ) -> Self {
7252        self.filename_datetime_format = v.into();
7253        self
7254    }
7255
7256    /// Sets the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
7257    ///
7258    /// # Example
7259    /// ```ignore,no_run
7260    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7261    /// use wkt::Duration;
7262    /// let x = CloudStorageConfig::new().set_max_duration(Duration::default()/* use setters */);
7263    /// ```
7264    pub fn set_max_duration<T>(mut self, v: T) -> Self
7265    where
7266        T: std::convert::Into<wkt::Duration>,
7267    {
7268        self.max_duration = std::option::Option::Some(v.into());
7269        self
7270    }
7271
7272    /// Sets or clears the value of [max_duration][crate::model::CloudStorageConfig::max_duration].
7273    ///
7274    /// # Example
7275    /// ```ignore,no_run
7276    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7277    /// use wkt::Duration;
7278    /// let x = CloudStorageConfig::new().set_or_clear_max_duration(Some(Duration::default()/* use setters */));
7279    /// let x = CloudStorageConfig::new().set_or_clear_max_duration(None::<Duration>);
7280    /// ```
7281    pub fn set_or_clear_max_duration<T>(mut self, v: std::option::Option<T>) -> Self
7282    where
7283        T: std::convert::Into<wkt::Duration>,
7284    {
7285        self.max_duration = v.map(|x| x.into());
7286        self
7287    }
7288
7289    /// Sets the value of [max_bytes][crate::model::CloudStorageConfig::max_bytes].
7290    ///
7291    /// # Example
7292    /// ```ignore,no_run
7293    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7294    /// let x = CloudStorageConfig::new().set_max_bytes(42);
7295    /// ```
7296    pub fn set_max_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7297        self.max_bytes = v.into();
7298        self
7299    }
7300
7301    /// Sets the value of [max_messages][crate::model::CloudStorageConfig::max_messages].
7302    ///
7303    /// # Example
7304    /// ```ignore,no_run
7305    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7306    /// let x = CloudStorageConfig::new().set_max_messages(42);
7307    /// ```
7308    pub fn set_max_messages<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7309        self.max_messages = v.into();
7310        self
7311    }
7312
7313    /// Sets the value of [state][crate::model::CloudStorageConfig::state].
7314    ///
7315    /// # Example
7316    /// ```ignore,no_run
7317    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7318    /// use google_cloud_pubsub::model::cloud_storage_config::State;
7319    /// let x0 = CloudStorageConfig::new().set_state(State::Active);
7320    /// let x1 = CloudStorageConfig::new().set_state(State::PermissionDenied);
7321    /// let x2 = CloudStorageConfig::new().set_state(State::NotFound);
7322    /// ```
7323    pub fn set_state<T: std::convert::Into<crate::model::cloud_storage_config::State>>(
7324        mut self,
7325        v: T,
7326    ) -> Self {
7327        self.state = v.into();
7328        self
7329    }
7330
7331    /// Sets the value of [service_account_email][crate::model::CloudStorageConfig::service_account_email].
7332    ///
7333    /// # Example
7334    /// ```ignore,no_run
7335    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7336    /// let x = CloudStorageConfig::new().set_service_account_email("example");
7337    /// ```
7338    pub fn set_service_account_email<T: std::convert::Into<std::string::String>>(
7339        mut self,
7340        v: T,
7341    ) -> Self {
7342        self.service_account_email = v.into();
7343        self
7344    }
7345
7346    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format].
7347    ///
7348    /// Note that all the setters affecting `output_format` are mutually
7349    /// exclusive.
7350    ///
7351    /// # Example
7352    /// ```ignore,no_run
7353    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7354    /// use google_cloud_pubsub::model::cloud_storage_config::TextConfig;
7355    /// let x = CloudStorageConfig::new().set_output_format(Some(
7356    ///     google_cloud_pubsub::model::cloud_storage_config::OutputFormat::TextConfig(TextConfig::default().into())));
7357    /// ```
7358    pub fn set_output_format<
7359        T: std::convert::Into<std::option::Option<crate::model::cloud_storage_config::OutputFormat>>,
7360    >(
7361        mut self,
7362        v: T,
7363    ) -> Self {
7364        self.output_format = v.into();
7365        self
7366    }
7367
7368    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
7369    /// if it holds a `TextConfig`, `None` if the field is not set or
7370    /// holds a different branch.
7371    pub fn text_config(
7372        &self,
7373    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::TextConfig>> {
7374        #[allow(unreachable_patterns)]
7375        self.output_format.as_ref().and_then(|v| match v {
7376            crate::model::cloud_storage_config::OutputFormat::TextConfig(v) => {
7377                std::option::Option::Some(v)
7378            }
7379            _ => std::option::Option::None,
7380        })
7381    }
7382
7383    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
7384    /// to hold a `TextConfig`.
7385    ///
7386    /// Note that all the setters affecting `output_format` are
7387    /// mutually exclusive.
7388    ///
7389    /// # Example
7390    /// ```ignore,no_run
7391    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7392    /// use google_cloud_pubsub::model::cloud_storage_config::TextConfig;
7393    /// let x = CloudStorageConfig::new().set_text_config(TextConfig::default()/* use setters */);
7394    /// assert!(x.text_config().is_some());
7395    /// assert!(x.avro_config().is_none());
7396    /// ```
7397    pub fn set_text_config<
7398        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::TextConfig>>,
7399    >(
7400        mut self,
7401        v: T,
7402    ) -> Self {
7403        self.output_format = std::option::Option::Some(
7404            crate::model::cloud_storage_config::OutputFormat::TextConfig(v.into()),
7405        );
7406        self
7407    }
7408
7409    /// The value of [output_format][crate::model::CloudStorageConfig::output_format]
7410    /// if it holds a `AvroConfig`, `None` if the field is not set or
7411    /// holds a different branch.
7412    pub fn avro_config(
7413        &self,
7414    ) -> std::option::Option<&std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>> {
7415        #[allow(unreachable_patterns)]
7416        self.output_format.as_ref().and_then(|v| match v {
7417            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v) => {
7418                std::option::Option::Some(v)
7419            }
7420            _ => std::option::Option::None,
7421        })
7422    }
7423
7424    /// Sets the value of [output_format][crate::model::CloudStorageConfig::output_format]
7425    /// to hold a `AvroConfig`.
7426    ///
7427    /// Note that all the setters affecting `output_format` are
7428    /// mutually exclusive.
7429    ///
7430    /// # Example
7431    /// ```ignore,no_run
7432    /// # use google_cloud_pubsub::model::CloudStorageConfig;
7433    /// use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
7434    /// let x = CloudStorageConfig::new().set_avro_config(AvroConfig::default()/* use setters */);
7435    /// assert!(x.avro_config().is_some());
7436    /// assert!(x.text_config().is_none());
7437    /// ```
7438    pub fn set_avro_config<
7439        T: std::convert::Into<std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>>,
7440    >(
7441        mut self,
7442        v: T,
7443    ) -> Self {
7444        self.output_format = std::option::Option::Some(
7445            crate::model::cloud_storage_config::OutputFormat::AvroConfig(v.into()),
7446        );
7447        self
7448    }
7449}
7450
7451impl wkt::message::Message for CloudStorageConfig {
7452    fn typename() -> &'static str {
7453        "type.googleapis.com/google.pubsub.v1.CloudStorageConfig"
7454    }
7455}
7456
7457/// Defines additional types related to [CloudStorageConfig].
7458pub mod cloud_storage_config {
7459    #[allow(unused_imports)]
7460    use super::*;
7461
7462    /// Configuration for writing message data in text format.
7463    /// Message payloads will be written to files as raw text, separated by a
7464    /// newline.
7465    #[derive(Clone, Default, PartialEq)]
7466    #[non_exhaustive]
7467    pub struct TextConfig {
7468        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7469    }
7470
7471    impl TextConfig {
7472        /// Creates a new default instance.
7473        pub fn new() -> Self {
7474            std::default::Default::default()
7475        }
7476    }
7477
7478    impl wkt::message::Message for TextConfig {
7479        fn typename() -> &'static str {
7480            "type.googleapis.com/google.pubsub.v1.CloudStorageConfig.TextConfig"
7481        }
7482    }
7483
7484    /// Configuration for writing message data in Avro format.
7485    /// Message payloads and metadata will be written to files as an Avro binary.
7486    #[derive(Clone, Default, PartialEq)]
7487    #[non_exhaustive]
7488    pub struct AvroConfig {
7489        /// Optional. When true, write the subscription name, message_id,
7490        /// publish_time, attributes, and ordering_key as additional fields in the
7491        /// output. The subscription name, message_id, and publish_time fields are
7492        /// put in their own fields while all other message properties other than
7493        /// data (for example, an ordering_key, if present) are added as entries in
7494        /// the attributes map.
7495        pub write_metadata: bool,
7496
7497        /// Optional. When true, the output Cloud Storage file will be serialized
7498        /// using the topic schema, if it exists.
7499        pub use_topic_schema: bool,
7500
7501        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7502    }
7503
7504    impl AvroConfig {
7505        /// Creates a new default instance.
7506        pub fn new() -> Self {
7507            std::default::Default::default()
7508        }
7509
7510        /// Sets the value of [write_metadata][crate::model::cloud_storage_config::AvroConfig::write_metadata].
7511        ///
7512        /// # Example
7513        /// ```ignore,no_run
7514        /// # use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
7515        /// let x = AvroConfig::new().set_write_metadata(true);
7516        /// ```
7517        pub fn set_write_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7518            self.write_metadata = v.into();
7519            self
7520        }
7521
7522        /// Sets the value of [use_topic_schema][crate::model::cloud_storage_config::AvroConfig::use_topic_schema].
7523        ///
7524        /// # Example
7525        /// ```ignore,no_run
7526        /// # use google_cloud_pubsub::model::cloud_storage_config::AvroConfig;
7527        /// let x = AvroConfig::new().set_use_topic_schema(true);
7528        /// ```
7529        pub fn set_use_topic_schema<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7530            self.use_topic_schema = v.into();
7531            self
7532        }
7533    }
7534
7535    impl wkt::message::Message for AvroConfig {
7536        fn typename() -> &'static str {
7537            "type.googleapis.com/google.pubsub.v1.CloudStorageConfig.AvroConfig"
7538        }
7539    }
7540
7541    /// Possible states for a Cloud Storage subscription.
7542    ///
7543    /// # Working with unknown values
7544    ///
7545    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7546    /// additional enum variants at any time. Adding new variants is not considered
7547    /// a breaking change. Applications should write their code in anticipation of:
7548    ///
7549    /// - New values appearing in future releases of the client library, **and**
7550    /// - New values received dynamically, without application changes.
7551    ///
7552    /// Please consult the [Working with enums] section in the user guide for some
7553    /// guidelines.
7554    ///
7555    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7556    #[derive(Clone, Debug, PartialEq)]
7557    #[non_exhaustive]
7558    pub enum State {
7559        /// Default value. This value is unused.
7560        Unspecified,
7561        /// The subscription can actively send messages to Cloud Storage.
7562        Active,
7563        /// Cannot write to the Cloud Storage bucket because of permission denied
7564        /// errors.
7565        PermissionDenied,
7566        /// Cannot write to the Cloud Storage bucket because it does not exist.
7567        NotFound,
7568        /// Cannot write to the destination because enforce_in_transit is set to true
7569        /// and the destination locations are not in the allowed regions.
7570        InTransitLocationRestriction,
7571        /// Cannot write to the Cloud Storage bucket due to an incompatibility
7572        /// between the topic schema and subscription settings.
7573        SchemaMismatch,
7574        /// Cannot write to the Cloud Storage bucket because the bucket is not in the
7575        /// same location as where Vertex AI models used in `message_transform`s are
7576        /// deployed.
7577        VertexAiLocationRestriction,
7578        /// If set, the enum was initialized with an unknown value.
7579        ///
7580        /// Applications can examine the value using [State::value] or
7581        /// [State::name].
7582        UnknownValue(state::UnknownValue),
7583    }
7584
7585    #[doc(hidden)]
7586    pub mod state {
7587        #[allow(unused_imports)]
7588        use super::*;
7589        #[derive(Clone, Debug, PartialEq)]
7590        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7591    }
7592
7593    impl State {
7594        /// Gets the enum value.
7595        ///
7596        /// Returns `None` if the enum contains an unknown value deserialized from
7597        /// the string representation of enums.
7598        pub fn value(&self) -> std::option::Option<i32> {
7599            match self {
7600                Self::Unspecified => std::option::Option::Some(0),
7601                Self::Active => std::option::Option::Some(1),
7602                Self::PermissionDenied => std::option::Option::Some(2),
7603                Self::NotFound => std::option::Option::Some(3),
7604                Self::InTransitLocationRestriction => std::option::Option::Some(4),
7605                Self::SchemaMismatch => std::option::Option::Some(5),
7606                Self::VertexAiLocationRestriction => std::option::Option::Some(6),
7607                Self::UnknownValue(u) => u.0.value(),
7608            }
7609        }
7610
7611        /// Gets the enum value as a string.
7612        ///
7613        /// Returns `None` if the enum contains an unknown value deserialized from
7614        /// the integer representation of enums.
7615        pub fn name(&self) -> std::option::Option<&str> {
7616            match self {
7617                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
7618                Self::Active => std::option::Option::Some("ACTIVE"),
7619                Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
7620                Self::NotFound => std::option::Option::Some("NOT_FOUND"),
7621                Self::InTransitLocationRestriction => {
7622                    std::option::Option::Some("IN_TRANSIT_LOCATION_RESTRICTION")
7623                }
7624                Self::SchemaMismatch => std::option::Option::Some("SCHEMA_MISMATCH"),
7625                Self::VertexAiLocationRestriction => {
7626                    std::option::Option::Some("VERTEX_AI_LOCATION_RESTRICTION")
7627                }
7628                Self::UnknownValue(u) => u.0.name(),
7629            }
7630        }
7631    }
7632
7633    impl std::default::Default for State {
7634        fn default() -> Self {
7635            use std::convert::From;
7636            Self::from(0)
7637        }
7638    }
7639
7640    impl std::fmt::Display for State {
7641        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7642            wkt::internal::display_enum(f, self.name(), self.value())
7643        }
7644    }
7645
7646    impl std::convert::From<i32> for State {
7647        fn from(value: i32) -> Self {
7648            match value {
7649                0 => Self::Unspecified,
7650                1 => Self::Active,
7651                2 => Self::PermissionDenied,
7652                3 => Self::NotFound,
7653                4 => Self::InTransitLocationRestriction,
7654                5 => Self::SchemaMismatch,
7655                6 => Self::VertexAiLocationRestriction,
7656                _ => Self::UnknownValue(state::UnknownValue(
7657                    wkt::internal::UnknownEnumValue::Integer(value),
7658                )),
7659            }
7660        }
7661    }
7662
7663    impl std::convert::From<&str> for State {
7664        fn from(value: &str) -> Self {
7665            use std::string::ToString;
7666            match value {
7667                "STATE_UNSPECIFIED" => Self::Unspecified,
7668                "ACTIVE" => Self::Active,
7669                "PERMISSION_DENIED" => Self::PermissionDenied,
7670                "NOT_FOUND" => Self::NotFound,
7671                "IN_TRANSIT_LOCATION_RESTRICTION" => Self::InTransitLocationRestriction,
7672                "SCHEMA_MISMATCH" => Self::SchemaMismatch,
7673                "VERTEX_AI_LOCATION_RESTRICTION" => Self::VertexAiLocationRestriction,
7674                _ => Self::UnknownValue(state::UnknownValue(
7675                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7676                )),
7677            }
7678        }
7679    }
7680
7681    impl serde::ser::Serialize for State {
7682        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7683        where
7684            S: serde::Serializer,
7685        {
7686            match self {
7687                Self::Unspecified => serializer.serialize_i32(0),
7688                Self::Active => serializer.serialize_i32(1),
7689                Self::PermissionDenied => serializer.serialize_i32(2),
7690                Self::NotFound => serializer.serialize_i32(3),
7691                Self::InTransitLocationRestriction => serializer.serialize_i32(4),
7692                Self::SchemaMismatch => serializer.serialize_i32(5),
7693                Self::VertexAiLocationRestriction => serializer.serialize_i32(6),
7694                Self::UnknownValue(u) => u.0.serialize(serializer),
7695            }
7696        }
7697    }
7698
7699    impl<'de> serde::de::Deserialize<'de> for State {
7700        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7701        where
7702            D: serde::Deserializer<'de>,
7703        {
7704            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
7705                ".google.pubsub.v1.CloudStorageConfig.State",
7706            ))
7707        }
7708    }
7709
7710    /// Defaults to text format.
7711    #[derive(Clone, Debug, PartialEq)]
7712    #[non_exhaustive]
7713    pub enum OutputFormat {
7714        /// Optional. If set, message data will be written to Cloud Storage in text
7715        /// format.
7716        TextConfig(std::boxed::Box<crate::model::cloud_storage_config::TextConfig>),
7717        /// Optional. If set, message data will be written to Cloud Storage in Avro
7718        /// format.
7719        AvroConfig(std::boxed::Box<crate::model::cloud_storage_config::AvroConfig>),
7720    }
7721}
7722
7723/// Request for the GetSubscription method.
7724#[derive(Clone, Default, PartialEq)]
7725#[non_exhaustive]
7726pub struct GetSubscriptionRequest {
7727    /// Required. The name of the subscription to get.
7728    /// Format is `projects/{project}/subscriptions/{sub}`.
7729    pub subscription: std::string::String,
7730
7731    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7732}
7733
7734impl GetSubscriptionRequest {
7735    /// Creates a new default instance.
7736    pub fn new() -> Self {
7737        std::default::Default::default()
7738    }
7739
7740    /// Sets the value of [subscription][crate::model::GetSubscriptionRequest::subscription].
7741    ///
7742    /// # Example
7743    /// ```ignore,no_run
7744    /// # use google_cloud_pubsub::model::GetSubscriptionRequest;
7745    /// # let project_id = "project_id";
7746    /// # let subscription_id = "subscription_id";
7747    /// let x = GetSubscriptionRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
7748    /// ```
7749    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7750        self.subscription = v.into();
7751        self
7752    }
7753}
7754
7755impl wkt::message::Message for GetSubscriptionRequest {
7756    fn typename() -> &'static str {
7757        "type.googleapis.com/google.pubsub.v1.GetSubscriptionRequest"
7758    }
7759}
7760
7761/// Request for the UpdateSubscription method.
7762#[derive(Clone, Default, PartialEq)]
7763#[non_exhaustive]
7764pub struct UpdateSubscriptionRequest {
7765    /// Required. The updated subscription object.
7766    pub subscription: std::option::Option<crate::model::Subscription>,
7767
7768    /// Required. Indicates which fields in the provided subscription to update.
7769    /// Must be specified and non-empty.
7770    pub update_mask: std::option::Option<wkt::FieldMask>,
7771
7772    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7773}
7774
7775impl UpdateSubscriptionRequest {
7776    /// Creates a new default instance.
7777    pub fn new() -> Self {
7778        std::default::Default::default()
7779    }
7780
7781    /// Sets the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
7782    ///
7783    /// # Example
7784    /// ```ignore,no_run
7785    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
7786    /// use google_cloud_pubsub::model::Subscription;
7787    /// let x = UpdateSubscriptionRequest::new().set_subscription(Subscription::default()/* use setters */);
7788    /// ```
7789    pub fn set_subscription<T>(mut self, v: T) -> Self
7790    where
7791        T: std::convert::Into<crate::model::Subscription>,
7792    {
7793        self.subscription = std::option::Option::Some(v.into());
7794        self
7795    }
7796
7797    /// Sets or clears the value of [subscription][crate::model::UpdateSubscriptionRequest::subscription].
7798    ///
7799    /// # Example
7800    /// ```ignore,no_run
7801    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
7802    /// use google_cloud_pubsub::model::Subscription;
7803    /// let x = UpdateSubscriptionRequest::new().set_or_clear_subscription(Some(Subscription::default()/* use setters */));
7804    /// let x = UpdateSubscriptionRequest::new().set_or_clear_subscription(None::<Subscription>);
7805    /// ```
7806    pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
7807    where
7808        T: std::convert::Into<crate::model::Subscription>,
7809    {
7810        self.subscription = v.map(|x| x.into());
7811        self
7812    }
7813
7814    /// Sets the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
7815    ///
7816    /// # Example
7817    /// ```ignore,no_run
7818    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
7819    /// use wkt::FieldMask;
7820    /// let x = UpdateSubscriptionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7821    /// ```
7822    pub fn set_update_mask<T>(mut self, v: T) -> Self
7823    where
7824        T: std::convert::Into<wkt::FieldMask>,
7825    {
7826        self.update_mask = std::option::Option::Some(v.into());
7827        self
7828    }
7829
7830    /// Sets or clears the value of [update_mask][crate::model::UpdateSubscriptionRequest::update_mask].
7831    ///
7832    /// # Example
7833    /// ```ignore,no_run
7834    /// # use google_cloud_pubsub::model::UpdateSubscriptionRequest;
7835    /// use wkt::FieldMask;
7836    /// let x = UpdateSubscriptionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7837    /// let x = UpdateSubscriptionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7838    /// ```
7839    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7840    where
7841        T: std::convert::Into<wkt::FieldMask>,
7842    {
7843        self.update_mask = v.map(|x| x.into());
7844        self
7845    }
7846}
7847
7848impl wkt::message::Message for UpdateSubscriptionRequest {
7849    fn typename() -> &'static str {
7850        "type.googleapis.com/google.pubsub.v1.UpdateSubscriptionRequest"
7851    }
7852}
7853
7854/// Request for the `ListSubscriptions` method.
7855#[derive(Clone, Default, PartialEq)]
7856#[non_exhaustive]
7857pub struct ListSubscriptionsRequest {
7858    /// Required. The name of the project in which to list subscriptions.
7859    /// Format is `projects/{project-id}`.
7860    pub project: std::string::String,
7861
7862    /// Optional. Maximum number of subscriptions to return.
7863    pub page_size: i32,
7864
7865    /// Optional. The value returned by the last `ListSubscriptionsResponse`;
7866    /// indicates that this is a continuation of a prior `ListSubscriptions` call,
7867    /// and that the system should return the next page of data.
7868    pub page_token: std::string::String,
7869
7870    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7871}
7872
7873impl ListSubscriptionsRequest {
7874    /// Creates a new default instance.
7875    pub fn new() -> Self {
7876        std::default::Default::default()
7877    }
7878
7879    /// Sets the value of [project][crate::model::ListSubscriptionsRequest::project].
7880    ///
7881    /// # Example
7882    /// ```ignore,no_run
7883    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
7884    /// let x = ListSubscriptionsRequest::new().set_project("example");
7885    /// ```
7886    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7887        self.project = v.into();
7888        self
7889    }
7890
7891    /// Sets the value of [page_size][crate::model::ListSubscriptionsRequest::page_size].
7892    ///
7893    /// # Example
7894    /// ```ignore,no_run
7895    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
7896    /// let x = ListSubscriptionsRequest::new().set_page_size(42);
7897    /// ```
7898    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7899        self.page_size = v.into();
7900        self
7901    }
7902
7903    /// Sets the value of [page_token][crate::model::ListSubscriptionsRequest::page_token].
7904    ///
7905    /// # Example
7906    /// ```ignore,no_run
7907    /// # use google_cloud_pubsub::model::ListSubscriptionsRequest;
7908    /// let x = ListSubscriptionsRequest::new().set_page_token("example");
7909    /// ```
7910    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7911        self.page_token = v.into();
7912        self
7913    }
7914}
7915
7916impl wkt::message::Message for ListSubscriptionsRequest {
7917    fn typename() -> &'static str {
7918        "type.googleapis.com/google.pubsub.v1.ListSubscriptionsRequest"
7919    }
7920}
7921
7922/// Response for the `ListSubscriptions` method.
7923#[derive(Clone, Default, PartialEq)]
7924#[non_exhaustive]
7925pub struct ListSubscriptionsResponse {
7926    /// Optional. The subscriptions that match the request.
7927    pub subscriptions: std::vec::Vec<crate::model::Subscription>,
7928
7929    /// Optional. If not empty, indicates that there may be more subscriptions that
7930    /// match the request; this value should be passed in a new
7931    /// `ListSubscriptionsRequest` to get more subscriptions.
7932    pub next_page_token: std::string::String,
7933
7934    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7935}
7936
7937impl ListSubscriptionsResponse {
7938    /// Creates a new default instance.
7939    pub fn new() -> Self {
7940        std::default::Default::default()
7941    }
7942
7943    /// Sets the value of [subscriptions][crate::model::ListSubscriptionsResponse::subscriptions].
7944    ///
7945    /// # Example
7946    /// ```ignore,no_run
7947    /// # use google_cloud_pubsub::model::ListSubscriptionsResponse;
7948    /// use google_cloud_pubsub::model::Subscription;
7949    /// let x = ListSubscriptionsResponse::new()
7950    ///     .set_subscriptions([
7951    ///         Subscription::default()/* use setters */,
7952    ///         Subscription::default()/* use (different) setters */,
7953    ///     ]);
7954    /// ```
7955    pub fn set_subscriptions<T, V>(mut self, v: T) -> Self
7956    where
7957        T: std::iter::IntoIterator<Item = V>,
7958        V: std::convert::Into<crate::model::Subscription>,
7959    {
7960        use std::iter::Iterator;
7961        self.subscriptions = v.into_iter().map(|i| i.into()).collect();
7962        self
7963    }
7964
7965    /// Sets the value of [next_page_token][crate::model::ListSubscriptionsResponse::next_page_token].
7966    ///
7967    /// # Example
7968    /// ```ignore,no_run
7969    /// # use google_cloud_pubsub::model::ListSubscriptionsResponse;
7970    /// let x = ListSubscriptionsResponse::new().set_next_page_token("example");
7971    /// ```
7972    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7973        self.next_page_token = v.into();
7974        self
7975    }
7976}
7977
7978impl wkt::message::Message for ListSubscriptionsResponse {
7979    fn typename() -> &'static str {
7980        "type.googleapis.com/google.pubsub.v1.ListSubscriptionsResponse"
7981    }
7982}
7983
7984#[doc(hidden)]
7985impl google_cloud_gax::paginator::internal::PageableResponse for ListSubscriptionsResponse {
7986    type PageItem = crate::model::Subscription;
7987
7988    fn items(self) -> std::vec::Vec<Self::PageItem> {
7989        self.subscriptions
7990    }
7991
7992    fn next_page_token(&self) -> std::string::String {
7993        use std::clone::Clone;
7994        self.next_page_token.clone()
7995    }
7996}
7997
7998/// Request for the DeleteSubscription method.
7999#[derive(Clone, Default, PartialEq)]
8000#[non_exhaustive]
8001pub struct DeleteSubscriptionRequest {
8002    /// Required. The subscription to delete.
8003    /// Format is `projects/{project}/subscriptions/{sub}`.
8004    pub subscription: std::string::String,
8005
8006    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8007}
8008
8009impl DeleteSubscriptionRequest {
8010    /// Creates a new default instance.
8011    pub fn new() -> Self {
8012        std::default::Default::default()
8013    }
8014
8015    /// Sets the value of [subscription][crate::model::DeleteSubscriptionRequest::subscription].
8016    ///
8017    /// # Example
8018    /// ```ignore,no_run
8019    /// # use google_cloud_pubsub::model::DeleteSubscriptionRequest;
8020    /// # let project_id = "project_id";
8021    /// # let subscription_id = "subscription_id";
8022    /// let x = DeleteSubscriptionRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
8023    /// ```
8024    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8025        self.subscription = v.into();
8026        self
8027    }
8028}
8029
8030impl wkt::message::Message for DeleteSubscriptionRequest {
8031    fn typename() -> &'static str {
8032        "type.googleapis.com/google.pubsub.v1.DeleteSubscriptionRequest"
8033    }
8034}
8035
8036/// Request for the ModifyPushConfig method.
8037#[derive(Clone, Default, PartialEq)]
8038#[non_exhaustive]
8039pub struct ModifyPushConfigRequest {
8040    /// Required. The name of the subscription.
8041    /// Format is `projects/{project}/subscriptions/{sub}`.
8042    pub subscription: std::string::String,
8043
8044    /// Required. The push configuration for future deliveries.
8045    ///
8046    /// An empty `pushConfig` indicates that the Pub/Sub system should
8047    /// stop pushing messages from the given subscription and allow
8048    /// messages to be pulled and acknowledged - effectively pausing
8049    /// the subscription if `Pull` or `StreamingPull` is not called.
8050    pub push_config: std::option::Option<crate::model::PushConfig>,
8051
8052    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8053}
8054
8055impl ModifyPushConfigRequest {
8056    /// Creates a new default instance.
8057    pub fn new() -> Self {
8058        std::default::Default::default()
8059    }
8060
8061    /// Sets the value of [subscription][crate::model::ModifyPushConfigRequest::subscription].
8062    ///
8063    /// # Example
8064    /// ```ignore,no_run
8065    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
8066    /// # let project_id = "project_id";
8067    /// # let subscription_id = "subscription_id";
8068    /// let x = ModifyPushConfigRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
8069    /// ```
8070    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8071        self.subscription = v.into();
8072        self
8073    }
8074
8075    /// Sets the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
8076    ///
8077    /// # Example
8078    /// ```ignore,no_run
8079    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
8080    /// use google_cloud_pubsub::model::PushConfig;
8081    /// let x = ModifyPushConfigRequest::new().set_push_config(PushConfig::default()/* use setters */);
8082    /// ```
8083    pub fn set_push_config<T>(mut self, v: T) -> Self
8084    where
8085        T: std::convert::Into<crate::model::PushConfig>,
8086    {
8087        self.push_config = std::option::Option::Some(v.into());
8088        self
8089    }
8090
8091    /// Sets or clears the value of [push_config][crate::model::ModifyPushConfigRequest::push_config].
8092    ///
8093    /// # Example
8094    /// ```ignore,no_run
8095    /// # use google_cloud_pubsub::model::ModifyPushConfigRequest;
8096    /// use google_cloud_pubsub::model::PushConfig;
8097    /// let x = ModifyPushConfigRequest::new().set_or_clear_push_config(Some(PushConfig::default()/* use setters */));
8098    /// let x = ModifyPushConfigRequest::new().set_or_clear_push_config(None::<PushConfig>);
8099    /// ```
8100    pub fn set_or_clear_push_config<T>(mut self, v: std::option::Option<T>) -> Self
8101    where
8102        T: std::convert::Into<crate::model::PushConfig>,
8103    {
8104        self.push_config = v.map(|x| x.into());
8105        self
8106    }
8107}
8108
8109impl wkt::message::Message for ModifyPushConfigRequest {
8110    fn typename() -> &'static str {
8111        "type.googleapis.com/google.pubsub.v1.ModifyPushConfigRequest"
8112    }
8113}
8114
8115/// Request for the `CreateSnapshot` method.
8116#[derive(Clone, Default, PartialEq)]
8117#[non_exhaustive]
8118pub struct CreateSnapshotRequest {
8119    /// Required. User-provided name for this snapshot. If the name is not provided
8120    /// in the request, the server will assign a random name for this snapshot on
8121    /// the same project as the subscription. Note that for REST API requests, you
8122    /// must specify a name.  See the [resource name
8123    /// rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
8124    /// Format is `projects/{project}/snapshots/{snap}`.
8125    pub name: std::string::String,
8126
8127    /// Required. The subscription whose backlog the snapshot retains.
8128    /// Specifically, the created snapshot is guaranteed to retain:
8129    /// (a) The existing backlog on the subscription. More precisely, this is
8130    /// defined as the messages in the subscription's backlog that are
8131    /// unacknowledged upon the successful completion of the
8132    /// `CreateSnapshot` request; as well as:
8133    /// (b) Any messages published to the subscription's topic following the
8134    /// successful completion of the CreateSnapshot request.
8135    /// Format is `projects/{project}/subscriptions/{sub}`.
8136    pub subscription: std::string::String,
8137
8138    /// Optional. See [Creating and managing
8139    /// labels](https://cloud.google.com/pubsub/docs/labels).
8140    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8141
8142    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
8143    /// resource. For example:
8144    /// "123/environment": "production",
8145    /// "123/costCenter": "marketing"
8146    /// See
8147    /// https://{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
8148    /// for more information on using tags with Pub/Sub resources.
8149    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
8150
8151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8152}
8153
8154impl CreateSnapshotRequest {
8155    /// Creates a new default instance.
8156    pub fn new() -> Self {
8157        std::default::Default::default()
8158    }
8159
8160    /// Sets the value of [name][crate::model::CreateSnapshotRequest::name].
8161    ///
8162    /// # Example
8163    /// ```ignore,no_run
8164    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
8165    /// # let project_id = "project_id";
8166    /// # let snapshot_id = "snapshot_id";
8167    /// let x = CreateSnapshotRequest::new().set_name(format!("projects/{project_id}/snapshots/{snapshot_id}"));
8168    /// ```
8169    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8170        self.name = v.into();
8171        self
8172    }
8173
8174    /// Sets the value of [subscription][crate::model::CreateSnapshotRequest::subscription].
8175    ///
8176    /// # Example
8177    /// ```ignore,no_run
8178    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
8179    /// # let project_id = "project_id";
8180    /// # let subscription_id = "subscription_id";
8181    /// let x = CreateSnapshotRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
8182    /// ```
8183    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8184        self.subscription = v.into();
8185        self
8186    }
8187
8188    /// Sets the value of [labels][crate::model::CreateSnapshotRequest::labels].
8189    ///
8190    /// # Example
8191    /// ```ignore,no_run
8192    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
8193    /// let x = CreateSnapshotRequest::new().set_labels([
8194    ///     ("key0", "abc"),
8195    ///     ("key1", "xyz"),
8196    /// ]);
8197    /// ```
8198    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8199    where
8200        T: std::iter::IntoIterator<Item = (K, V)>,
8201        K: std::convert::Into<std::string::String>,
8202        V: std::convert::Into<std::string::String>,
8203    {
8204        use std::iter::Iterator;
8205        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8206        self
8207    }
8208
8209    /// Sets the value of [tags][crate::model::CreateSnapshotRequest::tags].
8210    ///
8211    /// # Example
8212    /// ```ignore,no_run
8213    /// # use google_cloud_pubsub::model::CreateSnapshotRequest;
8214    /// let x = CreateSnapshotRequest::new().set_tags([
8215    ///     ("key0", "abc"),
8216    ///     ("key1", "xyz"),
8217    /// ]);
8218    /// ```
8219    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
8220    where
8221        T: std::iter::IntoIterator<Item = (K, V)>,
8222        K: std::convert::Into<std::string::String>,
8223        V: std::convert::Into<std::string::String>,
8224    {
8225        use std::iter::Iterator;
8226        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8227        self
8228    }
8229}
8230
8231impl wkt::message::Message for CreateSnapshotRequest {
8232    fn typename() -> &'static str {
8233        "type.googleapis.com/google.pubsub.v1.CreateSnapshotRequest"
8234    }
8235}
8236
8237/// Request for the UpdateSnapshot method.
8238#[derive(Clone, Default, PartialEq)]
8239#[non_exhaustive]
8240pub struct UpdateSnapshotRequest {
8241    /// Required. The updated snapshot object.
8242    pub snapshot: std::option::Option<crate::model::Snapshot>,
8243
8244    /// Required. Indicates which fields in the provided snapshot to update.
8245    /// Must be specified and non-empty.
8246    pub update_mask: std::option::Option<wkt::FieldMask>,
8247
8248    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8249}
8250
8251impl UpdateSnapshotRequest {
8252    /// Creates a new default instance.
8253    pub fn new() -> Self {
8254        std::default::Default::default()
8255    }
8256
8257    /// Sets the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
8258    ///
8259    /// # Example
8260    /// ```ignore,no_run
8261    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
8262    /// use google_cloud_pubsub::model::Snapshot;
8263    /// let x = UpdateSnapshotRequest::new().set_snapshot(Snapshot::default()/* use setters */);
8264    /// ```
8265    pub fn set_snapshot<T>(mut self, v: T) -> Self
8266    where
8267        T: std::convert::Into<crate::model::Snapshot>,
8268    {
8269        self.snapshot = std::option::Option::Some(v.into());
8270        self
8271    }
8272
8273    /// Sets or clears the value of [snapshot][crate::model::UpdateSnapshotRequest::snapshot].
8274    ///
8275    /// # Example
8276    /// ```ignore,no_run
8277    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
8278    /// use google_cloud_pubsub::model::Snapshot;
8279    /// let x = UpdateSnapshotRequest::new().set_or_clear_snapshot(Some(Snapshot::default()/* use setters */));
8280    /// let x = UpdateSnapshotRequest::new().set_or_clear_snapshot(None::<Snapshot>);
8281    /// ```
8282    pub fn set_or_clear_snapshot<T>(mut self, v: std::option::Option<T>) -> Self
8283    where
8284        T: std::convert::Into<crate::model::Snapshot>,
8285    {
8286        self.snapshot = v.map(|x| x.into());
8287        self
8288    }
8289
8290    /// Sets the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
8291    ///
8292    /// # Example
8293    /// ```ignore,no_run
8294    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
8295    /// use wkt::FieldMask;
8296    /// let x = UpdateSnapshotRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8297    /// ```
8298    pub fn set_update_mask<T>(mut self, v: T) -> Self
8299    where
8300        T: std::convert::Into<wkt::FieldMask>,
8301    {
8302        self.update_mask = std::option::Option::Some(v.into());
8303        self
8304    }
8305
8306    /// Sets or clears the value of [update_mask][crate::model::UpdateSnapshotRequest::update_mask].
8307    ///
8308    /// # Example
8309    /// ```ignore,no_run
8310    /// # use google_cloud_pubsub::model::UpdateSnapshotRequest;
8311    /// use wkt::FieldMask;
8312    /// let x = UpdateSnapshotRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8313    /// let x = UpdateSnapshotRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8314    /// ```
8315    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8316    where
8317        T: std::convert::Into<wkt::FieldMask>,
8318    {
8319        self.update_mask = v.map(|x| x.into());
8320        self
8321    }
8322}
8323
8324impl wkt::message::Message for UpdateSnapshotRequest {
8325    fn typename() -> &'static str {
8326        "type.googleapis.com/google.pubsub.v1.UpdateSnapshotRequest"
8327    }
8328}
8329
8330/// A snapshot resource. Snapshots are used in
8331/// [Seek](https://cloud.google.com/pubsub/docs/replay-overview)
8332/// operations, which allow you to manage message acknowledgments in bulk. That
8333/// is, you can set the acknowledgment state of messages in an existing
8334/// subscription to the state captured by a snapshot.
8335#[derive(Clone, Default, PartialEq)]
8336#[non_exhaustive]
8337pub struct Snapshot {
8338    /// Optional. The name of the snapshot.
8339    pub name: std::string::String,
8340
8341    /// Optional. The name of the topic from which this snapshot is retaining
8342    /// messages.
8343    pub topic: std::string::String,
8344
8345    /// Optional. The snapshot is guaranteed to exist up until this time.
8346    /// A newly-created snapshot expires no later than 7 days from the time of its
8347    /// creation. Its exact lifetime is determined at creation by the existing
8348    /// backlog in the source subscription. Specifically, the lifetime of the
8349    /// snapshot is `7 days - (age of oldest unacked message in the subscription)`.
8350    /// For example, consider a subscription whose oldest unacked message is 3 days
8351    /// old. If a snapshot is created from this subscription, the snapshot -- which
8352    /// will always capture this 3-day-old backlog as long as the snapshot
8353    /// exists -- will expire in 4 days. The service will refuse to create a
8354    /// snapshot that would expire in less than 1 hour after creation.
8355    pub expire_time: std::option::Option<wkt::Timestamp>,
8356
8357    /// Optional. See [Creating and managing labels]
8358    /// (<https://cloud.google.com/pubsub/docs/labels>).
8359    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
8360
8361    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8362}
8363
8364impl Snapshot {
8365    /// Creates a new default instance.
8366    pub fn new() -> Self {
8367        std::default::Default::default()
8368    }
8369
8370    /// Sets the value of [name][crate::model::Snapshot::name].
8371    ///
8372    /// # Example
8373    /// ```ignore,no_run
8374    /// # use google_cloud_pubsub::model::Snapshot;
8375    /// # let project_id = "project_id";
8376    /// # let snapshot_id = "snapshot_id";
8377    /// let x = Snapshot::new().set_name(format!("projects/{project_id}/snapshots/{snapshot_id}"));
8378    /// ```
8379    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8380        self.name = v.into();
8381        self
8382    }
8383
8384    /// Sets the value of [topic][crate::model::Snapshot::topic].
8385    ///
8386    /// # Example
8387    /// ```ignore,no_run
8388    /// # use google_cloud_pubsub::model::Snapshot;
8389    /// # let project_id = "project_id";
8390    /// # let topic_id = "topic_id";
8391    /// let x = Snapshot::new().set_topic(format!("projects/{project_id}/topics/{topic_id}"));
8392    /// ```
8393    pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8394        self.topic = v.into();
8395        self
8396    }
8397
8398    /// Sets the value of [expire_time][crate::model::Snapshot::expire_time].
8399    ///
8400    /// # Example
8401    /// ```ignore,no_run
8402    /// # use google_cloud_pubsub::model::Snapshot;
8403    /// use wkt::Timestamp;
8404    /// let x = Snapshot::new().set_expire_time(Timestamp::default()/* use setters */);
8405    /// ```
8406    pub fn set_expire_time<T>(mut self, v: T) -> Self
8407    where
8408        T: std::convert::Into<wkt::Timestamp>,
8409    {
8410        self.expire_time = std::option::Option::Some(v.into());
8411        self
8412    }
8413
8414    /// Sets or clears the value of [expire_time][crate::model::Snapshot::expire_time].
8415    ///
8416    /// # Example
8417    /// ```ignore,no_run
8418    /// # use google_cloud_pubsub::model::Snapshot;
8419    /// use wkt::Timestamp;
8420    /// let x = Snapshot::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
8421    /// let x = Snapshot::new().set_or_clear_expire_time(None::<Timestamp>);
8422    /// ```
8423    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8424    where
8425        T: std::convert::Into<wkt::Timestamp>,
8426    {
8427        self.expire_time = v.map(|x| x.into());
8428        self
8429    }
8430
8431    /// Sets the value of [labels][crate::model::Snapshot::labels].
8432    ///
8433    /// # Example
8434    /// ```ignore,no_run
8435    /// # use google_cloud_pubsub::model::Snapshot;
8436    /// let x = Snapshot::new().set_labels([
8437    ///     ("key0", "abc"),
8438    ///     ("key1", "xyz"),
8439    /// ]);
8440    /// ```
8441    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
8442    where
8443        T: std::iter::IntoIterator<Item = (K, V)>,
8444        K: std::convert::Into<std::string::String>,
8445        V: std::convert::Into<std::string::String>,
8446    {
8447        use std::iter::Iterator;
8448        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8449        self
8450    }
8451}
8452
8453impl wkt::message::Message for Snapshot {
8454    fn typename() -> &'static str {
8455        "type.googleapis.com/google.pubsub.v1.Snapshot"
8456    }
8457}
8458
8459/// Request for the GetSnapshot method.
8460#[derive(Clone, Default, PartialEq)]
8461#[non_exhaustive]
8462pub struct GetSnapshotRequest {
8463    /// Required. The name of the snapshot to get.
8464    /// Format is `projects/{project}/snapshots/{snap}`.
8465    pub snapshot: std::string::String,
8466
8467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8468}
8469
8470impl GetSnapshotRequest {
8471    /// Creates a new default instance.
8472    pub fn new() -> Self {
8473        std::default::Default::default()
8474    }
8475
8476    /// Sets the value of [snapshot][crate::model::GetSnapshotRequest::snapshot].
8477    ///
8478    /// # Example
8479    /// ```ignore,no_run
8480    /// # use google_cloud_pubsub::model::GetSnapshotRequest;
8481    /// # let project_id = "project_id";
8482    /// # let snapshot_id = "snapshot_id";
8483    /// let x = GetSnapshotRequest::new().set_snapshot(format!("projects/{project_id}/snapshots/{snapshot_id}"));
8484    /// ```
8485    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8486        self.snapshot = v.into();
8487        self
8488    }
8489}
8490
8491impl wkt::message::Message for GetSnapshotRequest {
8492    fn typename() -> &'static str {
8493        "type.googleapis.com/google.pubsub.v1.GetSnapshotRequest"
8494    }
8495}
8496
8497/// Request for the `ListSnapshots` method.
8498#[derive(Clone, Default, PartialEq)]
8499#[non_exhaustive]
8500pub struct ListSnapshotsRequest {
8501    /// Required. The name of the project in which to list snapshots.
8502    /// Format is `projects/{project-id}`.
8503    pub project: std::string::String,
8504
8505    /// Optional. Maximum number of snapshots to return.
8506    pub page_size: i32,
8507
8508    /// Optional. The value returned by the last `ListSnapshotsResponse`; indicates
8509    /// that this is a continuation of a prior `ListSnapshots` call, and that the
8510    /// system should return the next page of data.
8511    pub page_token: std::string::String,
8512
8513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8514}
8515
8516impl ListSnapshotsRequest {
8517    /// Creates a new default instance.
8518    pub fn new() -> Self {
8519        std::default::Default::default()
8520    }
8521
8522    /// Sets the value of [project][crate::model::ListSnapshotsRequest::project].
8523    ///
8524    /// # Example
8525    /// ```ignore,no_run
8526    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
8527    /// let x = ListSnapshotsRequest::new().set_project("example");
8528    /// ```
8529    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8530        self.project = v.into();
8531        self
8532    }
8533
8534    /// Sets the value of [page_size][crate::model::ListSnapshotsRequest::page_size].
8535    ///
8536    /// # Example
8537    /// ```ignore,no_run
8538    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
8539    /// let x = ListSnapshotsRequest::new().set_page_size(42);
8540    /// ```
8541    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8542        self.page_size = v.into();
8543        self
8544    }
8545
8546    /// Sets the value of [page_token][crate::model::ListSnapshotsRequest::page_token].
8547    ///
8548    /// # Example
8549    /// ```ignore,no_run
8550    /// # use google_cloud_pubsub::model::ListSnapshotsRequest;
8551    /// let x = ListSnapshotsRequest::new().set_page_token("example");
8552    /// ```
8553    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8554        self.page_token = v.into();
8555        self
8556    }
8557}
8558
8559impl wkt::message::Message for ListSnapshotsRequest {
8560    fn typename() -> &'static str {
8561        "type.googleapis.com/google.pubsub.v1.ListSnapshotsRequest"
8562    }
8563}
8564
8565/// Response for the `ListSnapshots` method.
8566#[derive(Clone, Default, PartialEq)]
8567#[non_exhaustive]
8568pub struct ListSnapshotsResponse {
8569    /// Optional. The resulting snapshots.
8570    pub snapshots: std::vec::Vec<crate::model::Snapshot>,
8571
8572    /// Optional. If not empty, indicates that there may be more snapshot that
8573    /// match the request; this value should be passed in a new
8574    /// `ListSnapshotsRequest`.
8575    pub next_page_token: std::string::String,
8576
8577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8578}
8579
8580impl ListSnapshotsResponse {
8581    /// Creates a new default instance.
8582    pub fn new() -> Self {
8583        std::default::Default::default()
8584    }
8585
8586    /// Sets the value of [snapshots][crate::model::ListSnapshotsResponse::snapshots].
8587    ///
8588    /// # Example
8589    /// ```ignore,no_run
8590    /// # use google_cloud_pubsub::model::ListSnapshotsResponse;
8591    /// use google_cloud_pubsub::model::Snapshot;
8592    /// let x = ListSnapshotsResponse::new()
8593    ///     .set_snapshots([
8594    ///         Snapshot::default()/* use setters */,
8595    ///         Snapshot::default()/* use (different) setters */,
8596    ///     ]);
8597    /// ```
8598    pub fn set_snapshots<T, V>(mut self, v: T) -> Self
8599    where
8600        T: std::iter::IntoIterator<Item = V>,
8601        V: std::convert::Into<crate::model::Snapshot>,
8602    {
8603        use std::iter::Iterator;
8604        self.snapshots = v.into_iter().map(|i| i.into()).collect();
8605        self
8606    }
8607
8608    /// Sets the value of [next_page_token][crate::model::ListSnapshotsResponse::next_page_token].
8609    ///
8610    /// # Example
8611    /// ```ignore,no_run
8612    /// # use google_cloud_pubsub::model::ListSnapshotsResponse;
8613    /// let x = ListSnapshotsResponse::new().set_next_page_token("example");
8614    /// ```
8615    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8616        self.next_page_token = v.into();
8617        self
8618    }
8619}
8620
8621impl wkt::message::Message for ListSnapshotsResponse {
8622    fn typename() -> &'static str {
8623        "type.googleapis.com/google.pubsub.v1.ListSnapshotsResponse"
8624    }
8625}
8626
8627#[doc(hidden)]
8628impl google_cloud_gax::paginator::internal::PageableResponse for ListSnapshotsResponse {
8629    type PageItem = crate::model::Snapshot;
8630
8631    fn items(self) -> std::vec::Vec<Self::PageItem> {
8632        self.snapshots
8633    }
8634
8635    fn next_page_token(&self) -> std::string::String {
8636        use std::clone::Clone;
8637        self.next_page_token.clone()
8638    }
8639}
8640
8641/// Request for the `DeleteSnapshot` method.
8642#[derive(Clone, Default, PartialEq)]
8643#[non_exhaustive]
8644pub struct DeleteSnapshotRequest {
8645    /// Required. The name of the snapshot to delete.
8646    /// Format is `projects/{project}/snapshots/{snap}`.
8647    pub snapshot: std::string::String,
8648
8649    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8650}
8651
8652impl DeleteSnapshotRequest {
8653    /// Creates a new default instance.
8654    pub fn new() -> Self {
8655        std::default::Default::default()
8656    }
8657
8658    /// Sets the value of [snapshot][crate::model::DeleteSnapshotRequest::snapshot].
8659    ///
8660    /// # Example
8661    /// ```ignore,no_run
8662    /// # use google_cloud_pubsub::model::DeleteSnapshotRequest;
8663    /// # let project_id = "project_id";
8664    /// # let snapshot_id = "snapshot_id";
8665    /// let x = DeleteSnapshotRequest::new().set_snapshot(format!("projects/{project_id}/snapshots/{snapshot_id}"));
8666    /// ```
8667    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8668        self.snapshot = v.into();
8669        self
8670    }
8671}
8672
8673impl wkt::message::Message for DeleteSnapshotRequest {
8674    fn typename() -> &'static str {
8675        "type.googleapis.com/google.pubsub.v1.DeleteSnapshotRequest"
8676    }
8677}
8678
8679/// Request for the `Seek` method.
8680#[derive(Clone, Default, PartialEq)]
8681#[non_exhaustive]
8682pub struct SeekRequest {
8683    /// Required. The subscription to affect.
8684    pub subscription: std::string::String,
8685
8686    #[allow(missing_docs)]
8687    pub target: std::option::Option<crate::model::seek_request::Target>,
8688
8689    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8690}
8691
8692impl SeekRequest {
8693    /// Creates a new default instance.
8694    pub fn new() -> Self {
8695        std::default::Default::default()
8696    }
8697
8698    /// Sets the value of [subscription][crate::model::SeekRequest::subscription].
8699    ///
8700    /// # Example
8701    /// ```ignore,no_run
8702    /// # use google_cloud_pubsub::model::SeekRequest;
8703    /// # let project_id = "project_id";
8704    /// # let subscription_id = "subscription_id";
8705    /// let x = SeekRequest::new().set_subscription(format!("projects/{project_id}/subscriptions/{subscription_id}"));
8706    /// ```
8707    pub fn set_subscription<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8708        self.subscription = v.into();
8709        self
8710    }
8711
8712    /// Sets the value of [target][crate::model::SeekRequest::target].
8713    ///
8714    /// Note that all the setters affecting `target` are mutually
8715    /// exclusive.
8716    ///
8717    /// # Example
8718    /// ```ignore,no_run
8719    /// # use google_cloud_pubsub::model::SeekRequest;
8720    /// use google_cloud_pubsub::model::seek_request::Target;
8721    /// let x = SeekRequest::new().set_target(Some(Target::Snapshot("example".to_string())));
8722    /// ```
8723    pub fn set_target<
8724        T: std::convert::Into<std::option::Option<crate::model::seek_request::Target>>,
8725    >(
8726        mut self,
8727        v: T,
8728    ) -> Self {
8729        self.target = v.into();
8730        self
8731    }
8732
8733    /// The value of [target][crate::model::SeekRequest::target]
8734    /// if it holds a `Time`, `None` if the field is not set or
8735    /// holds a different branch.
8736    pub fn time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
8737        #[allow(unreachable_patterns)]
8738        self.target.as_ref().and_then(|v| match v {
8739            crate::model::seek_request::Target::Time(v) => std::option::Option::Some(v),
8740            _ => std::option::Option::None,
8741        })
8742    }
8743
8744    /// Sets the value of [target][crate::model::SeekRequest::target]
8745    /// to hold a `Time`.
8746    ///
8747    /// Note that all the setters affecting `target` are
8748    /// mutually exclusive.
8749    ///
8750    /// # Example
8751    /// ```ignore,no_run
8752    /// # use google_cloud_pubsub::model::SeekRequest;
8753    /// use wkt::Timestamp;
8754    /// let x = SeekRequest::new().set_time(Timestamp::default()/* use setters */);
8755    /// assert!(x.time().is_some());
8756    /// assert!(x.snapshot().is_none());
8757    /// ```
8758    pub fn set_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
8759        mut self,
8760        v: T,
8761    ) -> Self {
8762        self.target = std::option::Option::Some(crate::model::seek_request::Target::Time(v.into()));
8763        self
8764    }
8765
8766    /// The value of [target][crate::model::SeekRequest::target]
8767    /// if it holds a `Snapshot`, `None` if the field is not set or
8768    /// holds a different branch.
8769    pub fn snapshot(&self) -> std::option::Option<&std::string::String> {
8770        #[allow(unreachable_patterns)]
8771        self.target.as_ref().and_then(|v| match v {
8772            crate::model::seek_request::Target::Snapshot(v) => std::option::Option::Some(v),
8773            _ => std::option::Option::None,
8774        })
8775    }
8776
8777    /// Sets the value of [target][crate::model::SeekRequest::target]
8778    /// to hold a `Snapshot`.
8779    ///
8780    /// Note that all the setters affecting `target` are
8781    /// mutually exclusive.
8782    ///
8783    /// # Example
8784    /// ```ignore,no_run
8785    /// # use google_cloud_pubsub::model::SeekRequest;
8786    /// # let project_id = "project_id";
8787    /// # let snapshot_id = "snapshot_id";
8788    /// let x = SeekRequest::new().set_snapshot(format!("projects/{project_id}/snapshots/{snapshot_id}"));
8789    /// assert!(x.snapshot().is_some());
8790    /// assert!(x.time().is_none());
8791    /// ```
8792    pub fn set_snapshot<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8793        self.target =
8794            std::option::Option::Some(crate::model::seek_request::Target::Snapshot(v.into()));
8795        self
8796    }
8797}
8798
8799impl wkt::message::Message for SeekRequest {
8800    fn typename() -> &'static str {
8801        "type.googleapis.com/google.pubsub.v1.SeekRequest"
8802    }
8803}
8804
8805/// Defines additional types related to [SeekRequest].
8806pub mod seek_request {
8807    #[allow(unused_imports)]
8808    use super::*;
8809
8810    #[allow(missing_docs)]
8811    #[derive(Clone, Debug, PartialEq)]
8812    #[non_exhaustive]
8813    pub enum Target {
8814        /// Optional. The time to seek to.
8815        /// Messages retained in the subscription that were published before this
8816        /// time are marked as acknowledged, and messages retained in the
8817        /// subscription that were published after this time are marked as
8818        /// unacknowledged. Note that this operation affects only those messages
8819        /// retained in the subscription (configured by the combination of
8820        /// `message_retention_duration` and `retain_acked_messages`). For example,
8821        /// if `time` corresponds to a point before the message retention
8822        /// window (or to a point before the system's notion of the subscription
8823        /// creation time), only retained messages will be marked as unacknowledged,
8824        /// and already-expunged messages will not be restored.
8825        Time(std::boxed::Box<wkt::Timestamp>),
8826        /// Optional. The snapshot to seek to. The snapshot's topic must be the same
8827        /// as that of the provided subscription. Format is
8828        /// `projects/{project}/snapshots/{snap}`.
8829        Snapshot(std::string::String),
8830    }
8831}
8832
8833/// Response for the `Seek` method (this response is empty).
8834#[derive(Clone, Default, PartialEq)]
8835#[non_exhaustive]
8836pub struct SeekResponse {
8837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8838}
8839
8840impl SeekResponse {
8841    /// Creates a new default instance.
8842    pub fn new() -> Self {
8843        std::default::Default::default()
8844    }
8845}
8846
8847impl wkt::message::Message for SeekResponse {
8848    fn typename() -> &'static str {
8849        "type.googleapis.com/google.pubsub.v1.SeekResponse"
8850    }
8851}
8852
8853/// A schema resource.
8854#[derive(Clone, Default, PartialEq)]
8855#[non_exhaustive]
8856pub struct Schema {
8857    /// Required. Name of the schema.
8858    /// Format is `projects/{project}/schemas/{schema}`.
8859    pub name: std::string::String,
8860
8861    /// The type of the schema definition.
8862    pub r#type: crate::model::schema::Type,
8863
8864    /// The definition of the schema. This should contain a string representing
8865    /// the full definition of the schema that is a valid schema definition of
8866    /// the type specified in `type`.
8867    pub definition: std::string::String,
8868
8869    /// Output only. Immutable. The revision ID of the schema.
8870    pub revision_id: std::string::String,
8871
8872    /// Output only. The timestamp that the revision was created.
8873    pub revision_create_time: std::option::Option<wkt::Timestamp>,
8874
8875    /// The configuration of the schema.
8876    /// This field is mutually exclusive with the `definition` field above, meaning
8877    /// either `definition` or one of the fields below can be set in a valid Schema
8878    /// object.
8879    pub configuration: std::option::Option<crate::model::schema::Configuration>,
8880
8881    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8882}
8883
8884impl Schema {
8885    /// Creates a new default instance.
8886    pub fn new() -> Self {
8887        std::default::Default::default()
8888    }
8889
8890    /// Sets the value of [name][crate::model::Schema::name].
8891    ///
8892    /// # Example
8893    /// ```ignore,no_run
8894    /// # use google_cloud_pubsub::model::Schema;
8895    /// # let project_id = "project_id";
8896    /// # let schema_id = "schema_id";
8897    /// let x = Schema::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
8898    /// ```
8899    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8900        self.name = v.into();
8901        self
8902    }
8903
8904    /// Sets the value of [r#type][crate::model::Schema::type].
8905    ///
8906    /// # Example
8907    /// ```ignore,no_run
8908    /// # use google_cloud_pubsub::model::Schema;
8909    /// use google_cloud_pubsub::model::schema::Type;
8910    /// let x0 = Schema::new().set_type(Type::ProtocolBuffer);
8911    /// let x1 = Schema::new().set_type(Type::Avro);
8912    /// ```
8913    pub fn set_type<T: std::convert::Into<crate::model::schema::Type>>(mut self, v: T) -> Self {
8914        self.r#type = v.into();
8915        self
8916    }
8917
8918    /// Sets the value of [definition][crate::model::Schema::definition].
8919    ///
8920    /// # Example
8921    /// ```ignore,no_run
8922    /// # use google_cloud_pubsub::model::Schema;
8923    /// let x = Schema::new().set_definition("example");
8924    /// ```
8925    pub fn set_definition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8926        self.definition = v.into();
8927        self
8928    }
8929
8930    /// Sets the value of [revision_id][crate::model::Schema::revision_id].
8931    ///
8932    /// # Example
8933    /// ```ignore,no_run
8934    /// # use google_cloud_pubsub::model::Schema;
8935    /// let x = Schema::new().set_revision_id("example");
8936    /// ```
8937    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8938        self.revision_id = v.into();
8939        self
8940    }
8941
8942    /// Sets the value of [revision_create_time][crate::model::Schema::revision_create_time].
8943    ///
8944    /// # Example
8945    /// ```ignore,no_run
8946    /// # use google_cloud_pubsub::model::Schema;
8947    /// use wkt::Timestamp;
8948    /// let x = Schema::new().set_revision_create_time(Timestamp::default()/* use setters */);
8949    /// ```
8950    pub fn set_revision_create_time<T>(mut self, v: T) -> Self
8951    where
8952        T: std::convert::Into<wkt::Timestamp>,
8953    {
8954        self.revision_create_time = std::option::Option::Some(v.into());
8955        self
8956    }
8957
8958    /// Sets or clears the value of [revision_create_time][crate::model::Schema::revision_create_time].
8959    ///
8960    /// # Example
8961    /// ```ignore,no_run
8962    /// # use google_cloud_pubsub::model::Schema;
8963    /// use wkt::Timestamp;
8964    /// let x = Schema::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
8965    /// let x = Schema::new().set_or_clear_revision_create_time(None::<Timestamp>);
8966    /// ```
8967    pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8968    where
8969        T: std::convert::Into<wkt::Timestamp>,
8970    {
8971        self.revision_create_time = v.map(|x| x.into());
8972        self
8973    }
8974
8975    /// Sets the value of [configuration][crate::model::Schema::configuration].
8976    ///
8977    /// Note that all the setters affecting `configuration` are mutually
8978    /// exclusive.
8979    ///
8980    /// # Example
8981    /// ```ignore,no_run
8982    /// # use google_cloud_pubsub::model::Schema;
8983    /// use google_cloud_pubsub::model::CompiledProtoSchema;
8984    /// let x = Schema::new().set_configuration(Some(
8985    ///     google_cloud_pubsub::model::schema::Configuration::CompiledProtoSchema(CompiledProtoSchema::default().into())));
8986    /// ```
8987    pub fn set_configuration<
8988        T: std::convert::Into<std::option::Option<crate::model::schema::Configuration>>,
8989    >(
8990        mut self,
8991        v: T,
8992    ) -> Self {
8993        self.configuration = v.into();
8994        self
8995    }
8996
8997    /// The value of [configuration][crate::model::Schema::configuration]
8998    /// if it holds a `CompiledProtoSchema`, `None` if the field is not set or
8999    /// holds a different branch.
9000    pub fn compiled_proto_schema(
9001        &self,
9002    ) -> std::option::Option<&std::boxed::Box<crate::model::CompiledProtoSchema>> {
9003        #[allow(unreachable_patterns)]
9004        self.configuration.as_ref().and_then(|v| match v {
9005            crate::model::schema::Configuration::CompiledProtoSchema(v) => {
9006                std::option::Option::Some(v)
9007            }
9008            _ => std::option::Option::None,
9009        })
9010    }
9011
9012    /// Sets the value of [configuration][crate::model::Schema::configuration]
9013    /// to hold a `CompiledProtoSchema`.
9014    ///
9015    /// Note that all the setters affecting `configuration` are
9016    /// mutually exclusive.
9017    ///
9018    /// # Example
9019    /// ```ignore,no_run
9020    /// # use google_cloud_pubsub::model::Schema;
9021    /// use google_cloud_pubsub::model::CompiledProtoSchema;
9022    /// let x = Schema::new().set_compiled_proto_schema(CompiledProtoSchema::default()/* use setters */);
9023    /// assert!(x.compiled_proto_schema().is_some());
9024    /// ```
9025    pub fn set_compiled_proto_schema<
9026        T: std::convert::Into<std::boxed::Box<crate::model::CompiledProtoSchema>>,
9027    >(
9028        mut self,
9029        v: T,
9030    ) -> Self {
9031        self.configuration = std::option::Option::Some(
9032            crate::model::schema::Configuration::CompiledProtoSchema(v.into()),
9033        );
9034        self
9035    }
9036}
9037
9038impl wkt::message::Message for Schema {
9039    fn typename() -> &'static str {
9040        "type.googleapis.com/google.pubsub.v1.Schema"
9041    }
9042}
9043
9044/// Defines additional types related to [Schema].
9045pub mod schema {
9046    #[allow(unused_imports)]
9047    use super::*;
9048
9049    /// Possible schema definition types.
9050    ///
9051    /// # Working with unknown values
9052    ///
9053    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9054    /// additional enum variants at any time. Adding new variants is not considered
9055    /// a breaking change. Applications should write their code in anticipation of:
9056    ///
9057    /// - New values appearing in future releases of the client library, **and**
9058    /// - New values received dynamically, without application changes.
9059    ///
9060    /// Please consult the [Working with enums] section in the user guide for some
9061    /// guidelines.
9062    ///
9063    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9064    #[derive(Clone, Debug, PartialEq)]
9065    #[non_exhaustive]
9066    pub enum Type {
9067        /// Default value. This value is unused.
9068        Unspecified,
9069        /// A Protocol Buffer schema definition.
9070        ProtocolBuffer,
9071        /// An Avro schema definition.
9072        Avro,
9073        /// If set, the enum was initialized with an unknown value.
9074        ///
9075        /// Applications can examine the value using [Type::value] or
9076        /// [Type::name].
9077        UnknownValue(r#type::UnknownValue),
9078    }
9079
9080    #[doc(hidden)]
9081    pub mod r#type {
9082        #[allow(unused_imports)]
9083        use super::*;
9084        #[derive(Clone, Debug, PartialEq)]
9085        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9086    }
9087
9088    impl Type {
9089        /// Gets the enum value.
9090        ///
9091        /// Returns `None` if the enum contains an unknown value deserialized from
9092        /// the string representation of enums.
9093        pub fn value(&self) -> std::option::Option<i32> {
9094            match self {
9095                Self::Unspecified => std::option::Option::Some(0),
9096                Self::ProtocolBuffer => std::option::Option::Some(1),
9097                Self::Avro => std::option::Option::Some(2),
9098                Self::UnknownValue(u) => u.0.value(),
9099            }
9100        }
9101
9102        /// Gets the enum value as a string.
9103        ///
9104        /// Returns `None` if the enum contains an unknown value deserialized from
9105        /// the integer representation of enums.
9106        pub fn name(&self) -> std::option::Option<&str> {
9107            match self {
9108                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
9109                Self::ProtocolBuffer => std::option::Option::Some("PROTOCOL_BUFFER"),
9110                Self::Avro => std::option::Option::Some("AVRO"),
9111                Self::UnknownValue(u) => u.0.name(),
9112            }
9113        }
9114    }
9115
9116    impl std::default::Default for Type {
9117        fn default() -> Self {
9118            use std::convert::From;
9119            Self::from(0)
9120        }
9121    }
9122
9123    impl std::fmt::Display for Type {
9124        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9125            wkt::internal::display_enum(f, self.name(), self.value())
9126        }
9127    }
9128
9129    impl std::convert::From<i32> for Type {
9130        fn from(value: i32) -> Self {
9131            match value {
9132                0 => Self::Unspecified,
9133                1 => Self::ProtocolBuffer,
9134                2 => Self::Avro,
9135                _ => Self::UnknownValue(r#type::UnknownValue(
9136                    wkt::internal::UnknownEnumValue::Integer(value),
9137                )),
9138            }
9139        }
9140    }
9141
9142    impl std::convert::From<&str> for Type {
9143        fn from(value: &str) -> Self {
9144            use std::string::ToString;
9145            match value {
9146                "TYPE_UNSPECIFIED" => Self::Unspecified,
9147                "PROTOCOL_BUFFER" => Self::ProtocolBuffer,
9148                "AVRO" => Self::Avro,
9149                _ => Self::UnknownValue(r#type::UnknownValue(
9150                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9151                )),
9152            }
9153        }
9154    }
9155
9156    impl serde::ser::Serialize for Type {
9157        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9158        where
9159            S: serde::Serializer,
9160        {
9161            match self {
9162                Self::Unspecified => serializer.serialize_i32(0),
9163                Self::ProtocolBuffer => serializer.serialize_i32(1),
9164                Self::Avro => serializer.serialize_i32(2),
9165                Self::UnknownValue(u) => u.0.serialize(serializer),
9166            }
9167        }
9168    }
9169
9170    impl<'de> serde::de::Deserialize<'de> for Type {
9171        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9172        where
9173            D: serde::Deserializer<'de>,
9174        {
9175            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
9176                ".google.pubsub.v1.Schema.Type",
9177            ))
9178        }
9179    }
9180
9181    /// The configuration of the schema.
9182    /// This field is mutually exclusive with the `definition` field above, meaning
9183    /// either `definition` or one of the fields below can be set in a valid Schema
9184    /// object.
9185    #[derive(Clone, Debug, PartialEq)]
9186    #[non_exhaustive]
9187    pub enum Configuration {
9188        /// Optional. Configuration for a schema provided as a pre-compiled Protocol
9189        /// Buffer FileDescriptorSet. The `type` field above must be set to
9190        /// PROTOCOL_BUFFER.
9191        CompiledProtoSchema(std::boxed::Box<crate::model::CompiledProtoSchema>),
9192    }
9193}
9194
9195/// Request for the CreateSchema method.
9196#[derive(Clone, Default, PartialEq)]
9197#[non_exhaustive]
9198pub struct CreateSchemaRequest {
9199    /// Required. The name of the project in which to create the schema.
9200    /// Format is `projects/{project-id}`.
9201    pub parent: std::string::String,
9202
9203    /// Required. The schema object to create.
9204    ///
9205    /// This schema's `name` parameter is ignored. The schema object returned
9206    /// by CreateSchema will have a `name` made using the given `parent` and
9207    /// `schema_id`.
9208    pub schema: std::option::Option<crate::model::Schema>,
9209
9210    /// The ID to use for the schema, which will become the final component of
9211    /// the schema's resource name.
9212    ///
9213    /// See <https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names> for
9214    /// resource name constraints.
9215    pub schema_id: std::string::String,
9216
9217    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9218}
9219
9220impl CreateSchemaRequest {
9221    /// Creates a new default instance.
9222    pub fn new() -> Self {
9223        std::default::Default::default()
9224    }
9225
9226    /// Sets the value of [parent][crate::model::CreateSchemaRequest::parent].
9227    ///
9228    /// # Example
9229    /// ```ignore,no_run
9230    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
9231    /// # let project_id = "project_id";
9232    /// let x = CreateSchemaRequest::new().set_parent(format!("projects/{project_id}"));
9233    /// ```
9234    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9235        self.parent = v.into();
9236        self
9237    }
9238
9239    /// Sets the value of [schema][crate::model::CreateSchemaRequest::schema].
9240    ///
9241    /// # Example
9242    /// ```ignore,no_run
9243    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
9244    /// use google_cloud_pubsub::model::Schema;
9245    /// let x = CreateSchemaRequest::new().set_schema(Schema::default()/* use setters */);
9246    /// ```
9247    pub fn set_schema<T>(mut self, v: T) -> Self
9248    where
9249        T: std::convert::Into<crate::model::Schema>,
9250    {
9251        self.schema = std::option::Option::Some(v.into());
9252        self
9253    }
9254
9255    /// Sets or clears the value of [schema][crate::model::CreateSchemaRequest::schema].
9256    ///
9257    /// # Example
9258    /// ```ignore,no_run
9259    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
9260    /// use google_cloud_pubsub::model::Schema;
9261    /// let x = CreateSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
9262    /// let x = CreateSchemaRequest::new().set_or_clear_schema(None::<Schema>);
9263    /// ```
9264    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
9265    where
9266        T: std::convert::Into<crate::model::Schema>,
9267    {
9268        self.schema = v.map(|x| x.into());
9269        self
9270    }
9271
9272    /// Sets the value of [schema_id][crate::model::CreateSchemaRequest::schema_id].
9273    ///
9274    /// # Example
9275    /// ```ignore,no_run
9276    /// # use google_cloud_pubsub::model::CreateSchemaRequest;
9277    /// let x = CreateSchemaRequest::new().set_schema_id("example");
9278    /// ```
9279    pub fn set_schema_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9280        self.schema_id = v.into();
9281        self
9282    }
9283}
9284
9285impl wkt::message::Message for CreateSchemaRequest {
9286    fn typename() -> &'static str {
9287        "type.googleapis.com/google.pubsub.v1.CreateSchemaRequest"
9288    }
9289}
9290
9291/// Request for the GetSchema method.
9292#[derive(Clone, Default, PartialEq)]
9293#[non_exhaustive]
9294pub struct GetSchemaRequest {
9295    /// Required. The name of the schema to get.
9296    /// Format is `projects/{project}/schemas/{schema}`.
9297    pub name: std::string::String,
9298
9299    /// The set of fields to return in the response. If not set, returns a Schema
9300    /// with all fields filled out. Set to `BASIC` to omit the `definition`.
9301    pub view: crate::model::SchemaView,
9302
9303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9304}
9305
9306impl GetSchemaRequest {
9307    /// Creates a new default instance.
9308    pub fn new() -> Self {
9309        std::default::Default::default()
9310    }
9311
9312    /// Sets the value of [name][crate::model::GetSchemaRequest::name].
9313    ///
9314    /// # Example
9315    /// ```ignore,no_run
9316    /// # use google_cloud_pubsub::model::GetSchemaRequest;
9317    /// # let project_id = "project_id";
9318    /// # let schema_id = "schema_id";
9319    /// let x = GetSchemaRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9320    /// ```
9321    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9322        self.name = v.into();
9323        self
9324    }
9325
9326    /// Sets the value of [view][crate::model::GetSchemaRequest::view].
9327    ///
9328    /// # Example
9329    /// ```ignore,no_run
9330    /// # use google_cloud_pubsub::model::GetSchemaRequest;
9331    /// use google_cloud_pubsub::model::SchemaView;
9332    /// let x0 = GetSchemaRequest::new().set_view(SchemaView::Basic);
9333    /// let x1 = GetSchemaRequest::new().set_view(SchemaView::Full);
9334    /// ```
9335    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
9336        self.view = v.into();
9337        self
9338    }
9339}
9340
9341impl wkt::message::Message for GetSchemaRequest {
9342    fn typename() -> &'static str {
9343        "type.googleapis.com/google.pubsub.v1.GetSchemaRequest"
9344    }
9345}
9346
9347/// Request for the `ListSchemas` method.
9348#[derive(Clone, Default, PartialEq)]
9349#[non_exhaustive]
9350pub struct ListSchemasRequest {
9351    /// Required. The name of the project in which to list schemas.
9352    /// Format is `projects/{project-id}`.
9353    pub parent: std::string::String,
9354
9355    /// The set of Schema fields to return in the response. If not set, returns
9356    /// Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
9357    /// retrieve all fields.
9358    pub view: crate::model::SchemaView,
9359
9360    /// Maximum number of schemas to return.
9361    pub page_size: i32,
9362
9363    /// The value returned by the last `ListSchemasResponse`; indicates that
9364    /// this is a continuation of a prior `ListSchemas` call, and that the
9365    /// system should return the next page of data.
9366    pub page_token: std::string::String,
9367
9368    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9369}
9370
9371impl ListSchemasRequest {
9372    /// Creates a new default instance.
9373    pub fn new() -> Self {
9374        std::default::Default::default()
9375    }
9376
9377    /// Sets the value of [parent][crate::model::ListSchemasRequest::parent].
9378    ///
9379    /// # Example
9380    /// ```ignore,no_run
9381    /// # use google_cloud_pubsub::model::ListSchemasRequest;
9382    /// let x = ListSchemasRequest::new().set_parent("example");
9383    /// ```
9384    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9385        self.parent = v.into();
9386        self
9387    }
9388
9389    /// Sets the value of [view][crate::model::ListSchemasRequest::view].
9390    ///
9391    /// # Example
9392    /// ```ignore,no_run
9393    /// # use google_cloud_pubsub::model::ListSchemasRequest;
9394    /// use google_cloud_pubsub::model::SchemaView;
9395    /// let x0 = ListSchemasRequest::new().set_view(SchemaView::Basic);
9396    /// let x1 = ListSchemasRequest::new().set_view(SchemaView::Full);
9397    /// ```
9398    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
9399        self.view = v.into();
9400        self
9401    }
9402
9403    /// Sets the value of [page_size][crate::model::ListSchemasRequest::page_size].
9404    ///
9405    /// # Example
9406    /// ```ignore,no_run
9407    /// # use google_cloud_pubsub::model::ListSchemasRequest;
9408    /// let x = ListSchemasRequest::new().set_page_size(42);
9409    /// ```
9410    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9411        self.page_size = v.into();
9412        self
9413    }
9414
9415    /// Sets the value of [page_token][crate::model::ListSchemasRequest::page_token].
9416    ///
9417    /// # Example
9418    /// ```ignore,no_run
9419    /// # use google_cloud_pubsub::model::ListSchemasRequest;
9420    /// let x = ListSchemasRequest::new().set_page_token("example");
9421    /// ```
9422    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9423        self.page_token = v.into();
9424        self
9425    }
9426}
9427
9428impl wkt::message::Message for ListSchemasRequest {
9429    fn typename() -> &'static str {
9430        "type.googleapis.com/google.pubsub.v1.ListSchemasRequest"
9431    }
9432}
9433
9434/// Response for the `ListSchemas` method.
9435#[derive(Clone, Default, PartialEq)]
9436#[non_exhaustive]
9437pub struct ListSchemasResponse {
9438    /// The resulting schemas.
9439    pub schemas: std::vec::Vec<crate::model::Schema>,
9440
9441    /// If not empty, indicates that there may be more schemas that match the
9442    /// request; this value should be passed in a new `ListSchemasRequest`.
9443    pub next_page_token: std::string::String,
9444
9445    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9446}
9447
9448impl ListSchemasResponse {
9449    /// Creates a new default instance.
9450    pub fn new() -> Self {
9451        std::default::Default::default()
9452    }
9453
9454    /// Sets the value of [schemas][crate::model::ListSchemasResponse::schemas].
9455    ///
9456    /// # Example
9457    /// ```ignore,no_run
9458    /// # use google_cloud_pubsub::model::ListSchemasResponse;
9459    /// use google_cloud_pubsub::model::Schema;
9460    /// let x = ListSchemasResponse::new()
9461    ///     .set_schemas([
9462    ///         Schema::default()/* use setters */,
9463    ///         Schema::default()/* use (different) setters */,
9464    ///     ]);
9465    /// ```
9466    pub fn set_schemas<T, V>(mut self, v: T) -> Self
9467    where
9468        T: std::iter::IntoIterator<Item = V>,
9469        V: std::convert::Into<crate::model::Schema>,
9470    {
9471        use std::iter::Iterator;
9472        self.schemas = v.into_iter().map(|i| i.into()).collect();
9473        self
9474    }
9475
9476    /// Sets the value of [next_page_token][crate::model::ListSchemasResponse::next_page_token].
9477    ///
9478    /// # Example
9479    /// ```ignore,no_run
9480    /// # use google_cloud_pubsub::model::ListSchemasResponse;
9481    /// let x = ListSchemasResponse::new().set_next_page_token("example");
9482    /// ```
9483    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9484        self.next_page_token = v.into();
9485        self
9486    }
9487}
9488
9489impl wkt::message::Message for ListSchemasResponse {
9490    fn typename() -> &'static str {
9491        "type.googleapis.com/google.pubsub.v1.ListSchemasResponse"
9492    }
9493}
9494
9495#[doc(hidden)]
9496impl google_cloud_gax::paginator::internal::PageableResponse for ListSchemasResponse {
9497    type PageItem = crate::model::Schema;
9498
9499    fn items(self) -> std::vec::Vec<Self::PageItem> {
9500        self.schemas
9501    }
9502
9503    fn next_page_token(&self) -> std::string::String {
9504        use std::clone::Clone;
9505        self.next_page_token.clone()
9506    }
9507}
9508
9509/// Request for the `ListSchemaRevisions` method.
9510#[derive(Clone, Default, PartialEq)]
9511#[non_exhaustive]
9512pub struct ListSchemaRevisionsRequest {
9513    /// Required. The name of the schema to list revisions for.
9514    pub name: std::string::String,
9515
9516    /// The set of Schema fields to return in the response. If not set, returns
9517    /// Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
9518    /// retrieve all fields.
9519    pub view: crate::model::SchemaView,
9520
9521    /// The maximum number of revisions to return per page.
9522    pub page_size: i32,
9523
9524    /// The page token, received from a previous ListSchemaRevisions call.
9525    /// Provide this to retrieve the subsequent page.
9526    pub page_token: std::string::String,
9527
9528    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9529}
9530
9531impl ListSchemaRevisionsRequest {
9532    /// Creates a new default instance.
9533    pub fn new() -> Self {
9534        std::default::Default::default()
9535    }
9536
9537    /// Sets the value of [name][crate::model::ListSchemaRevisionsRequest::name].
9538    ///
9539    /// # Example
9540    /// ```ignore,no_run
9541    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
9542    /// # let project_id = "project_id";
9543    /// # let schema_id = "schema_id";
9544    /// let x = ListSchemaRevisionsRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9545    /// ```
9546    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9547        self.name = v.into();
9548        self
9549    }
9550
9551    /// Sets the value of [view][crate::model::ListSchemaRevisionsRequest::view].
9552    ///
9553    /// # Example
9554    /// ```ignore,no_run
9555    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
9556    /// use google_cloud_pubsub::model::SchemaView;
9557    /// let x0 = ListSchemaRevisionsRequest::new().set_view(SchemaView::Basic);
9558    /// let x1 = ListSchemaRevisionsRequest::new().set_view(SchemaView::Full);
9559    /// ```
9560    pub fn set_view<T: std::convert::Into<crate::model::SchemaView>>(mut self, v: T) -> Self {
9561        self.view = v.into();
9562        self
9563    }
9564
9565    /// Sets the value of [page_size][crate::model::ListSchemaRevisionsRequest::page_size].
9566    ///
9567    /// # Example
9568    /// ```ignore,no_run
9569    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
9570    /// let x = ListSchemaRevisionsRequest::new().set_page_size(42);
9571    /// ```
9572    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9573        self.page_size = v.into();
9574        self
9575    }
9576
9577    /// Sets the value of [page_token][crate::model::ListSchemaRevisionsRequest::page_token].
9578    ///
9579    /// # Example
9580    /// ```ignore,no_run
9581    /// # use google_cloud_pubsub::model::ListSchemaRevisionsRequest;
9582    /// let x = ListSchemaRevisionsRequest::new().set_page_token("example");
9583    /// ```
9584    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9585        self.page_token = v.into();
9586        self
9587    }
9588}
9589
9590impl wkt::message::Message for ListSchemaRevisionsRequest {
9591    fn typename() -> &'static str {
9592        "type.googleapis.com/google.pubsub.v1.ListSchemaRevisionsRequest"
9593    }
9594}
9595
9596/// Response for the `ListSchemaRevisions` method.
9597#[derive(Clone, Default, PartialEq)]
9598#[non_exhaustive]
9599pub struct ListSchemaRevisionsResponse {
9600    /// The revisions of the schema.
9601    pub schemas: std::vec::Vec<crate::model::Schema>,
9602
9603    /// A token that can be sent as `page_token` to retrieve the next page.
9604    /// If this field is empty, there are no subsequent pages.
9605    pub next_page_token: std::string::String,
9606
9607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9608}
9609
9610impl ListSchemaRevisionsResponse {
9611    /// Creates a new default instance.
9612    pub fn new() -> Self {
9613        std::default::Default::default()
9614    }
9615
9616    /// Sets the value of [schemas][crate::model::ListSchemaRevisionsResponse::schemas].
9617    ///
9618    /// # Example
9619    /// ```ignore,no_run
9620    /// # use google_cloud_pubsub::model::ListSchemaRevisionsResponse;
9621    /// use google_cloud_pubsub::model::Schema;
9622    /// let x = ListSchemaRevisionsResponse::new()
9623    ///     .set_schemas([
9624    ///         Schema::default()/* use setters */,
9625    ///         Schema::default()/* use (different) setters */,
9626    ///     ]);
9627    /// ```
9628    pub fn set_schemas<T, V>(mut self, v: T) -> Self
9629    where
9630        T: std::iter::IntoIterator<Item = V>,
9631        V: std::convert::Into<crate::model::Schema>,
9632    {
9633        use std::iter::Iterator;
9634        self.schemas = v.into_iter().map(|i| i.into()).collect();
9635        self
9636    }
9637
9638    /// Sets the value of [next_page_token][crate::model::ListSchemaRevisionsResponse::next_page_token].
9639    ///
9640    /// # Example
9641    /// ```ignore,no_run
9642    /// # use google_cloud_pubsub::model::ListSchemaRevisionsResponse;
9643    /// let x = ListSchemaRevisionsResponse::new().set_next_page_token("example");
9644    /// ```
9645    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9646        self.next_page_token = v.into();
9647        self
9648    }
9649}
9650
9651impl wkt::message::Message for ListSchemaRevisionsResponse {
9652    fn typename() -> &'static str {
9653        "type.googleapis.com/google.pubsub.v1.ListSchemaRevisionsResponse"
9654    }
9655}
9656
9657#[doc(hidden)]
9658impl google_cloud_gax::paginator::internal::PageableResponse for ListSchemaRevisionsResponse {
9659    type PageItem = crate::model::Schema;
9660
9661    fn items(self) -> std::vec::Vec<Self::PageItem> {
9662        self.schemas
9663    }
9664
9665    fn next_page_token(&self) -> std::string::String {
9666        use std::clone::Clone;
9667        self.next_page_token.clone()
9668    }
9669}
9670
9671/// Request for CommitSchema method.
9672#[derive(Clone, Default, PartialEq)]
9673#[non_exhaustive]
9674pub struct CommitSchemaRequest {
9675    /// Required. The name of the schema we are revising.
9676    /// Format is `projects/{project}/schemas/{schema}`.
9677    pub name: std::string::String,
9678
9679    /// Required. The schema revision to commit.
9680    pub schema: std::option::Option<crate::model::Schema>,
9681
9682    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9683}
9684
9685impl CommitSchemaRequest {
9686    /// Creates a new default instance.
9687    pub fn new() -> Self {
9688        std::default::Default::default()
9689    }
9690
9691    /// Sets the value of [name][crate::model::CommitSchemaRequest::name].
9692    ///
9693    /// # Example
9694    /// ```ignore,no_run
9695    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
9696    /// # let project_id = "project_id";
9697    /// # let schema_id = "schema_id";
9698    /// let x = CommitSchemaRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9699    /// ```
9700    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9701        self.name = v.into();
9702        self
9703    }
9704
9705    /// Sets the value of [schema][crate::model::CommitSchemaRequest::schema].
9706    ///
9707    /// # Example
9708    /// ```ignore,no_run
9709    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
9710    /// use google_cloud_pubsub::model::Schema;
9711    /// let x = CommitSchemaRequest::new().set_schema(Schema::default()/* use setters */);
9712    /// ```
9713    pub fn set_schema<T>(mut self, v: T) -> Self
9714    where
9715        T: std::convert::Into<crate::model::Schema>,
9716    {
9717        self.schema = std::option::Option::Some(v.into());
9718        self
9719    }
9720
9721    /// Sets or clears the value of [schema][crate::model::CommitSchemaRequest::schema].
9722    ///
9723    /// # Example
9724    /// ```ignore,no_run
9725    /// # use google_cloud_pubsub::model::CommitSchemaRequest;
9726    /// use google_cloud_pubsub::model::Schema;
9727    /// let x = CommitSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
9728    /// let x = CommitSchemaRequest::new().set_or_clear_schema(None::<Schema>);
9729    /// ```
9730    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
9731    where
9732        T: std::convert::Into<crate::model::Schema>,
9733    {
9734        self.schema = v.map(|x| x.into());
9735        self
9736    }
9737}
9738
9739impl wkt::message::Message for CommitSchemaRequest {
9740    fn typename() -> &'static str {
9741        "type.googleapis.com/google.pubsub.v1.CommitSchemaRequest"
9742    }
9743}
9744
9745/// Request for the `RollbackSchema` method.
9746#[derive(Clone, Default, PartialEq)]
9747#[non_exhaustive]
9748pub struct RollbackSchemaRequest {
9749    /// Required. The schema being rolled back with revision id.
9750    pub name: std::string::String,
9751
9752    /// Required. The revision ID to roll back to.
9753    /// It must be a revision of the same schema.
9754    ///
9755    /// Example: c7cfa2a8
9756    pub revision_id: std::string::String,
9757
9758    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9759}
9760
9761impl RollbackSchemaRequest {
9762    /// Creates a new default instance.
9763    pub fn new() -> Self {
9764        std::default::Default::default()
9765    }
9766
9767    /// Sets the value of [name][crate::model::RollbackSchemaRequest::name].
9768    ///
9769    /// # Example
9770    /// ```ignore,no_run
9771    /// # use google_cloud_pubsub::model::RollbackSchemaRequest;
9772    /// # let project_id = "project_id";
9773    /// # let schema_id = "schema_id";
9774    /// let x = RollbackSchemaRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9775    /// ```
9776    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9777        self.name = v.into();
9778        self
9779    }
9780
9781    /// Sets the value of [revision_id][crate::model::RollbackSchemaRequest::revision_id].
9782    ///
9783    /// # Example
9784    /// ```ignore,no_run
9785    /// # use google_cloud_pubsub::model::RollbackSchemaRequest;
9786    /// let x = RollbackSchemaRequest::new().set_revision_id("example");
9787    /// ```
9788    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9789        self.revision_id = v.into();
9790        self
9791    }
9792}
9793
9794impl wkt::message::Message for RollbackSchemaRequest {
9795    fn typename() -> &'static str {
9796        "type.googleapis.com/google.pubsub.v1.RollbackSchemaRequest"
9797    }
9798}
9799
9800/// Request for the `DeleteSchemaRevision` method.
9801#[derive(Clone, Default, PartialEq)]
9802#[non_exhaustive]
9803pub struct DeleteSchemaRevisionRequest {
9804    /// Required. The name of the schema revision to be deleted, with a revision ID
9805    /// explicitly included.
9806    ///
9807    /// Example: `projects/123/schemas/my-schema@c7cfa2a8`
9808    pub name: std::string::String,
9809
9810    /// Optional. This field is deprecated and should not be used for specifying
9811    /// the revision ID. The revision ID should be specified via the `name`
9812    /// parameter.
9813    #[deprecated]
9814    pub revision_id: std::string::String,
9815
9816    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9817}
9818
9819impl DeleteSchemaRevisionRequest {
9820    /// Creates a new default instance.
9821    pub fn new() -> Self {
9822        std::default::Default::default()
9823    }
9824
9825    /// Sets the value of [name][crate::model::DeleteSchemaRevisionRequest::name].
9826    ///
9827    /// # Example
9828    /// ```ignore,no_run
9829    /// # use google_cloud_pubsub::model::DeleteSchemaRevisionRequest;
9830    /// # let project_id = "project_id";
9831    /// # let schema_id = "schema_id";
9832    /// let x = DeleteSchemaRevisionRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9833    /// ```
9834    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9835        self.name = v.into();
9836        self
9837    }
9838
9839    /// Sets the value of [revision_id][crate::model::DeleteSchemaRevisionRequest::revision_id].
9840    ///
9841    /// # Example
9842    /// ```ignore,no_run
9843    /// # use google_cloud_pubsub::model::DeleteSchemaRevisionRequest;
9844    /// let x = DeleteSchemaRevisionRequest::new().set_revision_id("example");
9845    /// ```
9846    #[deprecated]
9847    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9848        self.revision_id = v.into();
9849        self
9850    }
9851}
9852
9853impl wkt::message::Message for DeleteSchemaRevisionRequest {
9854    fn typename() -> &'static str {
9855        "type.googleapis.com/google.pubsub.v1.DeleteSchemaRevisionRequest"
9856    }
9857}
9858
9859/// Request for the `DeleteSchema` method.
9860#[derive(Clone, Default, PartialEq)]
9861#[non_exhaustive]
9862pub struct DeleteSchemaRequest {
9863    /// Required. Name of the schema to delete.
9864    /// Format is `projects/{project}/schemas/{schema}`.
9865    pub name: std::string::String,
9866
9867    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9868}
9869
9870impl DeleteSchemaRequest {
9871    /// Creates a new default instance.
9872    pub fn new() -> Self {
9873        std::default::Default::default()
9874    }
9875
9876    /// Sets the value of [name][crate::model::DeleteSchemaRequest::name].
9877    ///
9878    /// # Example
9879    /// ```ignore,no_run
9880    /// # use google_cloud_pubsub::model::DeleteSchemaRequest;
9881    /// # let project_id = "project_id";
9882    /// # let schema_id = "schema_id";
9883    /// let x = DeleteSchemaRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
9884    /// ```
9885    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9886        self.name = v.into();
9887        self
9888    }
9889}
9890
9891impl wkt::message::Message for DeleteSchemaRequest {
9892    fn typename() -> &'static str {
9893        "type.googleapis.com/google.pubsub.v1.DeleteSchemaRequest"
9894    }
9895}
9896
9897/// Request for the `ValidateSchema` method.
9898#[derive(Clone, Default, PartialEq)]
9899#[non_exhaustive]
9900pub struct ValidateSchemaRequest {
9901    /// Required. The name of the project in which to validate schemas.
9902    /// Format is `projects/{project-id}`.
9903    pub parent: std::string::String,
9904
9905    /// Required. The schema object to validate.
9906    pub schema: std::option::Option<crate::model::Schema>,
9907
9908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9909}
9910
9911impl ValidateSchemaRequest {
9912    /// Creates a new default instance.
9913    pub fn new() -> Self {
9914        std::default::Default::default()
9915    }
9916
9917    /// Sets the value of [parent][crate::model::ValidateSchemaRequest::parent].
9918    ///
9919    /// # Example
9920    /// ```ignore,no_run
9921    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
9922    /// let x = ValidateSchemaRequest::new().set_parent("example");
9923    /// ```
9924    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9925        self.parent = v.into();
9926        self
9927    }
9928
9929    /// Sets the value of [schema][crate::model::ValidateSchemaRequest::schema].
9930    ///
9931    /// # Example
9932    /// ```ignore,no_run
9933    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
9934    /// use google_cloud_pubsub::model::Schema;
9935    /// let x = ValidateSchemaRequest::new().set_schema(Schema::default()/* use setters */);
9936    /// ```
9937    pub fn set_schema<T>(mut self, v: T) -> Self
9938    where
9939        T: std::convert::Into<crate::model::Schema>,
9940    {
9941        self.schema = std::option::Option::Some(v.into());
9942        self
9943    }
9944
9945    /// Sets or clears the value of [schema][crate::model::ValidateSchemaRequest::schema].
9946    ///
9947    /// # Example
9948    /// ```ignore,no_run
9949    /// # use google_cloud_pubsub::model::ValidateSchemaRequest;
9950    /// use google_cloud_pubsub::model::Schema;
9951    /// let x = ValidateSchemaRequest::new().set_or_clear_schema(Some(Schema::default()/* use setters */));
9952    /// let x = ValidateSchemaRequest::new().set_or_clear_schema(None::<Schema>);
9953    /// ```
9954    pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
9955    where
9956        T: std::convert::Into<crate::model::Schema>,
9957    {
9958        self.schema = v.map(|x| x.into());
9959        self
9960    }
9961}
9962
9963impl wkt::message::Message for ValidateSchemaRequest {
9964    fn typename() -> &'static str {
9965        "type.googleapis.com/google.pubsub.v1.ValidateSchemaRequest"
9966    }
9967}
9968
9969/// Response for the `ValidateSchema` method.
9970/// Empty for now.
9971#[derive(Clone, Default, PartialEq)]
9972#[non_exhaustive]
9973pub struct ValidateSchemaResponse {
9974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9975}
9976
9977impl ValidateSchemaResponse {
9978    /// Creates a new default instance.
9979    pub fn new() -> Self {
9980        std::default::Default::default()
9981    }
9982}
9983
9984impl wkt::message::Message for ValidateSchemaResponse {
9985    fn typename() -> &'static str {
9986        "type.googleapis.com/google.pubsub.v1.ValidateSchemaResponse"
9987    }
9988}
9989
9990/// Request for the `ValidateMessage` method.
9991#[derive(Clone, Default, PartialEq)]
9992#[non_exhaustive]
9993pub struct ValidateMessageRequest {
9994    /// Required. The name of the project in which to validate schemas.
9995    /// Format is `projects/{project-id}`.
9996    pub parent: std::string::String,
9997
9998    /// Message to validate against the provided `schema_spec`.
9999    pub message: ::bytes::Bytes,
10000
10001    /// The encoding expected for messages
10002    pub encoding: crate::model::Encoding,
10003
10004    #[allow(missing_docs)]
10005    pub schema_spec: std::option::Option<crate::model::validate_message_request::SchemaSpec>,
10006
10007    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10008}
10009
10010impl ValidateMessageRequest {
10011    /// Creates a new default instance.
10012    pub fn new() -> Self {
10013        std::default::Default::default()
10014    }
10015
10016    /// Sets the value of [parent][crate::model::ValidateMessageRequest::parent].
10017    ///
10018    /// # Example
10019    /// ```ignore,no_run
10020    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10021    /// let x = ValidateMessageRequest::new().set_parent("example");
10022    /// ```
10023    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10024        self.parent = v.into();
10025        self
10026    }
10027
10028    /// Sets the value of [message][crate::model::ValidateMessageRequest::message].
10029    ///
10030    /// # Example
10031    /// ```ignore,no_run
10032    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10033    /// let x = ValidateMessageRequest::new().set_message(bytes::Bytes::from_static(b"example"));
10034    /// ```
10035    pub fn set_message<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10036        self.message = v.into();
10037        self
10038    }
10039
10040    /// Sets the value of [encoding][crate::model::ValidateMessageRequest::encoding].
10041    ///
10042    /// # Example
10043    /// ```ignore,no_run
10044    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10045    /// use google_cloud_pubsub::model::Encoding;
10046    /// let x0 = ValidateMessageRequest::new().set_encoding(Encoding::Json);
10047    /// let x1 = ValidateMessageRequest::new().set_encoding(Encoding::Binary);
10048    /// ```
10049    pub fn set_encoding<T: std::convert::Into<crate::model::Encoding>>(mut self, v: T) -> Self {
10050        self.encoding = v.into();
10051        self
10052    }
10053
10054    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec].
10055    ///
10056    /// Note that all the setters affecting `schema_spec` are mutually
10057    /// exclusive.
10058    ///
10059    /// # Example
10060    /// ```ignore,no_run
10061    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10062    /// use google_cloud_pubsub::model::validate_message_request::SchemaSpec;
10063    /// let x = ValidateMessageRequest::new().set_schema_spec(Some(SchemaSpec::Name("example".to_string())));
10064    /// ```
10065    pub fn set_schema_spec<
10066        T: std::convert::Into<std::option::Option<crate::model::validate_message_request::SchemaSpec>>,
10067    >(
10068        mut self,
10069        v: T,
10070    ) -> Self {
10071        self.schema_spec = v.into();
10072        self
10073    }
10074
10075    /// The value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
10076    /// if it holds a `Name`, `None` if the field is not set or
10077    /// holds a different branch.
10078    pub fn name(&self) -> std::option::Option<&std::string::String> {
10079        #[allow(unreachable_patterns)]
10080        self.schema_spec.as_ref().and_then(|v| match v {
10081            crate::model::validate_message_request::SchemaSpec::Name(v) => {
10082                std::option::Option::Some(v)
10083            }
10084            _ => std::option::Option::None,
10085        })
10086    }
10087
10088    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
10089    /// to hold a `Name`.
10090    ///
10091    /// Note that all the setters affecting `schema_spec` are
10092    /// mutually exclusive.
10093    ///
10094    /// # Example
10095    /// ```ignore,no_run
10096    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10097    /// # let project_id = "project_id";
10098    /// # let schema_id = "schema_id";
10099    /// let x = ValidateMessageRequest::new().set_name(format!("projects/{project_id}/schemas/{schema_id}"));
10100    /// assert!(x.name().is_some());
10101    /// assert!(x.schema().is_none());
10102    /// ```
10103    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10104        self.schema_spec = std::option::Option::Some(
10105            crate::model::validate_message_request::SchemaSpec::Name(v.into()),
10106        );
10107        self
10108    }
10109
10110    /// The value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
10111    /// if it holds a `Schema`, `None` if the field is not set or
10112    /// holds a different branch.
10113    pub fn schema(&self) -> std::option::Option<&std::boxed::Box<crate::model::Schema>> {
10114        #[allow(unreachable_patterns)]
10115        self.schema_spec.as_ref().and_then(|v| match v {
10116            crate::model::validate_message_request::SchemaSpec::Schema(v) => {
10117                std::option::Option::Some(v)
10118            }
10119            _ => std::option::Option::None,
10120        })
10121    }
10122
10123    /// Sets the value of [schema_spec][crate::model::ValidateMessageRequest::schema_spec]
10124    /// to hold a `Schema`.
10125    ///
10126    /// Note that all the setters affecting `schema_spec` are
10127    /// mutually exclusive.
10128    ///
10129    /// # Example
10130    /// ```ignore,no_run
10131    /// # use google_cloud_pubsub::model::ValidateMessageRequest;
10132    /// use google_cloud_pubsub::model::Schema;
10133    /// let x = ValidateMessageRequest::new().set_schema(Schema::default()/* use setters */);
10134    /// assert!(x.schema().is_some());
10135    /// assert!(x.name().is_none());
10136    /// ```
10137    pub fn set_schema<T: std::convert::Into<std::boxed::Box<crate::model::Schema>>>(
10138        mut self,
10139        v: T,
10140    ) -> Self {
10141        self.schema_spec = std::option::Option::Some(
10142            crate::model::validate_message_request::SchemaSpec::Schema(v.into()),
10143        );
10144        self
10145    }
10146}
10147
10148impl wkt::message::Message for ValidateMessageRequest {
10149    fn typename() -> &'static str {
10150        "type.googleapis.com/google.pubsub.v1.ValidateMessageRequest"
10151    }
10152}
10153
10154/// Defines additional types related to [ValidateMessageRequest].
10155pub mod validate_message_request {
10156    #[allow(unused_imports)]
10157    use super::*;
10158
10159    #[allow(missing_docs)]
10160    #[derive(Clone, Debug, PartialEq)]
10161    #[non_exhaustive]
10162    pub enum SchemaSpec {
10163        /// Name of the schema against which to validate.
10164        ///
10165        /// Format is `projects/{project}/schemas/{schema}`.
10166        Name(std::string::String),
10167        /// Ad-hoc schema against which to validate
10168        Schema(std::boxed::Box<crate::model::Schema>),
10169    }
10170}
10171
10172/// Response for the `ValidateMessage` method.
10173/// Empty for now.
10174#[derive(Clone, Default, PartialEq)]
10175#[non_exhaustive]
10176pub struct ValidateMessageResponse {
10177    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10178}
10179
10180impl ValidateMessageResponse {
10181    /// Creates a new default instance.
10182    pub fn new() -> Self {
10183        std::default::Default::default()
10184    }
10185}
10186
10187impl wkt::message::Message for ValidateMessageResponse {
10188    fn typename() -> &'static str {
10189        "type.googleapis.com/google.pubsub.v1.ValidateMessageResponse"
10190    }
10191}
10192
10193/// Configuration specific to compiled Protocol Buffer schemas.
10194#[derive(Clone, Default, PartialEq)]
10195#[non_exhaustive]
10196pub struct CompiledProtoSchema {
10197    /// Required. The name of the root message type in the schema.
10198    pub root_message: std::string::String,
10199
10200    /// Required. The compiled FileDescriptorSet binary.
10201    pub compiled_bytes: ::bytes::Bytes,
10202
10203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10204}
10205
10206impl CompiledProtoSchema {
10207    /// Creates a new default instance.
10208    pub fn new() -> Self {
10209        std::default::Default::default()
10210    }
10211
10212    /// Sets the value of [root_message][crate::model::CompiledProtoSchema::root_message].
10213    ///
10214    /// # Example
10215    /// ```ignore,no_run
10216    /// # use google_cloud_pubsub::model::CompiledProtoSchema;
10217    /// let x = CompiledProtoSchema::new().set_root_message("example");
10218    /// ```
10219    pub fn set_root_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10220        self.root_message = v.into();
10221        self
10222    }
10223
10224    /// Sets the value of [compiled_bytes][crate::model::CompiledProtoSchema::compiled_bytes].
10225    ///
10226    /// # Example
10227    /// ```ignore,no_run
10228    /// # use google_cloud_pubsub::model::CompiledProtoSchema;
10229    /// let x = CompiledProtoSchema::new().set_compiled_bytes(bytes::Bytes::from_static(b"example"));
10230    /// ```
10231    pub fn set_compiled_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10232        self.compiled_bytes = v.into();
10233        self
10234    }
10235}
10236
10237impl wkt::message::Message for CompiledProtoSchema {
10238    fn typename() -> &'static str {
10239        "type.googleapis.com/google.pubsub.v1.CompiledProtoSchema"
10240    }
10241}
10242
10243/// View of Schema object fields to be returned by GetSchema and ListSchemas.
10244///
10245/// # Working with unknown values
10246///
10247/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10248/// additional enum variants at any time. Adding new variants is not considered
10249/// a breaking change. Applications should write their code in anticipation of:
10250///
10251/// - New values appearing in future releases of the client library, **and**
10252/// - New values received dynamically, without application changes.
10253///
10254/// Please consult the [Working with enums] section in the user guide for some
10255/// guidelines.
10256///
10257/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10258#[derive(Clone, Debug, PartialEq)]
10259#[non_exhaustive]
10260pub enum SchemaView {
10261    /// The default / unset value.
10262    /// The API will default to the BASIC view.
10263    Unspecified,
10264    /// Include the name and type of the schema, but not the definition.
10265    Basic,
10266    /// Include all Schema object fields.
10267    Full,
10268    /// If set, the enum was initialized with an unknown value.
10269    ///
10270    /// Applications can examine the value using [SchemaView::value] or
10271    /// [SchemaView::name].
10272    UnknownValue(schema_view::UnknownValue),
10273}
10274
10275#[doc(hidden)]
10276pub mod schema_view {
10277    #[allow(unused_imports)]
10278    use super::*;
10279    #[derive(Clone, Debug, PartialEq)]
10280    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10281}
10282
10283impl SchemaView {
10284    /// Gets the enum value.
10285    ///
10286    /// Returns `None` if the enum contains an unknown value deserialized from
10287    /// the string representation of enums.
10288    pub fn value(&self) -> std::option::Option<i32> {
10289        match self {
10290            Self::Unspecified => std::option::Option::Some(0),
10291            Self::Basic => std::option::Option::Some(1),
10292            Self::Full => std::option::Option::Some(2),
10293            Self::UnknownValue(u) => u.0.value(),
10294        }
10295    }
10296
10297    /// Gets the enum value as a string.
10298    ///
10299    /// Returns `None` if the enum contains an unknown value deserialized from
10300    /// the integer representation of enums.
10301    pub fn name(&self) -> std::option::Option<&str> {
10302        match self {
10303            Self::Unspecified => std::option::Option::Some("SCHEMA_VIEW_UNSPECIFIED"),
10304            Self::Basic => std::option::Option::Some("BASIC"),
10305            Self::Full => std::option::Option::Some("FULL"),
10306            Self::UnknownValue(u) => u.0.name(),
10307        }
10308    }
10309}
10310
10311impl std::default::Default for SchemaView {
10312    fn default() -> Self {
10313        use std::convert::From;
10314        Self::from(0)
10315    }
10316}
10317
10318impl std::fmt::Display for SchemaView {
10319    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10320        wkt::internal::display_enum(f, self.name(), self.value())
10321    }
10322}
10323
10324impl std::convert::From<i32> for SchemaView {
10325    fn from(value: i32) -> Self {
10326        match value {
10327            0 => Self::Unspecified,
10328            1 => Self::Basic,
10329            2 => Self::Full,
10330            _ => Self::UnknownValue(schema_view::UnknownValue(
10331                wkt::internal::UnknownEnumValue::Integer(value),
10332            )),
10333        }
10334    }
10335}
10336
10337impl std::convert::From<&str> for SchemaView {
10338    fn from(value: &str) -> Self {
10339        use std::string::ToString;
10340        match value {
10341            "SCHEMA_VIEW_UNSPECIFIED" => Self::Unspecified,
10342            "BASIC" => Self::Basic,
10343            "FULL" => Self::Full,
10344            _ => Self::UnknownValue(schema_view::UnknownValue(
10345                wkt::internal::UnknownEnumValue::String(value.to_string()),
10346            )),
10347        }
10348    }
10349}
10350
10351impl serde::ser::Serialize for SchemaView {
10352    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10353    where
10354        S: serde::Serializer,
10355    {
10356        match self {
10357            Self::Unspecified => serializer.serialize_i32(0),
10358            Self::Basic => serializer.serialize_i32(1),
10359            Self::Full => serializer.serialize_i32(2),
10360            Self::UnknownValue(u) => u.0.serialize(serializer),
10361        }
10362    }
10363}
10364
10365impl<'de> serde::de::Deserialize<'de> for SchemaView {
10366    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10367    where
10368        D: serde::Deserializer<'de>,
10369    {
10370        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SchemaView>::new(
10371            ".google.pubsub.v1.SchemaView",
10372        ))
10373    }
10374}
10375
10376/// Possible encoding types for messages.
10377///
10378/// # Working with unknown values
10379///
10380/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10381/// additional enum variants at any time. Adding new variants is not considered
10382/// a breaking change. Applications should write their code in anticipation of:
10383///
10384/// - New values appearing in future releases of the client library, **and**
10385/// - New values received dynamically, without application changes.
10386///
10387/// Please consult the [Working with enums] section in the user guide for some
10388/// guidelines.
10389///
10390/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10391#[derive(Clone, Debug, PartialEq)]
10392#[non_exhaustive]
10393pub enum Encoding {
10394    /// Unspecified
10395    Unspecified,
10396    /// JSON encoding
10397    Json,
10398    /// Binary encoding, as defined by the schema type. For some schema types,
10399    /// binary encoding may not be available.
10400    Binary,
10401    /// If set, the enum was initialized with an unknown value.
10402    ///
10403    /// Applications can examine the value using [Encoding::value] or
10404    /// [Encoding::name].
10405    UnknownValue(encoding::UnknownValue),
10406}
10407
10408#[doc(hidden)]
10409pub mod encoding {
10410    #[allow(unused_imports)]
10411    use super::*;
10412    #[derive(Clone, Debug, PartialEq)]
10413    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10414}
10415
10416impl Encoding {
10417    /// Gets the enum value.
10418    ///
10419    /// Returns `None` if the enum contains an unknown value deserialized from
10420    /// the string representation of enums.
10421    pub fn value(&self) -> std::option::Option<i32> {
10422        match self {
10423            Self::Unspecified => std::option::Option::Some(0),
10424            Self::Json => std::option::Option::Some(1),
10425            Self::Binary => std::option::Option::Some(2),
10426            Self::UnknownValue(u) => u.0.value(),
10427        }
10428    }
10429
10430    /// Gets the enum value as a string.
10431    ///
10432    /// Returns `None` if the enum contains an unknown value deserialized from
10433    /// the integer representation of enums.
10434    pub fn name(&self) -> std::option::Option<&str> {
10435        match self {
10436            Self::Unspecified => std::option::Option::Some("ENCODING_UNSPECIFIED"),
10437            Self::Json => std::option::Option::Some("JSON"),
10438            Self::Binary => std::option::Option::Some("BINARY"),
10439            Self::UnknownValue(u) => u.0.name(),
10440        }
10441    }
10442}
10443
10444impl std::default::Default for Encoding {
10445    fn default() -> Self {
10446        use std::convert::From;
10447        Self::from(0)
10448    }
10449}
10450
10451impl std::fmt::Display for Encoding {
10452    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10453        wkt::internal::display_enum(f, self.name(), self.value())
10454    }
10455}
10456
10457impl std::convert::From<i32> for Encoding {
10458    fn from(value: i32) -> Self {
10459        match value {
10460            0 => Self::Unspecified,
10461            1 => Self::Json,
10462            2 => Self::Binary,
10463            _ => Self::UnknownValue(encoding::UnknownValue(
10464                wkt::internal::UnknownEnumValue::Integer(value),
10465            )),
10466        }
10467    }
10468}
10469
10470impl std::convert::From<&str> for Encoding {
10471    fn from(value: &str) -> Self {
10472        use std::string::ToString;
10473        match value {
10474            "ENCODING_UNSPECIFIED" => Self::Unspecified,
10475            "JSON" => Self::Json,
10476            "BINARY" => Self::Binary,
10477            _ => Self::UnknownValue(encoding::UnknownValue(
10478                wkt::internal::UnknownEnumValue::String(value.to_string()),
10479            )),
10480        }
10481    }
10482}
10483
10484impl serde::ser::Serialize for Encoding {
10485    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10486    where
10487        S: serde::Serializer,
10488    {
10489        match self {
10490            Self::Unspecified => serializer.serialize_i32(0),
10491            Self::Json => serializer.serialize_i32(1),
10492            Self::Binary => serializer.serialize_i32(2),
10493            Self::UnknownValue(u) => u.0.serialize(serializer),
10494        }
10495    }
10496}
10497
10498impl<'de> serde::de::Deserialize<'de> for Encoding {
10499    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10500    where
10501        D: serde::Deserializer<'de>,
10502    {
10503        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Encoding>::new(
10504            ".google.pubsub.v1.Encoding",
10505        ))
10506    }
10507}