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