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