Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_type;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Node specific properties.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct NodeInfo {
43    /// Output only. Node identifying string. e.g. 'node-0', 'node-1'
44    pub id: std::string::String,
45
46    /// Output only. Location of the node.
47    pub zone: std::string::String,
48
49    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl NodeInfo {
53    pub fn new() -> Self {
54        std::default::Default::default()
55    }
56
57    /// Sets the value of [id][crate::model::NodeInfo::id].
58    ///
59    /// # Example
60    /// ```ignore,no_run
61    /// # use google_cloud_redis_v1::model::NodeInfo;
62    /// let x = NodeInfo::new().set_id("example");
63    /// ```
64    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
65        self.id = v.into();
66        self
67    }
68
69    /// Sets the value of [zone][crate::model::NodeInfo::zone].
70    ///
71    /// # Example
72    /// ```ignore,no_run
73    /// # use google_cloud_redis_v1::model::NodeInfo;
74    /// let x = NodeInfo::new().set_zone("example");
75    /// ```
76    pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
77        self.zone = v.into();
78        self
79    }
80}
81
82impl wkt::message::Message for NodeInfo {
83    fn typename() -> &'static str {
84        "type.googleapis.com/google.cloud.redis.v1.NodeInfo"
85    }
86}
87
88/// A Memorystore for Redis instance.
89#[derive(Clone, Default, PartialEq)]
90#[non_exhaustive]
91pub struct Instance {
92    /// Required. Unique name of the resource in this scope including project and
93    /// location using the form:
94    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
95    ///
96    /// Note: Redis instances are managed and addressed at regional level so
97    /// location_id here refers to a GCP region; however, users may choose which
98    /// specific zone (or collection of zones for cross-zone instances) an instance
99    /// should be provisioned in. Refer to
100    /// [location_id][google.cloud.redis.v1.Instance.location_id] and
101    /// [alternative_location_id][google.cloud.redis.v1.Instance.alternative_location_id]
102    /// fields for more details.
103    ///
104    /// [google.cloud.redis.v1.Instance.alternative_location_id]: crate::model::Instance::alternative_location_id
105    /// [google.cloud.redis.v1.Instance.location_id]: crate::model::Instance::location_id
106    pub name: std::string::String,
107
108    /// An arbitrary and optional user-provided name for the instance.
109    pub display_name: std::string::String,
110
111    /// Resource labels to represent user provided metadata
112    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
113
114    /// Optional. The zone where the instance will be provisioned. If not provided,
115    /// the service will choose a zone from the specified region for the instance.
116    /// For standard tier, additional nodes will be added across multiple zones for
117    /// protection against zonal failures. If specified, at least one node will be
118    /// provisioned in this zone.
119    pub location_id: std::string::String,
120
121    /// Optional. If specified, at least one node will be provisioned in this zone
122    /// in addition to the zone specified in location_id. Only applicable to
123    /// standard tier. If provided, it must be a different zone from the one
124    /// provided in [location_id]. Additional nodes beyond the first 2 will be
125    /// placed in zones selected by the service.
126    pub alternative_location_id: std::string::String,
127
128    /// Optional. The version of Redis software.
129    /// If not provided, latest supported version will be used. Currently, the
130    /// supported values are:
131    ///
132    /// * `REDIS_3_2` for Redis 3.2 compatibility
133    /// * `REDIS_4_0` for Redis 4.0 compatibility (default)
134    /// * `REDIS_5_0` for Redis 5.0 compatibility
135    /// * `REDIS_6_X` for Redis 6.x compatibility
136    pub redis_version: std::string::String,
137
138    /// Optional. For DIRECT_PEERING mode, the CIDR range of internal addresses
139    /// that are reserved for this instance. Range must
140    /// be unique and non-overlapping with existing subnets in an authorized
141    /// network. For PRIVATE_SERVICE_ACCESS mode, the name of one allocated IP
142    /// address ranges associated with this private service access connection.
143    /// If not provided, the service will choose an unused /29 block, for
144    /// example, 10.0.0.0/29 or 192.168.0.0/29.  For READ_REPLICAS_ENABLED
145    /// the default block size is /28.
146    pub reserved_ip_range: std::string::String,
147
148    /// Optional. Additional IP range for node placement. Required when enabling
149    /// read replicas on an existing instance. For DIRECT_PEERING mode value must
150    /// be a CIDR range of size /28, or "auto". For PRIVATE_SERVICE_ACCESS mode
151    /// value must be the name of an allocated address range associated with the
152    /// private service access connection, or "auto".
153    pub secondary_ip_range: std::string::String,
154
155    /// Output only. Hostname or IP address of the exposed Redis endpoint used by
156    /// clients to connect to the service.
157    pub host: std::string::String,
158
159    /// Output only. The port number of the exposed Redis endpoint.
160    pub port: i32,
161
162    /// Output only. The current zone where the Redis primary node is located. In
163    /// basic tier, this will always be the same as [location_id]. In
164    /// standard tier, this can be the zone of any node in the instance.
165    pub current_location_id: std::string::String,
166
167    /// Output only. The time the instance was created.
168    pub create_time: std::option::Option<wkt::Timestamp>,
169
170    /// Output only. The current state of this instance.
171    pub state: crate::model::instance::State,
172
173    /// Output only. Additional information about the current status of this
174    /// instance, if available.
175    pub status_message: std::string::String,
176
177    /// Optional. Redis configuration parameters, according to
178    /// <http://redis.io/topics/config>. Currently, the only supported parameters
179    /// are:
180    ///
181    /// Redis version 3.2 and newer:
182    ///
183    /// * maxmemory-policy
184    /// * notify-keyspace-events
185    ///
186    /// Redis version 4.0 and newer:
187    ///
188    /// * activedefrag
189    /// * lfu-decay-time
190    /// * lfu-log-factor
191    /// * maxmemory-gb
192    ///
193    /// Redis version 5.0 and newer:
194    ///
195    /// * stream-node-max-bytes
196    /// * stream-node-max-entries
197    pub redis_configs: std::collections::HashMap<std::string::String, std::string::String>,
198
199    /// Required. The service tier of the instance.
200    pub tier: crate::model::instance::Tier,
201
202    /// Required. Redis memory size in GiB.
203    pub memory_size_gb: i32,
204
205    /// Optional. The full name of the Google Compute Engine
206    /// [network](https://cloud.google.com/vpc/docs/vpc) to which the
207    /// instance is connected. If left unspecified, the `default` network
208    /// will be used.
209    pub authorized_network: std::string::String,
210
211    /// Output only. Cloud IAM identity used by import / export operations to
212    /// transfer data to/from Cloud Storage. Format is
213    /// "serviceAccount:<service_account_email>". The value may change over time
214    /// for a given instance so should be checked before each import/export
215    /// operation.
216    pub persistence_iam_identity: std::string::String,
217
218    /// Optional. The network connect mode of the Redis instance.
219    /// If not provided, the connect mode defaults to DIRECT_PEERING.
220    pub connect_mode: crate::model::instance::ConnectMode,
221
222    /// Optional. Indicates whether OSS Redis AUTH is enabled for the instance. If
223    /// set to "true" AUTH is enabled on the instance. Default value is "false"
224    /// meaning AUTH is disabled.
225    pub auth_enabled: bool,
226
227    /// Output only. List of server CA certificates for the instance.
228    pub server_ca_certs: std::vec::Vec<crate::model::TlsCertificate>,
229
230    /// Optional. The TLS mode of the Redis instance.
231    /// If not provided, TLS is disabled for the instance.
232    pub transit_encryption_mode: crate::model::instance::TransitEncryptionMode,
233
234    /// Optional. The maintenance policy for the instance. If not provided,
235    /// maintenance events can be performed at any time.
236    pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
237
238    /// Output only. Date and time of upcoming maintenance events which have been
239    /// scheduled.
240    pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
241
242    /// Optional. The number of replica nodes. The valid range for the Standard
243    /// Tier with read replicas enabled is [1-5] and defaults to 2. If read
244    /// replicas are not enabled for a Standard Tier instance, the only valid value
245    /// is 1 and the default is 1. The valid value for basic tier is 0 and the
246    /// default is also 0.
247    pub replica_count: i32,
248
249    /// Output only. Info per node.
250    pub nodes: std::vec::Vec<crate::model::NodeInfo>,
251
252    /// Output only. Hostname or IP address of the exposed readonly Redis
253    /// endpoint. Standard tier only. Targets all healthy replica nodes in
254    /// instance. Replication is asynchronous and replica nodes will exhibit some
255    /// lag behind the primary. Write requests must target 'host'.
256    pub read_endpoint: std::string::String,
257
258    /// Output only. The port number of the exposed readonly redis
259    /// endpoint. Standard tier only. Write requests should target 'port'.
260    pub read_endpoint_port: i32,
261
262    /// Optional. Read replicas mode for the instance. Defaults to
263    /// READ_REPLICAS_DISABLED.
264    pub read_replicas_mode: crate::model::instance::ReadReplicasMode,
265
266    /// Optional. The KMS key reference that the customer provides when trying to
267    /// create the instance.
268    pub customer_managed_key: std::string::String,
269
270    /// Optional. Persistence configuration parameters
271    pub persistence_config: std::option::Option<crate::model::PersistenceConfig>,
272
273    /// Optional. reasons that causes instance in "SUSPENDED" state.
274    pub suspension_reasons: std::vec::Vec<crate::model::instance::SuspensionReason>,
275
276    /// Optional. The self service update maintenance version.
277    /// The version is date based such as "20210712_00_00".
278    pub maintenance_version: std::string::String,
279
280    /// Optional. The available maintenance versions that an instance could update
281    /// to.
282    pub available_maintenance_versions: std::vec::Vec<std::string::String>,
283
284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
285}
286
287impl Instance {
288    pub fn new() -> Self {
289        std::default::Default::default()
290    }
291
292    /// Sets the value of [name][crate::model::Instance::name].
293    ///
294    /// # Example
295    /// ```ignore,no_run
296    /// # use google_cloud_redis_v1::model::Instance;
297    /// let x = Instance::new().set_name("example");
298    /// ```
299    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
300        self.name = v.into();
301        self
302    }
303
304    /// Sets the value of [display_name][crate::model::Instance::display_name].
305    ///
306    /// # Example
307    /// ```ignore,no_run
308    /// # use google_cloud_redis_v1::model::Instance;
309    /// let x = Instance::new().set_display_name("example");
310    /// ```
311    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312        self.display_name = v.into();
313        self
314    }
315
316    /// Sets the value of [labels][crate::model::Instance::labels].
317    ///
318    /// # Example
319    /// ```ignore,no_run
320    /// # use google_cloud_redis_v1::model::Instance;
321    /// let x = Instance::new().set_labels([
322    ///     ("key0", "abc"),
323    ///     ("key1", "xyz"),
324    /// ]);
325    /// ```
326    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
327    where
328        T: std::iter::IntoIterator<Item = (K, V)>,
329        K: std::convert::Into<std::string::String>,
330        V: std::convert::Into<std::string::String>,
331    {
332        use std::iter::Iterator;
333        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
334        self
335    }
336
337    /// Sets the value of [location_id][crate::model::Instance::location_id].
338    ///
339    /// # Example
340    /// ```ignore,no_run
341    /// # use google_cloud_redis_v1::model::Instance;
342    /// let x = Instance::new().set_location_id("example");
343    /// ```
344    pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
345        self.location_id = v.into();
346        self
347    }
348
349    /// Sets the value of [alternative_location_id][crate::model::Instance::alternative_location_id].
350    ///
351    /// # Example
352    /// ```ignore,no_run
353    /// # use google_cloud_redis_v1::model::Instance;
354    /// let x = Instance::new().set_alternative_location_id("example");
355    /// ```
356    pub fn set_alternative_location_id<T: std::convert::Into<std::string::String>>(
357        mut self,
358        v: T,
359    ) -> Self {
360        self.alternative_location_id = v.into();
361        self
362    }
363
364    /// Sets the value of [redis_version][crate::model::Instance::redis_version].
365    ///
366    /// # Example
367    /// ```ignore,no_run
368    /// # use google_cloud_redis_v1::model::Instance;
369    /// let x = Instance::new().set_redis_version("example");
370    /// ```
371    pub fn set_redis_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
372        self.redis_version = v.into();
373        self
374    }
375
376    /// Sets the value of [reserved_ip_range][crate::model::Instance::reserved_ip_range].
377    ///
378    /// # Example
379    /// ```ignore,no_run
380    /// # use google_cloud_redis_v1::model::Instance;
381    /// let x = Instance::new().set_reserved_ip_range("example");
382    /// ```
383    pub fn set_reserved_ip_range<T: std::convert::Into<std::string::String>>(
384        mut self,
385        v: T,
386    ) -> Self {
387        self.reserved_ip_range = v.into();
388        self
389    }
390
391    /// Sets the value of [secondary_ip_range][crate::model::Instance::secondary_ip_range].
392    ///
393    /// # Example
394    /// ```ignore,no_run
395    /// # use google_cloud_redis_v1::model::Instance;
396    /// let x = Instance::new().set_secondary_ip_range("example");
397    /// ```
398    pub fn set_secondary_ip_range<T: std::convert::Into<std::string::String>>(
399        mut self,
400        v: T,
401    ) -> Self {
402        self.secondary_ip_range = v.into();
403        self
404    }
405
406    /// Sets the value of [host][crate::model::Instance::host].
407    ///
408    /// # Example
409    /// ```ignore,no_run
410    /// # use google_cloud_redis_v1::model::Instance;
411    /// let x = Instance::new().set_host("example");
412    /// ```
413    pub fn set_host<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
414        self.host = v.into();
415        self
416    }
417
418    /// Sets the value of [port][crate::model::Instance::port].
419    ///
420    /// # Example
421    /// ```ignore,no_run
422    /// # use google_cloud_redis_v1::model::Instance;
423    /// let x = Instance::new().set_port(42);
424    /// ```
425    pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
426        self.port = v.into();
427        self
428    }
429
430    /// Sets the value of [current_location_id][crate::model::Instance::current_location_id].
431    ///
432    /// # Example
433    /// ```ignore,no_run
434    /// # use google_cloud_redis_v1::model::Instance;
435    /// let x = Instance::new().set_current_location_id("example");
436    /// ```
437    pub fn set_current_location_id<T: std::convert::Into<std::string::String>>(
438        mut self,
439        v: T,
440    ) -> Self {
441        self.current_location_id = v.into();
442        self
443    }
444
445    /// Sets the value of [create_time][crate::model::Instance::create_time].
446    ///
447    /// # Example
448    /// ```ignore,no_run
449    /// # use google_cloud_redis_v1::model::Instance;
450    /// use wkt::Timestamp;
451    /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
452    /// ```
453    pub fn set_create_time<T>(mut self, v: T) -> Self
454    where
455        T: std::convert::Into<wkt::Timestamp>,
456    {
457        self.create_time = std::option::Option::Some(v.into());
458        self
459    }
460
461    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
462    ///
463    /// # Example
464    /// ```ignore,no_run
465    /// # use google_cloud_redis_v1::model::Instance;
466    /// use wkt::Timestamp;
467    /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
468    /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
469    /// ```
470    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
471    where
472        T: std::convert::Into<wkt::Timestamp>,
473    {
474        self.create_time = v.map(|x| x.into());
475        self
476    }
477
478    /// Sets the value of [state][crate::model::Instance::state].
479    ///
480    /// # Example
481    /// ```ignore,no_run
482    /// # use google_cloud_redis_v1::model::Instance;
483    /// use google_cloud_redis_v1::model::instance::State;
484    /// let x0 = Instance::new().set_state(State::Creating);
485    /// let x1 = Instance::new().set_state(State::Ready);
486    /// let x2 = Instance::new().set_state(State::Updating);
487    /// ```
488    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
489        self.state = v.into();
490        self
491    }
492
493    /// Sets the value of [status_message][crate::model::Instance::status_message].
494    ///
495    /// # Example
496    /// ```ignore,no_run
497    /// # use google_cloud_redis_v1::model::Instance;
498    /// let x = Instance::new().set_status_message("example");
499    /// ```
500    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
501        self.status_message = v.into();
502        self
503    }
504
505    /// Sets the value of [redis_configs][crate::model::Instance::redis_configs].
506    ///
507    /// # Example
508    /// ```ignore,no_run
509    /// # use google_cloud_redis_v1::model::Instance;
510    /// let x = Instance::new().set_redis_configs([
511    ///     ("key0", "abc"),
512    ///     ("key1", "xyz"),
513    /// ]);
514    /// ```
515    pub fn set_redis_configs<T, K, V>(mut self, v: T) -> Self
516    where
517        T: std::iter::IntoIterator<Item = (K, V)>,
518        K: std::convert::Into<std::string::String>,
519        V: std::convert::Into<std::string::String>,
520    {
521        use std::iter::Iterator;
522        self.redis_configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
523        self
524    }
525
526    /// Sets the value of [tier][crate::model::Instance::tier].
527    ///
528    /// # Example
529    /// ```ignore,no_run
530    /// # use google_cloud_redis_v1::model::Instance;
531    /// use google_cloud_redis_v1::model::instance::Tier;
532    /// let x0 = Instance::new().set_tier(Tier::Basic);
533    /// let x1 = Instance::new().set_tier(Tier::StandardHa);
534    /// ```
535    pub fn set_tier<T: std::convert::Into<crate::model::instance::Tier>>(mut self, v: T) -> Self {
536        self.tier = v.into();
537        self
538    }
539
540    /// Sets the value of [memory_size_gb][crate::model::Instance::memory_size_gb].
541    ///
542    /// # Example
543    /// ```ignore,no_run
544    /// # use google_cloud_redis_v1::model::Instance;
545    /// let x = Instance::new().set_memory_size_gb(42);
546    /// ```
547    pub fn set_memory_size_gb<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
548        self.memory_size_gb = v.into();
549        self
550    }
551
552    /// Sets the value of [authorized_network][crate::model::Instance::authorized_network].
553    ///
554    /// # Example
555    /// ```ignore,no_run
556    /// # use google_cloud_redis_v1::model::Instance;
557    /// let x = Instance::new().set_authorized_network("example");
558    /// ```
559    pub fn set_authorized_network<T: std::convert::Into<std::string::String>>(
560        mut self,
561        v: T,
562    ) -> Self {
563        self.authorized_network = v.into();
564        self
565    }
566
567    /// Sets the value of [persistence_iam_identity][crate::model::Instance::persistence_iam_identity].
568    ///
569    /// # Example
570    /// ```ignore,no_run
571    /// # use google_cloud_redis_v1::model::Instance;
572    /// let x = Instance::new().set_persistence_iam_identity("example");
573    /// ```
574    pub fn set_persistence_iam_identity<T: std::convert::Into<std::string::String>>(
575        mut self,
576        v: T,
577    ) -> Self {
578        self.persistence_iam_identity = v.into();
579        self
580    }
581
582    /// Sets the value of [connect_mode][crate::model::Instance::connect_mode].
583    ///
584    /// # Example
585    /// ```ignore,no_run
586    /// # use google_cloud_redis_v1::model::Instance;
587    /// use google_cloud_redis_v1::model::instance::ConnectMode;
588    /// let x0 = Instance::new().set_connect_mode(ConnectMode::DirectPeering);
589    /// let x1 = Instance::new().set_connect_mode(ConnectMode::PrivateServiceAccess);
590    /// ```
591    pub fn set_connect_mode<T: std::convert::Into<crate::model::instance::ConnectMode>>(
592        mut self,
593        v: T,
594    ) -> Self {
595        self.connect_mode = v.into();
596        self
597    }
598
599    /// Sets the value of [auth_enabled][crate::model::Instance::auth_enabled].
600    ///
601    /// # Example
602    /// ```ignore,no_run
603    /// # use google_cloud_redis_v1::model::Instance;
604    /// let x = Instance::new().set_auth_enabled(true);
605    /// ```
606    pub fn set_auth_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
607        self.auth_enabled = v.into();
608        self
609    }
610
611    /// Sets the value of [server_ca_certs][crate::model::Instance::server_ca_certs].
612    ///
613    /// # Example
614    /// ```ignore,no_run
615    /// # use google_cloud_redis_v1::model::Instance;
616    /// use google_cloud_redis_v1::model::TlsCertificate;
617    /// let x = Instance::new()
618    ///     .set_server_ca_certs([
619    ///         TlsCertificate::default()/* use setters */,
620    ///         TlsCertificate::default()/* use (different) setters */,
621    ///     ]);
622    /// ```
623    pub fn set_server_ca_certs<T, V>(mut self, v: T) -> Self
624    where
625        T: std::iter::IntoIterator<Item = V>,
626        V: std::convert::Into<crate::model::TlsCertificate>,
627    {
628        use std::iter::Iterator;
629        self.server_ca_certs = v.into_iter().map(|i| i.into()).collect();
630        self
631    }
632
633    /// Sets the value of [transit_encryption_mode][crate::model::Instance::transit_encryption_mode].
634    ///
635    /// # Example
636    /// ```ignore,no_run
637    /// # use google_cloud_redis_v1::model::Instance;
638    /// use google_cloud_redis_v1::model::instance::TransitEncryptionMode;
639    /// let x0 = Instance::new().set_transit_encryption_mode(TransitEncryptionMode::ServerAuthentication);
640    /// let x1 = Instance::new().set_transit_encryption_mode(TransitEncryptionMode::Disabled);
641    /// ```
642    pub fn set_transit_encryption_mode<
643        T: std::convert::Into<crate::model::instance::TransitEncryptionMode>,
644    >(
645        mut self,
646        v: T,
647    ) -> Self {
648        self.transit_encryption_mode = v.into();
649        self
650    }
651
652    /// Sets the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
653    ///
654    /// # Example
655    /// ```ignore,no_run
656    /// # use google_cloud_redis_v1::model::Instance;
657    /// use google_cloud_redis_v1::model::MaintenancePolicy;
658    /// let x = Instance::new().set_maintenance_policy(MaintenancePolicy::default()/* use setters */);
659    /// ```
660    pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
661    where
662        T: std::convert::Into<crate::model::MaintenancePolicy>,
663    {
664        self.maintenance_policy = std::option::Option::Some(v.into());
665        self
666    }
667
668    /// Sets or clears the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
669    ///
670    /// # Example
671    /// ```ignore,no_run
672    /// # use google_cloud_redis_v1::model::Instance;
673    /// use google_cloud_redis_v1::model::MaintenancePolicy;
674    /// let x = Instance::new().set_or_clear_maintenance_policy(Some(MaintenancePolicy::default()/* use setters */));
675    /// let x = Instance::new().set_or_clear_maintenance_policy(None::<MaintenancePolicy>);
676    /// ```
677    pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
678    where
679        T: std::convert::Into<crate::model::MaintenancePolicy>,
680    {
681        self.maintenance_policy = v.map(|x| x.into());
682        self
683    }
684
685    /// Sets the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
686    ///
687    /// # Example
688    /// ```ignore,no_run
689    /// # use google_cloud_redis_v1::model::Instance;
690    /// use google_cloud_redis_v1::model::MaintenanceSchedule;
691    /// let x = Instance::new().set_maintenance_schedule(MaintenanceSchedule::default()/* use setters */);
692    /// ```
693    pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
694    where
695        T: std::convert::Into<crate::model::MaintenanceSchedule>,
696    {
697        self.maintenance_schedule = std::option::Option::Some(v.into());
698        self
699    }
700
701    /// Sets or clears the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
702    ///
703    /// # Example
704    /// ```ignore,no_run
705    /// # use google_cloud_redis_v1::model::Instance;
706    /// use google_cloud_redis_v1::model::MaintenanceSchedule;
707    /// let x = Instance::new().set_or_clear_maintenance_schedule(Some(MaintenanceSchedule::default()/* use setters */));
708    /// let x = Instance::new().set_or_clear_maintenance_schedule(None::<MaintenanceSchedule>);
709    /// ```
710    pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
711    where
712        T: std::convert::Into<crate::model::MaintenanceSchedule>,
713    {
714        self.maintenance_schedule = v.map(|x| x.into());
715        self
716    }
717
718    /// Sets the value of [replica_count][crate::model::Instance::replica_count].
719    ///
720    /// # Example
721    /// ```ignore,no_run
722    /// # use google_cloud_redis_v1::model::Instance;
723    /// let x = Instance::new().set_replica_count(42);
724    /// ```
725    pub fn set_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
726        self.replica_count = v.into();
727        self
728    }
729
730    /// Sets the value of [nodes][crate::model::Instance::nodes].
731    ///
732    /// # Example
733    /// ```ignore,no_run
734    /// # use google_cloud_redis_v1::model::Instance;
735    /// use google_cloud_redis_v1::model::NodeInfo;
736    /// let x = Instance::new()
737    ///     .set_nodes([
738    ///         NodeInfo::default()/* use setters */,
739    ///         NodeInfo::default()/* use (different) setters */,
740    ///     ]);
741    /// ```
742    pub fn set_nodes<T, V>(mut self, v: T) -> Self
743    where
744        T: std::iter::IntoIterator<Item = V>,
745        V: std::convert::Into<crate::model::NodeInfo>,
746    {
747        use std::iter::Iterator;
748        self.nodes = v.into_iter().map(|i| i.into()).collect();
749        self
750    }
751
752    /// Sets the value of [read_endpoint][crate::model::Instance::read_endpoint].
753    ///
754    /// # Example
755    /// ```ignore,no_run
756    /// # use google_cloud_redis_v1::model::Instance;
757    /// let x = Instance::new().set_read_endpoint("example");
758    /// ```
759    pub fn set_read_endpoint<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
760        self.read_endpoint = v.into();
761        self
762    }
763
764    /// Sets the value of [read_endpoint_port][crate::model::Instance::read_endpoint_port].
765    ///
766    /// # Example
767    /// ```ignore,no_run
768    /// # use google_cloud_redis_v1::model::Instance;
769    /// let x = Instance::new().set_read_endpoint_port(42);
770    /// ```
771    pub fn set_read_endpoint_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
772        self.read_endpoint_port = v.into();
773        self
774    }
775
776    /// Sets the value of [read_replicas_mode][crate::model::Instance::read_replicas_mode].
777    ///
778    /// # Example
779    /// ```ignore,no_run
780    /// # use google_cloud_redis_v1::model::Instance;
781    /// use google_cloud_redis_v1::model::instance::ReadReplicasMode;
782    /// let x0 = Instance::new().set_read_replicas_mode(ReadReplicasMode::ReadReplicasDisabled);
783    /// let x1 = Instance::new().set_read_replicas_mode(ReadReplicasMode::ReadReplicasEnabled);
784    /// ```
785    pub fn set_read_replicas_mode<
786        T: std::convert::Into<crate::model::instance::ReadReplicasMode>,
787    >(
788        mut self,
789        v: T,
790    ) -> Self {
791        self.read_replicas_mode = v.into();
792        self
793    }
794
795    /// Sets the value of [customer_managed_key][crate::model::Instance::customer_managed_key].
796    ///
797    /// # Example
798    /// ```ignore,no_run
799    /// # use google_cloud_redis_v1::model::Instance;
800    /// let x = Instance::new().set_customer_managed_key("example");
801    /// ```
802    pub fn set_customer_managed_key<T: std::convert::Into<std::string::String>>(
803        mut self,
804        v: T,
805    ) -> Self {
806        self.customer_managed_key = v.into();
807        self
808    }
809
810    /// Sets the value of [persistence_config][crate::model::Instance::persistence_config].
811    ///
812    /// # Example
813    /// ```ignore,no_run
814    /// # use google_cloud_redis_v1::model::Instance;
815    /// use google_cloud_redis_v1::model::PersistenceConfig;
816    /// let x = Instance::new().set_persistence_config(PersistenceConfig::default()/* use setters */);
817    /// ```
818    pub fn set_persistence_config<T>(mut self, v: T) -> Self
819    where
820        T: std::convert::Into<crate::model::PersistenceConfig>,
821    {
822        self.persistence_config = std::option::Option::Some(v.into());
823        self
824    }
825
826    /// Sets or clears the value of [persistence_config][crate::model::Instance::persistence_config].
827    ///
828    /// # Example
829    /// ```ignore,no_run
830    /// # use google_cloud_redis_v1::model::Instance;
831    /// use google_cloud_redis_v1::model::PersistenceConfig;
832    /// let x = Instance::new().set_or_clear_persistence_config(Some(PersistenceConfig::default()/* use setters */));
833    /// let x = Instance::new().set_or_clear_persistence_config(None::<PersistenceConfig>);
834    /// ```
835    pub fn set_or_clear_persistence_config<T>(mut self, v: std::option::Option<T>) -> Self
836    where
837        T: std::convert::Into<crate::model::PersistenceConfig>,
838    {
839        self.persistence_config = v.map(|x| x.into());
840        self
841    }
842
843    /// Sets the value of [suspension_reasons][crate::model::Instance::suspension_reasons].
844    ///
845    /// # Example
846    /// ```ignore,no_run
847    /// # use google_cloud_redis_v1::model::Instance;
848    /// use google_cloud_redis_v1::model::instance::SuspensionReason;
849    /// let x = Instance::new().set_suspension_reasons([
850    ///     SuspensionReason::CustomerManagedKeyIssue,
851    /// ]);
852    /// ```
853    pub fn set_suspension_reasons<T, V>(mut self, v: T) -> Self
854    where
855        T: std::iter::IntoIterator<Item = V>,
856        V: std::convert::Into<crate::model::instance::SuspensionReason>,
857    {
858        use std::iter::Iterator;
859        self.suspension_reasons = v.into_iter().map(|i| i.into()).collect();
860        self
861    }
862
863    /// Sets the value of [maintenance_version][crate::model::Instance::maintenance_version].
864    ///
865    /// # Example
866    /// ```ignore,no_run
867    /// # use google_cloud_redis_v1::model::Instance;
868    /// let x = Instance::new().set_maintenance_version("example");
869    /// ```
870    pub fn set_maintenance_version<T: std::convert::Into<std::string::String>>(
871        mut self,
872        v: T,
873    ) -> Self {
874        self.maintenance_version = v.into();
875        self
876    }
877
878    /// Sets the value of [available_maintenance_versions][crate::model::Instance::available_maintenance_versions].
879    ///
880    /// # Example
881    /// ```ignore,no_run
882    /// # use google_cloud_redis_v1::model::Instance;
883    /// let x = Instance::new().set_available_maintenance_versions(["a", "b", "c"]);
884    /// ```
885    pub fn set_available_maintenance_versions<T, V>(mut self, v: T) -> Self
886    where
887        T: std::iter::IntoIterator<Item = V>,
888        V: std::convert::Into<std::string::String>,
889    {
890        use std::iter::Iterator;
891        self.available_maintenance_versions = v.into_iter().map(|i| i.into()).collect();
892        self
893    }
894}
895
896impl wkt::message::Message for Instance {
897    fn typename() -> &'static str {
898        "type.googleapis.com/google.cloud.redis.v1.Instance"
899    }
900}
901
902/// Defines additional types related to [Instance].
903pub mod instance {
904    #[allow(unused_imports)]
905    use super::*;
906
907    /// Represents the different states of a Redis instance.
908    ///
909    /// # Working with unknown values
910    ///
911    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
912    /// additional enum variants at any time. Adding new variants is not considered
913    /// a breaking change. Applications should write their code in anticipation of:
914    ///
915    /// - New values appearing in future releases of the client library, **and**
916    /// - New values received dynamically, without application changes.
917    ///
918    /// Please consult the [Working with enums] section in the user guide for some
919    /// guidelines.
920    ///
921    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
922    #[derive(Clone, Debug, PartialEq)]
923    #[non_exhaustive]
924    pub enum State {
925        /// Not set.
926        Unspecified,
927        /// Redis instance is being created.
928        Creating,
929        /// Redis instance has been created and is fully usable.
930        Ready,
931        /// Redis instance configuration is being updated. Certain kinds of updates
932        /// may cause the instance to become unusable while the update is in
933        /// progress.
934        Updating,
935        /// Redis instance is being deleted.
936        Deleting,
937        /// Redis instance is being repaired and may be unusable.
938        Repairing,
939        /// Maintenance is being performed on this Redis instance.
940        Maintenance,
941        /// Redis instance is importing data (availability may be affected).
942        Importing,
943        /// Redis instance is failing over (availability may be affected).
944        FailingOver,
945        /// If set, the enum was initialized with an unknown value.
946        ///
947        /// Applications can examine the value using [State::value] or
948        /// [State::name].
949        UnknownValue(state::UnknownValue),
950    }
951
952    #[doc(hidden)]
953    pub mod state {
954        #[allow(unused_imports)]
955        use super::*;
956        #[derive(Clone, Debug, PartialEq)]
957        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
958    }
959
960    impl State {
961        /// Gets the enum value.
962        ///
963        /// Returns `None` if the enum contains an unknown value deserialized from
964        /// the string representation of enums.
965        pub fn value(&self) -> std::option::Option<i32> {
966            match self {
967                Self::Unspecified => std::option::Option::Some(0),
968                Self::Creating => std::option::Option::Some(1),
969                Self::Ready => std::option::Option::Some(2),
970                Self::Updating => std::option::Option::Some(3),
971                Self::Deleting => std::option::Option::Some(4),
972                Self::Repairing => std::option::Option::Some(5),
973                Self::Maintenance => std::option::Option::Some(6),
974                Self::Importing => std::option::Option::Some(8),
975                Self::FailingOver => std::option::Option::Some(9),
976                Self::UnknownValue(u) => u.0.value(),
977            }
978        }
979
980        /// Gets the enum value as a string.
981        ///
982        /// Returns `None` if the enum contains an unknown value deserialized from
983        /// the integer representation of enums.
984        pub fn name(&self) -> std::option::Option<&str> {
985            match self {
986                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
987                Self::Creating => std::option::Option::Some("CREATING"),
988                Self::Ready => std::option::Option::Some("READY"),
989                Self::Updating => std::option::Option::Some("UPDATING"),
990                Self::Deleting => std::option::Option::Some("DELETING"),
991                Self::Repairing => std::option::Option::Some("REPAIRING"),
992                Self::Maintenance => std::option::Option::Some("MAINTENANCE"),
993                Self::Importing => std::option::Option::Some("IMPORTING"),
994                Self::FailingOver => std::option::Option::Some("FAILING_OVER"),
995                Self::UnknownValue(u) => u.0.name(),
996            }
997        }
998    }
999
1000    impl std::default::Default for State {
1001        fn default() -> Self {
1002            use std::convert::From;
1003            Self::from(0)
1004        }
1005    }
1006
1007    impl std::fmt::Display for State {
1008        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1009            wkt::internal::display_enum(f, self.name(), self.value())
1010        }
1011    }
1012
1013    impl std::convert::From<i32> for State {
1014        fn from(value: i32) -> Self {
1015            match value {
1016                0 => Self::Unspecified,
1017                1 => Self::Creating,
1018                2 => Self::Ready,
1019                3 => Self::Updating,
1020                4 => Self::Deleting,
1021                5 => Self::Repairing,
1022                6 => Self::Maintenance,
1023                8 => Self::Importing,
1024                9 => Self::FailingOver,
1025                _ => Self::UnknownValue(state::UnknownValue(
1026                    wkt::internal::UnknownEnumValue::Integer(value),
1027                )),
1028            }
1029        }
1030    }
1031
1032    impl std::convert::From<&str> for State {
1033        fn from(value: &str) -> Self {
1034            use std::string::ToString;
1035            match value {
1036                "STATE_UNSPECIFIED" => Self::Unspecified,
1037                "CREATING" => Self::Creating,
1038                "READY" => Self::Ready,
1039                "UPDATING" => Self::Updating,
1040                "DELETING" => Self::Deleting,
1041                "REPAIRING" => Self::Repairing,
1042                "MAINTENANCE" => Self::Maintenance,
1043                "IMPORTING" => Self::Importing,
1044                "FAILING_OVER" => Self::FailingOver,
1045                _ => Self::UnknownValue(state::UnknownValue(
1046                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1047                )),
1048            }
1049        }
1050    }
1051
1052    impl serde::ser::Serialize for State {
1053        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1054        where
1055            S: serde::Serializer,
1056        {
1057            match self {
1058                Self::Unspecified => serializer.serialize_i32(0),
1059                Self::Creating => serializer.serialize_i32(1),
1060                Self::Ready => serializer.serialize_i32(2),
1061                Self::Updating => serializer.serialize_i32(3),
1062                Self::Deleting => serializer.serialize_i32(4),
1063                Self::Repairing => serializer.serialize_i32(5),
1064                Self::Maintenance => serializer.serialize_i32(6),
1065                Self::Importing => serializer.serialize_i32(8),
1066                Self::FailingOver => serializer.serialize_i32(9),
1067                Self::UnknownValue(u) => u.0.serialize(serializer),
1068            }
1069        }
1070    }
1071
1072    impl<'de> serde::de::Deserialize<'de> for State {
1073        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1074        where
1075            D: serde::Deserializer<'de>,
1076        {
1077            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1078                ".google.cloud.redis.v1.Instance.State",
1079            ))
1080        }
1081    }
1082
1083    /// Available service tiers to choose from
1084    ///
1085    /// # Working with unknown values
1086    ///
1087    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1088    /// additional enum variants at any time. Adding new variants is not considered
1089    /// a breaking change. Applications should write their code in anticipation of:
1090    ///
1091    /// - New values appearing in future releases of the client library, **and**
1092    /// - New values received dynamically, without application changes.
1093    ///
1094    /// Please consult the [Working with enums] section in the user guide for some
1095    /// guidelines.
1096    ///
1097    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1098    #[derive(Clone, Debug, PartialEq)]
1099    #[non_exhaustive]
1100    pub enum Tier {
1101        /// Not set.
1102        Unspecified,
1103        /// BASIC tier: standalone instance
1104        Basic,
1105        /// STANDARD_HA tier: highly available primary/replica instances
1106        StandardHa,
1107        /// If set, the enum was initialized with an unknown value.
1108        ///
1109        /// Applications can examine the value using [Tier::value] or
1110        /// [Tier::name].
1111        UnknownValue(tier::UnknownValue),
1112    }
1113
1114    #[doc(hidden)]
1115    pub mod tier {
1116        #[allow(unused_imports)]
1117        use super::*;
1118        #[derive(Clone, Debug, PartialEq)]
1119        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1120    }
1121
1122    impl Tier {
1123        /// Gets the enum value.
1124        ///
1125        /// Returns `None` if the enum contains an unknown value deserialized from
1126        /// the string representation of enums.
1127        pub fn value(&self) -> std::option::Option<i32> {
1128            match self {
1129                Self::Unspecified => std::option::Option::Some(0),
1130                Self::Basic => std::option::Option::Some(1),
1131                Self::StandardHa => std::option::Option::Some(3),
1132                Self::UnknownValue(u) => u.0.value(),
1133            }
1134        }
1135
1136        /// Gets the enum value as a string.
1137        ///
1138        /// Returns `None` if the enum contains an unknown value deserialized from
1139        /// the integer representation of enums.
1140        pub fn name(&self) -> std::option::Option<&str> {
1141            match self {
1142                Self::Unspecified => std::option::Option::Some("TIER_UNSPECIFIED"),
1143                Self::Basic => std::option::Option::Some("BASIC"),
1144                Self::StandardHa => std::option::Option::Some("STANDARD_HA"),
1145                Self::UnknownValue(u) => u.0.name(),
1146            }
1147        }
1148    }
1149
1150    impl std::default::Default for Tier {
1151        fn default() -> Self {
1152            use std::convert::From;
1153            Self::from(0)
1154        }
1155    }
1156
1157    impl std::fmt::Display for Tier {
1158        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1159            wkt::internal::display_enum(f, self.name(), self.value())
1160        }
1161    }
1162
1163    impl std::convert::From<i32> for Tier {
1164        fn from(value: i32) -> Self {
1165            match value {
1166                0 => Self::Unspecified,
1167                1 => Self::Basic,
1168                3 => Self::StandardHa,
1169                _ => Self::UnknownValue(tier::UnknownValue(
1170                    wkt::internal::UnknownEnumValue::Integer(value),
1171                )),
1172            }
1173        }
1174    }
1175
1176    impl std::convert::From<&str> for Tier {
1177        fn from(value: &str) -> Self {
1178            use std::string::ToString;
1179            match value {
1180                "TIER_UNSPECIFIED" => Self::Unspecified,
1181                "BASIC" => Self::Basic,
1182                "STANDARD_HA" => Self::StandardHa,
1183                _ => Self::UnknownValue(tier::UnknownValue(
1184                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1185                )),
1186            }
1187        }
1188    }
1189
1190    impl serde::ser::Serialize for Tier {
1191        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1192        where
1193            S: serde::Serializer,
1194        {
1195            match self {
1196                Self::Unspecified => serializer.serialize_i32(0),
1197                Self::Basic => serializer.serialize_i32(1),
1198                Self::StandardHa => serializer.serialize_i32(3),
1199                Self::UnknownValue(u) => u.0.serialize(serializer),
1200            }
1201        }
1202    }
1203
1204    impl<'de> serde::de::Deserialize<'de> for Tier {
1205        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1206        where
1207            D: serde::Deserializer<'de>,
1208        {
1209            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Tier>::new(
1210                ".google.cloud.redis.v1.Instance.Tier",
1211            ))
1212        }
1213    }
1214
1215    /// Available connection modes.
1216    ///
1217    /// # Working with unknown values
1218    ///
1219    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1220    /// additional enum variants at any time. Adding new variants is not considered
1221    /// a breaking change. Applications should write their code in anticipation of:
1222    ///
1223    /// - New values appearing in future releases of the client library, **and**
1224    /// - New values received dynamically, without application changes.
1225    ///
1226    /// Please consult the [Working with enums] section in the user guide for some
1227    /// guidelines.
1228    ///
1229    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1230    #[derive(Clone, Debug, PartialEq)]
1231    #[non_exhaustive]
1232    pub enum ConnectMode {
1233        /// Not set.
1234        Unspecified,
1235        /// Connect via direct peering to the Memorystore for Redis hosted service.
1236        DirectPeering,
1237        /// Connect your Memorystore for Redis instance using Private Service
1238        /// Access. Private services access provides an IP address range for multiple
1239        /// Google Cloud services, including Memorystore.
1240        PrivateServiceAccess,
1241        /// If set, the enum was initialized with an unknown value.
1242        ///
1243        /// Applications can examine the value using [ConnectMode::value] or
1244        /// [ConnectMode::name].
1245        UnknownValue(connect_mode::UnknownValue),
1246    }
1247
1248    #[doc(hidden)]
1249    pub mod connect_mode {
1250        #[allow(unused_imports)]
1251        use super::*;
1252        #[derive(Clone, Debug, PartialEq)]
1253        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1254    }
1255
1256    impl ConnectMode {
1257        /// Gets the enum value.
1258        ///
1259        /// Returns `None` if the enum contains an unknown value deserialized from
1260        /// the string representation of enums.
1261        pub fn value(&self) -> std::option::Option<i32> {
1262            match self {
1263                Self::Unspecified => std::option::Option::Some(0),
1264                Self::DirectPeering => std::option::Option::Some(1),
1265                Self::PrivateServiceAccess => std::option::Option::Some(2),
1266                Self::UnknownValue(u) => u.0.value(),
1267            }
1268        }
1269
1270        /// Gets the enum value as a string.
1271        ///
1272        /// Returns `None` if the enum contains an unknown value deserialized from
1273        /// the integer representation of enums.
1274        pub fn name(&self) -> std::option::Option<&str> {
1275            match self {
1276                Self::Unspecified => std::option::Option::Some("CONNECT_MODE_UNSPECIFIED"),
1277                Self::DirectPeering => std::option::Option::Some("DIRECT_PEERING"),
1278                Self::PrivateServiceAccess => std::option::Option::Some("PRIVATE_SERVICE_ACCESS"),
1279                Self::UnknownValue(u) => u.0.name(),
1280            }
1281        }
1282    }
1283
1284    impl std::default::Default for ConnectMode {
1285        fn default() -> Self {
1286            use std::convert::From;
1287            Self::from(0)
1288        }
1289    }
1290
1291    impl std::fmt::Display for ConnectMode {
1292        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1293            wkt::internal::display_enum(f, self.name(), self.value())
1294        }
1295    }
1296
1297    impl std::convert::From<i32> for ConnectMode {
1298        fn from(value: i32) -> Self {
1299            match value {
1300                0 => Self::Unspecified,
1301                1 => Self::DirectPeering,
1302                2 => Self::PrivateServiceAccess,
1303                _ => Self::UnknownValue(connect_mode::UnknownValue(
1304                    wkt::internal::UnknownEnumValue::Integer(value),
1305                )),
1306            }
1307        }
1308    }
1309
1310    impl std::convert::From<&str> for ConnectMode {
1311        fn from(value: &str) -> Self {
1312            use std::string::ToString;
1313            match value {
1314                "CONNECT_MODE_UNSPECIFIED" => Self::Unspecified,
1315                "DIRECT_PEERING" => Self::DirectPeering,
1316                "PRIVATE_SERVICE_ACCESS" => Self::PrivateServiceAccess,
1317                _ => Self::UnknownValue(connect_mode::UnknownValue(
1318                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1319                )),
1320            }
1321        }
1322    }
1323
1324    impl serde::ser::Serialize for ConnectMode {
1325        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1326        where
1327            S: serde::Serializer,
1328        {
1329            match self {
1330                Self::Unspecified => serializer.serialize_i32(0),
1331                Self::DirectPeering => serializer.serialize_i32(1),
1332                Self::PrivateServiceAccess => serializer.serialize_i32(2),
1333                Self::UnknownValue(u) => u.0.serialize(serializer),
1334            }
1335        }
1336    }
1337
1338    impl<'de> serde::de::Deserialize<'de> for ConnectMode {
1339        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1340        where
1341            D: serde::Deserializer<'de>,
1342        {
1343            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectMode>::new(
1344                ".google.cloud.redis.v1.Instance.ConnectMode",
1345            ))
1346        }
1347    }
1348
1349    /// Available TLS modes.
1350    ///
1351    /// # Working with unknown values
1352    ///
1353    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1354    /// additional enum variants at any time. Adding new variants is not considered
1355    /// a breaking change. Applications should write their code in anticipation of:
1356    ///
1357    /// - New values appearing in future releases of the client library, **and**
1358    /// - New values received dynamically, without application changes.
1359    ///
1360    /// Please consult the [Working with enums] section in the user guide for some
1361    /// guidelines.
1362    ///
1363    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1364    #[derive(Clone, Debug, PartialEq)]
1365    #[non_exhaustive]
1366    pub enum TransitEncryptionMode {
1367        /// Not set.
1368        Unspecified,
1369        /// Client to Server traffic encryption enabled with server authentication.
1370        ServerAuthentication,
1371        /// TLS is disabled for the instance.
1372        Disabled,
1373        /// If set, the enum was initialized with an unknown value.
1374        ///
1375        /// Applications can examine the value using [TransitEncryptionMode::value] or
1376        /// [TransitEncryptionMode::name].
1377        UnknownValue(transit_encryption_mode::UnknownValue),
1378    }
1379
1380    #[doc(hidden)]
1381    pub mod transit_encryption_mode {
1382        #[allow(unused_imports)]
1383        use super::*;
1384        #[derive(Clone, Debug, PartialEq)]
1385        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1386    }
1387
1388    impl TransitEncryptionMode {
1389        /// Gets the enum value.
1390        ///
1391        /// Returns `None` if the enum contains an unknown value deserialized from
1392        /// the string representation of enums.
1393        pub fn value(&self) -> std::option::Option<i32> {
1394            match self {
1395                Self::Unspecified => std::option::Option::Some(0),
1396                Self::ServerAuthentication => std::option::Option::Some(1),
1397                Self::Disabled => std::option::Option::Some(2),
1398                Self::UnknownValue(u) => u.0.value(),
1399            }
1400        }
1401
1402        /// Gets the enum value as a string.
1403        ///
1404        /// Returns `None` if the enum contains an unknown value deserialized from
1405        /// the integer representation of enums.
1406        pub fn name(&self) -> std::option::Option<&str> {
1407            match self {
1408                Self::Unspecified => {
1409                    std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_UNSPECIFIED")
1410                }
1411                Self::ServerAuthentication => std::option::Option::Some("SERVER_AUTHENTICATION"),
1412                Self::Disabled => std::option::Option::Some("DISABLED"),
1413                Self::UnknownValue(u) => u.0.name(),
1414            }
1415        }
1416    }
1417
1418    impl std::default::Default for TransitEncryptionMode {
1419        fn default() -> Self {
1420            use std::convert::From;
1421            Self::from(0)
1422        }
1423    }
1424
1425    impl std::fmt::Display for TransitEncryptionMode {
1426        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1427            wkt::internal::display_enum(f, self.name(), self.value())
1428        }
1429    }
1430
1431    impl std::convert::From<i32> for TransitEncryptionMode {
1432        fn from(value: i32) -> Self {
1433            match value {
1434                0 => Self::Unspecified,
1435                1 => Self::ServerAuthentication,
1436                2 => Self::Disabled,
1437                _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
1438                    wkt::internal::UnknownEnumValue::Integer(value),
1439                )),
1440            }
1441        }
1442    }
1443
1444    impl std::convert::From<&str> for TransitEncryptionMode {
1445        fn from(value: &str) -> Self {
1446            use std::string::ToString;
1447            match value {
1448                "TRANSIT_ENCRYPTION_MODE_UNSPECIFIED" => Self::Unspecified,
1449                "SERVER_AUTHENTICATION" => Self::ServerAuthentication,
1450                "DISABLED" => Self::Disabled,
1451                _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
1452                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1453                )),
1454            }
1455        }
1456    }
1457
1458    impl serde::ser::Serialize for TransitEncryptionMode {
1459        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1460        where
1461            S: serde::Serializer,
1462        {
1463            match self {
1464                Self::Unspecified => serializer.serialize_i32(0),
1465                Self::ServerAuthentication => serializer.serialize_i32(1),
1466                Self::Disabled => serializer.serialize_i32(2),
1467                Self::UnknownValue(u) => u.0.serialize(serializer),
1468            }
1469        }
1470    }
1471
1472    impl<'de> serde::de::Deserialize<'de> for TransitEncryptionMode {
1473        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1474        where
1475            D: serde::Deserializer<'de>,
1476        {
1477            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransitEncryptionMode>::new(
1478                ".google.cloud.redis.v1.Instance.TransitEncryptionMode",
1479            ))
1480        }
1481    }
1482
1483    /// Read replicas mode.
1484    ///
1485    /// # Working with unknown values
1486    ///
1487    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1488    /// additional enum variants at any time. Adding new variants is not considered
1489    /// a breaking change. Applications should write their code in anticipation of:
1490    ///
1491    /// - New values appearing in future releases of the client library, **and**
1492    /// - New values received dynamically, without application changes.
1493    ///
1494    /// Please consult the [Working with enums] section in the user guide for some
1495    /// guidelines.
1496    ///
1497    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1498    #[derive(Clone, Debug, PartialEq)]
1499    #[non_exhaustive]
1500    pub enum ReadReplicasMode {
1501        /// If not set, Memorystore Redis backend will default to
1502        /// READ_REPLICAS_DISABLED.
1503        Unspecified,
1504        /// If disabled, read endpoint will not be provided and the instance cannot
1505        /// scale up or down the number of replicas.
1506        ReadReplicasDisabled,
1507        /// If enabled, read endpoint will be provided and the instance can scale
1508        /// up and down the number of replicas. Not valid for basic tier.
1509        ReadReplicasEnabled,
1510        /// If set, the enum was initialized with an unknown value.
1511        ///
1512        /// Applications can examine the value using [ReadReplicasMode::value] or
1513        /// [ReadReplicasMode::name].
1514        UnknownValue(read_replicas_mode::UnknownValue),
1515    }
1516
1517    #[doc(hidden)]
1518    pub mod read_replicas_mode {
1519        #[allow(unused_imports)]
1520        use super::*;
1521        #[derive(Clone, Debug, PartialEq)]
1522        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1523    }
1524
1525    impl ReadReplicasMode {
1526        /// Gets the enum value.
1527        ///
1528        /// Returns `None` if the enum contains an unknown value deserialized from
1529        /// the string representation of enums.
1530        pub fn value(&self) -> std::option::Option<i32> {
1531            match self {
1532                Self::Unspecified => std::option::Option::Some(0),
1533                Self::ReadReplicasDisabled => std::option::Option::Some(1),
1534                Self::ReadReplicasEnabled => std::option::Option::Some(2),
1535                Self::UnknownValue(u) => u.0.value(),
1536            }
1537        }
1538
1539        /// Gets the enum value as a string.
1540        ///
1541        /// Returns `None` if the enum contains an unknown value deserialized from
1542        /// the integer representation of enums.
1543        pub fn name(&self) -> std::option::Option<&str> {
1544            match self {
1545                Self::Unspecified => std::option::Option::Some("READ_REPLICAS_MODE_UNSPECIFIED"),
1546                Self::ReadReplicasDisabled => std::option::Option::Some("READ_REPLICAS_DISABLED"),
1547                Self::ReadReplicasEnabled => std::option::Option::Some("READ_REPLICAS_ENABLED"),
1548                Self::UnknownValue(u) => u.0.name(),
1549            }
1550        }
1551    }
1552
1553    impl std::default::Default for ReadReplicasMode {
1554        fn default() -> Self {
1555            use std::convert::From;
1556            Self::from(0)
1557        }
1558    }
1559
1560    impl std::fmt::Display for ReadReplicasMode {
1561        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1562            wkt::internal::display_enum(f, self.name(), self.value())
1563        }
1564    }
1565
1566    impl std::convert::From<i32> for ReadReplicasMode {
1567        fn from(value: i32) -> Self {
1568            match value {
1569                0 => Self::Unspecified,
1570                1 => Self::ReadReplicasDisabled,
1571                2 => Self::ReadReplicasEnabled,
1572                _ => Self::UnknownValue(read_replicas_mode::UnknownValue(
1573                    wkt::internal::UnknownEnumValue::Integer(value),
1574                )),
1575            }
1576        }
1577    }
1578
1579    impl std::convert::From<&str> for ReadReplicasMode {
1580        fn from(value: &str) -> Self {
1581            use std::string::ToString;
1582            match value {
1583                "READ_REPLICAS_MODE_UNSPECIFIED" => Self::Unspecified,
1584                "READ_REPLICAS_DISABLED" => Self::ReadReplicasDisabled,
1585                "READ_REPLICAS_ENABLED" => Self::ReadReplicasEnabled,
1586                _ => Self::UnknownValue(read_replicas_mode::UnknownValue(
1587                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1588                )),
1589            }
1590        }
1591    }
1592
1593    impl serde::ser::Serialize for ReadReplicasMode {
1594        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1595        where
1596            S: serde::Serializer,
1597        {
1598            match self {
1599                Self::Unspecified => serializer.serialize_i32(0),
1600                Self::ReadReplicasDisabled => serializer.serialize_i32(1),
1601                Self::ReadReplicasEnabled => serializer.serialize_i32(2),
1602                Self::UnknownValue(u) => u.0.serialize(serializer),
1603            }
1604        }
1605    }
1606
1607    impl<'de> serde::de::Deserialize<'de> for ReadReplicasMode {
1608        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1609        where
1610            D: serde::Deserializer<'de>,
1611        {
1612            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReadReplicasMode>::new(
1613                ".google.cloud.redis.v1.Instance.ReadReplicasMode",
1614            ))
1615        }
1616    }
1617
1618    /// Possible reasons for the instance to be in a "SUSPENDED" state.
1619    ///
1620    /// # Working with unknown values
1621    ///
1622    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1623    /// additional enum variants at any time. Adding new variants is not considered
1624    /// a breaking change. Applications should write their code in anticipation of:
1625    ///
1626    /// - New values appearing in future releases of the client library, **and**
1627    /// - New values received dynamically, without application changes.
1628    ///
1629    /// Please consult the [Working with enums] section in the user guide for some
1630    /// guidelines.
1631    ///
1632    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1633    #[derive(Clone, Debug, PartialEq)]
1634    #[non_exhaustive]
1635    pub enum SuspensionReason {
1636        /// Not set.
1637        Unspecified,
1638        /// Something wrong with the CMEK key provided by customer.
1639        CustomerManagedKeyIssue,
1640        /// If set, the enum was initialized with an unknown value.
1641        ///
1642        /// Applications can examine the value using [SuspensionReason::value] or
1643        /// [SuspensionReason::name].
1644        UnknownValue(suspension_reason::UnknownValue),
1645    }
1646
1647    #[doc(hidden)]
1648    pub mod suspension_reason {
1649        #[allow(unused_imports)]
1650        use super::*;
1651        #[derive(Clone, Debug, PartialEq)]
1652        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1653    }
1654
1655    impl SuspensionReason {
1656        /// Gets the enum value.
1657        ///
1658        /// Returns `None` if the enum contains an unknown value deserialized from
1659        /// the string representation of enums.
1660        pub fn value(&self) -> std::option::Option<i32> {
1661            match self {
1662                Self::Unspecified => std::option::Option::Some(0),
1663                Self::CustomerManagedKeyIssue => std::option::Option::Some(1),
1664                Self::UnknownValue(u) => u.0.value(),
1665            }
1666        }
1667
1668        /// Gets the enum value as a string.
1669        ///
1670        /// Returns `None` if the enum contains an unknown value deserialized from
1671        /// the integer representation of enums.
1672        pub fn name(&self) -> std::option::Option<&str> {
1673            match self {
1674                Self::Unspecified => std::option::Option::Some("SUSPENSION_REASON_UNSPECIFIED"),
1675                Self::CustomerManagedKeyIssue => {
1676                    std::option::Option::Some("CUSTOMER_MANAGED_KEY_ISSUE")
1677                }
1678                Self::UnknownValue(u) => u.0.name(),
1679            }
1680        }
1681    }
1682
1683    impl std::default::Default for SuspensionReason {
1684        fn default() -> Self {
1685            use std::convert::From;
1686            Self::from(0)
1687        }
1688    }
1689
1690    impl std::fmt::Display for SuspensionReason {
1691        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1692            wkt::internal::display_enum(f, self.name(), self.value())
1693        }
1694    }
1695
1696    impl std::convert::From<i32> for SuspensionReason {
1697        fn from(value: i32) -> Self {
1698            match value {
1699                0 => Self::Unspecified,
1700                1 => Self::CustomerManagedKeyIssue,
1701                _ => Self::UnknownValue(suspension_reason::UnknownValue(
1702                    wkt::internal::UnknownEnumValue::Integer(value),
1703                )),
1704            }
1705        }
1706    }
1707
1708    impl std::convert::From<&str> for SuspensionReason {
1709        fn from(value: &str) -> Self {
1710            use std::string::ToString;
1711            match value {
1712                "SUSPENSION_REASON_UNSPECIFIED" => Self::Unspecified,
1713                "CUSTOMER_MANAGED_KEY_ISSUE" => Self::CustomerManagedKeyIssue,
1714                _ => Self::UnknownValue(suspension_reason::UnknownValue(
1715                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1716                )),
1717            }
1718        }
1719    }
1720
1721    impl serde::ser::Serialize for SuspensionReason {
1722        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1723        where
1724            S: serde::Serializer,
1725        {
1726            match self {
1727                Self::Unspecified => serializer.serialize_i32(0),
1728                Self::CustomerManagedKeyIssue => serializer.serialize_i32(1),
1729                Self::UnknownValue(u) => u.0.serialize(serializer),
1730            }
1731        }
1732    }
1733
1734    impl<'de> serde::de::Deserialize<'de> for SuspensionReason {
1735        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1736        where
1737            D: serde::Deserializer<'de>,
1738        {
1739            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SuspensionReason>::new(
1740                ".google.cloud.redis.v1.Instance.SuspensionReason",
1741            ))
1742        }
1743    }
1744}
1745
1746/// Configuration of the persistence functionality.
1747#[derive(Clone, Default, PartialEq)]
1748#[non_exhaustive]
1749pub struct PersistenceConfig {
1750    /// Optional. Controls whether Persistence features are enabled.
1751    /// If not provided, the existing value will be used.
1752    pub persistence_mode: crate::model::persistence_config::PersistenceMode,
1753
1754    /// Optional. Period between RDB snapshots. Snapshots will be attempted every
1755    /// period starting from the provided snapshot start time. For example, a start
1756    /// time of 01/01/2033 06:45 and SIX_HOURS snapshot period will do nothing
1757    /// until 01/01/2033, and then trigger snapshots every day at 06:45, 12:45,
1758    /// 18:45, and 00:45 the next day, and so on. If not provided,
1759    /// TWENTY_FOUR_HOURS will be used as default.
1760    pub rdb_snapshot_period: crate::model::persistence_config::SnapshotPeriod,
1761
1762    /// Output only. The next time that a snapshot attempt is scheduled to occur.
1763    pub rdb_next_snapshot_time: std::option::Option<wkt::Timestamp>,
1764
1765    /// Optional. Date and time that the first snapshot was/will be attempted, and
1766    /// to which future snapshots will be aligned. If not provided, the current
1767    /// time will be used.
1768    pub rdb_snapshot_start_time: std::option::Option<wkt::Timestamp>,
1769
1770    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1771}
1772
1773impl PersistenceConfig {
1774    pub fn new() -> Self {
1775        std::default::Default::default()
1776    }
1777
1778    /// Sets the value of [persistence_mode][crate::model::PersistenceConfig::persistence_mode].
1779    ///
1780    /// # Example
1781    /// ```ignore,no_run
1782    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1783    /// use google_cloud_redis_v1::model::persistence_config::PersistenceMode;
1784    /// let x0 = PersistenceConfig::new().set_persistence_mode(PersistenceMode::Disabled);
1785    /// let x1 = PersistenceConfig::new().set_persistence_mode(PersistenceMode::Rdb);
1786    /// ```
1787    pub fn set_persistence_mode<
1788        T: std::convert::Into<crate::model::persistence_config::PersistenceMode>,
1789    >(
1790        mut self,
1791        v: T,
1792    ) -> Self {
1793        self.persistence_mode = v.into();
1794        self
1795    }
1796
1797    /// Sets the value of [rdb_snapshot_period][crate::model::PersistenceConfig::rdb_snapshot_period].
1798    ///
1799    /// # Example
1800    /// ```ignore,no_run
1801    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1802    /// use google_cloud_redis_v1::model::persistence_config::SnapshotPeriod;
1803    /// let x0 = PersistenceConfig::new().set_rdb_snapshot_period(SnapshotPeriod::OneHour);
1804    /// let x1 = PersistenceConfig::new().set_rdb_snapshot_period(SnapshotPeriod::SixHours);
1805    /// let x2 = PersistenceConfig::new().set_rdb_snapshot_period(SnapshotPeriod::TwelveHours);
1806    /// ```
1807    pub fn set_rdb_snapshot_period<
1808        T: std::convert::Into<crate::model::persistence_config::SnapshotPeriod>,
1809    >(
1810        mut self,
1811        v: T,
1812    ) -> Self {
1813        self.rdb_snapshot_period = v.into();
1814        self
1815    }
1816
1817    /// Sets the value of [rdb_next_snapshot_time][crate::model::PersistenceConfig::rdb_next_snapshot_time].
1818    ///
1819    /// # Example
1820    /// ```ignore,no_run
1821    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1822    /// use wkt::Timestamp;
1823    /// let x = PersistenceConfig::new().set_rdb_next_snapshot_time(Timestamp::default()/* use setters */);
1824    /// ```
1825    pub fn set_rdb_next_snapshot_time<T>(mut self, v: T) -> Self
1826    where
1827        T: std::convert::Into<wkt::Timestamp>,
1828    {
1829        self.rdb_next_snapshot_time = std::option::Option::Some(v.into());
1830        self
1831    }
1832
1833    /// Sets or clears the value of [rdb_next_snapshot_time][crate::model::PersistenceConfig::rdb_next_snapshot_time].
1834    ///
1835    /// # Example
1836    /// ```ignore,no_run
1837    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1838    /// use wkt::Timestamp;
1839    /// let x = PersistenceConfig::new().set_or_clear_rdb_next_snapshot_time(Some(Timestamp::default()/* use setters */));
1840    /// let x = PersistenceConfig::new().set_or_clear_rdb_next_snapshot_time(None::<Timestamp>);
1841    /// ```
1842    pub fn set_or_clear_rdb_next_snapshot_time<T>(mut self, v: std::option::Option<T>) -> Self
1843    where
1844        T: std::convert::Into<wkt::Timestamp>,
1845    {
1846        self.rdb_next_snapshot_time = v.map(|x| x.into());
1847        self
1848    }
1849
1850    /// Sets the value of [rdb_snapshot_start_time][crate::model::PersistenceConfig::rdb_snapshot_start_time].
1851    ///
1852    /// # Example
1853    /// ```ignore,no_run
1854    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1855    /// use wkt::Timestamp;
1856    /// let x = PersistenceConfig::new().set_rdb_snapshot_start_time(Timestamp::default()/* use setters */);
1857    /// ```
1858    pub fn set_rdb_snapshot_start_time<T>(mut self, v: T) -> Self
1859    where
1860        T: std::convert::Into<wkt::Timestamp>,
1861    {
1862        self.rdb_snapshot_start_time = std::option::Option::Some(v.into());
1863        self
1864    }
1865
1866    /// Sets or clears the value of [rdb_snapshot_start_time][crate::model::PersistenceConfig::rdb_snapshot_start_time].
1867    ///
1868    /// # Example
1869    /// ```ignore,no_run
1870    /// # use google_cloud_redis_v1::model::PersistenceConfig;
1871    /// use wkt::Timestamp;
1872    /// let x = PersistenceConfig::new().set_or_clear_rdb_snapshot_start_time(Some(Timestamp::default()/* use setters */));
1873    /// let x = PersistenceConfig::new().set_or_clear_rdb_snapshot_start_time(None::<Timestamp>);
1874    /// ```
1875    pub fn set_or_clear_rdb_snapshot_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1876    where
1877        T: std::convert::Into<wkt::Timestamp>,
1878    {
1879        self.rdb_snapshot_start_time = v.map(|x| x.into());
1880        self
1881    }
1882}
1883
1884impl wkt::message::Message for PersistenceConfig {
1885    fn typename() -> &'static str {
1886        "type.googleapis.com/google.cloud.redis.v1.PersistenceConfig"
1887    }
1888}
1889
1890/// Defines additional types related to [PersistenceConfig].
1891pub mod persistence_config {
1892    #[allow(unused_imports)]
1893    use super::*;
1894
1895    /// Available Persistence modes.
1896    ///
1897    /// # Working with unknown values
1898    ///
1899    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1900    /// additional enum variants at any time. Adding new variants is not considered
1901    /// a breaking change. Applications should write their code in anticipation of:
1902    ///
1903    /// - New values appearing in future releases of the client library, **and**
1904    /// - New values received dynamically, without application changes.
1905    ///
1906    /// Please consult the [Working with enums] section in the user guide for some
1907    /// guidelines.
1908    ///
1909    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1910    #[derive(Clone, Debug, PartialEq)]
1911    #[non_exhaustive]
1912    pub enum PersistenceMode {
1913        /// Not set.
1914        Unspecified,
1915        /// Persistence is disabled for the instance,
1916        /// and any existing snapshots are deleted.
1917        Disabled,
1918        /// RDB based Persistence is enabled.
1919        Rdb,
1920        /// If set, the enum was initialized with an unknown value.
1921        ///
1922        /// Applications can examine the value using [PersistenceMode::value] or
1923        /// [PersistenceMode::name].
1924        UnknownValue(persistence_mode::UnknownValue),
1925    }
1926
1927    #[doc(hidden)]
1928    pub mod persistence_mode {
1929        #[allow(unused_imports)]
1930        use super::*;
1931        #[derive(Clone, Debug, PartialEq)]
1932        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1933    }
1934
1935    impl PersistenceMode {
1936        /// Gets the enum value.
1937        ///
1938        /// Returns `None` if the enum contains an unknown value deserialized from
1939        /// the string representation of enums.
1940        pub fn value(&self) -> std::option::Option<i32> {
1941            match self {
1942                Self::Unspecified => std::option::Option::Some(0),
1943                Self::Disabled => std::option::Option::Some(1),
1944                Self::Rdb => std::option::Option::Some(2),
1945                Self::UnknownValue(u) => u.0.value(),
1946            }
1947        }
1948
1949        /// Gets the enum value as a string.
1950        ///
1951        /// Returns `None` if the enum contains an unknown value deserialized from
1952        /// the integer representation of enums.
1953        pub fn name(&self) -> std::option::Option<&str> {
1954            match self {
1955                Self::Unspecified => std::option::Option::Some("PERSISTENCE_MODE_UNSPECIFIED"),
1956                Self::Disabled => std::option::Option::Some("DISABLED"),
1957                Self::Rdb => std::option::Option::Some("RDB"),
1958                Self::UnknownValue(u) => u.0.name(),
1959            }
1960        }
1961    }
1962
1963    impl std::default::Default for PersistenceMode {
1964        fn default() -> Self {
1965            use std::convert::From;
1966            Self::from(0)
1967        }
1968    }
1969
1970    impl std::fmt::Display for PersistenceMode {
1971        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1972            wkt::internal::display_enum(f, self.name(), self.value())
1973        }
1974    }
1975
1976    impl std::convert::From<i32> for PersistenceMode {
1977        fn from(value: i32) -> Self {
1978            match value {
1979                0 => Self::Unspecified,
1980                1 => Self::Disabled,
1981                2 => Self::Rdb,
1982                _ => Self::UnknownValue(persistence_mode::UnknownValue(
1983                    wkt::internal::UnknownEnumValue::Integer(value),
1984                )),
1985            }
1986        }
1987    }
1988
1989    impl std::convert::From<&str> for PersistenceMode {
1990        fn from(value: &str) -> Self {
1991            use std::string::ToString;
1992            match value {
1993                "PERSISTENCE_MODE_UNSPECIFIED" => Self::Unspecified,
1994                "DISABLED" => Self::Disabled,
1995                "RDB" => Self::Rdb,
1996                _ => Self::UnknownValue(persistence_mode::UnknownValue(
1997                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1998                )),
1999            }
2000        }
2001    }
2002
2003    impl serde::ser::Serialize for PersistenceMode {
2004        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2005        where
2006            S: serde::Serializer,
2007        {
2008            match self {
2009                Self::Unspecified => serializer.serialize_i32(0),
2010                Self::Disabled => serializer.serialize_i32(1),
2011                Self::Rdb => serializer.serialize_i32(2),
2012                Self::UnknownValue(u) => u.0.serialize(serializer),
2013            }
2014        }
2015    }
2016
2017    impl<'de> serde::de::Deserialize<'de> for PersistenceMode {
2018        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2019        where
2020            D: serde::Deserializer<'de>,
2021        {
2022            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PersistenceMode>::new(
2023                ".google.cloud.redis.v1.PersistenceConfig.PersistenceMode",
2024            ))
2025        }
2026    }
2027
2028    /// Available snapshot periods for scheduling.
2029    ///
2030    /// # Working with unknown values
2031    ///
2032    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2033    /// additional enum variants at any time. Adding new variants is not considered
2034    /// a breaking change. Applications should write their code in anticipation of:
2035    ///
2036    /// - New values appearing in future releases of the client library, **and**
2037    /// - New values received dynamically, without application changes.
2038    ///
2039    /// Please consult the [Working with enums] section in the user guide for some
2040    /// guidelines.
2041    ///
2042    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2043    #[derive(Clone, Debug, PartialEq)]
2044    #[non_exhaustive]
2045    pub enum SnapshotPeriod {
2046        /// Not set.
2047        Unspecified,
2048        /// Snapshot every 1 hour.
2049        OneHour,
2050        /// Snapshot every 6 hours.
2051        SixHours,
2052        /// Snapshot every 12 hours.
2053        TwelveHours,
2054        /// Snapshot every 24 hours.
2055        TwentyFourHours,
2056        /// If set, the enum was initialized with an unknown value.
2057        ///
2058        /// Applications can examine the value using [SnapshotPeriod::value] or
2059        /// [SnapshotPeriod::name].
2060        UnknownValue(snapshot_period::UnknownValue),
2061    }
2062
2063    #[doc(hidden)]
2064    pub mod snapshot_period {
2065        #[allow(unused_imports)]
2066        use super::*;
2067        #[derive(Clone, Debug, PartialEq)]
2068        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2069    }
2070
2071    impl SnapshotPeriod {
2072        /// Gets the enum value.
2073        ///
2074        /// Returns `None` if the enum contains an unknown value deserialized from
2075        /// the string representation of enums.
2076        pub fn value(&self) -> std::option::Option<i32> {
2077            match self {
2078                Self::Unspecified => std::option::Option::Some(0),
2079                Self::OneHour => std::option::Option::Some(3),
2080                Self::SixHours => std::option::Option::Some(4),
2081                Self::TwelveHours => std::option::Option::Some(5),
2082                Self::TwentyFourHours => std::option::Option::Some(6),
2083                Self::UnknownValue(u) => u.0.value(),
2084            }
2085        }
2086
2087        /// Gets the enum value as a string.
2088        ///
2089        /// Returns `None` if the enum contains an unknown value deserialized from
2090        /// the integer representation of enums.
2091        pub fn name(&self) -> std::option::Option<&str> {
2092            match self {
2093                Self::Unspecified => std::option::Option::Some("SNAPSHOT_PERIOD_UNSPECIFIED"),
2094                Self::OneHour => std::option::Option::Some("ONE_HOUR"),
2095                Self::SixHours => std::option::Option::Some("SIX_HOURS"),
2096                Self::TwelveHours => std::option::Option::Some("TWELVE_HOURS"),
2097                Self::TwentyFourHours => std::option::Option::Some("TWENTY_FOUR_HOURS"),
2098                Self::UnknownValue(u) => u.0.name(),
2099            }
2100        }
2101    }
2102
2103    impl std::default::Default for SnapshotPeriod {
2104        fn default() -> Self {
2105            use std::convert::From;
2106            Self::from(0)
2107        }
2108    }
2109
2110    impl std::fmt::Display for SnapshotPeriod {
2111        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2112            wkt::internal::display_enum(f, self.name(), self.value())
2113        }
2114    }
2115
2116    impl std::convert::From<i32> for SnapshotPeriod {
2117        fn from(value: i32) -> Self {
2118            match value {
2119                0 => Self::Unspecified,
2120                3 => Self::OneHour,
2121                4 => Self::SixHours,
2122                5 => Self::TwelveHours,
2123                6 => Self::TwentyFourHours,
2124                _ => Self::UnknownValue(snapshot_period::UnknownValue(
2125                    wkt::internal::UnknownEnumValue::Integer(value),
2126                )),
2127            }
2128        }
2129    }
2130
2131    impl std::convert::From<&str> for SnapshotPeriod {
2132        fn from(value: &str) -> Self {
2133            use std::string::ToString;
2134            match value {
2135                "SNAPSHOT_PERIOD_UNSPECIFIED" => Self::Unspecified,
2136                "ONE_HOUR" => Self::OneHour,
2137                "SIX_HOURS" => Self::SixHours,
2138                "TWELVE_HOURS" => Self::TwelveHours,
2139                "TWENTY_FOUR_HOURS" => Self::TwentyFourHours,
2140                _ => Self::UnknownValue(snapshot_period::UnknownValue(
2141                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2142                )),
2143            }
2144        }
2145    }
2146
2147    impl serde::ser::Serialize for SnapshotPeriod {
2148        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2149        where
2150            S: serde::Serializer,
2151        {
2152            match self {
2153                Self::Unspecified => serializer.serialize_i32(0),
2154                Self::OneHour => serializer.serialize_i32(3),
2155                Self::SixHours => serializer.serialize_i32(4),
2156                Self::TwelveHours => serializer.serialize_i32(5),
2157                Self::TwentyFourHours => serializer.serialize_i32(6),
2158                Self::UnknownValue(u) => u.0.serialize(serializer),
2159            }
2160        }
2161    }
2162
2163    impl<'de> serde::de::Deserialize<'de> for SnapshotPeriod {
2164        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2165        where
2166            D: serde::Deserializer<'de>,
2167        {
2168            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotPeriod>::new(
2169                ".google.cloud.redis.v1.PersistenceConfig.SnapshotPeriod",
2170            ))
2171        }
2172    }
2173}
2174
2175/// Request for
2176/// [RescheduleMaintenance][google.cloud.redis.v1.CloudRedis.RescheduleMaintenance].
2177///
2178/// [google.cloud.redis.v1.CloudRedis.RescheduleMaintenance]: crate::client::CloudRedis::reschedule_maintenance
2179#[derive(Clone, Default, PartialEq)]
2180#[non_exhaustive]
2181pub struct RescheduleMaintenanceRequest {
2182    /// Required. Redis instance resource name using the form:
2183    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
2184    /// where `location_id` refers to a GCP region.
2185    pub name: std::string::String,
2186
2187    /// Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as
2188    /// well.
2189    pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
2190
2191    /// Optional. Timestamp when the maintenance shall be rescheduled to if
2192    /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for
2193    /// example `2012-11-15T16:19:00.094Z`.
2194    pub schedule_time: std::option::Option<wkt::Timestamp>,
2195
2196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2197}
2198
2199impl RescheduleMaintenanceRequest {
2200    pub fn new() -> Self {
2201        std::default::Default::default()
2202    }
2203
2204    /// Sets the value of [name][crate::model::RescheduleMaintenanceRequest::name].
2205    ///
2206    /// # Example
2207    /// ```ignore,no_run
2208    /// # use google_cloud_redis_v1::model::RescheduleMaintenanceRequest;
2209    /// let x = RescheduleMaintenanceRequest::new().set_name("example");
2210    /// ```
2211    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2212        self.name = v.into();
2213        self
2214    }
2215
2216    /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
2217    ///
2218    /// # Example
2219    /// ```ignore,no_run
2220    /// # use google_cloud_redis_v1::model::RescheduleMaintenanceRequest;
2221    /// use google_cloud_redis_v1::model::reschedule_maintenance_request::RescheduleType;
2222    /// let x0 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::Immediate);
2223    /// let x1 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::NextAvailableWindow);
2224    /// let x2 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::SpecificTime);
2225    /// ```
2226    pub fn set_reschedule_type<
2227        T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
2228    >(
2229        mut self,
2230        v: T,
2231    ) -> Self {
2232        self.reschedule_type = v.into();
2233        self
2234    }
2235
2236    /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
2237    ///
2238    /// # Example
2239    /// ```ignore,no_run
2240    /// # use google_cloud_redis_v1::model::RescheduleMaintenanceRequest;
2241    /// use wkt::Timestamp;
2242    /// let x = RescheduleMaintenanceRequest::new().set_schedule_time(Timestamp::default()/* use setters */);
2243    /// ```
2244    pub fn set_schedule_time<T>(mut self, v: T) -> Self
2245    where
2246        T: std::convert::Into<wkt::Timestamp>,
2247    {
2248        self.schedule_time = std::option::Option::Some(v.into());
2249        self
2250    }
2251
2252    /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
2253    ///
2254    /// # Example
2255    /// ```ignore,no_run
2256    /// # use google_cloud_redis_v1::model::RescheduleMaintenanceRequest;
2257    /// use wkt::Timestamp;
2258    /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
2259    /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(None::<Timestamp>);
2260    /// ```
2261    pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
2262    where
2263        T: std::convert::Into<wkt::Timestamp>,
2264    {
2265        self.schedule_time = v.map(|x| x.into());
2266        self
2267    }
2268}
2269
2270impl wkt::message::Message for RescheduleMaintenanceRequest {
2271    fn typename() -> &'static str {
2272        "type.googleapis.com/google.cloud.redis.v1.RescheduleMaintenanceRequest"
2273    }
2274}
2275
2276/// Defines additional types related to [RescheduleMaintenanceRequest].
2277pub mod reschedule_maintenance_request {
2278    #[allow(unused_imports)]
2279    use super::*;
2280
2281    /// Reschedule options.
2282    ///
2283    /// # Working with unknown values
2284    ///
2285    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2286    /// additional enum variants at any time. Adding new variants is not considered
2287    /// a breaking change. Applications should write their code in anticipation of:
2288    ///
2289    /// - New values appearing in future releases of the client library, **and**
2290    /// - New values received dynamically, without application changes.
2291    ///
2292    /// Please consult the [Working with enums] section in the user guide for some
2293    /// guidelines.
2294    ///
2295    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2296    #[derive(Clone, Debug, PartialEq)]
2297    #[non_exhaustive]
2298    pub enum RescheduleType {
2299        /// Not set.
2300        Unspecified,
2301        /// If the user wants to schedule the maintenance to happen now.
2302        Immediate,
2303        /// If the user wants to use the existing maintenance policy to find the
2304        /// next available window.
2305        NextAvailableWindow,
2306        /// If the user wants to reschedule the maintenance to a specific time.
2307        SpecificTime,
2308        /// If set, the enum was initialized with an unknown value.
2309        ///
2310        /// Applications can examine the value using [RescheduleType::value] or
2311        /// [RescheduleType::name].
2312        UnknownValue(reschedule_type::UnknownValue),
2313    }
2314
2315    #[doc(hidden)]
2316    pub mod reschedule_type {
2317        #[allow(unused_imports)]
2318        use super::*;
2319        #[derive(Clone, Debug, PartialEq)]
2320        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2321    }
2322
2323    impl RescheduleType {
2324        /// Gets the enum value.
2325        ///
2326        /// Returns `None` if the enum contains an unknown value deserialized from
2327        /// the string representation of enums.
2328        pub fn value(&self) -> std::option::Option<i32> {
2329            match self {
2330                Self::Unspecified => std::option::Option::Some(0),
2331                Self::Immediate => std::option::Option::Some(1),
2332                Self::NextAvailableWindow => std::option::Option::Some(2),
2333                Self::SpecificTime => std::option::Option::Some(3),
2334                Self::UnknownValue(u) => u.0.value(),
2335            }
2336        }
2337
2338        /// Gets the enum value as a string.
2339        ///
2340        /// Returns `None` if the enum contains an unknown value deserialized from
2341        /// the integer representation of enums.
2342        pub fn name(&self) -> std::option::Option<&str> {
2343            match self {
2344                Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
2345                Self::Immediate => std::option::Option::Some("IMMEDIATE"),
2346                Self::NextAvailableWindow => std::option::Option::Some("NEXT_AVAILABLE_WINDOW"),
2347                Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
2348                Self::UnknownValue(u) => u.0.name(),
2349            }
2350        }
2351    }
2352
2353    impl std::default::Default for RescheduleType {
2354        fn default() -> Self {
2355            use std::convert::From;
2356            Self::from(0)
2357        }
2358    }
2359
2360    impl std::fmt::Display for RescheduleType {
2361        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2362            wkt::internal::display_enum(f, self.name(), self.value())
2363        }
2364    }
2365
2366    impl std::convert::From<i32> for RescheduleType {
2367        fn from(value: i32) -> Self {
2368            match value {
2369                0 => Self::Unspecified,
2370                1 => Self::Immediate,
2371                2 => Self::NextAvailableWindow,
2372                3 => Self::SpecificTime,
2373                _ => Self::UnknownValue(reschedule_type::UnknownValue(
2374                    wkt::internal::UnknownEnumValue::Integer(value),
2375                )),
2376            }
2377        }
2378    }
2379
2380    impl std::convert::From<&str> for RescheduleType {
2381        fn from(value: &str) -> Self {
2382            use std::string::ToString;
2383            match value {
2384                "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
2385                "IMMEDIATE" => Self::Immediate,
2386                "NEXT_AVAILABLE_WINDOW" => Self::NextAvailableWindow,
2387                "SPECIFIC_TIME" => Self::SpecificTime,
2388                _ => Self::UnknownValue(reschedule_type::UnknownValue(
2389                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2390                )),
2391            }
2392        }
2393    }
2394
2395    impl serde::ser::Serialize for RescheduleType {
2396        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2397        where
2398            S: serde::Serializer,
2399        {
2400            match self {
2401                Self::Unspecified => serializer.serialize_i32(0),
2402                Self::Immediate => serializer.serialize_i32(1),
2403                Self::NextAvailableWindow => serializer.serialize_i32(2),
2404                Self::SpecificTime => serializer.serialize_i32(3),
2405                Self::UnknownValue(u) => u.0.serialize(serializer),
2406            }
2407        }
2408    }
2409
2410    impl<'de> serde::de::Deserialize<'de> for RescheduleType {
2411        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2412        where
2413            D: serde::Deserializer<'de>,
2414        {
2415            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
2416                ".google.cloud.redis.v1.RescheduleMaintenanceRequest.RescheduleType",
2417            ))
2418        }
2419    }
2420}
2421
2422/// Maintenance policy for an instance.
2423#[derive(Clone, Default, PartialEq)]
2424#[non_exhaustive]
2425pub struct MaintenancePolicy {
2426    /// Output only. The time when the policy was created.
2427    pub create_time: std::option::Option<wkt::Timestamp>,
2428
2429    /// Output only. The time when the policy was last updated.
2430    pub update_time: std::option::Option<wkt::Timestamp>,
2431
2432    /// Optional. Description of what this policy is for. Create/Update methods
2433    /// return INVALID_ARGUMENT if the length is greater than 512.
2434    pub description: std::string::String,
2435
2436    /// Optional. Maintenance window that is applied to resources covered by this
2437    /// policy. Minimum 1. For the current version, the maximum number of
2438    /// weekly_window is expected to be one.
2439    pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
2440
2441    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2442}
2443
2444impl MaintenancePolicy {
2445    pub fn new() -> Self {
2446        std::default::Default::default()
2447    }
2448
2449    /// Sets the value of [create_time][crate::model::MaintenancePolicy::create_time].
2450    ///
2451    /// # Example
2452    /// ```ignore,no_run
2453    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2454    /// use wkt::Timestamp;
2455    /// let x = MaintenancePolicy::new().set_create_time(Timestamp::default()/* use setters */);
2456    /// ```
2457    pub fn set_create_time<T>(mut self, v: T) -> Self
2458    where
2459        T: std::convert::Into<wkt::Timestamp>,
2460    {
2461        self.create_time = std::option::Option::Some(v.into());
2462        self
2463    }
2464
2465    /// Sets or clears the value of [create_time][crate::model::MaintenancePolicy::create_time].
2466    ///
2467    /// # Example
2468    /// ```ignore,no_run
2469    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2470    /// use wkt::Timestamp;
2471    /// let x = MaintenancePolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2472    /// let x = MaintenancePolicy::new().set_or_clear_create_time(None::<Timestamp>);
2473    /// ```
2474    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2475    where
2476        T: std::convert::Into<wkt::Timestamp>,
2477    {
2478        self.create_time = v.map(|x| x.into());
2479        self
2480    }
2481
2482    /// Sets the value of [update_time][crate::model::MaintenancePolicy::update_time].
2483    ///
2484    /// # Example
2485    /// ```ignore,no_run
2486    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2487    /// use wkt::Timestamp;
2488    /// let x = MaintenancePolicy::new().set_update_time(Timestamp::default()/* use setters */);
2489    /// ```
2490    pub fn set_update_time<T>(mut self, v: T) -> Self
2491    where
2492        T: std::convert::Into<wkt::Timestamp>,
2493    {
2494        self.update_time = std::option::Option::Some(v.into());
2495        self
2496    }
2497
2498    /// Sets or clears the value of [update_time][crate::model::MaintenancePolicy::update_time].
2499    ///
2500    /// # Example
2501    /// ```ignore,no_run
2502    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2503    /// use wkt::Timestamp;
2504    /// let x = MaintenancePolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2505    /// let x = MaintenancePolicy::new().set_or_clear_update_time(None::<Timestamp>);
2506    /// ```
2507    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2508    where
2509        T: std::convert::Into<wkt::Timestamp>,
2510    {
2511        self.update_time = v.map(|x| x.into());
2512        self
2513    }
2514
2515    /// Sets the value of [description][crate::model::MaintenancePolicy::description].
2516    ///
2517    /// # Example
2518    /// ```ignore,no_run
2519    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2520    /// let x = MaintenancePolicy::new().set_description("example");
2521    /// ```
2522    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2523        self.description = v.into();
2524        self
2525    }
2526
2527    /// Sets the value of [weekly_maintenance_window][crate::model::MaintenancePolicy::weekly_maintenance_window].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_redis_v1::model::MaintenancePolicy;
2532    /// use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2533    /// let x = MaintenancePolicy::new()
2534    ///     .set_weekly_maintenance_window([
2535    ///         WeeklyMaintenanceWindow::default()/* use setters */,
2536    ///         WeeklyMaintenanceWindow::default()/* use (different) setters */,
2537    ///     ]);
2538    /// ```
2539    pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
2540    where
2541        T: std::iter::IntoIterator<Item = V>,
2542        V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
2543    {
2544        use std::iter::Iterator;
2545        self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
2546        self
2547    }
2548}
2549
2550impl wkt::message::Message for MaintenancePolicy {
2551    fn typename() -> &'static str {
2552        "type.googleapis.com/google.cloud.redis.v1.MaintenancePolicy"
2553    }
2554}
2555
2556/// Time window in which disruptive maintenance updates occur. Non-disruptive
2557/// updates can occur inside or outside this window.
2558#[derive(Clone, Default, PartialEq)]
2559#[non_exhaustive]
2560pub struct WeeklyMaintenanceWindow {
2561    /// Required. The day of week that maintenance updates occur.
2562    pub day: google_cloud_type::model::DayOfWeek,
2563
2564    /// Required. Start time of the window in UTC time.
2565    pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
2566
2567    /// Output only. Duration of the maintenance window. The current window is
2568    /// fixed at 1 hour.
2569    pub duration: std::option::Option<wkt::Duration>,
2570
2571    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2572}
2573
2574impl WeeklyMaintenanceWindow {
2575    pub fn new() -> Self {
2576        std::default::Default::default()
2577    }
2578
2579    /// Sets the value of [day][crate::model::WeeklyMaintenanceWindow::day].
2580    ///
2581    /// # Example
2582    /// ```ignore,no_run
2583    /// # use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2584    /// use google_cloud_type::model::DayOfWeek;
2585    /// let x0 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Monday);
2586    /// let x1 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Tuesday);
2587    /// let x2 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Wednesday);
2588    /// ```
2589    pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
2590        mut self,
2591        v: T,
2592    ) -> Self {
2593        self.day = v.into();
2594        self
2595    }
2596
2597    /// Sets the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
2598    ///
2599    /// # Example
2600    /// ```ignore,no_run
2601    /// # use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2602    /// use google_cloud_type::model::TimeOfDay;
2603    /// let x = WeeklyMaintenanceWindow::new().set_start_time(TimeOfDay::default()/* use setters */);
2604    /// ```
2605    pub fn set_start_time<T>(mut self, v: T) -> Self
2606    where
2607        T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2608    {
2609        self.start_time = std::option::Option::Some(v.into());
2610        self
2611    }
2612
2613    /// Sets or clears the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
2614    ///
2615    /// # Example
2616    /// ```ignore,no_run
2617    /// # use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2618    /// use google_cloud_type::model::TimeOfDay;
2619    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
2620    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(None::<TimeOfDay>);
2621    /// ```
2622    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2623    where
2624        T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
2625    {
2626        self.start_time = v.map(|x| x.into());
2627        self
2628    }
2629
2630    /// Sets the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
2631    ///
2632    /// # Example
2633    /// ```ignore,no_run
2634    /// # use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2635    /// use wkt::Duration;
2636    /// let x = WeeklyMaintenanceWindow::new().set_duration(Duration::default()/* use setters */);
2637    /// ```
2638    pub fn set_duration<T>(mut self, v: T) -> Self
2639    where
2640        T: std::convert::Into<wkt::Duration>,
2641    {
2642        self.duration = std::option::Option::Some(v.into());
2643        self
2644    }
2645
2646    /// Sets or clears the value of [duration][crate::model::WeeklyMaintenanceWindow::duration].
2647    ///
2648    /// # Example
2649    /// ```ignore,no_run
2650    /// # use google_cloud_redis_v1::model::WeeklyMaintenanceWindow;
2651    /// use wkt::Duration;
2652    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
2653    /// let x = WeeklyMaintenanceWindow::new().set_or_clear_duration(None::<Duration>);
2654    /// ```
2655    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
2656    where
2657        T: std::convert::Into<wkt::Duration>,
2658    {
2659        self.duration = v.map(|x| x.into());
2660        self
2661    }
2662}
2663
2664impl wkt::message::Message for WeeklyMaintenanceWindow {
2665    fn typename() -> &'static str {
2666        "type.googleapis.com/google.cloud.redis.v1.WeeklyMaintenanceWindow"
2667    }
2668}
2669
2670/// Upcoming maintenance schedule. If no maintenance is scheduled, fields are not
2671/// populated.
2672#[derive(Clone, Default, PartialEq)]
2673#[non_exhaustive]
2674pub struct MaintenanceSchedule {
2675    /// Output only. The start time of any upcoming scheduled maintenance for this
2676    /// instance.
2677    pub start_time: std::option::Option<wkt::Timestamp>,
2678
2679    /// Output only. The end time of any upcoming scheduled maintenance for this
2680    /// instance.
2681    pub end_time: std::option::Option<wkt::Timestamp>,
2682
2683    /// If the scheduled maintenance can be rescheduled, default is true.
2684    #[deprecated]
2685    pub can_reschedule: bool,
2686
2687    /// Output only. The deadline that the maintenance schedule start time can not
2688    /// go beyond, including reschedule.
2689    pub schedule_deadline_time: std::option::Option<wkt::Timestamp>,
2690
2691    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2692}
2693
2694impl MaintenanceSchedule {
2695    pub fn new() -> Self {
2696        std::default::Default::default()
2697    }
2698
2699    /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
2700    ///
2701    /// # Example
2702    /// ```ignore,no_run
2703    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2704    /// use wkt::Timestamp;
2705    /// let x = MaintenanceSchedule::new().set_start_time(Timestamp::default()/* use setters */);
2706    /// ```
2707    pub fn set_start_time<T>(mut self, v: T) -> Self
2708    where
2709        T: std::convert::Into<wkt::Timestamp>,
2710    {
2711        self.start_time = std::option::Option::Some(v.into());
2712        self
2713    }
2714
2715    /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
2716    ///
2717    /// # Example
2718    /// ```ignore,no_run
2719    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2720    /// use wkt::Timestamp;
2721    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2722    /// let x = MaintenanceSchedule::new().set_or_clear_start_time(None::<Timestamp>);
2723    /// ```
2724    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2725    where
2726        T: std::convert::Into<wkt::Timestamp>,
2727    {
2728        self.start_time = v.map(|x| x.into());
2729        self
2730    }
2731
2732    /// Sets the value of [end_time][crate::model::MaintenanceSchedule::end_time].
2733    ///
2734    /// # Example
2735    /// ```ignore,no_run
2736    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2737    /// use wkt::Timestamp;
2738    /// let x = MaintenanceSchedule::new().set_end_time(Timestamp::default()/* use setters */);
2739    /// ```
2740    pub fn set_end_time<T>(mut self, v: T) -> Self
2741    where
2742        T: std::convert::Into<wkt::Timestamp>,
2743    {
2744        self.end_time = std::option::Option::Some(v.into());
2745        self
2746    }
2747
2748    /// Sets or clears the value of [end_time][crate::model::MaintenanceSchedule::end_time].
2749    ///
2750    /// # Example
2751    /// ```ignore,no_run
2752    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2753    /// use wkt::Timestamp;
2754    /// let x = MaintenanceSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2755    /// let x = MaintenanceSchedule::new().set_or_clear_end_time(None::<Timestamp>);
2756    /// ```
2757    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2758    where
2759        T: std::convert::Into<wkt::Timestamp>,
2760    {
2761        self.end_time = v.map(|x| x.into());
2762        self
2763    }
2764
2765    /// Sets the value of [can_reschedule][crate::model::MaintenanceSchedule::can_reschedule].
2766    ///
2767    /// # Example
2768    /// ```ignore,no_run
2769    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2770    /// let x = MaintenanceSchedule::new().set_can_reschedule(true);
2771    /// ```
2772    #[deprecated]
2773    pub fn set_can_reschedule<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2774        self.can_reschedule = v.into();
2775        self
2776    }
2777
2778    /// Sets the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
2779    ///
2780    /// # Example
2781    /// ```ignore,no_run
2782    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2783    /// use wkt::Timestamp;
2784    /// let x = MaintenanceSchedule::new().set_schedule_deadline_time(Timestamp::default()/* use setters */);
2785    /// ```
2786    pub fn set_schedule_deadline_time<T>(mut self, v: T) -> Self
2787    where
2788        T: std::convert::Into<wkt::Timestamp>,
2789    {
2790        self.schedule_deadline_time = std::option::Option::Some(v.into());
2791        self
2792    }
2793
2794    /// Sets or clears the value of [schedule_deadline_time][crate::model::MaintenanceSchedule::schedule_deadline_time].
2795    ///
2796    /// # Example
2797    /// ```ignore,no_run
2798    /// # use google_cloud_redis_v1::model::MaintenanceSchedule;
2799    /// use wkt::Timestamp;
2800    /// let x = MaintenanceSchedule::new().set_or_clear_schedule_deadline_time(Some(Timestamp::default()/* use setters */));
2801    /// let x = MaintenanceSchedule::new().set_or_clear_schedule_deadline_time(None::<Timestamp>);
2802    /// ```
2803    pub fn set_or_clear_schedule_deadline_time<T>(mut self, v: std::option::Option<T>) -> Self
2804    where
2805        T: std::convert::Into<wkt::Timestamp>,
2806    {
2807        self.schedule_deadline_time = v.map(|x| x.into());
2808        self
2809    }
2810}
2811
2812impl wkt::message::Message for MaintenanceSchedule {
2813    fn typename() -> &'static str {
2814        "type.googleapis.com/google.cloud.redis.v1.MaintenanceSchedule"
2815    }
2816}
2817
2818/// Request for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
2819///
2820/// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
2821#[derive(Clone, Default, PartialEq)]
2822#[non_exhaustive]
2823pub struct ListInstancesRequest {
2824    /// Required. The resource name of the instance location using the form:
2825    /// `projects/{project_id}/locations/{location_id}`
2826    /// where `location_id` refers to a GCP region.
2827    pub parent: std::string::String,
2828
2829    /// The maximum number of items to return.
2830    ///
2831    /// If not specified, a default value of 1000 will be used by the service.
2832    /// Regardless of the page_size value, the response may include a partial list
2833    /// and a caller should only rely on response's
2834    /// [`next_page_token`][google.cloud.redis.v1.ListInstancesResponse.next_page_token]
2835    /// to determine if there are more instances left to be queried.
2836    ///
2837    /// [google.cloud.redis.v1.ListInstancesResponse.next_page_token]: crate::model::ListInstancesResponse::next_page_token
2838    pub page_size: i32,
2839
2840    /// The `next_page_token` value returned from a previous
2841    /// [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances] request, if
2842    /// any.
2843    ///
2844    /// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
2845    pub page_token: std::string::String,
2846
2847    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2848}
2849
2850impl ListInstancesRequest {
2851    pub fn new() -> Self {
2852        std::default::Default::default()
2853    }
2854
2855    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
2856    ///
2857    /// # Example
2858    /// ```ignore,no_run
2859    /// # use google_cloud_redis_v1::model::ListInstancesRequest;
2860    /// let x = ListInstancesRequest::new().set_parent("example");
2861    /// ```
2862    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2863        self.parent = v.into();
2864        self
2865    }
2866
2867    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
2868    ///
2869    /// # Example
2870    /// ```ignore,no_run
2871    /// # use google_cloud_redis_v1::model::ListInstancesRequest;
2872    /// let x = ListInstancesRequest::new().set_page_size(42);
2873    /// ```
2874    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2875        self.page_size = v.into();
2876        self
2877    }
2878
2879    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
2880    ///
2881    /// # Example
2882    /// ```ignore,no_run
2883    /// # use google_cloud_redis_v1::model::ListInstancesRequest;
2884    /// let x = ListInstancesRequest::new().set_page_token("example");
2885    /// ```
2886    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2887        self.page_token = v.into();
2888        self
2889    }
2890}
2891
2892impl wkt::message::Message for ListInstancesRequest {
2893    fn typename() -> &'static str {
2894        "type.googleapis.com/google.cloud.redis.v1.ListInstancesRequest"
2895    }
2896}
2897
2898/// Response for [ListInstances][google.cloud.redis.v1.CloudRedis.ListInstances].
2899///
2900/// [google.cloud.redis.v1.CloudRedis.ListInstances]: crate::client::CloudRedis::list_instances
2901#[derive(Clone, Default, PartialEq)]
2902#[non_exhaustive]
2903pub struct ListInstancesResponse {
2904    /// A list of Redis instances in the project in the specified location,
2905    /// or across all locations.
2906    ///
2907    /// If the `location_id` in the parent field of the request is "-", all regions
2908    /// available to the project are queried, and the results aggregated.
2909    /// If in such an aggregated query a location is unavailable, a placeholder
2910    /// Redis entry is included in the response with the `name` field set to a
2911    /// value of the form
2912    /// `projects/{project_id}/locations/{location_id}/instances/`- and the
2913    /// `status` field set to ERROR and `status_message` field set to "location not
2914    /// available for ListInstances".
2915    pub instances: std::vec::Vec<crate::model::Instance>,
2916
2917    /// Token to retrieve the next page of results, or empty if there are no more
2918    /// results in the list.
2919    pub next_page_token: std::string::String,
2920
2921    /// Locations that could not be reached.
2922    pub unreachable: std::vec::Vec<std::string::String>,
2923
2924    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2925}
2926
2927impl ListInstancesResponse {
2928    pub fn new() -> Self {
2929        std::default::Default::default()
2930    }
2931
2932    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
2933    ///
2934    /// # Example
2935    /// ```ignore,no_run
2936    /// # use google_cloud_redis_v1::model::ListInstancesResponse;
2937    /// use google_cloud_redis_v1::model::Instance;
2938    /// let x = ListInstancesResponse::new()
2939    ///     .set_instances([
2940    ///         Instance::default()/* use setters */,
2941    ///         Instance::default()/* use (different) setters */,
2942    ///     ]);
2943    /// ```
2944    pub fn set_instances<T, V>(mut self, v: T) -> Self
2945    where
2946        T: std::iter::IntoIterator<Item = V>,
2947        V: std::convert::Into<crate::model::Instance>,
2948    {
2949        use std::iter::Iterator;
2950        self.instances = v.into_iter().map(|i| i.into()).collect();
2951        self
2952    }
2953
2954    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
2955    ///
2956    /// # Example
2957    /// ```ignore,no_run
2958    /// # use google_cloud_redis_v1::model::ListInstancesResponse;
2959    /// let x = ListInstancesResponse::new().set_next_page_token("example");
2960    /// ```
2961    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2962        self.next_page_token = v.into();
2963        self
2964    }
2965
2966    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
2967    ///
2968    /// # Example
2969    /// ```ignore,no_run
2970    /// # use google_cloud_redis_v1::model::ListInstancesResponse;
2971    /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
2972    /// ```
2973    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2974    where
2975        T: std::iter::IntoIterator<Item = V>,
2976        V: std::convert::Into<std::string::String>,
2977    {
2978        use std::iter::Iterator;
2979        self.unreachable = v.into_iter().map(|i| i.into()).collect();
2980        self
2981    }
2982}
2983
2984impl wkt::message::Message for ListInstancesResponse {
2985    fn typename() -> &'static str {
2986        "type.googleapis.com/google.cloud.redis.v1.ListInstancesResponse"
2987    }
2988}
2989
2990#[doc(hidden)]
2991impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
2992    type PageItem = crate::model::Instance;
2993
2994    fn items(self) -> std::vec::Vec<Self::PageItem> {
2995        self.instances
2996    }
2997
2998    fn next_page_token(&self) -> std::string::String {
2999        use std::clone::Clone;
3000        self.next_page_token.clone()
3001    }
3002}
3003
3004/// Request for [GetInstance][google.cloud.redis.v1.CloudRedis.GetInstance].
3005///
3006/// [google.cloud.redis.v1.CloudRedis.GetInstance]: crate::client::CloudRedis::get_instance
3007#[derive(Clone, Default, PartialEq)]
3008#[non_exhaustive]
3009pub struct GetInstanceRequest {
3010    /// Required. Redis instance resource name using the form:
3011    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3012    /// where `location_id` refers to a GCP region.
3013    pub name: std::string::String,
3014
3015    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3016}
3017
3018impl GetInstanceRequest {
3019    pub fn new() -> Self {
3020        std::default::Default::default()
3021    }
3022
3023    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
3024    ///
3025    /// # Example
3026    /// ```ignore,no_run
3027    /// # use google_cloud_redis_v1::model::GetInstanceRequest;
3028    /// let x = GetInstanceRequest::new().set_name("example");
3029    /// ```
3030    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3031        self.name = v.into();
3032        self
3033    }
3034}
3035
3036impl wkt::message::Message for GetInstanceRequest {
3037    fn typename() -> &'static str {
3038        "type.googleapis.com/google.cloud.redis.v1.GetInstanceRequest"
3039    }
3040}
3041
3042/// Request for
3043/// [GetInstanceAuthString][google.cloud.redis.v1.CloudRedis.GetInstanceAuthString].
3044///
3045/// [google.cloud.redis.v1.CloudRedis.GetInstanceAuthString]: crate::client::CloudRedis::get_instance_auth_string
3046#[derive(Clone, Default, PartialEq)]
3047#[non_exhaustive]
3048pub struct GetInstanceAuthStringRequest {
3049    /// Required. Redis instance resource name using the form:
3050    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3051    /// where `location_id` refers to a GCP region.
3052    pub name: std::string::String,
3053
3054    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3055}
3056
3057impl GetInstanceAuthStringRequest {
3058    pub fn new() -> Self {
3059        std::default::Default::default()
3060    }
3061
3062    /// Sets the value of [name][crate::model::GetInstanceAuthStringRequest::name].
3063    ///
3064    /// # Example
3065    /// ```ignore,no_run
3066    /// # use google_cloud_redis_v1::model::GetInstanceAuthStringRequest;
3067    /// let x = GetInstanceAuthStringRequest::new().set_name("example");
3068    /// ```
3069    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3070        self.name = v.into();
3071        self
3072    }
3073}
3074
3075impl wkt::message::Message for GetInstanceAuthStringRequest {
3076    fn typename() -> &'static str {
3077        "type.googleapis.com/google.cloud.redis.v1.GetInstanceAuthStringRequest"
3078    }
3079}
3080
3081/// Instance AUTH string details.
3082#[derive(Clone, Default, PartialEq)]
3083#[non_exhaustive]
3084pub struct InstanceAuthString {
3085    /// AUTH string set on the instance.
3086    pub auth_string: std::string::String,
3087
3088    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3089}
3090
3091impl InstanceAuthString {
3092    pub fn new() -> Self {
3093        std::default::Default::default()
3094    }
3095
3096    /// Sets the value of [auth_string][crate::model::InstanceAuthString::auth_string].
3097    ///
3098    /// # Example
3099    /// ```ignore,no_run
3100    /// # use google_cloud_redis_v1::model::InstanceAuthString;
3101    /// let x = InstanceAuthString::new().set_auth_string("example");
3102    /// ```
3103    pub fn set_auth_string<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3104        self.auth_string = v.into();
3105        self
3106    }
3107}
3108
3109impl wkt::message::Message for InstanceAuthString {
3110    fn typename() -> &'static str {
3111        "type.googleapis.com/google.cloud.redis.v1.InstanceAuthString"
3112    }
3113}
3114
3115/// Request for
3116/// [CreateInstance][google.cloud.redis.v1.CloudRedis.CreateInstance].
3117///
3118/// [google.cloud.redis.v1.CloudRedis.CreateInstance]: crate::client::CloudRedis::create_instance
3119#[derive(Clone, Default, PartialEq)]
3120#[non_exhaustive]
3121pub struct CreateInstanceRequest {
3122    /// Required. The resource name of the instance location using the form:
3123    /// `projects/{project_id}/locations/{location_id}`
3124    /// where `location_id` refers to a GCP region.
3125    pub parent: std::string::String,
3126
3127    /// Required. The logical name of the Redis instance in the customer project
3128    /// with the following restrictions:
3129    ///
3130    /// * Must contain only lowercase letters, numbers, and hyphens.
3131    /// * Must start with a letter.
3132    /// * Must be between 1-40 characters.
3133    /// * Must end with a number or a letter.
3134    /// * Must be unique within the customer project / location
3135    pub instance_id: std::string::String,
3136
3137    /// Required. A Redis [Instance] resource
3138    pub instance: std::option::Option<crate::model::Instance>,
3139
3140    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3141}
3142
3143impl CreateInstanceRequest {
3144    pub fn new() -> Self {
3145        std::default::Default::default()
3146    }
3147
3148    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
3149    ///
3150    /// # Example
3151    /// ```ignore,no_run
3152    /// # use google_cloud_redis_v1::model::CreateInstanceRequest;
3153    /// let x = CreateInstanceRequest::new().set_parent("example");
3154    /// ```
3155    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3156        self.parent = v.into();
3157        self
3158    }
3159
3160    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
3161    ///
3162    /// # Example
3163    /// ```ignore,no_run
3164    /// # use google_cloud_redis_v1::model::CreateInstanceRequest;
3165    /// let x = CreateInstanceRequest::new().set_instance_id("example");
3166    /// ```
3167    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3168        self.instance_id = v.into();
3169        self
3170    }
3171
3172    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
3173    ///
3174    /// # Example
3175    /// ```ignore,no_run
3176    /// # use google_cloud_redis_v1::model::CreateInstanceRequest;
3177    /// use google_cloud_redis_v1::model::Instance;
3178    /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3179    /// ```
3180    pub fn set_instance<T>(mut self, v: T) -> Self
3181    where
3182        T: std::convert::Into<crate::model::Instance>,
3183    {
3184        self.instance = std::option::Option::Some(v.into());
3185        self
3186    }
3187
3188    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
3189    ///
3190    /// # Example
3191    /// ```ignore,no_run
3192    /// # use google_cloud_redis_v1::model::CreateInstanceRequest;
3193    /// use google_cloud_redis_v1::model::Instance;
3194    /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3195    /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3196    /// ```
3197    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3198    where
3199        T: std::convert::Into<crate::model::Instance>,
3200    {
3201        self.instance = v.map(|x| x.into());
3202        self
3203    }
3204}
3205
3206impl wkt::message::Message for CreateInstanceRequest {
3207    fn typename() -> &'static str {
3208        "type.googleapis.com/google.cloud.redis.v1.CreateInstanceRequest"
3209    }
3210}
3211
3212/// Request for
3213/// [UpdateInstance][google.cloud.redis.v1.CloudRedis.UpdateInstance].
3214///
3215/// [google.cloud.redis.v1.CloudRedis.UpdateInstance]: crate::client::CloudRedis::update_instance
3216#[derive(Clone, Default, PartialEq)]
3217#[non_exhaustive]
3218pub struct UpdateInstanceRequest {
3219    /// Required. Mask of fields to update. At least one path must be supplied in
3220    /// this field. The elements of the repeated paths field may only include these
3221    /// fields from [Instance][google.cloud.redis.v1.Instance]:
3222    ///
3223    /// * `displayName`
3224    /// * `labels`
3225    /// * `memorySizeGb`
3226    /// * `redisConfig`
3227    /// * `replica_count`
3228    ///
3229    /// [google.cloud.redis.v1.Instance]: crate::model::Instance
3230    pub update_mask: std::option::Option<wkt::FieldMask>,
3231
3232    /// Required. Update description.
3233    /// Only fields specified in update_mask are updated.
3234    pub instance: std::option::Option<crate::model::Instance>,
3235
3236    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3237}
3238
3239impl UpdateInstanceRequest {
3240    pub fn new() -> Self {
3241        std::default::Default::default()
3242    }
3243
3244    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
3245    ///
3246    /// # Example
3247    /// ```ignore,no_run
3248    /// # use google_cloud_redis_v1::model::UpdateInstanceRequest;
3249    /// use wkt::FieldMask;
3250    /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3251    /// ```
3252    pub fn set_update_mask<T>(mut self, v: T) -> Self
3253    where
3254        T: std::convert::Into<wkt::FieldMask>,
3255    {
3256        self.update_mask = std::option::Option::Some(v.into());
3257        self
3258    }
3259
3260    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
3261    ///
3262    /// # Example
3263    /// ```ignore,no_run
3264    /// # use google_cloud_redis_v1::model::UpdateInstanceRequest;
3265    /// use wkt::FieldMask;
3266    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3267    /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3268    /// ```
3269    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3270    where
3271        T: std::convert::Into<wkt::FieldMask>,
3272    {
3273        self.update_mask = v.map(|x| x.into());
3274        self
3275    }
3276
3277    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
3278    ///
3279    /// # Example
3280    /// ```ignore,no_run
3281    /// # use google_cloud_redis_v1::model::UpdateInstanceRequest;
3282    /// use google_cloud_redis_v1::model::Instance;
3283    /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
3284    /// ```
3285    pub fn set_instance<T>(mut self, v: T) -> Self
3286    where
3287        T: std::convert::Into<crate::model::Instance>,
3288    {
3289        self.instance = std::option::Option::Some(v.into());
3290        self
3291    }
3292
3293    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
3294    ///
3295    /// # Example
3296    /// ```ignore,no_run
3297    /// # use google_cloud_redis_v1::model::UpdateInstanceRequest;
3298    /// use google_cloud_redis_v1::model::Instance;
3299    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
3300    /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
3301    /// ```
3302    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
3303    where
3304        T: std::convert::Into<crate::model::Instance>,
3305    {
3306        self.instance = v.map(|x| x.into());
3307        self
3308    }
3309}
3310
3311impl wkt::message::Message for UpdateInstanceRequest {
3312    fn typename() -> &'static str {
3313        "type.googleapis.com/google.cloud.redis.v1.UpdateInstanceRequest"
3314    }
3315}
3316
3317/// Request for
3318/// [UpgradeInstance][google.cloud.redis.v1.CloudRedis.UpgradeInstance].
3319///
3320/// [google.cloud.redis.v1.CloudRedis.UpgradeInstance]: crate::client::CloudRedis::upgrade_instance
3321#[derive(Clone, Default, PartialEq)]
3322#[non_exhaustive]
3323pub struct UpgradeInstanceRequest {
3324    /// Required. Redis instance resource name using the form:
3325    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3326    /// where `location_id` refers to a GCP region.
3327    pub name: std::string::String,
3328
3329    /// Required. Specifies the target version of Redis software to upgrade to.
3330    pub redis_version: std::string::String,
3331
3332    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3333}
3334
3335impl UpgradeInstanceRequest {
3336    pub fn new() -> Self {
3337        std::default::Default::default()
3338    }
3339
3340    /// Sets the value of [name][crate::model::UpgradeInstanceRequest::name].
3341    ///
3342    /// # Example
3343    /// ```ignore,no_run
3344    /// # use google_cloud_redis_v1::model::UpgradeInstanceRequest;
3345    /// let x = UpgradeInstanceRequest::new().set_name("example");
3346    /// ```
3347    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3348        self.name = v.into();
3349        self
3350    }
3351
3352    /// Sets the value of [redis_version][crate::model::UpgradeInstanceRequest::redis_version].
3353    ///
3354    /// # Example
3355    /// ```ignore,no_run
3356    /// # use google_cloud_redis_v1::model::UpgradeInstanceRequest;
3357    /// let x = UpgradeInstanceRequest::new().set_redis_version("example");
3358    /// ```
3359    pub fn set_redis_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3360        self.redis_version = v.into();
3361        self
3362    }
3363}
3364
3365impl wkt::message::Message for UpgradeInstanceRequest {
3366    fn typename() -> &'static str {
3367        "type.googleapis.com/google.cloud.redis.v1.UpgradeInstanceRequest"
3368    }
3369}
3370
3371/// Request for
3372/// [DeleteInstance][google.cloud.redis.v1.CloudRedis.DeleteInstance].
3373///
3374/// [google.cloud.redis.v1.CloudRedis.DeleteInstance]: crate::client::CloudRedis::delete_instance
3375#[derive(Clone, Default, PartialEq)]
3376#[non_exhaustive]
3377pub struct DeleteInstanceRequest {
3378    /// Required. Redis instance resource name using the form:
3379    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3380    /// where `location_id` refers to a GCP region.
3381    pub name: std::string::String,
3382
3383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3384}
3385
3386impl DeleteInstanceRequest {
3387    pub fn new() -> Self {
3388        std::default::Default::default()
3389    }
3390
3391    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
3392    ///
3393    /// # Example
3394    /// ```ignore,no_run
3395    /// # use google_cloud_redis_v1::model::DeleteInstanceRequest;
3396    /// let x = DeleteInstanceRequest::new().set_name("example");
3397    /// ```
3398    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3399        self.name = v.into();
3400        self
3401    }
3402}
3403
3404impl wkt::message::Message for DeleteInstanceRequest {
3405    fn typename() -> &'static str {
3406        "type.googleapis.com/google.cloud.redis.v1.DeleteInstanceRequest"
3407    }
3408}
3409
3410/// The Cloud Storage location for the input content
3411#[derive(Clone, Default, PartialEq)]
3412#[non_exhaustive]
3413pub struct GcsSource {
3414    /// Required. Source data URI. (e.g. 'gs://my_bucket/my_object').
3415    pub uri: std::string::String,
3416
3417    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3418}
3419
3420impl GcsSource {
3421    pub fn new() -> Self {
3422        std::default::Default::default()
3423    }
3424
3425    /// Sets the value of [uri][crate::model::GcsSource::uri].
3426    ///
3427    /// # Example
3428    /// ```ignore,no_run
3429    /// # use google_cloud_redis_v1::model::GcsSource;
3430    /// let x = GcsSource::new().set_uri("example");
3431    /// ```
3432    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3433        self.uri = v.into();
3434        self
3435    }
3436}
3437
3438impl wkt::message::Message for GcsSource {
3439    fn typename() -> &'static str {
3440        "type.googleapis.com/google.cloud.redis.v1.GcsSource"
3441    }
3442}
3443
3444/// The input content
3445#[derive(Clone, Default, PartialEq)]
3446#[non_exhaustive]
3447pub struct InputConfig {
3448    /// Required. Specify source location of input data
3449    pub source: std::option::Option<crate::model::input_config::Source>,
3450
3451    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3452}
3453
3454impl InputConfig {
3455    pub fn new() -> Self {
3456        std::default::Default::default()
3457    }
3458
3459    /// Sets the value of [source][crate::model::InputConfig::source].
3460    ///
3461    /// Note that all the setters affecting `source` are mutually
3462    /// exclusive.
3463    ///
3464    /// # Example
3465    /// ```ignore,no_run
3466    /// # use google_cloud_redis_v1::model::InputConfig;
3467    /// use google_cloud_redis_v1::model::GcsSource;
3468    /// let x = InputConfig::new().set_source(Some(
3469    ///     google_cloud_redis_v1::model::input_config::Source::GcsSource(GcsSource::default().into())));
3470    /// ```
3471    pub fn set_source<
3472        T: std::convert::Into<std::option::Option<crate::model::input_config::Source>>,
3473    >(
3474        mut self,
3475        v: T,
3476    ) -> Self {
3477        self.source = v.into();
3478        self
3479    }
3480
3481    /// The value of [source][crate::model::InputConfig::source]
3482    /// if it holds a `GcsSource`, `None` if the field is not set or
3483    /// holds a different branch.
3484    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
3485        #[allow(unreachable_patterns)]
3486        self.source.as_ref().and_then(|v| match v {
3487            crate::model::input_config::Source::GcsSource(v) => std::option::Option::Some(v),
3488            _ => std::option::Option::None,
3489        })
3490    }
3491
3492    /// Sets the value of [source][crate::model::InputConfig::source]
3493    /// to hold a `GcsSource`.
3494    ///
3495    /// Note that all the setters affecting `source` are
3496    /// mutually exclusive.
3497    ///
3498    /// # Example
3499    /// ```ignore,no_run
3500    /// # use google_cloud_redis_v1::model::InputConfig;
3501    /// use google_cloud_redis_v1::model::GcsSource;
3502    /// let x = InputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
3503    /// assert!(x.gcs_source().is_some());
3504    /// ```
3505    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
3506        mut self,
3507        v: T,
3508    ) -> Self {
3509        self.source =
3510            std::option::Option::Some(crate::model::input_config::Source::GcsSource(v.into()));
3511        self
3512    }
3513}
3514
3515impl wkt::message::Message for InputConfig {
3516    fn typename() -> &'static str {
3517        "type.googleapis.com/google.cloud.redis.v1.InputConfig"
3518    }
3519}
3520
3521/// Defines additional types related to [InputConfig].
3522pub mod input_config {
3523    #[allow(unused_imports)]
3524    use super::*;
3525
3526    /// Required. Specify source location of input data
3527    #[derive(Clone, Debug, PartialEq)]
3528    #[non_exhaustive]
3529    pub enum Source {
3530        /// Google Cloud Storage location where input content is located.
3531        GcsSource(std::boxed::Box<crate::model::GcsSource>),
3532    }
3533}
3534
3535/// Request for [Import][google.cloud.redis.v1.CloudRedis.ImportInstance].
3536///
3537/// [google.cloud.redis.v1.CloudRedis.ImportInstance]: crate::client::CloudRedis::import_instance
3538#[derive(Clone, Default, PartialEq)]
3539#[non_exhaustive]
3540pub struct ImportInstanceRequest {
3541    /// Required. Redis instance resource name using the form:
3542    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3543    /// where `location_id` refers to a GCP region.
3544    pub name: std::string::String,
3545
3546    /// Required. Specify data to be imported.
3547    pub input_config: std::option::Option<crate::model::InputConfig>,
3548
3549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3550}
3551
3552impl ImportInstanceRequest {
3553    pub fn new() -> Self {
3554        std::default::Default::default()
3555    }
3556
3557    /// Sets the value of [name][crate::model::ImportInstanceRequest::name].
3558    ///
3559    /// # Example
3560    /// ```ignore,no_run
3561    /// # use google_cloud_redis_v1::model::ImportInstanceRequest;
3562    /// let x = ImportInstanceRequest::new().set_name("example");
3563    /// ```
3564    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3565        self.name = v.into();
3566        self
3567    }
3568
3569    /// Sets the value of [input_config][crate::model::ImportInstanceRequest::input_config].
3570    ///
3571    /// # Example
3572    /// ```ignore,no_run
3573    /// # use google_cloud_redis_v1::model::ImportInstanceRequest;
3574    /// use google_cloud_redis_v1::model::InputConfig;
3575    /// let x = ImportInstanceRequest::new().set_input_config(InputConfig::default()/* use setters */);
3576    /// ```
3577    pub fn set_input_config<T>(mut self, v: T) -> Self
3578    where
3579        T: std::convert::Into<crate::model::InputConfig>,
3580    {
3581        self.input_config = std::option::Option::Some(v.into());
3582        self
3583    }
3584
3585    /// Sets or clears the value of [input_config][crate::model::ImportInstanceRequest::input_config].
3586    ///
3587    /// # Example
3588    /// ```ignore,no_run
3589    /// # use google_cloud_redis_v1::model::ImportInstanceRequest;
3590    /// use google_cloud_redis_v1::model::InputConfig;
3591    /// let x = ImportInstanceRequest::new().set_or_clear_input_config(Some(InputConfig::default()/* use setters */));
3592    /// let x = ImportInstanceRequest::new().set_or_clear_input_config(None::<InputConfig>);
3593    /// ```
3594    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
3595    where
3596        T: std::convert::Into<crate::model::InputConfig>,
3597    {
3598        self.input_config = v.map(|x| x.into());
3599        self
3600    }
3601}
3602
3603impl wkt::message::Message for ImportInstanceRequest {
3604    fn typename() -> &'static str {
3605        "type.googleapis.com/google.cloud.redis.v1.ImportInstanceRequest"
3606    }
3607}
3608
3609/// The Cloud Storage location for the output content
3610#[derive(Clone, Default, PartialEq)]
3611#[non_exhaustive]
3612pub struct GcsDestination {
3613    /// Required. Data destination URI (e.g.
3614    /// 'gs://my_bucket/my_object'). Existing files will be overwritten.
3615    pub uri: std::string::String,
3616
3617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3618}
3619
3620impl GcsDestination {
3621    pub fn new() -> Self {
3622        std::default::Default::default()
3623    }
3624
3625    /// Sets the value of [uri][crate::model::GcsDestination::uri].
3626    ///
3627    /// # Example
3628    /// ```ignore,no_run
3629    /// # use google_cloud_redis_v1::model::GcsDestination;
3630    /// let x = GcsDestination::new().set_uri("example");
3631    /// ```
3632    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3633        self.uri = v.into();
3634        self
3635    }
3636}
3637
3638impl wkt::message::Message for GcsDestination {
3639    fn typename() -> &'static str {
3640        "type.googleapis.com/google.cloud.redis.v1.GcsDestination"
3641    }
3642}
3643
3644/// The output content
3645#[derive(Clone, Default, PartialEq)]
3646#[non_exhaustive]
3647pub struct OutputConfig {
3648    /// Required. Specify destination location of output data
3649    pub destination: std::option::Option<crate::model::output_config::Destination>,
3650
3651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3652}
3653
3654impl OutputConfig {
3655    pub fn new() -> Self {
3656        std::default::Default::default()
3657    }
3658
3659    /// Sets the value of [destination][crate::model::OutputConfig::destination].
3660    ///
3661    /// Note that all the setters affecting `destination` are mutually
3662    /// exclusive.
3663    ///
3664    /// # Example
3665    /// ```ignore,no_run
3666    /// # use google_cloud_redis_v1::model::OutputConfig;
3667    /// use google_cloud_redis_v1::model::GcsDestination;
3668    /// let x = OutputConfig::new().set_destination(Some(
3669    ///     google_cloud_redis_v1::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
3670    /// ```
3671    pub fn set_destination<
3672        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
3673    >(
3674        mut self,
3675        v: T,
3676    ) -> Self {
3677        self.destination = v.into();
3678        self
3679    }
3680
3681    /// The value of [destination][crate::model::OutputConfig::destination]
3682    /// if it holds a `GcsDestination`, `None` if the field is not set or
3683    /// holds a different branch.
3684    pub fn gcs_destination(
3685        &self,
3686    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
3687        #[allow(unreachable_patterns)]
3688        self.destination.as_ref().and_then(|v| match v {
3689            crate::model::output_config::Destination::GcsDestination(v) => {
3690                std::option::Option::Some(v)
3691            }
3692            _ => std::option::Option::None,
3693        })
3694    }
3695
3696    /// Sets the value of [destination][crate::model::OutputConfig::destination]
3697    /// to hold a `GcsDestination`.
3698    ///
3699    /// Note that all the setters affecting `destination` are
3700    /// mutually exclusive.
3701    ///
3702    /// # Example
3703    /// ```ignore,no_run
3704    /// # use google_cloud_redis_v1::model::OutputConfig;
3705    /// use google_cloud_redis_v1::model::GcsDestination;
3706    /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
3707    /// assert!(x.gcs_destination().is_some());
3708    /// ```
3709    pub fn set_gcs_destination<
3710        T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
3711    >(
3712        mut self,
3713        v: T,
3714    ) -> Self {
3715        self.destination = std::option::Option::Some(
3716            crate::model::output_config::Destination::GcsDestination(v.into()),
3717        );
3718        self
3719    }
3720}
3721
3722impl wkt::message::Message for OutputConfig {
3723    fn typename() -> &'static str {
3724        "type.googleapis.com/google.cloud.redis.v1.OutputConfig"
3725    }
3726}
3727
3728/// Defines additional types related to [OutputConfig].
3729pub mod output_config {
3730    #[allow(unused_imports)]
3731    use super::*;
3732
3733    /// Required. Specify destination location of output data
3734    #[derive(Clone, Debug, PartialEq)]
3735    #[non_exhaustive]
3736    pub enum Destination {
3737        /// Google Cloud Storage destination for output content.
3738        GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
3739    }
3740}
3741
3742/// Request for [Export][google.cloud.redis.v1.CloudRedis.ExportInstance].
3743///
3744/// [google.cloud.redis.v1.CloudRedis.ExportInstance]: crate::client::CloudRedis::export_instance
3745#[derive(Clone, Default, PartialEq)]
3746#[non_exhaustive]
3747pub struct ExportInstanceRequest {
3748    /// Required. Redis instance resource name using the form:
3749    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3750    /// where `location_id` refers to a GCP region.
3751    pub name: std::string::String,
3752
3753    /// Required. Specify data to be exported.
3754    pub output_config: std::option::Option<crate::model::OutputConfig>,
3755
3756    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3757}
3758
3759impl ExportInstanceRequest {
3760    pub fn new() -> Self {
3761        std::default::Default::default()
3762    }
3763
3764    /// Sets the value of [name][crate::model::ExportInstanceRequest::name].
3765    ///
3766    /// # Example
3767    /// ```ignore,no_run
3768    /// # use google_cloud_redis_v1::model::ExportInstanceRequest;
3769    /// let x = ExportInstanceRequest::new().set_name("example");
3770    /// ```
3771    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3772        self.name = v.into();
3773        self
3774    }
3775
3776    /// Sets the value of [output_config][crate::model::ExportInstanceRequest::output_config].
3777    ///
3778    /// # Example
3779    /// ```ignore,no_run
3780    /// # use google_cloud_redis_v1::model::ExportInstanceRequest;
3781    /// use google_cloud_redis_v1::model::OutputConfig;
3782    /// let x = ExportInstanceRequest::new().set_output_config(OutputConfig::default()/* use setters */);
3783    /// ```
3784    pub fn set_output_config<T>(mut self, v: T) -> Self
3785    where
3786        T: std::convert::Into<crate::model::OutputConfig>,
3787    {
3788        self.output_config = std::option::Option::Some(v.into());
3789        self
3790    }
3791
3792    /// Sets or clears the value of [output_config][crate::model::ExportInstanceRequest::output_config].
3793    ///
3794    /// # Example
3795    /// ```ignore,no_run
3796    /// # use google_cloud_redis_v1::model::ExportInstanceRequest;
3797    /// use google_cloud_redis_v1::model::OutputConfig;
3798    /// let x = ExportInstanceRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
3799    /// let x = ExportInstanceRequest::new().set_or_clear_output_config(None::<OutputConfig>);
3800    /// ```
3801    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3802    where
3803        T: std::convert::Into<crate::model::OutputConfig>,
3804    {
3805        self.output_config = v.map(|x| x.into());
3806        self
3807    }
3808}
3809
3810impl wkt::message::Message for ExportInstanceRequest {
3811    fn typename() -> &'static str {
3812        "type.googleapis.com/google.cloud.redis.v1.ExportInstanceRequest"
3813    }
3814}
3815
3816/// Request for [Failover][google.cloud.redis.v1.CloudRedis.FailoverInstance].
3817///
3818/// [google.cloud.redis.v1.CloudRedis.FailoverInstance]: crate::client::CloudRedis::failover_instance
3819#[derive(Clone, Default, PartialEq)]
3820#[non_exhaustive]
3821pub struct FailoverInstanceRequest {
3822    /// Required. Redis instance resource name using the form:
3823    /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
3824    /// where `location_id` refers to a GCP region.
3825    pub name: std::string::String,
3826
3827    /// Optional. Available data protection modes that the user can choose. If it's
3828    /// unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
3829    pub data_protection_mode: crate::model::failover_instance_request::DataProtectionMode,
3830
3831    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3832}
3833
3834impl FailoverInstanceRequest {
3835    pub fn new() -> Self {
3836        std::default::Default::default()
3837    }
3838
3839    /// Sets the value of [name][crate::model::FailoverInstanceRequest::name].
3840    ///
3841    /// # Example
3842    /// ```ignore,no_run
3843    /// # use google_cloud_redis_v1::model::FailoverInstanceRequest;
3844    /// let x = FailoverInstanceRequest::new().set_name("example");
3845    /// ```
3846    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3847        self.name = v.into();
3848        self
3849    }
3850
3851    /// Sets the value of [data_protection_mode][crate::model::FailoverInstanceRequest::data_protection_mode].
3852    ///
3853    /// # Example
3854    /// ```ignore,no_run
3855    /// # use google_cloud_redis_v1::model::FailoverInstanceRequest;
3856    /// use google_cloud_redis_v1::model::failover_instance_request::DataProtectionMode;
3857    /// let x0 = FailoverInstanceRequest::new().set_data_protection_mode(DataProtectionMode::LimitedDataLoss);
3858    /// let x1 = FailoverInstanceRequest::new().set_data_protection_mode(DataProtectionMode::ForceDataLoss);
3859    /// ```
3860    pub fn set_data_protection_mode<
3861        T: std::convert::Into<crate::model::failover_instance_request::DataProtectionMode>,
3862    >(
3863        mut self,
3864        v: T,
3865    ) -> Self {
3866        self.data_protection_mode = v.into();
3867        self
3868    }
3869}
3870
3871impl wkt::message::Message for FailoverInstanceRequest {
3872    fn typename() -> &'static str {
3873        "type.googleapis.com/google.cloud.redis.v1.FailoverInstanceRequest"
3874    }
3875}
3876
3877/// Defines additional types related to [FailoverInstanceRequest].
3878pub mod failover_instance_request {
3879    #[allow(unused_imports)]
3880    use super::*;
3881
3882    /// Specifies different modes of operation in relation to the data retention.
3883    ///
3884    /// # Working with unknown values
3885    ///
3886    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3887    /// additional enum variants at any time. Adding new variants is not considered
3888    /// a breaking change. Applications should write their code in anticipation of:
3889    ///
3890    /// - New values appearing in future releases of the client library, **and**
3891    /// - New values received dynamically, without application changes.
3892    ///
3893    /// Please consult the [Working with enums] section in the user guide for some
3894    /// guidelines.
3895    ///
3896    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3897    #[derive(Clone, Debug, PartialEq)]
3898    #[non_exhaustive]
3899    pub enum DataProtectionMode {
3900        /// Defaults to LIMITED_DATA_LOSS if a data protection mode is not
3901        /// specified.
3902        Unspecified,
3903        /// Instance failover will be protected with data loss control. More
3904        /// specifically, the failover will only be performed if the current
3905        /// replication offset diff between primary and replica is under a certain
3906        /// threshold.
3907        LimitedDataLoss,
3908        /// Instance failover will be performed without data loss control.
3909        ForceDataLoss,
3910        /// If set, the enum was initialized with an unknown value.
3911        ///
3912        /// Applications can examine the value using [DataProtectionMode::value] or
3913        /// [DataProtectionMode::name].
3914        UnknownValue(data_protection_mode::UnknownValue),
3915    }
3916
3917    #[doc(hidden)]
3918    pub mod data_protection_mode {
3919        #[allow(unused_imports)]
3920        use super::*;
3921        #[derive(Clone, Debug, PartialEq)]
3922        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3923    }
3924
3925    impl DataProtectionMode {
3926        /// Gets the enum value.
3927        ///
3928        /// Returns `None` if the enum contains an unknown value deserialized from
3929        /// the string representation of enums.
3930        pub fn value(&self) -> std::option::Option<i32> {
3931            match self {
3932                Self::Unspecified => std::option::Option::Some(0),
3933                Self::LimitedDataLoss => std::option::Option::Some(1),
3934                Self::ForceDataLoss => std::option::Option::Some(2),
3935                Self::UnknownValue(u) => u.0.value(),
3936            }
3937        }
3938
3939        /// Gets the enum value as a string.
3940        ///
3941        /// Returns `None` if the enum contains an unknown value deserialized from
3942        /// the integer representation of enums.
3943        pub fn name(&self) -> std::option::Option<&str> {
3944            match self {
3945                Self::Unspecified => std::option::Option::Some("DATA_PROTECTION_MODE_UNSPECIFIED"),
3946                Self::LimitedDataLoss => std::option::Option::Some("LIMITED_DATA_LOSS"),
3947                Self::ForceDataLoss => std::option::Option::Some("FORCE_DATA_LOSS"),
3948                Self::UnknownValue(u) => u.0.name(),
3949            }
3950        }
3951    }
3952
3953    impl std::default::Default for DataProtectionMode {
3954        fn default() -> Self {
3955            use std::convert::From;
3956            Self::from(0)
3957        }
3958    }
3959
3960    impl std::fmt::Display for DataProtectionMode {
3961        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3962            wkt::internal::display_enum(f, self.name(), self.value())
3963        }
3964    }
3965
3966    impl std::convert::From<i32> for DataProtectionMode {
3967        fn from(value: i32) -> Self {
3968            match value {
3969                0 => Self::Unspecified,
3970                1 => Self::LimitedDataLoss,
3971                2 => Self::ForceDataLoss,
3972                _ => Self::UnknownValue(data_protection_mode::UnknownValue(
3973                    wkt::internal::UnknownEnumValue::Integer(value),
3974                )),
3975            }
3976        }
3977    }
3978
3979    impl std::convert::From<&str> for DataProtectionMode {
3980        fn from(value: &str) -> Self {
3981            use std::string::ToString;
3982            match value {
3983                "DATA_PROTECTION_MODE_UNSPECIFIED" => Self::Unspecified,
3984                "LIMITED_DATA_LOSS" => Self::LimitedDataLoss,
3985                "FORCE_DATA_LOSS" => Self::ForceDataLoss,
3986                _ => Self::UnknownValue(data_protection_mode::UnknownValue(
3987                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3988                )),
3989            }
3990        }
3991    }
3992
3993    impl serde::ser::Serialize for DataProtectionMode {
3994        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3995        where
3996            S: serde::Serializer,
3997        {
3998            match self {
3999                Self::Unspecified => serializer.serialize_i32(0),
4000                Self::LimitedDataLoss => serializer.serialize_i32(1),
4001                Self::ForceDataLoss => serializer.serialize_i32(2),
4002                Self::UnknownValue(u) => u.0.serialize(serializer),
4003            }
4004        }
4005    }
4006
4007    impl<'de> serde::de::Deserialize<'de> for DataProtectionMode {
4008        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4009        where
4010            D: serde::Deserializer<'de>,
4011        {
4012            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataProtectionMode>::new(
4013                ".google.cloud.redis.v1.FailoverInstanceRequest.DataProtectionMode",
4014            ))
4015        }
4016    }
4017}
4018
4019/// Represents the v1 metadata of the long-running operation.
4020#[derive(Clone, Default, PartialEq)]
4021#[non_exhaustive]
4022pub struct OperationMetadata {
4023    /// Creation timestamp.
4024    pub create_time: std::option::Option<wkt::Timestamp>,
4025
4026    /// End timestamp.
4027    pub end_time: std::option::Option<wkt::Timestamp>,
4028
4029    /// Operation target.
4030    pub target: std::string::String,
4031
4032    /// Operation verb.
4033    pub verb: std::string::String,
4034
4035    /// Operation status details.
4036    pub status_detail: std::string::String,
4037
4038    /// Specifies if cancellation was requested for the operation.
4039    pub cancel_requested: bool,
4040
4041    /// API version.
4042    pub api_version: std::string::String,
4043
4044    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4045}
4046
4047impl OperationMetadata {
4048    pub fn new() -> Self {
4049        std::default::Default::default()
4050    }
4051
4052    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
4053    ///
4054    /// # Example
4055    /// ```ignore,no_run
4056    /// # use google_cloud_redis_v1::model::OperationMetadata;
4057    /// use wkt::Timestamp;
4058    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
4059    /// ```
4060    pub fn set_create_time<T>(mut self, v: T) -> Self
4061    where
4062        T: std::convert::Into<wkt::Timestamp>,
4063    {
4064        self.create_time = std::option::Option::Some(v.into());
4065        self
4066    }
4067
4068    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
4069    ///
4070    /// # Example
4071    /// ```ignore,no_run
4072    /// # use google_cloud_redis_v1::model::OperationMetadata;
4073    /// use wkt::Timestamp;
4074    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4075    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
4076    /// ```
4077    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4078    where
4079        T: std::convert::Into<wkt::Timestamp>,
4080    {
4081        self.create_time = v.map(|x| x.into());
4082        self
4083    }
4084
4085    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
4086    ///
4087    /// # Example
4088    /// ```ignore,no_run
4089    /// # use google_cloud_redis_v1::model::OperationMetadata;
4090    /// use wkt::Timestamp;
4091    /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
4092    /// ```
4093    pub fn set_end_time<T>(mut self, v: T) -> Self
4094    where
4095        T: std::convert::Into<wkt::Timestamp>,
4096    {
4097        self.end_time = std::option::Option::Some(v.into());
4098        self
4099    }
4100
4101    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
4102    ///
4103    /// # Example
4104    /// ```ignore,no_run
4105    /// # use google_cloud_redis_v1::model::OperationMetadata;
4106    /// use wkt::Timestamp;
4107    /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
4108    /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
4109    /// ```
4110    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
4111    where
4112        T: std::convert::Into<wkt::Timestamp>,
4113    {
4114        self.end_time = v.map(|x| x.into());
4115        self
4116    }
4117
4118    /// Sets the value of [target][crate::model::OperationMetadata::target].
4119    ///
4120    /// # Example
4121    /// ```ignore,no_run
4122    /// # use google_cloud_redis_v1::model::OperationMetadata;
4123    /// let x = OperationMetadata::new().set_target("example");
4124    /// ```
4125    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4126        self.target = v.into();
4127        self
4128    }
4129
4130    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
4131    ///
4132    /// # Example
4133    /// ```ignore,no_run
4134    /// # use google_cloud_redis_v1::model::OperationMetadata;
4135    /// let x = OperationMetadata::new().set_verb("example");
4136    /// ```
4137    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4138        self.verb = v.into();
4139        self
4140    }
4141
4142    /// Sets the value of [status_detail][crate::model::OperationMetadata::status_detail].
4143    ///
4144    /// # Example
4145    /// ```ignore,no_run
4146    /// # use google_cloud_redis_v1::model::OperationMetadata;
4147    /// let x = OperationMetadata::new().set_status_detail("example");
4148    /// ```
4149    pub fn set_status_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4150        self.status_detail = v.into();
4151        self
4152    }
4153
4154    /// Sets the value of [cancel_requested][crate::model::OperationMetadata::cancel_requested].
4155    ///
4156    /// # Example
4157    /// ```ignore,no_run
4158    /// # use google_cloud_redis_v1::model::OperationMetadata;
4159    /// let x = OperationMetadata::new().set_cancel_requested(true);
4160    /// ```
4161    pub fn set_cancel_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4162        self.cancel_requested = v.into();
4163        self
4164    }
4165
4166    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
4167    ///
4168    /// # Example
4169    /// ```ignore,no_run
4170    /// # use google_cloud_redis_v1::model::OperationMetadata;
4171    /// let x = OperationMetadata::new().set_api_version("example");
4172    /// ```
4173    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174        self.api_version = v.into();
4175        self
4176    }
4177}
4178
4179impl wkt::message::Message for OperationMetadata {
4180    fn typename() -> &'static str {
4181        "type.googleapis.com/google.cloud.redis.v1.OperationMetadata"
4182    }
4183}
4184
4185/// This location metadata represents additional configuration options for a
4186/// given location where a Redis instance may be created. All fields are output
4187/// only. It is returned as content of the
4188/// `google.cloud.location.Location.metadata` field.
4189#[derive(Clone, Default, PartialEq)]
4190#[non_exhaustive]
4191pub struct LocationMetadata {
4192    /// Output only. The set of available zones in the location. The map is keyed
4193    /// by the lowercase ID of each zone, as defined by GCE. These keys can be
4194    /// specified in `location_id` or `alternative_location_id` fields when
4195    /// creating a Redis instance.
4196    pub available_zones: std::collections::HashMap<std::string::String, crate::model::ZoneMetadata>,
4197
4198    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4199}
4200
4201impl LocationMetadata {
4202    pub fn new() -> Self {
4203        std::default::Default::default()
4204    }
4205
4206    /// Sets the value of [available_zones][crate::model::LocationMetadata::available_zones].
4207    ///
4208    /// # Example
4209    /// ```ignore,no_run
4210    /// # use google_cloud_redis_v1::model::LocationMetadata;
4211    /// use google_cloud_redis_v1::model::ZoneMetadata;
4212    /// let x = LocationMetadata::new().set_available_zones([
4213    ///     ("key0", ZoneMetadata::default()/* use setters */),
4214    ///     ("key1", ZoneMetadata::default()/* use (different) setters */),
4215    /// ]);
4216    /// ```
4217    pub fn set_available_zones<T, K, V>(mut self, v: T) -> Self
4218    where
4219        T: std::iter::IntoIterator<Item = (K, V)>,
4220        K: std::convert::Into<std::string::String>,
4221        V: std::convert::Into<crate::model::ZoneMetadata>,
4222    {
4223        use std::iter::Iterator;
4224        self.available_zones = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4225        self
4226    }
4227}
4228
4229impl wkt::message::Message for LocationMetadata {
4230    fn typename() -> &'static str {
4231        "type.googleapis.com/google.cloud.redis.v1.LocationMetadata"
4232    }
4233}
4234
4235/// Defines specific information for a particular zone. Currently empty and
4236/// reserved for future use only.
4237#[derive(Clone, Default, PartialEq)]
4238#[non_exhaustive]
4239pub struct ZoneMetadata {
4240    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4241}
4242
4243impl ZoneMetadata {
4244    pub fn new() -> Self {
4245        std::default::Default::default()
4246    }
4247}
4248
4249impl wkt::message::Message for ZoneMetadata {
4250    fn typename() -> &'static str {
4251        "type.googleapis.com/google.cloud.redis.v1.ZoneMetadata"
4252    }
4253}
4254
4255/// TlsCertificate Resource
4256#[derive(Clone, Default, PartialEq)]
4257#[non_exhaustive]
4258pub struct TlsCertificate {
4259    /// Serial number, as extracted from the certificate.
4260    pub serial_number: std::string::String,
4261
4262    /// PEM representation.
4263    pub cert: std::string::String,
4264
4265    /// Output only. The time when the certificate was created in [RFC
4266    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
4267    /// `2020-05-18T00:00:00.094Z`.
4268    pub create_time: std::option::Option<wkt::Timestamp>,
4269
4270    /// Output only. The time when the certificate expires in [RFC
4271    /// 3339](https://tools.ietf.org/html/rfc3339) format, for example
4272    /// `2020-05-18T00:00:00.094Z`.
4273    pub expire_time: std::option::Option<wkt::Timestamp>,
4274
4275    /// Sha1 Fingerprint of the certificate.
4276    pub sha1_fingerprint: std::string::String,
4277
4278    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4279}
4280
4281impl TlsCertificate {
4282    pub fn new() -> Self {
4283        std::default::Default::default()
4284    }
4285
4286    /// Sets the value of [serial_number][crate::model::TlsCertificate::serial_number].
4287    ///
4288    /// # Example
4289    /// ```ignore,no_run
4290    /// # use google_cloud_redis_v1::model::TlsCertificate;
4291    /// let x = TlsCertificate::new().set_serial_number("example");
4292    /// ```
4293    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4294        self.serial_number = v.into();
4295        self
4296    }
4297
4298    /// Sets the value of [cert][crate::model::TlsCertificate::cert].
4299    ///
4300    /// # Example
4301    /// ```ignore,no_run
4302    /// # use google_cloud_redis_v1::model::TlsCertificate;
4303    /// let x = TlsCertificate::new().set_cert("example");
4304    /// ```
4305    pub fn set_cert<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4306        self.cert = v.into();
4307        self
4308    }
4309
4310    /// Sets the value of [create_time][crate::model::TlsCertificate::create_time].
4311    ///
4312    /// # Example
4313    /// ```ignore,no_run
4314    /// # use google_cloud_redis_v1::model::TlsCertificate;
4315    /// use wkt::Timestamp;
4316    /// let x = TlsCertificate::new().set_create_time(Timestamp::default()/* use setters */);
4317    /// ```
4318    pub fn set_create_time<T>(mut self, v: T) -> Self
4319    where
4320        T: std::convert::Into<wkt::Timestamp>,
4321    {
4322        self.create_time = std::option::Option::Some(v.into());
4323        self
4324    }
4325
4326    /// Sets or clears the value of [create_time][crate::model::TlsCertificate::create_time].
4327    ///
4328    /// # Example
4329    /// ```ignore,no_run
4330    /// # use google_cloud_redis_v1::model::TlsCertificate;
4331    /// use wkt::Timestamp;
4332    /// let x = TlsCertificate::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4333    /// let x = TlsCertificate::new().set_or_clear_create_time(None::<Timestamp>);
4334    /// ```
4335    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4336    where
4337        T: std::convert::Into<wkt::Timestamp>,
4338    {
4339        self.create_time = v.map(|x| x.into());
4340        self
4341    }
4342
4343    /// Sets the value of [expire_time][crate::model::TlsCertificate::expire_time].
4344    ///
4345    /// # Example
4346    /// ```ignore,no_run
4347    /// # use google_cloud_redis_v1::model::TlsCertificate;
4348    /// use wkt::Timestamp;
4349    /// let x = TlsCertificate::new().set_expire_time(Timestamp::default()/* use setters */);
4350    /// ```
4351    pub fn set_expire_time<T>(mut self, v: T) -> Self
4352    where
4353        T: std::convert::Into<wkt::Timestamp>,
4354    {
4355        self.expire_time = std::option::Option::Some(v.into());
4356        self
4357    }
4358
4359    /// Sets or clears the value of [expire_time][crate::model::TlsCertificate::expire_time].
4360    ///
4361    /// # Example
4362    /// ```ignore,no_run
4363    /// # use google_cloud_redis_v1::model::TlsCertificate;
4364    /// use wkt::Timestamp;
4365    /// let x = TlsCertificate::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4366    /// let x = TlsCertificate::new().set_or_clear_expire_time(None::<Timestamp>);
4367    /// ```
4368    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4369    where
4370        T: std::convert::Into<wkt::Timestamp>,
4371    {
4372        self.expire_time = v.map(|x| x.into());
4373        self
4374    }
4375
4376    /// Sets the value of [sha1_fingerprint][crate::model::TlsCertificate::sha1_fingerprint].
4377    ///
4378    /// # Example
4379    /// ```ignore,no_run
4380    /// # use google_cloud_redis_v1::model::TlsCertificate;
4381    /// let x = TlsCertificate::new().set_sha1_fingerprint("example");
4382    /// ```
4383    pub fn set_sha1_fingerprint<T: std::convert::Into<std::string::String>>(
4384        mut self,
4385        v: T,
4386    ) -> Self {
4387        self.sha1_fingerprint = v.into();
4388        self
4389    }
4390}
4391
4392impl wkt::message::Message for TlsCertificate {
4393    fn typename() -> &'static str {
4394        "type.googleapis.com/google.cloud.redis.v1.TlsCertificate"
4395    }
4396}