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