Skip to main content

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