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