google_cloud_redis_v1/
model.rs

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