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