google_cloud_spanner_admin_instance_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 gax;
23extern crate gaxi;
24extern crate iam_v1;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Encapsulates progress related information for a Cloud Spanner long
41/// running instance operations.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct OperationProgress {
45    /// Percent completion of the operation.
46    /// Values are between 0 and 100 inclusive.
47    pub progress_percent: i32,
48
49    /// Time the request was received.
50    pub start_time: std::option::Option<wkt::Timestamp>,
51
52    /// If set, the time at which this operation failed or was completed
53    /// successfully.
54    pub end_time: std::option::Option<wkt::Timestamp>,
55
56    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
57}
58
59impl OperationProgress {
60    pub fn new() -> Self {
61        std::default::Default::default()
62    }
63
64    /// Sets the value of [progress_percent][crate::model::OperationProgress::progress_percent].
65    pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
66        self.progress_percent = v.into();
67        self
68    }
69
70    /// Sets the value of [start_time][crate::model::OperationProgress::start_time].
71    pub fn set_start_time<T>(mut self, v: T) -> Self
72    where
73        T: std::convert::Into<wkt::Timestamp>,
74    {
75        self.start_time = std::option::Option::Some(v.into());
76        self
77    }
78
79    /// Sets or clears the value of [start_time][crate::model::OperationProgress::start_time].
80    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
81    where
82        T: std::convert::Into<wkt::Timestamp>,
83    {
84        self.start_time = v.map(|x| x.into());
85        self
86    }
87
88    /// Sets the value of [end_time][crate::model::OperationProgress::end_time].
89    pub fn set_end_time<T>(mut self, v: T) -> Self
90    where
91        T: std::convert::Into<wkt::Timestamp>,
92    {
93        self.end_time = std::option::Option::Some(v.into());
94        self
95    }
96
97    /// Sets or clears the value of [end_time][crate::model::OperationProgress::end_time].
98    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
99    where
100        T: std::convert::Into<wkt::Timestamp>,
101    {
102        self.end_time = v.map(|x| x.into());
103        self
104    }
105}
106
107impl wkt::message::Message for OperationProgress {
108    fn typename() -> &'static str {
109        "type.googleapis.com/google.spanner.admin.instance.v1.OperationProgress"
110    }
111}
112
113/// ReplicaSelection identifies replicas with common properties.
114#[derive(Clone, Default, PartialEq)]
115#[non_exhaustive]
116pub struct ReplicaSelection {
117    /// Required. Name of the location of the replicas (e.g., "us-central1").
118    pub location: std::string::String,
119
120    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
121}
122
123impl ReplicaSelection {
124    pub fn new() -> Self {
125        std::default::Default::default()
126    }
127
128    /// Sets the value of [location][crate::model::ReplicaSelection::location].
129    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
130        self.location = v.into();
131        self
132    }
133}
134
135impl wkt::message::Message for ReplicaSelection {
136    fn typename() -> &'static str {
137        "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaSelection"
138    }
139}
140
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct ReplicaInfo {
144    /// The location of the serving resources, e.g., "us-central1".
145    pub location: std::string::String,
146
147    /// The type of replica.
148    pub r#type: crate::model::replica_info::ReplicaType,
149
150    /// If true, this location is designated as the default leader location where
151    /// leader replicas are placed. See the [region types
152    /// documentation](https://cloud.google.com/spanner/docs/instances#region_types)
153    /// for more details.
154    pub default_leader_location: bool,
155
156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
157}
158
159impl ReplicaInfo {
160    pub fn new() -> Self {
161        std::default::Default::default()
162    }
163
164    /// Sets the value of [location][crate::model::ReplicaInfo::location].
165    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
166        self.location = v.into();
167        self
168    }
169
170    /// Sets the value of [r#type][crate::model::ReplicaInfo::type].
171    pub fn set_type<T: std::convert::Into<crate::model::replica_info::ReplicaType>>(
172        mut self,
173        v: T,
174    ) -> Self {
175        self.r#type = v.into();
176        self
177    }
178
179    /// Sets the value of [default_leader_location][crate::model::ReplicaInfo::default_leader_location].
180    pub fn set_default_leader_location<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
181        self.default_leader_location = v.into();
182        self
183    }
184}
185
186impl wkt::message::Message for ReplicaInfo {
187    fn typename() -> &'static str {
188        "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaInfo"
189    }
190}
191
192/// Defines additional types related to [ReplicaInfo].
193pub mod replica_info {
194    #[allow(unused_imports)]
195    use super::*;
196
197    /// Indicates the type of replica.  See the [replica types
198    /// documentation](https://cloud.google.com/spanner/docs/replication#replica_types)
199    /// for more details.
200    ///
201    /// # Working with unknown values
202    ///
203    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
204    /// additional enum variants at any time. Adding new variants is not considered
205    /// a breaking change. Applications should write their code in anticipation of:
206    ///
207    /// - New values appearing in future releases of the client library, **and**
208    /// - New values received dynamically, without application changes.
209    ///
210    /// Please consult the [Working with enums] section in the user guide for some
211    /// guidelines.
212    ///
213    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
214    #[derive(Clone, Debug, PartialEq)]
215    #[non_exhaustive]
216    pub enum ReplicaType {
217        /// Not specified.
218        TypeUnspecified,
219        /// Read-write replicas support both reads and writes. These replicas:
220        ///
221        /// * Maintain a full copy of your data.
222        /// * Serve reads.
223        /// * Can vote whether to commit a write.
224        /// * Participate in leadership election.
225        /// * Are eligible to become a leader.
226        ReadWrite,
227        /// Read-only replicas only support reads (not writes). Read-only replicas:
228        ///
229        /// * Maintain a full copy of your data.
230        /// * Serve reads.
231        /// * Do not participate in voting to commit writes.
232        /// * Are not eligible to become a leader.
233        ReadOnly,
234        /// Witness replicas don't support reads but do participate in voting to
235        /// commit writes. Witness replicas:
236        ///
237        /// * Do not maintain a full copy of data.
238        /// * Do not serve reads.
239        /// * Vote whether to commit writes.
240        /// * Participate in leader election but are not eligible to become leader.
241        Witness,
242        /// If set, the enum was initialized with an unknown value.
243        ///
244        /// Applications can examine the value using [ReplicaType::value] or
245        /// [ReplicaType::name].
246        UnknownValue(replica_type::UnknownValue),
247    }
248
249    #[doc(hidden)]
250    pub mod replica_type {
251        #[allow(unused_imports)]
252        use super::*;
253        #[derive(Clone, Debug, PartialEq)]
254        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
255    }
256
257    impl ReplicaType {
258        /// Gets the enum value.
259        ///
260        /// Returns `None` if the enum contains an unknown value deserialized from
261        /// the string representation of enums.
262        pub fn value(&self) -> std::option::Option<i32> {
263            match self {
264                Self::TypeUnspecified => std::option::Option::Some(0),
265                Self::ReadWrite => std::option::Option::Some(1),
266                Self::ReadOnly => std::option::Option::Some(2),
267                Self::Witness => std::option::Option::Some(3),
268                Self::UnknownValue(u) => u.0.value(),
269            }
270        }
271
272        /// Gets the enum value as a string.
273        ///
274        /// Returns `None` if the enum contains an unknown value deserialized from
275        /// the integer representation of enums.
276        pub fn name(&self) -> std::option::Option<&str> {
277            match self {
278                Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
279                Self::ReadWrite => std::option::Option::Some("READ_WRITE"),
280                Self::ReadOnly => std::option::Option::Some("READ_ONLY"),
281                Self::Witness => std::option::Option::Some("WITNESS"),
282                Self::UnknownValue(u) => u.0.name(),
283            }
284        }
285    }
286
287    impl std::default::Default for ReplicaType {
288        fn default() -> Self {
289            use std::convert::From;
290            Self::from(0)
291        }
292    }
293
294    impl std::fmt::Display for ReplicaType {
295        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
296            wkt::internal::display_enum(f, self.name(), self.value())
297        }
298    }
299
300    impl std::convert::From<i32> for ReplicaType {
301        fn from(value: i32) -> Self {
302            match value {
303                0 => Self::TypeUnspecified,
304                1 => Self::ReadWrite,
305                2 => Self::ReadOnly,
306                3 => Self::Witness,
307                _ => Self::UnknownValue(replica_type::UnknownValue(
308                    wkt::internal::UnknownEnumValue::Integer(value),
309                )),
310            }
311        }
312    }
313
314    impl std::convert::From<&str> for ReplicaType {
315        fn from(value: &str) -> Self {
316            use std::string::ToString;
317            match value {
318                "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
319                "READ_WRITE" => Self::ReadWrite,
320                "READ_ONLY" => Self::ReadOnly,
321                "WITNESS" => Self::Witness,
322                _ => Self::UnknownValue(replica_type::UnknownValue(
323                    wkt::internal::UnknownEnumValue::String(value.to_string()),
324                )),
325            }
326        }
327    }
328
329    impl serde::ser::Serialize for ReplicaType {
330        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
331        where
332            S: serde::Serializer,
333        {
334            match self {
335                Self::TypeUnspecified => serializer.serialize_i32(0),
336                Self::ReadWrite => serializer.serialize_i32(1),
337                Self::ReadOnly => serializer.serialize_i32(2),
338                Self::Witness => serializer.serialize_i32(3),
339                Self::UnknownValue(u) => u.0.serialize(serializer),
340            }
341        }
342    }
343
344    impl<'de> serde::de::Deserialize<'de> for ReplicaType {
345        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
346        where
347            D: serde::Deserializer<'de>,
348        {
349            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReplicaType>::new(
350                ".google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType",
351            ))
352        }
353    }
354}
355
356/// A possible configuration for a Cloud Spanner instance. Configurations
357/// define the geographic placement of nodes and their replication.
358#[derive(Clone, Default, PartialEq)]
359#[non_exhaustive]
360pub struct InstanceConfig {
361    /// A unique identifier for the instance configuration.  Values
362    /// are of the form
363    /// `projects/<project>/instanceConfigs/[a-z][-a-z0-9]*`.
364    ///
365    /// User instance configuration must start with `custom-`.
366    pub name: std::string::String,
367
368    /// The name of this instance configuration as it appears in UIs.
369    pub display_name: std::string::String,
370
371    /// Output only. Whether this instance configuration is a Google-managed or
372    /// user-managed configuration.
373    pub config_type: crate::model::instance_config::Type,
374
375    /// The geographic placement of nodes in this instance configuration and their
376    /// replication properties.
377    ///
378    /// To create user-managed configurations, input
379    /// `replicas` must include all replicas in `replicas` of the `base_config`
380    /// and include one or more replicas in the `optional_replicas` of the
381    /// `base_config`.
382    pub replicas: std::vec::Vec<crate::model::ReplicaInfo>,
383
384    /// Output only. The available optional replicas to choose from for
385    /// user-managed configurations. Populated for Google-managed configurations.
386    pub optional_replicas: std::vec::Vec<crate::model::ReplicaInfo>,
387
388    /// Base configuration name, e.g. projects/<project_name>/instanceConfigs/nam3,
389    /// based on which this configuration is created. Only set for user-managed
390    /// configurations. `base_config` must refer to a configuration of type
391    /// `GOOGLE_MANAGED` in the same project as this configuration.
392    pub base_config: std::string::String,
393
394    /// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
395    /// resources into groups that reflect a customer's organizational needs and
396    /// deployment strategies. Cloud Labels can be used to filter collections of
397    /// resources. They can be used to control how resource metrics are aggregated.
398    /// And they can be used as arguments to policy management rules (e.g. route,
399    /// firewall, load balancing, etc.).
400    ///
401    /// * Label keys must be between 1 and 63 characters long and must conform to
402    ///   the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
403    /// * Label values must be between 0 and 63 characters long and must conform
404    ///   to the regular expression `[a-z0-9_-]{0,63}`.
405    /// * No more than 64 labels can be associated with a given resource.
406    ///
407    /// See <https://goo.gl/xmQnxf> for more information on and examples of labels.
408    ///
409    /// If you plan to use labels in your own code, please note that additional
410    /// characters may be allowed in the future. Therefore, you are advised to use
411    /// an internal label representation, such as JSON, which doesn't rely upon
412    /// specific characters being disallowed.  For example, representing labels
413    /// as the string:  name + "_" + value  would prove problematic if we were to
414    /// allow "_" in a future release.
415    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
416
417    /// etag is used for optimistic concurrency control as a way
418    /// to help prevent simultaneous updates of a instance configuration from
419    /// overwriting each other. It is strongly suggested that systems make use of
420    /// the etag in the read-modify-write cycle to perform instance configuration
421    /// updates in order to avoid race conditions: An etag is returned in the
422    /// response which contains instance configurations, and systems are expected
423    /// to put that etag in the request to update instance configuration to ensure
424    /// that their change is applied to the same version of the instance
425    /// configuration. If no etag is provided in the call to update the instance
426    /// configuration, then the existing instance configuration is overwritten
427    /// blindly.
428    pub etag: std::string::String,
429
430    /// Allowed values of the "default_leader" schema option for databases in
431    /// instances that use this instance configuration.
432    pub leader_options: std::vec::Vec<std::string::String>,
433
434    /// Output only. If true, the instance configuration is being created or
435    /// updated. If false, there are no ongoing operations for the instance
436    /// configuration.
437    pub reconciling: bool,
438
439    /// Output only. The current instance configuration state. Applicable only for
440    /// `USER_MANAGED` configurations.
441    pub state: crate::model::instance_config::State,
442
443    /// Output only. Describes whether free instances are available to be created
444    /// in this instance configuration.
445    pub free_instance_availability: crate::model::instance_config::FreeInstanceAvailability,
446
447    /// Output only. The `QuorumType` of the instance configuration.
448    pub quorum_type: crate::model::instance_config::QuorumType,
449
450    /// Output only. The storage limit in bytes per processing unit.
451    pub storage_limit_per_processing_unit: i64,
452
453    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
454}
455
456impl InstanceConfig {
457    pub fn new() -> Self {
458        std::default::Default::default()
459    }
460
461    /// Sets the value of [name][crate::model::InstanceConfig::name].
462    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
463        self.name = v.into();
464        self
465    }
466
467    /// Sets the value of [display_name][crate::model::InstanceConfig::display_name].
468    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
469        self.display_name = v.into();
470        self
471    }
472
473    /// Sets the value of [config_type][crate::model::InstanceConfig::config_type].
474    pub fn set_config_type<T: std::convert::Into<crate::model::instance_config::Type>>(
475        mut self,
476        v: T,
477    ) -> Self {
478        self.config_type = v.into();
479        self
480    }
481
482    /// Sets the value of [replicas][crate::model::InstanceConfig::replicas].
483    pub fn set_replicas<T, V>(mut self, v: T) -> Self
484    where
485        T: std::iter::IntoIterator<Item = V>,
486        V: std::convert::Into<crate::model::ReplicaInfo>,
487    {
488        use std::iter::Iterator;
489        self.replicas = v.into_iter().map(|i| i.into()).collect();
490        self
491    }
492
493    /// Sets the value of [optional_replicas][crate::model::InstanceConfig::optional_replicas].
494    pub fn set_optional_replicas<T, V>(mut self, v: T) -> Self
495    where
496        T: std::iter::IntoIterator<Item = V>,
497        V: std::convert::Into<crate::model::ReplicaInfo>,
498    {
499        use std::iter::Iterator;
500        self.optional_replicas = v.into_iter().map(|i| i.into()).collect();
501        self
502    }
503
504    /// Sets the value of [base_config][crate::model::InstanceConfig::base_config].
505    pub fn set_base_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
506        self.base_config = v.into();
507        self
508    }
509
510    /// Sets the value of [labels][crate::model::InstanceConfig::labels].
511    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
512    where
513        T: std::iter::IntoIterator<Item = (K, V)>,
514        K: std::convert::Into<std::string::String>,
515        V: std::convert::Into<std::string::String>,
516    {
517        use std::iter::Iterator;
518        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
519        self
520    }
521
522    /// Sets the value of [etag][crate::model::InstanceConfig::etag].
523    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
524        self.etag = v.into();
525        self
526    }
527
528    /// Sets the value of [leader_options][crate::model::InstanceConfig::leader_options].
529    pub fn set_leader_options<T, V>(mut self, v: T) -> Self
530    where
531        T: std::iter::IntoIterator<Item = V>,
532        V: std::convert::Into<std::string::String>,
533    {
534        use std::iter::Iterator;
535        self.leader_options = v.into_iter().map(|i| i.into()).collect();
536        self
537    }
538
539    /// Sets the value of [reconciling][crate::model::InstanceConfig::reconciling].
540    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
541        self.reconciling = v.into();
542        self
543    }
544
545    /// Sets the value of [state][crate::model::InstanceConfig::state].
546    pub fn set_state<T: std::convert::Into<crate::model::instance_config::State>>(
547        mut self,
548        v: T,
549    ) -> Self {
550        self.state = v.into();
551        self
552    }
553
554    /// Sets the value of [free_instance_availability][crate::model::InstanceConfig::free_instance_availability].
555    pub fn set_free_instance_availability<
556        T: std::convert::Into<crate::model::instance_config::FreeInstanceAvailability>,
557    >(
558        mut self,
559        v: T,
560    ) -> Self {
561        self.free_instance_availability = v.into();
562        self
563    }
564
565    /// Sets the value of [quorum_type][crate::model::InstanceConfig::quorum_type].
566    pub fn set_quorum_type<T: std::convert::Into<crate::model::instance_config::QuorumType>>(
567        mut self,
568        v: T,
569    ) -> Self {
570        self.quorum_type = v.into();
571        self
572    }
573
574    /// Sets the value of [storage_limit_per_processing_unit][crate::model::InstanceConfig::storage_limit_per_processing_unit].
575    pub fn set_storage_limit_per_processing_unit<T: std::convert::Into<i64>>(
576        mut self,
577        v: T,
578    ) -> Self {
579        self.storage_limit_per_processing_unit = v.into();
580        self
581    }
582}
583
584impl wkt::message::Message for InstanceConfig {
585    fn typename() -> &'static str {
586        "type.googleapis.com/google.spanner.admin.instance.v1.InstanceConfig"
587    }
588}
589
590/// Defines additional types related to [InstanceConfig].
591pub mod instance_config {
592    #[allow(unused_imports)]
593    use super::*;
594
595    /// The type of this configuration.
596    ///
597    /// # Working with unknown values
598    ///
599    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
600    /// additional enum variants at any time. Adding new variants is not considered
601    /// a breaking change. Applications should write their code in anticipation of:
602    ///
603    /// - New values appearing in future releases of the client library, **and**
604    /// - New values received dynamically, without application changes.
605    ///
606    /// Please consult the [Working with enums] section in the user guide for some
607    /// guidelines.
608    ///
609    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
610    #[derive(Clone, Debug, PartialEq)]
611    #[non_exhaustive]
612    pub enum Type {
613        /// Unspecified.
614        Unspecified,
615        /// Google-managed configuration.
616        GoogleManaged,
617        /// User-managed configuration.
618        UserManaged,
619        /// If set, the enum was initialized with an unknown value.
620        ///
621        /// Applications can examine the value using [Type::value] or
622        /// [Type::name].
623        UnknownValue(r#type::UnknownValue),
624    }
625
626    #[doc(hidden)]
627    pub mod r#type {
628        #[allow(unused_imports)]
629        use super::*;
630        #[derive(Clone, Debug, PartialEq)]
631        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
632    }
633
634    impl Type {
635        /// Gets the enum value.
636        ///
637        /// Returns `None` if the enum contains an unknown value deserialized from
638        /// the string representation of enums.
639        pub fn value(&self) -> std::option::Option<i32> {
640            match self {
641                Self::Unspecified => std::option::Option::Some(0),
642                Self::GoogleManaged => std::option::Option::Some(1),
643                Self::UserManaged => std::option::Option::Some(2),
644                Self::UnknownValue(u) => u.0.value(),
645            }
646        }
647
648        /// Gets the enum value as a string.
649        ///
650        /// Returns `None` if the enum contains an unknown value deserialized from
651        /// the integer representation of enums.
652        pub fn name(&self) -> std::option::Option<&str> {
653            match self {
654                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
655                Self::GoogleManaged => std::option::Option::Some("GOOGLE_MANAGED"),
656                Self::UserManaged => std::option::Option::Some("USER_MANAGED"),
657                Self::UnknownValue(u) => u.0.name(),
658            }
659        }
660    }
661
662    impl std::default::Default for Type {
663        fn default() -> Self {
664            use std::convert::From;
665            Self::from(0)
666        }
667    }
668
669    impl std::fmt::Display for Type {
670        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
671            wkt::internal::display_enum(f, self.name(), self.value())
672        }
673    }
674
675    impl std::convert::From<i32> for Type {
676        fn from(value: i32) -> Self {
677            match value {
678                0 => Self::Unspecified,
679                1 => Self::GoogleManaged,
680                2 => Self::UserManaged,
681                _ => Self::UnknownValue(r#type::UnknownValue(
682                    wkt::internal::UnknownEnumValue::Integer(value),
683                )),
684            }
685        }
686    }
687
688    impl std::convert::From<&str> for Type {
689        fn from(value: &str) -> Self {
690            use std::string::ToString;
691            match value {
692                "TYPE_UNSPECIFIED" => Self::Unspecified,
693                "GOOGLE_MANAGED" => Self::GoogleManaged,
694                "USER_MANAGED" => Self::UserManaged,
695                _ => Self::UnknownValue(r#type::UnknownValue(
696                    wkt::internal::UnknownEnumValue::String(value.to_string()),
697                )),
698            }
699        }
700    }
701
702    impl serde::ser::Serialize for Type {
703        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
704        where
705            S: serde::Serializer,
706        {
707            match self {
708                Self::Unspecified => serializer.serialize_i32(0),
709                Self::GoogleManaged => serializer.serialize_i32(1),
710                Self::UserManaged => serializer.serialize_i32(2),
711                Self::UnknownValue(u) => u.0.serialize(serializer),
712            }
713        }
714    }
715
716    impl<'de> serde::de::Deserialize<'de> for Type {
717        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
718        where
719            D: serde::Deserializer<'de>,
720        {
721            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
722                ".google.spanner.admin.instance.v1.InstanceConfig.Type",
723            ))
724        }
725    }
726
727    /// Indicates the current state of the instance configuration.
728    ///
729    /// # Working with unknown values
730    ///
731    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
732    /// additional enum variants at any time. Adding new variants is not considered
733    /// a breaking change. Applications should write their code in anticipation of:
734    ///
735    /// - New values appearing in future releases of the client library, **and**
736    /// - New values received dynamically, without application changes.
737    ///
738    /// Please consult the [Working with enums] section in the user guide for some
739    /// guidelines.
740    ///
741    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
742    #[derive(Clone, Debug, PartialEq)]
743    #[non_exhaustive]
744    pub enum State {
745        /// Not specified.
746        Unspecified,
747        /// The instance configuration is still being created.
748        Creating,
749        /// The instance configuration is fully created and ready to be used to
750        /// create instances.
751        Ready,
752        /// If set, the enum was initialized with an unknown value.
753        ///
754        /// Applications can examine the value using [State::value] or
755        /// [State::name].
756        UnknownValue(state::UnknownValue),
757    }
758
759    #[doc(hidden)]
760    pub mod state {
761        #[allow(unused_imports)]
762        use super::*;
763        #[derive(Clone, Debug, PartialEq)]
764        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
765    }
766
767    impl State {
768        /// Gets the enum value.
769        ///
770        /// Returns `None` if the enum contains an unknown value deserialized from
771        /// the string representation of enums.
772        pub fn value(&self) -> std::option::Option<i32> {
773            match self {
774                Self::Unspecified => std::option::Option::Some(0),
775                Self::Creating => std::option::Option::Some(1),
776                Self::Ready => std::option::Option::Some(2),
777                Self::UnknownValue(u) => u.0.value(),
778            }
779        }
780
781        /// Gets the enum value as a string.
782        ///
783        /// Returns `None` if the enum contains an unknown value deserialized from
784        /// the integer representation of enums.
785        pub fn name(&self) -> std::option::Option<&str> {
786            match self {
787                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
788                Self::Creating => std::option::Option::Some("CREATING"),
789                Self::Ready => std::option::Option::Some("READY"),
790                Self::UnknownValue(u) => u.0.name(),
791            }
792        }
793    }
794
795    impl std::default::Default for State {
796        fn default() -> Self {
797            use std::convert::From;
798            Self::from(0)
799        }
800    }
801
802    impl std::fmt::Display for State {
803        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
804            wkt::internal::display_enum(f, self.name(), self.value())
805        }
806    }
807
808    impl std::convert::From<i32> for State {
809        fn from(value: i32) -> Self {
810            match value {
811                0 => Self::Unspecified,
812                1 => Self::Creating,
813                2 => Self::Ready,
814                _ => Self::UnknownValue(state::UnknownValue(
815                    wkt::internal::UnknownEnumValue::Integer(value),
816                )),
817            }
818        }
819    }
820
821    impl std::convert::From<&str> for State {
822        fn from(value: &str) -> Self {
823            use std::string::ToString;
824            match value {
825                "STATE_UNSPECIFIED" => Self::Unspecified,
826                "CREATING" => Self::Creating,
827                "READY" => Self::Ready,
828                _ => Self::UnknownValue(state::UnknownValue(
829                    wkt::internal::UnknownEnumValue::String(value.to_string()),
830                )),
831            }
832        }
833    }
834
835    impl serde::ser::Serialize for State {
836        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
837        where
838            S: serde::Serializer,
839        {
840            match self {
841                Self::Unspecified => serializer.serialize_i32(0),
842                Self::Creating => serializer.serialize_i32(1),
843                Self::Ready => serializer.serialize_i32(2),
844                Self::UnknownValue(u) => u.0.serialize(serializer),
845            }
846        }
847    }
848
849    impl<'de> serde::de::Deserialize<'de> for State {
850        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
851        where
852            D: serde::Deserializer<'de>,
853        {
854            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
855                ".google.spanner.admin.instance.v1.InstanceConfig.State",
856            ))
857        }
858    }
859
860    /// Describes the availability for free instances to be created in an instance
861    /// configuration.
862    ///
863    /// # Working with unknown values
864    ///
865    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
866    /// additional enum variants at any time. Adding new variants is not considered
867    /// a breaking change. Applications should write their code in anticipation of:
868    ///
869    /// - New values appearing in future releases of the client library, **and**
870    /// - New values received dynamically, without application changes.
871    ///
872    /// Please consult the [Working with enums] section in the user guide for some
873    /// guidelines.
874    ///
875    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
876    #[derive(Clone, Debug, PartialEq)]
877    #[non_exhaustive]
878    pub enum FreeInstanceAvailability {
879        /// Not specified.
880        Unspecified,
881        /// Indicates that free instances are available to be created in this
882        /// instance configuration.
883        Available,
884        /// Indicates that free instances are not supported in this instance
885        /// configuration.
886        Unsupported,
887        /// Indicates that free instances are currently not available to be created
888        /// in this instance configuration.
889        Disabled,
890        /// Indicates that additional free instances cannot be created in this
891        /// instance configuration because the project has reached its limit of free
892        /// instances.
893        QuotaExceeded,
894        /// If set, the enum was initialized with an unknown value.
895        ///
896        /// Applications can examine the value using [FreeInstanceAvailability::value] or
897        /// [FreeInstanceAvailability::name].
898        UnknownValue(free_instance_availability::UnknownValue),
899    }
900
901    #[doc(hidden)]
902    pub mod free_instance_availability {
903        #[allow(unused_imports)]
904        use super::*;
905        #[derive(Clone, Debug, PartialEq)]
906        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
907    }
908
909    impl FreeInstanceAvailability {
910        /// Gets the enum value.
911        ///
912        /// Returns `None` if the enum contains an unknown value deserialized from
913        /// the string representation of enums.
914        pub fn value(&self) -> std::option::Option<i32> {
915            match self {
916                Self::Unspecified => std::option::Option::Some(0),
917                Self::Available => std::option::Option::Some(1),
918                Self::Unsupported => std::option::Option::Some(2),
919                Self::Disabled => std::option::Option::Some(3),
920                Self::QuotaExceeded => std::option::Option::Some(4),
921                Self::UnknownValue(u) => u.0.value(),
922            }
923        }
924
925        /// Gets the enum value as a string.
926        ///
927        /// Returns `None` if the enum contains an unknown value deserialized from
928        /// the integer representation of enums.
929        pub fn name(&self) -> std::option::Option<&str> {
930            match self {
931                Self::Unspecified => {
932                    std::option::Option::Some("FREE_INSTANCE_AVAILABILITY_UNSPECIFIED")
933                }
934                Self::Available => std::option::Option::Some("AVAILABLE"),
935                Self::Unsupported => std::option::Option::Some("UNSUPPORTED"),
936                Self::Disabled => std::option::Option::Some("DISABLED"),
937                Self::QuotaExceeded => std::option::Option::Some("QUOTA_EXCEEDED"),
938                Self::UnknownValue(u) => u.0.name(),
939            }
940        }
941    }
942
943    impl std::default::Default for FreeInstanceAvailability {
944        fn default() -> Self {
945            use std::convert::From;
946            Self::from(0)
947        }
948    }
949
950    impl std::fmt::Display for FreeInstanceAvailability {
951        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
952            wkt::internal::display_enum(f, self.name(), self.value())
953        }
954    }
955
956    impl std::convert::From<i32> for FreeInstanceAvailability {
957        fn from(value: i32) -> Self {
958            match value {
959                0 => Self::Unspecified,
960                1 => Self::Available,
961                2 => Self::Unsupported,
962                3 => Self::Disabled,
963                4 => Self::QuotaExceeded,
964                _ => Self::UnknownValue(free_instance_availability::UnknownValue(
965                    wkt::internal::UnknownEnumValue::Integer(value),
966                )),
967            }
968        }
969    }
970
971    impl std::convert::From<&str> for FreeInstanceAvailability {
972        fn from(value: &str) -> Self {
973            use std::string::ToString;
974            match value {
975                "FREE_INSTANCE_AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
976                "AVAILABLE" => Self::Available,
977                "UNSUPPORTED" => Self::Unsupported,
978                "DISABLED" => Self::Disabled,
979                "QUOTA_EXCEEDED" => Self::QuotaExceeded,
980                _ => Self::UnknownValue(free_instance_availability::UnknownValue(
981                    wkt::internal::UnknownEnumValue::String(value.to_string()),
982                )),
983            }
984        }
985    }
986
987    impl serde::ser::Serialize for FreeInstanceAvailability {
988        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
989        where
990            S: serde::Serializer,
991        {
992            match self {
993                Self::Unspecified => serializer.serialize_i32(0),
994                Self::Available => serializer.serialize_i32(1),
995                Self::Unsupported => serializer.serialize_i32(2),
996                Self::Disabled => serializer.serialize_i32(3),
997                Self::QuotaExceeded => serializer.serialize_i32(4),
998                Self::UnknownValue(u) => u.0.serialize(serializer),
999            }
1000        }
1001    }
1002
1003    impl<'de> serde::de::Deserialize<'de> for FreeInstanceAvailability {
1004        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1005        where
1006            D: serde::Deserializer<'de>,
1007        {
1008            deserializer.deserialize_any(
1009                wkt::internal::EnumVisitor::<FreeInstanceAvailability>::new(
1010                    ".google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability",
1011                ),
1012            )
1013        }
1014    }
1015
1016    /// Indicates the quorum type of this instance configuration.
1017    ///
1018    /// # Working with unknown values
1019    ///
1020    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1021    /// additional enum variants at any time. Adding new variants is not considered
1022    /// a breaking change. Applications should write their code in anticipation of:
1023    ///
1024    /// - New values appearing in future releases of the client library, **and**
1025    /// - New values received dynamically, without application changes.
1026    ///
1027    /// Please consult the [Working with enums] section in the user guide for some
1028    /// guidelines.
1029    ///
1030    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1031    #[derive(Clone, Debug, PartialEq)]
1032    #[non_exhaustive]
1033    pub enum QuorumType {
1034        /// Quorum type not specified.
1035        Unspecified,
1036        /// An instance configuration tagged with `REGION` quorum type forms a write
1037        /// quorum in a single region.
1038        Region,
1039        /// An instance configuration tagged with the `DUAL_REGION` quorum type forms
1040        /// a write quorum with exactly two read-write regions in a multi-region
1041        /// configuration.
1042        ///
1043        /// This instance configuration requires failover in the event of
1044        /// regional failures.
1045        DualRegion,
1046        /// An instance configuration tagged with the `MULTI_REGION` quorum type
1047        /// forms a write quorum from replicas that are spread across more than one
1048        /// region in a multi-region configuration.
1049        MultiRegion,
1050        /// If set, the enum was initialized with an unknown value.
1051        ///
1052        /// Applications can examine the value using [QuorumType::value] or
1053        /// [QuorumType::name].
1054        UnknownValue(quorum_type::UnknownValue),
1055    }
1056
1057    #[doc(hidden)]
1058    pub mod quorum_type {
1059        #[allow(unused_imports)]
1060        use super::*;
1061        #[derive(Clone, Debug, PartialEq)]
1062        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1063    }
1064
1065    impl QuorumType {
1066        /// Gets the enum value.
1067        ///
1068        /// Returns `None` if the enum contains an unknown value deserialized from
1069        /// the string representation of enums.
1070        pub fn value(&self) -> std::option::Option<i32> {
1071            match self {
1072                Self::Unspecified => std::option::Option::Some(0),
1073                Self::Region => std::option::Option::Some(1),
1074                Self::DualRegion => std::option::Option::Some(2),
1075                Self::MultiRegion => std::option::Option::Some(3),
1076                Self::UnknownValue(u) => u.0.value(),
1077            }
1078        }
1079
1080        /// Gets the enum value as a string.
1081        ///
1082        /// Returns `None` if the enum contains an unknown value deserialized from
1083        /// the integer representation of enums.
1084        pub fn name(&self) -> std::option::Option<&str> {
1085            match self {
1086                Self::Unspecified => std::option::Option::Some("QUORUM_TYPE_UNSPECIFIED"),
1087                Self::Region => std::option::Option::Some("REGION"),
1088                Self::DualRegion => std::option::Option::Some("DUAL_REGION"),
1089                Self::MultiRegion => std::option::Option::Some("MULTI_REGION"),
1090                Self::UnknownValue(u) => u.0.name(),
1091            }
1092        }
1093    }
1094
1095    impl std::default::Default for QuorumType {
1096        fn default() -> Self {
1097            use std::convert::From;
1098            Self::from(0)
1099        }
1100    }
1101
1102    impl std::fmt::Display for QuorumType {
1103        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1104            wkt::internal::display_enum(f, self.name(), self.value())
1105        }
1106    }
1107
1108    impl std::convert::From<i32> for QuorumType {
1109        fn from(value: i32) -> Self {
1110            match value {
1111                0 => Self::Unspecified,
1112                1 => Self::Region,
1113                2 => Self::DualRegion,
1114                3 => Self::MultiRegion,
1115                _ => Self::UnknownValue(quorum_type::UnknownValue(
1116                    wkt::internal::UnknownEnumValue::Integer(value),
1117                )),
1118            }
1119        }
1120    }
1121
1122    impl std::convert::From<&str> for QuorumType {
1123        fn from(value: &str) -> Self {
1124            use std::string::ToString;
1125            match value {
1126                "QUORUM_TYPE_UNSPECIFIED" => Self::Unspecified,
1127                "REGION" => Self::Region,
1128                "DUAL_REGION" => Self::DualRegion,
1129                "MULTI_REGION" => Self::MultiRegion,
1130                _ => Self::UnknownValue(quorum_type::UnknownValue(
1131                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1132                )),
1133            }
1134        }
1135    }
1136
1137    impl serde::ser::Serialize for QuorumType {
1138        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1139        where
1140            S: serde::Serializer,
1141        {
1142            match self {
1143                Self::Unspecified => serializer.serialize_i32(0),
1144                Self::Region => serializer.serialize_i32(1),
1145                Self::DualRegion => serializer.serialize_i32(2),
1146                Self::MultiRegion => serializer.serialize_i32(3),
1147                Self::UnknownValue(u) => u.0.serialize(serializer),
1148            }
1149        }
1150    }
1151
1152    impl<'de> serde::de::Deserialize<'de> for QuorumType {
1153        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1154        where
1155            D: serde::Deserializer<'de>,
1156        {
1157            deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuorumType>::new(
1158                ".google.spanner.admin.instance.v1.InstanceConfig.QuorumType",
1159            ))
1160        }
1161    }
1162}
1163
1164/// ReplicaComputeCapacity describes the amount of server resources that are
1165/// allocated to each replica identified by the replica selection.
1166#[derive(Clone, Default, PartialEq)]
1167#[non_exhaustive]
1168pub struct ReplicaComputeCapacity {
1169    /// Required. Identifies replicas by specified properties.
1170    /// All replicas in the selection have the same amount of compute capacity.
1171    pub replica_selection: std::option::Option<crate::model::ReplicaSelection>,
1172
1173    /// Compute capacity allocated to each replica identified by the specified
1174    /// selection.
1175    /// The unit is selected based on the unit used to specify the instance size
1176    /// for non-autoscaling instances, or the unit used in autoscaling limit for
1177    /// autoscaling instances.
1178    pub compute_capacity:
1179        std::option::Option<crate::model::replica_compute_capacity::ComputeCapacity>,
1180
1181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1182}
1183
1184impl ReplicaComputeCapacity {
1185    pub fn new() -> Self {
1186        std::default::Default::default()
1187    }
1188
1189    /// Sets the value of [replica_selection][crate::model::ReplicaComputeCapacity::replica_selection].
1190    pub fn set_replica_selection<T>(mut self, v: T) -> Self
1191    where
1192        T: std::convert::Into<crate::model::ReplicaSelection>,
1193    {
1194        self.replica_selection = std::option::Option::Some(v.into());
1195        self
1196    }
1197
1198    /// Sets or clears the value of [replica_selection][crate::model::ReplicaComputeCapacity::replica_selection].
1199    pub fn set_or_clear_replica_selection<T>(mut self, v: std::option::Option<T>) -> Self
1200    where
1201        T: std::convert::Into<crate::model::ReplicaSelection>,
1202    {
1203        self.replica_selection = v.map(|x| x.into());
1204        self
1205    }
1206
1207    /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity].
1208    ///
1209    /// Note that all the setters affecting `compute_capacity` are mutually
1210    /// exclusive.
1211    pub fn set_compute_capacity<
1212        T: std::convert::Into<
1213                std::option::Option<crate::model::replica_compute_capacity::ComputeCapacity>,
1214            >,
1215    >(
1216        mut self,
1217        v: T,
1218    ) -> Self {
1219        self.compute_capacity = v.into();
1220        self
1221    }
1222
1223    /// The value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1224    /// if it holds a `NodeCount`, `None` if the field is not set or
1225    /// holds a different branch.
1226    pub fn node_count(&self) -> std::option::Option<&i32> {
1227        #[allow(unreachable_patterns)]
1228        self.compute_capacity.as_ref().and_then(|v| match v {
1229            crate::model::replica_compute_capacity::ComputeCapacity::NodeCount(v) => {
1230                std::option::Option::Some(v)
1231            }
1232            _ => std::option::Option::None,
1233        })
1234    }
1235
1236    /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1237    /// to hold a `NodeCount`.
1238    ///
1239    /// Note that all the setters affecting `compute_capacity` are
1240    /// mutually exclusive.
1241    pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1242        self.compute_capacity = std::option::Option::Some(
1243            crate::model::replica_compute_capacity::ComputeCapacity::NodeCount(v.into()),
1244        );
1245        self
1246    }
1247
1248    /// The value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1249    /// if it holds a `ProcessingUnits`, `None` if the field is not set or
1250    /// holds a different branch.
1251    pub fn processing_units(&self) -> std::option::Option<&i32> {
1252        #[allow(unreachable_patterns)]
1253        self.compute_capacity.as_ref().and_then(|v| match v {
1254            crate::model::replica_compute_capacity::ComputeCapacity::ProcessingUnits(v) => {
1255                std::option::Option::Some(v)
1256            }
1257            _ => std::option::Option::None,
1258        })
1259    }
1260
1261    /// Sets the value of [compute_capacity][crate::model::ReplicaComputeCapacity::compute_capacity]
1262    /// to hold a `ProcessingUnits`.
1263    ///
1264    /// Note that all the setters affecting `compute_capacity` are
1265    /// mutually exclusive.
1266    pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1267        self.compute_capacity = std::option::Option::Some(
1268            crate::model::replica_compute_capacity::ComputeCapacity::ProcessingUnits(v.into()),
1269        );
1270        self
1271    }
1272}
1273
1274impl wkt::message::Message for ReplicaComputeCapacity {
1275    fn typename() -> &'static str {
1276        "type.googleapis.com/google.spanner.admin.instance.v1.ReplicaComputeCapacity"
1277    }
1278}
1279
1280/// Defines additional types related to [ReplicaComputeCapacity].
1281pub mod replica_compute_capacity {
1282    #[allow(unused_imports)]
1283    use super::*;
1284
1285    /// Compute capacity allocated to each replica identified by the specified
1286    /// selection.
1287    /// The unit is selected based on the unit used to specify the instance size
1288    /// for non-autoscaling instances, or the unit used in autoscaling limit for
1289    /// autoscaling instances.
1290    #[derive(Clone, Debug, PartialEq)]
1291    #[non_exhaustive]
1292    pub enum ComputeCapacity {
1293        /// The number of nodes allocated to each replica.
1294        ///
1295        /// This may be zero in API responses for instances that are not yet in
1296        /// state `READY`.
1297        NodeCount(i32),
1298        /// The number of processing units allocated to each replica.
1299        ///
1300        /// This may be zero in API responses for instances that are not yet in
1301        /// state `READY`.
1302        ProcessingUnits(i32),
1303    }
1304}
1305
1306/// Autoscaling configuration for an instance.
1307#[derive(Clone, Default, PartialEq)]
1308#[non_exhaustive]
1309pub struct AutoscalingConfig {
1310    /// Required. Autoscaling limits for an instance.
1311    pub autoscaling_limits:
1312        std::option::Option<crate::model::autoscaling_config::AutoscalingLimits>,
1313
1314    /// Required. The autoscaling targets for an instance.
1315    pub autoscaling_targets:
1316        std::option::Option<crate::model::autoscaling_config::AutoscalingTargets>,
1317
1318    /// Optional. Optional asymmetric autoscaling options.
1319    /// Replicas matching the replica selection criteria will be autoscaled
1320    /// independently from other replicas. The autoscaler will scale the replicas
1321    /// based on the utilization of replicas identified by the replica selection.
1322    /// Replica selections should not overlap with each other.
1323    ///
1324    /// Other replicas (those do not match any replica selection) will be
1325    /// autoscaled together and will have the same compute capacity allocated to
1326    /// them.
1327    pub asymmetric_autoscaling_options:
1328        std::vec::Vec<crate::model::autoscaling_config::AsymmetricAutoscalingOption>,
1329
1330    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1331}
1332
1333impl AutoscalingConfig {
1334    pub fn new() -> Self {
1335        std::default::Default::default()
1336    }
1337
1338    /// Sets the value of [autoscaling_limits][crate::model::AutoscalingConfig::autoscaling_limits].
1339    pub fn set_autoscaling_limits<T>(mut self, v: T) -> Self
1340    where
1341        T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1342    {
1343        self.autoscaling_limits = std::option::Option::Some(v.into());
1344        self
1345    }
1346
1347    /// Sets or clears the value of [autoscaling_limits][crate::model::AutoscalingConfig::autoscaling_limits].
1348    pub fn set_or_clear_autoscaling_limits<T>(mut self, v: std::option::Option<T>) -> Self
1349    where
1350        T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1351    {
1352        self.autoscaling_limits = v.map(|x| x.into());
1353        self
1354    }
1355
1356    /// Sets the value of [autoscaling_targets][crate::model::AutoscalingConfig::autoscaling_targets].
1357    pub fn set_autoscaling_targets<T>(mut self, v: T) -> Self
1358    where
1359        T: std::convert::Into<crate::model::autoscaling_config::AutoscalingTargets>,
1360    {
1361        self.autoscaling_targets = std::option::Option::Some(v.into());
1362        self
1363    }
1364
1365    /// Sets or clears the value of [autoscaling_targets][crate::model::AutoscalingConfig::autoscaling_targets].
1366    pub fn set_or_clear_autoscaling_targets<T>(mut self, v: std::option::Option<T>) -> Self
1367    where
1368        T: std::convert::Into<crate::model::autoscaling_config::AutoscalingTargets>,
1369    {
1370        self.autoscaling_targets = v.map(|x| x.into());
1371        self
1372    }
1373
1374    /// Sets the value of [asymmetric_autoscaling_options][crate::model::AutoscalingConfig::asymmetric_autoscaling_options].
1375    pub fn set_asymmetric_autoscaling_options<T, V>(mut self, v: T) -> Self
1376    where
1377        T: std::iter::IntoIterator<Item = V>,
1378        V: std::convert::Into<crate::model::autoscaling_config::AsymmetricAutoscalingOption>,
1379    {
1380        use std::iter::Iterator;
1381        self.asymmetric_autoscaling_options = v.into_iter().map(|i| i.into()).collect();
1382        self
1383    }
1384}
1385
1386impl wkt::message::Message for AutoscalingConfig {
1387    fn typename() -> &'static str {
1388        "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig"
1389    }
1390}
1391
1392/// Defines additional types related to [AutoscalingConfig].
1393pub mod autoscaling_config {
1394    #[allow(unused_imports)]
1395    use super::*;
1396
1397    /// The autoscaling limits for the instance. Users can define the minimum and
1398    /// maximum compute capacity allocated to the instance, and the autoscaler will
1399    /// only scale within that range. Users can either use nodes or processing
1400    /// units to specify the limits, but should use the same unit to set both the
1401    /// min_limit and max_limit.
1402    #[derive(Clone, Default, PartialEq)]
1403    #[non_exhaustive]
1404    pub struct AutoscalingLimits {
1405        /// The minimum compute capacity for the instance.
1406        pub min_limit:
1407            std::option::Option<crate::model::autoscaling_config::autoscaling_limits::MinLimit>,
1408
1409        /// The maximum compute capacity for the instance. The maximum compute
1410        /// capacity should be less than or equal to 10X the minimum compute
1411        /// capacity.
1412        pub max_limit:
1413            std::option::Option<crate::model::autoscaling_config::autoscaling_limits::MaxLimit>,
1414
1415        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1416    }
1417
1418    impl AutoscalingLimits {
1419        pub fn new() -> Self {
1420            std::default::Default::default()
1421        }
1422
1423        /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit].
1424        ///
1425        /// Note that all the setters affecting `min_limit` are mutually
1426        /// exclusive.
1427        pub fn set_min_limit<
1428            T: std::convert::Into<
1429                    std::option::Option<
1430                        crate::model::autoscaling_config::autoscaling_limits::MinLimit,
1431                    >,
1432                >,
1433        >(
1434            mut self,
1435            v: T,
1436        ) -> Self {
1437            self.min_limit = v.into();
1438            self
1439        }
1440
1441        /// The value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1442        /// if it holds a `MinNodes`, `None` if the field is not set or
1443        /// holds a different branch.
1444        pub fn min_nodes(&self) -> std::option::Option<&i32> {
1445            #[allow(unreachable_patterns)]
1446            self.min_limit.as_ref().and_then(|v| match v {
1447                crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinNodes(v) => {
1448                    std::option::Option::Some(v)
1449                }
1450                _ => std::option::Option::None,
1451            })
1452        }
1453
1454        /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1455        /// to hold a `MinNodes`.
1456        ///
1457        /// Note that all the setters affecting `min_limit` are
1458        /// mutually exclusive.
1459        pub fn set_min_nodes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1460            self.min_limit = std::option::Option::Some(
1461                crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinNodes(v.into()),
1462            );
1463            self
1464        }
1465
1466        /// The value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1467        /// if it holds a `MinProcessingUnits`, `None` if the field is not set or
1468        /// holds a different branch.
1469        pub fn min_processing_units(&self) -> std::option::Option<&i32> {
1470            #[allow(unreachable_patterns)]
1471            self.min_limit.as_ref().and_then(|v| match v {
1472                crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinProcessingUnits(v) => std::option::Option::Some(v),
1473                _ => std::option::Option::None,
1474            })
1475        }
1476
1477        /// Sets the value of [min_limit][crate::model::autoscaling_config::AutoscalingLimits::min_limit]
1478        /// to hold a `MinProcessingUnits`.
1479        ///
1480        /// Note that all the setters affecting `min_limit` are
1481        /// mutually exclusive.
1482        pub fn set_min_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1483            self.min_limit = std::option::Option::Some(
1484                crate::model::autoscaling_config::autoscaling_limits::MinLimit::MinProcessingUnits(
1485                    v.into(),
1486                ),
1487            );
1488            self
1489        }
1490
1491        /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit].
1492        ///
1493        /// Note that all the setters affecting `max_limit` are mutually
1494        /// exclusive.
1495        pub fn set_max_limit<
1496            T: std::convert::Into<
1497                    std::option::Option<
1498                        crate::model::autoscaling_config::autoscaling_limits::MaxLimit,
1499                    >,
1500                >,
1501        >(
1502            mut self,
1503            v: T,
1504        ) -> Self {
1505            self.max_limit = v.into();
1506            self
1507        }
1508
1509        /// The value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1510        /// if it holds a `MaxNodes`, `None` if the field is not set or
1511        /// holds a different branch.
1512        pub fn max_nodes(&self) -> std::option::Option<&i32> {
1513            #[allow(unreachable_patterns)]
1514            self.max_limit.as_ref().and_then(|v| match v {
1515                crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxNodes(v) => {
1516                    std::option::Option::Some(v)
1517                }
1518                _ => std::option::Option::None,
1519            })
1520        }
1521
1522        /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1523        /// to hold a `MaxNodes`.
1524        ///
1525        /// Note that all the setters affecting `max_limit` are
1526        /// mutually exclusive.
1527        pub fn set_max_nodes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1528            self.max_limit = std::option::Option::Some(
1529                crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxNodes(v.into()),
1530            );
1531            self
1532        }
1533
1534        /// The value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1535        /// if it holds a `MaxProcessingUnits`, `None` if the field is not set or
1536        /// holds a different branch.
1537        pub fn max_processing_units(&self) -> std::option::Option<&i32> {
1538            #[allow(unreachable_patterns)]
1539            self.max_limit.as_ref().and_then(|v| match v {
1540                crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxProcessingUnits(v) => std::option::Option::Some(v),
1541                _ => std::option::Option::None,
1542            })
1543        }
1544
1545        /// Sets the value of [max_limit][crate::model::autoscaling_config::AutoscalingLimits::max_limit]
1546        /// to hold a `MaxProcessingUnits`.
1547        ///
1548        /// Note that all the setters affecting `max_limit` are
1549        /// mutually exclusive.
1550        pub fn set_max_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1551            self.max_limit = std::option::Option::Some(
1552                crate::model::autoscaling_config::autoscaling_limits::MaxLimit::MaxProcessingUnits(
1553                    v.into(),
1554                ),
1555            );
1556            self
1557        }
1558    }
1559
1560    impl wkt::message::Message for AutoscalingLimits {
1561        fn typename() -> &'static str {
1562            "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits"
1563        }
1564    }
1565
1566    /// Defines additional types related to [AutoscalingLimits].
1567    pub mod autoscaling_limits {
1568        #[allow(unused_imports)]
1569        use super::*;
1570
1571        /// The minimum compute capacity for the instance.
1572        #[derive(Clone, Debug, PartialEq)]
1573        #[non_exhaustive]
1574        pub enum MinLimit {
1575            /// Minimum number of nodes allocated to the instance. If set, this number
1576            /// should be greater than or equal to 1.
1577            MinNodes(i32),
1578            /// Minimum number of processing units allocated to the instance. If set,
1579            /// this number should be multiples of 1000.
1580            MinProcessingUnits(i32),
1581        }
1582
1583        /// The maximum compute capacity for the instance. The maximum compute
1584        /// capacity should be less than or equal to 10X the minimum compute
1585        /// capacity.
1586        #[derive(Clone, Debug, PartialEq)]
1587        #[non_exhaustive]
1588        pub enum MaxLimit {
1589            /// Maximum number of nodes allocated to the instance. If set, this number
1590            /// should be greater than or equal to min_nodes.
1591            MaxNodes(i32),
1592            /// Maximum number of processing units allocated to the instance. If set,
1593            /// this number should be multiples of 1000 and be greater than or equal to
1594            /// min_processing_units.
1595            MaxProcessingUnits(i32),
1596        }
1597    }
1598
1599    /// The autoscaling targets for an instance.
1600    #[derive(Clone, Default, PartialEq)]
1601    #[non_exhaustive]
1602    pub struct AutoscalingTargets {
1603        /// Required. The target high priority cpu utilization percentage that the
1604        /// autoscaler should be trying to achieve for the instance. This number is
1605        /// on a scale from 0 (no utilization) to 100 (full utilization). The valid
1606        /// range is [10, 90] inclusive.
1607        pub high_priority_cpu_utilization_percent: i32,
1608
1609        /// Required. The target storage utilization percentage that the autoscaler
1610        /// should be trying to achieve for the instance. This number is on a scale
1611        /// from 0 (no utilization) to 100 (full utilization). The valid range is
1612        /// [10, 99] inclusive.
1613        pub storage_utilization_percent: i32,
1614
1615        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1616    }
1617
1618    impl AutoscalingTargets {
1619        pub fn new() -> Self {
1620            std::default::Default::default()
1621        }
1622
1623        /// Sets the value of [high_priority_cpu_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::high_priority_cpu_utilization_percent].
1624        pub fn set_high_priority_cpu_utilization_percent<T: std::convert::Into<i32>>(
1625            mut self,
1626            v: T,
1627        ) -> Self {
1628            self.high_priority_cpu_utilization_percent = v.into();
1629            self
1630        }
1631
1632        /// Sets the value of [storage_utilization_percent][crate::model::autoscaling_config::AutoscalingTargets::storage_utilization_percent].
1633        pub fn set_storage_utilization_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1634            self.storage_utilization_percent = v.into();
1635            self
1636        }
1637    }
1638
1639    impl wkt::message::Message for AutoscalingTargets {
1640        fn typename() -> &'static str {
1641            "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets"
1642        }
1643    }
1644
1645    /// AsymmetricAutoscalingOption specifies the scaling of replicas identified by
1646    /// the given selection.
1647    #[derive(Clone, Default, PartialEq)]
1648    #[non_exhaustive]
1649    pub struct AsymmetricAutoscalingOption {
1650
1651        /// Required. Selects the replicas to which this AsymmetricAutoscalingOption
1652        /// applies. Only read-only replicas are supported.
1653        pub replica_selection: std::option::Option<crate::model::ReplicaSelection>,
1654
1655        /// Optional. Overrides applied to the top-level autoscaling configuration
1656        /// for the selected replicas.
1657        pub overrides: std::option::Option<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>,
1658
1659        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1660    }
1661
1662    impl AsymmetricAutoscalingOption {
1663        pub fn new() -> Self {
1664            std::default::Default::default()
1665        }
1666
1667        /// Sets the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
1668        pub fn set_replica_selection<T>(mut self, v: T) -> Self
1669        where
1670            T: std::convert::Into<crate::model::ReplicaSelection>,
1671        {
1672            self.replica_selection = std::option::Option::Some(v.into());
1673            self
1674        }
1675
1676        /// Sets or clears the value of [replica_selection][crate::model::autoscaling_config::AsymmetricAutoscalingOption::replica_selection].
1677        pub fn set_or_clear_replica_selection<T>(mut self, v: std::option::Option<T>) -> Self
1678        where
1679            T: std::convert::Into<crate::model::ReplicaSelection>,
1680        {
1681            self.replica_selection = v.map(|x| x.into());
1682            self
1683        }
1684
1685        /// Sets the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
1686        pub fn set_overrides<T>(mut self, v: T) -> Self
1687        where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
1688        {
1689            self.overrides = std::option::Option::Some(v.into());
1690            self
1691        }
1692
1693        /// Sets or clears the value of [overrides][crate::model::autoscaling_config::AsymmetricAutoscalingOption::overrides].
1694        pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
1695        where T: std::convert::Into<crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides>
1696        {
1697            self.overrides = v.map(|x| x.into());
1698            self
1699        }
1700    }
1701
1702    impl wkt::message::Message for AsymmetricAutoscalingOption {
1703        fn typename() -> &'static str {
1704            "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption"
1705        }
1706    }
1707
1708    /// Defines additional types related to [AsymmetricAutoscalingOption].
1709    pub mod asymmetric_autoscaling_option {
1710        #[allow(unused_imports)]
1711        use super::*;
1712
1713        /// Overrides the top-level autoscaling configuration for the replicas
1714        /// identified by `replica_selection`. All fields in this message are
1715        /// optional. Any unspecified fields will use the corresponding values from
1716        /// the top-level autoscaling configuration.
1717        #[derive(Clone, Default, PartialEq)]
1718        #[non_exhaustive]
1719        pub struct AutoscalingConfigOverrides {
1720            /// Optional. If specified, overrides the min/max limit in the top-level
1721            /// autoscaling configuration for the selected replicas.
1722            pub autoscaling_limits:
1723                std::option::Option<crate::model::autoscaling_config::AutoscalingLimits>,
1724
1725            /// Optional. If specified, overrides the autoscaling target
1726            /// high_priority_cpu_utilization_percent in the top-level autoscaling
1727            /// configuration for the selected replicas.
1728            pub autoscaling_target_high_priority_cpu_utilization_percent: i32,
1729
1730            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1731        }
1732
1733        impl AutoscalingConfigOverrides {
1734            pub fn new() -> Self {
1735                std::default::Default::default()
1736            }
1737
1738            /// Sets the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
1739            pub fn set_autoscaling_limits<T>(mut self, v: T) -> Self
1740            where
1741                T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1742            {
1743                self.autoscaling_limits = std::option::Option::Some(v.into());
1744                self
1745            }
1746
1747            /// Sets or clears the value of [autoscaling_limits][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_limits].
1748            pub fn set_or_clear_autoscaling_limits<T>(mut self, v: std::option::Option<T>) -> Self
1749            where
1750                T: std::convert::Into<crate::model::autoscaling_config::AutoscalingLimits>,
1751            {
1752                self.autoscaling_limits = v.map(|x| x.into());
1753                self
1754            }
1755
1756            /// Sets the value of [autoscaling_target_high_priority_cpu_utilization_percent][crate::model::autoscaling_config::asymmetric_autoscaling_option::AutoscalingConfigOverrides::autoscaling_target_high_priority_cpu_utilization_percent].
1757            pub fn set_autoscaling_target_high_priority_cpu_utilization_percent<
1758                T: std::convert::Into<i32>,
1759            >(
1760                mut self,
1761                v: T,
1762            ) -> Self {
1763                self.autoscaling_target_high_priority_cpu_utilization_percent = v.into();
1764                self
1765            }
1766        }
1767
1768        impl wkt::message::Message for AutoscalingConfigOverrides {
1769            fn typename() -> &'static str {
1770                "type.googleapis.com/google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides"
1771            }
1772        }
1773    }
1774}
1775
1776/// An isolated set of Cloud Spanner resources on which databases can be hosted.
1777#[derive(Clone, Default, PartialEq)]
1778#[non_exhaustive]
1779pub struct Instance {
1780    /// Required. A unique identifier for the instance, which cannot be changed
1781    /// after the instance is created. Values are of the form
1782    /// `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
1783    /// segment of the name must be between 2 and 64 characters in length.
1784    pub name: std::string::String,
1785
1786    /// Required. The name of the instance's configuration. Values are of the form
1787    /// `projects/<project>/instanceConfigs/<configuration>`. See
1788    /// also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
1789    /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
1790    ///
1791    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
1792    /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
1793    pub config: std::string::String,
1794
1795    /// Required. The descriptive name for this instance as it appears in UIs.
1796    /// Must be unique per project and between 4 and 30 characters in length.
1797    pub display_name: std::string::String,
1798
1799    /// The number of nodes allocated to this instance. At most, one of either
1800    /// `node_count` or `processing_units` should be present in the message.
1801    ///
1802    /// Users can set the `node_count` field to specify the target number of nodes
1803    /// allocated to the instance.
1804    ///
1805    /// If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
1806    /// field and reflects the current number of nodes allocated to the instance.
1807    ///
1808    /// This might be zero in API responses for instances that are not yet in the
1809    /// `READY` state.
1810    ///
1811    /// For more information, see
1812    /// [Compute capacity, nodes, and processing
1813    /// units](https://cloud.google.com/spanner/docs/compute-capacity).
1814    pub node_count: i32,
1815
1816    /// The number of processing units allocated to this instance. At most, one of
1817    /// either `processing_units` or `node_count` should be present in the message.
1818    ///
1819    /// Users can set the `processing_units` field to specify the target number of
1820    /// processing units allocated to the instance.
1821    ///
1822    /// If autoscaling is enabled, `processing_units` is treated as an
1823    /// `OUTPUT_ONLY` field and reflects the current number of processing units
1824    /// allocated to the instance.
1825    ///
1826    /// This might be zero in API responses for instances that are not yet in the
1827    /// `READY` state.
1828    ///
1829    /// For more information, see
1830    /// [Compute capacity, nodes and processing
1831    /// units](https://cloud.google.com/spanner/docs/compute-capacity).
1832    pub processing_units: i32,
1833
1834    /// Output only. Lists the compute capacity per ReplicaSelection. A replica
1835    /// selection identifies a set of replicas with common properties. Replicas
1836    /// identified by a ReplicaSelection are scaled with the same compute capacity.
1837    pub replica_compute_capacity: std::vec::Vec<crate::model::ReplicaComputeCapacity>,
1838
1839    /// Optional. The autoscaling configuration. Autoscaling is enabled if this
1840    /// field is set. When autoscaling is enabled, node_count and processing_units
1841    /// are treated as OUTPUT_ONLY fields and reflect the current compute capacity
1842    /// allocated to the instance.
1843    pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
1844
1845    /// Output only. The current instance state. For
1846    /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
1847    /// the state must be either omitted or set to `CREATING`. For
1848    /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance],
1849    /// the state must be either omitted or set to `READY`.
1850    ///
1851    /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
1852    /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
1853    pub state: crate::model::instance::State,
1854
1855    /// Cloud Labels are a flexible and lightweight mechanism for organizing cloud
1856    /// resources into groups that reflect a customer's organizational needs and
1857    /// deployment strategies. Cloud Labels can be used to filter collections of
1858    /// resources. They can be used to control how resource metrics are aggregated.
1859    /// And they can be used as arguments to policy management rules (e.g. route,
1860    /// firewall, load balancing, etc.).
1861    ///
1862    /// * Label keys must be between 1 and 63 characters long and must conform to
1863    ///   the following regular expression: `[a-z][a-z0-9_-]{0,62}`.
1864    /// * Label values must be between 0 and 63 characters long and must conform
1865    ///   to the regular expression `[a-z0-9_-]{0,63}`.
1866    /// * No more than 64 labels can be associated with a given resource.
1867    ///
1868    /// See <https://goo.gl/xmQnxf> for more information on and examples of labels.
1869    ///
1870    /// If you plan to use labels in your own code, please note that additional
1871    /// characters may be allowed in the future. And so you are advised to use an
1872    /// internal label representation, such as JSON, which doesn't rely upon
1873    /// specific characters being disallowed.  For example, representing labels
1874    /// as the string:  name + "_" + value  would prove problematic if we were to
1875    /// allow "_" in a future release.
1876    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
1877
1878    /// The `InstanceType` of the current instance.
1879    pub instance_type: crate::model::instance::InstanceType,
1880
1881    /// Deprecated. This field is not populated.
1882    pub endpoint_uris: std::vec::Vec<std::string::String>,
1883
1884    /// Output only. The time at which the instance was created.
1885    pub create_time: std::option::Option<wkt::Timestamp>,
1886
1887    /// Output only. The time at which the instance was most recently updated.
1888    pub update_time: std::option::Option<wkt::Timestamp>,
1889
1890    /// Free instance metadata. Only populated for free instances.
1891    pub free_instance_metadata: std::option::Option<crate::model::FreeInstanceMetadata>,
1892
1893    /// Optional. The `Edition` of the current instance.
1894    pub edition: crate::model::instance::Edition,
1895
1896    /// Optional. Controls the default backup schedule behavior for new databases
1897    /// within the instance. By default, a backup schedule is created automatically
1898    /// when a new database is created in a new instance.
1899    ///
1900    /// Note that the `AUTOMATIC` value isn't permitted for free instances,
1901    /// as backups and backup schedules aren't supported for free instances.
1902    ///
1903    /// In the `GetInstance` or `ListInstances` response, if the value of
1904    /// `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't
1905    /// create a default backup schedule for new databases in the instance.
1906    pub default_backup_schedule_type: crate::model::instance::DefaultBackupScheduleType,
1907
1908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1909}
1910
1911impl Instance {
1912    pub fn new() -> Self {
1913        std::default::Default::default()
1914    }
1915
1916    /// Sets the value of [name][crate::model::Instance::name].
1917    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1918        self.name = v.into();
1919        self
1920    }
1921
1922    /// Sets the value of [config][crate::model::Instance::config].
1923    pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1924        self.config = v.into();
1925        self
1926    }
1927
1928    /// Sets the value of [display_name][crate::model::Instance::display_name].
1929    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1930        self.display_name = v.into();
1931        self
1932    }
1933
1934    /// Sets the value of [node_count][crate::model::Instance::node_count].
1935    pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1936        self.node_count = v.into();
1937        self
1938    }
1939
1940    /// Sets the value of [processing_units][crate::model::Instance::processing_units].
1941    pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1942        self.processing_units = v.into();
1943        self
1944    }
1945
1946    /// Sets the value of [replica_compute_capacity][crate::model::Instance::replica_compute_capacity].
1947    pub fn set_replica_compute_capacity<T, V>(mut self, v: T) -> Self
1948    where
1949        T: std::iter::IntoIterator<Item = V>,
1950        V: std::convert::Into<crate::model::ReplicaComputeCapacity>,
1951    {
1952        use std::iter::Iterator;
1953        self.replica_compute_capacity = v.into_iter().map(|i| i.into()).collect();
1954        self
1955    }
1956
1957    /// Sets the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
1958    pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
1959    where
1960        T: std::convert::Into<crate::model::AutoscalingConfig>,
1961    {
1962        self.autoscaling_config = std::option::Option::Some(v.into());
1963        self
1964    }
1965
1966    /// Sets or clears the value of [autoscaling_config][crate::model::Instance::autoscaling_config].
1967    pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
1968    where
1969        T: std::convert::Into<crate::model::AutoscalingConfig>,
1970    {
1971        self.autoscaling_config = v.map(|x| x.into());
1972        self
1973    }
1974
1975    /// Sets the value of [state][crate::model::Instance::state].
1976    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
1977        self.state = v.into();
1978        self
1979    }
1980
1981    /// Sets the value of [labels][crate::model::Instance::labels].
1982    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1983    where
1984        T: std::iter::IntoIterator<Item = (K, V)>,
1985        K: std::convert::Into<std::string::String>,
1986        V: std::convert::Into<std::string::String>,
1987    {
1988        use std::iter::Iterator;
1989        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1990        self
1991    }
1992
1993    /// Sets the value of [instance_type][crate::model::Instance::instance_type].
1994    pub fn set_instance_type<T: std::convert::Into<crate::model::instance::InstanceType>>(
1995        mut self,
1996        v: T,
1997    ) -> Self {
1998        self.instance_type = v.into();
1999        self
2000    }
2001
2002    /// Sets the value of [endpoint_uris][crate::model::Instance::endpoint_uris].
2003    pub fn set_endpoint_uris<T, V>(mut self, v: T) -> Self
2004    where
2005        T: std::iter::IntoIterator<Item = V>,
2006        V: std::convert::Into<std::string::String>,
2007    {
2008        use std::iter::Iterator;
2009        self.endpoint_uris = v.into_iter().map(|i| i.into()).collect();
2010        self
2011    }
2012
2013    /// Sets the value of [create_time][crate::model::Instance::create_time].
2014    pub fn set_create_time<T>(mut self, v: T) -> Self
2015    where
2016        T: std::convert::Into<wkt::Timestamp>,
2017    {
2018        self.create_time = std::option::Option::Some(v.into());
2019        self
2020    }
2021
2022    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
2023    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2024    where
2025        T: std::convert::Into<wkt::Timestamp>,
2026    {
2027        self.create_time = v.map(|x| x.into());
2028        self
2029    }
2030
2031    /// Sets the value of [update_time][crate::model::Instance::update_time].
2032    pub fn set_update_time<T>(mut self, v: T) -> Self
2033    where
2034        T: std::convert::Into<wkt::Timestamp>,
2035    {
2036        self.update_time = std::option::Option::Some(v.into());
2037        self
2038    }
2039
2040    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
2041    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2042    where
2043        T: std::convert::Into<wkt::Timestamp>,
2044    {
2045        self.update_time = v.map(|x| x.into());
2046        self
2047    }
2048
2049    /// Sets the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2050    pub fn set_free_instance_metadata<T>(mut self, v: T) -> Self
2051    where
2052        T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2053    {
2054        self.free_instance_metadata = std::option::Option::Some(v.into());
2055        self
2056    }
2057
2058    /// Sets or clears the value of [free_instance_metadata][crate::model::Instance::free_instance_metadata].
2059    pub fn set_or_clear_free_instance_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2060    where
2061        T: std::convert::Into<crate::model::FreeInstanceMetadata>,
2062    {
2063        self.free_instance_metadata = v.map(|x| x.into());
2064        self
2065    }
2066
2067    /// Sets the value of [edition][crate::model::Instance::edition].
2068    pub fn set_edition<T: std::convert::Into<crate::model::instance::Edition>>(
2069        mut self,
2070        v: T,
2071    ) -> Self {
2072        self.edition = v.into();
2073        self
2074    }
2075
2076    /// Sets the value of [default_backup_schedule_type][crate::model::Instance::default_backup_schedule_type].
2077    pub fn set_default_backup_schedule_type<
2078        T: std::convert::Into<crate::model::instance::DefaultBackupScheduleType>,
2079    >(
2080        mut self,
2081        v: T,
2082    ) -> Self {
2083        self.default_backup_schedule_type = v.into();
2084        self
2085    }
2086}
2087
2088impl wkt::message::Message for Instance {
2089    fn typename() -> &'static str {
2090        "type.googleapis.com/google.spanner.admin.instance.v1.Instance"
2091    }
2092}
2093
2094/// Defines additional types related to [Instance].
2095pub mod instance {
2096    #[allow(unused_imports)]
2097    use super::*;
2098
2099    /// Indicates the current state of the instance.
2100    ///
2101    /// # Working with unknown values
2102    ///
2103    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2104    /// additional enum variants at any time. Adding new variants is not considered
2105    /// a breaking change. Applications should write their code in anticipation of:
2106    ///
2107    /// - New values appearing in future releases of the client library, **and**
2108    /// - New values received dynamically, without application changes.
2109    ///
2110    /// Please consult the [Working with enums] section in the user guide for some
2111    /// guidelines.
2112    ///
2113    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2114    #[derive(Clone, Debug, PartialEq)]
2115    #[non_exhaustive]
2116    pub enum State {
2117        /// Not specified.
2118        Unspecified,
2119        /// The instance is still being created. Resources may not be
2120        /// available yet, and operations such as database creation may not
2121        /// work.
2122        Creating,
2123        /// The instance is fully created and ready to do work such as
2124        /// creating databases.
2125        Ready,
2126        /// If set, the enum was initialized with an unknown value.
2127        ///
2128        /// Applications can examine the value using [State::value] or
2129        /// [State::name].
2130        UnknownValue(state::UnknownValue),
2131    }
2132
2133    #[doc(hidden)]
2134    pub mod state {
2135        #[allow(unused_imports)]
2136        use super::*;
2137        #[derive(Clone, Debug, PartialEq)]
2138        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2139    }
2140
2141    impl State {
2142        /// Gets the enum value.
2143        ///
2144        /// Returns `None` if the enum contains an unknown value deserialized from
2145        /// the string representation of enums.
2146        pub fn value(&self) -> std::option::Option<i32> {
2147            match self {
2148                Self::Unspecified => std::option::Option::Some(0),
2149                Self::Creating => std::option::Option::Some(1),
2150                Self::Ready => std::option::Option::Some(2),
2151                Self::UnknownValue(u) => u.0.value(),
2152            }
2153        }
2154
2155        /// Gets the enum value as a string.
2156        ///
2157        /// Returns `None` if the enum contains an unknown value deserialized from
2158        /// the integer representation of enums.
2159        pub fn name(&self) -> std::option::Option<&str> {
2160            match self {
2161                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2162                Self::Creating => std::option::Option::Some("CREATING"),
2163                Self::Ready => std::option::Option::Some("READY"),
2164                Self::UnknownValue(u) => u.0.name(),
2165            }
2166        }
2167    }
2168
2169    impl std::default::Default for State {
2170        fn default() -> Self {
2171            use std::convert::From;
2172            Self::from(0)
2173        }
2174    }
2175
2176    impl std::fmt::Display for State {
2177        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2178            wkt::internal::display_enum(f, self.name(), self.value())
2179        }
2180    }
2181
2182    impl std::convert::From<i32> for State {
2183        fn from(value: i32) -> Self {
2184            match value {
2185                0 => Self::Unspecified,
2186                1 => Self::Creating,
2187                2 => Self::Ready,
2188                _ => Self::UnknownValue(state::UnknownValue(
2189                    wkt::internal::UnknownEnumValue::Integer(value),
2190                )),
2191            }
2192        }
2193    }
2194
2195    impl std::convert::From<&str> for State {
2196        fn from(value: &str) -> Self {
2197            use std::string::ToString;
2198            match value {
2199                "STATE_UNSPECIFIED" => Self::Unspecified,
2200                "CREATING" => Self::Creating,
2201                "READY" => Self::Ready,
2202                _ => Self::UnknownValue(state::UnknownValue(
2203                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2204                )),
2205            }
2206        }
2207    }
2208
2209    impl serde::ser::Serialize for State {
2210        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2211        where
2212            S: serde::Serializer,
2213        {
2214            match self {
2215                Self::Unspecified => serializer.serialize_i32(0),
2216                Self::Creating => serializer.serialize_i32(1),
2217                Self::Ready => serializer.serialize_i32(2),
2218                Self::UnknownValue(u) => u.0.serialize(serializer),
2219            }
2220        }
2221    }
2222
2223    impl<'de> serde::de::Deserialize<'de> for State {
2224        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2225        where
2226            D: serde::Deserializer<'de>,
2227        {
2228            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2229                ".google.spanner.admin.instance.v1.Instance.State",
2230            ))
2231        }
2232    }
2233
2234    /// The type of this instance. The type can be used to distinguish product
2235    /// variants, that can affect aspects like: usage restrictions, quotas and
2236    /// billing. Currently this is used to distinguish FREE_INSTANCE vs PROVISIONED
2237    /// instances.
2238    ///
2239    /// # Working with unknown values
2240    ///
2241    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2242    /// additional enum variants at any time. Adding new variants is not considered
2243    /// a breaking change. Applications should write their code in anticipation of:
2244    ///
2245    /// - New values appearing in future releases of the client library, **and**
2246    /// - New values received dynamically, without application changes.
2247    ///
2248    /// Please consult the [Working with enums] section in the user guide for some
2249    /// guidelines.
2250    ///
2251    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2252    #[derive(Clone, Debug, PartialEq)]
2253    #[non_exhaustive]
2254    pub enum InstanceType {
2255        /// Not specified.
2256        Unspecified,
2257        /// Provisioned instances have dedicated resources, standard usage limits and
2258        /// support.
2259        Provisioned,
2260        /// Free instances provide no guarantee for dedicated resources,
2261        /// [node_count, processing_units] should be 0. They come
2262        /// with stricter usage limits and limited support.
2263        FreeInstance,
2264        /// If set, the enum was initialized with an unknown value.
2265        ///
2266        /// Applications can examine the value using [InstanceType::value] or
2267        /// [InstanceType::name].
2268        UnknownValue(instance_type::UnknownValue),
2269    }
2270
2271    #[doc(hidden)]
2272    pub mod instance_type {
2273        #[allow(unused_imports)]
2274        use super::*;
2275        #[derive(Clone, Debug, PartialEq)]
2276        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2277    }
2278
2279    impl InstanceType {
2280        /// Gets the enum value.
2281        ///
2282        /// Returns `None` if the enum contains an unknown value deserialized from
2283        /// the string representation of enums.
2284        pub fn value(&self) -> std::option::Option<i32> {
2285            match self {
2286                Self::Unspecified => std::option::Option::Some(0),
2287                Self::Provisioned => std::option::Option::Some(1),
2288                Self::FreeInstance => std::option::Option::Some(2),
2289                Self::UnknownValue(u) => u.0.value(),
2290            }
2291        }
2292
2293        /// Gets the enum value as a string.
2294        ///
2295        /// Returns `None` if the enum contains an unknown value deserialized from
2296        /// the integer representation of enums.
2297        pub fn name(&self) -> std::option::Option<&str> {
2298            match self {
2299                Self::Unspecified => std::option::Option::Some("INSTANCE_TYPE_UNSPECIFIED"),
2300                Self::Provisioned => std::option::Option::Some("PROVISIONED"),
2301                Self::FreeInstance => std::option::Option::Some("FREE_INSTANCE"),
2302                Self::UnknownValue(u) => u.0.name(),
2303            }
2304        }
2305    }
2306
2307    impl std::default::Default for InstanceType {
2308        fn default() -> Self {
2309            use std::convert::From;
2310            Self::from(0)
2311        }
2312    }
2313
2314    impl std::fmt::Display for InstanceType {
2315        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2316            wkt::internal::display_enum(f, self.name(), self.value())
2317        }
2318    }
2319
2320    impl std::convert::From<i32> for InstanceType {
2321        fn from(value: i32) -> Self {
2322            match value {
2323                0 => Self::Unspecified,
2324                1 => Self::Provisioned,
2325                2 => Self::FreeInstance,
2326                _ => Self::UnknownValue(instance_type::UnknownValue(
2327                    wkt::internal::UnknownEnumValue::Integer(value),
2328                )),
2329            }
2330        }
2331    }
2332
2333    impl std::convert::From<&str> for InstanceType {
2334        fn from(value: &str) -> Self {
2335            use std::string::ToString;
2336            match value {
2337                "INSTANCE_TYPE_UNSPECIFIED" => Self::Unspecified,
2338                "PROVISIONED" => Self::Provisioned,
2339                "FREE_INSTANCE" => Self::FreeInstance,
2340                _ => Self::UnknownValue(instance_type::UnknownValue(
2341                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2342                )),
2343            }
2344        }
2345    }
2346
2347    impl serde::ser::Serialize for InstanceType {
2348        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2349        where
2350            S: serde::Serializer,
2351        {
2352            match self {
2353                Self::Unspecified => serializer.serialize_i32(0),
2354                Self::Provisioned => serializer.serialize_i32(1),
2355                Self::FreeInstance => serializer.serialize_i32(2),
2356                Self::UnknownValue(u) => u.0.serialize(serializer),
2357            }
2358        }
2359    }
2360
2361    impl<'de> serde::de::Deserialize<'de> for InstanceType {
2362        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2363        where
2364            D: serde::Deserializer<'de>,
2365        {
2366            deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceType>::new(
2367                ".google.spanner.admin.instance.v1.Instance.InstanceType",
2368            ))
2369        }
2370    }
2371
2372    /// The edition selected for this instance. Different editions provide
2373    /// different capabilities at different price points.
2374    ///
2375    /// # Working with unknown values
2376    ///
2377    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2378    /// additional enum variants at any time. Adding new variants is not considered
2379    /// a breaking change. Applications should write their code in anticipation of:
2380    ///
2381    /// - New values appearing in future releases of the client library, **and**
2382    /// - New values received dynamically, without application changes.
2383    ///
2384    /// Please consult the [Working with enums] section in the user guide for some
2385    /// guidelines.
2386    ///
2387    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2388    #[derive(Clone, Debug, PartialEq)]
2389    #[non_exhaustive]
2390    pub enum Edition {
2391        /// Edition not specified.
2392        Unspecified,
2393        /// Standard edition.
2394        Standard,
2395        /// Enterprise edition.
2396        Enterprise,
2397        /// Enterprise Plus edition.
2398        EnterprisePlus,
2399        /// If set, the enum was initialized with an unknown value.
2400        ///
2401        /// Applications can examine the value using [Edition::value] or
2402        /// [Edition::name].
2403        UnknownValue(edition::UnknownValue),
2404    }
2405
2406    #[doc(hidden)]
2407    pub mod edition {
2408        #[allow(unused_imports)]
2409        use super::*;
2410        #[derive(Clone, Debug, PartialEq)]
2411        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2412    }
2413
2414    impl Edition {
2415        /// Gets the enum value.
2416        ///
2417        /// Returns `None` if the enum contains an unknown value deserialized from
2418        /// the string representation of enums.
2419        pub fn value(&self) -> std::option::Option<i32> {
2420            match self {
2421                Self::Unspecified => std::option::Option::Some(0),
2422                Self::Standard => std::option::Option::Some(1),
2423                Self::Enterprise => std::option::Option::Some(2),
2424                Self::EnterprisePlus => std::option::Option::Some(3),
2425                Self::UnknownValue(u) => u.0.value(),
2426            }
2427        }
2428
2429        /// Gets the enum value as a string.
2430        ///
2431        /// Returns `None` if the enum contains an unknown value deserialized from
2432        /// the integer representation of enums.
2433        pub fn name(&self) -> std::option::Option<&str> {
2434            match self {
2435                Self::Unspecified => std::option::Option::Some("EDITION_UNSPECIFIED"),
2436                Self::Standard => std::option::Option::Some("STANDARD"),
2437                Self::Enterprise => std::option::Option::Some("ENTERPRISE"),
2438                Self::EnterprisePlus => std::option::Option::Some("ENTERPRISE_PLUS"),
2439                Self::UnknownValue(u) => u.0.name(),
2440            }
2441        }
2442    }
2443
2444    impl std::default::Default for Edition {
2445        fn default() -> Self {
2446            use std::convert::From;
2447            Self::from(0)
2448        }
2449    }
2450
2451    impl std::fmt::Display for Edition {
2452        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2453            wkt::internal::display_enum(f, self.name(), self.value())
2454        }
2455    }
2456
2457    impl std::convert::From<i32> for Edition {
2458        fn from(value: i32) -> Self {
2459            match value {
2460                0 => Self::Unspecified,
2461                1 => Self::Standard,
2462                2 => Self::Enterprise,
2463                3 => Self::EnterprisePlus,
2464                _ => Self::UnknownValue(edition::UnknownValue(
2465                    wkt::internal::UnknownEnumValue::Integer(value),
2466                )),
2467            }
2468        }
2469    }
2470
2471    impl std::convert::From<&str> for Edition {
2472        fn from(value: &str) -> Self {
2473            use std::string::ToString;
2474            match value {
2475                "EDITION_UNSPECIFIED" => Self::Unspecified,
2476                "STANDARD" => Self::Standard,
2477                "ENTERPRISE" => Self::Enterprise,
2478                "ENTERPRISE_PLUS" => Self::EnterprisePlus,
2479                _ => Self::UnknownValue(edition::UnknownValue(
2480                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2481                )),
2482            }
2483        }
2484    }
2485
2486    impl serde::ser::Serialize for Edition {
2487        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2488        where
2489            S: serde::Serializer,
2490        {
2491            match self {
2492                Self::Unspecified => serializer.serialize_i32(0),
2493                Self::Standard => serializer.serialize_i32(1),
2494                Self::Enterprise => serializer.serialize_i32(2),
2495                Self::EnterprisePlus => serializer.serialize_i32(3),
2496                Self::UnknownValue(u) => u.0.serialize(serializer),
2497            }
2498        }
2499    }
2500
2501    impl<'de> serde::de::Deserialize<'de> for Edition {
2502        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2503        where
2504            D: serde::Deserializer<'de>,
2505        {
2506            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Edition>::new(
2507                ".google.spanner.admin.instance.v1.Instance.Edition",
2508            ))
2509        }
2510    }
2511
2512    /// Indicates the
2513    /// [default backup
2514    /// schedule](https://cloud.google.com/spanner/docs/backup#default-backup-schedules)
2515    /// behavior for new databases within the instance.
2516    ///
2517    /// # Working with unknown values
2518    ///
2519    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2520    /// additional enum variants at any time. Adding new variants is not considered
2521    /// a breaking change. Applications should write their code in anticipation of:
2522    ///
2523    /// - New values appearing in future releases of the client library, **and**
2524    /// - New values received dynamically, without application changes.
2525    ///
2526    /// Please consult the [Working with enums] section in the user guide for some
2527    /// guidelines.
2528    ///
2529    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2530    #[derive(Clone, Debug, PartialEq)]
2531    #[non_exhaustive]
2532    pub enum DefaultBackupScheduleType {
2533        /// Not specified.
2534        Unspecified,
2535        /// A default backup schedule isn't created automatically when a new database
2536        /// is created in the instance.
2537        None,
2538        /// A default backup schedule is created automatically when a new database
2539        /// is created in the instance. The default backup schedule creates a full
2540        /// backup every 24 hours. These full backups are retained for 7 days.
2541        /// You can edit or delete the default backup schedule once it's created.
2542        Automatic,
2543        /// If set, the enum was initialized with an unknown value.
2544        ///
2545        /// Applications can examine the value using [DefaultBackupScheduleType::value] or
2546        /// [DefaultBackupScheduleType::name].
2547        UnknownValue(default_backup_schedule_type::UnknownValue),
2548    }
2549
2550    #[doc(hidden)]
2551    pub mod default_backup_schedule_type {
2552        #[allow(unused_imports)]
2553        use super::*;
2554        #[derive(Clone, Debug, PartialEq)]
2555        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2556    }
2557
2558    impl DefaultBackupScheduleType {
2559        /// Gets the enum value.
2560        ///
2561        /// Returns `None` if the enum contains an unknown value deserialized from
2562        /// the string representation of enums.
2563        pub fn value(&self) -> std::option::Option<i32> {
2564            match self {
2565                Self::Unspecified => std::option::Option::Some(0),
2566                Self::None => std::option::Option::Some(1),
2567                Self::Automatic => std::option::Option::Some(2),
2568                Self::UnknownValue(u) => u.0.value(),
2569            }
2570        }
2571
2572        /// Gets the enum value as a string.
2573        ///
2574        /// Returns `None` if the enum contains an unknown value deserialized from
2575        /// the integer representation of enums.
2576        pub fn name(&self) -> std::option::Option<&str> {
2577            match self {
2578                Self::Unspecified => {
2579                    std::option::Option::Some("DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED")
2580                }
2581                Self::None => std::option::Option::Some("NONE"),
2582                Self::Automatic => std::option::Option::Some("AUTOMATIC"),
2583                Self::UnknownValue(u) => u.0.name(),
2584            }
2585        }
2586    }
2587
2588    impl std::default::Default for DefaultBackupScheduleType {
2589        fn default() -> Self {
2590            use std::convert::From;
2591            Self::from(0)
2592        }
2593    }
2594
2595    impl std::fmt::Display for DefaultBackupScheduleType {
2596        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2597            wkt::internal::display_enum(f, self.name(), self.value())
2598        }
2599    }
2600
2601    impl std::convert::From<i32> for DefaultBackupScheduleType {
2602        fn from(value: i32) -> Self {
2603            match value {
2604                0 => Self::Unspecified,
2605                1 => Self::None,
2606                2 => Self::Automatic,
2607                _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
2608                    wkt::internal::UnknownEnumValue::Integer(value),
2609                )),
2610            }
2611        }
2612    }
2613
2614    impl std::convert::From<&str> for DefaultBackupScheduleType {
2615        fn from(value: &str) -> Self {
2616            use std::string::ToString;
2617            match value {
2618                "DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
2619                "NONE" => Self::None,
2620                "AUTOMATIC" => Self::Automatic,
2621                _ => Self::UnknownValue(default_backup_schedule_type::UnknownValue(
2622                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2623                )),
2624            }
2625        }
2626    }
2627
2628    impl serde::ser::Serialize for DefaultBackupScheduleType {
2629        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2630        where
2631            S: serde::Serializer,
2632        {
2633            match self {
2634                Self::Unspecified => serializer.serialize_i32(0),
2635                Self::None => serializer.serialize_i32(1),
2636                Self::Automatic => serializer.serialize_i32(2),
2637                Self::UnknownValue(u) => u.0.serialize(serializer),
2638            }
2639        }
2640    }
2641
2642    impl<'de> serde::de::Deserialize<'de> for DefaultBackupScheduleType {
2643        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2644        where
2645            D: serde::Deserializer<'de>,
2646        {
2647            deserializer.deserialize_any(
2648                wkt::internal::EnumVisitor::<DefaultBackupScheduleType>::new(
2649                    ".google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType",
2650                ),
2651            )
2652        }
2653    }
2654}
2655
2656/// The request for
2657/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
2658///
2659/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
2660#[derive(Clone, Default, PartialEq)]
2661#[non_exhaustive]
2662pub struct ListInstanceConfigsRequest {
2663    /// Required. The name of the project for which a list of supported instance
2664    /// configurations is requested. Values are of the form
2665    /// `projects/<project>`.
2666    pub parent: std::string::String,
2667
2668    /// Number of instance configurations to be returned in the response. If 0 or
2669    /// less, defaults to the server's maximum allowed page size.
2670    pub page_size: i32,
2671
2672    /// If non-empty, `page_token` should contain a
2673    /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]
2674    /// from a previous
2675    /// [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse].
2676    ///
2677    /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse]: crate::model::ListInstanceConfigsResponse
2678    /// [google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]: crate::model::ListInstanceConfigsResponse::next_page_token
2679    pub page_token: std::string::String,
2680
2681    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2682}
2683
2684impl ListInstanceConfigsRequest {
2685    pub fn new() -> Self {
2686        std::default::Default::default()
2687    }
2688
2689    /// Sets the value of [parent][crate::model::ListInstanceConfigsRequest::parent].
2690    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2691        self.parent = v.into();
2692        self
2693    }
2694
2695    /// Sets the value of [page_size][crate::model::ListInstanceConfigsRequest::page_size].
2696    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2697        self.page_size = v.into();
2698        self
2699    }
2700
2701    /// Sets the value of [page_token][crate::model::ListInstanceConfigsRequest::page_token].
2702    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2703        self.page_token = v.into();
2704        self
2705    }
2706}
2707
2708impl wkt::message::Message for ListInstanceConfigsRequest {
2709    fn typename() -> &'static str {
2710        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsRequest"
2711    }
2712}
2713
2714/// The response for
2715/// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
2716///
2717/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
2718#[derive(Clone, Default, PartialEq)]
2719#[non_exhaustive]
2720pub struct ListInstanceConfigsResponse {
2721    /// The list of requested instance configurations.
2722    pub instance_configs: std::vec::Vec<crate::model::InstanceConfig>,
2723
2724    /// `next_page_token` can be sent in a subsequent
2725    /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]
2726    /// call to fetch more of the matching instance configurations.
2727    ///
2728    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
2729    pub next_page_token: std::string::String,
2730
2731    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2732}
2733
2734impl ListInstanceConfigsResponse {
2735    pub fn new() -> Self {
2736        std::default::Default::default()
2737    }
2738
2739    /// Sets the value of [instance_configs][crate::model::ListInstanceConfigsResponse::instance_configs].
2740    pub fn set_instance_configs<T, V>(mut self, v: T) -> Self
2741    where
2742        T: std::iter::IntoIterator<Item = V>,
2743        V: std::convert::Into<crate::model::InstanceConfig>,
2744    {
2745        use std::iter::Iterator;
2746        self.instance_configs = v.into_iter().map(|i| i.into()).collect();
2747        self
2748    }
2749
2750    /// Sets the value of [next_page_token][crate::model::ListInstanceConfigsResponse::next_page_token].
2751    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2752        self.next_page_token = v.into();
2753        self
2754    }
2755}
2756
2757impl wkt::message::Message for ListInstanceConfigsResponse {
2758    fn typename() -> &'static str {
2759        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigsResponse"
2760    }
2761}
2762
2763#[doc(hidden)]
2764impl gax::paginator::internal::PageableResponse for ListInstanceConfigsResponse {
2765    type PageItem = crate::model::InstanceConfig;
2766
2767    fn items(self) -> std::vec::Vec<Self::PageItem> {
2768        self.instance_configs
2769    }
2770
2771    fn next_page_token(&self) -> std::string::String {
2772        use std::clone::Clone;
2773        self.next_page_token.clone()
2774    }
2775}
2776
2777/// The request for
2778/// [GetInstanceConfigRequest][google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig].
2779///
2780/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstanceConfig]: crate::client::InstanceAdmin::get_instance_config
2781#[derive(Clone, Default, PartialEq)]
2782#[non_exhaustive]
2783pub struct GetInstanceConfigRequest {
2784    /// Required. The name of the requested instance configuration. Values are of
2785    /// the form `projects/<project>/instanceConfigs/<config>`.
2786    pub name: std::string::String,
2787
2788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2789}
2790
2791impl GetInstanceConfigRequest {
2792    pub fn new() -> Self {
2793        std::default::Default::default()
2794    }
2795
2796    /// Sets the value of [name][crate::model::GetInstanceConfigRequest::name].
2797    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2798        self.name = v.into();
2799        self
2800    }
2801}
2802
2803impl wkt::message::Message for GetInstanceConfigRequest {
2804    fn typename() -> &'static str {
2805        "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceConfigRequest"
2806    }
2807}
2808
2809/// The request for
2810/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
2811///
2812/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
2813#[derive(Clone, Default, PartialEq)]
2814#[non_exhaustive]
2815pub struct CreateInstanceConfigRequest {
2816    /// Required. The name of the project in which to create the instance
2817    /// configuration. Values are of the form `projects/<project>`.
2818    pub parent: std::string::String,
2819
2820    /// Required. The ID of the instance configuration to create. Valid identifiers
2821    /// are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
2822    /// characters in length. The `custom-` prefix is required to avoid name
2823    /// conflicts with Google-managed configurations.
2824    pub instance_config_id: std::string::String,
2825
2826    /// Required. The `InstanceConfig` proto of the configuration to create.
2827    /// `instance_config.name` must be
2828    /// `<parent>/instanceConfigs/<instance_config_id>`.
2829    /// `instance_config.base_config` must be a Google-managed configuration name,
2830    /// e.g. \<parent\>/instanceConfigs/us-east1, \<parent\>/instanceConfigs/nam3.
2831    pub instance_config: std::option::Option<crate::model::InstanceConfig>,
2832
2833    /// An option to validate, but not actually execute, a request,
2834    /// and provide the same response.
2835    pub validate_only: bool,
2836
2837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2838}
2839
2840impl CreateInstanceConfigRequest {
2841    pub fn new() -> Self {
2842        std::default::Default::default()
2843    }
2844
2845    /// Sets the value of [parent][crate::model::CreateInstanceConfigRequest::parent].
2846    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2847        self.parent = v.into();
2848        self
2849    }
2850
2851    /// Sets the value of [instance_config_id][crate::model::CreateInstanceConfigRequest::instance_config_id].
2852    pub fn set_instance_config_id<T: std::convert::Into<std::string::String>>(
2853        mut self,
2854        v: T,
2855    ) -> Self {
2856        self.instance_config_id = v.into();
2857        self
2858    }
2859
2860    /// Sets the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
2861    pub fn set_instance_config<T>(mut self, v: T) -> Self
2862    where
2863        T: std::convert::Into<crate::model::InstanceConfig>,
2864    {
2865        self.instance_config = std::option::Option::Some(v.into());
2866        self
2867    }
2868
2869    /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
2870    pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
2871    where
2872        T: std::convert::Into<crate::model::InstanceConfig>,
2873    {
2874        self.instance_config = v.map(|x| x.into());
2875        self
2876    }
2877
2878    /// Sets the value of [validate_only][crate::model::CreateInstanceConfigRequest::validate_only].
2879    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2880        self.validate_only = v.into();
2881        self
2882    }
2883}
2884
2885impl wkt::message::Message for CreateInstanceConfigRequest {
2886    fn typename() -> &'static str {
2887        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigRequest"
2888    }
2889}
2890
2891/// The request for
2892/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
2893///
2894/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
2895#[derive(Clone, Default, PartialEq)]
2896#[non_exhaustive]
2897pub struct UpdateInstanceConfigRequest {
2898    /// Required. The user instance configuration to update, which must always
2899    /// include the instance configuration name. Otherwise, only fields mentioned
2900    /// in
2901    /// [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]
2902    /// need be included. To prevent conflicts of concurrent updates,
2903    /// [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can
2904    /// be used.
2905    ///
2906    /// [google.spanner.admin.instance.v1.InstanceConfig.reconciling]: crate::model::InstanceConfig::reconciling
2907    /// [google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]: crate::model::UpdateInstanceConfigRequest::update_mask
2908    pub instance_config: std::option::Option<crate::model::InstanceConfig>,
2909
2910    /// Required. A mask specifying which fields in
2911    /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be
2912    /// updated. The field mask must always be specified; this prevents any future
2913    /// fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
2914    /// from being erased accidentally by clients that do not know about them. Only
2915    /// display_name and labels can be updated.
2916    ///
2917    /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
2918    pub update_mask: std::option::Option<wkt::FieldMask>,
2919
2920    /// An option to validate, but not actually execute, a request,
2921    /// and provide the same response.
2922    pub validate_only: bool,
2923
2924    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2925}
2926
2927impl UpdateInstanceConfigRequest {
2928    pub fn new() -> Self {
2929        std::default::Default::default()
2930    }
2931
2932    /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
2933    pub fn set_instance_config<T>(mut self, v: T) -> Self
2934    where
2935        T: std::convert::Into<crate::model::InstanceConfig>,
2936    {
2937        self.instance_config = std::option::Option::Some(v.into());
2938        self
2939    }
2940
2941    /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
2942    pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
2943    where
2944        T: std::convert::Into<crate::model::InstanceConfig>,
2945    {
2946        self.instance_config = v.map(|x| x.into());
2947        self
2948    }
2949
2950    /// Sets the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
2951    pub fn set_update_mask<T>(mut self, v: T) -> Self
2952    where
2953        T: std::convert::Into<wkt::FieldMask>,
2954    {
2955        self.update_mask = std::option::Option::Some(v.into());
2956        self
2957    }
2958
2959    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
2960    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2961    where
2962        T: std::convert::Into<wkt::FieldMask>,
2963    {
2964        self.update_mask = v.map(|x| x.into());
2965        self
2966    }
2967
2968    /// Sets the value of [validate_only][crate::model::UpdateInstanceConfigRequest::validate_only].
2969    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2970        self.validate_only = v.into();
2971        self
2972    }
2973}
2974
2975impl wkt::message::Message for UpdateInstanceConfigRequest {
2976    fn typename() -> &'static str {
2977        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigRequest"
2978    }
2979}
2980
2981/// The request for
2982/// [DeleteInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig].
2983///
2984/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig]: crate::client::InstanceAdmin::delete_instance_config
2985#[derive(Clone, Default, PartialEq)]
2986#[non_exhaustive]
2987pub struct DeleteInstanceConfigRequest {
2988    /// Required. The name of the instance configuration to be deleted.
2989    /// Values are of the form
2990    /// `projects/<project>/instanceConfigs/<instance_config>`
2991    pub name: std::string::String,
2992
2993    /// Used for optimistic concurrency control as a way to help prevent
2994    /// simultaneous deletes of an instance configuration from overwriting each
2995    /// other. If not empty, the API
2996    /// only deletes the instance configuration when the etag provided matches the
2997    /// current status of the requested instance configuration. Otherwise, deletes
2998    /// the instance configuration without checking the current status of the
2999    /// requested instance configuration.
3000    pub etag: std::string::String,
3001
3002    /// An option to validate, but not actually execute, a request,
3003    /// and provide the same response.
3004    pub validate_only: bool,
3005
3006    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3007}
3008
3009impl DeleteInstanceConfigRequest {
3010    pub fn new() -> Self {
3011        std::default::Default::default()
3012    }
3013
3014    /// Sets the value of [name][crate::model::DeleteInstanceConfigRequest::name].
3015    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3016        self.name = v.into();
3017        self
3018    }
3019
3020    /// Sets the value of [etag][crate::model::DeleteInstanceConfigRequest::etag].
3021    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3022        self.etag = v.into();
3023        self
3024    }
3025
3026    /// Sets the value of [validate_only][crate::model::DeleteInstanceConfigRequest::validate_only].
3027    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3028        self.validate_only = v.into();
3029        self
3030    }
3031}
3032
3033impl wkt::message::Message for DeleteInstanceConfigRequest {
3034    fn typename() -> &'static str {
3035        "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceConfigRequest"
3036    }
3037}
3038
3039/// The request for
3040/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3041///
3042/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3043#[derive(Clone, Default, PartialEq)]
3044#[non_exhaustive]
3045pub struct ListInstanceConfigOperationsRequest {
3046    /// Required. The project of the instance configuration operations.
3047    /// Values are of the form `projects/<project>`.
3048    pub parent: std::string::String,
3049
3050    /// An expression that filters the list of returned operations.
3051    ///
3052    /// A filter expression consists of a field name, a
3053    /// comparison operator, and a value for filtering.
3054    /// The value must be a string, a number, or a boolean. The comparison operator
3055    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
3056    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
3057    ///
3058    /// The following fields in the Operation are eligible for filtering:
3059    ///
3060    /// * `name` - The name of the long-running operation
3061    /// * `done` - False if the operation is in progress, else true.
3062    /// * `metadata.@type` - the type of metadata. For example, the type string
3063    ///   for
3064    ///   [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]
3065    ///   is
3066    ///   `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
3067    /// * `metadata.<field_name>` - any field in metadata.value.
3068    ///   `metadata.@type` must be specified first, if filtering on metadata
3069    ///   fields.
3070    /// * `error` - Error associated with the long-running operation.
3071    /// * `response.@type` - the type of response.
3072    /// * `response.<field_name>` - any field in response.value.
3073    ///
3074    /// You can combine multiple expressions by enclosing each expression in
3075    /// parentheses. By default, expressions are combined with AND logic. However,
3076    /// you can specify AND, OR, and NOT logic explicitly.
3077    ///
3078    /// Here are a few examples:
3079    ///
3080    /// * `done:true` - The operation is complete.
3081    /// * `(metadata.@type=` \
3082    ///   `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
3083    ///   AND` \
3084    ///   `(metadata.instance_config.name:custom-config) AND` \
3085    ///   `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
3086    ///   `(error:*)` - Return operations where:
3087    ///   * The operation's metadata type is
3088    ///     [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
3089    ///   * The instance configuration name contains "custom-config".
3090    ///   * The operation started before 2021-03-28T14:50:00Z.
3091    ///   * The operation resulted in an error.
3092    ///
3093    /// [google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]: crate::model::CreateInstanceConfigMetadata
3094    pub filter: std::string::String,
3095
3096    /// Number of operations to be returned in the response. If 0 or
3097    /// less, defaults to the server's maximum allowed page size.
3098    pub page_size: i32,
3099
3100    /// If non-empty, `page_token` should contain a
3101    /// [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]
3102    /// from a previous
3103    /// [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]
3104    /// to the same `parent` and with the same `filter`.
3105    ///
3106    /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse]: crate::model::ListInstanceConfigOperationsResponse
3107    /// [google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]: crate::model::ListInstanceConfigOperationsResponse::next_page_token
3108    pub page_token: std::string::String,
3109
3110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3111}
3112
3113impl ListInstanceConfigOperationsRequest {
3114    pub fn new() -> Self {
3115        std::default::Default::default()
3116    }
3117
3118    /// Sets the value of [parent][crate::model::ListInstanceConfigOperationsRequest::parent].
3119    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3120        self.parent = v.into();
3121        self
3122    }
3123
3124    /// Sets the value of [filter][crate::model::ListInstanceConfigOperationsRequest::filter].
3125    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3126        self.filter = v.into();
3127        self
3128    }
3129
3130    /// Sets the value of [page_size][crate::model::ListInstanceConfigOperationsRequest::page_size].
3131    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3132        self.page_size = v.into();
3133        self
3134    }
3135
3136    /// Sets the value of [page_token][crate::model::ListInstanceConfigOperationsRequest::page_token].
3137    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3138        self.page_token = v.into();
3139        self
3140    }
3141}
3142
3143impl wkt::message::Message for ListInstanceConfigOperationsRequest {
3144    fn typename() -> &'static str {
3145        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest"
3146    }
3147}
3148
3149/// The response for
3150/// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations].
3151///
3152/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3153#[derive(Clone, Default, PartialEq)]
3154#[non_exhaustive]
3155pub struct ListInstanceConfigOperationsResponse {
3156    /// The list of matching instance configuration long-running operations. Each
3157    /// operation's name will be
3158    /// prefixed by the name of the instance configuration. The operation's
3159    /// metadata field type
3160    /// `metadata.type_url` describes the type of the metadata.
3161    pub operations: std::vec::Vec<longrunning::model::Operation>,
3162
3163    /// `next_page_token` can be sent in a subsequent
3164    /// [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]
3165    /// call to fetch more of the matching metadata.
3166    ///
3167    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations]: crate::client::InstanceAdmin::list_instance_config_operations
3168    pub next_page_token: std::string::String,
3169
3170    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3171}
3172
3173impl ListInstanceConfigOperationsResponse {
3174    pub fn new() -> Self {
3175        std::default::Default::default()
3176    }
3177
3178    /// Sets the value of [operations][crate::model::ListInstanceConfigOperationsResponse::operations].
3179    pub fn set_operations<T, V>(mut self, v: T) -> Self
3180    where
3181        T: std::iter::IntoIterator<Item = V>,
3182        V: std::convert::Into<longrunning::model::Operation>,
3183    {
3184        use std::iter::Iterator;
3185        self.operations = v.into_iter().map(|i| i.into()).collect();
3186        self
3187    }
3188
3189    /// Sets the value of [next_page_token][crate::model::ListInstanceConfigOperationsResponse::next_page_token].
3190    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3191        self.next_page_token = v.into();
3192        self
3193    }
3194}
3195
3196impl wkt::message::Message for ListInstanceConfigOperationsResponse {
3197    fn typename() -> &'static str {
3198        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse"
3199    }
3200}
3201
3202#[doc(hidden)]
3203impl gax::paginator::internal::PageableResponse for ListInstanceConfigOperationsResponse {
3204    type PageItem = longrunning::model::Operation;
3205
3206    fn items(self) -> std::vec::Vec<Self::PageItem> {
3207        self.operations
3208    }
3209
3210    fn next_page_token(&self) -> std::string::String {
3211        use std::clone::Clone;
3212        self.next_page_token.clone()
3213    }
3214}
3215
3216/// The request for
3217/// [GetInstance][google.spanner.admin.instance.v1.InstanceAdmin.GetInstance].
3218///
3219/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstance]: crate::client::InstanceAdmin::get_instance
3220#[derive(Clone, Default, PartialEq)]
3221#[non_exhaustive]
3222pub struct GetInstanceRequest {
3223    /// Required. The name of the requested instance. Values are of the form
3224    /// `projects/<project>/instances/<instance>`.
3225    pub name: std::string::String,
3226
3227    /// If field_mask is present, specifies the subset of
3228    /// [Instance][google.spanner.admin.instance.v1.Instance] fields that should be
3229    /// returned. If absent, all
3230    /// [Instance][google.spanner.admin.instance.v1.Instance] fields are returned.
3231    ///
3232    /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
3233    pub field_mask: std::option::Option<wkt::FieldMask>,
3234
3235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3236}
3237
3238impl GetInstanceRequest {
3239    pub fn new() -> Self {
3240        std::default::Default::default()
3241    }
3242
3243    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3244    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3245        self.name = v.into();
3246        self
3247    }
3248
3249    /// Sets the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
3250    pub fn set_field_mask<T>(mut self, v: T) -> Self
3251    where
3252        T: std::convert::Into<wkt::FieldMask>,
3253    {
3254        self.field_mask = std::option::Option::Some(v.into());
3255        self
3256    }
3257
3258    /// Sets or clears the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
3259    pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
3260    where
3261        T: std::convert::Into<wkt::FieldMask>,
3262    {
3263        self.field_mask = v.map(|x| x.into());
3264        self
3265    }
3266}
3267
3268impl wkt::message::Message for GetInstanceRequest {
3269    fn typename() -> &'static str {
3270        "type.googleapis.com/google.spanner.admin.instance.v1.GetInstanceRequest"
3271    }
3272}
3273
3274/// The request for
3275/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
3276///
3277/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
3278#[derive(Clone, Default, PartialEq)]
3279#[non_exhaustive]
3280pub struct CreateInstanceRequest {
3281    /// Required. The name of the project in which to create the instance. Values
3282    /// are of the form `projects/<project>`.
3283    pub parent: std::string::String,
3284
3285    /// Required. The ID of the instance to create.  Valid identifiers are of the
3286    /// form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
3287    /// length.
3288    pub instance_id: std::string::String,
3289
3290    /// Required. The instance to create.  The name may be omitted, but if
3291    /// specified must be `<parent>/instances/<instance_id>`.
3292    pub instance: std::option::Option<crate::model::Instance>,
3293
3294    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3295}
3296
3297impl CreateInstanceRequest {
3298    pub fn new() -> Self {
3299        std::default::Default::default()
3300    }
3301
3302    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3303    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3304        self.parent = v.into();
3305        self
3306    }
3307
3308    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3309    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3310        self.instance_id = v.into();
3311        self
3312    }
3313
3314    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3315    pub fn set_instance<T>(mut self, v: T) -> Self
3316    where
3317        T: std::convert::Into<crate::model::Instance>,
3318    {
3319        self.instance = std::option::Option::Some(v.into());
3320        self
3321    }
3322
3323    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3324    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3325    where
3326        T: std::convert::Into<crate::model::Instance>,
3327    {
3328        self.instance = v.map(|x| x.into());
3329        self
3330    }
3331}
3332
3333impl wkt::message::Message for CreateInstanceRequest {
3334    fn typename() -> &'static str {
3335        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceRequest"
3336    }
3337}
3338
3339/// The request for
3340/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
3341///
3342/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
3343#[derive(Clone, Default, PartialEq)]
3344#[non_exhaustive]
3345pub struct ListInstancesRequest {
3346    /// Required. The name of the project for which a list of instances is
3347    /// requested. Values are of the form `projects/<project>`.
3348    pub parent: std::string::String,
3349
3350    /// Number of instances to be returned in the response. If 0 or less, defaults
3351    /// to the server's maximum allowed page size.
3352    pub page_size: i32,
3353
3354    /// If non-empty, `page_token` should contain a
3355    /// [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]
3356    /// from a previous
3357    /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
3358    ///
3359    /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
3360    /// [google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
3361    pub page_token: std::string::String,
3362
3363    /// An expression for filtering the results of the request. Filter rules are
3364    /// case insensitive. The fields eligible for filtering are:
3365    ///
3366    /// * `name`
3367    /// * `display_name`
3368    /// * `labels.key` where key is the name of a label
3369    ///
3370    /// Some examples of using filters are:
3371    ///
3372    /// * `name:*` --> The instance has a name.
3373    /// * `name:Howl` --> The instance's name contains the string "howl".
3374    /// * `name:HOWL` --> Equivalent to above.
3375    /// * `NAME:howl` --> Equivalent to above.
3376    /// * `labels.env:*` --> The instance has the label "env".
3377    /// * `labels.env:dev` --> The instance has the label "env" and the value of
3378    ///   the label contains the string "dev".
3379    /// * `name:howl labels.env:dev` --> The instance's name contains "howl" and
3380    ///   it has the label "env" with its value
3381    ///   containing "dev".
3382    pub filter: std::string::String,
3383
3384    /// Deadline used while retrieving metadata for instances.
3385    /// Instances whose metadata cannot be retrieved within this deadline will be
3386    /// added to
3387    /// [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
3388    /// in
3389    /// [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
3390    ///
3391    /// [google.spanner.admin.instance.v1.ListInstancesResponse]: crate::model::ListInstancesResponse
3392    /// [google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]: crate::model::ListInstancesResponse::unreachable
3393    pub instance_deadline: std::option::Option<wkt::Timestamp>,
3394
3395    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3396}
3397
3398impl ListInstancesRequest {
3399    pub fn new() -> Self {
3400        std::default::Default::default()
3401    }
3402
3403    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
3404    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3405        self.parent = v.into();
3406        self
3407    }
3408
3409    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
3410    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3411        self.page_size = v.into();
3412        self
3413    }
3414
3415    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
3416    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3417        self.page_token = v.into();
3418        self
3419    }
3420
3421    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
3422    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3423        self.filter = v.into();
3424        self
3425    }
3426
3427    /// Sets the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
3428    pub fn set_instance_deadline<T>(mut self, v: T) -> Self
3429    where
3430        T: std::convert::Into<wkt::Timestamp>,
3431    {
3432        self.instance_deadline = std::option::Option::Some(v.into());
3433        self
3434    }
3435
3436    /// Sets or clears the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
3437    pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
3438    where
3439        T: std::convert::Into<wkt::Timestamp>,
3440    {
3441        self.instance_deadline = v.map(|x| x.into());
3442        self
3443    }
3444}
3445
3446impl wkt::message::Message for ListInstancesRequest {
3447    fn typename() -> &'static str {
3448        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesRequest"
3449    }
3450}
3451
3452/// The response for
3453/// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
3454///
3455/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
3456#[derive(Clone, Default, PartialEq)]
3457#[non_exhaustive]
3458pub struct ListInstancesResponse {
3459    /// The list of requested instances.
3460    pub instances: std::vec::Vec<crate::model::Instance>,
3461
3462    /// `next_page_token` can be sent in a subsequent
3463    /// [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]
3464    /// call to fetch more of the matching instances.
3465    ///
3466    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstances]: crate::client::InstanceAdmin::list_instances
3467    pub next_page_token: std::string::String,
3468
3469    /// The list of unreachable instances.
3470    /// It includes the names of instances whose metadata could not be retrieved
3471    /// within
3472    /// [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline].
3473    ///
3474    /// [google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]: crate::model::ListInstancesRequest::instance_deadline
3475    pub unreachable: std::vec::Vec<std::string::String>,
3476
3477    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3478}
3479
3480impl ListInstancesResponse {
3481    pub fn new() -> Self {
3482        std::default::Default::default()
3483    }
3484
3485    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
3486    pub fn set_instances<T, V>(mut self, v: T) -> Self
3487    where
3488        T: std::iter::IntoIterator<Item = V>,
3489        V: std::convert::Into<crate::model::Instance>,
3490    {
3491        use std::iter::Iterator;
3492        self.instances = v.into_iter().map(|i| i.into()).collect();
3493        self
3494    }
3495
3496    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
3497    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3498        self.next_page_token = v.into();
3499        self
3500    }
3501
3502    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
3503    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3504    where
3505        T: std::iter::IntoIterator<Item = V>,
3506        V: std::convert::Into<std::string::String>,
3507    {
3508        use std::iter::Iterator;
3509        self.unreachable = v.into_iter().map(|i| i.into()).collect();
3510        self
3511    }
3512}
3513
3514impl wkt::message::Message for ListInstancesResponse {
3515    fn typename() -> &'static str {
3516        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancesResponse"
3517    }
3518}
3519
3520#[doc(hidden)]
3521impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
3522    type PageItem = crate::model::Instance;
3523
3524    fn items(self) -> std::vec::Vec<Self::PageItem> {
3525        self.instances
3526    }
3527
3528    fn next_page_token(&self) -> std::string::String {
3529        use std::clone::Clone;
3530        self.next_page_token.clone()
3531    }
3532}
3533
3534/// The request for
3535/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
3536///
3537/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
3538#[derive(Clone, Default, PartialEq)]
3539#[non_exhaustive]
3540pub struct UpdateInstanceRequest {
3541    /// Required. The instance to update, which must always include the instance
3542    /// name.  Otherwise, only fields mentioned in
3543    /// [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
3544    /// need be included.
3545    ///
3546    /// [google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]: crate::model::UpdateInstanceRequest::field_mask
3547    pub instance: std::option::Option<crate::model::Instance>,
3548
3549    /// Required. A mask specifying which fields in
3550    /// [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
3551    /// The field mask must always be specified; this prevents any future fields in
3552    /// [Instance][google.spanner.admin.instance.v1.Instance] from being erased
3553    /// accidentally by clients that do not know about them.
3554    ///
3555    /// [google.spanner.admin.instance.v1.Instance]: crate::model::Instance
3556    pub field_mask: std::option::Option<wkt::FieldMask>,
3557
3558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3559}
3560
3561impl UpdateInstanceRequest {
3562    pub fn new() -> Self {
3563        std::default::Default::default()
3564    }
3565
3566    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
3567    pub fn set_instance<T>(mut self, v: T) -> Self
3568    where
3569        T: std::convert::Into<crate::model::Instance>,
3570    {
3571        self.instance = std::option::Option::Some(v.into());
3572        self
3573    }
3574
3575    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
3576    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3577    where
3578        T: std::convert::Into<crate::model::Instance>,
3579    {
3580        self.instance = v.map(|x| x.into());
3581        self
3582    }
3583
3584    /// Sets the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
3585    pub fn set_field_mask<T>(mut self, v: T) -> Self
3586    where
3587        T: std::convert::Into<wkt::FieldMask>,
3588    {
3589        self.field_mask = std::option::Option::Some(v.into());
3590        self
3591    }
3592
3593    /// Sets or clears the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
3594    pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
3595    where
3596        T: std::convert::Into<wkt::FieldMask>,
3597    {
3598        self.field_mask = v.map(|x| x.into());
3599        self
3600    }
3601}
3602
3603impl wkt::message::Message for UpdateInstanceRequest {
3604    fn typename() -> &'static str {
3605        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceRequest"
3606    }
3607}
3608
3609/// The request for
3610/// [DeleteInstance][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance].
3611///
3612/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstance]: crate::client::InstanceAdmin::delete_instance
3613#[derive(Clone, Default, PartialEq)]
3614#[non_exhaustive]
3615pub struct DeleteInstanceRequest {
3616    /// Required. The name of the instance to be deleted. Values are of the form
3617    /// `projects/<project>/instances/<instance>`
3618    pub name: std::string::String,
3619
3620    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3621}
3622
3623impl DeleteInstanceRequest {
3624    pub fn new() -> Self {
3625        std::default::Default::default()
3626    }
3627
3628    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3629    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3630        self.name = v.into();
3631        self
3632    }
3633}
3634
3635impl wkt::message::Message for DeleteInstanceRequest {
3636    fn typename() -> &'static str {
3637        "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstanceRequest"
3638    }
3639}
3640
3641/// Metadata type for the operation returned by
3642/// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance].
3643///
3644/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
3645#[derive(Clone, Default, PartialEq)]
3646#[non_exhaustive]
3647pub struct CreateInstanceMetadata {
3648    /// The instance being created.
3649    pub instance: std::option::Option<crate::model::Instance>,
3650
3651    /// The time at which the
3652    /// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]
3653    /// request was received.
3654    ///
3655    /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]: crate::client::InstanceAdmin::create_instance
3656    pub start_time: std::option::Option<wkt::Timestamp>,
3657
3658    /// The time at which this operation was cancelled. If set, this operation is
3659    /// in the process of undoing itself (which is guaranteed to succeed) and
3660    /// cannot be cancelled again.
3661    pub cancel_time: std::option::Option<wkt::Timestamp>,
3662
3663    /// The time at which this operation failed or was completed successfully.
3664    pub end_time: std::option::Option<wkt::Timestamp>,
3665
3666    /// The expected fulfillment period of this create operation.
3667    pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
3668
3669    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3670}
3671
3672impl CreateInstanceMetadata {
3673    pub fn new() -> Self {
3674        std::default::Default::default()
3675    }
3676
3677    /// Sets the value of [instance][crate::model::CreateInstanceMetadata::instance].
3678    pub fn set_instance<T>(mut self, v: T) -> Self
3679    where
3680        T: std::convert::Into<crate::model::Instance>,
3681    {
3682        self.instance = std::option::Option::Some(v.into());
3683        self
3684    }
3685
3686    /// Sets or clears the value of [instance][crate::model::CreateInstanceMetadata::instance].
3687    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3688    where
3689        T: std::convert::Into<crate::model::Instance>,
3690    {
3691        self.instance = v.map(|x| x.into());
3692        self
3693    }
3694
3695    /// Sets the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
3696    pub fn set_start_time<T>(mut self, v: T) -> Self
3697    where
3698        T: std::convert::Into<wkt::Timestamp>,
3699    {
3700        self.start_time = std::option::Option::Some(v.into());
3701        self
3702    }
3703
3704    /// Sets or clears the value of [start_time][crate::model::CreateInstanceMetadata::start_time].
3705    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3706    where
3707        T: std::convert::Into<wkt::Timestamp>,
3708    {
3709        self.start_time = v.map(|x| x.into());
3710        self
3711    }
3712
3713    /// Sets the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
3714    pub fn set_cancel_time<T>(mut self, v: T) -> Self
3715    where
3716        T: std::convert::Into<wkt::Timestamp>,
3717    {
3718        self.cancel_time = std::option::Option::Some(v.into());
3719        self
3720    }
3721
3722    /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceMetadata::cancel_time].
3723    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
3724    where
3725        T: std::convert::Into<wkt::Timestamp>,
3726    {
3727        self.cancel_time = v.map(|x| x.into());
3728        self
3729    }
3730
3731    /// Sets the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
3732    pub fn set_end_time<T>(mut self, v: T) -> Self
3733    where
3734        T: std::convert::Into<wkt::Timestamp>,
3735    {
3736        self.end_time = std::option::Option::Some(v.into());
3737        self
3738    }
3739
3740    /// Sets or clears the value of [end_time][crate::model::CreateInstanceMetadata::end_time].
3741    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3742    where
3743        T: std::convert::Into<wkt::Timestamp>,
3744    {
3745        self.end_time = v.map(|x| x.into());
3746        self
3747    }
3748
3749    /// Sets the value of [expected_fulfillment_period][crate::model::CreateInstanceMetadata::expected_fulfillment_period].
3750    pub fn set_expected_fulfillment_period<
3751        T: std::convert::Into<crate::model::FulfillmentPeriod>,
3752    >(
3753        mut self,
3754        v: T,
3755    ) -> Self {
3756        self.expected_fulfillment_period = v.into();
3757        self
3758    }
3759}
3760
3761impl wkt::message::Message for CreateInstanceMetadata {
3762    fn typename() -> &'static str {
3763        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceMetadata"
3764    }
3765}
3766
3767/// Metadata type for the operation returned by
3768/// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance].
3769///
3770/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
3771#[derive(Clone, Default, PartialEq)]
3772#[non_exhaustive]
3773pub struct UpdateInstanceMetadata {
3774    /// The desired end state of the update.
3775    pub instance: std::option::Option<crate::model::Instance>,
3776
3777    /// The time at which
3778    /// [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]
3779    /// request was received.
3780    ///
3781    /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]: crate::client::InstanceAdmin::update_instance
3782    pub start_time: std::option::Option<wkt::Timestamp>,
3783
3784    /// The time at which this operation was cancelled. If set, this operation is
3785    /// in the process of undoing itself (which is guaranteed to succeed) and
3786    /// cannot be cancelled again.
3787    pub cancel_time: std::option::Option<wkt::Timestamp>,
3788
3789    /// The time at which this operation failed or was completed successfully.
3790    pub end_time: std::option::Option<wkt::Timestamp>,
3791
3792    /// The expected fulfillment period of this update operation.
3793    pub expected_fulfillment_period: crate::model::FulfillmentPeriod,
3794
3795    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3796}
3797
3798impl UpdateInstanceMetadata {
3799    pub fn new() -> Self {
3800        std::default::Default::default()
3801    }
3802
3803    /// Sets the value of [instance][crate::model::UpdateInstanceMetadata::instance].
3804    pub fn set_instance<T>(mut self, v: T) -> Self
3805    where
3806        T: std::convert::Into<crate::model::Instance>,
3807    {
3808        self.instance = std::option::Option::Some(v.into());
3809        self
3810    }
3811
3812    /// Sets or clears the value of [instance][crate::model::UpdateInstanceMetadata::instance].
3813    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3814    where
3815        T: std::convert::Into<crate::model::Instance>,
3816    {
3817        self.instance = v.map(|x| x.into());
3818        self
3819    }
3820
3821    /// Sets the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
3822    pub fn set_start_time<T>(mut self, v: T) -> Self
3823    where
3824        T: std::convert::Into<wkt::Timestamp>,
3825    {
3826        self.start_time = std::option::Option::Some(v.into());
3827        self
3828    }
3829
3830    /// Sets or clears the value of [start_time][crate::model::UpdateInstanceMetadata::start_time].
3831    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3832    where
3833        T: std::convert::Into<wkt::Timestamp>,
3834    {
3835        self.start_time = v.map(|x| x.into());
3836        self
3837    }
3838
3839    /// Sets the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
3840    pub fn set_cancel_time<T>(mut self, v: T) -> Self
3841    where
3842        T: std::convert::Into<wkt::Timestamp>,
3843    {
3844        self.cancel_time = std::option::Option::Some(v.into());
3845        self
3846    }
3847
3848    /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceMetadata::cancel_time].
3849    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
3850    where
3851        T: std::convert::Into<wkt::Timestamp>,
3852    {
3853        self.cancel_time = v.map(|x| x.into());
3854        self
3855    }
3856
3857    /// Sets the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
3858    pub fn set_end_time<T>(mut self, v: T) -> Self
3859    where
3860        T: std::convert::Into<wkt::Timestamp>,
3861    {
3862        self.end_time = std::option::Option::Some(v.into());
3863        self
3864    }
3865
3866    /// Sets or clears the value of [end_time][crate::model::UpdateInstanceMetadata::end_time].
3867    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3868    where
3869        T: std::convert::Into<wkt::Timestamp>,
3870    {
3871        self.end_time = v.map(|x| x.into());
3872        self
3873    }
3874
3875    /// Sets the value of [expected_fulfillment_period][crate::model::UpdateInstanceMetadata::expected_fulfillment_period].
3876    pub fn set_expected_fulfillment_period<
3877        T: std::convert::Into<crate::model::FulfillmentPeriod>,
3878    >(
3879        mut self,
3880        v: T,
3881    ) -> Self {
3882        self.expected_fulfillment_period = v.into();
3883        self
3884    }
3885}
3886
3887impl wkt::message::Message for UpdateInstanceMetadata {
3888    fn typename() -> &'static str {
3889        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceMetadata"
3890    }
3891}
3892
3893/// Free instance specific metadata that is kept even after an instance has been
3894/// upgraded for tracking purposes.
3895#[derive(Clone, Default, PartialEq)]
3896#[non_exhaustive]
3897pub struct FreeInstanceMetadata {
3898    /// Output only. Timestamp after which the instance will either be upgraded or
3899    /// scheduled for deletion after a grace period. ExpireBehavior is used to
3900    /// choose between upgrading or scheduling the free instance for deletion. This
3901    /// timestamp is set during the creation of a free instance.
3902    pub expire_time: std::option::Option<wkt::Timestamp>,
3903
3904    /// Output only. If present, the timestamp at which the free instance was
3905    /// upgraded to a provisioned instance.
3906    pub upgrade_time: std::option::Option<wkt::Timestamp>,
3907
3908    /// Specifies the expiration behavior of a free instance. The default of
3909    /// ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during
3910    /// or after creation, and before expiration.
3911    pub expire_behavior: crate::model::free_instance_metadata::ExpireBehavior,
3912
3913    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3914}
3915
3916impl FreeInstanceMetadata {
3917    pub fn new() -> Self {
3918        std::default::Default::default()
3919    }
3920
3921    /// Sets the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
3922    pub fn set_expire_time<T>(mut self, v: T) -> Self
3923    where
3924        T: std::convert::Into<wkt::Timestamp>,
3925    {
3926        self.expire_time = std::option::Option::Some(v.into());
3927        self
3928    }
3929
3930    /// Sets or clears the value of [expire_time][crate::model::FreeInstanceMetadata::expire_time].
3931    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
3932    where
3933        T: std::convert::Into<wkt::Timestamp>,
3934    {
3935        self.expire_time = v.map(|x| x.into());
3936        self
3937    }
3938
3939    /// Sets the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
3940    pub fn set_upgrade_time<T>(mut self, v: T) -> Self
3941    where
3942        T: std::convert::Into<wkt::Timestamp>,
3943    {
3944        self.upgrade_time = std::option::Option::Some(v.into());
3945        self
3946    }
3947
3948    /// Sets or clears the value of [upgrade_time][crate::model::FreeInstanceMetadata::upgrade_time].
3949    pub fn set_or_clear_upgrade_time<T>(mut self, v: std::option::Option<T>) -> Self
3950    where
3951        T: std::convert::Into<wkt::Timestamp>,
3952    {
3953        self.upgrade_time = v.map(|x| x.into());
3954        self
3955    }
3956
3957    /// Sets the value of [expire_behavior][crate::model::FreeInstanceMetadata::expire_behavior].
3958    pub fn set_expire_behavior<
3959        T: std::convert::Into<crate::model::free_instance_metadata::ExpireBehavior>,
3960    >(
3961        mut self,
3962        v: T,
3963    ) -> Self {
3964        self.expire_behavior = v.into();
3965        self
3966    }
3967}
3968
3969impl wkt::message::Message for FreeInstanceMetadata {
3970    fn typename() -> &'static str {
3971        "type.googleapis.com/google.spanner.admin.instance.v1.FreeInstanceMetadata"
3972    }
3973}
3974
3975/// Defines additional types related to [FreeInstanceMetadata].
3976pub mod free_instance_metadata {
3977    #[allow(unused_imports)]
3978    use super::*;
3979
3980    /// Allows users to change behavior when a free instance expires.
3981    ///
3982    /// # Working with unknown values
3983    ///
3984    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3985    /// additional enum variants at any time. Adding new variants is not considered
3986    /// a breaking change. Applications should write their code in anticipation of:
3987    ///
3988    /// - New values appearing in future releases of the client library, **and**
3989    /// - New values received dynamically, without application changes.
3990    ///
3991    /// Please consult the [Working with enums] section in the user guide for some
3992    /// guidelines.
3993    ///
3994    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3995    #[derive(Clone, Debug, PartialEq)]
3996    #[non_exhaustive]
3997    pub enum ExpireBehavior {
3998        /// Not specified.
3999        Unspecified,
4000        /// When the free instance expires, upgrade the instance to a provisioned
4001        /// instance.
4002        FreeToProvisioned,
4003        /// When the free instance expires, disable the instance, and delete it
4004        /// after the grace period passes if it has not been upgraded.
4005        RemoveAfterGracePeriod,
4006        /// If set, the enum was initialized with an unknown value.
4007        ///
4008        /// Applications can examine the value using [ExpireBehavior::value] or
4009        /// [ExpireBehavior::name].
4010        UnknownValue(expire_behavior::UnknownValue),
4011    }
4012
4013    #[doc(hidden)]
4014    pub mod expire_behavior {
4015        #[allow(unused_imports)]
4016        use super::*;
4017        #[derive(Clone, Debug, PartialEq)]
4018        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4019    }
4020
4021    impl ExpireBehavior {
4022        /// Gets the enum value.
4023        ///
4024        /// Returns `None` if the enum contains an unknown value deserialized from
4025        /// the string representation of enums.
4026        pub fn value(&self) -> std::option::Option<i32> {
4027            match self {
4028                Self::Unspecified => std::option::Option::Some(0),
4029                Self::FreeToProvisioned => std::option::Option::Some(1),
4030                Self::RemoveAfterGracePeriod => std::option::Option::Some(2),
4031                Self::UnknownValue(u) => u.0.value(),
4032            }
4033        }
4034
4035        /// Gets the enum value as a string.
4036        ///
4037        /// Returns `None` if the enum contains an unknown value deserialized from
4038        /// the integer representation of enums.
4039        pub fn name(&self) -> std::option::Option<&str> {
4040            match self {
4041                Self::Unspecified => std::option::Option::Some("EXPIRE_BEHAVIOR_UNSPECIFIED"),
4042                Self::FreeToProvisioned => std::option::Option::Some("FREE_TO_PROVISIONED"),
4043                Self::RemoveAfterGracePeriod => {
4044                    std::option::Option::Some("REMOVE_AFTER_GRACE_PERIOD")
4045                }
4046                Self::UnknownValue(u) => u.0.name(),
4047            }
4048        }
4049    }
4050
4051    impl std::default::Default for ExpireBehavior {
4052        fn default() -> Self {
4053            use std::convert::From;
4054            Self::from(0)
4055        }
4056    }
4057
4058    impl std::fmt::Display for ExpireBehavior {
4059        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4060            wkt::internal::display_enum(f, self.name(), self.value())
4061        }
4062    }
4063
4064    impl std::convert::From<i32> for ExpireBehavior {
4065        fn from(value: i32) -> Self {
4066            match value {
4067                0 => Self::Unspecified,
4068                1 => Self::FreeToProvisioned,
4069                2 => Self::RemoveAfterGracePeriod,
4070                _ => Self::UnknownValue(expire_behavior::UnknownValue(
4071                    wkt::internal::UnknownEnumValue::Integer(value),
4072                )),
4073            }
4074        }
4075    }
4076
4077    impl std::convert::From<&str> for ExpireBehavior {
4078        fn from(value: &str) -> Self {
4079            use std::string::ToString;
4080            match value {
4081                "EXPIRE_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
4082                "FREE_TO_PROVISIONED" => Self::FreeToProvisioned,
4083                "REMOVE_AFTER_GRACE_PERIOD" => Self::RemoveAfterGracePeriod,
4084                _ => Self::UnknownValue(expire_behavior::UnknownValue(
4085                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4086                )),
4087            }
4088        }
4089    }
4090
4091    impl serde::ser::Serialize for ExpireBehavior {
4092        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4093        where
4094            S: serde::Serializer,
4095        {
4096            match self {
4097                Self::Unspecified => serializer.serialize_i32(0),
4098                Self::FreeToProvisioned => serializer.serialize_i32(1),
4099                Self::RemoveAfterGracePeriod => serializer.serialize_i32(2),
4100                Self::UnknownValue(u) => u.0.serialize(serializer),
4101            }
4102        }
4103    }
4104
4105    impl<'de> serde::de::Deserialize<'de> for ExpireBehavior {
4106        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4107        where
4108            D: serde::Deserializer<'de>,
4109        {
4110            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExpireBehavior>::new(
4111                ".google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior",
4112            ))
4113        }
4114    }
4115}
4116
4117/// Metadata type for the operation returned by
4118/// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig].
4119///
4120/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
4121#[derive(Clone, Default, PartialEq)]
4122#[non_exhaustive]
4123pub struct CreateInstanceConfigMetadata {
4124    /// The target instance configuration end state.
4125    pub instance_config: std::option::Option<crate::model::InstanceConfig>,
4126
4127    /// The progress of the
4128    /// [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]
4129    /// operation.
4130    ///
4131    /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]: crate::client::InstanceAdmin::create_instance_config
4132    pub progress: std::option::Option<crate::model::OperationProgress>,
4133
4134    /// The time at which this operation was cancelled.
4135    pub cancel_time: std::option::Option<wkt::Timestamp>,
4136
4137    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4138}
4139
4140impl CreateInstanceConfigMetadata {
4141    pub fn new() -> Self {
4142        std::default::Default::default()
4143    }
4144
4145    /// Sets the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
4146    pub fn set_instance_config<T>(mut self, v: T) -> Self
4147    where
4148        T: std::convert::Into<crate::model::InstanceConfig>,
4149    {
4150        self.instance_config = std::option::Option::Some(v.into());
4151        self
4152    }
4153
4154    /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigMetadata::instance_config].
4155    pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4156    where
4157        T: std::convert::Into<crate::model::InstanceConfig>,
4158    {
4159        self.instance_config = v.map(|x| x.into());
4160        self
4161    }
4162
4163    /// Sets the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
4164    pub fn set_progress<T>(mut self, v: T) -> Self
4165    where
4166        T: std::convert::Into<crate::model::OperationProgress>,
4167    {
4168        self.progress = std::option::Option::Some(v.into());
4169        self
4170    }
4171
4172    /// Sets or clears the value of [progress][crate::model::CreateInstanceConfigMetadata::progress].
4173    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
4174    where
4175        T: std::convert::Into<crate::model::OperationProgress>,
4176    {
4177        self.progress = v.map(|x| x.into());
4178        self
4179    }
4180
4181    /// Sets the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
4182    pub fn set_cancel_time<T>(mut self, v: T) -> Self
4183    where
4184        T: std::convert::Into<wkt::Timestamp>,
4185    {
4186        self.cancel_time = std::option::Option::Some(v.into());
4187        self
4188    }
4189
4190    /// Sets or clears the value of [cancel_time][crate::model::CreateInstanceConfigMetadata::cancel_time].
4191    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4192    where
4193        T: std::convert::Into<wkt::Timestamp>,
4194    {
4195        self.cancel_time = v.map(|x| x.into());
4196        self
4197    }
4198}
4199
4200impl wkt::message::Message for CreateInstanceConfigMetadata {
4201    fn typename() -> &'static str {
4202        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata"
4203    }
4204}
4205
4206/// Metadata type for the operation returned by
4207/// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig].
4208///
4209/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
4210#[derive(Clone, Default, PartialEq)]
4211#[non_exhaustive]
4212pub struct UpdateInstanceConfigMetadata {
4213    /// The desired instance configuration after updating.
4214    pub instance_config: std::option::Option<crate::model::InstanceConfig>,
4215
4216    /// The progress of the
4217    /// [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]
4218    /// operation.
4219    ///
4220    /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]: crate::client::InstanceAdmin::update_instance_config
4221    pub progress: std::option::Option<crate::model::OperationProgress>,
4222
4223    /// The time at which this operation was cancelled.
4224    pub cancel_time: std::option::Option<wkt::Timestamp>,
4225
4226    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4227}
4228
4229impl UpdateInstanceConfigMetadata {
4230    pub fn new() -> Self {
4231        std::default::Default::default()
4232    }
4233
4234    /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
4235    pub fn set_instance_config<T>(mut self, v: T) -> Self
4236    where
4237        T: std::convert::Into<crate::model::InstanceConfig>,
4238    {
4239        self.instance_config = std::option::Option::Some(v.into());
4240        self
4241    }
4242
4243    /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigMetadata::instance_config].
4244    pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
4245    where
4246        T: std::convert::Into<crate::model::InstanceConfig>,
4247    {
4248        self.instance_config = v.map(|x| x.into());
4249        self
4250    }
4251
4252    /// Sets the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
4253    pub fn set_progress<T>(mut self, v: T) -> Self
4254    where
4255        T: std::convert::Into<crate::model::OperationProgress>,
4256    {
4257        self.progress = std::option::Option::Some(v.into());
4258        self
4259    }
4260
4261    /// Sets or clears the value of [progress][crate::model::UpdateInstanceConfigMetadata::progress].
4262    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
4263    where
4264        T: std::convert::Into<crate::model::OperationProgress>,
4265    {
4266        self.progress = v.map(|x| x.into());
4267        self
4268    }
4269
4270    /// Sets the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
4271    pub fn set_cancel_time<T>(mut self, v: T) -> Self
4272    where
4273        T: std::convert::Into<wkt::Timestamp>,
4274    {
4275        self.cancel_time = std::option::Option::Some(v.into());
4276        self
4277    }
4278
4279    /// Sets or clears the value of [cancel_time][crate::model::UpdateInstanceConfigMetadata::cancel_time].
4280    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4281    where
4282        T: std::convert::Into<wkt::Timestamp>,
4283    {
4284        self.cancel_time = v.map(|x| x.into());
4285        self
4286    }
4287}
4288
4289impl wkt::message::Message for UpdateInstanceConfigMetadata {
4290    fn typename() -> &'static str {
4291        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata"
4292    }
4293}
4294
4295/// An isolated set of Cloud Spanner resources that databases can define
4296/// placements on.
4297#[derive(Clone, Default, PartialEq)]
4298#[non_exhaustive]
4299pub struct InstancePartition {
4300    /// Required. A unique identifier for the instance partition. Values are of the
4301    /// form
4302    /// `projects/<project>/instances/<instance>/instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`.
4303    /// The final segment of the name must be between 2 and 64 characters in
4304    /// length. An instance partition's name cannot be changed after the instance
4305    /// partition is created.
4306    pub name: std::string::String,
4307
4308    /// Required. The name of the instance partition's configuration. Values are of
4309    /// the form `projects/<project>/instanceConfigs/<configuration>`. See also
4310    /// [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
4311    /// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
4312    ///
4313    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]: crate::client::InstanceAdmin::list_instance_configs
4314    /// [google.spanner.admin.instance.v1.InstanceConfig]: crate::model::InstanceConfig
4315    pub config: std::string::String,
4316
4317    /// Required. The descriptive name for this instance partition as it appears in
4318    /// UIs. Must be unique per project and between 4 and 30 characters in length.
4319    pub display_name: std::string::String,
4320
4321    /// Optional. The autoscaling configuration. Autoscaling is enabled if this
4322    /// field is set. When autoscaling is enabled, fields in compute_capacity are
4323    /// treated as OUTPUT_ONLY fields and reflect the current compute capacity
4324    /// allocated to the instance partition.
4325    pub autoscaling_config: std::option::Option<crate::model::AutoscalingConfig>,
4326
4327    /// Output only. The current instance partition state.
4328    pub state: crate::model::instance_partition::State,
4329
4330    /// Output only. The time at which the instance partition was created.
4331    pub create_time: std::option::Option<wkt::Timestamp>,
4332
4333    /// Output only. The time at which the instance partition was most recently
4334    /// updated.
4335    pub update_time: std::option::Option<wkt::Timestamp>,
4336
4337    /// Output only. The names of the databases that reference this
4338    /// instance partition. Referencing databases should share the parent instance.
4339    /// The existence of any referencing database prevents the instance partition
4340    /// from being deleted.
4341    pub referencing_databases: std::vec::Vec<std::string::String>,
4342
4343    /// Output only. Deprecated: This field is not populated.
4344    /// Output only. The names of the backups that reference this instance
4345    /// partition. Referencing backups should share the parent instance. The
4346    /// existence of any referencing backup prevents the instance partition from
4347    /// being deleted.
4348    #[deprecated]
4349    pub referencing_backups: std::vec::Vec<std::string::String>,
4350
4351    /// Used for optimistic concurrency control as a way
4352    /// to help prevent simultaneous updates of a instance partition from
4353    /// overwriting each other. It is strongly suggested that systems make use of
4354    /// the etag in the read-modify-write cycle to perform instance partition
4355    /// updates in order to avoid race conditions: An etag is returned in the
4356    /// response which contains instance partitions, and systems are expected to
4357    /// put that etag in the request to update instance partitions to ensure that
4358    /// their change will be applied to the same version of the instance partition.
4359    /// If no etag is provided in the call to update instance partition, then the
4360    /// existing instance partition is overwritten blindly.
4361    pub etag: std::string::String,
4362
4363    /// Compute capacity defines amount of server and storage resources that are
4364    /// available to the databases in an instance partition. At most, one of either
4365    /// `node_count` or` processing_units` should be present in the message. For
4366    /// more information, see
4367    /// [Compute capacity, nodes, and processing
4368    /// units](https://cloud.google.com/spanner/docs/compute-capacity).
4369    pub compute_capacity: std::option::Option<crate::model::instance_partition::ComputeCapacity>,
4370
4371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4372}
4373
4374impl InstancePartition {
4375    pub fn new() -> Self {
4376        std::default::Default::default()
4377    }
4378
4379    /// Sets the value of [name][crate::model::InstancePartition::name].
4380    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4381        self.name = v.into();
4382        self
4383    }
4384
4385    /// Sets the value of [config][crate::model::InstancePartition::config].
4386    pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4387        self.config = v.into();
4388        self
4389    }
4390
4391    /// Sets the value of [display_name][crate::model::InstancePartition::display_name].
4392    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4393        self.display_name = v.into();
4394        self
4395    }
4396
4397    /// Sets the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
4398    pub fn set_autoscaling_config<T>(mut self, v: T) -> Self
4399    where
4400        T: std::convert::Into<crate::model::AutoscalingConfig>,
4401    {
4402        self.autoscaling_config = std::option::Option::Some(v.into());
4403        self
4404    }
4405
4406    /// Sets or clears the value of [autoscaling_config][crate::model::InstancePartition::autoscaling_config].
4407    pub fn set_or_clear_autoscaling_config<T>(mut self, v: std::option::Option<T>) -> Self
4408    where
4409        T: std::convert::Into<crate::model::AutoscalingConfig>,
4410    {
4411        self.autoscaling_config = v.map(|x| x.into());
4412        self
4413    }
4414
4415    /// Sets the value of [state][crate::model::InstancePartition::state].
4416    pub fn set_state<T: std::convert::Into<crate::model::instance_partition::State>>(
4417        mut self,
4418        v: T,
4419    ) -> Self {
4420        self.state = v.into();
4421        self
4422    }
4423
4424    /// Sets the value of [create_time][crate::model::InstancePartition::create_time].
4425    pub fn set_create_time<T>(mut self, v: T) -> Self
4426    where
4427        T: std::convert::Into<wkt::Timestamp>,
4428    {
4429        self.create_time = std::option::Option::Some(v.into());
4430        self
4431    }
4432
4433    /// Sets or clears the value of [create_time][crate::model::InstancePartition::create_time].
4434    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4435    where
4436        T: std::convert::Into<wkt::Timestamp>,
4437    {
4438        self.create_time = v.map(|x| x.into());
4439        self
4440    }
4441
4442    /// Sets the value of [update_time][crate::model::InstancePartition::update_time].
4443    pub fn set_update_time<T>(mut self, v: T) -> Self
4444    where
4445        T: std::convert::Into<wkt::Timestamp>,
4446    {
4447        self.update_time = std::option::Option::Some(v.into());
4448        self
4449    }
4450
4451    /// Sets or clears the value of [update_time][crate::model::InstancePartition::update_time].
4452    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4453    where
4454        T: std::convert::Into<wkt::Timestamp>,
4455    {
4456        self.update_time = v.map(|x| x.into());
4457        self
4458    }
4459
4460    /// Sets the value of [referencing_databases][crate::model::InstancePartition::referencing_databases].
4461    pub fn set_referencing_databases<T, V>(mut self, v: T) -> Self
4462    where
4463        T: std::iter::IntoIterator<Item = V>,
4464        V: std::convert::Into<std::string::String>,
4465    {
4466        use std::iter::Iterator;
4467        self.referencing_databases = v.into_iter().map(|i| i.into()).collect();
4468        self
4469    }
4470
4471    /// Sets the value of [referencing_backups][crate::model::InstancePartition::referencing_backups].
4472    #[deprecated]
4473    pub fn set_referencing_backups<T, V>(mut self, v: T) -> Self
4474    where
4475        T: std::iter::IntoIterator<Item = V>,
4476        V: std::convert::Into<std::string::String>,
4477    {
4478        use std::iter::Iterator;
4479        self.referencing_backups = v.into_iter().map(|i| i.into()).collect();
4480        self
4481    }
4482
4483    /// Sets the value of [etag][crate::model::InstancePartition::etag].
4484    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4485        self.etag = v.into();
4486        self
4487    }
4488
4489    /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity].
4490    ///
4491    /// Note that all the setters affecting `compute_capacity` are mutually
4492    /// exclusive.
4493    pub fn set_compute_capacity<
4494        T: std::convert::Into<std::option::Option<crate::model::instance_partition::ComputeCapacity>>,
4495    >(
4496        mut self,
4497        v: T,
4498    ) -> Self {
4499        self.compute_capacity = v.into();
4500        self
4501    }
4502
4503    /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
4504    /// if it holds a `NodeCount`, `None` if the field is not set or
4505    /// holds a different branch.
4506    pub fn node_count(&self) -> std::option::Option<&i32> {
4507        #[allow(unreachable_patterns)]
4508        self.compute_capacity.as_ref().and_then(|v| match v {
4509            crate::model::instance_partition::ComputeCapacity::NodeCount(v) => {
4510                std::option::Option::Some(v)
4511            }
4512            _ => std::option::Option::None,
4513        })
4514    }
4515
4516    /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
4517    /// to hold a `NodeCount`.
4518    ///
4519    /// Note that all the setters affecting `compute_capacity` are
4520    /// mutually exclusive.
4521    pub fn set_node_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4522        self.compute_capacity = std::option::Option::Some(
4523            crate::model::instance_partition::ComputeCapacity::NodeCount(v.into()),
4524        );
4525        self
4526    }
4527
4528    /// The value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
4529    /// if it holds a `ProcessingUnits`, `None` if the field is not set or
4530    /// holds a different branch.
4531    pub fn processing_units(&self) -> std::option::Option<&i32> {
4532        #[allow(unreachable_patterns)]
4533        self.compute_capacity.as_ref().and_then(|v| match v {
4534            crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v) => {
4535                std::option::Option::Some(v)
4536            }
4537            _ => std::option::Option::None,
4538        })
4539    }
4540
4541    /// Sets the value of [compute_capacity][crate::model::InstancePartition::compute_capacity]
4542    /// to hold a `ProcessingUnits`.
4543    ///
4544    /// Note that all the setters affecting `compute_capacity` are
4545    /// mutually exclusive.
4546    pub fn set_processing_units<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4547        self.compute_capacity = std::option::Option::Some(
4548            crate::model::instance_partition::ComputeCapacity::ProcessingUnits(v.into()),
4549        );
4550        self
4551    }
4552}
4553
4554impl wkt::message::Message for InstancePartition {
4555    fn typename() -> &'static str {
4556        "type.googleapis.com/google.spanner.admin.instance.v1.InstancePartition"
4557    }
4558}
4559
4560/// Defines additional types related to [InstancePartition].
4561pub mod instance_partition {
4562    #[allow(unused_imports)]
4563    use super::*;
4564
4565    /// Indicates the current state of the instance partition.
4566    ///
4567    /// # Working with unknown values
4568    ///
4569    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4570    /// additional enum variants at any time. Adding new variants is not considered
4571    /// a breaking change. Applications should write their code in anticipation of:
4572    ///
4573    /// - New values appearing in future releases of the client library, **and**
4574    /// - New values received dynamically, without application changes.
4575    ///
4576    /// Please consult the [Working with enums] section in the user guide for some
4577    /// guidelines.
4578    ///
4579    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4580    #[derive(Clone, Debug, PartialEq)]
4581    #[non_exhaustive]
4582    pub enum State {
4583        /// Not specified.
4584        Unspecified,
4585        /// The instance partition is still being created. Resources may not be
4586        /// available yet, and operations such as creating placements using this
4587        /// instance partition may not work.
4588        Creating,
4589        /// The instance partition is fully created and ready to do work such as
4590        /// creating placements and using in databases.
4591        Ready,
4592        /// If set, the enum was initialized with an unknown value.
4593        ///
4594        /// Applications can examine the value using [State::value] or
4595        /// [State::name].
4596        UnknownValue(state::UnknownValue),
4597    }
4598
4599    #[doc(hidden)]
4600    pub mod state {
4601        #[allow(unused_imports)]
4602        use super::*;
4603        #[derive(Clone, Debug, PartialEq)]
4604        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4605    }
4606
4607    impl State {
4608        /// Gets the enum value.
4609        ///
4610        /// Returns `None` if the enum contains an unknown value deserialized from
4611        /// the string representation of enums.
4612        pub fn value(&self) -> std::option::Option<i32> {
4613            match self {
4614                Self::Unspecified => std::option::Option::Some(0),
4615                Self::Creating => std::option::Option::Some(1),
4616                Self::Ready => std::option::Option::Some(2),
4617                Self::UnknownValue(u) => u.0.value(),
4618            }
4619        }
4620
4621        /// Gets the enum value as a string.
4622        ///
4623        /// Returns `None` if the enum contains an unknown value deserialized from
4624        /// the integer representation of enums.
4625        pub fn name(&self) -> std::option::Option<&str> {
4626            match self {
4627                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4628                Self::Creating => std::option::Option::Some("CREATING"),
4629                Self::Ready => std::option::Option::Some("READY"),
4630                Self::UnknownValue(u) => u.0.name(),
4631            }
4632        }
4633    }
4634
4635    impl std::default::Default for State {
4636        fn default() -> Self {
4637            use std::convert::From;
4638            Self::from(0)
4639        }
4640    }
4641
4642    impl std::fmt::Display for State {
4643        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4644            wkt::internal::display_enum(f, self.name(), self.value())
4645        }
4646    }
4647
4648    impl std::convert::From<i32> for State {
4649        fn from(value: i32) -> Self {
4650            match value {
4651                0 => Self::Unspecified,
4652                1 => Self::Creating,
4653                2 => Self::Ready,
4654                _ => Self::UnknownValue(state::UnknownValue(
4655                    wkt::internal::UnknownEnumValue::Integer(value),
4656                )),
4657            }
4658        }
4659    }
4660
4661    impl std::convert::From<&str> for State {
4662        fn from(value: &str) -> Self {
4663            use std::string::ToString;
4664            match value {
4665                "STATE_UNSPECIFIED" => Self::Unspecified,
4666                "CREATING" => Self::Creating,
4667                "READY" => Self::Ready,
4668                _ => Self::UnknownValue(state::UnknownValue(
4669                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4670                )),
4671            }
4672        }
4673    }
4674
4675    impl serde::ser::Serialize for State {
4676        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4677        where
4678            S: serde::Serializer,
4679        {
4680            match self {
4681                Self::Unspecified => serializer.serialize_i32(0),
4682                Self::Creating => serializer.serialize_i32(1),
4683                Self::Ready => serializer.serialize_i32(2),
4684                Self::UnknownValue(u) => u.0.serialize(serializer),
4685            }
4686        }
4687    }
4688
4689    impl<'de> serde::de::Deserialize<'de> for State {
4690        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4691        where
4692            D: serde::Deserializer<'de>,
4693        {
4694            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4695                ".google.spanner.admin.instance.v1.InstancePartition.State",
4696            ))
4697        }
4698    }
4699
4700    /// Compute capacity defines amount of server and storage resources that are
4701    /// available to the databases in an instance partition. At most, one of either
4702    /// `node_count` or` processing_units` should be present in the message. For
4703    /// more information, see
4704    /// [Compute capacity, nodes, and processing
4705    /// units](https://cloud.google.com/spanner/docs/compute-capacity).
4706    #[derive(Clone, Debug, PartialEq)]
4707    #[non_exhaustive]
4708    pub enum ComputeCapacity {
4709        /// The number of nodes allocated to this instance partition.
4710        ///
4711        /// Users can set the `node_count` field to specify the target number of
4712        /// nodes allocated to the instance partition.
4713        ///
4714        /// This may be zero in API responses for instance partitions that are not
4715        /// yet in state `READY`.
4716        NodeCount(i32),
4717        /// The number of processing units allocated to this instance partition.
4718        ///
4719        /// Users can set the `processing_units` field to specify the target number
4720        /// of processing units allocated to the instance partition.
4721        ///
4722        /// This might be zero in API responses for instance partitions that are not
4723        /// yet in the `READY` state.
4724        ProcessingUnits(i32),
4725    }
4726}
4727
4728/// Metadata type for the operation returned by
4729/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
4730///
4731/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
4732#[derive(Clone, Default, PartialEq)]
4733#[non_exhaustive]
4734pub struct CreateInstancePartitionMetadata {
4735    /// The instance partition being created.
4736    pub instance_partition: std::option::Option<crate::model::InstancePartition>,
4737
4738    /// The time at which the
4739    /// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
4740    /// request was received.
4741    ///
4742    /// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
4743    pub start_time: std::option::Option<wkt::Timestamp>,
4744
4745    /// The time at which this operation was cancelled. If set, this operation is
4746    /// in the process of undoing itself (which is guaranteed to succeed) and
4747    /// cannot be cancelled again.
4748    pub cancel_time: std::option::Option<wkt::Timestamp>,
4749
4750    /// The time at which this operation failed or was completed successfully.
4751    pub end_time: std::option::Option<wkt::Timestamp>,
4752
4753    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4754}
4755
4756impl CreateInstancePartitionMetadata {
4757    pub fn new() -> Self {
4758        std::default::Default::default()
4759    }
4760
4761    /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
4762    pub fn set_instance_partition<T>(mut self, v: T) -> Self
4763    where
4764        T: std::convert::Into<crate::model::InstancePartition>,
4765    {
4766        self.instance_partition = std::option::Option::Some(v.into());
4767        self
4768    }
4769
4770    /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionMetadata::instance_partition].
4771    pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
4772    where
4773        T: std::convert::Into<crate::model::InstancePartition>,
4774    {
4775        self.instance_partition = v.map(|x| x.into());
4776        self
4777    }
4778
4779    /// Sets the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
4780    pub fn set_start_time<T>(mut self, v: T) -> Self
4781    where
4782        T: std::convert::Into<wkt::Timestamp>,
4783    {
4784        self.start_time = std::option::Option::Some(v.into());
4785        self
4786    }
4787
4788    /// Sets or clears the value of [start_time][crate::model::CreateInstancePartitionMetadata::start_time].
4789    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
4790    where
4791        T: std::convert::Into<wkt::Timestamp>,
4792    {
4793        self.start_time = v.map(|x| x.into());
4794        self
4795    }
4796
4797    /// Sets the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
4798    pub fn set_cancel_time<T>(mut self, v: T) -> Self
4799    where
4800        T: std::convert::Into<wkt::Timestamp>,
4801    {
4802        self.cancel_time = std::option::Option::Some(v.into());
4803        self
4804    }
4805
4806    /// Sets or clears the value of [cancel_time][crate::model::CreateInstancePartitionMetadata::cancel_time].
4807    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
4808    where
4809        T: std::convert::Into<wkt::Timestamp>,
4810    {
4811        self.cancel_time = v.map(|x| x.into());
4812        self
4813    }
4814
4815    /// Sets the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
4816    pub fn set_end_time<T>(mut self, v: T) -> Self
4817    where
4818        T: std::convert::Into<wkt::Timestamp>,
4819    {
4820        self.end_time = std::option::Option::Some(v.into());
4821        self
4822    }
4823
4824    /// Sets or clears the value of [end_time][crate::model::CreateInstancePartitionMetadata::end_time].
4825    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4826    where
4827        T: std::convert::Into<wkt::Timestamp>,
4828    {
4829        self.end_time = v.map(|x| x.into());
4830        self
4831    }
4832}
4833
4834impl wkt::message::Message for CreateInstancePartitionMetadata {
4835    fn typename() -> &'static str {
4836        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata"
4837    }
4838}
4839
4840/// The request for
4841/// [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition].
4842///
4843/// [google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]: crate::client::InstanceAdmin::create_instance_partition
4844#[derive(Clone, Default, PartialEq)]
4845#[non_exhaustive]
4846pub struct CreateInstancePartitionRequest {
4847    /// Required. The name of the instance in which to create the instance
4848    /// partition. Values are of the form
4849    /// `projects/<project>/instances/<instance>`.
4850    pub parent: std::string::String,
4851
4852    /// Required. The ID of the instance partition to create. Valid identifiers are
4853    /// of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
4854    /// characters in length.
4855    pub instance_partition_id: std::string::String,
4856
4857    /// Required. The instance partition to create. The instance_partition.name may
4858    /// be omitted, but if specified must be
4859    /// `<parent>/instancePartitions/<instance_partition_id>`.
4860    pub instance_partition: std::option::Option<crate::model::InstancePartition>,
4861
4862    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4863}
4864
4865impl CreateInstancePartitionRequest {
4866    pub fn new() -> Self {
4867        std::default::Default::default()
4868    }
4869
4870    /// Sets the value of [parent][crate::model::CreateInstancePartitionRequest::parent].
4871    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4872        self.parent = v.into();
4873        self
4874    }
4875
4876    /// Sets the value of [instance_partition_id][crate::model::CreateInstancePartitionRequest::instance_partition_id].
4877    pub fn set_instance_partition_id<T: std::convert::Into<std::string::String>>(
4878        mut self,
4879        v: T,
4880    ) -> Self {
4881        self.instance_partition_id = v.into();
4882        self
4883    }
4884
4885    /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
4886    pub fn set_instance_partition<T>(mut self, v: T) -> Self
4887    where
4888        T: std::convert::Into<crate::model::InstancePartition>,
4889    {
4890        self.instance_partition = std::option::Option::Some(v.into());
4891        self
4892    }
4893
4894    /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
4895    pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
4896    where
4897        T: std::convert::Into<crate::model::InstancePartition>,
4898    {
4899        self.instance_partition = v.map(|x| x.into());
4900        self
4901    }
4902}
4903
4904impl wkt::message::Message for CreateInstancePartitionRequest {
4905    fn typename() -> &'static str {
4906        "type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionRequest"
4907    }
4908}
4909
4910/// The request for
4911/// [DeleteInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition].
4912///
4913/// [google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstancePartition]: crate::client::InstanceAdmin::delete_instance_partition
4914#[derive(Clone, Default, PartialEq)]
4915#[non_exhaustive]
4916pub struct DeleteInstancePartitionRequest {
4917    /// Required. The name of the instance partition to be deleted.
4918    /// Values are of the form
4919    /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
4920    pub name: std::string::String,
4921
4922    /// Optional. If not empty, the API only deletes the instance partition when
4923    /// the etag provided matches the current status of the requested instance
4924    /// partition. Otherwise, deletes the instance partition without checking the
4925    /// current status of the requested instance partition.
4926    pub etag: std::string::String,
4927
4928    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4929}
4930
4931impl DeleteInstancePartitionRequest {
4932    pub fn new() -> Self {
4933        std::default::Default::default()
4934    }
4935
4936    /// Sets the value of [name][crate::model::DeleteInstancePartitionRequest::name].
4937    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4938        self.name = v.into();
4939        self
4940    }
4941
4942    /// Sets the value of [etag][crate::model::DeleteInstancePartitionRequest::etag].
4943    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4944        self.etag = v.into();
4945        self
4946    }
4947}
4948
4949impl wkt::message::Message for DeleteInstancePartitionRequest {
4950    fn typename() -> &'static str {
4951        "type.googleapis.com/google.spanner.admin.instance.v1.DeleteInstancePartitionRequest"
4952    }
4953}
4954
4955/// The request for
4956/// [GetInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition].
4957///
4958/// [google.spanner.admin.instance.v1.InstanceAdmin.GetInstancePartition]: crate::client::InstanceAdmin::get_instance_partition
4959#[derive(Clone, Default, PartialEq)]
4960#[non_exhaustive]
4961pub struct GetInstancePartitionRequest {
4962    /// Required. The name of the requested instance partition. Values are of
4963    /// the form
4964    /// `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
4965    pub name: std::string::String,
4966
4967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4968}
4969
4970impl GetInstancePartitionRequest {
4971    pub fn new() -> Self {
4972        std::default::Default::default()
4973    }
4974
4975    /// Sets the value of [name][crate::model::GetInstancePartitionRequest::name].
4976    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4977        self.name = v.into();
4978        self
4979    }
4980}
4981
4982impl wkt::message::Message for GetInstancePartitionRequest {
4983    fn typename() -> &'static str {
4984        "type.googleapis.com/google.spanner.admin.instance.v1.GetInstancePartitionRequest"
4985    }
4986}
4987
4988/// The request for
4989/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
4990///
4991/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
4992#[derive(Clone, Default, PartialEq)]
4993#[non_exhaustive]
4994pub struct UpdateInstancePartitionRequest {
4995    /// Required. The instance partition to update, which must always include the
4996    /// instance partition name. Otherwise, only fields mentioned in
4997    /// [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
4998    /// need be included.
4999    ///
5000    /// [google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]: crate::model::UpdateInstancePartitionRequest::field_mask
5001    pub instance_partition: std::option::Option<crate::model::InstancePartition>,
5002
5003    /// Required. A mask specifying which fields in
5004    /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
5005    /// should be updated. The field mask must always be specified; this prevents
5006    /// any future fields in
5007    /// [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
5008    /// from being erased accidentally by clients that do not know about them.
5009    ///
5010    /// [google.spanner.admin.instance.v1.InstancePartition]: crate::model::InstancePartition
5011    pub field_mask: std::option::Option<wkt::FieldMask>,
5012
5013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5014}
5015
5016impl UpdateInstancePartitionRequest {
5017    pub fn new() -> Self {
5018        std::default::Default::default()
5019    }
5020
5021    /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
5022    pub fn set_instance_partition<T>(mut self, v: T) -> Self
5023    where
5024        T: std::convert::Into<crate::model::InstancePartition>,
5025    {
5026        self.instance_partition = std::option::Option::Some(v.into());
5027        self
5028    }
5029
5030    /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
5031    pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
5032    where
5033        T: std::convert::Into<crate::model::InstancePartition>,
5034    {
5035        self.instance_partition = v.map(|x| x.into());
5036        self
5037    }
5038
5039    /// Sets the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
5040    pub fn set_field_mask<T>(mut self, v: T) -> Self
5041    where
5042        T: std::convert::Into<wkt::FieldMask>,
5043    {
5044        self.field_mask = std::option::Option::Some(v.into());
5045        self
5046    }
5047
5048    /// Sets or clears the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
5049    pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
5050    where
5051        T: std::convert::Into<wkt::FieldMask>,
5052    {
5053        self.field_mask = v.map(|x| x.into());
5054        self
5055    }
5056}
5057
5058impl wkt::message::Message for UpdateInstancePartitionRequest {
5059    fn typename() -> &'static str {
5060        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionRequest"
5061    }
5062}
5063
5064/// Metadata type for the operation returned by
5065/// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition].
5066///
5067/// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
5068#[derive(Clone, Default, PartialEq)]
5069#[non_exhaustive]
5070pub struct UpdateInstancePartitionMetadata {
5071    /// The desired end state of the update.
5072    pub instance_partition: std::option::Option<crate::model::InstancePartition>,
5073
5074    /// The time at which
5075    /// [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
5076    /// request was received.
5077    ///
5078    /// [google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]: crate::client::InstanceAdmin::update_instance_partition
5079    pub start_time: std::option::Option<wkt::Timestamp>,
5080
5081    /// The time at which this operation was cancelled. If set, this operation is
5082    /// in the process of undoing itself (which is guaranteed to succeed) and
5083    /// cannot be cancelled again.
5084    pub cancel_time: std::option::Option<wkt::Timestamp>,
5085
5086    /// The time at which this operation failed or was completed successfully.
5087    pub end_time: std::option::Option<wkt::Timestamp>,
5088
5089    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5090}
5091
5092impl UpdateInstancePartitionMetadata {
5093    pub fn new() -> Self {
5094        std::default::Default::default()
5095    }
5096
5097    /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
5098    pub fn set_instance_partition<T>(mut self, v: T) -> Self
5099    where
5100        T: std::convert::Into<crate::model::InstancePartition>,
5101    {
5102        self.instance_partition = std::option::Option::Some(v.into());
5103        self
5104    }
5105
5106    /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionMetadata::instance_partition].
5107    pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
5108    where
5109        T: std::convert::Into<crate::model::InstancePartition>,
5110    {
5111        self.instance_partition = v.map(|x| x.into());
5112        self
5113    }
5114
5115    /// Sets the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
5116    pub fn set_start_time<T>(mut self, v: T) -> Self
5117    where
5118        T: std::convert::Into<wkt::Timestamp>,
5119    {
5120        self.start_time = std::option::Option::Some(v.into());
5121        self
5122    }
5123
5124    /// Sets or clears the value of [start_time][crate::model::UpdateInstancePartitionMetadata::start_time].
5125    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5126    where
5127        T: std::convert::Into<wkt::Timestamp>,
5128    {
5129        self.start_time = v.map(|x| x.into());
5130        self
5131    }
5132
5133    /// Sets the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
5134    pub fn set_cancel_time<T>(mut self, v: T) -> Self
5135    where
5136        T: std::convert::Into<wkt::Timestamp>,
5137    {
5138        self.cancel_time = std::option::Option::Some(v.into());
5139        self
5140    }
5141
5142    /// Sets or clears the value of [cancel_time][crate::model::UpdateInstancePartitionMetadata::cancel_time].
5143    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5144    where
5145        T: std::convert::Into<wkt::Timestamp>,
5146    {
5147        self.cancel_time = v.map(|x| x.into());
5148        self
5149    }
5150
5151    /// Sets the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
5152    pub fn set_end_time<T>(mut self, v: T) -> Self
5153    where
5154        T: std::convert::Into<wkt::Timestamp>,
5155    {
5156        self.end_time = std::option::Option::Some(v.into());
5157        self
5158    }
5159
5160    /// Sets or clears the value of [end_time][crate::model::UpdateInstancePartitionMetadata::end_time].
5161    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5162    where
5163        T: std::convert::Into<wkt::Timestamp>,
5164    {
5165        self.end_time = v.map(|x| x.into());
5166        self
5167    }
5168}
5169
5170impl wkt::message::Message for UpdateInstancePartitionMetadata {
5171    fn typename() -> &'static str {
5172        "type.googleapis.com/google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata"
5173    }
5174}
5175
5176/// The request for
5177/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
5178///
5179/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
5180#[derive(Clone, Default, PartialEq)]
5181#[non_exhaustive]
5182pub struct ListInstancePartitionsRequest {
5183    /// Required. The instance whose instance partitions should be listed. Values
5184    /// are of the form `projects/<project>/instances/<instance>`. Use `{instance}
5185    /// = '-'` to list instance partitions for all Instances in a project, e.g.,
5186    /// `projects/myproject/instances/-`.
5187    pub parent: std::string::String,
5188
5189    /// Number of instance partitions to be returned in the response. If 0 or less,
5190    /// defaults to the server's maximum allowed page size.
5191    pub page_size: i32,
5192
5193    /// If non-empty, `page_token` should contain a
5194    /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
5195    /// from a previous
5196    /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
5197    ///
5198    /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
5199    /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]: crate::model::ListInstancePartitionsResponse::next_page_token
5200    pub page_token: std::string::String,
5201
5202    /// Optional. Deadline used while retrieving metadata for instance partitions.
5203    /// Instance partitions whose metadata cannot be retrieved within this deadline
5204    /// will be added to
5205    /// [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
5206    /// in
5207    /// [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
5208    ///
5209    /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse]: crate::model::ListInstancePartitionsResponse
5210    /// [google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]: crate::model::ListInstancePartitionsResponse::unreachable
5211    pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
5212
5213    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5214}
5215
5216impl ListInstancePartitionsRequest {
5217    pub fn new() -> Self {
5218        std::default::Default::default()
5219    }
5220
5221    /// Sets the value of [parent][crate::model::ListInstancePartitionsRequest::parent].
5222    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5223        self.parent = v.into();
5224        self
5225    }
5226
5227    /// Sets the value of [page_size][crate::model::ListInstancePartitionsRequest::page_size].
5228    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5229        self.page_size = v.into();
5230        self
5231    }
5232
5233    /// Sets the value of [page_token][crate::model::ListInstancePartitionsRequest::page_token].
5234    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5235        self.page_token = v.into();
5236        self
5237    }
5238
5239    /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
5240    pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
5241    where
5242        T: std::convert::Into<wkt::Timestamp>,
5243    {
5244        self.instance_partition_deadline = std::option::Option::Some(v.into());
5245        self
5246    }
5247
5248    /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
5249    pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
5250    where
5251        T: std::convert::Into<wkt::Timestamp>,
5252    {
5253        self.instance_partition_deadline = v.map(|x| x.into());
5254        self
5255    }
5256}
5257
5258impl wkt::message::Message for ListInstancePartitionsRequest {
5259    fn typename() -> &'static str {
5260        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsRequest"
5261    }
5262}
5263
5264/// The response for
5265/// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions].
5266///
5267/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
5268#[derive(Clone, Default, PartialEq)]
5269#[non_exhaustive]
5270pub struct ListInstancePartitionsResponse {
5271    /// The list of requested instancePartitions.
5272    pub instance_partitions: std::vec::Vec<crate::model::InstancePartition>,
5273
5274    /// `next_page_token` can be sent in a subsequent
5275    /// [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]
5276    /// call to fetch more of the matching instance partitions.
5277    ///
5278    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions]: crate::client::InstanceAdmin::list_instance_partitions
5279    pub next_page_token: std::string::String,
5280
5281    /// The list of unreachable instances or instance partitions.
5282    /// It includes the names of instances or instance partitions whose metadata
5283    /// could not be retrieved within
5284    /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline].
5285    ///
5286    /// [google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionsRequest::instance_partition_deadline
5287    pub unreachable: std::vec::Vec<std::string::String>,
5288
5289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5290}
5291
5292impl ListInstancePartitionsResponse {
5293    pub fn new() -> Self {
5294        std::default::Default::default()
5295    }
5296
5297    /// Sets the value of [instance_partitions][crate::model::ListInstancePartitionsResponse::instance_partitions].
5298    pub fn set_instance_partitions<T, V>(mut self, v: T) -> Self
5299    where
5300        T: std::iter::IntoIterator<Item = V>,
5301        V: std::convert::Into<crate::model::InstancePartition>,
5302    {
5303        use std::iter::Iterator;
5304        self.instance_partitions = v.into_iter().map(|i| i.into()).collect();
5305        self
5306    }
5307
5308    /// Sets the value of [next_page_token][crate::model::ListInstancePartitionsResponse::next_page_token].
5309    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5310        self.next_page_token = v.into();
5311        self
5312    }
5313
5314    /// Sets the value of [unreachable][crate::model::ListInstancePartitionsResponse::unreachable].
5315    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
5316    where
5317        T: std::iter::IntoIterator<Item = V>,
5318        V: std::convert::Into<std::string::String>,
5319    {
5320        use std::iter::Iterator;
5321        self.unreachable = v.into_iter().map(|i| i.into()).collect();
5322        self
5323    }
5324}
5325
5326impl wkt::message::Message for ListInstancePartitionsResponse {
5327    fn typename() -> &'static str {
5328        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionsResponse"
5329    }
5330}
5331
5332#[doc(hidden)]
5333impl gax::paginator::internal::PageableResponse for ListInstancePartitionsResponse {
5334    type PageItem = crate::model::InstancePartition;
5335
5336    fn items(self) -> std::vec::Vec<Self::PageItem> {
5337        self.instance_partitions
5338    }
5339
5340    fn next_page_token(&self) -> std::string::String {
5341        use std::clone::Clone;
5342        self.next_page_token.clone()
5343    }
5344}
5345
5346/// The request for
5347/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
5348///
5349/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
5350#[derive(Clone, Default, PartialEq)]
5351#[non_exhaustive]
5352pub struct ListInstancePartitionOperationsRequest {
5353    /// Required. The parent instance of the instance partition operations.
5354    /// Values are of the form `projects/<project>/instances/<instance>`.
5355    pub parent: std::string::String,
5356
5357    /// Optional. An expression that filters the list of returned operations.
5358    ///
5359    /// A filter expression consists of a field name, a
5360    /// comparison operator, and a value for filtering.
5361    /// The value must be a string, a number, or a boolean. The comparison operator
5362    /// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
5363    /// Colon `:` is the contains operator. Filter rules are not case sensitive.
5364    ///
5365    /// The following fields in the Operation are eligible for filtering:
5366    ///
5367    /// * `name` - The name of the long-running operation
5368    /// * `done` - False if the operation is in progress, else true.
5369    /// * `metadata.@type` - the type of metadata. For example, the type string
5370    ///   for
5371    ///   [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
5372    ///   is
5373    ///   `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
5374    /// * `metadata.<field_name>` - any field in metadata.value.
5375    ///   `metadata.@type` must be specified first, if filtering on metadata
5376    ///   fields.
5377    /// * `error` - Error associated with the long-running operation.
5378    /// * `response.@type` - the type of response.
5379    /// * `response.<field_name>` - any field in response.value.
5380    ///
5381    /// You can combine multiple expressions by enclosing each expression in
5382    /// parentheses. By default, expressions are combined with AND logic. However,
5383    /// you can specify AND, OR, and NOT logic explicitly.
5384    ///
5385    /// Here are a few examples:
5386    ///
5387    /// * `done:true` - The operation is complete.
5388    /// * `(metadata.@type=` \
5389    ///   `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
5390    ///   AND` \
5391    ///   `(metadata.instance_partition.name:custom-instance-partition) AND` \
5392    ///   `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
5393    ///   `(error:*)` - Return operations where:
5394    ///   * The operation's metadata type is
5395    ///     [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
5396    ///   * The instance partition name contains "custom-instance-partition".
5397    ///   * The operation started before 2021-03-28T14:50:00Z.
5398    ///   * The operation resulted in an error.
5399    ///
5400    /// [google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]: crate::model::CreateInstancePartitionMetadata
5401    pub filter: std::string::String,
5402
5403    /// Optional. Number of operations to be returned in the response. If 0 or
5404    /// less, defaults to the server's maximum allowed page size.
5405    pub page_size: i32,
5406
5407    /// Optional. If non-empty, `page_token` should contain a
5408    /// [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
5409    /// from a previous
5410    /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]
5411    /// to the same `parent` and with the same `filter`.
5412    ///
5413    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
5414    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]: crate::model::ListInstancePartitionOperationsResponse::next_page_token
5415    pub page_token: std::string::String,
5416
5417    /// Optional. Deadline used while retrieving metadata for instance partition
5418    /// operations. Instance partitions whose operation metadata cannot be
5419    /// retrieved within this deadline will be added to
5420    /// [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]
5421    /// in
5422    /// [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
5423    ///
5424    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]: crate::model::ListInstancePartitionOperationsResponse
5425    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions]: crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions
5426    pub instance_partition_deadline: std::option::Option<wkt::Timestamp>,
5427
5428    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429}
5430
5431impl ListInstancePartitionOperationsRequest {
5432    pub fn new() -> Self {
5433        std::default::Default::default()
5434    }
5435
5436    /// Sets the value of [parent][crate::model::ListInstancePartitionOperationsRequest::parent].
5437    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5438        self.parent = v.into();
5439        self
5440    }
5441
5442    /// Sets the value of [filter][crate::model::ListInstancePartitionOperationsRequest::filter].
5443    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5444        self.filter = v.into();
5445        self
5446    }
5447
5448    /// Sets the value of [page_size][crate::model::ListInstancePartitionOperationsRequest::page_size].
5449    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5450        self.page_size = v.into();
5451        self
5452    }
5453
5454    /// Sets the value of [page_token][crate::model::ListInstancePartitionOperationsRequest::page_token].
5455    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5456        self.page_token = v.into();
5457        self
5458    }
5459
5460    /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
5461    pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
5462    where
5463        T: std::convert::Into<wkt::Timestamp>,
5464    {
5465        self.instance_partition_deadline = std::option::Option::Some(v.into());
5466        self
5467    }
5468
5469    /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
5470    pub fn set_or_clear_instance_partition_deadline<T>(mut self, v: std::option::Option<T>) -> Self
5471    where
5472        T: std::convert::Into<wkt::Timestamp>,
5473    {
5474        self.instance_partition_deadline = v.map(|x| x.into());
5475        self
5476    }
5477}
5478
5479impl wkt::message::Message for ListInstancePartitionOperationsRequest {
5480    fn typename() -> &'static str {
5481        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest"
5482    }
5483}
5484
5485/// The response for
5486/// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations].
5487///
5488/// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
5489#[derive(Clone, Default, PartialEq)]
5490#[non_exhaustive]
5491pub struct ListInstancePartitionOperationsResponse {
5492    /// The list of matching instance partition long-running operations. Each
5493    /// operation's name will be
5494    /// prefixed by the instance partition's name. The operation's
5495    /// metadata field type
5496    /// `metadata.type_url` describes the type of the metadata.
5497    pub operations: std::vec::Vec<longrunning::model::Operation>,
5498
5499    /// `next_page_token` can be sent in a subsequent
5500    /// [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]
5501    /// call to fetch more of the matching metadata.
5502    ///
5503    /// [google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations]: crate::client::InstanceAdmin::list_instance_partition_operations
5504    pub next_page_token: std::string::String,
5505
5506    /// The list of unreachable instance partitions.
5507    /// It includes the names of instance partitions whose operation metadata could
5508    /// not be retrieved within
5509    /// [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline].
5510    ///
5511    /// [google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]: crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline
5512    pub unreachable_instance_partitions: std::vec::Vec<std::string::String>,
5513
5514    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5515}
5516
5517impl ListInstancePartitionOperationsResponse {
5518    pub fn new() -> Self {
5519        std::default::Default::default()
5520    }
5521
5522    /// Sets the value of [operations][crate::model::ListInstancePartitionOperationsResponse::operations].
5523    pub fn set_operations<T, V>(mut self, v: T) -> Self
5524    where
5525        T: std::iter::IntoIterator<Item = V>,
5526        V: std::convert::Into<longrunning::model::Operation>,
5527    {
5528        use std::iter::Iterator;
5529        self.operations = v.into_iter().map(|i| i.into()).collect();
5530        self
5531    }
5532
5533    /// Sets the value of [next_page_token][crate::model::ListInstancePartitionOperationsResponse::next_page_token].
5534    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5535        self.next_page_token = v.into();
5536        self
5537    }
5538
5539    /// Sets the value of [unreachable_instance_partitions][crate::model::ListInstancePartitionOperationsResponse::unreachable_instance_partitions].
5540    pub fn set_unreachable_instance_partitions<T, V>(mut self, v: T) -> Self
5541    where
5542        T: std::iter::IntoIterator<Item = V>,
5543        V: std::convert::Into<std::string::String>,
5544    {
5545        use std::iter::Iterator;
5546        self.unreachable_instance_partitions = v.into_iter().map(|i| i.into()).collect();
5547        self
5548    }
5549}
5550
5551impl wkt::message::Message for ListInstancePartitionOperationsResponse {
5552    fn typename() -> &'static str {
5553        "type.googleapis.com/google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse"
5554    }
5555}
5556
5557#[doc(hidden)]
5558impl gax::paginator::internal::PageableResponse for ListInstancePartitionOperationsResponse {
5559    type PageItem = longrunning::model::Operation;
5560
5561    fn items(self) -> std::vec::Vec<Self::PageItem> {
5562        self.operations
5563    }
5564
5565    fn next_page_token(&self) -> std::string::String {
5566        use std::clone::Clone;
5567        self.next_page_token.clone()
5568    }
5569}
5570
5571/// The request for
5572/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
5573///
5574/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
5575#[derive(Clone, Default, PartialEq)]
5576#[non_exhaustive]
5577pub struct MoveInstanceRequest {
5578    /// Required. The instance to move.
5579    /// Values are of the form `projects/<project>/instances/<instance>`.
5580    pub name: std::string::String,
5581
5582    /// Required. The target instance configuration where to move the instance.
5583    /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
5584    pub target_config: std::string::String,
5585
5586    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5587}
5588
5589impl MoveInstanceRequest {
5590    pub fn new() -> Self {
5591        std::default::Default::default()
5592    }
5593
5594    /// Sets the value of [name][crate::model::MoveInstanceRequest::name].
5595    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5596        self.name = v.into();
5597        self
5598    }
5599
5600    /// Sets the value of [target_config][crate::model::MoveInstanceRequest::target_config].
5601    pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5602        self.target_config = v.into();
5603        self
5604    }
5605}
5606
5607impl wkt::message::Message for MoveInstanceRequest {
5608    fn typename() -> &'static str {
5609        "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceRequest"
5610    }
5611}
5612
5613/// The response for
5614/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
5615///
5616/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
5617#[derive(Clone, Default, PartialEq)]
5618#[non_exhaustive]
5619pub struct MoveInstanceResponse {
5620    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5621}
5622
5623impl MoveInstanceResponse {
5624    pub fn new() -> Self {
5625        std::default::Default::default()
5626    }
5627}
5628
5629impl wkt::message::Message for MoveInstanceResponse {
5630    fn typename() -> &'static str {
5631        "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceResponse"
5632    }
5633}
5634
5635/// Metadata type for the operation returned by
5636/// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance].
5637///
5638/// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
5639#[derive(Clone, Default, PartialEq)]
5640#[non_exhaustive]
5641pub struct MoveInstanceMetadata {
5642    /// The target instance configuration where to move the instance.
5643    /// Values are of the form `projects/<project>/instanceConfigs/<config>`.
5644    pub target_config: std::string::String,
5645
5646    /// The progress of the
5647    /// [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]
5648    /// operation.
5649    /// [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent]
5650    /// is reset when cancellation is requested.
5651    ///
5652    /// [google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance]: crate::client::InstanceAdmin::move_instance
5653    /// [google.spanner.admin.instance.v1.OperationProgress.progress_percent]: crate::model::OperationProgress::progress_percent
5654    pub progress: std::option::Option<crate::model::OperationProgress>,
5655
5656    /// The time at which this operation was cancelled.
5657    pub cancel_time: std::option::Option<wkt::Timestamp>,
5658
5659    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5660}
5661
5662impl MoveInstanceMetadata {
5663    pub fn new() -> Self {
5664        std::default::Default::default()
5665    }
5666
5667    /// Sets the value of [target_config][crate::model::MoveInstanceMetadata::target_config].
5668    pub fn set_target_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5669        self.target_config = v.into();
5670        self
5671    }
5672
5673    /// Sets the value of [progress][crate::model::MoveInstanceMetadata::progress].
5674    pub fn set_progress<T>(mut self, v: T) -> Self
5675    where
5676        T: std::convert::Into<crate::model::OperationProgress>,
5677    {
5678        self.progress = std::option::Option::Some(v.into());
5679        self
5680    }
5681
5682    /// Sets or clears the value of [progress][crate::model::MoveInstanceMetadata::progress].
5683    pub fn set_or_clear_progress<T>(mut self, v: std::option::Option<T>) -> Self
5684    where
5685        T: std::convert::Into<crate::model::OperationProgress>,
5686    {
5687        self.progress = v.map(|x| x.into());
5688        self
5689    }
5690
5691    /// Sets the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
5692    pub fn set_cancel_time<T>(mut self, v: T) -> Self
5693    where
5694        T: std::convert::Into<wkt::Timestamp>,
5695    {
5696        self.cancel_time = std::option::Option::Some(v.into());
5697        self
5698    }
5699
5700    /// Sets or clears the value of [cancel_time][crate::model::MoveInstanceMetadata::cancel_time].
5701    pub fn set_or_clear_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
5702    where
5703        T: std::convert::Into<wkt::Timestamp>,
5704    {
5705        self.cancel_time = v.map(|x| x.into());
5706        self
5707    }
5708}
5709
5710impl wkt::message::Message for MoveInstanceMetadata {
5711    fn typename() -> &'static str {
5712        "type.googleapis.com/google.spanner.admin.instance.v1.MoveInstanceMetadata"
5713    }
5714}
5715
5716/// Indicates the expected fulfillment period of an operation.
5717///
5718/// # Working with unknown values
5719///
5720/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5721/// additional enum variants at any time. Adding new variants is not considered
5722/// a breaking change. Applications should write their code in anticipation of:
5723///
5724/// - New values appearing in future releases of the client library, **and**
5725/// - New values received dynamically, without application changes.
5726///
5727/// Please consult the [Working with enums] section in the user guide for some
5728/// guidelines.
5729///
5730/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5731#[derive(Clone, Debug, PartialEq)]
5732#[non_exhaustive]
5733pub enum FulfillmentPeriod {
5734    /// Not specified.
5735    Unspecified,
5736    /// Normal fulfillment period. The operation is expected to complete within
5737    /// minutes.
5738    Normal,
5739    /// Extended fulfillment period. It can take up to an hour for the operation
5740    /// to complete.
5741    Extended,
5742    /// If set, the enum was initialized with an unknown value.
5743    ///
5744    /// Applications can examine the value using [FulfillmentPeriod::value] or
5745    /// [FulfillmentPeriod::name].
5746    UnknownValue(fulfillment_period::UnknownValue),
5747}
5748
5749#[doc(hidden)]
5750pub mod fulfillment_period {
5751    #[allow(unused_imports)]
5752    use super::*;
5753    #[derive(Clone, Debug, PartialEq)]
5754    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5755}
5756
5757impl FulfillmentPeriod {
5758    /// Gets the enum value.
5759    ///
5760    /// Returns `None` if the enum contains an unknown value deserialized from
5761    /// the string representation of enums.
5762    pub fn value(&self) -> std::option::Option<i32> {
5763        match self {
5764            Self::Unspecified => std::option::Option::Some(0),
5765            Self::Normal => std::option::Option::Some(1),
5766            Self::Extended => std::option::Option::Some(2),
5767            Self::UnknownValue(u) => u.0.value(),
5768        }
5769    }
5770
5771    /// Gets the enum value as a string.
5772    ///
5773    /// Returns `None` if the enum contains an unknown value deserialized from
5774    /// the integer representation of enums.
5775    pub fn name(&self) -> std::option::Option<&str> {
5776        match self {
5777            Self::Unspecified => std::option::Option::Some("FULFILLMENT_PERIOD_UNSPECIFIED"),
5778            Self::Normal => std::option::Option::Some("FULFILLMENT_PERIOD_NORMAL"),
5779            Self::Extended => std::option::Option::Some("FULFILLMENT_PERIOD_EXTENDED"),
5780            Self::UnknownValue(u) => u.0.name(),
5781        }
5782    }
5783}
5784
5785impl std::default::Default for FulfillmentPeriod {
5786    fn default() -> Self {
5787        use std::convert::From;
5788        Self::from(0)
5789    }
5790}
5791
5792impl std::fmt::Display for FulfillmentPeriod {
5793    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5794        wkt::internal::display_enum(f, self.name(), self.value())
5795    }
5796}
5797
5798impl std::convert::From<i32> for FulfillmentPeriod {
5799    fn from(value: i32) -> Self {
5800        match value {
5801            0 => Self::Unspecified,
5802            1 => Self::Normal,
5803            2 => Self::Extended,
5804            _ => Self::UnknownValue(fulfillment_period::UnknownValue(
5805                wkt::internal::UnknownEnumValue::Integer(value),
5806            )),
5807        }
5808    }
5809}
5810
5811impl std::convert::From<&str> for FulfillmentPeriod {
5812    fn from(value: &str) -> Self {
5813        use std::string::ToString;
5814        match value {
5815            "FULFILLMENT_PERIOD_UNSPECIFIED" => Self::Unspecified,
5816            "FULFILLMENT_PERIOD_NORMAL" => Self::Normal,
5817            "FULFILLMENT_PERIOD_EXTENDED" => Self::Extended,
5818            _ => Self::UnknownValue(fulfillment_period::UnknownValue(
5819                wkt::internal::UnknownEnumValue::String(value.to_string()),
5820            )),
5821        }
5822    }
5823}
5824
5825impl serde::ser::Serialize for FulfillmentPeriod {
5826    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5827    where
5828        S: serde::Serializer,
5829    {
5830        match self {
5831            Self::Unspecified => serializer.serialize_i32(0),
5832            Self::Normal => serializer.serialize_i32(1),
5833            Self::Extended => serializer.serialize_i32(2),
5834            Self::UnknownValue(u) => u.0.serialize(serializer),
5835        }
5836    }
5837}
5838
5839impl<'de> serde::de::Deserialize<'de> for FulfillmentPeriod {
5840    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5841    where
5842        D: serde::Deserializer<'de>,
5843    {
5844        deserializer.deserialize_any(wkt::internal::EnumVisitor::<FulfillmentPeriod>::new(
5845            ".google.spanner.admin.instance.v1.FulfillmentPeriod",
5846        ))
5847    }
5848}