Skip to main content

google_cloud_alloydb_v1/
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#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate google_cloud_type;
29extern crate lazy_static;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// The source CloudSQL backup resource.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct CloudSQLBackupRunSource {
45    /// The project ID of the source CloudSQL instance. This should be the same as
46    /// the AlloyDB cluster's project.
47    pub project: std::string::String,
48
49    /// Required. The CloudSQL instance ID.
50    pub instance_id: std::string::String,
51
52    /// Required. The CloudSQL backup run ID.
53    pub backup_run_id: i64,
54
55    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl CloudSQLBackupRunSource {
59    pub fn new() -> Self {
60        std::default::Default::default()
61    }
62
63    /// Sets the value of [project][crate::model::CloudSQLBackupRunSource::project].
64    ///
65    /// # Example
66    /// ```ignore,no_run
67    /// # use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
68    /// let x = CloudSQLBackupRunSource::new().set_project("example");
69    /// ```
70    pub fn set_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71        self.project = v.into();
72        self
73    }
74
75    /// Sets the value of [instance_id][crate::model::CloudSQLBackupRunSource::instance_id].
76    ///
77    /// # Example
78    /// ```ignore,no_run
79    /// # use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
80    /// let x = CloudSQLBackupRunSource::new().set_instance_id("example");
81    /// ```
82    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83        self.instance_id = v.into();
84        self
85    }
86
87    /// Sets the value of [backup_run_id][crate::model::CloudSQLBackupRunSource::backup_run_id].
88    ///
89    /// # Example
90    /// ```ignore,no_run
91    /// # use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
92    /// let x = CloudSQLBackupRunSource::new().set_backup_run_id(42);
93    /// ```
94    pub fn set_backup_run_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
95        self.backup_run_id = v.into();
96        self
97    }
98}
99
100impl wkt::message::Message for CloudSQLBackupRunSource {
101    fn typename() -> &'static str {
102        "type.googleapis.com/google.cloud.alloydb.v1.CloudSQLBackupRunSource"
103    }
104}
105
106/// Message for registering Restoring from CloudSQL resource.
107#[derive(Clone, Default, PartialEq)]
108#[non_exhaustive]
109pub struct RestoreFromCloudSQLRequest {
110    /// Required. The location of the new cluster. For the required format, see the
111    /// comment on Cluster.name field.
112    pub parent: std::string::String,
113
114    /// Required. ID of the requesting object.
115    pub cluster_id: std::string::String,
116
117    /// Required. The resource being created
118    pub cluster: std::option::Option<crate::model::Cluster>,
119
120    /// The source CloudSQL resource to restore from.
121    pub source: std::option::Option<crate::model::restore_from_cloud_sql_request::Source>,
122
123    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
124}
125
126impl RestoreFromCloudSQLRequest {
127    pub fn new() -> Self {
128        std::default::Default::default()
129    }
130
131    /// Sets the value of [parent][crate::model::RestoreFromCloudSQLRequest::parent].
132    ///
133    /// # Example
134    /// ```ignore,no_run
135    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
136    /// let x = RestoreFromCloudSQLRequest::new().set_parent("example");
137    /// ```
138    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
139        self.parent = v.into();
140        self
141    }
142
143    /// Sets the value of [cluster_id][crate::model::RestoreFromCloudSQLRequest::cluster_id].
144    ///
145    /// # Example
146    /// ```ignore,no_run
147    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
148    /// let x = RestoreFromCloudSQLRequest::new().set_cluster_id("example");
149    /// ```
150    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
151        self.cluster_id = v.into();
152        self
153    }
154
155    /// Sets the value of [cluster][crate::model::RestoreFromCloudSQLRequest::cluster].
156    ///
157    /// # Example
158    /// ```ignore,no_run
159    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
160    /// use google_cloud_alloydb_v1::model::Cluster;
161    /// let x = RestoreFromCloudSQLRequest::new().set_cluster(Cluster::default()/* use setters */);
162    /// ```
163    pub fn set_cluster<T>(mut self, v: T) -> Self
164    where
165        T: std::convert::Into<crate::model::Cluster>,
166    {
167        self.cluster = std::option::Option::Some(v.into());
168        self
169    }
170
171    /// Sets or clears the value of [cluster][crate::model::RestoreFromCloudSQLRequest::cluster].
172    ///
173    /// # Example
174    /// ```ignore,no_run
175    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
176    /// use google_cloud_alloydb_v1::model::Cluster;
177    /// let x = RestoreFromCloudSQLRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
178    /// let x = RestoreFromCloudSQLRequest::new().set_or_clear_cluster(None::<Cluster>);
179    /// ```
180    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
181    where
182        T: std::convert::Into<crate::model::Cluster>,
183    {
184        self.cluster = v.map(|x| x.into());
185        self
186    }
187
188    /// Sets the value of [source][crate::model::RestoreFromCloudSQLRequest::source].
189    ///
190    /// Note that all the setters affecting `source` are mutually
191    /// exclusive.
192    ///
193    /// # Example
194    /// ```ignore,no_run
195    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
196    /// use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
197    /// let x = RestoreFromCloudSQLRequest::new().set_source(Some(
198    ///     google_cloud_alloydb_v1::model::restore_from_cloud_sql_request::Source::CloudsqlBackupRunSource(CloudSQLBackupRunSource::default().into())));
199    /// ```
200    pub fn set_source<
201        T: std::convert::Into<
202                std::option::Option<crate::model::restore_from_cloud_sql_request::Source>,
203            >,
204    >(
205        mut self,
206        v: T,
207    ) -> Self {
208        self.source = v.into();
209        self
210    }
211
212    /// The value of [source][crate::model::RestoreFromCloudSQLRequest::source]
213    /// if it holds a `CloudsqlBackupRunSource`, `None` if the field is not set or
214    /// holds a different branch.
215    pub fn cloudsql_backup_run_source(
216        &self,
217    ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSQLBackupRunSource>> {
218        #[allow(unreachable_patterns)]
219        self.source.as_ref().and_then(|v| match v {
220            crate::model::restore_from_cloud_sql_request::Source::CloudsqlBackupRunSource(v) => {
221                std::option::Option::Some(v)
222            }
223            _ => std::option::Option::None,
224        })
225    }
226
227    /// Sets the value of [source][crate::model::RestoreFromCloudSQLRequest::source]
228    /// to hold a `CloudsqlBackupRunSource`.
229    ///
230    /// Note that all the setters affecting `source` are
231    /// mutually exclusive.
232    ///
233    /// # Example
234    /// ```ignore,no_run
235    /// # use google_cloud_alloydb_v1::model::RestoreFromCloudSQLRequest;
236    /// use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
237    /// let x = RestoreFromCloudSQLRequest::new().set_cloudsql_backup_run_source(CloudSQLBackupRunSource::default()/* use setters */);
238    /// assert!(x.cloudsql_backup_run_source().is_some());
239    /// ```
240    pub fn set_cloudsql_backup_run_source<
241        T: std::convert::Into<std::boxed::Box<crate::model::CloudSQLBackupRunSource>>,
242    >(
243        mut self,
244        v: T,
245    ) -> Self {
246        self.source = std::option::Option::Some(
247            crate::model::restore_from_cloud_sql_request::Source::CloudsqlBackupRunSource(v.into()),
248        );
249        self
250    }
251}
252
253impl wkt::message::Message for RestoreFromCloudSQLRequest {
254    fn typename() -> &'static str {
255        "type.googleapis.com/google.cloud.alloydb.v1.RestoreFromCloudSQLRequest"
256    }
257}
258
259/// Defines additional types related to [RestoreFromCloudSQLRequest].
260pub mod restore_from_cloud_sql_request {
261    #[allow(unused_imports)]
262    use super::*;
263
264    /// The source CloudSQL resource to restore from.
265    #[derive(Clone, Debug, PartialEq)]
266    #[non_exhaustive]
267    pub enum Source {
268        /// Cluster created from CloudSQL backup run.
269        CloudsqlBackupRunSource(std::boxed::Box<crate::model::CloudSQLBackupRunSource>),
270    }
271}
272
273/// SqlResult represents the result for the execution of a sql statement.
274#[derive(Clone, Default, PartialEq)]
275#[non_exhaustive]
276pub struct SqlResult {
277    /// List of columns included in the result. This also includes the data type
278    /// of the column.
279    pub columns: std::vec::Vec<crate::model::SqlResultColumn>,
280
281    /// Rows returned by the SQL statement.
282    pub rows: std::vec::Vec<crate::model::SqlResultRow>,
283
284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
285}
286
287impl SqlResult {
288    pub fn new() -> Self {
289        std::default::Default::default()
290    }
291
292    /// Sets the value of [columns][crate::model::SqlResult::columns].
293    ///
294    /// # Example
295    /// ```ignore,no_run
296    /// # use google_cloud_alloydb_v1::model::SqlResult;
297    /// use google_cloud_alloydb_v1::model::SqlResultColumn;
298    /// let x = SqlResult::new()
299    ///     .set_columns([
300    ///         SqlResultColumn::default()/* use setters */,
301    ///         SqlResultColumn::default()/* use (different) setters */,
302    ///     ]);
303    /// ```
304    pub fn set_columns<T, V>(mut self, v: T) -> Self
305    where
306        T: std::iter::IntoIterator<Item = V>,
307        V: std::convert::Into<crate::model::SqlResultColumn>,
308    {
309        use std::iter::Iterator;
310        self.columns = v.into_iter().map(|i| i.into()).collect();
311        self
312    }
313
314    /// Sets the value of [rows][crate::model::SqlResult::rows].
315    ///
316    /// # Example
317    /// ```ignore,no_run
318    /// # use google_cloud_alloydb_v1::model::SqlResult;
319    /// use google_cloud_alloydb_v1::model::SqlResultRow;
320    /// let x = SqlResult::new()
321    ///     .set_rows([
322    ///         SqlResultRow::default()/* use setters */,
323    ///         SqlResultRow::default()/* use (different) setters */,
324    ///     ]);
325    /// ```
326    pub fn set_rows<T, V>(mut self, v: T) -> Self
327    where
328        T: std::iter::IntoIterator<Item = V>,
329        V: std::convert::Into<crate::model::SqlResultRow>,
330    {
331        use std::iter::Iterator;
332        self.rows = v.into_iter().map(|i| i.into()).collect();
333        self
334    }
335}
336
337impl wkt::message::Message for SqlResult {
338    fn typename() -> &'static str {
339        "type.googleapis.com/google.cloud.alloydb.v1.SqlResult"
340    }
341}
342
343/// Contains the name and datatype of a column in a SQL Result.
344#[derive(Clone, Default, PartialEq)]
345#[non_exhaustive]
346pub struct SqlResultColumn {
347    /// Name of the column.
348    pub name: std::string::String,
349
350    /// Datatype of the column as reported by the postgres driver.
351    /// Common type names are "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL",
352    /// "INT", and "BIGINT".
353    pub r#type: std::string::String,
354
355    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
356}
357
358impl SqlResultColumn {
359    pub fn new() -> Self {
360        std::default::Default::default()
361    }
362
363    /// Sets the value of [name][crate::model::SqlResultColumn::name].
364    ///
365    /// # Example
366    /// ```ignore,no_run
367    /// # use google_cloud_alloydb_v1::model::SqlResultColumn;
368    /// let x = SqlResultColumn::new().set_name("example");
369    /// ```
370    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
371        self.name = v.into();
372        self
373    }
374
375    /// Sets the value of [r#type][crate::model::SqlResultColumn::type].
376    ///
377    /// # Example
378    /// ```ignore,no_run
379    /// # use google_cloud_alloydb_v1::model::SqlResultColumn;
380    /// let x = SqlResultColumn::new().set_type("example");
381    /// ```
382    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
383        self.r#type = v.into();
384        self
385    }
386}
387
388impl wkt::message::Message for SqlResultColumn {
389    fn typename() -> &'static str {
390        "type.googleapis.com/google.cloud.alloydb.v1.SqlResultColumn"
391    }
392}
393
394/// A single row from a sql result.
395#[derive(Clone, Default, PartialEq)]
396#[non_exhaustive]
397pub struct SqlResultRow {
398    /// List of values in a row of sql result.
399    pub values: std::vec::Vec<crate::model::SqlResultValue>,
400
401    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
402}
403
404impl SqlResultRow {
405    pub fn new() -> Self {
406        std::default::Default::default()
407    }
408
409    /// Sets the value of [values][crate::model::SqlResultRow::values].
410    ///
411    /// # Example
412    /// ```ignore,no_run
413    /// # use google_cloud_alloydb_v1::model::SqlResultRow;
414    /// use google_cloud_alloydb_v1::model::SqlResultValue;
415    /// let x = SqlResultRow::new()
416    ///     .set_values([
417    ///         SqlResultValue::default()/* use setters */,
418    ///         SqlResultValue::default()/* use (different) setters */,
419    ///     ]);
420    /// ```
421    pub fn set_values<T, V>(mut self, v: T) -> Self
422    where
423        T: std::iter::IntoIterator<Item = V>,
424        V: std::convert::Into<crate::model::SqlResultValue>,
425    {
426        use std::iter::Iterator;
427        self.values = v.into_iter().map(|i| i.into()).collect();
428        self
429    }
430}
431
432impl wkt::message::Message for SqlResultRow {
433    fn typename() -> &'static str {
434        "type.googleapis.com/google.cloud.alloydb.v1.SqlResultRow"
435    }
436}
437
438/// A single value in a row from a sql result.
439#[derive(Clone, Default, PartialEq)]
440#[non_exhaustive]
441pub struct SqlResultValue {
442    /// The cell value represented in string format.
443    /// Timestamps are converted to string using RFC3339Nano format.
444    pub value: std::option::Option<std::string::String>,
445
446    /// Set to true if cell value is null.
447    pub null_value: std::option::Option<bool>,
448
449    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
450}
451
452impl SqlResultValue {
453    pub fn new() -> Self {
454        std::default::Default::default()
455    }
456
457    /// Sets the value of [value][crate::model::SqlResultValue::value].
458    ///
459    /// # Example
460    /// ```ignore,no_run
461    /// # use google_cloud_alloydb_v1::model::SqlResultValue;
462    /// let x = SqlResultValue::new().set_value("example");
463    /// ```
464    pub fn set_value<T>(mut self, v: T) -> Self
465    where
466        T: std::convert::Into<std::string::String>,
467    {
468        self.value = std::option::Option::Some(v.into());
469        self
470    }
471
472    /// Sets or clears the value of [value][crate::model::SqlResultValue::value].
473    ///
474    /// # Example
475    /// ```ignore,no_run
476    /// # use google_cloud_alloydb_v1::model::SqlResultValue;
477    /// let x = SqlResultValue::new().set_or_clear_value(Some("example"));
478    /// let x = SqlResultValue::new().set_or_clear_value(None::<String>);
479    /// ```
480    pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
481    where
482        T: std::convert::Into<std::string::String>,
483    {
484        self.value = v.map(|x| x.into());
485        self
486    }
487
488    /// Sets the value of [null_value][crate::model::SqlResultValue::null_value].
489    ///
490    /// # Example
491    /// ```ignore,no_run
492    /// # use google_cloud_alloydb_v1::model::SqlResultValue;
493    /// let x = SqlResultValue::new().set_null_value(true);
494    /// ```
495    pub fn set_null_value<T>(mut self, v: T) -> Self
496    where
497        T: std::convert::Into<bool>,
498    {
499        self.null_value = std::option::Option::Some(v.into());
500        self
501    }
502
503    /// Sets or clears the value of [null_value][crate::model::SqlResultValue::null_value].
504    ///
505    /// # Example
506    /// ```ignore,no_run
507    /// # use google_cloud_alloydb_v1::model::SqlResultValue;
508    /// let x = SqlResultValue::new().set_or_clear_null_value(Some(false));
509    /// let x = SqlResultValue::new().set_or_clear_null_value(None::<bool>);
510    /// ```
511    pub fn set_or_clear_null_value<T>(mut self, v: std::option::Option<T>) -> Self
512    where
513        T: std::convert::Into<bool>,
514    {
515        self.null_value = v.map(|x| x.into());
516        self
517    }
518}
519
520impl wkt::message::Message for SqlResultValue {
521    fn typename() -> &'static str {
522        "type.googleapis.com/google.cloud.alloydb.v1.SqlResultValue"
523    }
524}
525
526/// The username/password for a database user. Used for specifying initial
527/// users at cluster creation time.
528#[derive(Clone, Default, PartialEq)]
529#[non_exhaustive]
530pub struct UserPassword {
531    /// The database username.
532    pub user: std::string::String,
533
534    /// The initial password for the user.
535    pub password: std::string::String,
536
537    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
538}
539
540impl UserPassword {
541    pub fn new() -> Self {
542        std::default::Default::default()
543    }
544
545    /// Sets the value of [user][crate::model::UserPassword::user].
546    ///
547    /// # Example
548    /// ```ignore,no_run
549    /// # use google_cloud_alloydb_v1::model::UserPassword;
550    /// let x = UserPassword::new().set_user("example");
551    /// ```
552    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
553        self.user = v.into();
554        self
555    }
556
557    /// Sets the value of [password][crate::model::UserPassword::password].
558    ///
559    /// # Example
560    /// ```ignore,no_run
561    /// # use google_cloud_alloydb_v1::model::UserPassword;
562    /// let x = UserPassword::new().set_password("example");
563    /// ```
564    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
565        self.password = v.into();
566        self
567    }
568}
569
570impl wkt::message::Message for UserPassword {
571    fn typename() -> &'static str {
572        "type.googleapis.com/google.cloud.alloydb.v1.UserPassword"
573    }
574}
575
576/// Subset of the source instance configuration that is available when reading
577/// the cluster resource.
578#[derive(Clone, Default, PartialEq)]
579#[non_exhaustive]
580pub struct MigrationSource {
581    /// Output only. The host and port of the on-premises instance in host:port
582    /// format
583    pub host_port: std::string::String,
584
585    /// Output only. Place holder for the external source identifier(e.g DMS job
586    /// name) that created the cluster.
587    pub reference_id: std::string::String,
588
589    /// Output only. Type of migration source.
590    pub source_type: crate::model::migration_source::MigrationSourceType,
591
592    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
593}
594
595impl MigrationSource {
596    pub fn new() -> Self {
597        std::default::Default::default()
598    }
599
600    /// Sets the value of [host_port][crate::model::MigrationSource::host_port].
601    ///
602    /// # Example
603    /// ```ignore,no_run
604    /// # use google_cloud_alloydb_v1::model::MigrationSource;
605    /// let x = MigrationSource::new().set_host_port("example");
606    /// ```
607    pub fn set_host_port<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
608        self.host_port = v.into();
609        self
610    }
611
612    /// Sets the value of [reference_id][crate::model::MigrationSource::reference_id].
613    ///
614    /// # Example
615    /// ```ignore,no_run
616    /// # use google_cloud_alloydb_v1::model::MigrationSource;
617    /// let x = MigrationSource::new().set_reference_id("example");
618    /// ```
619    pub fn set_reference_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
620        self.reference_id = v.into();
621        self
622    }
623
624    /// Sets the value of [source_type][crate::model::MigrationSource::source_type].
625    ///
626    /// # Example
627    /// ```ignore,no_run
628    /// # use google_cloud_alloydb_v1::model::MigrationSource;
629    /// use google_cloud_alloydb_v1::model::migration_source::MigrationSourceType;
630    /// let x0 = MigrationSource::new().set_source_type(MigrationSourceType::Dms);
631    /// ```
632    pub fn set_source_type<
633        T: std::convert::Into<crate::model::migration_source::MigrationSourceType>,
634    >(
635        mut self,
636        v: T,
637    ) -> Self {
638        self.source_type = v.into();
639        self
640    }
641}
642
643impl wkt::message::Message for MigrationSource {
644    fn typename() -> &'static str {
645        "type.googleapis.com/google.cloud.alloydb.v1.MigrationSource"
646    }
647}
648
649/// Defines additional types related to [MigrationSource].
650pub mod migration_source {
651    #[allow(unused_imports)]
652    use super::*;
653
654    /// Denote the type of migration source that created this cluster.
655    ///
656    /// # Working with unknown values
657    ///
658    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
659    /// additional enum variants at any time. Adding new variants is not considered
660    /// a breaking change. Applications should write their code in anticipation of:
661    ///
662    /// - New values appearing in future releases of the client library, **and**
663    /// - New values received dynamically, without application changes.
664    ///
665    /// Please consult the [Working with enums] section in the user guide for some
666    /// guidelines.
667    ///
668    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
669    #[derive(Clone, Debug, PartialEq)]
670    #[non_exhaustive]
671    pub enum MigrationSourceType {
672        /// Migration source is unknown.
673        Unspecified,
674        /// DMS source means the cluster was created via DMS migration job.
675        Dms,
676        /// If set, the enum was initialized with an unknown value.
677        ///
678        /// Applications can examine the value using [MigrationSourceType::value] or
679        /// [MigrationSourceType::name].
680        UnknownValue(migration_source_type::UnknownValue),
681    }
682
683    #[doc(hidden)]
684    pub mod migration_source_type {
685        #[allow(unused_imports)]
686        use super::*;
687        #[derive(Clone, Debug, PartialEq)]
688        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
689    }
690
691    impl MigrationSourceType {
692        /// Gets the enum value.
693        ///
694        /// Returns `None` if the enum contains an unknown value deserialized from
695        /// the string representation of enums.
696        pub fn value(&self) -> std::option::Option<i32> {
697            match self {
698                Self::Unspecified => std::option::Option::Some(0),
699                Self::Dms => std::option::Option::Some(1),
700                Self::UnknownValue(u) => u.0.value(),
701            }
702        }
703
704        /// Gets the enum value as a string.
705        ///
706        /// Returns `None` if the enum contains an unknown value deserialized from
707        /// the integer representation of enums.
708        pub fn name(&self) -> std::option::Option<&str> {
709            match self {
710                Self::Unspecified => std::option::Option::Some("MIGRATION_SOURCE_TYPE_UNSPECIFIED"),
711                Self::Dms => std::option::Option::Some("DMS"),
712                Self::UnknownValue(u) => u.0.name(),
713            }
714        }
715    }
716
717    impl std::default::Default for MigrationSourceType {
718        fn default() -> Self {
719            use std::convert::From;
720            Self::from(0)
721        }
722    }
723
724    impl std::fmt::Display for MigrationSourceType {
725        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
726            wkt::internal::display_enum(f, self.name(), self.value())
727        }
728    }
729
730    impl std::convert::From<i32> for MigrationSourceType {
731        fn from(value: i32) -> Self {
732            match value {
733                0 => Self::Unspecified,
734                1 => Self::Dms,
735                _ => Self::UnknownValue(migration_source_type::UnknownValue(
736                    wkt::internal::UnknownEnumValue::Integer(value),
737                )),
738            }
739        }
740    }
741
742    impl std::convert::From<&str> for MigrationSourceType {
743        fn from(value: &str) -> Self {
744            use std::string::ToString;
745            match value {
746                "MIGRATION_SOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
747                "DMS" => Self::Dms,
748                _ => Self::UnknownValue(migration_source_type::UnknownValue(
749                    wkt::internal::UnknownEnumValue::String(value.to_string()),
750                )),
751            }
752        }
753    }
754
755    impl serde::ser::Serialize for MigrationSourceType {
756        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
757        where
758            S: serde::Serializer,
759        {
760            match self {
761                Self::Unspecified => serializer.serialize_i32(0),
762                Self::Dms => serializer.serialize_i32(1),
763                Self::UnknownValue(u) => u.0.serialize(serializer),
764            }
765        }
766    }
767
768    impl<'de> serde::de::Deserialize<'de> for MigrationSourceType {
769        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
770        where
771            D: serde::Deserializer<'de>,
772        {
773            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MigrationSourceType>::new(
774                ".google.cloud.alloydb.v1.MigrationSource.MigrationSourceType",
775            ))
776        }
777    }
778}
779
780/// EncryptionConfig describes the encryption config of a cluster or a backup
781/// that is encrypted with a CMEK (customer-managed encryption key).
782#[derive(Clone, Default, PartialEq)]
783#[non_exhaustive]
784pub struct EncryptionConfig {
785    /// The fully-qualified resource name of the KMS key.
786    /// Each Cloud KMS key is regionalized and has the following format:
787    /// projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
788    pub kms_key_name: std::string::String,
789
790    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
791}
792
793impl EncryptionConfig {
794    pub fn new() -> Self {
795        std::default::Default::default()
796    }
797
798    /// Sets the value of [kms_key_name][crate::model::EncryptionConfig::kms_key_name].
799    ///
800    /// # Example
801    /// ```ignore,no_run
802    /// # use google_cloud_alloydb_v1::model::EncryptionConfig;
803    /// let x = EncryptionConfig::new().set_kms_key_name("example");
804    /// ```
805    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
806        self.kms_key_name = v.into();
807        self
808    }
809}
810
811impl wkt::message::Message for EncryptionConfig {
812    fn typename() -> &'static str {
813        "type.googleapis.com/google.cloud.alloydb.v1.EncryptionConfig"
814    }
815}
816
817/// EncryptionInfo describes the encryption information of a cluster or a backup.
818#[derive(Clone, Default, PartialEq)]
819#[non_exhaustive]
820pub struct EncryptionInfo {
821    /// Output only. Type of encryption.
822    pub encryption_type: crate::model::encryption_info::Type,
823
824    /// Output only. Cloud KMS key versions that are being used to protect the
825    /// database or the backup.
826    pub kms_key_versions: std::vec::Vec<std::string::String>,
827
828    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
829}
830
831impl EncryptionInfo {
832    pub fn new() -> Self {
833        std::default::Default::default()
834    }
835
836    /// Sets the value of [encryption_type][crate::model::EncryptionInfo::encryption_type].
837    ///
838    /// # Example
839    /// ```ignore,no_run
840    /// # use google_cloud_alloydb_v1::model::EncryptionInfo;
841    /// use google_cloud_alloydb_v1::model::encryption_info::Type;
842    /// let x0 = EncryptionInfo::new().set_encryption_type(Type::GoogleDefaultEncryption);
843    /// let x1 = EncryptionInfo::new().set_encryption_type(Type::CustomerManagedEncryption);
844    /// ```
845    pub fn set_encryption_type<T: std::convert::Into<crate::model::encryption_info::Type>>(
846        mut self,
847        v: T,
848    ) -> Self {
849        self.encryption_type = v.into();
850        self
851    }
852
853    /// Sets the value of [kms_key_versions][crate::model::EncryptionInfo::kms_key_versions].
854    ///
855    /// # Example
856    /// ```ignore,no_run
857    /// # use google_cloud_alloydb_v1::model::EncryptionInfo;
858    /// let x = EncryptionInfo::new().set_kms_key_versions(["a", "b", "c"]);
859    /// ```
860    pub fn set_kms_key_versions<T, V>(mut self, v: T) -> Self
861    where
862        T: std::iter::IntoIterator<Item = V>,
863        V: std::convert::Into<std::string::String>,
864    {
865        use std::iter::Iterator;
866        self.kms_key_versions = v.into_iter().map(|i| i.into()).collect();
867        self
868    }
869}
870
871impl wkt::message::Message for EncryptionInfo {
872    fn typename() -> &'static str {
873        "type.googleapis.com/google.cloud.alloydb.v1.EncryptionInfo"
874    }
875}
876
877/// Defines additional types related to [EncryptionInfo].
878pub mod encryption_info {
879    #[allow(unused_imports)]
880    use super::*;
881
882    /// Possible encryption types.
883    ///
884    /// # Working with unknown values
885    ///
886    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
887    /// additional enum variants at any time. Adding new variants is not considered
888    /// a breaking change. Applications should write their code in anticipation of:
889    ///
890    /// - New values appearing in future releases of the client library, **and**
891    /// - New values received dynamically, without application changes.
892    ///
893    /// Please consult the [Working with enums] section in the user guide for some
894    /// guidelines.
895    ///
896    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
897    #[derive(Clone, Debug, PartialEq)]
898    #[non_exhaustive]
899    pub enum Type {
900        /// Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION.
901        Unspecified,
902        /// The data is encrypted at rest with a key that is fully managed by Google.
903        /// No key version will be populated. This is the default state.
904        GoogleDefaultEncryption,
905        /// The data is encrypted at rest with a key that is managed by the customer.
906        /// KMS key versions will be populated.
907        CustomerManagedEncryption,
908        /// If set, the enum was initialized with an unknown value.
909        ///
910        /// Applications can examine the value using [Type::value] or
911        /// [Type::name].
912        UnknownValue(r#type::UnknownValue),
913    }
914
915    #[doc(hidden)]
916    pub mod r#type {
917        #[allow(unused_imports)]
918        use super::*;
919        #[derive(Clone, Debug, PartialEq)]
920        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
921    }
922
923    impl Type {
924        /// Gets the enum value.
925        ///
926        /// Returns `None` if the enum contains an unknown value deserialized from
927        /// the string representation of enums.
928        pub fn value(&self) -> std::option::Option<i32> {
929            match self {
930                Self::Unspecified => std::option::Option::Some(0),
931                Self::GoogleDefaultEncryption => std::option::Option::Some(1),
932                Self::CustomerManagedEncryption => std::option::Option::Some(2),
933                Self::UnknownValue(u) => u.0.value(),
934            }
935        }
936
937        /// Gets the enum value as a string.
938        ///
939        /// Returns `None` if the enum contains an unknown value deserialized from
940        /// the integer representation of enums.
941        pub fn name(&self) -> std::option::Option<&str> {
942            match self {
943                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
944                Self::GoogleDefaultEncryption => {
945                    std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
946                }
947                Self::CustomerManagedEncryption => {
948                    std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
949                }
950                Self::UnknownValue(u) => u.0.name(),
951            }
952        }
953    }
954
955    impl std::default::Default for Type {
956        fn default() -> Self {
957            use std::convert::From;
958            Self::from(0)
959        }
960    }
961
962    impl std::fmt::Display for Type {
963        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
964            wkt::internal::display_enum(f, self.name(), self.value())
965        }
966    }
967
968    impl std::convert::From<i32> for Type {
969        fn from(value: i32) -> Self {
970            match value {
971                0 => Self::Unspecified,
972                1 => Self::GoogleDefaultEncryption,
973                2 => Self::CustomerManagedEncryption,
974                _ => Self::UnknownValue(r#type::UnknownValue(
975                    wkt::internal::UnknownEnumValue::Integer(value),
976                )),
977            }
978        }
979    }
980
981    impl std::convert::From<&str> for Type {
982        fn from(value: &str) -> Self {
983            use std::string::ToString;
984            match value {
985                "TYPE_UNSPECIFIED" => Self::Unspecified,
986                "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
987                "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
988                _ => Self::UnknownValue(r#type::UnknownValue(
989                    wkt::internal::UnknownEnumValue::String(value.to_string()),
990                )),
991            }
992        }
993    }
994
995    impl serde::ser::Serialize for Type {
996        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
997        where
998            S: serde::Serializer,
999        {
1000            match self {
1001                Self::Unspecified => serializer.serialize_i32(0),
1002                Self::GoogleDefaultEncryption => serializer.serialize_i32(1),
1003                Self::CustomerManagedEncryption => serializer.serialize_i32(2),
1004                Self::UnknownValue(u) => u.0.serialize(serializer),
1005            }
1006        }
1007    }
1008
1009    impl<'de> serde::de::Deserialize<'de> for Type {
1010        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1011        where
1012            D: serde::Deserializer<'de>,
1013        {
1014            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1015                ".google.cloud.alloydb.v1.EncryptionInfo.Type",
1016            ))
1017        }
1018    }
1019}
1020
1021/// SSL configuration.
1022#[derive(Clone, Default, PartialEq)]
1023#[non_exhaustive]
1024pub struct SslConfig {
1025    /// Optional. SSL mode. Specifies client-server SSL/TLS connection behavior.
1026    pub ssl_mode: crate::model::ssl_config::SslMode,
1027
1028    /// Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is
1029    /// supported currently, and is the default value.
1030    pub ca_source: crate::model::ssl_config::CaSource,
1031
1032    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1033}
1034
1035impl SslConfig {
1036    pub fn new() -> Self {
1037        std::default::Default::default()
1038    }
1039
1040    /// Sets the value of [ssl_mode][crate::model::SslConfig::ssl_mode].
1041    ///
1042    /// # Example
1043    /// ```ignore,no_run
1044    /// # use google_cloud_alloydb_v1::model::SslConfig;
1045    /// use google_cloud_alloydb_v1::model::ssl_config::SslMode;
1046    /// let x0 = SslConfig::new().set_ssl_mode(SslMode::AllowUnencryptedAndEncrypted);
1047    /// let x1 = SslConfig::new().set_ssl_mode(SslMode::EncryptedOnly);
1048    /// ```
1049    pub fn set_ssl_mode<T: std::convert::Into<crate::model::ssl_config::SslMode>>(
1050        mut self,
1051        v: T,
1052    ) -> Self {
1053        self.ssl_mode = v.into();
1054        self
1055    }
1056
1057    /// Sets the value of [ca_source][crate::model::SslConfig::ca_source].
1058    ///
1059    /// # Example
1060    /// ```ignore,no_run
1061    /// # use google_cloud_alloydb_v1::model::SslConfig;
1062    /// use google_cloud_alloydb_v1::model::ssl_config::CaSource;
1063    /// let x0 = SslConfig::new().set_ca_source(CaSource::Managed);
1064    /// ```
1065    pub fn set_ca_source<T: std::convert::Into<crate::model::ssl_config::CaSource>>(
1066        mut self,
1067        v: T,
1068    ) -> Self {
1069        self.ca_source = v.into();
1070        self
1071    }
1072}
1073
1074impl wkt::message::Message for SslConfig {
1075    fn typename() -> &'static str {
1076        "type.googleapis.com/google.cloud.alloydb.v1.SslConfig"
1077    }
1078}
1079
1080/// Defines additional types related to [SslConfig].
1081pub mod ssl_config {
1082    #[allow(unused_imports)]
1083    use super::*;
1084
1085    /// SSL mode options.
1086    ///
1087    /// # Working with unknown values
1088    ///
1089    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1090    /// additional enum variants at any time. Adding new variants is not considered
1091    /// a breaking change. Applications should write their code in anticipation of:
1092    ///
1093    /// - New values appearing in future releases of the client library, **and**
1094    /// - New values received dynamically, without application changes.
1095    ///
1096    /// Please consult the [Working with enums] section in the user guide for some
1097    /// guidelines.
1098    ///
1099    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1100    #[derive(Clone, Debug, PartialEq)]
1101    #[non_exhaustive]
1102    pub enum SslMode {
1103        /// SSL mode is not specified. Defaults to ENCRYPTED_ONLY.
1104        Unspecified,
1105        /// SSL connections are optional. CA verification not enforced.
1106        #[deprecated]
1107        Allow,
1108        /// SSL connections are required. CA verification not enforced.
1109        /// Clients may use locally self-signed certificates (default psql client
1110        /// behavior).
1111        #[deprecated]
1112        Require,
1113        /// SSL connections are required. CA verification enforced.
1114        /// Clients must have certificates signed by a Cluster CA, for example, using
1115        /// GenerateClientCertificate.
1116        #[deprecated]
1117        VerifyCa,
1118        /// SSL connections are optional. CA verification not enforced.
1119        AllowUnencryptedAndEncrypted,
1120        /// SSL connections are required. CA verification not enforced.
1121        EncryptedOnly,
1122        /// If set, the enum was initialized with an unknown value.
1123        ///
1124        /// Applications can examine the value using [SslMode::value] or
1125        /// [SslMode::name].
1126        UnknownValue(ssl_mode::UnknownValue),
1127    }
1128
1129    #[doc(hidden)]
1130    pub mod ssl_mode {
1131        #[allow(unused_imports)]
1132        use super::*;
1133        #[derive(Clone, Debug, PartialEq)]
1134        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1135    }
1136
1137    impl SslMode {
1138        /// Gets the enum value.
1139        ///
1140        /// Returns `None` if the enum contains an unknown value deserialized from
1141        /// the string representation of enums.
1142        pub fn value(&self) -> std::option::Option<i32> {
1143            match self {
1144                Self::Unspecified => std::option::Option::Some(0),
1145                Self::Allow => std::option::Option::Some(1),
1146                Self::Require => std::option::Option::Some(2),
1147                Self::VerifyCa => std::option::Option::Some(3),
1148                Self::AllowUnencryptedAndEncrypted => std::option::Option::Some(4),
1149                Self::EncryptedOnly => std::option::Option::Some(5),
1150                Self::UnknownValue(u) => u.0.value(),
1151            }
1152        }
1153
1154        /// Gets the enum value as a string.
1155        ///
1156        /// Returns `None` if the enum contains an unknown value deserialized from
1157        /// the integer representation of enums.
1158        pub fn name(&self) -> std::option::Option<&str> {
1159            match self {
1160                Self::Unspecified => std::option::Option::Some("SSL_MODE_UNSPECIFIED"),
1161                Self::Allow => std::option::Option::Some("SSL_MODE_ALLOW"),
1162                Self::Require => std::option::Option::Some("SSL_MODE_REQUIRE"),
1163                Self::VerifyCa => std::option::Option::Some("SSL_MODE_VERIFY_CA"),
1164                Self::AllowUnencryptedAndEncrypted => {
1165                    std::option::Option::Some("ALLOW_UNENCRYPTED_AND_ENCRYPTED")
1166                }
1167                Self::EncryptedOnly => std::option::Option::Some("ENCRYPTED_ONLY"),
1168                Self::UnknownValue(u) => u.0.name(),
1169            }
1170        }
1171    }
1172
1173    impl std::default::Default for SslMode {
1174        fn default() -> Self {
1175            use std::convert::From;
1176            Self::from(0)
1177        }
1178    }
1179
1180    impl std::fmt::Display for SslMode {
1181        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1182            wkt::internal::display_enum(f, self.name(), self.value())
1183        }
1184    }
1185
1186    impl std::convert::From<i32> for SslMode {
1187        fn from(value: i32) -> Self {
1188            match value {
1189                0 => Self::Unspecified,
1190                1 => Self::Allow,
1191                2 => Self::Require,
1192                3 => Self::VerifyCa,
1193                4 => Self::AllowUnencryptedAndEncrypted,
1194                5 => Self::EncryptedOnly,
1195                _ => Self::UnknownValue(ssl_mode::UnknownValue(
1196                    wkt::internal::UnknownEnumValue::Integer(value),
1197                )),
1198            }
1199        }
1200    }
1201
1202    impl std::convert::From<&str> for SslMode {
1203        fn from(value: &str) -> Self {
1204            use std::string::ToString;
1205            match value {
1206                "SSL_MODE_UNSPECIFIED" => Self::Unspecified,
1207                "SSL_MODE_ALLOW" => Self::Allow,
1208                "SSL_MODE_REQUIRE" => Self::Require,
1209                "SSL_MODE_VERIFY_CA" => Self::VerifyCa,
1210                "ALLOW_UNENCRYPTED_AND_ENCRYPTED" => Self::AllowUnencryptedAndEncrypted,
1211                "ENCRYPTED_ONLY" => Self::EncryptedOnly,
1212                _ => Self::UnknownValue(ssl_mode::UnknownValue(
1213                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1214                )),
1215            }
1216        }
1217    }
1218
1219    impl serde::ser::Serialize for SslMode {
1220        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1221        where
1222            S: serde::Serializer,
1223        {
1224            match self {
1225                Self::Unspecified => serializer.serialize_i32(0),
1226                Self::Allow => serializer.serialize_i32(1),
1227                Self::Require => serializer.serialize_i32(2),
1228                Self::VerifyCa => serializer.serialize_i32(3),
1229                Self::AllowUnencryptedAndEncrypted => serializer.serialize_i32(4),
1230                Self::EncryptedOnly => serializer.serialize_i32(5),
1231                Self::UnknownValue(u) => u.0.serialize(serializer),
1232            }
1233        }
1234    }
1235
1236    impl<'de> serde::de::Deserialize<'de> for SslMode {
1237        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1238        where
1239            D: serde::Deserializer<'de>,
1240        {
1241            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SslMode>::new(
1242                ".google.cloud.alloydb.v1.SslConfig.SslMode",
1243            ))
1244        }
1245    }
1246
1247    /// Certificate Authority (CA) source for SSL/TLS certificates.
1248    ///
1249    /// # Working with unknown values
1250    ///
1251    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1252    /// additional enum variants at any time. Adding new variants is not considered
1253    /// a breaking change. Applications should write their code in anticipation of:
1254    ///
1255    /// - New values appearing in future releases of the client library, **and**
1256    /// - New values received dynamically, without application changes.
1257    ///
1258    /// Please consult the [Working with enums] section in the user guide for some
1259    /// guidelines.
1260    ///
1261    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1262    #[derive(Clone, Debug, PartialEq)]
1263    #[non_exhaustive]
1264    pub enum CaSource {
1265        /// Certificate Authority (CA) source not specified. Defaults to
1266        /// CA_SOURCE_MANAGED.
1267        Unspecified,
1268        /// Certificate Authority (CA) managed by the AlloyDB Cluster.
1269        Managed,
1270        /// If set, the enum was initialized with an unknown value.
1271        ///
1272        /// Applications can examine the value using [CaSource::value] or
1273        /// [CaSource::name].
1274        UnknownValue(ca_source::UnknownValue),
1275    }
1276
1277    #[doc(hidden)]
1278    pub mod ca_source {
1279        #[allow(unused_imports)]
1280        use super::*;
1281        #[derive(Clone, Debug, PartialEq)]
1282        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1283    }
1284
1285    impl CaSource {
1286        /// Gets the enum value.
1287        ///
1288        /// Returns `None` if the enum contains an unknown value deserialized from
1289        /// the string representation of enums.
1290        pub fn value(&self) -> std::option::Option<i32> {
1291            match self {
1292                Self::Unspecified => std::option::Option::Some(0),
1293                Self::Managed => std::option::Option::Some(1),
1294                Self::UnknownValue(u) => u.0.value(),
1295            }
1296        }
1297
1298        /// Gets the enum value as a string.
1299        ///
1300        /// Returns `None` if the enum contains an unknown value deserialized from
1301        /// the integer representation of enums.
1302        pub fn name(&self) -> std::option::Option<&str> {
1303            match self {
1304                Self::Unspecified => std::option::Option::Some("CA_SOURCE_UNSPECIFIED"),
1305                Self::Managed => std::option::Option::Some("CA_SOURCE_MANAGED"),
1306                Self::UnknownValue(u) => u.0.name(),
1307            }
1308        }
1309    }
1310
1311    impl std::default::Default for CaSource {
1312        fn default() -> Self {
1313            use std::convert::From;
1314            Self::from(0)
1315        }
1316    }
1317
1318    impl std::fmt::Display for CaSource {
1319        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1320            wkt::internal::display_enum(f, self.name(), self.value())
1321        }
1322    }
1323
1324    impl std::convert::From<i32> for CaSource {
1325        fn from(value: i32) -> Self {
1326            match value {
1327                0 => Self::Unspecified,
1328                1 => Self::Managed,
1329                _ => Self::UnknownValue(ca_source::UnknownValue(
1330                    wkt::internal::UnknownEnumValue::Integer(value),
1331                )),
1332            }
1333        }
1334    }
1335
1336    impl std::convert::From<&str> for CaSource {
1337        fn from(value: &str) -> Self {
1338            use std::string::ToString;
1339            match value {
1340                "CA_SOURCE_UNSPECIFIED" => Self::Unspecified,
1341                "CA_SOURCE_MANAGED" => Self::Managed,
1342                _ => Self::UnknownValue(ca_source::UnknownValue(
1343                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1344                )),
1345            }
1346        }
1347    }
1348
1349    impl serde::ser::Serialize for CaSource {
1350        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1351        where
1352            S: serde::Serializer,
1353        {
1354            match self {
1355                Self::Unspecified => serializer.serialize_i32(0),
1356                Self::Managed => serializer.serialize_i32(1),
1357                Self::UnknownValue(u) => u.0.serialize(serializer),
1358            }
1359        }
1360    }
1361
1362    impl<'de> serde::de::Deserialize<'de> for CaSource {
1363        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1364        where
1365            D: serde::Deserializer<'de>,
1366        {
1367            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CaSource>::new(
1368                ".google.cloud.alloydb.v1.SslConfig.CaSource",
1369            ))
1370        }
1371    }
1372}
1373
1374/// Message describing the user-specified automated backup policy.
1375///
1376/// All fields in the automated backup policy are optional. Defaults for each
1377/// field are provided if they are not set.
1378#[derive(Clone, Default, PartialEq)]
1379#[non_exhaustive]
1380pub struct AutomatedBackupPolicy {
1381    /// Whether automated automated backups are enabled. If not set, defaults to
1382    /// true.
1383    pub enabled: std::option::Option<bool>,
1384
1385    /// The length of the time window during which a backup can be
1386    /// taken. If a backup does not succeed within this time window, it will be
1387    /// canceled and considered failed.
1388    ///
1389    /// The backup window must be at least 5 minutes long. There is no upper bound
1390    /// on the window. If not set, it defaults to 1 hour.
1391    pub backup_window: std::option::Option<wkt::Duration>,
1392
1393    /// Optional. The encryption config can be specified to encrypt the
1394    /// backups with a customer-managed encryption key (CMEK). When this field is
1395    /// not specified, the backup will use the cluster's encryption config.
1396    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
1397
1398    /// The location where the backup will be stored. Currently, the only supported
1399    /// option is to store the backup in the same region as the cluster.
1400    ///
1401    /// If empty, defaults to the region of the cluster.
1402    pub location: std::string::String,
1403
1404    /// Labels to apply to backups created using this configuration.
1405    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1406
1407    /// The schedule for this automated backup policy.
1408    ///
1409    /// A schedule specifies times at which to start a backup. If a backup
1410    /// window is also provided, the backup is guaranteed to be started and
1411    /// completed within the start time plus the backup window. If the backup is
1412    /// not completed within the backup window it is marked as failed.
1413    ///
1414    /// If not set, the schedule defaults to a weekly schedule with one backup
1415    /// per day and a start time chosen arbitrarily.
1416    pub schedule: std::option::Option<crate::model::automated_backup_policy::Schedule>,
1417
1418    /// The retention policy for automated backups.
1419    ///
1420    /// The retention policy for a backup is fixed at the time the backup is
1421    /// created. Changes to this field only apply to new backups taken with the
1422    /// policy; the retentions of existing backups remain unchanged.
1423    ///
1424    /// If no retention policy is set, a default of 14 days is used.
1425    pub retention: std::option::Option<crate::model::automated_backup_policy::Retention>,
1426
1427    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1428}
1429
1430impl AutomatedBackupPolicy {
1431    pub fn new() -> Self {
1432        std::default::Default::default()
1433    }
1434
1435    /// Sets the value of [enabled][crate::model::AutomatedBackupPolicy::enabled].
1436    ///
1437    /// # Example
1438    /// ```ignore,no_run
1439    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1440    /// let x = AutomatedBackupPolicy::new().set_enabled(true);
1441    /// ```
1442    pub fn set_enabled<T>(mut self, v: T) -> Self
1443    where
1444        T: std::convert::Into<bool>,
1445    {
1446        self.enabled = std::option::Option::Some(v.into());
1447        self
1448    }
1449
1450    /// Sets or clears the value of [enabled][crate::model::AutomatedBackupPolicy::enabled].
1451    ///
1452    /// # Example
1453    /// ```ignore,no_run
1454    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1455    /// let x = AutomatedBackupPolicy::new().set_or_clear_enabled(Some(false));
1456    /// let x = AutomatedBackupPolicy::new().set_or_clear_enabled(None::<bool>);
1457    /// ```
1458    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
1459    where
1460        T: std::convert::Into<bool>,
1461    {
1462        self.enabled = v.map(|x| x.into());
1463        self
1464    }
1465
1466    /// Sets the value of [backup_window][crate::model::AutomatedBackupPolicy::backup_window].
1467    ///
1468    /// # Example
1469    /// ```ignore,no_run
1470    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1471    /// use wkt::Duration;
1472    /// let x = AutomatedBackupPolicy::new().set_backup_window(Duration::default()/* use setters */);
1473    /// ```
1474    pub fn set_backup_window<T>(mut self, v: T) -> Self
1475    where
1476        T: std::convert::Into<wkt::Duration>,
1477    {
1478        self.backup_window = std::option::Option::Some(v.into());
1479        self
1480    }
1481
1482    /// Sets or clears the value of [backup_window][crate::model::AutomatedBackupPolicy::backup_window].
1483    ///
1484    /// # Example
1485    /// ```ignore,no_run
1486    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1487    /// use wkt::Duration;
1488    /// let x = AutomatedBackupPolicy::new().set_or_clear_backup_window(Some(Duration::default()/* use setters */));
1489    /// let x = AutomatedBackupPolicy::new().set_or_clear_backup_window(None::<Duration>);
1490    /// ```
1491    pub fn set_or_clear_backup_window<T>(mut self, v: std::option::Option<T>) -> Self
1492    where
1493        T: std::convert::Into<wkt::Duration>,
1494    {
1495        self.backup_window = v.map(|x| x.into());
1496        self
1497    }
1498
1499    /// Sets the value of [encryption_config][crate::model::AutomatedBackupPolicy::encryption_config].
1500    ///
1501    /// # Example
1502    /// ```ignore,no_run
1503    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1504    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
1505    /// let x = AutomatedBackupPolicy::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
1506    /// ```
1507    pub fn set_encryption_config<T>(mut self, v: T) -> Self
1508    where
1509        T: std::convert::Into<crate::model::EncryptionConfig>,
1510    {
1511        self.encryption_config = std::option::Option::Some(v.into());
1512        self
1513    }
1514
1515    /// Sets or clears the value of [encryption_config][crate::model::AutomatedBackupPolicy::encryption_config].
1516    ///
1517    /// # Example
1518    /// ```ignore,no_run
1519    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1520    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
1521    /// let x = AutomatedBackupPolicy::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
1522    /// let x = AutomatedBackupPolicy::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
1523    /// ```
1524    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
1525    where
1526        T: std::convert::Into<crate::model::EncryptionConfig>,
1527    {
1528        self.encryption_config = v.map(|x| x.into());
1529        self
1530    }
1531
1532    /// Sets the value of [location][crate::model::AutomatedBackupPolicy::location].
1533    ///
1534    /// # Example
1535    /// ```ignore,no_run
1536    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1537    /// let x = AutomatedBackupPolicy::new().set_location("example");
1538    /// ```
1539    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1540        self.location = v.into();
1541        self
1542    }
1543
1544    /// Sets the value of [labels][crate::model::AutomatedBackupPolicy::labels].
1545    ///
1546    /// # Example
1547    /// ```ignore,no_run
1548    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1549    /// let x = AutomatedBackupPolicy::new().set_labels([
1550    ///     ("key0", "abc"),
1551    ///     ("key1", "xyz"),
1552    /// ]);
1553    /// ```
1554    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1555    where
1556        T: std::iter::IntoIterator<Item = (K, V)>,
1557        K: std::convert::Into<std::string::String>,
1558        V: std::convert::Into<std::string::String>,
1559    {
1560        use std::iter::Iterator;
1561        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1562        self
1563    }
1564
1565    /// Sets the value of [schedule][crate::model::AutomatedBackupPolicy::schedule].
1566    ///
1567    /// Note that all the setters affecting `schedule` are mutually
1568    /// exclusive.
1569    ///
1570    /// # Example
1571    /// ```ignore,no_run
1572    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1573    /// use google_cloud_alloydb_v1::model::automated_backup_policy::WeeklySchedule;
1574    /// let x = AutomatedBackupPolicy::new().set_schedule(Some(
1575    ///     google_cloud_alloydb_v1::model::automated_backup_policy::Schedule::WeeklySchedule(WeeklySchedule::default().into())));
1576    /// ```
1577    pub fn set_schedule<
1578        T: std::convert::Into<std::option::Option<crate::model::automated_backup_policy::Schedule>>,
1579    >(
1580        mut self,
1581        v: T,
1582    ) -> Self {
1583        self.schedule = v.into();
1584        self
1585    }
1586
1587    /// The value of [schedule][crate::model::AutomatedBackupPolicy::schedule]
1588    /// if it holds a `WeeklySchedule`, `None` if the field is not set or
1589    /// holds a different branch.
1590    pub fn weekly_schedule(
1591        &self,
1592    ) -> std::option::Option<&std::boxed::Box<crate::model::automated_backup_policy::WeeklySchedule>>
1593    {
1594        #[allow(unreachable_patterns)]
1595        self.schedule.as_ref().and_then(|v| match v {
1596            crate::model::automated_backup_policy::Schedule::WeeklySchedule(v) => {
1597                std::option::Option::Some(v)
1598            }
1599            _ => std::option::Option::None,
1600        })
1601    }
1602
1603    /// Sets the value of [schedule][crate::model::AutomatedBackupPolicy::schedule]
1604    /// to hold a `WeeklySchedule`.
1605    ///
1606    /// Note that all the setters affecting `schedule` are
1607    /// mutually exclusive.
1608    ///
1609    /// # Example
1610    /// ```ignore,no_run
1611    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1612    /// use google_cloud_alloydb_v1::model::automated_backup_policy::WeeklySchedule;
1613    /// let x = AutomatedBackupPolicy::new().set_weekly_schedule(WeeklySchedule::default()/* use setters */);
1614    /// assert!(x.weekly_schedule().is_some());
1615    /// ```
1616    pub fn set_weekly_schedule<
1617        T: std::convert::Into<std::boxed::Box<crate::model::automated_backup_policy::WeeklySchedule>>,
1618    >(
1619        mut self,
1620        v: T,
1621    ) -> Self {
1622        self.schedule = std::option::Option::Some(
1623            crate::model::automated_backup_policy::Schedule::WeeklySchedule(v.into()),
1624        );
1625        self
1626    }
1627
1628    /// Sets the value of [retention][crate::model::AutomatedBackupPolicy::retention].
1629    ///
1630    /// Note that all the setters affecting `retention` are mutually
1631    /// exclusive.
1632    ///
1633    /// # Example
1634    /// ```ignore,no_run
1635    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1636    /// use google_cloud_alloydb_v1::model::automated_backup_policy::TimeBasedRetention;
1637    /// let x = AutomatedBackupPolicy::new().set_retention(Some(
1638    ///     google_cloud_alloydb_v1::model::automated_backup_policy::Retention::TimeBasedRetention(TimeBasedRetention::default().into())));
1639    /// ```
1640    pub fn set_retention<
1641        T: std::convert::Into<std::option::Option<crate::model::automated_backup_policy::Retention>>,
1642    >(
1643        mut self,
1644        v: T,
1645    ) -> Self {
1646        self.retention = v.into();
1647        self
1648    }
1649
1650    /// The value of [retention][crate::model::AutomatedBackupPolicy::retention]
1651    /// if it holds a `TimeBasedRetention`, `None` if the field is not set or
1652    /// holds a different branch.
1653    pub fn time_based_retention(
1654        &self,
1655    ) -> std::option::Option<
1656        &std::boxed::Box<crate::model::automated_backup_policy::TimeBasedRetention>,
1657    > {
1658        #[allow(unreachable_patterns)]
1659        self.retention.as_ref().and_then(|v| match v {
1660            crate::model::automated_backup_policy::Retention::TimeBasedRetention(v) => {
1661                std::option::Option::Some(v)
1662            }
1663            _ => std::option::Option::None,
1664        })
1665    }
1666
1667    /// Sets the value of [retention][crate::model::AutomatedBackupPolicy::retention]
1668    /// to hold a `TimeBasedRetention`.
1669    ///
1670    /// Note that all the setters affecting `retention` are
1671    /// mutually exclusive.
1672    ///
1673    /// # Example
1674    /// ```ignore,no_run
1675    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1676    /// use google_cloud_alloydb_v1::model::automated_backup_policy::TimeBasedRetention;
1677    /// let x = AutomatedBackupPolicy::new().set_time_based_retention(TimeBasedRetention::default()/* use setters */);
1678    /// assert!(x.time_based_retention().is_some());
1679    /// assert!(x.quantity_based_retention().is_none());
1680    /// ```
1681    pub fn set_time_based_retention<
1682        T: std::convert::Into<
1683                std::boxed::Box<crate::model::automated_backup_policy::TimeBasedRetention>,
1684            >,
1685    >(
1686        mut self,
1687        v: T,
1688    ) -> Self {
1689        self.retention = std::option::Option::Some(
1690            crate::model::automated_backup_policy::Retention::TimeBasedRetention(v.into()),
1691        );
1692        self
1693    }
1694
1695    /// The value of [retention][crate::model::AutomatedBackupPolicy::retention]
1696    /// if it holds a `QuantityBasedRetention`, `None` if the field is not set or
1697    /// holds a different branch.
1698    pub fn quantity_based_retention(
1699        &self,
1700    ) -> std::option::Option<
1701        &std::boxed::Box<crate::model::automated_backup_policy::QuantityBasedRetention>,
1702    > {
1703        #[allow(unreachable_patterns)]
1704        self.retention.as_ref().and_then(|v| match v {
1705            crate::model::automated_backup_policy::Retention::QuantityBasedRetention(v) => {
1706                std::option::Option::Some(v)
1707            }
1708            _ => std::option::Option::None,
1709        })
1710    }
1711
1712    /// Sets the value of [retention][crate::model::AutomatedBackupPolicy::retention]
1713    /// to hold a `QuantityBasedRetention`.
1714    ///
1715    /// Note that all the setters affecting `retention` are
1716    /// mutually exclusive.
1717    ///
1718    /// # Example
1719    /// ```ignore,no_run
1720    /// # use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
1721    /// use google_cloud_alloydb_v1::model::automated_backup_policy::QuantityBasedRetention;
1722    /// let x = AutomatedBackupPolicy::new().set_quantity_based_retention(QuantityBasedRetention::default()/* use setters */);
1723    /// assert!(x.quantity_based_retention().is_some());
1724    /// assert!(x.time_based_retention().is_none());
1725    /// ```
1726    pub fn set_quantity_based_retention<
1727        T: std::convert::Into<
1728                std::boxed::Box<crate::model::automated_backup_policy::QuantityBasedRetention>,
1729            >,
1730    >(
1731        mut self,
1732        v: T,
1733    ) -> Self {
1734        self.retention = std::option::Option::Some(
1735            crate::model::automated_backup_policy::Retention::QuantityBasedRetention(v.into()),
1736        );
1737        self
1738    }
1739}
1740
1741impl wkt::message::Message for AutomatedBackupPolicy {
1742    fn typename() -> &'static str {
1743        "type.googleapis.com/google.cloud.alloydb.v1.AutomatedBackupPolicy"
1744    }
1745}
1746
1747/// Defines additional types related to [AutomatedBackupPolicy].
1748pub mod automated_backup_policy {
1749    #[allow(unused_imports)]
1750    use super::*;
1751
1752    /// A weekly schedule starts a backup at prescribed start times within a
1753    /// day, for the specified days of the week.
1754    ///
1755    /// The weekly schedule message is flexible and can be used to create many
1756    /// types of schedules. For example, to have a daily backup that starts at
1757    /// 22:00, configure the `start_times` field to have one element "22:00" and
1758    /// the `days_of_week` field to have all seven days of the week.
1759    #[derive(Clone, Default, PartialEq)]
1760    #[non_exhaustive]
1761    pub struct WeeklySchedule {
1762        /// The times during the day to start a backup. The start times are assumed
1763        /// to be in UTC and to be an exact hour (e.g., 04:00:00).
1764        ///
1765        /// If no start times are provided, a single fixed start time is chosen
1766        /// arbitrarily.
1767        pub start_times: std::vec::Vec<google_cloud_type::model::TimeOfDay>,
1768
1769        /// The days of the week to perform a backup.
1770        ///
1771        /// If this field is left empty, the default of every day of the week is
1772        /// used.
1773        pub days_of_week: std::vec::Vec<google_cloud_type::model::DayOfWeek>,
1774
1775        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1776    }
1777
1778    impl WeeklySchedule {
1779        pub fn new() -> Self {
1780            std::default::Default::default()
1781        }
1782
1783        /// Sets the value of [start_times][crate::model::automated_backup_policy::WeeklySchedule::start_times].
1784        ///
1785        /// # Example
1786        /// ```ignore,no_run
1787        /// # use google_cloud_alloydb_v1::model::automated_backup_policy::WeeklySchedule;
1788        /// use google_cloud_type::model::TimeOfDay;
1789        /// let x = WeeklySchedule::new()
1790        ///     .set_start_times([
1791        ///         TimeOfDay::default()/* use setters */,
1792        ///         TimeOfDay::default()/* use (different) setters */,
1793        ///     ]);
1794        /// ```
1795        pub fn set_start_times<T, V>(mut self, v: T) -> Self
1796        where
1797            T: std::iter::IntoIterator<Item = V>,
1798            V: std::convert::Into<google_cloud_type::model::TimeOfDay>,
1799        {
1800            use std::iter::Iterator;
1801            self.start_times = v.into_iter().map(|i| i.into()).collect();
1802            self
1803        }
1804
1805        /// Sets the value of [days_of_week][crate::model::automated_backup_policy::WeeklySchedule::days_of_week].
1806        ///
1807        /// # Example
1808        /// ```ignore,no_run
1809        /// # use google_cloud_alloydb_v1::model::automated_backup_policy::WeeklySchedule;
1810        /// use google_cloud_type::model::DayOfWeek;
1811        /// let x = WeeklySchedule::new().set_days_of_week([
1812        ///     DayOfWeek::Monday,
1813        ///     DayOfWeek::Tuesday,
1814        ///     DayOfWeek::Wednesday,
1815        /// ]);
1816        /// ```
1817        pub fn set_days_of_week<T, V>(mut self, v: T) -> Self
1818        where
1819            T: std::iter::IntoIterator<Item = V>,
1820            V: std::convert::Into<google_cloud_type::model::DayOfWeek>,
1821        {
1822            use std::iter::Iterator;
1823            self.days_of_week = v.into_iter().map(|i| i.into()).collect();
1824            self
1825        }
1826    }
1827
1828    impl wkt::message::Message for WeeklySchedule {
1829        fn typename() -> &'static str {
1830            "type.googleapis.com/google.cloud.alloydb.v1.AutomatedBackupPolicy.WeeklySchedule"
1831        }
1832    }
1833
1834    /// A time based retention policy specifies that all backups within a certain
1835    /// time period should be retained.
1836    #[derive(Clone, Default, PartialEq)]
1837    #[non_exhaustive]
1838    pub struct TimeBasedRetention {
1839        /// The retention period.
1840        pub retention_period: std::option::Option<wkt::Duration>,
1841
1842        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1843    }
1844
1845    impl TimeBasedRetention {
1846        pub fn new() -> Self {
1847            std::default::Default::default()
1848        }
1849
1850        /// Sets the value of [retention_period][crate::model::automated_backup_policy::TimeBasedRetention::retention_period].
1851        ///
1852        /// # Example
1853        /// ```ignore,no_run
1854        /// # use google_cloud_alloydb_v1::model::automated_backup_policy::TimeBasedRetention;
1855        /// use wkt::Duration;
1856        /// let x = TimeBasedRetention::new().set_retention_period(Duration::default()/* use setters */);
1857        /// ```
1858        pub fn set_retention_period<T>(mut self, v: T) -> Self
1859        where
1860            T: std::convert::Into<wkt::Duration>,
1861        {
1862            self.retention_period = std::option::Option::Some(v.into());
1863            self
1864        }
1865
1866        /// Sets or clears the value of [retention_period][crate::model::automated_backup_policy::TimeBasedRetention::retention_period].
1867        ///
1868        /// # Example
1869        /// ```ignore,no_run
1870        /// # use google_cloud_alloydb_v1::model::automated_backup_policy::TimeBasedRetention;
1871        /// use wkt::Duration;
1872        /// let x = TimeBasedRetention::new().set_or_clear_retention_period(Some(Duration::default()/* use setters */));
1873        /// let x = TimeBasedRetention::new().set_or_clear_retention_period(None::<Duration>);
1874        /// ```
1875        pub fn set_or_clear_retention_period<T>(mut self, v: std::option::Option<T>) -> Self
1876        where
1877            T: std::convert::Into<wkt::Duration>,
1878        {
1879            self.retention_period = v.map(|x| x.into());
1880            self
1881        }
1882    }
1883
1884    impl wkt::message::Message for TimeBasedRetention {
1885        fn typename() -> &'static str {
1886            "type.googleapis.com/google.cloud.alloydb.v1.AutomatedBackupPolicy.TimeBasedRetention"
1887        }
1888    }
1889
1890    /// A quantity based policy specifies that a certain number of the most recent
1891    /// successful backups should be retained.
1892    #[derive(Clone, Default, PartialEq)]
1893    #[non_exhaustive]
1894    pub struct QuantityBasedRetention {
1895        /// The number of backups to retain.
1896        pub count: i32,
1897
1898        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1899    }
1900
1901    impl QuantityBasedRetention {
1902        pub fn new() -> Self {
1903            std::default::Default::default()
1904        }
1905
1906        /// Sets the value of [count][crate::model::automated_backup_policy::QuantityBasedRetention::count].
1907        ///
1908        /// # Example
1909        /// ```ignore,no_run
1910        /// # use google_cloud_alloydb_v1::model::automated_backup_policy::QuantityBasedRetention;
1911        /// let x = QuantityBasedRetention::new().set_count(42);
1912        /// ```
1913        pub fn set_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1914            self.count = v.into();
1915            self
1916        }
1917    }
1918
1919    impl wkt::message::Message for QuantityBasedRetention {
1920        fn typename() -> &'static str {
1921            "type.googleapis.com/google.cloud.alloydb.v1.AutomatedBackupPolicy.QuantityBasedRetention"
1922        }
1923    }
1924
1925    /// The schedule for this automated backup policy.
1926    ///
1927    /// A schedule specifies times at which to start a backup. If a backup
1928    /// window is also provided, the backup is guaranteed to be started and
1929    /// completed within the start time plus the backup window. If the backup is
1930    /// not completed within the backup window it is marked as failed.
1931    ///
1932    /// If not set, the schedule defaults to a weekly schedule with one backup
1933    /// per day and a start time chosen arbitrarily.
1934    #[derive(Clone, Debug, PartialEq)]
1935    #[non_exhaustive]
1936    pub enum Schedule {
1937        /// Weekly schedule for the Backup.
1938        WeeklySchedule(std::boxed::Box<crate::model::automated_backup_policy::WeeklySchedule>),
1939    }
1940
1941    /// The retention policy for automated backups.
1942    ///
1943    /// The retention policy for a backup is fixed at the time the backup is
1944    /// created. Changes to this field only apply to new backups taken with the
1945    /// policy; the retentions of existing backups remain unchanged.
1946    ///
1947    /// If no retention policy is set, a default of 14 days is used.
1948    #[derive(Clone, Debug, PartialEq)]
1949    #[non_exhaustive]
1950    pub enum Retention {
1951        /// Time-based Backup retention policy.
1952        TimeBasedRetention(
1953            std::boxed::Box<crate::model::automated_backup_policy::TimeBasedRetention>,
1954        ),
1955        /// Quantity-based Backup retention policy to retain recent backups.
1956        QuantityBasedRetention(
1957            std::boxed::Box<crate::model::automated_backup_policy::QuantityBasedRetention>,
1958        ),
1959    }
1960}
1961
1962/// ContinuousBackupConfig describes the continuous backups recovery
1963/// configurations of a cluster.
1964#[derive(Clone, Default, PartialEq)]
1965#[non_exhaustive]
1966pub struct ContinuousBackupConfig {
1967    /// Whether ContinuousBackup is enabled.
1968    pub enabled: std::option::Option<bool>,
1969
1970    /// The number of days that are eligible to restore from using PITR. To support
1971    /// the entire recovery window, backups and logs are retained for one day more
1972    /// than the recovery window. If not set, defaults to 14 days.
1973    pub recovery_window_days: i32,
1974
1975    /// The encryption config can be specified to encrypt the
1976    /// backups with a customer-managed encryption key (CMEK). When this field is
1977    /// not specified, the backup will use the cluster's encryption config.
1978    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
1979
1980    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1981}
1982
1983impl ContinuousBackupConfig {
1984    pub fn new() -> Self {
1985        std::default::Default::default()
1986    }
1987
1988    /// Sets the value of [enabled][crate::model::ContinuousBackupConfig::enabled].
1989    ///
1990    /// # Example
1991    /// ```ignore,no_run
1992    /// # use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
1993    /// let x = ContinuousBackupConfig::new().set_enabled(true);
1994    /// ```
1995    pub fn set_enabled<T>(mut self, v: T) -> Self
1996    where
1997        T: std::convert::Into<bool>,
1998    {
1999        self.enabled = std::option::Option::Some(v.into());
2000        self
2001    }
2002
2003    /// Sets or clears the value of [enabled][crate::model::ContinuousBackupConfig::enabled].
2004    ///
2005    /// # Example
2006    /// ```ignore,no_run
2007    /// # use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
2008    /// let x = ContinuousBackupConfig::new().set_or_clear_enabled(Some(false));
2009    /// let x = ContinuousBackupConfig::new().set_or_clear_enabled(None::<bool>);
2010    /// ```
2011    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
2012    where
2013        T: std::convert::Into<bool>,
2014    {
2015        self.enabled = v.map(|x| x.into());
2016        self
2017    }
2018
2019    /// Sets the value of [recovery_window_days][crate::model::ContinuousBackupConfig::recovery_window_days].
2020    ///
2021    /// # Example
2022    /// ```ignore,no_run
2023    /// # use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
2024    /// let x = ContinuousBackupConfig::new().set_recovery_window_days(42);
2025    /// ```
2026    pub fn set_recovery_window_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2027        self.recovery_window_days = v.into();
2028        self
2029    }
2030
2031    /// Sets the value of [encryption_config][crate::model::ContinuousBackupConfig::encryption_config].
2032    ///
2033    /// # Example
2034    /// ```ignore,no_run
2035    /// # use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
2036    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
2037    /// let x = ContinuousBackupConfig::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
2038    /// ```
2039    pub fn set_encryption_config<T>(mut self, v: T) -> Self
2040    where
2041        T: std::convert::Into<crate::model::EncryptionConfig>,
2042    {
2043        self.encryption_config = std::option::Option::Some(v.into());
2044        self
2045    }
2046
2047    /// Sets or clears the value of [encryption_config][crate::model::ContinuousBackupConfig::encryption_config].
2048    ///
2049    /// # Example
2050    /// ```ignore,no_run
2051    /// # use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
2052    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
2053    /// let x = ContinuousBackupConfig::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
2054    /// let x = ContinuousBackupConfig::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
2055    /// ```
2056    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
2057    where
2058        T: std::convert::Into<crate::model::EncryptionConfig>,
2059    {
2060        self.encryption_config = v.map(|x| x.into());
2061        self
2062    }
2063}
2064
2065impl wkt::message::Message for ContinuousBackupConfig {
2066    fn typename() -> &'static str {
2067        "type.googleapis.com/google.cloud.alloydb.v1.ContinuousBackupConfig"
2068    }
2069}
2070
2071/// ContinuousBackupInfo describes the continuous backup properties of a
2072/// cluster.
2073#[derive(Clone, Default, PartialEq)]
2074#[non_exhaustive]
2075pub struct ContinuousBackupInfo {
2076    /// Output only. The encryption information for the WALs and backups required
2077    /// for ContinuousBackup.
2078    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
2079
2080    /// Output only. When ContinuousBackup was most recently enabled. Set to null
2081    /// if ContinuousBackup is not enabled.
2082    pub enabled_time: std::option::Option<wkt::Timestamp>,
2083
2084    /// Output only. Days of the week on which a continuous backup is taken.
2085    pub schedule: std::vec::Vec<google_cloud_type::model::DayOfWeek>,
2086
2087    /// Output only. The earliest restorable time that can be restored to. If
2088    /// continuous backups and recovery was recently enabled, the earliest
2089    /// restorable time is the creation time of the earliest eligible backup within
2090    /// this cluster's continuous backup recovery window. After a cluster has had
2091    /// continuous backups enabled for the duration of its recovery window, the
2092    /// earliest restorable time becomes "now minus the recovery window". For
2093    /// example, assuming a point in time recovery is attempted at 04/16/2025
2094    /// 3:23:00PM with a 14d recovery window, the earliest restorable time would be
2095    /// 04/02/2025 3:23:00PM. This field is only visible if the
2096    /// CLUSTER_VIEW_CONTINUOUS_BACKUP cluster view is provided.
2097    pub earliest_restorable_time: std::option::Option<wkt::Timestamp>,
2098
2099    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2100}
2101
2102impl ContinuousBackupInfo {
2103    pub fn new() -> Self {
2104        std::default::Default::default()
2105    }
2106
2107    /// Sets the value of [encryption_info][crate::model::ContinuousBackupInfo::encryption_info].
2108    ///
2109    /// # Example
2110    /// ```ignore,no_run
2111    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2112    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
2113    /// let x = ContinuousBackupInfo::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
2114    /// ```
2115    pub fn set_encryption_info<T>(mut self, v: T) -> Self
2116    where
2117        T: std::convert::Into<crate::model::EncryptionInfo>,
2118    {
2119        self.encryption_info = std::option::Option::Some(v.into());
2120        self
2121    }
2122
2123    /// Sets or clears the value of [encryption_info][crate::model::ContinuousBackupInfo::encryption_info].
2124    ///
2125    /// # Example
2126    /// ```ignore,no_run
2127    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2128    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
2129    /// let x = ContinuousBackupInfo::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
2130    /// let x = ContinuousBackupInfo::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
2131    /// ```
2132    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
2133    where
2134        T: std::convert::Into<crate::model::EncryptionInfo>,
2135    {
2136        self.encryption_info = v.map(|x| x.into());
2137        self
2138    }
2139
2140    /// Sets the value of [enabled_time][crate::model::ContinuousBackupInfo::enabled_time].
2141    ///
2142    /// # Example
2143    /// ```ignore,no_run
2144    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2145    /// use wkt::Timestamp;
2146    /// let x = ContinuousBackupInfo::new().set_enabled_time(Timestamp::default()/* use setters */);
2147    /// ```
2148    pub fn set_enabled_time<T>(mut self, v: T) -> Self
2149    where
2150        T: std::convert::Into<wkt::Timestamp>,
2151    {
2152        self.enabled_time = std::option::Option::Some(v.into());
2153        self
2154    }
2155
2156    /// Sets or clears the value of [enabled_time][crate::model::ContinuousBackupInfo::enabled_time].
2157    ///
2158    /// # Example
2159    /// ```ignore,no_run
2160    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2161    /// use wkt::Timestamp;
2162    /// let x = ContinuousBackupInfo::new().set_or_clear_enabled_time(Some(Timestamp::default()/* use setters */));
2163    /// let x = ContinuousBackupInfo::new().set_or_clear_enabled_time(None::<Timestamp>);
2164    /// ```
2165    pub fn set_or_clear_enabled_time<T>(mut self, v: std::option::Option<T>) -> Self
2166    where
2167        T: std::convert::Into<wkt::Timestamp>,
2168    {
2169        self.enabled_time = v.map(|x| x.into());
2170        self
2171    }
2172
2173    /// Sets the value of [schedule][crate::model::ContinuousBackupInfo::schedule].
2174    ///
2175    /// # Example
2176    /// ```ignore,no_run
2177    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2178    /// use google_cloud_type::model::DayOfWeek;
2179    /// let x = ContinuousBackupInfo::new().set_schedule([
2180    ///     DayOfWeek::Monday,
2181    ///     DayOfWeek::Tuesday,
2182    ///     DayOfWeek::Wednesday,
2183    /// ]);
2184    /// ```
2185    pub fn set_schedule<T, V>(mut self, v: T) -> Self
2186    where
2187        T: std::iter::IntoIterator<Item = V>,
2188        V: std::convert::Into<google_cloud_type::model::DayOfWeek>,
2189    {
2190        use std::iter::Iterator;
2191        self.schedule = v.into_iter().map(|i| i.into()).collect();
2192        self
2193    }
2194
2195    /// Sets the value of [earliest_restorable_time][crate::model::ContinuousBackupInfo::earliest_restorable_time].
2196    ///
2197    /// # Example
2198    /// ```ignore,no_run
2199    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2200    /// use wkt::Timestamp;
2201    /// let x = ContinuousBackupInfo::new().set_earliest_restorable_time(Timestamp::default()/* use setters */);
2202    /// ```
2203    pub fn set_earliest_restorable_time<T>(mut self, v: T) -> Self
2204    where
2205        T: std::convert::Into<wkt::Timestamp>,
2206    {
2207        self.earliest_restorable_time = std::option::Option::Some(v.into());
2208        self
2209    }
2210
2211    /// Sets or clears the value of [earliest_restorable_time][crate::model::ContinuousBackupInfo::earliest_restorable_time].
2212    ///
2213    /// # Example
2214    /// ```ignore,no_run
2215    /// # use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
2216    /// use wkt::Timestamp;
2217    /// let x = ContinuousBackupInfo::new().set_or_clear_earliest_restorable_time(Some(Timestamp::default()/* use setters */));
2218    /// let x = ContinuousBackupInfo::new().set_or_clear_earliest_restorable_time(None::<Timestamp>);
2219    /// ```
2220    pub fn set_or_clear_earliest_restorable_time<T>(mut self, v: std::option::Option<T>) -> Self
2221    where
2222        T: std::convert::Into<wkt::Timestamp>,
2223    {
2224        self.earliest_restorable_time = v.map(|x| x.into());
2225        self
2226    }
2227}
2228
2229impl wkt::message::Message for ContinuousBackupInfo {
2230    fn typename() -> &'static str {
2231        "type.googleapis.com/google.cloud.alloydb.v1.ContinuousBackupInfo"
2232    }
2233}
2234
2235/// Message describing a BackupSource.
2236#[derive(Clone, Default, PartialEq)]
2237#[non_exhaustive]
2238pub struct BackupSource {
2239    /// Output only. The system-generated UID of the backup which was used to
2240    /// create this resource. The UID is generated when the backup is created, and
2241    /// it is retained until the backup is deleted.
2242    pub backup_uid: std::string::String,
2243
2244    /// Required. The name of the backup resource with the format:
2245    ///
2246    /// * projects/{project}/locations/{region}/backups/{backup_id}
2247    pub backup_name: std::string::String,
2248
2249    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2250}
2251
2252impl BackupSource {
2253    pub fn new() -> Self {
2254        std::default::Default::default()
2255    }
2256
2257    /// Sets the value of [backup_uid][crate::model::BackupSource::backup_uid].
2258    ///
2259    /// # Example
2260    /// ```ignore,no_run
2261    /// # use google_cloud_alloydb_v1::model::BackupSource;
2262    /// let x = BackupSource::new().set_backup_uid("example");
2263    /// ```
2264    pub fn set_backup_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2265        self.backup_uid = v.into();
2266        self
2267    }
2268
2269    /// Sets the value of [backup_name][crate::model::BackupSource::backup_name].
2270    ///
2271    /// # Example
2272    /// ```ignore,no_run
2273    /// # use google_cloud_alloydb_v1::model::BackupSource;
2274    /// let x = BackupSource::new().set_backup_name("example");
2275    /// ```
2276    pub fn set_backup_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2277        self.backup_name = v.into();
2278        self
2279    }
2280}
2281
2282impl wkt::message::Message for BackupSource {
2283    fn typename() -> &'static str {
2284        "type.googleapis.com/google.cloud.alloydb.v1.BackupSource"
2285    }
2286}
2287
2288/// Message describing a ContinuousBackupSource.
2289#[derive(Clone, Default, PartialEq)]
2290#[non_exhaustive]
2291pub struct ContinuousBackupSource {
2292    /// Required. The source cluster from which to restore. This cluster must have
2293    /// continuous backup enabled for this operation to succeed. For the required
2294    /// format, see the comment on the Cluster.name field.
2295    pub cluster: std::string::String,
2296
2297    /// Required. The point in time to restore to.
2298    pub point_in_time: std::option::Option<wkt::Timestamp>,
2299
2300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2301}
2302
2303impl ContinuousBackupSource {
2304    pub fn new() -> Self {
2305        std::default::Default::default()
2306    }
2307
2308    /// Sets the value of [cluster][crate::model::ContinuousBackupSource::cluster].
2309    ///
2310    /// # Example
2311    /// ```ignore,no_run
2312    /// # use google_cloud_alloydb_v1::model::ContinuousBackupSource;
2313    /// let x = ContinuousBackupSource::new().set_cluster("example");
2314    /// ```
2315    pub fn set_cluster<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2316        self.cluster = v.into();
2317        self
2318    }
2319
2320    /// Sets the value of [point_in_time][crate::model::ContinuousBackupSource::point_in_time].
2321    ///
2322    /// # Example
2323    /// ```ignore,no_run
2324    /// # use google_cloud_alloydb_v1::model::ContinuousBackupSource;
2325    /// use wkt::Timestamp;
2326    /// let x = ContinuousBackupSource::new().set_point_in_time(Timestamp::default()/* use setters */);
2327    /// ```
2328    pub fn set_point_in_time<T>(mut self, v: T) -> Self
2329    where
2330        T: std::convert::Into<wkt::Timestamp>,
2331    {
2332        self.point_in_time = std::option::Option::Some(v.into());
2333        self
2334    }
2335
2336    /// Sets or clears the value of [point_in_time][crate::model::ContinuousBackupSource::point_in_time].
2337    ///
2338    /// # Example
2339    /// ```ignore,no_run
2340    /// # use google_cloud_alloydb_v1::model::ContinuousBackupSource;
2341    /// use wkt::Timestamp;
2342    /// let x = ContinuousBackupSource::new().set_or_clear_point_in_time(Some(Timestamp::default()/* use setters */));
2343    /// let x = ContinuousBackupSource::new().set_or_clear_point_in_time(None::<Timestamp>);
2344    /// ```
2345    pub fn set_or_clear_point_in_time<T>(mut self, v: std::option::Option<T>) -> Self
2346    where
2347        T: std::convert::Into<wkt::Timestamp>,
2348    {
2349        self.point_in_time = v.map(|x| x.into());
2350        self
2351    }
2352}
2353
2354impl wkt::message::Message for ContinuousBackupSource {
2355    fn typename() -> &'static str {
2356        "type.googleapis.com/google.cloud.alloydb.v1.ContinuousBackupSource"
2357    }
2358}
2359
2360/// MaintenanceUpdatePolicy defines the policy for system updates.
2361#[derive(Clone, Default, PartialEq)]
2362#[non_exhaustive]
2363pub struct MaintenanceUpdatePolicy {
2364    /// Preferred windows to perform maintenance. Currently limited to 1.
2365    pub maintenance_windows:
2366        std::vec::Vec<crate::model::maintenance_update_policy::MaintenanceWindow>,
2367
2368    /// Periods to deny maintenance. Currently limited to 1.
2369    pub deny_maintenance_periods:
2370        std::vec::Vec<crate::model::maintenance_update_policy::DenyMaintenancePeriod>,
2371
2372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2373}
2374
2375impl MaintenanceUpdatePolicy {
2376    pub fn new() -> Self {
2377        std::default::Default::default()
2378    }
2379
2380    /// Sets the value of [maintenance_windows][crate::model::MaintenanceUpdatePolicy::maintenance_windows].
2381    ///
2382    /// # Example
2383    /// ```ignore,no_run
2384    /// # use google_cloud_alloydb_v1::model::MaintenanceUpdatePolicy;
2385    /// use google_cloud_alloydb_v1::model::maintenance_update_policy::MaintenanceWindow;
2386    /// let x = MaintenanceUpdatePolicy::new()
2387    ///     .set_maintenance_windows([
2388    ///         MaintenanceWindow::default()/* use setters */,
2389    ///         MaintenanceWindow::default()/* use (different) setters */,
2390    ///     ]);
2391    /// ```
2392    pub fn set_maintenance_windows<T, V>(mut self, v: T) -> Self
2393    where
2394        T: std::iter::IntoIterator<Item = V>,
2395        V: std::convert::Into<crate::model::maintenance_update_policy::MaintenanceWindow>,
2396    {
2397        use std::iter::Iterator;
2398        self.maintenance_windows = v.into_iter().map(|i| i.into()).collect();
2399        self
2400    }
2401
2402    /// Sets the value of [deny_maintenance_periods][crate::model::MaintenanceUpdatePolicy::deny_maintenance_periods].
2403    ///
2404    /// # Example
2405    /// ```ignore,no_run
2406    /// # use google_cloud_alloydb_v1::model::MaintenanceUpdatePolicy;
2407    /// use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2408    /// let x = MaintenanceUpdatePolicy::new()
2409    ///     .set_deny_maintenance_periods([
2410    ///         DenyMaintenancePeriod::default()/* use setters */,
2411    ///         DenyMaintenancePeriod::default()/* use (different) setters */,
2412    ///     ]);
2413    /// ```
2414    pub fn set_deny_maintenance_periods<T, V>(mut self, v: T) -> Self
2415    where
2416        T: std::iter::IntoIterator<Item = V>,
2417        V: std::convert::Into<crate::model::maintenance_update_policy::DenyMaintenancePeriod>,
2418    {
2419        use std::iter::Iterator;
2420        self.deny_maintenance_periods = v.into_iter().map(|i| i.into()).collect();
2421        self
2422    }
2423}
2424
2425impl wkt::message::Message for MaintenanceUpdatePolicy {
2426    fn typename() -> &'static str {
2427        "type.googleapis.com/google.cloud.alloydb.v1.MaintenanceUpdatePolicy"
2428    }
2429}
2430
2431/// Defines additional types related to [MaintenanceUpdatePolicy].
2432pub mod maintenance_update_policy {
2433    #[allow(unused_imports)]
2434    use super::*;
2435
2436    /// MaintenanceWindow specifies a preferred day and time for maintenance.
2437    #[derive(Clone, Default, PartialEq)]
2438    #[non_exhaustive]
2439    pub struct MaintenanceWindow {
2440        /// Preferred day of the week for maintenance, e.g. MONDAY, TUESDAY, etc.
2441        pub day: google_cloud_type::model::DayOfWeek,
2442
2443        /// Preferred time to start the maintenance operation on the specified day.
2444        /// Maintenance will start within 1 hour of this time.
2445        pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
2446
2447        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2448    }
2449
2450    impl MaintenanceWindow {
2451        pub fn new() -> Self {
2452            std::default::Default::default()
2453        }
2454
2455        /// Sets the value of [day][crate::model::maintenance_update_policy::MaintenanceWindow::day].
2456        ///
2457        /// # Example
2458        /// ```ignore,no_run
2459        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::MaintenanceWindow;
2460        /// use google_cloud_type::model::DayOfWeek;
2461        /// let x0 = MaintenanceWindow::new().set_day(DayOfWeek::Monday);
2462        /// let x1 = MaintenanceWindow::new().set_day(DayOfWeek::Tuesday);
2463        /// let x2 = MaintenanceWindow::new().set_day(DayOfWeek::Wednesday);
2464        /// ```
2465        pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
2466            mut self,
2467            v: T,
2468        ) -> Self {
2469            self.day = v.into();
2470            self
2471        }
2472
2473        /// Sets the value of [start_time][crate::model::maintenance_update_policy::MaintenanceWindow::start_time].
2474        ///
2475        /// # Example
2476        /// ```ignore,no_run
2477        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::MaintenanceWindow;
2478        /// use google_cloud_type::model::TimeOfDay;
2479        /// let x = MaintenanceWindow::new().set_start_time(TimeOfDay::default()/* use setters */);
2480        /// ```
2481        pub fn set_start_time<T>(mut self, v: T) -> Self
2482        where
2483            T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2484        {
2485            self.start_time = std::option::Option::Some(v.into());
2486            self
2487        }
2488
2489        /// Sets or clears the value of [start_time][crate::model::maintenance_update_policy::MaintenanceWindow::start_time].
2490        ///
2491        /// # Example
2492        /// ```ignore,no_run
2493        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::MaintenanceWindow;
2494        /// use google_cloud_type::model::TimeOfDay;
2495        /// let x = MaintenanceWindow::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
2496        /// let x = MaintenanceWindow::new().set_or_clear_start_time(None::<TimeOfDay>);
2497        /// ```
2498        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2499        where
2500            T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2501        {
2502            self.start_time = v.map(|x| x.into());
2503            self
2504        }
2505    }
2506
2507    impl wkt::message::Message for MaintenanceWindow {
2508        fn typename() -> &'static str {
2509            "type.googleapis.com/google.cloud.alloydb.v1.MaintenanceUpdatePolicy.MaintenanceWindow"
2510        }
2511    }
2512
2513    /// DenyMaintenancePeriod definition. Excepting emergencies, maintenance
2514    /// will not be scheduled to start within this deny period. The start_date must
2515    /// be less than the end_date.
2516    #[derive(Clone, Default, PartialEq)]
2517    #[non_exhaustive]
2518    pub struct DenyMaintenancePeriod {
2519        /// Deny period start date.
2520        /// This can be:
2521        ///
2522        /// * A full date, with non-zero year, month and day values OR
2523        /// * A month and day value, with a zero year for recurring
2524        pub start_date: std::option::Option<google_cloud_type::model::Date>,
2525
2526        /// Deny period end date.
2527        /// This can be:
2528        ///
2529        /// * A full date, with non-zero year, month and day values OR
2530        /// * A month and day value, with a zero year for recurring
2531        pub end_date: std::option::Option<google_cloud_type::model::Date>,
2532
2533        /// Time in UTC when the deny period starts on start_date and ends on
2534        /// end_date. This can be:
2535        ///
2536        /// * Full time OR
2537        /// * All zeros for 00:00:00 UTC
2538        pub time: std::option::Option<google_cloud_type::model::TimeOfDay>,
2539
2540        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2541    }
2542
2543    impl DenyMaintenancePeriod {
2544        pub fn new() -> Self {
2545            std::default::Default::default()
2546        }
2547
2548        /// Sets the value of [start_date][crate::model::maintenance_update_policy::DenyMaintenancePeriod::start_date].
2549        ///
2550        /// # Example
2551        /// ```ignore,no_run
2552        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2553        /// use google_cloud_type::model::Date;
2554        /// let x = DenyMaintenancePeriod::new().set_start_date(Date::default()/* use setters */);
2555        /// ```
2556        pub fn set_start_date<T>(mut self, v: T) -> Self
2557        where
2558            T: std::convert::Into<google_cloud_type::model::Date>,
2559        {
2560            self.start_date = std::option::Option::Some(v.into());
2561            self
2562        }
2563
2564        /// Sets or clears the value of [start_date][crate::model::maintenance_update_policy::DenyMaintenancePeriod::start_date].
2565        ///
2566        /// # Example
2567        /// ```ignore,no_run
2568        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2569        /// use google_cloud_type::model::Date;
2570        /// let x = DenyMaintenancePeriod::new().set_or_clear_start_date(Some(Date::default()/* use setters */));
2571        /// let x = DenyMaintenancePeriod::new().set_or_clear_start_date(None::<Date>);
2572        /// ```
2573        pub fn set_or_clear_start_date<T>(mut self, v: std::option::Option<T>) -> Self
2574        where
2575            T: std::convert::Into<google_cloud_type::model::Date>,
2576        {
2577            self.start_date = v.map(|x| x.into());
2578            self
2579        }
2580
2581        /// Sets the value of [end_date][crate::model::maintenance_update_policy::DenyMaintenancePeriod::end_date].
2582        ///
2583        /// # Example
2584        /// ```ignore,no_run
2585        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2586        /// use google_cloud_type::model::Date;
2587        /// let x = DenyMaintenancePeriod::new().set_end_date(Date::default()/* use setters */);
2588        /// ```
2589        pub fn set_end_date<T>(mut self, v: T) -> Self
2590        where
2591            T: std::convert::Into<google_cloud_type::model::Date>,
2592        {
2593            self.end_date = std::option::Option::Some(v.into());
2594            self
2595        }
2596
2597        /// Sets or clears the value of [end_date][crate::model::maintenance_update_policy::DenyMaintenancePeriod::end_date].
2598        ///
2599        /// # Example
2600        /// ```ignore,no_run
2601        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2602        /// use google_cloud_type::model::Date;
2603        /// let x = DenyMaintenancePeriod::new().set_or_clear_end_date(Some(Date::default()/* use setters */));
2604        /// let x = DenyMaintenancePeriod::new().set_or_clear_end_date(None::<Date>);
2605        /// ```
2606        pub fn set_or_clear_end_date<T>(mut self, v: std::option::Option<T>) -> Self
2607        where
2608            T: std::convert::Into<google_cloud_type::model::Date>,
2609        {
2610            self.end_date = v.map(|x| x.into());
2611            self
2612        }
2613
2614        /// Sets the value of [time][crate::model::maintenance_update_policy::DenyMaintenancePeriod::time].
2615        ///
2616        /// # Example
2617        /// ```ignore,no_run
2618        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2619        /// use google_cloud_type::model::TimeOfDay;
2620        /// let x = DenyMaintenancePeriod::new().set_time(TimeOfDay::default()/* use setters */);
2621        /// ```
2622        pub fn set_time<T>(mut self, v: T) -> Self
2623        where
2624            T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2625        {
2626            self.time = std::option::Option::Some(v.into());
2627            self
2628        }
2629
2630        /// Sets or clears the value of [time][crate::model::maintenance_update_policy::DenyMaintenancePeriod::time].
2631        ///
2632        /// # Example
2633        /// ```ignore,no_run
2634        /// # use google_cloud_alloydb_v1::model::maintenance_update_policy::DenyMaintenancePeriod;
2635        /// use google_cloud_type::model::TimeOfDay;
2636        /// let x = DenyMaintenancePeriod::new().set_or_clear_time(Some(TimeOfDay::default()/* use setters */));
2637        /// let x = DenyMaintenancePeriod::new().set_or_clear_time(None::<TimeOfDay>);
2638        /// ```
2639        pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
2640        where
2641            T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2642        {
2643            self.time = v.map(|x| x.into());
2644            self
2645        }
2646    }
2647
2648    impl wkt::message::Message for DenyMaintenancePeriod {
2649        fn typename() -> &'static str {
2650            "type.googleapis.com/google.cloud.alloydb.v1.MaintenanceUpdatePolicy.DenyMaintenancePeriod"
2651        }
2652    }
2653}
2654
2655/// MaintenanceSchedule stores the maintenance schedule generated from
2656/// the MaintenanceUpdatePolicy, once a maintenance rollout is triggered, if
2657/// MaintenanceWindow is set, and if there is no conflicting DenyPeriod.
2658/// The schedule is cleared once the update takes place. This field cannot be
2659/// manually changed; modify the MaintenanceUpdatePolicy instead.
2660#[derive(Clone, Default, PartialEq)]
2661#[non_exhaustive]
2662pub struct MaintenanceSchedule {
2663    /// Output only. The scheduled start time for the maintenance.
2664    pub start_time: std::option::Option<wkt::Timestamp>,
2665
2666    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2667}
2668
2669impl MaintenanceSchedule {
2670    pub fn new() -> Self {
2671        std::default::Default::default()
2672    }
2673
2674    /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
2675    ///
2676    /// # Example
2677    /// ```ignore,no_run
2678    /// # use google_cloud_alloydb_v1::model::MaintenanceSchedule;
2679    /// use wkt::Timestamp;
2680    /// let x = MaintenanceSchedule::new().set_start_time(Timestamp::default()/* use setters */);
2681    /// ```
2682    pub fn set_start_time<T>(mut self, v: T) -> Self
2683    where
2684        T: std::convert::Into<wkt::Timestamp>,
2685    {
2686        self.start_time = std::option::Option::Some(v.into());
2687        self
2688    }
2689
2690    /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
2691    ///
2692    /// # Example
2693    /// ```ignore,no_run
2694    /// # use google_cloud_alloydb_v1::model::MaintenanceSchedule;
2695    /// use wkt::Timestamp;
2696    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2697    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(None::<Timestamp>);
2698    /// ```
2699    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2700    where
2701        T: std::convert::Into<wkt::Timestamp>,
2702    {
2703        self.start_time = v.map(|x| x.into());
2704        self
2705    }
2706}
2707
2708impl wkt::message::Message for MaintenanceSchedule {
2709    fn typename() -> &'static str {
2710        "type.googleapis.com/google.cloud.alloydb.v1.MaintenanceSchedule"
2711    }
2712}
2713
2714/// A cluster is a collection of regional AlloyDB resources. It can include a
2715/// primary instance and one or more read pool instances.
2716/// All cluster resources share a storage layer, which scales as needed.
2717#[derive(Clone, Default, PartialEq)]
2718#[non_exhaustive]
2719pub struct Cluster {
2720    /// Output only. The name of the cluster resource with the format:
2721    ///
2722    /// * projects/{project}/locations/{region}/clusters/{cluster_id}
2723    ///   where the cluster ID segment should satisfy the regex expression
2724    ///   `[a-z0-9-]+`. For more details see <https://google.aip.dev/122>.
2725    ///   The prefix of the cluster resource name is the name of the parent resource:
2726    /// * projects/{project}/locations/{region}
2727    pub name: std::string::String,
2728
2729    /// User-settable and human-readable display name for the Cluster.
2730    pub display_name: std::string::String,
2731
2732    /// Output only. The system-generated UID of the resource. The UID is assigned
2733    /// when the resource is created, and it is retained until it is deleted.
2734    pub uid: std::string::String,
2735
2736    /// Output only. Create time stamp
2737    pub create_time: std::option::Option<wkt::Timestamp>,
2738
2739    /// Output only. Update time stamp
2740    pub update_time: std::option::Option<wkt::Timestamp>,
2741
2742    /// Output only. Delete time stamp
2743    pub delete_time: std::option::Option<wkt::Timestamp>,
2744
2745    /// Labels as key value pairs
2746    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2747
2748    /// Output only. The current serving state of the cluster.
2749    pub state: crate::model::cluster::State,
2750
2751    /// Output only. The type of the cluster. This is an output-only field and it's
2752    /// populated at the Cluster creation time or the Cluster promotion
2753    /// time. The cluster type is determined by which RPC was used to create
2754    /// the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster`
2755    pub cluster_type: crate::model::cluster::ClusterType,
2756
2757    /// Optional. The database engine major version. This is an optional field and
2758    /// it is populated at the Cluster creation time. If a database version is not
2759    /// supplied at cluster creation time, then a default database version will
2760    /// be used.
2761    pub database_version: crate::model::DatabaseVersion,
2762
2763    pub network_config: std::option::Option<crate::model::cluster::NetworkConfig>,
2764
2765    /// Required. The resource link for the VPC network in which cluster resources
2766    /// are created and from which they are accessible via Private IP. The network
2767    /// must belong to the same project as the cluster. It is specified in the
2768    /// form: `projects/{project}/global/networks/{network_id}`. This is required
2769    /// to create a cluster. Deprecated, use network_config.network instead.
2770    #[deprecated]
2771    pub network: std::string::String,
2772
2773    /// For Resource freshness validation (<https://google.aip.dev/154>)
2774    pub etag: std::string::String,
2775
2776    /// Annotations to allow client tools to store small amount of arbitrary data.
2777    /// This is distinct from labels.
2778    /// <https://google.aip.dev/128>
2779    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2780
2781    /// Output only. Reconciling (<https://google.aip.dev/128#reconciliation>).
2782    /// Set to true if the current state of Cluster does not match the user's
2783    /// intended state, and the service is actively updating the resource to
2784    /// reconcile them. This can happen due to user-triggered updates or
2785    /// system actions like failover or maintenance.
2786    pub reconciling: bool,
2787
2788    /// Input only. Initial user to setup during cluster creation.
2789    /// If used in `RestoreCluster` this is ignored.
2790    pub initial_user: std::option::Option<crate::model::UserPassword>,
2791
2792    /// The automated backup policy for this cluster.
2793    ///
2794    /// If no policy is provided then the default policy will be used. If backups
2795    /// are supported for the cluster, the default policy takes one backup a day,
2796    /// has a backup window of 1 hour, and retains backups for 14 days.
2797    /// For more information on the defaults, consult the
2798    /// documentation for the message type.
2799    pub automated_backup_policy: std::option::Option<crate::model::AutomatedBackupPolicy>,
2800
2801    /// SSL configuration for this AlloyDB cluster.
2802    #[deprecated]
2803    pub ssl_config: std::option::Option<crate::model::SslConfig>,
2804
2805    /// Optional. The encryption config can be specified to encrypt the data disks
2806    /// and other persistent data resources of a cluster with a
2807    /// customer-managed encryption key (CMEK). When this field is not
2808    /// specified, the cluster will then use default encryption scheme to
2809    /// protect the user data.
2810    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
2811
2812    /// Output only. The encryption information for the cluster.
2813    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
2814
2815    /// Optional. Continuous backup configuration for this cluster.
2816    pub continuous_backup_config: std::option::Option<crate::model::ContinuousBackupConfig>,
2817
2818    /// Output only. Continuous backup properties for this cluster.
2819    pub continuous_backup_info: std::option::Option<crate::model::ContinuousBackupInfo>,
2820
2821    /// Cross Region replication config specific to SECONDARY cluster.
2822    pub secondary_config: std::option::Option<crate::model::cluster::SecondaryConfig>,
2823
2824    /// Output only. Cross Region replication config specific to PRIMARY cluster.
2825    pub primary_config: std::option::Option<crate::model::cluster::PrimaryConfig>,
2826
2827    /// Output only. Reserved for future use.
2828    pub satisfies_pzs: bool,
2829
2830    /// Optional. The configuration for Private Service Connect (PSC) for the
2831    /// cluster.
2832    pub psc_config: std::option::Option<crate::model::cluster::PscConfig>,
2833
2834    /// Optional. The maintenance update policy determines when to allow or deny
2835    /// updates.
2836    pub maintenance_update_policy: std::option::Option<crate::model::MaintenanceUpdatePolicy>,
2837
2838    /// Output only. The maintenance schedule for the cluster, generated for a
2839    /// specific rollout if a maintenance window is set.
2840    pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
2841
2842    /// Optional. Subscription type of the cluster.
2843    pub subscription_type: crate::model::SubscriptionType,
2844
2845    /// Output only. Metadata for free trial clusters
2846    pub trial_metadata: std::option::Option<crate::model::cluster::TrialMetadata>,
2847
2848    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
2849    /// resource. For example:
2850    ///
2851    /// ```norust
2852    /// "123/environment": "production",
2853    /// "123/costCenter": "marketing"
2854    /// ```
2855    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
2856
2857    /// In case of an imported cluster, this field contains information about the
2858    /// source this cluster was imported from.
2859    pub source: std::option::Option<crate::model::cluster::Source>,
2860
2861    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2862}
2863
2864impl Cluster {
2865    pub fn new() -> Self {
2866        std::default::Default::default()
2867    }
2868
2869    /// Sets the value of [name][crate::model::Cluster::name].
2870    ///
2871    /// # Example
2872    /// ```ignore,no_run
2873    /// # use google_cloud_alloydb_v1::model::Cluster;
2874    /// let x = Cluster::new().set_name("example");
2875    /// ```
2876    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2877        self.name = v.into();
2878        self
2879    }
2880
2881    /// Sets the value of [display_name][crate::model::Cluster::display_name].
2882    ///
2883    /// # Example
2884    /// ```ignore,no_run
2885    /// # use google_cloud_alloydb_v1::model::Cluster;
2886    /// let x = Cluster::new().set_display_name("example");
2887    /// ```
2888    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2889        self.display_name = v.into();
2890        self
2891    }
2892
2893    /// Sets the value of [uid][crate::model::Cluster::uid].
2894    ///
2895    /// # Example
2896    /// ```ignore,no_run
2897    /// # use google_cloud_alloydb_v1::model::Cluster;
2898    /// let x = Cluster::new().set_uid("example");
2899    /// ```
2900    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2901        self.uid = v.into();
2902        self
2903    }
2904
2905    /// Sets the value of [create_time][crate::model::Cluster::create_time].
2906    ///
2907    /// # Example
2908    /// ```ignore,no_run
2909    /// # use google_cloud_alloydb_v1::model::Cluster;
2910    /// use wkt::Timestamp;
2911    /// let x = Cluster::new().set_create_time(Timestamp::default()/* use setters */);
2912    /// ```
2913    pub fn set_create_time<T>(mut self, v: T) -> Self
2914    where
2915        T: std::convert::Into<wkt::Timestamp>,
2916    {
2917        self.create_time = std::option::Option::Some(v.into());
2918        self
2919    }
2920
2921    /// Sets or clears the value of [create_time][crate::model::Cluster::create_time].
2922    ///
2923    /// # Example
2924    /// ```ignore,no_run
2925    /// # use google_cloud_alloydb_v1::model::Cluster;
2926    /// use wkt::Timestamp;
2927    /// let x = Cluster::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2928    /// let x = Cluster::new().set_or_clear_create_time(None::<Timestamp>);
2929    /// ```
2930    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2931    where
2932        T: std::convert::Into<wkt::Timestamp>,
2933    {
2934        self.create_time = v.map(|x| x.into());
2935        self
2936    }
2937
2938    /// Sets the value of [update_time][crate::model::Cluster::update_time].
2939    ///
2940    /// # Example
2941    /// ```ignore,no_run
2942    /// # use google_cloud_alloydb_v1::model::Cluster;
2943    /// use wkt::Timestamp;
2944    /// let x = Cluster::new().set_update_time(Timestamp::default()/* use setters */);
2945    /// ```
2946    pub fn set_update_time<T>(mut self, v: T) -> Self
2947    where
2948        T: std::convert::Into<wkt::Timestamp>,
2949    {
2950        self.update_time = std::option::Option::Some(v.into());
2951        self
2952    }
2953
2954    /// Sets or clears the value of [update_time][crate::model::Cluster::update_time].
2955    ///
2956    /// # Example
2957    /// ```ignore,no_run
2958    /// # use google_cloud_alloydb_v1::model::Cluster;
2959    /// use wkt::Timestamp;
2960    /// let x = Cluster::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2961    /// let x = Cluster::new().set_or_clear_update_time(None::<Timestamp>);
2962    /// ```
2963    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2964    where
2965        T: std::convert::Into<wkt::Timestamp>,
2966    {
2967        self.update_time = v.map(|x| x.into());
2968        self
2969    }
2970
2971    /// Sets the value of [delete_time][crate::model::Cluster::delete_time].
2972    ///
2973    /// # Example
2974    /// ```ignore,no_run
2975    /// # use google_cloud_alloydb_v1::model::Cluster;
2976    /// use wkt::Timestamp;
2977    /// let x = Cluster::new().set_delete_time(Timestamp::default()/* use setters */);
2978    /// ```
2979    pub fn set_delete_time<T>(mut self, v: T) -> Self
2980    where
2981        T: std::convert::Into<wkt::Timestamp>,
2982    {
2983        self.delete_time = std::option::Option::Some(v.into());
2984        self
2985    }
2986
2987    /// Sets or clears the value of [delete_time][crate::model::Cluster::delete_time].
2988    ///
2989    /// # Example
2990    /// ```ignore,no_run
2991    /// # use google_cloud_alloydb_v1::model::Cluster;
2992    /// use wkt::Timestamp;
2993    /// let x = Cluster::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2994    /// let x = Cluster::new().set_or_clear_delete_time(None::<Timestamp>);
2995    /// ```
2996    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2997    where
2998        T: std::convert::Into<wkt::Timestamp>,
2999    {
3000        self.delete_time = v.map(|x| x.into());
3001        self
3002    }
3003
3004    /// Sets the value of [labels][crate::model::Cluster::labels].
3005    ///
3006    /// # Example
3007    /// ```ignore,no_run
3008    /// # use google_cloud_alloydb_v1::model::Cluster;
3009    /// let x = Cluster::new().set_labels([
3010    ///     ("key0", "abc"),
3011    ///     ("key1", "xyz"),
3012    /// ]);
3013    /// ```
3014    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3015    where
3016        T: std::iter::IntoIterator<Item = (K, V)>,
3017        K: std::convert::Into<std::string::String>,
3018        V: std::convert::Into<std::string::String>,
3019    {
3020        use std::iter::Iterator;
3021        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3022        self
3023    }
3024
3025    /// Sets the value of [state][crate::model::Cluster::state].
3026    ///
3027    /// # Example
3028    /// ```ignore,no_run
3029    /// # use google_cloud_alloydb_v1::model::Cluster;
3030    /// use google_cloud_alloydb_v1::model::cluster::State;
3031    /// let x0 = Cluster::new().set_state(State::Ready);
3032    /// let x1 = Cluster::new().set_state(State::Stopped);
3033    /// let x2 = Cluster::new().set_state(State::Empty);
3034    /// ```
3035    pub fn set_state<T: std::convert::Into<crate::model::cluster::State>>(mut self, v: T) -> Self {
3036        self.state = v.into();
3037        self
3038    }
3039
3040    /// Sets the value of [cluster_type][crate::model::Cluster::cluster_type].
3041    ///
3042    /// # Example
3043    /// ```ignore,no_run
3044    /// # use google_cloud_alloydb_v1::model::Cluster;
3045    /// use google_cloud_alloydb_v1::model::cluster::ClusterType;
3046    /// let x0 = Cluster::new().set_cluster_type(ClusterType::Primary);
3047    /// let x1 = Cluster::new().set_cluster_type(ClusterType::Secondary);
3048    /// ```
3049    pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster::ClusterType>>(
3050        mut self,
3051        v: T,
3052    ) -> Self {
3053        self.cluster_type = v.into();
3054        self
3055    }
3056
3057    /// Sets the value of [database_version][crate::model::Cluster::database_version].
3058    ///
3059    /// # Example
3060    /// ```ignore,no_run
3061    /// # use google_cloud_alloydb_v1::model::Cluster;
3062    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
3063    /// let x0 = Cluster::new().set_database_version(DatabaseVersion::Postgres14);
3064    /// let x1 = Cluster::new().set_database_version(DatabaseVersion::Postgres15);
3065    /// let x2 = Cluster::new().set_database_version(DatabaseVersion::Postgres16);
3066    /// ```
3067    pub fn set_database_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
3068        mut self,
3069        v: T,
3070    ) -> Self {
3071        self.database_version = v.into();
3072        self
3073    }
3074
3075    /// Sets the value of [network_config][crate::model::Cluster::network_config].
3076    ///
3077    /// # Example
3078    /// ```ignore,no_run
3079    /// # use google_cloud_alloydb_v1::model::Cluster;
3080    /// use google_cloud_alloydb_v1::model::cluster::NetworkConfig;
3081    /// let x = Cluster::new().set_network_config(NetworkConfig::default()/* use setters */);
3082    /// ```
3083    pub fn set_network_config<T>(mut self, v: T) -> Self
3084    where
3085        T: std::convert::Into<crate::model::cluster::NetworkConfig>,
3086    {
3087        self.network_config = std::option::Option::Some(v.into());
3088        self
3089    }
3090
3091    /// Sets or clears the value of [network_config][crate::model::Cluster::network_config].
3092    ///
3093    /// # Example
3094    /// ```ignore,no_run
3095    /// # use google_cloud_alloydb_v1::model::Cluster;
3096    /// use google_cloud_alloydb_v1::model::cluster::NetworkConfig;
3097    /// let x = Cluster::new().set_or_clear_network_config(Some(NetworkConfig::default()/* use setters */));
3098    /// let x = Cluster::new().set_or_clear_network_config(None::<NetworkConfig>);
3099    /// ```
3100    pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
3101    where
3102        T: std::convert::Into<crate::model::cluster::NetworkConfig>,
3103    {
3104        self.network_config = v.map(|x| x.into());
3105        self
3106    }
3107
3108    /// Sets the value of [network][crate::model::Cluster::network].
3109    ///
3110    /// # Example
3111    /// ```ignore,no_run
3112    /// # use google_cloud_alloydb_v1::model::Cluster;
3113    /// let x = Cluster::new().set_network("example");
3114    /// ```
3115    #[deprecated]
3116    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3117        self.network = v.into();
3118        self
3119    }
3120
3121    /// Sets the value of [etag][crate::model::Cluster::etag].
3122    ///
3123    /// # Example
3124    /// ```ignore,no_run
3125    /// # use google_cloud_alloydb_v1::model::Cluster;
3126    /// let x = Cluster::new().set_etag("example");
3127    /// ```
3128    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3129        self.etag = v.into();
3130        self
3131    }
3132
3133    /// Sets the value of [annotations][crate::model::Cluster::annotations].
3134    ///
3135    /// # Example
3136    /// ```ignore,no_run
3137    /// # use google_cloud_alloydb_v1::model::Cluster;
3138    /// let x = Cluster::new().set_annotations([
3139    ///     ("key0", "abc"),
3140    ///     ("key1", "xyz"),
3141    /// ]);
3142    /// ```
3143    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3144    where
3145        T: std::iter::IntoIterator<Item = (K, V)>,
3146        K: std::convert::Into<std::string::String>,
3147        V: std::convert::Into<std::string::String>,
3148    {
3149        use std::iter::Iterator;
3150        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3151        self
3152    }
3153
3154    /// Sets the value of [reconciling][crate::model::Cluster::reconciling].
3155    ///
3156    /// # Example
3157    /// ```ignore,no_run
3158    /// # use google_cloud_alloydb_v1::model::Cluster;
3159    /// let x = Cluster::new().set_reconciling(true);
3160    /// ```
3161    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3162        self.reconciling = v.into();
3163        self
3164    }
3165
3166    /// Sets the value of [initial_user][crate::model::Cluster::initial_user].
3167    ///
3168    /// # Example
3169    /// ```ignore,no_run
3170    /// # use google_cloud_alloydb_v1::model::Cluster;
3171    /// use google_cloud_alloydb_v1::model::UserPassword;
3172    /// let x = Cluster::new().set_initial_user(UserPassword::default()/* use setters */);
3173    /// ```
3174    pub fn set_initial_user<T>(mut self, v: T) -> Self
3175    where
3176        T: std::convert::Into<crate::model::UserPassword>,
3177    {
3178        self.initial_user = std::option::Option::Some(v.into());
3179        self
3180    }
3181
3182    /// Sets or clears the value of [initial_user][crate::model::Cluster::initial_user].
3183    ///
3184    /// # Example
3185    /// ```ignore,no_run
3186    /// # use google_cloud_alloydb_v1::model::Cluster;
3187    /// use google_cloud_alloydb_v1::model::UserPassword;
3188    /// let x = Cluster::new().set_or_clear_initial_user(Some(UserPassword::default()/* use setters */));
3189    /// let x = Cluster::new().set_or_clear_initial_user(None::<UserPassword>);
3190    /// ```
3191    pub fn set_or_clear_initial_user<T>(mut self, v: std::option::Option<T>) -> Self
3192    where
3193        T: std::convert::Into<crate::model::UserPassword>,
3194    {
3195        self.initial_user = v.map(|x| x.into());
3196        self
3197    }
3198
3199    /// Sets the value of [automated_backup_policy][crate::model::Cluster::automated_backup_policy].
3200    ///
3201    /// # Example
3202    /// ```ignore,no_run
3203    /// # use google_cloud_alloydb_v1::model::Cluster;
3204    /// use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
3205    /// let x = Cluster::new().set_automated_backup_policy(AutomatedBackupPolicy::default()/* use setters */);
3206    /// ```
3207    pub fn set_automated_backup_policy<T>(mut self, v: T) -> Self
3208    where
3209        T: std::convert::Into<crate::model::AutomatedBackupPolicy>,
3210    {
3211        self.automated_backup_policy = std::option::Option::Some(v.into());
3212        self
3213    }
3214
3215    /// Sets or clears the value of [automated_backup_policy][crate::model::Cluster::automated_backup_policy].
3216    ///
3217    /// # Example
3218    /// ```ignore,no_run
3219    /// # use google_cloud_alloydb_v1::model::Cluster;
3220    /// use google_cloud_alloydb_v1::model::AutomatedBackupPolicy;
3221    /// let x = Cluster::new().set_or_clear_automated_backup_policy(Some(AutomatedBackupPolicy::default()/* use setters */));
3222    /// let x = Cluster::new().set_or_clear_automated_backup_policy(None::<AutomatedBackupPolicy>);
3223    /// ```
3224    pub fn set_or_clear_automated_backup_policy<T>(mut self, v: std::option::Option<T>) -> Self
3225    where
3226        T: std::convert::Into<crate::model::AutomatedBackupPolicy>,
3227    {
3228        self.automated_backup_policy = v.map(|x| x.into());
3229        self
3230    }
3231
3232    /// Sets the value of [ssl_config][crate::model::Cluster::ssl_config].
3233    ///
3234    /// # Example
3235    /// ```ignore,no_run
3236    /// # use google_cloud_alloydb_v1::model::Cluster;
3237    /// use google_cloud_alloydb_v1::model::SslConfig;
3238    /// let x = Cluster::new().set_ssl_config(SslConfig::default()/* use setters */);
3239    /// ```
3240    #[deprecated]
3241    pub fn set_ssl_config<T>(mut self, v: T) -> Self
3242    where
3243        T: std::convert::Into<crate::model::SslConfig>,
3244    {
3245        self.ssl_config = std::option::Option::Some(v.into());
3246        self
3247    }
3248
3249    /// Sets or clears the value of [ssl_config][crate::model::Cluster::ssl_config].
3250    ///
3251    /// # Example
3252    /// ```ignore,no_run
3253    /// # use google_cloud_alloydb_v1::model::Cluster;
3254    /// use google_cloud_alloydb_v1::model::SslConfig;
3255    /// let x = Cluster::new().set_or_clear_ssl_config(Some(SslConfig::default()/* use setters */));
3256    /// let x = Cluster::new().set_or_clear_ssl_config(None::<SslConfig>);
3257    /// ```
3258    #[deprecated]
3259    pub fn set_or_clear_ssl_config<T>(mut self, v: std::option::Option<T>) -> Self
3260    where
3261        T: std::convert::Into<crate::model::SslConfig>,
3262    {
3263        self.ssl_config = v.map(|x| x.into());
3264        self
3265    }
3266
3267    /// Sets the value of [encryption_config][crate::model::Cluster::encryption_config].
3268    ///
3269    /// # Example
3270    /// ```ignore,no_run
3271    /// # use google_cloud_alloydb_v1::model::Cluster;
3272    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
3273    /// let x = Cluster::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
3274    /// ```
3275    pub fn set_encryption_config<T>(mut self, v: T) -> Self
3276    where
3277        T: std::convert::Into<crate::model::EncryptionConfig>,
3278    {
3279        self.encryption_config = std::option::Option::Some(v.into());
3280        self
3281    }
3282
3283    /// Sets or clears the value of [encryption_config][crate::model::Cluster::encryption_config].
3284    ///
3285    /// # Example
3286    /// ```ignore,no_run
3287    /// # use google_cloud_alloydb_v1::model::Cluster;
3288    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
3289    /// let x = Cluster::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
3290    /// let x = Cluster::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
3291    /// ```
3292    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
3293    where
3294        T: std::convert::Into<crate::model::EncryptionConfig>,
3295    {
3296        self.encryption_config = v.map(|x| x.into());
3297        self
3298    }
3299
3300    /// Sets the value of [encryption_info][crate::model::Cluster::encryption_info].
3301    ///
3302    /// # Example
3303    /// ```ignore,no_run
3304    /// # use google_cloud_alloydb_v1::model::Cluster;
3305    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
3306    /// let x = Cluster::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
3307    /// ```
3308    pub fn set_encryption_info<T>(mut self, v: T) -> Self
3309    where
3310        T: std::convert::Into<crate::model::EncryptionInfo>,
3311    {
3312        self.encryption_info = std::option::Option::Some(v.into());
3313        self
3314    }
3315
3316    /// Sets or clears the value of [encryption_info][crate::model::Cluster::encryption_info].
3317    ///
3318    /// # Example
3319    /// ```ignore,no_run
3320    /// # use google_cloud_alloydb_v1::model::Cluster;
3321    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
3322    /// let x = Cluster::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
3323    /// let x = Cluster::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
3324    /// ```
3325    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
3326    where
3327        T: std::convert::Into<crate::model::EncryptionInfo>,
3328    {
3329        self.encryption_info = v.map(|x| x.into());
3330        self
3331    }
3332
3333    /// Sets the value of [continuous_backup_config][crate::model::Cluster::continuous_backup_config].
3334    ///
3335    /// # Example
3336    /// ```ignore,no_run
3337    /// # use google_cloud_alloydb_v1::model::Cluster;
3338    /// use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
3339    /// let x = Cluster::new().set_continuous_backup_config(ContinuousBackupConfig::default()/* use setters */);
3340    /// ```
3341    pub fn set_continuous_backup_config<T>(mut self, v: T) -> Self
3342    where
3343        T: std::convert::Into<crate::model::ContinuousBackupConfig>,
3344    {
3345        self.continuous_backup_config = std::option::Option::Some(v.into());
3346        self
3347    }
3348
3349    /// Sets or clears the value of [continuous_backup_config][crate::model::Cluster::continuous_backup_config].
3350    ///
3351    /// # Example
3352    /// ```ignore,no_run
3353    /// # use google_cloud_alloydb_v1::model::Cluster;
3354    /// use google_cloud_alloydb_v1::model::ContinuousBackupConfig;
3355    /// let x = Cluster::new().set_or_clear_continuous_backup_config(Some(ContinuousBackupConfig::default()/* use setters */));
3356    /// let x = Cluster::new().set_or_clear_continuous_backup_config(None::<ContinuousBackupConfig>);
3357    /// ```
3358    pub fn set_or_clear_continuous_backup_config<T>(mut self, v: std::option::Option<T>) -> Self
3359    where
3360        T: std::convert::Into<crate::model::ContinuousBackupConfig>,
3361    {
3362        self.continuous_backup_config = v.map(|x| x.into());
3363        self
3364    }
3365
3366    /// Sets the value of [continuous_backup_info][crate::model::Cluster::continuous_backup_info].
3367    ///
3368    /// # Example
3369    /// ```ignore,no_run
3370    /// # use google_cloud_alloydb_v1::model::Cluster;
3371    /// use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
3372    /// let x = Cluster::new().set_continuous_backup_info(ContinuousBackupInfo::default()/* use setters */);
3373    /// ```
3374    pub fn set_continuous_backup_info<T>(mut self, v: T) -> Self
3375    where
3376        T: std::convert::Into<crate::model::ContinuousBackupInfo>,
3377    {
3378        self.continuous_backup_info = std::option::Option::Some(v.into());
3379        self
3380    }
3381
3382    /// Sets or clears the value of [continuous_backup_info][crate::model::Cluster::continuous_backup_info].
3383    ///
3384    /// # Example
3385    /// ```ignore,no_run
3386    /// # use google_cloud_alloydb_v1::model::Cluster;
3387    /// use google_cloud_alloydb_v1::model::ContinuousBackupInfo;
3388    /// let x = Cluster::new().set_or_clear_continuous_backup_info(Some(ContinuousBackupInfo::default()/* use setters */));
3389    /// let x = Cluster::new().set_or_clear_continuous_backup_info(None::<ContinuousBackupInfo>);
3390    /// ```
3391    pub fn set_or_clear_continuous_backup_info<T>(mut self, v: std::option::Option<T>) -> Self
3392    where
3393        T: std::convert::Into<crate::model::ContinuousBackupInfo>,
3394    {
3395        self.continuous_backup_info = v.map(|x| x.into());
3396        self
3397    }
3398
3399    /// Sets the value of [secondary_config][crate::model::Cluster::secondary_config].
3400    ///
3401    /// # Example
3402    /// ```ignore,no_run
3403    /// # use google_cloud_alloydb_v1::model::Cluster;
3404    /// use google_cloud_alloydb_v1::model::cluster::SecondaryConfig;
3405    /// let x = Cluster::new().set_secondary_config(SecondaryConfig::default()/* use setters */);
3406    /// ```
3407    pub fn set_secondary_config<T>(mut self, v: T) -> Self
3408    where
3409        T: std::convert::Into<crate::model::cluster::SecondaryConfig>,
3410    {
3411        self.secondary_config = std::option::Option::Some(v.into());
3412        self
3413    }
3414
3415    /// Sets or clears the value of [secondary_config][crate::model::Cluster::secondary_config].
3416    ///
3417    /// # Example
3418    /// ```ignore,no_run
3419    /// # use google_cloud_alloydb_v1::model::Cluster;
3420    /// use google_cloud_alloydb_v1::model::cluster::SecondaryConfig;
3421    /// let x = Cluster::new().set_or_clear_secondary_config(Some(SecondaryConfig::default()/* use setters */));
3422    /// let x = Cluster::new().set_or_clear_secondary_config(None::<SecondaryConfig>);
3423    /// ```
3424    pub fn set_or_clear_secondary_config<T>(mut self, v: std::option::Option<T>) -> Self
3425    where
3426        T: std::convert::Into<crate::model::cluster::SecondaryConfig>,
3427    {
3428        self.secondary_config = v.map(|x| x.into());
3429        self
3430    }
3431
3432    /// Sets the value of [primary_config][crate::model::Cluster::primary_config].
3433    ///
3434    /// # Example
3435    /// ```ignore,no_run
3436    /// # use google_cloud_alloydb_v1::model::Cluster;
3437    /// use google_cloud_alloydb_v1::model::cluster::PrimaryConfig;
3438    /// let x = Cluster::new().set_primary_config(PrimaryConfig::default()/* use setters */);
3439    /// ```
3440    pub fn set_primary_config<T>(mut self, v: T) -> Self
3441    where
3442        T: std::convert::Into<crate::model::cluster::PrimaryConfig>,
3443    {
3444        self.primary_config = std::option::Option::Some(v.into());
3445        self
3446    }
3447
3448    /// Sets or clears the value of [primary_config][crate::model::Cluster::primary_config].
3449    ///
3450    /// # Example
3451    /// ```ignore,no_run
3452    /// # use google_cloud_alloydb_v1::model::Cluster;
3453    /// use google_cloud_alloydb_v1::model::cluster::PrimaryConfig;
3454    /// let x = Cluster::new().set_or_clear_primary_config(Some(PrimaryConfig::default()/* use setters */));
3455    /// let x = Cluster::new().set_or_clear_primary_config(None::<PrimaryConfig>);
3456    /// ```
3457    pub fn set_or_clear_primary_config<T>(mut self, v: std::option::Option<T>) -> Self
3458    where
3459        T: std::convert::Into<crate::model::cluster::PrimaryConfig>,
3460    {
3461        self.primary_config = v.map(|x| x.into());
3462        self
3463    }
3464
3465    /// Sets the value of [satisfies_pzs][crate::model::Cluster::satisfies_pzs].
3466    ///
3467    /// # Example
3468    /// ```ignore,no_run
3469    /// # use google_cloud_alloydb_v1::model::Cluster;
3470    /// let x = Cluster::new().set_satisfies_pzs(true);
3471    /// ```
3472    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3473        self.satisfies_pzs = v.into();
3474        self
3475    }
3476
3477    /// Sets the value of [psc_config][crate::model::Cluster::psc_config].
3478    ///
3479    /// # Example
3480    /// ```ignore,no_run
3481    /// # use google_cloud_alloydb_v1::model::Cluster;
3482    /// use google_cloud_alloydb_v1::model::cluster::PscConfig;
3483    /// let x = Cluster::new().set_psc_config(PscConfig::default()/* use setters */);
3484    /// ```
3485    pub fn set_psc_config<T>(mut self, v: T) -> Self
3486    where
3487        T: std::convert::Into<crate::model::cluster::PscConfig>,
3488    {
3489        self.psc_config = std::option::Option::Some(v.into());
3490        self
3491    }
3492
3493    /// Sets or clears the value of [psc_config][crate::model::Cluster::psc_config].
3494    ///
3495    /// # Example
3496    /// ```ignore,no_run
3497    /// # use google_cloud_alloydb_v1::model::Cluster;
3498    /// use google_cloud_alloydb_v1::model::cluster::PscConfig;
3499    /// let x = Cluster::new().set_or_clear_psc_config(Some(PscConfig::default()/* use setters */));
3500    /// let x = Cluster::new().set_or_clear_psc_config(None::<PscConfig>);
3501    /// ```
3502    pub fn set_or_clear_psc_config<T>(mut self, v: std::option::Option<T>) -> Self
3503    where
3504        T: std::convert::Into<crate::model::cluster::PscConfig>,
3505    {
3506        self.psc_config = v.map(|x| x.into());
3507        self
3508    }
3509
3510    /// Sets the value of [maintenance_update_policy][crate::model::Cluster::maintenance_update_policy].
3511    ///
3512    /// # Example
3513    /// ```ignore,no_run
3514    /// # use google_cloud_alloydb_v1::model::Cluster;
3515    /// use google_cloud_alloydb_v1::model::MaintenanceUpdatePolicy;
3516    /// let x = Cluster::new().set_maintenance_update_policy(MaintenanceUpdatePolicy::default()/* use setters */);
3517    /// ```
3518    pub fn set_maintenance_update_policy<T>(mut self, v: T) -> Self
3519    where
3520        T: std::convert::Into<crate::model::MaintenanceUpdatePolicy>,
3521    {
3522        self.maintenance_update_policy = std::option::Option::Some(v.into());
3523        self
3524    }
3525
3526    /// Sets or clears the value of [maintenance_update_policy][crate::model::Cluster::maintenance_update_policy].
3527    ///
3528    /// # Example
3529    /// ```ignore,no_run
3530    /// # use google_cloud_alloydb_v1::model::Cluster;
3531    /// use google_cloud_alloydb_v1::model::MaintenanceUpdatePolicy;
3532    /// let x = Cluster::new().set_or_clear_maintenance_update_policy(Some(MaintenanceUpdatePolicy::default()/* use setters */));
3533    /// let x = Cluster::new().set_or_clear_maintenance_update_policy(None::<MaintenanceUpdatePolicy>);
3534    /// ```
3535    pub fn set_or_clear_maintenance_update_policy<T>(mut self, v: std::option::Option<T>) -> Self
3536    where
3537        T: std::convert::Into<crate::model::MaintenanceUpdatePolicy>,
3538    {
3539        self.maintenance_update_policy = v.map(|x| x.into());
3540        self
3541    }
3542
3543    /// Sets the value of [maintenance_schedule][crate::model::Cluster::maintenance_schedule].
3544    ///
3545    /// # Example
3546    /// ```ignore,no_run
3547    /// # use google_cloud_alloydb_v1::model::Cluster;
3548    /// use google_cloud_alloydb_v1::model::MaintenanceSchedule;
3549    /// let x = Cluster::new().set_maintenance_schedule(MaintenanceSchedule::default()/* use setters */);
3550    /// ```
3551    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
3552    where
3553        T: std::convert::Into<crate::model::MaintenanceSchedule>,
3554    {
3555        self.maintenance_schedule = std::option::Option::Some(v.into());
3556        self
3557    }
3558
3559    /// Sets or clears the value of [maintenance_schedule][crate::model::Cluster::maintenance_schedule].
3560    ///
3561    /// # Example
3562    /// ```ignore,no_run
3563    /// # use google_cloud_alloydb_v1::model::Cluster;
3564    /// use google_cloud_alloydb_v1::model::MaintenanceSchedule;
3565    /// let x = Cluster::new().set_or_clear_maintenance_schedule(Some(MaintenanceSchedule::default()/* use setters */));
3566    /// let x = Cluster::new().set_or_clear_maintenance_schedule(None::<MaintenanceSchedule>);
3567    /// ```
3568    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
3569    where
3570        T: std::convert::Into<crate::model::MaintenanceSchedule>,
3571    {
3572        self.maintenance_schedule = v.map(|x| x.into());
3573        self
3574    }
3575
3576    /// Sets the value of [subscription_type][crate::model::Cluster::subscription_type].
3577    ///
3578    /// # Example
3579    /// ```ignore,no_run
3580    /// # use google_cloud_alloydb_v1::model::Cluster;
3581    /// use google_cloud_alloydb_v1::model::SubscriptionType;
3582    /// let x0 = Cluster::new().set_subscription_type(SubscriptionType::Standard);
3583    /// let x1 = Cluster::new().set_subscription_type(SubscriptionType::Trial);
3584    /// ```
3585    pub fn set_subscription_type<T: std::convert::Into<crate::model::SubscriptionType>>(
3586        mut self,
3587        v: T,
3588    ) -> Self {
3589        self.subscription_type = v.into();
3590        self
3591    }
3592
3593    /// Sets the value of [trial_metadata][crate::model::Cluster::trial_metadata].
3594    ///
3595    /// # Example
3596    /// ```ignore,no_run
3597    /// # use google_cloud_alloydb_v1::model::Cluster;
3598    /// use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
3599    /// let x = Cluster::new().set_trial_metadata(TrialMetadata::default()/* use setters */);
3600    /// ```
3601    pub fn set_trial_metadata<T>(mut self, v: T) -> Self
3602    where
3603        T: std::convert::Into<crate::model::cluster::TrialMetadata>,
3604    {
3605        self.trial_metadata = std::option::Option::Some(v.into());
3606        self
3607    }
3608
3609    /// Sets or clears the value of [trial_metadata][crate::model::Cluster::trial_metadata].
3610    ///
3611    /// # Example
3612    /// ```ignore,no_run
3613    /// # use google_cloud_alloydb_v1::model::Cluster;
3614    /// use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
3615    /// let x = Cluster::new().set_or_clear_trial_metadata(Some(TrialMetadata::default()/* use setters */));
3616    /// let x = Cluster::new().set_or_clear_trial_metadata(None::<TrialMetadata>);
3617    /// ```
3618    pub fn set_or_clear_trial_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3619    where
3620        T: std::convert::Into<crate::model::cluster::TrialMetadata>,
3621    {
3622        self.trial_metadata = v.map(|x| x.into());
3623        self
3624    }
3625
3626    /// Sets the value of [tags][crate::model::Cluster::tags].
3627    ///
3628    /// # Example
3629    /// ```ignore,no_run
3630    /// # use google_cloud_alloydb_v1::model::Cluster;
3631    /// let x = Cluster::new().set_tags([
3632    ///     ("key0", "abc"),
3633    ///     ("key1", "xyz"),
3634    /// ]);
3635    /// ```
3636    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
3637    where
3638        T: std::iter::IntoIterator<Item = (K, V)>,
3639        K: std::convert::Into<std::string::String>,
3640        V: std::convert::Into<std::string::String>,
3641    {
3642        use std::iter::Iterator;
3643        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3644        self
3645    }
3646
3647    /// Sets the value of [source][crate::model::Cluster::source].
3648    ///
3649    /// Note that all the setters affecting `source` are mutually
3650    /// exclusive.
3651    ///
3652    /// # Example
3653    /// ```ignore,no_run
3654    /// # use google_cloud_alloydb_v1::model::Cluster;
3655    /// use google_cloud_alloydb_v1::model::BackupSource;
3656    /// let x = Cluster::new().set_source(Some(
3657    ///     google_cloud_alloydb_v1::model::cluster::Source::BackupSource(BackupSource::default().into())));
3658    /// ```
3659    pub fn set_source<T: std::convert::Into<std::option::Option<crate::model::cluster::Source>>>(
3660        mut self,
3661        v: T,
3662    ) -> Self {
3663        self.source = v.into();
3664        self
3665    }
3666
3667    /// The value of [source][crate::model::Cluster::source]
3668    /// if it holds a `BackupSource`, `None` if the field is not set or
3669    /// holds a different branch.
3670    pub fn backup_source(
3671        &self,
3672    ) -> std::option::Option<&std::boxed::Box<crate::model::BackupSource>> {
3673        #[allow(unreachable_patterns)]
3674        self.source.as_ref().and_then(|v| match v {
3675            crate::model::cluster::Source::BackupSource(v) => std::option::Option::Some(v),
3676            _ => std::option::Option::None,
3677        })
3678    }
3679
3680    /// Sets the value of [source][crate::model::Cluster::source]
3681    /// to hold a `BackupSource`.
3682    ///
3683    /// Note that all the setters affecting `source` are
3684    /// mutually exclusive.
3685    ///
3686    /// # Example
3687    /// ```ignore,no_run
3688    /// # use google_cloud_alloydb_v1::model::Cluster;
3689    /// use google_cloud_alloydb_v1::model::BackupSource;
3690    /// let x = Cluster::new().set_backup_source(BackupSource::default()/* use setters */);
3691    /// assert!(x.backup_source().is_some());
3692    /// assert!(x.migration_source().is_none());
3693    /// assert!(x.cloudsql_backup_run_source().is_none());
3694    /// ```
3695    pub fn set_backup_source<T: std::convert::Into<std::boxed::Box<crate::model::BackupSource>>>(
3696        mut self,
3697        v: T,
3698    ) -> Self {
3699        self.source =
3700            std::option::Option::Some(crate::model::cluster::Source::BackupSource(v.into()));
3701        self
3702    }
3703
3704    /// The value of [source][crate::model::Cluster::source]
3705    /// if it holds a `MigrationSource`, `None` if the field is not set or
3706    /// holds a different branch.
3707    pub fn migration_source(
3708        &self,
3709    ) -> std::option::Option<&std::boxed::Box<crate::model::MigrationSource>> {
3710        #[allow(unreachable_patterns)]
3711        self.source.as_ref().and_then(|v| match v {
3712            crate::model::cluster::Source::MigrationSource(v) => std::option::Option::Some(v),
3713            _ => std::option::Option::None,
3714        })
3715    }
3716
3717    /// Sets the value of [source][crate::model::Cluster::source]
3718    /// to hold a `MigrationSource`.
3719    ///
3720    /// Note that all the setters affecting `source` are
3721    /// mutually exclusive.
3722    ///
3723    /// # Example
3724    /// ```ignore,no_run
3725    /// # use google_cloud_alloydb_v1::model::Cluster;
3726    /// use google_cloud_alloydb_v1::model::MigrationSource;
3727    /// let x = Cluster::new().set_migration_source(MigrationSource::default()/* use setters */);
3728    /// assert!(x.migration_source().is_some());
3729    /// assert!(x.backup_source().is_none());
3730    /// assert!(x.cloudsql_backup_run_source().is_none());
3731    /// ```
3732    pub fn set_migration_source<
3733        T: std::convert::Into<std::boxed::Box<crate::model::MigrationSource>>,
3734    >(
3735        mut self,
3736        v: T,
3737    ) -> Self {
3738        self.source =
3739            std::option::Option::Some(crate::model::cluster::Source::MigrationSource(v.into()));
3740        self
3741    }
3742
3743    /// The value of [source][crate::model::Cluster::source]
3744    /// if it holds a `CloudsqlBackupRunSource`, `None` if the field is not set or
3745    /// holds a different branch.
3746    pub fn cloudsql_backup_run_source(
3747        &self,
3748    ) -> std::option::Option<&std::boxed::Box<crate::model::CloudSQLBackupRunSource>> {
3749        #[allow(unreachable_patterns)]
3750        self.source.as_ref().and_then(|v| match v {
3751            crate::model::cluster::Source::CloudsqlBackupRunSource(v) => {
3752                std::option::Option::Some(v)
3753            }
3754            _ => std::option::Option::None,
3755        })
3756    }
3757
3758    /// Sets the value of [source][crate::model::Cluster::source]
3759    /// to hold a `CloudsqlBackupRunSource`.
3760    ///
3761    /// Note that all the setters affecting `source` are
3762    /// mutually exclusive.
3763    ///
3764    /// # Example
3765    /// ```ignore,no_run
3766    /// # use google_cloud_alloydb_v1::model::Cluster;
3767    /// use google_cloud_alloydb_v1::model::CloudSQLBackupRunSource;
3768    /// let x = Cluster::new().set_cloudsql_backup_run_source(CloudSQLBackupRunSource::default()/* use setters */);
3769    /// assert!(x.cloudsql_backup_run_source().is_some());
3770    /// assert!(x.backup_source().is_none());
3771    /// assert!(x.migration_source().is_none());
3772    /// ```
3773    pub fn set_cloudsql_backup_run_source<
3774        T: std::convert::Into<std::boxed::Box<crate::model::CloudSQLBackupRunSource>>,
3775    >(
3776        mut self,
3777        v: T,
3778    ) -> Self {
3779        self.source = std::option::Option::Some(
3780            crate::model::cluster::Source::CloudsqlBackupRunSource(v.into()),
3781        );
3782        self
3783    }
3784}
3785
3786impl wkt::message::Message for Cluster {
3787    fn typename() -> &'static str {
3788        "type.googleapis.com/google.cloud.alloydb.v1.Cluster"
3789    }
3790}
3791
3792/// Defines additional types related to [Cluster].
3793pub mod cluster {
3794    #[allow(unused_imports)]
3795    use super::*;
3796
3797    /// Metadata related to network configuration.
3798    #[derive(Clone, Default, PartialEq)]
3799    #[non_exhaustive]
3800    pub struct NetworkConfig {
3801        /// Optional. The resource link for the VPC network in which cluster
3802        /// resources are created and from which they are accessible via Private IP.
3803        /// The network must belong to the same project as the cluster. It is
3804        /// specified in the form:
3805        /// `projects/{project_number}/global/networks/{network_id}`. This is
3806        /// required to create a cluster.
3807        pub network: std::string::String,
3808
3809        /// Optional. Name of the allocated IP range for the private IP AlloyDB
3810        /// cluster, for example: "google-managed-services-default". If set, the
3811        /// instance IPs for this cluster will be created in the allocated range. The
3812        /// range name must comply with RFC 1035. Specifically, the name must be 1-63
3813        /// characters long and match the regular expression
3814        /// `[a-z]([-a-z0-9]*[a-z0-9])?`.
3815        /// Field name is intended to be consistent with Cloud SQL.
3816        pub allocated_ip_range: std::string::String,
3817
3818        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3819    }
3820
3821    impl NetworkConfig {
3822        pub fn new() -> Self {
3823            std::default::Default::default()
3824        }
3825
3826        /// Sets the value of [network][crate::model::cluster::NetworkConfig::network].
3827        ///
3828        /// # Example
3829        /// ```ignore,no_run
3830        /// # use google_cloud_alloydb_v1::model::cluster::NetworkConfig;
3831        /// let x = NetworkConfig::new().set_network("example");
3832        /// ```
3833        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3834            self.network = v.into();
3835            self
3836        }
3837
3838        /// Sets the value of [allocated_ip_range][crate::model::cluster::NetworkConfig::allocated_ip_range].
3839        ///
3840        /// # Example
3841        /// ```ignore,no_run
3842        /// # use google_cloud_alloydb_v1::model::cluster::NetworkConfig;
3843        /// let x = NetworkConfig::new().set_allocated_ip_range("example");
3844        /// ```
3845        pub fn set_allocated_ip_range<T: std::convert::Into<std::string::String>>(
3846            mut self,
3847            v: T,
3848        ) -> Self {
3849            self.allocated_ip_range = v.into();
3850            self
3851        }
3852    }
3853
3854    impl wkt::message::Message for NetworkConfig {
3855        fn typename() -> &'static str {
3856            "type.googleapis.com/google.cloud.alloydb.v1.Cluster.NetworkConfig"
3857        }
3858    }
3859
3860    /// Configuration information for the secondary cluster. This should be set
3861    /// if and only if the cluster is of type SECONDARY.
3862    #[derive(Clone, Default, PartialEq)]
3863    #[non_exhaustive]
3864    pub struct SecondaryConfig {
3865        /// The name of the primary cluster name with the format:
3866        ///
3867        /// * projects/{project}/locations/{region}/clusters/{cluster_id}
3868        pub primary_cluster_name: std::string::String,
3869
3870        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3871    }
3872
3873    impl SecondaryConfig {
3874        pub fn new() -> Self {
3875            std::default::Default::default()
3876        }
3877
3878        /// Sets the value of [primary_cluster_name][crate::model::cluster::SecondaryConfig::primary_cluster_name].
3879        ///
3880        /// # Example
3881        /// ```ignore,no_run
3882        /// # use google_cloud_alloydb_v1::model::cluster::SecondaryConfig;
3883        /// let x = SecondaryConfig::new().set_primary_cluster_name("example");
3884        /// ```
3885        pub fn set_primary_cluster_name<T: std::convert::Into<std::string::String>>(
3886            mut self,
3887            v: T,
3888        ) -> Self {
3889            self.primary_cluster_name = v.into();
3890            self
3891        }
3892    }
3893
3894    impl wkt::message::Message for SecondaryConfig {
3895        fn typename() -> &'static str {
3896            "type.googleapis.com/google.cloud.alloydb.v1.Cluster.SecondaryConfig"
3897        }
3898    }
3899
3900    /// Configuration for the primary cluster. It has the list of clusters that are
3901    /// replicating from this cluster. This should be set if and only if the
3902    /// cluster is of type PRIMARY.
3903    #[derive(Clone, Default, PartialEq)]
3904    #[non_exhaustive]
3905    pub struct PrimaryConfig {
3906        /// Output only. Names of the clusters that are replicating from this
3907        /// cluster.
3908        pub secondary_cluster_names: std::vec::Vec<std::string::String>,
3909
3910        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3911    }
3912
3913    impl PrimaryConfig {
3914        pub fn new() -> Self {
3915            std::default::Default::default()
3916        }
3917
3918        /// Sets the value of [secondary_cluster_names][crate::model::cluster::PrimaryConfig::secondary_cluster_names].
3919        ///
3920        /// # Example
3921        /// ```ignore,no_run
3922        /// # use google_cloud_alloydb_v1::model::cluster::PrimaryConfig;
3923        /// let x = PrimaryConfig::new().set_secondary_cluster_names(["a", "b", "c"]);
3924        /// ```
3925        pub fn set_secondary_cluster_names<T, V>(mut self, v: T) -> Self
3926        where
3927            T: std::iter::IntoIterator<Item = V>,
3928            V: std::convert::Into<std::string::String>,
3929        {
3930            use std::iter::Iterator;
3931            self.secondary_cluster_names = v.into_iter().map(|i| i.into()).collect();
3932            self
3933        }
3934    }
3935
3936    impl wkt::message::Message for PrimaryConfig {
3937        fn typename() -> &'static str {
3938            "type.googleapis.com/google.cloud.alloydb.v1.Cluster.PrimaryConfig"
3939        }
3940    }
3941
3942    /// PscConfig contains PSC related configuration at a cluster level.
3943    #[derive(Clone, Default, PartialEq)]
3944    #[non_exhaustive]
3945    pub struct PscConfig {
3946        /// Optional. Create an instance that allows connections from Private Service
3947        /// Connect endpoints to the instance.
3948        pub psc_enabled: bool,
3949
3950        /// Output only. The project number that needs to be allowlisted on the
3951        /// network attachment to enable outbound connectivity.
3952        pub service_owned_project_number: i64,
3953
3954        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3955    }
3956
3957    impl PscConfig {
3958        pub fn new() -> Self {
3959            std::default::Default::default()
3960        }
3961
3962        /// Sets the value of [psc_enabled][crate::model::cluster::PscConfig::psc_enabled].
3963        ///
3964        /// # Example
3965        /// ```ignore,no_run
3966        /// # use google_cloud_alloydb_v1::model::cluster::PscConfig;
3967        /// let x = PscConfig::new().set_psc_enabled(true);
3968        /// ```
3969        pub fn set_psc_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3970            self.psc_enabled = v.into();
3971            self
3972        }
3973
3974        /// Sets the value of [service_owned_project_number][crate::model::cluster::PscConfig::service_owned_project_number].
3975        ///
3976        /// # Example
3977        /// ```ignore,no_run
3978        /// # use google_cloud_alloydb_v1::model::cluster::PscConfig;
3979        /// let x = PscConfig::new().set_service_owned_project_number(42);
3980        /// ```
3981        pub fn set_service_owned_project_number<T: std::convert::Into<i64>>(
3982            mut self,
3983            v: T,
3984        ) -> Self {
3985            self.service_owned_project_number = v.into();
3986            self
3987        }
3988    }
3989
3990    impl wkt::message::Message for PscConfig {
3991        fn typename() -> &'static str {
3992            "type.googleapis.com/google.cloud.alloydb.v1.Cluster.PscConfig"
3993        }
3994    }
3995
3996    /// Contains information and all metadata related to TRIAL clusters.
3997    #[derive(Clone, Default, PartialEq)]
3998    #[non_exhaustive]
3999    pub struct TrialMetadata {
4000        /// start time of the trial cluster.
4001        pub start_time: std::option::Option<wkt::Timestamp>,
4002
4003        /// End time of the trial cluster.
4004        pub end_time: std::option::Option<wkt::Timestamp>,
4005
4006        /// Upgrade time of trial cluster to Standard cluster.
4007        pub upgrade_time: std::option::Option<wkt::Timestamp>,
4008
4009        /// grace end time of the cluster.
4010        pub grace_end_time: std::option::Option<wkt::Timestamp>,
4011
4012        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4013    }
4014
4015    impl TrialMetadata {
4016        pub fn new() -> Self {
4017            std::default::Default::default()
4018        }
4019
4020        /// Sets the value of [start_time][crate::model::cluster::TrialMetadata::start_time].
4021        ///
4022        /// # Example
4023        /// ```ignore,no_run
4024        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4025        /// use wkt::Timestamp;
4026        /// let x = TrialMetadata::new().set_start_time(Timestamp::default()/* use setters */);
4027        /// ```
4028        pub fn set_start_time<T>(mut self, v: T) -> Self
4029        where
4030            T: std::convert::Into<wkt::Timestamp>,
4031        {
4032            self.start_time = std::option::Option::Some(v.into());
4033            self
4034        }
4035
4036        /// Sets or clears the value of [start_time][crate::model::cluster::TrialMetadata::start_time].
4037        ///
4038        /// # Example
4039        /// ```ignore,no_run
4040        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4041        /// use wkt::Timestamp;
4042        /// let x = TrialMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
4043        /// let x = TrialMetadata::new().set_or_clear_start_time(None::<Timestamp>);
4044        /// ```
4045        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4046        where
4047            T: std::convert::Into<wkt::Timestamp>,
4048        {
4049            self.start_time = v.map(|x| x.into());
4050            self
4051        }
4052
4053        /// Sets the value of [end_time][crate::model::cluster::TrialMetadata::end_time].
4054        ///
4055        /// # Example
4056        /// ```ignore,no_run
4057        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4058        /// use wkt::Timestamp;
4059        /// let x = TrialMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4060        /// ```
4061        pub fn set_end_time<T>(mut self, v: T) -> Self
4062        where
4063            T: std::convert::Into<wkt::Timestamp>,
4064        {
4065            self.end_time = std::option::Option::Some(v.into());
4066            self
4067        }
4068
4069        /// Sets or clears the value of [end_time][crate::model::cluster::TrialMetadata::end_time].
4070        ///
4071        /// # Example
4072        /// ```ignore,no_run
4073        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4074        /// use wkt::Timestamp;
4075        /// let x = TrialMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4076        /// let x = TrialMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4077        /// ```
4078        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4079        where
4080            T: std::convert::Into<wkt::Timestamp>,
4081        {
4082            self.end_time = v.map(|x| x.into());
4083            self
4084        }
4085
4086        /// Sets the value of [upgrade_time][crate::model::cluster::TrialMetadata::upgrade_time].
4087        ///
4088        /// # Example
4089        /// ```ignore,no_run
4090        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4091        /// use wkt::Timestamp;
4092        /// let x = TrialMetadata::new().set_upgrade_time(Timestamp::default()/* use setters */);
4093        /// ```
4094        pub fn set_upgrade_time<T>(mut self, v: T) -> Self
4095        where
4096            T: std::convert::Into<wkt::Timestamp>,
4097        {
4098            self.upgrade_time = std::option::Option::Some(v.into());
4099            self
4100        }
4101
4102        /// Sets or clears the value of [upgrade_time][crate::model::cluster::TrialMetadata::upgrade_time].
4103        ///
4104        /// # Example
4105        /// ```ignore,no_run
4106        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4107        /// use wkt::Timestamp;
4108        /// let x = TrialMetadata::new().set_or_clear_upgrade_time(Some(Timestamp::default()/* use setters */));
4109        /// let x = TrialMetadata::new().set_or_clear_upgrade_time(None::<Timestamp>);
4110        /// ```
4111        pub fn set_or_clear_upgrade_time<T>(mut self, v: std::option::Option<T>) -> Self
4112        where
4113            T: std::convert::Into<wkt::Timestamp>,
4114        {
4115            self.upgrade_time = v.map(|x| x.into());
4116            self
4117        }
4118
4119        /// Sets the value of [grace_end_time][crate::model::cluster::TrialMetadata::grace_end_time].
4120        ///
4121        /// # Example
4122        /// ```ignore,no_run
4123        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4124        /// use wkt::Timestamp;
4125        /// let x = TrialMetadata::new().set_grace_end_time(Timestamp::default()/* use setters */);
4126        /// ```
4127        pub fn set_grace_end_time<T>(mut self, v: T) -> Self
4128        where
4129            T: std::convert::Into<wkt::Timestamp>,
4130        {
4131            self.grace_end_time = std::option::Option::Some(v.into());
4132            self
4133        }
4134
4135        /// Sets or clears the value of [grace_end_time][crate::model::cluster::TrialMetadata::grace_end_time].
4136        ///
4137        /// # Example
4138        /// ```ignore,no_run
4139        /// # use google_cloud_alloydb_v1::model::cluster::TrialMetadata;
4140        /// use wkt::Timestamp;
4141        /// let x = TrialMetadata::new().set_or_clear_grace_end_time(Some(Timestamp::default()/* use setters */));
4142        /// let x = TrialMetadata::new().set_or_clear_grace_end_time(None::<Timestamp>);
4143        /// ```
4144        pub fn set_or_clear_grace_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4145        where
4146            T: std::convert::Into<wkt::Timestamp>,
4147        {
4148            self.grace_end_time = v.map(|x| x.into());
4149            self
4150        }
4151    }
4152
4153    impl wkt::message::Message for TrialMetadata {
4154        fn typename() -> &'static str {
4155            "type.googleapis.com/google.cloud.alloydb.v1.Cluster.TrialMetadata"
4156        }
4157    }
4158
4159    /// Cluster State
4160    ///
4161    /// # Working with unknown values
4162    ///
4163    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4164    /// additional enum variants at any time. Adding new variants is not considered
4165    /// a breaking change. Applications should write their code in anticipation of:
4166    ///
4167    /// - New values appearing in future releases of the client library, **and**
4168    /// - New values received dynamically, without application changes.
4169    ///
4170    /// Please consult the [Working with enums] section in the user guide for some
4171    /// guidelines.
4172    ///
4173    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4174    #[derive(Clone, Debug, PartialEq)]
4175    #[non_exhaustive]
4176    pub enum State {
4177        /// The state of the cluster is unknown.
4178        Unspecified,
4179        /// The cluster is active and running.
4180        Ready,
4181        /// This is unused. Even when all instances in the cluster are stopped, the
4182        /// cluster remains in READY state.
4183        Stopped,
4184        /// The cluster is empty and has no associated resources.
4185        /// All instances, associated storage and backups have been deleted.
4186        Empty,
4187        /// The cluster is being created.
4188        Creating,
4189        /// The cluster is being deleted.
4190        Deleting,
4191        /// The creation of the cluster failed.
4192        Failed,
4193        /// The cluster is bootstrapping with data from some other source.
4194        /// Direct mutations to the cluster (e.g. adding read pool) are not allowed.
4195        Bootstrapping,
4196        /// The cluster is under maintenance. AlloyDB regularly performs maintenance
4197        /// and upgrades on customer clusters. Updates on the cluster are
4198        /// not allowed while the cluster is in this state.
4199        Maintenance,
4200        /// The cluster is being promoted.
4201        Promoting,
4202        /// If set, the enum was initialized with an unknown value.
4203        ///
4204        /// Applications can examine the value using [State::value] or
4205        /// [State::name].
4206        UnknownValue(state::UnknownValue),
4207    }
4208
4209    #[doc(hidden)]
4210    pub mod state {
4211        #[allow(unused_imports)]
4212        use super::*;
4213        #[derive(Clone, Debug, PartialEq)]
4214        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4215    }
4216
4217    impl State {
4218        /// Gets the enum value.
4219        ///
4220        /// Returns `None` if the enum contains an unknown value deserialized from
4221        /// the string representation of enums.
4222        pub fn value(&self) -> std::option::Option<i32> {
4223            match self {
4224                Self::Unspecified => std::option::Option::Some(0),
4225                Self::Ready => std::option::Option::Some(1),
4226                Self::Stopped => std::option::Option::Some(2),
4227                Self::Empty => std::option::Option::Some(3),
4228                Self::Creating => std::option::Option::Some(4),
4229                Self::Deleting => std::option::Option::Some(5),
4230                Self::Failed => std::option::Option::Some(6),
4231                Self::Bootstrapping => std::option::Option::Some(7),
4232                Self::Maintenance => std::option::Option::Some(8),
4233                Self::Promoting => std::option::Option::Some(9),
4234                Self::UnknownValue(u) => u.0.value(),
4235            }
4236        }
4237
4238        /// Gets the enum value as a string.
4239        ///
4240        /// Returns `None` if the enum contains an unknown value deserialized from
4241        /// the integer representation of enums.
4242        pub fn name(&self) -> std::option::Option<&str> {
4243            match self {
4244                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4245                Self::Ready => std::option::Option::Some("READY"),
4246                Self::Stopped => std::option::Option::Some("STOPPED"),
4247                Self::Empty => std::option::Option::Some("EMPTY"),
4248                Self::Creating => std::option::Option::Some("CREATING"),
4249                Self::Deleting => std::option::Option::Some("DELETING"),
4250                Self::Failed => std::option::Option::Some("FAILED"),
4251                Self::Bootstrapping => std::option::Option::Some("BOOTSTRAPPING"),
4252                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
4253                Self::Promoting => std::option::Option::Some("PROMOTING"),
4254                Self::UnknownValue(u) => u.0.name(),
4255            }
4256        }
4257    }
4258
4259    impl std::default::Default for State {
4260        fn default() -> Self {
4261            use std::convert::From;
4262            Self::from(0)
4263        }
4264    }
4265
4266    impl std::fmt::Display for State {
4267        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4268            wkt::internal::display_enum(f, self.name(), self.value())
4269        }
4270    }
4271
4272    impl std::convert::From<i32> for State {
4273        fn from(value: i32) -> Self {
4274            match value {
4275                0 => Self::Unspecified,
4276                1 => Self::Ready,
4277                2 => Self::Stopped,
4278                3 => Self::Empty,
4279                4 => Self::Creating,
4280                5 => Self::Deleting,
4281                6 => Self::Failed,
4282                7 => Self::Bootstrapping,
4283                8 => Self::Maintenance,
4284                9 => Self::Promoting,
4285                _ => Self::UnknownValue(state::UnknownValue(
4286                    wkt::internal::UnknownEnumValue::Integer(value),
4287                )),
4288            }
4289        }
4290    }
4291
4292    impl std::convert::From<&str> for State {
4293        fn from(value: &str) -> Self {
4294            use std::string::ToString;
4295            match value {
4296                "STATE_UNSPECIFIED" => Self::Unspecified,
4297                "READY" => Self::Ready,
4298                "STOPPED" => Self::Stopped,
4299                "EMPTY" => Self::Empty,
4300                "CREATING" => Self::Creating,
4301                "DELETING" => Self::Deleting,
4302                "FAILED" => Self::Failed,
4303                "BOOTSTRAPPING" => Self::Bootstrapping,
4304                "MAINTENANCE" => Self::Maintenance,
4305                "PROMOTING" => Self::Promoting,
4306                _ => Self::UnknownValue(state::UnknownValue(
4307                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4308                )),
4309            }
4310        }
4311    }
4312
4313    impl serde::ser::Serialize for State {
4314        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4315        where
4316            S: serde::Serializer,
4317        {
4318            match self {
4319                Self::Unspecified => serializer.serialize_i32(0),
4320                Self::Ready => serializer.serialize_i32(1),
4321                Self::Stopped => serializer.serialize_i32(2),
4322                Self::Empty => serializer.serialize_i32(3),
4323                Self::Creating => serializer.serialize_i32(4),
4324                Self::Deleting => serializer.serialize_i32(5),
4325                Self::Failed => serializer.serialize_i32(6),
4326                Self::Bootstrapping => serializer.serialize_i32(7),
4327                Self::Maintenance => serializer.serialize_i32(8),
4328                Self::Promoting => serializer.serialize_i32(9),
4329                Self::UnknownValue(u) => u.0.serialize(serializer),
4330            }
4331        }
4332    }
4333
4334    impl<'de> serde::de::Deserialize<'de> for State {
4335        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4336        where
4337            D: serde::Deserializer<'de>,
4338        {
4339            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4340                ".google.cloud.alloydb.v1.Cluster.State",
4341            ))
4342        }
4343    }
4344
4345    /// Type of Cluster
4346    ///
4347    /// # Working with unknown values
4348    ///
4349    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4350    /// additional enum variants at any time. Adding new variants is not considered
4351    /// a breaking change. Applications should write their code in anticipation of:
4352    ///
4353    /// - New values appearing in future releases of the client library, **and**
4354    /// - New values received dynamically, without application changes.
4355    ///
4356    /// Please consult the [Working with enums] section in the user guide for some
4357    /// guidelines.
4358    ///
4359    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4360    #[derive(Clone, Debug, PartialEq)]
4361    #[non_exhaustive]
4362    pub enum ClusterType {
4363        /// The type of the cluster is unknown.
4364        Unspecified,
4365        /// Primary cluster that support read and write operations.
4366        Primary,
4367        /// Secondary cluster that is replicating from another region.
4368        /// This only supports read.
4369        Secondary,
4370        /// If set, the enum was initialized with an unknown value.
4371        ///
4372        /// Applications can examine the value using [ClusterType::value] or
4373        /// [ClusterType::name].
4374        UnknownValue(cluster_type::UnknownValue),
4375    }
4376
4377    #[doc(hidden)]
4378    pub mod cluster_type {
4379        #[allow(unused_imports)]
4380        use super::*;
4381        #[derive(Clone, Debug, PartialEq)]
4382        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4383    }
4384
4385    impl ClusterType {
4386        /// Gets the enum value.
4387        ///
4388        /// Returns `None` if the enum contains an unknown value deserialized from
4389        /// the string representation of enums.
4390        pub fn value(&self) -> std::option::Option<i32> {
4391            match self {
4392                Self::Unspecified => std::option::Option::Some(0),
4393                Self::Primary => std::option::Option::Some(1),
4394                Self::Secondary => std::option::Option::Some(2),
4395                Self::UnknownValue(u) => u.0.value(),
4396            }
4397        }
4398
4399        /// Gets the enum value as a string.
4400        ///
4401        /// Returns `None` if the enum contains an unknown value deserialized from
4402        /// the integer representation of enums.
4403        pub fn name(&self) -> std::option::Option<&str> {
4404            match self {
4405                Self::Unspecified => std::option::Option::Some("CLUSTER_TYPE_UNSPECIFIED"),
4406                Self::Primary => std::option::Option::Some("PRIMARY"),
4407                Self::Secondary => std::option::Option::Some("SECONDARY"),
4408                Self::UnknownValue(u) => u.0.name(),
4409            }
4410        }
4411    }
4412
4413    impl std::default::Default for ClusterType {
4414        fn default() -> Self {
4415            use std::convert::From;
4416            Self::from(0)
4417        }
4418    }
4419
4420    impl std::fmt::Display for ClusterType {
4421        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4422            wkt::internal::display_enum(f, self.name(), self.value())
4423        }
4424    }
4425
4426    impl std::convert::From<i32> for ClusterType {
4427        fn from(value: i32) -> Self {
4428            match value {
4429                0 => Self::Unspecified,
4430                1 => Self::Primary,
4431                2 => Self::Secondary,
4432                _ => Self::UnknownValue(cluster_type::UnknownValue(
4433                    wkt::internal::UnknownEnumValue::Integer(value),
4434                )),
4435            }
4436        }
4437    }
4438
4439    impl std::convert::From<&str> for ClusterType {
4440        fn from(value: &str) -> Self {
4441            use std::string::ToString;
4442            match value {
4443                "CLUSTER_TYPE_UNSPECIFIED" => Self::Unspecified,
4444                "PRIMARY" => Self::Primary,
4445                "SECONDARY" => Self::Secondary,
4446                _ => Self::UnknownValue(cluster_type::UnknownValue(
4447                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4448                )),
4449            }
4450        }
4451    }
4452
4453    impl serde::ser::Serialize for ClusterType {
4454        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4455        where
4456            S: serde::Serializer,
4457        {
4458            match self {
4459                Self::Unspecified => serializer.serialize_i32(0),
4460                Self::Primary => serializer.serialize_i32(1),
4461                Self::Secondary => serializer.serialize_i32(2),
4462                Self::UnknownValue(u) => u.0.serialize(serializer),
4463            }
4464        }
4465    }
4466
4467    impl<'de> serde::de::Deserialize<'de> for ClusterType {
4468        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4469        where
4470            D: serde::Deserializer<'de>,
4471        {
4472            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterType>::new(
4473                ".google.cloud.alloydb.v1.Cluster.ClusterType",
4474            ))
4475        }
4476    }
4477
4478    /// In case of an imported cluster, this field contains information about the
4479    /// source this cluster was imported from.
4480    #[derive(Clone, Debug, PartialEq)]
4481    #[non_exhaustive]
4482    pub enum Source {
4483        /// Output only. Cluster created from backup.
4484        BackupSource(std::boxed::Box<crate::model::BackupSource>),
4485        /// Output only. Cluster created via DMS migration.
4486        MigrationSource(std::boxed::Box<crate::model::MigrationSource>),
4487        /// Output only. Cluster created from CloudSQL snapshot.
4488        CloudsqlBackupRunSource(std::boxed::Box<crate::model::CloudSQLBackupRunSource>),
4489    }
4490}
4491
4492/// An Instance is a computing unit that an end customer can connect to.
4493/// It's the main unit of computing resources in AlloyDB.
4494#[derive(Clone, Default, PartialEq)]
4495#[non_exhaustive]
4496pub struct Instance {
4497    /// Output only. The name of the instance resource with the format:
4498    ///
4499    /// * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id}
4500    ///   where the cluster and instance ID segments should satisfy the regex
4501    ///   expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of
4502    ///   lowercase letters, numbers, and dashes, starting with a letter, and ending
4503    ///   with a letter or number. For more details see <https://google.aip.dev/122>.
4504    ///   The prefix of the instance resource name is the name of the parent
4505    ///   resource:
4506    /// * projects/{project}/locations/{region}/clusters/{cluster_id}
4507    pub name: std::string::String,
4508
4509    /// User-settable and human-readable display name for the Instance.
4510    pub display_name: std::string::String,
4511
4512    /// Output only. The system-generated UID of the resource. The UID is assigned
4513    /// when the resource is created, and it is retained until it is deleted.
4514    pub uid: std::string::String,
4515
4516    /// Output only. Create time stamp
4517    pub create_time: std::option::Option<wkt::Timestamp>,
4518
4519    /// Output only. Update time stamp
4520    pub update_time: std::option::Option<wkt::Timestamp>,
4521
4522    /// Output only. Delete time stamp
4523    pub delete_time: std::option::Option<wkt::Timestamp>,
4524
4525    /// Labels as key value pairs
4526    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
4527
4528    /// Output only. The current serving state of the instance.
4529    pub state: crate::model::instance::State,
4530
4531    /// Required. The type of the instance. Specified at creation time.
4532    pub instance_type: crate::model::instance::InstanceType,
4533
4534    /// Configurations for the machines that host the underlying
4535    /// database engine.
4536    pub machine_config: std::option::Option<crate::model::instance::MachineConfig>,
4537
4538    /// Availability type of an Instance.
4539    /// If empty, defaults to REGIONAL for primary instances.
4540    /// For read pools, availability_type is always UNSPECIFIED. Instances in the
4541    /// read pools are evenly distributed across available zones within the region
4542    /// (i.e. read pools with more than one node will have a node in at
4543    /// least two zones).
4544    pub availability_type: crate::model::instance::AvailabilityType,
4545
4546    /// The Compute Engine zone that the instance should serve from, per
4547    /// <https://cloud.google.com/compute/docs/regions-zones>
4548    /// This can ONLY be specified for ZONAL instances.
4549    /// If present for a REGIONAL instance, an error will be thrown.
4550    /// If this is absent for a ZONAL instance, instance is created in a random
4551    /// zone with available capacity.
4552    pub gce_zone: std::string::String,
4553
4554    /// Database flags. Set at the instance level.
4555    /// They are copied from the primary instance on secondary instance creation.
4556    /// Flags that have restrictions default to the value at primary
4557    /// instance on read instances during creation. Read instances can set new
4558    /// flags or override existing flags that are relevant for reads, for example,
4559    /// for enabling columnar cache on a read instance. Flags set on read instance
4560    /// might or might not be present on the primary instance.
4561    ///
4562    /// This is a list of "key": "value" pairs.
4563    /// "key": The name of the flag. These flags are passed at instance setup time,
4564    /// so include both server options and system variables for Postgres. Flags are
4565    /// specified with underscores, not hyphens.
4566    /// "value": The value of the flag. Booleans are set to **on** for true
4567    /// and **off** for false. This field must be omitted if the flag
4568    /// doesn't take a value.
4569    pub database_flags: std::collections::HashMap<std::string::String, std::string::String>,
4570
4571    /// Output only. This is set for the read-write VM of the PRIMARY instance
4572    /// only.
4573    pub writable_node: std::option::Option<crate::model::instance::Node>,
4574
4575    /// Output only. List of available read-only VMs in this instance, including
4576    /// the standby for a PRIMARY instance.
4577    pub nodes: std::vec::Vec<crate::model::instance::Node>,
4578
4579    /// Configuration for query insights.
4580    pub query_insights_config:
4581        std::option::Option<crate::model::instance::QueryInsightsInstanceConfig>,
4582
4583    /// Configuration for observability.
4584    pub observability_config:
4585        std::option::Option<crate::model::instance::ObservabilityInstanceConfig>,
4586
4587    /// Read pool instance configuration.
4588    /// This is required if the value of instanceType is READ_POOL.
4589    pub read_pool_config: std::option::Option<crate::model::instance::ReadPoolConfig>,
4590
4591    /// Output only. The IP address for the Instance.
4592    /// This is the connection endpoint for an end-user application.
4593    pub ip_address: std::string::String,
4594
4595    /// Output only. The public IP addresses for the Instance. This is available
4596    /// ONLY when enable_public_ip is set. This is the connection endpoint for an
4597    /// end-user application.
4598    pub public_ip_address: std::string::String,
4599
4600    /// Output only. Reconciling (<https://google.aip.dev/128#reconciliation>).
4601    /// Set to true if the current state of Instance does not match the user's
4602    /// intended state, and the service is actively updating the resource to
4603    /// reconcile them. This can happen due to user-triggered updates or
4604    /// system actions like failover or maintenance.
4605    pub reconciling: bool,
4606
4607    /// For Resource freshness validation (<https://google.aip.dev/154>)
4608    pub etag: std::string::String,
4609
4610    /// Annotations to allow client tools to store small amount of arbitrary data.
4611    /// This is distinct from labels.
4612    /// <https://google.aip.dev/128>
4613    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
4614
4615    /// Optional. Client connection specific configurations
4616    pub client_connection_config:
4617        std::option::Option<crate::model::instance::ClientConnectionConfig>,
4618
4619    /// Output only. Reserved for future use.
4620    pub satisfies_pzs: bool,
4621
4622    /// Optional. The configuration for Private Service Connect (PSC) for the
4623    /// instance.
4624    pub psc_instance_config: std::option::Option<crate::model::instance::PscInstanceConfig>,
4625
4626    /// Optional. Instance-level network configuration.
4627    pub network_config: std::option::Option<crate::model::instance::InstanceNetworkConfig>,
4628
4629    /// Output only. All outbound public IP addresses configured for the instance.
4630    pub outbound_public_ip_addresses: std::vec::Vec<std::string::String>,
4631
4632    /// Optional. Specifies whether an instance needs to spin up. Once the instance
4633    /// is active, the activation policy can be updated to the `NEVER` to stop the
4634    /// instance. Likewise, the activation policy can be updated to `ALWAYS` to
4635    /// start the instance.
4636    /// There are restrictions around when an instance can/cannot be activated (for
4637    /// example, a read pool instance should be stopped before stopping primary
4638    /// etc.). Please refer to the API documentation for more details.
4639    pub activation_policy: crate::model::instance::ActivationPolicy,
4640
4641    /// Optional. The configuration for Managed Connection Pool (MCP).
4642    pub connection_pool_config: std::option::Option<crate::model::instance::ConnectionPoolConfig>,
4643
4644    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4645}
4646
4647impl Instance {
4648    pub fn new() -> Self {
4649        std::default::Default::default()
4650    }
4651
4652    /// Sets the value of [name][crate::model::Instance::name].
4653    ///
4654    /// # Example
4655    /// ```ignore,no_run
4656    /// # use google_cloud_alloydb_v1::model::Instance;
4657    /// let x = Instance::new().set_name("example");
4658    /// ```
4659    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4660        self.name = v.into();
4661        self
4662    }
4663
4664    /// Sets the value of [display_name][crate::model::Instance::display_name].
4665    ///
4666    /// # Example
4667    /// ```ignore,no_run
4668    /// # use google_cloud_alloydb_v1::model::Instance;
4669    /// let x = Instance::new().set_display_name("example");
4670    /// ```
4671    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4672        self.display_name = v.into();
4673        self
4674    }
4675
4676    /// Sets the value of [uid][crate::model::Instance::uid].
4677    ///
4678    /// # Example
4679    /// ```ignore,no_run
4680    /// # use google_cloud_alloydb_v1::model::Instance;
4681    /// let x = Instance::new().set_uid("example");
4682    /// ```
4683    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4684        self.uid = v.into();
4685        self
4686    }
4687
4688    /// Sets the value of [create_time][crate::model::Instance::create_time].
4689    ///
4690    /// # Example
4691    /// ```ignore,no_run
4692    /// # use google_cloud_alloydb_v1::model::Instance;
4693    /// use wkt::Timestamp;
4694    /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
4695    /// ```
4696    pub fn set_create_time<T>(mut self, v: T) -> Self
4697    where
4698        T: std::convert::Into<wkt::Timestamp>,
4699    {
4700        self.create_time = std::option::Option::Some(v.into());
4701        self
4702    }
4703
4704    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
4705    ///
4706    /// # Example
4707    /// ```ignore,no_run
4708    /// # use google_cloud_alloydb_v1::model::Instance;
4709    /// use wkt::Timestamp;
4710    /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4711    /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
4712    /// ```
4713    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4714    where
4715        T: std::convert::Into<wkt::Timestamp>,
4716    {
4717        self.create_time = v.map(|x| x.into());
4718        self
4719    }
4720
4721    /// Sets the value of [update_time][crate::model::Instance::update_time].
4722    ///
4723    /// # Example
4724    /// ```ignore,no_run
4725    /// # use google_cloud_alloydb_v1::model::Instance;
4726    /// use wkt::Timestamp;
4727    /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
4728    /// ```
4729    pub fn set_update_time<T>(mut self, v: T) -> Self
4730    where
4731        T: std::convert::Into<wkt::Timestamp>,
4732    {
4733        self.update_time = std::option::Option::Some(v.into());
4734        self
4735    }
4736
4737    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
4738    ///
4739    /// # Example
4740    /// ```ignore,no_run
4741    /// # use google_cloud_alloydb_v1::model::Instance;
4742    /// use wkt::Timestamp;
4743    /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4744    /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
4745    /// ```
4746    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4747    where
4748        T: std::convert::Into<wkt::Timestamp>,
4749    {
4750        self.update_time = v.map(|x| x.into());
4751        self
4752    }
4753
4754    /// Sets the value of [delete_time][crate::model::Instance::delete_time].
4755    ///
4756    /// # Example
4757    /// ```ignore,no_run
4758    /// # use google_cloud_alloydb_v1::model::Instance;
4759    /// use wkt::Timestamp;
4760    /// let x = Instance::new().set_delete_time(Timestamp::default()/* use setters */);
4761    /// ```
4762    pub fn set_delete_time<T>(mut self, v: T) -> Self
4763    where
4764        T: std::convert::Into<wkt::Timestamp>,
4765    {
4766        self.delete_time = std::option::Option::Some(v.into());
4767        self
4768    }
4769
4770    /// Sets or clears the value of [delete_time][crate::model::Instance::delete_time].
4771    ///
4772    /// # Example
4773    /// ```ignore,no_run
4774    /// # use google_cloud_alloydb_v1::model::Instance;
4775    /// use wkt::Timestamp;
4776    /// let x = Instance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
4777    /// let x = Instance::new().set_or_clear_delete_time(None::<Timestamp>);
4778    /// ```
4779    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
4780    where
4781        T: std::convert::Into<wkt::Timestamp>,
4782    {
4783        self.delete_time = v.map(|x| x.into());
4784        self
4785    }
4786
4787    /// Sets the value of [labels][crate::model::Instance::labels].
4788    ///
4789    /// # Example
4790    /// ```ignore,no_run
4791    /// # use google_cloud_alloydb_v1::model::Instance;
4792    /// let x = Instance::new().set_labels([
4793    ///     ("key0", "abc"),
4794    ///     ("key1", "xyz"),
4795    /// ]);
4796    /// ```
4797    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4798    where
4799        T: std::iter::IntoIterator<Item = (K, V)>,
4800        K: std::convert::Into<std::string::String>,
4801        V: std::convert::Into<std::string::String>,
4802    {
4803        use std::iter::Iterator;
4804        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4805        self
4806    }
4807
4808    /// Sets the value of [state][crate::model::Instance::state].
4809    ///
4810    /// # Example
4811    /// ```ignore,no_run
4812    /// # use google_cloud_alloydb_v1::model::Instance;
4813    /// use google_cloud_alloydb_v1::model::instance::State;
4814    /// let x0 = Instance::new().set_state(State::Ready);
4815    /// let x1 = Instance::new().set_state(State::Stopped);
4816    /// let x2 = Instance::new().set_state(State::Creating);
4817    /// ```
4818    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
4819        self.state = v.into();
4820        self
4821    }
4822
4823    /// Sets the value of [instance_type][crate::model::Instance::instance_type].
4824    ///
4825    /// # Example
4826    /// ```ignore,no_run
4827    /// # use google_cloud_alloydb_v1::model::Instance;
4828    /// use google_cloud_alloydb_v1::model::instance::InstanceType;
4829    /// let x0 = Instance::new().set_instance_type(InstanceType::Primary);
4830    /// let x1 = Instance::new().set_instance_type(InstanceType::ReadPool);
4831    /// let x2 = Instance::new().set_instance_type(InstanceType::Secondary);
4832    /// ```
4833    pub fn set_instance_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
4834        mut self,
4835        v: T,
4836    ) -> Self {
4837        self.instance_type = v.into();
4838        self
4839    }
4840
4841    /// Sets the value of [machine_config][crate::model::Instance::machine_config].
4842    ///
4843    /// # Example
4844    /// ```ignore,no_run
4845    /// # use google_cloud_alloydb_v1::model::Instance;
4846    /// use google_cloud_alloydb_v1::model::instance::MachineConfig;
4847    /// let x = Instance::new().set_machine_config(MachineConfig::default()/* use setters */);
4848    /// ```
4849    pub fn set_machine_config<T>(mut self, v: T) -> Self
4850    where
4851        T: std::convert::Into<crate::model::instance::MachineConfig>,
4852    {
4853        self.machine_config = std::option::Option::Some(v.into());
4854        self
4855    }
4856
4857    /// Sets or clears the value of [machine_config][crate::model::Instance::machine_config].
4858    ///
4859    /// # Example
4860    /// ```ignore,no_run
4861    /// # use google_cloud_alloydb_v1::model::Instance;
4862    /// use google_cloud_alloydb_v1::model::instance::MachineConfig;
4863    /// let x = Instance::new().set_or_clear_machine_config(Some(MachineConfig::default()/* use setters */));
4864    /// let x = Instance::new().set_or_clear_machine_config(None::<MachineConfig>);
4865    /// ```
4866    pub fn set_or_clear_machine_config<T>(mut self, v: std::option::Option<T>) -> Self
4867    where
4868        T: std::convert::Into<crate::model::instance::MachineConfig>,
4869    {
4870        self.machine_config = v.map(|x| x.into());
4871        self
4872    }
4873
4874    /// Sets the value of [availability_type][crate::model::Instance::availability_type].
4875    ///
4876    /// # Example
4877    /// ```ignore,no_run
4878    /// # use google_cloud_alloydb_v1::model::Instance;
4879    /// use google_cloud_alloydb_v1::model::instance::AvailabilityType;
4880    /// let x0 = Instance::new().set_availability_type(AvailabilityType::Zonal);
4881    /// let x1 = Instance::new().set_availability_type(AvailabilityType::Regional);
4882    /// ```
4883    pub fn set_availability_type<
4884        T: std::convert::Into<crate::model::instance::AvailabilityType>,
4885    >(
4886        mut self,
4887        v: T,
4888    ) -> Self {
4889        self.availability_type = v.into();
4890        self
4891    }
4892
4893    /// Sets the value of [gce_zone][crate::model::Instance::gce_zone].
4894    ///
4895    /// # Example
4896    /// ```ignore,no_run
4897    /// # use google_cloud_alloydb_v1::model::Instance;
4898    /// let x = Instance::new().set_gce_zone("example");
4899    /// ```
4900    pub fn set_gce_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4901        self.gce_zone = v.into();
4902        self
4903    }
4904
4905    /// Sets the value of [database_flags][crate::model::Instance::database_flags].
4906    ///
4907    /// # Example
4908    /// ```ignore,no_run
4909    /// # use google_cloud_alloydb_v1::model::Instance;
4910    /// let x = Instance::new().set_database_flags([
4911    ///     ("key0", "abc"),
4912    ///     ("key1", "xyz"),
4913    /// ]);
4914    /// ```
4915    pub fn set_database_flags<T, K, V>(mut self, v: T) -> Self
4916    where
4917        T: std::iter::IntoIterator<Item = (K, V)>,
4918        K: std::convert::Into<std::string::String>,
4919        V: std::convert::Into<std::string::String>,
4920    {
4921        use std::iter::Iterator;
4922        self.database_flags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4923        self
4924    }
4925
4926    /// Sets the value of [writable_node][crate::model::Instance::writable_node].
4927    ///
4928    /// # Example
4929    /// ```ignore,no_run
4930    /// # use google_cloud_alloydb_v1::model::Instance;
4931    /// use google_cloud_alloydb_v1::model::instance::Node;
4932    /// let x = Instance::new().set_writable_node(Node::default()/* use setters */);
4933    /// ```
4934    pub fn set_writable_node<T>(mut self, v: T) -> Self
4935    where
4936        T: std::convert::Into<crate::model::instance::Node>,
4937    {
4938        self.writable_node = std::option::Option::Some(v.into());
4939        self
4940    }
4941
4942    /// Sets or clears the value of [writable_node][crate::model::Instance::writable_node].
4943    ///
4944    /// # Example
4945    /// ```ignore,no_run
4946    /// # use google_cloud_alloydb_v1::model::Instance;
4947    /// use google_cloud_alloydb_v1::model::instance::Node;
4948    /// let x = Instance::new().set_or_clear_writable_node(Some(Node::default()/* use setters */));
4949    /// let x = Instance::new().set_or_clear_writable_node(None::<Node>);
4950    /// ```
4951    pub fn set_or_clear_writable_node<T>(mut self, v: std::option::Option<T>) -> Self
4952    where
4953        T: std::convert::Into<crate::model::instance::Node>,
4954    {
4955        self.writable_node = v.map(|x| x.into());
4956        self
4957    }
4958
4959    /// Sets the value of [nodes][crate::model::Instance::nodes].
4960    ///
4961    /// # Example
4962    /// ```ignore,no_run
4963    /// # use google_cloud_alloydb_v1::model::Instance;
4964    /// use google_cloud_alloydb_v1::model::instance::Node;
4965    /// let x = Instance::new()
4966    ///     .set_nodes([
4967    ///         Node::default()/* use setters */,
4968    ///         Node::default()/* use (different) setters */,
4969    ///     ]);
4970    /// ```
4971    pub fn set_nodes<T, V>(mut self, v: T) -> Self
4972    where
4973        T: std::iter::IntoIterator<Item = V>,
4974        V: std::convert::Into<crate::model::instance::Node>,
4975    {
4976        use std::iter::Iterator;
4977        self.nodes = v.into_iter().map(|i| i.into()).collect();
4978        self
4979    }
4980
4981    /// Sets the value of [query_insights_config][crate::model::Instance::query_insights_config].
4982    ///
4983    /// # Example
4984    /// ```ignore,no_run
4985    /// # use google_cloud_alloydb_v1::model::Instance;
4986    /// use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
4987    /// let x = Instance::new().set_query_insights_config(QueryInsightsInstanceConfig::default()/* use setters */);
4988    /// ```
4989    pub fn set_query_insights_config<T>(mut self, v: T) -> Self
4990    where
4991        T: std::convert::Into<crate::model::instance::QueryInsightsInstanceConfig>,
4992    {
4993        self.query_insights_config = std::option::Option::Some(v.into());
4994        self
4995    }
4996
4997    /// Sets or clears the value of [query_insights_config][crate::model::Instance::query_insights_config].
4998    ///
4999    /// # Example
5000    /// ```ignore,no_run
5001    /// # use google_cloud_alloydb_v1::model::Instance;
5002    /// use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5003    /// let x = Instance::new().set_or_clear_query_insights_config(Some(QueryInsightsInstanceConfig::default()/* use setters */));
5004    /// let x = Instance::new().set_or_clear_query_insights_config(None::<QueryInsightsInstanceConfig>);
5005    /// ```
5006    pub fn set_or_clear_query_insights_config<T>(mut self, v: std::option::Option<T>) -> Self
5007    where
5008        T: std::convert::Into<crate::model::instance::QueryInsightsInstanceConfig>,
5009    {
5010        self.query_insights_config = v.map(|x| x.into());
5011        self
5012    }
5013
5014    /// Sets the value of [observability_config][crate::model::Instance::observability_config].
5015    ///
5016    /// # Example
5017    /// ```ignore,no_run
5018    /// # use google_cloud_alloydb_v1::model::Instance;
5019    /// use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5020    /// let x = Instance::new().set_observability_config(ObservabilityInstanceConfig::default()/* use setters */);
5021    /// ```
5022    pub fn set_observability_config<T>(mut self, v: T) -> Self
5023    where
5024        T: std::convert::Into<crate::model::instance::ObservabilityInstanceConfig>,
5025    {
5026        self.observability_config = std::option::Option::Some(v.into());
5027        self
5028    }
5029
5030    /// Sets or clears the value of [observability_config][crate::model::Instance::observability_config].
5031    ///
5032    /// # Example
5033    /// ```ignore,no_run
5034    /// # use google_cloud_alloydb_v1::model::Instance;
5035    /// use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5036    /// let x = Instance::new().set_or_clear_observability_config(Some(ObservabilityInstanceConfig::default()/* use setters */));
5037    /// let x = Instance::new().set_or_clear_observability_config(None::<ObservabilityInstanceConfig>);
5038    /// ```
5039    pub fn set_or_clear_observability_config<T>(mut self, v: std::option::Option<T>) -> Self
5040    where
5041        T: std::convert::Into<crate::model::instance::ObservabilityInstanceConfig>,
5042    {
5043        self.observability_config = v.map(|x| x.into());
5044        self
5045    }
5046
5047    /// Sets the value of [read_pool_config][crate::model::Instance::read_pool_config].
5048    ///
5049    /// # Example
5050    /// ```ignore,no_run
5051    /// # use google_cloud_alloydb_v1::model::Instance;
5052    /// use google_cloud_alloydb_v1::model::instance::ReadPoolConfig;
5053    /// let x = Instance::new().set_read_pool_config(ReadPoolConfig::default()/* use setters */);
5054    /// ```
5055    pub fn set_read_pool_config<T>(mut self, v: T) -> Self
5056    where
5057        T: std::convert::Into<crate::model::instance::ReadPoolConfig>,
5058    {
5059        self.read_pool_config = std::option::Option::Some(v.into());
5060        self
5061    }
5062
5063    /// Sets or clears the value of [read_pool_config][crate::model::Instance::read_pool_config].
5064    ///
5065    /// # Example
5066    /// ```ignore,no_run
5067    /// # use google_cloud_alloydb_v1::model::Instance;
5068    /// use google_cloud_alloydb_v1::model::instance::ReadPoolConfig;
5069    /// let x = Instance::new().set_or_clear_read_pool_config(Some(ReadPoolConfig::default()/* use setters */));
5070    /// let x = Instance::new().set_or_clear_read_pool_config(None::<ReadPoolConfig>);
5071    /// ```
5072    pub fn set_or_clear_read_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
5073    where
5074        T: std::convert::Into<crate::model::instance::ReadPoolConfig>,
5075    {
5076        self.read_pool_config = v.map(|x| x.into());
5077        self
5078    }
5079
5080    /// Sets the value of [ip_address][crate::model::Instance::ip_address].
5081    ///
5082    /// # Example
5083    /// ```ignore,no_run
5084    /// # use google_cloud_alloydb_v1::model::Instance;
5085    /// let x = Instance::new().set_ip_address("example");
5086    /// ```
5087    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5088        self.ip_address = v.into();
5089        self
5090    }
5091
5092    /// Sets the value of [public_ip_address][crate::model::Instance::public_ip_address].
5093    ///
5094    /// # Example
5095    /// ```ignore,no_run
5096    /// # use google_cloud_alloydb_v1::model::Instance;
5097    /// let x = Instance::new().set_public_ip_address("example");
5098    /// ```
5099    pub fn set_public_ip_address<T: std::convert::Into<std::string::String>>(
5100        mut self,
5101        v: T,
5102    ) -> Self {
5103        self.public_ip_address = v.into();
5104        self
5105    }
5106
5107    /// Sets the value of [reconciling][crate::model::Instance::reconciling].
5108    ///
5109    /// # Example
5110    /// ```ignore,no_run
5111    /// # use google_cloud_alloydb_v1::model::Instance;
5112    /// let x = Instance::new().set_reconciling(true);
5113    /// ```
5114    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5115        self.reconciling = v.into();
5116        self
5117    }
5118
5119    /// Sets the value of [etag][crate::model::Instance::etag].
5120    ///
5121    /// # Example
5122    /// ```ignore,no_run
5123    /// # use google_cloud_alloydb_v1::model::Instance;
5124    /// let x = Instance::new().set_etag("example");
5125    /// ```
5126    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5127        self.etag = v.into();
5128        self
5129    }
5130
5131    /// Sets the value of [annotations][crate::model::Instance::annotations].
5132    ///
5133    /// # Example
5134    /// ```ignore,no_run
5135    /// # use google_cloud_alloydb_v1::model::Instance;
5136    /// let x = Instance::new().set_annotations([
5137    ///     ("key0", "abc"),
5138    ///     ("key1", "xyz"),
5139    /// ]);
5140    /// ```
5141    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
5142    where
5143        T: std::iter::IntoIterator<Item = (K, V)>,
5144        K: std::convert::Into<std::string::String>,
5145        V: std::convert::Into<std::string::String>,
5146    {
5147        use std::iter::Iterator;
5148        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5149        self
5150    }
5151
5152    /// Sets the value of [client_connection_config][crate::model::Instance::client_connection_config].
5153    ///
5154    /// # Example
5155    /// ```ignore,no_run
5156    /// # use google_cloud_alloydb_v1::model::Instance;
5157    /// use google_cloud_alloydb_v1::model::instance::ClientConnectionConfig;
5158    /// let x = Instance::new().set_client_connection_config(ClientConnectionConfig::default()/* use setters */);
5159    /// ```
5160    pub fn set_client_connection_config<T>(mut self, v: T) -> Self
5161    where
5162        T: std::convert::Into<crate::model::instance::ClientConnectionConfig>,
5163    {
5164        self.client_connection_config = std::option::Option::Some(v.into());
5165        self
5166    }
5167
5168    /// Sets or clears the value of [client_connection_config][crate::model::Instance::client_connection_config].
5169    ///
5170    /// # Example
5171    /// ```ignore,no_run
5172    /// # use google_cloud_alloydb_v1::model::Instance;
5173    /// use google_cloud_alloydb_v1::model::instance::ClientConnectionConfig;
5174    /// let x = Instance::new().set_or_clear_client_connection_config(Some(ClientConnectionConfig::default()/* use setters */));
5175    /// let x = Instance::new().set_or_clear_client_connection_config(None::<ClientConnectionConfig>);
5176    /// ```
5177    pub fn set_or_clear_client_connection_config<T>(mut self, v: std::option::Option<T>) -> Self
5178    where
5179        T: std::convert::Into<crate::model::instance::ClientConnectionConfig>,
5180    {
5181        self.client_connection_config = v.map(|x| x.into());
5182        self
5183    }
5184
5185    /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
5186    ///
5187    /// # Example
5188    /// ```ignore,no_run
5189    /// # use google_cloud_alloydb_v1::model::Instance;
5190    /// let x = Instance::new().set_satisfies_pzs(true);
5191    /// ```
5192    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5193        self.satisfies_pzs = v.into();
5194        self
5195    }
5196
5197    /// Sets the value of [psc_instance_config][crate::model::Instance::psc_instance_config].
5198    ///
5199    /// # Example
5200    /// ```ignore,no_run
5201    /// # use google_cloud_alloydb_v1::model::Instance;
5202    /// use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
5203    /// let x = Instance::new().set_psc_instance_config(PscInstanceConfig::default()/* use setters */);
5204    /// ```
5205    pub fn set_psc_instance_config<T>(mut self, v: T) -> Self
5206    where
5207        T: std::convert::Into<crate::model::instance::PscInstanceConfig>,
5208    {
5209        self.psc_instance_config = std::option::Option::Some(v.into());
5210        self
5211    }
5212
5213    /// Sets or clears the value of [psc_instance_config][crate::model::Instance::psc_instance_config].
5214    ///
5215    /// # Example
5216    /// ```ignore,no_run
5217    /// # use google_cloud_alloydb_v1::model::Instance;
5218    /// use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
5219    /// let x = Instance::new().set_or_clear_psc_instance_config(Some(PscInstanceConfig::default()/* use setters */));
5220    /// let x = Instance::new().set_or_clear_psc_instance_config(None::<PscInstanceConfig>);
5221    /// ```
5222    pub fn set_or_clear_psc_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
5223    where
5224        T: std::convert::Into<crate::model::instance::PscInstanceConfig>,
5225    {
5226        self.psc_instance_config = v.map(|x| x.into());
5227        self
5228    }
5229
5230    /// Sets the value of [network_config][crate::model::Instance::network_config].
5231    ///
5232    /// # Example
5233    /// ```ignore,no_run
5234    /// # use google_cloud_alloydb_v1::model::Instance;
5235    /// use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
5236    /// let x = Instance::new().set_network_config(InstanceNetworkConfig::default()/* use setters */);
5237    /// ```
5238    pub fn set_network_config<T>(mut self, v: T) -> Self
5239    where
5240        T: std::convert::Into<crate::model::instance::InstanceNetworkConfig>,
5241    {
5242        self.network_config = std::option::Option::Some(v.into());
5243        self
5244    }
5245
5246    /// Sets or clears the value of [network_config][crate::model::Instance::network_config].
5247    ///
5248    /// # Example
5249    /// ```ignore,no_run
5250    /// # use google_cloud_alloydb_v1::model::Instance;
5251    /// use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
5252    /// let x = Instance::new().set_or_clear_network_config(Some(InstanceNetworkConfig::default()/* use setters */));
5253    /// let x = Instance::new().set_or_clear_network_config(None::<InstanceNetworkConfig>);
5254    /// ```
5255    pub fn set_or_clear_network_config<T>(mut self, v: std::option::Option<T>) -> Self
5256    where
5257        T: std::convert::Into<crate::model::instance::InstanceNetworkConfig>,
5258    {
5259        self.network_config = v.map(|x| x.into());
5260        self
5261    }
5262
5263    /// Sets the value of [outbound_public_ip_addresses][crate::model::Instance::outbound_public_ip_addresses].
5264    ///
5265    /// # Example
5266    /// ```ignore,no_run
5267    /// # use google_cloud_alloydb_v1::model::Instance;
5268    /// let x = Instance::new().set_outbound_public_ip_addresses(["a", "b", "c"]);
5269    /// ```
5270    pub fn set_outbound_public_ip_addresses<T, V>(mut self, v: T) -> Self
5271    where
5272        T: std::iter::IntoIterator<Item = V>,
5273        V: std::convert::Into<std::string::String>,
5274    {
5275        use std::iter::Iterator;
5276        self.outbound_public_ip_addresses = v.into_iter().map(|i| i.into()).collect();
5277        self
5278    }
5279
5280    /// Sets the value of [activation_policy][crate::model::Instance::activation_policy].
5281    ///
5282    /// # Example
5283    /// ```ignore,no_run
5284    /// # use google_cloud_alloydb_v1::model::Instance;
5285    /// use google_cloud_alloydb_v1::model::instance::ActivationPolicy;
5286    /// let x0 = Instance::new().set_activation_policy(ActivationPolicy::Always);
5287    /// let x1 = Instance::new().set_activation_policy(ActivationPolicy::Never);
5288    /// ```
5289    pub fn set_activation_policy<
5290        T: std::convert::Into<crate::model::instance::ActivationPolicy>,
5291    >(
5292        mut self,
5293        v: T,
5294    ) -> Self {
5295        self.activation_policy = v.into();
5296        self
5297    }
5298
5299    /// Sets the value of [connection_pool_config][crate::model::Instance::connection_pool_config].
5300    ///
5301    /// # Example
5302    /// ```ignore,no_run
5303    /// # use google_cloud_alloydb_v1::model::Instance;
5304    /// use google_cloud_alloydb_v1::model::instance::ConnectionPoolConfig;
5305    /// let x = Instance::new().set_connection_pool_config(ConnectionPoolConfig::default()/* use setters */);
5306    /// ```
5307    pub fn set_connection_pool_config<T>(mut self, v: T) -> Self
5308    where
5309        T: std::convert::Into<crate::model::instance::ConnectionPoolConfig>,
5310    {
5311        self.connection_pool_config = std::option::Option::Some(v.into());
5312        self
5313    }
5314
5315    /// Sets or clears the value of [connection_pool_config][crate::model::Instance::connection_pool_config].
5316    ///
5317    /// # Example
5318    /// ```ignore,no_run
5319    /// # use google_cloud_alloydb_v1::model::Instance;
5320    /// use google_cloud_alloydb_v1::model::instance::ConnectionPoolConfig;
5321    /// let x = Instance::new().set_or_clear_connection_pool_config(Some(ConnectionPoolConfig::default()/* use setters */));
5322    /// let x = Instance::new().set_or_clear_connection_pool_config(None::<ConnectionPoolConfig>);
5323    /// ```
5324    pub fn set_or_clear_connection_pool_config<T>(mut self, v: std::option::Option<T>) -> Self
5325    where
5326        T: std::convert::Into<crate::model::instance::ConnectionPoolConfig>,
5327    {
5328        self.connection_pool_config = v.map(|x| x.into());
5329        self
5330    }
5331}
5332
5333impl wkt::message::Message for Instance {
5334    fn typename() -> &'static str {
5335        "type.googleapis.com/google.cloud.alloydb.v1.Instance"
5336    }
5337}
5338
5339/// Defines additional types related to [Instance].
5340pub mod instance {
5341    #[allow(unused_imports)]
5342    use super::*;
5343
5344    /// MachineConfig describes the configuration of a machine.
5345    #[derive(Clone, Default, PartialEq)]
5346    #[non_exhaustive]
5347    pub struct MachineConfig {
5348        /// The number of CPU's in the VM instance.
5349        pub cpu_count: i32,
5350
5351        /// Machine type of the VM instance. E.g. "n2-highmem-4",
5352        /// "n2-highmem-8", "c4a-highmem-4-lssd".
5353        /// cpu_count must match the number of vCPUs in the machine type.
5354        pub machine_type: std::string::String,
5355
5356        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5357    }
5358
5359    impl MachineConfig {
5360        pub fn new() -> Self {
5361            std::default::Default::default()
5362        }
5363
5364        /// Sets the value of [cpu_count][crate::model::instance::MachineConfig::cpu_count].
5365        ///
5366        /// # Example
5367        /// ```ignore,no_run
5368        /// # use google_cloud_alloydb_v1::model::instance::MachineConfig;
5369        /// let x = MachineConfig::new().set_cpu_count(42);
5370        /// ```
5371        pub fn set_cpu_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5372            self.cpu_count = v.into();
5373            self
5374        }
5375
5376        /// Sets the value of [machine_type][crate::model::instance::MachineConfig::machine_type].
5377        ///
5378        /// # Example
5379        /// ```ignore,no_run
5380        /// # use google_cloud_alloydb_v1::model::instance::MachineConfig;
5381        /// let x = MachineConfig::new().set_machine_type("example");
5382        /// ```
5383        pub fn set_machine_type<T: std::convert::Into<std::string::String>>(
5384            mut self,
5385            v: T,
5386        ) -> Self {
5387            self.machine_type = v.into();
5388            self
5389        }
5390    }
5391
5392    impl wkt::message::Message for MachineConfig {
5393        fn typename() -> &'static str {
5394            "type.googleapis.com/google.cloud.alloydb.v1.Instance.MachineConfig"
5395        }
5396    }
5397
5398    /// Details of a single node in the instance.
5399    /// Nodes in an AlloyDB instance are ephemeral, they can change during
5400    /// update, failover, autohealing and resize operations.
5401    #[derive(Clone, Default, PartialEq)]
5402    #[non_exhaustive]
5403    pub struct Node {
5404        /// Output only. The Compute Engine zone of the VM e.g. "us-central1-b".
5405        pub zone_id: std::string::String,
5406
5407        /// Output only. The identifier of the VM e.g.
5408        /// "test-read-0601-407e52be-ms3l".
5409        pub id: std::string::String,
5410
5411        /// Output only. The private IP address of the VM e.g. "10.57.0.34".
5412        pub ip: std::string::String,
5413
5414        /// Output only. Determined by state of the compute VM and postgres-service
5415        /// health. Compute VM state can have values listed in
5416        /// <https://cloud.google.com/compute/docs/instances/instance-life-cycle> and
5417        /// postgres-service health can have values: HEALTHY and UNHEALTHY.
5418        pub state: std::string::String,
5419
5420        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5421    }
5422
5423    impl Node {
5424        pub fn new() -> Self {
5425            std::default::Default::default()
5426        }
5427
5428        /// Sets the value of [zone_id][crate::model::instance::Node::zone_id].
5429        ///
5430        /// # Example
5431        /// ```ignore,no_run
5432        /// # use google_cloud_alloydb_v1::model::instance::Node;
5433        /// let x = Node::new().set_zone_id("example");
5434        /// ```
5435        pub fn set_zone_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5436            self.zone_id = v.into();
5437            self
5438        }
5439
5440        /// Sets the value of [id][crate::model::instance::Node::id].
5441        ///
5442        /// # Example
5443        /// ```ignore,no_run
5444        /// # use google_cloud_alloydb_v1::model::instance::Node;
5445        /// let x = Node::new().set_id("example");
5446        /// ```
5447        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5448            self.id = v.into();
5449            self
5450        }
5451
5452        /// Sets the value of [ip][crate::model::instance::Node::ip].
5453        ///
5454        /// # Example
5455        /// ```ignore,no_run
5456        /// # use google_cloud_alloydb_v1::model::instance::Node;
5457        /// let x = Node::new().set_ip("example");
5458        /// ```
5459        pub fn set_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5460            self.ip = v.into();
5461            self
5462        }
5463
5464        /// Sets the value of [state][crate::model::instance::Node::state].
5465        ///
5466        /// # Example
5467        /// ```ignore,no_run
5468        /// # use google_cloud_alloydb_v1::model::instance::Node;
5469        /// let x = Node::new().set_state("example");
5470        /// ```
5471        pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5472            self.state = v.into();
5473            self
5474        }
5475    }
5476
5477    impl wkt::message::Message for Node {
5478        fn typename() -> &'static str {
5479            "type.googleapis.com/google.cloud.alloydb.v1.Instance.Node"
5480        }
5481    }
5482
5483    /// QueryInsights Instance specific configuration.
5484    #[derive(Clone, Default, PartialEq)]
5485    #[non_exhaustive]
5486    pub struct QueryInsightsInstanceConfig {
5487        /// Record application tags for an instance.
5488        /// This flag is turned "on" by default.
5489        pub record_application_tags: std::option::Option<bool>,
5490
5491        /// Record client address for an instance. Client address is PII information.
5492        /// This flag is turned "on" by default.
5493        pub record_client_address: std::option::Option<bool>,
5494
5495        /// Query string length. The default value is 1024.
5496        /// Any integer between 256 and 4500 is considered valid.
5497        pub query_string_length: u32,
5498
5499        /// Number of query execution plans captured by Insights per minute
5500        /// for all queries combined. The default value is 5.
5501        /// Any integer between 0 and 20 is considered valid.
5502        pub query_plans_per_minute: std::option::Option<u32>,
5503
5504        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5505    }
5506
5507    impl QueryInsightsInstanceConfig {
5508        pub fn new() -> Self {
5509            std::default::Default::default()
5510        }
5511
5512        /// Sets the value of [record_application_tags][crate::model::instance::QueryInsightsInstanceConfig::record_application_tags].
5513        ///
5514        /// # Example
5515        /// ```ignore,no_run
5516        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5517        /// let x = QueryInsightsInstanceConfig::new().set_record_application_tags(true);
5518        /// ```
5519        pub fn set_record_application_tags<T>(mut self, v: T) -> Self
5520        where
5521            T: std::convert::Into<bool>,
5522        {
5523            self.record_application_tags = std::option::Option::Some(v.into());
5524            self
5525        }
5526
5527        /// Sets or clears the value of [record_application_tags][crate::model::instance::QueryInsightsInstanceConfig::record_application_tags].
5528        ///
5529        /// # Example
5530        /// ```ignore,no_run
5531        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5532        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_record_application_tags(Some(false));
5533        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_record_application_tags(None::<bool>);
5534        /// ```
5535        pub fn set_or_clear_record_application_tags<T>(mut self, v: std::option::Option<T>) -> Self
5536        where
5537            T: std::convert::Into<bool>,
5538        {
5539            self.record_application_tags = v.map(|x| x.into());
5540            self
5541        }
5542
5543        /// Sets the value of [record_client_address][crate::model::instance::QueryInsightsInstanceConfig::record_client_address].
5544        ///
5545        /// # Example
5546        /// ```ignore,no_run
5547        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5548        /// let x = QueryInsightsInstanceConfig::new().set_record_client_address(true);
5549        /// ```
5550        pub fn set_record_client_address<T>(mut self, v: T) -> Self
5551        where
5552            T: std::convert::Into<bool>,
5553        {
5554            self.record_client_address = std::option::Option::Some(v.into());
5555            self
5556        }
5557
5558        /// Sets or clears the value of [record_client_address][crate::model::instance::QueryInsightsInstanceConfig::record_client_address].
5559        ///
5560        /// # Example
5561        /// ```ignore,no_run
5562        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5563        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_record_client_address(Some(false));
5564        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_record_client_address(None::<bool>);
5565        /// ```
5566        pub fn set_or_clear_record_client_address<T>(mut self, v: std::option::Option<T>) -> Self
5567        where
5568            T: std::convert::Into<bool>,
5569        {
5570            self.record_client_address = v.map(|x| x.into());
5571            self
5572        }
5573
5574        /// Sets the value of [query_string_length][crate::model::instance::QueryInsightsInstanceConfig::query_string_length].
5575        ///
5576        /// # Example
5577        /// ```ignore,no_run
5578        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5579        /// let x = QueryInsightsInstanceConfig::new().set_query_string_length(42_u32);
5580        /// ```
5581        pub fn set_query_string_length<T: std::convert::Into<u32>>(mut self, v: T) -> Self {
5582            self.query_string_length = v.into();
5583            self
5584        }
5585
5586        /// Sets the value of [query_plans_per_minute][crate::model::instance::QueryInsightsInstanceConfig::query_plans_per_minute].
5587        ///
5588        /// # Example
5589        /// ```ignore,no_run
5590        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5591        /// let x = QueryInsightsInstanceConfig::new().set_query_plans_per_minute(42_u32);
5592        /// ```
5593        pub fn set_query_plans_per_minute<T>(mut self, v: T) -> Self
5594        where
5595            T: std::convert::Into<u32>,
5596        {
5597            self.query_plans_per_minute = std::option::Option::Some(v.into());
5598            self
5599        }
5600
5601        /// Sets or clears the value of [query_plans_per_minute][crate::model::instance::QueryInsightsInstanceConfig::query_plans_per_minute].
5602        ///
5603        /// # Example
5604        /// ```ignore,no_run
5605        /// # use google_cloud_alloydb_v1::model::instance::QueryInsightsInstanceConfig;
5606        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_query_plans_per_minute(Some(42_u32));
5607        /// let x = QueryInsightsInstanceConfig::new().set_or_clear_query_plans_per_minute(None::<u32>);
5608        /// ```
5609        pub fn set_or_clear_query_plans_per_minute<T>(mut self, v: std::option::Option<T>) -> Self
5610        where
5611            T: std::convert::Into<u32>,
5612        {
5613            self.query_plans_per_minute = v.map(|x| x.into());
5614            self
5615        }
5616    }
5617
5618    impl wkt::message::Message for QueryInsightsInstanceConfig {
5619        fn typename() -> &'static str {
5620            "type.googleapis.com/google.cloud.alloydb.v1.Instance.QueryInsightsInstanceConfig"
5621        }
5622    }
5623
5624    /// Observability Instance specific configuration.
5625    #[derive(Clone, Default, PartialEq)]
5626    #[non_exhaustive]
5627    pub struct ObservabilityInstanceConfig {
5628        /// Observability feature status for an instance.
5629        /// This flag is turned "off" by default.
5630        pub enabled: std::option::Option<bool>,
5631
5632        /// Preserve comments in query string for an instance.
5633        /// This flag is turned "off" by default.
5634        pub preserve_comments: std::option::Option<bool>,
5635
5636        /// Track wait events during query execution for an instance.
5637        /// This flag is turned "on" by default but tracking is enabled only after
5638        /// observability enabled flag is also turned on.
5639        pub track_wait_events: std::option::Option<bool>,
5640
5641        /// Output only. Track wait event types during query execution for an
5642        /// instance. This flag is turned "on" by default but tracking is enabled
5643        /// only after observability enabled flag is also turned on. This is
5644        /// read-only flag and only modifiable by internal API.
5645        pub track_wait_event_types: std::option::Option<bool>,
5646
5647        /// Query string length. The default value is 10k.
5648        pub max_query_string_length: std::option::Option<i32>,
5649
5650        /// Record application tags for an instance.
5651        /// This flag is turned "off" by default.
5652        pub record_application_tags: std::option::Option<bool>,
5653
5654        /// Number of query execution plans captured by Insights per minute
5655        /// for all queries combined. The default value is 200.
5656        /// Any integer between 0 to 200 is considered valid.
5657        pub query_plans_per_minute: std::option::Option<i32>,
5658
5659        /// Track actively running queries on the instance.
5660        /// If not set, this flag is "off" by default.
5661        pub track_active_queries: std::option::Option<bool>,
5662
5663        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5664    }
5665
5666    impl ObservabilityInstanceConfig {
5667        pub fn new() -> Self {
5668            std::default::Default::default()
5669        }
5670
5671        /// Sets the value of [enabled][crate::model::instance::ObservabilityInstanceConfig::enabled].
5672        ///
5673        /// # Example
5674        /// ```ignore,no_run
5675        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5676        /// let x = ObservabilityInstanceConfig::new().set_enabled(true);
5677        /// ```
5678        pub fn set_enabled<T>(mut self, v: T) -> Self
5679        where
5680            T: std::convert::Into<bool>,
5681        {
5682            self.enabled = std::option::Option::Some(v.into());
5683            self
5684        }
5685
5686        /// Sets or clears the value of [enabled][crate::model::instance::ObservabilityInstanceConfig::enabled].
5687        ///
5688        /// # Example
5689        /// ```ignore,no_run
5690        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5691        /// let x = ObservabilityInstanceConfig::new().set_or_clear_enabled(Some(false));
5692        /// let x = ObservabilityInstanceConfig::new().set_or_clear_enabled(None::<bool>);
5693        /// ```
5694        pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
5695        where
5696            T: std::convert::Into<bool>,
5697        {
5698            self.enabled = v.map(|x| x.into());
5699            self
5700        }
5701
5702        /// Sets the value of [preserve_comments][crate::model::instance::ObservabilityInstanceConfig::preserve_comments].
5703        ///
5704        /// # Example
5705        /// ```ignore,no_run
5706        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5707        /// let x = ObservabilityInstanceConfig::new().set_preserve_comments(true);
5708        /// ```
5709        pub fn set_preserve_comments<T>(mut self, v: T) -> Self
5710        where
5711            T: std::convert::Into<bool>,
5712        {
5713            self.preserve_comments = std::option::Option::Some(v.into());
5714            self
5715        }
5716
5717        /// Sets or clears the value of [preserve_comments][crate::model::instance::ObservabilityInstanceConfig::preserve_comments].
5718        ///
5719        /// # Example
5720        /// ```ignore,no_run
5721        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5722        /// let x = ObservabilityInstanceConfig::new().set_or_clear_preserve_comments(Some(false));
5723        /// let x = ObservabilityInstanceConfig::new().set_or_clear_preserve_comments(None::<bool>);
5724        /// ```
5725        pub fn set_or_clear_preserve_comments<T>(mut self, v: std::option::Option<T>) -> Self
5726        where
5727            T: std::convert::Into<bool>,
5728        {
5729            self.preserve_comments = v.map(|x| x.into());
5730            self
5731        }
5732
5733        /// Sets the value of [track_wait_events][crate::model::instance::ObservabilityInstanceConfig::track_wait_events].
5734        ///
5735        /// # Example
5736        /// ```ignore,no_run
5737        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5738        /// let x = ObservabilityInstanceConfig::new().set_track_wait_events(true);
5739        /// ```
5740        pub fn set_track_wait_events<T>(mut self, v: T) -> Self
5741        where
5742            T: std::convert::Into<bool>,
5743        {
5744            self.track_wait_events = std::option::Option::Some(v.into());
5745            self
5746        }
5747
5748        /// Sets or clears the value of [track_wait_events][crate::model::instance::ObservabilityInstanceConfig::track_wait_events].
5749        ///
5750        /// # Example
5751        /// ```ignore,no_run
5752        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5753        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_wait_events(Some(false));
5754        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_wait_events(None::<bool>);
5755        /// ```
5756        pub fn set_or_clear_track_wait_events<T>(mut self, v: std::option::Option<T>) -> Self
5757        where
5758            T: std::convert::Into<bool>,
5759        {
5760            self.track_wait_events = v.map(|x| x.into());
5761            self
5762        }
5763
5764        /// Sets the value of [track_wait_event_types][crate::model::instance::ObservabilityInstanceConfig::track_wait_event_types].
5765        ///
5766        /// # Example
5767        /// ```ignore,no_run
5768        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5769        /// let x = ObservabilityInstanceConfig::new().set_track_wait_event_types(true);
5770        /// ```
5771        pub fn set_track_wait_event_types<T>(mut self, v: T) -> Self
5772        where
5773            T: std::convert::Into<bool>,
5774        {
5775            self.track_wait_event_types = std::option::Option::Some(v.into());
5776            self
5777        }
5778
5779        /// Sets or clears the value of [track_wait_event_types][crate::model::instance::ObservabilityInstanceConfig::track_wait_event_types].
5780        ///
5781        /// # Example
5782        /// ```ignore,no_run
5783        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5784        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_wait_event_types(Some(false));
5785        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_wait_event_types(None::<bool>);
5786        /// ```
5787        pub fn set_or_clear_track_wait_event_types<T>(mut self, v: std::option::Option<T>) -> Self
5788        where
5789            T: std::convert::Into<bool>,
5790        {
5791            self.track_wait_event_types = v.map(|x| x.into());
5792            self
5793        }
5794
5795        /// Sets the value of [max_query_string_length][crate::model::instance::ObservabilityInstanceConfig::max_query_string_length].
5796        ///
5797        /// # Example
5798        /// ```ignore,no_run
5799        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5800        /// let x = ObservabilityInstanceConfig::new().set_max_query_string_length(42);
5801        /// ```
5802        pub fn set_max_query_string_length<T>(mut self, v: T) -> Self
5803        where
5804            T: std::convert::Into<i32>,
5805        {
5806            self.max_query_string_length = std::option::Option::Some(v.into());
5807            self
5808        }
5809
5810        /// Sets or clears the value of [max_query_string_length][crate::model::instance::ObservabilityInstanceConfig::max_query_string_length].
5811        ///
5812        /// # Example
5813        /// ```ignore,no_run
5814        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5815        /// let x = ObservabilityInstanceConfig::new().set_or_clear_max_query_string_length(Some(42));
5816        /// let x = ObservabilityInstanceConfig::new().set_or_clear_max_query_string_length(None::<i32>);
5817        /// ```
5818        pub fn set_or_clear_max_query_string_length<T>(mut self, v: std::option::Option<T>) -> Self
5819        where
5820            T: std::convert::Into<i32>,
5821        {
5822            self.max_query_string_length = v.map(|x| x.into());
5823            self
5824        }
5825
5826        /// Sets the value of [record_application_tags][crate::model::instance::ObservabilityInstanceConfig::record_application_tags].
5827        ///
5828        /// # Example
5829        /// ```ignore,no_run
5830        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5831        /// let x = ObservabilityInstanceConfig::new().set_record_application_tags(true);
5832        /// ```
5833        pub fn set_record_application_tags<T>(mut self, v: T) -> Self
5834        where
5835            T: std::convert::Into<bool>,
5836        {
5837            self.record_application_tags = std::option::Option::Some(v.into());
5838            self
5839        }
5840
5841        /// Sets or clears the value of [record_application_tags][crate::model::instance::ObservabilityInstanceConfig::record_application_tags].
5842        ///
5843        /// # Example
5844        /// ```ignore,no_run
5845        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5846        /// let x = ObservabilityInstanceConfig::new().set_or_clear_record_application_tags(Some(false));
5847        /// let x = ObservabilityInstanceConfig::new().set_or_clear_record_application_tags(None::<bool>);
5848        /// ```
5849        pub fn set_or_clear_record_application_tags<T>(mut self, v: std::option::Option<T>) -> Self
5850        where
5851            T: std::convert::Into<bool>,
5852        {
5853            self.record_application_tags = v.map(|x| x.into());
5854            self
5855        }
5856
5857        /// Sets the value of [query_plans_per_minute][crate::model::instance::ObservabilityInstanceConfig::query_plans_per_minute].
5858        ///
5859        /// # Example
5860        /// ```ignore,no_run
5861        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5862        /// let x = ObservabilityInstanceConfig::new().set_query_plans_per_minute(42);
5863        /// ```
5864        pub fn set_query_plans_per_minute<T>(mut self, v: T) -> Self
5865        where
5866            T: std::convert::Into<i32>,
5867        {
5868            self.query_plans_per_minute = std::option::Option::Some(v.into());
5869            self
5870        }
5871
5872        /// Sets or clears the value of [query_plans_per_minute][crate::model::instance::ObservabilityInstanceConfig::query_plans_per_minute].
5873        ///
5874        /// # Example
5875        /// ```ignore,no_run
5876        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5877        /// let x = ObservabilityInstanceConfig::new().set_or_clear_query_plans_per_minute(Some(42));
5878        /// let x = ObservabilityInstanceConfig::new().set_or_clear_query_plans_per_minute(None::<i32>);
5879        /// ```
5880        pub fn set_or_clear_query_plans_per_minute<T>(mut self, v: std::option::Option<T>) -> Self
5881        where
5882            T: std::convert::Into<i32>,
5883        {
5884            self.query_plans_per_minute = v.map(|x| x.into());
5885            self
5886        }
5887
5888        /// Sets the value of [track_active_queries][crate::model::instance::ObservabilityInstanceConfig::track_active_queries].
5889        ///
5890        /// # Example
5891        /// ```ignore,no_run
5892        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5893        /// let x = ObservabilityInstanceConfig::new().set_track_active_queries(true);
5894        /// ```
5895        pub fn set_track_active_queries<T>(mut self, v: T) -> Self
5896        where
5897            T: std::convert::Into<bool>,
5898        {
5899            self.track_active_queries = std::option::Option::Some(v.into());
5900            self
5901        }
5902
5903        /// Sets or clears the value of [track_active_queries][crate::model::instance::ObservabilityInstanceConfig::track_active_queries].
5904        ///
5905        /// # Example
5906        /// ```ignore,no_run
5907        /// # use google_cloud_alloydb_v1::model::instance::ObservabilityInstanceConfig;
5908        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_active_queries(Some(false));
5909        /// let x = ObservabilityInstanceConfig::new().set_or_clear_track_active_queries(None::<bool>);
5910        /// ```
5911        pub fn set_or_clear_track_active_queries<T>(mut self, v: std::option::Option<T>) -> Self
5912        where
5913            T: std::convert::Into<bool>,
5914        {
5915            self.track_active_queries = v.map(|x| x.into());
5916            self
5917        }
5918    }
5919
5920    impl wkt::message::Message for ObservabilityInstanceConfig {
5921        fn typename() -> &'static str {
5922            "type.googleapis.com/google.cloud.alloydb.v1.Instance.ObservabilityInstanceConfig"
5923        }
5924    }
5925
5926    /// Configuration for a read pool instance.
5927    #[derive(Clone, Default, PartialEq)]
5928    #[non_exhaustive]
5929    pub struct ReadPoolConfig {
5930        /// Read capacity, i.e. number of nodes in a read pool instance.
5931        pub node_count: i32,
5932
5933        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5934    }
5935
5936    impl ReadPoolConfig {
5937        pub fn new() -> Self {
5938            std::default::Default::default()
5939        }
5940
5941        /// Sets the value of [node_count][crate::model::instance::ReadPoolConfig::node_count].
5942        ///
5943        /// # Example
5944        /// ```ignore,no_run
5945        /// # use google_cloud_alloydb_v1::model::instance::ReadPoolConfig;
5946        /// let x = ReadPoolConfig::new().set_node_count(42);
5947        /// ```
5948        pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5949            self.node_count = v.into();
5950            self
5951        }
5952    }
5953
5954    impl wkt::message::Message for ReadPoolConfig {
5955        fn typename() -> &'static str {
5956            "type.googleapis.com/google.cloud.alloydb.v1.Instance.ReadPoolConfig"
5957        }
5958    }
5959
5960    /// Client connection configuration
5961    #[derive(Clone, Default, PartialEq)]
5962    #[non_exhaustive]
5963    pub struct ClientConnectionConfig {
5964        /// Optional. Configuration to enforce connectors only (ex: AuthProxy)
5965        /// connections to the database.
5966        pub require_connectors: bool,
5967
5968        /// Optional. SSL configuration option for this instance.
5969        pub ssl_config: std::option::Option<crate::model::SslConfig>,
5970
5971        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5972    }
5973
5974    impl ClientConnectionConfig {
5975        pub fn new() -> Self {
5976            std::default::Default::default()
5977        }
5978
5979        /// Sets the value of [require_connectors][crate::model::instance::ClientConnectionConfig::require_connectors].
5980        ///
5981        /// # Example
5982        /// ```ignore,no_run
5983        /// # use google_cloud_alloydb_v1::model::instance::ClientConnectionConfig;
5984        /// let x = ClientConnectionConfig::new().set_require_connectors(true);
5985        /// ```
5986        pub fn set_require_connectors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5987            self.require_connectors = v.into();
5988            self
5989        }
5990
5991        /// Sets the value of [ssl_config][crate::model::instance::ClientConnectionConfig::ssl_config].
5992        ///
5993        /// # Example
5994        /// ```ignore,no_run
5995        /// # use google_cloud_alloydb_v1::model::instance::ClientConnectionConfig;
5996        /// use google_cloud_alloydb_v1::model::SslConfig;
5997        /// let x = ClientConnectionConfig::new().set_ssl_config(SslConfig::default()/* use setters */);
5998        /// ```
5999        pub fn set_ssl_config<T>(mut self, v: T) -> Self
6000        where
6001            T: std::convert::Into<crate::model::SslConfig>,
6002        {
6003            self.ssl_config = std::option::Option::Some(v.into());
6004            self
6005        }
6006
6007        /// Sets or clears the value of [ssl_config][crate::model::instance::ClientConnectionConfig::ssl_config].
6008        ///
6009        /// # Example
6010        /// ```ignore,no_run
6011        /// # use google_cloud_alloydb_v1::model::instance::ClientConnectionConfig;
6012        /// use google_cloud_alloydb_v1::model::SslConfig;
6013        /// let x = ClientConnectionConfig::new().set_or_clear_ssl_config(Some(SslConfig::default()/* use setters */));
6014        /// let x = ClientConnectionConfig::new().set_or_clear_ssl_config(None::<SslConfig>);
6015        /// ```
6016        pub fn set_or_clear_ssl_config<T>(mut self, v: std::option::Option<T>) -> Self
6017        where
6018            T: std::convert::Into<crate::model::SslConfig>,
6019        {
6020            self.ssl_config = v.map(|x| x.into());
6021            self
6022        }
6023    }
6024
6025    impl wkt::message::Message for ClientConnectionConfig {
6026        fn typename() -> &'static str {
6027            "type.googleapis.com/google.cloud.alloydb.v1.Instance.ClientConnectionConfig"
6028        }
6029    }
6030
6031    /// Configuration for setting up a PSC interface to enable outbound
6032    /// connectivity.
6033    #[derive(Clone, Default, PartialEq)]
6034    #[non_exhaustive]
6035    pub struct PscInterfaceConfig {
6036        /// The network attachment resource created in the consumer network to which
6037        /// the PSC interface will be linked. This is of the format:
6038        /// "projects/${CONSUMER_PROJECT}/regions/${REGION}/networkAttachments/${NETWORK_ATTACHMENT_NAME}".
6039        /// The network attachment must be in the same region as the instance.
6040        pub network_attachment_resource: std::string::String,
6041
6042        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6043    }
6044
6045    impl PscInterfaceConfig {
6046        pub fn new() -> Self {
6047            std::default::Default::default()
6048        }
6049
6050        /// Sets the value of [network_attachment_resource][crate::model::instance::PscInterfaceConfig::network_attachment_resource].
6051        ///
6052        /// # Example
6053        /// ```ignore,no_run
6054        /// # use google_cloud_alloydb_v1::model::instance::PscInterfaceConfig;
6055        /// let x = PscInterfaceConfig::new().set_network_attachment_resource("example");
6056        /// ```
6057        pub fn set_network_attachment_resource<T: std::convert::Into<std::string::String>>(
6058            mut self,
6059            v: T,
6060        ) -> Self {
6061            self.network_attachment_resource = v.into();
6062            self
6063        }
6064    }
6065
6066    impl wkt::message::Message for PscInterfaceConfig {
6067        fn typename() -> &'static str {
6068            "type.googleapis.com/google.cloud.alloydb.v1.Instance.PscInterfaceConfig"
6069        }
6070    }
6071
6072    /// Configuration for setting up PSC service automation. Consumer projects in
6073    /// the configs will be allowlisted automatically for the instance.
6074    #[derive(Clone, Default, PartialEq)]
6075    #[non_exhaustive]
6076    pub struct PscAutoConnectionConfig {
6077        /// The consumer project to which the PSC service automation endpoint will
6078        /// be created.
6079        pub consumer_project: std::string::String,
6080
6081        /// The consumer network for the PSC service automation, example:
6082        /// "projects/vpc-host-project/global/networks/default".
6083        /// The consumer network might be hosted a different project than the
6084        /// consumer project.
6085        pub consumer_network: std::string::String,
6086
6087        /// Output only. The IP address of the PSC service automation endpoint.
6088        pub ip_address: std::string::String,
6089
6090        /// Output only. The status of the PSC service automation connection.
6091        /// Possible values:
6092        /// "STATE_UNSPECIFIED" - An invalid state as the default case.
6093        /// "ACTIVE" - The connection has been created successfully.
6094        /// "FAILED" - The connection is not functional since some resources on the
6095        /// connection fail to be created.
6096        /// "CREATING" - The connection is being created.
6097        /// "DELETING" - The connection is being deleted.
6098        /// "CREATE_REPAIRING" - The connection is being repaired to complete
6099        /// creation.
6100        /// "DELETE_REPAIRING" - The connection is being repaired to complete
6101        /// deletion.
6102        pub status: std::string::String,
6103
6104        /// Output only. The status of the service connection policy.
6105        /// Possible values:
6106        /// "STATE_UNSPECIFIED" - Default state, when Connection Map is created
6107        /// initially.
6108        /// "VALID" - Set when policy and map configuration is valid, and their
6109        /// matching can lead to allowing creation of PSC Connections subject to
6110        /// other constraints like connections limit.
6111        /// "CONNECTION_POLICY_MISSING" - No Service Connection Policy found for
6112        /// this network and Service Class
6113        /// "POLICY_LIMIT_REACHED" - Service Connection Policy limit reached for
6114        /// this network and Service Class
6115        /// "CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED" - The consumer instance
6116        /// project is not in AllowedGoogleProducersResourceHierarchyLevels of the
6117        /// matching ServiceConnectionPolicy.
6118        pub consumer_network_status: std::string::String,
6119
6120        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6121    }
6122
6123    impl PscAutoConnectionConfig {
6124        pub fn new() -> Self {
6125            std::default::Default::default()
6126        }
6127
6128        /// Sets the value of [consumer_project][crate::model::instance::PscAutoConnectionConfig::consumer_project].
6129        ///
6130        /// # Example
6131        /// ```ignore,no_run
6132        /// # use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6133        /// let x = PscAutoConnectionConfig::new().set_consumer_project("example");
6134        /// ```
6135        pub fn set_consumer_project<T: std::convert::Into<std::string::String>>(
6136            mut self,
6137            v: T,
6138        ) -> Self {
6139            self.consumer_project = v.into();
6140            self
6141        }
6142
6143        /// Sets the value of [consumer_network][crate::model::instance::PscAutoConnectionConfig::consumer_network].
6144        ///
6145        /// # Example
6146        /// ```ignore,no_run
6147        /// # use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6148        /// let x = PscAutoConnectionConfig::new().set_consumer_network("example");
6149        /// ```
6150        pub fn set_consumer_network<T: std::convert::Into<std::string::String>>(
6151            mut self,
6152            v: T,
6153        ) -> Self {
6154            self.consumer_network = v.into();
6155            self
6156        }
6157
6158        /// Sets the value of [ip_address][crate::model::instance::PscAutoConnectionConfig::ip_address].
6159        ///
6160        /// # Example
6161        /// ```ignore,no_run
6162        /// # use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6163        /// let x = PscAutoConnectionConfig::new().set_ip_address("example");
6164        /// ```
6165        pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6166            self.ip_address = v.into();
6167            self
6168        }
6169
6170        /// Sets the value of [status][crate::model::instance::PscAutoConnectionConfig::status].
6171        ///
6172        /// # Example
6173        /// ```ignore,no_run
6174        /// # use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6175        /// let x = PscAutoConnectionConfig::new().set_status("example");
6176        /// ```
6177        pub fn set_status<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6178            self.status = v.into();
6179            self
6180        }
6181
6182        /// Sets the value of [consumer_network_status][crate::model::instance::PscAutoConnectionConfig::consumer_network_status].
6183        ///
6184        /// # Example
6185        /// ```ignore,no_run
6186        /// # use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6187        /// let x = PscAutoConnectionConfig::new().set_consumer_network_status("example");
6188        /// ```
6189        pub fn set_consumer_network_status<T: std::convert::Into<std::string::String>>(
6190            mut self,
6191            v: T,
6192        ) -> Self {
6193            self.consumer_network_status = v.into();
6194            self
6195        }
6196    }
6197
6198    impl wkt::message::Message for PscAutoConnectionConfig {
6199        fn typename() -> &'static str {
6200            "type.googleapis.com/google.cloud.alloydb.v1.Instance.PscAutoConnectionConfig"
6201        }
6202    }
6203
6204    /// PscInstanceConfig contains PSC related configuration at an
6205    /// instance level.
6206    #[derive(Clone, Default, PartialEq)]
6207    #[non_exhaustive]
6208    pub struct PscInstanceConfig {
6209        /// Output only. The service attachment created when Private
6210        /// Service Connect (PSC) is enabled for the instance.
6211        /// The name of the resource will be in the format of
6212        /// `projects/<alloydb-tenant-project-number>/regions/<region-name>/serviceAttachments/<service-attachment-name>`
6213        pub service_attachment_link: std::string::String,
6214
6215        /// Optional. List of consumer projects that are allowed to create
6216        /// PSC endpoints to service-attachments to this instance.
6217        pub allowed_consumer_projects: std::vec::Vec<std::string::String>,
6218
6219        /// Output only. The DNS name of the instance for PSC connectivity.
6220        /// Name convention: \<uid\>.\<uid\>.\<region\>.alloydb-psc.goog
6221        pub psc_dns_name: std::string::String,
6222
6223        /// Optional. Configurations for setting up PSC interfaces attached to the
6224        /// instance which are used for outbound connectivity. Only primary instances
6225        /// can have PSC interface attached. Currently we only support 0 or 1 PSC
6226        /// interface.
6227        pub psc_interface_configs: std::vec::Vec<crate::model::instance::PscInterfaceConfig>,
6228
6229        /// Optional. Configurations for setting up PSC service automation.
6230        pub psc_auto_connections: std::vec::Vec<crate::model::instance::PscAutoConnectionConfig>,
6231
6232        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6233    }
6234
6235    impl PscInstanceConfig {
6236        pub fn new() -> Self {
6237            std::default::Default::default()
6238        }
6239
6240        /// Sets the value of [service_attachment_link][crate::model::instance::PscInstanceConfig::service_attachment_link].
6241        ///
6242        /// # Example
6243        /// ```ignore,no_run
6244        /// # use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
6245        /// let x = PscInstanceConfig::new().set_service_attachment_link("example");
6246        /// ```
6247        pub fn set_service_attachment_link<T: std::convert::Into<std::string::String>>(
6248            mut self,
6249            v: T,
6250        ) -> Self {
6251            self.service_attachment_link = v.into();
6252            self
6253        }
6254
6255        /// Sets the value of [allowed_consumer_projects][crate::model::instance::PscInstanceConfig::allowed_consumer_projects].
6256        ///
6257        /// # Example
6258        /// ```ignore,no_run
6259        /// # use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
6260        /// let x = PscInstanceConfig::new().set_allowed_consumer_projects(["a", "b", "c"]);
6261        /// ```
6262        pub fn set_allowed_consumer_projects<T, V>(mut self, v: T) -> Self
6263        where
6264            T: std::iter::IntoIterator<Item = V>,
6265            V: std::convert::Into<std::string::String>,
6266        {
6267            use std::iter::Iterator;
6268            self.allowed_consumer_projects = v.into_iter().map(|i| i.into()).collect();
6269            self
6270        }
6271
6272        /// Sets the value of [psc_dns_name][crate::model::instance::PscInstanceConfig::psc_dns_name].
6273        ///
6274        /// # Example
6275        /// ```ignore,no_run
6276        /// # use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
6277        /// let x = PscInstanceConfig::new().set_psc_dns_name("example");
6278        /// ```
6279        pub fn set_psc_dns_name<T: std::convert::Into<std::string::String>>(
6280            mut self,
6281            v: T,
6282        ) -> Self {
6283            self.psc_dns_name = v.into();
6284            self
6285        }
6286
6287        /// Sets the value of [psc_interface_configs][crate::model::instance::PscInstanceConfig::psc_interface_configs].
6288        ///
6289        /// # Example
6290        /// ```ignore,no_run
6291        /// # use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
6292        /// use google_cloud_alloydb_v1::model::instance::PscInterfaceConfig;
6293        /// let x = PscInstanceConfig::new()
6294        ///     .set_psc_interface_configs([
6295        ///         PscInterfaceConfig::default()/* use setters */,
6296        ///         PscInterfaceConfig::default()/* use (different) setters */,
6297        ///     ]);
6298        /// ```
6299        pub fn set_psc_interface_configs<T, V>(mut self, v: T) -> Self
6300        where
6301            T: std::iter::IntoIterator<Item = V>,
6302            V: std::convert::Into<crate::model::instance::PscInterfaceConfig>,
6303        {
6304            use std::iter::Iterator;
6305            self.psc_interface_configs = v.into_iter().map(|i| i.into()).collect();
6306            self
6307        }
6308
6309        /// Sets the value of [psc_auto_connections][crate::model::instance::PscInstanceConfig::psc_auto_connections].
6310        ///
6311        /// # Example
6312        /// ```ignore,no_run
6313        /// # use google_cloud_alloydb_v1::model::instance::PscInstanceConfig;
6314        /// use google_cloud_alloydb_v1::model::instance::PscAutoConnectionConfig;
6315        /// let x = PscInstanceConfig::new()
6316        ///     .set_psc_auto_connections([
6317        ///         PscAutoConnectionConfig::default()/* use setters */,
6318        ///         PscAutoConnectionConfig::default()/* use (different) setters */,
6319        ///     ]);
6320        /// ```
6321        pub fn set_psc_auto_connections<T, V>(mut self, v: T) -> Self
6322        where
6323            T: std::iter::IntoIterator<Item = V>,
6324            V: std::convert::Into<crate::model::instance::PscAutoConnectionConfig>,
6325        {
6326            use std::iter::Iterator;
6327            self.psc_auto_connections = v.into_iter().map(|i| i.into()).collect();
6328            self
6329        }
6330    }
6331
6332    impl wkt::message::Message for PscInstanceConfig {
6333        fn typename() -> &'static str {
6334            "type.googleapis.com/google.cloud.alloydb.v1.Instance.PscInstanceConfig"
6335        }
6336    }
6337
6338    /// Metadata related to instance-level network configuration.
6339    #[derive(Clone, Default, PartialEq)]
6340    #[non_exhaustive]
6341    pub struct InstanceNetworkConfig {
6342        /// Optional. A list of external network authorized to access this instance.
6343        pub authorized_external_networks:
6344            std::vec::Vec<crate::model::instance::instance_network_config::AuthorizedNetwork>,
6345
6346        /// Optional. Enabling public ip for the instance.
6347        pub enable_public_ip: bool,
6348
6349        /// Optional. Enabling an outbound public IP address to support a database
6350        /// server sending requests out into the internet.
6351        pub enable_outbound_public_ip: bool,
6352
6353        /// Output only. The resource link for the VPC network in which instance
6354        /// resources are created and from which they are accessible via Private IP.
6355        /// This will be the same value as the parent cluster's network. It is
6356        /// specified in the form: //
6357        /// `projects/{project_number}/global/networks/{network_id}`.
6358        pub network: std::string::String,
6359
6360        /// Optional. Name of the allocated IP range for the private IP AlloyDB
6361        /// instance, for example: "google-managed-services-default". If set, the
6362        /// instance IPs will be created from this allocated range and will override
6363        /// the IP range used by the parent cluster. The range name must comply with
6364        /// [RFC 1035](http://datatracker.ietf.org/doc/html/rfc1035). Specifically,
6365        /// the name must be 1-63 characters long and match the regular expression
6366        /// [a-z]([-a-z0-9]*[a-z0-9])?.
6367        pub allocated_ip_range_override: std::string::String,
6368
6369        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6370    }
6371
6372    impl InstanceNetworkConfig {
6373        pub fn new() -> Self {
6374            std::default::Default::default()
6375        }
6376
6377        /// Sets the value of [authorized_external_networks][crate::model::instance::InstanceNetworkConfig::authorized_external_networks].
6378        ///
6379        /// # Example
6380        /// ```ignore,no_run
6381        /// # use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
6382        /// use google_cloud_alloydb_v1::model::instance::instance_network_config::AuthorizedNetwork;
6383        /// let x = InstanceNetworkConfig::new()
6384        ///     .set_authorized_external_networks([
6385        ///         AuthorizedNetwork::default()/* use setters */,
6386        ///         AuthorizedNetwork::default()/* use (different) setters */,
6387        ///     ]);
6388        /// ```
6389        pub fn set_authorized_external_networks<T, V>(mut self, v: T) -> Self
6390        where
6391            T: std::iter::IntoIterator<Item = V>,
6392            V: std::convert::Into<
6393                    crate::model::instance::instance_network_config::AuthorizedNetwork,
6394                >,
6395        {
6396            use std::iter::Iterator;
6397            self.authorized_external_networks = v.into_iter().map(|i| i.into()).collect();
6398            self
6399        }
6400
6401        /// Sets the value of [enable_public_ip][crate::model::instance::InstanceNetworkConfig::enable_public_ip].
6402        ///
6403        /// # Example
6404        /// ```ignore,no_run
6405        /// # use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
6406        /// let x = InstanceNetworkConfig::new().set_enable_public_ip(true);
6407        /// ```
6408        pub fn set_enable_public_ip<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6409            self.enable_public_ip = v.into();
6410            self
6411        }
6412
6413        /// Sets the value of [enable_outbound_public_ip][crate::model::instance::InstanceNetworkConfig::enable_outbound_public_ip].
6414        ///
6415        /// # Example
6416        /// ```ignore,no_run
6417        /// # use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
6418        /// let x = InstanceNetworkConfig::new().set_enable_outbound_public_ip(true);
6419        /// ```
6420        pub fn set_enable_outbound_public_ip<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6421            self.enable_outbound_public_ip = v.into();
6422            self
6423        }
6424
6425        /// Sets the value of [network][crate::model::instance::InstanceNetworkConfig::network].
6426        ///
6427        /// # Example
6428        /// ```ignore,no_run
6429        /// # use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
6430        /// let x = InstanceNetworkConfig::new().set_network("example");
6431        /// ```
6432        pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6433            self.network = v.into();
6434            self
6435        }
6436
6437        /// Sets the value of [allocated_ip_range_override][crate::model::instance::InstanceNetworkConfig::allocated_ip_range_override].
6438        ///
6439        /// # Example
6440        /// ```ignore,no_run
6441        /// # use google_cloud_alloydb_v1::model::instance::InstanceNetworkConfig;
6442        /// let x = InstanceNetworkConfig::new().set_allocated_ip_range_override("example");
6443        /// ```
6444        pub fn set_allocated_ip_range_override<T: std::convert::Into<std::string::String>>(
6445            mut self,
6446            v: T,
6447        ) -> Self {
6448            self.allocated_ip_range_override = v.into();
6449            self
6450        }
6451    }
6452
6453    impl wkt::message::Message for InstanceNetworkConfig {
6454        fn typename() -> &'static str {
6455            "type.googleapis.com/google.cloud.alloydb.v1.Instance.InstanceNetworkConfig"
6456        }
6457    }
6458
6459    /// Defines additional types related to [InstanceNetworkConfig].
6460    pub mod instance_network_config {
6461        #[allow(unused_imports)]
6462        use super::*;
6463
6464        /// AuthorizedNetwork contains metadata for an authorized network.
6465        #[derive(Clone, Default, PartialEq)]
6466        #[non_exhaustive]
6467        pub struct AuthorizedNetwork {
6468            /// CIDR range for one authorzied network of the instance.
6469            pub cidr_range: std::string::String,
6470
6471            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6472        }
6473
6474        impl AuthorizedNetwork {
6475            pub fn new() -> Self {
6476                std::default::Default::default()
6477            }
6478
6479            /// Sets the value of [cidr_range][crate::model::instance::instance_network_config::AuthorizedNetwork::cidr_range].
6480            ///
6481            /// # Example
6482            /// ```ignore,no_run
6483            /// # use google_cloud_alloydb_v1::model::instance::instance_network_config::AuthorizedNetwork;
6484            /// let x = AuthorizedNetwork::new().set_cidr_range("example");
6485            /// ```
6486            pub fn set_cidr_range<T: std::convert::Into<std::string::String>>(
6487                mut self,
6488                v: T,
6489            ) -> Self {
6490                self.cidr_range = v.into();
6491                self
6492            }
6493        }
6494
6495        impl wkt::message::Message for AuthorizedNetwork {
6496            fn typename() -> &'static str {
6497                "type.googleapis.com/google.cloud.alloydb.v1.Instance.InstanceNetworkConfig.AuthorizedNetwork"
6498            }
6499        }
6500    }
6501
6502    /// Configuration for Managed Connection Pool (MCP).
6503    #[derive(Clone, Default, PartialEq)]
6504    #[non_exhaustive]
6505    pub struct ConnectionPoolConfig {
6506        /// Optional. Whether to enable Managed Connection Pool (MCP).
6507        pub enabled: bool,
6508
6509        /// Optional. Connection Pool flags, as a list of "key": "value" pairs.
6510        pub flags: std::collections::HashMap<std::string::String, std::string::String>,
6511
6512        /// Output only. The number of running poolers per instance.
6513        pub pooler_count: i32,
6514
6515        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6516    }
6517
6518    impl ConnectionPoolConfig {
6519        pub fn new() -> Self {
6520            std::default::Default::default()
6521        }
6522
6523        /// Sets the value of [enabled][crate::model::instance::ConnectionPoolConfig::enabled].
6524        ///
6525        /// # Example
6526        /// ```ignore,no_run
6527        /// # use google_cloud_alloydb_v1::model::instance::ConnectionPoolConfig;
6528        /// let x = ConnectionPoolConfig::new().set_enabled(true);
6529        /// ```
6530        pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6531            self.enabled = v.into();
6532            self
6533        }
6534
6535        /// Sets the value of [flags][crate::model::instance::ConnectionPoolConfig::flags].
6536        ///
6537        /// # Example
6538        /// ```ignore,no_run
6539        /// # use google_cloud_alloydb_v1::model::instance::ConnectionPoolConfig;
6540        /// let x = ConnectionPoolConfig::new().set_flags([
6541        ///     ("key0", "abc"),
6542        ///     ("key1", "xyz"),
6543        /// ]);
6544        /// ```
6545        pub fn set_flags<T, K, V>(mut self, v: T) -> Self
6546        where
6547            T: std::iter::IntoIterator<Item = (K, V)>,
6548            K: std::convert::Into<std::string::String>,
6549            V: std::convert::Into<std::string::String>,
6550        {
6551            use std::iter::Iterator;
6552            self.flags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6553            self
6554        }
6555
6556        /// Sets the value of [pooler_count][crate::model::instance::ConnectionPoolConfig::pooler_count].
6557        ///
6558        /// # Example
6559        /// ```ignore,no_run
6560        /// # use google_cloud_alloydb_v1::model::instance::ConnectionPoolConfig;
6561        /// let x = ConnectionPoolConfig::new().set_pooler_count(42);
6562        /// ```
6563        pub fn set_pooler_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6564            self.pooler_count = v.into();
6565            self
6566        }
6567    }
6568
6569    impl wkt::message::Message for ConnectionPoolConfig {
6570        fn typename() -> &'static str {
6571            "type.googleapis.com/google.cloud.alloydb.v1.Instance.ConnectionPoolConfig"
6572        }
6573    }
6574
6575    /// Instance State
6576    ///
6577    /// # Working with unknown values
6578    ///
6579    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6580    /// additional enum variants at any time. Adding new variants is not considered
6581    /// a breaking change. Applications should write their code in anticipation of:
6582    ///
6583    /// - New values appearing in future releases of the client library, **and**
6584    /// - New values received dynamically, without application changes.
6585    ///
6586    /// Please consult the [Working with enums] section in the user guide for some
6587    /// guidelines.
6588    ///
6589    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6590    #[derive(Clone, Debug, PartialEq)]
6591    #[non_exhaustive]
6592    pub enum State {
6593        /// The state of the instance is unknown.
6594        Unspecified,
6595        /// The instance is active and running.
6596        Ready,
6597        /// The instance is stopped. Instance name and IP resources are preserved.
6598        Stopped,
6599        /// The instance is being created.
6600        Creating,
6601        /// The instance is being deleted.
6602        Deleting,
6603        /// The instance is down for maintenance.
6604        Maintenance,
6605        /// The creation of the instance failed or a fatal error occurred during
6606        /// an operation on the instance.
6607        /// Note: Instances in this state would tried to be auto-repaired. And
6608        /// Customers should be able to restart, update or delete these instances.
6609        Failed,
6610        /// Index 7 is used in the producer apis for ROLLED_BACK state. Keeping that
6611        /// index unused in case that state also needs to exposed via consumer apis
6612        /// in future.
6613        /// The instance has been configured to sync data from some other source.
6614        Bootstrapping,
6615        /// The instance is being promoted.
6616        Promoting,
6617        /// If set, the enum was initialized with an unknown value.
6618        ///
6619        /// Applications can examine the value using [State::value] or
6620        /// [State::name].
6621        UnknownValue(state::UnknownValue),
6622    }
6623
6624    #[doc(hidden)]
6625    pub mod state {
6626        #[allow(unused_imports)]
6627        use super::*;
6628        #[derive(Clone, Debug, PartialEq)]
6629        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6630    }
6631
6632    impl State {
6633        /// Gets the enum value.
6634        ///
6635        /// Returns `None` if the enum contains an unknown value deserialized from
6636        /// the string representation of enums.
6637        pub fn value(&self) -> std::option::Option<i32> {
6638            match self {
6639                Self::Unspecified => std::option::Option::Some(0),
6640                Self::Ready => std::option::Option::Some(1),
6641                Self::Stopped => std::option::Option::Some(2),
6642                Self::Creating => std::option::Option::Some(3),
6643                Self::Deleting => std::option::Option::Some(4),
6644                Self::Maintenance => std::option::Option::Some(5),
6645                Self::Failed => std::option::Option::Some(6),
6646                Self::Bootstrapping => std::option::Option::Some(8),
6647                Self::Promoting => std::option::Option::Some(9),
6648                Self::UnknownValue(u) => u.0.value(),
6649            }
6650        }
6651
6652        /// Gets the enum value as a string.
6653        ///
6654        /// Returns `None` if the enum contains an unknown value deserialized from
6655        /// the integer representation of enums.
6656        pub fn name(&self) -> std::option::Option<&str> {
6657            match self {
6658                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
6659                Self::Ready => std::option::Option::Some("READY"),
6660                Self::Stopped => std::option::Option::Some("STOPPED"),
6661                Self::Creating => std::option::Option::Some("CREATING"),
6662                Self::Deleting => std::option::Option::Some("DELETING"),
6663                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
6664                Self::Failed => std::option::Option::Some("FAILED"),
6665                Self::Bootstrapping => std::option::Option::Some("BOOTSTRAPPING"),
6666                Self::Promoting => std::option::Option::Some("PROMOTING"),
6667                Self::UnknownValue(u) => u.0.name(),
6668            }
6669        }
6670    }
6671
6672    impl std::default::Default for State {
6673        fn default() -> Self {
6674            use std::convert::From;
6675            Self::from(0)
6676        }
6677    }
6678
6679    impl std::fmt::Display for State {
6680        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6681            wkt::internal::display_enum(f, self.name(), self.value())
6682        }
6683    }
6684
6685    impl std::convert::From<i32> for State {
6686        fn from(value: i32) -> Self {
6687            match value {
6688                0 => Self::Unspecified,
6689                1 => Self::Ready,
6690                2 => Self::Stopped,
6691                3 => Self::Creating,
6692                4 => Self::Deleting,
6693                5 => Self::Maintenance,
6694                6 => Self::Failed,
6695                8 => Self::Bootstrapping,
6696                9 => Self::Promoting,
6697                _ => Self::UnknownValue(state::UnknownValue(
6698                    wkt::internal::UnknownEnumValue::Integer(value),
6699                )),
6700            }
6701        }
6702    }
6703
6704    impl std::convert::From<&str> for State {
6705        fn from(value: &str) -> Self {
6706            use std::string::ToString;
6707            match value {
6708                "STATE_UNSPECIFIED" => Self::Unspecified,
6709                "READY" => Self::Ready,
6710                "STOPPED" => Self::Stopped,
6711                "CREATING" => Self::Creating,
6712                "DELETING" => Self::Deleting,
6713                "MAINTENANCE" => Self::Maintenance,
6714                "FAILED" => Self::Failed,
6715                "BOOTSTRAPPING" => Self::Bootstrapping,
6716                "PROMOTING" => Self::Promoting,
6717                _ => Self::UnknownValue(state::UnknownValue(
6718                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6719                )),
6720            }
6721        }
6722    }
6723
6724    impl serde::ser::Serialize for State {
6725        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6726        where
6727            S: serde::Serializer,
6728        {
6729            match self {
6730                Self::Unspecified => serializer.serialize_i32(0),
6731                Self::Ready => serializer.serialize_i32(1),
6732                Self::Stopped => serializer.serialize_i32(2),
6733                Self::Creating => serializer.serialize_i32(3),
6734                Self::Deleting => serializer.serialize_i32(4),
6735                Self::Maintenance => serializer.serialize_i32(5),
6736                Self::Failed => serializer.serialize_i32(6),
6737                Self::Bootstrapping => serializer.serialize_i32(8),
6738                Self::Promoting => serializer.serialize_i32(9),
6739                Self::UnknownValue(u) => u.0.serialize(serializer),
6740            }
6741        }
6742    }
6743
6744    impl<'de> serde::de::Deserialize<'de> for State {
6745        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6746        where
6747            D: serde::Deserializer<'de>,
6748        {
6749            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6750                ".google.cloud.alloydb.v1.Instance.State",
6751            ))
6752        }
6753    }
6754
6755    /// Type of an Instance
6756    ///
6757    /// # Working with unknown values
6758    ///
6759    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6760    /// additional enum variants at any time. Adding new variants is not considered
6761    /// a breaking change. Applications should write their code in anticipation of:
6762    ///
6763    /// - New values appearing in future releases of the client library, **and**
6764    /// - New values received dynamically, without application changes.
6765    ///
6766    /// Please consult the [Working with enums] section in the user guide for some
6767    /// guidelines.
6768    ///
6769    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6770    #[derive(Clone, Debug, PartialEq)]
6771    #[non_exhaustive]
6772    pub enum InstanceType {
6773        /// The type of the instance is unknown.
6774        Unspecified,
6775        /// PRIMARY instances support read and write operations.
6776        Primary,
6777        /// READ POOL instances support read operations only. Each read pool instance
6778        /// consists of one or more homogeneous nodes.
6779        ///
6780        /// * Read pool of size 1 can only have zonal availability.
6781        /// * Read pools with node count of 2 or more can have regional
6782        ///   availability (nodes are present in 2 or more zones in a region).
6783        ReadPool,
6784        /// SECONDARY instances support read operations only. SECONDARY instance
6785        /// is a cross-region read replica
6786        Secondary,
6787        /// If set, the enum was initialized with an unknown value.
6788        ///
6789        /// Applications can examine the value using [InstanceType::value] or
6790        /// [InstanceType::name].
6791        UnknownValue(instance_type::UnknownValue),
6792    }
6793
6794    #[doc(hidden)]
6795    pub mod instance_type {
6796        #[allow(unused_imports)]
6797        use super::*;
6798        #[derive(Clone, Debug, PartialEq)]
6799        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6800    }
6801
6802    impl InstanceType {
6803        /// Gets the enum value.
6804        ///
6805        /// Returns `None` if the enum contains an unknown value deserialized from
6806        /// the string representation of enums.
6807        pub fn value(&self) -> std::option::Option<i32> {
6808            match self {
6809                Self::Unspecified => std::option::Option::Some(0),
6810                Self::Primary => std::option::Option::Some(1),
6811                Self::ReadPool => std::option::Option::Some(2),
6812                Self::Secondary => std::option::Option::Some(3),
6813                Self::UnknownValue(u) => u.0.value(),
6814            }
6815        }
6816
6817        /// Gets the enum value as a string.
6818        ///
6819        /// Returns `None` if the enum contains an unknown value deserialized from
6820        /// the integer representation of enums.
6821        pub fn name(&self) -> std::option::Option<&str> {
6822            match self {
6823                Self::Unspecified => std::option::Option::Some("INSTANCE_TYPE_UNSPECIFIED"),
6824                Self::Primary => std::option::Option::Some("PRIMARY"),
6825                Self::ReadPool => std::option::Option::Some("READ_POOL"),
6826                Self::Secondary => std::option::Option::Some("SECONDARY"),
6827                Self::UnknownValue(u) => u.0.name(),
6828            }
6829        }
6830    }
6831
6832    impl std::default::Default for InstanceType {
6833        fn default() -> Self {
6834            use std::convert::From;
6835            Self::from(0)
6836        }
6837    }
6838
6839    impl std::fmt::Display for InstanceType {
6840        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6841            wkt::internal::display_enum(f, self.name(), self.value())
6842        }
6843    }
6844
6845    impl std::convert::From<i32> for InstanceType {
6846        fn from(value: i32) -> Self {
6847            match value {
6848                0 => Self::Unspecified,
6849                1 => Self::Primary,
6850                2 => Self::ReadPool,
6851                3 => Self::Secondary,
6852                _ => Self::UnknownValue(instance_type::UnknownValue(
6853                    wkt::internal::UnknownEnumValue::Integer(value),
6854                )),
6855            }
6856        }
6857    }
6858
6859    impl std::convert::From<&str> for InstanceType {
6860        fn from(value: &str) -> Self {
6861            use std::string::ToString;
6862            match value {
6863                "INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
6864                "PRIMARY" => Self::Primary,
6865                "READ_POOL" => Self::ReadPool,
6866                "SECONDARY" => Self::Secondary,
6867                _ => Self::UnknownValue(instance_type::UnknownValue(
6868                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6869                )),
6870            }
6871        }
6872    }
6873
6874    impl serde::ser::Serialize for InstanceType {
6875        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6876        where
6877            S: serde::Serializer,
6878        {
6879            match self {
6880                Self::Unspecified => serializer.serialize_i32(0),
6881                Self::Primary => serializer.serialize_i32(1),
6882                Self::ReadPool => serializer.serialize_i32(2),
6883                Self::Secondary => serializer.serialize_i32(3),
6884                Self::UnknownValue(u) => u.0.serialize(serializer),
6885            }
6886        }
6887    }
6888
6889    impl<'de> serde::de::Deserialize<'de> for InstanceType {
6890        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6891        where
6892            D: serde::Deserializer<'de>,
6893        {
6894            deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceType>::new(
6895                ".google.cloud.alloydb.v1.Instance.InstanceType",
6896            ))
6897        }
6898    }
6899
6900    /// The Availability type of an instance. Potential values:
6901    ///
6902    /// - ZONAL: The instance serves data from only one zone. Outages in that
6903    ///   zone affect instance availability.
6904    /// - REGIONAL: The instance can serve data from more than one zone in a
6905    ///   region (it is highly available).
6906    ///
6907    /// # Working with unknown values
6908    ///
6909    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6910    /// additional enum variants at any time. Adding new variants is not considered
6911    /// a breaking change. Applications should write their code in anticipation of:
6912    ///
6913    /// - New values appearing in future releases of the client library, **and**
6914    /// - New values received dynamically, without application changes.
6915    ///
6916    /// Please consult the [Working with enums] section in the user guide for some
6917    /// guidelines.
6918    ///
6919    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6920    #[derive(Clone, Debug, PartialEq)]
6921    #[non_exhaustive]
6922    pub enum AvailabilityType {
6923        /// This is an unknown Availability type.
6924        Unspecified,
6925        /// Zonal available instance.
6926        Zonal,
6927        /// Regional (or Highly) available instance.
6928        Regional,
6929        /// If set, the enum was initialized with an unknown value.
6930        ///
6931        /// Applications can examine the value using [AvailabilityType::value] or
6932        /// [AvailabilityType::name].
6933        UnknownValue(availability_type::UnknownValue),
6934    }
6935
6936    #[doc(hidden)]
6937    pub mod availability_type {
6938        #[allow(unused_imports)]
6939        use super::*;
6940        #[derive(Clone, Debug, PartialEq)]
6941        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6942    }
6943
6944    impl AvailabilityType {
6945        /// Gets the enum value.
6946        ///
6947        /// Returns `None` if the enum contains an unknown value deserialized from
6948        /// the string representation of enums.
6949        pub fn value(&self) -> std::option::Option<i32> {
6950            match self {
6951                Self::Unspecified => std::option::Option::Some(0),
6952                Self::Zonal => std::option::Option::Some(1),
6953                Self::Regional => std::option::Option::Some(2),
6954                Self::UnknownValue(u) => u.0.value(),
6955            }
6956        }
6957
6958        /// Gets the enum value as a string.
6959        ///
6960        /// Returns `None` if the enum contains an unknown value deserialized from
6961        /// the integer representation of enums.
6962        pub fn name(&self) -> std::option::Option<&str> {
6963            match self {
6964                Self::Unspecified => std::option::Option::Some("AVAILABILITY_TYPE_UNSPECIFIED"),
6965                Self::Zonal => std::option::Option::Some("ZONAL"),
6966                Self::Regional => std::option::Option::Some("REGIONAL"),
6967                Self::UnknownValue(u) => u.0.name(),
6968            }
6969        }
6970    }
6971
6972    impl std::default::Default for AvailabilityType {
6973        fn default() -> Self {
6974            use std::convert::From;
6975            Self::from(0)
6976        }
6977    }
6978
6979    impl std::fmt::Display for AvailabilityType {
6980        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6981            wkt::internal::display_enum(f, self.name(), self.value())
6982        }
6983    }
6984
6985    impl std::convert::From<i32> for AvailabilityType {
6986        fn from(value: i32) -> Self {
6987            match value {
6988                0 => Self::Unspecified,
6989                1 => Self::Zonal,
6990                2 => Self::Regional,
6991                _ => Self::UnknownValue(availability_type::UnknownValue(
6992                    wkt::internal::UnknownEnumValue::Integer(value),
6993                )),
6994            }
6995        }
6996    }
6997
6998    impl std::convert::From<&str> for AvailabilityType {
6999        fn from(value: &str) -> Self {
7000            use std::string::ToString;
7001            match value {
7002                "AVAILABILITY_TYPE_UNSPECIFIED" => Self::Unspecified,
7003                "ZONAL" => Self::Zonal,
7004                "REGIONAL" => Self::Regional,
7005                _ => Self::UnknownValue(availability_type::UnknownValue(
7006                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7007                )),
7008            }
7009        }
7010    }
7011
7012    impl serde::ser::Serialize for AvailabilityType {
7013        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7014        where
7015            S: serde::Serializer,
7016        {
7017            match self {
7018                Self::Unspecified => serializer.serialize_i32(0),
7019                Self::Zonal => serializer.serialize_i32(1),
7020                Self::Regional => serializer.serialize_i32(2),
7021                Self::UnknownValue(u) => u.0.serialize(serializer),
7022            }
7023        }
7024    }
7025
7026    impl<'de> serde::de::Deserialize<'de> for AvailabilityType {
7027        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7028        where
7029            D: serde::Deserializer<'de>,
7030        {
7031            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AvailabilityType>::new(
7032                ".google.cloud.alloydb.v1.Instance.AvailabilityType",
7033            ))
7034        }
7035    }
7036
7037    /// Specifies whether an instance needs to spin up.
7038    ///
7039    /// # Working with unknown values
7040    ///
7041    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7042    /// additional enum variants at any time. Adding new variants is not considered
7043    /// a breaking change. Applications should write their code in anticipation of:
7044    ///
7045    /// - New values appearing in future releases of the client library, **and**
7046    /// - New values received dynamically, without application changes.
7047    ///
7048    /// Please consult the [Working with enums] section in the user guide for some
7049    /// guidelines.
7050    ///
7051    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7052    #[derive(Clone, Debug, PartialEq)]
7053    #[non_exhaustive]
7054    pub enum ActivationPolicy {
7055        /// The policy is not specified.
7056        Unspecified,
7057        /// The instance is running.
7058        Always,
7059        /// The instance is not running.
7060        Never,
7061        /// If set, the enum was initialized with an unknown value.
7062        ///
7063        /// Applications can examine the value using [ActivationPolicy::value] or
7064        /// [ActivationPolicy::name].
7065        UnknownValue(activation_policy::UnknownValue),
7066    }
7067
7068    #[doc(hidden)]
7069    pub mod activation_policy {
7070        #[allow(unused_imports)]
7071        use super::*;
7072        #[derive(Clone, Debug, PartialEq)]
7073        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7074    }
7075
7076    impl ActivationPolicy {
7077        /// Gets the enum value.
7078        ///
7079        /// Returns `None` if the enum contains an unknown value deserialized from
7080        /// the string representation of enums.
7081        pub fn value(&self) -> std::option::Option<i32> {
7082            match self {
7083                Self::Unspecified => std::option::Option::Some(0),
7084                Self::Always => std::option::Option::Some(1),
7085                Self::Never => std::option::Option::Some(2),
7086                Self::UnknownValue(u) => u.0.value(),
7087            }
7088        }
7089
7090        /// Gets the enum value as a string.
7091        ///
7092        /// Returns `None` if the enum contains an unknown value deserialized from
7093        /// the integer representation of enums.
7094        pub fn name(&self) -> std::option::Option<&str> {
7095            match self {
7096                Self::Unspecified => std::option::Option::Some("ACTIVATION_POLICY_UNSPECIFIED"),
7097                Self::Always => std::option::Option::Some("ALWAYS"),
7098                Self::Never => std::option::Option::Some("NEVER"),
7099                Self::UnknownValue(u) => u.0.name(),
7100            }
7101        }
7102    }
7103
7104    impl std::default::Default for ActivationPolicy {
7105        fn default() -> Self {
7106            use std::convert::From;
7107            Self::from(0)
7108        }
7109    }
7110
7111    impl std::fmt::Display for ActivationPolicy {
7112        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7113            wkt::internal::display_enum(f, self.name(), self.value())
7114        }
7115    }
7116
7117    impl std::convert::From<i32> for ActivationPolicy {
7118        fn from(value: i32) -> Self {
7119            match value {
7120                0 => Self::Unspecified,
7121                1 => Self::Always,
7122                2 => Self::Never,
7123                _ => Self::UnknownValue(activation_policy::UnknownValue(
7124                    wkt::internal::UnknownEnumValue::Integer(value),
7125                )),
7126            }
7127        }
7128    }
7129
7130    impl std::convert::From<&str> for ActivationPolicy {
7131        fn from(value: &str) -> Self {
7132            use std::string::ToString;
7133            match value {
7134                "ACTIVATION_POLICY_UNSPECIFIED" => Self::Unspecified,
7135                "ALWAYS" => Self::Always,
7136                "NEVER" => Self::Never,
7137                _ => Self::UnknownValue(activation_policy::UnknownValue(
7138                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7139                )),
7140            }
7141        }
7142    }
7143
7144    impl serde::ser::Serialize for ActivationPolicy {
7145        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7146        where
7147            S: serde::Serializer,
7148        {
7149            match self {
7150                Self::Unspecified => serializer.serialize_i32(0),
7151                Self::Always => serializer.serialize_i32(1),
7152                Self::Never => serializer.serialize_i32(2),
7153                Self::UnknownValue(u) => u.0.serialize(serializer),
7154            }
7155        }
7156    }
7157
7158    impl<'de> serde::de::Deserialize<'de> for ActivationPolicy {
7159        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7160        where
7161            D: serde::Deserializer<'de>,
7162        {
7163            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActivationPolicy>::new(
7164                ".google.cloud.alloydb.v1.Instance.ActivationPolicy",
7165            ))
7166        }
7167    }
7168}
7169
7170/// ConnectionInfo singleton resource.
7171/// <https://google.aip.dev/156>
7172#[derive(Clone, Default, PartialEq)]
7173#[non_exhaustive]
7174pub struct ConnectionInfo {
7175    /// The name of the ConnectionInfo singleton resource, e.g.:
7176    /// projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo
7177    /// This field currently has no semantic meaning.
7178    pub name: std::string::String,
7179
7180    /// Output only. The private network IP address for the Instance. This is the
7181    /// default IP for the instance and is always created (even if enable_public_ip
7182    /// is set). This is the connection endpoint for an end-user application.
7183    pub ip_address: std::string::String,
7184
7185    /// Output only. The public IP addresses for the Instance. This is available
7186    /// ONLY when enable_public_ip is set. This is the connection endpoint for an
7187    /// end-user application.
7188    pub public_ip_address: std::string::String,
7189
7190    /// Output only. The unique ID of the Instance.
7191    pub instance_uid: std::string::String,
7192
7193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7194}
7195
7196impl ConnectionInfo {
7197    pub fn new() -> Self {
7198        std::default::Default::default()
7199    }
7200
7201    /// Sets the value of [name][crate::model::ConnectionInfo::name].
7202    ///
7203    /// # Example
7204    /// ```ignore,no_run
7205    /// # use google_cloud_alloydb_v1::model::ConnectionInfo;
7206    /// let x = ConnectionInfo::new().set_name("example");
7207    /// ```
7208    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7209        self.name = v.into();
7210        self
7211    }
7212
7213    /// Sets the value of [ip_address][crate::model::ConnectionInfo::ip_address].
7214    ///
7215    /// # Example
7216    /// ```ignore,no_run
7217    /// # use google_cloud_alloydb_v1::model::ConnectionInfo;
7218    /// let x = ConnectionInfo::new().set_ip_address("example");
7219    /// ```
7220    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7221        self.ip_address = v.into();
7222        self
7223    }
7224
7225    /// Sets the value of [public_ip_address][crate::model::ConnectionInfo::public_ip_address].
7226    ///
7227    /// # Example
7228    /// ```ignore,no_run
7229    /// # use google_cloud_alloydb_v1::model::ConnectionInfo;
7230    /// let x = ConnectionInfo::new().set_public_ip_address("example");
7231    /// ```
7232    pub fn set_public_ip_address<T: std::convert::Into<std::string::String>>(
7233        mut self,
7234        v: T,
7235    ) -> Self {
7236        self.public_ip_address = v.into();
7237        self
7238    }
7239
7240    /// Sets the value of [instance_uid][crate::model::ConnectionInfo::instance_uid].
7241    ///
7242    /// # Example
7243    /// ```ignore,no_run
7244    /// # use google_cloud_alloydb_v1::model::ConnectionInfo;
7245    /// let x = ConnectionInfo::new().set_instance_uid("example");
7246    /// ```
7247    pub fn set_instance_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7248        self.instance_uid = v.into();
7249        self
7250    }
7251}
7252
7253impl wkt::message::Message for ConnectionInfo {
7254    fn typename() -> &'static str {
7255        "type.googleapis.com/google.cloud.alloydb.v1.ConnectionInfo"
7256    }
7257}
7258
7259/// Message describing Backup object
7260#[derive(Clone, Default, PartialEq)]
7261#[non_exhaustive]
7262pub struct Backup {
7263    /// Output only. The name of the backup resource with the format:
7264    ///
7265    /// * projects/{project}/locations/{region}/backups/{backup_id}
7266    ///   where the cluster and backup ID segments should satisfy the regex
7267    ///   expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of
7268    ///   lowercase letters, numbers, and dashes, starting with a letter, and ending
7269    ///   with a letter or number. For more details see <https://google.aip.dev/122>.
7270    ///   The prefix of the backup resource name is the name of the parent
7271    ///   resource:
7272    /// * projects/{project}/locations/{region}
7273    pub name: std::string::String,
7274
7275    /// User-settable and human-readable display name for the Backup.
7276    pub display_name: std::string::String,
7277
7278    /// Output only. The system-generated UID of the resource. The UID is assigned
7279    /// when the resource is created, and it is retained until it is deleted.
7280    pub uid: std::string::String,
7281
7282    /// Output only. Create time stamp
7283    pub create_time: std::option::Option<wkt::Timestamp>,
7284
7285    /// Output only. Update time stamp
7286    ///
7287    /// Users should not infer any meaning from this field. Its value is generally
7288    /// unrelated to the timing of the backup creation operation.
7289    pub update_time: std::option::Option<wkt::Timestamp>,
7290
7291    /// Output only. Delete time stamp
7292    pub delete_time: std::option::Option<wkt::Timestamp>,
7293
7294    /// Output only. Timestamp when the resource finished being created.
7295    pub create_completion_time: std::option::Option<wkt::Timestamp>,
7296
7297    /// Labels as key value pairs
7298    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7299
7300    /// Output only. The current state of the backup.
7301    pub state: crate::model::backup::State,
7302
7303    /// The backup type, which suggests the trigger for the backup.
7304    pub r#type: crate::model::backup::Type,
7305
7306    /// User-provided description of the backup.
7307    pub description: std::string::String,
7308
7309    /// Output only. The system-generated UID of the cluster which was used to
7310    /// create this resource.
7311    pub cluster_uid: std::string::String,
7312
7313    /// Required. The full resource name of the backup source cluster
7314    /// (e.g., projects/{project}/locations/{region}/clusters/{cluster_id}).
7315    pub cluster_name: std::string::String,
7316
7317    /// Output only. Reconciling (<https://google.aip.dev/128#reconciliation>), if
7318    /// true, indicates that the service is actively updating the resource. This
7319    /// can happen due to user-triggered updates or system actions like failover or
7320    /// maintenance.
7321    pub reconciling: bool,
7322
7323    /// Optional. The encryption config can be specified to encrypt the
7324    /// backup with a customer-managed encryption key (CMEK). When this field is
7325    /// not specified, the backup will then use default encryption scheme to
7326    /// protect the user data.
7327    pub encryption_config: std::option::Option<crate::model::EncryptionConfig>,
7328
7329    /// Output only. The encryption information for the backup.
7330    pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
7331
7332    /// For Resource freshness validation (<https://google.aip.dev/154>)
7333    pub etag: std::string::String,
7334
7335    /// Annotations to allow client tools to store small amount of arbitrary data.
7336    /// This is distinct from labels.
7337    /// <https://google.aip.dev/128>
7338    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
7339
7340    /// Output only. The size of the backup in bytes.
7341    pub size_bytes: i64,
7342
7343    /// Output only. The time at which after the backup is eligible to be garbage
7344    /// collected. It is the duration specified by the backup's retention policy,
7345    /// added to the backup's create_time.
7346    pub expiry_time: std::option::Option<wkt::Timestamp>,
7347
7348    /// Output only. The QuantityBasedExpiry of the backup, specified by the
7349    /// backup's retention policy. Once the expiry quantity is over retention, the
7350    /// backup is eligible to be garbage collected.
7351    pub expiry_quantity: std::option::Option<crate::model::backup::QuantityBasedExpiry>,
7352
7353    /// Output only. Reserved for future use.
7354    pub satisfies_pzs: bool,
7355
7356    /// Output only. The database engine major version of the cluster this backup
7357    /// was created from. Any restored cluster created from this backup will have
7358    /// the same database version.
7359    pub database_version: crate::model::DatabaseVersion,
7360
7361    /// Optional. Input only. Immutable. Tag keys/values directly bound to this
7362    /// resource. For example:
7363    ///
7364    /// ```norust
7365    /// "123/environment": "production",
7366    /// "123/costCenter": "marketing"
7367    /// ```
7368    pub tags: std::collections::HashMap<std::string::String, std::string::String>,
7369
7370    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7371}
7372
7373impl Backup {
7374    pub fn new() -> Self {
7375        std::default::Default::default()
7376    }
7377
7378    /// Sets the value of [name][crate::model::Backup::name].
7379    ///
7380    /// # Example
7381    /// ```ignore,no_run
7382    /// # use google_cloud_alloydb_v1::model::Backup;
7383    /// let x = Backup::new().set_name("example");
7384    /// ```
7385    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7386        self.name = v.into();
7387        self
7388    }
7389
7390    /// Sets the value of [display_name][crate::model::Backup::display_name].
7391    ///
7392    /// # Example
7393    /// ```ignore,no_run
7394    /// # use google_cloud_alloydb_v1::model::Backup;
7395    /// let x = Backup::new().set_display_name("example");
7396    /// ```
7397    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7398        self.display_name = v.into();
7399        self
7400    }
7401
7402    /// Sets the value of [uid][crate::model::Backup::uid].
7403    ///
7404    /// # Example
7405    /// ```ignore,no_run
7406    /// # use google_cloud_alloydb_v1::model::Backup;
7407    /// let x = Backup::new().set_uid("example");
7408    /// ```
7409    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7410        self.uid = v.into();
7411        self
7412    }
7413
7414    /// Sets the value of [create_time][crate::model::Backup::create_time].
7415    ///
7416    /// # Example
7417    /// ```ignore,no_run
7418    /// # use google_cloud_alloydb_v1::model::Backup;
7419    /// use wkt::Timestamp;
7420    /// let x = Backup::new().set_create_time(Timestamp::default()/* use setters */);
7421    /// ```
7422    pub fn set_create_time<T>(mut self, v: T) -> Self
7423    where
7424        T: std::convert::Into<wkt::Timestamp>,
7425    {
7426        self.create_time = std::option::Option::Some(v.into());
7427        self
7428    }
7429
7430    /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
7431    ///
7432    /// # Example
7433    /// ```ignore,no_run
7434    /// # use google_cloud_alloydb_v1::model::Backup;
7435    /// use wkt::Timestamp;
7436    /// let x = Backup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7437    /// let x = Backup::new().set_or_clear_create_time(None::<Timestamp>);
7438    /// ```
7439    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7440    where
7441        T: std::convert::Into<wkt::Timestamp>,
7442    {
7443        self.create_time = v.map(|x| x.into());
7444        self
7445    }
7446
7447    /// Sets the value of [update_time][crate::model::Backup::update_time].
7448    ///
7449    /// # Example
7450    /// ```ignore,no_run
7451    /// # use google_cloud_alloydb_v1::model::Backup;
7452    /// use wkt::Timestamp;
7453    /// let x = Backup::new().set_update_time(Timestamp::default()/* use setters */);
7454    /// ```
7455    pub fn set_update_time<T>(mut self, v: T) -> Self
7456    where
7457        T: std::convert::Into<wkt::Timestamp>,
7458    {
7459        self.update_time = std::option::Option::Some(v.into());
7460        self
7461    }
7462
7463    /// Sets or clears the value of [update_time][crate::model::Backup::update_time].
7464    ///
7465    /// # Example
7466    /// ```ignore,no_run
7467    /// # use google_cloud_alloydb_v1::model::Backup;
7468    /// use wkt::Timestamp;
7469    /// let x = Backup::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7470    /// let x = Backup::new().set_or_clear_update_time(None::<Timestamp>);
7471    /// ```
7472    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7473    where
7474        T: std::convert::Into<wkt::Timestamp>,
7475    {
7476        self.update_time = v.map(|x| x.into());
7477        self
7478    }
7479
7480    /// Sets the value of [delete_time][crate::model::Backup::delete_time].
7481    ///
7482    /// # Example
7483    /// ```ignore,no_run
7484    /// # use google_cloud_alloydb_v1::model::Backup;
7485    /// use wkt::Timestamp;
7486    /// let x = Backup::new().set_delete_time(Timestamp::default()/* use setters */);
7487    /// ```
7488    pub fn set_delete_time<T>(mut self, v: T) -> Self
7489    where
7490        T: std::convert::Into<wkt::Timestamp>,
7491    {
7492        self.delete_time = std::option::Option::Some(v.into());
7493        self
7494    }
7495
7496    /// Sets or clears the value of [delete_time][crate::model::Backup::delete_time].
7497    ///
7498    /// # Example
7499    /// ```ignore,no_run
7500    /// # use google_cloud_alloydb_v1::model::Backup;
7501    /// use wkt::Timestamp;
7502    /// let x = Backup::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
7503    /// let x = Backup::new().set_or_clear_delete_time(None::<Timestamp>);
7504    /// ```
7505    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
7506    where
7507        T: std::convert::Into<wkt::Timestamp>,
7508    {
7509        self.delete_time = v.map(|x| x.into());
7510        self
7511    }
7512
7513    /// Sets the value of [create_completion_time][crate::model::Backup::create_completion_time].
7514    ///
7515    /// # Example
7516    /// ```ignore,no_run
7517    /// # use google_cloud_alloydb_v1::model::Backup;
7518    /// use wkt::Timestamp;
7519    /// let x = Backup::new().set_create_completion_time(Timestamp::default()/* use setters */);
7520    /// ```
7521    pub fn set_create_completion_time<T>(mut self, v: T) -> Self
7522    where
7523        T: std::convert::Into<wkt::Timestamp>,
7524    {
7525        self.create_completion_time = std::option::Option::Some(v.into());
7526        self
7527    }
7528
7529    /// Sets or clears the value of [create_completion_time][crate::model::Backup::create_completion_time].
7530    ///
7531    /// # Example
7532    /// ```ignore,no_run
7533    /// # use google_cloud_alloydb_v1::model::Backup;
7534    /// use wkt::Timestamp;
7535    /// let x = Backup::new().set_or_clear_create_completion_time(Some(Timestamp::default()/* use setters */));
7536    /// let x = Backup::new().set_or_clear_create_completion_time(None::<Timestamp>);
7537    /// ```
7538    pub fn set_or_clear_create_completion_time<T>(mut self, v: std::option::Option<T>) -> Self
7539    where
7540        T: std::convert::Into<wkt::Timestamp>,
7541    {
7542        self.create_completion_time = v.map(|x| x.into());
7543        self
7544    }
7545
7546    /// Sets the value of [labels][crate::model::Backup::labels].
7547    ///
7548    /// # Example
7549    /// ```ignore,no_run
7550    /// # use google_cloud_alloydb_v1::model::Backup;
7551    /// let x = Backup::new().set_labels([
7552    ///     ("key0", "abc"),
7553    ///     ("key1", "xyz"),
7554    /// ]);
7555    /// ```
7556    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7557    where
7558        T: std::iter::IntoIterator<Item = (K, V)>,
7559        K: std::convert::Into<std::string::String>,
7560        V: std::convert::Into<std::string::String>,
7561    {
7562        use std::iter::Iterator;
7563        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7564        self
7565    }
7566
7567    /// Sets the value of [state][crate::model::Backup::state].
7568    ///
7569    /// # Example
7570    /// ```ignore,no_run
7571    /// # use google_cloud_alloydb_v1::model::Backup;
7572    /// use google_cloud_alloydb_v1::model::backup::State;
7573    /// let x0 = Backup::new().set_state(State::Ready);
7574    /// let x1 = Backup::new().set_state(State::Creating);
7575    /// let x2 = Backup::new().set_state(State::Failed);
7576    /// ```
7577    pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
7578        self.state = v.into();
7579        self
7580    }
7581
7582    /// Sets the value of [r#type][crate::model::Backup::type].
7583    ///
7584    /// # Example
7585    /// ```ignore,no_run
7586    /// # use google_cloud_alloydb_v1::model::Backup;
7587    /// use google_cloud_alloydb_v1::model::backup::Type;
7588    /// let x0 = Backup::new().set_type(Type::OnDemand);
7589    /// let x1 = Backup::new().set_type(Type::Automated);
7590    /// let x2 = Backup::new().set_type(Type::Continuous);
7591    /// ```
7592    pub fn set_type<T: std::convert::Into<crate::model::backup::Type>>(mut self, v: T) -> Self {
7593        self.r#type = v.into();
7594        self
7595    }
7596
7597    /// Sets the value of [description][crate::model::Backup::description].
7598    ///
7599    /// # Example
7600    /// ```ignore,no_run
7601    /// # use google_cloud_alloydb_v1::model::Backup;
7602    /// let x = Backup::new().set_description("example");
7603    /// ```
7604    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7605        self.description = v.into();
7606        self
7607    }
7608
7609    /// Sets the value of [cluster_uid][crate::model::Backup::cluster_uid].
7610    ///
7611    /// # Example
7612    /// ```ignore,no_run
7613    /// # use google_cloud_alloydb_v1::model::Backup;
7614    /// let x = Backup::new().set_cluster_uid("example");
7615    /// ```
7616    pub fn set_cluster_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7617        self.cluster_uid = v.into();
7618        self
7619    }
7620
7621    /// Sets the value of [cluster_name][crate::model::Backup::cluster_name].
7622    ///
7623    /// # Example
7624    /// ```ignore,no_run
7625    /// # use google_cloud_alloydb_v1::model::Backup;
7626    /// let x = Backup::new().set_cluster_name("example");
7627    /// ```
7628    pub fn set_cluster_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7629        self.cluster_name = v.into();
7630        self
7631    }
7632
7633    /// Sets the value of [reconciling][crate::model::Backup::reconciling].
7634    ///
7635    /// # Example
7636    /// ```ignore,no_run
7637    /// # use google_cloud_alloydb_v1::model::Backup;
7638    /// let x = Backup::new().set_reconciling(true);
7639    /// ```
7640    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7641        self.reconciling = v.into();
7642        self
7643    }
7644
7645    /// Sets the value of [encryption_config][crate::model::Backup::encryption_config].
7646    ///
7647    /// # Example
7648    /// ```ignore,no_run
7649    /// # use google_cloud_alloydb_v1::model::Backup;
7650    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
7651    /// let x = Backup::new().set_encryption_config(EncryptionConfig::default()/* use setters */);
7652    /// ```
7653    pub fn set_encryption_config<T>(mut self, v: T) -> Self
7654    where
7655        T: std::convert::Into<crate::model::EncryptionConfig>,
7656    {
7657        self.encryption_config = std::option::Option::Some(v.into());
7658        self
7659    }
7660
7661    /// Sets or clears the value of [encryption_config][crate::model::Backup::encryption_config].
7662    ///
7663    /// # Example
7664    /// ```ignore,no_run
7665    /// # use google_cloud_alloydb_v1::model::Backup;
7666    /// use google_cloud_alloydb_v1::model::EncryptionConfig;
7667    /// let x = Backup::new().set_or_clear_encryption_config(Some(EncryptionConfig::default()/* use setters */));
7668    /// let x = Backup::new().set_or_clear_encryption_config(None::<EncryptionConfig>);
7669    /// ```
7670    pub fn set_or_clear_encryption_config<T>(mut self, v: std::option::Option<T>) -> Self
7671    where
7672        T: std::convert::Into<crate::model::EncryptionConfig>,
7673    {
7674        self.encryption_config = v.map(|x| x.into());
7675        self
7676    }
7677
7678    /// Sets the value of [encryption_info][crate::model::Backup::encryption_info].
7679    ///
7680    /// # Example
7681    /// ```ignore,no_run
7682    /// # use google_cloud_alloydb_v1::model::Backup;
7683    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
7684    /// let x = Backup::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
7685    /// ```
7686    pub fn set_encryption_info<T>(mut self, v: T) -> Self
7687    where
7688        T: std::convert::Into<crate::model::EncryptionInfo>,
7689    {
7690        self.encryption_info = std::option::Option::Some(v.into());
7691        self
7692    }
7693
7694    /// Sets or clears the value of [encryption_info][crate::model::Backup::encryption_info].
7695    ///
7696    /// # Example
7697    /// ```ignore,no_run
7698    /// # use google_cloud_alloydb_v1::model::Backup;
7699    /// use google_cloud_alloydb_v1::model::EncryptionInfo;
7700    /// let x = Backup::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
7701    /// let x = Backup::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
7702    /// ```
7703    pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
7704    where
7705        T: std::convert::Into<crate::model::EncryptionInfo>,
7706    {
7707        self.encryption_info = v.map(|x| x.into());
7708        self
7709    }
7710
7711    /// Sets the value of [etag][crate::model::Backup::etag].
7712    ///
7713    /// # Example
7714    /// ```ignore,no_run
7715    /// # use google_cloud_alloydb_v1::model::Backup;
7716    /// let x = Backup::new().set_etag("example");
7717    /// ```
7718    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7719        self.etag = v.into();
7720        self
7721    }
7722
7723    /// Sets the value of [annotations][crate::model::Backup::annotations].
7724    ///
7725    /// # Example
7726    /// ```ignore,no_run
7727    /// # use google_cloud_alloydb_v1::model::Backup;
7728    /// let x = Backup::new().set_annotations([
7729    ///     ("key0", "abc"),
7730    ///     ("key1", "xyz"),
7731    /// ]);
7732    /// ```
7733    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
7734    where
7735        T: std::iter::IntoIterator<Item = (K, V)>,
7736        K: std::convert::Into<std::string::String>,
7737        V: std::convert::Into<std::string::String>,
7738    {
7739        use std::iter::Iterator;
7740        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7741        self
7742    }
7743
7744    /// Sets the value of [size_bytes][crate::model::Backup::size_bytes].
7745    ///
7746    /// # Example
7747    /// ```ignore,no_run
7748    /// # use google_cloud_alloydb_v1::model::Backup;
7749    /// let x = Backup::new().set_size_bytes(42);
7750    /// ```
7751    pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
7752        self.size_bytes = v.into();
7753        self
7754    }
7755
7756    /// Sets the value of [expiry_time][crate::model::Backup::expiry_time].
7757    ///
7758    /// # Example
7759    /// ```ignore,no_run
7760    /// # use google_cloud_alloydb_v1::model::Backup;
7761    /// use wkt::Timestamp;
7762    /// let x = Backup::new().set_expiry_time(Timestamp::default()/* use setters */);
7763    /// ```
7764    pub fn set_expiry_time<T>(mut self, v: T) -> Self
7765    where
7766        T: std::convert::Into<wkt::Timestamp>,
7767    {
7768        self.expiry_time = std::option::Option::Some(v.into());
7769        self
7770    }
7771
7772    /// Sets or clears the value of [expiry_time][crate::model::Backup::expiry_time].
7773    ///
7774    /// # Example
7775    /// ```ignore,no_run
7776    /// # use google_cloud_alloydb_v1::model::Backup;
7777    /// use wkt::Timestamp;
7778    /// let x = Backup::new().set_or_clear_expiry_time(Some(Timestamp::default()/* use setters */));
7779    /// let x = Backup::new().set_or_clear_expiry_time(None::<Timestamp>);
7780    /// ```
7781    pub fn set_or_clear_expiry_time<T>(mut self, v: std::option::Option<T>) -> Self
7782    where
7783        T: std::convert::Into<wkt::Timestamp>,
7784    {
7785        self.expiry_time = v.map(|x| x.into());
7786        self
7787    }
7788
7789    /// Sets the value of [expiry_quantity][crate::model::Backup::expiry_quantity].
7790    ///
7791    /// # Example
7792    /// ```ignore,no_run
7793    /// # use google_cloud_alloydb_v1::model::Backup;
7794    /// use google_cloud_alloydb_v1::model::backup::QuantityBasedExpiry;
7795    /// let x = Backup::new().set_expiry_quantity(QuantityBasedExpiry::default()/* use setters */);
7796    /// ```
7797    pub fn set_expiry_quantity<T>(mut self, v: T) -> Self
7798    where
7799        T: std::convert::Into<crate::model::backup::QuantityBasedExpiry>,
7800    {
7801        self.expiry_quantity = std::option::Option::Some(v.into());
7802        self
7803    }
7804
7805    /// Sets or clears the value of [expiry_quantity][crate::model::Backup::expiry_quantity].
7806    ///
7807    /// # Example
7808    /// ```ignore,no_run
7809    /// # use google_cloud_alloydb_v1::model::Backup;
7810    /// use google_cloud_alloydb_v1::model::backup::QuantityBasedExpiry;
7811    /// let x = Backup::new().set_or_clear_expiry_quantity(Some(QuantityBasedExpiry::default()/* use setters */));
7812    /// let x = Backup::new().set_or_clear_expiry_quantity(None::<QuantityBasedExpiry>);
7813    /// ```
7814    pub fn set_or_clear_expiry_quantity<T>(mut self, v: std::option::Option<T>) -> Self
7815    where
7816        T: std::convert::Into<crate::model::backup::QuantityBasedExpiry>,
7817    {
7818        self.expiry_quantity = v.map(|x| x.into());
7819        self
7820    }
7821
7822    /// Sets the value of [satisfies_pzs][crate::model::Backup::satisfies_pzs].
7823    ///
7824    /// # Example
7825    /// ```ignore,no_run
7826    /// # use google_cloud_alloydb_v1::model::Backup;
7827    /// let x = Backup::new().set_satisfies_pzs(true);
7828    /// ```
7829    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7830        self.satisfies_pzs = v.into();
7831        self
7832    }
7833
7834    /// Sets the value of [database_version][crate::model::Backup::database_version].
7835    ///
7836    /// # Example
7837    /// ```ignore,no_run
7838    /// # use google_cloud_alloydb_v1::model::Backup;
7839    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
7840    /// let x0 = Backup::new().set_database_version(DatabaseVersion::Postgres14);
7841    /// let x1 = Backup::new().set_database_version(DatabaseVersion::Postgres15);
7842    /// let x2 = Backup::new().set_database_version(DatabaseVersion::Postgres16);
7843    /// ```
7844    pub fn set_database_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
7845        mut self,
7846        v: T,
7847    ) -> Self {
7848        self.database_version = v.into();
7849        self
7850    }
7851
7852    /// Sets the value of [tags][crate::model::Backup::tags].
7853    ///
7854    /// # Example
7855    /// ```ignore,no_run
7856    /// # use google_cloud_alloydb_v1::model::Backup;
7857    /// let x = Backup::new().set_tags([
7858    ///     ("key0", "abc"),
7859    ///     ("key1", "xyz"),
7860    /// ]);
7861    /// ```
7862    pub fn set_tags<T, K, V>(mut self, v: T) -> Self
7863    where
7864        T: std::iter::IntoIterator<Item = (K, V)>,
7865        K: std::convert::Into<std::string::String>,
7866        V: std::convert::Into<std::string::String>,
7867    {
7868        use std::iter::Iterator;
7869        self.tags = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7870        self
7871    }
7872}
7873
7874impl wkt::message::Message for Backup {
7875    fn typename() -> &'static str {
7876        "type.googleapis.com/google.cloud.alloydb.v1.Backup"
7877    }
7878}
7879
7880/// Defines additional types related to [Backup].
7881pub mod backup {
7882    #[allow(unused_imports)]
7883    use super::*;
7884
7885    /// A backup's position in a quantity-based retention queue, of backups with
7886    /// the same source cluster and type, with length, retention, specified by the
7887    /// backup's retention policy.
7888    /// Once the position is greater than the retention, the backup is eligible to
7889    /// be garbage collected.
7890    ///
7891    /// Example: 5 backups from the same source cluster and type with a
7892    /// quantity-based retention of 3 and denoted by backup_id (position,
7893    /// retention).
7894    ///
7895    /// Safe: backup_5 (1, 3), backup_4, (2, 3), backup_3 (3, 3).
7896    /// Awaiting garbage collection: backup_2 (4, 3), backup_1 (5, 3)
7897    #[derive(Clone, Default, PartialEq)]
7898    #[non_exhaustive]
7899    pub struct QuantityBasedExpiry {
7900        /// Output only. The backup's position among its backups with the same source
7901        /// cluster and type, by descending chronological order create time(i.e.
7902        /// newest first).
7903        pub retention_count: i32,
7904
7905        /// Output only. The length of the quantity-based queue, specified by the
7906        /// backup's retention policy.
7907        pub total_retention_count: i32,
7908
7909        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7910    }
7911
7912    impl QuantityBasedExpiry {
7913        pub fn new() -> Self {
7914            std::default::Default::default()
7915        }
7916
7917        /// Sets the value of [retention_count][crate::model::backup::QuantityBasedExpiry::retention_count].
7918        ///
7919        /// # Example
7920        /// ```ignore,no_run
7921        /// # use google_cloud_alloydb_v1::model::backup::QuantityBasedExpiry;
7922        /// let x = QuantityBasedExpiry::new().set_retention_count(42);
7923        /// ```
7924        pub fn set_retention_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7925            self.retention_count = v.into();
7926            self
7927        }
7928
7929        /// Sets the value of [total_retention_count][crate::model::backup::QuantityBasedExpiry::total_retention_count].
7930        ///
7931        /// # Example
7932        /// ```ignore,no_run
7933        /// # use google_cloud_alloydb_v1::model::backup::QuantityBasedExpiry;
7934        /// let x = QuantityBasedExpiry::new().set_total_retention_count(42);
7935        /// ```
7936        pub fn set_total_retention_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7937            self.total_retention_count = v.into();
7938            self
7939        }
7940    }
7941
7942    impl wkt::message::Message for QuantityBasedExpiry {
7943        fn typename() -> &'static str {
7944            "type.googleapis.com/google.cloud.alloydb.v1.Backup.QuantityBasedExpiry"
7945        }
7946    }
7947
7948    /// Backup State
7949    ///
7950    /// # Working with unknown values
7951    ///
7952    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7953    /// additional enum variants at any time. Adding new variants is not considered
7954    /// a breaking change. Applications should write their code in anticipation of:
7955    ///
7956    /// - New values appearing in future releases of the client library, **and**
7957    /// - New values received dynamically, without application changes.
7958    ///
7959    /// Please consult the [Working with enums] section in the user guide for some
7960    /// guidelines.
7961    ///
7962    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7963    #[derive(Clone, Debug, PartialEq)]
7964    #[non_exhaustive]
7965    pub enum State {
7966        /// The state of the backup is unknown.
7967        Unspecified,
7968        /// The backup is ready.
7969        Ready,
7970        /// The backup is creating.
7971        Creating,
7972        /// The backup failed.
7973        Failed,
7974        /// The backup is being deleted.
7975        Deleting,
7976        /// If set, the enum was initialized with an unknown value.
7977        ///
7978        /// Applications can examine the value using [State::value] or
7979        /// [State::name].
7980        UnknownValue(state::UnknownValue),
7981    }
7982
7983    #[doc(hidden)]
7984    pub mod state {
7985        #[allow(unused_imports)]
7986        use super::*;
7987        #[derive(Clone, Debug, PartialEq)]
7988        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7989    }
7990
7991    impl State {
7992        /// Gets the enum value.
7993        ///
7994        /// Returns `None` if the enum contains an unknown value deserialized from
7995        /// the string representation of enums.
7996        pub fn value(&self) -> std::option::Option<i32> {
7997            match self {
7998                Self::Unspecified => std::option::Option::Some(0),
7999                Self::Ready => std::option::Option::Some(1),
8000                Self::Creating => std::option::Option::Some(2),
8001                Self::Failed => std::option::Option::Some(3),
8002                Self::Deleting => std::option::Option::Some(4),
8003                Self::UnknownValue(u) => u.0.value(),
8004            }
8005        }
8006
8007        /// Gets the enum value as a string.
8008        ///
8009        /// Returns `None` if the enum contains an unknown value deserialized from
8010        /// the integer representation of enums.
8011        pub fn name(&self) -> std::option::Option<&str> {
8012            match self {
8013                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8014                Self::Ready => std::option::Option::Some("READY"),
8015                Self::Creating => std::option::Option::Some("CREATING"),
8016                Self::Failed => std::option::Option::Some("FAILED"),
8017                Self::Deleting => std::option::Option::Some("DELETING"),
8018                Self::UnknownValue(u) => u.0.name(),
8019            }
8020        }
8021    }
8022
8023    impl std::default::Default for State {
8024        fn default() -> Self {
8025            use std::convert::From;
8026            Self::from(0)
8027        }
8028    }
8029
8030    impl std::fmt::Display for State {
8031        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8032            wkt::internal::display_enum(f, self.name(), self.value())
8033        }
8034    }
8035
8036    impl std::convert::From<i32> for State {
8037        fn from(value: i32) -> Self {
8038            match value {
8039                0 => Self::Unspecified,
8040                1 => Self::Ready,
8041                2 => Self::Creating,
8042                3 => Self::Failed,
8043                4 => Self::Deleting,
8044                _ => Self::UnknownValue(state::UnknownValue(
8045                    wkt::internal::UnknownEnumValue::Integer(value),
8046                )),
8047            }
8048        }
8049    }
8050
8051    impl std::convert::From<&str> for State {
8052        fn from(value: &str) -> Self {
8053            use std::string::ToString;
8054            match value {
8055                "STATE_UNSPECIFIED" => Self::Unspecified,
8056                "READY" => Self::Ready,
8057                "CREATING" => Self::Creating,
8058                "FAILED" => Self::Failed,
8059                "DELETING" => Self::Deleting,
8060                _ => Self::UnknownValue(state::UnknownValue(
8061                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8062                )),
8063            }
8064        }
8065    }
8066
8067    impl serde::ser::Serialize for State {
8068        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8069        where
8070            S: serde::Serializer,
8071        {
8072            match self {
8073                Self::Unspecified => serializer.serialize_i32(0),
8074                Self::Ready => serializer.serialize_i32(1),
8075                Self::Creating => serializer.serialize_i32(2),
8076                Self::Failed => serializer.serialize_i32(3),
8077                Self::Deleting => serializer.serialize_i32(4),
8078                Self::UnknownValue(u) => u.0.serialize(serializer),
8079            }
8080        }
8081    }
8082
8083    impl<'de> serde::de::Deserialize<'de> for State {
8084        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8085        where
8086            D: serde::Deserializer<'de>,
8087        {
8088            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8089                ".google.cloud.alloydb.v1.Backup.State",
8090            ))
8091        }
8092    }
8093
8094    /// Backup Type
8095    ///
8096    /// # Working with unknown values
8097    ///
8098    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8099    /// additional enum variants at any time. Adding new variants is not considered
8100    /// a breaking change. Applications should write their code in anticipation of:
8101    ///
8102    /// - New values appearing in future releases of the client library, **and**
8103    /// - New values received dynamically, without application changes.
8104    ///
8105    /// Please consult the [Working with enums] section in the user guide for some
8106    /// guidelines.
8107    ///
8108    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8109    #[derive(Clone, Debug, PartialEq)]
8110    #[non_exhaustive]
8111    pub enum Type {
8112        /// Backup Type is unknown.
8113        Unspecified,
8114        /// ON_DEMAND backups that were triggered by the customer (e.g., not
8115        /// AUTOMATED).
8116        OnDemand,
8117        /// AUTOMATED backups triggered by the automated backups scheduler pursuant
8118        /// to an automated backup policy.
8119        Automated,
8120        /// CONTINUOUS backups triggered by the automated backups scheduler
8121        /// due to a continuous backup policy.
8122        Continuous,
8123        /// If set, the enum was initialized with an unknown value.
8124        ///
8125        /// Applications can examine the value using [Type::value] or
8126        /// [Type::name].
8127        UnknownValue(r#type::UnknownValue),
8128    }
8129
8130    #[doc(hidden)]
8131    pub mod r#type {
8132        #[allow(unused_imports)]
8133        use super::*;
8134        #[derive(Clone, Debug, PartialEq)]
8135        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8136    }
8137
8138    impl Type {
8139        /// Gets the enum value.
8140        ///
8141        /// Returns `None` if the enum contains an unknown value deserialized from
8142        /// the string representation of enums.
8143        pub fn value(&self) -> std::option::Option<i32> {
8144            match self {
8145                Self::Unspecified => std::option::Option::Some(0),
8146                Self::OnDemand => std::option::Option::Some(1),
8147                Self::Automated => std::option::Option::Some(2),
8148                Self::Continuous => std::option::Option::Some(3),
8149                Self::UnknownValue(u) => u.0.value(),
8150            }
8151        }
8152
8153        /// Gets the enum value as a string.
8154        ///
8155        /// Returns `None` if the enum contains an unknown value deserialized from
8156        /// the integer representation of enums.
8157        pub fn name(&self) -> std::option::Option<&str> {
8158            match self {
8159                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
8160                Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
8161                Self::Automated => std::option::Option::Some("AUTOMATED"),
8162                Self::Continuous => std::option::Option::Some("CONTINUOUS"),
8163                Self::UnknownValue(u) => u.0.name(),
8164            }
8165        }
8166    }
8167
8168    impl std::default::Default for Type {
8169        fn default() -> Self {
8170            use std::convert::From;
8171            Self::from(0)
8172        }
8173    }
8174
8175    impl std::fmt::Display for Type {
8176        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8177            wkt::internal::display_enum(f, self.name(), self.value())
8178        }
8179    }
8180
8181    impl std::convert::From<i32> for Type {
8182        fn from(value: i32) -> Self {
8183            match value {
8184                0 => Self::Unspecified,
8185                1 => Self::OnDemand,
8186                2 => Self::Automated,
8187                3 => Self::Continuous,
8188                _ => Self::UnknownValue(r#type::UnknownValue(
8189                    wkt::internal::UnknownEnumValue::Integer(value),
8190                )),
8191            }
8192        }
8193    }
8194
8195    impl std::convert::From<&str> for Type {
8196        fn from(value: &str) -> Self {
8197            use std::string::ToString;
8198            match value {
8199                "TYPE_UNSPECIFIED" => Self::Unspecified,
8200                "ON_DEMAND" => Self::OnDemand,
8201                "AUTOMATED" => Self::Automated,
8202                "CONTINUOUS" => Self::Continuous,
8203                _ => Self::UnknownValue(r#type::UnknownValue(
8204                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8205                )),
8206            }
8207        }
8208    }
8209
8210    impl serde::ser::Serialize for Type {
8211        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8212        where
8213            S: serde::Serializer,
8214        {
8215            match self {
8216                Self::Unspecified => serializer.serialize_i32(0),
8217                Self::OnDemand => serializer.serialize_i32(1),
8218                Self::Automated => serializer.serialize_i32(2),
8219                Self::Continuous => serializer.serialize_i32(3),
8220                Self::UnknownValue(u) => u.0.serialize(serializer),
8221            }
8222        }
8223    }
8224
8225    impl<'de> serde::de::Deserialize<'de> for Type {
8226        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8227        where
8228            D: serde::Deserializer<'de>,
8229        {
8230            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
8231                ".google.cloud.alloydb.v1.Backup.Type",
8232            ))
8233        }
8234    }
8235}
8236
8237/// SupportedDatabaseFlag gives general information about a database flag,
8238/// like type and allowed values. This is a static value that is defined
8239/// on the server side, and it cannot be modified by callers.
8240/// To set the Database flags on a particular Instance, a caller should modify
8241/// the Instance.database_flags field.
8242#[derive(Clone, Default, PartialEq)]
8243#[non_exhaustive]
8244pub struct SupportedDatabaseFlag {
8245    /// The name of the flag resource, following Google Cloud conventions, e.g.:
8246    ///
8247    /// * projects/{project}/locations/{location}/flags/{flag}
8248    ///   This field currently has no semantic meaning.
8249    pub name: std::string::String,
8250
8251    /// The name of the database flag, e.g. "max_allowed_packets".
8252    /// The is a possibly key for the Instance.database_flags map field.
8253    pub flag_name: std::string::String,
8254
8255    pub value_type: crate::model::supported_database_flag::ValueType,
8256
8257    /// Whether the database flag accepts multiple values. If true,
8258    /// a comma-separated list of stringified values may be specified.
8259    pub accepts_multiple_values: bool,
8260
8261    /// Major database engine versions for which this flag is supported.
8262    pub supported_db_versions: std::vec::Vec<crate::model::DatabaseVersion>,
8263
8264    /// Whether setting or updating this flag on an Instance requires a database
8265    /// restart. If a flag that requires database restart is set, the backend
8266    /// will automatically restart the database (making sure to satisfy any
8267    /// availability SLO's).
8268    pub requires_db_restart: bool,
8269
8270    /// The scope of the flag.
8271    pub scope: crate::model::supported_database_flag::Scope,
8272
8273    /// The restrictions on the flag value per type.
8274    pub restrictions: std::option::Option<crate::model::supported_database_flag::Restrictions>,
8275
8276    /// The recommended value for the flag by type, if applicable.
8277    pub recommended_value:
8278        std::option::Option<crate::model::supported_database_flag::RecommendedValue>,
8279
8280    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8281}
8282
8283impl SupportedDatabaseFlag {
8284    pub fn new() -> Self {
8285        std::default::Default::default()
8286    }
8287
8288    /// Sets the value of [name][crate::model::SupportedDatabaseFlag::name].
8289    ///
8290    /// # Example
8291    /// ```ignore,no_run
8292    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8293    /// let x = SupportedDatabaseFlag::new().set_name("example");
8294    /// ```
8295    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8296        self.name = v.into();
8297        self
8298    }
8299
8300    /// Sets the value of [flag_name][crate::model::SupportedDatabaseFlag::flag_name].
8301    ///
8302    /// # Example
8303    /// ```ignore,no_run
8304    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8305    /// let x = SupportedDatabaseFlag::new().set_flag_name("example");
8306    /// ```
8307    pub fn set_flag_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8308        self.flag_name = v.into();
8309        self
8310    }
8311
8312    /// Sets the value of [value_type][crate::model::SupportedDatabaseFlag::value_type].
8313    ///
8314    /// # Example
8315    /// ```ignore,no_run
8316    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8317    /// use google_cloud_alloydb_v1::model::supported_database_flag::ValueType;
8318    /// let x0 = SupportedDatabaseFlag::new().set_value_type(ValueType::String);
8319    /// let x1 = SupportedDatabaseFlag::new().set_value_type(ValueType::Integer);
8320    /// let x2 = SupportedDatabaseFlag::new().set_value_type(ValueType::Float);
8321    /// ```
8322    pub fn set_value_type<
8323        T: std::convert::Into<crate::model::supported_database_flag::ValueType>,
8324    >(
8325        mut self,
8326        v: T,
8327    ) -> Self {
8328        self.value_type = v.into();
8329        self
8330    }
8331
8332    /// Sets the value of [accepts_multiple_values][crate::model::SupportedDatabaseFlag::accepts_multiple_values].
8333    ///
8334    /// # Example
8335    /// ```ignore,no_run
8336    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8337    /// let x = SupportedDatabaseFlag::new().set_accepts_multiple_values(true);
8338    /// ```
8339    pub fn set_accepts_multiple_values<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8340        self.accepts_multiple_values = v.into();
8341        self
8342    }
8343
8344    /// Sets the value of [supported_db_versions][crate::model::SupportedDatabaseFlag::supported_db_versions].
8345    ///
8346    /// # Example
8347    /// ```ignore,no_run
8348    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8349    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
8350    /// let x = SupportedDatabaseFlag::new().set_supported_db_versions([
8351    ///     DatabaseVersion::Postgres14,
8352    ///     DatabaseVersion::Postgres15,
8353    ///     DatabaseVersion::Postgres16,
8354    /// ]);
8355    /// ```
8356    pub fn set_supported_db_versions<T, V>(mut self, v: T) -> Self
8357    where
8358        T: std::iter::IntoIterator<Item = V>,
8359        V: std::convert::Into<crate::model::DatabaseVersion>,
8360    {
8361        use std::iter::Iterator;
8362        self.supported_db_versions = v.into_iter().map(|i| i.into()).collect();
8363        self
8364    }
8365
8366    /// Sets the value of [requires_db_restart][crate::model::SupportedDatabaseFlag::requires_db_restart].
8367    ///
8368    /// # Example
8369    /// ```ignore,no_run
8370    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8371    /// let x = SupportedDatabaseFlag::new().set_requires_db_restart(true);
8372    /// ```
8373    pub fn set_requires_db_restart<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8374        self.requires_db_restart = v.into();
8375        self
8376    }
8377
8378    /// Sets the value of [scope][crate::model::SupportedDatabaseFlag::scope].
8379    ///
8380    /// # Example
8381    /// ```ignore,no_run
8382    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8383    /// use google_cloud_alloydb_v1::model::supported_database_flag::Scope;
8384    /// let x0 = SupportedDatabaseFlag::new().set_scope(Scope::Database);
8385    /// let x1 = SupportedDatabaseFlag::new().set_scope(Scope::ConnectionPool);
8386    /// ```
8387    pub fn set_scope<T: std::convert::Into<crate::model::supported_database_flag::Scope>>(
8388        mut self,
8389        v: T,
8390    ) -> Self {
8391        self.scope = v.into();
8392        self
8393    }
8394
8395    /// Sets the value of [restrictions][crate::model::SupportedDatabaseFlag::restrictions].
8396    ///
8397    /// Note that all the setters affecting `restrictions` are mutually
8398    /// exclusive.
8399    ///
8400    /// # Example
8401    /// ```ignore,no_run
8402    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8403    /// use google_cloud_alloydb_v1::model::supported_database_flag::StringRestrictions;
8404    /// let x = SupportedDatabaseFlag::new().set_restrictions(Some(
8405    ///     google_cloud_alloydb_v1::model::supported_database_flag::Restrictions::StringRestrictions(StringRestrictions::default().into())));
8406    /// ```
8407    pub fn set_restrictions<
8408        T: std::convert::Into<
8409                std::option::Option<crate::model::supported_database_flag::Restrictions>,
8410            >,
8411    >(
8412        mut self,
8413        v: T,
8414    ) -> Self {
8415        self.restrictions = v.into();
8416        self
8417    }
8418
8419    /// The value of [restrictions][crate::model::SupportedDatabaseFlag::restrictions]
8420    /// if it holds a `StringRestrictions`, `None` if the field is not set or
8421    /// holds a different branch.
8422    pub fn string_restrictions(
8423        &self,
8424    ) -> std::option::Option<
8425        &std::boxed::Box<crate::model::supported_database_flag::StringRestrictions>,
8426    > {
8427        #[allow(unreachable_patterns)]
8428        self.restrictions.as_ref().and_then(|v| match v {
8429            crate::model::supported_database_flag::Restrictions::StringRestrictions(v) => {
8430                std::option::Option::Some(v)
8431            }
8432            _ => std::option::Option::None,
8433        })
8434    }
8435
8436    /// Sets the value of [restrictions][crate::model::SupportedDatabaseFlag::restrictions]
8437    /// to hold a `StringRestrictions`.
8438    ///
8439    /// Note that all the setters affecting `restrictions` are
8440    /// mutually exclusive.
8441    ///
8442    /// # Example
8443    /// ```ignore,no_run
8444    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8445    /// use google_cloud_alloydb_v1::model::supported_database_flag::StringRestrictions;
8446    /// let x = SupportedDatabaseFlag::new().set_string_restrictions(StringRestrictions::default()/* use setters */);
8447    /// assert!(x.string_restrictions().is_some());
8448    /// assert!(x.integer_restrictions().is_none());
8449    /// ```
8450    pub fn set_string_restrictions<
8451        T: std::convert::Into<
8452                std::boxed::Box<crate::model::supported_database_flag::StringRestrictions>,
8453            >,
8454    >(
8455        mut self,
8456        v: T,
8457    ) -> Self {
8458        self.restrictions = std::option::Option::Some(
8459            crate::model::supported_database_flag::Restrictions::StringRestrictions(v.into()),
8460        );
8461        self
8462    }
8463
8464    /// The value of [restrictions][crate::model::SupportedDatabaseFlag::restrictions]
8465    /// if it holds a `IntegerRestrictions`, `None` if the field is not set or
8466    /// holds a different branch.
8467    pub fn integer_restrictions(
8468        &self,
8469    ) -> std::option::Option<
8470        &std::boxed::Box<crate::model::supported_database_flag::IntegerRestrictions>,
8471    > {
8472        #[allow(unreachable_patterns)]
8473        self.restrictions.as_ref().and_then(|v| match v {
8474            crate::model::supported_database_flag::Restrictions::IntegerRestrictions(v) => {
8475                std::option::Option::Some(v)
8476            }
8477            _ => std::option::Option::None,
8478        })
8479    }
8480
8481    /// Sets the value of [restrictions][crate::model::SupportedDatabaseFlag::restrictions]
8482    /// to hold a `IntegerRestrictions`.
8483    ///
8484    /// Note that all the setters affecting `restrictions` are
8485    /// mutually exclusive.
8486    ///
8487    /// # Example
8488    /// ```ignore,no_run
8489    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8490    /// use google_cloud_alloydb_v1::model::supported_database_flag::IntegerRestrictions;
8491    /// let x = SupportedDatabaseFlag::new().set_integer_restrictions(IntegerRestrictions::default()/* use setters */);
8492    /// assert!(x.integer_restrictions().is_some());
8493    /// assert!(x.string_restrictions().is_none());
8494    /// ```
8495    pub fn set_integer_restrictions<
8496        T: std::convert::Into<
8497                std::boxed::Box<crate::model::supported_database_flag::IntegerRestrictions>,
8498            >,
8499    >(
8500        mut self,
8501        v: T,
8502    ) -> Self {
8503        self.restrictions = std::option::Option::Some(
8504            crate::model::supported_database_flag::Restrictions::IntegerRestrictions(v.into()),
8505        );
8506        self
8507    }
8508
8509    /// Sets the value of [recommended_value][crate::model::SupportedDatabaseFlag::recommended_value].
8510    ///
8511    /// Note that all the setters affecting `recommended_value` are mutually
8512    /// exclusive.
8513    ///
8514    /// # Example
8515    /// ```ignore,no_run
8516    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8517    /// use google_cloud_alloydb_v1::model::supported_database_flag::RecommendedValue;
8518    /// let x = SupportedDatabaseFlag::new().set_recommended_value(Some(RecommendedValue::RecommendedStringValue("example".to_string())));
8519    /// ```
8520    pub fn set_recommended_value<
8521        T: std::convert::Into<
8522                std::option::Option<crate::model::supported_database_flag::RecommendedValue>,
8523            >,
8524    >(
8525        mut self,
8526        v: T,
8527    ) -> Self {
8528        self.recommended_value = v.into();
8529        self
8530    }
8531
8532    /// The value of [recommended_value][crate::model::SupportedDatabaseFlag::recommended_value]
8533    /// if it holds a `RecommendedStringValue`, `None` if the field is not set or
8534    /// holds a different branch.
8535    pub fn recommended_string_value(&self) -> std::option::Option<&std::string::String> {
8536        #[allow(unreachable_patterns)]
8537        self.recommended_value.as_ref().and_then(|v| match v {
8538            crate::model::supported_database_flag::RecommendedValue::RecommendedStringValue(v) => {
8539                std::option::Option::Some(v)
8540            }
8541            _ => std::option::Option::None,
8542        })
8543    }
8544
8545    /// Sets the value of [recommended_value][crate::model::SupportedDatabaseFlag::recommended_value]
8546    /// to hold a `RecommendedStringValue`.
8547    ///
8548    /// Note that all the setters affecting `recommended_value` are
8549    /// mutually exclusive.
8550    ///
8551    /// # Example
8552    /// ```ignore,no_run
8553    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8554    /// let x = SupportedDatabaseFlag::new().set_recommended_string_value("example");
8555    /// assert!(x.recommended_string_value().is_some());
8556    /// assert!(x.recommended_integer_value().is_none());
8557    /// ```
8558    pub fn set_recommended_string_value<T: std::convert::Into<std::string::String>>(
8559        mut self,
8560        v: T,
8561    ) -> Self {
8562        self.recommended_value = std::option::Option::Some(
8563            crate::model::supported_database_flag::RecommendedValue::RecommendedStringValue(
8564                v.into(),
8565            ),
8566        );
8567        self
8568    }
8569
8570    /// The value of [recommended_value][crate::model::SupportedDatabaseFlag::recommended_value]
8571    /// if it holds a `RecommendedIntegerValue`, `None` if the field is not set or
8572    /// holds a different branch.
8573    pub fn recommended_integer_value(
8574        &self,
8575    ) -> std::option::Option<&std::boxed::Box<wkt::Int64Value>> {
8576        #[allow(unreachable_patterns)]
8577        self.recommended_value.as_ref().and_then(|v| match v {
8578            crate::model::supported_database_flag::RecommendedValue::RecommendedIntegerValue(v) => {
8579                std::option::Option::Some(v)
8580            }
8581            _ => std::option::Option::None,
8582        })
8583    }
8584
8585    /// Sets the value of [recommended_value][crate::model::SupportedDatabaseFlag::recommended_value]
8586    /// to hold a `RecommendedIntegerValue`.
8587    ///
8588    /// Note that all the setters affecting `recommended_value` are
8589    /// mutually exclusive.
8590    ///
8591    /// # Example
8592    /// ```ignore,no_run
8593    /// # use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
8594    /// use wkt::Int64Value;
8595    /// let x = SupportedDatabaseFlag::new().set_recommended_integer_value(Int64Value::default()/* use setters */);
8596    /// assert!(x.recommended_integer_value().is_some());
8597    /// assert!(x.recommended_string_value().is_none());
8598    /// ```
8599    pub fn set_recommended_integer_value<
8600        T: std::convert::Into<std::boxed::Box<wkt::Int64Value>>,
8601    >(
8602        mut self,
8603        v: T,
8604    ) -> Self {
8605        self.recommended_value = std::option::Option::Some(
8606            crate::model::supported_database_flag::RecommendedValue::RecommendedIntegerValue(
8607                v.into(),
8608            ),
8609        );
8610        self
8611    }
8612}
8613
8614impl wkt::message::Message for SupportedDatabaseFlag {
8615    fn typename() -> &'static str {
8616        "type.googleapis.com/google.cloud.alloydb.v1.SupportedDatabaseFlag"
8617    }
8618}
8619
8620/// Defines additional types related to [SupportedDatabaseFlag].
8621pub mod supported_database_flag {
8622    #[allow(unused_imports)]
8623    use super::*;
8624
8625    /// Restrictions on STRING type values
8626    #[derive(Clone, Default, PartialEq)]
8627    #[non_exhaustive]
8628    pub struct StringRestrictions {
8629        /// The list of allowed values, if bounded. This field will be empty
8630        /// if there is a unbounded number of allowed values.
8631        pub allowed_values: std::vec::Vec<std::string::String>,
8632
8633        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8634    }
8635
8636    impl StringRestrictions {
8637        pub fn new() -> Self {
8638            std::default::Default::default()
8639        }
8640
8641        /// Sets the value of [allowed_values][crate::model::supported_database_flag::StringRestrictions::allowed_values].
8642        ///
8643        /// # Example
8644        /// ```ignore,no_run
8645        /// # use google_cloud_alloydb_v1::model::supported_database_flag::StringRestrictions;
8646        /// let x = StringRestrictions::new().set_allowed_values(["a", "b", "c"]);
8647        /// ```
8648        pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
8649        where
8650            T: std::iter::IntoIterator<Item = V>,
8651            V: std::convert::Into<std::string::String>,
8652        {
8653            use std::iter::Iterator;
8654            self.allowed_values = v.into_iter().map(|i| i.into()).collect();
8655            self
8656        }
8657    }
8658
8659    impl wkt::message::Message for StringRestrictions {
8660        fn typename() -> &'static str {
8661            "type.googleapis.com/google.cloud.alloydb.v1.SupportedDatabaseFlag.StringRestrictions"
8662        }
8663    }
8664
8665    /// Restrictions on INTEGER type values.
8666    #[derive(Clone, Default, PartialEq)]
8667    #[non_exhaustive]
8668    pub struct IntegerRestrictions {
8669        /// The minimum value that can be specified, if applicable.
8670        pub min_value: std::option::Option<wkt::Int64Value>,
8671
8672        /// The maximum value that can be specified, if applicable.
8673        pub max_value: std::option::Option<wkt::Int64Value>,
8674
8675        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8676    }
8677
8678    impl IntegerRestrictions {
8679        pub fn new() -> Self {
8680            std::default::Default::default()
8681        }
8682
8683        /// Sets the value of [min_value][crate::model::supported_database_flag::IntegerRestrictions::min_value].
8684        ///
8685        /// # Example
8686        /// ```ignore,no_run
8687        /// # use google_cloud_alloydb_v1::model::supported_database_flag::IntegerRestrictions;
8688        /// use wkt::Int64Value;
8689        /// let x = IntegerRestrictions::new().set_min_value(Int64Value::default()/* use setters */);
8690        /// ```
8691        pub fn set_min_value<T>(mut self, v: T) -> Self
8692        where
8693            T: std::convert::Into<wkt::Int64Value>,
8694        {
8695            self.min_value = std::option::Option::Some(v.into());
8696            self
8697        }
8698
8699        /// Sets or clears the value of [min_value][crate::model::supported_database_flag::IntegerRestrictions::min_value].
8700        ///
8701        /// # Example
8702        /// ```ignore,no_run
8703        /// # use google_cloud_alloydb_v1::model::supported_database_flag::IntegerRestrictions;
8704        /// use wkt::Int64Value;
8705        /// let x = IntegerRestrictions::new().set_or_clear_min_value(Some(Int64Value::default()/* use setters */));
8706        /// let x = IntegerRestrictions::new().set_or_clear_min_value(None::<Int64Value>);
8707        /// ```
8708        pub fn set_or_clear_min_value<T>(mut self, v: std::option::Option<T>) -> Self
8709        where
8710            T: std::convert::Into<wkt::Int64Value>,
8711        {
8712            self.min_value = v.map(|x| x.into());
8713            self
8714        }
8715
8716        /// Sets the value of [max_value][crate::model::supported_database_flag::IntegerRestrictions::max_value].
8717        ///
8718        /// # Example
8719        /// ```ignore,no_run
8720        /// # use google_cloud_alloydb_v1::model::supported_database_flag::IntegerRestrictions;
8721        /// use wkt::Int64Value;
8722        /// let x = IntegerRestrictions::new().set_max_value(Int64Value::default()/* use setters */);
8723        /// ```
8724        pub fn set_max_value<T>(mut self, v: T) -> Self
8725        where
8726            T: std::convert::Into<wkt::Int64Value>,
8727        {
8728            self.max_value = std::option::Option::Some(v.into());
8729            self
8730        }
8731
8732        /// Sets or clears the value of [max_value][crate::model::supported_database_flag::IntegerRestrictions::max_value].
8733        ///
8734        /// # Example
8735        /// ```ignore,no_run
8736        /// # use google_cloud_alloydb_v1::model::supported_database_flag::IntegerRestrictions;
8737        /// use wkt::Int64Value;
8738        /// let x = IntegerRestrictions::new().set_or_clear_max_value(Some(Int64Value::default()/* use setters */));
8739        /// let x = IntegerRestrictions::new().set_or_clear_max_value(None::<Int64Value>);
8740        /// ```
8741        pub fn set_or_clear_max_value<T>(mut self, v: std::option::Option<T>) -> Self
8742        where
8743            T: std::convert::Into<wkt::Int64Value>,
8744        {
8745            self.max_value = v.map(|x| x.into());
8746            self
8747        }
8748    }
8749
8750    impl wkt::message::Message for IntegerRestrictions {
8751        fn typename() -> &'static str {
8752            "type.googleapis.com/google.cloud.alloydb.v1.SupportedDatabaseFlag.IntegerRestrictions"
8753        }
8754    }
8755
8756    /// ValueType describes the semantic type of the value that the flag accepts.
8757    /// Regardless of the ValueType, the Instance.database_flags field accepts the
8758    /// stringified version of the value, i.e. "20" or "3.14".
8759    ///
8760    /// # Working with unknown values
8761    ///
8762    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8763    /// additional enum variants at any time. Adding new variants is not considered
8764    /// a breaking change. Applications should write their code in anticipation of:
8765    ///
8766    /// - New values appearing in future releases of the client library, **and**
8767    /// - New values received dynamically, without application changes.
8768    ///
8769    /// Please consult the [Working with enums] section in the user guide for some
8770    /// guidelines.
8771    ///
8772    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8773    #[derive(Clone, Debug, PartialEq)]
8774    #[non_exhaustive]
8775    pub enum ValueType {
8776        /// This is an unknown flag type.
8777        Unspecified,
8778        /// String type flag.
8779        String,
8780        /// Integer type flag.
8781        Integer,
8782        /// Float type flag.
8783        Float,
8784        /// Denotes that the flag does not accept any values.
8785        None,
8786        /// If set, the enum was initialized with an unknown value.
8787        ///
8788        /// Applications can examine the value using [ValueType::value] or
8789        /// [ValueType::name].
8790        UnknownValue(value_type::UnknownValue),
8791    }
8792
8793    #[doc(hidden)]
8794    pub mod value_type {
8795        #[allow(unused_imports)]
8796        use super::*;
8797        #[derive(Clone, Debug, PartialEq)]
8798        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8799    }
8800
8801    impl ValueType {
8802        /// Gets the enum value.
8803        ///
8804        /// Returns `None` if the enum contains an unknown value deserialized from
8805        /// the string representation of enums.
8806        pub fn value(&self) -> std::option::Option<i32> {
8807            match self {
8808                Self::Unspecified => std::option::Option::Some(0),
8809                Self::String => std::option::Option::Some(1),
8810                Self::Integer => std::option::Option::Some(2),
8811                Self::Float => std::option::Option::Some(3),
8812                Self::None => std::option::Option::Some(4),
8813                Self::UnknownValue(u) => u.0.value(),
8814            }
8815        }
8816
8817        /// Gets the enum value as a string.
8818        ///
8819        /// Returns `None` if the enum contains an unknown value deserialized from
8820        /// the integer representation of enums.
8821        pub fn name(&self) -> std::option::Option<&str> {
8822            match self {
8823                Self::Unspecified => std::option::Option::Some("VALUE_TYPE_UNSPECIFIED"),
8824                Self::String => std::option::Option::Some("STRING"),
8825                Self::Integer => std::option::Option::Some("INTEGER"),
8826                Self::Float => std::option::Option::Some("FLOAT"),
8827                Self::None => std::option::Option::Some("NONE"),
8828                Self::UnknownValue(u) => u.0.name(),
8829            }
8830        }
8831    }
8832
8833    impl std::default::Default for ValueType {
8834        fn default() -> Self {
8835            use std::convert::From;
8836            Self::from(0)
8837        }
8838    }
8839
8840    impl std::fmt::Display for ValueType {
8841        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8842            wkt::internal::display_enum(f, self.name(), self.value())
8843        }
8844    }
8845
8846    impl std::convert::From<i32> for ValueType {
8847        fn from(value: i32) -> Self {
8848            match value {
8849                0 => Self::Unspecified,
8850                1 => Self::String,
8851                2 => Self::Integer,
8852                3 => Self::Float,
8853                4 => Self::None,
8854                _ => Self::UnknownValue(value_type::UnknownValue(
8855                    wkt::internal::UnknownEnumValue::Integer(value),
8856                )),
8857            }
8858        }
8859    }
8860
8861    impl std::convert::From<&str> for ValueType {
8862        fn from(value: &str) -> Self {
8863            use std::string::ToString;
8864            match value {
8865                "VALUE_TYPE_UNSPECIFIED" => Self::Unspecified,
8866                "STRING" => Self::String,
8867                "INTEGER" => Self::Integer,
8868                "FLOAT" => Self::Float,
8869                "NONE" => Self::None,
8870                _ => Self::UnknownValue(value_type::UnknownValue(
8871                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8872                )),
8873            }
8874        }
8875    }
8876
8877    impl serde::ser::Serialize for ValueType {
8878        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8879        where
8880            S: serde::Serializer,
8881        {
8882            match self {
8883                Self::Unspecified => serializer.serialize_i32(0),
8884                Self::String => serializer.serialize_i32(1),
8885                Self::Integer => serializer.serialize_i32(2),
8886                Self::Float => serializer.serialize_i32(3),
8887                Self::None => serializer.serialize_i32(4),
8888                Self::UnknownValue(u) => u.0.serialize(serializer),
8889            }
8890        }
8891    }
8892
8893    impl<'de> serde::de::Deserialize<'de> for ValueType {
8894        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8895        where
8896            D: serde::Deserializer<'de>,
8897        {
8898            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValueType>::new(
8899                ".google.cloud.alloydb.v1.SupportedDatabaseFlag.ValueType",
8900            ))
8901        }
8902    }
8903
8904    /// The scope of the flag.
8905    ///
8906    /// # Working with unknown values
8907    ///
8908    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8909    /// additional enum variants at any time. Adding new variants is not considered
8910    /// a breaking change. Applications should write their code in anticipation of:
8911    ///
8912    /// - New values appearing in future releases of the client library, **and**
8913    /// - New values received dynamically, without application changes.
8914    ///
8915    /// Please consult the [Working with enums] section in the user guide for some
8916    /// guidelines.
8917    ///
8918    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8919    #[derive(Clone, Debug, PartialEq)]
8920    #[non_exhaustive]
8921    pub enum Scope {
8922        /// The scope of the flag is not specified. Default is DATABASE.
8923        Unspecified,
8924        /// The flag is a database flag.
8925        Database,
8926        /// The flag is a connection pool flag.
8927        ConnectionPool,
8928        /// If set, the enum was initialized with an unknown value.
8929        ///
8930        /// Applications can examine the value using [Scope::value] or
8931        /// [Scope::name].
8932        UnknownValue(scope::UnknownValue),
8933    }
8934
8935    #[doc(hidden)]
8936    pub mod scope {
8937        #[allow(unused_imports)]
8938        use super::*;
8939        #[derive(Clone, Debug, PartialEq)]
8940        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8941    }
8942
8943    impl Scope {
8944        /// Gets the enum value.
8945        ///
8946        /// Returns `None` if the enum contains an unknown value deserialized from
8947        /// the string representation of enums.
8948        pub fn value(&self) -> std::option::Option<i32> {
8949            match self {
8950                Self::Unspecified => std::option::Option::Some(0),
8951                Self::Database => std::option::Option::Some(1),
8952                Self::ConnectionPool => std::option::Option::Some(2),
8953                Self::UnknownValue(u) => u.0.value(),
8954            }
8955        }
8956
8957        /// Gets the enum value as a string.
8958        ///
8959        /// Returns `None` if the enum contains an unknown value deserialized from
8960        /// the integer representation of enums.
8961        pub fn name(&self) -> std::option::Option<&str> {
8962            match self {
8963                Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
8964                Self::Database => std::option::Option::Some("DATABASE"),
8965                Self::ConnectionPool => std::option::Option::Some("CONNECTION_POOL"),
8966                Self::UnknownValue(u) => u.0.name(),
8967            }
8968        }
8969    }
8970
8971    impl std::default::Default for Scope {
8972        fn default() -> Self {
8973            use std::convert::From;
8974            Self::from(0)
8975        }
8976    }
8977
8978    impl std::fmt::Display for Scope {
8979        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8980            wkt::internal::display_enum(f, self.name(), self.value())
8981        }
8982    }
8983
8984    impl std::convert::From<i32> for Scope {
8985        fn from(value: i32) -> Self {
8986            match value {
8987                0 => Self::Unspecified,
8988                1 => Self::Database,
8989                2 => Self::ConnectionPool,
8990                _ => Self::UnknownValue(scope::UnknownValue(
8991                    wkt::internal::UnknownEnumValue::Integer(value),
8992                )),
8993            }
8994        }
8995    }
8996
8997    impl std::convert::From<&str> for Scope {
8998        fn from(value: &str) -> Self {
8999            use std::string::ToString;
9000            match value {
9001                "SCOPE_UNSPECIFIED" => Self::Unspecified,
9002                "DATABASE" => Self::Database,
9003                "CONNECTION_POOL" => Self::ConnectionPool,
9004                _ => Self::UnknownValue(scope::UnknownValue(
9005                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9006                )),
9007            }
9008        }
9009    }
9010
9011    impl serde::ser::Serialize for Scope {
9012        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9013        where
9014            S: serde::Serializer,
9015        {
9016            match self {
9017                Self::Unspecified => serializer.serialize_i32(0),
9018                Self::Database => serializer.serialize_i32(1),
9019                Self::ConnectionPool => serializer.serialize_i32(2),
9020                Self::UnknownValue(u) => u.0.serialize(serializer),
9021            }
9022        }
9023    }
9024
9025    impl<'de> serde::de::Deserialize<'de> for Scope {
9026        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9027        where
9028            D: serde::Deserializer<'de>,
9029        {
9030            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
9031                ".google.cloud.alloydb.v1.SupportedDatabaseFlag.Scope",
9032            ))
9033        }
9034    }
9035
9036    /// The restrictions on the flag value per type.
9037    #[derive(Clone, Debug, PartialEq)]
9038    #[non_exhaustive]
9039    pub enum Restrictions {
9040        /// Restriction on STRING type value.
9041        StringRestrictions(
9042            std::boxed::Box<crate::model::supported_database_flag::StringRestrictions>,
9043        ),
9044        /// Restriction on INTEGER type value.
9045        IntegerRestrictions(
9046            std::boxed::Box<crate::model::supported_database_flag::IntegerRestrictions>,
9047        ),
9048    }
9049
9050    /// The recommended value for the flag by type, if applicable.
9051    #[derive(Clone, Debug, PartialEq)]
9052    #[non_exhaustive]
9053    pub enum RecommendedValue {
9054        /// The recommended value for a STRING flag.
9055        RecommendedStringValue(std::string::String),
9056        /// The recommended value for an INTEGER flag.
9057        RecommendedIntegerValue(std::boxed::Box<wkt::Int64Value>),
9058    }
9059}
9060
9061/// Message describing User object.
9062#[derive(Clone, Default, PartialEq)]
9063#[non_exhaustive]
9064pub struct User {
9065    /// Output only. Name of the resource in the form of
9066    /// projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
9067    pub name: std::string::String,
9068
9069    /// Input only. Password for the user.
9070    pub password: std::string::String,
9071
9072    /// Optional. List of database roles this user has.
9073    /// The database role strings are subject to the PostgreSQL naming conventions.
9074    pub database_roles: std::vec::Vec<std::string::String>,
9075
9076    /// Optional. Type of this user.
9077    pub user_type: crate::model::user::UserType,
9078
9079    /// Input only. If the user already exists and it has additional roles, keep
9080    /// them granted.
9081    pub keep_extra_roles: bool,
9082
9083    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9084}
9085
9086impl User {
9087    pub fn new() -> Self {
9088        std::default::Default::default()
9089    }
9090
9091    /// Sets the value of [name][crate::model::User::name].
9092    ///
9093    /// # Example
9094    /// ```ignore,no_run
9095    /// # use google_cloud_alloydb_v1::model::User;
9096    /// let x = User::new().set_name("example");
9097    /// ```
9098    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9099        self.name = v.into();
9100        self
9101    }
9102
9103    /// Sets the value of [password][crate::model::User::password].
9104    ///
9105    /// # Example
9106    /// ```ignore,no_run
9107    /// # use google_cloud_alloydb_v1::model::User;
9108    /// let x = User::new().set_password("example");
9109    /// ```
9110    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9111        self.password = v.into();
9112        self
9113    }
9114
9115    /// Sets the value of [database_roles][crate::model::User::database_roles].
9116    ///
9117    /// # Example
9118    /// ```ignore,no_run
9119    /// # use google_cloud_alloydb_v1::model::User;
9120    /// let x = User::new().set_database_roles(["a", "b", "c"]);
9121    /// ```
9122    pub fn set_database_roles<T, V>(mut self, v: T) -> Self
9123    where
9124        T: std::iter::IntoIterator<Item = V>,
9125        V: std::convert::Into<std::string::String>,
9126    {
9127        use std::iter::Iterator;
9128        self.database_roles = v.into_iter().map(|i| i.into()).collect();
9129        self
9130    }
9131
9132    /// Sets the value of [user_type][crate::model::User::user_type].
9133    ///
9134    /// # Example
9135    /// ```ignore,no_run
9136    /// # use google_cloud_alloydb_v1::model::User;
9137    /// use google_cloud_alloydb_v1::model::user::UserType;
9138    /// let x0 = User::new().set_user_type(UserType::AlloydbBuiltIn);
9139    /// let x1 = User::new().set_user_type(UserType::AlloydbIamUser);
9140    /// ```
9141    pub fn set_user_type<T: std::convert::Into<crate::model::user::UserType>>(
9142        mut self,
9143        v: T,
9144    ) -> Self {
9145        self.user_type = v.into();
9146        self
9147    }
9148
9149    /// Sets the value of [keep_extra_roles][crate::model::User::keep_extra_roles].
9150    ///
9151    /// # Example
9152    /// ```ignore,no_run
9153    /// # use google_cloud_alloydb_v1::model::User;
9154    /// let x = User::new().set_keep_extra_roles(true);
9155    /// ```
9156    pub fn set_keep_extra_roles<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9157        self.keep_extra_roles = v.into();
9158        self
9159    }
9160}
9161
9162impl wkt::message::Message for User {
9163    fn typename() -> &'static str {
9164        "type.googleapis.com/google.cloud.alloydb.v1.User"
9165    }
9166}
9167
9168/// Defines additional types related to [User].
9169pub mod user {
9170    #[allow(unused_imports)]
9171    use super::*;
9172
9173    /// Enum that details the user type.
9174    ///
9175    /// # Working with unknown values
9176    ///
9177    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9178    /// additional enum variants at any time. Adding new variants is not considered
9179    /// a breaking change. Applications should write their code in anticipation of:
9180    ///
9181    /// - New values appearing in future releases of the client library, **and**
9182    /// - New values received dynamically, without application changes.
9183    ///
9184    /// Please consult the [Working with enums] section in the user guide for some
9185    /// guidelines.
9186    ///
9187    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9188    #[derive(Clone, Debug, PartialEq)]
9189    #[non_exhaustive]
9190    pub enum UserType {
9191        /// Unspecified user type.
9192        Unspecified,
9193        /// The default user type that authenticates via password-based
9194        /// authentication.
9195        AlloydbBuiltIn,
9196        /// Database user that can authenticate via IAM-Based authentication.
9197        AlloydbIamUser,
9198        /// If set, the enum was initialized with an unknown value.
9199        ///
9200        /// Applications can examine the value using [UserType::value] or
9201        /// [UserType::name].
9202        UnknownValue(user_type::UnknownValue),
9203    }
9204
9205    #[doc(hidden)]
9206    pub mod user_type {
9207        #[allow(unused_imports)]
9208        use super::*;
9209        #[derive(Clone, Debug, PartialEq)]
9210        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9211    }
9212
9213    impl UserType {
9214        /// Gets the enum value.
9215        ///
9216        /// Returns `None` if the enum contains an unknown value deserialized from
9217        /// the string representation of enums.
9218        pub fn value(&self) -> std::option::Option<i32> {
9219            match self {
9220                Self::Unspecified => std::option::Option::Some(0),
9221                Self::AlloydbBuiltIn => std::option::Option::Some(1),
9222                Self::AlloydbIamUser => std::option::Option::Some(2),
9223                Self::UnknownValue(u) => u.0.value(),
9224            }
9225        }
9226
9227        /// Gets the enum value as a string.
9228        ///
9229        /// Returns `None` if the enum contains an unknown value deserialized from
9230        /// the integer representation of enums.
9231        pub fn name(&self) -> std::option::Option<&str> {
9232            match self {
9233                Self::Unspecified => std::option::Option::Some("USER_TYPE_UNSPECIFIED"),
9234                Self::AlloydbBuiltIn => std::option::Option::Some("ALLOYDB_BUILT_IN"),
9235                Self::AlloydbIamUser => std::option::Option::Some("ALLOYDB_IAM_USER"),
9236                Self::UnknownValue(u) => u.0.name(),
9237            }
9238        }
9239    }
9240
9241    impl std::default::Default for UserType {
9242        fn default() -> Self {
9243            use std::convert::From;
9244            Self::from(0)
9245        }
9246    }
9247
9248    impl std::fmt::Display for UserType {
9249        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9250            wkt::internal::display_enum(f, self.name(), self.value())
9251        }
9252    }
9253
9254    impl std::convert::From<i32> for UserType {
9255        fn from(value: i32) -> Self {
9256            match value {
9257                0 => Self::Unspecified,
9258                1 => Self::AlloydbBuiltIn,
9259                2 => Self::AlloydbIamUser,
9260                _ => Self::UnknownValue(user_type::UnknownValue(
9261                    wkt::internal::UnknownEnumValue::Integer(value),
9262                )),
9263            }
9264        }
9265    }
9266
9267    impl std::convert::From<&str> for UserType {
9268        fn from(value: &str) -> Self {
9269            use std::string::ToString;
9270            match value {
9271                "USER_TYPE_UNSPECIFIED" => Self::Unspecified,
9272                "ALLOYDB_BUILT_IN" => Self::AlloydbBuiltIn,
9273                "ALLOYDB_IAM_USER" => Self::AlloydbIamUser,
9274                _ => Self::UnknownValue(user_type::UnknownValue(
9275                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9276                )),
9277            }
9278        }
9279    }
9280
9281    impl serde::ser::Serialize for UserType {
9282        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9283        where
9284            S: serde::Serializer,
9285        {
9286            match self {
9287                Self::Unspecified => serializer.serialize_i32(0),
9288                Self::AlloydbBuiltIn => serializer.serialize_i32(1),
9289                Self::AlloydbIamUser => serializer.serialize_i32(2),
9290                Self::UnknownValue(u) => u.0.serialize(serializer),
9291            }
9292        }
9293    }
9294
9295    impl<'de> serde::de::Deserialize<'de> for UserType {
9296        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9297        where
9298            D: serde::Deserializer<'de>,
9299        {
9300            deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserType>::new(
9301                ".google.cloud.alloydb.v1.User.UserType",
9302            ))
9303        }
9304    }
9305}
9306
9307/// Message describing Database object.
9308#[derive(Clone, Default, PartialEq)]
9309#[non_exhaustive]
9310pub struct Database {
9311    /// Identifier. Name of the resource in the form of
9312    /// `projects/{project}/locations/{location}/clusters/{cluster}/databases/{database}`.
9313    pub name: std::string::String,
9314
9315    /// Optional. Immutable. Charset for the database.
9316    /// This field can contain any PostgreSQL supported charset name.
9317    /// Example values include "UTF8", "SQL_ASCII", etc.
9318    pub charset: std::string::String,
9319
9320    /// Optional. Immutable. lc_collate for the database.
9321    /// String sort order.
9322    /// Example values include "C", "POSIX", etc.
9323    pub collation: std::string::String,
9324
9325    /// Optional. Immutable. lc_ctype for the database.
9326    /// Character classification (What is a letter? The upper-case equivalent?).
9327    /// Example values include "C", "POSIX", etc.
9328    pub character_type: std::string::String,
9329
9330    /// Input only. Immutable. Template of the database to be used for creating a
9331    /// new database.
9332    pub database_template: std::string::String,
9333
9334    /// Optional. Whether the database is a template database.
9335    pub is_template_database: std::option::Option<bool>,
9336
9337    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9338}
9339
9340impl Database {
9341    pub fn new() -> Self {
9342        std::default::Default::default()
9343    }
9344
9345    /// Sets the value of [name][crate::model::Database::name].
9346    ///
9347    /// # Example
9348    /// ```ignore,no_run
9349    /// # use google_cloud_alloydb_v1::model::Database;
9350    /// let x = Database::new().set_name("example");
9351    /// ```
9352    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9353        self.name = v.into();
9354        self
9355    }
9356
9357    /// Sets the value of [charset][crate::model::Database::charset].
9358    ///
9359    /// # Example
9360    /// ```ignore,no_run
9361    /// # use google_cloud_alloydb_v1::model::Database;
9362    /// let x = Database::new().set_charset("example");
9363    /// ```
9364    pub fn set_charset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9365        self.charset = v.into();
9366        self
9367    }
9368
9369    /// Sets the value of [collation][crate::model::Database::collation].
9370    ///
9371    /// # Example
9372    /// ```ignore,no_run
9373    /// # use google_cloud_alloydb_v1::model::Database;
9374    /// let x = Database::new().set_collation("example");
9375    /// ```
9376    pub fn set_collation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9377        self.collation = v.into();
9378        self
9379    }
9380
9381    /// Sets the value of [character_type][crate::model::Database::character_type].
9382    ///
9383    /// # Example
9384    /// ```ignore,no_run
9385    /// # use google_cloud_alloydb_v1::model::Database;
9386    /// let x = Database::new().set_character_type("example");
9387    /// ```
9388    pub fn set_character_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9389        self.character_type = v.into();
9390        self
9391    }
9392
9393    /// Sets the value of [database_template][crate::model::Database::database_template].
9394    ///
9395    /// # Example
9396    /// ```ignore,no_run
9397    /// # use google_cloud_alloydb_v1::model::Database;
9398    /// let x = Database::new().set_database_template("example");
9399    /// ```
9400    pub fn set_database_template<T: std::convert::Into<std::string::String>>(
9401        mut self,
9402        v: T,
9403    ) -> Self {
9404        self.database_template = v.into();
9405        self
9406    }
9407
9408    /// Sets the value of [is_template_database][crate::model::Database::is_template_database].
9409    ///
9410    /// # Example
9411    /// ```ignore,no_run
9412    /// # use google_cloud_alloydb_v1::model::Database;
9413    /// let x = Database::new().set_is_template_database(true);
9414    /// ```
9415    pub fn set_is_template_database<T>(mut self, v: T) -> Self
9416    where
9417        T: std::convert::Into<bool>,
9418    {
9419        self.is_template_database = std::option::Option::Some(v.into());
9420        self
9421    }
9422
9423    /// Sets or clears the value of [is_template_database][crate::model::Database::is_template_database].
9424    ///
9425    /// # Example
9426    /// ```ignore,no_run
9427    /// # use google_cloud_alloydb_v1::model::Database;
9428    /// let x = Database::new().set_or_clear_is_template_database(Some(false));
9429    /// let x = Database::new().set_or_clear_is_template_database(None::<bool>);
9430    /// ```
9431    pub fn set_or_clear_is_template_database<T>(mut self, v: std::option::Option<T>) -> Self
9432    where
9433        T: std::convert::Into<bool>,
9434    {
9435        self.is_template_database = v.map(|x| x.into());
9436        self
9437    }
9438}
9439
9440impl wkt::message::Message for Database {
9441    fn typename() -> &'static str {
9442        "type.googleapis.com/google.cloud.alloydb.v1.Database"
9443    }
9444}
9445
9446/// Message for requesting list of Clusters
9447#[derive(Clone, Default, PartialEq)]
9448#[non_exhaustive]
9449pub struct ListClustersRequest {
9450    /// Required. The name of the parent resource. For the required format, see the
9451    /// comment on the Cluster.name field. Additionally, you can perform an
9452    /// aggregated list operation by specifying a value with the following format:
9453    ///
9454    /// * projects/{project}/locations/-
9455    pub parent: std::string::String,
9456
9457    /// Optional. Requested page size. Server may return fewer items than
9458    /// requested. If unspecified, server will pick an appropriate default.
9459    pub page_size: i32,
9460
9461    /// A token identifying a page of results the server should return.
9462    pub page_token: std::string::String,
9463
9464    /// Optional. Filtering results
9465    pub filter: std::string::String,
9466
9467    /// Optional. Hint for how to order the results
9468    pub order_by: std::string::String,
9469
9470    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9471}
9472
9473impl ListClustersRequest {
9474    pub fn new() -> Self {
9475        std::default::Default::default()
9476    }
9477
9478    /// Sets the value of [parent][crate::model::ListClustersRequest::parent].
9479    ///
9480    /// # Example
9481    /// ```ignore,no_run
9482    /// # use google_cloud_alloydb_v1::model::ListClustersRequest;
9483    /// let x = ListClustersRequest::new().set_parent("example");
9484    /// ```
9485    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9486        self.parent = v.into();
9487        self
9488    }
9489
9490    /// Sets the value of [page_size][crate::model::ListClustersRequest::page_size].
9491    ///
9492    /// # Example
9493    /// ```ignore,no_run
9494    /// # use google_cloud_alloydb_v1::model::ListClustersRequest;
9495    /// let x = ListClustersRequest::new().set_page_size(42);
9496    /// ```
9497    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9498        self.page_size = v.into();
9499        self
9500    }
9501
9502    /// Sets the value of [page_token][crate::model::ListClustersRequest::page_token].
9503    ///
9504    /// # Example
9505    /// ```ignore,no_run
9506    /// # use google_cloud_alloydb_v1::model::ListClustersRequest;
9507    /// let x = ListClustersRequest::new().set_page_token("example");
9508    /// ```
9509    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9510        self.page_token = v.into();
9511        self
9512    }
9513
9514    /// Sets the value of [filter][crate::model::ListClustersRequest::filter].
9515    ///
9516    /// # Example
9517    /// ```ignore,no_run
9518    /// # use google_cloud_alloydb_v1::model::ListClustersRequest;
9519    /// let x = ListClustersRequest::new().set_filter("example");
9520    /// ```
9521    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9522        self.filter = v.into();
9523        self
9524    }
9525
9526    /// Sets the value of [order_by][crate::model::ListClustersRequest::order_by].
9527    ///
9528    /// # Example
9529    /// ```ignore,no_run
9530    /// # use google_cloud_alloydb_v1::model::ListClustersRequest;
9531    /// let x = ListClustersRequest::new().set_order_by("example");
9532    /// ```
9533    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9534        self.order_by = v.into();
9535        self
9536    }
9537}
9538
9539impl wkt::message::Message for ListClustersRequest {
9540    fn typename() -> &'static str {
9541        "type.googleapis.com/google.cloud.alloydb.v1.ListClustersRequest"
9542    }
9543}
9544
9545/// Message for response to listing Clusters
9546#[derive(Clone, Default, PartialEq)]
9547#[non_exhaustive]
9548pub struct ListClustersResponse {
9549    /// The list of Cluster
9550    pub clusters: std::vec::Vec<crate::model::Cluster>,
9551
9552    /// A token identifying a page of results the server should return.
9553    pub next_page_token: std::string::String,
9554
9555    /// Locations that could not be reached.
9556    pub unreachable: std::vec::Vec<std::string::String>,
9557
9558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9559}
9560
9561impl ListClustersResponse {
9562    pub fn new() -> Self {
9563        std::default::Default::default()
9564    }
9565
9566    /// Sets the value of [clusters][crate::model::ListClustersResponse::clusters].
9567    ///
9568    /// # Example
9569    /// ```ignore,no_run
9570    /// # use google_cloud_alloydb_v1::model::ListClustersResponse;
9571    /// use google_cloud_alloydb_v1::model::Cluster;
9572    /// let x = ListClustersResponse::new()
9573    ///     .set_clusters([
9574    ///         Cluster::default()/* use setters */,
9575    ///         Cluster::default()/* use (different) setters */,
9576    ///     ]);
9577    /// ```
9578    pub fn set_clusters<T, V>(mut self, v: T) -> Self
9579    where
9580        T: std::iter::IntoIterator<Item = V>,
9581        V: std::convert::Into<crate::model::Cluster>,
9582    {
9583        use std::iter::Iterator;
9584        self.clusters = v.into_iter().map(|i| i.into()).collect();
9585        self
9586    }
9587
9588    /// Sets the value of [next_page_token][crate::model::ListClustersResponse::next_page_token].
9589    ///
9590    /// # Example
9591    /// ```ignore,no_run
9592    /// # use google_cloud_alloydb_v1::model::ListClustersResponse;
9593    /// let x = ListClustersResponse::new().set_next_page_token("example");
9594    /// ```
9595    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9596        self.next_page_token = v.into();
9597        self
9598    }
9599
9600    /// Sets the value of [unreachable][crate::model::ListClustersResponse::unreachable].
9601    ///
9602    /// # Example
9603    /// ```ignore,no_run
9604    /// # use google_cloud_alloydb_v1::model::ListClustersResponse;
9605    /// let x = ListClustersResponse::new().set_unreachable(["a", "b", "c"]);
9606    /// ```
9607    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
9608    where
9609        T: std::iter::IntoIterator<Item = V>,
9610        V: std::convert::Into<std::string::String>,
9611    {
9612        use std::iter::Iterator;
9613        self.unreachable = v.into_iter().map(|i| i.into()).collect();
9614        self
9615    }
9616}
9617
9618impl wkt::message::Message for ListClustersResponse {
9619    fn typename() -> &'static str {
9620        "type.googleapis.com/google.cloud.alloydb.v1.ListClustersResponse"
9621    }
9622}
9623
9624#[doc(hidden)]
9625impl google_cloud_gax::paginator::internal::PageableResponse for ListClustersResponse {
9626    type PageItem = crate::model::Cluster;
9627
9628    fn items(self) -> std::vec::Vec<Self::PageItem> {
9629        self.clusters
9630    }
9631
9632    fn next_page_token(&self) -> std::string::String {
9633        use std::clone::Clone;
9634        self.next_page_token.clone()
9635    }
9636}
9637
9638/// Message for getting a Cluster
9639#[derive(Clone, Default, PartialEq)]
9640#[non_exhaustive]
9641pub struct GetClusterRequest {
9642    /// Required. The name of the resource. For the required format, see the
9643    /// comment on the Cluster.name field.
9644    pub name: std::string::String,
9645
9646    /// Optional. The view of the cluster to return. Returns all default fields if
9647    /// not set.
9648    pub view: crate::model::ClusterView,
9649
9650    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9651}
9652
9653impl GetClusterRequest {
9654    pub fn new() -> Self {
9655        std::default::Default::default()
9656    }
9657
9658    /// Sets the value of [name][crate::model::GetClusterRequest::name].
9659    ///
9660    /// # Example
9661    /// ```ignore,no_run
9662    /// # use google_cloud_alloydb_v1::model::GetClusterRequest;
9663    /// let x = GetClusterRequest::new().set_name("example");
9664    /// ```
9665    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9666        self.name = v.into();
9667        self
9668    }
9669
9670    /// Sets the value of [view][crate::model::GetClusterRequest::view].
9671    ///
9672    /// # Example
9673    /// ```ignore,no_run
9674    /// # use google_cloud_alloydb_v1::model::GetClusterRequest;
9675    /// use google_cloud_alloydb_v1::model::ClusterView;
9676    /// let x0 = GetClusterRequest::new().set_view(ClusterView::Basic);
9677    /// let x1 = GetClusterRequest::new().set_view(ClusterView::ContinuousBackup);
9678    /// ```
9679    pub fn set_view<T: std::convert::Into<crate::model::ClusterView>>(mut self, v: T) -> Self {
9680        self.view = v.into();
9681        self
9682    }
9683}
9684
9685impl wkt::message::Message for GetClusterRequest {
9686    fn typename() -> &'static str {
9687        "type.googleapis.com/google.cloud.alloydb.v1.GetClusterRequest"
9688    }
9689}
9690
9691#[derive(Clone, Default, PartialEq)]
9692#[non_exhaustive]
9693pub struct CreateSecondaryClusterRequest {
9694    /// Required. The location of the new cluster. For the required
9695    /// format, see the comment on the Cluster.name field.
9696    pub parent: std::string::String,
9697
9698    /// Required. ID of the requesting object (the secondary cluster).
9699    pub cluster_id: std::string::String,
9700
9701    /// Required. Configuration of the requesting object (the secondary cluster).
9702    pub cluster: std::option::Option<crate::model::Cluster>,
9703
9704    /// Optional. An optional request ID to identify requests. Specify a unique
9705    /// request ID so that if you must retry your request, the server ignores the
9706    /// request if it has already been completed. The server guarantees that for at
9707    /// least 60 minutes since the first request.
9708    ///
9709    /// For example, consider a situation where you make an initial request and
9710    /// the request times out. If you make the request again with the same request
9711    /// ID, the server can check if the original operation with the same request ID
9712    /// was received, and if so, ignores the second request. This prevents
9713    /// clients from accidentally creating duplicate commitments.
9714    ///
9715    /// The request ID must be a valid UUID with the exception that zero UUID is
9716    /// not supported (00000000-0000-0000-0000-000000000000).
9717    pub request_id: std::string::String,
9718
9719    /// Optional. If set, performs request validation, for example, permission
9720    /// checks and any other type of validation, but does not actually execute the
9721    /// create request.
9722    pub validate_only: bool,
9723
9724    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9725}
9726
9727impl CreateSecondaryClusterRequest {
9728    pub fn new() -> Self {
9729        std::default::Default::default()
9730    }
9731
9732    /// Sets the value of [parent][crate::model::CreateSecondaryClusterRequest::parent].
9733    ///
9734    /// # Example
9735    /// ```ignore,no_run
9736    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9737    /// let x = CreateSecondaryClusterRequest::new().set_parent("example");
9738    /// ```
9739    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9740        self.parent = v.into();
9741        self
9742    }
9743
9744    /// Sets the value of [cluster_id][crate::model::CreateSecondaryClusterRequest::cluster_id].
9745    ///
9746    /// # Example
9747    /// ```ignore,no_run
9748    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9749    /// let x = CreateSecondaryClusterRequest::new().set_cluster_id("example");
9750    /// ```
9751    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9752        self.cluster_id = v.into();
9753        self
9754    }
9755
9756    /// Sets the value of [cluster][crate::model::CreateSecondaryClusterRequest::cluster].
9757    ///
9758    /// # Example
9759    /// ```ignore,no_run
9760    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9761    /// use google_cloud_alloydb_v1::model::Cluster;
9762    /// let x = CreateSecondaryClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9763    /// ```
9764    pub fn set_cluster<T>(mut self, v: T) -> Self
9765    where
9766        T: std::convert::Into<crate::model::Cluster>,
9767    {
9768        self.cluster = std::option::Option::Some(v.into());
9769        self
9770    }
9771
9772    /// Sets or clears the value of [cluster][crate::model::CreateSecondaryClusterRequest::cluster].
9773    ///
9774    /// # Example
9775    /// ```ignore,no_run
9776    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9777    /// use google_cloud_alloydb_v1::model::Cluster;
9778    /// let x = CreateSecondaryClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9779    /// let x = CreateSecondaryClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9780    /// ```
9781    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9782    where
9783        T: std::convert::Into<crate::model::Cluster>,
9784    {
9785        self.cluster = v.map(|x| x.into());
9786        self
9787    }
9788
9789    /// Sets the value of [request_id][crate::model::CreateSecondaryClusterRequest::request_id].
9790    ///
9791    /// # Example
9792    /// ```ignore,no_run
9793    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9794    /// let x = CreateSecondaryClusterRequest::new().set_request_id("example");
9795    /// ```
9796    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9797        self.request_id = v.into();
9798        self
9799    }
9800
9801    /// Sets the value of [validate_only][crate::model::CreateSecondaryClusterRequest::validate_only].
9802    ///
9803    /// # Example
9804    /// ```ignore,no_run
9805    /// # use google_cloud_alloydb_v1::model::CreateSecondaryClusterRequest;
9806    /// let x = CreateSecondaryClusterRequest::new().set_validate_only(true);
9807    /// ```
9808    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9809        self.validate_only = v.into();
9810        self
9811    }
9812}
9813
9814impl wkt::message::Message for CreateSecondaryClusterRequest {
9815    fn typename() -> &'static str {
9816        "type.googleapis.com/google.cloud.alloydb.v1.CreateSecondaryClusterRequest"
9817    }
9818}
9819
9820/// Message for creating a Cluster
9821#[derive(Clone, Default, PartialEq)]
9822#[non_exhaustive]
9823pub struct CreateClusterRequest {
9824    /// Required. The location of the new cluster. For the required format, see the
9825    /// comment on the Cluster.name field.
9826    pub parent: std::string::String,
9827
9828    /// Required. ID of the requesting object.
9829    pub cluster_id: std::string::String,
9830
9831    /// Required. The resource being created
9832    pub cluster: std::option::Option<crate::model::Cluster>,
9833
9834    /// Optional. An optional request ID to identify requests. Specify a unique
9835    /// request ID so that if you must retry your request, the server ignores the
9836    /// request if it has already been completed. The server guarantees that for at
9837    /// least 60 minutes since the first request.
9838    ///
9839    /// For example, consider a situation where you make an initial request and
9840    /// the request times out. If you make the request again with the same request
9841    /// ID, the server can check if the original operation with the same request ID
9842    /// was received, and if so, ignores the second request. This prevents
9843    /// clients from accidentally creating duplicate commitments.
9844    ///
9845    /// The request ID must be a valid UUID with the exception that zero UUID is
9846    /// not supported (00000000-0000-0000-0000-000000000000).
9847    pub request_id: std::string::String,
9848
9849    /// Optional. If set, performs request validation, for example, permission
9850    /// checks and any other type of validation, but does not actually execute the
9851    /// create request.
9852    pub validate_only: bool,
9853
9854    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9855}
9856
9857impl CreateClusterRequest {
9858    pub fn new() -> Self {
9859        std::default::Default::default()
9860    }
9861
9862    /// Sets the value of [parent][crate::model::CreateClusterRequest::parent].
9863    ///
9864    /// # Example
9865    /// ```ignore,no_run
9866    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9867    /// let x = CreateClusterRequest::new().set_parent("example");
9868    /// ```
9869    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9870        self.parent = v.into();
9871        self
9872    }
9873
9874    /// Sets the value of [cluster_id][crate::model::CreateClusterRequest::cluster_id].
9875    ///
9876    /// # Example
9877    /// ```ignore,no_run
9878    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9879    /// let x = CreateClusterRequest::new().set_cluster_id("example");
9880    /// ```
9881    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9882        self.cluster_id = v.into();
9883        self
9884    }
9885
9886    /// Sets the value of [cluster][crate::model::CreateClusterRequest::cluster].
9887    ///
9888    /// # Example
9889    /// ```ignore,no_run
9890    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9891    /// use google_cloud_alloydb_v1::model::Cluster;
9892    /// let x = CreateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
9893    /// ```
9894    pub fn set_cluster<T>(mut self, v: T) -> Self
9895    where
9896        T: std::convert::Into<crate::model::Cluster>,
9897    {
9898        self.cluster = std::option::Option::Some(v.into());
9899        self
9900    }
9901
9902    /// Sets or clears the value of [cluster][crate::model::CreateClusterRequest::cluster].
9903    ///
9904    /// # Example
9905    /// ```ignore,no_run
9906    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9907    /// use google_cloud_alloydb_v1::model::Cluster;
9908    /// let x = CreateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
9909    /// let x = CreateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
9910    /// ```
9911    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
9912    where
9913        T: std::convert::Into<crate::model::Cluster>,
9914    {
9915        self.cluster = v.map(|x| x.into());
9916        self
9917    }
9918
9919    /// Sets the value of [request_id][crate::model::CreateClusterRequest::request_id].
9920    ///
9921    /// # Example
9922    /// ```ignore,no_run
9923    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9924    /// let x = CreateClusterRequest::new().set_request_id("example");
9925    /// ```
9926    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9927        self.request_id = v.into();
9928        self
9929    }
9930
9931    /// Sets the value of [validate_only][crate::model::CreateClusterRequest::validate_only].
9932    ///
9933    /// # Example
9934    /// ```ignore,no_run
9935    /// # use google_cloud_alloydb_v1::model::CreateClusterRequest;
9936    /// let x = CreateClusterRequest::new().set_validate_only(true);
9937    /// ```
9938    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9939        self.validate_only = v.into();
9940        self
9941    }
9942}
9943
9944impl wkt::message::Message for CreateClusterRequest {
9945    fn typename() -> &'static str {
9946        "type.googleapis.com/google.cloud.alloydb.v1.CreateClusterRequest"
9947    }
9948}
9949
9950/// Message for updating a Cluster
9951#[derive(Clone, Default, PartialEq)]
9952#[non_exhaustive]
9953pub struct UpdateClusterRequest {
9954    /// Optional. Field mask is used to specify the fields to be overwritten in the
9955    /// Cluster resource by the update.
9956    /// The fields specified in the update_mask are relative to the resource, not
9957    /// the full request. A field will be overwritten if it is in the mask. If the
9958    /// user does not provide a mask then all fields will be overwritten.
9959    pub update_mask: std::option::Option<wkt::FieldMask>,
9960
9961    /// Required. The resource being updated
9962    pub cluster: std::option::Option<crate::model::Cluster>,
9963
9964    /// Optional. An optional request ID to identify requests. Specify a unique
9965    /// request ID so that if you must retry your request, the server ignores the
9966    /// request if it has already been completed. The server guarantees that for at
9967    /// least 60 minutes since the first request.
9968    ///
9969    /// For example, consider a situation where you make an initial request and
9970    /// the request times out. If you make the request again with the same request
9971    /// ID, the server can check if the original operation with the same request ID
9972    /// was received, and if so, ignores the second request. This prevents
9973    /// clients from accidentally creating duplicate commitments.
9974    ///
9975    /// The request ID must be a valid UUID with the exception that zero UUID is
9976    /// not supported (00000000-0000-0000-0000-000000000000).
9977    pub request_id: std::string::String,
9978
9979    /// Optional. If set, performs request validation, for example, permission
9980    /// checks and any other type of validation, but does not actually execute the
9981    /// create request.
9982    pub validate_only: bool,
9983
9984    /// Optional. If set to true, update succeeds even if cluster is not found. In
9985    /// that case, a new cluster is created and `update_mask` is ignored.
9986    pub allow_missing: bool,
9987
9988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9989}
9990
9991impl UpdateClusterRequest {
9992    pub fn new() -> Self {
9993        std::default::Default::default()
9994    }
9995
9996    /// Sets the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
9997    ///
9998    /// # Example
9999    /// ```ignore,no_run
10000    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10001    /// use wkt::FieldMask;
10002    /// let x = UpdateClusterRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10003    /// ```
10004    pub fn set_update_mask<T>(mut self, v: T) -> Self
10005    where
10006        T: std::convert::Into<wkt::FieldMask>,
10007    {
10008        self.update_mask = std::option::Option::Some(v.into());
10009        self
10010    }
10011
10012    /// Sets or clears the value of [update_mask][crate::model::UpdateClusterRequest::update_mask].
10013    ///
10014    /// # Example
10015    /// ```ignore,no_run
10016    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10017    /// use wkt::FieldMask;
10018    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10019    /// let x = UpdateClusterRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10020    /// ```
10021    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10022    where
10023        T: std::convert::Into<wkt::FieldMask>,
10024    {
10025        self.update_mask = v.map(|x| x.into());
10026        self
10027    }
10028
10029    /// Sets the value of [cluster][crate::model::UpdateClusterRequest::cluster].
10030    ///
10031    /// # Example
10032    /// ```ignore,no_run
10033    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10034    /// use google_cloud_alloydb_v1::model::Cluster;
10035    /// let x = UpdateClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
10036    /// ```
10037    pub fn set_cluster<T>(mut self, v: T) -> Self
10038    where
10039        T: std::convert::Into<crate::model::Cluster>,
10040    {
10041        self.cluster = std::option::Option::Some(v.into());
10042        self
10043    }
10044
10045    /// Sets or clears the value of [cluster][crate::model::UpdateClusterRequest::cluster].
10046    ///
10047    /// # Example
10048    /// ```ignore,no_run
10049    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10050    /// use google_cloud_alloydb_v1::model::Cluster;
10051    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
10052    /// let x = UpdateClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
10053    /// ```
10054    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
10055    where
10056        T: std::convert::Into<crate::model::Cluster>,
10057    {
10058        self.cluster = v.map(|x| x.into());
10059        self
10060    }
10061
10062    /// Sets the value of [request_id][crate::model::UpdateClusterRequest::request_id].
10063    ///
10064    /// # Example
10065    /// ```ignore,no_run
10066    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10067    /// let x = UpdateClusterRequest::new().set_request_id("example");
10068    /// ```
10069    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10070        self.request_id = v.into();
10071        self
10072    }
10073
10074    /// Sets the value of [validate_only][crate::model::UpdateClusterRequest::validate_only].
10075    ///
10076    /// # Example
10077    /// ```ignore,no_run
10078    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10079    /// let x = UpdateClusterRequest::new().set_validate_only(true);
10080    /// ```
10081    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10082        self.validate_only = v.into();
10083        self
10084    }
10085
10086    /// Sets the value of [allow_missing][crate::model::UpdateClusterRequest::allow_missing].
10087    ///
10088    /// # Example
10089    /// ```ignore,no_run
10090    /// # use google_cloud_alloydb_v1::model::UpdateClusterRequest;
10091    /// let x = UpdateClusterRequest::new().set_allow_missing(true);
10092    /// ```
10093    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10094        self.allow_missing = v.into();
10095        self
10096    }
10097}
10098
10099impl wkt::message::Message for UpdateClusterRequest {
10100    fn typename() -> &'static str {
10101        "type.googleapis.com/google.cloud.alloydb.v1.UpdateClusterRequest"
10102    }
10103}
10104
10105/// Destination for Export. Export will be done to cloud storage.
10106#[derive(Clone, Default, PartialEq)]
10107#[non_exhaustive]
10108pub struct GcsDestination {
10109    /// Required. The path to the file in Google Cloud Storage where the export
10110    /// will be stored. The URI is in the form `gs://bucketName/fileName`.
10111    pub uri: std::string::String,
10112
10113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10114}
10115
10116impl GcsDestination {
10117    pub fn new() -> Self {
10118        std::default::Default::default()
10119    }
10120
10121    /// Sets the value of [uri][crate::model::GcsDestination::uri].
10122    ///
10123    /// # Example
10124    /// ```ignore,no_run
10125    /// # use google_cloud_alloydb_v1::model::GcsDestination;
10126    /// let x = GcsDestination::new().set_uri("example");
10127    /// ```
10128    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10129        self.uri = v.into();
10130        self
10131    }
10132}
10133
10134impl wkt::message::Message for GcsDestination {
10135    fn typename() -> &'static str {
10136        "type.googleapis.com/google.cloud.alloydb.v1.GcsDestination"
10137    }
10138}
10139
10140/// Export cluster request.
10141#[derive(Clone, Default, PartialEq)]
10142#[non_exhaustive]
10143pub struct ExportClusterRequest {
10144    /// Required. The resource name of the cluster.
10145    pub name: std::string::String,
10146
10147    /// Required. Name of the database where the export command will be executed.
10148    /// Note - Value provided should be the same as expected from
10149    /// `SELECT current_database();` and NOT as a resource reference.
10150    pub database: std::string::String,
10151
10152    /// Oneof field to support other destinations in future.
10153    pub destination: std::option::Option<crate::model::export_cluster_request::Destination>,
10154
10155    /// Required field to specify export file type and options.
10156    pub export_options: std::option::Option<crate::model::export_cluster_request::ExportOptions>,
10157
10158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10159}
10160
10161impl ExportClusterRequest {
10162    pub fn new() -> Self {
10163        std::default::Default::default()
10164    }
10165
10166    /// Sets the value of [name][crate::model::ExportClusterRequest::name].
10167    ///
10168    /// # Example
10169    /// ```ignore,no_run
10170    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10171    /// let x = ExportClusterRequest::new().set_name("example");
10172    /// ```
10173    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10174        self.name = v.into();
10175        self
10176    }
10177
10178    /// Sets the value of [database][crate::model::ExportClusterRequest::database].
10179    ///
10180    /// # Example
10181    /// ```ignore,no_run
10182    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10183    /// let x = ExportClusterRequest::new().set_database("example");
10184    /// ```
10185    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10186        self.database = v.into();
10187        self
10188    }
10189
10190    /// Sets the value of [destination][crate::model::ExportClusterRequest::destination].
10191    ///
10192    /// Note that all the setters affecting `destination` are mutually
10193    /// exclusive.
10194    ///
10195    /// # Example
10196    /// ```ignore,no_run
10197    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10198    /// use google_cloud_alloydb_v1::model::GcsDestination;
10199    /// let x = ExportClusterRequest::new().set_destination(Some(
10200    ///     google_cloud_alloydb_v1::model::export_cluster_request::Destination::GcsDestination(GcsDestination::default().into())));
10201    /// ```
10202    pub fn set_destination<
10203        T: std::convert::Into<std::option::Option<crate::model::export_cluster_request::Destination>>,
10204    >(
10205        mut self,
10206        v: T,
10207    ) -> Self {
10208        self.destination = v.into();
10209        self
10210    }
10211
10212    /// The value of [destination][crate::model::ExportClusterRequest::destination]
10213    /// if it holds a `GcsDestination`, `None` if the field is not set or
10214    /// holds a different branch.
10215    pub fn gcs_destination(
10216        &self,
10217    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
10218        #[allow(unreachable_patterns)]
10219        self.destination.as_ref().and_then(|v| match v {
10220            crate::model::export_cluster_request::Destination::GcsDestination(v) => {
10221                std::option::Option::Some(v)
10222            }
10223            _ => std::option::Option::None,
10224        })
10225    }
10226
10227    /// Sets the value of [destination][crate::model::ExportClusterRequest::destination]
10228    /// to hold a `GcsDestination`.
10229    ///
10230    /// Note that all the setters affecting `destination` are
10231    /// mutually exclusive.
10232    ///
10233    /// # Example
10234    /// ```ignore,no_run
10235    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10236    /// use google_cloud_alloydb_v1::model::GcsDestination;
10237    /// let x = ExportClusterRequest::new().set_gcs_destination(GcsDestination::default()/* use setters */);
10238    /// assert!(x.gcs_destination().is_some());
10239    /// ```
10240    pub fn set_gcs_destination<
10241        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
10242    >(
10243        mut self,
10244        v: T,
10245    ) -> Self {
10246        self.destination = std::option::Option::Some(
10247            crate::model::export_cluster_request::Destination::GcsDestination(v.into()),
10248        );
10249        self
10250    }
10251
10252    /// Sets the value of [export_options][crate::model::ExportClusterRequest::export_options].
10253    ///
10254    /// Note that all the setters affecting `export_options` are mutually
10255    /// exclusive.
10256    ///
10257    /// # Example
10258    /// ```ignore,no_run
10259    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10260    /// use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10261    /// let x = ExportClusterRequest::new().set_export_options(Some(
10262    ///     google_cloud_alloydb_v1::model::export_cluster_request::ExportOptions::CsvExportOptions(CsvExportOptions::default().into())));
10263    /// ```
10264    pub fn set_export_options<
10265        T: std::convert::Into<
10266                std::option::Option<crate::model::export_cluster_request::ExportOptions>,
10267            >,
10268    >(
10269        mut self,
10270        v: T,
10271    ) -> Self {
10272        self.export_options = v.into();
10273        self
10274    }
10275
10276    /// The value of [export_options][crate::model::ExportClusterRequest::export_options]
10277    /// if it holds a `CsvExportOptions`, `None` if the field is not set or
10278    /// holds a different branch.
10279    pub fn csv_export_options(
10280        &self,
10281    ) -> std::option::Option<&std::boxed::Box<crate::model::export_cluster_request::CsvExportOptions>>
10282    {
10283        #[allow(unreachable_patterns)]
10284        self.export_options.as_ref().and_then(|v| match v {
10285            crate::model::export_cluster_request::ExportOptions::CsvExportOptions(v) => {
10286                std::option::Option::Some(v)
10287            }
10288            _ => std::option::Option::None,
10289        })
10290    }
10291
10292    /// Sets the value of [export_options][crate::model::ExportClusterRequest::export_options]
10293    /// to hold a `CsvExportOptions`.
10294    ///
10295    /// Note that all the setters affecting `export_options` are
10296    /// mutually exclusive.
10297    ///
10298    /// # Example
10299    /// ```ignore,no_run
10300    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10301    /// use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10302    /// let x = ExportClusterRequest::new().set_csv_export_options(CsvExportOptions::default()/* use setters */);
10303    /// assert!(x.csv_export_options().is_some());
10304    /// assert!(x.sql_export_options().is_none());
10305    /// ```
10306    pub fn set_csv_export_options<
10307        T: std::convert::Into<std::boxed::Box<crate::model::export_cluster_request::CsvExportOptions>>,
10308    >(
10309        mut self,
10310        v: T,
10311    ) -> Self {
10312        self.export_options = std::option::Option::Some(
10313            crate::model::export_cluster_request::ExportOptions::CsvExportOptions(v.into()),
10314        );
10315        self
10316    }
10317
10318    /// The value of [export_options][crate::model::ExportClusterRequest::export_options]
10319    /// if it holds a `SqlExportOptions`, `None` if the field is not set or
10320    /// holds a different branch.
10321    pub fn sql_export_options(
10322        &self,
10323    ) -> std::option::Option<&std::boxed::Box<crate::model::export_cluster_request::SqlExportOptions>>
10324    {
10325        #[allow(unreachable_patterns)]
10326        self.export_options.as_ref().and_then(|v| match v {
10327            crate::model::export_cluster_request::ExportOptions::SqlExportOptions(v) => {
10328                std::option::Option::Some(v)
10329            }
10330            _ => std::option::Option::None,
10331        })
10332    }
10333
10334    /// Sets the value of [export_options][crate::model::ExportClusterRequest::export_options]
10335    /// to hold a `SqlExportOptions`.
10336    ///
10337    /// Note that all the setters affecting `export_options` are
10338    /// mutually exclusive.
10339    ///
10340    /// # Example
10341    /// ```ignore,no_run
10342    /// # use google_cloud_alloydb_v1::model::ExportClusterRequest;
10343    /// use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10344    /// let x = ExportClusterRequest::new().set_sql_export_options(SqlExportOptions::default()/* use setters */);
10345    /// assert!(x.sql_export_options().is_some());
10346    /// assert!(x.csv_export_options().is_none());
10347    /// ```
10348    pub fn set_sql_export_options<
10349        T: std::convert::Into<std::boxed::Box<crate::model::export_cluster_request::SqlExportOptions>>,
10350    >(
10351        mut self,
10352        v: T,
10353    ) -> Self {
10354        self.export_options = std::option::Option::Some(
10355            crate::model::export_cluster_request::ExportOptions::SqlExportOptions(v.into()),
10356        );
10357        self
10358    }
10359}
10360
10361impl wkt::message::Message for ExportClusterRequest {
10362    fn typename() -> &'static str {
10363        "type.googleapis.com/google.cloud.alloydb.v1.ExportClusterRequest"
10364    }
10365}
10366
10367/// Defines additional types related to [ExportClusterRequest].
10368pub mod export_cluster_request {
10369    #[allow(unused_imports)]
10370    use super::*;
10371
10372    /// Options for exporting data in CSV format.
10373    #[derive(Clone, Default, PartialEq)]
10374    #[non_exhaustive]
10375    pub struct CsvExportOptions {
10376        /// Required. The SELECT query used to extract the data.
10377        pub select_query: std::string::String,
10378
10379        /// Optional. Specifies the character that separates columns within each row
10380        /// (line) of the file. The default is comma. The value of this argument has
10381        /// to be a character in Hex ASCII Code.
10382        pub field_delimiter: std::string::String,
10383
10384        /// Optional. Specifies the quoting character to be used when a data value is
10385        /// quoted. The default is double-quote. The value of this argument has to be
10386        /// a character in Hex ASCII Code.
10387        pub quote_character: std::string::String,
10388
10389        /// Optional. Specifies the character that should appear before a data
10390        /// character that needs to be escaped. The default is the same as quote
10391        /// character. The value of this argument has to be a character in Hex ASCII
10392        /// Code.
10393        pub escape_character: std::string::String,
10394
10395        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10396    }
10397
10398    impl CsvExportOptions {
10399        pub fn new() -> Self {
10400            std::default::Default::default()
10401        }
10402
10403        /// Sets the value of [select_query][crate::model::export_cluster_request::CsvExportOptions::select_query].
10404        ///
10405        /// # Example
10406        /// ```ignore,no_run
10407        /// # use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10408        /// let x = CsvExportOptions::new().set_select_query("example");
10409        /// ```
10410        pub fn set_select_query<T: std::convert::Into<std::string::String>>(
10411            mut self,
10412            v: T,
10413        ) -> Self {
10414            self.select_query = v.into();
10415            self
10416        }
10417
10418        /// Sets the value of [field_delimiter][crate::model::export_cluster_request::CsvExportOptions::field_delimiter].
10419        ///
10420        /// # Example
10421        /// ```ignore,no_run
10422        /// # use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10423        /// let x = CsvExportOptions::new().set_field_delimiter("example");
10424        /// ```
10425        pub fn set_field_delimiter<T: std::convert::Into<std::string::String>>(
10426            mut self,
10427            v: T,
10428        ) -> Self {
10429            self.field_delimiter = v.into();
10430            self
10431        }
10432
10433        /// Sets the value of [quote_character][crate::model::export_cluster_request::CsvExportOptions::quote_character].
10434        ///
10435        /// # Example
10436        /// ```ignore,no_run
10437        /// # use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10438        /// let x = CsvExportOptions::new().set_quote_character("example");
10439        /// ```
10440        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
10441            mut self,
10442            v: T,
10443        ) -> Self {
10444            self.quote_character = v.into();
10445            self
10446        }
10447
10448        /// Sets the value of [escape_character][crate::model::export_cluster_request::CsvExportOptions::escape_character].
10449        ///
10450        /// # Example
10451        /// ```ignore,no_run
10452        /// # use google_cloud_alloydb_v1::model::export_cluster_request::CsvExportOptions;
10453        /// let x = CsvExportOptions::new().set_escape_character("example");
10454        /// ```
10455        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
10456            mut self,
10457            v: T,
10458        ) -> Self {
10459            self.escape_character = v.into();
10460            self
10461        }
10462    }
10463
10464    impl wkt::message::Message for CsvExportOptions {
10465        fn typename() -> &'static str {
10466            "type.googleapis.com/google.cloud.alloydb.v1.ExportClusterRequest.CsvExportOptions"
10467        }
10468    }
10469
10470    /// Options for exporting data in SQL format.
10471    #[derive(Clone, Default, PartialEq)]
10472    #[non_exhaustive]
10473    pub struct SqlExportOptions {
10474        /// Optional. Tables to export from.
10475        pub tables: std::vec::Vec<std::string::String>,
10476
10477        /// Optional. If true, only export the schema.
10478        pub schema_only: std::option::Option<bool>,
10479
10480        /// Optional. If true, output commands to DROP all the dumped database
10481        /// objects prior to outputting the commands for creating them.
10482        pub clean_target_objects: std::option::Option<bool>,
10483
10484        /// Optional. If true, use DROP ... IF EXISTS commands to check for the
10485        /// object's existence before dropping it in clean_target_objects mode.
10486        pub if_exist_target_objects: std::option::Option<bool>,
10487
10488        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10489    }
10490
10491    impl SqlExportOptions {
10492        pub fn new() -> Self {
10493            std::default::Default::default()
10494        }
10495
10496        /// Sets the value of [tables][crate::model::export_cluster_request::SqlExportOptions::tables].
10497        ///
10498        /// # Example
10499        /// ```ignore,no_run
10500        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10501        /// let x = SqlExportOptions::new().set_tables(["a", "b", "c"]);
10502        /// ```
10503        pub fn set_tables<T, V>(mut self, v: T) -> Self
10504        where
10505            T: std::iter::IntoIterator<Item = V>,
10506            V: std::convert::Into<std::string::String>,
10507        {
10508            use std::iter::Iterator;
10509            self.tables = v.into_iter().map(|i| i.into()).collect();
10510            self
10511        }
10512
10513        /// Sets the value of [schema_only][crate::model::export_cluster_request::SqlExportOptions::schema_only].
10514        ///
10515        /// # Example
10516        /// ```ignore,no_run
10517        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10518        /// let x = SqlExportOptions::new().set_schema_only(true);
10519        /// ```
10520        pub fn set_schema_only<T>(mut self, v: T) -> Self
10521        where
10522            T: std::convert::Into<bool>,
10523        {
10524            self.schema_only = std::option::Option::Some(v.into());
10525            self
10526        }
10527
10528        /// Sets or clears the value of [schema_only][crate::model::export_cluster_request::SqlExportOptions::schema_only].
10529        ///
10530        /// # Example
10531        /// ```ignore,no_run
10532        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10533        /// let x = SqlExportOptions::new().set_or_clear_schema_only(Some(false));
10534        /// let x = SqlExportOptions::new().set_or_clear_schema_only(None::<bool>);
10535        /// ```
10536        pub fn set_or_clear_schema_only<T>(mut self, v: std::option::Option<T>) -> Self
10537        where
10538            T: std::convert::Into<bool>,
10539        {
10540            self.schema_only = v.map(|x| x.into());
10541            self
10542        }
10543
10544        /// Sets the value of [clean_target_objects][crate::model::export_cluster_request::SqlExportOptions::clean_target_objects].
10545        ///
10546        /// # Example
10547        /// ```ignore,no_run
10548        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10549        /// let x = SqlExportOptions::new().set_clean_target_objects(true);
10550        /// ```
10551        pub fn set_clean_target_objects<T>(mut self, v: T) -> Self
10552        where
10553            T: std::convert::Into<bool>,
10554        {
10555            self.clean_target_objects = std::option::Option::Some(v.into());
10556            self
10557        }
10558
10559        /// Sets or clears the value of [clean_target_objects][crate::model::export_cluster_request::SqlExportOptions::clean_target_objects].
10560        ///
10561        /// # Example
10562        /// ```ignore,no_run
10563        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10564        /// let x = SqlExportOptions::new().set_or_clear_clean_target_objects(Some(false));
10565        /// let x = SqlExportOptions::new().set_or_clear_clean_target_objects(None::<bool>);
10566        /// ```
10567        pub fn set_or_clear_clean_target_objects<T>(mut self, v: std::option::Option<T>) -> Self
10568        where
10569            T: std::convert::Into<bool>,
10570        {
10571            self.clean_target_objects = v.map(|x| x.into());
10572            self
10573        }
10574
10575        /// Sets the value of [if_exist_target_objects][crate::model::export_cluster_request::SqlExportOptions::if_exist_target_objects].
10576        ///
10577        /// # Example
10578        /// ```ignore,no_run
10579        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10580        /// let x = SqlExportOptions::new().set_if_exist_target_objects(true);
10581        /// ```
10582        pub fn set_if_exist_target_objects<T>(mut self, v: T) -> Self
10583        where
10584            T: std::convert::Into<bool>,
10585        {
10586            self.if_exist_target_objects = std::option::Option::Some(v.into());
10587            self
10588        }
10589
10590        /// Sets or clears the value of [if_exist_target_objects][crate::model::export_cluster_request::SqlExportOptions::if_exist_target_objects].
10591        ///
10592        /// # Example
10593        /// ```ignore,no_run
10594        /// # use google_cloud_alloydb_v1::model::export_cluster_request::SqlExportOptions;
10595        /// let x = SqlExportOptions::new().set_or_clear_if_exist_target_objects(Some(false));
10596        /// let x = SqlExportOptions::new().set_or_clear_if_exist_target_objects(None::<bool>);
10597        /// ```
10598        pub fn set_or_clear_if_exist_target_objects<T>(mut self, v: std::option::Option<T>) -> Self
10599        where
10600            T: std::convert::Into<bool>,
10601        {
10602            self.if_exist_target_objects = v.map(|x| x.into());
10603            self
10604        }
10605    }
10606
10607    impl wkt::message::Message for SqlExportOptions {
10608        fn typename() -> &'static str {
10609            "type.googleapis.com/google.cloud.alloydb.v1.ExportClusterRequest.SqlExportOptions"
10610        }
10611    }
10612
10613    /// Oneof field to support other destinations in future.
10614    #[derive(Clone, Debug, PartialEq)]
10615    #[non_exhaustive]
10616    pub enum Destination {
10617        /// Required. Option to export data to cloud storage.
10618        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
10619    }
10620
10621    /// Required field to specify export file type and options.
10622    #[derive(Clone, Debug, PartialEq)]
10623    #[non_exhaustive]
10624    pub enum ExportOptions {
10625        /// Options for exporting data in CSV format. Required field to be set for
10626        /// CSV file type.
10627        CsvExportOptions(std::boxed::Box<crate::model::export_cluster_request::CsvExportOptions>),
10628        /// Options for exporting data in SQL format. Required field to be set for
10629        /// SQL file type.
10630        SqlExportOptions(std::boxed::Box<crate::model::export_cluster_request::SqlExportOptions>),
10631    }
10632}
10633
10634/// Response of export cluster rpc.
10635#[derive(Clone, Default, PartialEq)]
10636#[non_exhaustive]
10637pub struct ExportClusterResponse {
10638    /// Oneof field to support other destinations in future.
10639    pub destination: std::option::Option<crate::model::export_cluster_response::Destination>,
10640
10641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10642}
10643
10644impl ExportClusterResponse {
10645    pub fn new() -> Self {
10646        std::default::Default::default()
10647    }
10648
10649    /// Sets the value of [destination][crate::model::ExportClusterResponse::destination].
10650    ///
10651    /// Note that all the setters affecting `destination` are mutually
10652    /// exclusive.
10653    ///
10654    /// # Example
10655    /// ```ignore,no_run
10656    /// # use google_cloud_alloydb_v1::model::ExportClusterResponse;
10657    /// use google_cloud_alloydb_v1::model::GcsDestination;
10658    /// let x = ExportClusterResponse::new().set_destination(Some(
10659    ///     google_cloud_alloydb_v1::model::export_cluster_response::Destination::GcsDestination(GcsDestination::default().into())));
10660    /// ```
10661    pub fn set_destination<
10662        T: std::convert::Into<std::option::Option<crate::model::export_cluster_response::Destination>>,
10663    >(
10664        mut self,
10665        v: T,
10666    ) -> Self {
10667        self.destination = v.into();
10668        self
10669    }
10670
10671    /// The value of [destination][crate::model::ExportClusterResponse::destination]
10672    /// if it holds a `GcsDestination`, `None` if the field is not set or
10673    /// holds a different branch.
10674    pub fn gcs_destination(
10675        &self,
10676    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
10677        #[allow(unreachable_patterns)]
10678        self.destination.as_ref().and_then(|v| match v {
10679            crate::model::export_cluster_response::Destination::GcsDestination(v) => {
10680                std::option::Option::Some(v)
10681            }
10682            _ => std::option::Option::None,
10683        })
10684    }
10685
10686    /// Sets the value of [destination][crate::model::ExportClusterResponse::destination]
10687    /// to hold a `GcsDestination`.
10688    ///
10689    /// Note that all the setters affecting `destination` are
10690    /// mutually exclusive.
10691    ///
10692    /// # Example
10693    /// ```ignore,no_run
10694    /// # use google_cloud_alloydb_v1::model::ExportClusterResponse;
10695    /// use google_cloud_alloydb_v1::model::GcsDestination;
10696    /// let x = ExportClusterResponse::new().set_gcs_destination(GcsDestination::default()/* use setters */);
10697    /// assert!(x.gcs_destination().is_some());
10698    /// ```
10699    pub fn set_gcs_destination<
10700        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
10701    >(
10702        mut self,
10703        v: T,
10704    ) -> Self {
10705        self.destination = std::option::Option::Some(
10706            crate::model::export_cluster_response::Destination::GcsDestination(v.into()),
10707        );
10708        self
10709    }
10710}
10711
10712impl wkt::message::Message for ExportClusterResponse {
10713    fn typename() -> &'static str {
10714        "type.googleapis.com/google.cloud.alloydb.v1.ExportClusterResponse"
10715    }
10716}
10717
10718/// Defines additional types related to [ExportClusterResponse].
10719pub mod export_cluster_response {
10720    #[allow(unused_imports)]
10721    use super::*;
10722
10723    /// Oneof field to support other destinations in future.
10724    #[derive(Clone, Debug, PartialEq)]
10725    #[non_exhaustive]
10726    pub enum Destination {
10727        /// Required. Option to export data to cloud storage.
10728        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
10729    }
10730}
10731
10732/// Import cluster request.
10733#[derive(Clone, Default, PartialEq)]
10734#[non_exhaustive]
10735pub struct ImportClusterRequest {
10736    /// Required. The resource name of the cluster.
10737    pub name: std::string::String,
10738
10739    /// Required. The path to the file in Google Cloud Storage where the source
10740    /// file for import will be stored. The URI is in the form
10741    /// `gs://bucketName/fileName`.
10742    pub gcs_uri: std::string::String,
10743
10744    /// Optional. Name of the database to which the import will be done.
10745    /// For import from SQL file, this is required only if the file does not
10746    /// specify a database.
10747    /// Note - Value provided should be the same as expected from `SELECT
10748    /// current_database();` and NOT as a resource reference.
10749    pub database: std::string::String,
10750
10751    /// Optional. Database user to be used for importing the data.
10752    /// Note - Value provided should be the same as expected from
10753    /// `SELECT current_user;` and NOT as a resource reference.
10754    pub user: std::string::String,
10755
10756    /// oneof field to support various import formats like SQL and CSV.
10757    pub import_options: std::option::Option<crate::model::import_cluster_request::ImportOptions>,
10758
10759    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10760}
10761
10762impl ImportClusterRequest {
10763    pub fn new() -> Self {
10764        std::default::Default::default()
10765    }
10766
10767    /// Sets the value of [name][crate::model::ImportClusterRequest::name].
10768    ///
10769    /// # Example
10770    /// ```ignore,no_run
10771    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10772    /// let x = ImportClusterRequest::new().set_name("example");
10773    /// ```
10774    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10775        self.name = v.into();
10776        self
10777    }
10778
10779    /// Sets the value of [gcs_uri][crate::model::ImportClusterRequest::gcs_uri].
10780    ///
10781    /// # Example
10782    /// ```ignore,no_run
10783    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10784    /// let x = ImportClusterRequest::new().set_gcs_uri("example");
10785    /// ```
10786    pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10787        self.gcs_uri = v.into();
10788        self
10789    }
10790
10791    /// Sets the value of [database][crate::model::ImportClusterRequest::database].
10792    ///
10793    /// # Example
10794    /// ```ignore,no_run
10795    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10796    /// let x = ImportClusterRequest::new().set_database("example");
10797    /// ```
10798    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10799        self.database = v.into();
10800        self
10801    }
10802
10803    /// Sets the value of [user][crate::model::ImportClusterRequest::user].
10804    ///
10805    /// # Example
10806    /// ```ignore,no_run
10807    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10808    /// let x = ImportClusterRequest::new().set_user("example");
10809    /// ```
10810    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10811        self.user = v.into();
10812        self
10813    }
10814
10815    /// Sets the value of [import_options][crate::model::ImportClusterRequest::import_options].
10816    ///
10817    /// Note that all the setters affecting `import_options` are mutually
10818    /// exclusive.
10819    ///
10820    /// # Example
10821    /// ```ignore,no_run
10822    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10823    /// use google_cloud_alloydb_v1::model::import_cluster_request::SqlImportOptions;
10824    /// let x = ImportClusterRequest::new().set_import_options(Some(
10825    ///     google_cloud_alloydb_v1::model::import_cluster_request::ImportOptions::SqlImportOptions(SqlImportOptions::default().into())));
10826    /// ```
10827    pub fn set_import_options<
10828        T: std::convert::Into<
10829                std::option::Option<crate::model::import_cluster_request::ImportOptions>,
10830            >,
10831    >(
10832        mut self,
10833        v: T,
10834    ) -> Self {
10835        self.import_options = v.into();
10836        self
10837    }
10838
10839    /// The value of [import_options][crate::model::ImportClusterRequest::import_options]
10840    /// if it holds a `SqlImportOptions`, `None` if the field is not set or
10841    /// holds a different branch.
10842    pub fn sql_import_options(
10843        &self,
10844    ) -> std::option::Option<&std::boxed::Box<crate::model::import_cluster_request::SqlImportOptions>>
10845    {
10846        #[allow(unreachable_patterns)]
10847        self.import_options.as_ref().and_then(|v| match v {
10848            crate::model::import_cluster_request::ImportOptions::SqlImportOptions(v) => {
10849                std::option::Option::Some(v)
10850            }
10851            _ => std::option::Option::None,
10852        })
10853    }
10854
10855    /// Sets the value of [import_options][crate::model::ImportClusterRequest::import_options]
10856    /// to hold a `SqlImportOptions`.
10857    ///
10858    /// Note that all the setters affecting `import_options` are
10859    /// mutually exclusive.
10860    ///
10861    /// # Example
10862    /// ```ignore,no_run
10863    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10864    /// use google_cloud_alloydb_v1::model::import_cluster_request::SqlImportOptions;
10865    /// let x = ImportClusterRequest::new().set_sql_import_options(SqlImportOptions::default()/* use setters */);
10866    /// assert!(x.sql_import_options().is_some());
10867    /// assert!(x.csv_import_options().is_none());
10868    /// ```
10869    pub fn set_sql_import_options<
10870        T: std::convert::Into<std::boxed::Box<crate::model::import_cluster_request::SqlImportOptions>>,
10871    >(
10872        mut self,
10873        v: T,
10874    ) -> Self {
10875        self.import_options = std::option::Option::Some(
10876            crate::model::import_cluster_request::ImportOptions::SqlImportOptions(v.into()),
10877        );
10878        self
10879    }
10880
10881    /// The value of [import_options][crate::model::ImportClusterRequest::import_options]
10882    /// if it holds a `CsvImportOptions`, `None` if the field is not set or
10883    /// holds a different branch.
10884    pub fn csv_import_options(
10885        &self,
10886    ) -> std::option::Option<&std::boxed::Box<crate::model::import_cluster_request::CsvImportOptions>>
10887    {
10888        #[allow(unreachable_patterns)]
10889        self.import_options.as_ref().and_then(|v| match v {
10890            crate::model::import_cluster_request::ImportOptions::CsvImportOptions(v) => {
10891                std::option::Option::Some(v)
10892            }
10893            _ => std::option::Option::None,
10894        })
10895    }
10896
10897    /// Sets the value of [import_options][crate::model::ImportClusterRequest::import_options]
10898    /// to hold a `CsvImportOptions`.
10899    ///
10900    /// Note that all the setters affecting `import_options` are
10901    /// mutually exclusive.
10902    ///
10903    /// # Example
10904    /// ```ignore,no_run
10905    /// # use google_cloud_alloydb_v1::model::ImportClusterRequest;
10906    /// use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
10907    /// let x = ImportClusterRequest::new().set_csv_import_options(CsvImportOptions::default()/* use setters */);
10908    /// assert!(x.csv_import_options().is_some());
10909    /// assert!(x.sql_import_options().is_none());
10910    /// ```
10911    pub fn set_csv_import_options<
10912        T: std::convert::Into<std::boxed::Box<crate::model::import_cluster_request::CsvImportOptions>>,
10913    >(
10914        mut self,
10915        v: T,
10916    ) -> Self {
10917        self.import_options = std::option::Option::Some(
10918            crate::model::import_cluster_request::ImportOptions::CsvImportOptions(v.into()),
10919        );
10920        self
10921    }
10922}
10923
10924impl wkt::message::Message for ImportClusterRequest {
10925    fn typename() -> &'static str {
10926        "type.googleapis.com/google.cloud.alloydb.v1.ImportClusterRequest"
10927    }
10928}
10929
10930/// Defines additional types related to [ImportClusterRequest].
10931pub mod import_cluster_request {
10932    #[allow(unused_imports)]
10933    use super::*;
10934
10935    /// Options for importing data in SQL format.
10936    #[derive(Clone, Default, PartialEq)]
10937    #[non_exhaustive]
10938    pub struct SqlImportOptions {
10939        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10940    }
10941
10942    impl SqlImportOptions {
10943        pub fn new() -> Self {
10944            std::default::Default::default()
10945        }
10946    }
10947
10948    impl wkt::message::Message for SqlImportOptions {
10949        fn typename() -> &'static str {
10950            "type.googleapis.com/google.cloud.alloydb.v1.ImportClusterRequest.SqlImportOptions"
10951        }
10952    }
10953
10954    /// Options for importing data in CSV format.
10955    #[derive(Clone, Default, PartialEq)]
10956    #[non_exhaustive]
10957    pub struct CsvImportOptions {
10958        /// Required. The database table to import CSV file into.
10959        pub table: std::string::String,
10960
10961        /// Optional. The columns to which CSV data is imported. If not specified,
10962        /// all columns of the database table are loaded with CSV data.
10963        pub columns: std::vec::Vec<std::string::String>,
10964
10965        /// Optional. Specifies the character that separates columns within each row
10966        /// (line) of the file. The default is comma. The value of this argument has
10967        /// to be a character in Hex ASCII Code.
10968        pub field_delimiter: std::string::String,
10969
10970        /// Optional. Specifies the quoting character to be used when a data value is
10971        /// quoted. The default is double-quote. The value of this argument has to be
10972        /// a character in Hex ASCII Code.
10973        pub quote_character: std::string::String,
10974
10975        /// Optional. Specifies the character that should appear before a data
10976        /// character that needs to be escaped. The default is same as quote
10977        /// character. The value of this argument has to be a character in Hex ASCII
10978        /// Code.
10979        pub escape_character: std::string::String,
10980
10981        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10982    }
10983
10984    impl CsvImportOptions {
10985        pub fn new() -> Self {
10986            std::default::Default::default()
10987        }
10988
10989        /// Sets the value of [table][crate::model::import_cluster_request::CsvImportOptions::table].
10990        ///
10991        /// # Example
10992        /// ```ignore,no_run
10993        /// # use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
10994        /// let x = CsvImportOptions::new().set_table("example");
10995        /// ```
10996        pub fn set_table<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10997            self.table = v.into();
10998            self
10999        }
11000
11001        /// Sets the value of [columns][crate::model::import_cluster_request::CsvImportOptions::columns].
11002        ///
11003        /// # Example
11004        /// ```ignore,no_run
11005        /// # use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
11006        /// let x = CsvImportOptions::new().set_columns(["a", "b", "c"]);
11007        /// ```
11008        pub fn set_columns<T, V>(mut self, v: T) -> Self
11009        where
11010            T: std::iter::IntoIterator<Item = V>,
11011            V: std::convert::Into<std::string::String>,
11012        {
11013            use std::iter::Iterator;
11014            self.columns = v.into_iter().map(|i| i.into()).collect();
11015            self
11016        }
11017
11018        /// Sets the value of [field_delimiter][crate::model::import_cluster_request::CsvImportOptions::field_delimiter].
11019        ///
11020        /// # Example
11021        /// ```ignore,no_run
11022        /// # use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
11023        /// let x = CsvImportOptions::new().set_field_delimiter("example");
11024        /// ```
11025        pub fn set_field_delimiter<T: std::convert::Into<std::string::String>>(
11026            mut self,
11027            v: T,
11028        ) -> Self {
11029            self.field_delimiter = v.into();
11030            self
11031        }
11032
11033        /// Sets the value of [quote_character][crate::model::import_cluster_request::CsvImportOptions::quote_character].
11034        ///
11035        /// # Example
11036        /// ```ignore,no_run
11037        /// # use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
11038        /// let x = CsvImportOptions::new().set_quote_character("example");
11039        /// ```
11040        pub fn set_quote_character<T: std::convert::Into<std::string::String>>(
11041            mut self,
11042            v: T,
11043        ) -> Self {
11044            self.quote_character = v.into();
11045            self
11046        }
11047
11048        /// Sets the value of [escape_character][crate::model::import_cluster_request::CsvImportOptions::escape_character].
11049        ///
11050        /// # Example
11051        /// ```ignore,no_run
11052        /// # use google_cloud_alloydb_v1::model::import_cluster_request::CsvImportOptions;
11053        /// let x = CsvImportOptions::new().set_escape_character("example");
11054        /// ```
11055        pub fn set_escape_character<T: std::convert::Into<std::string::String>>(
11056            mut self,
11057            v: T,
11058        ) -> Self {
11059            self.escape_character = v.into();
11060            self
11061        }
11062    }
11063
11064    impl wkt::message::Message for CsvImportOptions {
11065        fn typename() -> &'static str {
11066            "type.googleapis.com/google.cloud.alloydb.v1.ImportClusterRequest.CsvImportOptions"
11067        }
11068    }
11069
11070    /// oneof field to support various import formats like SQL and CSV.
11071    #[derive(Clone, Debug, PartialEq)]
11072    #[non_exhaustive]
11073    pub enum ImportOptions {
11074        /// Options for importing data in SQL format.
11075        SqlImportOptions(std::boxed::Box<crate::model::import_cluster_request::SqlImportOptions>),
11076        /// Options for importing data in CSV format.
11077        CsvImportOptions(std::boxed::Box<crate::model::import_cluster_request::CsvImportOptions>),
11078    }
11079}
11080
11081/// Response of import rpc.
11082#[derive(Clone, Default, PartialEq)]
11083#[non_exhaustive]
11084pub struct ImportClusterResponse {
11085    /// Required. Size of the object downloaded from Google Cloud Storage in bytes.
11086    pub bytes_downloaded: i64,
11087
11088    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11089}
11090
11091impl ImportClusterResponse {
11092    pub fn new() -> Self {
11093        std::default::Default::default()
11094    }
11095
11096    /// Sets the value of [bytes_downloaded][crate::model::ImportClusterResponse::bytes_downloaded].
11097    ///
11098    /// # Example
11099    /// ```ignore,no_run
11100    /// # use google_cloud_alloydb_v1::model::ImportClusterResponse;
11101    /// let x = ImportClusterResponse::new().set_bytes_downloaded(42);
11102    /// ```
11103    pub fn set_bytes_downloaded<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11104        self.bytes_downloaded = v.into();
11105        self
11106    }
11107}
11108
11109impl wkt::message::Message for ImportClusterResponse {
11110    fn typename() -> &'static str {
11111        "type.googleapis.com/google.cloud.alloydb.v1.ImportClusterResponse"
11112    }
11113}
11114
11115/// Upgrades a cluster.
11116#[derive(Clone, Default, PartialEq)]
11117#[non_exhaustive]
11118pub struct UpgradeClusterRequest {
11119    /// Required. The resource name of the cluster.
11120    pub name: std::string::String,
11121
11122    /// Required. The version the cluster is going to be upgraded to.
11123    pub version: crate::model::DatabaseVersion,
11124
11125    /// Optional. An optional request ID to identify requests. Specify a unique
11126    /// request ID so that if you must retry your request, the server ignores the
11127    /// request if it has already been completed. The server guarantees that for at
11128    /// least 60 minutes since the first request.
11129    ///
11130    /// For example, consider a situation where you make an initial request and
11131    /// the request times out. If you make the request again with the same request
11132    /// ID, the server can check if the original operation with the same request ID
11133    /// was received, and if so, ignores the second request. This prevents
11134    /// clients from accidentally creating duplicate commitments.
11135    ///
11136    /// The request ID must be a valid UUID with the exception that zero UUID is
11137    /// not supported (00000000-0000-0000-0000-000000000000).
11138    pub request_id: std::string::String,
11139
11140    /// Optional. If set, performs request validation, for example, permission
11141    /// checks and any other type of validation, but does not actually execute the
11142    /// create request.
11143    pub validate_only: bool,
11144
11145    /// Optional. The current etag of the Cluster.
11146    /// If an etag is provided and does not match the current etag of the Cluster,
11147    /// upgrade will be blocked and an ABORTED error will be returned.
11148    pub etag: std::string::String,
11149
11150    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11151}
11152
11153impl UpgradeClusterRequest {
11154    pub fn new() -> Self {
11155        std::default::Default::default()
11156    }
11157
11158    /// Sets the value of [name][crate::model::UpgradeClusterRequest::name].
11159    ///
11160    /// # Example
11161    /// ```ignore,no_run
11162    /// # use google_cloud_alloydb_v1::model::UpgradeClusterRequest;
11163    /// let x = UpgradeClusterRequest::new().set_name("example");
11164    /// ```
11165    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11166        self.name = v.into();
11167        self
11168    }
11169
11170    /// Sets the value of [version][crate::model::UpgradeClusterRequest::version].
11171    ///
11172    /// # Example
11173    /// ```ignore,no_run
11174    /// # use google_cloud_alloydb_v1::model::UpgradeClusterRequest;
11175    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
11176    /// let x0 = UpgradeClusterRequest::new().set_version(DatabaseVersion::Postgres14);
11177    /// let x1 = UpgradeClusterRequest::new().set_version(DatabaseVersion::Postgres15);
11178    /// let x2 = UpgradeClusterRequest::new().set_version(DatabaseVersion::Postgres16);
11179    /// ```
11180    pub fn set_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
11181        mut self,
11182        v: T,
11183    ) -> Self {
11184        self.version = v.into();
11185        self
11186    }
11187
11188    /// Sets the value of [request_id][crate::model::UpgradeClusterRequest::request_id].
11189    ///
11190    /// # Example
11191    /// ```ignore,no_run
11192    /// # use google_cloud_alloydb_v1::model::UpgradeClusterRequest;
11193    /// let x = UpgradeClusterRequest::new().set_request_id("example");
11194    /// ```
11195    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11196        self.request_id = v.into();
11197        self
11198    }
11199
11200    /// Sets the value of [validate_only][crate::model::UpgradeClusterRequest::validate_only].
11201    ///
11202    /// # Example
11203    /// ```ignore,no_run
11204    /// # use google_cloud_alloydb_v1::model::UpgradeClusterRequest;
11205    /// let x = UpgradeClusterRequest::new().set_validate_only(true);
11206    /// ```
11207    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11208        self.validate_only = v.into();
11209        self
11210    }
11211
11212    /// Sets the value of [etag][crate::model::UpgradeClusterRequest::etag].
11213    ///
11214    /// # Example
11215    /// ```ignore,no_run
11216    /// # use google_cloud_alloydb_v1::model::UpgradeClusterRequest;
11217    /// let x = UpgradeClusterRequest::new().set_etag("example");
11218    /// ```
11219    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11220        self.etag = v.into();
11221        self
11222    }
11223}
11224
11225impl wkt::message::Message for UpgradeClusterRequest {
11226    fn typename() -> &'static str {
11227        "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterRequest"
11228    }
11229}
11230
11231/// UpgradeClusterResponse contains the response for upgrade cluster operation.
11232#[derive(Clone, Default, PartialEq)]
11233#[non_exhaustive]
11234pub struct UpgradeClusterResponse {
11235    /// Status of upgrade operation.
11236    pub status: crate::model::upgrade_cluster_response::Status,
11237
11238    /// A user friendly message summarising the upgrade operation details and the
11239    /// next steps for the user if there is any.
11240    pub message: std::string::String,
11241
11242    /// Array of upgrade details for the current cluster and all the secondary
11243    /// clusters associated with this cluster.
11244    pub cluster_upgrade_details:
11245        std::vec::Vec<crate::model::upgrade_cluster_response::ClusterUpgradeDetails>,
11246
11247    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11248}
11249
11250impl UpgradeClusterResponse {
11251    pub fn new() -> Self {
11252        std::default::Default::default()
11253    }
11254
11255    /// Sets the value of [status][crate::model::UpgradeClusterResponse::status].
11256    ///
11257    /// # Example
11258    /// ```ignore,no_run
11259    /// # use google_cloud_alloydb_v1::model::UpgradeClusterResponse;
11260    /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
11261    /// let x0 = UpgradeClusterResponse::new().set_status(Status::NotStarted);
11262    /// let x1 = UpgradeClusterResponse::new().set_status(Status::InProgress);
11263    /// let x2 = UpgradeClusterResponse::new().set_status(Status::Success);
11264    /// ```
11265    pub fn set_status<T: std::convert::Into<crate::model::upgrade_cluster_response::Status>>(
11266        mut self,
11267        v: T,
11268    ) -> Self {
11269        self.status = v.into();
11270        self
11271    }
11272
11273    /// Sets the value of [message][crate::model::UpgradeClusterResponse::message].
11274    ///
11275    /// # Example
11276    /// ```ignore,no_run
11277    /// # use google_cloud_alloydb_v1::model::UpgradeClusterResponse;
11278    /// let x = UpgradeClusterResponse::new().set_message("example");
11279    /// ```
11280    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11281        self.message = v.into();
11282        self
11283    }
11284
11285    /// Sets the value of [cluster_upgrade_details][crate::model::UpgradeClusterResponse::cluster_upgrade_details].
11286    ///
11287    /// # Example
11288    /// ```ignore,no_run
11289    /// # use google_cloud_alloydb_v1::model::UpgradeClusterResponse;
11290    /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11291    /// let x = UpgradeClusterResponse::new()
11292    ///     .set_cluster_upgrade_details([
11293    ///         ClusterUpgradeDetails::default()/* use setters */,
11294    ///         ClusterUpgradeDetails::default()/* use (different) setters */,
11295    ///     ]);
11296    /// ```
11297    pub fn set_cluster_upgrade_details<T, V>(mut self, v: T) -> Self
11298    where
11299        T: std::iter::IntoIterator<Item = V>,
11300        V: std::convert::Into<crate::model::upgrade_cluster_response::ClusterUpgradeDetails>,
11301    {
11302        use std::iter::Iterator;
11303        self.cluster_upgrade_details = v.into_iter().map(|i| i.into()).collect();
11304        self
11305    }
11306}
11307
11308impl wkt::message::Message for UpgradeClusterResponse {
11309    fn typename() -> &'static str {
11310        "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterResponse"
11311    }
11312}
11313
11314/// Defines additional types related to [UpgradeClusterResponse].
11315pub mod upgrade_cluster_response {
11316    #[allow(unused_imports)]
11317    use super::*;
11318
11319    /// Stage information for different stages in the upgrade process.
11320    #[derive(Clone, Default, PartialEq)]
11321    #[non_exhaustive]
11322    pub struct StageInfo {
11323        /// The stage.
11324        pub stage: crate::model::upgrade_cluster_response::Stage,
11325
11326        /// Status of the stage.
11327        pub status: crate::model::upgrade_cluster_response::Status,
11328
11329        /// logs_url is the URL for the logs associated with a stage if that stage
11330        /// has logs. Right now, only three stages have logs: ALLOYDB_PRECHECK,
11331        /// PG_UPGRADE_CHECK, PRIMARY_INSTANCE_UPGRADE.
11332        pub logs_url: std::string::String,
11333
11334        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11335    }
11336
11337    impl StageInfo {
11338        pub fn new() -> Self {
11339            std::default::Default::default()
11340        }
11341
11342        /// Sets the value of [stage][crate::model::upgrade_cluster_response::StageInfo::stage].
11343        ///
11344        /// # Example
11345        /// ```ignore,no_run
11346        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::StageInfo;
11347        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Stage;
11348        /// let x0 = StageInfo::new().set_stage(Stage::AlloydbPrecheck);
11349        /// let x1 = StageInfo::new().set_stage(Stage::PgUpgradeCheck);
11350        /// let x2 = StageInfo::new().set_stage(Stage::PrepareForUpgrade);
11351        /// ```
11352        pub fn set_stage<T: std::convert::Into<crate::model::upgrade_cluster_response::Stage>>(
11353            mut self,
11354            v: T,
11355        ) -> Self {
11356            self.stage = v.into();
11357            self
11358        }
11359
11360        /// Sets the value of [status][crate::model::upgrade_cluster_response::StageInfo::status].
11361        ///
11362        /// # Example
11363        /// ```ignore,no_run
11364        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::StageInfo;
11365        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
11366        /// let x0 = StageInfo::new().set_status(Status::NotStarted);
11367        /// let x1 = StageInfo::new().set_status(Status::InProgress);
11368        /// let x2 = StageInfo::new().set_status(Status::Success);
11369        /// ```
11370        pub fn set_status<T: std::convert::Into<crate::model::upgrade_cluster_response::Status>>(
11371            mut self,
11372            v: T,
11373        ) -> Self {
11374            self.status = v.into();
11375            self
11376        }
11377
11378        /// Sets the value of [logs_url][crate::model::upgrade_cluster_response::StageInfo::logs_url].
11379        ///
11380        /// # Example
11381        /// ```ignore,no_run
11382        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::StageInfo;
11383        /// let x = StageInfo::new().set_logs_url("example");
11384        /// ```
11385        pub fn set_logs_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11386            self.logs_url = v.into();
11387            self
11388        }
11389    }
11390
11391    impl wkt::message::Message for StageInfo {
11392        fn typename() -> &'static str {
11393            "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterResponse.StageInfo"
11394        }
11395    }
11396
11397    /// Details regarding the upgrade of instances associated with a cluster.
11398    #[derive(Clone, Default, PartialEq)]
11399    #[non_exhaustive]
11400    pub struct InstanceUpgradeDetails {
11401        /// Normalized name of the instance.
11402        pub name: std::string::String,
11403
11404        /// Upgrade status of the instance.
11405        pub upgrade_status: crate::model::upgrade_cluster_response::Status,
11406
11407        /// Instance type.
11408        pub instance_type: crate::model::instance::InstanceType,
11409
11410        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11411    }
11412
11413    impl InstanceUpgradeDetails {
11414        pub fn new() -> Self {
11415            std::default::Default::default()
11416        }
11417
11418        /// Sets the value of [name][crate::model::upgrade_cluster_response::InstanceUpgradeDetails::name].
11419        ///
11420        /// # Example
11421        /// ```ignore,no_run
11422        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::InstanceUpgradeDetails;
11423        /// let x = InstanceUpgradeDetails::new().set_name("example");
11424        /// ```
11425        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11426            self.name = v.into();
11427            self
11428        }
11429
11430        /// Sets the value of [upgrade_status][crate::model::upgrade_cluster_response::InstanceUpgradeDetails::upgrade_status].
11431        ///
11432        /// # Example
11433        /// ```ignore,no_run
11434        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::InstanceUpgradeDetails;
11435        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
11436        /// let x0 = InstanceUpgradeDetails::new().set_upgrade_status(Status::NotStarted);
11437        /// let x1 = InstanceUpgradeDetails::new().set_upgrade_status(Status::InProgress);
11438        /// let x2 = InstanceUpgradeDetails::new().set_upgrade_status(Status::Success);
11439        /// ```
11440        pub fn set_upgrade_status<
11441            T: std::convert::Into<crate::model::upgrade_cluster_response::Status>,
11442        >(
11443            mut self,
11444            v: T,
11445        ) -> Self {
11446            self.upgrade_status = v.into();
11447            self
11448        }
11449
11450        /// Sets the value of [instance_type][crate::model::upgrade_cluster_response::InstanceUpgradeDetails::instance_type].
11451        ///
11452        /// # Example
11453        /// ```ignore,no_run
11454        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::InstanceUpgradeDetails;
11455        /// use google_cloud_alloydb_v1::model::instance::InstanceType;
11456        /// let x0 = InstanceUpgradeDetails::new().set_instance_type(InstanceType::Primary);
11457        /// let x1 = InstanceUpgradeDetails::new().set_instance_type(InstanceType::ReadPool);
11458        /// let x2 = InstanceUpgradeDetails::new().set_instance_type(InstanceType::Secondary);
11459        /// ```
11460        pub fn set_instance_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
11461            mut self,
11462            v: T,
11463        ) -> Self {
11464            self.instance_type = v.into();
11465            self
11466        }
11467    }
11468
11469    impl wkt::message::Message for InstanceUpgradeDetails {
11470        fn typename() -> &'static str {
11471            "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterResponse.InstanceUpgradeDetails"
11472        }
11473    }
11474
11475    /// Upgrade details of a cluster. This cluster can be primary or secondary.
11476    #[derive(Clone, Default, PartialEq)]
11477    #[non_exhaustive]
11478    pub struct ClusterUpgradeDetails {
11479        /// Normalized name of the cluster
11480        pub name: std::string::String,
11481
11482        /// Upgrade status of the cluster.
11483        pub upgrade_status: crate::model::upgrade_cluster_response::Status,
11484
11485        /// Cluster type which can either be primary or secondary.
11486        pub cluster_type: crate::model::cluster::ClusterType,
11487
11488        /// Database version of the cluster after the upgrade operation. This will be
11489        /// the target version if the upgrade was successful otherwise it remains the
11490        /// same as that before the upgrade operation.
11491        pub database_version: crate::model::DatabaseVersion,
11492
11493        /// Array containing stage info associated with this cluster.
11494        pub stage_info: std::vec::Vec<crate::model::upgrade_cluster_response::StageInfo>,
11495
11496        /// Upgrade details of the instances directly associated with this cluster.
11497        pub instance_upgrade_details:
11498            std::vec::Vec<crate::model::upgrade_cluster_response::InstanceUpgradeDetails>,
11499
11500        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11501    }
11502
11503    impl ClusterUpgradeDetails {
11504        pub fn new() -> Self {
11505            std::default::Default::default()
11506        }
11507
11508        /// Sets the value of [name][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::name].
11509        ///
11510        /// # Example
11511        /// ```ignore,no_run
11512        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11513        /// let x = ClusterUpgradeDetails::new().set_name("example");
11514        /// ```
11515        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11516            self.name = v.into();
11517            self
11518        }
11519
11520        /// Sets the value of [upgrade_status][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::upgrade_status].
11521        ///
11522        /// # Example
11523        /// ```ignore,no_run
11524        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11525        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
11526        /// let x0 = ClusterUpgradeDetails::new().set_upgrade_status(Status::NotStarted);
11527        /// let x1 = ClusterUpgradeDetails::new().set_upgrade_status(Status::InProgress);
11528        /// let x2 = ClusterUpgradeDetails::new().set_upgrade_status(Status::Success);
11529        /// ```
11530        pub fn set_upgrade_status<
11531            T: std::convert::Into<crate::model::upgrade_cluster_response::Status>,
11532        >(
11533            mut self,
11534            v: T,
11535        ) -> Self {
11536            self.upgrade_status = v.into();
11537            self
11538        }
11539
11540        /// Sets the value of [cluster_type][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::cluster_type].
11541        ///
11542        /// # Example
11543        /// ```ignore,no_run
11544        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11545        /// use google_cloud_alloydb_v1::model::cluster::ClusterType;
11546        /// let x0 = ClusterUpgradeDetails::new().set_cluster_type(ClusterType::Primary);
11547        /// let x1 = ClusterUpgradeDetails::new().set_cluster_type(ClusterType::Secondary);
11548        /// ```
11549        pub fn set_cluster_type<T: std::convert::Into<crate::model::cluster::ClusterType>>(
11550            mut self,
11551            v: T,
11552        ) -> Self {
11553            self.cluster_type = v.into();
11554            self
11555        }
11556
11557        /// Sets the value of [database_version][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::database_version].
11558        ///
11559        /// # Example
11560        /// ```ignore,no_run
11561        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11562        /// use google_cloud_alloydb_v1::model::DatabaseVersion;
11563        /// let x0 = ClusterUpgradeDetails::new().set_database_version(DatabaseVersion::Postgres14);
11564        /// let x1 = ClusterUpgradeDetails::new().set_database_version(DatabaseVersion::Postgres15);
11565        /// let x2 = ClusterUpgradeDetails::new().set_database_version(DatabaseVersion::Postgres16);
11566        /// ```
11567        pub fn set_database_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
11568            mut self,
11569            v: T,
11570        ) -> Self {
11571            self.database_version = v.into();
11572            self
11573        }
11574
11575        /// Sets the value of [stage_info][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::stage_info].
11576        ///
11577        /// # Example
11578        /// ```ignore,no_run
11579        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11580        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::StageInfo;
11581        /// let x = ClusterUpgradeDetails::new()
11582        ///     .set_stage_info([
11583        ///         StageInfo::default()/* use setters */,
11584        ///         StageInfo::default()/* use (different) setters */,
11585        ///     ]);
11586        /// ```
11587        pub fn set_stage_info<T, V>(mut self, v: T) -> Self
11588        where
11589            T: std::iter::IntoIterator<Item = V>,
11590            V: std::convert::Into<crate::model::upgrade_cluster_response::StageInfo>,
11591        {
11592            use std::iter::Iterator;
11593            self.stage_info = v.into_iter().map(|i| i.into()).collect();
11594            self
11595        }
11596
11597        /// Sets the value of [instance_upgrade_details][crate::model::upgrade_cluster_response::ClusterUpgradeDetails::instance_upgrade_details].
11598        ///
11599        /// # Example
11600        /// ```ignore,no_run
11601        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_response::ClusterUpgradeDetails;
11602        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::InstanceUpgradeDetails;
11603        /// let x = ClusterUpgradeDetails::new()
11604        ///     .set_instance_upgrade_details([
11605        ///         InstanceUpgradeDetails::default()/* use setters */,
11606        ///         InstanceUpgradeDetails::default()/* use (different) setters */,
11607        ///     ]);
11608        /// ```
11609        pub fn set_instance_upgrade_details<T, V>(mut self, v: T) -> Self
11610        where
11611            T: std::iter::IntoIterator<Item = V>,
11612            V: std::convert::Into<crate::model::upgrade_cluster_response::InstanceUpgradeDetails>,
11613        {
11614            use std::iter::Iterator;
11615            self.instance_upgrade_details = v.into_iter().map(|i| i.into()).collect();
11616            self
11617        }
11618    }
11619
11620    impl wkt::message::Message for ClusterUpgradeDetails {
11621        fn typename() -> &'static str {
11622            "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterResponse.ClusterUpgradeDetails"
11623        }
11624    }
11625
11626    /// Status of upgrade operation.
11627    ///
11628    /// # Working with unknown values
11629    ///
11630    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11631    /// additional enum variants at any time. Adding new variants is not considered
11632    /// a breaking change. Applications should write their code in anticipation of:
11633    ///
11634    /// - New values appearing in future releases of the client library, **and**
11635    /// - New values received dynamically, without application changes.
11636    ///
11637    /// Please consult the [Working with enums] section in the user guide for some
11638    /// guidelines.
11639    ///
11640    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11641    #[derive(Clone, Debug, PartialEq)]
11642    #[non_exhaustive]
11643    pub enum Status {
11644        /// Unspecified status.
11645        Unspecified,
11646        /// Not started.
11647        NotStarted,
11648        /// In progress.
11649        InProgress,
11650        /// Operation succeeded.
11651        Success,
11652        /// Operation failed.
11653        Failed,
11654        /// Operation partially succeeded.
11655        PartialSuccess,
11656        /// Cancel is in progress.
11657        CancelInProgress,
11658        /// Cancellation complete.
11659        Cancelled,
11660        /// If set, the enum was initialized with an unknown value.
11661        ///
11662        /// Applications can examine the value using [Status::value] or
11663        /// [Status::name].
11664        UnknownValue(status::UnknownValue),
11665    }
11666
11667    #[doc(hidden)]
11668    pub mod status {
11669        #[allow(unused_imports)]
11670        use super::*;
11671        #[derive(Clone, Debug, PartialEq)]
11672        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11673    }
11674
11675    impl Status {
11676        /// Gets the enum value.
11677        ///
11678        /// Returns `None` if the enum contains an unknown value deserialized from
11679        /// the string representation of enums.
11680        pub fn value(&self) -> std::option::Option<i32> {
11681            match self {
11682                Self::Unspecified => std::option::Option::Some(0),
11683                Self::NotStarted => std::option::Option::Some(4),
11684                Self::InProgress => std::option::Option::Some(5),
11685                Self::Success => std::option::Option::Some(1),
11686                Self::Failed => std::option::Option::Some(2),
11687                Self::PartialSuccess => std::option::Option::Some(3),
11688                Self::CancelInProgress => std::option::Option::Some(6),
11689                Self::Cancelled => std::option::Option::Some(7),
11690                Self::UnknownValue(u) => u.0.value(),
11691            }
11692        }
11693
11694        /// Gets the enum value as a string.
11695        ///
11696        /// Returns `None` if the enum contains an unknown value deserialized from
11697        /// the integer representation of enums.
11698        pub fn name(&self) -> std::option::Option<&str> {
11699            match self {
11700                Self::Unspecified => std::option::Option::Some("STATUS_UNSPECIFIED"),
11701                Self::NotStarted => std::option::Option::Some("NOT_STARTED"),
11702                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
11703                Self::Success => std::option::Option::Some("SUCCESS"),
11704                Self::Failed => std::option::Option::Some("FAILED"),
11705                Self::PartialSuccess => std::option::Option::Some("PARTIAL_SUCCESS"),
11706                Self::CancelInProgress => std::option::Option::Some("CANCEL_IN_PROGRESS"),
11707                Self::Cancelled => std::option::Option::Some("CANCELLED"),
11708                Self::UnknownValue(u) => u.0.name(),
11709            }
11710        }
11711    }
11712
11713    impl std::default::Default for Status {
11714        fn default() -> Self {
11715            use std::convert::From;
11716            Self::from(0)
11717        }
11718    }
11719
11720    impl std::fmt::Display for Status {
11721        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11722            wkt::internal::display_enum(f, self.name(), self.value())
11723        }
11724    }
11725
11726    impl std::convert::From<i32> for Status {
11727        fn from(value: i32) -> Self {
11728            match value {
11729                0 => Self::Unspecified,
11730                1 => Self::Success,
11731                2 => Self::Failed,
11732                3 => Self::PartialSuccess,
11733                4 => Self::NotStarted,
11734                5 => Self::InProgress,
11735                6 => Self::CancelInProgress,
11736                7 => Self::Cancelled,
11737                _ => Self::UnknownValue(status::UnknownValue(
11738                    wkt::internal::UnknownEnumValue::Integer(value),
11739                )),
11740            }
11741        }
11742    }
11743
11744    impl std::convert::From<&str> for Status {
11745        fn from(value: &str) -> Self {
11746            use std::string::ToString;
11747            match value {
11748                "STATUS_UNSPECIFIED" => Self::Unspecified,
11749                "NOT_STARTED" => Self::NotStarted,
11750                "IN_PROGRESS" => Self::InProgress,
11751                "SUCCESS" => Self::Success,
11752                "FAILED" => Self::Failed,
11753                "PARTIAL_SUCCESS" => Self::PartialSuccess,
11754                "CANCEL_IN_PROGRESS" => Self::CancelInProgress,
11755                "CANCELLED" => Self::Cancelled,
11756                _ => Self::UnknownValue(status::UnknownValue(
11757                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11758                )),
11759            }
11760        }
11761    }
11762
11763    impl serde::ser::Serialize for Status {
11764        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11765        where
11766            S: serde::Serializer,
11767        {
11768            match self {
11769                Self::Unspecified => serializer.serialize_i32(0),
11770                Self::NotStarted => serializer.serialize_i32(4),
11771                Self::InProgress => serializer.serialize_i32(5),
11772                Self::Success => serializer.serialize_i32(1),
11773                Self::Failed => serializer.serialize_i32(2),
11774                Self::PartialSuccess => serializer.serialize_i32(3),
11775                Self::CancelInProgress => serializer.serialize_i32(6),
11776                Self::Cancelled => serializer.serialize_i32(7),
11777                Self::UnknownValue(u) => u.0.serialize(serializer),
11778            }
11779        }
11780    }
11781
11782    impl<'de> serde::de::Deserialize<'de> for Status {
11783        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11784        where
11785            D: serde::Deserializer<'de>,
11786        {
11787            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
11788                ".google.cloud.alloydb.v1.UpgradeClusterResponse.Status",
11789            ))
11790        }
11791    }
11792
11793    /// Stage in the upgrade.
11794    ///
11795    /// # Working with unknown values
11796    ///
11797    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11798    /// additional enum variants at any time. Adding new variants is not considered
11799    /// a breaking change. Applications should write their code in anticipation of:
11800    ///
11801    /// - New values appearing in future releases of the client library, **and**
11802    /// - New values received dynamically, without application changes.
11803    ///
11804    /// Please consult the [Working with enums] section in the user guide for some
11805    /// guidelines.
11806    ///
11807    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11808    #[derive(Clone, Debug, PartialEq)]
11809    #[non_exhaustive]
11810    pub enum Stage {
11811        /// Unspecified stage.
11812        Unspecified,
11813        /// Pre-upgrade custom checks, not covered by pg_upgrade.
11814        AlloydbPrecheck,
11815        /// Pre-upgrade pg_upgrade checks.
11816        PgUpgradeCheck,
11817        /// Clone the original cluster.
11818        PrepareForUpgrade,
11819        /// Upgrade the primary instance(downtime).
11820        PrimaryInstanceUpgrade,
11821        /// This stage is read pool upgrade.
11822        ReadPoolInstancesUpgrade,
11823        /// Rollback in case of critical failures.
11824        Rollback,
11825        /// Cleanup.
11826        Cleanup,
11827        /// If set, the enum was initialized with an unknown value.
11828        ///
11829        /// Applications can examine the value using [Stage::value] or
11830        /// [Stage::name].
11831        UnknownValue(stage::UnknownValue),
11832    }
11833
11834    #[doc(hidden)]
11835    pub mod stage {
11836        #[allow(unused_imports)]
11837        use super::*;
11838        #[derive(Clone, Debug, PartialEq)]
11839        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11840    }
11841
11842    impl Stage {
11843        /// Gets the enum value.
11844        ///
11845        /// Returns `None` if the enum contains an unknown value deserialized from
11846        /// the string representation of enums.
11847        pub fn value(&self) -> std::option::Option<i32> {
11848            match self {
11849                Self::Unspecified => std::option::Option::Some(0),
11850                Self::AlloydbPrecheck => std::option::Option::Some(1),
11851                Self::PgUpgradeCheck => std::option::Option::Some(2),
11852                Self::PrepareForUpgrade => std::option::Option::Some(5),
11853                Self::PrimaryInstanceUpgrade => std::option::Option::Some(3),
11854                Self::ReadPoolInstancesUpgrade => std::option::Option::Some(4),
11855                Self::Rollback => std::option::Option::Some(6),
11856                Self::Cleanup => std::option::Option::Some(7),
11857                Self::UnknownValue(u) => u.0.value(),
11858            }
11859        }
11860
11861        /// Gets the enum value as a string.
11862        ///
11863        /// Returns `None` if the enum contains an unknown value deserialized from
11864        /// the integer representation of enums.
11865        pub fn name(&self) -> std::option::Option<&str> {
11866            match self {
11867                Self::Unspecified => std::option::Option::Some("STAGE_UNSPECIFIED"),
11868                Self::AlloydbPrecheck => std::option::Option::Some("ALLOYDB_PRECHECK"),
11869                Self::PgUpgradeCheck => std::option::Option::Some("PG_UPGRADE_CHECK"),
11870                Self::PrepareForUpgrade => std::option::Option::Some("PREPARE_FOR_UPGRADE"),
11871                Self::PrimaryInstanceUpgrade => {
11872                    std::option::Option::Some("PRIMARY_INSTANCE_UPGRADE")
11873                }
11874                Self::ReadPoolInstancesUpgrade => {
11875                    std::option::Option::Some("READ_POOL_INSTANCES_UPGRADE")
11876                }
11877                Self::Rollback => std::option::Option::Some("ROLLBACK"),
11878                Self::Cleanup => std::option::Option::Some("CLEANUP"),
11879                Self::UnknownValue(u) => u.0.name(),
11880            }
11881        }
11882    }
11883
11884    impl std::default::Default for Stage {
11885        fn default() -> Self {
11886            use std::convert::From;
11887            Self::from(0)
11888        }
11889    }
11890
11891    impl std::fmt::Display for Stage {
11892        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11893            wkt::internal::display_enum(f, self.name(), self.value())
11894        }
11895    }
11896
11897    impl std::convert::From<i32> for Stage {
11898        fn from(value: i32) -> Self {
11899            match value {
11900                0 => Self::Unspecified,
11901                1 => Self::AlloydbPrecheck,
11902                2 => Self::PgUpgradeCheck,
11903                3 => Self::PrimaryInstanceUpgrade,
11904                4 => Self::ReadPoolInstancesUpgrade,
11905                5 => Self::PrepareForUpgrade,
11906                6 => Self::Rollback,
11907                7 => Self::Cleanup,
11908                _ => Self::UnknownValue(stage::UnknownValue(
11909                    wkt::internal::UnknownEnumValue::Integer(value),
11910                )),
11911            }
11912        }
11913    }
11914
11915    impl std::convert::From<&str> for Stage {
11916        fn from(value: &str) -> Self {
11917            use std::string::ToString;
11918            match value {
11919                "STAGE_UNSPECIFIED" => Self::Unspecified,
11920                "ALLOYDB_PRECHECK" => Self::AlloydbPrecheck,
11921                "PG_UPGRADE_CHECK" => Self::PgUpgradeCheck,
11922                "PREPARE_FOR_UPGRADE" => Self::PrepareForUpgrade,
11923                "PRIMARY_INSTANCE_UPGRADE" => Self::PrimaryInstanceUpgrade,
11924                "READ_POOL_INSTANCES_UPGRADE" => Self::ReadPoolInstancesUpgrade,
11925                "ROLLBACK" => Self::Rollback,
11926                "CLEANUP" => Self::Cleanup,
11927                _ => Self::UnknownValue(stage::UnknownValue(
11928                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11929                )),
11930            }
11931        }
11932    }
11933
11934    impl serde::ser::Serialize for Stage {
11935        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11936        where
11937            S: serde::Serializer,
11938        {
11939            match self {
11940                Self::Unspecified => serializer.serialize_i32(0),
11941                Self::AlloydbPrecheck => serializer.serialize_i32(1),
11942                Self::PgUpgradeCheck => serializer.serialize_i32(2),
11943                Self::PrepareForUpgrade => serializer.serialize_i32(5),
11944                Self::PrimaryInstanceUpgrade => serializer.serialize_i32(3),
11945                Self::ReadPoolInstancesUpgrade => serializer.serialize_i32(4),
11946                Self::Rollback => serializer.serialize_i32(6),
11947                Self::Cleanup => serializer.serialize_i32(7),
11948                Self::UnknownValue(u) => u.0.serialize(serializer),
11949            }
11950        }
11951    }
11952
11953    impl<'de> serde::de::Deserialize<'de> for Stage {
11954        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11955        where
11956            D: serde::Deserializer<'de>,
11957        {
11958            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Stage>::new(
11959                ".google.cloud.alloydb.v1.UpgradeClusterResponse.Stage",
11960            ))
11961        }
11962    }
11963}
11964
11965/// Message for deleting a Cluster
11966#[derive(Clone, Default, PartialEq)]
11967#[non_exhaustive]
11968pub struct DeleteClusterRequest {
11969    /// Required. The name of the resource. For the required format, see the
11970    /// comment on the Cluster.name field.
11971    pub name: std::string::String,
11972
11973    /// Optional. An optional request ID to identify requests. Specify a unique
11974    /// request ID so that if you must retry your request, the server ignores the
11975    /// request if it has already been completed. The server guarantees that for at
11976    /// least 60 minutes since the first request.
11977    ///
11978    /// For example, consider a situation where you make an initial request and
11979    /// the request times out. If you make the request again with the same request
11980    /// ID, the server can check if the original operation with the same request ID
11981    /// was received, and if so, ignores the second request. This prevents
11982    /// clients from accidentally creating duplicate commitments.
11983    ///
11984    /// The request ID must be a valid UUID with the exception that zero UUID is
11985    /// not supported (00000000-0000-0000-0000-000000000000).
11986    pub request_id: std::string::String,
11987
11988    /// Optional. The current etag of the Cluster.
11989    /// If an etag is provided and does not match the current etag of the Cluster,
11990    /// deletion will be blocked and an ABORTED error will be returned.
11991    pub etag: std::string::String,
11992
11993    /// Optional. If set, performs request validation, for example, permission
11994    /// checks and any other type of validation, but does not actually execute the
11995    /// create request.
11996    pub validate_only: bool,
11997
11998    /// Optional. Whether to cascade delete child instances for given cluster.
11999    pub force: bool,
12000
12001    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12002}
12003
12004impl DeleteClusterRequest {
12005    pub fn new() -> Self {
12006        std::default::Default::default()
12007    }
12008
12009    /// Sets the value of [name][crate::model::DeleteClusterRequest::name].
12010    ///
12011    /// # Example
12012    /// ```ignore,no_run
12013    /// # use google_cloud_alloydb_v1::model::DeleteClusterRequest;
12014    /// let x = DeleteClusterRequest::new().set_name("example");
12015    /// ```
12016    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12017        self.name = v.into();
12018        self
12019    }
12020
12021    /// Sets the value of [request_id][crate::model::DeleteClusterRequest::request_id].
12022    ///
12023    /// # Example
12024    /// ```ignore,no_run
12025    /// # use google_cloud_alloydb_v1::model::DeleteClusterRequest;
12026    /// let x = DeleteClusterRequest::new().set_request_id("example");
12027    /// ```
12028    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12029        self.request_id = v.into();
12030        self
12031    }
12032
12033    /// Sets the value of [etag][crate::model::DeleteClusterRequest::etag].
12034    ///
12035    /// # Example
12036    /// ```ignore,no_run
12037    /// # use google_cloud_alloydb_v1::model::DeleteClusterRequest;
12038    /// let x = DeleteClusterRequest::new().set_etag("example");
12039    /// ```
12040    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12041        self.etag = v.into();
12042        self
12043    }
12044
12045    /// Sets the value of [validate_only][crate::model::DeleteClusterRequest::validate_only].
12046    ///
12047    /// # Example
12048    /// ```ignore,no_run
12049    /// # use google_cloud_alloydb_v1::model::DeleteClusterRequest;
12050    /// let x = DeleteClusterRequest::new().set_validate_only(true);
12051    /// ```
12052    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12053        self.validate_only = v.into();
12054        self
12055    }
12056
12057    /// Sets the value of [force][crate::model::DeleteClusterRequest::force].
12058    ///
12059    /// # Example
12060    /// ```ignore,no_run
12061    /// # use google_cloud_alloydb_v1::model::DeleteClusterRequest;
12062    /// let x = DeleteClusterRequest::new().set_force(true);
12063    /// ```
12064    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12065        self.force = v.into();
12066        self
12067    }
12068}
12069
12070impl wkt::message::Message for DeleteClusterRequest {
12071    fn typename() -> &'static str {
12072        "type.googleapis.com/google.cloud.alloydb.v1.DeleteClusterRequest"
12073    }
12074}
12075
12076/// Message for switching over to a cluster
12077#[derive(Clone, Default, PartialEq)]
12078#[non_exhaustive]
12079pub struct SwitchoverClusterRequest {
12080    /// Required. The name of the resource. For the required format, see the
12081    /// comment on the Cluster.name field
12082    pub name: std::string::String,
12083
12084    /// Optional. An optional request ID to identify requests. Specify a unique
12085    /// request ID so that if you must retry your request, the server ignores the
12086    /// request if it has already been completed. The server guarantees that for at
12087    /// least 60 minutes since the first request.
12088    ///
12089    /// For example, consider a situation where you make an initial request and
12090    /// the request times out. If you make the request again with the same request
12091    /// ID, the server can check if the original operation with the same request ID
12092    /// was received, and if so, ignores the second request. This prevents
12093    /// clients from accidentally creating duplicate commitments.
12094    ///
12095    /// The request ID must be a valid UUID with the exception that zero UUID is
12096    /// not supported (00000000-0000-0000-0000-000000000000).
12097    pub request_id: std::string::String,
12098
12099    /// Optional. If set, performs request validation, for example, permission
12100    /// checks and any other type of validation, but does not actually execute the
12101    /// create request.
12102    pub validate_only: bool,
12103
12104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12105}
12106
12107impl SwitchoverClusterRequest {
12108    pub fn new() -> Self {
12109        std::default::Default::default()
12110    }
12111
12112    /// Sets the value of [name][crate::model::SwitchoverClusterRequest::name].
12113    ///
12114    /// # Example
12115    /// ```ignore,no_run
12116    /// # use google_cloud_alloydb_v1::model::SwitchoverClusterRequest;
12117    /// let x = SwitchoverClusterRequest::new().set_name("example");
12118    /// ```
12119    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12120        self.name = v.into();
12121        self
12122    }
12123
12124    /// Sets the value of [request_id][crate::model::SwitchoverClusterRequest::request_id].
12125    ///
12126    /// # Example
12127    /// ```ignore,no_run
12128    /// # use google_cloud_alloydb_v1::model::SwitchoverClusterRequest;
12129    /// let x = SwitchoverClusterRequest::new().set_request_id("example");
12130    /// ```
12131    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12132        self.request_id = v.into();
12133        self
12134    }
12135
12136    /// Sets the value of [validate_only][crate::model::SwitchoverClusterRequest::validate_only].
12137    ///
12138    /// # Example
12139    /// ```ignore,no_run
12140    /// # use google_cloud_alloydb_v1::model::SwitchoverClusterRequest;
12141    /// let x = SwitchoverClusterRequest::new().set_validate_only(true);
12142    /// ```
12143    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12144        self.validate_only = v.into();
12145        self
12146    }
12147}
12148
12149impl wkt::message::Message for SwitchoverClusterRequest {
12150    fn typename() -> &'static str {
12151        "type.googleapis.com/google.cloud.alloydb.v1.SwitchoverClusterRequest"
12152    }
12153}
12154
12155/// Message for promoting a Cluster
12156#[derive(Clone, Default, PartialEq)]
12157#[non_exhaustive]
12158pub struct PromoteClusterRequest {
12159    /// Required. The name of the resource. For the required format, see the
12160    /// comment on the Cluster.name field
12161    pub name: std::string::String,
12162
12163    /// Optional. An optional request ID to identify requests. Specify a unique
12164    /// request ID so that if you must retry your request, the server ignores the
12165    /// request if it has already been completed. The server guarantees that for at
12166    /// least 60 minutes since the first request.
12167    ///
12168    /// For example, consider a situation where you make an initial request and
12169    /// the request times out. If you make the request again with the same request
12170    /// ID, the server can check if original operation with the same request ID
12171    /// was received, and if so, will ignore the second request. This prevents
12172    /// clients from accidentally creating duplicate commitments.
12173    ///
12174    /// The request ID must be a valid UUID with the exception that zero UUID is
12175    /// not supported (00000000-0000-0000-0000-000000000000).
12176    pub request_id: std::string::String,
12177
12178    /// Optional. The current etag of the Cluster.
12179    /// If an etag is provided and does not match the current etag of the Cluster,
12180    /// deletion will be blocked and an ABORTED error will be returned.
12181    pub etag: std::string::String,
12182
12183    /// Optional. If set, performs request validation, for example, permission
12184    /// checks and any other type of validation, but does not actually execute the
12185    /// create request.
12186    pub validate_only: bool,
12187
12188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12189}
12190
12191impl PromoteClusterRequest {
12192    pub fn new() -> Self {
12193        std::default::Default::default()
12194    }
12195
12196    /// Sets the value of [name][crate::model::PromoteClusterRequest::name].
12197    ///
12198    /// # Example
12199    /// ```ignore,no_run
12200    /// # use google_cloud_alloydb_v1::model::PromoteClusterRequest;
12201    /// let x = PromoteClusterRequest::new().set_name("example");
12202    /// ```
12203    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12204        self.name = v.into();
12205        self
12206    }
12207
12208    /// Sets the value of [request_id][crate::model::PromoteClusterRequest::request_id].
12209    ///
12210    /// # Example
12211    /// ```ignore,no_run
12212    /// # use google_cloud_alloydb_v1::model::PromoteClusterRequest;
12213    /// let x = PromoteClusterRequest::new().set_request_id("example");
12214    /// ```
12215    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12216        self.request_id = v.into();
12217        self
12218    }
12219
12220    /// Sets the value of [etag][crate::model::PromoteClusterRequest::etag].
12221    ///
12222    /// # Example
12223    /// ```ignore,no_run
12224    /// # use google_cloud_alloydb_v1::model::PromoteClusterRequest;
12225    /// let x = PromoteClusterRequest::new().set_etag("example");
12226    /// ```
12227    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12228        self.etag = v.into();
12229        self
12230    }
12231
12232    /// Sets the value of [validate_only][crate::model::PromoteClusterRequest::validate_only].
12233    ///
12234    /// # Example
12235    /// ```ignore,no_run
12236    /// # use google_cloud_alloydb_v1::model::PromoteClusterRequest;
12237    /// let x = PromoteClusterRequest::new().set_validate_only(true);
12238    /// ```
12239    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12240        self.validate_only = v.into();
12241        self
12242    }
12243}
12244
12245impl wkt::message::Message for PromoteClusterRequest {
12246    fn typename() -> &'static str {
12247        "type.googleapis.com/google.cloud.alloydb.v1.PromoteClusterRequest"
12248    }
12249}
12250
12251/// Message for restoring a Cluster from a backup or another cluster at a given
12252/// point in time.
12253/// NEXT_ID: 11
12254#[derive(Clone, Default, PartialEq)]
12255#[non_exhaustive]
12256pub struct RestoreClusterRequest {
12257    /// Required. The name of the parent resource. For the required format, see the
12258    /// comment on the Cluster.name field.
12259    pub parent: std::string::String,
12260
12261    /// Required. ID of the requesting object.
12262    pub cluster_id: std::string::String,
12263
12264    /// Required. The resource being created
12265    pub cluster: std::option::Option<crate::model::Cluster>,
12266
12267    /// Optional. An optional request ID to identify requests. Specify a unique
12268    /// request ID so that if you must retry your request, the server ignores the
12269    /// request if it has already been completed. The server guarantees that for at
12270    /// least 60 minutes since the first request.
12271    ///
12272    /// For example, consider a situation where you make an initial request and
12273    /// the request times out. If you make the request again with the same request
12274    /// ID, the server can check if the original operation with the same request ID
12275    /// was received, and if so, ignores the second request. This prevents
12276    /// clients from accidentally creating duplicate commitments.
12277    ///
12278    /// The request ID must be a valid UUID with the exception that zero UUID is
12279    /// not supported (00000000-0000-0000-0000-000000000000).
12280    pub request_id: std::string::String,
12281
12282    /// Optional. If set, performs request validation, for example, permission
12283    /// checks and any other type of validation, but does not actually execute the
12284    /// create request.
12285    pub validate_only: bool,
12286
12287    /// Required.
12288    /// The source to import from.
12289    pub source: std::option::Option<crate::model::restore_cluster_request::Source>,
12290
12291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12292}
12293
12294impl RestoreClusterRequest {
12295    pub fn new() -> Self {
12296        std::default::Default::default()
12297    }
12298
12299    /// Sets the value of [parent][crate::model::RestoreClusterRequest::parent].
12300    ///
12301    /// # Example
12302    /// ```ignore,no_run
12303    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12304    /// let x = RestoreClusterRequest::new().set_parent("example");
12305    /// ```
12306    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12307        self.parent = v.into();
12308        self
12309    }
12310
12311    /// Sets the value of [cluster_id][crate::model::RestoreClusterRequest::cluster_id].
12312    ///
12313    /// # Example
12314    /// ```ignore,no_run
12315    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12316    /// let x = RestoreClusterRequest::new().set_cluster_id("example");
12317    /// ```
12318    pub fn set_cluster_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12319        self.cluster_id = v.into();
12320        self
12321    }
12322
12323    /// Sets the value of [cluster][crate::model::RestoreClusterRequest::cluster].
12324    ///
12325    /// # Example
12326    /// ```ignore,no_run
12327    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12328    /// use google_cloud_alloydb_v1::model::Cluster;
12329    /// let x = RestoreClusterRequest::new().set_cluster(Cluster::default()/* use setters */);
12330    /// ```
12331    pub fn set_cluster<T>(mut self, v: T) -> Self
12332    where
12333        T: std::convert::Into<crate::model::Cluster>,
12334    {
12335        self.cluster = std::option::Option::Some(v.into());
12336        self
12337    }
12338
12339    /// Sets or clears the value of [cluster][crate::model::RestoreClusterRequest::cluster].
12340    ///
12341    /// # Example
12342    /// ```ignore,no_run
12343    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12344    /// use google_cloud_alloydb_v1::model::Cluster;
12345    /// let x = RestoreClusterRequest::new().set_or_clear_cluster(Some(Cluster::default()/* use setters */));
12346    /// let x = RestoreClusterRequest::new().set_or_clear_cluster(None::<Cluster>);
12347    /// ```
12348    pub fn set_or_clear_cluster<T>(mut self, v: std::option::Option<T>) -> Self
12349    where
12350        T: std::convert::Into<crate::model::Cluster>,
12351    {
12352        self.cluster = v.map(|x| x.into());
12353        self
12354    }
12355
12356    /// Sets the value of [request_id][crate::model::RestoreClusterRequest::request_id].
12357    ///
12358    /// # Example
12359    /// ```ignore,no_run
12360    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12361    /// let x = RestoreClusterRequest::new().set_request_id("example");
12362    /// ```
12363    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12364        self.request_id = v.into();
12365        self
12366    }
12367
12368    /// Sets the value of [validate_only][crate::model::RestoreClusterRequest::validate_only].
12369    ///
12370    /// # Example
12371    /// ```ignore,no_run
12372    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12373    /// let x = RestoreClusterRequest::new().set_validate_only(true);
12374    /// ```
12375    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12376        self.validate_only = v.into();
12377        self
12378    }
12379
12380    /// Sets the value of [source][crate::model::RestoreClusterRequest::source].
12381    ///
12382    /// Note that all the setters affecting `source` are mutually
12383    /// exclusive.
12384    ///
12385    /// # Example
12386    /// ```ignore,no_run
12387    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12388    /// use google_cloud_alloydb_v1::model::BackupSource;
12389    /// let x = RestoreClusterRequest::new().set_source(Some(
12390    ///     google_cloud_alloydb_v1::model::restore_cluster_request::Source::BackupSource(BackupSource::default().into())));
12391    /// ```
12392    pub fn set_source<
12393        T: std::convert::Into<std::option::Option<crate::model::restore_cluster_request::Source>>,
12394    >(
12395        mut self,
12396        v: T,
12397    ) -> Self {
12398        self.source = v.into();
12399        self
12400    }
12401
12402    /// The value of [source][crate::model::RestoreClusterRequest::source]
12403    /// if it holds a `BackupSource`, `None` if the field is not set or
12404    /// holds a different branch.
12405    pub fn backup_source(
12406        &self,
12407    ) -> std::option::Option<&std::boxed::Box<crate::model::BackupSource>> {
12408        #[allow(unreachable_patterns)]
12409        self.source.as_ref().and_then(|v| match v {
12410            crate::model::restore_cluster_request::Source::BackupSource(v) => {
12411                std::option::Option::Some(v)
12412            }
12413            _ => std::option::Option::None,
12414        })
12415    }
12416
12417    /// Sets the value of [source][crate::model::RestoreClusterRequest::source]
12418    /// to hold a `BackupSource`.
12419    ///
12420    /// Note that all the setters affecting `source` are
12421    /// mutually exclusive.
12422    ///
12423    /// # Example
12424    /// ```ignore,no_run
12425    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12426    /// use google_cloud_alloydb_v1::model::BackupSource;
12427    /// let x = RestoreClusterRequest::new().set_backup_source(BackupSource::default()/* use setters */);
12428    /// assert!(x.backup_source().is_some());
12429    /// assert!(x.continuous_backup_source().is_none());
12430    /// ```
12431    pub fn set_backup_source<T: std::convert::Into<std::boxed::Box<crate::model::BackupSource>>>(
12432        mut self,
12433        v: T,
12434    ) -> Self {
12435        self.source = std::option::Option::Some(
12436            crate::model::restore_cluster_request::Source::BackupSource(v.into()),
12437        );
12438        self
12439    }
12440
12441    /// The value of [source][crate::model::RestoreClusterRequest::source]
12442    /// if it holds a `ContinuousBackupSource`, `None` if the field is not set or
12443    /// holds a different branch.
12444    pub fn continuous_backup_source(
12445        &self,
12446    ) -> std::option::Option<&std::boxed::Box<crate::model::ContinuousBackupSource>> {
12447        #[allow(unreachable_patterns)]
12448        self.source.as_ref().and_then(|v| match v {
12449            crate::model::restore_cluster_request::Source::ContinuousBackupSource(v) => {
12450                std::option::Option::Some(v)
12451            }
12452            _ => std::option::Option::None,
12453        })
12454    }
12455
12456    /// Sets the value of [source][crate::model::RestoreClusterRequest::source]
12457    /// to hold a `ContinuousBackupSource`.
12458    ///
12459    /// Note that all the setters affecting `source` are
12460    /// mutually exclusive.
12461    ///
12462    /// # Example
12463    /// ```ignore,no_run
12464    /// # use google_cloud_alloydb_v1::model::RestoreClusterRequest;
12465    /// use google_cloud_alloydb_v1::model::ContinuousBackupSource;
12466    /// let x = RestoreClusterRequest::new().set_continuous_backup_source(ContinuousBackupSource::default()/* use setters */);
12467    /// assert!(x.continuous_backup_source().is_some());
12468    /// assert!(x.backup_source().is_none());
12469    /// ```
12470    pub fn set_continuous_backup_source<
12471        T: std::convert::Into<std::boxed::Box<crate::model::ContinuousBackupSource>>,
12472    >(
12473        mut self,
12474        v: T,
12475    ) -> Self {
12476        self.source = std::option::Option::Some(
12477            crate::model::restore_cluster_request::Source::ContinuousBackupSource(v.into()),
12478        );
12479        self
12480    }
12481}
12482
12483impl wkt::message::Message for RestoreClusterRequest {
12484    fn typename() -> &'static str {
12485        "type.googleapis.com/google.cloud.alloydb.v1.RestoreClusterRequest"
12486    }
12487}
12488
12489/// Defines additional types related to [RestoreClusterRequest].
12490pub mod restore_cluster_request {
12491    #[allow(unused_imports)]
12492    use super::*;
12493
12494    /// Required.
12495    /// The source to import from.
12496    #[derive(Clone, Debug, PartialEq)]
12497    #[non_exhaustive]
12498    pub enum Source {
12499        /// Backup source.
12500        BackupSource(std::boxed::Box<crate::model::BackupSource>),
12501        /// ContinuousBackup source. Continuous backup needs to be enabled in the
12502        /// source cluster for this operation to succeed.
12503        ContinuousBackupSource(std::boxed::Box<crate::model::ContinuousBackupSource>),
12504    }
12505}
12506
12507/// Message for requesting list of Instances
12508#[derive(Clone, Default, PartialEq)]
12509#[non_exhaustive]
12510pub struct ListInstancesRequest {
12511    /// Required. The name of the parent resource. For the required format, see the
12512    /// comment on the Instance.name field. Additionally, you can perform an
12513    /// aggregated list operation by specifying a value with one of the following
12514    /// formats:
12515    ///
12516    /// * projects/{project}/locations/-/clusters/-
12517    /// * projects/{project}/locations/{region}/clusters/-
12518    pub parent: std::string::String,
12519
12520    /// Optional. Requested page size. Server may return fewer items than
12521    /// requested. If unspecified, server will pick an appropriate default.
12522    pub page_size: i32,
12523
12524    /// A token identifying a page of results the server should return.
12525    pub page_token: std::string::String,
12526
12527    /// Optional. Filtering results
12528    pub filter: std::string::String,
12529
12530    /// Optional. Hint for how to order the results
12531    pub order_by: std::string::String,
12532
12533    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12534}
12535
12536impl ListInstancesRequest {
12537    pub fn new() -> Self {
12538        std::default::Default::default()
12539    }
12540
12541    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
12542    ///
12543    /// # Example
12544    /// ```ignore,no_run
12545    /// # use google_cloud_alloydb_v1::model::ListInstancesRequest;
12546    /// let x = ListInstancesRequest::new().set_parent("example");
12547    /// ```
12548    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12549        self.parent = v.into();
12550        self
12551    }
12552
12553    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
12554    ///
12555    /// # Example
12556    /// ```ignore,no_run
12557    /// # use google_cloud_alloydb_v1::model::ListInstancesRequest;
12558    /// let x = ListInstancesRequest::new().set_page_size(42);
12559    /// ```
12560    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12561        self.page_size = v.into();
12562        self
12563    }
12564
12565    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
12566    ///
12567    /// # Example
12568    /// ```ignore,no_run
12569    /// # use google_cloud_alloydb_v1::model::ListInstancesRequest;
12570    /// let x = ListInstancesRequest::new().set_page_token("example");
12571    /// ```
12572    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12573        self.page_token = v.into();
12574        self
12575    }
12576
12577    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
12578    ///
12579    /// # Example
12580    /// ```ignore,no_run
12581    /// # use google_cloud_alloydb_v1::model::ListInstancesRequest;
12582    /// let x = ListInstancesRequest::new().set_filter("example");
12583    /// ```
12584    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12585        self.filter = v.into();
12586        self
12587    }
12588
12589    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
12590    ///
12591    /// # Example
12592    /// ```ignore,no_run
12593    /// # use google_cloud_alloydb_v1::model::ListInstancesRequest;
12594    /// let x = ListInstancesRequest::new().set_order_by("example");
12595    /// ```
12596    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12597        self.order_by = v.into();
12598        self
12599    }
12600}
12601
12602impl wkt::message::Message for ListInstancesRequest {
12603    fn typename() -> &'static str {
12604        "type.googleapis.com/google.cloud.alloydb.v1.ListInstancesRequest"
12605    }
12606}
12607
12608/// Message for response to listing Instances
12609#[derive(Clone, Default, PartialEq)]
12610#[non_exhaustive]
12611pub struct ListInstancesResponse {
12612    /// The list of Instance
12613    pub instances: std::vec::Vec<crate::model::Instance>,
12614
12615    /// A token identifying a page of results the server should return.
12616    pub next_page_token: std::string::String,
12617
12618    /// Locations that could not be reached.
12619    pub unreachable: std::vec::Vec<std::string::String>,
12620
12621    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12622}
12623
12624impl ListInstancesResponse {
12625    pub fn new() -> Self {
12626        std::default::Default::default()
12627    }
12628
12629    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
12630    ///
12631    /// # Example
12632    /// ```ignore,no_run
12633    /// # use google_cloud_alloydb_v1::model::ListInstancesResponse;
12634    /// use google_cloud_alloydb_v1::model::Instance;
12635    /// let x = ListInstancesResponse::new()
12636    ///     .set_instances([
12637    ///         Instance::default()/* use setters */,
12638    ///         Instance::default()/* use (different) setters */,
12639    ///     ]);
12640    /// ```
12641    pub fn set_instances<T, V>(mut self, v: T) -> Self
12642    where
12643        T: std::iter::IntoIterator<Item = V>,
12644        V: std::convert::Into<crate::model::Instance>,
12645    {
12646        use std::iter::Iterator;
12647        self.instances = v.into_iter().map(|i| i.into()).collect();
12648        self
12649    }
12650
12651    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
12652    ///
12653    /// # Example
12654    /// ```ignore,no_run
12655    /// # use google_cloud_alloydb_v1::model::ListInstancesResponse;
12656    /// let x = ListInstancesResponse::new().set_next_page_token("example");
12657    /// ```
12658    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12659        self.next_page_token = v.into();
12660        self
12661    }
12662
12663    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
12664    ///
12665    /// # Example
12666    /// ```ignore,no_run
12667    /// # use google_cloud_alloydb_v1::model::ListInstancesResponse;
12668    /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
12669    /// ```
12670    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
12671    where
12672        T: std::iter::IntoIterator<Item = V>,
12673        V: std::convert::Into<std::string::String>,
12674    {
12675        use std::iter::Iterator;
12676        self.unreachable = v.into_iter().map(|i| i.into()).collect();
12677        self
12678    }
12679}
12680
12681impl wkt::message::Message for ListInstancesResponse {
12682    fn typename() -> &'static str {
12683        "type.googleapis.com/google.cloud.alloydb.v1.ListInstancesResponse"
12684    }
12685}
12686
12687#[doc(hidden)]
12688impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
12689    type PageItem = crate::model::Instance;
12690
12691    fn items(self) -> std::vec::Vec<Self::PageItem> {
12692        self.instances
12693    }
12694
12695    fn next_page_token(&self) -> std::string::String {
12696        use std::clone::Clone;
12697        self.next_page_token.clone()
12698    }
12699}
12700
12701/// Message for getting a Instance
12702#[derive(Clone, Default, PartialEq)]
12703#[non_exhaustive]
12704pub struct GetInstanceRequest {
12705    /// Required. The name of the resource. For the required format, see the
12706    /// comment on the Instance.name field.
12707    pub name: std::string::String,
12708
12709    /// The view of the instance to return.
12710    pub view: crate::model::InstanceView,
12711
12712    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12713}
12714
12715impl GetInstanceRequest {
12716    pub fn new() -> Self {
12717        std::default::Default::default()
12718    }
12719
12720    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
12721    ///
12722    /// # Example
12723    /// ```ignore,no_run
12724    /// # use google_cloud_alloydb_v1::model::GetInstanceRequest;
12725    /// let x = GetInstanceRequest::new().set_name("example");
12726    /// ```
12727    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12728        self.name = v.into();
12729        self
12730    }
12731
12732    /// Sets the value of [view][crate::model::GetInstanceRequest::view].
12733    ///
12734    /// # Example
12735    /// ```ignore,no_run
12736    /// # use google_cloud_alloydb_v1::model::GetInstanceRequest;
12737    /// use google_cloud_alloydb_v1::model::InstanceView;
12738    /// let x0 = GetInstanceRequest::new().set_view(InstanceView::Basic);
12739    /// let x1 = GetInstanceRequest::new().set_view(InstanceView::Full);
12740    /// ```
12741    pub fn set_view<T: std::convert::Into<crate::model::InstanceView>>(mut self, v: T) -> Self {
12742        self.view = v.into();
12743        self
12744    }
12745}
12746
12747impl wkt::message::Message for GetInstanceRequest {
12748    fn typename() -> &'static str {
12749        "type.googleapis.com/google.cloud.alloydb.v1.GetInstanceRequest"
12750    }
12751}
12752
12753/// Message for creating a Instance
12754#[derive(Clone, Default, PartialEq)]
12755#[non_exhaustive]
12756pub struct CreateInstanceRequest {
12757    /// Required. The name of the parent resource. For the required format, see the
12758    /// comment on the Instance.name field.
12759    pub parent: std::string::String,
12760
12761    /// Required. ID of the requesting object.
12762    pub instance_id: std::string::String,
12763
12764    /// Required. The resource being created
12765    pub instance: std::option::Option<crate::model::Instance>,
12766
12767    /// Optional. An optional request ID to identify requests. Specify a unique
12768    /// request ID so that if you must retry your request, the server ignores the
12769    /// request if it has already been completed. The server guarantees that for at
12770    /// least 60 minutes since the first request.
12771    ///
12772    /// For example, consider a situation where you make an initial request and
12773    /// the request times out. If you make the request again with the same request
12774    /// ID, the server can check if the original operation with the same request ID
12775    /// was received, and if so, ignores the second request. This prevents
12776    /// clients from accidentally creating duplicate commitments.
12777    ///
12778    /// The request ID must be a valid UUID with the exception that zero UUID is
12779    /// not supported (00000000-0000-0000-0000-000000000000).
12780    pub request_id: std::string::String,
12781
12782    /// Optional. If set, performs request validation, for example, permission
12783    /// checks and any other type of validation, but does not actually execute the
12784    /// create request.
12785    pub validate_only: bool,
12786
12787    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12788}
12789
12790impl CreateInstanceRequest {
12791    pub fn new() -> Self {
12792        std::default::Default::default()
12793    }
12794
12795    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
12796    ///
12797    /// # Example
12798    /// ```ignore,no_run
12799    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12800    /// let x = CreateInstanceRequest::new().set_parent("example");
12801    /// ```
12802    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12803        self.parent = v.into();
12804        self
12805    }
12806
12807    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
12808    ///
12809    /// # Example
12810    /// ```ignore,no_run
12811    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12812    /// let x = CreateInstanceRequest::new().set_instance_id("example");
12813    /// ```
12814    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12815        self.instance_id = v.into();
12816        self
12817    }
12818
12819    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
12820    ///
12821    /// # Example
12822    /// ```ignore,no_run
12823    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12824    /// use google_cloud_alloydb_v1::model::Instance;
12825    /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
12826    /// ```
12827    pub fn set_instance<T>(mut self, v: T) -> Self
12828    where
12829        T: std::convert::Into<crate::model::Instance>,
12830    {
12831        self.instance = std::option::Option::Some(v.into());
12832        self
12833    }
12834
12835    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
12836    ///
12837    /// # Example
12838    /// ```ignore,no_run
12839    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12840    /// use google_cloud_alloydb_v1::model::Instance;
12841    /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
12842    /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
12843    /// ```
12844    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
12845    where
12846        T: std::convert::Into<crate::model::Instance>,
12847    {
12848        self.instance = v.map(|x| x.into());
12849        self
12850    }
12851
12852    /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
12853    ///
12854    /// # Example
12855    /// ```ignore,no_run
12856    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12857    /// let x = CreateInstanceRequest::new().set_request_id("example");
12858    /// ```
12859    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12860        self.request_id = v.into();
12861        self
12862    }
12863
12864    /// Sets the value of [validate_only][crate::model::CreateInstanceRequest::validate_only].
12865    ///
12866    /// # Example
12867    /// ```ignore,no_run
12868    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequest;
12869    /// let x = CreateInstanceRequest::new().set_validate_only(true);
12870    /// ```
12871    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12872        self.validate_only = v.into();
12873        self
12874    }
12875}
12876
12877impl wkt::message::Message for CreateInstanceRequest {
12878    fn typename() -> &'static str {
12879        "type.googleapis.com/google.cloud.alloydb.v1.CreateInstanceRequest"
12880    }
12881}
12882
12883/// Message for creating a Secondary Instance
12884#[derive(Clone, Default, PartialEq)]
12885#[non_exhaustive]
12886pub struct CreateSecondaryInstanceRequest {
12887    /// Required. The name of the parent resource. For the required format, see the
12888    /// comment on the Instance.name field.
12889    pub parent: std::string::String,
12890
12891    /// Required. ID of the requesting object.
12892    pub instance_id: std::string::String,
12893
12894    /// Required. The resource being created
12895    pub instance: std::option::Option<crate::model::Instance>,
12896
12897    /// Optional. An optional request ID to identify requests. Specify a unique
12898    /// request ID so that if you must retry your request, the server ignores the
12899    /// request if it has already been completed. The server guarantees that for at
12900    /// least 60 minutes since the first request.
12901    ///
12902    /// For example, consider a situation where you make an initial request and
12903    /// the request times out. If you make the request again with the same request
12904    /// ID, the server can check if the original operation with the same request ID
12905    /// was received, and if so, ignores the second request. This prevents
12906    /// clients from accidentally creating duplicate commitments.
12907    ///
12908    /// The request ID must be a valid UUID with the exception that zero UUID is
12909    /// not supported (00000000-0000-0000-0000-000000000000).
12910    pub request_id: std::string::String,
12911
12912    /// Optional. If set, performs request validation, for example, permission
12913    /// checks and any other type of validation, but does not actually execute the
12914    /// create request.
12915    pub validate_only: bool,
12916
12917    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12918}
12919
12920impl CreateSecondaryInstanceRequest {
12921    pub fn new() -> Self {
12922        std::default::Default::default()
12923    }
12924
12925    /// Sets the value of [parent][crate::model::CreateSecondaryInstanceRequest::parent].
12926    ///
12927    /// # Example
12928    /// ```ignore,no_run
12929    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12930    /// let x = CreateSecondaryInstanceRequest::new().set_parent("example");
12931    /// ```
12932    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12933        self.parent = v.into();
12934        self
12935    }
12936
12937    /// Sets the value of [instance_id][crate::model::CreateSecondaryInstanceRequest::instance_id].
12938    ///
12939    /// # Example
12940    /// ```ignore,no_run
12941    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12942    /// let x = CreateSecondaryInstanceRequest::new().set_instance_id("example");
12943    /// ```
12944    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12945        self.instance_id = v.into();
12946        self
12947    }
12948
12949    /// Sets the value of [instance][crate::model::CreateSecondaryInstanceRequest::instance].
12950    ///
12951    /// # Example
12952    /// ```ignore,no_run
12953    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12954    /// use google_cloud_alloydb_v1::model::Instance;
12955    /// let x = CreateSecondaryInstanceRequest::new().set_instance(Instance::default()/* use setters */);
12956    /// ```
12957    pub fn set_instance<T>(mut self, v: T) -> Self
12958    where
12959        T: std::convert::Into<crate::model::Instance>,
12960    {
12961        self.instance = std::option::Option::Some(v.into());
12962        self
12963    }
12964
12965    /// Sets or clears the value of [instance][crate::model::CreateSecondaryInstanceRequest::instance].
12966    ///
12967    /// # Example
12968    /// ```ignore,no_run
12969    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12970    /// use google_cloud_alloydb_v1::model::Instance;
12971    /// let x = CreateSecondaryInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
12972    /// let x = CreateSecondaryInstanceRequest::new().set_or_clear_instance(None::<Instance>);
12973    /// ```
12974    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
12975    where
12976        T: std::convert::Into<crate::model::Instance>,
12977    {
12978        self.instance = v.map(|x| x.into());
12979        self
12980    }
12981
12982    /// Sets the value of [request_id][crate::model::CreateSecondaryInstanceRequest::request_id].
12983    ///
12984    /// # Example
12985    /// ```ignore,no_run
12986    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12987    /// let x = CreateSecondaryInstanceRequest::new().set_request_id("example");
12988    /// ```
12989    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12990        self.request_id = v.into();
12991        self
12992    }
12993
12994    /// Sets the value of [validate_only][crate::model::CreateSecondaryInstanceRequest::validate_only].
12995    ///
12996    /// # Example
12997    /// ```ignore,no_run
12998    /// # use google_cloud_alloydb_v1::model::CreateSecondaryInstanceRequest;
12999    /// let x = CreateSecondaryInstanceRequest::new().set_validate_only(true);
13000    /// ```
13001    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13002        self.validate_only = v.into();
13003        self
13004    }
13005}
13006
13007impl wkt::message::Message for CreateSecondaryInstanceRequest {
13008    fn typename() -> &'static str {
13009        "type.googleapis.com/google.cloud.alloydb.v1.CreateSecondaryInstanceRequest"
13010    }
13011}
13012
13013/// See usage below for notes.
13014#[derive(Clone, Default, PartialEq)]
13015#[non_exhaustive]
13016pub struct CreateInstanceRequests {
13017    /// Required. Primary and read replica instances to be created. This list
13018    /// should not be empty.
13019    pub create_instance_requests: std::vec::Vec<crate::model::CreateInstanceRequest>,
13020
13021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13022}
13023
13024impl CreateInstanceRequests {
13025    pub fn new() -> Self {
13026        std::default::Default::default()
13027    }
13028
13029    /// Sets the value of [create_instance_requests][crate::model::CreateInstanceRequests::create_instance_requests].
13030    ///
13031    /// # Example
13032    /// ```ignore,no_run
13033    /// # use google_cloud_alloydb_v1::model::CreateInstanceRequests;
13034    /// use google_cloud_alloydb_v1::model::CreateInstanceRequest;
13035    /// let x = CreateInstanceRequests::new()
13036    ///     .set_create_instance_requests([
13037    ///         CreateInstanceRequest::default()/* use setters */,
13038    ///         CreateInstanceRequest::default()/* use (different) setters */,
13039    ///     ]);
13040    /// ```
13041    pub fn set_create_instance_requests<T, V>(mut self, v: T) -> Self
13042    where
13043        T: std::iter::IntoIterator<Item = V>,
13044        V: std::convert::Into<crate::model::CreateInstanceRequest>,
13045    {
13046        use std::iter::Iterator;
13047        self.create_instance_requests = v.into_iter().map(|i| i.into()).collect();
13048        self
13049    }
13050}
13051
13052impl wkt::message::Message for CreateInstanceRequests {
13053    fn typename() -> &'static str {
13054        "type.googleapis.com/google.cloud.alloydb.v1.CreateInstanceRequests"
13055    }
13056}
13057
13058/// Message for creating a batch of instances under the specified cluster.
13059#[derive(Clone, Default, PartialEq)]
13060#[non_exhaustive]
13061pub struct BatchCreateInstancesRequest {
13062    /// Required. The name of the parent resource.
13063    pub parent: std::string::String,
13064
13065    /// Required. Resources being created.
13066    pub requests: std::option::Option<crate::model::CreateInstanceRequests>,
13067
13068    /// Optional. An optional request ID to identify requests. Specify a unique
13069    /// request ID so that if you must retry your request, the server ignores the
13070    /// request if it has already been completed. The server guarantees that for at
13071    /// least 60 minutes since the first request.
13072    ///
13073    /// For example, consider a situation where you make an initial request and
13074    /// the request times out. If you make the request again with the same request
13075    /// ID, the server can check if the original operation with the same request ID
13076    /// was received, and if so, ignores the second request. This prevents
13077    /// clients from accidentally creating duplicate commitments.
13078    ///
13079    /// The request ID must be a valid UUID with the exception that zero UUID is
13080    /// not supported (00000000-0000-0000-0000-000000000000).
13081    pub request_id: std::string::String,
13082
13083    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13084}
13085
13086impl BatchCreateInstancesRequest {
13087    pub fn new() -> Self {
13088        std::default::Default::default()
13089    }
13090
13091    /// Sets the value of [parent][crate::model::BatchCreateInstancesRequest::parent].
13092    ///
13093    /// # Example
13094    /// ```ignore,no_run
13095    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesRequest;
13096    /// let x = BatchCreateInstancesRequest::new().set_parent("example");
13097    /// ```
13098    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13099        self.parent = v.into();
13100        self
13101    }
13102
13103    /// Sets the value of [requests][crate::model::BatchCreateInstancesRequest::requests].
13104    ///
13105    /// # Example
13106    /// ```ignore,no_run
13107    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesRequest;
13108    /// use google_cloud_alloydb_v1::model::CreateInstanceRequests;
13109    /// let x = BatchCreateInstancesRequest::new().set_requests(CreateInstanceRequests::default()/* use setters */);
13110    /// ```
13111    pub fn set_requests<T>(mut self, v: T) -> Self
13112    where
13113        T: std::convert::Into<crate::model::CreateInstanceRequests>,
13114    {
13115        self.requests = std::option::Option::Some(v.into());
13116        self
13117    }
13118
13119    /// Sets or clears the value of [requests][crate::model::BatchCreateInstancesRequest::requests].
13120    ///
13121    /// # Example
13122    /// ```ignore,no_run
13123    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesRequest;
13124    /// use google_cloud_alloydb_v1::model::CreateInstanceRequests;
13125    /// let x = BatchCreateInstancesRequest::new().set_or_clear_requests(Some(CreateInstanceRequests::default()/* use setters */));
13126    /// let x = BatchCreateInstancesRequest::new().set_or_clear_requests(None::<CreateInstanceRequests>);
13127    /// ```
13128    pub fn set_or_clear_requests<T>(mut self, v: std::option::Option<T>) -> Self
13129    where
13130        T: std::convert::Into<crate::model::CreateInstanceRequests>,
13131    {
13132        self.requests = v.map(|x| x.into());
13133        self
13134    }
13135
13136    /// Sets the value of [request_id][crate::model::BatchCreateInstancesRequest::request_id].
13137    ///
13138    /// # Example
13139    /// ```ignore,no_run
13140    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesRequest;
13141    /// let x = BatchCreateInstancesRequest::new().set_request_id("example");
13142    /// ```
13143    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13144        self.request_id = v.into();
13145        self
13146    }
13147}
13148
13149impl wkt::message::Message for BatchCreateInstancesRequest {
13150    fn typename() -> &'static str {
13151        "type.googleapis.com/google.cloud.alloydb.v1.BatchCreateInstancesRequest"
13152    }
13153}
13154
13155/// Message for creating batches of instances in a cluster.
13156#[derive(Clone, Default, PartialEq)]
13157#[non_exhaustive]
13158pub struct BatchCreateInstancesResponse {
13159    /// Created instances.
13160    pub instances: std::vec::Vec<crate::model::Instance>,
13161
13162    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13163}
13164
13165impl BatchCreateInstancesResponse {
13166    pub fn new() -> Self {
13167        std::default::Default::default()
13168    }
13169
13170    /// Sets the value of [instances][crate::model::BatchCreateInstancesResponse::instances].
13171    ///
13172    /// # Example
13173    /// ```ignore,no_run
13174    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesResponse;
13175    /// use google_cloud_alloydb_v1::model::Instance;
13176    /// let x = BatchCreateInstancesResponse::new()
13177    ///     .set_instances([
13178    ///         Instance::default()/* use setters */,
13179    ///         Instance::default()/* use (different) setters */,
13180    ///     ]);
13181    /// ```
13182    pub fn set_instances<T, V>(mut self, v: T) -> Self
13183    where
13184        T: std::iter::IntoIterator<Item = V>,
13185        V: std::convert::Into<crate::model::Instance>,
13186    {
13187        use std::iter::Iterator;
13188        self.instances = v.into_iter().map(|i| i.into()).collect();
13189        self
13190    }
13191}
13192
13193impl wkt::message::Message for BatchCreateInstancesResponse {
13194    fn typename() -> &'static str {
13195        "type.googleapis.com/google.cloud.alloydb.v1.BatchCreateInstancesResponse"
13196    }
13197}
13198
13199/// Message for metadata that is specific to BatchCreateInstances API.
13200/// NEXT_ID: 3
13201#[derive(Clone, Default, PartialEq)]
13202#[non_exhaustive]
13203pub struct BatchCreateInstancesMetadata {
13204    /// The instances being created in the API call. Each string in this list
13205    /// is the server defined resource path for target instances in the request
13206    /// and for the format of each string, see the comment on the Instance.name
13207    /// field.
13208    pub instance_targets: std::vec::Vec<std::string::String>,
13209
13210    /// A map representing state of the instances involved in the
13211    /// BatchCreateInstances operation during the operation execution.
13212    /// The instance state will be in STATE_UNSPECIFIED state if the instance has
13213    /// not yet been picked up for processing.
13214    /// The key of the map is the name of the instance resource.
13215    /// For the format, see the comment on the Instance.name field.
13216    pub instance_statuses:
13217        std::collections::HashMap<std::string::String, crate::model::BatchCreateInstanceStatus>,
13218
13219    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13220}
13221
13222impl BatchCreateInstancesMetadata {
13223    pub fn new() -> Self {
13224        std::default::Default::default()
13225    }
13226
13227    /// Sets the value of [instance_targets][crate::model::BatchCreateInstancesMetadata::instance_targets].
13228    ///
13229    /// # Example
13230    /// ```ignore,no_run
13231    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesMetadata;
13232    /// let x = BatchCreateInstancesMetadata::new().set_instance_targets(["a", "b", "c"]);
13233    /// ```
13234    pub fn set_instance_targets<T, V>(mut self, v: T) -> Self
13235    where
13236        T: std::iter::IntoIterator<Item = V>,
13237        V: std::convert::Into<std::string::String>,
13238    {
13239        use std::iter::Iterator;
13240        self.instance_targets = v.into_iter().map(|i| i.into()).collect();
13241        self
13242    }
13243
13244    /// Sets the value of [instance_statuses][crate::model::BatchCreateInstancesMetadata::instance_statuses].
13245    ///
13246    /// # Example
13247    /// ```ignore,no_run
13248    /// # use google_cloud_alloydb_v1::model::BatchCreateInstancesMetadata;
13249    /// use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13250    /// let x = BatchCreateInstancesMetadata::new().set_instance_statuses([
13251    ///     ("key0", BatchCreateInstanceStatus::default()/* use setters */),
13252    ///     ("key1", BatchCreateInstanceStatus::default()/* use (different) setters */),
13253    /// ]);
13254    /// ```
13255    pub fn set_instance_statuses<T, K, V>(mut self, v: T) -> Self
13256    where
13257        T: std::iter::IntoIterator<Item = (K, V)>,
13258        K: std::convert::Into<std::string::String>,
13259        V: std::convert::Into<crate::model::BatchCreateInstanceStatus>,
13260    {
13261        use std::iter::Iterator;
13262        self.instance_statuses = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13263        self
13264    }
13265}
13266
13267impl wkt::message::Message for BatchCreateInstancesMetadata {
13268    fn typename() -> &'static str {
13269        "type.googleapis.com/google.cloud.alloydb.v1.BatchCreateInstancesMetadata"
13270    }
13271}
13272
13273/// Message for current status of an instance in the BatchCreateInstances
13274/// operation.
13275/// For example, lets say a BatchCreateInstances workflow has 4 instances,
13276/// Instance1 through Instance4. Lets also assume that 2 instances succeeded
13277/// but the third failed to create and the 4th was never picked up for creation
13278/// because of failure of the previous one. Then, resulting states would look
13279/// something like:
13280///
13281/// 1. Instance1 = ROLLED_BACK
13282/// 1. Instance2 = ROLLED_BACK
13283/// 1. Instance3 = FAILED
13284/// 1. Instance4 = FAILED
13285///
13286/// However, while the operation is running, the instance might be in other
13287/// states including PENDING_CREATE, ACTIVE, DELETING and CREATING. The states
13288/// / do not get further updated once the operation is done.
13289#[derive(Clone, Default, PartialEq)]
13290#[non_exhaustive]
13291pub struct BatchCreateInstanceStatus {
13292    /// The current state of an instance involved in the batch create operation.
13293    /// Once the operation is complete, the final state of the instances in the
13294    /// LRO can be one of:
13295    ///
13296    /// 1. ACTIVE, indicating that instances were created successfully
13297    /// 1. FAILED, indicating that a particular instance failed creation
13298    /// 1. ROLLED_BACK indicating that although the instance was created
13299    ///    successfully, it had to be rolled back and deleted due to failure in
13300    ///    other steps of the workflow.
13301    pub state: crate::model::batch_create_instance_status::State,
13302
13303    /// DEPRECATED - Use the error field instead.
13304    /// Error, if any error occurred and is available, during instance creation.
13305    pub error_msg: std::string::String,
13306
13307    /// The RPC status of the instance creation operation. This field will be
13308    /// present if an error happened during the instance creation.
13309    pub error: std::option::Option<google_cloud_rpc::model::Status>,
13310
13311    pub r#type: crate::model::instance::InstanceType,
13312
13313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13314}
13315
13316impl BatchCreateInstanceStatus {
13317    pub fn new() -> Self {
13318        std::default::Default::default()
13319    }
13320
13321    /// Sets the value of [state][crate::model::BatchCreateInstanceStatus::state].
13322    ///
13323    /// # Example
13324    /// ```ignore,no_run
13325    /// # use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13326    /// use google_cloud_alloydb_v1::model::batch_create_instance_status::State;
13327    /// let x0 = BatchCreateInstanceStatus::new().set_state(State::PendingCreate);
13328    /// let x1 = BatchCreateInstanceStatus::new().set_state(State::Ready);
13329    /// let x2 = BatchCreateInstanceStatus::new().set_state(State::Creating);
13330    /// ```
13331    pub fn set_state<T: std::convert::Into<crate::model::batch_create_instance_status::State>>(
13332        mut self,
13333        v: T,
13334    ) -> Self {
13335        self.state = v.into();
13336        self
13337    }
13338
13339    /// Sets the value of [error_msg][crate::model::BatchCreateInstanceStatus::error_msg].
13340    ///
13341    /// # Example
13342    /// ```ignore,no_run
13343    /// # use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13344    /// let x = BatchCreateInstanceStatus::new().set_error_msg("example");
13345    /// ```
13346    pub fn set_error_msg<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13347        self.error_msg = v.into();
13348        self
13349    }
13350
13351    /// Sets the value of [error][crate::model::BatchCreateInstanceStatus::error].
13352    ///
13353    /// # Example
13354    /// ```ignore,no_run
13355    /// # use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13356    /// use google_cloud_rpc::model::Status;
13357    /// let x = BatchCreateInstanceStatus::new().set_error(Status::default()/* use setters */);
13358    /// ```
13359    pub fn set_error<T>(mut self, v: T) -> Self
13360    where
13361        T: std::convert::Into<google_cloud_rpc::model::Status>,
13362    {
13363        self.error = std::option::Option::Some(v.into());
13364        self
13365    }
13366
13367    /// Sets or clears the value of [error][crate::model::BatchCreateInstanceStatus::error].
13368    ///
13369    /// # Example
13370    /// ```ignore,no_run
13371    /// # use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13372    /// use google_cloud_rpc::model::Status;
13373    /// let x = BatchCreateInstanceStatus::new().set_or_clear_error(Some(Status::default()/* use setters */));
13374    /// let x = BatchCreateInstanceStatus::new().set_or_clear_error(None::<Status>);
13375    /// ```
13376    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
13377    where
13378        T: std::convert::Into<google_cloud_rpc::model::Status>,
13379    {
13380        self.error = v.map(|x| x.into());
13381        self
13382    }
13383
13384    /// Sets the value of [r#type][crate::model::BatchCreateInstanceStatus::type].
13385    ///
13386    /// # Example
13387    /// ```ignore,no_run
13388    /// # use google_cloud_alloydb_v1::model::BatchCreateInstanceStatus;
13389    /// use google_cloud_alloydb_v1::model::instance::InstanceType;
13390    /// let x0 = BatchCreateInstanceStatus::new().set_type(InstanceType::Primary);
13391    /// let x1 = BatchCreateInstanceStatus::new().set_type(InstanceType::ReadPool);
13392    /// let x2 = BatchCreateInstanceStatus::new().set_type(InstanceType::Secondary);
13393    /// ```
13394    pub fn set_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
13395        mut self,
13396        v: T,
13397    ) -> Self {
13398        self.r#type = v.into();
13399        self
13400    }
13401}
13402
13403impl wkt::message::Message for BatchCreateInstanceStatus {
13404    fn typename() -> &'static str {
13405        "type.googleapis.com/google.cloud.alloydb.v1.BatchCreateInstanceStatus"
13406    }
13407}
13408
13409/// Defines additional types related to [BatchCreateInstanceStatus].
13410pub mod batch_create_instance_status {
13411    #[allow(unused_imports)]
13412    use super::*;
13413
13414    /// State contains all valid instance states for the BatchCreateInstances
13415    /// operation. This is mainly used for status reporting through the LRO
13416    /// metadata.
13417    ///
13418    /// # Working with unknown values
13419    ///
13420    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13421    /// additional enum variants at any time. Adding new variants is not considered
13422    /// a breaking change. Applications should write their code in anticipation of:
13423    ///
13424    /// - New values appearing in future releases of the client library, **and**
13425    /// - New values received dynamically, without application changes.
13426    ///
13427    /// Please consult the [Working with enums] section in the user guide for some
13428    /// guidelines.
13429    ///
13430    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13431    #[derive(Clone, Debug, PartialEq)]
13432    #[non_exhaustive]
13433    pub enum State {
13434        /// The state of the instance is unknown.
13435        Unspecified,
13436        /// Instance is pending creation and has not yet been picked up for
13437        /// processing in the backend.
13438        PendingCreate,
13439        /// The instance is active and running.
13440        Ready,
13441        /// The instance is being created.
13442        Creating,
13443        /// The instance is being deleted.
13444        Deleting,
13445        /// The creation of the instance failed or a fatal error occurred during
13446        /// an operation on the instance or a batch of instances.
13447        Failed,
13448        /// The instance was created successfully, but was rolled back and deleted
13449        /// due to some other failure during BatchCreateInstances operation.
13450        RolledBack,
13451        /// If set, the enum was initialized with an unknown value.
13452        ///
13453        /// Applications can examine the value using [State::value] or
13454        /// [State::name].
13455        UnknownValue(state::UnknownValue),
13456    }
13457
13458    #[doc(hidden)]
13459    pub mod state {
13460        #[allow(unused_imports)]
13461        use super::*;
13462        #[derive(Clone, Debug, PartialEq)]
13463        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13464    }
13465
13466    impl State {
13467        /// Gets the enum value.
13468        ///
13469        /// Returns `None` if the enum contains an unknown value deserialized from
13470        /// the string representation of enums.
13471        pub fn value(&self) -> std::option::Option<i32> {
13472            match self {
13473                Self::Unspecified => std::option::Option::Some(0),
13474                Self::PendingCreate => std::option::Option::Some(1),
13475                Self::Ready => std::option::Option::Some(2),
13476                Self::Creating => std::option::Option::Some(3),
13477                Self::Deleting => std::option::Option::Some(4),
13478                Self::Failed => std::option::Option::Some(5),
13479                Self::RolledBack => std::option::Option::Some(6),
13480                Self::UnknownValue(u) => u.0.value(),
13481            }
13482        }
13483
13484        /// Gets the enum value as a string.
13485        ///
13486        /// Returns `None` if the enum contains an unknown value deserialized from
13487        /// the integer representation of enums.
13488        pub fn name(&self) -> std::option::Option<&str> {
13489            match self {
13490                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13491                Self::PendingCreate => std::option::Option::Some("PENDING_CREATE"),
13492                Self::Ready => std::option::Option::Some("READY"),
13493                Self::Creating => std::option::Option::Some("CREATING"),
13494                Self::Deleting => std::option::Option::Some("DELETING"),
13495                Self::Failed => std::option::Option::Some("FAILED"),
13496                Self::RolledBack => std::option::Option::Some("ROLLED_BACK"),
13497                Self::UnknownValue(u) => u.0.name(),
13498            }
13499        }
13500    }
13501
13502    impl std::default::Default for State {
13503        fn default() -> Self {
13504            use std::convert::From;
13505            Self::from(0)
13506        }
13507    }
13508
13509    impl std::fmt::Display for State {
13510        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13511            wkt::internal::display_enum(f, self.name(), self.value())
13512        }
13513    }
13514
13515    impl std::convert::From<i32> for State {
13516        fn from(value: i32) -> Self {
13517            match value {
13518                0 => Self::Unspecified,
13519                1 => Self::PendingCreate,
13520                2 => Self::Ready,
13521                3 => Self::Creating,
13522                4 => Self::Deleting,
13523                5 => Self::Failed,
13524                6 => Self::RolledBack,
13525                _ => Self::UnknownValue(state::UnknownValue(
13526                    wkt::internal::UnknownEnumValue::Integer(value),
13527                )),
13528            }
13529        }
13530    }
13531
13532    impl std::convert::From<&str> for State {
13533        fn from(value: &str) -> Self {
13534            use std::string::ToString;
13535            match value {
13536                "STATE_UNSPECIFIED" => Self::Unspecified,
13537                "PENDING_CREATE" => Self::PendingCreate,
13538                "READY" => Self::Ready,
13539                "CREATING" => Self::Creating,
13540                "DELETING" => Self::Deleting,
13541                "FAILED" => Self::Failed,
13542                "ROLLED_BACK" => Self::RolledBack,
13543                _ => Self::UnknownValue(state::UnknownValue(
13544                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13545                )),
13546            }
13547        }
13548    }
13549
13550    impl serde::ser::Serialize for State {
13551        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13552        where
13553            S: serde::Serializer,
13554        {
13555            match self {
13556                Self::Unspecified => serializer.serialize_i32(0),
13557                Self::PendingCreate => serializer.serialize_i32(1),
13558                Self::Ready => serializer.serialize_i32(2),
13559                Self::Creating => serializer.serialize_i32(3),
13560                Self::Deleting => serializer.serialize_i32(4),
13561                Self::Failed => serializer.serialize_i32(5),
13562                Self::RolledBack => serializer.serialize_i32(6),
13563                Self::UnknownValue(u) => u.0.serialize(serializer),
13564            }
13565        }
13566    }
13567
13568    impl<'de> serde::de::Deserialize<'de> for State {
13569        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13570        where
13571            D: serde::Deserializer<'de>,
13572        {
13573            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13574                ".google.cloud.alloydb.v1.BatchCreateInstanceStatus.State",
13575            ))
13576        }
13577    }
13578}
13579
13580/// Message for updating a Instance
13581#[derive(Clone, Default, PartialEq)]
13582#[non_exhaustive]
13583pub struct UpdateInstanceRequest {
13584    /// Optional. Field mask is used to specify the fields to be overwritten in the
13585    /// Instance resource by the update.
13586    /// The fields specified in the update_mask are relative to the resource, not
13587    /// the full request. A field will be overwritten if it is in the mask. If the
13588    /// user does not provide a mask then all fields will be overwritten.
13589    pub update_mask: std::option::Option<wkt::FieldMask>,
13590
13591    /// Required. The resource being updated
13592    pub instance: std::option::Option<crate::model::Instance>,
13593
13594    /// Optional. An optional request ID to identify requests. Specify a unique
13595    /// request ID so that if you must retry your request, the server ignores the
13596    /// request if it has already been completed. The server guarantees that for at
13597    /// least 60 minutes since the first request.
13598    ///
13599    /// For example, consider a situation where you make an initial request and
13600    /// the request times out. If you make the request again with the same request
13601    /// ID, the server can check if the original operation with the same request ID
13602    /// was received, and if so, ignores the second request. This prevents
13603    /// clients from accidentally creating duplicate commitments.
13604    ///
13605    /// The request ID must be a valid UUID with the exception that zero UUID is
13606    /// not supported (00000000-0000-0000-0000-000000000000).
13607    pub request_id: std::string::String,
13608
13609    /// Optional. If set, performs request validation, for example, permission
13610    /// checks and any other type of validation, but does not actually execute the
13611    /// create request.
13612    pub validate_only: bool,
13613
13614    /// Optional. If set to true, update succeeds even if instance is not found. In
13615    /// that case, a new instance is created and `update_mask` is ignored.
13616    pub allow_missing: bool,
13617
13618    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13619}
13620
13621impl UpdateInstanceRequest {
13622    pub fn new() -> Self {
13623        std::default::Default::default()
13624    }
13625
13626    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
13627    ///
13628    /// # Example
13629    /// ```ignore,no_run
13630    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13631    /// use wkt::FieldMask;
13632    /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13633    /// ```
13634    pub fn set_update_mask<T>(mut self, v: T) -> Self
13635    where
13636        T: std::convert::Into<wkt::FieldMask>,
13637    {
13638        self.update_mask = std::option::Option::Some(v.into());
13639        self
13640    }
13641
13642    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
13643    ///
13644    /// # Example
13645    /// ```ignore,no_run
13646    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13647    /// use wkt::FieldMask;
13648    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13649    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13650    /// ```
13651    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13652    where
13653        T: std::convert::Into<wkt::FieldMask>,
13654    {
13655        self.update_mask = v.map(|x| x.into());
13656        self
13657    }
13658
13659    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
13660    ///
13661    /// # Example
13662    /// ```ignore,no_run
13663    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13664    /// use google_cloud_alloydb_v1::model::Instance;
13665    /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
13666    /// ```
13667    pub fn set_instance<T>(mut self, v: T) -> Self
13668    where
13669        T: std::convert::Into<crate::model::Instance>,
13670    {
13671        self.instance = std::option::Option::Some(v.into());
13672        self
13673    }
13674
13675    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
13676    ///
13677    /// # Example
13678    /// ```ignore,no_run
13679    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13680    /// use google_cloud_alloydb_v1::model::Instance;
13681    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
13682    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
13683    /// ```
13684    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
13685    where
13686        T: std::convert::Into<crate::model::Instance>,
13687    {
13688        self.instance = v.map(|x| x.into());
13689        self
13690    }
13691
13692    /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
13693    ///
13694    /// # Example
13695    /// ```ignore,no_run
13696    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13697    /// let x = UpdateInstanceRequest::new().set_request_id("example");
13698    /// ```
13699    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13700        self.request_id = v.into();
13701        self
13702    }
13703
13704    /// Sets the value of [validate_only][crate::model::UpdateInstanceRequest::validate_only].
13705    ///
13706    /// # Example
13707    /// ```ignore,no_run
13708    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13709    /// let x = UpdateInstanceRequest::new().set_validate_only(true);
13710    /// ```
13711    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13712        self.validate_only = v.into();
13713        self
13714    }
13715
13716    /// Sets the value of [allow_missing][crate::model::UpdateInstanceRequest::allow_missing].
13717    ///
13718    /// # Example
13719    /// ```ignore,no_run
13720    /// # use google_cloud_alloydb_v1::model::UpdateInstanceRequest;
13721    /// let x = UpdateInstanceRequest::new().set_allow_missing(true);
13722    /// ```
13723    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13724        self.allow_missing = v.into();
13725        self
13726    }
13727}
13728
13729impl wkt::message::Message for UpdateInstanceRequest {
13730    fn typename() -> &'static str {
13731        "type.googleapis.com/google.cloud.alloydb.v1.UpdateInstanceRequest"
13732    }
13733}
13734
13735/// Message for deleting a Instance
13736#[derive(Clone, Default, PartialEq)]
13737#[non_exhaustive]
13738pub struct DeleteInstanceRequest {
13739    /// Required. The name of the resource. For the required format, see the
13740    /// comment on the Instance.name field.
13741    pub name: std::string::String,
13742
13743    /// Optional. An optional request ID to identify requests. Specify a unique
13744    /// request ID so that if you must retry your request, the server ignores the
13745    /// request if it has already been completed. The server guarantees that for at
13746    /// least 60 minutes since the first request.
13747    ///
13748    /// For example, consider a situation where you make an initial request and
13749    /// the request times out. If you make the request again with the same request
13750    /// ID, the server can check if the original operation with the same request ID
13751    /// was received, and if so, ignores the second request. This prevents
13752    /// clients from accidentally creating duplicate commitments.
13753    ///
13754    /// The request ID must be a valid UUID with the exception that zero UUID is
13755    /// not supported (00000000-0000-0000-0000-000000000000).
13756    pub request_id: std::string::String,
13757
13758    /// Optional. The current etag of the Instance.
13759    /// If an etag is provided and does not match the current etag of the Instance,
13760    /// deletion will be blocked and an ABORTED error will be returned.
13761    pub etag: std::string::String,
13762
13763    /// Optional. If set, performs request validation, for example, permission
13764    /// checks and any other type of validation, but does not actually execute the
13765    /// create request.
13766    pub validate_only: bool,
13767
13768    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13769}
13770
13771impl DeleteInstanceRequest {
13772    pub fn new() -> Self {
13773        std::default::Default::default()
13774    }
13775
13776    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
13777    ///
13778    /// # Example
13779    /// ```ignore,no_run
13780    /// # use google_cloud_alloydb_v1::model::DeleteInstanceRequest;
13781    /// let x = DeleteInstanceRequest::new().set_name("example");
13782    /// ```
13783    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13784        self.name = v.into();
13785        self
13786    }
13787
13788    /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
13789    ///
13790    /// # Example
13791    /// ```ignore,no_run
13792    /// # use google_cloud_alloydb_v1::model::DeleteInstanceRequest;
13793    /// let x = DeleteInstanceRequest::new().set_request_id("example");
13794    /// ```
13795    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13796        self.request_id = v.into();
13797        self
13798    }
13799
13800    /// Sets the value of [etag][crate::model::DeleteInstanceRequest::etag].
13801    ///
13802    /// # Example
13803    /// ```ignore,no_run
13804    /// # use google_cloud_alloydb_v1::model::DeleteInstanceRequest;
13805    /// let x = DeleteInstanceRequest::new().set_etag("example");
13806    /// ```
13807    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13808        self.etag = v.into();
13809        self
13810    }
13811
13812    /// Sets the value of [validate_only][crate::model::DeleteInstanceRequest::validate_only].
13813    ///
13814    /// # Example
13815    /// ```ignore,no_run
13816    /// # use google_cloud_alloydb_v1::model::DeleteInstanceRequest;
13817    /// let x = DeleteInstanceRequest::new().set_validate_only(true);
13818    /// ```
13819    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13820        self.validate_only = v.into();
13821        self
13822    }
13823}
13824
13825impl wkt::message::Message for DeleteInstanceRequest {
13826    fn typename() -> &'static str {
13827        "type.googleapis.com/google.cloud.alloydb.v1.DeleteInstanceRequest"
13828    }
13829}
13830
13831/// Message for triggering failover on an Instance
13832#[derive(Clone, Default, PartialEq)]
13833#[non_exhaustive]
13834pub struct FailoverInstanceRequest {
13835    /// Required. The name of the resource. For the required format, see the
13836    /// comment on the Instance.name field.
13837    pub name: std::string::String,
13838
13839    /// Optional. An optional request ID to identify requests. Specify a unique
13840    /// request ID so that if you must retry your request, the server ignores the
13841    /// request if it has already been completed. The server guarantees that for at
13842    /// least 60 minutes since the first request.
13843    ///
13844    /// For example, consider a situation where you make an initial request and
13845    /// the request times out. If you make the request again with the same request
13846    /// ID, the server can check if the original operation with the same request ID
13847    /// was received, and if so, ignores the second request. This prevents
13848    /// clients from accidentally creating duplicate commitments.
13849    ///
13850    /// The request ID must be a valid UUID with the exception that zero UUID is
13851    /// not supported (00000000-0000-0000-0000-000000000000).
13852    pub request_id: std::string::String,
13853
13854    /// Optional. If set, performs request validation, for example, permission
13855    /// checks and any other type of validation, but does not actually execute the
13856    /// create request.
13857    pub validate_only: bool,
13858
13859    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13860}
13861
13862impl FailoverInstanceRequest {
13863    pub fn new() -> Self {
13864        std::default::Default::default()
13865    }
13866
13867    /// Sets the value of [name][crate::model::FailoverInstanceRequest::name].
13868    ///
13869    /// # Example
13870    /// ```ignore,no_run
13871    /// # use google_cloud_alloydb_v1::model::FailoverInstanceRequest;
13872    /// let x = FailoverInstanceRequest::new().set_name("example");
13873    /// ```
13874    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13875        self.name = v.into();
13876        self
13877    }
13878
13879    /// Sets the value of [request_id][crate::model::FailoverInstanceRequest::request_id].
13880    ///
13881    /// # Example
13882    /// ```ignore,no_run
13883    /// # use google_cloud_alloydb_v1::model::FailoverInstanceRequest;
13884    /// let x = FailoverInstanceRequest::new().set_request_id("example");
13885    /// ```
13886    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13887        self.request_id = v.into();
13888        self
13889    }
13890
13891    /// Sets the value of [validate_only][crate::model::FailoverInstanceRequest::validate_only].
13892    ///
13893    /// # Example
13894    /// ```ignore,no_run
13895    /// # use google_cloud_alloydb_v1::model::FailoverInstanceRequest;
13896    /// let x = FailoverInstanceRequest::new().set_validate_only(true);
13897    /// ```
13898    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13899        self.validate_only = v.into();
13900        self
13901    }
13902}
13903
13904impl wkt::message::Message for FailoverInstanceRequest {
13905    fn typename() -> &'static str {
13906        "type.googleapis.com/google.cloud.alloydb.v1.FailoverInstanceRequest"
13907    }
13908}
13909
13910/// Message for triggering fault injection on an instance
13911#[derive(Clone, Default, PartialEq)]
13912#[non_exhaustive]
13913pub struct InjectFaultRequest {
13914    /// Required. The type of fault to be injected in an instance.
13915    pub fault_type: crate::model::inject_fault_request::FaultType,
13916
13917    /// Required. The name of the resource. For the required format, see the
13918    /// comment on the Instance.name field.
13919    pub name: std::string::String,
13920
13921    /// Optional. An optional request ID to identify requests. Specify a unique
13922    /// request ID so that if you must retry your request, the server ignores the
13923    /// request if it has already been completed. The server guarantees that for at
13924    /// least 60 minutes since the first request.
13925    ///
13926    /// For example, consider a situation where you make an initial request and
13927    /// the request times out. If you make the request again with the same request
13928    /// ID, the server can check if the original operation with the same request ID
13929    /// was received, and if so, ignores the second request. This prevents
13930    /// clients from accidentally creating duplicate commitments.
13931    ///
13932    /// The request ID must be a valid UUID with the exception that zero UUID is
13933    /// not supported (00000000-0000-0000-0000-000000000000).
13934    pub request_id: std::string::String,
13935
13936    /// Optional. If set, performs request validation, for example, permission
13937    /// checks and any other type of validation, but does not actually execute the
13938    /// create request.
13939    pub validate_only: bool,
13940
13941    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13942}
13943
13944impl InjectFaultRequest {
13945    pub fn new() -> Self {
13946        std::default::Default::default()
13947    }
13948
13949    /// Sets the value of [fault_type][crate::model::InjectFaultRequest::fault_type].
13950    ///
13951    /// # Example
13952    /// ```ignore,no_run
13953    /// # use google_cloud_alloydb_v1::model::InjectFaultRequest;
13954    /// use google_cloud_alloydb_v1::model::inject_fault_request::FaultType;
13955    /// let x0 = InjectFaultRequest::new().set_fault_type(FaultType::StopVm);
13956    /// ```
13957    pub fn set_fault_type<T: std::convert::Into<crate::model::inject_fault_request::FaultType>>(
13958        mut self,
13959        v: T,
13960    ) -> Self {
13961        self.fault_type = v.into();
13962        self
13963    }
13964
13965    /// Sets the value of [name][crate::model::InjectFaultRequest::name].
13966    ///
13967    /// # Example
13968    /// ```ignore,no_run
13969    /// # use google_cloud_alloydb_v1::model::InjectFaultRequest;
13970    /// let x = InjectFaultRequest::new().set_name("example");
13971    /// ```
13972    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13973        self.name = v.into();
13974        self
13975    }
13976
13977    /// Sets the value of [request_id][crate::model::InjectFaultRequest::request_id].
13978    ///
13979    /// # Example
13980    /// ```ignore,no_run
13981    /// # use google_cloud_alloydb_v1::model::InjectFaultRequest;
13982    /// let x = InjectFaultRequest::new().set_request_id("example");
13983    /// ```
13984    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13985        self.request_id = v.into();
13986        self
13987    }
13988
13989    /// Sets the value of [validate_only][crate::model::InjectFaultRequest::validate_only].
13990    ///
13991    /// # Example
13992    /// ```ignore,no_run
13993    /// # use google_cloud_alloydb_v1::model::InjectFaultRequest;
13994    /// let x = InjectFaultRequest::new().set_validate_only(true);
13995    /// ```
13996    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13997        self.validate_only = v.into();
13998        self
13999    }
14000}
14001
14002impl wkt::message::Message for InjectFaultRequest {
14003    fn typename() -> &'static str {
14004        "type.googleapis.com/google.cloud.alloydb.v1.InjectFaultRequest"
14005    }
14006}
14007
14008/// Defines additional types related to [InjectFaultRequest].
14009pub mod inject_fault_request {
14010    #[allow(unused_imports)]
14011    use super::*;
14012
14013    /// FaultType contains all valid types of faults that can be injected to an
14014    /// instance.
14015    ///
14016    /// # Working with unknown values
14017    ///
14018    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14019    /// additional enum variants at any time. Adding new variants is not considered
14020    /// a breaking change. Applications should write their code in anticipation of:
14021    ///
14022    /// - New values appearing in future releases of the client library, **and**
14023    /// - New values received dynamically, without application changes.
14024    ///
14025    /// Please consult the [Working with enums] section in the user guide for some
14026    /// guidelines.
14027    ///
14028    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14029    #[derive(Clone, Debug, PartialEq)]
14030    #[non_exhaustive]
14031    pub enum FaultType {
14032        /// The fault type is unknown.
14033        Unspecified,
14034        /// Stop the VM
14035        StopVm,
14036        /// If set, the enum was initialized with an unknown value.
14037        ///
14038        /// Applications can examine the value using [FaultType::value] or
14039        /// [FaultType::name].
14040        UnknownValue(fault_type::UnknownValue),
14041    }
14042
14043    #[doc(hidden)]
14044    pub mod fault_type {
14045        #[allow(unused_imports)]
14046        use super::*;
14047        #[derive(Clone, Debug, PartialEq)]
14048        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14049    }
14050
14051    impl FaultType {
14052        /// Gets the enum value.
14053        ///
14054        /// Returns `None` if the enum contains an unknown value deserialized from
14055        /// the string representation of enums.
14056        pub fn value(&self) -> std::option::Option<i32> {
14057            match self {
14058                Self::Unspecified => std::option::Option::Some(0),
14059                Self::StopVm => std::option::Option::Some(1),
14060                Self::UnknownValue(u) => u.0.value(),
14061            }
14062        }
14063
14064        /// Gets the enum value as a string.
14065        ///
14066        /// Returns `None` if the enum contains an unknown value deserialized from
14067        /// the integer representation of enums.
14068        pub fn name(&self) -> std::option::Option<&str> {
14069            match self {
14070                Self::Unspecified => std::option::Option::Some("FAULT_TYPE_UNSPECIFIED"),
14071                Self::StopVm => std::option::Option::Some("STOP_VM"),
14072                Self::UnknownValue(u) => u.0.name(),
14073            }
14074        }
14075    }
14076
14077    impl std::default::Default for FaultType {
14078        fn default() -> Self {
14079            use std::convert::From;
14080            Self::from(0)
14081        }
14082    }
14083
14084    impl std::fmt::Display for FaultType {
14085        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14086            wkt::internal::display_enum(f, self.name(), self.value())
14087        }
14088    }
14089
14090    impl std::convert::From<i32> for FaultType {
14091        fn from(value: i32) -> Self {
14092            match value {
14093                0 => Self::Unspecified,
14094                1 => Self::StopVm,
14095                _ => Self::UnknownValue(fault_type::UnknownValue(
14096                    wkt::internal::UnknownEnumValue::Integer(value),
14097                )),
14098            }
14099        }
14100    }
14101
14102    impl std::convert::From<&str> for FaultType {
14103        fn from(value: &str) -> Self {
14104            use std::string::ToString;
14105            match value {
14106                "FAULT_TYPE_UNSPECIFIED" => Self::Unspecified,
14107                "STOP_VM" => Self::StopVm,
14108                _ => Self::UnknownValue(fault_type::UnknownValue(
14109                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14110                )),
14111            }
14112        }
14113    }
14114
14115    impl serde::ser::Serialize for FaultType {
14116        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14117        where
14118            S: serde::Serializer,
14119        {
14120            match self {
14121                Self::Unspecified => serializer.serialize_i32(0),
14122                Self::StopVm => serializer.serialize_i32(1),
14123                Self::UnknownValue(u) => u.0.serialize(serializer),
14124            }
14125        }
14126    }
14127
14128    impl<'de> serde::de::Deserialize<'de> for FaultType {
14129        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14130        where
14131            D: serde::Deserializer<'de>,
14132        {
14133            deserializer.deserialize_any(wkt::internal::EnumVisitor::<FaultType>::new(
14134                ".google.cloud.alloydb.v1.InjectFaultRequest.FaultType",
14135            ))
14136        }
14137    }
14138}
14139
14140#[derive(Clone, Default, PartialEq)]
14141#[non_exhaustive]
14142pub struct RestartInstanceRequest {
14143    /// Required. The name of the resource. For the required format, see the
14144    /// comment on the Instance.name field.
14145    pub name: std::string::String,
14146
14147    /// Optional. An optional request ID to identify requests. Specify a unique
14148    /// request ID so that if you must retry your request, the server ignores the
14149    /// request if it has already been completed. The server guarantees that for at
14150    /// least 60 minutes since the first request.
14151    ///
14152    /// For example, consider a situation where you make an initial request and
14153    /// the request times out. If you make the request again with the same request
14154    /// ID, the server can check if the original operation with the same request ID
14155    /// was received, and if so, ignores the second request. This prevents
14156    /// clients from accidentally creating duplicate commitments.
14157    ///
14158    /// The request ID must be a valid UUID with the exception that zero UUID is
14159    /// not supported (00000000-0000-0000-0000-000000000000).
14160    pub request_id: std::string::String,
14161
14162    /// Optional. If set, performs request validation, for example, permission
14163    /// checks and any other type of validation, but does not actually execute the
14164    /// create request.
14165    pub validate_only: bool,
14166
14167    /// Optional. Full name of the nodes as obtained from INSTANCE_VIEW_FULL to
14168    /// restart upon. Applicable only to read instances.
14169    pub node_ids: std::vec::Vec<std::string::String>,
14170
14171    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14172}
14173
14174impl RestartInstanceRequest {
14175    pub fn new() -> Self {
14176        std::default::Default::default()
14177    }
14178
14179    /// Sets the value of [name][crate::model::RestartInstanceRequest::name].
14180    ///
14181    /// # Example
14182    /// ```ignore,no_run
14183    /// # use google_cloud_alloydb_v1::model::RestartInstanceRequest;
14184    /// let x = RestartInstanceRequest::new().set_name("example");
14185    /// ```
14186    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14187        self.name = v.into();
14188        self
14189    }
14190
14191    /// Sets the value of [request_id][crate::model::RestartInstanceRequest::request_id].
14192    ///
14193    /// # Example
14194    /// ```ignore,no_run
14195    /// # use google_cloud_alloydb_v1::model::RestartInstanceRequest;
14196    /// let x = RestartInstanceRequest::new().set_request_id("example");
14197    /// ```
14198    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14199        self.request_id = v.into();
14200        self
14201    }
14202
14203    /// Sets the value of [validate_only][crate::model::RestartInstanceRequest::validate_only].
14204    ///
14205    /// # Example
14206    /// ```ignore,no_run
14207    /// # use google_cloud_alloydb_v1::model::RestartInstanceRequest;
14208    /// let x = RestartInstanceRequest::new().set_validate_only(true);
14209    /// ```
14210    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14211        self.validate_only = v.into();
14212        self
14213    }
14214
14215    /// Sets the value of [node_ids][crate::model::RestartInstanceRequest::node_ids].
14216    ///
14217    /// # Example
14218    /// ```ignore,no_run
14219    /// # use google_cloud_alloydb_v1::model::RestartInstanceRequest;
14220    /// let x = RestartInstanceRequest::new().set_node_ids(["a", "b", "c"]);
14221    /// ```
14222    pub fn set_node_ids<T, V>(mut self, v: T) -> Self
14223    where
14224        T: std::iter::IntoIterator<Item = V>,
14225        V: std::convert::Into<std::string::String>,
14226    {
14227        use std::iter::Iterator;
14228        self.node_ids = v.into_iter().map(|i| i.into()).collect();
14229        self
14230    }
14231}
14232
14233impl wkt::message::Message for RestartInstanceRequest {
14234    fn typename() -> &'static str {
14235        "type.googleapis.com/google.cloud.alloydb.v1.RestartInstanceRequest"
14236    }
14237}
14238
14239/// Request for ExecuteSql rpc.
14240#[derive(Clone, Default, PartialEq)]
14241#[non_exhaustive]
14242pub struct ExecuteSqlRequest {
14243    /// Required. The instance where the SQL will be executed. For the required
14244    /// format, see the comment on the Instance.name field.
14245    pub instance: std::string::String,
14246
14247    /// Required. Name of the database where the query will be executed.
14248    /// Note - Value provided should be the same as expected from `SELECT
14249    /// current_database();` and NOT as a resource reference.
14250    pub database: std::string::String,
14251
14252    /// Required. Database user to be used for executing the SQL.
14253    /// Note - Value provided should be the same as expected from
14254    /// `SELECT current_user;` and NOT as a resource reference.
14255    pub user: std::string::String,
14256
14257    /// Required. SQL statement to execute on database. Any valid statement is
14258    /// permitted, including DDL, DML, DQL statements.
14259    pub sql_statement: std::string::String,
14260
14261    /// Optional. If set, validates the sql statement by performing
14262    /// syntax and semantic validation and doesn't execute the query.
14263    pub validate_only: bool,
14264
14265    /// Oneof field to support other credential mechanisms in future like
14266    /// SecretManager etc.
14267    pub user_credential: std::option::Option<crate::model::execute_sql_request::UserCredential>,
14268
14269    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14270}
14271
14272impl ExecuteSqlRequest {
14273    pub fn new() -> Self {
14274        std::default::Default::default()
14275    }
14276
14277    /// Sets the value of [instance][crate::model::ExecuteSqlRequest::instance].
14278    ///
14279    /// # Example
14280    /// ```ignore,no_run
14281    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14282    /// let x = ExecuteSqlRequest::new().set_instance("example");
14283    /// ```
14284    pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14285        self.instance = v.into();
14286        self
14287    }
14288
14289    /// Sets the value of [database][crate::model::ExecuteSqlRequest::database].
14290    ///
14291    /// # Example
14292    /// ```ignore,no_run
14293    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14294    /// let x = ExecuteSqlRequest::new().set_database("example");
14295    /// ```
14296    pub fn set_database<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14297        self.database = v.into();
14298        self
14299    }
14300
14301    /// Sets the value of [user][crate::model::ExecuteSqlRequest::user].
14302    ///
14303    /// # Example
14304    /// ```ignore,no_run
14305    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14306    /// let x = ExecuteSqlRequest::new().set_user("example");
14307    /// ```
14308    pub fn set_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14309        self.user = v.into();
14310        self
14311    }
14312
14313    /// Sets the value of [sql_statement][crate::model::ExecuteSqlRequest::sql_statement].
14314    ///
14315    /// # Example
14316    /// ```ignore,no_run
14317    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14318    /// let x = ExecuteSqlRequest::new().set_sql_statement("example");
14319    /// ```
14320    pub fn set_sql_statement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14321        self.sql_statement = v.into();
14322        self
14323    }
14324
14325    /// Sets the value of [validate_only][crate::model::ExecuteSqlRequest::validate_only].
14326    ///
14327    /// # Example
14328    /// ```ignore,no_run
14329    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14330    /// let x = ExecuteSqlRequest::new().set_validate_only(true);
14331    /// ```
14332    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14333        self.validate_only = v.into();
14334        self
14335    }
14336
14337    /// Sets the value of [user_credential][crate::model::ExecuteSqlRequest::user_credential].
14338    ///
14339    /// Note that all the setters affecting `user_credential` are mutually
14340    /// exclusive.
14341    ///
14342    /// # Example
14343    /// ```ignore,no_run
14344    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14345    /// use google_cloud_alloydb_v1::model::execute_sql_request::UserCredential;
14346    /// let x = ExecuteSqlRequest::new().set_user_credential(Some(UserCredential::Password("example".to_string())));
14347    /// ```
14348    pub fn set_user_credential<
14349        T: std::convert::Into<std::option::Option<crate::model::execute_sql_request::UserCredential>>,
14350    >(
14351        mut self,
14352        v: T,
14353    ) -> Self {
14354        self.user_credential = v.into();
14355        self
14356    }
14357
14358    /// The value of [user_credential][crate::model::ExecuteSqlRequest::user_credential]
14359    /// if it holds a `Password`, `None` if the field is not set or
14360    /// holds a different branch.
14361    pub fn password(&self) -> std::option::Option<&std::string::String> {
14362        #[allow(unreachable_patterns)]
14363        self.user_credential.as_ref().and_then(|v| match v {
14364            crate::model::execute_sql_request::UserCredential::Password(v) => {
14365                std::option::Option::Some(v)
14366            }
14367            _ => std::option::Option::None,
14368        })
14369    }
14370
14371    /// Sets the value of [user_credential][crate::model::ExecuteSqlRequest::user_credential]
14372    /// to hold a `Password`.
14373    ///
14374    /// Note that all the setters affecting `user_credential` are
14375    /// mutually exclusive.
14376    ///
14377    /// # Example
14378    /// ```ignore,no_run
14379    /// # use google_cloud_alloydb_v1::model::ExecuteSqlRequest;
14380    /// let x = ExecuteSqlRequest::new().set_password("example");
14381    /// assert!(x.password().is_some());
14382    /// ```
14383    pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14384        self.user_credential = std::option::Option::Some(
14385            crate::model::execute_sql_request::UserCredential::Password(v.into()),
14386        );
14387        self
14388    }
14389}
14390
14391impl wkt::message::Message for ExecuteSqlRequest {
14392    fn typename() -> &'static str {
14393        "type.googleapis.com/google.cloud.alloydb.v1.ExecuteSqlRequest"
14394    }
14395}
14396
14397/// Defines additional types related to [ExecuteSqlRequest].
14398pub mod execute_sql_request {
14399    #[allow(unused_imports)]
14400    use super::*;
14401
14402    /// Oneof field to support other credential mechanisms in future like
14403    /// SecretManager etc.
14404    #[derive(Clone, Debug, PartialEq)]
14405    #[non_exhaustive]
14406    pub enum UserCredential {
14407        /// Optional. The database native user’s password.
14408        Password(std::string::String),
14409    }
14410}
14411
14412/// Execute a SQL statement response.
14413#[derive(Clone, Default, PartialEq)]
14414#[non_exhaustive]
14415pub struct ExecuteSqlResponse {
14416    /// SqlResult represents the results for the execution of sql statements.
14417    pub sql_results: std::vec::Vec<crate::model::SqlResult>,
14418
14419    /// Any additional metadata information regarding the execution of the sql
14420    /// statement.
14421    pub metadata: std::option::Option<crate::model::ExecuteSqlMetadata>,
14422
14423    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14424}
14425
14426impl ExecuteSqlResponse {
14427    pub fn new() -> Self {
14428        std::default::Default::default()
14429    }
14430
14431    /// Sets the value of [sql_results][crate::model::ExecuteSqlResponse::sql_results].
14432    ///
14433    /// # Example
14434    /// ```ignore,no_run
14435    /// # use google_cloud_alloydb_v1::model::ExecuteSqlResponse;
14436    /// use google_cloud_alloydb_v1::model::SqlResult;
14437    /// let x = ExecuteSqlResponse::new()
14438    ///     .set_sql_results([
14439    ///         SqlResult::default()/* use setters */,
14440    ///         SqlResult::default()/* use (different) setters */,
14441    ///     ]);
14442    /// ```
14443    pub fn set_sql_results<T, V>(mut self, v: T) -> Self
14444    where
14445        T: std::iter::IntoIterator<Item = V>,
14446        V: std::convert::Into<crate::model::SqlResult>,
14447    {
14448        use std::iter::Iterator;
14449        self.sql_results = v.into_iter().map(|i| i.into()).collect();
14450        self
14451    }
14452
14453    /// Sets the value of [metadata][crate::model::ExecuteSqlResponse::metadata].
14454    ///
14455    /// # Example
14456    /// ```ignore,no_run
14457    /// # use google_cloud_alloydb_v1::model::ExecuteSqlResponse;
14458    /// use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14459    /// let x = ExecuteSqlResponse::new().set_metadata(ExecuteSqlMetadata::default()/* use setters */);
14460    /// ```
14461    pub fn set_metadata<T>(mut self, v: T) -> Self
14462    where
14463        T: std::convert::Into<crate::model::ExecuteSqlMetadata>,
14464    {
14465        self.metadata = std::option::Option::Some(v.into());
14466        self
14467    }
14468
14469    /// Sets or clears the value of [metadata][crate::model::ExecuteSqlResponse::metadata].
14470    ///
14471    /// # Example
14472    /// ```ignore,no_run
14473    /// # use google_cloud_alloydb_v1::model::ExecuteSqlResponse;
14474    /// use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14475    /// let x = ExecuteSqlResponse::new().set_or_clear_metadata(Some(ExecuteSqlMetadata::default()/* use setters */));
14476    /// let x = ExecuteSqlResponse::new().set_or_clear_metadata(None::<ExecuteSqlMetadata>);
14477    /// ```
14478    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14479    where
14480        T: std::convert::Into<crate::model::ExecuteSqlMetadata>,
14481    {
14482        self.metadata = v.map(|x| x.into());
14483        self
14484    }
14485}
14486
14487impl wkt::message::Message for ExecuteSqlResponse {
14488    fn typename() -> &'static str {
14489        "type.googleapis.com/google.cloud.alloydb.v1.ExecuteSqlResponse"
14490    }
14491}
14492
14493/// Any additional metadata information regarding the execution of the SQL
14494#[derive(Clone, Default, PartialEq)]
14495#[non_exhaustive]
14496pub struct ExecuteSqlMetadata {
14497    /// Message related to SQL execution. Marked as core content since it
14498    /// can potentially contain details related to the query or result set. This
14499    /// field can be used to convey messages such as "when the SQL result set
14500    /// exceeds the acceptable response size limits."
14501    pub message: std::string::String,
14502
14503    /// Set to true if SQL returned a result set larger than the acceptable
14504    /// response size limits and the result was truncated.
14505    pub partial_result: bool,
14506
14507    /// The time duration taken to execute the sql statement.
14508    pub sql_statement_execution_duration: std::option::Option<wkt::Duration>,
14509
14510    /// Status of SQL execution.
14511    pub status: crate::model::execute_sql_metadata::Status,
14512
14513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14514}
14515
14516impl ExecuteSqlMetadata {
14517    pub fn new() -> Self {
14518        std::default::Default::default()
14519    }
14520
14521    /// Sets the value of [message][crate::model::ExecuteSqlMetadata::message].
14522    ///
14523    /// # Example
14524    /// ```ignore,no_run
14525    /// # use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14526    /// let x = ExecuteSqlMetadata::new().set_message("example");
14527    /// ```
14528    pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14529        self.message = v.into();
14530        self
14531    }
14532
14533    /// Sets the value of [partial_result][crate::model::ExecuteSqlMetadata::partial_result].
14534    ///
14535    /// # Example
14536    /// ```ignore,no_run
14537    /// # use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14538    /// let x = ExecuteSqlMetadata::new().set_partial_result(true);
14539    /// ```
14540    pub fn set_partial_result<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14541        self.partial_result = v.into();
14542        self
14543    }
14544
14545    /// Sets the value of [sql_statement_execution_duration][crate::model::ExecuteSqlMetadata::sql_statement_execution_duration].
14546    ///
14547    /// # Example
14548    /// ```ignore,no_run
14549    /// # use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14550    /// use wkt::Duration;
14551    /// let x = ExecuteSqlMetadata::new().set_sql_statement_execution_duration(Duration::default()/* use setters */);
14552    /// ```
14553    pub fn set_sql_statement_execution_duration<T>(mut self, v: T) -> Self
14554    where
14555        T: std::convert::Into<wkt::Duration>,
14556    {
14557        self.sql_statement_execution_duration = std::option::Option::Some(v.into());
14558        self
14559    }
14560
14561    /// Sets or clears the value of [sql_statement_execution_duration][crate::model::ExecuteSqlMetadata::sql_statement_execution_duration].
14562    ///
14563    /// # Example
14564    /// ```ignore,no_run
14565    /// # use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14566    /// use wkt::Duration;
14567    /// let x = ExecuteSqlMetadata::new().set_or_clear_sql_statement_execution_duration(Some(Duration::default()/* use setters */));
14568    /// let x = ExecuteSqlMetadata::new().set_or_clear_sql_statement_execution_duration(None::<Duration>);
14569    /// ```
14570    pub fn set_or_clear_sql_statement_execution_duration<T>(
14571        mut self,
14572        v: std::option::Option<T>,
14573    ) -> Self
14574    where
14575        T: std::convert::Into<wkt::Duration>,
14576    {
14577        self.sql_statement_execution_duration = v.map(|x| x.into());
14578        self
14579    }
14580
14581    /// Sets the value of [status][crate::model::ExecuteSqlMetadata::status].
14582    ///
14583    /// # Example
14584    /// ```ignore,no_run
14585    /// # use google_cloud_alloydb_v1::model::ExecuteSqlMetadata;
14586    /// use google_cloud_alloydb_v1::model::execute_sql_metadata::Status;
14587    /// let x0 = ExecuteSqlMetadata::new().set_status(Status::Ok);
14588    /// let x1 = ExecuteSqlMetadata::new().set_status(Status::Partial);
14589    /// let x2 = ExecuteSqlMetadata::new().set_status(Status::Error);
14590    /// ```
14591    pub fn set_status<T: std::convert::Into<crate::model::execute_sql_metadata::Status>>(
14592        mut self,
14593        v: T,
14594    ) -> Self {
14595        self.status = v.into();
14596        self
14597    }
14598}
14599
14600impl wkt::message::Message for ExecuteSqlMetadata {
14601    fn typename() -> &'static str {
14602        "type.googleapis.com/google.cloud.alloydb.v1.ExecuteSqlMetadata"
14603    }
14604}
14605
14606/// Defines additional types related to [ExecuteSqlMetadata].
14607pub mod execute_sql_metadata {
14608    #[allow(unused_imports)]
14609    use super::*;
14610
14611    /// Status contains all valid Status a SQL execution can end up in.
14612    ///
14613    /// # Working with unknown values
14614    ///
14615    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14616    /// additional enum variants at any time. Adding new variants is not considered
14617    /// a breaking change. Applications should write their code in anticipation of:
14618    ///
14619    /// - New values appearing in future releases of the client library, **and**
14620    /// - New values received dynamically, without application changes.
14621    ///
14622    /// Please consult the [Working with enums] section in the user guide for some
14623    /// guidelines.
14624    ///
14625    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14626    #[derive(Clone, Debug, PartialEq)]
14627    #[non_exhaustive]
14628    pub enum Status {
14629        /// The status is unknown.
14630        Unspecified,
14631        /// No error during SQL execution i.e. All SQL statements ran to completion.
14632        /// The "message" will be empty.
14633        Ok,
14634        /// Same as OK, except indicates that only partial results were
14635        /// returned. The "message" field will contain details on why results were
14636        /// truncated.
14637        Partial,
14638        /// Error during SQL execution. Atleast 1 SQL statement execution resulted in
14639        /// a error. Side effects of other statements are rolled back.  The "message"
14640        /// field will contain human readable error given by Postgres of the first
14641        /// bad SQL statement. SQL execution errors don't constitute API errors as
14642        /// defined in <https://google.aip.dev/193> but will be returned as part of
14643        /// this message.
14644        Error,
14645        /// If set, the enum was initialized with an unknown value.
14646        ///
14647        /// Applications can examine the value using [Status::value] or
14648        /// [Status::name].
14649        UnknownValue(status::UnknownValue),
14650    }
14651
14652    #[doc(hidden)]
14653    pub mod status {
14654        #[allow(unused_imports)]
14655        use super::*;
14656        #[derive(Clone, Debug, PartialEq)]
14657        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14658    }
14659
14660    impl Status {
14661        /// Gets the enum value.
14662        ///
14663        /// Returns `None` if the enum contains an unknown value deserialized from
14664        /// the string representation of enums.
14665        pub fn value(&self) -> std::option::Option<i32> {
14666            match self {
14667                Self::Unspecified => std::option::Option::Some(0),
14668                Self::Ok => std::option::Option::Some(1),
14669                Self::Partial => std::option::Option::Some(2),
14670                Self::Error => std::option::Option::Some(3),
14671                Self::UnknownValue(u) => u.0.value(),
14672            }
14673        }
14674
14675        /// Gets the enum value as a string.
14676        ///
14677        /// Returns `None` if the enum contains an unknown value deserialized from
14678        /// the integer representation of enums.
14679        pub fn name(&self) -> std::option::Option<&str> {
14680            match self {
14681                Self::Unspecified => std::option::Option::Some("STATUS_UNSPECIFIED"),
14682                Self::Ok => std::option::Option::Some("OK"),
14683                Self::Partial => std::option::Option::Some("PARTIAL"),
14684                Self::Error => std::option::Option::Some("ERROR"),
14685                Self::UnknownValue(u) => u.0.name(),
14686            }
14687        }
14688    }
14689
14690    impl std::default::Default for Status {
14691        fn default() -> Self {
14692            use std::convert::From;
14693            Self::from(0)
14694        }
14695    }
14696
14697    impl std::fmt::Display for Status {
14698        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14699            wkt::internal::display_enum(f, self.name(), self.value())
14700        }
14701    }
14702
14703    impl std::convert::From<i32> for Status {
14704        fn from(value: i32) -> Self {
14705            match value {
14706                0 => Self::Unspecified,
14707                1 => Self::Ok,
14708                2 => Self::Partial,
14709                3 => Self::Error,
14710                _ => Self::UnknownValue(status::UnknownValue(
14711                    wkt::internal::UnknownEnumValue::Integer(value),
14712                )),
14713            }
14714        }
14715    }
14716
14717    impl std::convert::From<&str> for Status {
14718        fn from(value: &str) -> Self {
14719            use std::string::ToString;
14720            match value {
14721                "STATUS_UNSPECIFIED" => Self::Unspecified,
14722                "OK" => Self::Ok,
14723                "PARTIAL" => Self::Partial,
14724                "ERROR" => Self::Error,
14725                _ => Self::UnknownValue(status::UnknownValue(
14726                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14727                )),
14728            }
14729        }
14730    }
14731
14732    impl serde::ser::Serialize for Status {
14733        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14734        where
14735            S: serde::Serializer,
14736        {
14737            match self {
14738                Self::Unspecified => serializer.serialize_i32(0),
14739                Self::Ok => serializer.serialize_i32(1),
14740                Self::Partial => serializer.serialize_i32(2),
14741                Self::Error => serializer.serialize_i32(3),
14742                Self::UnknownValue(u) => u.0.serialize(serializer),
14743            }
14744        }
14745    }
14746
14747    impl<'de> serde::de::Deserialize<'de> for Status {
14748        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14749        where
14750            D: serde::Deserializer<'de>,
14751        {
14752            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
14753                ".google.cloud.alloydb.v1.ExecuteSqlMetadata.Status",
14754            ))
14755        }
14756    }
14757}
14758
14759/// Message for requesting list of Backups
14760#[derive(Clone, Default, PartialEq)]
14761#[non_exhaustive]
14762pub struct ListBackupsRequest {
14763    /// Required. Parent value for ListBackupsRequest
14764    pub parent: std::string::String,
14765
14766    /// Requested page size. Server may return fewer items than requested.
14767    /// If unspecified, server will pick an appropriate default.
14768    pub page_size: i32,
14769
14770    /// A token identifying a page of results the server should return.
14771    pub page_token: std::string::String,
14772
14773    /// Filtering results
14774    pub filter: std::string::String,
14775
14776    /// Hint for how to order the results
14777    pub order_by: std::string::String,
14778
14779    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14780}
14781
14782impl ListBackupsRequest {
14783    pub fn new() -> Self {
14784        std::default::Default::default()
14785    }
14786
14787    /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
14788    ///
14789    /// # Example
14790    /// ```ignore,no_run
14791    /// # use google_cloud_alloydb_v1::model::ListBackupsRequest;
14792    /// let x = ListBackupsRequest::new().set_parent("example");
14793    /// ```
14794    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14795        self.parent = v.into();
14796        self
14797    }
14798
14799    /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
14800    ///
14801    /// # Example
14802    /// ```ignore,no_run
14803    /// # use google_cloud_alloydb_v1::model::ListBackupsRequest;
14804    /// let x = ListBackupsRequest::new().set_page_size(42);
14805    /// ```
14806    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14807        self.page_size = v.into();
14808        self
14809    }
14810
14811    /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
14812    ///
14813    /// # Example
14814    /// ```ignore,no_run
14815    /// # use google_cloud_alloydb_v1::model::ListBackupsRequest;
14816    /// let x = ListBackupsRequest::new().set_page_token("example");
14817    /// ```
14818    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14819        self.page_token = v.into();
14820        self
14821    }
14822
14823    /// Sets the value of [filter][crate::model::ListBackupsRequest::filter].
14824    ///
14825    /// # Example
14826    /// ```ignore,no_run
14827    /// # use google_cloud_alloydb_v1::model::ListBackupsRequest;
14828    /// let x = ListBackupsRequest::new().set_filter("example");
14829    /// ```
14830    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14831        self.filter = v.into();
14832        self
14833    }
14834
14835    /// Sets the value of [order_by][crate::model::ListBackupsRequest::order_by].
14836    ///
14837    /// # Example
14838    /// ```ignore,no_run
14839    /// # use google_cloud_alloydb_v1::model::ListBackupsRequest;
14840    /// let x = ListBackupsRequest::new().set_order_by("example");
14841    /// ```
14842    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14843        self.order_by = v.into();
14844        self
14845    }
14846}
14847
14848impl wkt::message::Message for ListBackupsRequest {
14849    fn typename() -> &'static str {
14850        "type.googleapis.com/google.cloud.alloydb.v1.ListBackupsRequest"
14851    }
14852}
14853
14854/// Message for response to listing Backups
14855#[derive(Clone, Default, PartialEq)]
14856#[non_exhaustive]
14857pub struct ListBackupsResponse {
14858    /// The list of Backup
14859    pub backups: std::vec::Vec<crate::model::Backup>,
14860
14861    /// A token identifying a page of results the server should return.
14862    pub next_page_token: std::string::String,
14863
14864    /// Locations that could not be reached.
14865    pub unreachable: std::vec::Vec<std::string::String>,
14866
14867    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14868}
14869
14870impl ListBackupsResponse {
14871    pub fn new() -> Self {
14872        std::default::Default::default()
14873    }
14874
14875    /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
14876    ///
14877    /// # Example
14878    /// ```ignore,no_run
14879    /// # use google_cloud_alloydb_v1::model::ListBackupsResponse;
14880    /// use google_cloud_alloydb_v1::model::Backup;
14881    /// let x = ListBackupsResponse::new()
14882    ///     .set_backups([
14883    ///         Backup::default()/* use setters */,
14884    ///         Backup::default()/* use (different) setters */,
14885    ///     ]);
14886    /// ```
14887    pub fn set_backups<T, V>(mut self, v: T) -> Self
14888    where
14889        T: std::iter::IntoIterator<Item = V>,
14890        V: std::convert::Into<crate::model::Backup>,
14891    {
14892        use std::iter::Iterator;
14893        self.backups = v.into_iter().map(|i| i.into()).collect();
14894        self
14895    }
14896
14897    /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
14898    ///
14899    /// # Example
14900    /// ```ignore,no_run
14901    /// # use google_cloud_alloydb_v1::model::ListBackupsResponse;
14902    /// let x = ListBackupsResponse::new().set_next_page_token("example");
14903    /// ```
14904    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14905        self.next_page_token = v.into();
14906        self
14907    }
14908
14909    /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
14910    ///
14911    /// # Example
14912    /// ```ignore,no_run
14913    /// # use google_cloud_alloydb_v1::model::ListBackupsResponse;
14914    /// let x = ListBackupsResponse::new().set_unreachable(["a", "b", "c"]);
14915    /// ```
14916    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
14917    where
14918        T: std::iter::IntoIterator<Item = V>,
14919        V: std::convert::Into<std::string::String>,
14920    {
14921        use std::iter::Iterator;
14922        self.unreachable = v.into_iter().map(|i| i.into()).collect();
14923        self
14924    }
14925}
14926
14927impl wkt::message::Message for ListBackupsResponse {
14928    fn typename() -> &'static str {
14929        "type.googleapis.com/google.cloud.alloydb.v1.ListBackupsResponse"
14930    }
14931}
14932
14933#[doc(hidden)]
14934impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupsResponse {
14935    type PageItem = crate::model::Backup;
14936
14937    fn items(self) -> std::vec::Vec<Self::PageItem> {
14938        self.backups
14939    }
14940
14941    fn next_page_token(&self) -> std::string::String {
14942        use std::clone::Clone;
14943        self.next_page_token.clone()
14944    }
14945}
14946
14947/// Message for getting a Backup
14948#[derive(Clone, Default, PartialEq)]
14949#[non_exhaustive]
14950pub struct GetBackupRequest {
14951    /// Required. Name of the resource
14952    pub name: std::string::String,
14953
14954    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14955}
14956
14957impl GetBackupRequest {
14958    pub fn new() -> Self {
14959        std::default::Default::default()
14960    }
14961
14962    /// Sets the value of [name][crate::model::GetBackupRequest::name].
14963    ///
14964    /// # Example
14965    /// ```ignore,no_run
14966    /// # use google_cloud_alloydb_v1::model::GetBackupRequest;
14967    /// let x = GetBackupRequest::new().set_name("example");
14968    /// ```
14969    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14970        self.name = v.into();
14971        self
14972    }
14973}
14974
14975impl wkt::message::Message for GetBackupRequest {
14976    fn typename() -> &'static str {
14977        "type.googleapis.com/google.cloud.alloydb.v1.GetBackupRequest"
14978    }
14979}
14980
14981/// Message for creating a Backup
14982#[derive(Clone, Default, PartialEq)]
14983#[non_exhaustive]
14984pub struct CreateBackupRequest {
14985    /// Required. Value for parent.
14986    pub parent: std::string::String,
14987
14988    /// Required. ID of the requesting object.
14989    pub backup_id: std::string::String,
14990
14991    /// Required. The resource being created
14992    pub backup: std::option::Option<crate::model::Backup>,
14993
14994    /// Optional. An optional request ID to identify requests. Specify a unique
14995    /// request ID so that if you must retry your request, the server ignores the
14996    /// request if it has already been completed. The server guarantees that for at
14997    /// least 60 minutes since the first request.
14998    ///
14999    /// For example, consider a situation where you make an initial request and
15000    /// the request times out. If you make the request again with the same request
15001    /// ID, the server can check if the original operation with the same request ID
15002    /// was received, and if so, ignores the second request. This prevents
15003    /// clients from accidentally creating duplicate commitments.
15004    ///
15005    /// The request ID must be a valid UUID with the exception that zero UUID is
15006    /// not supported (00000000-0000-0000-0000-000000000000).
15007    pub request_id: std::string::String,
15008
15009    /// Optional. If set, the backend validates the request, but doesn't actually
15010    /// execute it.
15011    pub validate_only: bool,
15012
15013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15014}
15015
15016impl CreateBackupRequest {
15017    pub fn new() -> Self {
15018        std::default::Default::default()
15019    }
15020
15021    /// Sets the value of [parent][crate::model::CreateBackupRequest::parent].
15022    ///
15023    /// # Example
15024    /// ```ignore,no_run
15025    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15026    /// let x = CreateBackupRequest::new().set_parent("example");
15027    /// ```
15028    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15029        self.parent = v.into();
15030        self
15031    }
15032
15033    /// Sets the value of [backup_id][crate::model::CreateBackupRequest::backup_id].
15034    ///
15035    /// # Example
15036    /// ```ignore,no_run
15037    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15038    /// let x = CreateBackupRequest::new().set_backup_id("example");
15039    /// ```
15040    pub fn set_backup_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15041        self.backup_id = v.into();
15042        self
15043    }
15044
15045    /// Sets the value of [backup][crate::model::CreateBackupRequest::backup].
15046    ///
15047    /// # Example
15048    /// ```ignore,no_run
15049    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15050    /// use google_cloud_alloydb_v1::model::Backup;
15051    /// let x = CreateBackupRequest::new().set_backup(Backup::default()/* use setters */);
15052    /// ```
15053    pub fn set_backup<T>(mut self, v: T) -> Self
15054    where
15055        T: std::convert::Into<crate::model::Backup>,
15056    {
15057        self.backup = std::option::Option::Some(v.into());
15058        self
15059    }
15060
15061    /// Sets or clears the value of [backup][crate::model::CreateBackupRequest::backup].
15062    ///
15063    /// # Example
15064    /// ```ignore,no_run
15065    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15066    /// use google_cloud_alloydb_v1::model::Backup;
15067    /// let x = CreateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
15068    /// let x = CreateBackupRequest::new().set_or_clear_backup(None::<Backup>);
15069    /// ```
15070    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
15071    where
15072        T: std::convert::Into<crate::model::Backup>,
15073    {
15074        self.backup = v.map(|x| x.into());
15075        self
15076    }
15077
15078    /// Sets the value of [request_id][crate::model::CreateBackupRequest::request_id].
15079    ///
15080    /// # Example
15081    /// ```ignore,no_run
15082    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15083    /// let x = CreateBackupRequest::new().set_request_id("example");
15084    /// ```
15085    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15086        self.request_id = v.into();
15087        self
15088    }
15089
15090    /// Sets the value of [validate_only][crate::model::CreateBackupRequest::validate_only].
15091    ///
15092    /// # Example
15093    /// ```ignore,no_run
15094    /// # use google_cloud_alloydb_v1::model::CreateBackupRequest;
15095    /// let x = CreateBackupRequest::new().set_validate_only(true);
15096    /// ```
15097    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15098        self.validate_only = v.into();
15099        self
15100    }
15101}
15102
15103impl wkt::message::Message for CreateBackupRequest {
15104    fn typename() -> &'static str {
15105        "type.googleapis.com/google.cloud.alloydb.v1.CreateBackupRequest"
15106    }
15107}
15108
15109/// Message for updating a Backup
15110#[derive(Clone, Default, PartialEq)]
15111#[non_exhaustive]
15112pub struct UpdateBackupRequest {
15113    /// Optional. Field mask is used to specify the fields to be overwritten in the
15114    /// Backup resource by the update.
15115    /// The fields specified in the update_mask are relative to the resource, not
15116    /// the full request. A field will be overwritten if it is in the mask. If the
15117    /// user does not provide a mask then all fields will be overwritten.
15118    pub update_mask: std::option::Option<wkt::FieldMask>,
15119
15120    /// Required. The resource being updated
15121    pub backup: std::option::Option<crate::model::Backup>,
15122
15123    /// Optional. An optional request ID to identify requests. Specify a unique
15124    /// request ID so that if you must retry your request, the server ignores the
15125    /// request if it has already been completed. The server guarantees that for at
15126    /// least 60 minutes since the first request.
15127    ///
15128    /// For example, consider a situation where you make an initial request and
15129    /// the request times out. If you make the request again with the same request
15130    /// ID, the server can check if the original operation with the same request ID
15131    /// was received, and if so, ignores the second request. This prevents
15132    /// clients from accidentally creating duplicate commitments.
15133    ///
15134    /// The request ID must be a valid UUID with the exception that zero UUID is
15135    /// not supported (00000000-0000-0000-0000-000000000000).
15136    pub request_id: std::string::String,
15137
15138    /// Optional. If set, the backend validates the request, but doesn't actually
15139    /// execute it.
15140    pub validate_only: bool,
15141
15142    /// Optional. If set to true, update succeeds even if instance is not found. In
15143    /// that case, a new backup is created and `update_mask` is ignored.
15144    pub allow_missing: bool,
15145
15146    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15147}
15148
15149impl UpdateBackupRequest {
15150    pub fn new() -> Self {
15151        std::default::Default::default()
15152    }
15153
15154    /// Sets the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
15155    ///
15156    /// # Example
15157    /// ```ignore,no_run
15158    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15159    /// use wkt::FieldMask;
15160    /// let x = UpdateBackupRequest::new().set_update_mask(FieldMask::default()/* use setters */);
15161    /// ```
15162    pub fn set_update_mask<T>(mut self, v: T) -> Self
15163    where
15164        T: std::convert::Into<wkt::FieldMask>,
15165    {
15166        self.update_mask = std::option::Option::Some(v.into());
15167        self
15168    }
15169
15170    /// Sets or clears the value of [update_mask][crate::model::UpdateBackupRequest::update_mask].
15171    ///
15172    /// # Example
15173    /// ```ignore,no_run
15174    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15175    /// use wkt::FieldMask;
15176    /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
15177    /// let x = UpdateBackupRequest::new().set_or_clear_update_mask(None::<FieldMask>);
15178    /// ```
15179    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15180    where
15181        T: std::convert::Into<wkt::FieldMask>,
15182    {
15183        self.update_mask = v.map(|x| x.into());
15184        self
15185    }
15186
15187    /// Sets the value of [backup][crate::model::UpdateBackupRequest::backup].
15188    ///
15189    /// # Example
15190    /// ```ignore,no_run
15191    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15192    /// use google_cloud_alloydb_v1::model::Backup;
15193    /// let x = UpdateBackupRequest::new().set_backup(Backup::default()/* use setters */);
15194    /// ```
15195    pub fn set_backup<T>(mut self, v: T) -> Self
15196    where
15197        T: std::convert::Into<crate::model::Backup>,
15198    {
15199        self.backup = std::option::Option::Some(v.into());
15200        self
15201    }
15202
15203    /// Sets or clears the value of [backup][crate::model::UpdateBackupRequest::backup].
15204    ///
15205    /// # Example
15206    /// ```ignore,no_run
15207    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15208    /// use google_cloud_alloydb_v1::model::Backup;
15209    /// let x = UpdateBackupRequest::new().set_or_clear_backup(Some(Backup::default()/* use setters */));
15210    /// let x = UpdateBackupRequest::new().set_or_clear_backup(None::<Backup>);
15211    /// ```
15212    pub fn set_or_clear_backup<T>(mut self, v: std::option::Option<T>) -> Self
15213    where
15214        T: std::convert::Into<crate::model::Backup>,
15215    {
15216        self.backup = v.map(|x| x.into());
15217        self
15218    }
15219
15220    /// Sets the value of [request_id][crate::model::UpdateBackupRequest::request_id].
15221    ///
15222    /// # Example
15223    /// ```ignore,no_run
15224    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15225    /// let x = UpdateBackupRequest::new().set_request_id("example");
15226    /// ```
15227    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15228        self.request_id = v.into();
15229        self
15230    }
15231
15232    /// Sets the value of [validate_only][crate::model::UpdateBackupRequest::validate_only].
15233    ///
15234    /// # Example
15235    /// ```ignore,no_run
15236    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15237    /// let x = UpdateBackupRequest::new().set_validate_only(true);
15238    /// ```
15239    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15240        self.validate_only = v.into();
15241        self
15242    }
15243
15244    /// Sets the value of [allow_missing][crate::model::UpdateBackupRequest::allow_missing].
15245    ///
15246    /// # Example
15247    /// ```ignore,no_run
15248    /// # use google_cloud_alloydb_v1::model::UpdateBackupRequest;
15249    /// let x = UpdateBackupRequest::new().set_allow_missing(true);
15250    /// ```
15251    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15252        self.allow_missing = v.into();
15253        self
15254    }
15255}
15256
15257impl wkt::message::Message for UpdateBackupRequest {
15258    fn typename() -> &'static str {
15259        "type.googleapis.com/google.cloud.alloydb.v1.UpdateBackupRequest"
15260    }
15261}
15262
15263/// Message for deleting a Backup
15264#[derive(Clone, Default, PartialEq)]
15265#[non_exhaustive]
15266pub struct DeleteBackupRequest {
15267    /// Required. Name of the resource. For the required format, see the comment on
15268    /// the Backup.name field.
15269    pub name: std::string::String,
15270
15271    /// Optional. An optional request ID to identify requests. Specify a unique
15272    /// request ID so that if you must retry your request, the server ignores the
15273    /// request if it has already been completed. The server guarantees that for at
15274    /// least 60 minutes since the first request.
15275    ///
15276    /// For example, consider a situation where you make an initial request and
15277    /// the request times out. If you make the request again with the same request
15278    /// ID, the server can check if the original operation with the same request ID
15279    /// was received, and if so, ignores the second request. This prevents
15280    /// clients from accidentally creating duplicate commitments.
15281    ///
15282    /// The request ID must be a valid UUID with the exception that zero UUID is
15283    /// not supported (00000000-0000-0000-0000-000000000000).
15284    pub request_id: std::string::String,
15285
15286    /// Optional. If set, the backend validates the request, but doesn't actually
15287    /// execute it.
15288    pub validate_only: bool,
15289
15290    /// Optional. The current etag of the Backup.
15291    /// If an etag is provided and does not match the current etag of the Backup,
15292    /// deletion will be blocked and an ABORTED error will be returned.
15293    pub etag: std::string::String,
15294
15295    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15296}
15297
15298impl DeleteBackupRequest {
15299    pub fn new() -> Self {
15300        std::default::Default::default()
15301    }
15302
15303    /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
15304    ///
15305    /// # Example
15306    /// ```ignore,no_run
15307    /// # use google_cloud_alloydb_v1::model::DeleteBackupRequest;
15308    /// let x = DeleteBackupRequest::new().set_name("example");
15309    /// ```
15310    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15311        self.name = v.into();
15312        self
15313    }
15314
15315    /// Sets the value of [request_id][crate::model::DeleteBackupRequest::request_id].
15316    ///
15317    /// # Example
15318    /// ```ignore,no_run
15319    /// # use google_cloud_alloydb_v1::model::DeleteBackupRequest;
15320    /// let x = DeleteBackupRequest::new().set_request_id("example");
15321    /// ```
15322    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15323        self.request_id = v.into();
15324        self
15325    }
15326
15327    /// Sets the value of [validate_only][crate::model::DeleteBackupRequest::validate_only].
15328    ///
15329    /// # Example
15330    /// ```ignore,no_run
15331    /// # use google_cloud_alloydb_v1::model::DeleteBackupRequest;
15332    /// let x = DeleteBackupRequest::new().set_validate_only(true);
15333    /// ```
15334    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15335        self.validate_only = v.into();
15336        self
15337    }
15338
15339    /// Sets the value of [etag][crate::model::DeleteBackupRequest::etag].
15340    ///
15341    /// # Example
15342    /// ```ignore,no_run
15343    /// # use google_cloud_alloydb_v1::model::DeleteBackupRequest;
15344    /// let x = DeleteBackupRequest::new().set_etag("example");
15345    /// ```
15346    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15347        self.etag = v.into();
15348        self
15349    }
15350}
15351
15352impl wkt::message::Message for DeleteBackupRequest {
15353    fn typename() -> &'static str {
15354        "type.googleapis.com/google.cloud.alloydb.v1.DeleteBackupRequest"
15355    }
15356}
15357
15358/// Message for listing the information about the supported Database flags.
15359#[derive(Clone, Default, PartialEq)]
15360#[non_exhaustive]
15361pub struct ListSupportedDatabaseFlagsRequest {
15362    /// Required. The name of the parent resource. The required format is:
15363    ///
15364    /// * projects/{project}/locations/{location}
15365    ///
15366    /// Regardless of the parent specified here, as long it is contains a valid
15367    /// project and location, the service will return a static list of supported
15368    /// flags resources. Note that we do not yet support region-specific
15369    /// flags.
15370    pub parent: std::string::String,
15371
15372    /// Requested page size. Server may return fewer items than requested.
15373    /// If unspecified, server will pick an appropriate default.
15374    pub page_size: i32,
15375
15376    /// A token identifying a page of results the server should return.
15377    pub page_token: std::string::String,
15378
15379    /// Optional. The scope for which supported flags are requested. If not
15380    /// specified, default is DATABASE.
15381    pub scope: crate::model::supported_database_flag::Scope,
15382
15383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15384}
15385
15386impl ListSupportedDatabaseFlagsRequest {
15387    pub fn new() -> Self {
15388        std::default::Default::default()
15389    }
15390
15391    /// Sets the value of [parent][crate::model::ListSupportedDatabaseFlagsRequest::parent].
15392    ///
15393    /// # Example
15394    /// ```ignore,no_run
15395    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsRequest;
15396    /// let x = ListSupportedDatabaseFlagsRequest::new().set_parent("example");
15397    /// ```
15398    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15399        self.parent = v.into();
15400        self
15401    }
15402
15403    /// Sets the value of [page_size][crate::model::ListSupportedDatabaseFlagsRequest::page_size].
15404    ///
15405    /// # Example
15406    /// ```ignore,no_run
15407    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsRequest;
15408    /// let x = ListSupportedDatabaseFlagsRequest::new().set_page_size(42);
15409    /// ```
15410    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15411        self.page_size = v.into();
15412        self
15413    }
15414
15415    /// Sets the value of [page_token][crate::model::ListSupportedDatabaseFlagsRequest::page_token].
15416    ///
15417    /// # Example
15418    /// ```ignore,no_run
15419    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsRequest;
15420    /// let x = ListSupportedDatabaseFlagsRequest::new().set_page_token("example");
15421    /// ```
15422    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15423        self.page_token = v.into();
15424        self
15425    }
15426
15427    /// Sets the value of [scope][crate::model::ListSupportedDatabaseFlagsRequest::scope].
15428    ///
15429    /// # Example
15430    /// ```ignore,no_run
15431    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsRequest;
15432    /// use google_cloud_alloydb_v1::model::supported_database_flag::Scope;
15433    /// let x0 = ListSupportedDatabaseFlagsRequest::new().set_scope(Scope::Database);
15434    /// let x1 = ListSupportedDatabaseFlagsRequest::new().set_scope(Scope::ConnectionPool);
15435    /// ```
15436    pub fn set_scope<T: std::convert::Into<crate::model::supported_database_flag::Scope>>(
15437        mut self,
15438        v: T,
15439    ) -> Self {
15440        self.scope = v.into();
15441        self
15442    }
15443}
15444
15445impl wkt::message::Message for ListSupportedDatabaseFlagsRequest {
15446    fn typename() -> &'static str {
15447        "type.googleapis.com/google.cloud.alloydb.v1.ListSupportedDatabaseFlagsRequest"
15448    }
15449}
15450
15451/// Message for response to listing SupportedDatabaseFlags.
15452#[derive(Clone, Default, PartialEq)]
15453#[non_exhaustive]
15454pub struct ListSupportedDatabaseFlagsResponse {
15455    /// The list of SupportedDatabaseFlags.
15456    pub supported_database_flags: std::vec::Vec<crate::model::SupportedDatabaseFlag>,
15457
15458    /// A token identifying a page of results the server should return.
15459    pub next_page_token: std::string::String,
15460
15461    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15462}
15463
15464impl ListSupportedDatabaseFlagsResponse {
15465    pub fn new() -> Self {
15466        std::default::Default::default()
15467    }
15468
15469    /// Sets the value of [supported_database_flags][crate::model::ListSupportedDatabaseFlagsResponse::supported_database_flags].
15470    ///
15471    /// # Example
15472    /// ```ignore,no_run
15473    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsResponse;
15474    /// use google_cloud_alloydb_v1::model::SupportedDatabaseFlag;
15475    /// let x = ListSupportedDatabaseFlagsResponse::new()
15476    ///     .set_supported_database_flags([
15477    ///         SupportedDatabaseFlag::default()/* use setters */,
15478    ///         SupportedDatabaseFlag::default()/* use (different) setters */,
15479    ///     ]);
15480    /// ```
15481    pub fn set_supported_database_flags<T, V>(mut self, v: T) -> Self
15482    where
15483        T: std::iter::IntoIterator<Item = V>,
15484        V: std::convert::Into<crate::model::SupportedDatabaseFlag>,
15485    {
15486        use std::iter::Iterator;
15487        self.supported_database_flags = v.into_iter().map(|i| i.into()).collect();
15488        self
15489    }
15490
15491    /// Sets the value of [next_page_token][crate::model::ListSupportedDatabaseFlagsResponse::next_page_token].
15492    ///
15493    /// # Example
15494    /// ```ignore,no_run
15495    /// # use google_cloud_alloydb_v1::model::ListSupportedDatabaseFlagsResponse;
15496    /// let x = ListSupportedDatabaseFlagsResponse::new().set_next_page_token("example");
15497    /// ```
15498    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15499        self.next_page_token = v.into();
15500        self
15501    }
15502}
15503
15504impl wkt::message::Message for ListSupportedDatabaseFlagsResponse {
15505    fn typename() -> &'static str {
15506        "type.googleapis.com/google.cloud.alloydb.v1.ListSupportedDatabaseFlagsResponse"
15507    }
15508}
15509
15510#[doc(hidden)]
15511impl google_cloud_gax::paginator::internal::PageableResponse
15512    for ListSupportedDatabaseFlagsResponse
15513{
15514    type PageItem = crate::model::SupportedDatabaseFlag;
15515
15516    fn items(self) -> std::vec::Vec<Self::PageItem> {
15517        self.supported_database_flags
15518    }
15519
15520    fn next_page_token(&self) -> std::string::String {
15521        use std::clone::Clone;
15522        self.next_page_token.clone()
15523    }
15524}
15525
15526/// Message for requests to generate a client certificate signed by the Cluster
15527/// CA.
15528#[derive(Clone, Default, PartialEq)]
15529#[non_exhaustive]
15530pub struct GenerateClientCertificateRequest {
15531    /// Required. The name of the parent resource. The required format is:
15532    ///
15533    /// * projects/{project}/locations/{location}/clusters/{cluster}
15534    pub parent: std::string::String,
15535
15536    /// Optional. An optional request ID to identify requests. Specify a unique
15537    /// request ID so that if you must retry your request, the server ignores the
15538    /// request if it has already been completed. The server guarantees that for at
15539    /// least 60 minutes since the first request.
15540    ///
15541    /// For example, consider a situation where you make an initial request and
15542    /// the request times out. If you make the request again with the same request
15543    /// ID, the server can check if the original operation with the same request ID
15544    /// was received, and if so, ignores the second request. This prevents
15545    /// clients from accidentally creating duplicate commitments.
15546    ///
15547    /// The request ID must be a valid UUID with the exception that zero UUID is
15548    /// not supported (00000000-0000-0000-0000-000000000000).
15549    pub request_id: std::string::String,
15550
15551    /// Optional. An optional hint to the endpoint to generate the client
15552    /// certificate with the requested duration. The duration can be from 1 hour to
15553    /// 24 hours. The endpoint may or may not honor the hint. If the hint is left
15554    /// unspecified or is not honored, then the endpoint will pick an appropriate
15555    /// default duration.
15556    pub cert_duration: std::option::Option<wkt::Duration>,
15557
15558    /// Optional. The public key from the client.
15559    pub public_key: std::string::String,
15560
15561    /// Optional. An optional hint to the endpoint to generate a client certificate
15562    /// that can be used by AlloyDB connectors to exchange additional metadata with
15563    /// the server after TLS handshake.
15564    pub use_metadata_exchange: bool,
15565
15566    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15567}
15568
15569impl GenerateClientCertificateRequest {
15570    pub fn new() -> Self {
15571        std::default::Default::default()
15572    }
15573
15574    /// Sets the value of [parent][crate::model::GenerateClientCertificateRequest::parent].
15575    ///
15576    /// # Example
15577    /// ```ignore,no_run
15578    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15579    /// let x = GenerateClientCertificateRequest::new().set_parent("example");
15580    /// ```
15581    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15582        self.parent = v.into();
15583        self
15584    }
15585
15586    /// Sets the value of [request_id][crate::model::GenerateClientCertificateRequest::request_id].
15587    ///
15588    /// # Example
15589    /// ```ignore,no_run
15590    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15591    /// let x = GenerateClientCertificateRequest::new().set_request_id("example");
15592    /// ```
15593    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15594        self.request_id = v.into();
15595        self
15596    }
15597
15598    /// Sets the value of [cert_duration][crate::model::GenerateClientCertificateRequest::cert_duration].
15599    ///
15600    /// # Example
15601    /// ```ignore,no_run
15602    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15603    /// use wkt::Duration;
15604    /// let x = GenerateClientCertificateRequest::new().set_cert_duration(Duration::default()/* use setters */);
15605    /// ```
15606    pub fn set_cert_duration<T>(mut self, v: T) -> Self
15607    where
15608        T: std::convert::Into<wkt::Duration>,
15609    {
15610        self.cert_duration = std::option::Option::Some(v.into());
15611        self
15612    }
15613
15614    /// Sets or clears the value of [cert_duration][crate::model::GenerateClientCertificateRequest::cert_duration].
15615    ///
15616    /// # Example
15617    /// ```ignore,no_run
15618    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15619    /// use wkt::Duration;
15620    /// let x = GenerateClientCertificateRequest::new().set_or_clear_cert_duration(Some(Duration::default()/* use setters */));
15621    /// let x = GenerateClientCertificateRequest::new().set_or_clear_cert_duration(None::<Duration>);
15622    /// ```
15623    pub fn set_or_clear_cert_duration<T>(mut self, v: std::option::Option<T>) -> Self
15624    where
15625        T: std::convert::Into<wkt::Duration>,
15626    {
15627        self.cert_duration = v.map(|x| x.into());
15628        self
15629    }
15630
15631    /// Sets the value of [public_key][crate::model::GenerateClientCertificateRequest::public_key].
15632    ///
15633    /// # Example
15634    /// ```ignore,no_run
15635    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15636    /// let x = GenerateClientCertificateRequest::new().set_public_key("example");
15637    /// ```
15638    pub fn set_public_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15639        self.public_key = v.into();
15640        self
15641    }
15642
15643    /// Sets the value of [use_metadata_exchange][crate::model::GenerateClientCertificateRequest::use_metadata_exchange].
15644    ///
15645    /// # Example
15646    /// ```ignore,no_run
15647    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateRequest;
15648    /// let x = GenerateClientCertificateRequest::new().set_use_metadata_exchange(true);
15649    /// ```
15650    pub fn set_use_metadata_exchange<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15651        self.use_metadata_exchange = v.into();
15652        self
15653    }
15654}
15655
15656impl wkt::message::Message for GenerateClientCertificateRequest {
15657    fn typename() -> &'static str {
15658        "type.googleapis.com/google.cloud.alloydb.v1.GenerateClientCertificateRequest"
15659    }
15660}
15661
15662/// Message returned by a GenerateClientCertificate operation.
15663#[derive(Clone, Default, PartialEq)]
15664#[non_exhaustive]
15665pub struct GenerateClientCertificateResponse {
15666    /// Output only. The pem-encoded chain that may be used to verify the X.509
15667    /// certificate. Expected to be in issuer-to-root order according to RFC 5246.
15668    pub pem_certificate_chain: std::vec::Vec<std::string::String>,
15669
15670    /// Optional. The pem-encoded cluster ca X.509 certificate.
15671    pub ca_cert: std::string::String,
15672
15673    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15674}
15675
15676impl GenerateClientCertificateResponse {
15677    pub fn new() -> Self {
15678        std::default::Default::default()
15679    }
15680
15681    /// Sets the value of [pem_certificate_chain][crate::model::GenerateClientCertificateResponse::pem_certificate_chain].
15682    ///
15683    /// # Example
15684    /// ```ignore,no_run
15685    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateResponse;
15686    /// let x = GenerateClientCertificateResponse::new().set_pem_certificate_chain(["a", "b", "c"]);
15687    /// ```
15688    pub fn set_pem_certificate_chain<T, V>(mut self, v: T) -> Self
15689    where
15690        T: std::iter::IntoIterator<Item = V>,
15691        V: std::convert::Into<std::string::String>,
15692    {
15693        use std::iter::Iterator;
15694        self.pem_certificate_chain = v.into_iter().map(|i| i.into()).collect();
15695        self
15696    }
15697
15698    /// Sets the value of [ca_cert][crate::model::GenerateClientCertificateResponse::ca_cert].
15699    ///
15700    /// # Example
15701    /// ```ignore,no_run
15702    /// # use google_cloud_alloydb_v1::model::GenerateClientCertificateResponse;
15703    /// let x = GenerateClientCertificateResponse::new().set_ca_cert("example");
15704    /// ```
15705    pub fn set_ca_cert<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15706        self.ca_cert = v.into();
15707        self
15708    }
15709}
15710
15711impl wkt::message::Message for GenerateClientCertificateResponse {
15712    fn typename() -> &'static str {
15713        "type.googleapis.com/google.cloud.alloydb.v1.GenerateClientCertificateResponse"
15714    }
15715}
15716
15717/// Request message for GetConnectionInfo.
15718#[derive(Clone, Default, PartialEq)]
15719#[non_exhaustive]
15720pub struct GetConnectionInfoRequest {
15721    /// Required. The name of the parent resource. The required format is:
15722    /// projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}
15723    pub parent: std::string::String,
15724
15725    /// Optional. An optional request ID to identify requests. Specify a unique
15726    /// request ID so that if you must retry your request, the server ignores the
15727    /// request if it has already been completed. The server guarantees that for at
15728    /// least 60 minutes since the first request.
15729    ///
15730    /// For example, consider a situation where you make an initial request and
15731    /// the request times out. If you make the request again with the same request
15732    /// ID, the server can check if the original operation with the same request ID
15733    /// was received, and if so, ignores the second request. This prevents
15734    /// clients from accidentally creating duplicate commitments.
15735    ///
15736    /// The request ID must be a valid UUID with the exception that zero UUID is
15737    /// not supported (00000000-0000-0000-0000-000000000000).
15738    pub request_id: std::string::String,
15739
15740    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15741}
15742
15743impl GetConnectionInfoRequest {
15744    pub fn new() -> Self {
15745        std::default::Default::default()
15746    }
15747
15748    /// Sets the value of [parent][crate::model::GetConnectionInfoRequest::parent].
15749    ///
15750    /// # Example
15751    /// ```ignore,no_run
15752    /// # use google_cloud_alloydb_v1::model::GetConnectionInfoRequest;
15753    /// let x = GetConnectionInfoRequest::new().set_parent("example");
15754    /// ```
15755    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15756        self.parent = v.into();
15757        self
15758    }
15759
15760    /// Sets the value of [request_id][crate::model::GetConnectionInfoRequest::request_id].
15761    ///
15762    /// # Example
15763    /// ```ignore,no_run
15764    /// # use google_cloud_alloydb_v1::model::GetConnectionInfoRequest;
15765    /// let x = GetConnectionInfoRequest::new().set_request_id("example");
15766    /// ```
15767    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15768        self.request_id = v.into();
15769        self
15770    }
15771}
15772
15773impl wkt::message::Message for GetConnectionInfoRequest {
15774    fn typename() -> &'static str {
15775        "type.googleapis.com/google.cloud.alloydb.v1.GetConnectionInfoRequest"
15776    }
15777}
15778
15779/// Represents the metadata of the long-running operation.
15780#[derive(Clone, Default, PartialEq)]
15781#[non_exhaustive]
15782pub struct OperationMetadata {
15783    /// Output only. The time the operation was created.
15784    pub create_time: std::option::Option<wkt::Timestamp>,
15785
15786    /// Output only. The time the operation finished running.
15787    pub end_time: std::option::Option<wkt::Timestamp>,
15788
15789    /// Output only. Server-defined resource path for the target of the operation.
15790    pub target: std::string::String,
15791
15792    /// Output only. Name of the verb executed by the operation.
15793    pub verb: std::string::String,
15794
15795    /// Output only. Human-readable status of the operation, if any.
15796    pub status_message: std::string::String,
15797
15798    /// Output only. Identifies whether the user has requested cancellation
15799    /// of the operation. Operations that have successfully been cancelled
15800    /// have
15801    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
15802    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
15803    /// corresponding to `Code.CANCELLED`.
15804    ///
15805    /// [google.longrunning.Operation.error]: google_cloud_longrunning::model::Operation::result
15806    /// [google.rpc.Status.code]: google_cloud_rpc::model::Status::code
15807    pub requested_cancellation: bool,
15808
15809    /// Output only. API version used to start the operation.
15810    pub api_version: std::string::String,
15811
15812    /// Request specific metadata, if any.
15813    pub request_specific: std::option::Option<crate::model::operation_metadata::RequestSpecific>,
15814
15815    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15816}
15817
15818impl OperationMetadata {
15819    pub fn new() -> Self {
15820        std::default::Default::default()
15821    }
15822
15823    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
15824    ///
15825    /// # Example
15826    /// ```ignore,no_run
15827    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15828    /// use wkt::Timestamp;
15829    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
15830    /// ```
15831    pub fn set_create_time<T>(mut self, v: T) -> Self
15832    where
15833        T: std::convert::Into<wkt::Timestamp>,
15834    {
15835        self.create_time = std::option::Option::Some(v.into());
15836        self
15837    }
15838
15839    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
15840    ///
15841    /// # Example
15842    /// ```ignore,no_run
15843    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15844    /// use wkt::Timestamp;
15845    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15846    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
15847    /// ```
15848    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15849    where
15850        T: std::convert::Into<wkt::Timestamp>,
15851    {
15852        self.create_time = v.map(|x| x.into());
15853        self
15854    }
15855
15856    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
15857    ///
15858    /// # Example
15859    /// ```ignore,no_run
15860    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15861    /// use wkt::Timestamp;
15862    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
15863    /// ```
15864    pub fn set_end_time<T>(mut self, v: T) -> Self
15865    where
15866        T: std::convert::Into<wkt::Timestamp>,
15867    {
15868        self.end_time = std::option::Option::Some(v.into());
15869        self
15870    }
15871
15872    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
15873    ///
15874    /// # Example
15875    /// ```ignore,no_run
15876    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15877    /// use wkt::Timestamp;
15878    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
15879    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
15880    /// ```
15881    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
15882    where
15883        T: std::convert::Into<wkt::Timestamp>,
15884    {
15885        self.end_time = v.map(|x| x.into());
15886        self
15887    }
15888
15889    /// Sets the value of [target][crate::model::OperationMetadata::target].
15890    ///
15891    /// # Example
15892    /// ```ignore,no_run
15893    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15894    /// let x = OperationMetadata::new().set_target("example");
15895    /// ```
15896    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15897        self.target = v.into();
15898        self
15899    }
15900
15901    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
15902    ///
15903    /// # Example
15904    /// ```ignore,no_run
15905    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15906    /// let x = OperationMetadata::new().set_verb("example");
15907    /// ```
15908    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15909        self.verb = v.into();
15910        self
15911    }
15912
15913    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
15914    ///
15915    /// # Example
15916    /// ```ignore,no_run
15917    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15918    /// let x = OperationMetadata::new().set_status_message("example");
15919    /// ```
15920    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15921        self.status_message = v.into();
15922        self
15923    }
15924
15925    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
15926    ///
15927    /// # Example
15928    /// ```ignore,no_run
15929    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15930    /// let x = OperationMetadata::new().set_requested_cancellation(true);
15931    /// ```
15932    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15933        self.requested_cancellation = v.into();
15934        self
15935    }
15936
15937    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
15938    ///
15939    /// # Example
15940    /// ```ignore,no_run
15941    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15942    /// let x = OperationMetadata::new().set_api_version("example");
15943    /// ```
15944    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15945        self.api_version = v.into();
15946        self
15947    }
15948
15949    /// Sets the value of [request_specific][crate::model::OperationMetadata::request_specific].
15950    ///
15951    /// Note that all the setters affecting `request_specific` are mutually
15952    /// exclusive.
15953    ///
15954    /// # Example
15955    /// ```ignore,no_run
15956    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15957    /// use google_cloud_alloydb_v1::model::BatchCreateInstancesMetadata;
15958    /// let x = OperationMetadata::new().set_request_specific(Some(
15959    ///     google_cloud_alloydb_v1::model::operation_metadata::RequestSpecific::BatchCreateInstancesMetadata(BatchCreateInstancesMetadata::default().into())));
15960    /// ```
15961    pub fn set_request_specific<
15962        T: std::convert::Into<std::option::Option<crate::model::operation_metadata::RequestSpecific>>,
15963    >(
15964        mut self,
15965        v: T,
15966    ) -> Self {
15967        self.request_specific = v.into();
15968        self
15969    }
15970
15971    /// The value of [request_specific][crate::model::OperationMetadata::request_specific]
15972    /// if it holds a `BatchCreateInstancesMetadata`, `None` if the field is not set or
15973    /// holds a different branch.
15974    pub fn batch_create_instances_metadata(
15975        &self,
15976    ) -> std::option::Option<&std::boxed::Box<crate::model::BatchCreateInstancesMetadata>> {
15977        #[allow(unreachable_patterns)]
15978        self.request_specific.as_ref().and_then(|v| match v {
15979            crate::model::operation_metadata::RequestSpecific::BatchCreateInstancesMetadata(v) => {
15980                std::option::Option::Some(v)
15981            }
15982            _ => std::option::Option::None,
15983        })
15984    }
15985
15986    /// Sets the value of [request_specific][crate::model::OperationMetadata::request_specific]
15987    /// to hold a `BatchCreateInstancesMetadata`.
15988    ///
15989    /// Note that all the setters affecting `request_specific` are
15990    /// mutually exclusive.
15991    ///
15992    /// # Example
15993    /// ```ignore,no_run
15994    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
15995    /// use google_cloud_alloydb_v1::model::BatchCreateInstancesMetadata;
15996    /// let x = OperationMetadata::new().set_batch_create_instances_metadata(BatchCreateInstancesMetadata::default()/* use setters */);
15997    /// assert!(x.batch_create_instances_metadata().is_some());
15998    /// assert!(x.upgrade_cluster_status().is_none());
15999    /// ```
16000    pub fn set_batch_create_instances_metadata<
16001        T: std::convert::Into<std::boxed::Box<crate::model::BatchCreateInstancesMetadata>>,
16002    >(
16003        mut self,
16004        v: T,
16005    ) -> Self {
16006        self.request_specific = std::option::Option::Some(
16007            crate::model::operation_metadata::RequestSpecific::BatchCreateInstancesMetadata(
16008                v.into(),
16009            ),
16010        );
16011        self
16012    }
16013
16014    /// The value of [request_specific][crate::model::OperationMetadata::request_specific]
16015    /// if it holds a `UpgradeClusterStatus`, `None` if the field is not set or
16016    /// holds a different branch.
16017    pub fn upgrade_cluster_status(
16018        &self,
16019    ) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeClusterStatus>> {
16020        #[allow(unreachable_patterns)]
16021        self.request_specific.as_ref().and_then(|v| match v {
16022            crate::model::operation_metadata::RequestSpecific::UpgradeClusterStatus(v) => {
16023                std::option::Option::Some(v)
16024            }
16025            _ => std::option::Option::None,
16026        })
16027    }
16028
16029    /// Sets the value of [request_specific][crate::model::OperationMetadata::request_specific]
16030    /// to hold a `UpgradeClusterStatus`.
16031    ///
16032    /// Note that all the setters affecting `request_specific` are
16033    /// mutually exclusive.
16034    ///
16035    /// # Example
16036    /// ```ignore,no_run
16037    /// # use google_cloud_alloydb_v1::model::OperationMetadata;
16038    /// use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16039    /// let x = OperationMetadata::new().set_upgrade_cluster_status(UpgradeClusterStatus::default()/* use setters */);
16040    /// assert!(x.upgrade_cluster_status().is_some());
16041    /// assert!(x.batch_create_instances_metadata().is_none());
16042    /// ```
16043    pub fn set_upgrade_cluster_status<
16044        T: std::convert::Into<std::boxed::Box<crate::model::UpgradeClusterStatus>>,
16045    >(
16046        mut self,
16047        v: T,
16048    ) -> Self {
16049        self.request_specific = std::option::Option::Some(
16050            crate::model::operation_metadata::RequestSpecific::UpgradeClusterStatus(v.into()),
16051        );
16052        self
16053    }
16054}
16055
16056impl wkt::message::Message for OperationMetadata {
16057    fn typename() -> &'static str {
16058        "type.googleapis.com/google.cloud.alloydb.v1.OperationMetadata"
16059    }
16060}
16061
16062/// Defines additional types related to [OperationMetadata].
16063pub mod operation_metadata {
16064    #[allow(unused_imports)]
16065    use super::*;
16066
16067    /// Request specific metadata, if any.
16068    #[derive(Clone, Debug, PartialEq)]
16069    #[non_exhaustive]
16070    pub enum RequestSpecific {
16071        /// Output only. BatchCreateInstances related metadata.
16072        BatchCreateInstancesMetadata(std::boxed::Box<crate::model::BatchCreateInstancesMetadata>),
16073        /// Output only. UpgradeClusterStatus related metadata.
16074        UpgradeClusterStatus(std::boxed::Box<crate::model::UpgradeClusterStatus>),
16075    }
16076}
16077
16078/// Message for current status of the Major Version Upgrade operation.
16079#[derive(Clone, Default, PartialEq)]
16080#[non_exhaustive]
16081pub struct UpgradeClusterStatus {
16082    /// Cluster Major Version Upgrade state.
16083    pub state: crate::model::upgrade_cluster_response::Status,
16084
16085    /// Whether the operation is cancellable.
16086    pub cancellable: bool,
16087
16088    /// Source database major version.
16089    pub source_version: crate::model::DatabaseVersion,
16090
16091    /// Target database major version.
16092    pub target_version: crate::model::DatabaseVersion,
16093
16094    /// Status of all upgrade stages.
16095    pub stages: std::vec::Vec<crate::model::upgrade_cluster_status::StageStatus>,
16096
16097    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16098}
16099
16100impl UpgradeClusterStatus {
16101    pub fn new() -> Self {
16102        std::default::Default::default()
16103    }
16104
16105    /// Sets the value of [state][crate::model::UpgradeClusterStatus::state].
16106    ///
16107    /// # Example
16108    /// ```ignore,no_run
16109    /// # use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16110    /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
16111    /// let x0 = UpgradeClusterStatus::new().set_state(Status::NotStarted);
16112    /// let x1 = UpgradeClusterStatus::new().set_state(Status::InProgress);
16113    /// let x2 = UpgradeClusterStatus::new().set_state(Status::Success);
16114    /// ```
16115    pub fn set_state<T: std::convert::Into<crate::model::upgrade_cluster_response::Status>>(
16116        mut self,
16117        v: T,
16118    ) -> Self {
16119        self.state = v.into();
16120        self
16121    }
16122
16123    /// Sets the value of [cancellable][crate::model::UpgradeClusterStatus::cancellable].
16124    ///
16125    /// # Example
16126    /// ```ignore,no_run
16127    /// # use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16128    /// let x = UpgradeClusterStatus::new().set_cancellable(true);
16129    /// ```
16130    pub fn set_cancellable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16131        self.cancellable = v.into();
16132        self
16133    }
16134
16135    /// Sets the value of [source_version][crate::model::UpgradeClusterStatus::source_version].
16136    ///
16137    /// # Example
16138    /// ```ignore,no_run
16139    /// # use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16140    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
16141    /// let x0 = UpgradeClusterStatus::new().set_source_version(DatabaseVersion::Postgres14);
16142    /// let x1 = UpgradeClusterStatus::new().set_source_version(DatabaseVersion::Postgres15);
16143    /// let x2 = UpgradeClusterStatus::new().set_source_version(DatabaseVersion::Postgres16);
16144    /// ```
16145    pub fn set_source_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
16146        mut self,
16147        v: T,
16148    ) -> Self {
16149        self.source_version = v.into();
16150        self
16151    }
16152
16153    /// Sets the value of [target_version][crate::model::UpgradeClusterStatus::target_version].
16154    ///
16155    /// # Example
16156    /// ```ignore,no_run
16157    /// # use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16158    /// use google_cloud_alloydb_v1::model::DatabaseVersion;
16159    /// let x0 = UpgradeClusterStatus::new().set_target_version(DatabaseVersion::Postgres14);
16160    /// let x1 = UpgradeClusterStatus::new().set_target_version(DatabaseVersion::Postgres15);
16161    /// let x2 = UpgradeClusterStatus::new().set_target_version(DatabaseVersion::Postgres16);
16162    /// ```
16163    pub fn set_target_version<T: std::convert::Into<crate::model::DatabaseVersion>>(
16164        mut self,
16165        v: T,
16166    ) -> Self {
16167        self.target_version = v.into();
16168        self
16169    }
16170
16171    /// Sets the value of [stages][crate::model::UpgradeClusterStatus::stages].
16172    ///
16173    /// # Example
16174    /// ```ignore,no_run
16175    /// # use google_cloud_alloydb_v1::model::UpgradeClusterStatus;
16176    /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16177    /// let x = UpgradeClusterStatus::new()
16178    ///     .set_stages([
16179    ///         StageStatus::default()/* use setters */,
16180    ///         StageStatus::default()/* use (different) setters */,
16181    ///     ]);
16182    /// ```
16183    pub fn set_stages<T, V>(mut self, v: T) -> Self
16184    where
16185        T: std::iter::IntoIterator<Item = V>,
16186        V: std::convert::Into<crate::model::upgrade_cluster_status::StageStatus>,
16187    {
16188        use std::iter::Iterator;
16189        self.stages = v.into_iter().map(|i| i.into()).collect();
16190        self
16191    }
16192}
16193
16194impl wkt::message::Message for UpgradeClusterStatus {
16195    fn typename() -> &'static str {
16196        "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterStatus"
16197    }
16198}
16199
16200/// Defines additional types related to [UpgradeClusterStatus].
16201pub mod upgrade_cluster_status {
16202    #[allow(unused_imports)]
16203    use super::*;
16204
16205    /// Status of an upgrade stage.
16206    #[derive(Clone, Default, PartialEq)]
16207    #[non_exhaustive]
16208    pub struct StageStatus {
16209        /// Upgrade stage.
16210        pub stage: crate::model::upgrade_cluster_response::Stage,
16211
16212        /// State of this stage.
16213        pub state: crate::model::upgrade_cluster_response::Status,
16214
16215        /// Output only. Timing information for the stage execution.
16216        pub schedule:
16217            std::option::Option<crate::model::upgrade_cluster_status::stage_status::StageSchedule>,
16218
16219        /// Stage specific status information, if any.
16220        pub stage_specific_status: std::option::Option<
16221            crate::model::upgrade_cluster_status::stage_status::StageSpecificStatus,
16222        >,
16223
16224        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16225    }
16226
16227    impl StageStatus {
16228        pub fn new() -> Self {
16229            std::default::Default::default()
16230        }
16231
16232        /// Sets the value of [stage][crate::model::upgrade_cluster_status::StageStatus::stage].
16233        ///
16234        /// # Example
16235        /// ```ignore,no_run
16236        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16237        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Stage;
16238        /// let x0 = StageStatus::new().set_stage(Stage::AlloydbPrecheck);
16239        /// let x1 = StageStatus::new().set_stage(Stage::PgUpgradeCheck);
16240        /// let x2 = StageStatus::new().set_stage(Stage::PrepareForUpgrade);
16241        /// ```
16242        pub fn set_stage<T: std::convert::Into<crate::model::upgrade_cluster_response::Stage>>(
16243            mut self,
16244            v: T,
16245        ) -> Self {
16246            self.stage = v.into();
16247            self
16248        }
16249
16250        /// Sets the value of [state][crate::model::upgrade_cluster_status::StageStatus::state].
16251        ///
16252        /// # Example
16253        /// ```ignore,no_run
16254        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16255        /// use google_cloud_alloydb_v1::model::upgrade_cluster_response::Status;
16256        /// let x0 = StageStatus::new().set_state(Status::NotStarted);
16257        /// let x1 = StageStatus::new().set_state(Status::InProgress);
16258        /// let x2 = StageStatus::new().set_state(Status::Success);
16259        /// ```
16260        pub fn set_state<T: std::convert::Into<crate::model::upgrade_cluster_response::Status>>(
16261            mut self,
16262            v: T,
16263        ) -> Self {
16264            self.state = v.into();
16265            self
16266        }
16267
16268        /// Sets the value of [schedule][crate::model::upgrade_cluster_status::StageStatus::schedule].
16269        ///
16270        /// # Example
16271        /// ```ignore,no_run
16272        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16273        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16274        /// let x = StageStatus::new().set_schedule(StageSchedule::default()/* use setters */);
16275        /// ```
16276        pub fn set_schedule<T>(mut self, v: T) -> Self
16277        where
16278            T: std::convert::Into<
16279                    crate::model::upgrade_cluster_status::stage_status::StageSchedule,
16280                >,
16281        {
16282            self.schedule = std::option::Option::Some(v.into());
16283            self
16284        }
16285
16286        /// Sets or clears the value of [schedule][crate::model::upgrade_cluster_status::StageStatus::schedule].
16287        ///
16288        /// # Example
16289        /// ```ignore,no_run
16290        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16291        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16292        /// let x = StageStatus::new().set_or_clear_schedule(Some(StageSchedule::default()/* use setters */));
16293        /// let x = StageStatus::new().set_or_clear_schedule(None::<StageSchedule>);
16294        /// ```
16295        pub fn set_or_clear_schedule<T>(mut self, v: std::option::Option<T>) -> Self
16296        where
16297            T: std::convert::Into<
16298                    crate::model::upgrade_cluster_status::stage_status::StageSchedule,
16299                >,
16300        {
16301            self.schedule = v.map(|x| x.into());
16302            self
16303        }
16304
16305        /// Sets the value of [stage_specific_status][crate::model::upgrade_cluster_status::StageStatus::stage_specific_status].
16306        ///
16307        /// Note that all the setters affecting `stage_specific_status` are mutually
16308        /// exclusive.
16309        ///
16310        /// # Example
16311        /// ```ignore,no_run
16312        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16313        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus;
16314        /// let x = StageStatus::new().set_stage_specific_status(Some(
16315        ///     google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSpecificStatus::ReadPoolInstancesUpgrade(ReadPoolInstancesUpgradeStageStatus::default().into())));
16316        /// ```
16317        pub fn set_stage_specific_status<
16318            T: std::convert::Into<
16319                    std::option::Option<
16320                        crate::model::upgrade_cluster_status::stage_status::StageSpecificStatus,
16321                    >,
16322                >,
16323        >(
16324            mut self,
16325            v: T,
16326        ) -> Self {
16327            self.stage_specific_status = v.into();
16328            self
16329        }
16330
16331        /// The value of [stage_specific_status][crate::model::upgrade_cluster_status::StageStatus::stage_specific_status]
16332        /// if it holds a `ReadPoolInstancesUpgrade`, `None` if the field is not set or
16333        /// holds a different branch.
16334        pub fn read_pool_instances_upgrade(
16335            &self,
16336        ) -> std::option::Option<
16337            &std::boxed::Box<
16338                crate::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus,
16339            >,
16340        > {
16341            #[allow(unreachable_patterns)]
16342            self.stage_specific_status.as_ref().and_then(|v| match v {
16343                crate::model::upgrade_cluster_status::stage_status::StageSpecificStatus::ReadPoolInstancesUpgrade(v) => std::option::Option::Some(v),
16344                _ => std::option::Option::None,
16345            })
16346        }
16347
16348        /// Sets the value of [stage_specific_status][crate::model::upgrade_cluster_status::StageStatus::stage_specific_status]
16349        /// to hold a `ReadPoolInstancesUpgrade`.
16350        ///
16351        /// Note that all the setters affecting `stage_specific_status` are
16352        /// mutually exclusive.
16353        ///
16354        /// # Example
16355        /// ```ignore,no_run
16356        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::StageStatus;
16357        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus;
16358        /// let x = StageStatus::new().set_read_pool_instances_upgrade(ReadPoolInstancesUpgradeStageStatus::default()/* use setters */);
16359        /// assert!(x.read_pool_instances_upgrade().is_some());
16360        /// ```
16361        pub fn set_read_pool_instances_upgrade<
16362            T: std::convert::Into<
16363                    std::boxed::Box<
16364                        crate::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus,
16365                    >,
16366                >,
16367        >(
16368            mut self,
16369            v: T,
16370        ) -> Self {
16371            self.stage_specific_status = std::option::Option::Some(
16372                crate::model::upgrade_cluster_status::stage_status::StageSpecificStatus::ReadPoolInstancesUpgrade(
16373                    v.into()
16374                )
16375            );
16376            self
16377        }
16378    }
16379
16380    impl wkt::message::Message for StageStatus {
16381        fn typename() -> &'static str {
16382            "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterStatus.StageStatus"
16383        }
16384    }
16385
16386    /// Defines additional types related to [StageStatus].
16387    pub mod stage_status {
16388        #[allow(unused_imports)]
16389        use super::*;
16390
16391        /// Timing information for the stage execution.
16392        #[derive(Clone, Default, PartialEq)]
16393        #[non_exhaustive]
16394        pub struct StageSchedule {
16395            /// When the stage is expected to start. Set only if the stage has not
16396            /// started yet.
16397            pub estimated_start_time: std::option::Option<wkt::Timestamp>,
16398
16399            /// Actual start time of the stage. Set only if the stage has started.
16400            pub actual_start_time: std::option::Option<wkt::Timestamp>,
16401
16402            /// When the stage is expected to end. Set only if the stage has not
16403            /// completed yet.
16404            pub estimated_end_time: std::option::Option<wkt::Timestamp>,
16405
16406            /// Actual end time of the stage. Set only if the stage has completed.
16407            pub actual_end_time: std::option::Option<wkt::Timestamp>,
16408
16409            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16410        }
16411
16412        impl StageSchedule {
16413            pub fn new() -> Self {
16414                std::default::Default::default()
16415            }
16416
16417            /// Sets the value of [estimated_start_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::estimated_start_time].
16418            ///
16419            /// # Example
16420            /// ```ignore,no_run
16421            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16422            /// use wkt::Timestamp;
16423            /// let x = StageSchedule::new().set_estimated_start_time(Timestamp::default()/* use setters */);
16424            /// ```
16425            pub fn set_estimated_start_time<T>(mut self, v: T) -> Self
16426            where
16427                T: std::convert::Into<wkt::Timestamp>,
16428            {
16429                self.estimated_start_time = std::option::Option::Some(v.into());
16430                self
16431            }
16432
16433            /// Sets or clears the value of [estimated_start_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::estimated_start_time].
16434            ///
16435            /// # Example
16436            /// ```ignore,no_run
16437            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16438            /// use wkt::Timestamp;
16439            /// let x = StageSchedule::new().set_or_clear_estimated_start_time(Some(Timestamp::default()/* use setters */));
16440            /// let x = StageSchedule::new().set_or_clear_estimated_start_time(None::<Timestamp>);
16441            /// ```
16442            pub fn set_or_clear_estimated_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16443            where
16444                T: std::convert::Into<wkt::Timestamp>,
16445            {
16446                self.estimated_start_time = v.map(|x| x.into());
16447                self
16448            }
16449
16450            /// Sets the value of [actual_start_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::actual_start_time].
16451            ///
16452            /// # Example
16453            /// ```ignore,no_run
16454            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16455            /// use wkt::Timestamp;
16456            /// let x = StageSchedule::new().set_actual_start_time(Timestamp::default()/* use setters */);
16457            /// ```
16458            pub fn set_actual_start_time<T>(mut self, v: T) -> Self
16459            where
16460                T: std::convert::Into<wkt::Timestamp>,
16461            {
16462                self.actual_start_time = std::option::Option::Some(v.into());
16463                self
16464            }
16465
16466            /// Sets or clears the value of [actual_start_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::actual_start_time].
16467            ///
16468            /// # Example
16469            /// ```ignore,no_run
16470            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16471            /// use wkt::Timestamp;
16472            /// let x = StageSchedule::new().set_or_clear_actual_start_time(Some(Timestamp::default()/* use setters */));
16473            /// let x = StageSchedule::new().set_or_clear_actual_start_time(None::<Timestamp>);
16474            /// ```
16475            pub fn set_or_clear_actual_start_time<T>(mut self, v: std::option::Option<T>) -> Self
16476            where
16477                T: std::convert::Into<wkt::Timestamp>,
16478            {
16479                self.actual_start_time = v.map(|x| x.into());
16480                self
16481            }
16482
16483            /// Sets the value of [estimated_end_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::estimated_end_time].
16484            ///
16485            /// # Example
16486            /// ```ignore,no_run
16487            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16488            /// use wkt::Timestamp;
16489            /// let x = StageSchedule::new().set_estimated_end_time(Timestamp::default()/* use setters */);
16490            /// ```
16491            pub fn set_estimated_end_time<T>(mut self, v: T) -> Self
16492            where
16493                T: std::convert::Into<wkt::Timestamp>,
16494            {
16495                self.estimated_end_time = std::option::Option::Some(v.into());
16496                self
16497            }
16498
16499            /// Sets or clears the value of [estimated_end_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::estimated_end_time].
16500            ///
16501            /// # Example
16502            /// ```ignore,no_run
16503            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16504            /// use wkt::Timestamp;
16505            /// let x = StageSchedule::new().set_or_clear_estimated_end_time(Some(Timestamp::default()/* use setters */));
16506            /// let x = StageSchedule::new().set_or_clear_estimated_end_time(None::<Timestamp>);
16507            /// ```
16508            pub fn set_or_clear_estimated_end_time<T>(mut self, v: std::option::Option<T>) -> Self
16509            where
16510                T: std::convert::Into<wkt::Timestamp>,
16511            {
16512                self.estimated_end_time = v.map(|x| x.into());
16513                self
16514            }
16515
16516            /// Sets the value of [actual_end_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::actual_end_time].
16517            ///
16518            /// # Example
16519            /// ```ignore,no_run
16520            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16521            /// use wkt::Timestamp;
16522            /// let x = StageSchedule::new().set_actual_end_time(Timestamp::default()/* use setters */);
16523            /// ```
16524            pub fn set_actual_end_time<T>(mut self, v: T) -> Self
16525            where
16526                T: std::convert::Into<wkt::Timestamp>,
16527            {
16528                self.actual_end_time = std::option::Option::Some(v.into());
16529                self
16530            }
16531
16532            /// Sets or clears the value of [actual_end_time][crate::model::upgrade_cluster_status::stage_status::StageSchedule::actual_end_time].
16533            ///
16534            /// # Example
16535            /// ```ignore,no_run
16536            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::stage_status::StageSchedule;
16537            /// use wkt::Timestamp;
16538            /// let x = StageSchedule::new().set_or_clear_actual_end_time(Some(Timestamp::default()/* use setters */));
16539            /// let x = StageSchedule::new().set_or_clear_actual_end_time(None::<Timestamp>);
16540            /// ```
16541            pub fn set_or_clear_actual_end_time<T>(mut self, v: std::option::Option<T>) -> Self
16542            where
16543                T: std::convert::Into<wkt::Timestamp>,
16544            {
16545                self.actual_end_time = v.map(|x| x.into());
16546                self
16547            }
16548        }
16549
16550        impl wkt::message::Message for StageSchedule {
16551            fn typename() -> &'static str {
16552                "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterStatus.StageStatus.StageSchedule"
16553            }
16554        }
16555
16556        /// Stage specific status information, if any.
16557        #[derive(Clone, Debug, PartialEq)]
16558        #[non_exhaustive]
16559        pub enum StageSpecificStatus {
16560            /// Read pool instances upgrade metadata.
16561            ReadPoolInstancesUpgrade(
16562                std::boxed::Box<
16563                    crate::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus,
16564                >,
16565            ),
16566        }
16567    }
16568
16569    /// Read pool instances upgrade specific status.
16570    #[derive(Clone, Default, PartialEq)]
16571    #[non_exhaustive]
16572    pub struct ReadPoolInstancesUpgradeStageStatus {
16573        /// Read pool instances upgrade statistics.
16574        pub upgrade_stats: std::option::Option<
16575            crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats,
16576        >,
16577
16578        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16579    }
16580
16581    impl ReadPoolInstancesUpgradeStageStatus {
16582        pub fn new() -> Self {
16583            std::default::Default::default()
16584        }
16585
16586        /// Sets the value of [upgrade_stats][crate::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus::upgrade_stats].
16587        ///
16588        /// # Example
16589        /// ```ignore,no_run
16590        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus;
16591        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16592        /// let x = ReadPoolInstancesUpgradeStageStatus::new().set_upgrade_stats(Stats::default()/* use setters */);
16593        /// ```
16594        pub fn set_upgrade_stats<T>(mut self, v: T) -> Self
16595        where T: std::convert::Into<crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats>
16596        {
16597            self.upgrade_stats = std::option::Option::Some(v.into());
16598            self
16599        }
16600
16601        /// Sets or clears the value of [upgrade_stats][crate::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus::upgrade_stats].
16602        ///
16603        /// # Example
16604        /// ```ignore,no_run
16605        /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::ReadPoolInstancesUpgradeStageStatus;
16606        /// use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16607        /// let x = ReadPoolInstancesUpgradeStageStatus::new().set_or_clear_upgrade_stats(Some(Stats::default()/* use setters */));
16608        /// let x = ReadPoolInstancesUpgradeStageStatus::new().set_or_clear_upgrade_stats(None::<Stats>);
16609        /// ```
16610        pub fn set_or_clear_upgrade_stats<T>(mut self, v: std::option::Option<T>) -> Self
16611        where T: std::convert::Into<crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats>
16612        {
16613            self.upgrade_stats = v.map(|x| x.into());
16614            self
16615        }
16616    }
16617
16618    impl wkt::message::Message for ReadPoolInstancesUpgradeStageStatus {
16619        fn typename() -> &'static str {
16620            "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterStatus.ReadPoolInstancesUpgradeStageStatus"
16621        }
16622    }
16623
16624    /// Defines additional types related to [ReadPoolInstancesUpgradeStageStatus].
16625    pub mod read_pool_instances_upgrade_stage_status {
16626        #[allow(unused_imports)]
16627        use super::*;
16628
16629        /// Upgrade stats for read pool instances.
16630        #[derive(Clone, Default, PartialEq)]
16631        #[non_exhaustive]
16632        pub struct Stats {
16633            /// Number of read pool instances for which upgrade has not started.
16634            pub not_started: i32,
16635
16636            /// Number of read pool instances undergoing upgrade.
16637            pub ongoing: i32,
16638
16639            /// Number of read pool instances successfully upgraded.
16640            pub success: i32,
16641
16642            /// Number of read pool instances which failed to upgrade.
16643            pub failed: i32,
16644
16645            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16646        }
16647
16648        impl Stats {
16649            pub fn new() -> Self {
16650                std::default::Default::default()
16651            }
16652
16653            /// Sets the value of [not_started][crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats::not_started].
16654            ///
16655            /// # Example
16656            /// ```ignore,no_run
16657            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16658            /// let x = Stats::new().set_not_started(42);
16659            /// ```
16660            pub fn set_not_started<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16661                self.not_started = v.into();
16662                self
16663            }
16664
16665            /// Sets the value of [ongoing][crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats::ongoing].
16666            ///
16667            /// # Example
16668            /// ```ignore,no_run
16669            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16670            /// let x = Stats::new().set_ongoing(42);
16671            /// ```
16672            pub fn set_ongoing<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16673                self.ongoing = v.into();
16674                self
16675            }
16676
16677            /// Sets the value of [success][crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats::success].
16678            ///
16679            /// # Example
16680            /// ```ignore,no_run
16681            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16682            /// let x = Stats::new().set_success(42);
16683            /// ```
16684            pub fn set_success<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16685                self.success = v.into();
16686                self
16687            }
16688
16689            /// Sets the value of [failed][crate::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats::failed].
16690            ///
16691            /// # Example
16692            /// ```ignore,no_run
16693            /// # use google_cloud_alloydb_v1::model::upgrade_cluster_status::read_pool_instances_upgrade_stage_status::Stats;
16694            /// let x = Stats::new().set_failed(42);
16695            /// ```
16696            pub fn set_failed<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16697                self.failed = v.into();
16698                self
16699            }
16700        }
16701
16702        impl wkt::message::Message for Stats {
16703            fn typename() -> &'static str {
16704                "type.googleapis.com/google.cloud.alloydb.v1.UpgradeClusterStatus.ReadPoolInstancesUpgradeStageStatus.Stats"
16705            }
16706        }
16707    }
16708}
16709
16710/// Message for requesting list of Users
16711#[derive(Clone, Default, PartialEq)]
16712#[non_exhaustive]
16713pub struct ListUsersRequest {
16714    /// Required. Parent value for ListUsersRequest
16715    pub parent: std::string::String,
16716
16717    /// Optional. Requested page size. Server may return fewer items than
16718    /// requested. If unspecified, server will pick an appropriate default.
16719    pub page_size: i32,
16720
16721    /// Optional. A token identifying a page of results the server should return.
16722    pub page_token: std::string::String,
16723
16724    /// Optional. Filtering results
16725    pub filter: std::string::String,
16726
16727    /// Optional. Hint for how to order the results
16728    pub order_by: std::string::String,
16729
16730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16731}
16732
16733impl ListUsersRequest {
16734    pub fn new() -> Self {
16735        std::default::Default::default()
16736    }
16737
16738    /// Sets the value of [parent][crate::model::ListUsersRequest::parent].
16739    ///
16740    /// # Example
16741    /// ```ignore,no_run
16742    /// # use google_cloud_alloydb_v1::model::ListUsersRequest;
16743    /// let x = ListUsersRequest::new().set_parent("example");
16744    /// ```
16745    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16746        self.parent = v.into();
16747        self
16748    }
16749
16750    /// Sets the value of [page_size][crate::model::ListUsersRequest::page_size].
16751    ///
16752    /// # Example
16753    /// ```ignore,no_run
16754    /// # use google_cloud_alloydb_v1::model::ListUsersRequest;
16755    /// let x = ListUsersRequest::new().set_page_size(42);
16756    /// ```
16757    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16758        self.page_size = v.into();
16759        self
16760    }
16761
16762    /// Sets the value of [page_token][crate::model::ListUsersRequest::page_token].
16763    ///
16764    /// # Example
16765    /// ```ignore,no_run
16766    /// # use google_cloud_alloydb_v1::model::ListUsersRequest;
16767    /// let x = ListUsersRequest::new().set_page_token("example");
16768    /// ```
16769    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16770        self.page_token = v.into();
16771        self
16772    }
16773
16774    /// Sets the value of [filter][crate::model::ListUsersRequest::filter].
16775    ///
16776    /// # Example
16777    /// ```ignore,no_run
16778    /// # use google_cloud_alloydb_v1::model::ListUsersRequest;
16779    /// let x = ListUsersRequest::new().set_filter("example");
16780    /// ```
16781    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16782        self.filter = v.into();
16783        self
16784    }
16785
16786    /// Sets the value of [order_by][crate::model::ListUsersRequest::order_by].
16787    ///
16788    /// # Example
16789    /// ```ignore,no_run
16790    /// # use google_cloud_alloydb_v1::model::ListUsersRequest;
16791    /// let x = ListUsersRequest::new().set_order_by("example");
16792    /// ```
16793    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16794        self.order_by = v.into();
16795        self
16796    }
16797}
16798
16799impl wkt::message::Message for ListUsersRequest {
16800    fn typename() -> &'static str {
16801        "type.googleapis.com/google.cloud.alloydb.v1.ListUsersRequest"
16802    }
16803}
16804
16805/// Message for response to listing Users
16806#[derive(Clone, Default, PartialEq)]
16807#[non_exhaustive]
16808pub struct ListUsersResponse {
16809    /// The list of User
16810    pub users: std::vec::Vec<crate::model::User>,
16811
16812    /// A token identifying a page of results the server should return.
16813    pub next_page_token: std::string::String,
16814
16815    /// Locations that could not be reached.
16816    pub unreachable: std::vec::Vec<std::string::String>,
16817
16818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16819}
16820
16821impl ListUsersResponse {
16822    pub fn new() -> Self {
16823        std::default::Default::default()
16824    }
16825
16826    /// Sets the value of [users][crate::model::ListUsersResponse::users].
16827    ///
16828    /// # Example
16829    /// ```ignore,no_run
16830    /// # use google_cloud_alloydb_v1::model::ListUsersResponse;
16831    /// use google_cloud_alloydb_v1::model::User;
16832    /// let x = ListUsersResponse::new()
16833    ///     .set_users([
16834    ///         User::default()/* use setters */,
16835    ///         User::default()/* use (different) setters */,
16836    ///     ]);
16837    /// ```
16838    pub fn set_users<T, V>(mut self, v: T) -> Self
16839    where
16840        T: std::iter::IntoIterator<Item = V>,
16841        V: std::convert::Into<crate::model::User>,
16842    {
16843        use std::iter::Iterator;
16844        self.users = v.into_iter().map(|i| i.into()).collect();
16845        self
16846    }
16847
16848    /// Sets the value of [next_page_token][crate::model::ListUsersResponse::next_page_token].
16849    ///
16850    /// # Example
16851    /// ```ignore,no_run
16852    /// # use google_cloud_alloydb_v1::model::ListUsersResponse;
16853    /// let x = ListUsersResponse::new().set_next_page_token("example");
16854    /// ```
16855    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16856        self.next_page_token = v.into();
16857        self
16858    }
16859
16860    /// Sets the value of [unreachable][crate::model::ListUsersResponse::unreachable].
16861    ///
16862    /// # Example
16863    /// ```ignore,no_run
16864    /// # use google_cloud_alloydb_v1::model::ListUsersResponse;
16865    /// let x = ListUsersResponse::new().set_unreachable(["a", "b", "c"]);
16866    /// ```
16867    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
16868    where
16869        T: std::iter::IntoIterator<Item = V>,
16870        V: std::convert::Into<std::string::String>,
16871    {
16872        use std::iter::Iterator;
16873        self.unreachable = v.into_iter().map(|i| i.into()).collect();
16874        self
16875    }
16876}
16877
16878impl wkt::message::Message for ListUsersResponse {
16879    fn typename() -> &'static str {
16880        "type.googleapis.com/google.cloud.alloydb.v1.ListUsersResponse"
16881    }
16882}
16883
16884#[doc(hidden)]
16885impl google_cloud_gax::paginator::internal::PageableResponse for ListUsersResponse {
16886    type PageItem = crate::model::User;
16887
16888    fn items(self) -> std::vec::Vec<Self::PageItem> {
16889        self.users
16890    }
16891
16892    fn next_page_token(&self) -> std::string::String {
16893        use std::clone::Clone;
16894        self.next_page_token.clone()
16895    }
16896}
16897
16898/// Message for getting a User
16899#[derive(Clone, Default, PartialEq)]
16900#[non_exhaustive]
16901pub struct GetUserRequest {
16902    /// Required. The name of the resource. For the required format, see the
16903    /// comment on the User.name field.
16904    pub name: std::string::String,
16905
16906    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16907}
16908
16909impl GetUserRequest {
16910    pub fn new() -> Self {
16911        std::default::Default::default()
16912    }
16913
16914    /// Sets the value of [name][crate::model::GetUserRequest::name].
16915    ///
16916    /// # Example
16917    /// ```ignore,no_run
16918    /// # use google_cloud_alloydb_v1::model::GetUserRequest;
16919    /// let x = GetUserRequest::new().set_name("example");
16920    /// ```
16921    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16922        self.name = v.into();
16923        self
16924    }
16925}
16926
16927impl wkt::message::Message for GetUserRequest {
16928    fn typename() -> &'static str {
16929        "type.googleapis.com/google.cloud.alloydb.v1.GetUserRequest"
16930    }
16931}
16932
16933/// Message for creating a User
16934#[derive(Clone, Default, PartialEq)]
16935#[non_exhaustive]
16936pub struct CreateUserRequest {
16937    /// Required. Value for parent.
16938    pub parent: std::string::String,
16939
16940    /// Required. ID of the requesting object.
16941    pub user_id: std::string::String,
16942
16943    /// Required. The resource being created
16944    pub user: std::option::Option<crate::model::User>,
16945
16946    /// Optional. An optional request ID to identify requests. Specify a unique
16947    /// request ID so that if you must retry your request, the server ignores the
16948    /// request if it has already been completed. The server guarantees that for at
16949    /// least 60 minutes since the first request.
16950    ///
16951    /// For example, consider a situation where you make an initial request and
16952    /// the request times out. If you make the request again with the same request
16953    /// ID, the server can check if the original operation with the same request ID
16954    /// was received, and if so, ignores the second request. This prevents
16955    /// clients from accidentally creating duplicate commitments.
16956    ///
16957    /// The request ID must be a valid UUID with the exception that zero UUID is
16958    /// not supported (00000000-0000-0000-0000-000000000000).
16959    pub request_id: std::string::String,
16960
16961    /// Optional. If set, the backend validates the request, but doesn't actually
16962    /// execute it.
16963    pub validate_only: bool,
16964
16965    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16966}
16967
16968impl CreateUserRequest {
16969    pub fn new() -> Self {
16970        std::default::Default::default()
16971    }
16972
16973    /// Sets the value of [parent][crate::model::CreateUserRequest::parent].
16974    ///
16975    /// # Example
16976    /// ```ignore,no_run
16977    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
16978    /// let x = CreateUserRequest::new().set_parent("example");
16979    /// ```
16980    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16981        self.parent = v.into();
16982        self
16983    }
16984
16985    /// Sets the value of [user_id][crate::model::CreateUserRequest::user_id].
16986    ///
16987    /// # Example
16988    /// ```ignore,no_run
16989    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
16990    /// let x = CreateUserRequest::new().set_user_id("example");
16991    /// ```
16992    pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16993        self.user_id = v.into();
16994        self
16995    }
16996
16997    /// Sets the value of [user][crate::model::CreateUserRequest::user].
16998    ///
16999    /// # Example
17000    /// ```ignore,no_run
17001    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
17002    /// use google_cloud_alloydb_v1::model::User;
17003    /// let x = CreateUserRequest::new().set_user(User::default()/* use setters */);
17004    /// ```
17005    pub fn set_user<T>(mut self, v: T) -> Self
17006    where
17007        T: std::convert::Into<crate::model::User>,
17008    {
17009        self.user = std::option::Option::Some(v.into());
17010        self
17011    }
17012
17013    /// Sets or clears the value of [user][crate::model::CreateUserRequest::user].
17014    ///
17015    /// # Example
17016    /// ```ignore,no_run
17017    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
17018    /// use google_cloud_alloydb_v1::model::User;
17019    /// let x = CreateUserRequest::new().set_or_clear_user(Some(User::default()/* use setters */));
17020    /// let x = CreateUserRequest::new().set_or_clear_user(None::<User>);
17021    /// ```
17022    pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
17023    where
17024        T: std::convert::Into<crate::model::User>,
17025    {
17026        self.user = v.map(|x| x.into());
17027        self
17028    }
17029
17030    /// Sets the value of [request_id][crate::model::CreateUserRequest::request_id].
17031    ///
17032    /// # Example
17033    /// ```ignore,no_run
17034    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
17035    /// let x = CreateUserRequest::new().set_request_id("example");
17036    /// ```
17037    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17038        self.request_id = v.into();
17039        self
17040    }
17041
17042    /// Sets the value of [validate_only][crate::model::CreateUserRequest::validate_only].
17043    ///
17044    /// # Example
17045    /// ```ignore,no_run
17046    /// # use google_cloud_alloydb_v1::model::CreateUserRequest;
17047    /// let x = CreateUserRequest::new().set_validate_only(true);
17048    /// ```
17049    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17050        self.validate_only = v.into();
17051        self
17052    }
17053}
17054
17055impl wkt::message::Message for CreateUserRequest {
17056    fn typename() -> &'static str {
17057        "type.googleapis.com/google.cloud.alloydb.v1.CreateUserRequest"
17058    }
17059}
17060
17061/// Message for updating a User
17062#[derive(Clone, Default, PartialEq)]
17063#[non_exhaustive]
17064pub struct UpdateUserRequest {
17065    /// Optional. Field mask is used to specify the fields to be overwritten in the
17066    /// User resource by the update.
17067    /// The fields specified in the update_mask are relative to the resource, not
17068    /// the full request. A field will be overwritten if it is in the mask. If the
17069    /// user does not provide a mask then all fields will be overwritten.
17070    pub update_mask: std::option::Option<wkt::FieldMask>,
17071
17072    /// Required. The resource being updated
17073    pub user: std::option::Option<crate::model::User>,
17074
17075    /// Optional. An optional request ID to identify requests. Specify a unique
17076    /// request ID so that if you must retry your request, the server ignores the
17077    /// request if it has already been completed. The server guarantees that for at
17078    /// least 60 minutes since the first request.
17079    ///
17080    /// For example, consider a situation where you make an initial request and
17081    /// the request times out. If you make the request again with the same request
17082    /// ID, the server can check if the original operation with the same request ID
17083    /// was received, and if so, ignores the second request. This prevents
17084    /// clients from accidentally creating duplicate commitments.
17085    ///
17086    /// The request ID must be a valid UUID with the exception that zero UUID is
17087    /// not supported (00000000-0000-0000-0000-000000000000).
17088    pub request_id: std::string::String,
17089
17090    /// Optional. If set, the backend validates the request, but doesn't actually
17091    /// execute it.
17092    pub validate_only: bool,
17093
17094    /// Optional. Allow missing fields in the update mask.
17095    pub allow_missing: bool,
17096
17097    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17098}
17099
17100impl UpdateUserRequest {
17101    pub fn new() -> Self {
17102        std::default::Default::default()
17103    }
17104
17105    /// Sets the value of [update_mask][crate::model::UpdateUserRequest::update_mask].
17106    ///
17107    /// # Example
17108    /// ```ignore,no_run
17109    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17110    /// use wkt::FieldMask;
17111    /// let x = UpdateUserRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17112    /// ```
17113    pub fn set_update_mask<T>(mut self, v: T) -> Self
17114    where
17115        T: std::convert::Into<wkt::FieldMask>,
17116    {
17117        self.update_mask = std::option::Option::Some(v.into());
17118        self
17119    }
17120
17121    /// Sets or clears the value of [update_mask][crate::model::UpdateUserRequest::update_mask].
17122    ///
17123    /// # Example
17124    /// ```ignore,no_run
17125    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17126    /// use wkt::FieldMask;
17127    /// let x = UpdateUserRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17128    /// let x = UpdateUserRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17129    /// ```
17130    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17131    where
17132        T: std::convert::Into<wkt::FieldMask>,
17133    {
17134        self.update_mask = v.map(|x| x.into());
17135        self
17136    }
17137
17138    /// Sets the value of [user][crate::model::UpdateUserRequest::user].
17139    ///
17140    /// # Example
17141    /// ```ignore,no_run
17142    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17143    /// use google_cloud_alloydb_v1::model::User;
17144    /// let x = UpdateUserRequest::new().set_user(User::default()/* use setters */);
17145    /// ```
17146    pub fn set_user<T>(mut self, v: T) -> Self
17147    where
17148        T: std::convert::Into<crate::model::User>,
17149    {
17150        self.user = std::option::Option::Some(v.into());
17151        self
17152    }
17153
17154    /// Sets or clears the value of [user][crate::model::UpdateUserRequest::user].
17155    ///
17156    /// # Example
17157    /// ```ignore,no_run
17158    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17159    /// use google_cloud_alloydb_v1::model::User;
17160    /// let x = UpdateUserRequest::new().set_or_clear_user(Some(User::default()/* use setters */));
17161    /// let x = UpdateUserRequest::new().set_or_clear_user(None::<User>);
17162    /// ```
17163    pub fn set_or_clear_user<T>(mut self, v: std::option::Option<T>) -> Self
17164    where
17165        T: std::convert::Into<crate::model::User>,
17166    {
17167        self.user = v.map(|x| x.into());
17168        self
17169    }
17170
17171    /// Sets the value of [request_id][crate::model::UpdateUserRequest::request_id].
17172    ///
17173    /// # Example
17174    /// ```ignore,no_run
17175    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17176    /// let x = UpdateUserRequest::new().set_request_id("example");
17177    /// ```
17178    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17179        self.request_id = v.into();
17180        self
17181    }
17182
17183    /// Sets the value of [validate_only][crate::model::UpdateUserRequest::validate_only].
17184    ///
17185    /// # Example
17186    /// ```ignore,no_run
17187    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17188    /// let x = UpdateUserRequest::new().set_validate_only(true);
17189    /// ```
17190    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17191        self.validate_only = v.into();
17192        self
17193    }
17194
17195    /// Sets the value of [allow_missing][crate::model::UpdateUserRequest::allow_missing].
17196    ///
17197    /// # Example
17198    /// ```ignore,no_run
17199    /// # use google_cloud_alloydb_v1::model::UpdateUserRequest;
17200    /// let x = UpdateUserRequest::new().set_allow_missing(true);
17201    /// ```
17202    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17203        self.allow_missing = v.into();
17204        self
17205    }
17206}
17207
17208impl wkt::message::Message for UpdateUserRequest {
17209    fn typename() -> &'static str {
17210        "type.googleapis.com/google.cloud.alloydb.v1.UpdateUserRequest"
17211    }
17212}
17213
17214/// Message for deleting a User
17215#[derive(Clone, Default, PartialEq)]
17216#[non_exhaustive]
17217pub struct DeleteUserRequest {
17218    /// Required. The name of the resource. For the required format, see the
17219    /// comment on the User.name field.
17220    pub name: std::string::String,
17221
17222    /// Optional. An optional request ID to identify requests. Specify a unique
17223    /// request ID so that if you must retry your request, the server ignores the
17224    /// request if it has already been completed. The server guarantees that for at
17225    /// least 60 minutes since the first request.
17226    ///
17227    /// For example, consider a situation where you make an initial request and
17228    /// the request times out. If you make the request again with the same request
17229    /// ID, the server can check if the original operation with the same request ID
17230    /// was received, and if so, ignores the second request. This prevents
17231    /// clients from accidentally creating duplicate commitments.
17232    ///
17233    /// The request ID must be a valid UUID with the exception that zero UUID is
17234    /// not supported (00000000-0000-0000-0000-000000000000).
17235    pub request_id: std::string::String,
17236
17237    /// Optional. If set, the backend validates the request, but doesn't actually
17238    /// execute it.
17239    pub validate_only: bool,
17240
17241    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17242}
17243
17244impl DeleteUserRequest {
17245    pub fn new() -> Self {
17246        std::default::Default::default()
17247    }
17248
17249    /// Sets the value of [name][crate::model::DeleteUserRequest::name].
17250    ///
17251    /// # Example
17252    /// ```ignore,no_run
17253    /// # use google_cloud_alloydb_v1::model::DeleteUserRequest;
17254    /// let x = DeleteUserRequest::new().set_name("example");
17255    /// ```
17256    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17257        self.name = v.into();
17258        self
17259    }
17260
17261    /// Sets the value of [request_id][crate::model::DeleteUserRequest::request_id].
17262    ///
17263    /// # Example
17264    /// ```ignore,no_run
17265    /// # use google_cloud_alloydb_v1::model::DeleteUserRequest;
17266    /// let x = DeleteUserRequest::new().set_request_id("example");
17267    /// ```
17268    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17269        self.request_id = v.into();
17270        self
17271    }
17272
17273    /// Sets the value of [validate_only][crate::model::DeleteUserRequest::validate_only].
17274    ///
17275    /// # Example
17276    /// ```ignore,no_run
17277    /// # use google_cloud_alloydb_v1::model::DeleteUserRequest;
17278    /// let x = DeleteUserRequest::new().set_validate_only(true);
17279    /// ```
17280    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17281        self.validate_only = v.into();
17282        self
17283    }
17284}
17285
17286impl wkt::message::Message for DeleteUserRequest {
17287    fn typename() -> &'static str {
17288        "type.googleapis.com/google.cloud.alloydb.v1.DeleteUserRequest"
17289    }
17290}
17291
17292/// Message for ListDatabases request.
17293#[derive(Clone, Default, PartialEq)]
17294#[non_exhaustive]
17295pub struct ListDatabasesRequest {
17296    /// Required. Parent value for ListDatabasesRequest.
17297    pub parent: std::string::String,
17298
17299    /// Optional. The maximum number of databases to return. The service may return
17300    /// fewer than this value. If unspecified, 2000 is the default page_size. The
17301    /// max value of page_size will be 4000, values above max will be coerced to
17302    /// max.
17303    pub page_size: i32,
17304
17305    /// Optional. A page token, received from a previous `ListDatabases` call.
17306    /// This should be provided to retrieve the subsequent page.
17307    /// This field is currently not supported, its value will be ignored if passed.
17308    pub page_token: std::string::String,
17309
17310    /// Optional. Filtering results.
17311    /// This field is currently not supported, its value will be ignored if passed.
17312    pub filter: std::string::String,
17313
17314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17315}
17316
17317impl ListDatabasesRequest {
17318    pub fn new() -> Self {
17319        std::default::Default::default()
17320    }
17321
17322    /// Sets the value of [parent][crate::model::ListDatabasesRequest::parent].
17323    ///
17324    /// # Example
17325    /// ```ignore,no_run
17326    /// # use google_cloud_alloydb_v1::model::ListDatabasesRequest;
17327    /// let x = ListDatabasesRequest::new().set_parent("example");
17328    /// ```
17329    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17330        self.parent = v.into();
17331        self
17332    }
17333
17334    /// Sets the value of [page_size][crate::model::ListDatabasesRequest::page_size].
17335    ///
17336    /// # Example
17337    /// ```ignore,no_run
17338    /// # use google_cloud_alloydb_v1::model::ListDatabasesRequest;
17339    /// let x = ListDatabasesRequest::new().set_page_size(42);
17340    /// ```
17341    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17342        self.page_size = v.into();
17343        self
17344    }
17345
17346    /// Sets the value of [page_token][crate::model::ListDatabasesRequest::page_token].
17347    ///
17348    /// # Example
17349    /// ```ignore,no_run
17350    /// # use google_cloud_alloydb_v1::model::ListDatabasesRequest;
17351    /// let x = ListDatabasesRequest::new().set_page_token("example");
17352    /// ```
17353    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17354        self.page_token = v.into();
17355        self
17356    }
17357
17358    /// Sets the value of [filter][crate::model::ListDatabasesRequest::filter].
17359    ///
17360    /// # Example
17361    /// ```ignore,no_run
17362    /// # use google_cloud_alloydb_v1::model::ListDatabasesRequest;
17363    /// let x = ListDatabasesRequest::new().set_filter("example");
17364    /// ```
17365    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17366        self.filter = v.into();
17367        self
17368    }
17369}
17370
17371impl wkt::message::Message for ListDatabasesRequest {
17372    fn typename() -> &'static str {
17373        "type.googleapis.com/google.cloud.alloydb.v1.ListDatabasesRequest"
17374    }
17375}
17376
17377/// Message for ListDatabases response.
17378#[derive(Clone, Default, PartialEq)]
17379#[non_exhaustive]
17380pub struct ListDatabasesResponse {
17381    /// The list of databases.
17382    pub databases: std::vec::Vec<crate::model::Database>,
17383
17384    /// A token identifying the next page of results the server should return.
17385    /// If this field is omitted, there are no subsequent pages.
17386    pub next_page_token: std::string::String,
17387
17388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17389}
17390
17391impl ListDatabasesResponse {
17392    pub fn new() -> Self {
17393        std::default::Default::default()
17394    }
17395
17396    /// Sets the value of [databases][crate::model::ListDatabasesResponse::databases].
17397    ///
17398    /// # Example
17399    /// ```ignore,no_run
17400    /// # use google_cloud_alloydb_v1::model::ListDatabasesResponse;
17401    /// use google_cloud_alloydb_v1::model::Database;
17402    /// let x = ListDatabasesResponse::new()
17403    ///     .set_databases([
17404    ///         Database::default()/* use setters */,
17405    ///         Database::default()/* use (different) setters */,
17406    ///     ]);
17407    /// ```
17408    pub fn set_databases<T, V>(mut self, v: T) -> Self
17409    where
17410        T: std::iter::IntoIterator<Item = V>,
17411        V: std::convert::Into<crate::model::Database>,
17412    {
17413        use std::iter::Iterator;
17414        self.databases = v.into_iter().map(|i| i.into()).collect();
17415        self
17416    }
17417
17418    /// Sets the value of [next_page_token][crate::model::ListDatabasesResponse::next_page_token].
17419    ///
17420    /// # Example
17421    /// ```ignore,no_run
17422    /// # use google_cloud_alloydb_v1::model::ListDatabasesResponse;
17423    /// let x = ListDatabasesResponse::new().set_next_page_token("example");
17424    /// ```
17425    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17426        self.next_page_token = v.into();
17427        self
17428    }
17429}
17430
17431impl wkt::message::Message for ListDatabasesResponse {
17432    fn typename() -> &'static str {
17433        "type.googleapis.com/google.cloud.alloydb.v1.ListDatabasesResponse"
17434    }
17435}
17436
17437#[doc(hidden)]
17438impl google_cloud_gax::paginator::internal::PageableResponse for ListDatabasesResponse {
17439    type PageItem = crate::model::Database;
17440
17441    fn items(self) -> std::vec::Vec<Self::PageItem> {
17442        self.databases
17443    }
17444
17445    fn next_page_token(&self) -> std::string::String {
17446        use std::clone::Clone;
17447        self.next_page_token.clone()
17448    }
17449}
17450
17451/// View on Instance. Pass this enum to rpcs that returns an Instance message to
17452/// control which subsets of fields to get.
17453///
17454/// # Working with unknown values
17455///
17456/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17457/// additional enum variants at any time. Adding new variants is not considered
17458/// a breaking change. Applications should write their code in anticipation of:
17459///
17460/// - New values appearing in future releases of the client library, **and**
17461/// - New values received dynamically, without application changes.
17462///
17463/// Please consult the [Working with enums] section in the user guide for some
17464/// guidelines.
17465///
17466/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17467#[derive(Clone, Debug, PartialEq)]
17468#[non_exhaustive]
17469pub enum InstanceView {
17470    /// INSTANCE_VIEW_UNSPECIFIED Not specified, equivalent to BASIC.
17471    Unspecified,
17472    /// BASIC server responses for a primary or read instance include all the
17473    /// relevant instance details, excluding the details of each node in the
17474    /// instance. The default value.
17475    Basic,
17476    /// FULL response is equivalent to BASIC for primary instance (for now).
17477    /// For read pool instance, this includes details of each node in the pool.
17478    Full,
17479    /// If set, the enum was initialized with an unknown value.
17480    ///
17481    /// Applications can examine the value using [InstanceView::value] or
17482    /// [InstanceView::name].
17483    UnknownValue(instance_view::UnknownValue),
17484}
17485
17486#[doc(hidden)]
17487pub mod instance_view {
17488    #[allow(unused_imports)]
17489    use super::*;
17490    #[derive(Clone, Debug, PartialEq)]
17491    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17492}
17493
17494impl InstanceView {
17495    /// Gets the enum value.
17496    ///
17497    /// Returns `None` if the enum contains an unknown value deserialized from
17498    /// the string representation of enums.
17499    pub fn value(&self) -> std::option::Option<i32> {
17500        match self {
17501            Self::Unspecified => std::option::Option::Some(0),
17502            Self::Basic => std::option::Option::Some(1),
17503            Self::Full => std::option::Option::Some(2),
17504            Self::UnknownValue(u) => u.0.value(),
17505        }
17506    }
17507
17508    /// Gets the enum value as a string.
17509    ///
17510    /// Returns `None` if the enum contains an unknown value deserialized from
17511    /// the integer representation of enums.
17512    pub fn name(&self) -> std::option::Option<&str> {
17513        match self {
17514            Self::Unspecified => std::option::Option::Some("INSTANCE_VIEW_UNSPECIFIED"),
17515            Self::Basic => std::option::Option::Some("INSTANCE_VIEW_BASIC"),
17516            Self::Full => std::option::Option::Some("INSTANCE_VIEW_FULL"),
17517            Self::UnknownValue(u) => u.0.name(),
17518        }
17519    }
17520}
17521
17522impl std::default::Default for InstanceView {
17523    fn default() -> Self {
17524        use std::convert::From;
17525        Self::from(0)
17526    }
17527}
17528
17529impl std::fmt::Display for InstanceView {
17530    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17531        wkt::internal::display_enum(f, self.name(), self.value())
17532    }
17533}
17534
17535impl std::convert::From<i32> for InstanceView {
17536    fn from(value: i32) -> Self {
17537        match value {
17538            0 => Self::Unspecified,
17539            1 => Self::Basic,
17540            2 => Self::Full,
17541            _ => Self::UnknownValue(instance_view::UnknownValue(
17542                wkt::internal::UnknownEnumValue::Integer(value),
17543            )),
17544        }
17545    }
17546}
17547
17548impl std::convert::From<&str> for InstanceView {
17549    fn from(value: &str) -> Self {
17550        use std::string::ToString;
17551        match value {
17552            "INSTANCE_VIEW_UNSPECIFIED" => Self::Unspecified,
17553            "INSTANCE_VIEW_BASIC" => Self::Basic,
17554            "INSTANCE_VIEW_FULL" => Self::Full,
17555            _ => Self::UnknownValue(instance_view::UnknownValue(
17556                wkt::internal::UnknownEnumValue::String(value.to_string()),
17557            )),
17558        }
17559    }
17560}
17561
17562impl serde::ser::Serialize for InstanceView {
17563    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17564    where
17565        S: serde::Serializer,
17566    {
17567        match self {
17568            Self::Unspecified => serializer.serialize_i32(0),
17569            Self::Basic => serializer.serialize_i32(1),
17570            Self::Full => serializer.serialize_i32(2),
17571            Self::UnknownValue(u) => u.0.serialize(serializer),
17572        }
17573    }
17574}
17575
17576impl<'de> serde::de::Deserialize<'de> for InstanceView {
17577    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17578    where
17579        D: serde::Deserializer<'de>,
17580    {
17581        deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceView>::new(
17582            ".google.cloud.alloydb.v1.InstanceView",
17583        ))
17584    }
17585}
17586
17587/// View on Cluster. Pass this enum to rpcs that returns a cluster message to
17588/// control which subsets of fields to get.
17589///
17590/// # Working with unknown values
17591///
17592/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17593/// additional enum variants at any time. Adding new variants is not considered
17594/// a breaking change. Applications should write their code in anticipation of:
17595///
17596/// - New values appearing in future releases of the client library, **and**
17597/// - New values received dynamically, without application changes.
17598///
17599/// Please consult the [Working with enums] section in the user guide for some
17600/// guidelines.
17601///
17602/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17603#[derive(Clone, Debug, PartialEq)]
17604#[non_exhaustive]
17605pub enum ClusterView {
17606    /// CLUSTER_VIEW_UNSPECIFIED Not specified, equivalent to BASIC.
17607    Unspecified,
17608    /// BASIC server responses include all the relevant cluster details, excluding
17609    /// Cluster.ContinuousBackupInfo.EarliestRestorableTime and other view-specific
17610    /// fields. The default value.
17611    Basic,
17612    /// CONTINUOUS_BACKUP response returns all the fields from BASIC plus
17613    /// the earliest restorable time if continuous backups are enabled.
17614    /// May increase latency.
17615    ContinuousBackup,
17616    /// If set, the enum was initialized with an unknown value.
17617    ///
17618    /// Applications can examine the value using [ClusterView::value] or
17619    /// [ClusterView::name].
17620    UnknownValue(cluster_view::UnknownValue),
17621}
17622
17623#[doc(hidden)]
17624pub mod cluster_view {
17625    #[allow(unused_imports)]
17626    use super::*;
17627    #[derive(Clone, Debug, PartialEq)]
17628    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17629}
17630
17631impl ClusterView {
17632    /// Gets the enum value.
17633    ///
17634    /// Returns `None` if the enum contains an unknown value deserialized from
17635    /// the string representation of enums.
17636    pub fn value(&self) -> std::option::Option<i32> {
17637        match self {
17638            Self::Unspecified => std::option::Option::Some(0),
17639            Self::Basic => std::option::Option::Some(1),
17640            Self::ContinuousBackup => std::option::Option::Some(2),
17641            Self::UnknownValue(u) => u.0.value(),
17642        }
17643    }
17644
17645    /// Gets the enum value as a string.
17646    ///
17647    /// Returns `None` if the enum contains an unknown value deserialized from
17648    /// the integer representation of enums.
17649    pub fn name(&self) -> std::option::Option<&str> {
17650        match self {
17651            Self::Unspecified => std::option::Option::Some("CLUSTER_VIEW_UNSPECIFIED"),
17652            Self::Basic => std::option::Option::Some("CLUSTER_VIEW_BASIC"),
17653            Self::ContinuousBackup => std::option::Option::Some("CLUSTER_VIEW_CONTINUOUS_BACKUP"),
17654            Self::UnknownValue(u) => u.0.name(),
17655        }
17656    }
17657}
17658
17659impl std::default::Default for ClusterView {
17660    fn default() -> Self {
17661        use std::convert::From;
17662        Self::from(0)
17663    }
17664}
17665
17666impl std::fmt::Display for ClusterView {
17667    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17668        wkt::internal::display_enum(f, self.name(), self.value())
17669    }
17670}
17671
17672impl std::convert::From<i32> for ClusterView {
17673    fn from(value: i32) -> Self {
17674        match value {
17675            0 => Self::Unspecified,
17676            1 => Self::Basic,
17677            2 => Self::ContinuousBackup,
17678            _ => Self::UnknownValue(cluster_view::UnknownValue(
17679                wkt::internal::UnknownEnumValue::Integer(value),
17680            )),
17681        }
17682    }
17683}
17684
17685impl std::convert::From<&str> for ClusterView {
17686    fn from(value: &str) -> Self {
17687        use std::string::ToString;
17688        match value {
17689            "CLUSTER_VIEW_UNSPECIFIED" => Self::Unspecified,
17690            "CLUSTER_VIEW_BASIC" => Self::Basic,
17691            "CLUSTER_VIEW_CONTINUOUS_BACKUP" => Self::ContinuousBackup,
17692            _ => Self::UnknownValue(cluster_view::UnknownValue(
17693                wkt::internal::UnknownEnumValue::String(value.to_string()),
17694            )),
17695        }
17696    }
17697}
17698
17699impl serde::ser::Serialize for ClusterView {
17700    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17701    where
17702        S: serde::Serializer,
17703    {
17704        match self {
17705            Self::Unspecified => serializer.serialize_i32(0),
17706            Self::Basic => serializer.serialize_i32(1),
17707            Self::ContinuousBackup => serializer.serialize_i32(2),
17708            Self::UnknownValue(u) => u.0.serialize(serializer),
17709        }
17710    }
17711}
17712
17713impl<'de> serde::de::Deserialize<'de> for ClusterView {
17714    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17715    where
17716        D: serde::Deserializer<'de>,
17717    {
17718        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ClusterView>::new(
17719            ".google.cloud.alloydb.v1.ClusterView",
17720        ))
17721    }
17722}
17723
17724/// The supported database engine versions.
17725///
17726/// # Working with unknown values
17727///
17728/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17729/// additional enum variants at any time. Adding new variants is not considered
17730/// a breaking change. Applications should write their code in anticipation of:
17731///
17732/// - New values appearing in future releases of the client library, **and**
17733/// - New values received dynamically, without application changes.
17734///
17735/// Please consult the [Working with enums] section in the user guide for some
17736/// guidelines.
17737///
17738/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17739#[derive(Clone, Debug, PartialEq)]
17740#[non_exhaustive]
17741pub enum DatabaseVersion {
17742    /// This is an unknown database version.
17743    Unspecified,
17744    /// DEPRECATED - The database version is Postgres 13.
17745    #[deprecated]
17746    Postgres13,
17747    /// The database version is Postgres 14.
17748    Postgres14,
17749    /// The database version is Postgres 15.
17750    Postgres15,
17751    /// The database version is Postgres 16.
17752    Postgres16,
17753    /// The database version is Postgres 17.
17754    Postgres17,
17755    /// If set, the enum was initialized with an unknown value.
17756    ///
17757    /// Applications can examine the value using [DatabaseVersion::value] or
17758    /// [DatabaseVersion::name].
17759    UnknownValue(database_version::UnknownValue),
17760}
17761
17762#[doc(hidden)]
17763pub mod database_version {
17764    #[allow(unused_imports)]
17765    use super::*;
17766    #[derive(Clone, Debug, PartialEq)]
17767    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17768}
17769
17770impl DatabaseVersion {
17771    /// Gets the enum value.
17772    ///
17773    /// Returns `None` if the enum contains an unknown value deserialized from
17774    /// the string representation of enums.
17775    pub fn value(&self) -> std::option::Option<i32> {
17776        match self {
17777            Self::Unspecified => std::option::Option::Some(0),
17778            Self::Postgres13 => std::option::Option::Some(1),
17779            Self::Postgres14 => std::option::Option::Some(2),
17780            Self::Postgres15 => std::option::Option::Some(3),
17781            Self::Postgres16 => std::option::Option::Some(4),
17782            Self::Postgres17 => std::option::Option::Some(5),
17783            Self::UnknownValue(u) => u.0.value(),
17784        }
17785    }
17786
17787    /// Gets the enum value as a string.
17788    ///
17789    /// Returns `None` if the enum contains an unknown value deserialized from
17790    /// the integer representation of enums.
17791    pub fn name(&self) -> std::option::Option<&str> {
17792        match self {
17793            Self::Unspecified => std::option::Option::Some("DATABASE_VERSION_UNSPECIFIED"),
17794            Self::Postgres13 => std::option::Option::Some("POSTGRES_13"),
17795            Self::Postgres14 => std::option::Option::Some("POSTGRES_14"),
17796            Self::Postgres15 => std::option::Option::Some("POSTGRES_15"),
17797            Self::Postgres16 => std::option::Option::Some("POSTGRES_16"),
17798            Self::Postgres17 => std::option::Option::Some("POSTGRES_17"),
17799            Self::UnknownValue(u) => u.0.name(),
17800        }
17801    }
17802}
17803
17804impl std::default::Default for DatabaseVersion {
17805    fn default() -> Self {
17806        use std::convert::From;
17807        Self::from(0)
17808    }
17809}
17810
17811impl std::fmt::Display for DatabaseVersion {
17812    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17813        wkt::internal::display_enum(f, self.name(), self.value())
17814    }
17815}
17816
17817impl std::convert::From<i32> for DatabaseVersion {
17818    fn from(value: i32) -> Self {
17819        match value {
17820            0 => Self::Unspecified,
17821            1 => Self::Postgres13,
17822            2 => Self::Postgres14,
17823            3 => Self::Postgres15,
17824            4 => Self::Postgres16,
17825            5 => Self::Postgres17,
17826            _ => Self::UnknownValue(database_version::UnknownValue(
17827                wkt::internal::UnknownEnumValue::Integer(value),
17828            )),
17829        }
17830    }
17831}
17832
17833impl std::convert::From<&str> for DatabaseVersion {
17834    fn from(value: &str) -> Self {
17835        use std::string::ToString;
17836        match value {
17837            "DATABASE_VERSION_UNSPECIFIED" => Self::Unspecified,
17838            "POSTGRES_13" => Self::Postgres13,
17839            "POSTGRES_14" => Self::Postgres14,
17840            "POSTGRES_15" => Self::Postgres15,
17841            "POSTGRES_16" => Self::Postgres16,
17842            "POSTGRES_17" => Self::Postgres17,
17843            _ => Self::UnknownValue(database_version::UnknownValue(
17844                wkt::internal::UnknownEnumValue::String(value.to_string()),
17845            )),
17846        }
17847    }
17848}
17849
17850impl serde::ser::Serialize for DatabaseVersion {
17851    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17852    where
17853        S: serde::Serializer,
17854    {
17855        match self {
17856            Self::Unspecified => serializer.serialize_i32(0),
17857            Self::Postgres13 => serializer.serialize_i32(1),
17858            Self::Postgres14 => serializer.serialize_i32(2),
17859            Self::Postgres15 => serializer.serialize_i32(3),
17860            Self::Postgres16 => serializer.serialize_i32(4),
17861            Self::Postgres17 => serializer.serialize_i32(5),
17862            Self::UnknownValue(u) => u.0.serialize(serializer),
17863        }
17864    }
17865}
17866
17867impl<'de> serde::de::Deserialize<'de> for DatabaseVersion {
17868    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17869    where
17870        D: serde::Deserializer<'de>,
17871    {
17872        deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatabaseVersion>::new(
17873            ".google.cloud.alloydb.v1.DatabaseVersion",
17874        ))
17875    }
17876}
17877
17878/// Subscription_type added to distinguish between Standard and Trial
17879/// subscriptions. By default, a subscription type is considered STANDARD unless
17880/// explicitly specified.
17881///
17882/// # Working with unknown values
17883///
17884/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17885/// additional enum variants at any time. Adding new variants is not considered
17886/// a breaking change. Applications should write their code in anticipation of:
17887///
17888/// - New values appearing in future releases of the client library, **and**
17889/// - New values received dynamically, without application changes.
17890///
17891/// Please consult the [Working with enums] section in the user guide for some
17892/// guidelines.
17893///
17894/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17895#[derive(Clone, Debug, PartialEq)]
17896#[non_exhaustive]
17897pub enum SubscriptionType {
17898    /// This is an unknown subscription type. By default, the subscription type is
17899    /// STANDARD.
17900    Unspecified,
17901    /// Standard subscription.
17902    Standard,
17903    /// Trial subscription.
17904    Trial,
17905    /// If set, the enum was initialized with an unknown value.
17906    ///
17907    /// Applications can examine the value using [SubscriptionType::value] or
17908    /// [SubscriptionType::name].
17909    UnknownValue(subscription_type::UnknownValue),
17910}
17911
17912#[doc(hidden)]
17913pub mod subscription_type {
17914    #[allow(unused_imports)]
17915    use super::*;
17916    #[derive(Clone, Debug, PartialEq)]
17917    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17918}
17919
17920impl SubscriptionType {
17921    /// Gets the enum value.
17922    ///
17923    /// Returns `None` if the enum contains an unknown value deserialized from
17924    /// the string representation of enums.
17925    pub fn value(&self) -> std::option::Option<i32> {
17926        match self {
17927            Self::Unspecified => std::option::Option::Some(0),
17928            Self::Standard => std::option::Option::Some(1),
17929            Self::Trial => std::option::Option::Some(2),
17930            Self::UnknownValue(u) => u.0.value(),
17931        }
17932    }
17933
17934    /// Gets the enum value as a string.
17935    ///
17936    /// Returns `None` if the enum contains an unknown value deserialized from
17937    /// the integer representation of enums.
17938    pub fn name(&self) -> std::option::Option<&str> {
17939        match self {
17940            Self::Unspecified => std::option::Option::Some("SUBSCRIPTION_TYPE_UNSPECIFIED"),
17941            Self::Standard => std::option::Option::Some("STANDARD"),
17942            Self::Trial => std::option::Option::Some("TRIAL"),
17943            Self::UnknownValue(u) => u.0.name(),
17944        }
17945    }
17946}
17947
17948impl std::default::Default for SubscriptionType {
17949    fn default() -> Self {
17950        use std::convert::From;
17951        Self::from(0)
17952    }
17953}
17954
17955impl std::fmt::Display for SubscriptionType {
17956    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17957        wkt::internal::display_enum(f, self.name(), self.value())
17958    }
17959}
17960
17961impl std::convert::From<i32> for SubscriptionType {
17962    fn from(value: i32) -> Self {
17963        match value {
17964            0 => Self::Unspecified,
17965            1 => Self::Standard,
17966            2 => Self::Trial,
17967            _ => Self::UnknownValue(subscription_type::UnknownValue(
17968                wkt::internal::UnknownEnumValue::Integer(value),
17969            )),
17970        }
17971    }
17972}
17973
17974impl std::convert::From<&str> for SubscriptionType {
17975    fn from(value: &str) -> Self {
17976        use std::string::ToString;
17977        match value {
17978            "SUBSCRIPTION_TYPE_UNSPECIFIED" => Self::Unspecified,
17979            "STANDARD" => Self::Standard,
17980            "TRIAL" => Self::Trial,
17981            _ => Self::UnknownValue(subscription_type::UnknownValue(
17982                wkt::internal::UnknownEnumValue::String(value.to_string()),
17983            )),
17984        }
17985    }
17986}
17987
17988impl serde::ser::Serialize for SubscriptionType {
17989    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17990    where
17991        S: serde::Serializer,
17992    {
17993        match self {
17994            Self::Unspecified => serializer.serialize_i32(0),
17995            Self::Standard => serializer.serialize_i32(1),
17996            Self::Trial => serializer.serialize_i32(2),
17997            Self::UnknownValue(u) => u.0.serialize(serializer),
17998        }
17999    }
18000}
18001
18002impl<'de> serde::de::Deserialize<'de> for SubscriptionType {
18003    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18004    where
18005        D: serde::Deserializer<'de>,
18006    {
18007        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SubscriptionType>::new(
18008            ".google.cloud.alloydb.v1.SubscriptionType",
18009        ))
18010    }
18011}