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