google_cloud_redis_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 gtype;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37/// Node specific properties.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct NodeInfo {
41    /// Output only. Node identifying string. e.g. 'node-0', 'node-1'
42    pub id: std::string::String,
43
44    /// Output only. Location of the node.
45    pub zone: std::string::String,
46
47    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
48}
49
50impl NodeInfo {
51    pub fn new() -> Self {
52        std::default::Default::default()
53    }
54
55    /// Sets the value of [id][crate::model::NodeInfo::id].
56    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
57        self.id = v.into();
58        self
59    }
60
61    /// Sets the value of [zone][crate::model::NodeInfo::zone].
62    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
63        self.zone = v.into();
64        self
65    }
66}
67
68impl wkt::message::Message for NodeInfo {
69    fn typename() -> &'static str {
70        "type.googleapis.com/google.cloud.redis.v1.NodeInfo"
71    }
72}
73
74#[doc(hidden)]
75impl<'de> serde::de::Deserialize<'de> for NodeInfo {
76    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
77    where
78        D: serde::Deserializer<'de>,
79    {
80        #[allow(non_camel_case_types)]
81        #[doc(hidden)]
82        #[derive(PartialEq, Eq, Hash)]
83        enum __FieldTag {
84            __id,
85            __zone,
86            Unknown(std::string::String),
87        }
88        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
89            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
90            where
91                D: serde::Deserializer<'de>,
92            {
93                struct Visitor;
94                impl<'de> serde::de::Visitor<'de> for Visitor {
95                    type Value = __FieldTag;
96                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
97                        formatter.write_str("a field name for NodeInfo")
98                    }
99                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
100                    where
101                        E: serde::de::Error,
102                    {
103                        use std::result::Result::Ok;
104                        use std::string::ToString;
105                        match value {
106                            "id" => Ok(__FieldTag::__id),
107                            "zone" => Ok(__FieldTag::__zone),
108                            _ => Ok(__FieldTag::Unknown(value.to_string())),
109                        }
110                    }
111                }
112                deserializer.deserialize_identifier(Visitor)
113            }
114        }
115        struct Visitor;
116        impl<'de> serde::de::Visitor<'de> for Visitor {
117            type Value = NodeInfo;
118            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
119                formatter.write_str("struct NodeInfo")
120            }
121            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
122            where
123                A: serde::de::MapAccess<'de>,
124            {
125                #[allow(unused_imports)]
126                use serde::de::Error;
127                use std::option::Option::Some;
128                let mut fields = std::collections::HashSet::new();
129                let mut result = Self::Value::new();
130                while let Some(tag) = map.next_key::<__FieldTag>()? {
131                    #[allow(clippy::match_single_binding)]
132                    match tag {
133                        __FieldTag::__id => {
134                            if !fields.insert(__FieldTag::__id) {
135                                return std::result::Result::Err(A::Error::duplicate_field(
136                                    "multiple values for id",
137                                ));
138                            }
139                            result.id = map
140                                .next_value::<std::option::Option<std::string::String>>()?
141                                .unwrap_or_default();
142                        }
143                        __FieldTag::__zone => {
144                            if !fields.insert(__FieldTag::__zone) {
145                                return std::result::Result::Err(A::Error::duplicate_field(
146                                    "multiple values for zone",
147                                ));
148                            }
149                            result.zone = map
150                                .next_value::<std::option::Option<std::string::String>>()?
151                                .unwrap_or_default();
152                        }
153                        __FieldTag::Unknown(key) => {
154                            let value = map.next_value::<serde_json::Value>()?;
155                            result._unknown_fields.insert(key, value);
156                        }
157                    }
158                }
159                std::result::Result::Ok(result)
160            }
161        }
162        deserializer.deserialize_any(Visitor)
163    }
164}
165
166#[doc(hidden)]
167impl serde::ser::Serialize for NodeInfo {
168    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
169    where
170        S: serde::ser::Serializer,
171    {
172        use serde::ser::SerializeMap;
173        #[allow(unused_imports)]
174        use std::option::Option::Some;
175        let mut state = serializer.serialize_map(std::option::Option::None)?;
176        if !self.id.is_empty() {
177            state.serialize_entry("id", &self.id)?;
178        }
179        if !self.zone.is_empty() {
180            state.serialize_entry("zone", &self.zone)?;
181        }
182        if !self._unknown_fields.is_empty() {
183            for (key, value) in self._unknown_fields.iter() {
184                state.serialize_entry(key, &value)?;
185            }
186        }
187        state.end()
188    }
189}
190
191impl std::fmt::Debug for NodeInfo {
192    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
193        let mut debug_struct = f.debug_struct("NodeInfo");
194        debug_struct.field("id", &self.id);
195        debug_struct.field("zone", &self.zone);
196        if !self._unknown_fields.is_empty() {
197            debug_struct.field("_unknown_fields", &self._unknown_fields);
198        }
199        debug_struct.finish()
200    }
201}
202
203/// A Memorystore for Redis instance.
204#[derive(Clone, Default, PartialEq)]
205#[non_exhaustive]
206pub struct Instance {
207    /// Required. Unique name of the resource in this scope including project and
208    /// location using the form:
209    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
210    ///
211    /// Note: Redis instances are managed and addressed at regional level so
212    /// location_id here refers to a GCP region; however, users may choose which
213    /// specific zone (or collection of zones for cross-zone instances) an instance
214    /// should be provisioned in. Refer to
215    /// [location_id][google.cloud.redis.v1.Instance.location_id] and
216    /// [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id]
217    /// fields for more details.
218    ///
219    /// [google.cloud.redis.v1.Instance.alternative_location_id]: crate::model::Instance::alternative_location_id
220    /// [google.cloud.redis.v1.Instance.location_id]: crate::model::Instance::location_id
221    pub name: std::string::String,
222
223    /// An arbitrary and optional user-provided name for the instance.
224    pub display_name: std::string::String,
225
226    /// Resource labels to represent user provided metadata
227    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
228
229    /// Optional. The zone where the instance will be provisioned. If not provided,
230    /// the service will choose a zone from the specified region for the instance.
231    /// For standard tier, additional nodes will be added across multiple zones for
232    /// protection against zonal failures. If specified, at least one node will be
233    /// provisioned in this zone.
234    pub location_id: std::string::String,
235
236    /// Optional. If specified, at least one node will be provisioned in this zone
237    /// in addition to the zone specified in location_id. Only applicable to
238    /// standard tier. If provided, it must be a different zone from the one
239    /// provided in [location_id]. Additional nodes beyond the first 2 will be
240    /// placed in zones selected by the service.
241    pub alternative_location_id: std::string::String,
242
243    /// Optional. The version of Redis software.
244    /// If not provided, latest supported version will be used. Currently, the
245    /// supported values are:
246    ///
247    /// * `REDIS_3_2` for Redis 3.2 compatibility
248    /// * `REDIS_4_0` for Redis 4.0 compatibility (default)
249    /// * `REDIS_5_0` for Redis 5.0 compatibility
250    /// * `REDIS_6_X` for Redis 6.x compatibility
251    pub redis_version: std::string::String,
252
253    /// Optional. For DIRECT_PEERING mode, the CIDR range of internal addresses
254    /// that are reserved for this instance. Range must
255    /// be unique and non-overlapping with existing subnets in an authorized
256    /// network. For PRIVATE_SERVICE_ACCESS mode, the name of one allocated IP
257    /// address ranges associated with this private service access connection.
258    /// If not provided, the service will choose an unused /29 block, for
259    /// example, 10.0.0.0/29 or 192.168.0.0/29.  For READ_REPLICAS_ENABLED
260    /// the default block size is /28.
261    pub reserved_ip_range: std::string::String,
262
263    /// Optional. Additional IP range for node placement. Required when enabling
264    /// read replicas on an existing instance. For DIRECT_PEERING mode value must
265    /// be a CIDR range of size /28, or "auto". For PRIVATE_SERVICE_ACCESS mode
266    /// value must be the name of an allocated address range associated with the
267    /// private service access connection, or "auto".
268    pub secondary_ip_range: std::string::String,
269
270    /// Output only. Hostname or IP address of the exposed Redis endpoint used by
271    /// clients to connect to the service.
272    pub host: std::string::String,
273
274    /// Output only. The port number of the exposed Redis endpoint.
275    pub port: i32,
276
277    /// Output only. The current zone where the Redis primary node is located. In
278    /// basic tier, this will always be the same as [location_id]. In
279    /// standard tier, this can be the zone of any node in the instance.
280    pub current_location_id: std::string::String,
281
282    /// Output only. The time the instance was created.
283    pub create_time: std::option::Option<wkt::Timestamp>,
284
285    /// Output only. The current state of this instance.
286    pub state: crate::model::instance::State,
287
288    /// Output only. Additional information about the current status of this
289    /// instance, if available.
290    pub status_message: std::string::String,
291
292    /// Optional. Redis configuration parameters, according to
293    /// <http://redis.io/topics/config>. Currently, the only supported parameters
294    /// are:
295    ///
296    /// Redis version 3.2 and newer:
297    ///
298    /// * maxmemory-policy
299    /// * notify-keyspace-events
300    ///
301    /// Redis version 4.0 and newer:
302    ///
303    /// * activedefrag
304    /// * lfu-decay-time
305    /// * lfu-log-factor
306    /// * maxmemory-gb
307    ///
308    /// Redis version 5.0 and newer:
309    ///
310    /// * stream-node-max-bytes
311    /// * stream-node-max-entries
312    pub redis_configs: std::collections::HashMap<std::string::String, std::string::String>,
313
314    /// Required. The service tier of the instance.
315    pub tier: crate::model::instance::Tier,
316
317    /// Required. Redis memory size in GiB.
318    pub memory_size_gb: i32,
319
320    /// Optional. The full name of the Google Compute Engine
321    /// [network](https://cloud.google.com/vpc/docs/vpc) to which the
322    /// instance is connected. If left unspecified, the `default` network
323    /// will be used.
324    pub authorized_network: std::string::String,
325
326    /// Output only. Cloud IAM identity used by import / export operations to
327    /// transfer data to/from Cloud Storage. Format is
328    /// "serviceAccount:<service_account_email>". The value may change over time
329    /// for a given instance so should be checked before each import/export
330    /// operation.
331    pub persistence_iam_identity: std::string::String,
332
333    /// Optional. The network connect mode of the Redis instance.
334    /// If not provided, the connect mode defaults to DIRECT_PEERING.
335    pub connect_mode: crate::model::instance::ConnectMode,
336
337    /// Optional. Indicates whether OSS Redis AUTH is enabled for the instance. If
338    /// set to "true" AUTH is enabled on the instance. Default value is "false"
339    /// meaning AUTH is disabled.
340    pub auth_enabled: bool,
341
342    /// Output only. List of server CA certificates for the instance.
343    pub server_ca_certs: std::vec::Vec<crate::model::TlsCertificate>,
344
345    /// Optional. The TLS mode of the Redis instance.
346    /// If not provided, TLS is disabled for the instance.
347    pub transit_encryption_mode: crate::model::instance::TransitEncryptionMode,
348
349    /// Optional. The maintenance policy for the instance. If not provided,
350    /// maintenance events can be performed at any time.
351    pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
352
353    /// Output only. Date and time of upcoming maintenance events which have been
354    /// scheduled.
355    pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
356
357    /// Optional. The number of replica nodes. The valid range for the Standard
358    /// Tier with read replicas enabled is [1-5] and defaults to 2. If read
359    /// replicas are not enabled for a Standard Tier instance, the only valid value
360    /// is 1 and the default is 1. The valid value for basic tier is 0 and the
361    /// default is also 0.
362    pub replica_count: i32,
363
364    /// Output only. Info per node.
365    pub nodes: std::vec::Vec<crate::model::NodeInfo>,
366
367    /// Output only. Hostname or IP address of the exposed readonly Redis
368    /// endpoint. Standard tier only. Targets all healthy replica nodes in
369    /// instance. Replication is asynchronous and replica nodes will exhibit some
370    /// lag behind the primary. Write requests must target 'host'.
371    pub read_endpoint: std::string::String,
372
373    /// Output only. The port number of the exposed readonly redis
374    /// endpoint. Standard tier only. Write requests should target 'port'.
375    pub read_endpoint_port: i32,
376
377    /// Optional. Read replicas mode for the instance. Defaults to
378    /// READ_REPLICAS_DISABLED.
379    pub read_replicas_mode: crate::model::instance::ReadReplicasMode,
380
381    /// Optional. The KMS key reference that the customer provides when trying to
382    /// create the instance.
383    pub customer_managed_key: std::string::String,
384
385    /// Optional. Persistence configuration parameters
386    pub persistence_config: std::option::Option<crate::model::PersistenceConfig>,
387
388    /// Optional. reasons that causes instance in "SUSPENDED" state.
389    pub suspension_reasons: std::vec::Vec<crate::model::instance::SuspensionReason>,
390
391    /// Optional. The self service update maintenance version.
392    /// The version is date based such as "20210712_00_00".
393    pub maintenance_version: std::string::String,
394
395    /// Optional. The available maintenance versions that an instance could update
396    /// to.
397    pub available_maintenance_versions: std::vec::Vec<std::string::String>,
398
399    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
400}
401
402impl Instance {
403    pub fn new() -> Self {
404        std::default::Default::default()
405    }
406
407    /// Sets the value of [name][crate::model::Instance::name].
408    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
409        self.name = v.into();
410        self
411    }
412
413    /// Sets the value of [display_name][crate::model::Instance::display_name].
414    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
415        self.display_name = v.into();
416        self
417    }
418
419    /// Sets the value of [labels][crate::model::Instance::labels].
420    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
421    where
422        T: std::iter::IntoIterator<Item = (K, V)>,
423        K: std::convert::Into<std::string::String>,
424        V: std::convert::Into<std::string::String>,
425    {
426        use std::iter::Iterator;
427        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
428        self
429    }
430
431    /// Sets the value of [location_id][crate::model::Instance::location_id].
432    pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433        self.location_id = v.into();
434        self
435    }
436
437    /// Sets the value of [alternative_location_id][crate::model::Instance::alternative_location_id].
438    pub fn set_alternative_location_id<T: std::convert::Into<std::string::String>>(
439        mut self,
440        v: T,
441    ) -> Self {
442        self.alternative_location_id = v.into();
443        self
444    }
445
446    /// Sets the value of [redis_version][crate::model::Instance::redis_version].
447    pub fn set_redis_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
448        self.redis_version = v.into();
449        self
450    }
451
452    /// Sets the value of [reserved_ip_range][crate::model::Instance::reserved_ip_range].
453    pub fn set_reserved_ip_range<T: std::convert::Into<std::string::String>>(
454        mut self,
455        v: T,
456    ) -> Self {
457        self.reserved_ip_range = v.into();
458        self
459    }
460
461    /// Sets the value of [secondary_ip_range][crate::model::Instance::secondary_ip_range].
462    pub fn set_secondary_ip_range<T: std::convert::Into<std::string::String>>(
463        mut self,
464        v: T,
465    ) -> Self {
466        self.secondary_ip_range = v.into();
467        self
468    }
469
470    /// Sets the value of [host][crate::model::Instance::host].
471    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
472        self.host = v.into();
473        self
474    }
475
476    /// Sets the value of [port][crate::model::Instance::port].
477    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
478        self.port = v.into();
479        self
480    }
481
482    /// Sets the value of [current_location_id][crate::model::Instance::current_location_id].
483    pub fn set_current_location_id<T: std::convert::Into<std::string::String>>(
484        mut self,
485        v: T,
486    ) -> Self {
487        self.current_location_id = v.into();
488        self
489    }
490
491    /// Sets the value of [create_time][crate::model::Instance::create_time].
492    pub fn set_create_time<T>(mut self, v: T) -> Self
493    where
494        T: std::convert::Into<wkt::Timestamp>,
495    {
496        self.create_time = std::option::Option::Some(v.into());
497        self
498    }
499
500    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
501    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
502    where
503        T: std::convert::Into<wkt::Timestamp>,
504    {
505        self.create_time = v.map(|x| x.into());
506        self
507    }
508
509    /// Sets the value of [state][crate::model::Instance::state].
510    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
511        self.state = v.into();
512        self
513    }
514
515    /// Sets the value of [status_message][crate::model::Instance::status_message].
516    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
517        self.status_message = v.into();
518        self
519    }
520
521    /// Sets the value of [redis_configs][crate::model::Instance::redis_configs].
522    pub fn set_redis_configs<T, K, V>(mut self, v: T) -> Self
523    where
524        T: std::iter::IntoIterator<Item = (K, V)>,
525        K: std::convert::Into<std::string::String>,
526        V: std::convert::Into<std::string::String>,
527    {
528        use std::iter::Iterator;
529        self.redis_configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
530        self
531    }
532
533    /// Sets the value of [tier][crate::model::Instance::tier].
534    pub fn set_tier<T: std::convert::Into<crate::model::instance::Tier>>(mut self, v: T) -> Self {
535        self.tier = v.into();
536        self
537    }
538
539    /// Sets the value of [memory_size_gb][crate::model::Instance::memory_size_gb].
540    pub fn set_memory_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
541        self.memory_size_gb = v.into();
542        self
543    }
544
545    /// Sets the value of [authorized_network][crate::model::Instance::authorized_network].
546    pub fn set_authorized_network<T: std::convert::Into<std::string::String>>(
547        mut self,
548        v: T,
549    ) -> Self {
550        self.authorized_network = v.into();
551        self
552    }
553
554    /// Sets the value of [persistence_iam_identity][crate::model::Instance::persistence_iam_identity].
555    pub fn set_persistence_iam_identity<T: std::convert::Into<std::string::String>>(
556        mut self,
557        v: T,
558    ) -> Self {
559        self.persistence_iam_identity = v.into();
560        self
561    }
562
563    /// Sets the value of [connect_mode][crate::model::Instance::connect_mode].
564    pub fn set_connect_mode<T: std::convert::Into<crate::model::instance::ConnectMode>>(
565        mut self,
566        v: T,
567    ) -> Self {
568        self.connect_mode = v.into();
569        self
570    }
571
572    /// Sets the value of [auth_enabled][crate::model::Instance::auth_enabled].
573    pub fn set_auth_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
574        self.auth_enabled = v.into();
575        self
576    }
577
578    /// Sets the value of [server_ca_certs][crate::model::Instance::server_ca_certs].
579    pub fn set_server_ca_certs<T, V>(mut self, v: T) -> Self
580    where
581        T: std::iter::IntoIterator<Item = V>,
582        V: std::convert::Into<crate::model::TlsCertificate>,
583    {
584        use std::iter::Iterator;
585        self.server_ca_certs = v.into_iter().map(|i| i.into()).collect();
586        self
587    }
588
589    /// Sets the value of [transit_encryption_mode][crate::model::Instance::transit_encryption_mode].
590    pub fn set_transit_encryption_mode<
591        T: std::convert::Into<crate::model::instance::TransitEncryptionMode>,
592    >(
593        mut self,
594        v: T,
595    ) -> Self {
596        self.transit_encryption_mode = v.into();
597        self
598    }
599
600    /// Sets the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
601    pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
602    where
603        T: std::convert::Into<crate::model::MaintenancePolicy>,
604    {
605        self.maintenance_policy = std::option::Option::Some(v.into());
606        self
607    }
608
609    /// Sets or clears the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
610    pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
611    where
612        T: std::convert::Into<crate::model::MaintenancePolicy>,
613    {
614        self.maintenance_policy = v.map(|x| x.into());
615        self
616    }
617
618    /// Sets the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
619    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
620    where
621        T: std::convert::Into<crate::model::MaintenanceSchedule>,
622    {
623        self.maintenance_schedule = std::option::Option::Some(v.into());
624        self
625    }
626
627    /// Sets or clears the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
628    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
629    where
630        T: std::convert::Into<crate::model::MaintenanceSchedule>,
631    {
632        self.maintenance_schedule = v.map(|x| x.into());
633        self
634    }
635
636    /// Sets the value of [replica_count][crate::model::Instance::replica_count].
637    pub fn set_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
638        self.replica_count = v.into();
639        self
640    }
641
642    /// Sets the value of [nodes][crate::model::Instance::nodes].
643    pub fn set_nodes<T, V>(mut self, v: T) -> Self
644    where
645        T: std::iter::IntoIterator<Item = V>,
646        V: std::convert::Into<crate::model::NodeInfo>,
647    {
648        use std::iter::Iterator;
649        self.nodes = v.into_iter().map(|i| i.into()).collect();
650        self
651    }
652
653    /// Sets the value of [read_endpoint][crate::model::Instance::read_endpoint].
654    pub fn set_read_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
655        self.read_endpoint = v.into();
656        self
657    }
658
659    /// Sets the value of [read_endpoint_port][crate::model::Instance::read_endpoint_port].
660    pub fn set_read_endpoint_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
661        self.read_endpoint_port = v.into();
662        self
663    }
664
665    /// Sets the value of [read_replicas_mode][crate::model::Instance::read_replicas_mode].
666    pub fn set_read_replicas_mode<
667        T: std::convert::Into<crate::model::instance::ReadReplicasMode>,
668    >(
669        mut self,
670        v: T,
671    ) -> Self {
672        self.read_replicas_mode = v.into();
673        self
674    }
675
676    /// Sets the value of [customer_managed_key][crate::model::Instance::customer_managed_key].
677    pub fn set_customer_managed_key<T: std::convert::Into<std::string::String>>(
678        mut self,
679        v: T,
680    ) -> Self {
681        self.customer_managed_key = v.into();
682        self
683    }
684
685    /// Sets the value of [persistence_config][crate::model::Instance::persistence_config].
686    pub fn set_persistence_config<T>(mut self, v: T) -> Self
687    where
688        T: std::convert::Into<crate::model::PersistenceConfig>,
689    {
690        self.persistence_config = std::option::Option::Some(v.into());
691        self
692    }
693
694    /// Sets or clears the value of [persistence_config][crate::model::Instance::persistence_config].
695    pub fn set_or_clear_persistence_config<T>(mut self, v: std::option::Option<T>) -> Self
696    where
697        T: std::convert::Into<crate::model::PersistenceConfig>,
698    {
699        self.persistence_config = v.map(|x| x.into());
700        self
701    }
702
703    /// Sets the value of [suspension_reasons][crate::model::Instance::suspension_reasons].
704    pub fn set_suspension_reasons<T, V>(mut self, v: T) -> Self
705    where
706        T: std::iter::IntoIterator<Item = V>,
707        V: std::convert::Into<crate::model::instance::SuspensionReason>,
708    {
709        use std::iter::Iterator;
710        self.suspension_reasons = v.into_iter().map(|i| i.into()).collect();
711        self
712    }
713
714    /// Sets the value of [maintenance_version][crate::model::Instance::maintenance_version].
715    pub fn set_maintenance_version<T: std::convert::Into<std::string::String>>(
716        mut self,
717        v: T,
718    ) -> Self {
719        self.maintenance_version = v.into();
720        self
721    }
722
723    /// Sets the value of [available_maintenance_versions][crate::model::Instance::available_maintenance_versions].
724    pub fn set_available_maintenance_versions<T, V>(mut self, v: T) -> Self
725    where
726        T: std::iter::IntoIterator<Item = V>,
727        V: std::convert::Into<std::string::String>,
728    {
729        use std::iter::Iterator;
730        self.available_maintenance_versions = v.into_iter().map(|i| i.into()).collect();
731        self
732    }
733}
734
735impl wkt::message::Message for Instance {
736    fn typename() -> &'static str {
737        "type.googleapis.com/google.cloud.redis.v1.Instance"
738    }
739}
740
741#[doc(hidden)]
742impl<'de> serde::de::Deserialize<'de> for Instance {
743    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
744    where
745        D: serde::Deserializer<'de>,
746    {
747        #[allow(non_camel_case_types)]
748        #[doc(hidden)]
749        #[derive(PartialEq, Eq, Hash)]
750        enum __FieldTag {
751            __name,
752            __display_name,
753            __labels,
754            __location_id,
755            __alternative_location_id,
756            __redis_version,
757            __reserved_ip_range,
758            __secondary_ip_range,
759            __host,
760            __port,
761            __current_location_id,
762            __create_time,
763            __state,
764            __status_message,
765            __redis_configs,
766            __tier,
767            __memory_size_gb,
768            __authorized_network,
769            __persistence_iam_identity,
770            __connect_mode,
771            __auth_enabled,
772            __server_ca_certs,
773            __transit_encryption_mode,
774            __maintenance_policy,
775            __maintenance_schedule,
776            __replica_count,
777            __nodes,
778            __read_endpoint,
779            __read_endpoint_port,
780            __read_replicas_mode,
781            __customer_managed_key,
782            __persistence_config,
783            __suspension_reasons,
784            __maintenance_version,
785            __available_maintenance_versions,
786            Unknown(std::string::String),
787        }
788        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
789            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
790            where
791                D: serde::Deserializer<'de>,
792            {
793                struct Visitor;
794                impl<'de> serde::de::Visitor<'de> for Visitor {
795                    type Value = __FieldTag;
796                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
797                        formatter.write_str("a field name for Instance")
798                    }
799                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
800                    where
801                        E: serde::de::Error,
802                    {
803                        use std::result::Result::Ok;
804                        use std::string::ToString;
805                        match value {
806                            "name" => Ok(__FieldTag::__name),
807                            "displayName" => Ok(__FieldTag::__display_name),
808                            "display_name" => Ok(__FieldTag::__display_name),
809                            "labels" => Ok(__FieldTag::__labels),
810                            "locationId" => Ok(__FieldTag::__location_id),
811                            "location_id" => Ok(__FieldTag::__location_id),
812                            "alternativeLocationId" => Ok(__FieldTag::__alternative_location_id),
813                            "alternative_location_id" => Ok(__FieldTag::__alternative_location_id),
814                            "redisVersion" => Ok(__FieldTag::__redis_version),
815                            "redis_version" => Ok(__FieldTag::__redis_version),
816                            "reservedIpRange" => Ok(__FieldTag::__reserved_ip_range),
817                            "reserved_ip_range" => Ok(__FieldTag::__reserved_ip_range),
818                            "secondaryIpRange" => Ok(__FieldTag::__secondary_ip_range),
819                            "secondary_ip_range" => Ok(__FieldTag::__secondary_ip_range),
820                            "host" => Ok(__FieldTag::__host),
821                            "port" => Ok(__FieldTag::__port),
822                            "currentLocationId" => Ok(__FieldTag::__current_location_id),
823                            "current_location_id" => Ok(__FieldTag::__current_location_id),
824                            "createTime" => Ok(__FieldTag::__create_time),
825                            "create_time" => Ok(__FieldTag::__create_time),
826                            "state" => Ok(__FieldTag::__state),
827                            "statusMessage" => Ok(__FieldTag::__status_message),
828                            "status_message" => Ok(__FieldTag::__status_message),
829                            "redisConfigs" => Ok(__FieldTag::__redis_configs),
830                            "redis_configs" => Ok(__FieldTag::__redis_configs),
831                            "tier" => Ok(__FieldTag::__tier),
832                            "memorySizeGb" => Ok(__FieldTag::__memory_size_gb),
833                            "memory_size_gb" => Ok(__FieldTag::__memory_size_gb),
834                            "authorizedNetwork" => Ok(__FieldTag::__authorized_network),
835                            "authorized_network" => Ok(__FieldTag::__authorized_network),
836                            "persistenceIamIdentity" => Ok(__FieldTag::__persistence_iam_identity),
837                            "persistence_iam_identity" => {
838                                Ok(__FieldTag::__persistence_iam_identity)
839                            }
840                            "connectMode" => Ok(__FieldTag::__connect_mode),
841                            "connect_mode" => Ok(__FieldTag::__connect_mode),
842                            "authEnabled" => Ok(__FieldTag::__auth_enabled),
843                            "auth_enabled" => Ok(__FieldTag::__auth_enabled),
844                            "serverCaCerts" => Ok(__FieldTag::__server_ca_certs),
845                            "server_ca_certs" => Ok(__FieldTag::__server_ca_certs),
846                            "transitEncryptionMode" => Ok(__FieldTag::__transit_encryption_mode),
847                            "transit_encryption_mode" => Ok(__FieldTag::__transit_encryption_mode),
848                            "maintenancePolicy" => Ok(__FieldTag::__maintenance_policy),
849                            "maintenance_policy" => Ok(__FieldTag::__maintenance_policy),
850                            "maintenanceSchedule" => Ok(__FieldTag::__maintenance_schedule),
851                            "maintenance_schedule" => Ok(__FieldTag::__maintenance_schedule),
852                            "replicaCount" => Ok(__FieldTag::__replica_count),
853                            "replica_count" => Ok(__FieldTag::__replica_count),
854                            "nodes" => Ok(__FieldTag::__nodes),
855                            "readEndpoint" => Ok(__FieldTag::__read_endpoint),
856                            "read_endpoint" => Ok(__FieldTag::__read_endpoint),
857                            "readEndpointPort" => Ok(__FieldTag::__read_endpoint_port),
858                            "read_endpoint_port" => Ok(__FieldTag::__read_endpoint_port),
859                            "readReplicasMode" => Ok(__FieldTag::__read_replicas_mode),
860                            "read_replicas_mode" => Ok(__FieldTag::__read_replicas_mode),
861                            "customerManagedKey" => Ok(__FieldTag::__customer_managed_key),
862                            "customer_managed_key" => Ok(__FieldTag::__customer_managed_key),
863                            "persistenceConfig" => Ok(__FieldTag::__persistence_config),
864                            "persistence_config" => Ok(__FieldTag::__persistence_config),
865                            "suspensionReasons" => Ok(__FieldTag::__suspension_reasons),
866                            "suspension_reasons" => Ok(__FieldTag::__suspension_reasons),
867                            "maintenanceVersion" => Ok(__FieldTag::__maintenance_version),
868                            "maintenance_version" => Ok(__FieldTag::__maintenance_version),
869                            "availableMaintenanceVersions" => {
870                                Ok(__FieldTag::__available_maintenance_versions)
871                            }
872                            "available_maintenance_versions" => {
873                                Ok(__FieldTag::__available_maintenance_versions)
874                            }
875                            _ => Ok(__FieldTag::Unknown(value.to_string())),
876                        }
877                    }
878                }
879                deserializer.deserialize_identifier(Visitor)
880            }
881        }
882        struct Visitor;
883        impl<'de> serde::de::Visitor<'de> for Visitor {
884            type Value = Instance;
885            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
886                formatter.write_str("struct Instance")
887            }
888            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
889            where
890                A: serde::de::MapAccess<'de>,
891            {
892                #[allow(unused_imports)]
893                use serde::de::Error;
894                use std::option::Option::Some;
895                let mut fields = std::collections::HashSet::new();
896                let mut result = Self::Value::new();
897                while let Some(tag) = map.next_key::<__FieldTag>()? {
898                    #[allow(clippy::match_single_binding)]
899                    match tag {
900                        __FieldTag::__name => {
901                            if !fields.insert(__FieldTag::__name) {
902                                return std::result::Result::Err(A::Error::duplicate_field(
903                                    "multiple values for name",
904                                ));
905                            }
906                            result.name = map
907                                .next_value::<std::option::Option<std::string::String>>()?
908                                .unwrap_or_default();
909                        }
910                        __FieldTag::__display_name => {
911                            if !fields.insert(__FieldTag::__display_name) {
912                                return std::result::Result::Err(A::Error::duplicate_field(
913                                    "multiple values for display_name",
914                                ));
915                            }
916                            result.display_name = map
917                                .next_value::<std::option::Option<std::string::String>>()?
918                                .unwrap_or_default();
919                        }
920                        __FieldTag::__labels => {
921                            if !fields.insert(__FieldTag::__labels) {
922                                return std::result::Result::Err(A::Error::duplicate_field(
923                                    "multiple values for labels",
924                                ));
925                            }
926                            result.labels = map
927                                .next_value::<std::option::Option<
928                                    std::collections::HashMap<
929                                        std::string::String,
930                                        std::string::String,
931                                    >,
932                                >>()?
933                                .unwrap_or_default();
934                        }
935                        __FieldTag::__location_id => {
936                            if !fields.insert(__FieldTag::__location_id) {
937                                return std::result::Result::Err(A::Error::duplicate_field(
938                                    "multiple values for location_id",
939                                ));
940                            }
941                            result.location_id = map
942                                .next_value::<std::option::Option<std::string::String>>()?
943                                .unwrap_or_default();
944                        }
945                        __FieldTag::__alternative_location_id => {
946                            if !fields.insert(__FieldTag::__alternative_location_id) {
947                                return std::result::Result::Err(A::Error::duplicate_field(
948                                    "multiple values for alternative_location_id",
949                                ));
950                            }
951                            result.alternative_location_id = map
952                                .next_value::<std::option::Option<std::string::String>>()?
953                                .unwrap_or_default();
954                        }
955                        __FieldTag::__redis_version => {
956                            if !fields.insert(__FieldTag::__redis_version) {
957                                return std::result::Result::Err(A::Error::duplicate_field(
958                                    "multiple values for redis_version",
959                                ));
960                            }
961                            result.redis_version = map
962                                .next_value::<std::option::Option<std::string::String>>()?
963                                .unwrap_or_default();
964                        }
965                        __FieldTag::__reserved_ip_range => {
966                            if !fields.insert(__FieldTag::__reserved_ip_range) {
967                                return std::result::Result::Err(A::Error::duplicate_field(
968                                    "multiple values for reserved_ip_range",
969                                ));
970                            }
971                            result.reserved_ip_range = map
972                                .next_value::<std::option::Option<std::string::String>>()?
973                                .unwrap_or_default();
974                        }
975                        __FieldTag::__secondary_ip_range => {
976                            if !fields.insert(__FieldTag::__secondary_ip_range) {
977                                return std::result::Result::Err(A::Error::duplicate_field(
978                                    "multiple values for secondary_ip_range",
979                                ));
980                            }
981                            result.secondary_ip_range = map
982                                .next_value::<std::option::Option<std::string::String>>()?
983                                .unwrap_or_default();
984                        }
985                        __FieldTag::__host => {
986                            if !fields.insert(__FieldTag::__host) {
987                                return std::result::Result::Err(A::Error::duplicate_field(
988                                    "multiple values for host",
989                                ));
990                            }
991                            result.host = map
992                                .next_value::<std::option::Option<std::string::String>>()?
993                                .unwrap_or_default();
994                        }
995                        __FieldTag::__port => {
996                            if !fields.insert(__FieldTag::__port) {
997                                return std::result::Result::Err(A::Error::duplicate_field(
998                                    "multiple values for port",
999                                ));
1000                            }
1001                            struct __With(std::option::Option<i32>);
1002                            impl<'de> serde::de::Deserialize<'de> for __With {
1003                                fn deserialize<D>(
1004                                    deserializer: D,
1005                                ) -> std::result::Result<Self, D::Error>
1006                                where
1007                                    D: serde::de::Deserializer<'de>,
1008                                {
1009                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1010                                }
1011                            }
1012                            result.port = map.next_value::<__With>()?.0.unwrap_or_default();
1013                        }
1014                        __FieldTag::__current_location_id => {
1015                            if !fields.insert(__FieldTag::__current_location_id) {
1016                                return std::result::Result::Err(A::Error::duplicate_field(
1017                                    "multiple values for current_location_id",
1018                                ));
1019                            }
1020                            result.current_location_id = map
1021                                .next_value::<std::option::Option<std::string::String>>()?
1022                                .unwrap_or_default();
1023                        }
1024                        __FieldTag::__create_time => {
1025                            if !fields.insert(__FieldTag::__create_time) {
1026                                return std::result::Result::Err(A::Error::duplicate_field(
1027                                    "multiple values for create_time",
1028                                ));
1029                            }
1030                            result.create_time =
1031                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
1032                        }
1033                        __FieldTag::__state => {
1034                            if !fields.insert(__FieldTag::__state) {
1035                                return std::result::Result::Err(A::Error::duplicate_field(
1036                                    "multiple values for state",
1037                                ));
1038                            }
1039                            result.state = map
1040                                .next_value::<std::option::Option<crate::model::instance::State>>()?
1041                                .unwrap_or_default();
1042                        }
1043                        __FieldTag::__status_message => {
1044                            if !fields.insert(__FieldTag::__status_message) {
1045                                return std::result::Result::Err(A::Error::duplicate_field(
1046                                    "multiple values for status_message",
1047                                ));
1048                            }
1049                            result.status_message = map
1050                                .next_value::<std::option::Option<std::string::String>>()?
1051                                .unwrap_or_default();
1052                        }
1053                        __FieldTag::__redis_configs => {
1054                            if !fields.insert(__FieldTag::__redis_configs) {
1055                                return std::result::Result::Err(A::Error::duplicate_field(
1056                                    "multiple values for redis_configs",
1057                                ));
1058                            }
1059                            result.redis_configs = map
1060                                .next_value::<std::option::Option<
1061                                    std::collections::HashMap<
1062                                        std::string::String,
1063                                        std::string::String,
1064                                    >,
1065                                >>()?
1066                                .unwrap_or_default();
1067                        }
1068                        __FieldTag::__tier => {
1069                            if !fields.insert(__FieldTag::__tier) {
1070                                return std::result::Result::Err(A::Error::duplicate_field(
1071                                    "multiple values for tier",
1072                                ));
1073                            }
1074                            result.tier = map
1075                                .next_value::<std::option::Option<crate::model::instance::Tier>>()?
1076                                .unwrap_or_default();
1077                        }
1078                        __FieldTag::__memory_size_gb => {
1079                            if !fields.insert(__FieldTag::__memory_size_gb) {
1080                                return std::result::Result::Err(A::Error::duplicate_field(
1081                                    "multiple values for memory_size_gb",
1082                                ));
1083                            }
1084                            struct __With(std::option::Option<i32>);
1085                            impl<'de> serde::de::Deserialize<'de> for __With {
1086                                fn deserialize<D>(
1087                                    deserializer: D,
1088                                ) -> std::result::Result<Self, D::Error>
1089                                where
1090                                    D: serde::de::Deserializer<'de>,
1091                                {
1092                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1093                                }
1094                            }
1095                            result.memory_size_gb =
1096                                map.next_value::<__With>()?.0.unwrap_or_default();
1097                        }
1098                        __FieldTag::__authorized_network => {
1099                            if !fields.insert(__FieldTag::__authorized_network) {
1100                                return std::result::Result::Err(A::Error::duplicate_field(
1101                                    "multiple values for authorized_network",
1102                                ));
1103                            }
1104                            result.authorized_network = map
1105                                .next_value::<std::option::Option<std::string::String>>()?
1106                                .unwrap_or_default();
1107                        }
1108                        __FieldTag::__persistence_iam_identity => {
1109                            if !fields.insert(__FieldTag::__persistence_iam_identity) {
1110                                return std::result::Result::Err(A::Error::duplicate_field(
1111                                    "multiple values for persistence_iam_identity",
1112                                ));
1113                            }
1114                            result.persistence_iam_identity = map
1115                                .next_value::<std::option::Option<std::string::String>>()?
1116                                .unwrap_or_default();
1117                        }
1118                        __FieldTag::__connect_mode => {
1119                            if !fields.insert(__FieldTag::__connect_mode) {
1120                                return std::result::Result::Err(A::Error::duplicate_field(
1121                                    "multiple values for connect_mode",
1122                                ));
1123                            }
1124                            result.connect_mode = map.next_value::<std::option::Option<crate::model::instance::ConnectMode>>()?.unwrap_or_default();
1125                        }
1126                        __FieldTag::__auth_enabled => {
1127                            if !fields.insert(__FieldTag::__auth_enabled) {
1128                                return std::result::Result::Err(A::Error::duplicate_field(
1129                                    "multiple values for auth_enabled",
1130                                ));
1131                            }
1132                            result.auth_enabled = map
1133                                .next_value::<std::option::Option<bool>>()?
1134                                .unwrap_or_default();
1135                        }
1136                        __FieldTag::__server_ca_certs => {
1137                            if !fields.insert(__FieldTag::__server_ca_certs) {
1138                                return std::result::Result::Err(A::Error::duplicate_field(
1139                                    "multiple values for server_ca_certs",
1140                                ));
1141                            }
1142                            result.server_ca_certs =
1143                                map.next_value::<std::option::Option<
1144                                    std::vec::Vec<crate::model::TlsCertificate>,
1145                                >>()?
1146                                .unwrap_or_default();
1147                        }
1148                        __FieldTag::__transit_encryption_mode => {
1149                            if !fields.insert(__FieldTag::__transit_encryption_mode) {
1150                                return std::result::Result::Err(A::Error::duplicate_field(
1151                                    "multiple values for transit_encryption_mode",
1152                                ));
1153                            }
1154                            result.transit_encryption_mode =
1155                                map.next_value::<std::option::Option<
1156                                    crate::model::instance::TransitEncryptionMode,
1157                                >>()?
1158                                .unwrap_or_default();
1159                        }
1160                        __FieldTag::__maintenance_policy => {
1161                            if !fields.insert(__FieldTag::__maintenance_policy) {
1162                                return std::result::Result::Err(A::Error::duplicate_field(
1163                                    "multiple values for maintenance_policy",
1164                                ));
1165                            }
1166                            result.maintenance_policy = map
1167                                .next_value::<std::option::Option<crate::model::MaintenancePolicy>>(
1168                                )?;
1169                        }
1170                        __FieldTag::__maintenance_schedule => {
1171                            if !fields.insert(__FieldTag::__maintenance_schedule) {
1172                                return std::result::Result::Err(A::Error::duplicate_field(
1173                                    "multiple values for maintenance_schedule",
1174                                ));
1175                            }
1176                            result.maintenance_schedule = map.next_value::<std::option::Option<crate::model::MaintenanceSchedule>>()?
1177                                ;
1178                        }
1179                        __FieldTag::__replica_count => {
1180                            if !fields.insert(__FieldTag::__replica_count) {
1181                                return std::result::Result::Err(A::Error::duplicate_field(
1182                                    "multiple values for replica_count",
1183                                ));
1184                            }
1185                            struct __With(std::option::Option<i32>);
1186                            impl<'de> serde::de::Deserialize<'de> for __With {
1187                                fn deserialize<D>(
1188                                    deserializer: D,
1189                                ) -> std::result::Result<Self, D::Error>
1190                                where
1191                                    D: serde::de::Deserializer<'de>,
1192                                {
1193                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1194                                }
1195                            }
1196                            result.replica_count =
1197                                map.next_value::<__With>()?.0.unwrap_or_default();
1198                        }
1199                        __FieldTag::__nodes => {
1200                            if !fields.insert(__FieldTag::__nodes) {
1201                                return std::result::Result::Err(A::Error::duplicate_field(
1202                                    "multiple values for nodes",
1203                                ));
1204                            }
1205                            result.nodes = map.next_value::<std::option::Option<std::vec::Vec<crate::model::NodeInfo>>>()?.unwrap_or_default();
1206                        }
1207                        __FieldTag::__read_endpoint => {
1208                            if !fields.insert(__FieldTag::__read_endpoint) {
1209                                return std::result::Result::Err(A::Error::duplicate_field(
1210                                    "multiple values for read_endpoint",
1211                                ));
1212                            }
1213                            result.read_endpoint = map
1214                                .next_value::<std::option::Option<std::string::String>>()?
1215                                .unwrap_or_default();
1216                        }
1217                        __FieldTag::__read_endpoint_port => {
1218                            if !fields.insert(__FieldTag::__read_endpoint_port) {
1219                                return std::result::Result::Err(A::Error::duplicate_field(
1220                                    "multiple values for read_endpoint_port",
1221                                ));
1222                            }
1223                            struct __With(std::option::Option<i32>);
1224                            impl<'de> serde::de::Deserialize<'de> for __With {
1225                                fn deserialize<D>(
1226                                    deserializer: D,
1227                                ) -> std::result::Result<Self, D::Error>
1228                                where
1229                                    D: serde::de::Deserializer<'de>,
1230                                {
1231                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
1232                                }
1233                            }
1234                            result.read_endpoint_port =
1235                                map.next_value::<__With>()?.0.unwrap_or_default();
1236                        }
1237                        __FieldTag::__read_replicas_mode => {
1238                            if !fields.insert(__FieldTag::__read_replicas_mode) {
1239                                return std::result::Result::Err(A::Error::duplicate_field(
1240                                    "multiple values for read_replicas_mode",
1241                                ));
1242                            }
1243                            result.read_replicas_mode = map.next_value::<std::option::Option<crate::model::instance::ReadReplicasMode>>()?.unwrap_or_default();
1244                        }
1245                        __FieldTag::__customer_managed_key => {
1246                            if !fields.insert(__FieldTag::__customer_managed_key) {
1247                                return std::result::Result::Err(A::Error::duplicate_field(
1248                                    "multiple values for customer_managed_key",
1249                                ));
1250                            }
1251                            result.customer_managed_key = map
1252                                .next_value::<std::option::Option<std::string::String>>()?
1253                                .unwrap_or_default();
1254                        }
1255                        __FieldTag::__persistence_config => {
1256                            if !fields.insert(__FieldTag::__persistence_config) {
1257                                return std::result::Result::Err(A::Error::duplicate_field(
1258                                    "multiple values for persistence_config",
1259                                ));
1260                            }
1261                            result.persistence_config = map
1262                                .next_value::<std::option::Option<crate::model::PersistenceConfig>>(
1263                                )?;
1264                        }
1265                        __FieldTag::__suspension_reasons => {
1266                            if !fields.insert(__FieldTag::__suspension_reasons) {
1267                                return std::result::Result::Err(A::Error::duplicate_field(
1268                                    "multiple values for suspension_reasons",
1269                                ));
1270                            }
1271                            result.suspension_reasons = map
1272                                .next_value::<std::option::Option<
1273                                    std::vec::Vec<crate::model::instance::SuspensionReason>,
1274                                >>()?
1275                                .unwrap_or_default();
1276                        }
1277                        __FieldTag::__maintenance_version => {
1278                            if !fields.insert(__FieldTag::__maintenance_version) {
1279                                return std::result::Result::Err(A::Error::duplicate_field(
1280                                    "multiple values for maintenance_version",
1281                                ));
1282                            }
1283                            result.maintenance_version = map
1284                                .next_value::<std::option::Option<std::string::String>>()?
1285                                .unwrap_or_default();
1286                        }
1287                        __FieldTag::__available_maintenance_versions => {
1288                            if !fields.insert(__FieldTag::__available_maintenance_versions) {
1289                                return std::result::Result::Err(A::Error::duplicate_field(
1290                                    "multiple values for available_maintenance_versions",
1291                                ));
1292                            }
1293                            result.available_maintenance_versions = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
1294                        }
1295                        __FieldTag::Unknown(key) => {
1296                            let value = map.next_value::<serde_json::Value>()?;
1297                            result._unknown_fields.insert(key, value);
1298                        }
1299                    }
1300                }
1301                std::result::Result::Ok(result)
1302            }
1303        }
1304        deserializer.deserialize_any(Visitor)
1305    }
1306}
1307
1308#[doc(hidden)]
1309impl serde::ser::Serialize for Instance {
1310    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1311    where
1312        S: serde::ser::Serializer,
1313    {
1314        use serde::ser::SerializeMap;
1315        #[allow(unused_imports)]
1316        use std::option::Option::Some;
1317        let mut state = serializer.serialize_map(std::option::Option::None)?;
1318        if !self.name.is_empty() {
1319            state.serialize_entry("name", &self.name)?;
1320        }
1321        if !self.display_name.is_empty() {
1322            state.serialize_entry("displayName", &self.display_name)?;
1323        }
1324        if !self.labels.is_empty() {
1325            state.serialize_entry("labels", &self.labels)?;
1326        }
1327        if !self.location_id.is_empty() {
1328            state.serialize_entry("locationId", &self.location_id)?;
1329        }
1330        if !self.alternative_location_id.is_empty() {
1331            state.serialize_entry("alternativeLocationId", &self.alternative_location_id)?;
1332        }
1333        if !self.redis_version.is_empty() {
1334            state.serialize_entry("redisVersion", &self.redis_version)?;
1335        }
1336        if !self.reserved_ip_range.is_empty() {
1337            state.serialize_entry("reservedIpRange", &self.reserved_ip_range)?;
1338        }
1339        if !self.secondary_ip_range.is_empty() {
1340            state.serialize_entry("secondaryIpRange", &self.secondary_ip_range)?;
1341        }
1342        if !self.host.is_empty() {
1343            state.serialize_entry("host", &self.host)?;
1344        }
1345        if !wkt::internal::is_default(&self.port) {
1346            struct __With<'a>(&'a i32);
1347            impl<'a> serde::ser::Serialize for __With<'a> {
1348                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1349                where
1350                    S: serde::ser::Serializer,
1351                {
1352                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1353                }
1354            }
1355            state.serialize_entry("port", &__With(&self.port))?;
1356        }
1357        if !self.current_location_id.is_empty() {
1358            state.serialize_entry("currentLocationId", &self.current_location_id)?;
1359        }
1360        if self.create_time.is_some() {
1361            state.serialize_entry("createTime", &self.create_time)?;
1362        }
1363        if !wkt::internal::is_default(&self.state) {
1364            state.serialize_entry("state", &self.state)?;
1365        }
1366        if !self.status_message.is_empty() {
1367            state.serialize_entry("statusMessage", &self.status_message)?;
1368        }
1369        if !self.redis_configs.is_empty() {
1370            state.serialize_entry("redisConfigs", &self.redis_configs)?;
1371        }
1372        if !wkt::internal::is_default(&self.tier) {
1373            state.serialize_entry("tier", &self.tier)?;
1374        }
1375        if !wkt::internal::is_default(&self.memory_size_gb) {
1376            struct __With<'a>(&'a i32);
1377            impl<'a> serde::ser::Serialize for __With<'a> {
1378                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1379                where
1380                    S: serde::ser::Serializer,
1381                {
1382                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1383                }
1384            }
1385            state.serialize_entry("memorySizeGb", &__With(&self.memory_size_gb))?;
1386        }
1387        if !self.authorized_network.is_empty() {
1388            state.serialize_entry("authorizedNetwork", &self.authorized_network)?;
1389        }
1390        if !self.persistence_iam_identity.is_empty() {
1391            state.serialize_entry("persistenceIamIdentity", &self.persistence_iam_identity)?;
1392        }
1393        if !wkt::internal::is_default(&self.connect_mode) {
1394            state.serialize_entry("connectMode", &self.connect_mode)?;
1395        }
1396        if !wkt::internal::is_default(&self.auth_enabled) {
1397            state.serialize_entry("authEnabled", &self.auth_enabled)?;
1398        }
1399        if !self.server_ca_certs.is_empty() {
1400            state.serialize_entry("serverCaCerts", &self.server_ca_certs)?;
1401        }
1402        if !wkt::internal::is_default(&self.transit_encryption_mode) {
1403            state.serialize_entry("transitEncryptionMode", &self.transit_encryption_mode)?;
1404        }
1405        if self.maintenance_policy.is_some() {
1406            state.serialize_entry("maintenancePolicy", &self.maintenance_policy)?;
1407        }
1408        if self.maintenance_schedule.is_some() {
1409            state.serialize_entry("maintenanceSchedule", &self.maintenance_schedule)?;
1410        }
1411        if !wkt::internal::is_default(&self.replica_count) {
1412            struct __With<'a>(&'a i32);
1413            impl<'a> serde::ser::Serialize for __With<'a> {
1414                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1415                where
1416                    S: serde::ser::Serializer,
1417                {
1418                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1419                }
1420            }
1421            state.serialize_entry("replicaCount", &__With(&self.replica_count))?;
1422        }
1423        if !self.nodes.is_empty() {
1424            state.serialize_entry("nodes", &self.nodes)?;
1425        }
1426        if !self.read_endpoint.is_empty() {
1427            state.serialize_entry("readEndpoint", &self.read_endpoint)?;
1428        }
1429        if !wkt::internal::is_default(&self.read_endpoint_port) {
1430            struct __With<'a>(&'a i32);
1431            impl<'a> serde::ser::Serialize for __With<'a> {
1432                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1433                where
1434                    S: serde::ser::Serializer,
1435                {
1436                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
1437                }
1438            }
1439            state.serialize_entry("readEndpointPort", &__With(&self.read_endpoint_port))?;
1440        }
1441        if !wkt::internal::is_default(&self.read_replicas_mode) {
1442            state.serialize_entry("readReplicasMode", &self.read_replicas_mode)?;
1443        }
1444        if !self.customer_managed_key.is_empty() {
1445            state.serialize_entry("customerManagedKey", &self.customer_managed_key)?;
1446        }
1447        if self.persistence_config.is_some() {
1448            state.serialize_entry("persistenceConfig", &self.persistence_config)?;
1449        }
1450        if !self.suspension_reasons.is_empty() {
1451            state.serialize_entry("suspensionReasons", &self.suspension_reasons)?;
1452        }
1453        if !self.maintenance_version.is_empty() {
1454            state.serialize_entry("maintenanceVersion", &self.maintenance_version)?;
1455        }
1456        if !self.available_maintenance_versions.is_empty() {
1457            state.serialize_entry(
1458                "availableMaintenanceVersions",
1459                &self.available_maintenance_versions,
1460            )?;
1461        }
1462        if !self._unknown_fields.is_empty() {
1463            for (key, value) in self._unknown_fields.iter() {
1464                state.serialize_entry(key, &value)?;
1465            }
1466        }
1467        state.end()
1468    }
1469}
1470
1471impl std::fmt::Debug for Instance {
1472    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1473        let mut debug_struct = f.debug_struct("Instance");
1474        debug_struct.field("name", &self.name);
1475        debug_struct.field("display_name", &self.display_name);
1476        debug_struct.field("labels", &self.labels);
1477        debug_struct.field("location_id", &self.location_id);
1478        debug_struct.field("alternative_location_id", &self.alternative_location_id);
1479        debug_struct.field("redis_version", &self.redis_version);
1480        debug_struct.field("reserved_ip_range", &self.reserved_ip_range);
1481        debug_struct.field("secondary_ip_range", &self.secondary_ip_range);
1482        debug_struct.field("host", &self.host);
1483        debug_struct.field("port", &self.port);
1484        debug_struct.field("current_location_id", &self.current_location_id);
1485        debug_struct.field("create_time", &self.create_time);
1486        debug_struct.field("state", &self.state);
1487        debug_struct.field("status_message", &self.status_message);
1488        debug_struct.field("redis_configs", &self.redis_configs);
1489        debug_struct.field("tier", &self.tier);
1490        debug_struct.field("memory_size_gb", &self.memory_size_gb);
1491        debug_struct.field("authorized_network", &self.authorized_network);
1492        debug_struct.field("persistence_iam_identity", &self.persistence_iam_identity);
1493        debug_struct.field("connect_mode", &self.connect_mode);
1494        debug_struct.field("auth_enabled", &self.auth_enabled);
1495        debug_struct.field("server_ca_certs", &self.server_ca_certs);
1496        debug_struct.field("transit_encryption_mode", &self.transit_encryption_mode);
1497        debug_struct.field("maintenance_policy", &self.maintenance_policy);
1498        debug_struct.field("maintenance_schedule", &self.maintenance_schedule);
1499        debug_struct.field("replica_count", &self.replica_count);
1500        debug_struct.field("nodes", &self.nodes);
1501        debug_struct.field("read_endpoint", &self.read_endpoint);
1502        debug_struct.field("read_endpoint_port", &self.read_endpoint_port);
1503        debug_struct.field("read_replicas_mode", &self.read_replicas_mode);
1504        debug_struct.field("customer_managed_key", &self.customer_managed_key);
1505        debug_struct.field("persistence_config", &self.persistence_config);
1506        debug_struct.field("suspension_reasons", &self.suspension_reasons);
1507        debug_struct.field("maintenance_version", &self.maintenance_version);
1508        debug_struct.field(
1509            "available_maintenance_versions",
1510            &self.available_maintenance_versions,
1511        );
1512        if !self._unknown_fields.is_empty() {
1513            debug_struct.field("_unknown_fields", &self._unknown_fields);
1514        }
1515        debug_struct.finish()
1516    }
1517}
1518
1519/// Defines additional types related to [Instance].
1520pub mod instance {
1521    #[allow(unused_imports)]
1522    use super::*;
1523
1524    /// Represents the different states of a Redis instance.
1525    ///
1526    /// # Working with unknown values
1527    ///
1528    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1529    /// additional enum variants at any time. Adding new variants is not considered
1530    /// a breaking change. Applications should write their code in anticipation of:
1531    ///
1532    /// - New values appearing in future releases of the client library, **and**
1533    /// - New values received dynamically, without application changes.
1534    ///
1535    /// Please consult the [Working with enums] section in the user guide for some
1536    /// guidelines.
1537    ///
1538    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1539    #[derive(Clone, Debug, PartialEq)]
1540    #[non_exhaustive]
1541    pub enum State {
1542        /// Not set.
1543        Unspecified,
1544        /// Redis instance is being created.
1545        Creating,
1546        /// Redis instance has been created and is fully usable.
1547        Ready,
1548        /// Redis instance configuration is being updated. Certain kinds of updates
1549        /// may cause the instance to become unusable while the update is in
1550        /// progress.
1551        Updating,
1552        /// Redis instance is being deleted.
1553        Deleting,
1554        /// Redis instance is being repaired and may be unusable.
1555        Repairing,
1556        /// Maintenance is being performed on this Redis instance.
1557        Maintenance,
1558        /// Redis instance is importing data (availability may be affected).
1559        Importing,
1560        /// Redis instance is failing over (availability may be affected).
1561        FailingOver,
1562        /// If set, the enum was initialized with an unknown value.
1563        ///
1564        /// Applications can examine the value using [State::value] or
1565        /// [State::name].
1566        UnknownValue(state::UnknownValue),
1567    }
1568
1569    #[doc(hidden)]
1570    pub mod state {
1571        #[allow(unused_imports)]
1572        use super::*;
1573        #[derive(Clone, Debug, PartialEq)]
1574        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1575    }
1576
1577    impl State {
1578        /// Gets the enum value.
1579        ///
1580        /// Returns `None` if the enum contains an unknown value deserialized from
1581        /// the string representation of enums.
1582        pub fn value(&self) -> std::option::Option<i32> {
1583            match self {
1584                Self::Unspecified => std::option::Option::Some(0),
1585                Self::Creating => std::option::Option::Some(1),
1586                Self::Ready => std::option::Option::Some(2),
1587                Self::Updating => std::option::Option::Some(3),
1588                Self::Deleting => std::option::Option::Some(4),
1589                Self::Repairing => std::option::Option::Some(5),
1590                Self::Maintenance => std::option::Option::Some(6),
1591                Self::Importing => std::option::Option::Some(8),
1592                Self::FailingOver => std::option::Option::Some(9),
1593                Self::UnknownValue(u) => u.0.value(),
1594            }
1595        }
1596
1597        /// Gets the enum value as a string.
1598        ///
1599        /// Returns `None` if the enum contains an unknown value deserialized from
1600        /// the integer representation of enums.
1601        pub fn name(&self) -> std::option::Option<&str> {
1602            match self {
1603                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1604                Self::Creating => std::option::Option::Some("CREATING"),
1605                Self::Ready => std::option::Option::Some("READY"),
1606                Self::Updating => std::option::Option::Some("UPDATING"),
1607                Self::Deleting => std::option::Option::Some("DELETING"),
1608                Self::Repairing => std::option::Option::Some("REPAIRING"),
1609                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
1610                Self::Importing => std::option::Option::Some("IMPORTING"),
1611                Self::FailingOver => std::option::Option::Some("FAILING_OVER"),
1612                Self::UnknownValue(u) => u.0.name(),
1613            }
1614        }
1615    }
1616
1617    impl std::default::Default for State {
1618        fn default() -> Self {
1619            use std::convert::From;
1620            Self::from(0)
1621        }
1622    }
1623
1624    impl std::fmt::Display for State {
1625        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1626            wkt::internal::display_enum(f, self.name(), self.value())
1627        }
1628    }
1629
1630    impl std::convert::From<i32> for State {
1631        fn from(value: i32) -> Self {
1632            match value {
1633                0 => Self::Unspecified,
1634                1 => Self::Creating,
1635                2 => Self::Ready,
1636                3 => Self::Updating,
1637                4 => Self::Deleting,
1638                5 => Self::Repairing,
1639                6 => Self::Maintenance,
1640                8 => Self::Importing,
1641                9 => Self::FailingOver,
1642                _ => Self::UnknownValue(state::UnknownValue(
1643                    wkt::internal::UnknownEnumValue::Integer(value),
1644                )),
1645            }
1646        }
1647    }
1648
1649    impl std::convert::From<&str> for State {
1650        fn from(value: &str) -> Self {
1651            use std::string::ToString;
1652            match value {
1653                "STATE_UNSPECIFIED" => Self::Unspecified,
1654                "CREATING" => Self::Creating,
1655                "READY" => Self::Ready,
1656                "UPDATING" => Self::Updating,
1657                "DELETING" => Self::Deleting,
1658                "REPAIRING" => Self::Repairing,
1659                "MAINTENANCE" => Self::Maintenance,
1660                "IMPORTING" => Self::Importing,
1661                "FAILING_OVER" => Self::FailingOver,
1662                _ => Self::UnknownValue(state::UnknownValue(
1663                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1664                )),
1665            }
1666        }
1667    }
1668
1669    impl serde::ser::Serialize for State {
1670        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1671        where
1672            S: serde::Serializer,
1673        {
1674            match self {
1675                Self::Unspecified => serializer.serialize_i32(0),
1676                Self::Creating => serializer.serialize_i32(1),
1677                Self::Ready => serializer.serialize_i32(2),
1678                Self::Updating => serializer.serialize_i32(3),
1679                Self::Deleting => serializer.serialize_i32(4),
1680                Self::Repairing => serializer.serialize_i32(5),
1681                Self::Maintenance => serializer.serialize_i32(6),
1682                Self::Importing => serializer.serialize_i32(8),
1683                Self::FailingOver => serializer.serialize_i32(9),
1684                Self::UnknownValue(u) => u.0.serialize(serializer),
1685            }
1686        }
1687    }
1688
1689    impl<'de> serde::de::Deserialize<'de> for State {
1690        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1691        where
1692            D: serde::Deserializer<'de>,
1693        {
1694            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1695                ".google.cloud.redis.v1.Instance.State",
1696            ))
1697        }
1698    }
1699
1700    /// Available service tiers to choose from
1701    ///
1702    /// # Working with unknown values
1703    ///
1704    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1705    /// additional enum variants at any time. Adding new variants is not considered
1706    /// a breaking change. Applications should write their code in anticipation of:
1707    ///
1708    /// - New values appearing in future releases of the client library, **and**
1709    /// - New values received dynamically, without application changes.
1710    ///
1711    /// Please consult the [Working with enums] section in the user guide for some
1712    /// guidelines.
1713    ///
1714    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1715    #[derive(Clone, Debug, PartialEq)]
1716    #[non_exhaustive]
1717    pub enum Tier {
1718        /// Not set.
1719        Unspecified,
1720        /// BASIC tier: standalone instance
1721        Basic,
1722        /// STANDARD_HA tier: highly available primary/replica instances
1723        StandardHa,
1724        /// If set, the enum was initialized with an unknown value.
1725        ///
1726        /// Applications can examine the value using [Tier::value] or
1727        /// [Tier::name].
1728        UnknownValue(tier::UnknownValue),
1729    }
1730
1731    #[doc(hidden)]
1732    pub mod tier {
1733        #[allow(unused_imports)]
1734        use super::*;
1735        #[derive(Clone, Debug, PartialEq)]
1736        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1737    }
1738
1739    impl Tier {
1740        /// Gets the enum value.
1741        ///
1742        /// Returns `None` if the enum contains an unknown value deserialized from
1743        /// the string representation of enums.
1744        pub fn value(&self) -> std::option::Option<i32> {
1745            match self {
1746                Self::Unspecified => std::option::Option::Some(0),
1747                Self::Basic => std::option::Option::Some(1),
1748                Self::StandardHa => std::option::Option::Some(3),
1749                Self::UnknownValue(u) => u.0.value(),
1750            }
1751        }
1752
1753        /// Gets the enum value as a string.
1754        ///
1755        /// Returns `None` if the enum contains an unknown value deserialized from
1756        /// the integer representation of enums.
1757        pub fn name(&self) -> std::option::Option<&str> {
1758            match self {
1759                Self::Unspecified => std::option::Option::Some("TIER_UNSPECIFIED"),
1760                Self::Basic => std::option::Option::Some("BASIC"),
1761                Self::StandardHa => std::option::Option::Some("STANDARD_HA"),
1762                Self::UnknownValue(u) => u.0.name(),
1763            }
1764        }
1765    }
1766
1767    impl std::default::Default for Tier {
1768        fn default() -> Self {
1769            use std::convert::From;
1770            Self::from(0)
1771        }
1772    }
1773
1774    impl std::fmt::Display for Tier {
1775        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1776            wkt::internal::display_enum(f, self.name(), self.value())
1777        }
1778    }
1779
1780    impl std::convert::From<i32> for Tier {
1781        fn from(value: i32) -> Self {
1782            match value {
1783                0 => Self::Unspecified,
1784                1 => Self::Basic,
1785                3 => Self::StandardHa,
1786                _ => Self::UnknownValue(tier::UnknownValue(
1787                    wkt::internal::UnknownEnumValue::Integer(value),
1788                )),
1789            }
1790        }
1791    }
1792
1793    impl std::convert::From<&str> for Tier {
1794        fn from(value: &str) -> Self {
1795            use std::string::ToString;
1796            match value {
1797                "TIER_UNSPECIFIED" => Self::Unspecified,
1798                "BASIC" => Self::Basic,
1799                "STANDARD_HA" => Self::StandardHa,
1800                _ => Self::UnknownValue(tier::UnknownValue(
1801                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1802                )),
1803            }
1804        }
1805    }
1806
1807    impl serde::ser::Serialize for Tier {
1808        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1809        where
1810            S: serde::Serializer,
1811        {
1812            match self {
1813                Self::Unspecified => serializer.serialize_i32(0),
1814                Self::Basic => serializer.serialize_i32(1),
1815                Self::StandardHa => serializer.serialize_i32(3),
1816                Self::UnknownValue(u) => u.0.serialize(serializer),
1817            }
1818        }
1819    }
1820
1821    impl<'de> serde::de::Deserialize<'de> for Tier {
1822        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1823        where
1824            D: serde::Deserializer<'de>,
1825        {
1826            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Tier>::new(
1827                ".google.cloud.redis.v1.Instance.Tier",
1828            ))
1829        }
1830    }
1831
1832    /// Available connection modes.
1833    ///
1834    /// # Working with unknown values
1835    ///
1836    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1837    /// additional enum variants at any time. Adding new variants is not considered
1838    /// a breaking change. Applications should write their code in anticipation of:
1839    ///
1840    /// - New values appearing in future releases of the client library, **and**
1841    /// - New values received dynamically, without application changes.
1842    ///
1843    /// Please consult the [Working with enums] section in the user guide for some
1844    /// guidelines.
1845    ///
1846    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1847    #[derive(Clone, Debug, PartialEq)]
1848    #[non_exhaustive]
1849    pub enum ConnectMode {
1850        /// Not set.
1851        Unspecified,
1852        /// Connect via direct peering to the Memorystore for Redis hosted service.
1853        DirectPeering,
1854        /// Connect your Memorystore for Redis instance using Private Service
1855        /// Access. Private services access provides an IP address range for multiple
1856        /// Google Cloud services, including Memorystore.
1857        PrivateServiceAccess,
1858        /// If set, the enum was initialized with an unknown value.
1859        ///
1860        /// Applications can examine the value using [ConnectMode::value] or
1861        /// [ConnectMode::name].
1862        UnknownValue(connect_mode::UnknownValue),
1863    }
1864
1865    #[doc(hidden)]
1866    pub mod connect_mode {
1867        #[allow(unused_imports)]
1868        use super::*;
1869        #[derive(Clone, Debug, PartialEq)]
1870        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1871    }
1872
1873    impl ConnectMode {
1874        /// Gets the enum value.
1875        ///
1876        /// Returns `None` if the enum contains an unknown value deserialized from
1877        /// the string representation of enums.
1878        pub fn value(&self) -> std::option::Option<i32> {
1879            match self {
1880                Self::Unspecified => std::option::Option::Some(0),
1881                Self::DirectPeering => std::option::Option::Some(1),
1882                Self::PrivateServiceAccess => std::option::Option::Some(2),
1883                Self::UnknownValue(u) => u.0.value(),
1884            }
1885        }
1886
1887        /// Gets the enum value as a string.
1888        ///
1889        /// Returns `None` if the enum contains an unknown value deserialized from
1890        /// the integer representation of enums.
1891        pub fn name(&self) -> std::option::Option<&str> {
1892            match self {
1893                Self::Unspecified => std::option::Option::Some("CONNECT_MODE_UNSPECIFIED"),
1894                Self::DirectPeering => std::option::Option::Some("DIRECT_PEERING"),
1895                Self::PrivateServiceAccess => std::option::Option::Some("PRIVATE_SERVICE_ACCESS"),
1896                Self::UnknownValue(u) => u.0.name(),
1897            }
1898        }
1899    }
1900
1901    impl std::default::Default for ConnectMode {
1902        fn default() -> Self {
1903            use std::convert::From;
1904            Self::from(0)
1905        }
1906    }
1907
1908    impl std::fmt::Display for ConnectMode {
1909        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1910            wkt::internal::display_enum(f, self.name(), self.value())
1911        }
1912    }
1913
1914    impl std::convert::From<i32> for ConnectMode {
1915        fn from(value: i32) -> Self {
1916            match value {
1917                0 => Self::Unspecified,
1918                1 => Self::DirectPeering,
1919                2 => Self::PrivateServiceAccess,
1920                _ => Self::UnknownValue(connect_mode::UnknownValue(
1921                    wkt::internal::UnknownEnumValue::Integer(value),
1922                )),
1923            }
1924        }
1925    }
1926
1927    impl std::convert::From<&str> for ConnectMode {
1928        fn from(value: &str) -> Self {
1929            use std::string::ToString;
1930            match value {
1931                "CONNECT_MODE_UNSPECIFIED" => Self::Unspecified,
1932                "DIRECT_PEERING" => Self::DirectPeering,
1933                "PRIVATE_SERVICE_ACCESS" => Self::PrivateServiceAccess,
1934                _ => Self::UnknownValue(connect_mode::UnknownValue(
1935                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1936                )),
1937            }
1938        }
1939    }
1940
1941    impl serde::ser::Serialize for ConnectMode {
1942        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1943        where
1944            S: serde::Serializer,
1945        {
1946            match self {
1947                Self::Unspecified => serializer.serialize_i32(0),
1948                Self::DirectPeering => serializer.serialize_i32(1),
1949                Self::PrivateServiceAccess => serializer.serialize_i32(2),
1950                Self::UnknownValue(u) => u.0.serialize(serializer),
1951            }
1952        }
1953    }
1954
1955    impl<'de> serde::de::Deserialize<'de> for ConnectMode {
1956        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1957        where
1958            D: serde::Deserializer<'de>,
1959        {
1960            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectMode>::new(
1961                ".google.cloud.redis.v1.Instance.ConnectMode",
1962            ))
1963        }
1964    }
1965
1966    /// Available TLS modes.
1967    ///
1968    /// # Working with unknown values
1969    ///
1970    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1971    /// additional enum variants at any time. Adding new variants is not considered
1972    /// a breaking change. Applications should write their code in anticipation of:
1973    ///
1974    /// - New values appearing in future releases of the client library, **and**
1975    /// - New values received dynamically, without application changes.
1976    ///
1977    /// Please consult the [Working with enums] section in the user guide for some
1978    /// guidelines.
1979    ///
1980    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1981    #[derive(Clone, Debug, PartialEq)]
1982    #[non_exhaustive]
1983    pub enum TransitEncryptionMode {
1984        /// Not set.
1985        Unspecified,
1986        /// Client to Server traffic encryption enabled with server authentication.
1987        ServerAuthentication,
1988        /// TLS is disabled for the instance.
1989        Disabled,
1990        /// If set, the enum was initialized with an unknown value.
1991        ///
1992        /// Applications can examine the value using [TransitEncryptionMode::value] or
1993        /// [TransitEncryptionMode::name].
1994        UnknownValue(transit_encryption_mode::UnknownValue),
1995    }
1996
1997    #[doc(hidden)]
1998    pub mod transit_encryption_mode {
1999        #[allow(unused_imports)]
2000        use super::*;
2001        #[derive(Clone, Debug, PartialEq)]
2002        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2003    }
2004
2005    impl TransitEncryptionMode {
2006        /// Gets the enum value.
2007        ///
2008        /// Returns `None` if the enum contains an unknown value deserialized from
2009        /// the string representation of enums.
2010        pub fn value(&self) -> std::option::Option<i32> {
2011            match self {
2012                Self::Unspecified => std::option::Option::Some(0),
2013                Self::ServerAuthentication => std::option::Option::Some(1),
2014                Self::Disabled => std::option::Option::Some(2),
2015                Self::UnknownValue(u) => u.0.value(),
2016            }
2017        }
2018
2019        /// Gets the enum value as a string.
2020        ///
2021        /// Returns `None` if the enum contains an unknown value deserialized from
2022        /// the integer representation of enums.
2023        pub fn name(&self) -> std::option::Option<&str> {
2024            match self {
2025                Self::Unspecified => {
2026                    std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_UNSPECIFIED")
2027                }
2028                Self::ServerAuthentication => std::option::Option::Some("SERVER_AUTHENTICATION"),
2029                Self::Disabled => std::option::Option::Some("DISABLED"),
2030                Self::UnknownValue(u) => u.0.name(),
2031            }
2032        }
2033    }
2034
2035    impl std::default::Default for TransitEncryptionMode {
2036        fn default() -> Self {
2037            use std::convert::From;
2038            Self::from(0)
2039        }
2040    }
2041
2042    impl std::fmt::Display for TransitEncryptionMode {
2043        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2044            wkt::internal::display_enum(f, self.name(), self.value())
2045        }
2046    }
2047
2048    impl std::convert::From<i32> for TransitEncryptionMode {
2049        fn from(value: i32) -> Self {
2050            match value {
2051                0 => Self::Unspecified,
2052                1 => Self::ServerAuthentication,
2053                2 => Self::Disabled,
2054                _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
2055                    wkt::internal::UnknownEnumValue::Integer(value),
2056                )),
2057            }
2058        }
2059    }
2060
2061    impl std::convert::From<&str> for TransitEncryptionMode {
2062        fn from(value: &str) -> Self {
2063            use std::string::ToString;
2064            match value {
2065                "TRANSIT_ENCRYPTION_MODE_UNSPECIFIED" => Self::Unspecified,
2066                "SERVER_AUTHENTICATION" => Self::ServerAuthentication,
2067                "DISABLED" => Self::Disabled,
2068                _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
2069                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2070                )),
2071            }
2072        }
2073    }
2074
2075    impl serde::ser::Serialize for TransitEncryptionMode {
2076        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2077        where
2078            S: serde::Serializer,
2079        {
2080            match self {
2081                Self::Unspecified => serializer.serialize_i32(0),
2082                Self::ServerAuthentication => serializer.serialize_i32(1),
2083                Self::Disabled => serializer.serialize_i32(2),
2084                Self::UnknownValue(u) => u.0.serialize(serializer),
2085            }
2086        }
2087    }
2088
2089    impl<'de> serde::de::Deserialize<'de> for TransitEncryptionMode {
2090        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2091        where
2092            D: serde::Deserializer<'de>,
2093        {
2094            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransitEncryptionMode>::new(
2095                ".google.cloud.redis.v1.Instance.TransitEncryptionMode",
2096            ))
2097        }
2098    }
2099
2100    /// Read replicas mode.
2101    ///
2102    /// # Working with unknown values
2103    ///
2104    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2105    /// additional enum variants at any time. Adding new variants is not considered
2106    /// a breaking change. Applications should write their code in anticipation of:
2107    ///
2108    /// - New values appearing in future releases of the client library, **and**
2109    /// - New values received dynamically, without application changes.
2110    ///
2111    /// Please consult the [Working with enums] section in the user guide for some
2112    /// guidelines.
2113    ///
2114    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2115    #[derive(Clone, Debug, PartialEq)]
2116    #[non_exhaustive]
2117    pub enum ReadReplicasMode {
2118        /// If not set, Memorystore Redis backend will default to
2119        /// READ_REPLICAS_DISABLED.
2120        Unspecified,
2121        /// If disabled, read endpoint will not be provided and the instance cannot
2122        /// scale up or down the number of replicas.
2123        ReadReplicasDisabled,
2124        /// If enabled, read endpoint will be provided and the instance can scale
2125        /// up and down the number of replicas. Not valid for basic tier.
2126        ReadReplicasEnabled,
2127        /// If set, the enum was initialized with an unknown value.
2128        ///
2129        /// Applications can examine the value using [ReadReplicasMode::value] or
2130        /// [ReadReplicasMode::name].
2131        UnknownValue(read_replicas_mode::UnknownValue),
2132    }
2133
2134    #[doc(hidden)]
2135    pub mod read_replicas_mode {
2136        #[allow(unused_imports)]
2137        use super::*;
2138        #[derive(Clone, Debug, PartialEq)]
2139        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2140    }
2141
2142    impl ReadReplicasMode {
2143        /// Gets the enum value.
2144        ///
2145        /// Returns `None` if the enum contains an unknown value deserialized from
2146        /// the string representation of enums.
2147        pub fn value(&self) -> std::option::Option<i32> {
2148            match self {
2149                Self::Unspecified => std::option::Option::Some(0),
2150                Self::ReadReplicasDisabled => std::option::Option::Some(1),
2151                Self::ReadReplicasEnabled => std::option::Option::Some(2),
2152                Self::UnknownValue(u) => u.0.value(),
2153            }
2154        }
2155
2156        /// Gets the enum value as a string.
2157        ///
2158        /// Returns `None` if the enum contains an unknown value deserialized from
2159        /// the integer representation of enums.
2160        pub fn name(&self) -> std::option::Option<&str> {
2161            match self {
2162                Self::Unspecified => std::option::Option::Some("READ_REPLICAS_MODE_UNSPECIFIED"),
2163                Self::ReadReplicasDisabled => std::option::Option::Some("READ_REPLICAS_DISABLED"),
2164                Self::ReadReplicasEnabled => std::option::Option::Some("READ_REPLICAS_ENABLED"),
2165                Self::UnknownValue(u) => u.0.name(),
2166            }
2167        }
2168    }
2169
2170    impl std::default::Default for ReadReplicasMode {
2171        fn default() -> Self {
2172            use std::convert::From;
2173            Self::from(0)
2174        }
2175    }
2176
2177    impl std::fmt::Display for ReadReplicasMode {
2178        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2179            wkt::internal::display_enum(f, self.name(), self.value())
2180        }
2181    }
2182
2183    impl std::convert::From<i32> for ReadReplicasMode {
2184        fn from(value: i32) -> Self {
2185            match value {
2186                0 => Self::Unspecified,
2187                1 => Self::ReadReplicasDisabled,
2188                2 => Self::ReadReplicasEnabled,
2189                _ => Self::UnknownValue(read_replicas_mode::UnknownValue(
2190                    wkt::internal::UnknownEnumValue::Integer(value),
2191                )),
2192            }
2193        }
2194    }
2195
2196    impl std::convert::From<&str> for ReadReplicasMode {
2197        fn from(value: &str) -> Self {
2198            use std::string::ToString;
2199            match value {
2200                "READ_REPLICAS_MODE_UNSPECIFIED" => Self::Unspecified,
2201                "READ_REPLICAS_DISABLED" => Self::ReadReplicasDisabled,
2202                "READ_REPLICAS_ENABLED" => Self::ReadReplicasEnabled,
2203                _ => Self::UnknownValue(read_replicas_mode::UnknownValue(
2204                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2205                )),
2206            }
2207        }
2208    }
2209
2210    impl serde::ser::Serialize for ReadReplicasMode {
2211        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2212        where
2213            S: serde::Serializer,
2214        {
2215            match self {
2216                Self::Unspecified => serializer.serialize_i32(0),
2217                Self::ReadReplicasDisabled => serializer.serialize_i32(1),
2218                Self::ReadReplicasEnabled => serializer.serialize_i32(2),
2219                Self::UnknownValue(u) => u.0.serialize(serializer),
2220            }
2221        }
2222    }
2223
2224    impl<'de> serde::de::Deserialize<'de> for ReadReplicasMode {
2225        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2226        where
2227            D: serde::Deserializer<'de>,
2228        {
2229            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReadReplicasMode>::new(
2230                ".google.cloud.redis.v1.Instance.ReadReplicasMode",
2231            ))
2232        }
2233    }
2234
2235    /// Possible reasons for the instance to be in a "SUSPENDED" state.
2236    ///
2237    /// # Working with unknown values
2238    ///
2239    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2240    /// additional enum variants at any time. Adding new variants is not considered
2241    /// a breaking change. Applications should write their code in anticipation of:
2242    ///
2243    /// - New values appearing in future releases of the client library, **and**
2244    /// - New values received dynamically, without application changes.
2245    ///
2246    /// Please consult the [Working with enums] section in the user guide for some
2247    /// guidelines.
2248    ///
2249    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2250    #[derive(Clone, Debug, PartialEq)]
2251    #[non_exhaustive]
2252    pub enum SuspensionReason {
2253        /// Not set.
2254        Unspecified,
2255        /// Something wrong with the CMEK key provided by customer.
2256        CustomerManagedKeyIssue,
2257        /// If set, the enum was initialized with an unknown value.
2258        ///
2259        /// Applications can examine the value using [SuspensionReason::value] or
2260        /// [SuspensionReason::name].
2261        UnknownValue(suspension_reason::UnknownValue),
2262    }
2263
2264    #[doc(hidden)]
2265    pub mod suspension_reason {
2266        #[allow(unused_imports)]
2267        use super::*;
2268        #[derive(Clone, Debug, PartialEq)]
2269        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2270    }
2271
2272    impl SuspensionReason {
2273        /// Gets the enum value.
2274        ///
2275        /// Returns `None` if the enum contains an unknown value deserialized from
2276        /// the string representation of enums.
2277        pub fn value(&self) -> std::option::Option<i32> {
2278            match self {
2279                Self::Unspecified => std::option::Option::Some(0),
2280                Self::CustomerManagedKeyIssue => std::option::Option::Some(1),
2281                Self::UnknownValue(u) => u.0.value(),
2282            }
2283        }
2284
2285        /// Gets the enum value as a string.
2286        ///
2287        /// Returns `None` if the enum contains an unknown value deserialized from
2288        /// the integer representation of enums.
2289        pub fn name(&self) -> std::option::Option<&str> {
2290            match self {
2291                Self::Unspecified => std::option::Option::Some("SUSPENSION_REASON_UNSPECIFIED"),
2292                Self::CustomerManagedKeyIssue => {
2293                    std::option::Option::Some("CUSTOMER_MANAGED_KEY_ISSUE")
2294                }
2295                Self::UnknownValue(u) => u.0.name(),
2296            }
2297        }
2298    }
2299
2300    impl std::default::Default for SuspensionReason {
2301        fn default() -> Self {
2302            use std::convert::From;
2303            Self::from(0)
2304        }
2305    }
2306
2307    impl std::fmt::Display for SuspensionReason {
2308        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2309            wkt::internal::display_enum(f, self.name(), self.value())
2310        }
2311    }
2312
2313    impl std::convert::From<i32> for SuspensionReason {
2314        fn from(value: i32) -> Self {
2315            match value {
2316                0 => Self::Unspecified,
2317                1 => Self::CustomerManagedKeyIssue,
2318                _ => Self::UnknownValue(suspension_reason::UnknownValue(
2319                    wkt::internal::UnknownEnumValue::Integer(value),
2320                )),
2321            }
2322        }
2323    }
2324
2325    impl std::convert::From<&str> for SuspensionReason {
2326        fn from(value: &str) -> Self {
2327            use std::string::ToString;
2328            match value {
2329                "SUSPENSION_REASON_UNSPECIFIED" => Self::Unspecified,
2330                "CUSTOMER_MANAGED_KEY_ISSUE" => Self::CustomerManagedKeyIssue,
2331                _ => Self::UnknownValue(suspension_reason::UnknownValue(
2332                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2333                )),
2334            }
2335        }
2336    }
2337
2338    impl serde::ser::Serialize for SuspensionReason {
2339        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2340        where
2341            S: serde::Serializer,
2342        {
2343            match self {
2344                Self::Unspecified => serializer.serialize_i32(0),
2345                Self::CustomerManagedKeyIssue => serializer.serialize_i32(1),
2346                Self::UnknownValue(u) => u.0.serialize(serializer),
2347            }
2348        }
2349    }
2350
2351    impl<'de> serde::de::Deserialize<'de> for SuspensionReason {
2352        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2353        where
2354            D: serde::Deserializer<'de>,
2355        {
2356            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SuspensionReason>::new(
2357                ".google.cloud.redis.v1.Instance.SuspensionReason",
2358            ))
2359        }
2360    }
2361}
2362
2363/// Configuration of the persistence functionality.
2364#[derive(Clone, Default, PartialEq)]
2365#[non_exhaustive]
2366pub struct PersistenceConfig {
2367    /// Optional. Controls whether Persistence features are enabled.
2368    /// If not provided, the existing value will be used.
2369    pub persistence_mode: crate::model::persistence_config::PersistenceMode,
2370
2371    /// Optional. Period between RDB snapshots. Snapshots will be attempted every
2372    /// period starting from the provided snapshot start time. For example, a start
2373    /// time of 01/01/2033 06:45 and SIX_HOURS snapshot period will do nothing
2374    /// until 01/01/2033, and then trigger snapshots every day at 06:45, 12:45,
2375    /// 18:45, and 00:45 the next day, and so on. If not provided,
2376    /// TWENTY_FOUR_HOURS will be used as default.
2377    pub rdb_snapshot_period: crate::model::persistence_config::SnapshotPeriod,
2378
2379    /// Output only. The next time that a snapshot attempt is scheduled to occur.
2380    pub rdb_next_snapshot_time: std::option::Option<wkt::Timestamp>,
2381
2382    /// Optional. Date and time that the first snapshot was/will be attempted, and
2383    /// to which future snapshots will be aligned. If not provided, the current
2384    /// time will be used.
2385    pub rdb_snapshot_start_time: std::option::Option<wkt::Timestamp>,
2386
2387    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2388}
2389
2390impl PersistenceConfig {
2391    pub fn new() -> Self {
2392        std::default::Default::default()
2393    }
2394
2395    /// Sets the value of [persistence_mode][crate::model::PersistenceConfig::persistence_mode].
2396    pub fn set_persistence_mode<
2397        T: std::convert::Into<crate::model::persistence_config::PersistenceMode>,
2398    >(
2399        mut self,
2400        v: T,
2401    ) -> Self {
2402        self.persistence_mode = v.into();
2403        self
2404    }
2405
2406    /// Sets the value of [rdb_snapshot_period][crate::model::PersistenceConfig::rdb_snapshot_period].
2407    pub fn set_rdb_snapshot_period<
2408        T: std::convert::Into<crate::model::persistence_config::SnapshotPeriod>,
2409    >(
2410        mut self,
2411        v: T,
2412    ) -> Self {
2413        self.rdb_snapshot_period = v.into();
2414        self
2415    }
2416
2417    /// Sets the value of [rdb_next_snapshot_time][crate::model::PersistenceConfig::rdb_next_snapshot_time].
2418    pub fn set_rdb_next_snapshot_time<T>(mut self, v: T) -> Self
2419    where
2420        T: std::convert::Into<wkt::Timestamp>,
2421    {
2422        self.rdb_next_snapshot_time = std::option::Option::Some(v.into());
2423        self
2424    }
2425
2426    /// Sets or clears the value of [rdb_next_snapshot_time][crate::model::PersistenceConfig::rdb_next_snapshot_time].
2427    pub fn set_or_clear_rdb_next_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
2428    where
2429        T: std::convert::Into<wkt::Timestamp>,
2430    {
2431        self.rdb_next_snapshot_time = v.map(|x| x.into());
2432        self
2433    }
2434
2435    /// Sets the value of [rdb_snapshot_start_time][crate::model::PersistenceConfig::rdb_snapshot_start_time].
2436    pub fn set_rdb_snapshot_start_time<T>(mut self, v: T) -> Self
2437    where
2438        T: std::convert::Into<wkt::Timestamp>,
2439    {
2440        self.rdb_snapshot_start_time = std::option::Option::Some(v.into());
2441        self
2442    }
2443
2444    /// Sets or clears the value of [rdb_snapshot_start_time][crate::model::PersistenceConfig::rdb_snapshot_start_time].
2445    pub fn set_or_clear_rdb_snapshot_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2446    where
2447        T: std::convert::Into<wkt::Timestamp>,
2448    {
2449        self.rdb_snapshot_start_time = v.map(|x| x.into());
2450        self
2451    }
2452}
2453
2454impl wkt::message::Message for PersistenceConfig {
2455    fn typename() -> &'static str {
2456        "type.googleapis.com/google.cloud.redis.v1.PersistenceConfig"
2457    }
2458}
2459
2460#[doc(hidden)]
2461impl<'de> serde::de::Deserialize<'de> for PersistenceConfig {
2462    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2463    where
2464        D: serde::Deserializer<'de>,
2465    {
2466        #[allow(non_camel_case_types)]
2467        #[doc(hidden)]
2468        #[derive(PartialEq, Eq, Hash)]
2469        enum __FieldTag {
2470            __persistence_mode,
2471            __rdb_snapshot_period,
2472            __rdb_next_snapshot_time,
2473            __rdb_snapshot_start_time,
2474            Unknown(std::string::String),
2475        }
2476        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2477            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2478            where
2479                D: serde::Deserializer<'de>,
2480            {
2481                struct Visitor;
2482                impl<'de> serde::de::Visitor<'de> for Visitor {
2483                    type Value = __FieldTag;
2484                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2485                        formatter.write_str("a field name for PersistenceConfig")
2486                    }
2487                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
2488                    where
2489                        E: serde::de::Error,
2490                    {
2491                        use std::result::Result::Ok;
2492                        use std::string::ToString;
2493                        match value {
2494                            "persistenceMode" => Ok(__FieldTag::__persistence_mode),
2495                            "persistence_mode" => Ok(__FieldTag::__persistence_mode),
2496                            "rdbSnapshotPeriod" => Ok(__FieldTag::__rdb_snapshot_period),
2497                            "rdb_snapshot_period" => Ok(__FieldTag::__rdb_snapshot_period),
2498                            "rdbNextSnapshotTime" => Ok(__FieldTag::__rdb_next_snapshot_time),
2499                            "rdb_next_snapshot_time" => Ok(__FieldTag::__rdb_next_snapshot_time),
2500                            "rdbSnapshotStartTime" => Ok(__FieldTag::__rdb_snapshot_start_time),
2501                            "rdb_snapshot_start_time" => Ok(__FieldTag::__rdb_snapshot_start_time),
2502                            _ => Ok(__FieldTag::Unknown(value.to_string())),
2503                        }
2504                    }
2505                }
2506                deserializer.deserialize_identifier(Visitor)
2507            }
2508        }
2509        struct Visitor;
2510        impl<'de> serde::de::Visitor<'de> for Visitor {
2511            type Value = PersistenceConfig;
2512            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
2513                formatter.write_str("struct PersistenceConfig")
2514            }
2515            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
2516            where
2517                A: serde::de::MapAccess<'de>,
2518            {
2519                #[allow(unused_imports)]
2520                use serde::de::Error;
2521                use std::option::Option::Some;
2522                let mut fields = std::collections::HashSet::new();
2523                let mut result = Self::Value::new();
2524                while let Some(tag) = map.next_key::<__FieldTag>()? {
2525                    #[allow(clippy::match_single_binding)]
2526                    match tag {
2527                        __FieldTag::__persistence_mode => {
2528                            if !fields.insert(__FieldTag::__persistence_mode) {
2529                                return std::result::Result::Err(A::Error::duplicate_field(
2530                                    "multiple values for persistence_mode",
2531                                ));
2532                            }
2533                            result.persistence_mode = map
2534                                .next_value::<std::option::Option<
2535                                    crate::model::persistence_config::PersistenceMode,
2536                                >>()?
2537                                .unwrap_or_default();
2538                        }
2539                        __FieldTag::__rdb_snapshot_period => {
2540                            if !fields.insert(__FieldTag::__rdb_snapshot_period) {
2541                                return std::result::Result::Err(A::Error::duplicate_field(
2542                                    "multiple values for rdb_snapshot_period",
2543                                ));
2544                            }
2545                            result.rdb_snapshot_period = map
2546                                .next_value::<std::option::Option<
2547                                    crate::model::persistence_config::SnapshotPeriod,
2548                                >>()?
2549                                .unwrap_or_default();
2550                        }
2551                        __FieldTag::__rdb_next_snapshot_time => {
2552                            if !fields.insert(__FieldTag::__rdb_next_snapshot_time) {
2553                                return std::result::Result::Err(A::Error::duplicate_field(
2554                                    "multiple values for rdb_next_snapshot_time",
2555                                ));
2556                            }
2557                            result.rdb_next_snapshot_time =
2558                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2559                        }
2560                        __FieldTag::__rdb_snapshot_start_time => {
2561                            if !fields.insert(__FieldTag::__rdb_snapshot_start_time) {
2562                                return std::result::Result::Err(A::Error::duplicate_field(
2563                                    "multiple values for rdb_snapshot_start_time",
2564                                ));
2565                            }
2566                            result.rdb_snapshot_start_time =
2567                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
2568                        }
2569                        __FieldTag::Unknown(key) => {
2570                            let value = map.next_value::<serde_json::Value>()?;
2571                            result._unknown_fields.insert(key, value);
2572                        }
2573                    }
2574                }
2575                std::result::Result::Ok(result)
2576            }
2577        }
2578        deserializer.deserialize_any(Visitor)
2579    }
2580}
2581
2582#[doc(hidden)]
2583impl serde::ser::Serialize for PersistenceConfig {
2584    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2585    where
2586        S: serde::ser::Serializer,
2587    {
2588        use serde::ser::SerializeMap;
2589        #[allow(unused_imports)]
2590        use std::option::Option::Some;
2591        let mut state = serializer.serialize_map(std::option::Option::None)?;
2592        if !wkt::internal::is_default(&self.persistence_mode) {
2593            state.serialize_entry("persistenceMode", &self.persistence_mode)?;
2594        }
2595        if !wkt::internal::is_default(&self.rdb_snapshot_period) {
2596            state.serialize_entry("rdbSnapshotPeriod", &self.rdb_snapshot_period)?;
2597        }
2598        if self.rdb_next_snapshot_time.is_some() {
2599            state.serialize_entry("rdbNextSnapshotTime", &self.rdb_next_snapshot_time)?;
2600        }
2601        if self.rdb_snapshot_start_time.is_some() {
2602            state.serialize_entry("rdbSnapshotStartTime", &self.rdb_snapshot_start_time)?;
2603        }
2604        if !self._unknown_fields.is_empty() {
2605            for (key, value) in self._unknown_fields.iter() {
2606                state.serialize_entry(key, &value)?;
2607            }
2608        }
2609        state.end()
2610    }
2611}
2612
2613impl std::fmt::Debug for PersistenceConfig {
2614    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2615        let mut debug_struct = f.debug_struct("PersistenceConfig");
2616        debug_struct.field("persistence_mode", &self.persistence_mode);
2617        debug_struct.field("rdb_snapshot_period", &self.rdb_snapshot_period);
2618        debug_struct.field("rdb_next_snapshot_time", &self.rdb_next_snapshot_time);
2619        debug_struct.field("rdb_snapshot_start_time", &self.rdb_snapshot_start_time);
2620        if !self._unknown_fields.is_empty() {
2621            debug_struct.field("_unknown_fields", &self._unknown_fields);
2622        }
2623        debug_struct.finish()
2624    }
2625}
2626
2627/// Defines additional types related to [PersistenceConfig].
2628pub mod persistence_config {
2629    #[allow(unused_imports)]
2630    use super::*;
2631
2632    /// Available Persistence modes.
2633    ///
2634    /// # Working with unknown values
2635    ///
2636    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2637    /// additional enum variants at any time. Adding new variants is not considered
2638    /// a breaking change. Applications should write their code in anticipation of:
2639    ///
2640    /// - New values appearing in future releases of the client library, **and**
2641    /// - New values received dynamically, without application changes.
2642    ///
2643    /// Please consult the [Working with enums] section in the user guide for some
2644    /// guidelines.
2645    ///
2646    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2647    #[derive(Clone, Debug, PartialEq)]
2648    #[non_exhaustive]
2649    pub enum PersistenceMode {
2650        /// Not set.
2651        Unspecified,
2652        /// Persistence is disabled for the instance,
2653        /// and any existing snapshots are deleted.
2654        Disabled,
2655        /// RDB based Persistence is enabled.
2656        Rdb,
2657        /// If set, the enum was initialized with an unknown value.
2658        ///
2659        /// Applications can examine the value using [PersistenceMode::value] or
2660        /// [PersistenceMode::name].
2661        UnknownValue(persistence_mode::UnknownValue),
2662    }
2663
2664    #[doc(hidden)]
2665    pub mod persistence_mode {
2666        #[allow(unused_imports)]
2667        use super::*;
2668        #[derive(Clone, Debug, PartialEq)]
2669        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2670    }
2671
2672    impl PersistenceMode {
2673        /// Gets the enum value.
2674        ///
2675        /// Returns `None` if the enum contains an unknown value deserialized from
2676        /// the string representation of enums.
2677        pub fn value(&self) -> std::option::Option<i32> {
2678            match self {
2679                Self::Unspecified => std::option::Option::Some(0),
2680                Self::Disabled => std::option::Option::Some(1),
2681                Self::Rdb => std::option::Option::Some(2),
2682                Self::UnknownValue(u) => u.0.value(),
2683            }
2684        }
2685
2686        /// Gets the enum value as a string.
2687        ///
2688        /// Returns `None` if the enum contains an unknown value deserialized from
2689        /// the integer representation of enums.
2690        pub fn name(&self) -> std::option::Option<&str> {
2691            match self {
2692                Self::Unspecified => std::option::Option::Some("PERSISTENCE_MODE_UNSPECIFIED"),
2693                Self::Disabled => std::option::Option::Some("DISABLED"),
2694                Self::Rdb => std::option::Option::Some("RDB"),
2695                Self::UnknownValue(u) => u.0.name(),
2696            }
2697        }
2698    }
2699
2700    impl std::default::Default for PersistenceMode {
2701        fn default() -> Self {
2702            use std::convert::From;
2703            Self::from(0)
2704        }
2705    }
2706
2707    impl std::fmt::Display for PersistenceMode {
2708        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2709            wkt::internal::display_enum(f, self.name(), self.value())
2710        }
2711    }
2712
2713    impl std::convert::From<i32> for PersistenceMode {
2714        fn from(value: i32) -> Self {
2715            match value {
2716                0 => Self::Unspecified,
2717                1 => Self::Disabled,
2718                2 => Self::Rdb,
2719                _ => Self::UnknownValue(persistence_mode::UnknownValue(
2720                    wkt::internal::UnknownEnumValue::Integer(value),
2721                )),
2722            }
2723        }
2724    }
2725
2726    impl std::convert::From<&str> for PersistenceMode {
2727        fn from(value: &str) -> Self {
2728            use std::string::ToString;
2729            match value {
2730                "PERSISTENCE_MODE_UNSPECIFIED" => Self::Unspecified,
2731                "DISABLED" => Self::Disabled,
2732                "RDB" => Self::Rdb,
2733                _ => Self::UnknownValue(persistence_mode::UnknownValue(
2734                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2735                )),
2736            }
2737        }
2738    }
2739
2740    impl serde::ser::Serialize for PersistenceMode {
2741        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2742        where
2743            S: serde::Serializer,
2744        {
2745            match self {
2746                Self::Unspecified => serializer.serialize_i32(0),
2747                Self::Disabled => serializer.serialize_i32(1),
2748                Self::Rdb => serializer.serialize_i32(2),
2749                Self::UnknownValue(u) => u.0.serialize(serializer),
2750            }
2751        }
2752    }
2753
2754    impl<'de> serde::de::Deserialize<'de> for PersistenceMode {
2755        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2756        where
2757            D: serde::Deserializer<'de>,
2758        {
2759            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PersistenceMode>::new(
2760                ".google.cloud.redis.v1.PersistenceConfig.PersistenceMode",
2761            ))
2762        }
2763    }
2764
2765    /// Available snapshot periods for scheduling.
2766    ///
2767    /// # Working with unknown values
2768    ///
2769    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2770    /// additional enum variants at any time. Adding new variants is not considered
2771    /// a breaking change. Applications should write their code in anticipation of:
2772    ///
2773    /// - New values appearing in future releases of the client library, **and**
2774    /// - New values received dynamically, without application changes.
2775    ///
2776    /// Please consult the [Working with enums] section in the user guide for some
2777    /// guidelines.
2778    ///
2779    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2780    #[derive(Clone, Debug, PartialEq)]
2781    #[non_exhaustive]
2782    pub enum SnapshotPeriod {
2783        /// Not set.
2784        Unspecified,
2785        /// Snapshot every 1 hour.
2786        OneHour,
2787        /// Snapshot every 6 hours.
2788        SixHours,
2789        /// Snapshot every 12 hours.
2790        TwelveHours,
2791        /// Snapshot every 24 hours.
2792        TwentyFourHours,
2793        /// If set, the enum was initialized with an unknown value.
2794        ///
2795        /// Applications can examine the value using [SnapshotPeriod::value] or
2796        /// [SnapshotPeriod::name].
2797        UnknownValue(snapshot_period::UnknownValue),
2798    }
2799
2800    #[doc(hidden)]
2801    pub mod snapshot_period {
2802        #[allow(unused_imports)]
2803        use super::*;
2804        #[derive(Clone, Debug, PartialEq)]
2805        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2806    }
2807
2808    impl SnapshotPeriod {
2809        /// Gets the enum value.
2810        ///
2811        /// Returns `None` if the enum contains an unknown value deserialized from
2812        /// the string representation of enums.
2813        pub fn value(&self) -> std::option::Option<i32> {
2814            match self {
2815                Self::Unspecified => std::option::Option::Some(0),
2816                Self::OneHour => std::option::Option::Some(3),
2817                Self::SixHours => std::option::Option::Some(4),
2818                Self::TwelveHours => std::option::Option::Some(5),
2819                Self::TwentyFourHours => std::option::Option::Some(6),
2820                Self::UnknownValue(u) => u.0.value(),
2821            }
2822        }
2823
2824        /// Gets the enum value as a string.
2825        ///
2826        /// Returns `None` if the enum contains an unknown value deserialized from
2827        /// the integer representation of enums.
2828        pub fn name(&self) -> std::option::Option<&str> {
2829            match self {
2830                Self::Unspecified => std::option::Option::Some("SNAPSHOT_PERIOD_UNSPECIFIED"),
2831                Self::OneHour => std::option::Option::Some("ONE_HOUR"),
2832                Self::SixHours => std::option::Option::Some("SIX_HOURS"),
2833                Self::TwelveHours => std::option::Option::Some("TWELVE_HOURS"),
2834                Self::TwentyFourHours => std::option::Option::Some("TWENTY_FOUR_HOURS"),
2835                Self::UnknownValue(u) => u.0.name(),
2836            }
2837        }
2838    }
2839
2840    impl std::default::Default for SnapshotPeriod {
2841        fn default() -> Self {
2842            use std::convert::From;
2843            Self::from(0)
2844        }
2845    }
2846
2847    impl std::fmt::Display for SnapshotPeriod {
2848        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2849            wkt::internal::display_enum(f, self.name(), self.value())
2850        }
2851    }
2852
2853    impl std::convert::From<i32> for SnapshotPeriod {
2854        fn from(value: i32) -> Self {
2855            match value {
2856                0 => Self::Unspecified,
2857                3 => Self::OneHour,
2858                4 => Self::SixHours,
2859                5 => Self::TwelveHours,
2860                6 => Self::TwentyFourHours,
2861                _ => Self::UnknownValue(snapshot_period::UnknownValue(
2862                    wkt::internal::UnknownEnumValue::Integer(value),
2863                )),
2864            }
2865        }
2866    }
2867
2868    impl std::convert::From<&str> for SnapshotPeriod {
2869        fn from(value: &str) -> Self {
2870            use std::string::ToString;
2871            match value {
2872                "SNAPSHOT_PERIOD_UNSPECIFIED" => Self::Unspecified,
2873                "ONE_HOUR" => Self::OneHour,
2874                "SIX_HOURS" => Self::SixHours,
2875                "TWELVE_HOURS" => Self::TwelveHours,
2876                "TWENTY_FOUR_HOURS" => Self::TwentyFourHours,
2877                _ => Self::UnknownValue(snapshot_period::UnknownValue(
2878                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2879                )),
2880            }
2881        }
2882    }
2883
2884    impl serde::ser::Serialize for SnapshotPeriod {
2885        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2886        where
2887            S: serde::Serializer,
2888        {
2889            match self {
2890                Self::Unspecified => serializer.serialize_i32(0),
2891                Self::OneHour => serializer.serialize_i32(3),
2892                Self::SixHours => serializer.serialize_i32(4),
2893                Self::TwelveHours => serializer.serialize_i32(5),
2894                Self::TwentyFourHours => serializer.serialize_i32(6),
2895                Self::UnknownValue(u) => u.0.serialize(serializer),
2896            }
2897        }
2898    }
2899
2900    impl<'de> serde::de::Deserialize<'de> for SnapshotPeriod {
2901        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2902        where
2903            D: serde::Deserializer<'de>,
2904        {
2905            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotPeriod>::new(
2906                ".google.cloud.redis.v1.PersistenceConfig.SnapshotPeriod",
2907            ))
2908        }
2909    }
2910}
2911
2912/// Request for
2913/// [RescheduleMaintenance][google.cloud.redis.v1.CloudRedis.RescheduleMaintenance].
2914///
2915/// [google.cloud.redis.v1.CloudRedis.RescheduleMaintenance]: crate::client::CloudRedis::reschedule_maintenance
2916#[derive(Clone, Default, PartialEq)]
2917#[non_exhaustive]
2918pub struct RescheduleMaintenanceRequest {
2919    /// Required. Redis instance resource name using the form:
2920    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
2921    /// where `location_id` refers to a GCP region.
2922    pub name: std::string::String,
2923
2924    /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
2925    /// well.
2926    pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
2927
2928    /// Optional. Timestamp when the maintenance shall be rescheduled to if
2929    /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
2930    /// example `2012-11-15T16:19:00.094Z`.
2931    pub schedule_time: std::option::Option<wkt::Timestamp>,
2932
2933    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2934}
2935
2936impl RescheduleMaintenanceRequest {
2937    pub fn new() -> Self {
2938        std::default::Default::default()
2939    }
2940
2941    /// Sets the value of [name][crate::model::RescheduleMaintenanceRequest::name].
2942    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2943        self.name = v.into();
2944        self
2945    }
2946
2947    /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
2948    pub fn set_reschedule_type<
2949        T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
2950    >(
2951        mut self,
2952        v: T,
2953    ) -> Self {
2954        self.reschedule_type = v.into();
2955        self
2956    }
2957
2958    /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
2959    pub fn set_schedule_time<T>(mut self, v: T) -> Self
2960    where
2961        T: std::convert::Into<wkt::Timestamp>,
2962    {
2963        self.schedule_time = std::option::Option::Some(v.into());
2964        self
2965    }
2966
2967    /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
2968    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
2969    where
2970        T: std::convert::Into<wkt::Timestamp>,
2971    {
2972        self.schedule_time = v.map(|x| x.into());
2973        self
2974    }
2975}
2976
2977impl wkt::message::Message for RescheduleMaintenanceRequest {
2978    fn typename() -> &'static str {
2979        "type.googleapis.com/google.cloud.redis.v1.RescheduleMaintenanceRequest"
2980    }
2981}
2982
2983#[doc(hidden)]
2984impl<'de> serde::de::Deserialize<'de> for RescheduleMaintenanceRequest {
2985    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2986    where
2987        D: serde::Deserializer<'de>,
2988    {
2989        #[allow(non_camel_case_types)]
2990        #[doc(hidden)]
2991        #[derive(PartialEq, Eq, Hash)]
2992        enum __FieldTag {
2993            __name,
2994            __reschedule_type,
2995            __schedule_time,
2996            Unknown(std::string::String),
2997        }
2998        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
2999            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3000            where
3001                D: serde::Deserializer<'de>,
3002            {
3003                struct Visitor;
3004                impl<'de> serde::de::Visitor<'de> for Visitor {
3005                    type Value = __FieldTag;
3006                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3007                        formatter.write_str("a field name for RescheduleMaintenanceRequest")
3008                    }
3009                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3010                    where
3011                        E: serde::de::Error,
3012                    {
3013                        use std::result::Result::Ok;
3014                        use std::string::ToString;
3015                        match value {
3016                            "name" => Ok(__FieldTag::__name),
3017                            "rescheduleType" => Ok(__FieldTag::__reschedule_type),
3018                            "reschedule_type" => Ok(__FieldTag::__reschedule_type),
3019                            "scheduleTime" => Ok(__FieldTag::__schedule_time),
3020                            "schedule_time" => Ok(__FieldTag::__schedule_time),
3021                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3022                        }
3023                    }
3024                }
3025                deserializer.deserialize_identifier(Visitor)
3026            }
3027        }
3028        struct Visitor;
3029        impl<'de> serde::de::Visitor<'de> for Visitor {
3030            type Value = RescheduleMaintenanceRequest;
3031            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3032                formatter.write_str("struct RescheduleMaintenanceRequest")
3033            }
3034            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3035            where
3036                A: serde::de::MapAccess<'de>,
3037            {
3038                #[allow(unused_imports)]
3039                use serde::de::Error;
3040                use std::option::Option::Some;
3041                let mut fields = std::collections::HashSet::new();
3042                let mut result = Self::Value::new();
3043                while let Some(tag) = map.next_key::<__FieldTag>()? {
3044                    #[allow(clippy::match_single_binding)]
3045                    match tag {
3046                        __FieldTag::__name => {
3047                            if !fields.insert(__FieldTag::__name) {
3048                                return std::result::Result::Err(A::Error::duplicate_field(
3049                                    "multiple values for name",
3050                                ));
3051                            }
3052                            result.name = map
3053                                .next_value::<std::option::Option<std::string::String>>()?
3054                                .unwrap_or_default();
3055                        }
3056                        __FieldTag::__reschedule_type => {
3057                            if !fields.insert(__FieldTag::__reschedule_type) {
3058                                return std::result::Result::Err(A::Error::duplicate_field(
3059                                    "multiple values for reschedule_type",
3060                                ));
3061                            }
3062                            result.reschedule_type = map
3063                                .next_value::<std::option::Option<
3064                                    crate::model::reschedule_maintenance_request::RescheduleType,
3065                                >>()?
3066                                .unwrap_or_default();
3067                        }
3068                        __FieldTag::__schedule_time => {
3069                            if !fields.insert(__FieldTag::__schedule_time) {
3070                                return std::result::Result::Err(A::Error::duplicate_field(
3071                                    "multiple values for schedule_time",
3072                                ));
3073                            }
3074                            result.schedule_time =
3075                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3076                        }
3077                        __FieldTag::Unknown(key) => {
3078                            let value = map.next_value::<serde_json::Value>()?;
3079                            result._unknown_fields.insert(key, value);
3080                        }
3081                    }
3082                }
3083                std::result::Result::Ok(result)
3084            }
3085        }
3086        deserializer.deserialize_any(Visitor)
3087    }
3088}
3089
3090#[doc(hidden)]
3091impl serde::ser::Serialize for RescheduleMaintenanceRequest {
3092    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3093    where
3094        S: serde::ser::Serializer,
3095    {
3096        use serde::ser::SerializeMap;
3097        #[allow(unused_imports)]
3098        use std::option::Option::Some;
3099        let mut state = serializer.serialize_map(std::option::Option::None)?;
3100        if !self.name.is_empty() {
3101            state.serialize_entry("name", &self.name)?;
3102        }
3103        if !wkt::internal::is_default(&self.reschedule_type) {
3104            state.serialize_entry("rescheduleType", &self.reschedule_type)?;
3105        }
3106        if self.schedule_time.is_some() {
3107            state.serialize_entry("scheduleTime", &self.schedule_time)?;
3108        }
3109        if !self._unknown_fields.is_empty() {
3110            for (key, value) in self._unknown_fields.iter() {
3111                state.serialize_entry(key, &value)?;
3112            }
3113        }
3114        state.end()
3115    }
3116}
3117
3118impl std::fmt::Debug for RescheduleMaintenanceRequest {
3119    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3120        let mut debug_struct = f.debug_struct("RescheduleMaintenanceRequest");
3121        debug_struct.field("name", &self.name);
3122        debug_struct.field("reschedule_type", &self.reschedule_type);
3123        debug_struct.field("schedule_time", &self.schedule_time);
3124        if !self._unknown_fields.is_empty() {
3125            debug_struct.field("_unknown_fields", &self._unknown_fields);
3126        }
3127        debug_struct.finish()
3128    }
3129}
3130
3131/// Defines additional types related to [RescheduleMaintenanceRequest].
3132pub mod reschedule_maintenance_request {
3133    #[allow(unused_imports)]
3134    use super::*;
3135
3136    /// Reschedule options.
3137    ///
3138    /// # Working with unknown values
3139    ///
3140    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3141    /// additional enum variants at any time. Adding new variants is not considered
3142    /// a breaking change. Applications should write their code in anticipation of:
3143    ///
3144    /// - New values appearing in future releases of the client library, **and**
3145    /// - New values received dynamically, without application changes.
3146    ///
3147    /// Please consult the [Working with enums] section in the user guide for some
3148    /// guidelines.
3149    ///
3150    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3151    #[derive(Clone, Debug, PartialEq)]
3152    #[non_exhaustive]
3153    pub enum RescheduleType {
3154        /// Not set.
3155        Unspecified,
3156        /// If the user wants to schedule the maintenance to happen now.
3157        Immediate,
3158        /// If the user wants to use the existing maintenance policy to find the
3159        /// next available window.
3160        NextAvailableWindow,
3161        /// If the user wants to reschedule the maintenance to a specific time.
3162        SpecificTime,
3163        /// If set, the enum was initialized with an unknown value.
3164        ///
3165        /// Applications can examine the value using [RescheduleType::value] or
3166        /// [RescheduleType::name].
3167        UnknownValue(reschedule_type::UnknownValue),
3168    }
3169
3170    #[doc(hidden)]
3171    pub mod reschedule_type {
3172        #[allow(unused_imports)]
3173        use super::*;
3174        #[derive(Clone, Debug, PartialEq)]
3175        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3176    }
3177
3178    impl RescheduleType {
3179        /// Gets the enum value.
3180        ///
3181        /// Returns `None` if the enum contains an unknown value deserialized from
3182        /// the string representation of enums.
3183        pub fn value(&self) -> std::option::Option<i32> {
3184            match self {
3185                Self::Unspecified => std::option::Option::Some(0),
3186                Self::Immediate => std::option::Option::Some(1),
3187                Self::NextAvailableWindow => std::option::Option::Some(2),
3188                Self::SpecificTime => std::option::Option::Some(3),
3189                Self::UnknownValue(u) => u.0.value(),
3190            }
3191        }
3192
3193        /// Gets the enum value as a string.
3194        ///
3195        /// Returns `None` if the enum contains an unknown value deserialized from
3196        /// the integer representation of enums.
3197        pub fn name(&self) -> std::option::Option<&str> {
3198            match self {
3199                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
3200                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
3201                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
3202                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
3203                Self::UnknownValue(u) => u.0.name(),
3204            }
3205        }
3206    }
3207
3208    impl std::default::Default for RescheduleType {
3209        fn default() -> Self {
3210            use std::convert::From;
3211            Self::from(0)
3212        }
3213    }
3214
3215    impl std::fmt::Display for RescheduleType {
3216        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3217            wkt::internal::display_enum(f, self.name(), self.value())
3218        }
3219    }
3220
3221    impl std::convert::From<i32> for RescheduleType {
3222        fn from(value: i32) -> Self {
3223            match value {
3224                0 => Self::Unspecified,
3225                1 => Self::Immediate,
3226                2 => Self::NextAvailableWindow,
3227                3 => Self::SpecificTime,
3228                _ => Self::UnknownValue(reschedule_type::UnknownValue(
3229                    wkt::internal::UnknownEnumValue::Integer(value),
3230                )),
3231            }
3232        }
3233    }
3234
3235    impl std::convert::From<&str> for RescheduleType {
3236        fn from(value: &str) -> Self {
3237            use std::string::ToString;
3238            match value {
3239                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
3240                "IMMEDIATE" => Self::Immediate,
3241                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
3242                "SPECIFIC_TIME" => Self::SpecificTime,
3243                _ => Self::UnknownValue(reschedule_type::UnknownValue(
3244                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3245                )),
3246            }
3247        }
3248    }
3249
3250    impl serde::ser::Serialize for RescheduleType {
3251        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3252        where
3253            S: serde::Serializer,
3254        {
3255            match self {
3256                Self::Unspecified => serializer.serialize_i32(0),
3257                Self::Immediate => serializer.serialize_i32(1),
3258                Self::NextAvailableWindow => serializer.serialize_i32(2),
3259                Self::SpecificTime => serializer.serialize_i32(3),
3260                Self::UnknownValue(u) => u.0.serialize(serializer),
3261            }
3262        }
3263    }
3264
3265    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
3266        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3267        where
3268            D: serde::Deserializer<'de>,
3269        {
3270            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
3271                ".google.cloud.redis.v1.RescheduleMaintenanceRequest.RescheduleType",
3272            ))
3273        }
3274    }
3275}
3276
3277/// Maintenance policy for an instance.
3278#[derive(Clone, Default, PartialEq)]
3279#[non_exhaustive]
3280pub struct MaintenancePolicy {
3281    /// Output only. The time when the policy was created.
3282    pub create_time: std::option::Option<wkt::Timestamp>,
3283
3284    /// Output only. The time when the policy was last updated.
3285    pub update_time: std::option::Option<wkt::Timestamp>,
3286
3287    /// Optional. Description of what this policy is for. Create/Update methods
3288    /// return INVALID_ARGUMENT if the length is greater than 512.
3289    pub description: std::string::String,
3290
3291    /// Optional. Maintenance window that is applied to resources covered by this
3292    /// policy. Minimum 1. For the current version, the maximum number of
3293    /// weekly_window is expected to be one.
3294    pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
3295
3296    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3297}
3298
3299impl MaintenancePolicy {
3300    pub fn new() -> Self {
3301        std::default::Default::default()
3302    }
3303
3304    /// Sets the value of [create_time][crate::model::MaintenancePolicy::create_time].
3305    pub fn set_create_time<T>(mut self, v: T) -> Self
3306    where
3307        T: std::convert::Into<wkt::Timestamp>,
3308    {
3309        self.create_time = std::option::Option::Some(v.into());
3310        self
3311    }
3312
3313    /// Sets or clears the value of [create_time][crate::model::MaintenancePolicy::create_time].
3314    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3315    where
3316        T: std::convert::Into<wkt::Timestamp>,
3317    {
3318        self.create_time = v.map(|x| x.into());
3319        self
3320    }
3321
3322    /// Sets the value of [update_time][crate::model::MaintenancePolicy::update_time].
3323    pub fn set_update_time<T>(mut self, v: T) -> Self
3324    where
3325        T: std::convert::Into<wkt::Timestamp>,
3326    {
3327        self.update_time = std::option::Option::Some(v.into());
3328        self
3329    }
3330
3331    /// Sets or clears the value of [update_time][crate::model::MaintenancePolicy::update_time].
3332    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3333    where
3334        T: std::convert::Into<wkt::Timestamp>,
3335    {
3336        self.update_time = v.map(|x| x.into());
3337        self
3338    }
3339
3340    /// Sets the value of [description][crate::model::MaintenancePolicy::description].
3341    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3342        self.description = v.into();
3343        self
3344    }
3345
3346    /// Sets the value of [weekly_maintenance_window][crate::model::MaintenancePolicy::weekly_maintenance_window].
3347    pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
3348    where
3349        T: std::iter::IntoIterator<Item = V>,
3350        V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
3351    {
3352        use std::iter::Iterator;
3353        self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
3354        self
3355    }
3356}
3357
3358impl wkt::message::Message for MaintenancePolicy {
3359    fn typename() -> &'static str {
3360        "type.googleapis.com/google.cloud.redis.v1.MaintenancePolicy"
3361    }
3362}
3363
3364#[doc(hidden)]
3365impl<'de> serde::de::Deserialize<'de> for MaintenancePolicy {
3366    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3367    where
3368        D: serde::Deserializer<'de>,
3369    {
3370        #[allow(non_camel_case_types)]
3371        #[doc(hidden)]
3372        #[derive(PartialEq, Eq, Hash)]
3373        enum __FieldTag {
3374            __create_time,
3375            __update_time,
3376            __description,
3377            __weekly_maintenance_window,
3378            Unknown(std::string::String),
3379        }
3380        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3381            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3382            where
3383                D: serde::Deserializer<'de>,
3384            {
3385                struct Visitor;
3386                impl<'de> serde::de::Visitor<'de> for Visitor {
3387                    type Value = __FieldTag;
3388                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3389                        formatter.write_str("a field name for MaintenancePolicy")
3390                    }
3391                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3392                    where
3393                        E: serde::de::Error,
3394                    {
3395                        use std::result::Result::Ok;
3396                        use std::string::ToString;
3397                        match value {
3398                            "createTime" => Ok(__FieldTag::__create_time),
3399                            "create_time" => Ok(__FieldTag::__create_time),
3400                            "updateTime" => Ok(__FieldTag::__update_time),
3401                            "update_time" => Ok(__FieldTag::__update_time),
3402                            "description" => Ok(__FieldTag::__description),
3403                            "weeklyMaintenanceWindow" => {
3404                                Ok(__FieldTag::__weekly_maintenance_window)
3405                            }
3406                            "weekly_maintenance_window" => {
3407                                Ok(__FieldTag::__weekly_maintenance_window)
3408                            }
3409                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3410                        }
3411                    }
3412                }
3413                deserializer.deserialize_identifier(Visitor)
3414            }
3415        }
3416        struct Visitor;
3417        impl<'de> serde::de::Visitor<'de> for Visitor {
3418            type Value = MaintenancePolicy;
3419            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3420                formatter.write_str("struct MaintenancePolicy")
3421            }
3422            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3423            where
3424                A: serde::de::MapAccess<'de>,
3425            {
3426                #[allow(unused_imports)]
3427                use serde::de::Error;
3428                use std::option::Option::Some;
3429                let mut fields = std::collections::HashSet::new();
3430                let mut result = Self::Value::new();
3431                while let Some(tag) = map.next_key::<__FieldTag>()? {
3432                    #[allow(clippy::match_single_binding)]
3433                    match tag {
3434                        __FieldTag::__create_time => {
3435                            if !fields.insert(__FieldTag::__create_time) {
3436                                return std::result::Result::Err(A::Error::duplicate_field(
3437                                    "multiple values for create_time",
3438                                ));
3439                            }
3440                            result.create_time =
3441                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3442                        }
3443                        __FieldTag::__update_time => {
3444                            if !fields.insert(__FieldTag::__update_time) {
3445                                return std::result::Result::Err(A::Error::duplicate_field(
3446                                    "multiple values for update_time",
3447                                ));
3448                            }
3449                            result.update_time =
3450                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3451                        }
3452                        __FieldTag::__description => {
3453                            if !fields.insert(__FieldTag::__description) {
3454                                return std::result::Result::Err(A::Error::duplicate_field(
3455                                    "multiple values for description",
3456                                ));
3457                            }
3458                            result.description = map
3459                                .next_value::<std::option::Option<std::string::String>>()?
3460                                .unwrap_or_default();
3461                        }
3462                        __FieldTag::__weekly_maintenance_window => {
3463                            if !fields.insert(__FieldTag::__weekly_maintenance_window) {
3464                                return std::result::Result::Err(A::Error::duplicate_field(
3465                                    "multiple values for weekly_maintenance_window",
3466                                ));
3467                            }
3468                            result.weekly_maintenance_window = map
3469                                .next_value::<std::option::Option<
3470                                    std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
3471                                >>()?
3472                                .unwrap_or_default();
3473                        }
3474                        __FieldTag::Unknown(key) => {
3475                            let value = map.next_value::<serde_json::Value>()?;
3476                            result._unknown_fields.insert(key, value);
3477                        }
3478                    }
3479                }
3480                std::result::Result::Ok(result)
3481            }
3482        }
3483        deserializer.deserialize_any(Visitor)
3484    }
3485}
3486
3487#[doc(hidden)]
3488impl serde::ser::Serialize for MaintenancePolicy {
3489    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3490    where
3491        S: serde::ser::Serializer,
3492    {
3493        use serde::ser::SerializeMap;
3494        #[allow(unused_imports)]
3495        use std::option::Option::Some;
3496        let mut state = serializer.serialize_map(std::option::Option::None)?;
3497        if self.create_time.is_some() {
3498            state.serialize_entry("createTime", &self.create_time)?;
3499        }
3500        if self.update_time.is_some() {
3501            state.serialize_entry("updateTime", &self.update_time)?;
3502        }
3503        if !self.description.is_empty() {
3504            state.serialize_entry("description", &self.description)?;
3505        }
3506        if !self.weekly_maintenance_window.is_empty() {
3507            state.serialize_entry("weeklyMaintenanceWindow", &self.weekly_maintenance_window)?;
3508        }
3509        if !self._unknown_fields.is_empty() {
3510            for (key, value) in self._unknown_fields.iter() {
3511                state.serialize_entry(key, &value)?;
3512            }
3513        }
3514        state.end()
3515    }
3516}
3517
3518impl std::fmt::Debug for MaintenancePolicy {
3519    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3520        let mut debug_struct = f.debug_struct("MaintenancePolicy");
3521        debug_struct.field("create_time", &self.create_time);
3522        debug_struct.field("update_time", &self.update_time);
3523        debug_struct.field("description", &self.description);
3524        debug_struct.field("weekly_maintenance_window", &self.weekly_maintenance_window);
3525        if !self._unknown_fields.is_empty() {
3526            debug_struct.field("_unknown_fields", &self._unknown_fields);
3527        }
3528        debug_struct.finish()
3529    }
3530}
3531
3532/// Time window in which disruptive maintenance updates occur. Non-disruptive
3533/// updates can occur inside or outside this window.
3534#[derive(Clone, Default, PartialEq)]
3535#[non_exhaustive]
3536pub struct WeeklyMaintenanceWindow {
3537    /// Required. The day of week that maintenance updates occur.
3538    pub day: gtype::model::DayOfWeek,
3539
3540    /// Required. Start time of the window in UTC time.
3541    pub start_time: std::option::Option<gtype::model::TimeOfDay>,
3542
3543    /// Output only. Duration of the maintenance window. The current window is
3544    /// fixed at 1 hour.
3545    pub duration: std::option::Option<wkt::Duration>,
3546
3547    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3548}
3549
3550impl WeeklyMaintenanceWindow {
3551    pub fn new() -> Self {
3552        std::default::Default::default()
3553    }
3554
3555    /// Sets the value of [day][crate::model::WeeklyMaintenanceWindow::day].
3556    pub fn set_day<T: std::convert::Into<gtype::model::DayOfWeek>>(mut self, v: T) -> Self {
3557        self.day = v.into();
3558        self
3559    }
3560
3561    /// Sets the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
3562    pub fn set_start_time<T>(mut self, v: T) -> Self
3563    where
3564        T: std::convert::Into<gtype::model::TimeOfDay>,
3565    {
3566        self.start_time = std::option::Option::Some(v.into());
3567        self
3568    }
3569
3570    /// Sets or clears the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
3571    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3572    where
3573        T: std::convert::Into<gtype::model::TimeOfDay>,
3574    {
3575        self.start_time = v.map(|x| x.into());
3576        self
3577    }
3578
3579    /// Sets the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
3580    pub fn set_duration<T>(mut self, v: T) -> Self
3581    where
3582        T: std::convert::Into<wkt::Duration>,
3583    {
3584        self.duration = std::option::Option::Some(v.into());
3585        self
3586    }
3587
3588    /// Sets or clears the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
3589    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
3590    where
3591        T: std::convert::Into<wkt::Duration>,
3592    {
3593        self.duration = v.map(|x| x.into());
3594        self
3595    }
3596}
3597
3598impl wkt::message::Message for WeeklyMaintenanceWindow {
3599    fn typename() -> &'static str {
3600        "type.googleapis.com/google.cloud.redis.v1.WeeklyMaintenanceWindow"
3601    }
3602}
3603
3604#[doc(hidden)]
3605impl<'de> serde::de::Deserialize<'de> for WeeklyMaintenanceWindow {
3606    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3607    where
3608        D: serde::Deserializer<'de>,
3609    {
3610        #[allow(non_camel_case_types)]
3611        #[doc(hidden)]
3612        #[derive(PartialEq, Eq, Hash)]
3613        enum __FieldTag {
3614            __day,
3615            __start_time,
3616            __duration,
3617            Unknown(std::string::String),
3618        }
3619        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3620            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3621            where
3622                D: serde::Deserializer<'de>,
3623            {
3624                struct Visitor;
3625                impl<'de> serde::de::Visitor<'de> for Visitor {
3626                    type Value = __FieldTag;
3627                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3628                        formatter.write_str("a field name for WeeklyMaintenanceWindow")
3629                    }
3630                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3631                    where
3632                        E: serde::de::Error,
3633                    {
3634                        use std::result::Result::Ok;
3635                        use std::string::ToString;
3636                        match value {
3637                            "day" => Ok(__FieldTag::__day),
3638                            "startTime" => Ok(__FieldTag::__start_time),
3639                            "start_time" => Ok(__FieldTag::__start_time),
3640                            "duration" => Ok(__FieldTag::__duration),
3641                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3642                        }
3643                    }
3644                }
3645                deserializer.deserialize_identifier(Visitor)
3646            }
3647        }
3648        struct Visitor;
3649        impl<'de> serde::de::Visitor<'de> for Visitor {
3650            type Value = WeeklyMaintenanceWindow;
3651            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3652                formatter.write_str("struct WeeklyMaintenanceWindow")
3653            }
3654            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3655            where
3656                A: serde::de::MapAccess<'de>,
3657            {
3658                #[allow(unused_imports)]
3659                use serde::de::Error;
3660                use std::option::Option::Some;
3661                let mut fields = std::collections::HashSet::new();
3662                let mut result = Self::Value::new();
3663                while let Some(tag) = map.next_key::<__FieldTag>()? {
3664                    #[allow(clippy::match_single_binding)]
3665                    match tag {
3666                        __FieldTag::__day => {
3667                            if !fields.insert(__FieldTag::__day) {
3668                                return std::result::Result::Err(A::Error::duplicate_field(
3669                                    "multiple values for day",
3670                                ));
3671                            }
3672                            result.day = map
3673                                .next_value::<std::option::Option<gtype::model::DayOfWeek>>()?
3674                                .unwrap_or_default();
3675                        }
3676                        __FieldTag::__start_time => {
3677                            if !fields.insert(__FieldTag::__start_time) {
3678                                return std::result::Result::Err(A::Error::duplicate_field(
3679                                    "multiple values for start_time",
3680                                ));
3681                            }
3682                            result.start_time =
3683                                map.next_value::<std::option::Option<gtype::model::TimeOfDay>>()?;
3684                        }
3685                        __FieldTag::__duration => {
3686                            if !fields.insert(__FieldTag::__duration) {
3687                                return std::result::Result::Err(A::Error::duplicate_field(
3688                                    "multiple values for duration",
3689                                ));
3690                            }
3691                            result.duration =
3692                                map.next_value::<std::option::Option<wkt::Duration>>()?;
3693                        }
3694                        __FieldTag::Unknown(key) => {
3695                            let value = map.next_value::<serde_json::Value>()?;
3696                            result._unknown_fields.insert(key, value);
3697                        }
3698                    }
3699                }
3700                std::result::Result::Ok(result)
3701            }
3702        }
3703        deserializer.deserialize_any(Visitor)
3704    }
3705}
3706
3707#[doc(hidden)]
3708impl serde::ser::Serialize for WeeklyMaintenanceWindow {
3709    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3710    where
3711        S: serde::ser::Serializer,
3712    {
3713        use serde::ser::SerializeMap;
3714        #[allow(unused_imports)]
3715        use std::option::Option::Some;
3716        let mut state = serializer.serialize_map(std::option::Option::None)?;
3717        if !wkt::internal::is_default(&self.day) {
3718            state.serialize_entry("day", &self.day)?;
3719        }
3720        if self.start_time.is_some() {
3721            state.serialize_entry("startTime", &self.start_time)?;
3722        }
3723        if self.duration.is_some() {
3724            state.serialize_entry("duration", &self.duration)?;
3725        }
3726        if !self._unknown_fields.is_empty() {
3727            for (key, value) in self._unknown_fields.iter() {
3728                state.serialize_entry(key, &value)?;
3729            }
3730        }
3731        state.end()
3732    }
3733}
3734
3735impl std::fmt::Debug for WeeklyMaintenanceWindow {
3736    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3737        let mut debug_struct = f.debug_struct("WeeklyMaintenanceWindow");
3738        debug_struct.field("day", &self.day);
3739        debug_struct.field("start_time", &self.start_time);
3740        debug_struct.field("duration", &self.duration);
3741        if !self._unknown_fields.is_empty() {
3742            debug_struct.field("_unknown_fields", &self._unknown_fields);
3743        }
3744        debug_struct.finish()
3745    }
3746}
3747
3748/// Upcoming maintenance schedule. If no maintenance is scheduled, fields are not
3749/// populated.
3750#[derive(Clone, Default, PartialEq)]
3751#[non_exhaustive]
3752pub struct MaintenanceSchedule {
3753    /// Output only. The start time of any upcoming scheduled maintenance for this
3754    /// instance.
3755    pub start_time: std::option::Option<wkt::Timestamp>,
3756
3757    /// Output only. The end time of any upcoming scheduled maintenance for this
3758    /// instance.
3759    pub end_time: std::option::Option<wkt::Timestamp>,
3760
3761    /// If the scheduled maintenance can be rescheduled, default is true.
3762    #[deprecated]
3763    pub can_reschedule: bool,
3764
3765    /// Output only. The deadline that the maintenance schedule start time can not
3766    /// go beyond, including reschedule.
3767    pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
3768
3769    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3770}
3771
3772impl MaintenanceSchedule {
3773    pub fn new() -> Self {
3774        std::default::Default::default()
3775    }
3776
3777    /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
3778    pub fn set_start_time<T>(mut self, v: T) -> Self
3779    where
3780        T: std::convert::Into<wkt::Timestamp>,
3781    {
3782        self.start_time = std::option::Option::Some(v.into());
3783        self
3784    }
3785
3786    /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
3787    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3788    where
3789        T: std::convert::Into<wkt::Timestamp>,
3790    {
3791        self.start_time = v.map(|x| x.into());
3792        self
3793    }
3794
3795    /// Sets the value of [end_time][crate::model::MaintenanceSchedule::end_time].
3796    pub fn set_end_time<T>(mut self, v: T) -> Self
3797    where
3798        T: std::convert::Into<wkt::Timestamp>,
3799    {
3800        self.end_time = std::option::Option::Some(v.into());
3801        self
3802    }
3803
3804    /// Sets or clears the value of [end_time][crate::model::MaintenanceSchedule::end_time].
3805    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3806    where
3807        T: std::convert::Into<wkt::Timestamp>,
3808    {
3809        self.end_time = v.map(|x| x.into());
3810        self
3811    }
3812
3813    /// Sets the value of [can_reschedule][crate::model::MaintenanceSchedule::can_reschedule].
3814    #[deprecated]
3815    pub fn set_can_reschedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3816        self.can_reschedule = v.into();
3817        self
3818    }
3819
3820    /// Sets the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
3821    pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
3822    where
3823        T: std::convert::Into<wkt::Timestamp>,
3824    {
3825        self.schedule_deadline_time = std::option::Option::Some(v.into());
3826        self
3827    }
3828
3829    /// Sets or clears the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
3830    pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
3831    where
3832        T: std::convert::Into<wkt::Timestamp>,
3833    {
3834        self.schedule_deadline_time = v.map(|x| x.into());
3835        self
3836    }
3837}
3838
3839impl wkt::message::Message for MaintenanceSchedule {
3840    fn typename() -> &'static str {
3841        "type.googleapis.com/google.cloud.redis.v1.MaintenanceSchedule"
3842    }
3843}
3844
3845#[doc(hidden)]
3846impl<'de> serde::de::Deserialize<'de> for MaintenanceSchedule {
3847    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3848    where
3849        D: serde::Deserializer<'de>,
3850    {
3851        #[allow(non_camel_case_types)]
3852        #[doc(hidden)]
3853        #[derive(PartialEq, Eq, Hash)]
3854        enum __FieldTag {
3855            __start_time,
3856            __end_time,
3857            __can_reschedule,
3858            __schedule_deadline_time,
3859            Unknown(std::string::String),
3860        }
3861        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
3862            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3863            where
3864                D: serde::Deserializer<'de>,
3865            {
3866                struct Visitor;
3867                impl<'de> serde::de::Visitor<'de> for Visitor {
3868                    type Value = __FieldTag;
3869                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3870                        formatter.write_str("a field name for MaintenanceSchedule")
3871                    }
3872                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
3873                    where
3874                        E: serde::de::Error,
3875                    {
3876                        use std::result::Result::Ok;
3877                        use std::string::ToString;
3878                        match value {
3879                            "startTime" => Ok(__FieldTag::__start_time),
3880                            "start_time" => Ok(__FieldTag::__start_time),
3881                            "endTime" => Ok(__FieldTag::__end_time),
3882                            "end_time" => Ok(__FieldTag::__end_time),
3883                            "canReschedule" => Ok(__FieldTag::__can_reschedule),
3884                            "can_reschedule" => Ok(__FieldTag::__can_reschedule),
3885                            "scheduleDeadlineTime" => Ok(__FieldTag::__schedule_deadline_time),
3886                            "schedule_deadline_time" => Ok(__FieldTag::__schedule_deadline_time),
3887                            _ => Ok(__FieldTag::Unknown(value.to_string())),
3888                        }
3889                    }
3890                }
3891                deserializer.deserialize_identifier(Visitor)
3892            }
3893        }
3894        struct Visitor;
3895        impl<'de> serde::de::Visitor<'de> for Visitor {
3896            type Value = MaintenanceSchedule;
3897            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
3898                formatter.write_str("struct MaintenanceSchedule")
3899            }
3900            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
3901            where
3902                A: serde::de::MapAccess<'de>,
3903            {
3904                #[allow(unused_imports)]
3905                use serde::de::Error;
3906                use std::option::Option::Some;
3907                let mut fields = std::collections::HashSet::new();
3908                let mut result = Self::Value::new();
3909                while let Some(tag) = map.next_key::<__FieldTag>()? {
3910                    #[allow(clippy::match_single_binding)]
3911                    match tag {
3912                        __FieldTag::__start_time => {
3913                            if !fields.insert(__FieldTag::__start_time) {
3914                                return std::result::Result::Err(A::Error::duplicate_field(
3915                                    "multiple values for start_time",
3916                                ));
3917                            }
3918                            result.start_time =
3919                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3920                        }
3921                        __FieldTag::__end_time => {
3922                            if !fields.insert(__FieldTag::__end_time) {
3923                                return std::result::Result::Err(A::Error::duplicate_field(
3924                                    "multiple values for end_time",
3925                                ));
3926                            }
3927                            result.end_time =
3928                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3929                        }
3930                        __FieldTag::__can_reschedule => {
3931                            if !fields.insert(__FieldTag::__can_reschedule) {
3932                                return std::result::Result::Err(A::Error::duplicate_field(
3933                                    "multiple values for can_reschedule",
3934                                ));
3935                            }
3936                            result.can_reschedule = map
3937                                .next_value::<std::option::Option<bool>>()?
3938                                .unwrap_or_default();
3939                        }
3940                        __FieldTag::__schedule_deadline_time => {
3941                            if !fields.insert(__FieldTag::__schedule_deadline_time) {
3942                                return std::result::Result::Err(A::Error::duplicate_field(
3943                                    "multiple values for schedule_deadline_time",
3944                                ));
3945                            }
3946                            result.schedule_deadline_time =
3947                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
3948                        }
3949                        __FieldTag::Unknown(key) => {
3950                            let value = map.next_value::<serde_json::Value>()?;
3951                            result._unknown_fields.insert(key, value);
3952                        }
3953                    }
3954                }
3955                std::result::Result::Ok(result)
3956            }
3957        }
3958        deserializer.deserialize_any(Visitor)
3959    }
3960}
3961
3962#[doc(hidden)]
3963impl serde::ser::Serialize for MaintenanceSchedule {
3964    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3965    where
3966        S: serde::ser::Serializer,
3967    {
3968        use serde::ser::SerializeMap;
3969        #[allow(unused_imports)]
3970        use std::option::Option::Some;
3971        let mut state = serializer.serialize_map(std::option::Option::None)?;
3972        if self.start_time.is_some() {
3973            state.serialize_entry("startTime", &self.start_time)?;
3974        }
3975        if self.end_time.is_some() {
3976            state.serialize_entry("endTime", &self.end_time)?;
3977        }
3978        if !wkt::internal::is_default(&self.can_reschedule) {
3979            state.serialize_entry("canReschedule", &self.can_reschedule)?;
3980        }
3981        if self.schedule_deadline_time.is_some() {
3982            state.serialize_entry("scheduleDeadlineTime", &self.schedule_deadline_time)?;
3983        }
3984        if !self._unknown_fields.is_empty() {
3985            for (key, value) in self._unknown_fields.iter() {
3986                state.serialize_entry(key, &value)?;
3987            }
3988        }
3989        state.end()
3990    }
3991}
3992
3993impl std::fmt::Debug for MaintenanceSchedule {
3994    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3995        let mut debug_struct = f.debug_struct("MaintenanceSchedule");
3996        debug_struct.field("start_time", &self.start_time);
3997        debug_struct.field("end_time", &self.end_time);
3998        debug_struct.field("can_reschedule", &self.can_reschedule);
3999        debug_struct.field("schedule_deadline_time", &self.schedule_deadline_time);
4000        if !self._unknown_fields.is_empty() {
4001            debug_struct.field("_unknown_fields", &self._unknown_fields);
4002        }
4003        debug_struct.finish()
4004    }
4005}
4006
4007/// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
4008///
4009/// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
4010#[derive(Clone, Default, PartialEq)]
4011#[non_exhaustive]
4012pub struct ListInstancesRequest {
4013    /// Required. The resource name of the instance location using the form:
4014    /// `projects/{project_id}/locations/{location_id}`
4015    /// where `location_id` refers to a GCP region.
4016    pub parent: std::string::String,
4017
4018    /// The maximum number of items to return.
4019    ///
4020    /// If not specified, a default value of 1000 will be used by the service.
4021    /// Regardless of the page_size value, the response may include a partial list
4022    /// and a caller should only rely on response's
4023    /// [`next_page_token`][google.cloud.redis.v1.ListInstancesResponse.next_page_token]
4024    /// to determine if there are more instances left to be queried.
4025    ///
4026    /// [google.cloud.redis.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
4027    pub page_size: i32,
4028
4029    /// The `next_page_token` value returned from a previous
4030    /// [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances] request, if
4031    /// any.
4032    ///
4033    /// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
4034    pub page_token: std::string::String,
4035
4036    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4037}
4038
4039impl ListInstancesRequest {
4040    pub fn new() -> Self {
4041        std::default::Default::default()
4042    }
4043
4044    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
4045    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4046        self.parent = v.into();
4047        self
4048    }
4049
4050    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
4051    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4052        self.page_size = v.into();
4053        self
4054    }
4055
4056    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
4057    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4058        self.page_token = v.into();
4059        self
4060    }
4061}
4062
4063impl wkt::message::Message for ListInstancesRequest {
4064    fn typename() -> &'static str {
4065        "type.googleapis.com/google.cloud.redis.v1.ListInstancesRequest"
4066    }
4067}
4068
4069#[doc(hidden)]
4070impl<'de> serde::de::Deserialize<'de> for ListInstancesRequest {
4071    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4072    where
4073        D: serde::Deserializer<'de>,
4074    {
4075        #[allow(non_camel_case_types)]
4076        #[doc(hidden)]
4077        #[derive(PartialEq, Eq, Hash)]
4078        enum __FieldTag {
4079            __parent,
4080            __page_size,
4081            __page_token,
4082            Unknown(std::string::String),
4083        }
4084        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4085            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4086            where
4087                D: serde::Deserializer<'de>,
4088            {
4089                struct Visitor;
4090                impl<'de> serde::de::Visitor<'de> for Visitor {
4091                    type Value = __FieldTag;
4092                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4093                        formatter.write_str("a field name for ListInstancesRequest")
4094                    }
4095                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4096                    where
4097                        E: serde::de::Error,
4098                    {
4099                        use std::result::Result::Ok;
4100                        use std::string::ToString;
4101                        match value {
4102                            "parent" => Ok(__FieldTag::__parent),
4103                            "pageSize" => Ok(__FieldTag::__page_size),
4104                            "page_size" => Ok(__FieldTag::__page_size),
4105                            "pageToken" => Ok(__FieldTag::__page_token),
4106                            "page_token" => Ok(__FieldTag::__page_token),
4107                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4108                        }
4109                    }
4110                }
4111                deserializer.deserialize_identifier(Visitor)
4112            }
4113        }
4114        struct Visitor;
4115        impl<'de> serde::de::Visitor<'de> for Visitor {
4116            type Value = ListInstancesRequest;
4117            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4118                formatter.write_str("struct ListInstancesRequest")
4119            }
4120            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4121            where
4122                A: serde::de::MapAccess<'de>,
4123            {
4124                #[allow(unused_imports)]
4125                use serde::de::Error;
4126                use std::option::Option::Some;
4127                let mut fields = std::collections::HashSet::new();
4128                let mut result = Self::Value::new();
4129                while let Some(tag) = map.next_key::<__FieldTag>()? {
4130                    #[allow(clippy::match_single_binding)]
4131                    match tag {
4132                        __FieldTag::__parent => {
4133                            if !fields.insert(__FieldTag::__parent) {
4134                                return std::result::Result::Err(A::Error::duplicate_field(
4135                                    "multiple values for parent",
4136                                ));
4137                            }
4138                            result.parent = map
4139                                .next_value::<std::option::Option<std::string::String>>()?
4140                                .unwrap_or_default();
4141                        }
4142                        __FieldTag::__page_size => {
4143                            if !fields.insert(__FieldTag::__page_size) {
4144                                return std::result::Result::Err(A::Error::duplicate_field(
4145                                    "multiple values for page_size",
4146                                ));
4147                            }
4148                            struct __With(std::option::Option<i32>);
4149                            impl<'de> serde::de::Deserialize<'de> for __With {
4150                                fn deserialize<D>(
4151                                    deserializer: D,
4152                                ) -> std::result::Result<Self, D::Error>
4153                                where
4154                                    D: serde::de::Deserializer<'de>,
4155                                {
4156                                    serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
4157                                }
4158                            }
4159                            result.page_size = map.next_value::<__With>()?.0.unwrap_or_default();
4160                        }
4161                        __FieldTag::__page_token => {
4162                            if !fields.insert(__FieldTag::__page_token) {
4163                                return std::result::Result::Err(A::Error::duplicate_field(
4164                                    "multiple values for page_token",
4165                                ));
4166                            }
4167                            result.page_token = map
4168                                .next_value::<std::option::Option<std::string::String>>()?
4169                                .unwrap_or_default();
4170                        }
4171                        __FieldTag::Unknown(key) => {
4172                            let value = map.next_value::<serde_json::Value>()?;
4173                            result._unknown_fields.insert(key, value);
4174                        }
4175                    }
4176                }
4177                std::result::Result::Ok(result)
4178            }
4179        }
4180        deserializer.deserialize_any(Visitor)
4181    }
4182}
4183
4184#[doc(hidden)]
4185impl serde::ser::Serialize for ListInstancesRequest {
4186    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4187    where
4188        S: serde::ser::Serializer,
4189    {
4190        use serde::ser::SerializeMap;
4191        #[allow(unused_imports)]
4192        use std::option::Option::Some;
4193        let mut state = serializer.serialize_map(std::option::Option::None)?;
4194        if !self.parent.is_empty() {
4195            state.serialize_entry("parent", &self.parent)?;
4196        }
4197        if !wkt::internal::is_default(&self.page_size) {
4198            struct __With<'a>(&'a i32);
4199            impl<'a> serde::ser::Serialize for __With<'a> {
4200                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4201                where
4202                    S: serde::ser::Serializer,
4203                {
4204                    serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
4205                }
4206            }
4207            state.serialize_entry("pageSize", &__With(&self.page_size))?;
4208        }
4209        if !self.page_token.is_empty() {
4210            state.serialize_entry("pageToken", &self.page_token)?;
4211        }
4212        if !self._unknown_fields.is_empty() {
4213            for (key, value) in self._unknown_fields.iter() {
4214                state.serialize_entry(key, &value)?;
4215            }
4216        }
4217        state.end()
4218    }
4219}
4220
4221impl std::fmt::Debug for ListInstancesRequest {
4222    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4223        let mut debug_struct = f.debug_struct("ListInstancesRequest");
4224        debug_struct.field("parent", &self.parent);
4225        debug_struct.field("page_size", &self.page_size);
4226        debug_struct.field("page_token", &self.page_token);
4227        if !self._unknown_fields.is_empty() {
4228            debug_struct.field("_unknown_fields", &self._unknown_fields);
4229        }
4230        debug_struct.finish()
4231    }
4232}
4233
4234/// Response for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
4235///
4236/// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
4237#[derive(Clone, Default, PartialEq)]
4238#[non_exhaustive]
4239pub struct ListInstancesResponse {
4240    /// A list of Redis instances in the project in the specified location,
4241    /// or across all locations.
4242    ///
4243    /// If the `location_id` in the parent field of the request is "-", all regions
4244    /// available to the project are queried, and the results aggregated.
4245    /// If in such an aggregated query a location is unavailable, a placeholder
4246    /// Redis entry is included in the response with the `name` field set to a
4247    /// value of the form
4248    /// `projects/{project_id}/locations/{location_id}/instances/`- and the
4249    /// `status` field set to ERROR and `status_message` field set to "location not
4250    /// available for ListInstances".
4251    pub instances: std::vec::Vec<crate::model::Instance>,
4252
4253    /// Token to retrieve the next page of results, or empty if there are no more
4254    /// results in the list.
4255    pub next_page_token: std::string::String,
4256
4257    /// Locations that could not be reached.
4258    pub unreachable: std::vec::Vec<std::string::String>,
4259
4260    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4261}
4262
4263impl ListInstancesResponse {
4264    pub fn new() -> Self {
4265        std::default::Default::default()
4266    }
4267
4268    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
4269    pub fn set_instances<T, V>(mut self, v: T) -> Self
4270    where
4271        T: std::iter::IntoIterator<Item = V>,
4272        V: std::convert::Into<crate::model::Instance>,
4273    {
4274        use std::iter::Iterator;
4275        self.instances = v.into_iter().map(|i| i.into()).collect();
4276        self
4277    }
4278
4279    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
4280    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4281        self.next_page_token = v.into();
4282        self
4283    }
4284
4285    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
4286    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
4287    where
4288        T: std::iter::IntoIterator<Item = V>,
4289        V: std::convert::Into<std::string::String>,
4290    {
4291        use std::iter::Iterator;
4292        self.unreachable = v.into_iter().map(|i| i.into()).collect();
4293        self
4294    }
4295}
4296
4297impl wkt::message::Message for ListInstancesResponse {
4298    fn typename() -> &'static str {
4299        "type.googleapis.com/google.cloud.redis.v1.ListInstancesResponse"
4300    }
4301}
4302
4303#[doc(hidden)]
4304impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
4305    type PageItem = crate::model::Instance;
4306
4307    fn items(self) -> std::vec::Vec<Self::PageItem> {
4308        self.instances
4309    }
4310
4311    fn next_page_token(&self) -> std::string::String {
4312        use std::clone::Clone;
4313        self.next_page_token.clone()
4314    }
4315}
4316
4317#[doc(hidden)]
4318impl<'de> serde::de::Deserialize<'de> for ListInstancesResponse {
4319    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4320    where
4321        D: serde::Deserializer<'de>,
4322    {
4323        #[allow(non_camel_case_types)]
4324        #[doc(hidden)]
4325        #[derive(PartialEq, Eq, Hash)]
4326        enum __FieldTag {
4327            __instances,
4328            __next_page_token,
4329            __unreachable,
4330            Unknown(std::string::String),
4331        }
4332        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4333            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4334            where
4335                D: serde::Deserializer<'de>,
4336            {
4337                struct Visitor;
4338                impl<'de> serde::de::Visitor<'de> for Visitor {
4339                    type Value = __FieldTag;
4340                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4341                        formatter.write_str("a field name for ListInstancesResponse")
4342                    }
4343                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4344                    where
4345                        E: serde::de::Error,
4346                    {
4347                        use std::result::Result::Ok;
4348                        use std::string::ToString;
4349                        match value {
4350                            "instances" => Ok(__FieldTag::__instances),
4351                            "nextPageToken" => Ok(__FieldTag::__next_page_token),
4352                            "next_page_token" => Ok(__FieldTag::__next_page_token),
4353                            "unreachable" => Ok(__FieldTag::__unreachable),
4354                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4355                        }
4356                    }
4357                }
4358                deserializer.deserialize_identifier(Visitor)
4359            }
4360        }
4361        struct Visitor;
4362        impl<'de> serde::de::Visitor<'de> for Visitor {
4363            type Value = ListInstancesResponse;
4364            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4365                formatter.write_str("struct ListInstancesResponse")
4366            }
4367            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4368            where
4369                A: serde::de::MapAccess<'de>,
4370            {
4371                #[allow(unused_imports)]
4372                use serde::de::Error;
4373                use std::option::Option::Some;
4374                let mut fields = std::collections::HashSet::new();
4375                let mut result = Self::Value::new();
4376                while let Some(tag) = map.next_key::<__FieldTag>()? {
4377                    #[allow(clippy::match_single_binding)]
4378                    match tag {
4379                        __FieldTag::__instances => {
4380                            if !fields.insert(__FieldTag::__instances) {
4381                                return std::result::Result::Err(A::Error::duplicate_field(
4382                                    "multiple values for instances",
4383                                ));
4384                            }
4385                            result.instances = map.next_value::<std::option::Option<std::vec::Vec<crate::model::Instance>>>()?.unwrap_or_default();
4386                        }
4387                        __FieldTag::__next_page_token => {
4388                            if !fields.insert(__FieldTag::__next_page_token) {
4389                                return std::result::Result::Err(A::Error::duplicate_field(
4390                                    "multiple values for next_page_token",
4391                                ));
4392                            }
4393                            result.next_page_token = map
4394                                .next_value::<std::option::Option<std::string::String>>()?
4395                                .unwrap_or_default();
4396                        }
4397                        __FieldTag::__unreachable => {
4398                            if !fields.insert(__FieldTag::__unreachable) {
4399                                return std::result::Result::Err(A::Error::duplicate_field(
4400                                    "multiple values for unreachable",
4401                                ));
4402                            }
4403                            result.unreachable = map.next_value::<std::option::Option<std::vec::Vec<std::string::String>>>()?.unwrap_or_default();
4404                        }
4405                        __FieldTag::Unknown(key) => {
4406                            let value = map.next_value::<serde_json::Value>()?;
4407                            result._unknown_fields.insert(key, value);
4408                        }
4409                    }
4410                }
4411                std::result::Result::Ok(result)
4412            }
4413        }
4414        deserializer.deserialize_any(Visitor)
4415    }
4416}
4417
4418#[doc(hidden)]
4419impl serde::ser::Serialize for ListInstancesResponse {
4420    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4421    where
4422        S: serde::ser::Serializer,
4423    {
4424        use serde::ser::SerializeMap;
4425        #[allow(unused_imports)]
4426        use std::option::Option::Some;
4427        let mut state = serializer.serialize_map(std::option::Option::None)?;
4428        if !self.instances.is_empty() {
4429            state.serialize_entry("instances", &self.instances)?;
4430        }
4431        if !self.next_page_token.is_empty() {
4432            state.serialize_entry("nextPageToken", &self.next_page_token)?;
4433        }
4434        if !self.unreachable.is_empty() {
4435            state.serialize_entry("unreachable", &self.unreachable)?;
4436        }
4437        if !self._unknown_fields.is_empty() {
4438            for (key, value) in self._unknown_fields.iter() {
4439                state.serialize_entry(key, &value)?;
4440            }
4441        }
4442        state.end()
4443    }
4444}
4445
4446impl std::fmt::Debug for ListInstancesResponse {
4447    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4448        let mut debug_struct = f.debug_struct("ListInstancesResponse");
4449        debug_struct.field("instances", &self.instances);
4450        debug_struct.field("next_page_token", &self.next_page_token);
4451        debug_struct.field("unreachable", &self.unreachable);
4452        if !self._unknown_fields.is_empty() {
4453            debug_struct.field("_unknown_fields", &self._unknown_fields);
4454        }
4455        debug_struct.finish()
4456    }
4457}
4458
4459/// Request for [GetInstance][google.cloud.redis.v1.CloudRedis.GetInstance].
4460///
4461/// [google.cloud.redis.v1.CloudRedis.GetInstance]: crate::client::CloudRedis::get_instance
4462#[derive(Clone, Default, PartialEq)]
4463#[non_exhaustive]
4464pub struct GetInstanceRequest {
4465    /// Required. Redis instance resource name using the form:
4466    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
4467    /// where `location_id` refers to a GCP region.
4468    pub name: std::string::String,
4469
4470    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4471}
4472
4473impl GetInstanceRequest {
4474    pub fn new() -> Self {
4475        std::default::Default::default()
4476    }
4477
4478    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
4479    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4480        self.name = v.into();
4481        self
4482    }
4483}
4484
4485impl wkt::message::Message for GetInstanceRequest {
4486    fn typename() -> &'static str {
4487        "type.googleapis.com/google.cloud.redis.v1.GetInstanceRequest"
4488    }
4489}
4490
4491#[doc(hidden)]
4492impl<'de> serde::de::Deserialize<'de> for GetInstanceRequest {
4493    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4494    where
4495        D: serde::Deserializer<'de>,
4496    {
4497        #[allow(non_camel_case_types)]
4498        #[doc(hidden)]
4499        #[derive(PartialEq, Eq, Hash)]
4500        enum __FieldTag {
4501            __name,
4502            Unknown(std::string::String),
4503        }
4504        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4505            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4506            where
4507                D: serde::Deserializer<'de>,
4508            {
4509                struct Visitor;
4510                impl<'de> serde::de::Visitor<'de> for Visitor {
4511                    type Value = __FieldTag;
4512                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4513                        formatter.write_str("a field name for GetInstanceRequest")
4514                    }
4515                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4516                    where
4517                        E: serde::de::Error,
4518                    {
4519                        use std::result::Result::Ok;
4520                        use std::string::ToString;
4521                        match value {
4522                            "name" => Ok(__FieldTag::__name),
4523                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4524                        }
4525                    }
4526                }
4527                deserializer.deserialize_identifier(Visitor)
4528            }
4529        }
4530        struct Visitor;
4531        impl<'de> serde::de::Visitor<'de> for Visitor {
4532            type Value = GetInstanceRequest;
4533            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4534                formatter.write_str("struct GetInstanceRequest")
4535            }
4536            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4537            where
4538                A: serde::de::MapAccess<'de>,
4539            {
4540                #[allow(unused_imports)]
4541                use serde::de::Error;
4542                use std::option::Option::Some;
4543                let mut fields = std::collections::HashSet::new();
4544                let mut result = Self::Value::new();
4545                while let Some(tag) = map.next_key::<__FieldTag>()? {
4546                    #[allow(clippy::match_single_binding)]
4547                    match tag {
4548                        __FieldTag::__name => {
4549                            if !fields.insert(__FieldTag::__name) {
4550                                return std::result::Result::Err(A::Error::duplicate_field(
4551                                    "multiple values for name",
4552                                ));
4553                            }
4554                            result.name = map
4555                                .next_value::<std::option::Option<std::string::String>>()?
4556                                .unwrap_or_default();
4557                        }
4558                        __FieldTag::Unknown(key) => {
4559                            let value = map.next_value::<serde_json::Value>()?;
4560                            result._unknown_fields.insert(key, value);
4561                        }
4562                    }
4563                }
4564                std::result::Result::Ok(result)
4565            }
4566        }
4567        deserializer.deserialize_any(Visitor)
4568    }
4569}
4570
4571#[doc(hidden)]
4572impl serde::ser::Serialize for GetInstanceRequest {
4573    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4574    where
4575        S: serde::ser::Serializer,
4576    {
4577        use serde::ser::SerializeMap;
4578        #[allow(unused_imports)]
4579        use std::option::Option::Some;
4580        let mut state = serializer.serialize_map(std::option::Option::None)?;
4581        if !self.name.is_empty() {
4582            state.serialize_entry("name", &self.name)?;
4583        }
4584        if !self._unknown_fields.is_empty() {
4585            for (key, value) in self._unknown_fields.iter() {
4586                state.serialize_entry(key, &value)?;
4587            }
4588        }
4589        state.end()
4590    }
4591}
4592
4593impl std::fmt::Debug for GetInstanceRequest {
4594    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4595        let mut debug_struct = f.debug_struct("GetInstanceRequest");
4596        debug_struct.field("name", &self.name);
4597        if !self._unknown_fields.is_empty() {
4598            debug_struct.field("_unknown_fields", &self._unknown_fields);
4599        }
4600        debug_struct.finish()
4601    }
4602}
4603
4604/// Request for
4605/// [GetInstanceAuthString][google.cloud.redis.v1.CloudRedis.GetInstanceAuthString].
4606///
4607/// [google.cloud.redis.v1.CloudRedis.GetInstanceAuthString]: crate::client::CloudRedis::get_instance_auth_string
4608#[derive(Clone, Default, PartialEq)]
4609#[non_exhaustive]
4610pub struct GetInstanceAuthStringRequest {
4611    /// Required. Redis instance resource name using the form:
4612    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
4613    /// where `location_id` refers to a GCP region.
4614    pub name: std::string::String,
4615
4616    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4617}
4618
4619impl GetInstanceAuthStringRequest {
4620    pub fn new() -> Self {
4621        std::default::Default::default()
4622    }
4623
4624    /// Sets the value of [name][crate::model::GetInstanceAuthStringRequest::name].
4625    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4626        self.name = v.into();
4627        self
4628    }
4629}
4630
4631impl wkt::message::Message for GetInstanceAuthStringRequest {
4632    fn typename() -> &'static str {
4633        "type.googleapis.com/google.cloud.redis.v1.GetInstanceAuthStringRequest"
4634    }
4635}
4636
4637#[doc(hidden)]
4638impl<'de> serde::de::Deserialize<'de> for GetInstanceAuthStringRequest {
4639    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4640    where
4641        D: serde::Deserializer<'de>,
4642    {
4643        #[allow(non_camel_case_types)]
4644        #[doc(hidden)]
4645        #[derive(PartialEq, Eq, Hash)]
4646        enum __FieldTag {
4647            __name,
4648            Unknown(std::string::String),
4649        }
4650        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4651            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4652            where
4653                D: serde::Deserializer<'de>,
4654            {
4655                struct Visitor;
4656                impl<'de> serde::de::Visitor<'de> for Visitor {
4657                    type Value = __FieldTag;
4658                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4659                        formatter.write_str("a field name for GetInstanceAuthStringRequest")
4660                    }
4661                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4662                    where
4663                        E: serde::de::Error,
4664                    {
4665                        use std::result::Result::Ok;
4666                        use std::string::ToString;
4667                        match value {
4668                            "name" => Ok(__FieldTag::__name),
4669                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4670                        }
4671                    }
4672                }
4673                deserializer.deserialize_identifier(Visitor)
4674            }
4675        }
4676        struct Visitor;
4677        impl<'de> serde::de::Visitor<'de> for Visitor {
4678            type Value = GetInstanceAuthStringRequest;
4679            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4680                formatter.write_str("struct GetInstanceAuthStringRequest")
4681            }
4682            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4683            where
4684                A: serde::de::MapAccess<'de>,
4685            {
4686                #[allow(unused_imports)]
4687                use serde::de::Error;
4688                use std::option::Option::Some;
4689                let mut fields = std::collections::HashSet::new();
4690                let mut result = Self::Value::new();
4691                while let Some(tag) = map.next_key::<__FieldTag>()? {
4692                    #[allow(clippy::match_single_binding)]
4693                    match tag {
4694                        __FieldTag::__name => {
4695                            if !fields.insert(__FieldTag::__name) {
4696                                return std::result::Result::Err(A::Error::duplicate_field(
4697                                    "multiple values for name",
4698                                ));
4699                            }
4700                            result.name = map
4701                                .next_value::<std::option::Option<std::string::String>>()?
4702                                .unwrap_or_default();
4703                        }
4704                        __FieldTag::Unknown(key) => {
4705                            let value = map.next_value::<serde_json::Value>()?;
4706                            result._unknown_fields.insert(key, value);
4707                        }
4708                    }
4709                }
4710                std::result::Result::Ok(result)
4711            }
4712        }
4713        deserializer.deserialize_any(Visitor)
4714    }
4715}
4716
4717#[doc(hidden)]
4718impl serde::ser::Serialize for GetInstanceAuthStringRequest {
4719    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4720    where
4721        S: serde::ser::Serializer,
4722    {
4723        use serde::ser::SerializeMap;
4724        #[allow(unused_imports)]
4725        use std::option::Option::Some;
4726        let mut state = serializer.serialize_map(std::option::Option::None)?;
4727        if !self.name.is_empty() {
4728            state.serialize_entry("name", &self.name)?;
4729        }
4730        if !self._unknown_fields.is_empty() {
4731            for (key, value) in self._unknown_fields.iter() {
4732                state.serialize_entry(key, &value)?;
4733            }
4734        }
4735        state.end()
4736    }
4737}
4738
4739impl std::fmt::Debug for GetInstanceAuthStringRequest {
4740    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4741        let mut debug_struct = f.debug_struct("GetInstanceAuthStringRequest");
4742        debug_struct.field("name", &self.name);
4743        if !self._unknown_fields.is_empty() {
4744            debug_struct.field("_unknown_fields", &self._unknown_fields);
4745        }
4746        debug_struct.finish()
4747    }
4748}
4749
4750/// Instance AUTH string details.
4751#[derive(Clone, Default, PartialEq)]
4752#[non_exhaustive]
4753pub struct InstanceAuthString {
4754    /// AUTH string set on the instance.
4755    pub auth_string: std::string::String,
4756
4757    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4758}
4759
4760impl InstanceAuthString {
4761    pub fn new() -> Self {
4762        std::default::Default::default()
4763    }
4764
4765    /// Sets the value of [auth_string][crate::model::InstanceAuthString::auth_string].
4766    pub fn set_auth_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4767        self.auth_string = v.into();
4768        self
4769    }
4770}
4771
4772impl wkt::message::Message for InstanceAuthString {
4773    fn typename() -> &'static str {
4774        "type.googleapis.com/google.cloud.redis.v1.InstanceAuthString"
4775    }
4776}
4777
4778#[doc(hidden)]
4779impl<'de> serde::de::Deserialize<'de> for InstanceAuthString {
4780    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4781    where
4782        D: serde::Deserializer<'de>,
4783    {
4784        #[allow(non_camel_case_types)]
4785        #[doc(hidden)]
4786        #[derive(PartialEq, Eq, Hash)]
4787        enum __FieldTag {
4788            __auth_string,
4789            Unknown(std::string::String),
4790        }
4791        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4792            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4793            where
4794                D: serde::Deserializer<'de>,
4795            {
4796                struct Visitor;
4797                impl<'de> serde::de::Visitor<'de> for Visitor {
4798                    type Value = __FieldTag;
4799                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4800                        formatter.write_str("a field name for InstanceAuthString")
4801                    }
4802                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4803                    where
4804                        E: serde::de::Error,
4805                    {
4806                        use std::result::Result::Ok;
4807                        use std::string::ToString;
4808                        match value {
4809                            "authString" => Ok(__FieldTag::__auth_string),
4810                            "auth_string" => Ok(__FieldTag::__auth_string),
4811                            _ => Ok(__FieldTag::Unknown(value.to_string())),
4812                        }
4813                    }
4814                }
4815                deserializer.deserialize_identifier(Visitor)
4816            }
4817        }
4818        struct Visitor;
4819        impl<'de> serde::de::Visitor<'de> for Visitor {
4820            type Value = InstanceAuthString;
4821            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4822                formatter.write_str("struct InstanceAuthString")
4823            }
4824            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
4825            where
4826                A: serde::de::MapAccess<'de>,
4827            {
4828                #[allow(unused_imports)]
4829                use serde::de::Error;
4830                use std::option::Option::Some;
4831                let mut fields = std::collections::HashSet::new();
4832                let mut result = Self::Value::new();
4833                while let Some(tag) = map.next_key::<__FieldTag>()? {
4834                    #[allow(clippy::match_single_binding)]
4835                    match tag {
4836                        __FieldTag::__auth_string => {
4837                            if !fields.insert(__FieldTag::__auth_string) {
4838                                return std::result::Result::Err(A::Error::duplicate_field(
4839                                    "multiple values for auth_string",
4840                                ));
4841                            }
4842                            result.auth_string = map
4843                                .next_value::<std::option::Option<std::string::String>>()?
4844                                .unwrap_or_default();
4845                        }
4846                        __FieldTag::Unknown(key) => {
4847                            let value = map.next_value::<serde_json::Value>()?;
4848                            result._unknown_fields.insert(key, value);
4849                        }
4850                    }
4851                }
4852                std::result::Result::Ok(result)
4853            }
4854        }
4855        deserializer.deserialize_any(Visitor)
4856    }
4857}
4858
4859#[doc(hidden)]
4860impl serde::ser::Serialize for InstanceAuthString {
4861    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4862    where
4863        S: serde::ser::Serializer,
4864    {
4865        use serde::ser::SerializeMap;
4866        #[allow(unused_imports)]
4867        use std::option::Option::Some;
4868        let mut state = serializer.serialize_map(std::option::Option::None)?;
4869        if !self.auth_string.is_empty() {
4870            state.serialize_entry("authString", &self.auth_string)?;
4871        }
4872        if !self._unknown_fields.is_empty() {
4873            for (key, value) in self._unknown_fields.iter() {
4874                state.serialize_entry(key, &value)?;
4875            }
4876        }
4877        state.end()
4878    }
4879}
4880
4881impl std::fmt::Debug for InstanceAuthString {
4882    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4883        let mut debug_struct = f.debug_struct("InstanceAuthString");
4884        debug_struct.field("auth_string", &self.auth_string);
4885        if !self._unknown_fields.is_empty() {
4886            debug_struct.field("_unknown_fields", &self._unknown_fields);
4887        }
4888        debug_struct.finish()
4889    }
4890}
4891
4892/// Request for
4893/// [CreateInstance][google.cloud.redis.v1.CloudRedis.CreateInstance].
4894///
4895/// [google.cloud.redis.v1.CloudRedis.CreateInstance]: crate::client::CloudRedis::create_instance
4896#[derive(Clone, Default, PartialEq)]
4897#[non_exhaustive]
4898pub struct CreateInstanceRequest {
4899    /// Required. The resource name of the instance location using the form:
4900    /// `projects/{project_id}/locations/{location_id}`
4901    /// where `location_id` refers to a GCP region.
4902    pub parent: std::string::String,
4903
4904    /// Required. The logical name of the Redis instance in the customer project
4905    /// with the following restrictions:
4906    ///
4907    /// * Must contain only lowercase letters, numbers, and hyphens.
4908    /// * Must start with a letter.
4909    /// * Must be between 1-40 characters.
4910    /// * Must end with a number or a letter.
4911    /// * Must be unique within the customer project / location
4912    pub instance_id: std::string::String,
4913
4914    /// Required. A Redis [Instance] resource
4915    pub instance: std::option::Option<crate::model::Instance>,
4916
4917    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4918}
4919
4920impl CreateInstanceRequest {
4921    pub fn new() -> Self {
4922        std::default::Default::default()
4923    }
4924
4925    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
4926    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4927        self.parent = v.into();
4928        self
4929    }
4930
4931    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
4932    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4933        self.instance_id = v.into();
4934        self
4935    }
4936
4937    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
4938    pub fn set_instance<T>(mut self, v: T) -> Self
4939    where
4940        T: std::convert::Into<crate::model::Instance>,
4941    {
4942        self.instance = std::option::Option::Some(v.into());
4943        self
4944    }
4945
4946    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
4947    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
4948    where
4949        T: std::convert::Into<crate::model::Instance>,
4950    {
4951        self.instance = v.map(|x| x.into());
4952        self
4953    }
4954}
4955
4956impl wkt::message::Message for CreateInstanceRequest {
4957    fn typename() -> &'static str {
4958        "type.googleapis.com/google.cloud.redis.v1.CreateInstanceRequest"
4959    }
4960}
4961
4962#[doc(hidden)]
4963impl<'de> serde::de::Deserialize<'de> for CreateInstanceRequest {
4964    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4965    where
4966        D: serde::Deserializer<'de>,
4967    {
4968        #[allow(non_camel_case_types)]
4969        #[doc(hidden)]
4970        #[derive(PartialEq, Eq, Hash)]
4971        enum __FieldTag {
4972            __parent,
4973            __instance_id,
4974            __instance,
4975            Unknown(std::string::String),
4976        }
4977        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
4978            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4979            where
4980                D: serde::Deserializer<'de>,
4981            {
4982                struct Visitor;
4983                impl<'de> serde::de::Visitor<'de> for Visitor {
4984                    type Value = __FieldTag;
4985                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
4986                        formatter.write_str("a field name for CreateInstanceRequest")
4987                    }
4988                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
4989                    where
4990                        E: serde::de::Error,
4991                    {
4992                        use std::result::Result::Ok;
4993                        use std::string::ToString;
4994                        match value {
4995                            "parent" => Ok(__FieldTag::__parent),
4996                            "instanceId" => Ok(__FieldTag::__instance_id),
4997                            "instance_id" => Ok(__FieldTag::__instance_id),
4998                            "instance" => Ok(__FieldTag::__instance),
4999                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5000                        }
5001                    }
5002                }
5003                deserializer.deserialize_identifier(Visitor)
5004            }
5005        }
5006        struct Visitor;
5007        impl<'de> serde::de::Visitor<'de> for Visitor {
5008            type Value = CreateInstanceRequest;
5009            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5010                formatter.write_str("struct CreateInstanceRequest")
5011            }
5012            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5013            where
5014                A: serde::de::MapAccess<'de>,
5015            {
5016                #[allow(unused_imports)]
5017                use serde::de::Error;
5018                use std::option::Option::Some;
5019                let mut fields = std::collections::HashSet::new();
5020                let mut result = Self::Value::new();
5021                while let Some(tag) = map.next_key::<__FieldTag>()? {
5022                    #[allow(clippy::match_single_binding)]
5023                    match tag {
5024                        __FieldTag::__parent => {
5025                            if !fields.insert(__FieldTag::__parent) {
5026                                return std::result::Result::Err(A::Error::duplicate_field(
5027                                    "multiple values for parent",
5028                                ));
5029                            }
5030                            result.parent = map
5031                                .next_value::<std::option::Option<std::string::String>>()?
5032                                .unwrap_or_default();
5033                        }
5034                        __FieldTag::__instance_id => {
5035                            if !fields.insert(__FieldTag::__instance_id) {
5036                                return std::result::Result::Err(A::Error::duplicate_field(
5037                                    "multiple values for instance_id",
5038                                ));
5039                            }
5040                            result.instance_id = map
5041                                .next_value::<std::option::Option<std::string::String>>()?
5042                                .unwrap_or_default();
5043                        }
5044                        __FieldTag::__instance => {
5045                            if !fields.insert(__FieldTag::__instance) {
5046                                return std::result::Result::Err(A::Error::duplicate_field(
5047                                    "multiple values for instance",
5048                                ));
5049                            }
5050                            result.instance =
5051                                map.next_value::<std::option::Option<crate::model::Instance>>()?;
5052                        }
5053                        __FieldTag::Unknown(key) => {
5054                            let value = map.next_value::<serde_json::Value>()?;
5055                            result._unknown_fields.insert(key, value);
5056                        }
5057                    }
5058                }
5059                std::result::Result::Ok(result)
5060            }
5061        }
5062        deserializer.deserialize_any(Visitor)
5063    }
5064}
5065
5066#[doc(hidden)]
5067impl serde::ser::Serialize for CreateInstanceRequest {
5068    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5069    where
5070        S: serde::ser::Serializer,
5071    {
5072        use serde::ser::SerializeMap;
5073        #[allow(unused_imports)]
5074        use std::option::Option::Some;
5075        let mut state = serializer.serialize_map(std::option::Option::None)?;
5076        if !self.parent.is_empty() {
5077            state.serialize_entry("parent", &self.parent)?;
5078        }
5079        if !self.instance_id.is_empty() {
5080            state.serialize_entry("instanceId", &self.instance_id)?;
5081        }
5082        if self.instance.is_some() {
5083            state.serialize_entry("instance", &self.instance)?;
5084        }
5085        if !self._unknown_fields.is_empty() {
5086            for (key, value) in self._unknown_fields.iter() {
5087                state.serialize_entry(key, &value)?;
5088            }
5089        }
5090        state.end()
5091    }
5092}
5093
5094impl std::fmt::Debug for CreateInstanceRequest {
5095    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5096        let mut debug_struct = f.debug_struct("CreateInstanceRequest");
5097        debug_struct.field("parent", &self.parent);
5098        debug_struct.field("instance_id", &self.instance_id);
5099        debug_struct.field("instance", &self.instance);
5100        if !self._unknown_fields.is_empty() {
5101            debug_struct.field("_unknown_fields", &self._unknown_fields);
5102        }
5103        debug_struct.finish()
5104    }
5105}
5106
5107/// Request for
5108/// [UpdateInstance][google.cloud.redis.v1.CloudRedis.UpdateInstance].
5109///
5110/// [google.cloud.redis.v1.CloudRedis.UpdateInstance]: crate::client::CloudRedis::update_instance
5111#[derive(Clone, Default, PartialEq)]
5112#[non_exhaustive]
5113pub struct UpdateInstanceRequest {
5114    /// Required. Mask of fields to update. At least one path must be supplied in
5115    /// this field. The elements of the repeated paths field may only include these
5116    /// fields from [Instance][google.cloud.redis.v1.Instance]:
5117    ///
5118    /// * `displayName`
5119    /// * `labels`
5120    /// * `memorySizeGb`
5121    /// * `redisConfig`
5122    /// * `replica_count`
5123    ///
5124    /// [google.cloud.redis.v1.Instance]: crate::model::Instance
5125    pub update_mask: std::option::Option<wkt::FieldMask>,
5126
5127    /// Required. Update description.
5128    /// Only fields specified in update_mask are updated.
5129    pub instance: std::option::Option<crate::model::Instance>,
5130
5131    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5132}
5133
5134impl UpdateInstanceRequest {
5135    pub fn new() -> Self {
5136        std::default::Default::default()
5137    }
5138
5139    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
5140    pub fn set_update_mask<T>(mut self, v: T) -> Self
5141    where
5142        T: std::convert::Into<wkt::FieldMask>,
5143    {
5144        self.update_mask = std::option::Option::Some(v.into());
5145        self
5146    }
5147
5148    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
5149    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5150    where
5151        T: std::convert::Into<wkt::FieldMask>,
5152    {
5153        self.update_mask = v.map(|x| x.into());
5154        self
5155    }
5156
5157    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
5158    pub fn set_instance<T>(mut self, v: T) -> Self
5159    where
5160        T: std::convert::Into<crate::model::Instance>,
5161    {
5162        self.instance = std::option::Option::Some(v.into());
5163        self
5164    }
5165
5166    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
5167    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
5168    where
5169        T: std::convert::Into<crate::model::Instance>,
5170    {
5171        self.instance = v.map(|x| x.into());
5172        self
5173    }
5174}
5175
5176impl wkt::message::Message for UpdateInstanceRequest {
5177    fn typename() -> &'static str {
5178        "type.googleapis.com/google.cloud.redis.v1.UpdateInstanceRequest"
5179    }
5180}
5181
5182#[doc(hidden)]
5183impl<'de> serde::de::Deserialize<'de> for UpdateInstanceRequest {
5184    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5185    where
5186        D: serde::Deserializer<'de>,
5187    {
5188        #[allow(non_camel_case_types)]
5189        #[doc(hidden)]
5190        #[derive(PartialEq, Eq, Hash)]
5191        enum __FieldTag {
5192            __update_mask,
5193            __instance,
5194            Unknown(std::string::String),
5195        }
5196        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5197            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5198            where
5199                D: serde::Deserializer<'de>,
5200            {
5201                struct Visitor;
5202                impl<'de> serde::de::Visitor<'de> for Visitor {
5203                    type Value = __FieldTag;
5204                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5205                        formatter.write_str("a field name for UpdateInstanceRequest")
5206                    }
5207                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5208                    where
5209                        E: serde::de::Error,
5210                    {
5211                        use std::result::Result::Ok;
5212                        use std::string::ToString;
5213                        match value {
5214                            "updateMask" => Ok(__FieldTag::__update_mask),
5215                            "update_mask" => Ok(__FieldTag::__update_mask),
5216                            "instance" => Ok(__FieldTag::__instance),
5217                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5218                        }
5219                    }
5220                }
5221                deserializer.deserialize_identifier(Visitor)
5222            }
5223        }
5224        struct Visitor;
5225        impl<'de> serde::de::Visitor<'de> for Visitor {
5226            type Value = UpdateInstanceRequest;
5227            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5228                formatter.write_str("struct UpdateInstanceRequest")
5229            }
5230            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5231            where
5232                A: serde::de::MapAccess<'de>,
5233            {
5234                #[allow(unused_imports)]
5235                use serde::de::Error;
5236                use std::option::Option::Some;
5237                let mut fields = std::collections::HashSet::new();
5238                let mut result = Self::Value::new();
5239                while let Some(tag) = map.next_key::<__FieldTag>()? {
5240                    #[allow(clippy::match_single_binding)]
5241                    match tag {
5242                        __FieldTag::__update_mask => {
5243                            if !fields.insert(__FieldTag::__update_mask) {
5244                                return std::result::Result::Err(A::Error::duplicate_field(
5245                                    "multiple values for update_mask",
5246                                ));
5247                            }
5248                            result.update_mask =
5249                                map.next_value::<std::option::Option<wkt::FieldMask>>()?;
5250                        }
5251                        __FieldTag::__instance => {
5252                            if !fields.insert(__FieldTag::__instance) {
5253                                return std::result::Result::Err(A::Error::duplicate_field(
5254                                    "multiple values for instance",
5255                                ));
5256                            }
5257                            result.instance =
5258                                map.next_value::<std::option::Option<crate::model::Instance>>()?;
5259                        }
5260                        __FieldTag::Unknown(key) => {
5261                            let value = map.next_value::<serde_json::Value>()?;
5262                            result._unknown_fields.insert(key, value);
5263                        }
5264                    }
5265                }
5266                std::result::Result::Ok(result)
5267            }
5268        }
5269        deserializer.deserialize_any(Visitor)
5270    }
5271}
5272
5273#[doc(hidden)]
5274impl serde::ser::Serialize for UpdateInstanceRequest {
5275    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5276    where
5277        S: serde::ser::Serializer,
5278    {
5279        use serde::ser::SerializeMap;
5280        #[allow(unused_imports)]
5281        use std::option::Option::Some;
5282        let mut state = serializer.serialize_map(std::option::Option::None)?;
5283        if self.update_mask.is_some() {
5284            state.serialize_entry("updateMask", &self.update_mask)?;
5285        }
5286        if self.instance.is_some() {
5287            state.serialize_entry("instance", &self.instance)?;
5288        }
5289        if !self._unknown_fields.is_empty() {
5290            for (key, value) in self._unknown_fields.iter() {
5291                state.serialize_entry(key, &value)?;
5292            }
5293        }
5294        state.end()
5295    }
5296}
5297
5298impl std::fmt::Debug for UpdateInstanceRequest {
5299    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5300        let mut debug_struct = f.debug_struct("UpdateInstanceRequest");
5301        debug_struct.field("update_mask", &self.update_mask);
5302        debug_struct.field("instance", &self.instance);
5303        if !self._unknown_fields.is_empty() {
5304            debug_struct.field("_unknown_fields", &self._unknown_fields);
5305        }
5306        debug_struct.finish()
5307    }
5308}
5309
5310/// Request for
5311/// [UpgradeInstance][google.cloud.redis.v1.CloudRedis.UpgradeInstance].
5312///
5313/// [google.cloud.redis.v1.CloudRedis.UpgradeInstance]: crate::client::CloudRedis::upgrade_instance
5314#[derive(Clone, Default, PartialEq)]
5315#[non_exhaustive]
5316pub struct UpgradeInstanceRequest {
5317    /// Required. Redis instance resource name using the form:
5318    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
5319    /// where `location_id` refers to a GCP region.
5320    pub name: std::string::String,
5321
5322    /// Required. Specifies the target version of Redis software to upgrade to.
5323    pub redis_version: std::string::String,
5324
5325    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5326}
5327
5328impl UpgradeInstanceRequest {
5329    pub fn new() -> Self {
5330        std::default::Default::default()
5331    }
5332
5333    /// Sets the value of [name][crate::model::UpgradeInstanceRequest::name].
5334    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5335        self.name = v.into();
5336        self
5337    }
5338
5339    /// Sets the value of [redis_version][crate::model::UpgradeInstanceRequest::redis_version].
5340    pub fn set_redis_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5341        self.redis_version = v.into();
5342        self
5343    }
5344}
5345
5346impl wkt::message::Message for UpgradeInstanceRequest {
5347    fn typename() -> &'static str {
5348        "type.googleapis.com/google.cloud.redis.v1.UpgradeInstanceRequest"
5349    }
5350}
5351
5352#[doc(hidden)]
5353impl<'de> serde::de::Deserialize<'de> for UpgradeInstanceRequest {
5354    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5355    where
5356        D: serde::Deserializer<'de>,
5357    {
5358        #[allow(non_camel_case_types)]
5359        #[doc(hidden)]
5360        #[derive(PartialEq, Eq, Hash)]
5361        enum __FieldTag {
5362            __name,
5363            __redis_version,
5364            Unknown(std::string::String),
5365        }
5366        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5367            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5368            where
5369                D: serde::Deserializer<'de>,
5370            {
5371                struct Visitor;
5372                impl<'de> serde::de::Visitor<'de> for Visitor {
5373                    type Value = __FieldTag;
5374                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5375                        formatter.write_str("a field name for UpgradeInstanceRequest")
5376                    }
5377                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5378                    where
5379                        E: serde::de::Error,
5380                    {
5381                        use std::result::Result::Ok;
5382                        use std::string::ToString;
5383                        match value {
5384                            "name" => Ok(__FieldTag::__name),
5385                            "redisVersion" => Ok(__FieldTag::__redis_version),
5386                            "redis_version" => Ok(__FieldTag::__redis_version),
5387                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5388                        }
5389                    }
5390                }
5391                deserializer.deserialize_identifier(Visitor)
5392            }
5393        }
5394        struct Visitor;
5395        impl<'de> serde::de::Visitor<'de> for Visitor {
5396            type Value = UpgradeInstanceRequest;
5397            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5398                formatter.write_str("struct UpgradeInstanceRequest")
5399            }
5400            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5401            where
5402                A: serde::de::MapAccess<'de>,
5403            {
5404                #[allow(unused_imports)]
5405                use serde::de::Error;
5406                use std::option::Option::Some;
5407                let mut fields = std::collections::HashSet::new();
5408                let mut result = Self::Value::new();
5409                while let Some(tag) = map.next_key::<__FieldTag>()? {
5410                    #[allow(clippy::match_single_binding)]
5411                    match tag {
5412                        __FieldTag::__name => {
5413                            if !fields.insert(__FieldTag::__name) {
5414                                return std::result::Result::Err(A::Error::duplicate_field(
5415                                    "multiple values for name",
5416                                ));
5417                            }
5418                            result.name = map
5419                                .next_value::<std::option::Option<std::string::String>>()?
5420                                .unwrap_or_default();
5421                        }
5422                        __FieldTag::__redis_version => {
5423                            if !fields.insert(__FieldTag::__redis_version) {
5424                                return std::result::Result::Err(A::Error::duplicate_field(
5425                                    "multiple values for redis_version",
5426                                ));
5427                            }
5428                            result.redis_version = map
5429                                .next_value::<std::option::Option<std::string::String>>()?
5430                                .unwrap_or_default();
5431                        }
5432                        __FieldTag::Unknown(key) => {
5433                            let value = map.next_value::<serde_json::Value>()?;
5434                            result._unknown_fields.insert(key, value);
5435                        }
5436                    }
5437                }
5438                std::result::Result::Ok(result)
5439            }
5440        }
5441        deserializer.deserialize_any(Visitor)
5442    }
5443}
5444
5445#[doc(hidden)]
5446impl serde::ser::Serialize for UpgradeInstanceRequest {
5447    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5448    where
5449        S: serde::ser::Serializer,
5450    {
5451        use serde::ser::SerializeMap;
5452        #[allow(unused_imports)]
5453        use std::option::Option::Some;
5454        let mut state = serializer.serialize_map(std::option::Option::None)?;
5455        if !self.name.is_empty() {
5456            state.serialize_entry("name", &self.name)?;
5457        }
5458        if !self.redis_version.is_empty() {
5459            state.serialize_entry("redisVersion", &self.redis_version)?;
5460        }
5461        if !self._unknown_fields.is_empty() {
5462            for (key, value) in self._unknown_fields.iter() {
5463                state.serialize_entry(key, &value)?;
5464            }
5465        }
5466        state.end()
5467    }
5468}
5469
5470impl std::fmt::Debug for UpgradeInstanceRequest {
5471    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5472        let mut debug_struct = f.debug_struct("UpgradeInstanceRequest");
5473        debug_struct.field("name", &self.name);
5474        debug_struct.field("redis_version", &self.redis_version);
5475        if !self._unknown_fields.is_empty() {
5476            debug_struct.field("_unknown_fields", &self._unknown_fields);
5477        }
5478        debug_struct.finish()
5479    }
5480}
5481
5482/// Request for
5483/// [DeleteInstance][google.cloud.redis.v1.CloudRedis.DeleteInstance].
5484///
5485/// [google.cloud.redis.v1.CloudRedis.DeleteInstance]: crate::client::CloudRedis::delete_instance
5486#[derive(Clone, Default, PartialEq)]
5487#[non_exhaustive]
5488pub struct DeleteInstanceRequest {
5489    /// Required. Redis instance resource name using the form:
5490    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
5491    /// where `location_id` refers to a GCP region.
5492    pub name: std::string::String,
5493
5494    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5495}
5496
5497impl DeleteInstanceRequest {
5498    pub fn new() -> Self {
5499        std::default::Default::default()
5500    }
5501
5502    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
5503    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5504        self.name = v.into();
5505        self
5506    }
5507}
5508
5509impl wkt::message::Message for DeleteInstanceRequest {
5510    fn typename() -> &'static str {
5511        "type.googleapis.com/google.cloud.redis.v1.DeleteInstanceRequest"
5512    }
5513}
5514
5515#[doc(hidden)]
5516impl<'de> serde::de::Deserialize<'de> for DeleteInstanceRequest {
5517    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5518    where
5519        D: serde::Deserializer<'de>,
5520    {
5521        #[allow(non_camel_case_types)]
5522        #[doc(hidden)]
5523        #[derive(PartialEq, Eq, Hash)]
5524        enum __FieldTag {
5525            __name,
5526            Unknown(std::string::String),
5527        }
5528        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5529            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5530            where
5531                D: serde::Deserializer<'de>,
5532            {
5533                struct Visitor;
5534                impl<'de> serde::de::Visitor<'de> for Visitor {
5535                    type Value = __FieldTag;
5536                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5537                        formatter.write_str("a field name for DeleteInstanceRequest")
5538                    }
5539                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5540                    where
5541                        E: serde::de::Error,
5542                    {
5543                        use std::result::Result::Ok;
5544                        use std::string::ToString;
5545                        match value {
5546                            "name" => Ok(__FieldTag::__name),
5547                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5548                        }
5549                    }
5550                }
5551                deserializer.deserialize_identifier(Visitor)
5552            }
5553        }
5554        struct Visitor;
5555        impl<'de> serde::de::Visitor<'de> for Visitor {
5556            type Value = DeleteInstanceRequest;
5557            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5558                formatter.write_str("struct DeleteInstanceRequest")
5559            }
5560            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5561            where
5562                A: serde::de::MapAccess<'de>,
5563            {
5564                #[allow(unused_imports)]
5565                use serde::de::Error;
5566                use std::option::Option::Some;
5567                let mut fields = std::collections::HashSet::new();
5568                let mut result = Self::Value::new();
5569                while let Some(tag) = map.next_key::<__FieldTag>()? {
5570                    #[allow(clippy::match_single_binding)]
5571                    match tag {
5572                        __FieldTag::__name => {
5573                            if !fields.insert(__FieldTag::__name) {
5574                                return std::result::Result::Err(A::Error::duplicate_field(
5575                                    "multiple values for name",
5576                                ));
5577                            }
5578                            result.name = map
5579                                .next_value::<std::option::Option<std::string::String>>()?
5580                                .unwrap_or_default();
5581                        }
5582                        __FieldTag::Unknown(key) => {
5583                            let value = map.next_value::<serde_json::Value>()?;
5584                            result._unknown_fields.insert(key, value);
5585                        }
5586                    }
5587                }
5588                std::result::Result::Ok(result)
5589            }
5590        }
5591        deserializer.deserialize_any(Visitor)
5592    }
5593}
5594
5595#[doc(hidden)]
5596impl serde::ser::Serialize for DeleteInstanceRequest {
5597    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5598    where
5599        S: serde::ser::Serializer,
5600    {
5601        use serde::ser::SerializeMap;
5602        #[allow(unused_imports)]
5603        use std::option::Option::Some;
5604        let mut state = serializer.serialize_map(std::option::Option::None)?;
5605        if !self.name.is_empty() {
5606            state.serialize_entry("name", &self.name)?;
5607        }
5608        if !self._unknown_fields.is_empty() {
5609            for (key, value) in self._unknown_fields.iter() {
5610                state.serialize_entry(key, &value)?;
5611            }
5612        }
5613        state.end()
5614    }
5615}
5616
5617impl std::fmt::Debug for DeleteInstanceRequest {
5618    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5619        let mut debug_struct = f.debug_struct("DeleteInstanceRequest");
5620        debug_struct.field("name", &self.name);
5621        if !self._unknown_fields.is_empty() {
5622            debug_struct.field("_unknown_fields", &self._unknown_fields);
5623        }
5624        debug_struct.finish()
5625    }
5626}
5627
5628/// The Cloud Storage location for the input content
5629#[derive(Clone, Default, PartialEq)]
5630#[non_exhaustive]
5631pub struct GcsSource {
5632    /// Required. Source data URI. (e.g. 'gs://my_bucket/my_object').
5633    pub uri: std::string::String,
5634
5635    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5636}
5637
5638impl GcsSource {
5639    pub fn new() -> Self {
5640        std::default::Default::default()
5641    }
5642
5643    /// Sets the value of [uri][crate::model::GcsSource::uri].
5644    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5645        self.uri = v.into();
5646        self
5647    }
5648}
5649
5650impl wkt::message::Message for GcsSource {
5651    fn typename() -> &'static str {
5652        "type.googleapis.com/google.cloud.redis.v1.GcsSource"
5653    }
5654}
5655
5656#[doc(hidden)]
5657impl<'de> serde::de::Deserialize<'de> for GcsSource {
5658    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5659    where
5660        D: serde::Deserializer<'de>,
5661    {
5662        #[allow(non_camel_case_types)]
5663        #[doc(hidden)]
5664        #[derive(PartialEq, Eq, Hash)]
5665        enum __FieldTag {
5666            __uri,
5667            Unknown(std::string::String),
5668        }
5669        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5670            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5671            where
5672                D: serde::Deserializer<'de>,
5673            {
5674                struct Visitor;
5675                impl<'de> serde::de::Visitor<'de> for Visitor {
5676                    type Value = __FieldTag;
5677                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5678                        formatter.write_str("a field name for GcsSource")
5679                    }
5680                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5681                    where
5682                        E: serde::de::Error,
5683                    {
5684                        use std::result::Result::Ok;
5685                        use std::string::ToString;
5686                        match value {
5687                            "uri" => Ok(__FieldTag::__uri),
5688                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5689                        }
5690                    }
5691                }
5692                deserializer.deserialize_identifier(Visitor)
5693            }
5694        }
5695        struct Visitor;
5696        impl<'de> serde::de::Visitor<'de> for Visitor {
5697            type Value = GcsSource;
5698            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5699                formatter.write_str("struct GcsSource")
5700            }
5701            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5702            where
5703                A: serde::de::MapAccess<'de>,
5704            {
5705                #[allow(unused_imports)]
5706                use serde::de::Error;
5707                use std::option::Option::Some;
5708                let mut fields = std::collections::HashSet::new();
5709                let mut result = Self::Value::new();
5710                while let Some(tag) = map.next_key::<__FieldTag>()? {
5711                    #[allow(clippy::match_single_binding)]
5712                    match tag {
5713                        __FieldTag::__uri => {
5714                            if !fields.insert(__FieldTag::__uri) {
5715                                return std::result::Result::Err(A::Error::duplicate_field(
5716                                    "multiple values for uri",
5717                                ));
5718                            }
5719                            result.uri = map
5720                                .next_value::<std::option::Option<std::string::String>>()?
5721                                .unwrap_or_default();
5722                        }
5723                        __FieldTag::Unknown(key) => {
5724                            let value = map.next_value::<serde_json::Value>()?;
5725                            result._unknown_fields.insert(key, value);
5726                        }
5727                    }
5728                }
5729                std::result::Result::Ok(result)
5730            }
5731        }
5732        deserializer.deserialize_any(Visitor)
5733    }
5734}
5735
5736#[doc(hidden)]
5737impl serde::ser::Serialize for GcsSource {
5738    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5739    where
5740        S: serde::ser::Serializer,
5741    {
5742        use serde::ser::SerializeMap;
5743        #[allow(unused_imports)]
5744        use std::option::Option::Some;
5745        let mut state = serializer.serialize_map(std::option::Option::None)?;
5746        if !self.uri.is_empty() {
5747            state.serialize_entry("uri", &self.uri)?;
5748        }
5749        if !self._unknown_fields.is_empty() {
5750            for (key, value) in self._unknown_fields.iter() {
5751                state.serialize_entry(key, &value)?;
5752            }
5753        }
5754        state.end()
5755    }
5756}
5757
5758impl std::fmt::Debug for GcsSource {
5759    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5760        let mut debug_struct = f.debug_struct("GcsSource");
5761        debug_struct.field("uri", &self.uri);
5762        if !self._unknown_fields.is_empty() {
5763            debug_struct.field("_unknown_fields", &self._unknown_fields);
5764        }
5765        debug_struct.finish()
5766    }
5767}
5768
5769/// The input content
5770#[derive(Clone, Default, PartialEq)]
5771#[non_exhaustive]
5772pub struct InputConfig {
5773    /// Required. Specify source location of input data
5774    pub source: std::option::Option<crate::model::input_config::Source>,
5775
5776    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5777}
5778
5779impl InputConfig {
5780    pub fn new() -> Self {
5781        std::default::Default::default()
5782    }
5783
5784    /// Sets the value of [source][crate::model::InputConfig::source].
5785    ///
5786    /// Note that all the setters affecting `source` are mutually
5787    /// exclusive.
5788    pub fn set_source<
5789        T: std::convert::Into<std::option::Option<crate::model::input_config::Source>>,
5790    >(
5791        mut self,
5792        v: T,
5793    ) -> Self {
5794        self.source = v.into();
5795        self
5796    }
5797
5798    /// The value of [source][crate::model::InputConfig::source]
5799    /// if it holds a `GcsSource`, `None` if the field is not set or
5800    /// holds a different branch.
5801    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
5802        #[allow(unreachable_patterns)]
5803        self.source.as_ref().and_then(|v| match v {
5804            crate::model::input_config::Source::GcsSource(v) => std::option::Option::Some(v),
5805            _ => std::option::Option::None,
5806        })
5807    }
5808
5809    /// Sets the value of [source][crate::model::InputConfig::source]
5810    /// to hold a `GcsSource`.
5811    ///
5812    /// Note that all the setters affecting `source` are
5813    /// mutually exclusive.
5814    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5815        mut self,
5816        v: T,
5817    ) -> Self {
5818        self.source =
5819            std::option::Option::Some(crate::model::input_config::Source::GcsSource(v.into()));
5820        self
5821    }
5822}
5823
5824impl wkt::message::Message for InputConfig {
5825    fn typename() -> &'static str {
5826        "type.googleapis.com/google.cloud.redis.v1.InputConfig"
5827    }
5828}
5829
5830#[doc(hidden)]
5831impl<'de> serde::de::Deserialize<'de> for InputConfig {
5832    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5833    where
5834        D: serde::Deserializer<'de>,
5835    {
5836        #[allow(non_camel_case_types)]
5837        #[doc(hidden)]
5838        #[derive(PartialEq, Eq, Hash)]
5839        enum __FieldTag {
5840            __gcs_source,
5841            Unknown(std::string::String),
5842        }
5843        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
5844            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5845            where
5846                D: serde::Deserializer<'de>,
5847            {
5848                struct Visitor;
5849                impl<'de> serde::de::Visitor<'de> for Visitor {
5850                    type Value = __FieldTag;
5851                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5852                        formatter.write_str("a field name for InputConfig")
5853                    }
5854                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
5855                    where
5856                        E: serde::de::Error,
5857                    {
5858                        use std::result::Result::Ok;
5859                        use std::string::ToString;
5860                        match value {
5861                            "gcsSource" => Ok(__FieldTag::__gcs_source),
5862                            "gcs_source" => Ok(__FieldTag::__gcs_source),
5863                            _ => Ok(__FieldTag::Unknown(value.to_string())),
5864                        }
5865                    }
5866                }
5867                deserializer.deserialize_identifier(Visitor)
5868            }
5869        }
5870        struct Visitor;
5871        impl<'de> serde::de::Visitor<'de> for Visitor {
5872            type Value = InputConfig;
5873            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
5874                formatter.write_str("struct InputConfig")
5875            }
5876            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
5877            where
5878                A: serde::de::MapAccess<'de>,
5879            {
5880                #[allow(unused_imports)]
5881                use serde::de::Error;
5882                use std::option::Option::Some;
5883                let mut fields = std::collections::HashSet::new();
5884                let mut result = Self::Value::new();
5885                while let Some(tag) = map.next_key::<__FieldTag>()? {
5886                    #[allow(clippy::match_single_binding)]
5887                    match tag {
5888                        __FieldTag::__gcs_source => {
5889                            if !fields.insert(__FieldTag::__gcs_source) {
5890                                return std::result::Result::Err(A::Error::duplicate_field(
5891                                    "multiple values for gcs_source",
5892                                ));
5893                            }
5894                            if result.source.is_some() {
5895                                return std::result::Result::Err(A::Error::duplicate_field(
5896                                    "multiple values for `source`, a oneof with full ID .google.cloud.redis.v1.InputConfig.gcs_source, latest field was gcsSource",
5897                                ));
5898                            }
5899                            result.source = std::option::Option::Some(
5900                                crate::model::input_config::Source::GcsSource(
5901                                    map.next_value::<std::option::Option<
5902                                        std::boxed::Box<crate::model::GcsSource>,
5903                                    >>()?
5904                                    .unwrap_or_default(),
5905                                ),
5906                            );
5907                        }
5908                        __FieldTag::Unknown(key) => {
5909                            let value = map.next_value::<serde_json::Value>()?;
5910                            result._unknown_fields.insert(key, value);
5911                        }
5912                    }
5913                }
5914                std::result::Result::Ok(result)
5915            }
5916        }
5917        deserializer.deserialize_any(Visitor)
5918    }
5919}
5920
5921#[doc(hidden)]
5922impl serde::ser::Serialize for InputConfig {
5923    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5924    where
5925        S: serde::ser::Serializer,
5926    {
5927        use serde::ser::SerializeMap;
5928        #[allow(unused_imports)]
5929        use std::option::Option::Some;
5930        let mut state = serializer.serialize_map(std::option::Option::None)?;
5931        if let Some(value) = self.gcs_source() {
5932            state.serialize_entry("gcsSource", value)?;
5933        }
5934        if !self._unknown_fields.is_empty() {
5935            for (key, value) in self._unknown_fields.iter() {
5936                state.serialize_entry(key, &value)?;
5937            }
5938        }
5939        state.end()
5940    }
5941}
5942
5943impl std::fmt::Debug for InputConfig {
5944    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5945        let mut debug_struct = f.debug_struct("InputConfig");
5946        debug_struct.field("source", &self.source);
5947        if !self._unknown_fields.is_empty() {
5948            debug_struct.field("_unknown_fields", &self._unknown_fields);
5949        }
5950        debug_struct.finish()
5951    }
5952}
5953
5954/// Defines additional types related to [InputConfig].
5955pub mod input_config {
5956    #[allow(unused_imports)]
5957    use super::*;
5958
5959    /// Required. Specify source location of input data
5960    #[derive(Clone, Debug, PartialEq)]
5961    #[non_exhaustive]
5962    pub enum Source {
5963        /// Google Cloud Storage location where input content is located.
5964        GcsSource(std::boxed::Box<crate::model::GcsSource>),
5965    }
5966}
5967
5968/// Request for [Import][google.cloud.redis.v1.CloudRedis.ImportInstance].
5969///
5970/// [google.cloud.redis.v1.CloudRedis.ImportInstance]: crate::client::CloudRedis::import_instance
5971#[derive(Clone, Default, PartialEq)]
5972#[non_exhaustive]
5973pub struct ImportInstanceRequest {
5974    /// Required. Redis instance resource name using the form:
5975    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
5976    /// where `location_id` refers to a GCP region.
5977    pub name: std::string::String,
5978
5979    /// Required. Specify data to be imported.
5980    pub input_config: std::option::Option<crate::model::InputConfig>,
5981
5982    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5983}
5984
5985impl ImportInstanceRequest {
5986    pub fn new() -> Self {
5987        std::default::Default::default()
5988    }
5989
5990    /// Sets the value of [name][crate::model::ImportInstanceRequest::name].
5991    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5992        self.name = v.into();
5993        self
5994    }
5995
5996    /// Sets the value of [input_config][crate::model::ImportInstanceRequest::input_config].
5997    pub fn set_input_config<T>(mut self, v: T) -> Self
5998    where
5999        T: std::convert::Into<crate::model::InputConfig>,
6000    {
6001        self.input_config = std::option::Option::Some(v.into());
6002        self
6003    }
6004
6005    /// Sets or clears the value of [input_config][crate::model::ImportInstanceRequest::input_config].
6006    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
6007    where
6008        T: std::convert::Into<crate::model::InputConfig>,
6009    {
6010        self.input_config = v.map(|x| x.into());
6011        self
6012    }
6013}
6014
6015impl wkt::message::Message for ImportInstanceRequest {
6016    fn typename() -> &'static str {
6017        "type.googleapis.com/google.cloud.redis.v1.ImportInstanceRequest"
6018    }
6019}
6020
6021#[doc(hidden)]
6022impl<'de> serde::de::Deserialize<'de> for ImportInstanceRequest {
6023    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6024    where
6025        D: serde::Deserializer<'de>,
6026    {
6027        #[allow(non_camel_case_types)]
6028        #[doc(hidden)]
6029        #[derive(PartialEq, Eq, Hash)]
6030        enum __FieldTag {
6031            __name,
6032            __input_config,
6033            Unknown(std::string::String),
6034        }
6035        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6036            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6037            where
6038                D: serde::Deserializer<'de>,
6039            {
6040                struct Visitor;
6041                impl<'de> serde::de::Visitor<'de> for Visitor {
6042                    type Value = __FieldTag;
6043                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6044                        formatter.write_str("a field name for ImportInstanceRequest")
6045                    }
6046                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6047                    where
6048                        E: serde::de::Error,
6049                    {
6050                        use std::result::Result::Ok;
6051                        use std::string::ToString;
6052                        match value {
6053                            "name" => Ok(__FieldTag::__name),
6054                            "inputConfig" => Ok(__FieldTag::__input_config),
6055                            "input_config" => Ok(__FieldTag::__input_config),
6056                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6057                        }
6058                    }
6059                }
6060                deserializer.deserialize_identifier(Visitor)
6061            }
6062        }
6063        struct Visitor;
6064        impl<'de> serde::de::Visitor<'de> for Visitor {
6065            type Value = ImportInstanceRequest;
6066            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6067                formatter.write_str("struct ImportInstanceRequest")
6068            }
6069            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6070            where
6071                A: serde::de::MapAccess<'de>,
6072            {
6073                #[allow(unused_imports)]
6074                use serde::de::Error;
6075                use std::option::Option::Some;
6076                let mut fields = std::collections::HashSet::new();
6077                let mut result = Self::Value::new();
6078                while let Some(tag) = map.next_key::<__FieldTag>()? {
6079                    #[allow(clippy::match_single_binding)]
6080                    match tag {
6081                        __FieldTag::__name => {
6082                            if !fields.insert(__FieldTag::__name) {
6083                                return std::result::Result::Err(A::Error::duplicate_field(
6084                                    "multiple values for name",
6085                                ));
6086                            }
6087                            result.name = map
6088                                .next_value::<std::option::Option<std::string::String>>()?
6089                                .unwrap_or_default();
6090                        }
6091                        __FieldTag::__input_config => {
6092                            if !fields.insert(__FieldTag::__input_config) {
6093                                return std::result::Result::Err(A::Error::duplicate_field(
6094                                    "multiple values for input_config",
6095                                ));
6096                            }
6097                            result.input_config =
6098                                map.next_value::<std::option::Option<crate::model::InputConfig>>()?;
6099                        }
6100                        __FieldTag::Unknown(key) => {
6101                            let value = map.next_value::<serde_json::Value>()?;
6102                            result._unknown_fields.insert(key, value);
6103                        }
6104                    }
6105                }
6106                std::result::Result::Ok(result)
6107            }
6108        }
6109        deserializer.deserialize_any(Visitor)
6110    }
6111}
6112
6113#[doc(hidden)]
6114impl serde::ser::Serialize for ImportInstanceRequest {
6115    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6116    where
6117        S: serde::ser::Serializer,
6118    {
6119        use serde::ser::SerializeMap;
6120        #[allow(unused_imports)]
6121        use std::option::Option::Some;
6122        let mut state = serializer.serialize_map(std::option::Option::None)?;
6123        if !self.name.is_empty() {
6124            state.serialize_entry("name", &self.name)?;
6125        }
6126        if self.input_config.is_some() {
6127            state.serialize_entry("inputConfig", &self.input_config)?;
6128        }
6129        if !self._unknown_fields.is_empty() {
6130            for (key, value) in self._unknown_fields.iter() {
6131                state.serialize_entry(key, &value)?;
6132            }
6133        }
6134        state.end()
6135    }
6136}
6137
6138impl std::fmt::Debug for ImportInstanceRequest {
6139    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6140        let mut debug_struct = f.debug_struct("ImportInstanceRequest");
6141        debug_struct.field("name", &self.name);
6142        debug_struct.field("input_config", &self.input_config);
6143        if !self._unknown_fields.is_empty() {
6144            debug_struct.field("_unknown_fields", &self._unknown_fields);
6145        }
6146        debug_struct.finish()
6147    }
6148}
6149
6150/// The Cloud Storage location for the output content
6151#[derive(Clone, Default, PartialEq)]
6152#[non_exhaustive]
6153pub struct GcsDestination {
6154    /// Required. Data destination URI (e.g.
6155    /// 'gs://my_bucket/my_object'). Existing files will be overwritten.
6156    pub uri: std::string::String,
6157
6158    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6159}
6160
6161impl GcsDestination {
6162    pub fn new() -> Self {
6163        std::default::Default::default()
6164    }
6165
6166    /// Sets the value of [uri][crate::model::GcsDestination::uri].
6167    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6168        self.uri = v.into();
6169        self
6170    }
6171}
6172
6173impl wkt::message::Message for GcsDestination {
6174    fn typename() -> &'static str {
6175        "type.googleapis.com/google.cloud.redis.v1.GcsDestination"
6176    }
6177}
6178
6179#[doc(hidden)]
6180impl<'de> serde::de::Deserialize<'de> for GcsDestination {
6181    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6182    where
6183        D: serde::Deserializer<'de>,
6184    {
6185        #[allow(non_camel_case_types)]
6186        #[doc(hidden)]
6187        #[derive(PartialEq, Eq, Hash)]
6188        enum __FieldTag {
6189            __uri,
6190            Unknown(std::string::String),
6191        }
6192        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6193            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6194            where
6195                D: serde::Deserializer<'de>,
6196            {
6197                struct Visitor;
6198                impl<'de> serde::de::Visitor<'de> for Visitor {
6199                    type Value = __FieldTag;
6200                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6201                        formatter.write_str("a field name for GcsDestination")
6202                    }
6203                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6204                    where
6205                        E: serde::de::Error,
6206                    {
6207                        use std::result::Result::Ok;
6208                        use std::string::ToString;
6209                        match value {
6210                            "uri" => Ok(__FieldTag::__uri),
6211                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6212                        }
6213                    }
6214                }
6215                deserializer.deserialize_identifier(Visitor)
6216            }
6217        }
6218        struct Visitor;
6219        impl<'de> serde::de::Visitor<'de> for Visitor {
6220            type Value = GcsDestination;
6221            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6222                formatter.write_str("struct GcsDestination")
6223            }
6224            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6225            where
6226                A: serde::de::MapAccess<'de>,
6227            {
6228                #[allow(unused_imports)]
6229                use serde::de::Error;
6230                use std::option::Option::Some;
6231                let mut fields = std::collections::HashSet::new();
6232                let mut result = Self::Value::new();
6233                while let Some(tag) = map.next_key::<__FieldTag>()? {
6234                    #[allow(clippy::match_single_binding)]
6235                    match tag {
6236                        __FieldTag::__uri => {
6237                            if !fields.insert(__FieldTag::__uri) {
6238                                return std::result::Result::Err(A::Error::duplicate_field(
6239                                    "multiple values for uri",
6240                                ));
6241                            }
6242                            result.uri = map
6243                                .next_value::<std::option::Option<std::string::String>>()?
6244                                .unwrap_or_default();
6245                        }
6246                        __FieldTag::Unknown(key) => {
6247                            let value = map.next_value::<serde_json::Value>()?;
6248                            result._unknown_fields.insert(key, value);
6249                        }
6250                    }
6251                }
6252                std::result::Result::Ok(result)
6253            }
6254        }
6255        deserializer.deserialize_any(Visitor)
6256    }
6257}
6258
6259#[doc(hidden)]
6260impl serde::ser::Serialize for GcsDestination {
6261    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6262    where
6263        S: serde::ser::Serializer,
6264    {
6265        use serde::ser::SerializeMap;
6266        #[allow(unused_imports)]
6267        use std::option::Option::Some;
6268        let mut state = serializer.serialize_map(std::option::Option::None)?;
6269        if !self.uri.is_empty() {
6270            state.serialize_entry("uri", &self.uri)?;
6271        }
6272        if !self._unknown_fields.is_empty() {
6273            for (key, value) in self._unknown_fields.iter() {
6274                state.serialize_entry(key, &value)?;
6275            }
6276        }
6277        state.end()
6278    }
6279}
6280
6281impl std::fmt::Debug for GcsDestination {
6282    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6283        let mut debug_struct = f.debug_struct("GcsDestination");
6284        debug_struct.field("uri", &self.uri);
6285        if !self._unknown_fields.is_empty() {
6286            debug_struct.field("_unknown_fields", &self._unknown_fields);
6287        }
6288        debug_struct.finish()
6289    }
6290}
6291
6292/// The output content
6293#[derive(Clone, Default, PartialEq)]
6294#[non_exhaustive]
6295pub struct OutputConfig {
6296    /// Required. Specify destination location of output data
6297    pub destination: std::option::Option<crate::model::output_config::Destination>,
6298
6299    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6300}
6301
6302impl OutputConfig {
6303    pub fn new() -> Self {
6304        std::default::Default::default()
6305    }
6306
6307    /// Sets the value of [destination][crate::model::OutputConfig::destination].
6308    ///
6309    /// Note that all the setters affecting `destination` are mutually
6310    /// exclusive.
6311    pub fn set_destination<
6312        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
6313    >(
6314        mut self,
6315        v: T,
6316    ) -> Self {
6317        self.destination = v.into();
6318        self
6319    }
6320
6321    /// The value of [destination][crate::model::OutputConfig::destination]
6322    /// if it holds a `GcsDestination`, `None` if the field is not set or
6323    /// holds a different branch.
6324    pub fn gcs_destination(
6325        &self,
6326    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
6327        #[allow(unreachable_patterns)]
6328        self.destination.as_ref().and_then(|v| match v {
6329            crate::model::output_config::Destination::GcsDestination(v) => {
6330                std::option::Option::Some(v)
6331            }
6332            _ => std::option::Option::None,
6333        })
6334    }
6335
6336    /// Sets the value of [destination][crate::model::OutputConfig::destination]
6337    /// to hold a `GcsDestination`.
6338    ///
6339    /// Note that all the setters affecting `destination` are
6340    /// mutually exclusive.
6341    pub fn set_gcs_destination<
6342        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
6343    >(
6344        mut self,
6345        v: T,
6346    ) -> Self {
6347        self.destination = std::option::Option::Some(
6348            crate::model::output_config::Destination::GcsDestination(v.into()),
6349        );
6350        self
6351    }
6352}
6353
6354impl wkt::message::Message for OutputConfig {
6355    fn typename() -> &'static str {
6356        "type.googleapis.com/google.cloud.redis.v1.OutputConfig"
6357    }
6358}
6359
6360#[doc(hidden)]
6361impl<'de> serde::de::Deserialize<'de> for OutputConfig {
6362    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6363    where
6364        D: serde::Deserializer<'de>,
6365    {
6366        #[allow(non_camel_case_types)]
6367        #[doc(hidden)]
6368        #[derive(PartialEq, Eq, Hash)]
6369        enum __FieldTag {
6370            __gcs_destination,
6371            Unknown(std::string::String),
6372        }
6373        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6374            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6375            where
6376                D: serde::Deserializer<'de>,
6377            {
6378                struct Visitor;
6379                impl<'de> serde::de::Visitor<'de> for Visitor {
6380                    type Value = __FieldTag;
6381                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6382                        formatter.write_str("a field name for OutputConfig")
6383                    }
6384                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6385                    where
6386                        E: serde::de::Error,
6387                    {
6388                        use std::result::Result::Ok;
6389                        use std::string::ToString;
6390                        match value {
6391                            "gcsDestination" => Ok(__FieldTag::__gcs_destination),
6392                            "gcs_destination" => Ok(__FieldTag::__gcs_destination),
6393                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6394                        }
6395                    }
6396                }
6397                deserializer.deserialize_identifier(Visitor)
6398            }
6399        }
6400        struct Visitor;
6401        impl<'de> serde::de::Visitor<'de> for Visitor {
6402            type Value = OutputConfig;
6403            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6404                formatter.write_str("struct OutputConfig")
6405            }
6406            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6407            where
6408                A: serde::de::MapAccess<'de>,
6409            {
6410                #[allow(unused_imports)]
6411                use serde::de::Error;
6412                use std::option::Option::Some;
6413                let mut fields = std::collections::HashSet::new();
6414                let mut result = Self::Value::new();
6415                while let Some(tag) = map.next_key::<__FieldTag>()? {
6416                    #[allow(clippy::match_single_binding)]
6417                    match tag {
6418                        __FieldTag::__gcs_destination => {
6419                            if !fields.insert(__FieldTag::__gcs_destination) {
6420                                return std::result::Result::Err(A::Error::duplicate_field(
6421                                    "multiple values for gcs_destination",
6422                                ));
6423                            }
6424                            if result.destination.is_some() {
6425                                return std::result::Result::Err(A::Error::duplicate_field(
6426                                    "multiple values for `destination`, a oneof with full ID .google.cloud.redis.v1.OutputConfig.gcs_destination, latest field was gcsDestination",
6427                                ));
6428                            }
6429                            result.destination = std::option::Option::Some(
6430                                crate::model::output_config::Destination::GcsDestination(
6431                                    map.next_value::<std::option::Option<
6432                                        std::boxed::Box<crate::model::GcsDestination>,
6433                                    >>()?
6434                                    .unwrap_or_default(),
6435                                ),
6436                            );
6437                        }
6438                        __FieldTag::Unknown(key) => {
6439                            let value = map.next_value::<serde_json::Value>()?;
6440                            result._unknown_fields.insert(key, value);
6441                        }
6442                    }
6443                }
6444                std::result::Result::Ok(result)
6445            }
6446        }
6447        deserializer.deserialize_any(Visitor)
6448    }
6449}
6450
6451#[doc(hidden)]
6452impl serde::ser::Serialize for OutputConfig {
6453    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6454    where
6455        S: serde::ser::Serializer,
6456    {
6457        use serde::ser::SerializeMap;
6458        #[allow(unused_imports)]
6459        use std::option::Option::Some;
6460        let mut state = serializer.serialize_map(std::option::Option::None)?;
6461        if let Some(value) = self.gcs_destination() {
6462            state.serialize_entry("gcsDestination", value)?;
6463        }
6464        if !self._unknown_fields.is_empty() {
6465            for (key, value) in self._unknown_fields.iter() {
6466                state.serialize_entry(key, &value)?;
6467            }
6468        }
6469        state.end()
6470    }
6471}
6472
6473impl std::fmt::Debug for OutputConfig {
6474    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6475        let mut debug_struct = f.debug_struct("OutputConfig");
6476        debug_struct.field("destination", &self.destination);
6477        if !self._unknown_fields.is_empty() {
6478            debug_struct.field("_unknown_fields", &self._unknown_fields);
6479        }
6480        debug_struct.finish()
6481    }
6482}
6483
6484/// Defines additional types related to [OutputConfig].
6485pub mod output_config {
6486    #[allow(unused_imports)]
6487    use super::*;
6488
6489    /// Required. Specify destination location of output data
6490    #[derive(Clone, Debug, PartialEq)]
6491    #[non_exhaustive]
6492    pub enum Destination {
6493        /// Google Cloud Storage destination for output content.
6494        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
6495    }
6496}
6497
6498/// Request for [Export][google.cloud.redis.v1.CloudRedis.ExportInstance].
6499///
6500/// [google.cloud.redis.v1.CloudRedis.ExportInstance]: crate::client::CloudRedis::export_instance
6501#[derive(Clone, Default, PartialEq)]
6502#[non_exhaustive]
6503pub struct ExportInstanceRequest {
6504    /// Required. Redis instance resource name using the form:
6505    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
6506    /// where `location_id` refers to a GCP region.
6507    pub name: std::string::String,
6508
6509    /// Required. Specify data to be exported.
6510    pub output_config: std::option::Option<crate::model::OutputConfig>,
6511
6512    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6513}
6514
6515impl ExportInstanceRequest {
6516    pub fn new() -> Self {
6517        std::default::Default::default()
6518    }
6519
6520    /// Sets the value of [name][crate::model::ExportInstanceRequest::name].
6521    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6522        self.name = v.into();
6523        self
6524    }
6525
6526    /// Sets the value of [output_config][crate::model::ExportInstanceRequest::output_config].
6527    pub fn set_output_config<T>(mut self, v: T) -> Self
6528    where
6529        T: std::convert::Into<crate::model::OutputConfig>,
6530    {
6531        self.output_config = std::option::Option::Some(v.into());
6532        self
6533    }
6534
6535    /// Sets or clears the value of [output_config][crate::model::ExportInstanceRequest::output_config].
6536    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
6537    where
6538        T: std::convert::Into<crate::model::OutputConfig>,
6539    {
6540        self.output_config = v.map(|x| x.into());
6541        self
6542    }
6543}
6544
6545impl wkt::message::Message for ExportInstanceRequest {
6546    fn typename() -> &'static str {
6547        "type.googleapis.com/google.cloud.redis.v1.ExportInstanceRequest"
6548    }
6549}
6550
6551#[doc(hidden)]
6552impl<'de> serde::de::Deserialize<'de> for ExportInstanceRequest {
6553    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6554    where
6555        D: serde::Deserializer<'de>,
6556    {
6557        #[allow(non_camel_case_types)]
6558        #[doc(hidden)]
6559        #[derive(PartialEq, Eq, Hash)]
6560        enum __FieldTag {
6561            __name,
6562            __output_config,
6563            Unknown(std::string::String),
6564        }
6565        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6566            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6567            where
6568                D: serde::Deserializer<'de>,
6569            {
6570                struct Visitor;
6571                impl<'de> serde::de::Visitor<'de> for Visitor {
6572                    type Value = __FieldTag;
6573                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6574                        formatter.write_str("a field name for ExportInstanceRequest")
6575                    }
6576                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6577                    where
6578                        E: serde::de::Error,
6579                    {
6580                        use std::result::Result::Ok;
6581                        use std::string::ToString;
6582                        match value {
6583                            "name" => Ok(__FieldTag::__name),
6584                            "outputConfig" => Ok(__FieldTag::__output_config),
6585                            "output_config" => Ok(__FieldTag::__output_config),
6586                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6587                        }
6588                    }
6589                }
6590                deserializer.deserialize_identifier(Visitor)
6591            }
6592        }
6593        struct Visitor;
6594        impl<'de> serde::de::Visitor<'de> for Visitor {
6595            type Value = ExportInstanceRequest;
6596            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6597                formatter.write_str("struct ExportInstanceRequest")
6598            }
6599            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6600            where
6601                A: serde::de::MapAccess<'de>,
6602            {
6603                #[allow(unused_imports)]
6604                use serde::de::Error;
6605                use std::option::Option::Some;
6606                let mut fields = std::collections::HashSet::new();
6607                let mut result = Self::Value::new();
6608                while let Some(tag) = map.next_key::<__FieldTag>()? {
6609                    #[allow(clippy::match_single_binding)]
6610                    match tag {
6611                        __FieldTag::__name => {
6612                            if !fields.insert(__FieldTag::__name) {
6613                                return std::result::Result::Err(A::Error::duplicate_field(
6614                                    "multiple values for name",
6615                                ));
6616                            }
6617                            result.name = map
6618                                .next_value::<std::option::Option<std::string::String>>()?
6619                                .unwrap_or_default();
6620                        }
6621                        __FieldTag::__output_config => {
6622                            if !fields.insert(__FieldTag::__output_config) {
6623                                return std::result::Result::Err(A::Error::duplicate_field(
6624                                    "multiple values for output_config",
6625                                ));
6626                            }
6627                            result.output_config = map
6628                                .next_value::<std::option::Option<crate::model::OutputConfig>>()?;
6629                        }
6630                        __FieldTag::Unknown(key) => {
6631                            let value = map.next_value::<serde_json::Value>()?;
6632                            result._unknown_fields.insert(key, value);
6633                        }
6634                    }
6635                }
6636                std::result::Result::Ok(result)
6637            }
6638        }
6639        deserializer.deserialize_any(Visitor)
6640    }
6641}
6642
6643#[doc(hidden)]
6644impl serde::ser::Serialize for ExportInstanceRequest {
6645    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6646    where
6647        S: serde::ser::Serializer,
6648    {
6649        use serde::ser::SerializeMap;
6650        #[allow(unused_imports)]
6651        use std::option::Option::Some;
6652        let mut state = serializer.serialize_map(std::option::Option::None)?;
6653        if !self.name.is_empty() {
6654            state.serialize_entry("name", &self.name)?;
6655        }
6656        if self.output_config.is_some() {
6657            state.serialize_entry("outputConfig", &self.output_config)?;
6658        }
6659        if !self._unknown_fields.is_empty() {
6660            for (key, value) in self._unknown_fields.iter() {
6661                state.serialize_entry(key, &value)?;
6662            }
6663        }
6664        state.end()
6665    }
6666}
6667
6668impl std::fmt::Debug for ExportInstanceRequest {
6669    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6670        let mut debug_struct = f.debug_struct("ExportInstanceRequest");
6671        debug_struct.field("name", &self.name);
6672        debug_struct.field("output_config", &self.output_config);
6673        if !self._unknown_fields.is_empty() {
6674            debug_struct.field("_unknown_fields", &self._unknown_fields);
6675        }
6676        debug_struct.finish()
6677    }
6678}
6679
6680/// Request for [Failover][google.cloud.redis.v1.CloudRedis.FailoverInstance].
6681///
6682/// [google.cloud.redis.v1.CloudRedis.FailoverInstance]: crate::client::CloudRedis::failover_instance
6683#[derive(Clone, Default, PartialEq)]
6684#[non_exhaustive]
6685pub struct FailoverInstanceRequest {
6686    /// Required. Redis instance resource name using the form:
6687    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
6688    /// where `location_id` refers to a GCP region.
6689    pub name: std::string::String,
6690
6691    /// Optional. Available data protection modes that the user can choose. If it's
6692    /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
6693    pub data_protection_mode: crate::model::failover_instance_request::DataProtectionMode,
6694
6695    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6696}
6697
6698impl FailoverInstanceRequest {
6699    pub fn new() -> Self {
6700        std::default::Default::default()
6701    }
6702
6703    /// Sets the value of [name][crate::model::FailoverInstanceRequest::name].
6704    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6705        self.name = v.into();
6706        self
6707    }
6708
6709    /// Sets the value of [data_protection_mode][crate::model::FailoverInstanceRequest::data_protection_mode].
6710    pub fn set_data_protection_mode<
6711        T: std::convert::Into<crate::model::failover_instance_request::DataProtectionMode>,
6712    >(
6713        mut self,
6714        v: T,
6715    ) -> Self {
6716        self.data_protection_mode = v.into();
6717        self
6718    }
6719}
6720
6721impl wkt::message::Message for FailoverInstanceRequest {
6722    fn typename() -> &'static str {
6723        "type.googleapis.com/google.cloud.redis.v1.FailoverInstanceRequest"
6724    }
6725}
6726
6727#[doc(hidden)]
6728impl<'de> serde::de::Deserialize<'de> for FailoverInstanceRequest {
6729    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6730    where
6731        D: serde::Deserializer<'de>,
6732    {
6733        #[allow(non_camel_case_types)]
6734        #[doc(hidden)]
6735        #[derive(PartialEq, Eq, Hash)]
6736        enum __FieldTag {
6737            __name,
6738            __data_protection_mode,
6739            Unknown(std::string::String),
6740        }
6741        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
6742            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6743            where
6744                D: serde::Deserializer<'de>,
6745            {
6746                struct Visitor;
6747                impl<'de> serde::de::Visitor<'de> for Visitor {
6748                    type Value = __FieldTag;
6749                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6750                        formatter.write_str("a field name for FailoverInstanceRequest")
6751                    }
6752                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
6753                    where
6754                        E: serde::de::Error,
6755                    {
6756                        use std::result::Result::Ok;
6757                        use std::string::ToString;
6758                        match value {
6759                            "name" => Ok(__FieldTag::__name),
6760                            "dataProtectionMode" => Ok(__FieldTag::__data_protection_mode),
6761                            "data_protection_mode" => Ok(__FieldTag::__data_protection_mode),
6762                            _ => Ok(__FieldTag::Unknown(value.to_string())),
6763                        }
6764                    }
6765                }
6766                deserializer.deserialize_identifier(Visitor)
6767            }
6768        }
6769        struct Visitor;
6770        impl<'de> serde::de::Visitor<'de> for Visitor {
6771            type Value = FailoverInstanceRequest;
6772            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
6773                formatter.write_str("struct FailoverInstanceRequest")
6774            }
6775            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
6776            where
6777                A: serde::de::MapAccess<'de>,
6778            {
6779                #[allow(unused_imports)]
6780                use serde::de::Error;
6781                use std::option::Option::Some;
6782                let mut fields = std::collections::HashSet::new();
6783                let mut result = Self::Value::new();
6784                while let Some(tag) = map.next_key::<__FieldTag>()? {
6785                    #[allow(clippy::match_single_binding)]
6786                    match tag {
6787                        __FieldTag::__name => {
6788                            if !fields.insert(__FieldTag::__name) {
6789                                return std::result::Result::Err(A::Error::duplicate_field(
6790                                    "multiple values for name",
6791                                ));
6792                            }
6793                            result.name = map
6794                                .next_value::<std::option::Option<std::string::String>>()?
6795                                .unwrap_or_default();
6796                        }
6797                        __FieldTag::__data_protection_mode => {
6798                            if !fields.insert(__FieldTag::__data_protection_mode) {
6799                                return std::result::Result::Err(A::Error::duplicate_field(
6800                                    "multiple values for data_protection_mode",
6801                                ));
6802                            }
6803                            result.data_protection_mode = map
6804                                .next_value::<std::option::Option<
6805                                    crate::model::failover_instance_request::DataProtectionMode,
6806                                >>()?
6807                                .unwrap_or_default();
6808                        }
6809                        __FieldTag::Unknown(key) => {
6810                            let value = map.next_value::<serde_json::Value>()?;
6811                            result._unknown_fields.insert(key, value);
6812                        }
6813                    }
6814                }
6815                std::result::Result::Ok(result)
6816            }
6817        }
6818        deserializer.deserialize_any(Visitor)
6819    }
6820}
6821
6822#[doc(hidden)]
6823impl serde::ser::Serialize for FailoverInstanceRequest {
6824    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6825    where
6826        S: serde::ser::Serializer,
6827    {
6828        use serde::ser::SerializeMap;
6829        #[allow(unused_imports)]
6830        use std::option::Option::Some;
6831        let mut state = serializer.serialize_map(std::option::Option::None)?;
6832        if !self.name.is_empty() {
6833            state.serialize_entry("name", &self.name)?;
6834        }
6835        if !wkt::internal::is_default(&self.data_protection_mode) {
6836            state.serialize_entry("dataProtectionMode", &self.data_protection_mode)?;
6837        }
6838        if !self._unknown_fields.is_empty() {
6839            for (key, value) in self._unknown_fields.iter() {
6840                state.serialize_entry(key, &value)?;
6841            }
6842        }
6843        state.end()
6844    }
6845}
6846
6847impl std::fmt::Debug for FailoverInstanceRequest {
6848    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6849        let mut debug_struct = f.debug_struct("FailoverInstanceRequest");
6850        debug_struct.field("name", &self.name);
6851        debug_struct.field("data_protection_mode", &self.data_protection_mode);
6852        if !self._unknown_fields.is_empty() {
6853            debug_struct.field("_unknown_fields", &self._unknown_fields);
6854        }
6855        debug_struct.finish()
6856    }
6857}
6858
6859/// Defines additional types related to [FailoverInstanceRequest].
6860pub mod failover_instance_request {
6861    #[allow(unused_imports)]
6862    use super::*;
6863
6864    /// Specifies different modes of operation in relation to the data retention.
6865    ///
6866    /// # Working with unknown values
6867    ///
6868    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6869    /// additional enum variants at any time. Adding new variants is not considered
6870    /// a breaking change. Applications should write their code in anticipation of:
6871    ///
6872    /// - New values appearing in future releases of the client library, **and**
6873    /// - New values received dynamically, without application changes.
6874    ///
6875    /// Please consult the [Working with enums] section in the user guide for some
6876    /// guidelines.
6877    ///
6878    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6879    #[derive(Clone, Debug, PartialEq)]
6880    #[non_exhaustive]
6881    pub enum DataProtectionMode {
6882        /// Defaults to LIMITED_DATA_LOSS if a data protection mode is not
6883        /// specified.
6884        Unspecified,
6885        /// Instance failover will be protected with data loss control. More
6886        /// specifically, the failover will only be performed if the current
6887        /// replication offset diff between primary and replica is under a certain
6888        /// threshold.
6889        LimitedDataLoss,
6890        /// Instance failover will be performed without data loss control.
6891        ForceDataLoss,
6892        /// If set, the enum was initialized with an unknown value.
6893        ///
6894        /// Applications can examine the value using [DataProtectionMode::value] or
6895        /// [DataProtectionMode::name].
6896        UnknownValue(data_protection_mode::UnknownValue),
6897    }
6898
6899    #[doc(hidden)]
6900    pub mod data_protection_mode {
6901        #[allow(unused_imports)]
6902        use super::*;
6903        #[derive(Clone, Debug, PartialEq)]
6904        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6905    }
6906
6907    impl DataProtectionMode {
6908        /// Gets the enum value.
6909        ///
6910        /// Returns `None` if the enum contains an unknown value deserialized from
6911        /// the string representation of enums.
6912        pub fn value(&self) -> std::option::Option<i32> {
6913            match self {
6914                Self::Unspecified => std::option::Option::Some(0),
6915                Self::LimitedDataLoss => std::option::Option::Some(1),
6916                Self::ForceDataLoss => std::option::Option::Some(2),
6917                Self::UnknownValue(u) => u.0.value(),
6918            }
6919        }
6920
6921        /// Gets the enum value as a string.
6922        ///
6923        /// Returns `None` if the enum contains an unknown value deserialized from
6924        /// the integer representation of enums.
6925        pub fn name(&self) -> std::option::Option<&str> {
6926            match self {
6927                Self::Unspecified => std::option::Option::Some("DATA_PROTECTION_MODE_UNSPECIFIED"),
6928                Self::LimitedDataLoss => std::option::Option::Some("LIMITED_DATA_LOSS"),
6929                Self::ForceDataLoss => std::option::Option::Some("FORCE_DATA_LOSS"),
6930                Self::UnknownValue(u) => u.0.name(),
6931            }
6932        }
6933    }
6934
6935    impl std::default::Default for DataProtectionMode {
6936        fn default() -> Self {
6937            use std::convert::From;
6938            Self::from(0)
6939        }
6940    }
6941
6942    impl std::fmt::Display for DataProtectionMode {
6943        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6944            wkt::internal::display_enum(f, self.name(), self.value())
6945        }
6946    }
6947
6948    impl std::convert::From<i32> for DataProtectionMode {
6949        fn from(value: i32) -> Self {
6950            match value {
6951                0 => Self::Unspecified,
6952                1 => Self::LimitedDataLoss,
6953                2 => Self::ForceDataLoss,
6954                _ => Self::UnknownValue(data_protection_mode::UnknownValue(
6955                    wkt::internal::UnknownEnumValue::Integer(value),
6956                )),
6957            }
6958        }
6959    }
6960
6961    impl std::convert::From<&str> for DataProtectionMode {
6962        fn from(value: &str) -> Self {
6963            use std::string::ToString;
6964            match value {
6965                "DATA_PROTECTION_MODE_UNSPECIFIED" => Self::Unspecified,
6966                "LIMITED_DATA_LOSS" => Self::LimitedDataLoss,
6967                "FORCE_DATA_LOSS" => Self::ForceDataLoss,
6968                _ => Self::UnknownValue(data_protection_mode::UnknownValue(
6969                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6970                )),
6971            }
6972        }
6973    }
6974
6975    impl serde::ser::Serialize for DataProtectionMode {
6976        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6977        where
6978            S: serde::Serializer,
6979        {
6980            match self {
6981                Self::Unspecified => serializer.serialize_i32(0),
6982                Self::LimitedDataLoss => serializer.serialize_i32(1),
6983                Self::ForceDataLoss => serializer.serialize_i32(2),
6984                Self::UnknownValue(u) => u.0.serialize(serializer),
6985            }
6986        }
6987    }
6988
6989    impl<'de> serde::de::Deserialize<'de> for DataProtectionMode {
6990        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6991        where
6992            D: serde::Deserializer<'de>,
6993        {
6994            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataProtectionMode>::new(
6995                ".google.cloud.redis.v1.FailoverInstanceRequest.DataProtectionMode",
6996            ))
6997        }
6998    }
6999}
7000
7001/// Represents the v1 metadata of the long-running operation.
7002#[derive(Clone, Default, PartialEq)]
7003#[non_exhaustive]
7004pub struct OperationMetadata {
7005    /// Creation timestamp.
7006    pub create_time: std::option::Option<wkt::Timestamp>,
7007
7008    /// End timestamp.
7009    pub end_time: std::option::Option<wkt::Timestamp>,
7010
7011    /// Operation target.
7012    pub target: std::string::String,
7013
7014    /// Operation verb.
7015    pub verb: std::string::String,
7016
7017    /// Operation status details.
7018    pub status_detail: std::string::String,
7019
7020    /// Specifies if cancellation was requested for the operation.
7021    pub cancel_requested: bool,
7022
7023    /// API version.
7024    pub api_version: std::string::String,
7025
7026    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7027}
7028
7029impl OperationMetadata {
7030    pub fn new() -> Self {
7031        std::default::Default::default()
7032    }
7033
7034    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
7035    pub fn set_create_time<T>(mut self, v: T) -> Self
7036    where
7037        T: std::convert::Into<wkt::Timestamp>,
7038    {
7039        self.create_time = std::option::Option::Some(v.into());
7040        self
7041    }
7042
7043    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
7044    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7045    where
7046        T: std::convert::Into<wkt::Timestamp>,
7047    {
7048        self.create_time = v.map(|x| x.into());
7049        self
7050    }
7051
7052    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
7053    pub fn set_end_time<T>(mut self, v: T) -> Self
7054    where
7055        T: std::convert::Into<wkt::Timestamp>,
7056    {
7057        self.end_time = std::option::Option::Some(v.into());
7058        self
7059    }
7060
7061    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
7062    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
7063    where
7064        T: std::convert::Into<wkt::Timestamp>,
7065    {
7066        self.end_time = v.map(|x| x.into());
7067        self
7068    }
7069
7070    /// Sets the value of [target][crate::model::OperationMetadata::target].
7071    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7072        self.target = v.into();
7073        self
7074    }
7075
7076    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
7077    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7078        self.verb = v.into();
7079        self
7080    }
7081
7082    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
7083    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7084        self.status_detail = v.into();
7085        self
7086    }
7087
7088    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
7089    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7090        self.cancel_requested = v.into();
7091        self
7092    }
7093
7094    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
7095    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7096        self.api_version = v.into();
7097        self
7098    }
7099}
7100
7101impl wkt::message::Message for OperationMetadata {
7102    fn typename() -> &'static str {
7103        "type.googleapis.com/google.cloud.redis.v1.OperationMetadata"
7104    }
7105}
7106
7107#[doc(hidden)]
7108impl<'de> serde::de::Deserialize<'de> for OperationMetadata {
7109    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7110    where
7111        D: serde::Deserializer<'de>,
7112    {
7113        #[allow(non_camel_case_types)]
7114        #[doc(hidden)]
7115        #[derive(PartialEq, Eq, Hash)]
7116        enum __FieldTag {
7117            __create_time,
7118            __end_time,
7119            __target,
7120            __verb,
7121            __status_detail,
7122            __cancel_requested,
7123            __api_version,
7124            Unknown(std::string::String),
7125        }
7126        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7127            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7128            where
7129                D: serde::Deserializer<'de>,
7130            {
7131                struct Visitor;
7132                impl<'de> serde::de::Visitor<'de> for Visitor {
7133                    type Value = __FieldTag;
7134                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7135                        formatter.write_str("a field name for OperationMetadata")
7136                    }
7137                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7138                    where
7139                        E: serde::de::Error,
7140                    {
7141                        use std::result::Result::Ok;
7142                        use std::string::ToString;
7143                        match value {
7144                            "createTime" => Ok(__FieldTag::__create_time),
7145                            "create_time" => Ok(__FieldTag::__create_time),
7146                            "endTime" => Ok(__FieldTag::__end_time),
7147                            "end_time" => Ok(__FieldTag::__end_time),
7148                            "target" => Ok(__FieldTag::__target),
7149                            "verb" => Ok(__FieldTag::__verb),
7150                            "statusDetail" => Ok(__FieldTag::__status_detail),
7151                            "status_detail" => Ok(__FieldTag::__status_detail),
7152                            "cancelRequested" => Ok(__FieldTag::__cancel_requested),
7153                            "cancel_requested" => Ok(__FieldTag::__cancel_requested),
7154                            "apiVersion" => Ok(__FieldTag::__api_version),
7155                            "api_version" => Ok(__FieldTag::__api_version),
7156                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7157                        }
7158                    }
7159                }
7160                deserializer.deserialize_identifier(Visitor)
7161            }
7162        }
7163        struct Visitor;
7164        impl<'de> serde::de::Visitor<'de> for Visitor {
7165            type Value = OperationMetadata;
7166            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7167                formatter.write_str("struct OperationMetadata")
7168            }
7169            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7170            where
7171                A: serde::de::MapAccess<'de>,
7172            {
7173                #[allow(unused_imports)]
7174                use serde::de::Error;
7175                use std::option::Option::Some;
7176                let mut fields = std::collections::HashSet::new();
7177                let mut result = Self::Value::new();
7178                while let Some(tag) = map.next_key::<__FieldTag>()? {
7179                    #[allow(clippy::match_single_binding)]
7180                    match tag {
7181                        __FieldTag::__create_time => {
7182                            if !fields.insert(__FieldTag::__create_time) {
7183                                return std::result::Result::Err(A::Error::duplicate_field(
7184                                    "multiple values for create_time",
7185                                ));
7186                            }
7187                            result.create_time =
7188                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7189                        }
7190                        __FieldTag::__end_time => {
7191                            if !fields.insert(__FieldTag::__end_time) {
7192                                return std::result::Result::Err(A::Error::duplicate_field(
7193                                    "multiple values for end_time",
7194                                ));
7195                            }
7196                            result.end_time =
7197                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7198                        }
7199                        __FieldTag::__target => {
7200                            if !fields.insert(__FieldTag::__target) {
7201                                return std::result::Result::Err(A::Error::duplicate_field(
7202                                    "multiple values for target",
7203                                ));
7204                            }
7205                            result.target = map
7206                                .next_value::<std::option::Option<std::string::String>>()?
7207                                .unwrap_or_default();
7208                        }
7209                        __FieldTag::__verb => {
7210                            if !fields.insert(__FieldTag::__verb) {
7211                                return std::result::Result::Err(A::Error::duplicate_field(
7212                                    "multiple values for verb",
7213                                ));
7214                            }
7215                            result.verb = map
7216                                .next_value::<std::option::Option<std::string::String>>()?
7217                                .unwrap_or_default();
7218                        }
7219                        __FieldTag::__status_detail => {
7220                            if !fields.insert(__FieldTag::__status_detail) {
7221                                return std::result::Result::Err(A::Error::duplicate_field(
7222                                    "multiple values for status_detail",
7223                                ));
7224                            }
7225                            result.status_detail = map
7226                                .next_value::<std::option::Option<std::string::String>>()?
7227                                .unwrap_or_default();
7228                        }
7229                        __FieldTag::__cancel_requested => {
7230                            if !fields.insert(__FieldTag::__cancel_requested) {
7231                                return std::result::Result::Err(A::Error::duplicate_field(
7232                                    "multiple values for cancel_requested",
7233                                ));
7234                            }
7235                            result.cancel_requested = map
7236                                .next_value::<std::option::Option<bool>>()?
7237                                .unwrap_or_default();
7238                        }
7239                        __FieldTag::__api_version => {
7240                            if !fields.insert(__FieldTag::__api_version) {
7241                                return std::result::Result::Err(A::Error::duplicate_field(
7242                                    "multiple values for api_version",
7243                                ));
7244                            }
7245                            result.api_version = map
7246                                .next_value::<std::option::Option<std::string::String>>()?
7247                                .unwrap_or_default();
7248                        }
7249                        __FieldTag::Unknown(key) => {
7250                            let value = map.next_value::<serde_json::Value>()?;
7251                            result._unknown_fields.insert(key, value);
7252                        }
7253                    }
7254                }
7255                std::result::Result::Ok(result)
7256            }
7257        }
7258        deserializer.deserialize_any(Visitor)
7259    }
7260}
7261
7262#[doc(hidden)]
7263impl serde::ser::Serialize for OperationMetadata {
7264    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7265    where
7266        S: serde::ser::Serializer,
7267    {
7268        use serde::ser::SerializeMap;
7269        #[allow(unused_imports)]
7270        use std::option::Option::Some;
7271        let mut state = serializer.serialize_map(std::option::Option::None)?;
7272        if self.create_time.is_some() {
7273            state.serialize_entry("createTime", &self.create_time)?;
7274        }
7275        if self.end_time.is_some() {
7276            state.serialize_entry("endTime", &self.end_time)?;
7277        }
7278        if !self.target.is_empty() {
7279            state.serialize_entry("target", &self.target)?;
7280        }
7281        if !self.verb.is_empty() {
7282            state.serialize_entry("verb", &self.verb)?;
7283        }
7284        if !self.status_detail.is_empty() {
7285            state.serialize_entry("statusDetail", &self.status_detail)?;
7286        }
7287        if !wkt::internal::is_default(&self.cancel_requested) {
7288            state.serialize_entry("cancelRequested", &self.cancel_requested)?;
7289        }
7290        if !self.api_version.is_empty() {
7291            state.serialize_entry("apiVersion", &self.api_version)?;
7292        }
7293        if !self._unknown_fields.is_empty() {
7294            for (key, value) in self._unknown_fields.iter() {
7295                state.serialize_entry(key, &value)?;
7296            }
7297        }
7298        state.end()
7299    }
7300}
7301
7302impl std::fmt::Debug for OperationMetadata {
7303    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7304        let mut debug_struct = f.debug_struct("OperationMetadata");
7305        debug_struct.field("create_time", &self.create_time);
7306        debug_struct.field("end_time", &self.end_time);
7307        debug_struct.field("target", &self.target);
7308        debug_struct.field("verb", &self.verb);
7309        debug_struct.field("status_detail", &self.status_detail);
7310        debug_struct.field("cancel_requested", &self.cancel_requested);
7311        debug_struct.field("api_version", &self.api_version);
7312        if !self._unknown_fields.is_empty() {
7313            debug_struct.field("_unknown_fields", &self._unknown_fields);
7314        }
7315        debug_struct.finish()
7316    }
7317}
7318
7319/// This location metadata represents additional configuration options for a
7320/// given location where a Redis instance may be created. All fields are output
7321/// only. It is returned as content of the
7322/// `google.cloud.location.Location.metadata` field.
7323#[derive(Clone, Default, PartialEq)]
7324#[non_exhaustive]
7325pub struct LocationMetadata {
7326    /// Output only. The set of available zones in the location. The map is keyed
7327    /// by the lowercase ID of each zone, as defined by GCE. These keys can be
7328    /// specified in `location_id` or `alternative_location_id` fields when
7329    /// creating a Redis instance.
7330    pub available_zones: std::collections::HashMap<std::string::String, crate::model::ZoneMetadata>,
7331
7332    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7333}
7334
7335impl LocationMetadata {
7336    pub fn new() -> Self {
7337        std::default::Default::default()
7338    }
7339
7340    /// Sets the value of [available_zones][crate::model::LocationMetadata::available_zones].
7341    pub fn set_available_zones<T, K, V>(mut self, v: T) -> Self
7342    where
7343        T: std::iter::IntoIterator<Item = (K, V)>,
7344        K: std::convert::Into<std::string::String>,
7345        V: std::convert::Into<crate::model::ZoneMetadata>,
7346    {
7347        use std::iter::Iterator;
7348        self.available_zones = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7349        self
7350    }
7351}
7352
7353impl wkt::message::Message for LocationMetadata {
7354    fn typename() -> &'static str {
7355        "type.googleapis.com/google.cloud.redis.v1.LocationMetadata"
7356    }
7357}
7358
7359#[doc(hidden)]
7360impl<'de> serde::de::Deserialize<'de> for LocationMetadata {
7361    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7362    where
7363        D: serde::Deserializer<'de>,
7364    {
7365        #[allow(non_camel_case_types)]
7366        #[doc(hidden)]
7367        #[derive(PartialEq, Eq, Hash)]
7368        enum __FieldTag {
7369            __available_zones,
7370            Unknown(std::string::String),
7371        }
7372        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7373            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7374            where
7375                D: serde::Deserializer<'de>,
7376            {
7377                struct Visitor;
7378                impl<'de> serde::de::Visitor<'de> for Visitor {
7379                    type Value = __FieldTag;
7380                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7381                        formatter.write_str("a field name for LocationMetadata")
7382                    }
7383                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7384                    where
7385                        E: serde::de::Error,
7386                    {
7387                        use std::result::Result::Ok;
7388                        use std::string::ToString;
7389                        match value {
7390                            "availableZones" => Ok(__FieldTag::__available_zones),
7391                            "available_zones" => Ok(__FieldTag::__available_zones),
7392                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7393                        }
7394                    }
7395                }
7396                deserializer.deserialize_identifier(Visitor)
7397            }
7398        }
7399        struct Visitor;
7400        impl<'de> serde::de::Visitor<'de> for Visitor {
7401            type Value = LocationMetadata;
7402            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7403                formatter.write_str("struct LocationMetadata")
7404            }
7405            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7406            where
7407                A: serde::de::MapAccess<'de>,
7408            {
7409                #[allow(unused_imports)]
7410                use serde::de::Error;
7411                use std::option::Option::Some;
7412                let mut fields = std::collections::HashSet::new();
7413                let mut result = Self::Value::new();
7414                while let Some(tag) = map.next_key::<__FieldTag>()? {
7415                    #[allow(clippy::match_single_binding)]
7416                    match tag {
7417                        __FieldTag::__available_zones => {
7418                            if !fields.insert(__FieldTag::__available_zones) {
7419                                return std::result::Result::Err(A::Error::duplicate_field(
7420                                    "multiple values for available_zones",
7421                                ));
7422                            }
7423                            result.available_zones = map
7424                                .next_value::<std::option::Option<
7425                                    std::collections::HashMap<
7426                                        std::string::String,
7427                                        crate::model::ZoneMetadata,
7428                                    >,
7429                                >>()?
7430                                .unwrap_or_default();
7431                        }
7432                        __FieldTag::Unknown(key) => {
7433                            let value = map.next_value::<serde_json::Value>()?;
7434                            result._unknown_fields.insert(key, value);
7435                        }
7436                    }
7437                }
7438                std::result::Result::Ok(result)
7439            }
7440        }
7441        deserializer.deserialize_any(Visitor)
7442    }
7443}
7444
7445#[doc(hidden)]
7446impl serde::ser::Serialize for LocationMetadata {
7447    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7448    where
7449        S: serde::ser::Serializer,
7450    {
7451        use serde::ser::SerializeMap;
7452        #[allow(unused_imports)]
7453        use std::option::Option::Some;
7454        let mut state = serializer.serialize_map(std::option::Option::None)?;
7455        if !self.available_zones.is_empty() {
7456            state.serialize_entry("availableZones", &self.available_zones)?;
7457        }
7458        if !self._unknown_fields.is_empty() {
7459            for (key, value) in self._unknown_fields.iter() {
7460                state.serialize_entry(key, &value)?;
7461            }
7462        }
7463        state.end()
7464    }
7465}
7466
7467impl std::fmt::Debug for LocationMetadata {
7468    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7469        let mut debug_struct = f.debug_struct("LocationMetadata");
7470        debug_struct.field("available_zones", &self.available_zones);
7471        if !self._unknown_fields.is_empty() {
7472            debug_struct.field("_unknown_fields", &self._unknown_fields);
7473        }
7474        debug_struct.finish()
7475    }
7476}
7477
7478/// Defines specific information for a particular zone. Currently empty and
7479/// reserved for future use only.
7480#[derive(Clone, Default, PartialEq)]
7481#[non_exhaustive]
7482pub struct ZoneMetadata {
7483    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7484}
7485
7486impl ZoneMetadata {
7487    pub fn new() -> Self {
7488        std::default::Default::default()
7489    }
7490}
7491
7492impl wkt::message::Message for ZoneMetadata {
7493    fn typename() -> &'static str {
7494        "type.googleapis.com/google.cloud.redis.v1.ZoneMetadata"
7495    }
7496}
7497
7498#[doc(hidden)]
7499impl<'de> serde::de::Deserialize<'de> for ZoneMetadata {
7500    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7501    where
7502        D: serde::Deserializer<'de>,
7503    {
7504        #[allow(non_camel_case_types)]
7505        #[doc(hidden)]
7506        #[derive(PartialEq, Eq, Hash)]
7507        enum __FieldTag {
7508            Unknown(std::string::String),
7509        }
7510        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7511            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7512            where
7513                D: serde::Deserializer<'de>,
7514            {
7515                struct Visitor;
7516                impl<'de> serde::de::Visitor<'de> for Visitor {
7517                    type Value = __FieldTag;
7518                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7519                        formatter.write_str("a field name for ZoneMetadata")
7520                    }
7521                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7522                    where
7523                        E: serde::de::Error,
7524                    {
7525                        use std::result::Result::Ok;
7526                        use std::string::ToString;
7527                        Ok(__FieldTag::Unknown(value.to_string()))
7528                    }
7529                }
7530                deserializer.deserialize_identifier(Visitor)
7531            }
7532        }
7533        struct Visitor;
7534        impl<'de> serde::de::Visitor<'de> for Visitor {
7535            type Value = ZoneMetadata;
7536            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7537                formatter.write_str("struct ZoneMetadata")
7538            }
7539            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7540            where
7541                A: serde::de::MapAccess<'de>,
7542            {
7543                #[allow(unused_imports)]
7544                use serde::de::Error;
7545                use std::option::Option::Some;
7546                let mut result = Self::Value::new();
7547                while let Some(tag) = map.next_key::<__FieldTag>()? {
7548                    #[allow(clippy::match_single_binding)]
7549                    match tag {
7550                        __FieldTag::Unknown(key) => {
7551                            let value = map.next_value::<serde_json::Value>()?;
7552                            result._unknown_fields.insert(key, value);
7553                        }
7554                    }
7555                }
7556                std::result::Result::Ok(result)
7557            }
7558        }
7559        deserializer.deserialize_any(Visitor)
7560    }
7561}
7562
7563#[doc(hidden)]
7564impl serde::ser::Serialize for ZoneMetadata {
7565    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7566    where
7567        S: serde::ser::Serializer,
7568    {
7569        use serde::ser::SerializeMap;
7570        #[allow(unused_imports)]
7571        use std::option::Option::Some;
7572        let mut state = serializer.serialize_map(std::option::Option::None)?;
7573        if !self._unknown_fields.is_empty() {
7574            for (key, value) in self._unknown_fields.iter() {
7575                state.serialize_entry(key, &value)?;
7576            }
7577        }
7578        state.end()
7579    }
7580}
7581
7582impl std::fmt::Debug for ZoneMetadata {
7583    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7584        let mut debug_struct = f.debug_struct("ZoneMetadata");
7585        if !self._unknown_fields.is_empty() {
7586            debug_struct.field("_unknown_fields", &self._unknown_fields);
7587        }
7588        debug_struct.finish()
7589    }
7590}
7591
7592/// TlsCertificate Resource
7593#[derive(Clone, Default, PartialEq)]
7594#[non_exhaustive]
7595pub struct TlsCertificate {
7596    /// Serial number, as extracted from the certificate.
7597    pub serial_number: std::string::String,
7598
7599    /// PEM representation.
7600    pub cert: std::string::String,
7601
7602    /// Output only. The time when the certificate was created in [RFC
7603    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
7604    /// `2020-05-18T00:00:00.094Z`.
7605    pub create_time: std::option::Option<wkt::Timestamp>,
7606
7607    /// Output only. The time when the certificate expires in [RFC
7608    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
7609    /// `2020-05-18T00:00:00.094Z`.
7610    pub expire_time: std::option::Option<wkt::Timestamp>,
7611
7612    /// Sha1 Fingerprint of the certificate.
7613    pub sha1_fingerprint: std::string::String,
7614
7615    _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7616}
7617
7618impl TlsCertificate {
7619    pub fn new() -> Self {
7620        std::default::Default::default()
7621    }
7622
7623    /// Sets the value of [serial_number][crate::model::TlsCertificate::serial_number].
7624    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7625        self.serial_number = v.into();
7626        self
7627    }
7628
7629    /// Sets the value of [cert][crate::model::TlsCertificate::cert].
7630    pub fn set_cert<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7631        self.cert = v.into();
7632        self
7633    }
7634
7635    /// Sets the value of [create_time][crate::model::TlsCertificate::create_time].
7636    pub fn set_create_time<T>(mut self, v: T) -> Self
7637    where
7638        T: std::convert::Into<wkt::Timestamp>,
7639    {
7640        self.create_time = std::option::Option::Some(v.into());
7641        self
7642    }
7643
7644    /// Sets or clears the value of [create_time][crate::model::TlsCertificate::create_time].
7645    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7646    where
7647        T: std::convert::Into<wkt::Timestamp>,
7648    {
7649        self.create_time = v.map(|x| x.into());
7650        self
7651    }
7652
7653    /// Sets the value of [expire_time][crate::model::TlsCertificate::expire_time].
7654    pub fn set_expire_time<T>(mut self, v: T) -> Self
7655    where
7656        T: std::convert::Into<wkt::Timestamp>,
7657    {
7658        self.expire_time = std::option::Option::Some(v.into());
7659        self
7660    }
7661
7662    /// Sets or clears the value of [expire_time][crate::model::TlsCertificate::expire_time].
7663    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7664    where
7665        T: std::convert::Into<wkt::Timestamp>,
7666    {
7667        self.expire_time = v.map(|x| x.into());
7668        self
7669    }
7670
7671    /// Sets the value of [sha1_fingerprint][crate::model::TlsCertificate::sha1_fingerprint].
7672    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
7673        mut self,
7674        v: T,
7675    ) -> Self {
7676        self.sha1_fingerprint = v.into();
7677        self
7678    }
7679}
7680
7681impl wkt::message::Message for TlsCertificate {
7682    fn typename() -> &'static str {
7683        "type.googleapis.com/google.cloud.redis.v1.TlsCertificate"
7684    }
7685}
7686
7687#[doc(hidden)]
7688impl<'de> serde::de::Deserialize<'de> for TlsCertificate {
7689    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7690    where
7691        D: serde::Deserializer<'de>,
7692    {
7693        #[allow(non_camel_case_types)]
7694        #[doc(hidden)]
7695        #[derive(PartialEq, Eq, Hash)]
7696        enum __FieldTag {
7697            __serial_number,
7698            __cert,
7699            __create_time,
7700            __expire_time,
7701            __sha1_fingerprint,
7702            Unknown(std::string::String),
7703        }
7704        impl<'de> serde::de::Deserialize<'de> for __FieldTag {
7705            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7706            where
7707                D: serde::Deserializer<'de>,
7708            {
7709                struct Visitor;
7710                impl<'de> serde::de::Visitor<'de> for Visitor {
7711                    type Value = __FieldTag;
7712                    fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7713                        formatter.write_str("a field name for TlsCertificate")
7714                    }
7715                    fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
7716                    where
7717                        E: serde::de::Error,
7718                    {
7719                        use std::result::Result::Ok;
7720                        use std::string::ToString;
7721                        match value {
7722                            "serialNumber" => Ok(__FieldTag::__serial_number),
7723                            "serial_number" => Ok(__FieldTag::__serial_number),
7724                            "cert" => Ok(__FieldTag::__cert),
7725                            "createTime" => Ok(__FieldTag::__create_time),
7726                            "create_time" => Ok(__FieldTag::__create_time),
7727                            "expireTime" => Ok(__FieldTag::__expire_time),
7728                            "expire_time" => Ok(__FieldTag::__expire_time),
7729                            "sha1Fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
7730                            "sha1_fingerprint" => Ok(__FieldTag::__sha1_fingerprint),
7731                            _ => Ok(__FieldTag::Unknown(value.to_string())),
7732                        }
7733                    }
7734                }
7735                deserializer.deserialize_identifier(Visitor)
7736            }
7737        }
7738        struct Visitor;
7739        impl<'de> serde::de::Visitor<'de> for Visitor {
7740            type Value = TlsCertificate;
7741            fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
7742                formatter.write_str("struct TlsCertificate")
7743            }
7744            fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
7745            where
7746                A: serde::de::MapAccess<'de>,
7747            {
7748                #[allow(unused_imports)]
7749                use serde::de::Error;
7750                use std::option::Option::Some;
7751                let mut fields = std::collections::HashSet::new();
7752                let mut result = Self::Value::new();
7753                while let Some(tag) = map.next_key::<__FieldTag>()? {
7754                    #[allow(clippy::match_single_binding)]
7755                    match tag {
7756                        __FieldTag::__serial_number => {
7757                            if !fields.insert(__FieldTag::__serial_number) {
7758                                return std::result::Result::Err(A::Error::duplicate_field(
7759                                    "multiple values for serial_number",
7760                                ));
7761                            }
7762                            result.serial_number = map
7763                                .next_value::<std::option::Option<std::string::String>>()?
7764                                .unwrap_or_default();
7765                        }
7766                        __FieldTag::__cert => {
7767                            if !fields.insert(__FieldTag::__cert) {
7768                                return std::result::Result::Err(A::Error::duplicate_field(
7769                                    "multiple values for cert",
7770                                ));
7771                            }
7772                            result.cert = map
7773                                .next_value::<std::option::Option<std::string::String>>()?
7774                                .unwrap_or_default();
7775                        }
7776                        __FieldTag::__create_time => {
7777                            if !fields.insert(__FieldTag::__create_time) {
7778                                return std::result::Result::Err(A::Error::duplicate_field(
7779                                    "multiple values for create_time",
7780                                ));
7781                            }
7782                            result.create_time =
7783                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7784                        }
7785                        __FieldTag::__expire_time => {
7786                            if !fields.insert(__FieldTag::__expire_time) {
7787                                return std::result::Result::Err(A::Error::duplicate_field(
7788                                    "multiple values for expire_time",
7789                                ));
7790                            }
7791                            result.expire_time =
7792                                map.next_value::<std::option::Option<wkt::Timestamp>>()?;
7793                        }
7794                        __FieldTag::__sha1_fingerprint => {
7795                            if !fields.insert(__FieldTag::__sha1_fingerprint) {
7796                                return std::result::Result::Err(A::Error::duplicate_field(
7797                                    "multiple values for sha1_fingerprint",
7798                                ));
7799                            }
7800                            result.sha1_fingerprint = map
7801                                .next_value::<std::option::Option<std::string::String>>()?
7802                                .unwrap_or_default();
7803                        }
7804                        __FieldTag::Unknown(key) => {
7805                            let value = map.next_value::<serde_json::Value>()?;
7806                            result._unknown_fields.insert(key, value);
7807                        }
7808                    }
7809                }
7810                std::result::Result::Ok(result)
7811            }
7812        }
7813        deserializer.deserialize_any(Visitor)
7814    }
7815}
7816
7817#[doc(hidden)]
7818impl serde::ser::Serialize for TlsCertificate {
7819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7820    where
7821        S: serde::ser::Serializer,
7822    {
7823        use serde::ser::SerializeMap;
7824        #[allow(unused_imports)]
7825        use std::option::Option::Some;
7826        let mut state = serializer.serialize_map(std::option::Option::None)?;
7827        if !self.serial_number.is_empty() {
7828            state.serialize_entry("serialNumber", &self.serial_number)?;
7829        }
7830        if !self.cert.is_empty() {
7831            state.serialize_entry("cert", &self.cert)?;
7832        }
7833        if self.create_time.is_some() {
7834            state.serialize_entry("createTime", &self.create_time)?;
7835        }
7836        if self.expire_time.is_some() {
7837            state.serialize_entry("expireTime", &self.expire_time)?;
7838        }
7839        if !self.sha1_fingerprint.is_empty() {
7840            state.serialize_entry("sha1Fingerprint", &self.sha1_fingerprint)?;
7841        }
7842        if !self._unknown_fields.is_empty() {
7843            for (key, value) in self._unknown_fields.iter() {
7844                state.serialize_entry(key, &value)?;
7845            }
7846        }
7847        state.end()
7848    }
7849}
7850
7851impl std::fmt::Debug for TlsCertificate {
7852    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7853        let mut debug_struct = f.debug_struct("TlsCertificate");
7854        debug_struct.field("serial_number", &self.serial_number);
7855        debug_struct.field("cert", &self.cert);
7856        debug_struct.field("create_time", &self.create_time);
7857        debug_struct.field("expire_time", &self.expire_time);
7858        debug_struct.field("sha1_fingerprint", &self.sha1_fingerprint);
7859        if !self._unknown_fields.is_empty() {
7860            debug_struct.field("_unknown_fields", &self._unknown_fields);
7861        }
7862        debug_struct.finish()
7863    }
7864}