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