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