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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_location;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate google_cloud_type;
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: The discovery_endpoints parameter is deprecated.
81 /// As a result, it will not be populated if the connections are created using
82 /// endpoints parameter. Instead of this parameter, for discovery, use
83 /// endpoints.connections.pscConnection and
84 /// endpoints.connections.pscAutoConnection
85 /// with connectionType CONNECTION_TYPE_DISCOVERY.
86 #[deprecated]
87 pub discovery_endpoints: std::vec::Vec<crate::model::DiscoveryEndpoint>,
88
89 /// Optional. Machine type for individual nodes of the instance.
90 pub node_type: crate::model::instance::NodeType,
91
92 /// Optional. Persistence configuration of the instance.
93 pub persistence_config: std::option::Option<crate::model::PersistenceConfig>,
94
95 /// Optional. Engine version of the instance.
96 pub engine_version: std::string::String,
97
98 /// Optional. User-provided engine configurations for the instance.
99 pub engine_configs: std::collections::HashMap<std::string::String, std::string::String>,
100
101 /// Output only. Configuration of individual nodes of the instance.
102 pub node_config: std::option::Option<crate::model::NodeConfig>,
103
104 /// Optional. Immutable. Zone distribution configuration of the instance for
105 /// node allocation.
106 pub zone_distribution_config: std::option::Option<crate::model::ZoneDistributionConfig>,
107
108 /// Optional. If set to true deletion of the instance will fail.
109 pub deletion_protection_enabled: std::option::Option<bool>,
110
111 /// Optional. Immutable. Deprecated: Use the
112 /// endpoints.connections.psc_auto_connection value instead.
113 #[deprecated]
114 pub psc_auto_connections: std::vec::Vec<crate::model::PscAutoConnection>,
115
116 /// Output only. Service attachment details to configure PSC connections.
117 pub psc_attachment_details: std::vec::Vec<crate::model::PscAttachmentDetail>,
118
119 /// Optional. Endpoints for the instance.
120 pub endpoints: std::vec::Vec<crate::model::instance::InstanceEndpoint>,
121
122 /// Optional. Immutable. The mode config for the instance.
123 pub mode: crate::model::instance::Mode,
124
125 /// Optional. Input only. Simulate a maintenance event.
126 pub simulate_maintenance_event: std::option::Option<bool>,
127
128 /// Optional. Input only. Ondemand maintenance for the instance.
129 #[deprecated]
130 pub ondemand_maintenance: std::option::Option<bool>,
131
132 /// Optional. Output only. Reserved for future use.
133 pub satisfies_pzs: std::option::Option<bool>,
134
135 /// Optional. Output only. Reserved for future use.
136 pub satisfies_pzi: std::option::Option<bool>,
137
138 /// Optional. The maintenance policy for the instance. If not provided,
139 /// the maintenance event will be performed based on Memorystore
140 /// internal rollout schedule.
141 pub maintenance_policy: std::option::Option<crate::model::MaintenancePolicy>,
142
143 /// Output only. Published maintenance schedule.
144 pub maintenance_schedule: std::option::Option<crate::model::MaintenanceSchedule>,
145
146 /// Optional. The config for cross instance replication.
147 pub cross_instance_replication_config:
148 std::option::Option<crate::model::CrossInstanceReplicationConfig>,
149
150 /// Optional. If true, instance endpoints that are created and registered by
151 /// customers can be deleted asynchronously. That is, such an instance endpoint
152 /// can be de-registered before the forwarding rules in the instance endpoint
153 /// are deleted.
154 pub async_instance_endpoints_deletion_enabled: std::option::Option<bool>,
155
156 /// Optional. The KMS key used to encrypt the at-rest data of the cluster.
157 pub kms_key: std::option::Option<std::string::String>,
158
159 /// Output only. Encryption information of the data at rest of the cluster.
160 pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
161
162 /// Output only. The backup collection full resource name. Example:
163 /// projects/{project}/locations/{location}/backupCollections/{collection}
164 pub backup_collection: std::option::Option<std::string::String>,
165
166 /// Optional. The automated backup config for the instance.
167 pub automated_backup_config: std::option::Option<crate::model::AutomatedBackupConfig>,
168
169 /// Optional. This field can be used to trigger self service update to indicate
170 /// the desired maintenance version. The input to this field can be determined
171 /// by the available_maintenance_versions field.
172 pub maintenance_version: std::option::Option<std::string::String>,
173
174 /// Output only. This field represents the actual maintenance version of the
175 /// instance.
176 pub effective_maintenance_version: std::option::Option<std::string::String>,
177
178 /// Output only. This field is used to determine the available maintenance
179 /// versions for the self service update.
180 pub available_maintenance_versions: std::vec::Vec<std::string::String>,
181
182 /// Optional. Immutable. Deprecated, do not use.
183 #[deprecated]
184 pub allow_fewer_zones_deployment: bool,
185
186 /// Optional. Immutable. The Server CA mode for the instance.
187 pub server_ca_mode: std::option::Option<crate::model::instance::ServerCaMode>,
188
189 /// Optional. Immutable. The customer-managed CA pool for the instance. Only
190 /// applicable if the Server CA mode is CUSTOMER_MANAGED_CAS_CA. Format:
191 /// "projects/{project}/locations/{region}/caPools/{ca_pool}".
192 pub server_ca_pool: std::option::Option<std::string::String>,
193
194 /// Optional. Input only. Rotate the server certificates.
195 pub rotate_server_certificate: std::option::Option<bool>,
196
197 /// Output only. Migration config for the instance.
198 pub migration_config: std::option::Option<crate::model::MigrationConfig>,
199
200 /// The source to import from.
201 pub import_sources: std::option::Option<crate::model::instance::ImportSources>,
202
203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
204}
205
206impl Instance {
207 /// Creates a new default instance.
208 pub fn new() -> Self {
209 std::default::Default::default()
210 }
211
212 /// Sets the value of [name][crate::model::Instance::name].
213 ///
214 /// # Example
215 /// ```ignore,no_run
216 /// # use google_cloud_memorystore_v1::model::Instance;
217 /// # let project_id = "project_id";
218 /// # let location_id = "location_id";
219 /// # let instance_id = "instance_id";
220 /// let x = Instance::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
221 /// ```
222 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
223 self.name = v.into();
224 self
225 }
226
227 /// Sets the value of [create_time][crate::model::Instance::create_time].
228 ///
229 /// # Example
230 /// ```ignore,no_run
231 /// # use google_cloud_memorystore_v1::model::Instance;
232 /// use wkt::Timestamp;
233 /// let x = Instance::new().set_create_time(Timestamp::default()/* use setters */);
234 /// ```
235 pub fn set_create_time<T>(mut self, v: T) -> Self
236 where
237 T: std::convert::Into<wkt::Timestamp>,
238 {
239 self.create_time = std::option::Option::Some(v.into());
240 self
241 }
242
243 /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_memorystore_v1::model::Instance;
248 /// use wkt::Timestamp;
249 /// let x = Instance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
250 /// let x = Instance::new().set_or_clear_create_time(None::<Timestamp>);
251 /// ```
252 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
253 where
254 T: std::convert::Into<wkt::Timestamp>,
255 {
256 self.create_time = v.map(|x| x.into());
257 self
258 }
259
260 /// Sets the value of [update_time][crate::model::Instance::update_time].
261 ///
262 /// # Example
263 /// ```ignore,no_run
264 /// # use google_cloud_memorystore_v1::model::Instance;
265 /// use wkt::Timestamp;
266 /// let x = Instance::new().set_update_time(Timestamp::default()/* use setters */);
267 /// ```
268 pub fn set_update_time<T>(mut self, v: T) -> Self
269 where
270 T: std::convert::Into<wkt::Timestamp>,
271 {
272 self.update_time = std::option::Option::Some(v.into());
273 self
274 }
275
276 /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
277 ///
278 /// # Example
279 /// ```ignore,no_run
280 /// # use google_cloud_memorystore_v1::model::Instance;
281 /// use wkt::Timestamp;
282 /// let x = Instance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
283 /// let x = Instance::new().set_or_clear_update_time(None::<Timestamp>);
284 /// ```
285 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
286 where
287 T: std::convert::Into<wkt::Timestamp>,
288 {
289 self.update_time = v.map(|x| x.into());
290 self
291 }
292
293 /// Sets the value of [labels][crate::model::Instance::labels].
294 ///
295 /// # Example
296 /// ```ignore,no_run
297 /// # use google_cloud_memorystore_v1::model::Instance;
298 /// let x = Instance::new().set_labels([
299 /// ("key0", "abc"),
300 /// ("key1", "xyz"),
301 /// ]);
302 /// ```
303 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
304 where
305 T: std::iter::IntoIterator<Item = (K, V)>,
306 K: std::convert::Into<std::string::String>,
307 V: std::convert::Into<std::string::String>,
308 {
309 use std::iter::Iterator;
310 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
311 self
312 }
313
314 /// Sets the value of [state][crate::model::Instance::state].
315 ///
316 /// # Example
317 /// ```ignore,no_run
318 /// # use google_cloud_memorystore_v1::model::Instance;
319 /// use google_cloud_memorystore_v1::model::instance::State;
320 /// let x0 = Instance::new().set_state(State::Creating);
321 /// let x1 = Instance::new().set_state(State::Active);
322 /// let x2 = Instance::new().set_state(State::Updating);
323 /// ```
324 pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
325 self.state = v.into();
326 self
327 }
328
329 /// Sets the value of [state_info][crate::model::Instance::state_info].
330 ///
331 /// # Example
332 /// ```ignore,no_run
333 /// # use google_cloud_memorystore_v1::model::Instance;
334 /// use google_cloud_memorystore_v1::model::instance::StateInfo;
335 /// let x = Instance::new().set_state_info(StateInfo::default()/* use setters */);
336 /// ```
337 pub fn set_state_info<T>(mut self, v: T) -> Self
338 where
339 T: std::convert::Into<crate::model::instance::StateInfo>,
340 {
341 self.state_info = std::option::Option::Some(v.into());
342 self
343 }
344
345 /// Sets or clears the value of [state_info][crate::model::Instance::state_info].
346 ///
347 /// # Example
348 /// ```ignore,no_run
349 /// # use google_cloud_memorystore_v1::model::Instance;
350 /// use google_cloud_memorystore_v1::model::instance::StateInfo;
351 /// let x = Instance::new().set_or_clear_state_info(Some(StateInfo::default()/* use setters */));
352 /// let x = Instance::new().set_or_clear_state_info(None::<StateInfo>);
353 /// ```
354 pub fn set_or_clear_state_info<T>(mut self, v: std::option::Option<T>) -> Self
355 where
356 T: std::convert::Into<crate::model::instance::StateInfo>,
357 {
358 self.state_info = v.map(|x| x.into());
359 self
360 }
361
362 /// Sets the value of [uid][crate::model::Instance::uid].
363 ///
364 /// # Example
365 /// ```ignore,no_run
366 /// # use google_cloud_memorystore_v1::model::Instance;
367 /// let x = Instance::new().set_uid("example");
368 /// ```
369 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
370 self.uid = v.into();
371 self
372 }
373
374 /// Sets the value of [replica_count][crate::model::Instance::replica_count].
375 ///
376 /// # Example
377 /// ```ignore,no_run
378 /// # use google_cloud_memorystore_v1::model::Instance;
379 /// let x = Instance::new().set_replica_count(42);
380 /// ```
381 pub fn set_replica_count<T>(mut self, v: T) -> Self
382 where
383 T: std::convert::Into<i32>,
384 {
385 self.replica_count = std::option::Option::Some(v.into());
386 self
387 }
388
389 /// Sets or clears the value of [replica_count][crate::model::Instance::replica_count].
390 ///
391 /// # Example
392 /// ```ignore,no_run
393 /// # use google_cloud_memorystore_v1::model::Instance;
394 /// let x = Instance::new().set_or_clear_replica_count(Some(42));
395 /// let x = Instance::new().set_or_clear_replica_count(None::<i32>);
396 /// ```
397 pub fn set_or_clear_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
398 where
399 T: std::convert::Into<i32>,
400 {
401 self.replica_count = v.map(|x| x.into());
402 self
403 }
404
405 /// Sets the value of [authorization_mode][crate::model::Instance::authorization_mode].
406 ///
407 /// # Example
408 /// ```ignore,no_run
409 /// # use google_cloud_memorystore_v1::model::Instance;
410 /// use google_cloud_memorystore_v1::model::instance::AuthorizationMode;
411 /// let x0 = Instance::new().set_authorization_mode(AuthorizationMode::AuthDisabled);
412 /// let x1 = Instance::new().set_authorization_mode(AuthorizationMode::IamAuth);
413 /// let x2 = Instance::new().set_authorization_mode(AuthorizationMode::TokenAuth);
414 /// ```
415 pub fn set_authorization_mode<
416 T: std::convert::Into<crate::model::instance::AuthorizationMode>,
417 >(
418 mut self,
419 v: T,
420 ) -> Self {
421 self.authorization_mode = v.into();
422 self
423 }
424
425 /// Sets the value of [transit_encryption_mode][crate::model::Instance::transit_encryption_mode].
426 ///
427 /// # Example
428 /// ```ignore,no_run
429 /// # use google_cloud_memorystore_v1::model::Instance;
430 /// use google_cloud_memorystore_v1::model::instance::TransitEncryptionMode;
431 /// let x0 = Instance::new().set_transit_encryption_mode(TransitEncryptionMode::TransitEncryptionDisabled);
432 /// let x1 = Instance::new().set_transit_encryption_mode(TransitEncryptionMode::ServerAuthentication);
433 /// ```
434 pub fn set_transit_encryption_mode<
435 T: std::convert::Into<crate::model::instance::TransitEncryptionMode>,
436 >(
437 mut self,
438 v: T,
439 ) -> Self {
440 self.transit_encryption_mode = v.into();
441 self
442 }
443
444 /// Sets the value of [shard_count][crate::model::Instance::shard_count].
445 ///
446 /// # Example
447 /// ```ignore,no_run
448 /// # use google_cloud_memorystore_v1::model::Instance;
449 /// let x = Instance::new().set_shard_count(42);
450 /// ```
451 pub fn set_shard_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
452 self.shard_count = v.into();
453 self
454 }
455
456 /// Sets the value of [discovery_endpoints][crate::model::Instance::discovery_endpoints].
457 ///
458 /// # Example
459 /// ```ignore,no_run
460 /// # use google_cloud_memorystore_v1::model::Instance;
461 /// use google_cloud_memorystore_v1::model::DiscoveryEndpoint;
462 /// let x = Instance::new()
463 /// .set_discovery_endpoints([
464 /// DiscoveryEndpoint::default()/* use setters */,
465 /// DiscoveryEndpoint::default()/* use (different) setters */,
466 /// ]);
467 /// ```
468 #[deprecated]
469 pub fn set_discovery_endpoints<T, V>(mut self, v: T) -> Self
470 where
471 T: std::iter::IntoIterator<Item = V>,
472 V: std::convert::Into<crate::model::DiscoveryEndpoint>,
473 {
474 use std::iter::Iterator;
475 self.discovery_endpoints = v.into_iter().map(|i| i.into()).collect();
476 self
477 }
478
479 /// Sets the value of [node_type][crate::model::Instance::node_type].
480 ///
481 /// # Example
482 /// ```ignore,no_run
483 /// # use google_cloud_memorystore_v1::model::Instance;
484 /// use google_cloud_memorystore_v1::model::instance::NodeType;
485 /// let x0 = Instance::new().set_node_type(NodeType::SharedCoreNano);
486 /// let x1 = Instance::new().set_node_type(NodeType::HighmemMedium);
487 /// let x2 = Instance::new().set_node_type(NodeType::HighmemXlarge);
488 /// ```
489 pub fn set_node_type<T: std::convert::Into<crate::model::instance::NodeType>>(
490 mut self,
491 v: T,
492 ) -> Self {
493 self.node_type = v.into();
494 self
495 }
496
497 /// Sets the value of [persistence_config][crate::model::Instance::persistence_config].
498 ///
499 /// # Example
500 /// ```ignore,no_run
501 /// # use google_cloud_memorystore_v1::model::Instance;
502 /// use google_cloud_memorystore_v1::model::PersistenceConfig;
503 /// let x = Instance::new().set_persistence_config(PersistenceConfig::default()/* use setters */);
504 /// ```
505 pub fn set_persistence_config<T>(mut self, v: T) -> Self
506 where
507 T: std::convert::Into<crate::model::PersistenceConfig>,
508 {
509 self.persistence_config = std::option::Option::Some(v.into());
510 self
511 }
512
513 /// Sets or clears the value of [persistence_config][crate::model::Instance::persistence_config].
514 ///
515 /// # Example
516 /// ```ignore,no_run
517 /// # use google_cloud_memorystore_v1::model::Instance;
518 /// use google_cloud_memorystore_v1::model::PersistenceConfig;
519 /// let x = Instance::new().set_or_clear_persistence_config(Some(PersistenceConfig::default()/* use setters */));
520 /// let x = Instance::new().set_or_clear_persistence_config(None::<PersistenceConfig>);
521 /// ```
522 pub fn set_or_clear_persistence_config<T>(mut self, v: std::option::Option<T>) -> Self
523 where
524 T: std::convert::Into<crate::model::PersistenceConfig>,
525 {
526 self.persistence_config = v.map(|x| x.into());
527 self
528 }
529
530 /// Sets the value of [engine_version][crate::model::Instance::engine_version].
531 ///
532 /// # Example
533 /// ```ignore,no_run
534 /// # use google_cloud_memorystore_v1::model::Instance;
535 /// let x = Instance::new().set_engine_version("example");
536 /// ```
537 pub fn set_engine_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
538 self.engine_version = v.into();
539 self
540 }
541
542 /// Sets the value of [engine_configs][crate::model::Instance::engine_configs].
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_memorystore_v1::model::Instance;
547 /// let x = Instance::new().set_engine_configs([
548 /// ("key0", "abc"),
549 /// ("key1", "xyz"),
550 /// ]);
551 /// ```
552 pub fn set_engine_configs<T, K, V>(mut self, v: T) -> Self
553 where
554 T: std::iter::IntoIterator<Item = (K, V)>,
555 K: std::convert::Into<std::string::String>,
556 V: std::convert::Into<std::string::String>,
557 {
558 use std::iter::Iterator;
559 self.engine_configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
560 self
561 }
562
563 /// Sets the value of [node_config][crate::model::Instance::node_config].
564 ///
565 /// # Example
566 /// ```ignore,no_run
567 /// # use google_cloud_memorystore_v1::model::Instance;
568 /// use google_cloud_memorystore_v1::model::NodeConfig;
569 /// let x = Instance::new().set_node_config(NodeConfig::default()/* use setters */);
570 /// ```
571 pub fn set_node_config<T>(mut self, v: T) -> Self
572 where
573 T: std::convert::Into<crate::model::NodeConfig>,
574 {
575 self.node_config = std::option::Option::Some(v.into());
576 self
577 }
578
579 /// Sets or clears the value of [node_config][crate::model::Instance::node_config].
580 ///
581 /// # Example
582 /// ```ignore,no_run
583 /// # use google_cloud_memorystore_v1::model::Instance;
584 /// use google_cloud_memorystore_v1::model::NodeConfig;
585 /// let x = Instance::new().set_or_clear_node_config(Some(NodeConfig::default()/* use setters */));
586 /// let x = Instance::new().set_or_clear_node_config(None::<NodeConfig>);
587 /// ```
588 pub fn set_or_clear_node_config<T>(mut self, v: std::option::Option<T>) -> Self
589 where
590 T: std::convert::Into<crate::model::NodeConfig>,
591 {
592 self.node_config = v.map(|x| x.into());
593 self
594 }
595
596 /// Sets the value of [zone_distribution_config][crate::model::Instance::zone_distribution_config].
597 ///
598 /// # Example
599 /// ```ignore,no_run
600 /// # use google_cloud_memorystore_v1::model::Instance;
601 /// use google_cloud_memorystore_v1::model::ZoneDistributionConfig;
602 /// let x = Instance::new().set_zone_distribution_config(ZoneDistributionConfig::default()/* use setters */);
603 /// ```
604 pub fn set_zone_distribution_config<T>(mut self, v: T) -> Self
605 where
606 T: std::convert::Into<crate::model::ZoneDistributionConfig>,
607 {
608 self.zone_distribution_config = std::option::Option::Some(v.into());
609 self
610 }
611
612 /// Sets or clears the value of [zone_distribution_config][crate::model::Instance::zone_distribution_config].
613 ///
614 /// # Example
615 /// ```ignore,no_run
616 /// # use google_cloud_memorystore_v1::model::Instance;
617 /// use google_cloud_memorystore_v1::model::ZoneDistributionConfig;
618 /// let x = Instance::new().set_or_clear_zone_distribution_config(Some(ZoneDistributionConfig::default()/* use setters */));
619 /// let x = Instance::new().set_or_clear_zone_distribution_config(None::<ZoneDistributionConfig>);
620 /// ```
621 pub fn set_or_clear_zone_distribution_config<T>(mut self, v: std::option::Option<T>) -> Self
622 where
623 T: std::convert::Into<crate::model::ZoneDistributionConfig>,
624 {
625 self.zone_distribution_config = v.map(|x| x.into());
626 self
627 }
628
629 /// Sets the value of [deletion_protection_enabled][crate::model::Instance::deletion_protection_enabled].
630 ///
631 /// # Example
632 /// ```ignore,no_run
633 /// # use google_cloud_memorystore_v1::model::Instance;
634 /// let x = Instance::new().set_deletion_protection_enabled(true);
635 /// ```
636 pub fn set_deletion_protection_enabled<T>(mut self, v: T) -> Self
637 where
638 T: std::convert::Into<bool>,
639 {
640 self.deletion_protection_enabled = std::option::Option::Some(v.into());
641 self
642 }
643
644 /// Sets or clears the value of [deletion_protection_enabled][crate::model::Instance::deletion_protection_enabled].
645 ///
646 /// # Example
647 /// ```ignore,no_run
648 /// # use google_cloud_memorystore_v1::model::Instance;
649 /// let x = Instance::new().set_or_clear_deletion_protection_enabled(Some(false));
650 /// let x = Instance::new().set_or_clear_deletion_protection_enabled(None::<bool>);
651 /// ```
652 pub fn set_or_clear_deletion_protection_enabled<T>(mut self, v: std::option::Option<T>) -> Self
653 where
654 T: std::convert::Into<bool>,
655 {
656 self.deletion_protection_enabled = v.map(|x| x.into());
657 self
658 }
659
660 /// Sets the value of [psc_auto_connections][crate::model::Instance::psc_auto_connections].
661 ///
662 /// # Example
663 /// ```ignore,no_run
664 /// # use google_cloud_memorystore_v1::model::Instance;
665 /// use google_cloud_memorystore_v1::model::PscAutoConnection;
666 /// let x = Instance::new()
667 /// .set_psc_auto_connections([
668 /// PscAutoConnection::default()/* use setters */,
669 /// PscAutoConnection::default()/* use (different) setters */,
670 /// ]);
671 /// ```
672 #[deprecated]
673 pub fn set_psc_auto_connections<T, V>(mut self, v: T) -> Self
674 where
675 T: std::iter::IntoIterator<Item = V>,
676 V: std::convert::Into<crate::model::PscAutoConnection>,
677 {
678 use std::iter::Iterator;
679 self.psc_auto_connections = v.into_iter().map(|i| i.into()).collect();
680 self
681 }
682
683 /// Sets the value of [psc_attachment_details][crate::model::Instance::psc_attachment_details].
684 ///
685 /// # Example
686 /// ```ignore,no_run
687 /// # use google_cloud_memorystore_v1::model::Instance;
688 /// use google_cloud_memorystore_v1::model::PscAttachmentDetail;
689 /// let x = Instance::new()
690 /// .set_psc_attachment_details([
691 /// PscAttachmentDetail::default()/* use setters */,
692 /// PscAttachmentDetail::default()/* use (different) setters */,
693 /// ]);
694 /// ```
695 pub fn set_psc_attachment_details<T, V>(mut self, v: T) -> Self
696 where
697 T: std::iter::IntoIterator<Item = V>,
698 V: std::convert::Into<crate::model::PscAttachmentDetail>,
699 {
700 use std::iter::Iterator;
701 self.psc_attachment_details = v.into_iter().map(|i| i.into()).collect();
702 self
703 }
704
705 /// Sets the value of [endpoints][crate::model::Instance::endpoints].
706 ///
707 /// # Example
708 /// ```ignore,no_run
709 /// # use google_cloud_memorystore_v1::model::Instance;
710 /// use google_cloud_memorystore_v1::model::instance::InstanceEndpoint;
711 /// let x = Instance::new()
712 /// .set_endpoints([
713 /// InstanceEndpoint::default()/* use setters */,
714 /// InstanceEndpoint::default()/* use (different) setters */,
715 /// ]);
716 /// ```
717 pub fn set_endpoints<T, V>(mut self, v: T) -> Self
718 where
719 T: std::iter::IntoIterator<Item = V>,
720 V: std::convert::Into<crate::model::instance::InstanceEndpoint>,
721 {
722 use std::iter::Iterator;
723 self.endpoints = v.into_iter().map(|i| i.into()).collect();
724 self
725 }
726
727 /// Sets the value of [mode][crate::model::Instance::mode].
728 ///
729 /// # Example
730 /// ```ignore,no_run
731 /// # use google_cloud_memorystore_v1::model::Instance;
732 /// use google_cloud_memorystore_v1::model::instance::Mode;
733 /// let x0 = Instance::new().set_mode(Mode::Cluster);
734 /// let x1 = Instance::new().set_mode(Mode::ClusterDisabled);
735 /// ```
736 pub fn set_mode<T: std::convert::Into<crate::model::instance::Mode>>(mut self, v: T) -> Self {
737 self.mode = v.into();
738 self
739 }
740
741 /// Sets the value of [simulate_maintenance_event][crate::model::Instance::simulate_maintenance_event].
742 ///
743 /// # Example
744 /// ```ignore,no_run
745 /// # use google_cloud_memorystore_v1::model::Instance;
746 /// let x = Instance::new().set_simulate_maintenance_event(true);
747 /// ```
748 pub fn set_simulate_maintenance_event<T>(mut self, v: T) -> Self
749 where
750 T: std::convert::Into<bool>,
751 {
752 self.simulate_maintenance_event = std::option::Option::Some(v.into());
753 self
754 }
755
756 /// Sets or clears the value of [simulate_maintenance_event][crate::model::Instance::simulate_maintenance_event].
757 ///
758 /// # Example
759 /// ```ignore,no_run
760 /// # use google_cloud_memorystore_v1::model::Instance;
761 /// let x = Instance::new().set_or_clear_simulate_maintenance_event(Some(false));
762 /// let x = Instance::new().set_or_clear_simulate_maintenance_event(None::<bool>);
763 /// ```
764 pub fn set_or_clear_simulate_maintenance_event<T>(mut self, v: std::option::Option<T>) -> Self
765 where
766 T: std::convert::Into<bool>,
767 {
768 self.simulate_maintenance_event = v.map(|x| x.into());
769 self
770 }
771
772 /// Sets the value of [ondemand_maintenance][crate::model::Instance::ondemand_maintenance].
773 ///
774 /// # Example
775 /// ```ignore,no_run
776 /// # use google_cloud_memorystore_v1::model::Instance;
777 /// let x = Instance::new().set_ondemand_maintenance(true);
778 /// ```
779 #[deprecated]
780 pub fn set_ondemand_maintenance<T>(mut self, v: T) -> Self
781 where
782 T: std::convert::Into<bool>,
783 {
784 self.ondemand_maintenance = std::option::Option::Some(v.into());
785 self
786 }
787
788 /// Sets or clears the value of [ondemand_maintenance][crate::model::Instance::ondemand_maintenance].
789 ///
790 /// # Example
791 /// ```ignore,no_run
792 /// # use google_cloud_memorystore_v1::model::Instance;
793 /// let x = Instance::new().set_or_clear_ondemand_maintenance(Some(false));
794 /// let x = Instance::new().set_or_clear_ondemand_maintenance(None::<bool>);
795 /// ```
796 #[deprecated]
797 pub fn set_or_clear_ondemand_maintenance<T>(mut self, v: std::option::Option<T>) -> Self
798 where
799 T: std::convert::Into<bool>,
800 {
801 self.ondemand_maintenance = v.map(|x| x.into());
802 self
803 }
804
805 /// Sets the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
806 ///
807 /// # Example
808 /// ```ignore,no_run
809 /// # use google_cloud_memorystore_v1::model::Instance;
810 /// let x = Instance::new().set_satisfies_pzs(true);
811 /// ```
812 pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
813 where
814 T: std::convert::Into<bool>,
815 {
816 self.satisfies_pzs = std::option::Option::Some(v.into());
817 self
818 }
819
820 /// Sets or clears the value of [satisfies_pzs][crate::model::Instance::satisfies_pzs].
821 ///
822 /// # Example
823 /// ```ignore,no_run
824 /// # use google_cloud_memorystore_v1::model::Instance;
825 /// let x = Instance::new().set_or_clear_satisfies_pzs(Some(false));
826 /// let x = Instance::new().set_or_clear_satisfies_pzs(None::<bool>);
827 /// ```
828 pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
829 where
830 T: std::convert::Into<bool>,
831 {
832 self.satisfies_pzs = v.map(|x| x.into());
833 self
834 }
835
836 /// Sets the value of [satisfies_pzi][crate::model::Instance::satisfies_pzi].
837 ///
838 /// # Example
839 /// ```ignore,no_run
840 /// # use google_cloud_memorystore_v1::model::Instance;
841 /// let x = Instance::new().set_satisfies_pzi(true);
842 /// ```
843 pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
844 where
845 T: std::convert::Into<bool>,
846 {
847 self.satisfies_pzi = std::option::Option::Some(v.into());
848 self
849 }
850
851 /// Sets or clears the value of [satisfies_pzi][crate::model::Instance::satisfies_pzi].
852 ///
853 /// # Example
854 /// ```ignore,no_run
855 /// # use google_cloud_memorystore_v1::model::Instance;
856 /// let x = Instance::new().set_or_clear_satisfies_pzi(Some(false));
857 /// let x = Instance::new().set_or_clear_satisfies_pzi(None::<bool>);
858 /// ```
859 pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
860 where
861 T: std::convert::Into<bool>,
862 {
863 self.satisfies_pzi = v.map(|x| x.into());
864 self
865 }
866
867 /// Sets the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
868 ///
869 /// # Example
870 /// ```ignore,no_run
871 /// # use google_cloud_memorystore_v1::model::Instance;
872 /// use google_cloud_memorystore_v1::model::MaintenancePolicy;
873 /// let x = Instance::new().set_maintenance_policy(MaintenancePolicy::default()/* use setters */);
874 /// ```
875 pub fn set_maintenance_policy<T>(mut self, v: T) -> Self
876 where
877 T: std::convert::Into<crate::model::MaintenancePolicy>,
878 {
879 self.maintenance_policy = std::option::Option::Some(v.into());
880 self
881 }
882
883 /// Sets or clears the value of [maintenance_policy][crate::model::Instance::maintenance_policy].
884 ///
885 /// # Example
886 /// ```ignore,no_run
887 /// # use google_cloud_memorystore_v1::model::Instance;
888 /// use google_cloud_memorystore_v1::model::MaintenancePolicy;
889 /// let x = Instance::new().set_or_clear_maintenance_policy(Some(MaintenancePolicy::default()/* use setters */));
890 /// let x = Instance::new().set_or_clear_maintenance_policy(None::<MaintenancePolicy>);
891 /// ```
892 pub fn set_or_clear_maintenance_policy<T>(mut self, v: std::option::Option<T>) -> Self
893 where
894 T: std::convert::Into<crate::model::MaintenancePolicy>,
895 {
896 self.maintenance_policy = v.map(|x| x.into());
897 self
898 }
899
900 /// Sets the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
901 ///
902 /// # Example
903 /// ```ignore,no_run
904 /// # use google_cloud_memorystore_v1::model::Instance;
905 /// use google_cloud_memorystore_v1::model::MaintenanceSchedule;
906 /// let x = Instance::new().set_maintenance_schedule(MaintenanceSchedule::default()/* use setters */);
907 /// ```
908 pub fn set_maintenance_schedule<T>(mut self, v: T) -> Self
909 where
910 T: std::convert::Into<crate::model::MaintenanceSchedule>,
911 {
912 self.maintenance_schedule = std::option::Option::Some(v.into());
913 self
914 }
915
916 /// Sets or clears the value of [maintenance_schedule][crate::model::Instance::maintenance_schedule].
917 ///
918 /// # Example
919 /// ```ignore,no_run
920 /// # use google_cloud_memorystore_v1::model::Instance;
921 /// use google_cloud_memorystore_v1::model::MaintenanceSchedule;
922 /// let x = Instance::new().set_or_clear_maintenance_schedule(Some(MaintenanceSchedule::default()/* use setters */));
923 /// let x = Instance::new().set_or_clear_maintenance_schedule(None::<MaintenanceSchedule>);
924 /// ```
925 pub fn set_or_clear_maintenance_schedule<T>(mut self, v: std::option::Option<T>) -> Self
926 where
927 T: std::convert::Into<crate::model::MaintenanceSchedule>,
928 {
929 self.maintenance_schedule = v.map(|x| x.into());
930 self
931 }
932
933 /// Sets the value of [cross_instance_replication_config][crate::model::Instance::cross_instance_replication_config].
934 ///
935 /// # Example
936 /// ```ignore,no_run
937 /// # use google_cloud_memorystore_v1::model::Instance;
938 /// use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
939 /// let x = Instance::new().set_cross_instance_replication_config(CrossInstanceReplicationConfig::default()/* use setters */);
940 /// ```
941 pub fn set_cross_instance_replication_config<T>(mut self, v: T) -> Self
942 where
943 T: std::convert::Into<crate::model::CrossInstanceReplicationConfig>,
944 {
945 self.cross_instance_replication_config = std::option::Option::Some(v.into());
946 self
947 }
948
949 /// Sets or clears the value of [cross_instance_replication_config][crate::model::Instance::cross_instance_replication_config].
950 ///
951 /// # Example
952 /// ```ignore,no_run
953 /// # use google_cloud_memorystore_v1::model::Instance;
954 /// use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
955 /// let x = Instance::new().set_or_clear_cross_instance_replication_config(Some(CrossInstanceReplicationConfig::default()/* use setters */));
956 /// let x = Instance::new().set_or_clear_cross_instance_replication_config(None::<CrossInstanceReplicationConfig>);
957 /// ```
958 pub fn set_or_clear_cross_instance_replication_config<T>(
959 mut self,
960 v: std::option::Option<T>,
961 ) -> Self
962 where
963 T: std::convert::Into<crate::model::CrossInstanceReplicationConfig>,
964 {
965 self.cross_instance_replication_config = v.map(|x| x.into());
966 self
967 }
968
969 /// Sets the value of [async_instance_endpoints_deletion_enabled][crate::model::Instance::async_instance_endpoints_deletion_enabled].
970 ///
971 /// # Example
972 /// ```ignore,no_run
973 /// # use google_cloud_memorystore_v1::model::Instance;
974 /// let x = Instance::new().set_async_instance_endpoints_deletion_enabled(true);
975 /// ```
976 pub fn set_async_instance_endpoints_deletion_enabled<T>(mut self, v: T) -> Self
977 where
978 T: std::convert::Into<bool>,
979 {
980 self.async_instance_endpoints_deletion_enabled = std::option::Option::Some(v.into());
981 self
982 }
983
984 /// Sets or clears the value of [async_instance_endpoints_deletion_enabled][crate::model::Instance::async_instance_endpoints_deletion_enabled].
985 ///
986 /// # Example
987 /// ```ignore,no_run
988 /// # use google_cloud_memorystore_v1::model::Instance;
989 /// let x = Instance::new().set_or_clear_async_instance_endpoints_deletion_enabled(Some(false));
990 /// let x = Instance::new().set_or_clear_async_instance_endpoints_deletion_enabled(None::<bool>);
991 /// ```
992 pub fn set_or_clear_async_instance_endpoints_deletion_enabled<T>(
993 mut self,
994 v: std::option::Option<T>,
995 ) -> Self
996 where
997 T: std::convert::Into<bool>,
998 {
999 self.async_instance_endpoints_deletion_enabled = v.map(|x| x.into());
1000 self
1001 }
1002
1003 /// Sets the value of [kms_key][crate::model::Instance::kms_key].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_memorystore_v1::model::Instance;
1008 /// let x = Instance::new().set_kms_key("example");
1009 /// ```
1010 pub fn set_kms_key<T>(mut self, v: T) -> Self
1011 where
1012 T: std::convert::Into<std::string::String>,
1013 {
1014 self.kms_key = std::option::Option::Some(v.into());
1015 self
1016 }
1017
1018 /// Sets or clears the value of [kms_key][crate::model::Instance::kms_key].
1019 ///
1020 /// # Example
1021 /// ```ignore,no_run
1022 /// # use google_cloud_memorystore_v1::model::Instance;
1023 /// let x = Instance::new().set_or_clear_kms_key(Some("example"));
1024 /// let x = Instance::new().set_or_clear_kms_key(None::<String>);
1025 /// ```
1026 pub fn set_or_clear_kms_key<T>(mut self, v: std::option::Option<T>) -> Self
1027 where
1028 T: std::convert::Into<std::string::String>,
1029 {
1030 self.kms_key = v.map(|x| x.into());
1031 self
1032 }
1033
1034 /// Sets the value of [encryption_info][crate::model::Instance::encryption_info].
1035 ///
1036 /// # Example
1037 /// ```ignore,no_run
1038 /// # use google_cloud_memorystore_v1::model::Instance;
1039 /// use google_cloud_memorystore_v1::model::EncryptionInfo;
1040 /// let x = Instance::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
1041 /// ```
1042 pub fn set_encryption_info<T>(mut self, v: T) -> Self
1043 where
1044 T: std::convert::Into<crate::model::EncryptionInfo>,
1045 {
1046 self.encryption_info = std::option::Option::Some(v.into());
1047 self
1048 }
1049
1050 /// Sets or clears the value of [encryption_info][crate::model::Instance::encryption_info].
1051 ///
1052 /// # Example
1053 /// ```ignore,no_run
1054 /// # use google_cloud_memorystore_v1::model::Instance;
1055 /// use google_cloud_memorystore_v1::model::EncryptionInfo;
1056 /// let x = Instance::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
1057 /// let x = Instance::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
1058 /// ```
1059 pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
1060 where
1061 T: std::convert::Into<crate::model::EncryptionInfo>,
1062 {
1063 self.encryption_info = v.map(|x| x.into());
1064 self
1065 }
1066
1067 /// Sets the value of [backup_collection][crate::model::Instance::backup_collection].
1068 ///
1069 /// # Example
1070 /// ```ignore,no_run
1071 /// # use google_cloud_memorystore_v1::model::Instance;
1072 /// # let project_id = "project_id";
1073 /// # let location_id = "location_id";
1074 /// # let backup_collection_id = "backup_collection_id";
1075 /// let x = Instance::new().set_backup_collection(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"));
1076 /// ```
1077 pub fn set_backup_collection<T>(mut self, v: T) -> Self
1078 where
1079 T: std::convert::Into<std::string::String>,
1080 {
1081 self.backup_collection = std::option::Option::Some(v.into());
1082 self
1083 }
1084
1085 /// Sets or clears the value of [backup_collection][crate::model::Instance::backup_collection].
1086 ///
1087 /// # Example
1088 /// ```ignore,no_run
1089 /// # use google_cloud_memorystore_v1::model::Instance;
1090 /// # let project_id = "project_id";
1091 /// # let location_id = "location_id";
1092 /// # let backup_collection_id = "backup_collection_id";
1093 /// let x = Instance::new().set_or_clear_backup_collection(Some(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}")));
1094 /// let x = Instance::new().set_or_clear_backup_collection(None::<String>);
1095 /// ```
1096 pub fn set_or_clear_backup_collection<T>(mut self, v: std::option::Option<T>) -> Self
1097 where
1098 T: std::convert::Into<std::string::String>,
1099 {
1100 self.backup_collection = v.map(|x| x.into());
1101 self
1102 }
1103
1104 /// Sets the value of [automated_backup_config][crate::model::Instance::automated_backup_config].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_memorystore_v1::model::Instance;
1109 /// use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
1110 /// let x = Instance::new().set_automated_backup_config(AutomatedBackupConfig::default()/* use setters */);
1111 /// ```
1112 pub fn set_automated_backup_config<T>(mut self, v: T) -> Self
1113 where
1114 T: std::convert::Into<crate::model::AutomatedBackupConfig>,
1115 {
1116 self.automated_backup_config = std::option::Option::Some(v.into());
1117 self
1118 }
1119
1120 /// Sets or clears the value of [automated_backup_config][crate::model::Instance::automated_backup_config].
1121 ///
1122 /// # Example
1123 /// ```ignore,no_run
1124 /// # use google_cloud_memorystore_v1::model::Instance;
1125 /// use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
1126 /// let x = Instance::new().set_or_clear_automated_backup_config(Some(AutomatedBackupConfig::default()/* use setters */));
1127 /// let x = Instance::new().set_or_clear_automated_backup_config(None::<AutomatedBackupConfig>);
1128 /// ```
1129 pub fn set_or_clear_automated_backup_config<T>(mut self, v: std::option::Option<T>) -> Self
1130 where
1131 T: std::convert::Into<crate::model::AutomatedBackupConfig>,
1132 {
1133 self.automated_backup_config = v.map(|x| x.into());
1134 self
1135 }
1136
1137 /// Sets the value of [maintenance_version][crate::model::Instance::maintenance_version].
1138 ///
1139 /// # Example
1140 /// ```ignore,no_run
1141 /// # use google_cloud_memorystore_v1::model::Instance;
1142 /// let x = Instance::new().set_maintenance_version("example");
1143 /// ```
1144 pub fn set_maintenance_version<T>(mut self, v: T) -> Self
1145 where
1146 T: std::convert::Into<std::string::String>,
1147 {
1148 self.maintenance_version = std::option::Option::Some(v.into());
1149 self
1150 }
1151
1152 /// Sets or clears the value of [maintenance_version][crate::model::Instance::maintenance_version].
1153 ///
1154 /// # Example
1155 /// ```ignore,no_run
1156 /// # use google_cloud_memorystore_v1::model::Instance;
1157 /// let x = Instance::new().set_or_clear_maintenance_version(Some("example"));
1158 /// let x = Instance::new().set_or_clear_maintenance_version(None::<String>);
1159 /// ```
1160 pub fn set_or_clear_maintenance_version<T>(mut self, v: std::option::Option<T>) -> Self
1161 where
1162 T: std::convert::Into<std::string::String>,
1163 {
1164 self.maintenance_version = v.map(|x| x.into());
1165 self
1166 }
1167
1168 /// Sets the value of [effective_maintenance_version][crate::model::Instance::effective_maintenance_version].
1169 ///
1170 /// # Example
1171 /// ```ignore,no_run
1172 /// # use google_cloud_memorystore_v1::model::Instance;
1173 /// let x = Instance::new().set_effective_maintenance_version("example");
1174 /// ```
1175 pub fn set_effective_maintenance_version<T>(mut self, v: T) -> Self
1176 where
1177 T: std::convert::Into<std::string::String>,
1178 {
1179 self.effective_maintenance_version = std::option::Option::Some(v.into());
1180 self
1181 }
1182
1183 /// Sets or clears the value of [effective_maintenance_version][crate::model::Instance::effective_maintenance_version].
1184 ///
1185 /// # Example
1186 /// ```ignore,no_run
1187 /// # use google_cloud_memorystore_v1::model::Instance;
1188 /// let x = Instance::new().set_or_clear_effective_maintenance_version(Some("example"));
1189 /// let x = Instance::new().set_or_clear_effective_maintenance_version(None::<String>);
1190 /// ```
1191 pub fn set_or_clear_effective_maintenance_version<T>(
1192 mut self,
1193 v: std::option::Option<T>,
1194 ) -> Self
1195 where
1196 T: std::convert::Into<std::string::String>,
1197 {
1198 self.effective_maintenance_version = v.map(|x| x.into());
1199 self
1200 }
1201
1202 /// Sets the value of [available_maintenance_versions][crate::model::Instance::available_maintenance_versions].
1203 ///
1204 /// # Example
1205 /// ```ignore,no_run
1206 /// # use google_cloud_memorystore_v1::model::Instance;
1207 /// let x = Instance::new().set_available_maintenance_versions(["a", "b", "c"]);
1208 /// ```
1209 pub fn set_available_maintenance_versions<T, V>(mut self, v: T) -> Self
1210 where
1211 T: std::iter::IntoIterator<Item = V>,
1212 V: std::convert::Into<std::string::String>,
1213 {
1214 use std::iter::Iterator;
1215 self.available_maintenance_versions = v.into_iter().map(|i| i.into()).collect();
1216 self
1217 }
1218
1219 /// Sets the value of [allow_fewer_zones_deployment][crate::model::Instance::allow_fewer_zones_deployment].
1220 ///
1221 /// # Example
1222 /// ```ignore,no_run
1223 /// # use google_cloud_memorystore_v1::model::Instance;
1224 /// let x = Instance::new().set_allow_fewer_zones_deployment(true);
1225 /// ```
1226 #[deprecated]
1227 pub fn set_allow_fewer_zones_deployment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1228 self.allow_fewer_zones_deployment = v.into();
1229 self
1230 }
1231
1232 /// Sets the value of [server_ca_mode][crate::model::Instance::server_ca_mode].
1233 ///
1234 /// # Example
1235 /// ```ignore,no_run
1236 /// # use google_cloud_memorystore_v1::model::Instance;
1237 /// use google_cloud_memorystore_v1::model::instance::ServerCaMode;
1238 /// let x0 = Instance::new().set_server_ca_mode(ServerCaMode::GoogleManagedPerInstanceCa);
1239 /// let x1 = Instance::new().set_server_ca_mode(ServerCaMode::GoogleManagedSharedCa);
1240 /// let x2 = Instance::new().set_server_ca_mode(ServerCaMode::CustomerManagedCasCa);
1241 /// ```
1242 pub fn set_server_ca_mode<T>(mut self, v: T) -> Self
1243 where
1244 T: std::convert::Into<crate::model::instance::ServerCaMode>,
1245 {
1246 self.server_ca_mode = std::option::Option::Some(v.into());
1247 self
1248 }
1249
1250 /// Sets or clears the value of [server_ca_mode][crate::model::Instance::server_ca_mode].
1251 ///
1252 /// # Example
1253 /// ```ignore,no_run
1254 /// # use google_cloud_memorystore_v1::model::Instance;
1255 /// use google_cloud_memorystore_v1::model::instance::ServerCaMode;
1256 /// let x0 = Instance::new().set_or_clear_server_ca_mode(Some(ServerCaMode::GoogleManagedPerInstanceCa));
1257 /// let x1 = Instance::new().set_or_clear_server_ca_mode(Some(ServerCaMode::GoogleManagedSharedCa));
1258 /// let x2 = Instance::new().set_or_clear_server_ca_mode(Some(ServerCaMode::CustomerManagedCasCa));
1259 /// let x_none = Instance::new().set_or_clear_server_ca_mode(None::<ServerCaMode>);
1260 /// ```
1261 pub fn set_or_clear_server_ca_mode<T>(mut self, v: std::option::Option<T>) -> Self
1262 where
1263 T: std::convert::Into<crate::model::instance::ServerCaMode>,
1264 {
1265 self.server_ca_mode = v.map(|x| x.into());
1266 self
1267 }
1268
1269 /// Sets the value of [server_ca_pool][crate::model::Instance::server_ca_pool].
1270 ///
1271 /// # Example
1272 /// ```ignore,no_run
1273 /// # use google_cloud_memorystore_v1::model::Instance;
1274 /// let x = Instance::new().set_server_ca_pool("example");
1275 /// ```
1276 pub fn set_server_ca_pool<T>(mut self, v: T) -> Self
1277 where
1278 T: std::convert::Into<std::string::String>,
1279 {
1280 self.server_ca_pool = std::option::Option::Some(v.into());
1281 self
1282 }
1283
1284 /// Sets or clears the value of [server_ca_pool][crate::model::Instance::server_ca_pool].
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_memorystore_v1::model::Instance;
1289 /// let x = Instance::new().set_or_clear_server_ca_pool(Some("example"));
1290 /// let x = Instance::new().set_or_clear_server_ca_pool(None::<String>);
1291 /// ```
1292 pub fn set_or_clear_server_ca_pool<T>(mut self, v: std::option::Option<T>) -> Self
1293 where
1294 T: std::convert::Into<std::string::String>,
1295 {
1296 self.server_ca_pool = v.map(|x| x.into());
1297 self
1298 }
1299
1300 /// Sets the value of [rotate_server_certificate][crate::model::Instance::rotate_server_certificate].
1301 ///
1302 /// # Example
1303 /// ```ignore,no_run
1304 /// # use google_cloud_memorystore_v1::model::Instance;
1305 /// let x = Instance::new().set_rotate_server_certificate(true);
1306 /// ```
1307 pub fn set_rotate_server_certificate<T>(mut self, v: T) -> Self
1308 where
1309 T: std::convert::Into<bool>,
1310 {
1311 self.rotate_server_certificate = std::option::Option::Some(v.into());
1312 self
1313 }
1314
1315 /// Sets or clears the value of [rotate_server_certificate][crate::model::Instance::rotate_server_certificate].
1316 ///
1317 /// # Example
1318 /// ```ignore,no_run
1319 /// # use google_cloud_memorystore_v1::model::Instance;
1320 /// let x = Instance::new().set_or_clear_rotate_server_certificate(Some(false));
1321 /// let x = Instance::new().set_or_clear_rotate_server_certificate(None::<bool>);
1322 /// ```
1323 pub fn set_or_clear_rotate_server_certificate<T>(mut self, v: std::option::Option<T>) -> Self
1324 where
1325 T: std::convert::Into<bool>,
1326 {
1327 self.rotate_server_certificate = v.map(|x| x.into());
1328 self
1329 }
1330
1331 /// Sets the value of [migration_config][crate::model::Instance::migration_config].
1332 ///
1333 /// # Example
1334 /// ```ignore,no_run
1335 /// # use google_cloud_memorystore_v1::model::Instance;
1336 /// use google_cloud_memorystore_v1::model::MigrationConfig;
1337 /// let x = Instance::new().set_migration_config(MigrationConfig::default()/* use setters */);
1338 /// ```
1339 pub fn set_migration_config<T>(mut self, v: T) -> Self
1340 where
1341 T: std::convert::Into<crate::model::MigrationConfig>,
1342 {
1343 self.migration_config = std::option::Option::Some(v.into());
1344 self
1345 }
1346
1347 /// Sets or clears the value of [migration_config][crate::model::Instance::migration_config].
1348 ///
1349 /// # Example
1350 /// ```ignore,no_run
1351 /// # use google_cloud_memorystore_v1::model::Instance;
1352 /// use google_cloud_memorystore_v1::model::MigrationConfig;
1353 /// let x = Instance::new().set_or_clear_migration_config(Some(MigrationConfig::default()/* use setters */));
1354 /// let x = Instance::new().set_or_clear_migration_config(None::<MigrationConfig>);
1355 /// ```
1356 pub fn set_or_clear_migration_config<T>(mut self, v: std::option::Option<T>) -> Self
1357 where
1358 T: std::convert::Into<crate::model::MigrationConfig>,
1359 {
1360 self.migration_config = v.map(|x| x.into());
1361 self
1362 }
1363
1364 /// Sets the value of [import_sources][crate::model::Instance::import_sources].
1365 ///
1366 /// Note that all the setters affecting `import_sources` are mutually
1367 /// exclusive.
1368 ///
1369 /// # Example
1370 /// ```ignore,no_run
1371 /// # use google_cloud_memorystore_v1::model::Instance;
1372 /// use google_cloud_memorystore_v1::model::instance::GcsBackupSource;
1373 /// let x = Instance::new().set_import_sources(Some(
1374 /// google_cloud_memorystore_v1::model::instance::ImportSources::GcsSource(GcsBackupSource::default().into())));
1375 /// ```
1376 pub fn set_import_sources<
1377 T: std::convert::Into<std::option::Option<crate::model::instance::ImportSources>>,
1378 >(
1379 mut self,
1380 v: T,
1381 ) -> Self {
1382 self.import_sources = v.into();
1383 self
1384 }
1385
1386 /// The value of [import_sources][crate::model::Instance::import_sources]
1387 /// if it holds a `GcsSource`, `None` if the field is not set or
1388 /// holds a different branch.
1389 pub fn gcs_source(
1390 &self,
1391 ) -> std::option::Option<&std::boxed::Box<crate::model::instance::GcsBackupSource>> {
1392 #[allow(unreachable_patterns)]
1393 self.import_sources.as_ref().and_then(|v| match v {
1394 crate::model::instance::ImportSources::GcsSource(v) => std::option::Option::Some(v),
1395 _ => std::option::Option::None,
1396 })
1397 }
1398
1399 /// Sets the value of [import_sources][crate::model::Instance::import_sources]
1400 /// to hold a `GcsSource`.
1401 ///
1402 /// Note that all the setters affecting `import_sources` are
1403 /// mutually exclusive.
1404 ///
1405 /// # Example
1406 /// ```ignore,no_run
1407 /// # use google_cloud_memorystore_v1::model::Instance;
1408 /// use google_cloud_memorystore_v1::model::instance::GcsBackupSource;
1409 /// let x = Instance::new().set_gcs_source(GcsBackupSource::default()/* use setters */);
1410 /// assert!(x.gcs_source().is_some());
1411 /// assert!(x.managed_backup_source().is_none());
1412 /// ```
1413 pub fn set_gcs_source<
1414 T: std::convert::Into<std::boxed::Box<crate::model::instance::GcsBackupSource>>,
1415 >(
1416 mut self,
1417 v: T,
1418 ) -> Self {
1419 self.import_sources =
1420 std::option::Option::Some(crate::model::instance::ImportSources::GcsSource(v.into()));
1421 self
1422 }
1423
1424 /// The value of [import_sources][crate::model::Instance::import_sources]
1425 /// if it holds a `ManagedBackupSource`, `None` if the field is not set or
1426 /// holds a different branch.
1427 pub fn managed_backup_source(
1428 &self,
1429 ) -> std::option::Option<&std::boxed::Box<crate::model::instance::ManagedBackupSource>> {
1430 #[allow(unreachable_patterns)]
1431 self.import_sources.as_ref().and_then(|v| match v {
1432 crate::model::instance::ImportSources::ManagedBackupSource(v) => {
1433 std::option::Option::Some(v)
1434 }
1435 _ => std::option::Option::None,
1436 })
1437 }
1438
1439 /// Sets the value of [import_sources][crate::model::Instance::import_sources]
1440 /// to hold a `ManagedBackupSource`.
1441 ///
1442 /// Note that all the setters affecting `import_sources` are
1443 /// mutually exclusive.
1444 ///
1445 /// # Example
1446 /// ```ignore,no_run
1447 /// # use google_cloud_memorystore_v1::model::Instance;
1448 /// use google_cloud_memorystore_v1::model::instance::ManagedBackupSource;
1449 /// let x = Instance::new().set_managed_backup_source(ManagedBackupSource::default()/* use setters */);
1450 /// assert!(x.managed_backup_source().is_some());
1451 /// assert!(x.gcs_source().is_none());
1452 /// ```
1453 pub fn set_managed_backup_source<
1454 T: std::convert::Into<std::boxed::Box<crate::model::instance::ManagedBackupSource>>,
1455 >(
1456 mut self,
1457 v: T,
1458 ) -> Self {
1459 self.import_sources = std::option::Option::Some(
1460 crate::model::instance::ImportSources::ManagedBackupSource(v.into()),
1461 );
1462 self
1463 }
1464}
1465
1466impl wkt::message::Message for Instance {
1467 fn typename() -> &'static str {
1468 "type.googleapis.com/google.cloud.memorystore.v1.Instance"
1469 }
1470}
1471
1472/// Defines additional types related to [Instance].
1473pub mod instance {
1474 #[allow(unused_imports)]
1475 use super::*;
1476
1477 /// Additional information about the state of the instance.
1478 #[derive(Clone, Default, PartialEq)]
1479 #[non_exhaustive]
1480 pub struct StateInfo {
1481 #[allow(missing_docs)]
1482 pub info: std::option::Option<crate::model::instance::state_info::Info>,
1483
1484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1485 }
1486
1487 impl StateInfo {
1488 /// Creates a new default instance.
1489 pub fn new() -> Self {
1490 std::default::Default::default()
1491 }
1492
1493 /// Sets the value of [info][crate::model::instance::StateInfo::info].
1494 ///
1495 /// Note that all the setters affecting `info` are mutually
1496 /// exclusive.
1497 ///
1498 /// # Example
1499 /// ```ignore,no_run
1500 /// # use google_cloud_memorystore_v1::model::instance::StateInfo;
1501 /// use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1502 /// let x = StateInfo::new().set_info(Some(
1503 /// google_cloud_memorystore_v1::model::instance::state_info::Info::UpdateInfo(UpdateInfo::default().into())));
1504 /// ```
1505 pub fn set_info<
1506 T: std::convert::Into<std::option::Option<crate::model::instance::state_info::Info>>,
1507 >(
1508 mut self,
1509 v: T,
1510 ) -> Self {
1511 self.info = v.into();
1512 self
1513 }
1514
1515 /// The value of [info][crate::model::instance::StateInfo::info]
1516 /// if it holds a `UpdateInfo`, `None` if the field is not set or
1517 /// holds a different branch.
1518 pub fn update_info(
1519 &self,
1520 ) -> std::option::Option<&std::boxed::Box<crate::model::instance::state_info::UpdateInfo>>
1521 {
1522 #[allow(unreachable_patterns)]
1523 self.info.as_ref().and_then(|v| match v {
1524 crate::model::instance::state_info::Info::UpdateInfo(v) => {
1525 std::option::Option::Some(v)
1526 }
1527 _ => std::option::Option::None,
1528 })
1529 }
1530
1531 /// Sets the value of [info][crate::model::instance::StateInfo::info]
1532 /// to hold a `UpdateInfo`.
1533 ///
1534 /// Note that all the setters affecting `info` are
1535 /// mutually exclusive.
1536 ///
1537 /// # Example
1538 /// ```ignore,no_run
1539 /// # use google_cloud_memorystore_v1::model::instance::StateInfo;
1540 /// use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1541 /// let x = StateInfo::new().set_update_info(UpdateInfo::default()/* use setters */);
1542 /// assert!(x.update_info().is_some());
1543 /// ```
1544 pub fn set_update_info<
1545 T: std::convert::Into<std::boxed::Box<crate::model::instance::state_info::UpdateInfo>>,
1546 >(
1547 mut self,
1548 v: T,
1549 ) -> Self {
1550 self.info = std::option::Option::Some(
1551 crate::model::instance::state_info::Info::UpdateInfo(v.into()),
1552 );
1553 self
1554 }
1555 }
1556
1557 impl wkt::message::Message for StateInfo {
1558 fn typename() -> &'static str {
1559 "type.googleapis.com/google.cloud.memorystore.v1.Instance.StateInfo"
1560 }
1561 }
1562
1563 /// Defines additional types related to [StateInfo].
1564 pub mod state_info {
1565 #[allow(unused_imports)]
1566 use super::*;
1567
1568 /// Represents information about instance with state UPDATING.
1569 #[derive(Clone, Default, PartialEq)]
1570 #[non_exhaustive]
1571 pub struct UpdateInfo {
1572 /// Output only. Target number of shards for the instance.
1573 pub target_shard_count: std::option::Option<i32>,
1574
1575 /// Output only. Target number of replica nodes per shard for the instance.
1576 pub target_replica_count: std::option::Option<i32>,
1577
1578 /// Output only. Target engine version for the instance.
1579 pub target_engine_version: std::option::Option<std::string::String>,
1580
1581 /// Output only. Target node type for the instance.
1582 pub target_node_type: std::option::Option<crate::model::instance::NodeType>,
1583
1584 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1585 }
1586
1587 impl UpdateInfo {
1588 /// Creates a new default instance.
1589 pub fn new() -> Self {
1590 std::default::Default::default()
1591 }
1592
1593 /// Sets the value of [target_shard_count][crate::model::instance::state_info::UpdateInfo::target_shard_count].
1594 ///
1595 /// # Example
1596 /// ```ignore,no_run
1597 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1598 /// let x = UpdateInfo::new().set_target_shard_count(42);
1599 /// ```
1600 pub fn set_target_shard_count<T>(mut self, v: T) -> Self
1601 where
1602 T: std::convert::Into<i32>,
1603 {
1604 self.target_shard_count = std::option::Option::Some(v.into());
1605 self
1606 }
1607
1608 /// Sets or clears the value of [target_shard_count][crate::model::instance::state_info::UpdateInfo::target_shard_count].
1609 ///
1610 /// # Example
1611 /// ```ignore,no_run
1612 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1613 /// let x = UpdateInfo::new().set_or_clear_target_shard_count(Some(42));
1614 /// let x = UpdateInfo::new().set_or_clear_target_shard_count(None::<i32>);
1615 /// ```
1616 pub fn set_or_clear_target_shard_count<T>(mut self, v: std::option::Option<T>) -> Self
1617 where
1618 T: std::convert::Into<i32>,
1619 {
1620 self.target_shard_count = v.map(|x| x.into());
1621 self
1622 }
1623
1624 /// Sets the value of [target_replica_count][crate::model::instance::state_info::UpdateInfo::target_replica_count].
1625 ///
1626 /// # Example
1627 /// ```ignore,no_run
1628 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1629 /// let x = UpdateInfo::new().set_target_replica_count(42);
1630 /// ```
1631 pub fn set_target_replica_count<T>(mut self, v: T) -> Self
1632 where
1633 T: std::convert::Into<i32>,
1634 {
1635 self.target_replica_count = std::option::Option::Some(v.into());
1636 self
1637 }
1638
1639 /// Sets or clears the value of [target_replica_count][crate::model::instance::state_info::UpdateInfo::target_replica_count].
1640 ///
1641 /// # Example
1642 /// ```ignore,no_run
1643 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1644 /// let x = UpdateInfo::new().set_or_clear_target_replica_count(Some(42));
1645 /// let x = UpdateInfo::new().set_or_clear_target_replica_count(None::<i32>);
1646 /// ```
1647 pub fn set_or_clear_target_replica_count<T>(mut self, v: std::option::Option<T>) -> Self
1648 where
1649 T: std::convert::Into<i32>,
1650 {
1651 self.target_replica_count = v.map(|x| x.into());
1652 self
1653 }
1654
1655 /// Sets the value of [target_engine_version][crate::model::instance::state_info::UpdateInfo::target_engine_version].
1656 ///
1657 /// # Example
1658 /// ```ignore,no_run
1659 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1660 /// let x = UpdateInfo::new().set_target_engine_version("example");
1661 /// ```
1662 pub fn set_target_engine_version<T>(mut self, v: T) -> Self
1663 where
1664 T: std::convert::Into<std::string::String>,
1665 {
1666 self.target_engine_version = std::option::Option::Some(v.into());
1667 self
1668 }
1669
1670 /// Sets or clears the value of [target_engine_version][crate::model::instance::state_info::UpdateInfo::target_engine_version].
1671 ///
1672 /// # Example
1673 /// ```ignore,no_run
1674 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1675 /// let x = UpdateInfo::new().set_or_clear_target_engine_version(Some("example"));
1676 /// let x = UpdateInfo::new().set_or_clear_target_engine_version(None::<String>);
1677 /// ```
1678 pub fn set_or_clear_target_engine_version<T>(
1679 mut self,
1680 v: std::option::Option<T>,
1681 ) -> Self
1682 where
1683 T: std::convert::Into<std::string::String>,
1684 {
1685 self.target_engine_version = v.map(|x| x.into());
1686 self
1687 }
1688
1689 /// Sets the value of [target_node_type][crate::model::instance::state_info::UpdateInfo::target_node_type].
1690 ///
1691 /// # Example
1692 /// ```ignore,no_run
1693 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1694 /// use google_cloud_memorystore_v1::model::instance::NodeType;
1695 /// let x0 = UpdateInfo::new().set_target_node_type(NodeType::SharedCoreNano);
1696 /// let x1 = UpdateInfo::new().set_target_node_type(NodeType::HighmemMedium);
1697 /// let x2 = UpdateInfo::new().set_target_node_type(NodeType::HighmemXlarge);
1698 /// ```
1699 pub fn set_target_node_type<T>(mut self, v: T) -> Self
1700 where
1701 T: std::convert::Into<crate::model::instance::NodeType>,
1702 {
1703 self.target_node_type = std::option::Option::Some(v.into());
1704 self
1705 }
1706
1707 /// Sets or clears the value of [target_node_type][crate::model::instance::state_info::UpdateInfo::target_node_type].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_memorystore_v1::model::instance::state_info::UpdateInfo;
1712 /// use google_cloud_memorystore_v1::model::instance::NodeType;
1713 /// let x0 = UpdateInfo::new().set_or_clear_target_node_type(Some(NodeType::SharedCoreNano));
1714 /// let x1 = UpdateInfo::new().set_or_clear_target_node_type(Some(NodeType::HighmemMedium));
1715 /// let x2 = UpdateInfo::new().set_or_clear_target_node_type(Some(NodeType::HighmemXlarge));
1716 /// let x_none = UpdateInfo::new().set_or_clear_target_node_type(None::<NodeType>);
1717 /// ```
1718 pub fn set_or_clear_target_node_type<T>(mut self, v: std::option::Option<T>) -> Self
1719 where
1720 T: std::convert::Into<crate::model::instance::NodeType>,
1721 {
1722 self.target_node_type = v.map(|x| x.into());
1723 self
1724 }
1725 }
1726
1727 impl wkt::message::Message for UpdateInfo {
1728 fn typename() -> &'static str {
1729 "type.googleapis.com/google.cloud.memorystore.v1.Instance.StateInfo.UpdateInfo"
1730 }
1731 }
1732
1733 #[allow(missing_docs)]
1734 #[derive(Clone, Debug, PartialEq)]
1735 #[non_exhaustive]
1736 pub enum Info {
1737 /// Output only. Describes ongoing update when instance state is UPDATING.
1738 UpdateInfo(std::boxed::Box<crate::model::instance::state_info::UpdateInfo>),
1739 }
1740 }
1741
1742 /// Backups that stored in Cloud Storage buckets.
1743 /// The Cloud Storage buckets need to be the same region as the instances.
1744 #[derive(Clone, Default, PartialEq)]
1745 #[non_exhaustive]
1746 pub struct GcsBackupSource {
1747 /// Optional. Example: gs://bucket1/object1, gs://bucket2/folder2/object2
1748 pub uris: std::vec::Vec<std::string::String>,
1749
1750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1751 }
1752
1753 impl GcsBackupSource {
1754 /// Creates a new default instance.
1755 pub fn new() -> Self {
1756 std::default::Default::default()
1757 }
1758
1759 /// Sets the value of [uris][crate::model::instance::GcsBackupSource::uris].
1760 ///
1761 /// # Example
1762 /// ```ignore,no_run
1763 /// # use google_cloud_memorystore_v1::model::instance::GcsBackupSource;
1764 /// let x = GcsBackupSource::new().set_uris(["a", "b", "c"]);
1765 /// ```
1766 pub fn set_uris<T, V>(mut self, v: T) -> Self
1767 where
1768 T: std::iter::IntoIterator<Item = V>,
1769 V: std::convert::Into<std::string::String>,
1770 {
1771 use std::iter::Iterator;
1772 self.uris = v.into_iter().map(|i| i.into()).collect();
1773 self
1774 }
1775 }
1776
1777 impl wkt::message::Message for GcsBackupSource {
1778 fn typename() -> &'static str {
1779 "type.googleapis.com/google.cloud.memorystore.v1.Instance.GcsBackupSource"
1780 }
1781 }
1782
1783 /// Backups that generated and managed by memorystore.
1784 #[derive(Clone, Default, PartialEq)]
1785 #[non_exhaustive]
1786 pub struct ManagedBackupSource {
1787 /// Optional. Example:
1788 /// //memorystore.googleapis.com/projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup}
1789 /// A shorter version (without the prefix) of the backup name is also
1790 /// supported, like
1791 /// projects/{project}/locations/{location}/backupCollections/{collection}/backups/{backup_id}
1792 /// In this case, it assumes the backup is under memorystore.googleapis.com.
1793 pub backup: std::string::String,
1794
1795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1796 }
1797
1798 impl ManagedBackupSource {
1799 /// Creates a new default instance.
1800 pub fn new() -> Self {
1801 std::default::Default::default()
1802 }
1803
1804 /// Sets the value of [backup][crate::model::instance::ManagedBackupSource::backup].
1805 ///
1806 /// # Example
1807 /// ```ignore,no_run
1808 /// # use google_cloud_memorystore_v1::model::instance::ManagedBackupSource;
1809 /// let x = ManagedBackupSource::new().set_backup("example");
1810 /// ```
1811 pub fn set_backup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1812 self.backup = v.into();
1813 self
1814 }
1815 }
1816
1817 impl wkt::message::Message for ManagedBackupSource {
1818 fn typename() -> &'static str {
1819 "type.googleapis.com/google.cloud.memorystore.v1.Instance.ManagedBackupSource"
1820 }
1821 }
1822
1823 /// InstanceEndpoint consists of PSC connections that are created
1824 /// as a group in each VPC network for accessing the instance. In each group,
1825 /// there shall be one connection for each service attachment in the cluster.
1826 #[derive(Clone, Default, PartialEq)]
1827 #[non_exhaustive]
1828 pub struct InstanceEndpoint {
1829 /// Optional. A group of PSC connections. They are created in the same VPC
1830 /// network, one for each service attachment in the cluster.
1831 pub connections: std::vec::Vec<crate::model::instance::ConnectionDetail>,
1832
1833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1834 }
1835
1836 impl InstanceEndpoint {
1837 /// Creates a new default instance.
1838 pub fn new() -> Self {
1839 std::default::Default::default()
1840 }
1841
1842 /// Sets the value of [connections][crate::model::instance::InstanceEndpoint::connections].
1843 ///
1844 /// # Example
1845 /// ```ignore,no_run
1846 /// # use google_cloud_memorystore_v1::model::instance::InstanceEndpoint;
1847 /// use google_cloud_memorystore_v1::model::instance::ConnectionDetail;
1848 /// let x = InstanceEndpoint::new()
1849 /// .set_connections([
1850 /// ConnectionDetail::default()/* use setters */,
1851 /// ConnectionDetail::default()/* use (different) setters */,
1852 /// ]);
1853 /// ```
1854 pub fn set_connections<T, V>(mut self, v: T) -> Self
1855 where
1856 T: std::iter::IntoIterator<Item = V>,
1857 V: std::convert::Into<crate::model::instance::ConnectionDetail>,
1858 {
1859 use std::iter::Iterator;
1860 self.connections = v.into_iter().map(|i| i.into()).collect();
1861 self
1862 }
1863 }
1864
1865 impl wkt::message::Message for InstanceEndpoint {
1866 fn typename() -> &'static str {
1867 "type.googleapis.com/google.cloud.memorystore.v1.Instance.InstanceEndpoint"
1868 }
1869 }
1870
1871 /// Information of each PSC connection.
1872 #[derive(Clone, Default, PartialEq)]
1873 #[non_exhaustive]
1874 pub struct ConnectionDetail {
1875 /// A PSC connection to an instance could either be created through Service
1876 /// Connectivity Automation (auto connection) during the cluster creation,
1877 /// or it could be created by customer themeslves (user-created connection).
1878 pub connection: std::option::Option<crate::model::instance::connection_detail::Connection>,
1879
1880 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1881 }
1882
1883 impl ConnectionDetail {
1884 /// Creates a new default instance.
1885 pub fn new() -> Self {
1886 std::default::Default::default()
1887 }
1888
1889 /// Sets the value of [connection][crate::model::instance::ConnectionDetail::connection].
1890 ///
1891 /// Note that all the setters affecting `connection` are mutually
1892 /// exclusive.
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_memorystore_v1::model::instance::ConnectionDetail;
1897 /// use google_cloud_memorystore_v1::model::PscAutoConnection;
1898 /// let x = ConnectionDetail::new().set_connection(Some(
1899 /// google_cloud_memorystore_v1::model::instance::connection_detail::Connection::PscAutoConnection(PscAutoConnection::default().into())));
1900 /// ```
1901 pub fn set_connection<
1902 T: std::convert::Into<
1903 std::option::Option<crate::model::instance::connection_detail::Connection>,
1904 >,
1905 >(
1906 mut self,
1907 v: T,
1908 ) -> Self {
1909 self.connection = v.into();
1910 self
1911 }
1912
1913 /// The value of [connection][crate::model::instance::ConnectionDetail::connection]
1914 /// if it holds a `PscAutoConnection`, `None` if the field is not set or
1915 /// holds a different branch.
1916 pub fn psc_auto_connection(
1917 &self,
1918 ) -> std::option::Option<&std::boxed::Box<crate::model::PscAutoConnection>> {
1919 #[allow(unreachable_patterns)]
1920 self.connection.as_ref().and_then(|v| match v {
1921 crate::model::instance::connection_detail::Connection::PscAutoConnection(v) => {
1922 std::option::Option::Some(v)
1923 }
1924 _ => std::option::Option::None,
1925 })
1926 }
1927
1928 /// Sets the value of [connection][crate::model::instance::ConnectionDetail::connection]
1929 /// to hold a `PscAutoConnection`.
1930 ///
1931 /// Note that all the setters affecting `connection` are
1932 /// mutually exclusive.
1933 ///
1934 /// # Example
1935 /// ```ignore,no_run
1936 /// # use google_cloud_memorystore_v1::model::instance::ConnectionDetail;
1937 /// use google_cloud_memorystore_v1::model::PscAutoConnection;
1938 /// let x = ConnectionDetail::new().set_psc_auto_connection(PscAutoConnection::default()/* use setters */);
1939 /// assert!(x.psc_auto_connection().is_some());
1940 /// assert!(x.psc_connection().is_none());
1941 /// ```
1942 pub fn set_psc_auto_connection<
1943 T: std::convert::Into<std::boxed::Box<crate::model::PscAutoConnection>>,
1944 >(
1945 mut self,
1946 v: T,
1947 ) -> Self {
1948 self.connection = std::option::Option::Some(
1949 crate::model::instance::connection_detail::Connection::PscAutoConnection(v.into()),
1950 );
1951 self
1952 }
1953
1954 /// The value of [connection][crate::model::instance::ConnectionDetail::connection]
1955 /// if it holds a `PscConnection`, `None` if the field is not set or
1956 /// holds a different branch.
1957 pub fn psc_connection(
1958 &self,
1959 ) -> std::option::Option<&std::boxed::Box<crate::model::PscConnection>> {
1960 #[allow(unreachable_patterns)]
1961 self.connection.as_ref().and_then(|v| match v {
1962 crate::model::instance::connection_detail::Connection::PscConnection(v) => {
1963 std::option::Option::Some(v)
1964 }
1965 _ => std::option::Option::None,
1966 })
1967 }
1968
1969 /// Sets the value of [connection][crate::model::instance::ConnectionDetail::connection]
1970 /// to hold a `PscConnection`.
1971 ///
1972 /// Note that all the setters affecting `connection` are
1973 /// mutually exclusive.
1974 ///
1975 /// # Example
1976 /// ```ignore,no_run
1977 /// # use google_cloud_memorystore_v1::model::instance::ConnectionDetail;
1978 /// use google_cloud_memorystore_v1::model::PscConnection;
1979 /// let x = ConnectionDetail::new().set_psc_connection(PscConnection::default()/* use setters */);
1980 /// assert!(x.psc_connection().is_some());
1981 /// assert!(x.psc_auto_connection().is_none());
1982 /// ```
1983 pub fn set_psc_connection<
1984 T: std::convert::Into<std::boxed::Box<crate::model::PscConnection>>,
1985 >(
1986 mut self,
1987 v: T,
1988 ) -> Self {
1989 self.connection = std::option::Option::Some(
1990 crate::model::instance::connection_detail::Connection::PscConnection(v.into()),
1991 );
1992 self
1993 }
1994 }
1995
1996 impl wkt::message::Message for ConnectionDetail {
1997 fn typename() -> &'static str {
1998 "type.googleapis.com/google.cloud.memorystore.v1.Instance.ConnectionDetail"
1999 }
2000 }
2001
2002 /// Defines additional types related to [ConnectionDetail].
2003 pub mod connection_detail {
2004 #[allow(unused_imports)]
2005 use super::*;
2006
2007 /// A PSC connection to an instance could either be created through Service
2008 /// Connectivity Automation (auto connection) during the cluster creation,
2009 /// or it could be created by customer themeslves (user-created connection).
2010 #[derive(Clone, Debug, PartialEq)]
2011 #[non_exhaustive]
2012 pub enum Connection {
2013 /// Immutable. Detailed information of a PSC connection that is created
2014 /// through service connectivity automation.
2015 PscAutoConnection(std::boxed::Box<crate::model::PscAutoConnection>),
2016 /// Detailed information of a PSC connection that is created by the user.
2017 PscConnection(std::boxed::Box<crate::model::PscConnection>),
2018 }
2019 }
2020
2021 /// Possible states of the instance.
2022 ///
2023 /// # Working with unknown values
2024 ///
2025 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2026 /// additional enum variants at any time. Adding new variants is not considered
2027 /// a breaking change. Applications should write their code in anticipation of:
2028 ///
2029 /// - New values appearing in future releases of the client library, **and**
2030 /// - New values received dynamically, without application changes.
2031 ///
2032 /// Please consult the [Working with enums] section in the user guide for some
2033 /// guidelines.
2034 ///
2035 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2036 #[derive(Clone, Debug, PartialEq)]
2037 #[non_exhaustive]
2038 pub enum State {
2039 /// Not set.
2040 Unspecified,
2041 /// Instance is being created.
2042 Creating,
2043 /// Instance has been created and is usable.
2044 Active,
2045 /// Instance is being updated.
2046 Updating,
2047 /// Instance is being deleted.
2048 Deleting,
2049 /// Instance is being migrated.
2050 Migrating,
2051 /// If set, the enum was initialized with an unknown value.
2052 ///
2053 /// Applications can examine the value using [State::value] or
2054 /// [State::name].
2055 UnknownValue(state::UnknownValue),
2056 }
2057
2058 #[doc(hidden)]
2059 pub mod state {
2060 #[allow(unused_imports)]
2061 use super::*;
2062 #[derive(Clone, Debug, PartialEq)]
2063 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2064 }
2065
2066 impl State {
2067 /// Gets the enum value.
2068 ///
2069 /// Returns `None` if the enum contains an unknown value deserialized from
2070 /// the string representation of enums.
2071 pub fn value(&self) -> std::option::Option<i32> {
2072 match self {
2073 Self::Unspecified => std::option::Option::Some(0),
2074 Self::Creating => std::option::Option::Some(1),
2075 Self::Active => std::option::Option::Some(2),
2076 Self::Updating => std::option::Option::Some(3),
2077 Self::Deleting => std::option::Option::Some(4),
2078 Self::Migrating => std::option::Option::Some(6),
2079 Self::UnknownValue(u) => u.0.value(),
2080 }
2081 }
2082
2083 /// Gets the enum value as a string.
2084 ///
2085 /// Returns `None` if the enum contains an unknown value deserialized from
2086 /// the integer representation of enums.
2087 pub fn name(&self) -> std::option::Option<&str> {
2088 match self {
2089 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2090 Self::Creating => std::option::Option::Some("CREATING"),
2091 Self::Active => std::option::Option::Some("ACTIVE"),
2092 Self::Updating => std::option::Option::Some("UPDATING"),
2093 Self::Deleting => std::option::Option::Some("DELETING"),
2094 Self::Migrating => std::option::Option::Some("MIGRATING"),
2095 Self::UnknownValue(u) => u.0.name(),
2096 }
2097 }
2098 }
2099
2100 impl std::default::Default for State {
2101 fn default() -> Self {
2102 use std::convert::From;
2103 Self::from(0)
2104 }
2105 }
2106
2107 impl std::fmt::Display for State {
2108 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2109 wkt::internal::display_enum(f, self.name(), self.value())
2110 }
2111 }
2112
2113 impl std::convert::From<i32> for State {
2114 fn from(value: i32) -> Self {
2115 match value {
2116 0 => Self::Unspecified,
2117 1 => Self::Creating,
2118 2 => Self::Active,
2119 3 => Self::Updating,
2120 4 => Self::Deleting,
2121 6 => Self::Migrating,
2122 _ => Self::UnknownValue(state::UnknownValue(
2123 wkt::internal::UnknownEnumValue::Integer(value),
2124 )),
2125 }
2126 }
2127 }
2128
2129 impl std::convert::From<&str> for State {
2130 fn from(value: &str) -> Self {
2131 use std::string::ToString;
2132 match value {
2133 "STATE_UNSPECIFIED" => Self::Unspecified,
2134 "CREATING" => Self::Creating,
2135 "ACTIVE" => Self::Active,
2136 "UPDATING" => Self::Updating,
2137 "DELETING" => Self::Deleting,
2138 "MIGRATING" => Self::Migrating,
2139 _ => Self::UnknownValue(state::UnknownValue(
2140 wkt::internal::UnknownEnumValue::String(value.to_string()),
2141 )),
2142 }
2143 }
2144 }
2145
2146 impl serde::ser::Serialize for State {
2147 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2148 where
2149 S: serde::Serializer,
2150 {
2151 match self {
2152 Self::Unspecified => serializer.serialize_i32(0),
2153 Self::Creating => serializer.serialize_i32(1),
2154 Self::Active => serializer.serialize_i32(2),
2155 Self::Updating => serializer.serialize_i32(3),
2156 Self::Deleting => serializer.serialize_i32(4),
2157 Self::Migrating => serializer.serialize_i32(6),
2158 Self::UnknownValue(u) => u.0.serialize(serializer),
2159 }
2160 }
2161 }
2162
2163 impl<'de> serde::de::Deserialize<'de> for State {
2164 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2165 where
2166 D: serde::Deserializer<'de>,
2167 {
2168 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2169 ".google.cloud.memorystore.v1.Instance.State",
2170 ))
2171 }
2172 }
2173
2174 /// Possible authorization modes of the instance.
2175 ///
2176 /// # Working with unknown values
2177 ///
2178 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2179 /// additional enum variants at any time. Adding new variants is not considered
2180 /// a breaking change. Applications should write their code in anticipation of:
2181 ///
2182 /// - New values appearing in future releases of the client library, **and**
2183 /// - New values received dynamically, without application changes.
2184 ///
2185 /// Please consult the [Working with enums] section in the user guide for some
2186 /// guidelines.
2187 ///
2188 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2189 #[derive(Clone, Debug, PartialEq)]
2190 #[non_exhaustive]
2191 pub enum AuthorizationMode {
2192 /// Not set.
2193 Unspecified,
2194 /// Authorization disabled.
2195 AuthDisabled,
2196 /// IAM basic authorization.
2197 IamAuth,
2198 /// Token based authorization.
2199 TokenAuth,
2200 /// If set, the enum was initialized with an unknown value.
2201 ///
2202 /// Applications can examine the value using [AuthorizationMode::value] or
2203 /// [AuthorizationMode::name].
2204 UnknownValue(authorization_mode::UnknownValue),
2205 }
2206
2207 #[doc(hidden)]
2208 pub mod authorization_mode {
2209 #[allow(unused_imports)]
2210 use super::*;
2211 #[derive(Clone, Debug, PartialEq)]
2212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2213 }
2214
2215 impl AuthorizationMode {
2216 /// Gets the enum value.
2217 ///
2218 /// Returns `None` if the enum contains an unknown value deserialized from
2219 /// the string representation of enums.
2220 pub fn value(&self) -> std::option::Option<i32> {
2221 match self {
2222 Self::Unspecified => std::option::Option::Some(0),
2223 Self::AuthDisabled => std::option::Option::Some(1),
2224 Self::IamAuth => std::option::Option::Some(2),
2225 Self::TokenAuth => std::option::Option::Some(3),
2226 Self::UnknownValue(u) => u.0.value(),
2227 }
2228 }
2229
2230 /// Gets the enum value as a string.
2231 ///
2232 /// Returns `None` if the enum contains an unknown value deserialized from
2233 /// the integer representation of enums.
2234 pub fn name(&self) -> std::option::Option<&str> {
2235 match self {
2236 Self::Unspecified => std::option::Option::Some("AUTHORIZATION_MODE_UNSPECIFIED"),
2237 Self::AuthDisabled => std::option::Option::Some("AUTH_DISABLED"),
2238 Self::IamAuth => std::option::Option::Some("IAM_AUTH"),
2239 Self::TokenAuth => std::option::Option::Some("TOKEN_AUTH"),
2240 Self::UnknownValue(u) => u.0.name(),
2241 }
2242 }
2243 }
2244
2245 impl std::default::Default for AuthorizationMode {
2246 fn default() -> Self {
2247 use std::convert::From;
2248 Self::from(0)
2249 }
2250 }
2251
2252 impl std::fmt::Display for AuthorizationMode {
2253 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2254 wkt::internal::display_enum(f, self.name(), self.value())
2255 }
2256 }
2257
2258 impl std::convert::From<i32> for AuthorizationMode {
2259 fn from(value: i32) -> Self {
2260 match value {
2261 0 => Self::Unspecified,
2262 1 => Self::AuthDisabled,
2263 2 => Self::IamAuth,
2264 3 => Self::TokenAuth,
2265 _ => Self::UnknownValue(authorization_mode::UnknownValue(
2266 wkt::internal::UnknownEnumValue::Integer(value),
2267 )),
2268 }
2269 }
2270 }
2271
2272 impl std::convert::From<&str> for AuthorizationMode {
2273 fn from(value: &str) -> Self {
2274 use std::string::ToString;
2275 match value {
2276 "AUTHORIZATION_MODE_UNSPECIFIED" => Self::Unspecified,
2277 "AUTH_DISABLED" => Self::AuthDisabled,
2278 "IAM_AUTH" => Self::IamAuth,
2279 "TOKEN_AUTH" => Self::TokenAuth,
2280 _ => Self::UnknownValue(authorization_mode::UnknownValue(
2281 wkt::internal::UnknownEnumValue::String(value.to_string()),
2282 )),
2283 }
2284 }
2285 }
2286
2287 impl serde::ser::Serialize for AuthorizationMode {
2288 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2289 where
2290 S: serde::Serializer,
2291 {
2292 match self {
2293 Self::Unspecified => serializer.serialize_i32(0),
2294 Self::AuthDisabled => serializer.serialize_i32(1),
2295 Self::IamAuth => serializer.serialize_i32(2),
2296 Self::TokenAuth => serializer.serialize_i32(3),
2297 Self::UnknownValue(u) => u.0.serialize(serializer),
2298 }
2299 }
2300 }
2301
2302 impl<'de> serde::de::Deserialize<'de> for AuthorizationMode {
2303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2304 where
2305 D: serde::Deserializer<'de>,
2306 {
2307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AuthorizationMode>::new(
2308 ".google.cloud.memorystore.v1.Instance.AuthorizationMode",
2309 ))
2310 }
2311 }
2312
2313 /// Possible in-transit encryption modes of the instance.
2314 ///
2315 /// # Working with unknown values
2316 ///
2317 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2318 /// additional enum variants at any time. Adding new variants is not considered
2319 /// a breaking change. Applications should write their code in anticipation of:
2320 ///
2321 /// - New values appearing in future releases of the client library, **and**
2322 /// - New values received dynamically, without application changes.
2323 ///
2324 /// Please consult the [Working with enums] section in the user guide for some
2325 /// guidelines.
2326 ///
2327 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2328 #[derive(Clone, Debug, PartialEq)]
2329 #[non_exhaustive]
2330 pub enum TransitEncryptionMode {
2331 /// Not set.
2332 Unspecified,
2333 /// In-transit encryption is disabled.
2334 TransitEncryptionDisabled,
2335 /// Server-managed encryption is used for in-transit encryption.
2336 ServerAuthentication,
2337 /// If set, the enum was initialized with an unknown value.
2338 ///
2339 /// Applications can examine the value using [TransitEncryptionMode::value] or
2340 /// [TransitEncryptionMode::name].
2341 UnknownValue(transit_encryption_mode::UnknownValue),
2342 }
2343
2344 #[doc(hidden)]
2345 pub mod transit_encryption_mode {
2346 #[allow(unused_imports)]
2347 use super::*;
2348 #[derive(Clone, Debug, PartialEq)]
2349 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2350 }
2351
2352 impl TransitEncryptionMode {
2353 /// Gets the enum value.
2354 ///
2355 /// Returns `None` if the enum contains an unknown value deserialized from
2356 /// the string representation of enums.
2357 pub fn value(&self) -> std::option::Option<i32> {
2358 match self {
2359 Self::Unspecified => std::option::Option::Some(0),
2360 Self::TransitEncryptionDisabled => std::option::Option::Some(1),
2361 Self::ServerAuthentication => std::option::Option::Some(2),
2362 Self::UnknownValue(u) => u.0.value(),
2363 }
2364 }
2365
2366 /// Gets the enum value as a string.
2367 ///
2368 /// Returns `None` if the enum contains an unknown value deserialized from
2369 /// the integer representation of enums.
2370 pub fn name(&self) -> std::option::Option<&str> {
2371 match self {
2372 Self::Unspecified => {
2373 std::option::Option::Some("TRANSIT_ENCRYPTION_MODE_UNSPECIFIED")
2374 }
2375 Self::TransitEncryptionDisabled => {
2376 std::option::Option::Some("TRANSIT_ENCRYPTION_DISABLED")
2377 }
2378 Self::ServerAuthentication => std::option::Option::Some("SERVER_AUTHENTICATION"),
2379 Self::UnknownValue(u) => u.0.name(),
2380 }
2381 }
2382 }
2383
2384 impl std::default::Default for TransitEncryptionMode {
2385 fn default() -> Self {
2386 use std::convert::From;
2387 Self::from(0)
2388 }
2389 }
2390
2391 impl std::fmt::Display for TransitEncryptionMode {
2392 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2393 wkt::internal::display_enum(f, self.name(), self.value())
2394 }
2395 }
2396
2397 impl std::convert::From<i32> for TransitEncryptionMode {
2398 fn from(value: i32) -> Self {
2399 match value {
2400 0 => Self::Unspecified,
2401 1 => Self::TransitEncryptionDisabled,
2402 2 => Self::ServerAuthentication,
2403 _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
2404 wkt::internal::UnknownEnumValue::Integer(value),
2405 )),
2406 }
2407 }
2408 }
2409
2410 impl std::convert::From<&str> for TransitEncryptionMode {
2411 fn from(value: &str) -> Self {
2412 use std::string::ToString;
2413 match value {
2414 "TRANSIT_ENCRYPTION_MODE_UNSPECIFIED" => Self::Unspecified,
2415 "TRANSIT_ENCRYPTION_DISABLED" => Self::TransitEncryptionDisabled,
2416 "SERVER_AUTHENTICATION" => Self::ServerAuthentication,
2417 _ => Self::UnknownValue(transit_encryption_mode::UnknownValue(
2418 wkt::internal::UnknownEnumValue::String(value.to_string()),
2419 )),
2420 }
2421 }
2422 }
2423
2424 impl serde::ser::Serialize for TransitEncryptionMode {
2425 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2426 where
2427 S: serde::Serializer,
2428 {
2429 match self {
2430 Self::Unspecified => serializer.serialize_i32(0),
2431 Self::TransitEncryptionDisabled => serializer.serialize_i32(1),
2432 Self::ServerAuthentication => serializer.serialize_i32(2),
2433 Self::UnknownValue(u) => u.0.serialize(serializer),
2434 }
2435 }
2436 }
2437
2438 impl<'de> serde::de::Deserialize<'de> for TransitEncryptionMode {
2439 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2440 where
2441 D: serde::Deserializer<'de>,
2442 {
2443 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransitEncryptionMode>::new(
2444 ".google.cloud.memorystore.v1.Instance.TransitEncryptionMode",
2445 ))
2446 }
2447 }
2448
2449 /// Possible node types of the instance. See
2450 /// <https://cloud.google.com/memorystore/docs/valkey/instance-node-specification>
2451 /// for more information.
2452 ///
2453 /// # Working with unknown values
2454 ///
2455 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2456 /// additional enum variants at any time. Adding new variants is not considered
2457 /// a breaking change. Applications should write their code in anticipation of:
2458 ///
2459 /// - New values appearing in future releases of the client library, **and**
2460 /// - New values received dynamically, without application changes.
2461 ///
2462 /// Please consult the [Working with enums] section in the user guide for some
2463 /// guidelines.
2464 ///
2465 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2466 #[derive(Clone, Debug, PartialEq)]
2467 #[non_exhaustive]
2468 pub enum NodeType {
2469 /// Not set.
2470 Unspecified,
2471 /// Shared core nano.
2472 SharedCoreNano,
2473 /// High memory medium.
2474 HighmemMedium,
2475 /// High memory extra large.
2476 HighmemXlarge,
2477 /// Standard small.
2478 StandardSmall,
2479 /// Custom micro.
2480 CustomMicro,
2481 /// Custom mini.
2482 CustomMini,
2483 /// High cpu medium.
2484 HighcpuMedium,
2485 /// Standard large.
2486 StandardLarge,
2487 /// High memory 2xlarge.
2488 Highmem2Xlarge,
2489 /// Custom pico.
2490 CustomPico,
2491 /// If set, the enum was initialized with an unknown value.
2492 ///
2493 /// Applications can examine the value using [NodeType::value] or
2494 /// [NodeType::name].
2495 UnknownValue(node_type::UnknownValue),
2496 }
2497
2498 #[doc(hidden)]
2499 pub mod node_type {
2500 #[allow(unused_imports)]
2501 use super::*;
2502 #[derive(Clone, Debug, PartialEq)]
2503 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2504 }
2505
2506 impl NodeType {
2507 /// Gets the enum value.
2508 ///
2509 /// Returns `None` if the enum contains an unknown value deserialized from
2510 /// the string representation of enums.
2511 pub fn value(&self) -> std::option::Option<i32> {
2512 match self {
2513 Self::Unspecified => std::option::Option::Some(0),
2514 Self::SharedCoreNano => std::option::Option::Some(1),
2515 Self::HighmemMedium => std::option::Option::Some(2),
2516 Self::HighmemXlarge => std::option::Option::Some(3),
2517 Self::StandardSmall => std::option::Option::Some(4),
2518 Self::CustomMicro => std::option::Option::Some(5),
2519 Self::CustomMini => std::option::Option::Some(6),
2520 Self::HighcpuMedium => std::option::Option::Some(7),
2521 Self::StandardLarge => std::option::Option::Some(8),
2522 Self::Highmem2Xlarge => std::option::Option::Some(9),
2523 Self::CustomPico => std::option::Option::Some(10),
2524 Self::UnknownValue(u) => u.0.value(),
2525 }
2526 }
2527
2528 /// Gets the enum value as a string.
2529 ///
2530 /// Returns `None` if the enum contains an unknown value deserialized from
2531 /// the integer representation of enums.
2532 pub fn name(&self) -> std::option::Option<&str> {
2533 match self {
2534 Self::Unspecified => std::option::Option::Some("NODE_TYPE_UNSPECIFIED"),
2535 Self::SharedCoreNano => std::option::Option::Some("SHARED_CORE_NANO"),
2536 Self::HighmemMedium => std::option::Option::Some("HIGHMEM_MEDIUM"),
2537 Self::HighmemXlarge => std::option::Option::Some("HIGHMEM_XLARGE"),
2538 Self::StandardSmall => std::option::Option::Some("STANDARD_SMALL"),
2539 Self::CustomMicro => std::option::Option::Some("CUSTOM_MICRO"),
2540 Self::CustomMini => std::option::Option::Some("CUSTOM_MINI"),
2541 Self::HighcpuMedium => std::option::Option::Some("HIGHCPU_MEDIUM"),
2542 Self::StandardLarge => std::option::Option::Some("STANDARD_LARGE"),
2543 Self::Highmem2Xlarge => std::option::Option::Some("HIGHMEM_2XLARGE"),
2544 Self::CustomPico => std::option::Option::Some("CUSTOM_PICO"),
2545 Self::UnknownValue(u) => u.0.name(),
2546 }
2547 }
2548 }
2549
2550 impl std::default::Default for NodeType {
2551 fn default() -> Self {
2552 use std::convert::From;
2553 Self::from(0)
2554 }
2555 }
2556
2557 impl std::fmt::Display for NodeType {
2558 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2559 wkt::internal::display_enum(f, self.name(), self.value())
2560 }
2561 }
2562
2563 impl std::convert::From<i32> for NodeType {
2564 fn from(value: i32) -> Self {
2565 match value {
2566 0 => Self::Unspecified,
2567 1 => Self::SharedCoreNano,
2568 2 => Self::HighmemMedium,
2569 3 => Self::HighmemXlarge,
2570 4 => Self::StandardSmall,
2571 5 => Self::CustomMicro,
2572 6 => Self::CustomMini,
2573 7 => Self::HighcpuMedium,
2574 8 => Self::StandardLarge,
2575 9 => Self::Highmem2Xlarge,
2576 10 => Self::CustomPico,
2577 _ => Self::UnknownValue(node_type::UnknownValue(
2578 wkt::internal::UnknownEnumValue::Integer(value),
2579 )),
2580 }
2581 }
2582 }
2583
2584 impl std::convert::From<&str> for NodeType {
2585 fn from(value: &str) -> Self {
2586 use std::string::ToString;
2587 match value {
2588 "NODE_TYPE_UNSPECIFIED" => Self::Unspecified,
2589 "SHARED_CORE_NANO" => Self::SharedCoreNano,
2590 "HIGHMEM_MEDIUM" => Self::HighmemMedium,
2591 "HIGHMEM_XLARGE" => Self::HighmemXlarge,
2592 "STANDARD_SMALL" => Self::StandardSmall,
2593 "CUSTOM_MICRO" => Self::CustomMicro,
2594 "CUSTOM_MINI" => Self::CustomMini,
2595 "HIGHCPU_MEDIUM" => Self::HighcpuMedium,
2596 "STANDARD_LARGE" => Self::StandardLarge,
2597 "HIGHMEM_2XLARGE" => Self::Highmem2Xlarge,
2598 "CUSTOM_PICO" => Self::CustomPico,
2599 _ => Self::UnknownValue(node_type::UnknownValue(
2600 wkt::internal::UnknownEnumValue::String(value.to_string()),
2601 )),
2602 }
2603 }
2604 }
2605
2606 impl serde::ser::Serialize for NodeType {
2607 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2608 where
2609 S: serde::Serializer,
2610 {
2611 match self {
2612 Self::Unspecified => serializer.serialize_i32(0),
2613 Self::SharedCoreNano => serializer.serialize_i32(1),
2614 Self::HighmemMedium => serializer.serialize_i32(2),
2615 Self::HighmemXlarge => serializer.serialize_i32(3),
2616 Self::StandardSmall => serializer.serialize_i32(4),
2617 Self::CustomMicro => serializer.serialize_i32(5),
2618 Self::CustomMini => serializer.serialize_i32(6),
2619 Self::HighcpuMedium => serializer.serialize_i32(7),
2620 Self::StandardLarge => serializer.serialize_i32(8),
2621 Self::Highmem2Xlarge => serializer.serialize_i32(9),
2622 Self::CustomPico => serializer.serialize_i32(10),
2623 Self::UnknownValue(u) => u.0.serialize(serializer),
2624 }
2625 }
2626 }
2627
2628 impl<'de> serde::de::Deserialize<'de> for NodeType {
2629 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2630 where
2631 D: serde::Deserializer<'de>,
2632 {
2633 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NodeType>::new(
2634 ".google.cloud.memorystore.v1.Instance.NodeType",
2635 ))
2636 }
2637 }
2638
2639 /// The mode config, which is used to enable/disable cluster mode.
2640 ///
2641 /// # Working with unknown values
2642 ///
2643 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2644 /// additional enum variants at any time. Adding new variants is not considered
2645 /// a breaking change. Applications should write their code in anticipation of:
2646 ///
2647 /// - New values appearing in future releases of the client library, **and**
2648 /// - New values received dynamically, without application changes.
2649 ///
2650 /// Please consult the [Working with enums] section in the user guide for some
2651 /// guidelines.
2652 ///
2653 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2654 #[derive(Clone, Debug, PartialEq)]
2655 #[non_exhaustive]
2656 pub enum Mode {
2657 /// Mode is not specified.
2658 Unspecified,
2659 /// Deprecated: Use CLUSTER_DISABLED instead.
2660 #[deprecated]
2661 Standalone,
2662 /// Instance is in cluster mode.
2663 Cluster,
2664 /// Cluster mode is disabled for the instance.
2665 ClusterDisabled,
2666 /// If set, the enum was initialized with an unknown value.
2667 ///
2668 /// Applications can examine the value using [Mode::value] or
2669 /// [Mode::name].
2670 UnknownValue(mode::UnknownValue),
2671 }
2672
2673 #[doc(hidden)]
2674 pub mod mode {
2675 #[allow(unused_imports)]
2676 use super::*;
2677 #[derive(Clone, Debug, PartialEq)]
2678 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2679 }
2680
2681 impl Mode {
2682 /// Gets the enum value.
2683 ///
2684 /// Returns `None` if the enum contains an unknown value deserialized from
2685 /// the string representation of enums.
2686 pub fn value(&self) -> std::option::Option<i32> {
2687 match self {
2688 Self::Unspecified => std::option::Option::Some(0),
2689 Self::Standalone => std::option::Option::Some(1),
2690 Self::Cluster => std::option::Option::Some(2),
2691 Self::ClusterDisabled => std::option::Option::Some(4),
2692 Self::UnknownValue(u) => u.0.value(),
2693 }
2694 }
2695
2696 /// Gets the enum value as a string.
2697 ///
2698 /// Returns `None` if the enum contains an unknown value deserialized from
2699 /// the integer representation of enums.
2700 pub fn name(&self) -> std::option::Option<&str> {
2701 match self {
2702 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
2703 Self::Standalone => std::option::Option::Some("STANDALONE"),
2704 Self::Cluster => std::option::Option::Some("CLUSTER"),
2705 Self::ClusterDisabled => std::option::Option::Some("CLUSTER_DISABLED"),
2706 Self::UnknownValue(u) => u.0.name(),
2707 }
2708 }
2709 }
2710
2711 impl std::default::Default for Mode {
2712 fn default() -> Self {
2713 use std::convert::From;
2714 Self::from(0)
2715 }
2716 }
2717
2718 impl std::fmt::Display for Mode {
2719 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2720 wkt::internal::display_enum(f, self.name(), self.value())
2721 }
2722 }
2723
2724 impl std::convert::From<i32> for Mode {
2725 fn from(value: i32) -> Self {
2726 match value {
2727 0 => Self::Unspecified,
2728 1 => Self::Standalone,
2729 2 => Self::Cluster,
2730 4 => Self::ClusterDisabled,
2731 _ => Self::UnknownValue(mode::UnknownValue(
2732 wkt::internal::UnknownEnumValue::Integer(value),
2733 )),
2734 }
2735 }
2736 }
2737
2738 impl std::convert::From<&str> for Mode {
2739 fn from(value: &str) -> Self {
2740 use std::string::ToString;
2741 match value {
2742 "MODE_UNSPECIFIED" => Self::Unspecified,
2743 "STANDALONE" => Self::Standalone,
2744 "CLUSTER" => Self::Cluster,
2745 "CLUSTER_DISABLED" => Self::ClusterDisabled,
2746 _ => Self::UnknownValue(mode::UnknownValue(
2747 wkt::internal::UnknownEnumValue::String(value.to_string()),
2748 )),
2749 }
2750 }
2751 }
2752
2753 impl serde::ser::Serialize for Mode {
2754 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2755 where
2756 S: serde::Serializer,
2757 {
2758 match self {
2759 Self::Unspecified => serializer.serialize_i32(0),
2760 Self::Standalone => serializer.serialize_i32(1),
2761 Self::Cluster => serializer.serialize_i32(2),
2762 Self::ClusterDisabled => serializer.serialize_i32(4),
2763 Self::UnknownValue(u) => u.0.serialize(serializer),
2764 }
2765 }
2766 }
2767
2768 impl<'de> serde::de::Deserialize<'de> for Mode {
2769 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2770 where
2771 D: serde::Deserializer<'de>,
2772 {
2773 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
2774 ".google.cloud.memorystore.v1.Instance.Mode",
2775 ))
2776 }
2777 }
2778
2779 /// The Server CA mode for the instance.
2780 ///
2781 /// # Working with unknown values
2782 ///
2783 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2784 /// additional enum variants at any time. Adding new variants is not considered
2785 /// a breaking change. Applications should write their code in anticipation of:
2786 ///
2787 /// - New values appearing in future releases of the client library, **and**
2788 /// - New values received dynamically, without application changes.
2789 ///
2790 /// Please consult the [Working with enums] section in the user guide for some
2791 /// guidelines.
2792 ///
2793 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2794 #[derive(Clone, Debug, PartialEq)]
2795 #[non_exhaustive]
2796 pub enum ServerCaMode {
2797 /// Server CA mode not specified.
2798 Unspecified,
2799 /// Each instance has its own Google-managed CA.
2800 GoogleManagedPerInstanceCa,
2801 /// The instance uses a Google-managed shared CA for the instance's region.
2802 GoogleManagedSharedCa,
2803 /// The instance uses a customer-managed CA from CAS.
2804 CustomerManagedCasCa,
2805 /// If set, the enum was initialized with an unknown value.
2806 ///
2807 /// Applications can examine the value using [ServerCaMode::value] or
2808 /// [ServerCaMode::name].
2809 UnknownValue(server_ca_mode::UnknownValue),
2810 }
2811
2812 #[doc(hidden)]
2813 pub mod server_ca_mode {
2814 #[allow(unused_imports)]
2815 use super::*;
2816 #[derive(Clone, Debug, PartialEq)]
2817 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2818 }
2819
2820 impl ServerCaMode {
2821 /// Gets the enum value.
2822 ///
2823 /// Returns `None` if the enum contains an unknown value deserialized from
2824 /// the string representation of enums.
2825 pub fn value(&self) -> std::option::Option<i32> {
2826 match self {
2827 Self::Unspecified => std::option::Option::Some(0),
2828 Self::GoogleManagedPerInstanceCa => std::option::Option::Some(1),
2829 Self::GoogleManagedSharedCa => std::option::Option::Some(2),
2830 Self::CustomerManagedCasCa => std::option::Option::Some(3),
2831 Self::UnknownValue(u) => u.0.value(),
2832 }
2833 }
2834
2835 /// Gets the enum value as a string.
2836 ///
2837 /// Returns `None` if the enum contains an unknown value deserialized from
2838 /// the integer representation of enums.
2839 pub fn name(&self) -> std::option::Option<&str> {
2840 match self {
2841 Self::Unspecified => std::option::Option::Some("SERVER_CA_MODE_UNSPECIFIED"),
2842 Self::GoogleManagedPerInstanceCa => {
2843 std::option::Option::Some("GOOGLE_MANAGED_PER_INSTANCE_CA")
2844 }
2845 Self::GoogleManagedSharedCa => {
2846 std::option::Option::Some("GOOGLE_MANAGED_SHARED_CA")
2847 }
2848 Self::CustomerManagedCasCa => std::option::Option::Some("CUSTOMER_MANAGED_CAS_CA"),
2849 Self::UnknownValue(u) => u.0.name(),
2850 }
2851 }
2852 }
2853
2854 impl std::default::Default for ServerCaMode {
2855 fn default() -> Self {
2856 use std::convert::From;
2857 Self::from(0)
2858 }
2859 }
2860
2861 impl std::fmt::Display for ServerCaMode {
2862 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2863 wkt::internal::display_enum(f, self.name(), self.value())
2864 }
2865 }
2866
2867 impl std::convert::From<i32> for ServerCaMode {
2868 fn from(value: i32) -> Self {
2869 match value {
2870 0 => Self::Unspecified,
2871 1 => Self::GoogleManagedPerInstanceCa,
2872 2 => Self::GoogleManagedSharedCa,
2873 3 => Self::CustomerManagedCasCa,
2874 _ => Self::UnknownValue(server_ca_mode::UnknownValue(
2875 wkt::internal::UnknownEnumValue::Integer(value),
2876 )),
2877 }
2878 }
2879 }
2880
2881 impl std::convert::From<&str> for ServerCaMode {
2882 fn from(value: &str) -> Self {
2883 use std::string::ToString;
2884 match value {
2885 "SERVER_CA_MODE_UNSPECIFIED" => Self::Unspecified,
2886 "GOOGLE_MANAGED_PER_INSTANCE_CA" => Self::GoogleManagedPerInstanceCa,
2887 "GOOGLE_MANAGED_SHARED_CA" => Self::GoogleManagedSharedCa,
2888 "CUSTOMER_MANAGED_CAS_CA" => Self::CustomerManagedCasCa,
2889 "SERVER_CA_MODE_GOOGLE_MANAGED_PER_INSTANCE_CA" => Self::GoogleManagedPerInstanceCa,
2890 "SERVER_CA_MODE_GOOGLE_MANAGED_SHARED_CA" => Self::GoogleManagedSharedCa,
2891 "SERVER_CA_MODE_CUSTOMER_MANAGED_CAS_CA" => Self::CustomerManagedCasCa,
2892 _ => Self::UnknownValue(server_ca_mode::UnknownValue(
2893 wkt::internal::UnknownEnumValue::String(value.to_string()),
2894 )),
2895 }
2896 }
2897 }
2898
2899 impl serde::ser::Serialize for ServerCaMode {
2900 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2901 where
2902 S: serde::Serializer,
2903 {
2904 match self {
2905 Self::Unspecified => serializer.serialize_i32(0),
2906 Self::GoogleManagedPerInstanceCa => serializer.serialize_i32(1),
2907 Self::GoogleManagedSharedCa => serializer.serialize_i32(2),
2908 Self::CustomerManagedCasCa => serializer.serialize_i32(3),
2909 Self::UnknownValue(u) => u.0.serialize(serializer),
2910 }
2911 }
2912 }
2913
2914 impl<'de> serde::de::Deserialize<'de> for ServerCaMode {
2915 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2916 where
2917 D: serde::Deserializer<'de>,
2918 {
2919 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServerCaMode>::new(
2920 ".google.cloud.memorystore.v1.Instance.ServerCaMode",
2921 ))
2922 }
2923 }
2924
2925 /// The source to import from.
2926 #[derive(Clone, Debug, PartialEq)]
2927 #[non_exhaustive]
2928 pub enum ImportSources {
2929 /// Optional. Immutable. Backups that stored in Cloud Storage buckets.
2930 /// The Cloud Storage buckets need to be the same region as the instances.
2931 /// Read permission is required to import from the provided Cloud Storage
2932 /// Objects.
2933 GcsSource(std::boxed::Box<crate::model::instance::GcsBackupSource>),
2934 /// Optional. Immutable. Backups that generated and managed by memorystore
2935 /// service.
2936 ManagedBackupSource(std::boxed::Box<crate::model::instance::ManagedBackupSource>),
2937 }
2938}
2939
2940/// Request for `StartMigration`.
2941#[derive(Clone, Default, PartialEq)]
2942#[non_exhaustive]
2943pub struct StartMigrationRequest {
2944 /// Required. The resource name of the instance to start migration on.
2945 /// Format: projects/{project}/locations/{location}/instances/{instance}
2946 pub name: std::string::String,
2947
2948 /// Defines the source of the migration.
2949 pub source: std::option::Option<crate::model::start_migration_request::Source>,
2950
2951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2952}
2953
2954impl StartMigrationRequest {
2955 /// Creates a new default instance.
2956 pub fn new() -> Self {
2957 std::default::Default::default()
2958 }
2959
2960 /// Sets the value of [name][crate::model::StartMigrationRequest::name].
2961 ///
2962 /// # Example
2963 /// ```ignore,no_run
2964 /// # use google_cloud_memorystore_v1::model::StartMigrationRequest;
2965 /// # let project_id = "project_id";
2966 /// # let location_id = "location_id";
2967 /// # let instance_id = "instance_id";
2968 /// let x = StartMigrationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
2969 /// ```
2970 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2971 self.name = v.into();
2972 self
2973 }
2974
2975 /// Sets the value of [source][crate::model::StartMigrationRequest::source].
2976 ///
2977 /// Note that all the setters affecting `source` are mutually
2978 /// exclusive.
2979 ///
2980 /// # Example
2981 /// ```ignore,no_run
2982 /// # use google_cloud_memorystore_v1::model::StartMigrationRequest;
2983 /// use google_cloud_memorystore_v1::model::SelfManagedSource;
2984 /// let x = StartMigrationRequest::new().set_source(Some(
2985 /// google_cloud_memorystore_v1::model::start_migration_request::Source::SelfManagedSource(SelfManagedSource::default().into())));
2986 /// ```
2987 pub fn set_source<
2988 T: std::convert::Into<std::option::Option<crate::model::start_migration_request::Source>>,
2989 >(
2990 mut self,
2991 v: T,
2992 ) -> Self {
2993 self.source = v.into();
2994 self
2995 }
2996
2997 /// The value of [source][crate::model::StartMigrationRequest::source]
2998 /// if it holds a `SelfManagedSource`, `None` if the field is not set or
2999 /// holds a different branch.
3000 pub fn self_managed_source(
3001 &self,
3002 ) -> std::option::Option<&std::boxed::Box<crate::model::SelfManagedSource>> {
3003 #[allow(unreachable_patterns)]
3004 self.source.as_ref().and_then(|v| match v {
3005 crate::model::start_migration_request::Source::SelfManagedSource(v) => {
3006 std::option::Option::Some(v)
3007 }
3008 _ => std::option::Option::None,
3009 })
3010 }
3011
3012 /// Sets the value of [source][crate::model::StartMigrationRequest::source]
3013 /// to hold a `SelfManagedSource`.
3014 ///
3015 /// Note that all the setters affecting `source` are
3016 /// mutually exclusive.
3017 ///
3018 /// # Example
3019 /// ```ignore,no_run
3020 /// # use google_cloud_memorystore_v1::model::StartMigrationRequest;
3021 /// use google_cloud_memorystore_v1::model::SelfManagedSource;
3022 /// let x = StartMigrationRequest::new().set_self_managed_source(SelfManagedSource::default()/* use setters */);
3023 /// assert!(x.self_managed_source().is_some());
3024 /// ```
3025 pub fn set_self_managed_source<
3026 T: std::convert::Into<std::boxed::Box<crate::model::SelfManagedSource>>,
3027 >(
3028 mut self,
3029 v: T,
3030 ) -> Self {
3031 self.source = std::option::Option::Some(
3032 crate::model::start_migration_request::Source::SelfManagedSource(v.into()),
3033 );
3034 self
3035 }
3036}
3037
3038impl wkt::message::Message for StartMigrationRequest {
3039 fn typename() -> &'static str {
3040 "type.googleapis.com/google.cloud.memorystore.v1.StartMigrationRequest"
3041 }
3042}
3043
3044/// Defines additional types related to [StartMigrationRequest].
3045pub mod start_migration_request {
3046 #[allow(unused_imports)]
3047 use super::*;
3048
3049 /// Defines the source of the migration.
3050 #[derive(Clone, Debug, PartialEq)]
3051 #[non_exhaustive]
3052 pub enum Source {
3053 /// Required. Configuration for migrating from a self-managed Valkey/Redis
3054 /// instance
3055 SelfManagedSource(std::boxed::Box<crate::model::SelfManagedSource>),
3056 }
3057}
3058
3059/// Request for `FinishMigration`.
3060#[derive(Clone, Default, PartialEq)]
3061#[non_exhaustive]
3062pub struct FinishMigrationRequest {
3063 /// Required. The resource name of the instance to finalize migration on.
3064 /// Format: projects/{project}/locations/{location}/instances/{instance}
3065 pub name: std::string::String,
3066
3067 /// Optional. By default, the `FinishMigration` operation ensures the target
3068 /// replication offset to catch up to the source offset as of the time of the
3069 /// call. Set this field to `true` to bypass this offset verification check.
3070 pub force: bool,
3071
3072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3073}
3074
3075impl FinishMigrationRequest {
3076 /// Creates a new default instance.
3077 pub fn new() -> Self {
3078 std::default::Default::default()
3079 }
3080
3081 /// Sets the value of [name][crate::model::FinishMigrationRequest::name].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_memorystore_v1::model::FinishMigrationRequest;
3086 /// # let project_id = "project_id";
3087 /// # let location_id = "location_id";
3088 /// # let instance_id = "instance_id";
3089 /// let x = FinishMigrationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3090 /// ```
3091 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3092 self.name = v.into();
3093 self
3094 }
3095
3096 /// Sets the value of [force][crate::model::FinishMigrationRequest::force].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_memorystore_v1::model::FinishMigrationRequest;
3101 /// let x = FinishMigrationRequest::new().set_force(true);
3102 /// ```
3103 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3104 self.force = v.into();
3105 self
3106 }
3107}
3108
3109impl wkt::message::Message for FinishMigrationRequest {
3110 fn typename() -> &'static str {
3111 "type.googleapis.com/google.cloud.memorystore.v1.FinishMigrationRequest"
3112 }
3113}
3114
3115/// Details of the self-managed source instance.
3116#[derive(Clone, Default, PartialEq)]
3117#[non_exhaustive]
3118pub struct SelfManagedSource {
3119 /// Required. The IP address of the source instance.
3120 /// This IP address should be a stable IP address that can be accessed by the
3121 /// Memorystore instance throughout the migration process.
3122 pub ip_address: std::string::String,
3123
3124 /// Required. The port of the source instance.
3125 /// This port should be a stable port that can be accessed by the Memorystore
3126 /// instance throughout the migration process.
3127 pub port: i32,
3128
3129 /// Required. The resource name of the Private Service Connect Network
3130 /// Attachment used to establish connectivity to the source instance. This
3131 /// network attachment has the following requirements:
3132 ///
3133 /// 1. It must be in the same project as the Memorystore instance.
3134 /// 1. It must be in the same region as the Memorystore instance.
3135 /// 1. The subnet attached to the network attachment must be in the same VPC
3136 /// network as the source instance nodes.
3137 ///
3138 /// Format:
3139 /// projects/{project}/regions/{region}/networkAttachments/{network_attachment}
3140 pub network_attachment: std::string::String,
3141
3142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3143}
3144
3145impl SelfManagedSource {
3146 /// Creates a new default instance.
3147 pub fn new() -> Self {
3148 std::default::Default::default()
3149 }
3150
3151 /// Sets the value of [ip_address][crate::model::SelfManagedSource::ip_address].
3152 ///
3153 /// # Example
3154 /// ```ignore,no_run
3155 /// # use google_cloud_memorystore_v1::model::SelfManagedSource;
3156 /// let x = SelfManagedSource::new().set_ip_address("example");
3157 /// ```
3158 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3159 self.ip_address = v.into();
3160 self
3161 }
3162
3163 /// Sets the value of [port][crate::model::SelfManagedSource::port].
3164 ///
3165 /// # Example
3166 /// ```ignore,no_run
3167 /// # use google_cloud_memorystore_v1::model::SelfManagedSource;
3168 /// let x = SelfManagedSource::new().set_port(42);
3169 /// ```
3170 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3171 self.port = v.into();
3172 self
3173 }
3174
3175 /// Sets the value of [network_attachment][crate::model::SelfManagedSource::network_attachment].
3176 ///
3177 /// # Example
3178 /// ```ignore,no_run
3179 /// # use google_cloud_memorystore_v1::model::SelfManagedSource;
3180 /// let x = SelfManagedSource::new().set_network_attachment("example");
3181 /// ```
3182 pub fn set_network_attachment<T: std::convert::Into<std::string::String>>(
3183 mut self,
3184 v: T,
3185 ) -> Self {
3186 self.network_attachment = v.into();
3187 self
3188 }
3189}
3190
3191impl wkt::message::Message for SelfManagedSource {
3192 fn typename() -> &'static str {
3193 "type.googleapis.com/google.cloud.memorystore.v1.SelfManagedSource"
3194 }
3195}
3196
3197/// Configuration for the migration of an instance.
3198#[derive(Clone, Default, PartialEq)]
3199#[non_exhaustive]
3200pub struct MigrationConfig {
3201 /// Output only. Migration state of the instance.
3202 pub state: crate::model::migration_config::State,
3203
3204 /// Output only. Represents a boolean flag to force migration finalization
3205 /// without offset catch up validation between source and target before
3206 /// stopping replication.
3207 pub force_finish_migration: bool,
3208
3209 /// Details about the migration source.
3210 pub source: std::option::Option<crate::model::migration_config::Source>,
3211
3212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3213}
3214
3215impl MigrationConfig {
3216 /// Creates a new default instance.
3217 pub fn new() -> Self {
3218 std::default::Default::default()
3219 }
3220
3221 /// Sets the value of [state][crate::model::MigrationConfig::state].
3222 ///
3223 /// # Example
3224 /// ```ignore,no_run
3225 /// # use google_cloud_memorystore_v1::model::MigrationConfig;
3226 /// use google_cloud_memorystore_v1::model::migration_config::State;
3227 /// let x0 = MigrationConfig::new().set_state(State::RolledBack);
3228 /// let x1 = MigrationConfig::new().set_state(State::RollingBack);
3229 /// let x2 = MigrationConfig::new().set_state(State::ReplicationEstablished);
3230 /// ```
3231 pub fn set_state<T: std::convert::Into<crate::model::migration_config::State>>(
3232 mut self,
3233 v: T,
3234 ) -> Self {
3235 self.state = v.into();
3236 self
3237 }
3238
3239 /// Sets the value of [force_finish_migration][crate::model::MigrationConfig::force_finish_migration].
3240 ///
3241 /// # Example
3242 /// ```ignore,no_run
3243 /// # use google_cloud_memorystore_v1::model::MigrationConfig;
3244 /// let x = MigrationConfig::new().set_force_finish_migration(true);
3245 /// ```
3246 pub fn set_force_finish_migration<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3247 self.force_finish_migration = v.into();
3248 self
3249 }
3250
3251 /// Sets the value of [source][crate::model::MigrationConfig::source].
3252 ///
3253 /// Note that all the setters affecting `source` are mutually
3254 /// exclusive.
3255 ///
3256 /// # Example
3257 /// ```ignore,no_run
3258 /// # use google_cloud_memorystore_v1::model::MigrationConfig;
3259 /// use google_cloud_memorystore_v1::model::SelfManagedSource;
3260 /// let x = MigrationConfig::new().set_source(Some(
3261 /// google_cloud_memorystore_v1::model::migration_config::Source::SelfManagedSource(SelfManagedSource::default().into())));
3262 /// ```
3263 pub fn set_source<
3264 T: std::convert::Into<std::option::Option<crate::model::migration_config::Source>>,
3265 >(
3266 mut self,
3267 v: T,
3268 ) -> Self {
3269 self.source = v.into();
3270 self
3271 }
3272
3273 /// The value of [source][crate::model::MigrationConfig::source]
3274 /// if it holds a `SelfManagedSource`, `None` if the field is not set or
3275 /// holds a different branch.
3276 pub fn self_managed_source(
3277 &self,
3278 ) -> std::option::Option<&std::boxed::Box<crate::model::SelfManagedSource>> {
3279 #[allow(unreachable_patterns)]
3280 self.source.as_ref().and_then(|v| match v {
3281 crate::model::migration_config::Source::SelfManagedSource(v) => {
3282 std::option::Option::Some(v)
3283 }
3284 _ => std::option::Option::None,
3285 })
3286 }
3287
3288 /// Sets the value of [source][crate::model::MigrationConfig::source]
3289 /// to hold a `SelfManagedSource`.
3290 ///
3291 /// Note that all the setters affecting `source` are
3292 /// mutually exclusive.
3293 ///
3294 /// # Example
3295 /// ```ignore,no_run
3296 /// # use google_cloud_memorystore_v1::model::MigrationConfig;
3297 /// use google_cloud_memorystore_v1::model::SelfManagedSource;
3298 /// let x = MigrationConfig::new().set_self_managed_source(SelfManagedSource::default()/* use setters */);
3299 /// assert!(x.self_managed_source().is_some());
3300 /// ```
3301 pub fn set_self_managed_source<
3302 T: std::convert::Into<std::boxed::Box<crate::model::SelfManagedSource>>,
3303 >(
3304 mut self,
3305 v: T,
3306 ) -> Self {
3307 self.source = std::option::Option::Some(
3308 crate::model::migration_config::Source::SelfManagedSource(v.into()),
3309 );
3310 self
3311 }
3312}
3313
3314impl wkt::message::Message for MigrationConfig {
3315 fn typename() -> &'static str {
3316 "type.googleapis.com/google.cloud.memorystore.v1.MigrationConfig"
3317 }
3318}
3319
3320/// Defines additional types related to [MigrationConfig].
3321pub mod migration_config {
3322 #[allow(unused_imports)]
3323 use super::*;
3324
3325 /// Migration state of the instance.
3326 /// New values may be added in the future.
3327 ///
3328 /// # Working with unknown values
3329 ///
3330 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3331 /// additional enum variants at any time. Adding new variants is not considered
3332 /// a breaking change. Applications should write their code in anticipation of:
3333 ///
3334 /// - New values appearing in future releases of the client library, **and**
3335 /// - New values received dynamically, without application changes.
3336 ///
3337 /// Please consult the [Working with enums] section in the user guide for some
3338 /// guidelines.
3339 ///
3340 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3341 #[derive(Clone, Debug, PartialEq)]
3342 #[non_exhaustive]
3343 pub enum State {
3344 /// Instance has no migration related activity. This is the initial state.
3345 Unspecified,
3346 /// Instance is not currently migrating. The instance underwent a migration
3347 /// attempt that failed, and the subsequent rollback was successful. The
3348 /// instance is now ready for a new migration attempt if desired.
3349 RolledBack,
3350 /// Indicates a previous migration attempt failed. The high-level instance
3351 /// state will be `MIGRATING`. The instance is not ready for a new migration
3352 /// attempt. Rollback is in progress to restore the instance to its original
3353 /// state. The instance will remain in this state until rollback is
3354 /// successful.
3355 RollingBack,
3356 /// Instance is in the process of migration. Instance has established
3357 /// successful replication and is ready for cutover.
3358 ReplicationEstablished,
3359 /// Instance is successfully migrated.
3360 Migrated,
3361 /// If set, the enum was initialized with an unknown value.
3362 ///
3363 /// Applications can examine the value using [State::value] or
3364 /// [State::name].
3365 UnknownValue(state::UnknownValue),
3366 }
3367
3368 #[doc(hidden)]
3369 pub mod state {
3370 #[allow(unused_imports)]
3371 use super::*;
3372 #[derive(Clone, Debug, PartialEq)]
3373 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3374 }
3375
3376 impl State {
3377 /// Gets the enum value.
3378 ///
3379 /// Returns `None` if the enum contains an unknown value deserialized from
3380 /// the string representation of enums.
3381 pub fn value(&self) -> std::option::Option<i32> {
3382 match self {
3383 Self::Unspecified => std::option::Option::Some(0),
3384 Self::RolledBack => std::option::Option::Some(1),
3385 Self::RollingBack => std::option::Option::Some(5),
3386 Self::ReplicationEstablished => std::option::Option::Some(6),
3387 Self::Migrated => std::option::Option::Some(4),
3388 Self::UnknownValue(u) => u.0.value(),
3389 }
3390 }
3391
3392 /// Gets the enum value as a string.
3393 ///
3394 /// Returns `None` if the enum contains an unknown value deserialized from
3395 /// the integer representation of enums.
3396 pub fn name(&self) -> std::option::Option<&str> {
3397 match self {
3398 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3399 Self::RolledBack => std::option::Option::Some("ROLLED_BACK"),
3400 Self::RollingBack => std::option::Option::Some("ROLLING_BACK"),
3401 Self::ReplicationEstablished => {
3402 std::option::Option::Some("REPLICATION_ESTABLISHED")
3403 }
3404 Self::Migrated => std::option::Option::Some("MIGRATED"),
3405 Self::UnknownValue(u) => u.0.name(),
3406 }
3407 }
3408 }
3409
3410 impl std::default::Default for State {
3411 fn default() -> Self {
3412 use std::convert::From;
3413 Self::from(0)
3414 }
3415 }
3416
3417 impl std::fmt::Display for State {
3418 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3419 wkt::internal::display_enum(f, self.name(), self.value())
3420 }
3421 }
3422
3423 impl std::convert::From<i32> for State {
3424 fn from(value: i32) -> Self {
3425 match value {
3426 0 => Self::Unspecified,
3427 1 => Self::RolledBack,
3428 4 => Self::Migrated,
3429 5 => Self::RollingBack,
3430 6 => Self::ReplicationEstablished,
3431 _ => Self::UnknownValue(state::UnknownValue(
3432 wkt::internal::UnknownEnumValue::Integer(value),
3433 )),
3434 }
3435 }
3436 }
3437
3438 impl std::convert::From<&str> for State {
3439 fn from(value: &str) -> Self {
3440 use std::string::ToString;
3441 match value {
3442 "STATE_UNSPECIFIED" => Self::Unspecified,
3443 "ROLLED_BACK" => Self::RolledBack,
3444 "ROLLING_BACK" => Self::RollingBack,
3445 "REPLICATION_ESTABLISHED" => Self::ReplicationEstablished,
3446 "MIGRATED" => Self::Migrated,
3447 _ => Self::UnknownValue(state::UnknownValue(
3448 wkt::internal::UnknownEnumValue::String(value.to_string()),
3449 )),
3450 }
3451 }
3452 }
3453
3454 impl serde::ser::Serialize for State {
3455 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3456 where
3457 S: serde::Serializer,
3458 {
3459 match self {
3460 Self::Unspecified => serializer.serialize_i32(0),
3461 Self::RolledBack => serializer.serialize_i32(1),
3462 Self::RollingBack => serializer.serialize_i32(5),
3463 Self::ReplicationEstablished => serializer.serialize_i32(6),
3464 Self::Migrated => serializer.serialize_i32(4),
3465 Self::UnknownValue(u) => u.0.serialize(serializer),
3466 }
3467 }
3468 }
3469
3470 impl<'de> serde::de::Deserialize<'de> for State {
3471 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3472 where
3473 D: serde::Deserializer<'de>,
3474 {
3475 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3476 ".google.cloud.memorystore.v1.MigrationConfig.State",
3477 ))
3478 }
3479 }
3480
3481 /// Details about the migration source.
3482 #[derive(Clone, Debug, PartialEq)]
3483 #[non_exhaustive]
3484 pub enum Source {
3485 /// Output only. Configuration for migrating from a self-managed Valkey/Redis
3486 /// instance
3487 SelfManagedSource(std::boxed::Box<crate::model::SelfManagedSource>),
3488 }
3489}
3490
3491/// The automated backup config for an instance.
3492#[derive(Clone, Default, PartialEq)]
3493#[non_exhaustive]
3494pub struct AutomatedBackupConfig {
3495 /// Optional. The automated backup mode. If the mode is disabled, the other
3496 /// fields will be ignored.
3497 pub automated_backup_mode: crate::model::automated_backup_config::AutomatedBackupMode,
3498
3499 /// Optional. How long to keep automated backups before the backups are
3500 /// deleted. The value should be between 1 day and 365 days. If not specified,
3501 /// the default value is 35 days.
3502 pub retention: std::option::Option<wkt::Duration>,
3503
3504 /// The schedule of automated backups.
3505 pub schedule: std::option::Option<crate::model::automated_backup_config::Schedule>,
3506
3507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3508}
3509
3510impl AutomatedBackupConfig {
3511 /// Creates a new default instance.
3512 pub fn new() -> Self {
3513 std::default::Default::default()
3514 }
3515
3516 /// Sets the value of [automated_backup_mode][crate::model::AutomatedBackupConfig::automated_backup_mode].
3517 ///
3518 /// # Example
3519 /// ```ignore,no_run
3520 /// # use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
3521 /// use google_cloud_memorystore_v1::model::automated_backup_config::AutomatedBackupMode;
3522 /// let x0 = AutomatedBackupConfig::new().set_automated_backup_mode(AutomatedBackupMode::Disabled);
3523 /// let x1 = AutomatedBackupConfig::new().set_automated_backup_mode(AutomatedBackupMode::Enabled);
3524 /// ```
3525 pub fn set_automated_backup_mode<
3526 T: std::convert::Into<crate::model::automated_backup_config::AutomatedBackupMode>,
3527 >(
3528 mut self,
3529 v: T,
3530 ) -> Self {
3531 self.automated_backup_mode = v.into();
3532 self
3533 }
3534
3535 /// Sets the value of [retention][crate::model::AutomatedBackupConfig::retention].
3536 ///
3537 /// # Example
3538 /// ```ignore,no_run
3539 /// # use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
3540 /// use wkt::Duration;
3541 /// let x = AutomatedBackupConfig::new().set_retention(Duration::default()/* use setters */);
3542 /// ```
3543 pub fn set_retention<T>(mut self, v: T) -> Self
3544 where
3545 T: std::convert::Into<wkt::Duration>,
3546 {
3547 self.retention = std::option::Option::Some(v.into());
3548 self
3549 }
3550
3551 /// Sets or clears the value of [retention][crate::model::AutomatedBackupConfig::retention].
3552 ///
3553 /// # Example
3554 /// ```ignore,no_run
3555 /// # use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
3556 /// use wkt::Duration;
3557 /// let x = AutomatedBackupConfig::new().set_or_clear_retention(Some(Duration::default()/* use setters */));
3558 /// let x = AutomatedBackupConfig::new().set_or_clear_retention(None::<Duration>);
3559 /// ```
3560 pub fn set_or_clear_retention<T>(mut self, v: std::option::Option<T>) -> Self
3561 where
3562 T: std::convert::Into<wkt::Duration>,
3563 {
3564 self.retention = v.map(|x| x.into());
3565 self
3566 }
3567
3568 /// Sets the value of [schedule][crate::model::AutomatedBackupConfig::schedule].
3569 ///
3570 /// Note that all the setters affecting `schedule` are mutually
3571 /// exclusive.
3572 ///
3573 /// # Example
3574 /// ```ignore,no_run
3575 /// # use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
3576 /// use google_cloud_memorystore_v1::model::automated_backup_config::FixedFrequencySchedule;
3577 /// let x = AutomatedBackupConfig::new().set_schedule(Some(
3578 /// google_cloud_memorystore_v1::model::automated_backup_config::Schedule::FixedFrequencySchedule(FixedFrequencySchedule::default().into())));
3579 /// ```
3580 pub fn set_schedule<
3581 T: std::convert::Into<std::option::Option<crate::model::automated_backup_config::Schedule>>,
3582 >(
3583 mut self,
3584 v: T,
3585 ) -> Self {
3586 self.schedule = v.into();
3587 self
3588 }
3589
3590 /// The value of [schedule][crate::model::AutomatedBackupConfig::schedule]
3591 /// if it holds a `FixedFrequencySchedule`, `None` if the field is not set or
3592 /// holds a different branch.
3593 pub fn fixed_frequency_schedule(
3594 &self,
3595 ) -> std::option::Option<
3596 &std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
3597 > {
3598 #[allow(unreachable_patterns)]
3599 self.schedule.as_ref().and_then(|v| match v {
3600 crate::model::automated_backup_config::Schedule::FixedFrequencySchedule(v) => {
3601 std::option::Option::Some(v)
3602 }
3603 _ => std::option::Option::None,
3604 })
3605 }
3606
3607 /// Sets the value of [schedule][crate::model::AutomatedBackupConfig::schedule]
3608 /// to hold a `FixedFrequencySchedule`.
3609 ///
3610 /// Note that all the setters affecting `schedule` are
3611 /// mutually exclusive.
3612 ///
3613 /// # Example
3614 /// ```ignore,no_run
3615 /// # use google_cloud_memorystore_v1::model::AutomatedBackupConfig;
3616 /// use google_cloud_memorystore_v1::model::automated_backup_config::FixedFrequencySchedule;
3617 /// let x = AutomatedBackupConfig::new().set_fixed_frequency_schedule(FixedFrequencySchedule::default()/* use setters */);
3618 /// assert!(x.fixed_frequency_schedule().is_some());
3619 /// ```
3620 pub fn set_fixed_frequency_schedule<
3621 T: std::convert::Into<
3622 std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
3623 >,
3624 >(
3625 mut self,
3626 v: T,
3627 ) -> Self {
3628 self.schedule = std::option::Option::Some(
3629 crate::model::automated_backup_config::Schedule::FixedFrequencySchedule(v.into()),
3630 );
3631 self
3632 }
3633}
3634
3635impl wkt::message::Message for AutomatedBackupConfig {
3636 fn typename() -> &'static str {
3637 "type.googleapis.com/google.cloud.memorystore.v1.AutomatedBackupConfig"
3638 }
3639}
3640
3641/// Defines additional types related to [AutomatedBackupConfig].
3642pub mod automated_backup_config {
3643 #[allow(unused_imports)]
3644 use super::*;
3645
3646 /// This schedule allows the backup to be triggered at a fixed frequency
3647 /// (currently only daily is supported).
3648 #[derive(Clone, Default, PartialEq)]
3649 #[non_exhaustive]
3650 pub struct FixedFrequencySchedule {
3651 /// Required. The start time of every automated backup in UTC. It must be set
3652 /// to the start of an hour. This field is required.
3653 pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
3654
3655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3656 }
3657
3658 impl FixedFrequencySchedule {
3659 /// Creates a new default instance.
3660 pub fn new() -> Self {
3661 std::default::Default::default()
3662 }
3663
3664 /// Sets the value of [start_time][crate::model::automated_backup_config::FixedFrequencySchedule::start_time].
3665 ///
3666 /// # Example
3667 /// ```ignore,no_run
3668 /// # use google_cloud_memorystore_v1::model::automated_backup_config::FixedFrequencySchedule;
3669 /// use google_cloud_type::model::TimeOfDay;
3670 /// let x = FixedFrequencySchedule::new().set_start_time(TimeOfDay::default()/* use setters */);
3671 /// ```
3672 pub fn set_start_time<T>(mut self, v: T) -> Self
3673 where
3674 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
3675 {
3676 self.start_time = std::option::Option::Some(v.into());
3677 self
3678 }
3679
3680 /// Sets or clears the value of [start_time][crate::model::automated_backup_config::FixedFrequencySchedule::start_time].
3681 ///
3682 /// # Example
3683 /// ```ignore,no_run
3684 /// # use google_cloud_memorystore_v1::model::automated_backup_config::FixedFrequencySchedule;
3685 /// use google_cloud_type::model::TimeOfDay;
3686 /// let x = FixedFrequencySchedule::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
3687 /// let x = FixedFrequencySchedule::new().set_or_clear_start_time(None::<TimeOfDay>);
3688 /// ```
3689 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3690 where
3691 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
3692 {
3693 self.start_time = v.map(|x| x.into());
3694 self
3695 }
3696 }
3697
3698 impl wkt::message::Message for FixedFrequencySchedule {
3699 fn typename() -> &'static str {
3700 "type.googleapis.com/google.cloud.memorystore.v1.AutomatedBackupConfig.FixedFrequencySchedule"
3701 }
3702 }
3703
3704 /// The automated backup mode.
3705 ///
3706 /// # Working with unknown values
3707 ///
3708 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3709 /// additional enum variants at any time. Adding new variants is not considered
3710 /// a breaking change. Applications should write their code in anticipation of:
3711 ///
3712 /// - New values appearing in future releases of the client library, **and**
3713 /// - New values received dynamically, without application changes.
3714 ///
3715 /// Please consult the [Working with enums] section in the user guide for some
3716 /// guidelines.
3717 ///
3718 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3719 #[derive(Clone, Debug, PartialEq)]
3720 #[non_exhaustive]
3721 pub enum AutomatedBackupMode {
3722 /// Default value. Automated backup config is not specified.
3723 Unspecified,
3724 /// Automated backup config disabled.
3725 Disabled,
3726 /// Automated backup config enabled.
3727 Enabled,
3728 /// If set, the enum was initialized with an unknown value.
3729 ///
3730 /// Applications can examine the value using [AutomatedBackupMode::value] or
3731 /// [AutomatedBackupMode::name].
3732 UnknownValue(automated_backup_mode::UnknownValue),
3733 }
3734
3735 #[doc(hidden)]
3736 pub mod automated_backup_mode {
3737 #[allow(unused_imports)]
3738 use super::*;
3739 #[derive(Clone, Debug, PartialEq)]
3740 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3741 }
3742
3743 impl AutomatedBackupMode {
3744 /// Gets the enum value.
3745 ///
3746 /// Returns `None` if the enum contains an unknown value deserialized from
3747 /// the string representation of enums.
3748 pub fn value(&self) -> std::option::Option<i32> {
3749 match self {
3750 Self::Unspecified => std::option::Option::Some(0),
3751 Self::Disabled => std::option::Option::Some(1),
3752 Self::Enabled => std::option::Option::Some(2),
3753 Self::UnknownValue(u) => u.0.value(),
3754 }
3755 }
3756
3757 /// Gets the enum value as a string.
3758 ///
3759 /// Returns `None` if the enum contains an unknown value deserialized from
3760 /// the integer representation of enums.
3761 pub fn name(&self) -> std::option::Option<&str> {
3762 match self {
3763 Self::Unspecified => std::option::Option::Some("AUTOMATED_BACKUP_MODE_UNSPECIFIED"),
3764 Self::Disabled => std::option::Option::Some("DISABLED"),
3765 Self::Enabled => std::option::Option::Some("ENABLED"),
3766 Self::UnknownValue(u) => u.0.name(),
3767 }
3768 }
3769 }
3770
3771 impl std::default::Default for AutomatedBackupMode {
3772 fn default() -> Self {
3773 use std::convert::From;
3774 Self::from(0)
3775 }
3776 }
3777
3778 impl std::fmt::Display for AutomatedBackupMode {
3779 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3780 wkt::internal::display_enum(f, self.name(), self.value())
3781 }
3782 }
3783
3784 impl std::convert::From<i32> for AutomatedBackupMode {
3785 fn from(value: i32) -> Self {
3786 match value {
3787 0 => Self::Unspecified,
3788 1 => Self::Disabled,
3789 2 => Self::Enabled,
3790 _ => Self::UnknownValue(automated_backup_mode::UnknownValue(
3791 wkt::internal::UnknownEnumValue::Integer(value),
3792 )),
3793 }
3794 }
3795 }
3796
3797 impl std::convert::From<&str> for AutomatedBackupMode {
3798 fn from(value: &str) -> Self {
3799 use std::string::ToString;
3800 match value {
3801 "AUTOMATED_BACKUP_MODE_UNSPECIFIED" => Self::Unspecified,
3802 "DISABLED" => Self::Disabled,
3803 "ENABLED" => Self::Enabled,
3804 _ => Self::UnknownValue(automated_backup_mode::UnknownValue(
3805 wkt::internal::UnknownEnumValue::String(value.to_string()),
3806 )),
3807 }
3808 }
3809 }
3810
3811 impl serde::ser::Serialize for AutomatedBackupMode {
3812 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3813 where
3814 S: serde::Serializer,
3815 {
3816 match self {
3817 Self::Unspecified => serializer.serialize_i32(0),
3818 Self::Disabled => serializer.serialize_i32(1),
3819 Self::Enabled => serializer.serialize_i32(2),
3820 Self::UnknownValue(u) => u.0.serialize(serializer),
3821 }
3822 }
3823 }
3824
3825 impl<'de> serde::de::Deserialize<'de> for AutomatedBackupMode {
3826 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3827 where
3828 D: serde::Deserializer<'de>,
3829 {
3830 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AutomatedBackupMode>::new(
3831 ".google.cloud.memorystore.v1.AutomatedBackupConfig.AutomatedBackupMode",
3832 ))
3833 }
3834 }
3835
3836 /// The schedule of automated backups.
3837 #[derive(Clone, Debug, PartialEq)]
3838 #[non_exhaustive]
3839 pub enum Schedule {
3840 /// Optional. Trigger automated backups at a fixed frequency.
3841 FixedFrequencySchedule(
3842 std::boxed::Box<crate::model::automated_backup_config::FixedFrequencySchedule>,
3843 ),
3844 }
3845}
3846
3847/// BackupCollection of an instance.
3848#[derive(Clone, Default, PartialEq)]
3849#[non_exhaustive]
3850pub struct BackupCollection {
3851 /// Identifier. Full resource path of the backup collection.
3852 pub name: std::string::String,
3853
3854 /// Output only. The instance uid of the backup collection.
3855 pub instance_uid: std::string::String,
3856
3857 /// Output only. The full resource path of the instance the backup collection
3858 /// belongs to. Example:
3859 /// projects/{project}/locations/{location}/instances/{instance}
3860 pub instance: std::string::String,
3861
3862 /// Output only. The KMS key used to encrypt the backups under this backup
3863 /// collection.
3864 pub kms_key: std::string::String,
3865
3866 /// Output only. System assigned unique identifier of the backup collection.
3867 pub uid: std::string::String,
3868
3869 /// Output only. The time when the backup collection was created.
3870 pub create_time: std::option::Option<wkt::Timestamp>,
3871
3872 /// Output only. Total size of all backups in the backup collection.
3873 pub total_backup_size_bytes: i64,
3874
3875 /// Output only. Total number of backups in the backup collection.
3876 pub total_backup_count: i64,
3877
3878 /// Output only. The last time a backup was created in the backup collection.
3879 pub last_backup_time: std::option::Option<wkt::Timestamp>,
3880
3881 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3882}
3883
3884impl BackupCollection {
3885 /// Creates a new default instance.
3886 pub fn new() -> Self {
3887 std::default::Default::default()
3888 }
3889
3890 /// Sets the value of [name][crate::model::BackupCollection::name].
3891 ///
3892 /// # Example
3893 /// ```ignore,no_run
3894 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3895 /// # let project_id = "project_id";
3896 /// # let location_id = "location_id";
3897 /// # let backup_collection_id = "backup_collection_id";
3898 /// let x = BackupCollection::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"));
3899 /// ```
3900 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3901 self.name = v.into();
3902 self
3903 }
3904
3905 /// Sets the value of [instance_uid][crate::model::BackupCollection::instance_uid].
3906 ///
3907 /// # Example
3908 /// ```ignore,no_run
3909 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3910 /// let x = BackupCollection::new().set_instance_uid("example");
3911 /// ```
3912 pub fn set_instance_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3913 self.instance_uid = v.into();
3914 self
3915 }
3916
3917 /// Sets the value of [instance][crate::model::BackupCollection::instance].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3922 /// # let project_id = "project_id";
3923 /// # let location_id = "location_id";
3924 /// # let instance_id = "instance_id";
3925 /// let x = BackupCollection::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
3926 /// ```
3927 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3928 self.instance = v.into();
3929 self
3930 }
3931
3932 /// Sets the value of [kms_key][crate::model::BackupCollection::kms_key].
3933 ///
3934 /// # Example
3935 /// ```ignore,no_run
3936 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3937 /// let x = BackupCollection::new().set_kms_key("example");
3938 /// ```
3939 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3940 self.kms_key = v.into();
3941 self
3942 }
3943
3944 /// Sets the value of [uid][crate::model::BackupCollection::uid].
3945 ///
3946 /// # Example
3947 /// ```ignore,no_run
3948 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3949 /// let x = BackupCollection::new().set_uid("example");
3950 /// ```
3951 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3952 self.uid = v.into();
3953 self
3954 }
3955
3956 /// Sets the value of [create_time][crate::model::BackupCollection::create_time].
3957 ///
3958 /// # Example
3959 /// ```ignore,no_run
3960 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3961 /// use wkt::Timestamp;
3962 /// let x = BackupCollection::new().set_create_time(Timestamp::default()/* use setters */);
3963 /// ```
3964 pub fn set_create_time<T>(mut self, v: T) -> Self
3965 where
3966 T: std::convert::Into<wkt::Timestamp>,
3967 {
3968 self.create_time = std::option::Option::Some(v.into());
3969 self
3970 }
3971
3972 /// Sets or clears the value of [create_time][crate::model::BackupCollection::create_time].
3973 ///
3974 /// # Example
3975 /// ```ignore,no_run
3976 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3977 /// use wkt::Timestamp;
3978 /// let x = BackupCollection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3979 /// let x = BackupCollection::new().set_or_clear_create_time(None::<Timestamp>);
3980 /// ```
3981 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3982 where
3983 T: std::convert::Into<wkt::Timestamp>,
3984 {
3985 self.create_time = v.map(|x| x.into());
3986 self
3987 }
3988
3989 /// Sets the value of [total_backup_size_bytes][crate::model::BackupCollection::total_backup_size_bytes].
3990 ///
3991 /// # Example
3992 /// ```ignore,no_run
3993 /// # use google_cloud_memorystore_v1::model::BackupCollection;
3994 /// let x = BackupCollection::new().set_total_backup_size_bytes(42);
3995 /// ```
3996 pub fn set_total_backup_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3997 self.total_backup_size_bytes = v.into();
3998 self
3999 }
4000
4001 /// Sets the value of [total_backup_count][crate::model::BackupCollection::total_backup_count].
4002 ///
4003 /// # Example
4004 /// ```ignore,no_run
4005 /// # use google_cloud_memorystore_v1::model::BackupCollection;
4006 /// let x = BackupCollection::new().set_total_backup_count(42);
4007 /// ```
4008 pub fn set_total_backup_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4009 self.total_backup_count = v.into();
4010 self
4011 }
4012
4013 /// Sets the value of [last_backup_time][crate::model::BackupCollection::last_backup_time].
4014 ///
4015 /// # Example
4016 /// ```ignore,no_run
4017 /// # use google_cloud_memorystore_v1::model::BackupCollection;
4018 /// use wkt::Timestamp;
4019 /// let x = BackupCollection::new().set_last_backup_time(Timestamp::default()/* use setters */);
4020 /// ```
4021 pub fn set_last_backup_time<T>(mut self, v: T) -> Self
4022 where
4023 T: std::convert::Into<wkt::Timestamp>,
4024 {
4025 self.last_backup_time = std::option::Option::Some(v.into());
4026 self
4027 }
4028
4029 /// Sets or clears the value of [last_backup_time][crate::model::BackupCollection::last_backup_time].
4030 ///
4031 /// # Example
4032 /// ```ignore,no_run
4033 /// # use google_cloud_memorystore_v1::model::BackupCollection;
4034 /// use wkt::Timestamp;
4035 /// let x = BackupCollection::new().set_or_clear_last_backup_time(Some(Timestamp::default()/* use setters */));
4036 /// let x = BackupCollection::new().set_or_clear_last_backup_time(None::<Timestamp>);
4037 /// ```
4038 pub fn set_or_clear_last_backup_time<T>(mut self, v: std::option::Option<T>) -> Self
4039 where
4040 T: std::convert::Into<wkt::Timestamp>,
4041 {
4042 self.last_backup_time = v.map(|x| x.into());
4043 self
4044 }
4045}
4046
4047impl wkt::message::Message for BackupCollection {
4048 fn typename() -> &'static str {
4049 "type.googleapis.com/google.cloud.memorystore.v1.BackupCollection"
4050 }
4051}
4052
4053/// Backup of an instance.
4054#[derive(Clone, Default, PartialEq)]
4055#[non_exhaustive]
4056pub struct Backup {
4057 /// Identifier. Full resource path of the backup. the last part of the name is
4058 /// the backup id with the following format: [YYYYMMDDHHMMSS]_[Shorted Instance
4059 /// UID] OR customer specified while backup instance. Example:
4060 /// 20240515123000_1234
4061 pub name: std::string::String,
4062
4063 /// Output only. The time when the backup was created.
4064 pub create_time: std::option::Option<wkt::Timestamp>,
4065
4066 /// Output only. Instance resource path of this backup.
4067 pub instance: std::string::String,
4068
4069 /// Output only. Instance uid of this backup.
4070 pub instance_uid: std::string::String,
4071
4072 /// Output only. Total size of the backup in bytes.
4073 pub total_size_bytes: i64,
4074
4075 /// Output only. The time when the backup will expire.
4076 pub expire_time: std::option::Option<wkt::Timestamp>,
4077
4078 /// Output only. valkey-7.5/valkey-8.0, etc.
4079 pub engine_version: std::string::String,
4080
4081 /// Output only. List of backup files of the backup.
4082 pub backup_files: std::vec::Vec<crate::model::BackupFile>,
4083
4084 /// Output only. Node type of the instance.
4085 pub node_type: crate::model::instance::NodeType,
4086
4087 /// Output only. Number of replicas for the instance.
4088 pub replica_count: i32,
4089
4090 /// Output only. Number of shards for the instance.
4091 pub shard_count: i32,
4092
4093 /// Output only. Type of the backup.
4094 pub backup_type: crate::model::backup::BackupType,
4095
4096 /// Output only. State of the backup.
4097 pub state: crate::model::backup::State,
4098
4099 /// Output only. Encryption information of the backup.
4100 pub encryption_info: std::option::Option<crate::model::EncryptionInfo>,
4101
4102 /// Output only. System assigned unique identifier of the backup.
4103 pub uid: std::string::String,
4104
4105 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4106}
4107
4108impl Backup {
4109 /// Creates a new default instance.
4110 pub fn new() -> Self {
4111 std::default::Default::default()
4112 }
4113
4114 /// Sets the value of [name][crate::model::Backup::name].
4115 ///
4116 /// # Example
4117 /// ```ignore,no_run
4118 /// # use google_cloud_memorystore_v1::model::Backup;
4119 /// # let project_id = "project_id";
4120 /// # let location_id = "location_id";
4121 /// # let backup_collection_id = "backup_collection_id";
4122 /// # let backup_id = "backup_id";
4123 /// let x = Backup::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"));
4124 /// ```
4125 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4126 self.name = v.into();
4127 self
4128 }
4129
4130 /// Sets the value of [create_time][crate::model::Backup::create_time].
4131 ///
4132 /// # Example
4133 /// ```ignore,no_run
4134 /// # use google_cloud_memorystore_v1::model::Backup;
4135 /// use wkt::Timestamp;
4136 /// let x = Backup::new().set_create_time(Timestamp::default()/* use setters */);
4137 /// ```
4138 pub fn set_create_time<T>(mut self, v: T) -> Self
4139 where
4140 T: std::convert::Into<wkt::Timestamp>,
4141 {
4142 self.create_time = std::option::Option::Some(v.into());
4143 self
4144 }
4145
4146 /// Sets or clears the value of [create_time][crate::model::Backup::create_time].
4147 ///
4148 /// # Example
4149 /// ```ignore,no_run
4150 /// # use google_cloud_memorystore_v1::model::Backup;
4151 /// use wkt::Timestamp;
4152 /// let x = Backup::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4153 /// let x = Backup::new().set_or_clear_create_time(None::<Timestamp>);
4154 /// ```
4155 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4156 where
4157 T: std::convert::Into<wkt::Timestamp>,
4158 {
4159 self.create_time = v.map(|x| x.into());
4160 self
4161 }
4162
4163 /// Sets the value of [instance][crate::model::Backup::instance].
4164 ///
4165 /// # Example
4166 /// ```ignore,no_run
4167 /// # use google_cloud_memorystore_v1::model::Backup;
4168 /// # let project_id = "project_id";
4169 /// # let location_id = "location_id";
4170 /// # let instance_id = "instance_id";
4171 /// let x = Backup::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
4172 /// ```
4173 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4174 self.instance = v.into();
4175 self
4176 }
4177
4178 /// Sets the value of [instance_uid][crate::model::Backup::instance_uid].
4179 ///
4180 /// # Example
4181 /// ```ignore,no_run
4182 /// # use google_cloud_memorystore_v1::model::Backup;
4183 /// let x = Backup::new().set_instance_uid("example");
4184 /// ```
4185 pub fn set_instance_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4186 self.instance_uid = v.into();
4187 self
4188 }
4189
4190 /// Sets the value of [total_size_bytes][crate::model::Backup::total_size_bytes].
4191 ///
4192 /// # Example
4193 /// ```ignore,no_run
4194 /// # use google_cloud_memorystore_v1::model::Backup;
4195 /// let x = Backup::new().set_total_size_bytes(42);
4196 /// ```
4197 pub fn set_total_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4198 self.total_size_bytes = v.into();
4199 self
4200 }
4201
4202 /// Sets the value of [expire_time][crate::model::Backup::expire_time].
4203 ///
4204 /// # Example
4205 /// ```ignore,no_run
4206 /// # use google_cloud_memorystore_v1::model::Backup;
4207 /// use wkt::Timestamp;
4208 /// let x = Backup::new().set_expire_time(Timestamp::default()/* use setters */);
4209 /// ```
4210 pub fn set_expire_time<T>(mut self, v: T) -> Self
4211 where
4212 T: std::convert::Into<wkt::Timestamp>,
4213 {
4214 self.expire_time = std::option::Option::Some(v.into());
4215 self
4216 }
4217
4218 /// Sets or clears the value of [expire_time][crate::model::Backup::expire_time].
4219 ///
4220 /// # Example
4221 /// ```ignore,no_run
4222 /// # use google_cloud_memorystore_v1::model::Backup;
4223 /// use wkt::Timestamp;
4224 /// let x = Backup::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
4225 /// let x = Backup::new().set_or_clear_expire_time(None::<Timestamp>);
4226 /// ```
4227 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4228 where
4229 T: std::convert::Into<wkt::Timestamp>,
4230 {
4231 self.expire_time = v.map(|x| x.into());
4232 self
4233 }
4234
4235 /// Sets the value of [engine_version][crate::model::Backup::engine_version].
4236 ///
4237 /// # Example
4238 /// ```ignore,no_run
4239 /// # use google_cloud_memorystore_v1::model::Backup;
4240 /// let x = Backup::new().set_engine_version("example");
4241 /// ```
4242 pub fn set_engine_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4243 self.engine_version = v.into();
4244 self
4245 }
4246
4247 /// Sets the value of [backup_files][crate::model::Backup::backup_files].
4248 ///
4249 /// # Example
4250 /// ```ignore,no_run
4251 /// # use google_cloud_memorystore_v1::model::Backup;
4252 /// use google_cloud_memorystore_v1::model::BackupFile;
4253 /// let x = Backup::new()
4254 /// .set_backup_files([
4255 /// BackupFile::default()/* use setters */,
4256 /// BackupFile::default()/* use (different) setters */,
4257 /// ]);
4258 /// ```
4259 pub fn set_backup_files<T, V>(mut self, v: T) -> Self
4260 where
4261 T: std::iter::IntoIterator<Item = V>,
4262 V: std::convert::Into<crate::model::BackupFile>,
4263 {
4264 use std::iter::Iterator;
4265 self.backup_files = v.into_iter().map(|i| i.into()).collect();
4266 self
4267 }
4268
4269 /// Sets the value of [node_type][crate::model::Backup::node_type].
4270 ///
4271 /// # Example
4272 /// ```ignore,no_run
4273 /// # use google_cloud_memorystore_v1::model::Backup;
4274 /// use google_cloud_memorystore_v1::model::instance::NodeType;
4275 /// let x0 = Backup::new().set_node_type(NodeType::SharedCoreNano);
4276 /// let x1 = Backup::new().set_node_type(NodeType::HighmemMedium);
4277 /// let x2 = Backup::new().set_node_type(NodeType::HighmemXlarge);
4278 /// ```
4279 pub fn set_node_type<T: std::convert::Into<crate::model::instance::NodeType>>(
4280 mut self,
4281 v: T,
4282 ) -> Self {
4283 self.node_type = v.into();
4284 self
4285 }
4286
4287 /// Sets the value of [replica_count][crate::model::Backup::replica_count].
4288 ///
4289 /// # Example
4290 /// ```ignore,no_run
4291 /// # use google_cloud_memorystore_v1::model::Backup;
4292 /// let x = Backup::new().set_replica_count(42);
4293 /// ```
4294 pub fn set_replica_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4295 self.replica_count = v.into();
4296 self
4297 }
4298
4299 /// Sets the value of [shard_count][crate::model::Backup::shard_count].
4300 ///
4301 /// # Example
4302 /// ```ignore,no_run
4303 /// # use google_cloud_memorystore_v1::model::Backup;
4304 /// let x = Backup::new().set_shard_count(42);
4305 /// ```
4306 pub fn set_shard_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4307 self.shard_count = v.into();
4308 self
4309 }
4310
4311 /// Sets the value of [backup_type][crate::model::Backup::backup_type].
4312 ///
4313 /// # Example
4314 /// ```ignore,no_run
4315 /// # use google_cloud_memorystore_v1::model::Backup;
4316 /// use google_cloud_memorystore_v1::model::backup::BackupType;
4317 /// let x0 = Backup::new().set_backup_type(BackupType::OnDemand);
4318 /// let x1 = Backup::new().set_backup_type(BackupType::Automated);
4319 /// ```
4320 pub fn set_backup_type<T: std::convert::Into<crate::model::backup::BackupType>>(
4321 mut self,
4322 v: T,
4323 ) -> Self {
4324 self.backup_type = v.into();
4325 self
4326 }
4327
4328 /// Sets the value of [state][crate::model::Backup::state].
4329 ///
4330 /// # Example
4331 /// ```ignore,no_run
4332 /// # use google_cloud_memorystore_v1::model::Backup;
4333 /// use google_cloud_memorystore_v1::model::backup::State;
4334 /// let x0 = Backup::new().set_state(State::Creating);
4335 /// let x1 = Backup::new().set_state(State::Active);
4336 /// let x2 = Backup::new().set_state(State::Deleting);
4337 /// ```
4338 pub fn set_state<T: std::convert::Into<crate::model::backup::State>>(mut self, v: T) -> Self {
4339 self.state = v.into();
4340 self
4341 }
4342
4343 /// Sets the value of [encryption_info][crate::model::Backup::encryption_info].
4344 ///
4345 /// # Example
4346 /// ```ignore,no_run
4347 /// # use google_cloud_memorystore_v1::model::Backup;
4348 /// use google_cloud_memorystore_v1::model::EncryptionInfo;
4349 /// let x = Backup::new().set_encryption_info(EncryptionInfo::default()/* use setters */);
4350 /// ```
4351 pub fn set_encryption_info<T>(mut self, v: T) -> Self
4352 where
4353 T: std::convert::Into<crate::model::EncryptionInfo>,
4354 {
4355 self.encryption_info = std::option::Option::Some(v.into());
4356 self
4357 }
4358
4359 /// Sets or clears the value of [encryption_info][crate::model::Backup::encryption_info].
4360 ///
4361 /// # Example
4362 /// ```ignore,no_run
4363 /// # use google_cloud_memorystore_v1::model::Backup;
4364 /// use google_cloud_memorystore_v1::model::EncryptionInfo;
4365 /// let x = Backup::new().set_or_clear_encryption_info(Some(EncryptionInfo::default()/* use setters */));
4366 /// let x = Backup::new().set_or_clear_encryption_info(None::<EncryptionInfo>);
4367 /// ```
4368 pub fn set_or_clear_encryption_info<T>(mut self, v: std::option::Option<T>) -> Self
4369 where
4370 T: std::convert::Into<crate::model::EncryptionInfo>,
4371 {
4372 self.encryption_info = v.map(|x| x.into());
4373 self
4374 }
4375
4376 /// Sets the value of [uid][crate::model::Backup::uid].
4377 ///
4378 /// # Example
4379 /// ```ignore,no_run
4380 /// # use google_cloud_memorystore_v1::model::Backup;
4381 /// let x = Backup::new().set_uid("example");
4382 /// ```
4383 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4384 self.uid = v.into();
4385 self
4386 }
4387}
4388
4389impl wkt::message::Message for Backup {
4390 fn typename() -> &'static str {
4391 "type.googleapis.com/google.cloud.memorystore.v1.Backup"
4392 }
4393}
4394
4395/// Defines additional types related to [Backup].
4396pub mod backup {
4397 #[allow(unused_imports)]
4398 use super::*;
4399
4400 /// Type of the backup.
4401 ///
4402 /// # Working with unknown values
4403 ///
4404 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4405 /// additional enum variants at any time. Adding new variants is not considered
4406 /// a breaking change. Applications should write their code in anticipation of:
4407 ///
4408 /// - New values appearing in future releases of the client library, **and**
4409 /// - New values received dynamically, without application changes.
4410 ///
4411 /// Please consult the [Working with enums] section in the user guide for some
4412 /// guidelines.
4413 ///
4414 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4415 #[derive(Clone, Debug, PartialEq)]
4416 #[non_exhaustive]
4417 pub enum BackupType {
4418 /// The default value, not set.
4419 Unspecified,
4420 /// On-demand backup.
4421 OnDemand,
4422 /// Automated backup.
4423 Automated,
4424 /// If set, the enum was initialized with an unknown value.
4425 ///
4426 /// Applications can examine the value using [BackupType::value] or
4427 /// [BackupType::name].
4428 UnknownValue(backup_type::UnknownValue),
4429 }
4430
4431 #[doc(hidden)]
4432 pub mod backup_type {
4433 #[allow(unused_imports)]
4434 use super::*;
4435 #[derive(Clone, Debug, PartialEq)]
4436 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4437 }
4438
4439 impl BackupType {
4440 /// Gets the enum value.
4441 ///
4442 /// Returns `None` if the enum contains an unknown value deserialized from
4443 /// the string representation of enums.
4444 pub fn value(&self) -> std::option::Option<i32> {
4445 match self {
4446 Self::Unspecified => std::option::Option::Some(0),
4447 Self::OnDemand => std::option::Option::Some(1),
4448 Self::Automated => std::option::Option::Some(2),
4449 Self::UnknownValue(u) => u.0.value(),
4450 }
4451 }
4452
4453 /// Gets the enum value as a string.
4454 ///
4455 /// Returns `None` if the enum contains an unknown value deserialized from
4456 /// the integer representation of enums.
4457 pub fn name(&self) -> std::option::Option<&str> {
4458 match self {
4459 Self::Unspecified => std::option::Option::Some("BACKUP_TYPE_UNSPECIFIED"),
4460 Self::OnDemand => std::option::Option::Some("ON_DEMAND"),
4461 Self::Automated => std::option::Option::Some("AUTOMATED"),
4462 Self::UnknownValue(u) => u.0.name(),
4463 }
4464 }
4465 }
4466
4467 impl std::default::Default for BackupType {
4468 fn default() -> Self {
4469 use std::convert::From;
4470 Self::from(0)
4471 }
4472 }
4473
4474 impl std::fmt::Display for BackupType {
4475 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4476 wkt::internal::display_enum(f, self.name(), self.value())
4477 }
4478 }
4479
4480 impl std::convert::From<i32> for BackupType {
4481 fn from(value: i32) -> Self {
4482 match value {
4483 0 => Self::Unspecified,
4484 1 => Self::OnDemand,
4485 2 => Self::Automated,
4486 _ => Self::UnknownValue(backup_type::UnknownValue(
4487 wkt::internal::UnknownEnumValue::Integer(value),
4488 )),
4489 }
4490 }
4491 }
4492
4493 impl std::convert::From<&str> for BackupType {
4494 fn from(value: &str) -> Self {
4495 use std::string::ToString;
4496 match value {
4497 "BACKUP_TYPE_UNSPECIFIED" => Self::Unspecified,
4498 "ON_DEMAND" => Self::OnDemand,
4499 "AUTOMATED" => Self::Automated,
4500 _ => Self::UnknownValue(backup_type::UnknownValue(
4501 wkt::internal::UnknownEnumValue::String(value.to_string()),
4502 )),
4503 }
4504 }
4505 }
4506
4507 impl serde::ser::Serialize for BackupType {
4508 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4509 where
4510 S: serde::Serializer,
4511 {
4512 match self {
4513 Self::Unspecified => serializer.serialize_i32(0),
4514 Self::OnDemand => serializer.serialize_i32(1),
4515 Self::Automated => serializer.serialize_i32(2),
4516 Self::UnknownValue(u) => u.0.serialize(serializer),
4517 }
4518 }
4519 }
4520
4521 impl<'de> serde::de::Deserialize<'de> for BackupType {
4522 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4523 where
4524 D: serde::Deserializer<'de>,
4525 {
4526 deserializer.deserialize_any(wkt::internal::EnumVisitor::<BackupType>::new(
4527 ".google.cloud.memorystore.v1.Backup.BackupType",
4528 ))
4529 }
4530 }
4531
4532 /// State of the backup.
4533 ///
4534 /// # Working with unknown values
4535 ///
4536 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4537 /// additional enum variants at any time. Adding new variants is not considered
4538 /// a breaking change. Applications should write their code in anticipation of:
4539 ///
4540 /// - New values appearing in future releases of the client library, **and**
4541 /// - New values received dynamically, without application changes.
4542 ///
4543 /// Please consult the [Working with enums] section in the user guide for some
4544 /// guidelines.
4545 ///
4546 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4547 #[derive(Clone, Debug, PartialEq)]
4548 #[non_exhaustive]
4549 pub enum State {
4550 /// The default value, not set.
4551 Unspecified,
4552 /// The backup is being created.
4553 Creating,
4554 /// The backup is active to be used.
4555 Active,
4556 /// The backup is being deleted.
4557 Deleting,
4558 /// The backup is currently suspended due to reasons like project deletion,
4559 /// billing account closure, etc.
4560 Suspended,
4561 /// If set, the enum was initialized with an unknown value.
4562 ///
4563 /// Applications can examine the value using [State::value] or
4564 /// [State::name].
4565 UnknownValue(state::UnknownValue),
4566 }
4567
4568 #[doc(hidden)]
4569 pub mod state {
4570 #[allow(unused_imports)]
4571 use super::*;
4572 #[derive(Clone, Debug, PartialEq)]
4573 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4574 }
4575
4576 impl State {
4577 /// Gets the enum value.
4578 ///
4579 /// Returns `None` if the enum contains an unknown value deserialized from
4580 /// the string representation of enums.
4581 pub fn value(&self) -> std::option::Option<i32> {
4582 match self {
4583 Self::Unspecified => std::option::Option::Some(0),
4584 Self::Creating => std::option::Option::Some(1),
4585 Self::Active => std::option::Option::Some(2),
4586 Self::Deleting => std::option::Option::Some(3),
4587 Self::Suspended => std::option::Option::Some(4),
4588 Self::UnknownValue(u) => u.0.value(),
4589 }
4590 }
4591
4592 /// Gets the enum value as a string.
4593 ///
4594 /// Returns `None` if the enum contains an unknown value deserialized from
4595 /// the integer representation of enums.
4596 pub fn name(&self) -> std::option::Option<&str> {
4597 match self {
4598 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4599 Self::Creating => std::option::Option::Some("CREATING"),
4600 Self::Active => std::option::Option::Some("ACTIVE"),
4601 Self::Deleting => std::option::Option::Some("DELETING"),
4602 Self::Suspended => std::option::Option::Some("SUSPENDED"),
4603 Self::UnknownValue(u) => u.0.name(),
4604 }
4605 }
4606 }
4607
4608 impl std::default::Default for State {
4609 fn default() -> Self {
4610 use std::convert::From;
4611 Self::from(0)
4612 }
4613 }
4614
4615 impl std::fmt::Display for State {
4616 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4617 wkt::internal::display_enum(f, self.name(), self.value())
4618 }
4619 }
4620
4621 impl std::convert::From<i32> for State {
4622 fn from(value: i32) -> Self {
4623 match value {
4624 0 => Self::Unspecified,
4625 1 => Self::Creating,
4626 2 => Self::Active,
4627 3 => Self::Deleting,
4628 4 => Self::Suspended,
4629 _ => Self::UnknownValue(state::UnknownValue(
4630 wkt::internal::UnknownEnumValue::Integer(value),
4631 )),
4632 }
4633 }
4634 }
4635
4636 impl std::convert::From<&str> for State {
4637 fn from(value: &str) -> Self {
4638 use std::string::ToString;
4639 match value {
4640 "STATE_UNSPECIFIED" => Self::Unspecified,
4641 "CREATING" => Self::Creating,
4642 "ACTIVE" => Self::Active,
4643 "DELETING" => Self::Deleting,
4644 "SUSPENDED" => Self::Suspended,
4645 _ => Self::UnknownValue(state::UnknownValue(
4646 wkt::internal::UnknownEnumValue::String(value.to_string()),
4647 )),
4648 }
4649 }
4650 }
4651
4652 impl serde::ser::Serialize for State {
4653 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4654 where
4655 S: serde::Serializer,
4656 {
4657 match self {
4658 Self::Unspecified => serializer.serialize_i32(0),
4659 Self::Creating => serializer.serialize_i32(1),
4660 Self::Active => serializer.serialize_i32(2),
4661 Self::Deleting => serializer.serialize_i32(3),
4662 Self::Suspended => serializer.serialize_i32(4),
4663 Self::UnknownValue(u) => u.0.serialize(serializer),
4664 }
4665 }
4666 }
4667
4668 impl<'de> serde::de::Deserialize<'de> for State {
4669 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4670 where
4671 D: serde::Deserializer<'de>,
4672 {
4673 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4674 ".google.cloud.memorystore.v1.Backup.State",
4675 ))
4676 }
4677 }
4678}
4679
4680/// Backup is consisted of multiple backup files.
4681#[derive(Clone, Default, PartialEq)]
4682#[non_exhaustive]
4683pub struct BackupFile {
4684 /// Output only. e.g: \<shard-id\>.rdb
4685 pub file_name: std::string::String,
4686
4687 /// Output only. Size of the backup file in bytes.
4688 pub size_bytes: i64,
4689
4690 /// Output only. The time when the backup file was created.
4691 pub create_time: std::option::Option<wkt::Timestamp>,
4692
4693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4694}
4695
4696impl BackupFile {
4697 /// Creates a new default instance.
4698 pub fn new() -> Self {
4699 std::default::Default::default()
4700 }
4701
4702 /// Sets the value of [file_name][crate::model::BackupFile::file_name].
4703 ///
4704 /// # Example
4705 /// ```ignore,no_run
4706 /// # use google_cloud_memorystore_v1::model::BackupFile;
4707 /// let x = BackupFile::new().set_file_name("example");
4708 /// ```
4709 pub fn set_file_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4710 self.file_name = v.into();
4711 self
4712 }
4713
4714 /// Sets the value of [size_bytes][crate::model::BackupFile::size_bytes].
4715 ///
4716 /// # Example
4717 /// ```ignore,no_run
4718 /// # use google_cloud_memorystore_v1::model::BackupFile;
4719 /// let x = BackupFile::new().set_size_bytes(42);
4720 /// ```
4721 pub fn set_size_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4722 self.size_bytes = v.into();
4723 self
4724 }
4725
4726 /// Sets the value of [create_time][crate::model::BackupFile::create_time].
4727 ///
4728 /// # Example
4729 /// ```ignore,no_run
4730 /// # use google_cloud_memorystore_v1::model::BackupFile;
4731 /// use wkt::Timestamp;
4732 /// let x = BackupFile::new().set_create_time(Timestamp::default()/* use setters */);
4733 /// ```
4734 pub fn set_create_time<T>(mut self, v: T) -> Self
4735 where
4736 T: std::convert::Into<wkt::Timestamp>,
4737 {
4738 self.create_time = std::option::Option::Some(v.into());
4739 self
4740 }
4741
4742 /// Sets or clears the value of [create_time][crate::model::BackupFile::create_time].
4743 ///
4744 /// # Example
4745 /// ```ignore,no_run
4746 /// # use google_cloud_memorystore_v1::model::BackupFile;
4747 /// use wkt::Timestamp;
4748 /// let x = BackupFile::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
4749 /// let x = BackupFile::new().set_or_clear_create_time(None::<Timestamp>);
4750 /// ```
4751 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4752 where
4753 T: std::convert::Into<wkt::Timestamp>,
4754 {
4755 self.create_time = v.map(|x| x.into());
4756 self
4757 }
4758}
4759
4760impl wkt::message::Message for BackupFile {
4761 fn typename() -> &'static str {
4762 "type.googleapis.com/google.cloud.memorystore.v1.BackupFile"
4763 }
4764}
4765
4766/// Cross instance replication config.
4767#[derive(Clone, Default, PartialEq)]
4768#[non_exhaustive]
4769pub struct CrossInstanceReplicationConfig {
4770 /// Required. The role of the instance in cross instance replication.
4771 pub instance_role: crate::model::cross_instance_replication_config::InstanceRole,
4772
4773 /// Optional. Details of the primary instance that is used as the replication
4774 /// source for this secondary instance.
4775 ///
4776 /// This field is only set for a secondary instance.
4777 pub primary_instance:
4778 std::option::Option<crate::model::cross_instance_replication_config::RemoteInstance>,
4779
4780 /// Optional. List of secondary instances that are replicating from this
4781 /// primary instance.
4782 ///
4783 /// This field is only set for a primary instance.
4784 pub secondary_instances:
4785 std::vec::Vec<crate::model::cross_instance_replication_config::RemoteInstance>,
4786
4787 /// Output only. The last time cross instance replication config was updated.
4788 pub update_time: std::option::Option<wkt::Timestamp>,
4789
4790 /// Output only. An output only view of all the member instances participating
4791 /// in the cross instance replication. This view will be provided by every
4792 /// member instance irrespective of its instance role(primary or secondary).
4793 ///
4794 /// A primary instance can provide information about all the secondary
4795 /// instances replicating from it. However, a secondary instance only knows
4796 /// about the primary instance from which it is replicating. However, for
4797 /// scenarios, where the primary instance is unavailable(e.g. regional outage),
4798 /// a Getinstance request can be sent to any other member instance and this
4799 /// field will list all the member instances participating in cross instance
4800 /// replication.
4801 pub membership:
4802 std::option::Option<crate::model::cross_instance_replication_config::Membership>,
4803
4804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4805}
4806
4807impl CrossInstanceReplicationConfig {
4808 /// Creates a new default instance.
4809 pub fn new() -> Self {
4810 std::default::Default::default()
4811 }
4812
4813 /// Sets the value of [instance_role][crate::model::CrossInstanceReplicationConfig::instance_role].
4814 ///
4815 /// # Example
4816 /// ```ignore,no_run
4817 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4818 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::InstanceRole;
4819 /// let x0 = CrossInstanceReplicationConfig::new().set_instance_role(InstanceRole::None);
4820 /// let x1 = CrossInstanceReplicationConfig::new().set_instance_role(InstanceRole::Primary);
4821 /// let x2 = CrossInstanceReplicationConfig::new().set_instance_role(InstanceRole::Secondary);
4822 /// ```
4823 pub fn set_instance_role<
4824 T: std::convert::Into<crate::model::cross_instance_replication_config::InstanceRole>,
4825 >(
4826 mut self,
4827 v: T,
4828 ) -> Self {
4829 self.instance_role = v.into();
4830 self
4831 }
4832
4833 /// Sets the value of [primary_instance][crate::model::CrossInstanceReplicationConfig::primary_instance].
4834 ///
4835 /// # Example
4836 /// ```ignore,no_run
4837 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4838 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
4839 /// let x = CrossInstanceReplicationConfig::new().set_primary_instance(RemoteInstance::default()/* use setters */);
4840 /// ```
4841 pub fn set_primary_instance<T>(mut self, v: T) -> Self
4842 where
4843 T: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
4844 {
4845 self.primary_instance = std::option::Option::Some(v.into());
4846 self
4847 }
4848
4849 /// Sets or clears the value of [primary_instance][crate::model::CrossInstanceReplicationConfig::primary_instance].
4850 ///
4851 /// # Example
4852 /// ```ignore,no_run
4853 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4854 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
4855 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_primary_instance(Some(RemoteInstance::default()/* use setters */));
4856 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_primary_instance(None::<RemoteInstance>);
4857 /// ```
4858 pub fn set_or_clear_primary_instance<T>(mut self, v: std::option::Option<T>) -> Self
4859 where
4860 T: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
4861 {
4862 self.primary_instance = v.map(|x| x.into());
4863 self
4864 }
4865
4866 /// Sets the value of [secondary_instances][crate::model::CrossInstanceReplicationConfig::secondary_instances].
4867 ///
4868 /// # Example
4869 /// ```ignore,no_run
4870 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4871 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
4872 /// let x = CrossInstanceReplicationConfig::new()
4873 /// .set_secondary_instances([
4874 /// RemoteInstance::default()/* use setters */,
4875 /// RemoteInstance::default()/* use (different) setters */,
4876 /// ]);
4877 /// ```
4878 pub fn set_secondary_instances<T, V>(mut self, v: T) -> Self
4879 where
4880 T: std::iter::IntoIterator<Item = V>,
4881 V: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
4882 {
4883 use std::iter::Iterator;
4884 self.secondary_instances = v.into_iter().map(|i| i.into()).collect();
4885 self
4886 }
4887
4888 /// Sets the value of [update_time][crate::model::CrossInstanceReplicationConfig::update_time].
4889 ///
4890 /// # Example
4891 /// ```ignore,no_run
4892 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4893 /// use wkt::Timestamp;
4894 /// let x = CrossInstanceReplicationConfig::new().set_update_time(Timestamp::default()/* use setters */);
4895 /// ```
4896 pub fn set_update_time<T>(mut self, v: T) -> Self
4897 where
4898 T: std::convert::Into<wkt::Timestamp>,
4899 {
4900 self.update_time = std::option::Option::Some(v.into());
4901 self
4902 }
4903
4904 /// Sets or clears the value of [update_time][crate::model::CrossInstanceReplicationConfig::update_time].
4905 ///
4906 /// # Example
4907 /// ```ignore,no_run
4908 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4909 /// use wkt::Timestamp;
4910 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
4911 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_update_time(None::<Timestamp>);
4912 /// ```
4913 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
4914 where
4915 T: std::convert::Into<wkt::Timestamp>,
4916 {
4917 self.update_time = v.map(|x| x.into());
4918 self
4919 }
4920
4921 /// Sets the value of [membership][crate::model::CrossInstanceReplicationConfig::membership].
4922 ///
4923 /// # Example
4924 /// ```ignore,no_run
4925 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4926 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::Membership;
4927 /// let x = CrossInstanceReplicationConfig::new().set_membership(Membership::default()/* use setters */);
4928 /// ```
4929 pub fn set_membership<T>(mut self, v: T) -> Self
4930 where
4931 T: std::convert::Into<crate::model::cross_instance_replication_config::Membership>,
4932 {
4933 self.membership = std::option::Option::Some(v.into());
4934 self
4935 }
4936
4937 /// Sets or clears the value of [membership][crate::model::CrossInstanceReplicationConfig::membership].
4938 ///
4939 /// # Example
4940 /// ```ignore,no_run
4941 /// # use google_cloud_memorystore_v1::model::CrossInstanceReplicationConfig;
4942 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::Membership;
4943 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_membership(Some(Membership::default()/* use setters */));
4944 /// let x = CrossInstanceReplicationConfig::new().set_or_clear_membership(None::<Membership>);
4945 /// ```
4946 pub fn set_or_clear_membership<T>(mut self, v: std::option::Option<T>) -> Self
4947 where
4948 T: std::convert::Into<crate::model::cross_instance_replication_config::Membership>,
4949 {
4950 self.membership = v.map(|x| x.into());
4951 self
4952 }
4953}
4954
4955impl wkt::message::Message for CrossInstanceReplicationConfig {
4956 fn typename() -> &'static str {
4957 "type.googleapis.com/google.cloud.memorystore.v1.CrossInstanceReplicationConfig"
4958 }
4959}
4960
4961/// Defines additional types related to [CrossInstanceReplicationConfig].
4962pub mod cross_instance_replication_config {
4963 #[allow(unused_imports)]
4964 use super::*;
4965
4966 /// Details of the remote instance associated with this instance in a cross
4967 /// instance replication setup.
4968 #[derive(Clone, Default, PartialEq)]
4969 #[non_exhaustive]
4970 pub struct RemoteInstance {
4971 /// Optional. The full resource path of the remote instance in
4972 /// the format: projects/\<project\>/locations/\<region\>/instances/\<instance-id\>
4973 pub instance: std::string::String,
4974
4975 /// Output only. The unique identifier of the remote instance.
4976 pub uid: std::string::String,
4977
4978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4979 }
4980
4981 impl RemoteInstance {
4982 /// Creates a new default instance.
4983 pub fn new() -> Self {
4984 std::default::Default::default()
4985 }
4986
4987 /// Sets the value of [instance][crate::model::cross_instance_replication_config::RemoteInstance::instance].
4988 ///
4989 /// # Example
4990 /// ```ignore,no_run
4991 /// # use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
4992 /// # let project_id = "project_id";
4993 /// # let location_id = "location_id";
4994 /// # let instance_id = "instance_id";
4995 /// let x = RemoteInstance::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
4996 /// ```
4997 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4998 self.instance = v.into();
4999 self
5000 }
5001
5002 /// Sets the value of [uid][crate::model::cross_instance_replication_config::RemoteInstance::uid].
5003 ///
5004 /// # Example
5005 /// ```ignore,no_run
5006 /// # use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
5007 /// let x = RemoteInstance::new().set_uid("example");
5008 /// ```
5009 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5010 self.uid = v.into();
5011 self
5012 }
5013 }
5014
5015 impl wkt::message::Message for RemoteInstance {
5016 fn typename() -> &'static str {
5017 "type.googleapis.com/google.cloud.memorystore.v1.CrossInstanceReplicationConfig.RemoteInstance"
5018 }
5019 }
5020
5021 /// An output only view of all the member instances participating in the cross
5022 /// instance replication.
5023 #[derive(Clone, Default, PartialEq)]
5024 #[non_exhaustive]
5025 pub struct Membership {
5026 /// Output only. The primary instance that acts as the source of replication
5027 /// for the secondary instances.
5028 pub primary_instance:
5029 std::option::Option<crate::model::cross_instance_replication_config::RemoteInstance>,
5030
5031 /// Output only. The list of secondary instances replicating from the primary
5032 /// instance.
5033 pub secondary_instances:
5034 std::vec::Vec<crate::model::cross_instance_replication_config::RemoteInstance>,
5035
5036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5037 }
5038
5039 impl Membership {
5040 /// Creates a new default instance.
5041 pub fn new() -> Self {
5042 std::default::Default::default()
5043 }
5044
5045 /// Sets the value of [primary_instance][crate::model::cross_instance_replication_config::Membership::primary_instance].
5046 ///
5047 /// # Example
5048 /// ```ignore,no_run
5049 /// # use google_cloud_memorystore_v1::model::cross_instance_replication_config::Membership;
5050 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
5051 /// let x = Membership::new().set_primary_instance(RemoteInstance::default()/* use setters */);
5052 /// ```
5053 pub fn set_primary_instance<T>(mut self, v: T) -> Self
5054 where
5055 T: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
5056 {
5057 self.primary_instance = std::option::Option::Some(v.into());
5058 self
5059 }
5060
5061 /// Sets or clears the value of [primary_instance][crate::model::cross_instance_replication_config::Membership::primary_instance].
5062 ///
5063 /// # Example
5064 /// ```ignore,no_run
5065 /// # use google_cloud_memorystore_v1::model::cross_instance_replication_config::Membership;
5066 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
5067 /// let x = Membership::new().set_or_clear_primary_instance(Some(RemoteInstance::default()/* use setters */));
5068 /// let x = Membership::new().set_or_clear_primary_instance(None::<RemoteInstance>);
5069 /// ```
5070 pub fn set_or_clear_primary_instance<T>(mut self, v: std::option::Option<T>) -> Self
5071 where
5072 T: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
5073 {
5074 self.primary_instance = v.map(|x| x.into());
5075 self
5076 }
5077
5078 /// Sets the value of [secondary_instances][crate::model::cross_instance_replication_config::Membership::secondary_instances].
5079 ///
5080 /// # Example
5081 /// ```ignore,no_run
5082 /// # use google_cloud_memorystore_v1::model::cross_instance_replication_config::Membership;
5083 /// use google_cloud_memorystore_v1::model::cross_instance_replication_config::RemoteInstance;
5084 /// let x = Membership::new()
5085 /// .set_secondary_instances([
5086 /// RemoteInstance::default()/* use setters */,
5087 /// RemoteInstance::default()/* use (different) setters */,
5088 /// ]);
5089 /// ```
5090 pub fn set_secondary_instances<T, V>(mut self, v: T) -> Self
5091 where
5092 T: std::iter::IntoIterator<Item = V>,
5093 V: std::convert::Into<crate::model::cross_instance_replication_config::RemoteInstance>,
5094 {
5095 use std::iter::Iterator;
5096 self.secondary_instances = v.into_iter().map(|i| i.into()).collect();
5097 self
5098 }
5099 }
5100
5101 impl wkt::message::Message for Membership {
5102 fn typename() -> &'static str {
5103 "type.googleapis.com/google.cloud.memorystore.v1.CrossInstanceReplicationConfig.Membership"
5104 }
5105 }
5106
5107 /// The role of the instance in cross instance replication.
5108 ///
5109 /// # Working with unknown values
5110 ///
5111 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5112 /// additional enum variants at any time. Adding new variants is not considered
5113 /// a breaking change. Applications should write their code in anticipation of:
5114 ///
5115 /// - New values appearing in future releases of the client library, **and**
5116 /// - New values received dynamically, without application changes.
5117 ///
5118 /// Please consult the [Working with enums] section in the user guide for some
5119 /// guidelines.
5120 ///
5121 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5122 #[derive(Clone, Debug, PartialEq)]
5123 #[non_exhaustive]
5124 pub enum InstanceRole {
5125 /// instance role is not set.
5126 /// The behavior is equivalent to NONE.
5127 Unspecified,
5128 /// This instance does not participate in cross instance replication. It is
5129 /// an independent instance and does not replicate to or from any other
5130 /// instances.
5131 None,
5132 /// A instance that allows both reads and writes. Any data written to this
5133 /// instance is also replicated to the attached secondary instances.
5134 Primary,
5135 /// A instance that allows only reads and replicates data from a primary
5136 /// instance.
5137 Secondary,
5138 /// If set, the enum was initialized with an unknown value.
5139 ///
5140 /// Applications can examine the value using [InstanceRole::value] or
5141 /// [InstanceRole::name].
5142 UnknownValue(instance_role::UnknownValue),
5143 }
5144
5145 #[doc(hidden)]
5146 pub mod instance_role {
5147 #[allow(unused_imports)]
5148 use super::*;
5149 #[derive(Clone, Debug, PartialEq)]
5150 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5151 }
5152
5153 impl InstanceRole {
5154 /// Gets the enum value.
5155 ///
5156 /// Returns `None` if the enum contains an unknown value deserialized from
5157 /// the string representation of enums.
5158 pub fn value(&self) -> std::option::Option<i32> {
5159 match self {
5160 Self::Unspecified => std::option::Option::Some(0),
5161 Self::None => std::option::Option::Some(1),
5162 Self::Primary => std::option::Option::Some(2),
5163 Self::Secondary => std::option::Option::Some(3),
5164 Self::UnknownValue(u) => u.0.value(),
5165 }
5166 }
5167
5168 /// Gets the enum value as a string.
5169 ///
5170 /// Returns `None` if the enum contains an unknown value deserialized from
5171 /// the integer representation of enums.
5172 pub fn name(&self) -> std::option::Option<&str> {
5173 match self {
5174 Self::Unspecified => std::option::Option::Some("INSTANCE_ROLE_UNSPECIFIED"),
5175 Self::None => std::option::Option::Some("NONE"),
5176 Self::Primary => std::option::Option::Some("PRIMARY"),
5177 Self::Secondary => std::option::Option::Some("SECONDARY"),
5178 Self::UnknownValue(u) => u.0.name(),
5179 }
5180 }
5181 }
5182
5183 impl std::default::Default for InstanceRole {
5184 fn default() -> Self {
5185 use std::convert::From;
5186 Self::from(0)
5187 }
5188 }
5189
5190 impl std::fmt::Display for InstanceRole {
5191 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5192 wkt::internal::display_enum(f, self.name(), self.value())
5193 }
5194 }
5195
5196 impl std::convert::From<i32> for InstanceRole {
5197 fn from(value: i32) -> Self {
5198 match value {
5199 0 => Self::Unspecified,
5200 1 => Self::None,
5201 2 => Self::Primary,
5202 3 => Self::Secondary,
5203 _ => Self::UnknownValue(instance_role::UnknownValue(
5204 wkt::internal::UnknownEnumValue::Integer(value),
5205 )),
5206 }
5207 }
5208 }
5209
5210 impl std::convert::From<&str> for InstanceRole {
5211 fn from(value: &str) -> Self {
5212 use std::string::ToString;
5213 match value {
5214 "INSTANCE_ROLE_UNSPECIFIED" => Self::Unspecified,
5215 "NONE" => Self::None,
5216 "PRIMARY" => Self::Primary,
5217 "SECONDARY" => Self::Secondary,
5218 _ => Self::UnknownValue(instance_role::UnknownValue(
5219 wkt::internal::UnknownEnumValue::String(value.to_string()),
5220 )),
5221 }
5222 }
5223 }
5224
5225 impl serde::ser::Serialize for InstanceRole {
5226 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5227 where
5228 S: serde::Serializer,
5229 {
5230 match self {
5231 Self::Unspecified => serializer.serialize_i32(0),
5232 Self::None => serializer.serialize_i32(1),
5233 Self::Primary => serializer.serialize_i32(2),
5234 Self::Secondary => serializer.serialize_i32(3),
5235 Self::UnknownValue(u) => u.0.serialize(serializer),
5236 }
5237 }
5238 }
5239
5240 impl<'de> serde::de::Deserialize<'de> for InstanceRole {
5241 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5242 where
5243 D: serde::Deserializer<'de>,
5244 {
5245 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InstanceRole>::new(
5246 ".google.cloud.memorystore.v1.CrossInstanceReplicationConfig.InstanceRole",
5247 ))
5248 }
5249 }
5250}
5251
5252/// Token based auth user for the instance.
5253#[derive(Clone, Default, PartialEq)]
5254#[non_exhaustive]
5255pub struct TokenAuthUser {
5256 /// Identifier. Token based auth user name.
5257 pub name: std::string::String,
5258
5259 /// Output only. The state of the token based auth user.
5260 pub state: crate::model::token_auth_user::State,
5261
5262 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5263}
5264
5265impl TokenAuthUser {
5266 /// Creates a new default instance.
5267 pub fn new() -> Self {
5268 std::default::Default::default()
5269 }
5270
5271 /// Sets the value of [name][crate::model::TokenAuthUser::name].
5272 ///
5273 /// # Example
5274 /// ```ignore,no_run
5275 /// # use google_cloud_memorystore_v1::model::TokenAuthUser;
5276 /// # let project_id = "project_id";
5277 /// # let location_id = "location_id";
5278 /// # let instance_id = "instance_id";
5279 /// # let token_auth_user_id = "token_auth_user_id";
5280 /// let x = TokenAuthUser::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"));
5281 /// ```
5282 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5283 self.name = v.into();
5284 self
5285 }
5286
5287 /// Sets the value of [state][crate::model::TokenAuthUser::state].
5288 ///
5289 /// # Example
5290 /// ```ignore,no_run
5291 /// # use google_cloud_memorystore_v1::model::TokenAuthUser;
5292 /// use google_cloud_memorystore_v1::model::token_auth_user::State;
5293 /// let x0 = TokenAuthUser::new().set_state(State::Active);
5294 /// let x1 = TokenAuthUser::new().set_state(State::Creating);
5295 /// let x2 = TokenAuthUser::new().set_state(State::Updating);
5296 /// ```
5297 pub fn set_state<T: std::convert::Into<crate::model::token_auth_user::State>>(
5298 mut self,
5299 v: T,
5300 ) -> Self {
5301 self.state = v.into();
5302 self
5303 }
5304}
5305
5306impl wkt::message::Message for TokenAuthUser {
5307 fn typename() -> &'static str {
5308 "type.googleapis.com/google.cloud.memorystore.v1.TokenAuthUser"
5309 }
5310}
5311
5312/// Defines additional types related to [TokenAuthUser].
5313pub mod token_auth_user {
5314 #[allow(unused_imports)]
5315 use super::*;
5316
5317 /// Represents the different states of a token based auth user.
5318 /// New values may be added in the future.
5319 ///
5320 /// # Working with unknown values
5321 ///
5322 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5323 /// additional enum variants at any time. Adding new variants is not considered
5324 /// a breaking change. Applications should write their code in anticipation of:
5325 ///
5326 /// - New values appearing in future releases of the client library, **and**
5327 /// - New values received dynamically, without application changes.
5328 ///
5329 /// Please consult the [Working with enums] section in the user guide for some
5330 /// guidelines.
5331 ///
5332 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5333 #[derive(Clone, Debug, PartialEq)]
5334 #[non_exhaustive]
5335 pub enum State {
5336 /// Not set.
5337 Unspecified,
5338 /// The auth user is active.
5339 Active,
5340 /// The auth user is being created.
5341 Creating,
5342 /// The auth user is being updated.
5343 Updating,
5344 /// The auth user is being deleted.
5345 Deleting,
5346 /// If set, the enum was initialized with an unknown value.
5347 ///
5348 /// Applications can examine the value using [State::value] or
5349 /// [State::name].
5350 UnknownValue(state::UnknownValue),
5351 }
5352
5353 #[doc(hidden)]
5354 pub mod state {
5355 #[allow(unused_imports)]
5356 use super::*;
5357 #[derive(Clone, Debug, PartialEq)]
5358 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5359 }
5360
5361 impl State {
5362 /// Gets the enum value.
5363 ///
5364 /// Returns `None` if the enum contains an unknown value deserialized from
5365 /// the string representation of enums.
5366 pub fn value(&self) -> std::option::Option<i32> {
5367 match self {
5368 Self::Unspecified => std::option::Option::Some(0),
5369 Self::Active => std::option::Option::Some(1),
5370 Self::Creating => std::option::Option::Some(2),
5371 Self::Updating => std::option::Option::Some(3),
5372 Self::Deleting => std::option::Option::Some(4),
5373 Self::UnknownValue(u) => u.0.value(),
5374 }
5375 }
5376
5377 /// Gets the enum value as a string.
5378 ///
5379 /// Returns `None` if the enum contains an unknown value deserialized from
5380 /// the integer representation of enums.
5381 pub fn name(&self) -> std::option::Option<&str> {
5382 match self {
5383 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5384 Self::Active => std::option::Option::Some("ACTIVE"),
5385 Self::Creating => std::option::Option::Some("CREATING"),
5386 Self::Updating => std::option::Option::Some("UPDATING"),
5387 Self::Deleting => std::option::Option::Some("DELETING"),
5388 Self::UnknownValue(u) => u.0.name(),
5389 }
5390 }
5391 }
5392
5393 impl std::default::Default for State {
5394 fn default() -> Self {
5395 use std::convert::From;
5396 Self::from(0)
5397 }
5398 }
5399
5400 impl std::fmt::Display for State {
5401 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5402 wkt::internal::display_enum(f, self.name(), self.value())
5403 }
5404 }
5405
5406 impl std::convert::From<i32> for State {
5407 fn from(value: i32) -> Self {
5408 match value {
5409 0 => Self::Unspecified,
5410 1 => Self::Active,
5411 2 => Self::Creating,
5412 3 => Self::Updating,
5413 4 => Self::Deleting,
5414 _ => Self::UnknownValue(state::UnknownValue(
5415 wkt::internal::UnknownEnumValue::Integer(value),
5416 )),
5417 }
5418 }
5419 }
5420
5421 impl std::convert::From<&str> for State {
5422 fn from(value: &str) -> Self {
5423 use std::string::ToString;
5424 match value {
5425 "STATE_UNSPECIFIED" => Self::Unspecified,
5426 "ACTIVE" => Self::Active,
5427 "CREATING" => Self::Creating,
5428 "UPDATING" => Self::Updating,
5429 "DELETING" => Self::Deleting,
5430 _ => Self::UnknownValue(state::UnknownValue(
5431 wkt::internal::UnknownEnumValue::String(value.to_string()),
5432 )),
5433 }
5434 }
5435 }
5436
5437 impl serde::ser::Serialize for State {
5438 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5439 where
5440 S: serde::Serializer,
5441 {
5442 match self {
5443 Self::Unspecified => serializer.serialize_i32(0),
5444 Self::Active => serializer.serialize_i32(1),
5445 Self::Creating => serializer.serialize_i32(2),
5446 Self::Updating => serializer.serialize_i32(3),
5447 Self::Deleting => serializer.serialize_i32(4),
5448 Self::UnknownValue(u) => u.0.serialize(serializer),
5449 }
5450 }
5451 }
5452
5453 impl<'de> serde::de::Deserialize<'de> for State {
5454 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5455 where
5456 D: serde::Deserializer<'de>,
5457 {
5458 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5459 ".google.cloud.memorystore.v1.TokenAuthUser.State",
5460 ))
5461 }
5462 }
5463}
5464
5465/// Auth token for the instance.
5466#[derive(Clone, Default, PartialEq)]
5467#[non_exhaustive]
5468pub struct AuthToken {
5469 /// Identifier. Name of the auth token.
5470 pub name: std::string::String,
5471
5472 /// Output only. The auth token.
5473 pub token: std::string::String,
5474
5475 /// Output only. Create time of the auth token.
5476 pub create_time: std::option::Option<wkt::Timestamp>,
5477
5478 /// Output only. The state of the auth token.
5479 pub state: crate::model::auth_token::State,
5480
5481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5482}
5483
5484impl AuthToken {
5485 /// Creates a new default instance.
5486 pub fn new() -> Self {
5487 std::default::Default::default()
5488 }
5489
5490 /// Sets the value of [name][crate::model::AuthToken::name].
5491 ///
5492 /// # Example
5493 /// ```ignore,no_run
5494 /// # use google_cloud_memorystore_v1::model::AuthToken;
5495 /// # let project_id = "project_id";
5496 /// # let location_id = "location_id";
5497 /// # let instance_id = "instance_id";
5498 /// # let token_auth_user_id = "token_auth_user_id";
5499 /// # let auth_token_id = "auth_token_id";
5500 /// let x = AuthToken::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}/authTokens/{auth_token_id}"));
5501 /// ```
5502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5503 self.name = v.into();
5504 self
5505 }
5506
5507 /// Sets the value of [token][crate::model::AuthToken::token].
5508 ///
5509 /// # Example
5510 /// ```ignore,no_run
5511 /// # use google_cloud_memorystore_v1::model::AuthToken;
5512 /// let x = AuthToken::new().set_token("example");
5513 /// ```
5514 pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5515 self.token = v.into();
5516 self
5517 }
5518
5519 /// Sets the value of [create_time][crate::model::AuthToken::create_time].
5520 ///
5521 /// # Example
5522 /// ```ignore,no_run
5523 /// # use google_cloud_memorystore_v1::model::AuthToken;
5524 /// use wkt::Timestamp;
5525 /// let x = AuthToken::new().set_create_time(Timestamp::default()/* use setters */);
5526 /// ```
5527 pub fn set_create_time<T>(mut self, v: T) -> Self
5528 where
5529 T: std::convert::Into<wkt::Timestamp>,
5530 {
5531 self.create_time = std::option::Option::Some(v.into());
5532 self
5533 }
5534
5535 /// Sets or clears the value of [create_time][crate::model::AuthToken::create_time].
5536 ///
5537 /// # Example
5538 /// ```ignore,no_run
5539 /// # use google_cloud_memorystore_v1::model::AuthToken;
5540 /// use wkt::Timestamp;
5541 /// let x = AuthToken::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5542 /// let x = AuthToken::new().set_or_clear_create_time(None::<Timestamp>);
5543 /// ```
5544 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5545 where
5546 T: std::convert::Into<wkt::Timestamp>,
5547 {
5548 self.create_time = v.map(|x| x.into());
5549 self
5550 }
5551
5552 /// Sets the value of [state][crate::model::AuthToken::state].
5553 ///
5554 /// # Example
5555 /// ```ignore,no_run
5556 /// # use google_cloud_memorystore_v1::model::AuthToken;
5557 /// use google_cloud_memorystore_v1::model::auth_token::State;
5558 /// let x0 = AuthToken::new().set_state(State::Active);
5559 /// let x1 = AuthToken::new().set_state(State::Creating);
5560 /// let x2 = AuthToken::new().set_state(State::Deleting);
5561 /// ```
5562 pub fn set_state<T: std::convert::Into<crate::model::auth_token::State>>(
5563 mut self,
5564 v: T,
5565 ) -> Self {
5566 self.state = v.into();
5567 self
5568 }
5569}
5570
5571impl wkt::message::Message for AuthToken {
5572 fn typename() -> &'static str {
5573 "type.googleapis.com/google.cloud.memorystore.v1.AuthToken"
5574 }
5575}
5576
5577/// Defines additional types related to [AuthToken].
5578pub mod auth_token {
5579 #[allow(unused_imports)]
5580 use super::*;
5581
5582 /// Represents the different states of an auth token.
5583 /// New values may be added in the future.
5584 ///
5585 /// # Working with unknown values
5586 ///
5587 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5588 /// additional enum variants at any time. Adding new variants is not considered
5589 /// a breaking change. Applications should write their code in anticipation of:
5590 ///
5591 /// - New values appearing in future releases of the client library, **and**
5592 /// - New values received dynamically, without application changes.
5593 ///
5594 /// Please consult the [Working with enums] section in the user guide for some
5595 /// guidelines.
5596 ///
5597 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5598 #[derive(Clone, Debug, PartialEq)]
5599 #[non_exhaustive]
5600 pub enum State {
5601 /// Not set.
5602 Unspecified,
5603 /// The auth token is active.
5604 Active,
5605 /// The auth token is being created.
5606 Creating,
5607 /// The auth token is being deleted.
5608 Deleting,
5609 /// If set, the enum was initialized with an unknown value.
5610 ///
5611 /// Applications can examine the value using [State::value] or
5612 /// [State::name].
5613 UnknownValue(state::UnknownValue),
5614 }
5615
5616 #[doc(hidden)]
5617 pub mod state {
5618 #[allow(unused_imports)]
5619 use super::*;
5620 #[derive(Clone, Debug, PartialEq)]
5621 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5622 }
5623
5624 impl State {
5625 /// Gets the enum value.
5626 ///
5627 /// Returns `None` if the enum contains an unknown value deserialized from
5628 /// the string representation of enums.
5629 pub fn value(&self) -> std::option::Option<i32> {
5630 match self {
5631 Self::Unspecified => std::option::Option::Some(0),
5632 Self::Active => std::option::Option::Some(1),
5633 Self::Creating => std::option::Option::Some(2),
5634 Self::Deleting => std::option::Option::Some(3),
5635 Self::UnknownValue(u) => u.0.value(),
5636 }
5637 }
5638
5639 /// Gets the enum value as a string.
5640 ///
5641 /// Returns `None` if the enum contains an unknown value deserialized from
5642 /// the integer representation of enums.
5643 pub fn name(&self) -> std::option::Option<&str> {
5644 match self {
5645 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5646 Self::Active => std::option::Option::Some("ACTIVE"),
5647 Self::Creating => std::option::Option::Some("CREATING"),
5648 Self::Deleting => std::option::Option::Some("DELETING"),
5649 Self::UnknownValue(u) => u.0.name(),
5650 }
5651 }
5652 }
5653
5654 impl std::default::Default for State {
5655 fn default() -> Self {
5656 use std::convert::From;
5657 Self::from(0)
5658 }
5659 }
5660
5661 impl std::fmt::Display for State {
5662 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5663 wkt::internal::display_enum(f, self.name(), self.value())
5664 }
5665 }
5666
5667 impl std::convert::From<i32> for State {
5668 fn from(value: i32) -> Self {
5669 match value {
5670 0 => Self::Unspecified,
5671 1 => Self::Active,
5672 2 => Self::Creating,
5673 3 => Self::Deleting,
5674 _ => Self::UnknownValue(state::UnknownValue(
5675 wkt::internal::UnknownEnumValue::Integer(value),
5676 )),
5677 }
5678 }
5679 }
5680
5681 impl std::convert::From<&str> for State {
5682 fn from(value: &str) -> Self {
5683 use std::string::ToString;
5684 match value {
5685 "STATE_UNSPECIFIED" => Self::Unspecified,
5686 "ACTIVE" => Self::Active,
5687 "CREATING" => Self::Creating,
5688 "DELETING" => Self::Deleting,
5689 _ => Self::UnknownValue(state::UnknownValue(
5690 wkt::internal::UnknownEnumValue::String(value.to_string()),
5691 )),
5692 }
5693 }
5694 }
5695
5696 impl serde::ser::Serialize for State {
5697 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5698 where
5699 S: serde::Serializer,
5700 {
5701 match self {
5702 Self::Unspecified => serializer.serialize_i32(0),
5703 Self::Active => serializer.serialize_i32(1),
5704 Self::Creating => serializer.serialize_i32(2),
5705 Self::Deleting => serializer.serialize_i32(3),
5706 Self::UnknownValue(u) => u.0.serialize(serializer),
5707 }
5708 }
5709 }
5710
5711 impl<'de> serde::de::Deserialize<'de> for State {
5712 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5713 where
5714 D: serde::Deserializer<'de>,
5715 {
5716 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
5717 ".google.cloud.memorystore.v1.AuthToken.State",
5718 ))
5719 }
5720 }
5721}
5722
5723/// Maintenance policy per instance.
5724#[derive(Clone, Default, PartialEq)]
5725#[non_exhaustive]
5726pub struct MaintenancePolicy {
5727 /// Output only. The time when the policy was created.
5728 pub create_time: std::option::Option<wkt::Timestamp>,
5729
5730 /// Output only. The time when the policy was updated.
5731 pub update_time: std::option::Option<wkt::Timestamp>,
5732
5733 /// Optional. Maintenance window that is applied to resources covered by this
5734 /// policy. Minimum 1. For the current version, the maximum number of
5735 /// weekly_window is expected to be one.
5736 pub weekly_maintenance_window: std::vec::Vec<crate::model::WeeklyMaintenanceWindow>,
5737
5738 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5739}
5740
5741impl MaintenancePolicy {
5742 /// Creates a new default instance.
5743 pub fn new() -> Self {
5744 std::default::Default::default()
5745 }
5746
5747 /// Sets the value of [create_time][crate::model::MaintenancePolicy::create_time].
5748 ///
5749 /// # Example
5750 /// ```ignore,no_run
5751 /// # use google_cloud_memorystore_v1::model::MaintenancePolicy;
5752 /// use wkt::Timestamp;
5753 /// let x = MaintenancePolicy::new().set_create_time(Timestamp::default()/* use setters */);
5754 /// ```
5755 pub fn set_create_time<T>(mut self, v: T) -> Self
5756 where
5757 T: std::convert::Into<wkt::Timestamp>,
5758 {
5759 self.create_time = std::option::Option::Some(v.into());
5760 self
5761 }
5762
5763 /// Sets or clears the value of [create_time][crate::model::MaintenancePolicy::create_time].
5764 ///
5765 /// # Example
5766 /// ```ignore,no_run
5767 /// # use google_cloud_memorystore_v1::model::MaintenancePolicy;
5768 /// use wkt::Timestamp;
5769 /// let x = MaintenancePolicy::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5770 /// let x = MaintenancePolicy::new().set_or_clear_create_time(None::<Timestamp>);
5771 /// ```
5772 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5773 where
5774 T: std::convert::Into<wkt::Timestamp>,
5775 {
5776 self.create_time = v.map(|x| x.into());
5777 self
5778 }
5779
5780 /// Sets the value of [update_time][crate::model::MaintenancePolicy::update_time].
5781 ///
5782 /// # Example
5783 /// ```ignore,no_run
5784 /// # use google_cloud_memorystore_v1::model::MaintenancePolicy;
5785 /// use wkt::Timestamp;
5786 /// let x = MaintenancePolicy::new().set_update_time(Timestamp::default()/* use setters */);
5787 /// ```
5788 pub fn set_update_time<T>(mut self, v: T) -> Self
5789 where
5790 T: std::convert::Into<wkt::Timestamp>,
5791 {
5792 self.update_time = std::option::Option::Some(v.into());
5793 self
5794 }
5795
5796 /// Sets or clears the value of [update_time][crate::model::MaintenancePolicy::update_time].
5797 ///
5798 /// # Example
5799 /// ```ignore,no_run
5800 /// # use google_cloud_memorystore_v1::model::MaintenancePolicy;
5801 /// use wkt::Timestamp;
5802 /// let x = MaintenancePolicy::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5803 /// let x = MaintenancePolicy::new().set_or_clear_update_time(None::<Timestamp>);
5804 /// ```
5805 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5806 where
5807 T: std::convert::Into<wkt::Timestamp>,
5808 {
5809 self.update_time = v.map(|x| x.into());
5810 self
5811 }
5812
5813 /// Sets the value of [weekly_maintenance_window][crate::model::MaintenancePolicy::weekly_maintenance_window].
5814 ///
5815 /// # Example
5816 /// ```ignore,no_run
5817 /// # use google_cloud_memorystore_v1::model::MaintenancePolicy;
5818 /// use google_cloud_memorystore_v1::model::WeeklyMaintenanceWindow;
5819 /// let x = MaintenancePolicy::new()
5820 /// .set_weekly_maintenance_window([
5821 /// WeeklyMaintenanceWindow::default()/* use setters */,
5822 /// WeeklyMaintenanceWindow::default()/* use (different) setters */,
5823 /// ]);
5824 /// ```
5825 pub fn set_weekly_maintenance_window<T, V>(mut self, v: T) -> Self
5826 where
5827 T: std::iter::IntoIterator<Item = V>,
5828 V: std::convert::Into<crate::model::WeeklyMaintenanceWindow>,
5829 {
5830 use std::iter::Iterator;
5831 self.weekly_maintenance_window = v.into_iter().map(|i| i.into()).collect();
5832 self
5833 }
5834}
5835
5836impl wkt::message::Message for MaintenancePolicy {
5837 fn typename() -> &'static str {
5838 "type.googleapis.com/google.cloud.memorystore.v1.MaintenancePolicy"
5839 }
5840}
5841
5842/// Time window specified for weekly operations.
5843#[derive(Clone, Default, PartialEq)]
5844#[non_exhaustive]
5845pub struct WeeklyMaintenanceWindow {
5846 /// Optional. Allows to define schedule that runs specified day of the week.
5847 pub day: google_cloud_type::model::DayOfWeek,
5848
5849 /// Optional. Start time of the window in UTC.
5850 pub start_time: std::option::Option<google_cloud_type::model::TimeOfDay>,
5851
5852 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5853}
5854
5855impl WeeklyMaintenanceWindow {
5856 /// Creates a new default instance.
5857 pub fn new() -> Self {
5858 std::default::Default::default()
5859 }
5860
5861 /// Sets the value of [day][crate::model::WeeklyMaintenanceWindow::day].
5862 ///
5863 /// # Example
5864 /// ```ignore,no_run
5865 /// # use google_cloud_memorystore_v1::model::WeeklyMaintenanceWindow;
5866 /// use google_cloud_type::model::DayOfWeek;
5867 /// let x0 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Monday);
5868 /// let x1 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Tuesday);
5869 /// let x2 = WeeklyMaintenanceWindow::new().set_day(DayOfWeek::Wednesday);
5870 /// ```
5871 pub fn set_day<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
5872 mut self,
5873 v: T,
5874 ) -> Self {
5875 self.day = v.into();
5876 self
5877 }
5878
5879 /// Sets the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
5880 ///
5881 /// # Example
5882 /// ```ignore,no_run
5883 /// # use google_cloud_memorystore_v1::model::WeeklyMaintenanceWindow;
5884 /// use google_cloud_type::model::TimeOfDay;
5885 /// let x = WeeklyMaintenanceWindow::new().set_start_time(TimeOfDay::default()/* use setters */);
5886 /// ```
5887 pub fn set_start_time<T>(mut self, v: T) -> Self
5888 where
5889 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
5890 {
5891 self.start_time = std::option::Option::Some(v.into());
5892 self
5893 }
5894
5895 /// Sets or clears the value of [start_time][crate::model::WeeklyMaintenanceWindow::start_time].
5896 ///
5897 /// # Example
5898 /// ```ignore,no_run
5899 /// # use google_cloud_memorystore_v1::model::WeeklyMaintenanceWindow;
5900 /// use google_cloud_type::model::TimeOfDay;
5901 /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(Some(TimeOfDay::default()/* use setters */));
5902 /// let x = WeeklyMaintenanceWindow::new().set_or_clear_start_time(None::<TimeOfDay>);
5903 /// ```
5904 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5905 where
5906 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
5907 {
5908 self.start_time = v.map(|x| x.into());
5909 self
5910 }
5911}
5912
5913impl wkt::message::Message for WeeklyMaintenanceWindow {
5914 fn typename() -> &'static str {
5915 "type.googleapis.com/google.cloud.memorystore.v1.WeeklyMaintenanceWindow"
5916 }
5917}
5918
5919/// Upcoming maintenance schedule.
5920#[derive(Clone, Default, PartialEq)]
5921#[non_exhaustive]
5922pub struct MaintenanceSchedule {
5923 /// Output only. The start time of any upcoming scheduled maintenance for this
5924 /// instance.
5925 pub start_time: std::option::Option<wkt::Timestamp>,
5926
5927 /// Output only. The end time of any upcoming scheduled maintenance for this
5928 /// instance.
5929 pub end_time: std::option::Option<wkt::Timestamp>,
5930
5931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5932}
5933
5934impl MaintenanceSchedule {
5935 /// Creates a new default instance.
5936 pub fn new() -> Self {
5937 std::default::Default::default()
5938 }
5939
5940 /// Sets the value of [start_time][crate::model::MaintenanceSchedule::start_time].
5941 ///
5942 /// # Example
5943 /// ```ignore,no_run
5944 /// # use google_cloud_memorystore_v1::model::MaintenanceSchedule;
5945 /// use wkt::Timestamp;
5946 /// let x = MaintenanceSchedule::new().set_start_time(Timestamp::default()/* use setters */);
5947 /// ```
5948 pub fn set_start_time<T>(mut self, v: T) -> Self
5949 where
5950 T: std::convert::Into<wkt::Timestamp>,
5951 {
5952 self.start_time = std::option::Option::Some(v.into());
5953 self
5954 }
5955
5956 /// Sets or clears the value of [start_time][crate::model::MaintenanceSchedule::start_time].
5957 ///
5958 /// # Example
5959 /// ```ignore,no_run
5960 /// # use google_cloud_memorystore_v1::model::MaintenanceSchedule;
5961 /// use wkt::Timestamp;
5962 /// let x = MaintenanceSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
5963 /// let x = MaintenanceSchedule::new().set_or_clear_start_time(None::<Timestamp>);
5964 /// ```
5965 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
5966 where
5967 T: std::convert::Into<wkt::Timestamp>,
5968 {
5969 self.start_time = v.map(|x| x.into());
5970 self
5971 }
5972
5973 /// Sets the value of [end_time][crate::model::MaintenanceSchedule::end_time].
5974 ///
5975 /// # Example
5976 /// ```ignore,no_run
5977 /// # use google_cloud_memorystore_v1::model::MaintenanceSchedule;
5978 /// use wkt::Timestamp;
5979 /// let x = MaintenanceSchedule::new().set_end_time(Timestamp::default()/* use setters */);
5980 /// ```
5981 pub fn set_end_time<T>(mut self, v: T) -> Self
5982 where
5983 T: std::convert::Into<wkt::Timestamp>,
5984 {
5985 self.end_time = std::option::Option::Some(v.into());
5986 self
5987 }
5988
5989 /// Sets or clears the value of [end_time][crate::model::MaintenanceSchedule::end_time].
5990 ///
5991 /// # Example
5992 /// ```ignore,no_run
5993 /// # use google_cloud_memorystore_v1::model::MaintenanceSchedule;
5994 /// use wkt::Timestamp;
5995 /// let x = MaintenanceSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
5996 /// let x = MaintenanceSchedule::new().set_or_clear_end_time(None::<Timestamp>);
5997 /// ```
5998 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5999 where
6000 T: std::convert::Into<wkt::Timestamp>,
6001 {
6002 self.end_time = v.map(|x| x.into());
6003 self
6004 }
6005}
6006
6007impl wkt::message::Message for MaintenanceSchedule {
6008 fn typename() -> &'static str {
6009 "type.googleapis.com/google.cloud.memorystore.v1.MaintenanceSchedule"
6010 }
6011}
6012
6013/// Configuration of a service attachment of the cluster, for creating PSC
6014/// connections.
6015#[derive(Clone, Default, PartialEq)]
6016#[non_exhaustive]
6017pub struct PscAttachmentDetail {
6018 /// Output only. Service attachment URI which your self-created PscConnection
6019 /// should use as target.
6020 pub service_attachment: std::string::String,
6021
6022 /// Output only. Type of Psc endpoint.
6023 pub connection_type: crate::model::ConnectionType,
6024
6025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6026}
6027
6028impl PscAttachmentDetail {
6029 /// Creates a new default instance.
6030 pub fn new() -> Self {
6031 std::default::Default::default()
6032 }
6033
6034 /// Sets the value of [service_attachment][crate::model::PscAttachmentDetail::service_attachment].
6035 ///
6036 /// # Example
6037 /// ```ignore,no_run
6038 /// # use google_cloud_memorystore_v1::model::PscAttachmentDetail;
6039 /// let x = PscAttachmentDetail::new().set_service_attachment("example");
6040 /// ```
6041 pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
6042 mut self,
6043 v: T,
6044 ) -> Self {
6045 self.service_attachment = v.into();
6046 self
6047 }
6048
6049 /// Sets the value of [connection_type][crate::model::PscAttachmentDetail::connection_type].
6050 ///
6051 /// # Example
6052 /// ```ignore,no_run
6053 /// # use google_cloud_memorystore_v1::model::PscAttachmentDetail;
6054 /// use google_cloud_memorystore_v1::model::ConnectionType;
6055 /// let x0 = PscAttachmentDetail::new().set_connection_type(ConnectionType::Discovery);
6056 /// let x1 = PscAttachmentDetail::new().set_connection_type(ConnectionType::Primary);
6057 /// let x2 = PscAttachmentDetail::new().set_connection_type(ConnectionType::Reader);
6058 /// ```
6059 pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
6060 mut self,
6061 v: T,
6062 ) -> Self {
6063 self.connection_type = v.into();
6064 self
6065 }
6066}
6067
6068impl wkt::message::Message for PscAttachmentDetail {
6069 fn typename() -> &'static str {
6070 "type.googleapis.com/google.cloud.memorystore.v1.PscAttachmentDetail"
6071 }
6072}
6073
6074/// Details of consumer resources in a PSC connection.
6075#[derive(Clone, Default, PartialEq)]
6076#[non_exhaustive]
6077pub struct PscAutoConnection {
6078 /// Output only. The PSC connection id of the forwarding rule connected to the
6079 /// service attachment.
6080 pub psc_connection_id: std::string::String,
6081
6082 /// Output only. The IP allocated on the consumer network for the PSC
6083 /// forwarding rule.
6084 pub ip_address: std::string::String,
6085
6086 /// Output only. The URI of the consumer side forwarding rule.
6087 /// Format:
6088 /// projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
6089 pub forwarding_rule: std::string::String,
6090
6091 /// Required. The consumer project_id where PSC connections are established.
6092 /// This should be the same project_id that the instance is being created in.
6093 pub project_id: std::string::String,
6094
6095 /// Required. The network where the PSC endpoints are created, in the form of
6096 /// projects/{project_id}/global/networks/{network_name}.
6097 pub network: std::string::String,
6098
6099 /// Output only. The service attachment which is the target of the PSC
6100 /// connection, in the form of
6101 /// projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
6102 pub service_attachment: std::string::String,
6103
6104 /// Output only. The status of the PSC connection: whether a connection exists
6105 /// and ACTIVE or it no longer exists. Please note that this value is updated
6106 /// periodically. Please use Private Service Connect APIs for the latest
6107 /// status.
6108 pub psc_connection_status: crate::model::PscConnectionStatus,
6109
6110 /// Output only. Type of the PSC connection.
6111 pub connection_type: crate::model::ConnectionType,
6112
6113 /// Ports of the exposed endpoint.
6114 pub ports: std::option::Option<crate::model::psc_auto_connection::Ports>,
6115
6116 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6117}
6118
6119impl PscAutoConnection {
6120 /// Creates a new default instance.
6121 pub fn new() -> Self {
6122 std::default::Default::default()
6123 }
6124
6125 /// Sets the value of [psc_connection_id][crate::model::PscAutoConnection::psc_connection_id].
6126 ///
6127 /// # Example
6128 /// ```ignore,no_run
6129 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6130 /// let x = PscAutoConnection::new().set_psc_connection_id("example");
6131 /// ```
6132 pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
6133 mut self,
6134 v: T,
6135 ) -> Self {
6136 self.psc_connection_id = v.into();
6137 self
6138 }
6139
6140 /// Sets the value of [ip_address][crate::model::PscAutoConnection::ip_address].
6141 ///
6142 /// # Example
6143 /// ```ignore,no_run
6144 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6145 /// let x = PscAutoConnection::new().set_ip_address("example");
6146 /// ```
6147 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6148 self.ip_address = v.into();
6149 self
6150 }
6151
6152 /// Sets the value of [forwarding_rule][crate::model::PscAutoConnection::forwarding_rule].
6153 ///
6154 /// # Example
6155 /// ```ignore,no_run
6156 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6157 /// let x = PscAutoConnection::new().set_forwarding_rule("example");
6158 /// ```
6159 pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6160 self.forwarding_rule = v.into();
6161 self
6162 }
6163
6164 /// Sets the value of [project_id][crate::model::PscAutoConnection::project_id].
6165 ///
6166 /// # Example
6167 /// ```ignore,no_run
6168 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6169 /// let x = PscAutoConnection::new().set_project_id("example");
6170 /// ```
6171 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6172 self.project_id = v.into();
6173 self
6174 }
6175
6176 /// Sets the value of [network][crate::model::PscAutoConnection::network].
6177 ///
6178 /// # Example
6179 /// ```ignore,no_run
6180 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6181 /// let x = PscAutoConnection::new().set_network("example");
6182 /// ```
6183 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6184 self.network = v.into();
6185 self
6186 }
6187
6188 /// Sets the value of [service_attachment][crate::model::PscAutoConnection::service_attachment].
6189 ///
6190 /// # Example
6191 /// ```ignore,no_run
6192 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6193 /// let x = PscAutoConnection::new().set_service_attachment("example");
6194 /// ```
6195 pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
6196 mut self,
6197 v: T,
6198 ) -> Self {
6199 self.service_attachment = v.into();
6200 self
6201 }
6202
6203 /// Sets the value of [psc_connection_status][crate::model::PscAutoConnection::psc_connection_status].
6204 ///
6205 /// # Example
6206 /// ```ignore,no_run
6207 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6208 /// use google_cloud_memorystore_v1::model::PscConnectionStatus;
6209 /// let x0 = PscAutoConnection::new().set_psc_connection_status(PscConnectionStatus::Active);
6210 /// let x1 = PscAutoConnection::new().set_psc_connection_status(PscConnectionStatus::NotFound);
6211 /// ```
6212 pub fn set_psc_connection_status<T: std::convert::Into<crate::model::PscConnectionStatus>>(
6213 mut self,
6214 v: T,
6215 ) -> Self {
6216 self.psc_connection_status = v.into();
6217 self
6218 }
6219
6220 /// Sets the value of [connection_type][crate::model::PscAutoConnection::connection_type].
6221 ///
6222 /// # Example
6223 /// ```ignore,no_run
6224 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6225 /// use google_cloud_memorystore_v1::model::ConnectionType;
6226 /// let x0 = PscAutoConnection::new().set_connection_type(ConnectionType::Discovery);
6227 /// let x1 = PscAutoConnection::new().set_connection_type(ConnectionType::Primary);
6228 /// let x2 = PscAutoConnection::new().set_connection_type(ConnectionType::Reader);
6229 /// ```
6230 pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
6231 mut self,
6232 v: T,
6233 ) -> Self {
6234 self.connection_type = v.into();
6235 self
6236 }
6237
6238 /// Sets the value of [ports][crate::model::PscAutoConnection::ports].
6239 ///
6240 /// Note that all the setters affecting `ports` are mutually
6241 /// exclusive.
6242 ///
6243 /// # Example
6244 /// ```ignore,no_run
6245 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6246 /// use google_cloud_memorystore_v1::model::psc_auto_connection::Ports;
6247 /// let x = PscAutoConnection::new().set_ports(Some(Ports::Port(42)));
6248 /// ```
6249 pub fn set_ports<
6250 T: std::convert::Into<std::option::Option<crate::model::psc_auto_connection::Ports>>,
6251 >(
6252 mut self,
6253 v: T,
6254 ) -> Self {
6255 self.ports = v.into();
6256 self
6257 }
6258
6259 /// The value of [ports][crate::model::PscAutoConnection::ports]
6260 /// if it holds a `Port`, `None` if the field is not set or
6261 /// holds a different branch.
6262 pub fn port(&self) -> std::option::Option<&i32> {
6263 #[allow(unreachable_patterns)]
6264 self.ports.as_ref().and_then(|v| match v {
6265 crate::model::psc_auto_connection::Ports::Port(v) => std::option::Option::Some(v),
6266 _ => std::option::Option::None,
6267 })
6268 }
6269
6270 /// Sets the value of [ports][crate::model::PscAutoConnection::ports]
6271 /// to hold a `Port`.
6272 ///
6273 /// Note that all the setters affecting `ports` are
6274 /// mutually exclusive.
6275 ///
6276 /// # Example
6277 /// ```ignore,no_run
6278 /// # use google_cloud_memorystore_v1::model::PscAutoConnection;
6279 /// let x = PscAutoConnection::new().set_port(42);
6280 /// assert!(x.port().is_some());
6281 /// ```
6282 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6283 self.ports =
6284 std::option::Option::Some(crate::model::psc_auto_connection::Ports::Port(v.into()));
6285 self
6286 }
6287}
6288
6289impl wkt::message::Message for PscAutoConnection {
6290 fn typename() -> &'static str {
6291 "type.googleapis.com/google.cloud.memorystore.v1.PscAutoConnection"
6292 }
6293}
6294
6295/// Defines additional types related to [PscAutoConnection].
6296pub mod psc_auto_connection {
6297 #[allow(unused_imports)]
6298 use super::*;
6299
6300 /// Ports of the exposed endpoint.
6301 #[derive(Clone, Debug, PartialEq)]
6302 #[non_exhaustive]
6303 pub enum Ports {
6304 /// Optional. port will only be set for Primary/Reader or Discovery endpoint.
6305 Port(i32),
6306 }
6307}
6308
6309/// User created Psc connection configuration.
6310#[derive(Clone, Default, PartialEq)]
6311#[non_exhaustive]
6312pub struct PscConnection {
6313 /// Required. The PSC connection id of the forwarding rule connected to the
6314 /// service attachment.
6315 pub psc_connection_id: std::string::String,
6316
6317 /// Required. The IP allocated on the consumer network for the PSC forwarding
6318 /// rule.
6319 pub ip_address: std::string::String,
6320
6321 /// Required. The URI of the consumer side forwarding rule.
6322 /// Format:
6323 /// projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
6324 pub forwarding_rule: std::string::String,
6325
6326 /// Output only. The consumer project_id where the forwarding rule is created
6327 /// from.
6328 pub project_id: std::string::String,
6329
6330 /// Required. The consumer network where the IP address resides, in the form of
6331 /// projects/{project_id}/global/networks/{network_name}.
6332 pub network: std::string::String,
6333
6334 /// Required. The service attachment which is the target of the PSC connection,
6335 /// in the form of
6336 /// projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
6337 pub service_attachment: std::string::String,
6338
6339 /// Output only. The status of the PSC connection: whether a connection exists
6340 /// and ACTIVE or it no longer exists. Please note that this value is updated
6341 /// periodically. Please use Private Service Connect APIs for the latest
6342 /// status.
6343 pub psc_connection_status: crate::model::PscConnectionStatus,
6344
6345 /// Output only. Type of the PSC connection.
6346 pub connection_type: crate::model::ConnectionType,
6347
6348 /// Ports of the exposed endpoint.
6349 pub ports: std::option::Option<crate::model::psc_connection::Ports>,
6350
6351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6352}
6353
6354impl PscConnection {
6355 /// Creates a new default instance.
6356 pub fn new() -> Self {
6357 std::default::Default::default()
6358 }
6359
6360 /// Sets the value of [psc_connection_id][crate::model::PscConnection::psc_connection_id].
6361 ///
6362 /// # Example
6363 /// ```ignore,no_run
6364 /// # use google_cloud_memorystore_v1::model::PscConnection;
6365 /// let x = PscConnection::new().set_psc_connection_id("example");
6366 /// ```
6367 pub fn set_psc_connection_id<T: std::convert::Into<std::string::String>>(
6368 mut self,
6369 v: T,
6370 ) -> Self {
6371 self.psc_connection_id = v.into();
6372 self
6373 }
6374
6375 /// Sets the value of [ip_address][crate::model::PscConnection::ip_address].
6376 ///
6377 /// # Example
6378 /// ```ignore,no_run
6379 /// # use google_cloud_memorystore_v1::model::PscConnection;
6380 /// let x = PscConnection::new().set_ip_address("example");
6381 /// ```
6382 pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6383 self.ip_address = v.into();
6384 self
6385 }
6386
6387 /// Sets the value of [forwarding_rule][crate::model::PscConnection::forwarding_rule].
6388 ///
6389 /// # Example
6390 /// ```ignore,no_run
6391 /// # use google_cloud_memorystore_v1::model::PscConnection;
6392 /// let x = PscConnection::new().set_forwarding_rule("example");
6393 /// ```
6394 pub fn set_forwarding_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6395 self.forwarding_rule = v.into();
6396 self
6397 }
6398
6399 /// Sets the value of [project_id][crate::model::PscConnection::project_id].
6400 ///
6401 /// # Example
6402 /// ```ignore,no_run
6403 /// # use google_cloud_memorystore_v1::model::PscConnection;
6404 /// let x = PscConnection::new().set_project_id("example");
6405 /// ```
6406 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6407 self.project_id = v.into();
6408 self
6409 }
6410
6411 /// Sets the value of [network][crate::model::PscConnection::network].
6412 ///
6413 /// # Example
6414 /// ```ignore,no_run
6415 /// # use google_cloud_memorystore_v1::model::PscConnection;
6416 /// let x = PscConnection::new().set_network("example");
6417 /// ```
6418 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6419 self.network = v.into();
6420 self
6421 }
6422
6423 /// Sets the value of [service_attachment][crate::model::PscConnection::service_attachment].
6424 ///
6425 /// # Example
6426 /// ```ignore,no_run
6427 /// # use google_cloud_memorystore_v1::model::PscConnection;
6428 /// let x = PscConnection::new().set_service_attachment("example");
6429 /// ```
6430 pub fn set_service_attachment<T: std::convert::Into<std::string::String>>(
6431 mut self,
6432 v: T,
6433 ) -> Self {
6434 self.service_attachment = v.into();
6435 self
6436 }
6437
6438 /// Sets the value of [psc_connection_status][crate::model::PscConnection::psc_connection_status].
6439 ///
6440 /// # Example
6441 /// ```ignore,no_run
6442 /// # use google_cloud_memorystore_v1::model::PscConnection;
6443 /// use google_cloud_memorystore_v1::model::PscConnectionStatus;
6444 /// let x0 = PscConnection::new().set_psc_connection_status(PscConnectionStatus::Active);
6445 /// let x1 = PscConnection::new().set_psc_connection_status(PscConnectionStatus::NotFound);
6446 /// ```
6447 pub fn set_psc_connection_status<T: std::convert::Into<crate::model::PscConnectionStatus>>(
6448 mut self,
6449 v: T,
6450 ) -> Self {
6451 self.psc_connection_status = v.into();
6452 self
6453 }
6454
6455 /// Sets the value of [connection_type][crate::model::PscConnection::connection_type].
6456 ///
6457 /// # Example
6458 /// ```ignore,no_run
6459 /// # use google_cloud_memorystore_v1::model::PscConnection;
6460 /// use google_cloud_memorystore_v1::model::ConnectionType;
6461 /// let x0 = PscConnection::new().set_connection_type(ConnectionType::Discovery);
6462 /// let x1 = PscConnection::new().set_connection_type(ConnectionType::Primary);
6463 /// let x2 = PscConnection::new().set_connection_type(ConnectionType::Reader);
6464 /// ```
6465 pub fn set_connection_type<T: std::convert::Into<crate::model::ConnectionType>>(
6466 mut self,
6467 v: T,
6468 ) -> Self {
6469 self.connection_type = v.into();
6470 self
6471 }
6472
6473 /// Sets the value of [ports][crate::model::PscConnection::ports].
6474 ///
6475 /// Note that all the setters affecting `ports` are mutually
6476 /// exclusive.
6477 ///
6478 /// # Example
6479 /// ```ignore,no_run
6480 /// # use google_cloud_memorystore_v1::model::PscConnection;
6481 /// use google_cloud_memorystore_v1::model::psc_connection::Ports;
6482 /// let x = PscConnection::new().set_ports(Some(Ports::Port(42)));
6483 /// ```
6484 pub fn set_ports<
6485 T: std::convert::Into<std::option::Option<crate::model::psc_connection::Ports>>,
6486 >(
6487 mut self,
6488 v: T,
6489 ) -> Self {
6490 self.ports = v.into();
6491 self
6492 }
6493
6494 /// The value of [ports][crate::model::PscConnection::ports]
6495 /// if it holds a `Port`, `None` if the field is not set or
6496 /// holds a different branch.
6497 pub fn port(&self) -> std::option::Option<&i32> {
6498 #[allow(unreachable_patterns)]
6499 self.ports.as_ref().and_then(|v| match v {
6500 crate::model::psc_connection::Ports::Port(v) => std::option::Option::Some(v),
6501 _ => std::option::Option::None,
6502 })
6503 }
6504
6505 /// Sets the value of [ports][crate::model::PscConnection::ports]
6506 /// to hold a `Port`.
6507 ///
6508 /// Note that all the setters affecting `ports` are
6509 /// mutually exclusive.
6510 ///
6511 /// # Example
6512 /// ```ignore,no_run
6513 /// # use google_cloud_memorystore_v1::model::PscConnection;
6514 /// let x = PscConnection::new().set_port(42);
6515 /// assert!(x.port().is_some());
6516 /// ```
6517 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6518 self.ports = std::option::Option::Some(crate::model::psc_connection::Ports::Port(v.into()));
6519 self
6520 }
6521}
6522
6523impl wkt::message::Message for PscConnection {
6524 fn typename() -> &'static str {
6525 "type.googleapis.com/google.cloud.memorystore.v1.PscConnection"
6526 }
6527}
6528
6529/// Defines additional types related to [PscConnection].
6530pub mod psc_connection {
6531 #[allow(unused_imports)]
6532 use super::*;
6533
6534 /// Ports of the exposed endpoint.
6535 #[derive(Clone, Debug, PartialEq)]
6536 #[non_exhaustive]
6537 pub enum Ports {
6538 /// Optional. port will only be set for Primary/Reader or Discovery endpoint.
6539 Port(i32),
6540 }
6541}
6542
6543/// Represents an endpoint for clients to connect to the instance.
6544#[derive(Clone, Default, PartialEq)]
6545#[non_exhaustive]
6546pub struct DiscoveryEndpoint {
6547 /// Output only. IP address of the exposed endpoint clients connect to.
6548 pub address: std::string::String,
6549
6550 /// Output only. The port number of the exposed endpoint.
6551 pub port: i32,
6552
6553 /// Output only. The network where the IP address of the discovery endpoint
6554 /// will be reserved, in the form of
6555 /// projects/{network_project}/global/networks/{network_name}.
6556 pub network: std::string::String,
6557
6558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6559}
6560
6561impl DiscoveryEndpoint {
6562 /// Creates a new default instance.
6563 pub fn new() -> Self {
6564 std::default::Default::default()
6565 }
6566
6567 /// Sets the value of [address][crate::model::DiscoveryEndpoint::address].
6568 ///
6569 /// # Example
6570 /// ```ignore,no_run
6571 /// # use google_cloud_memorystore_v1::model::DiscoveryEndpoint;
6572 /// let x = DiscoveryEndpoint::new().set_address("example");
6573 /// ```
6574 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6575 self.address = v.into();
6576 self
6577 }
6578
6579 /// Sets the value of [port][crate::model::DiscoveryEndpoint::port].
6580 ///
6581 /// # Example
6582 /// ```ignore,no_run
6583 /// # use google_cloud_memorystore_v1::model::DiscoveryEndpoint;
6584 /// let x = DiscoveryEndpoint::new().set_port(42);
6585 /// ```
6586 pub fn set_port<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6587 self.port = v.into();
6588 self
6589 }
6590
6591 /// Sets the value of [network][crate::model::DiscoveryEndpoint::network].
6592 ///
6593 /// # Example
6594 /// ```ignore,no_run
6595 /// # use google_cloud_memorystore_v1::model::DiscoveryEndpoint;
6596 /// let x = DiscoveryEndpoint::new().set_network("example");
6597 /// ```
6598 pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6599 self.network = v.into();
6600 self
6601 }
6602}
6603
6604impl wkt::message::Message for DiscoveryEndpoint {
6605 fn typename() -> &'static str {
6606 "type.googleapis.com/google.cloud.memorystore.v1.DiscoveryEndpoint"
6607 }
6608}
6609
6610/// Represents persistence configuration for a instance.
6611#[derive(Clone, Default, PartialEq)]
6612#[non_exhaustive]
6613pub struct PersistenceConfig {
6614 /// Optional. Current persistence mode.
6615 pub mode: crate::model::persistence_config::PersistenceMode,
6616
6617 /// Optional. RDB configuration. This field will be ignored if mode is not RDB.
6618 pub rdb_config: std::option::Option<crate::model::persistence_config::RDBConfig>,
6619
6620 /// Optional. AOF configuration. This field will be ignored if mode is not AOF.
6621 pub aof_config: std::option::Option<crate::model::persistence_config::AOFConfig>,
6622
6623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6624}
6625
6626impl PersistenceConfig {
6627 /// Creates a new default instance.
6628 pub fn new() -> Self {
6629 std::default::Default::default()
6630 }
6631
6632 /// Sets the value of [mode][crate::model::PersistenceConfig::mode].
6633 ///
6634 /// # Example
6635 /// ```ignore,no_run
6636 /// # use google_cloud_memorystore_v1::model::PersistenceConfig;
6637 /// use google_cloud_memorystore_v1::model::persistence_config::PersistenceMode;
6638 /// let x0 = PersistenceConfig::new().set_mode(PersistenceMode::Disabled);
6639 /// let x1 = PersistenceConfig::new().set_mode(PersistenceMode::Rdb);
6640 /// let x2 = PersistenceConfig::new().set_mode(PersistenceMode::Aof);
6641 /// ```
6642 pub fn set_mode<T: std::convert::Into<crate::model::persistence_config::PersistenceMode>>(
6643 mut self,
6644 v: T,
6645 ) -> Self {
6646 self.mode = v.into();
6647 self
6648 }
6649
6650 /// Sets the value of [rdb_config][crate::model::PersistenceConfig::rdb_config].
6651 ///
6652 /// # Example
6653 /// ```ignore,no_run
6654 /// # use google_cloud_memorystore_v1::model::PersistenceConfig;
6655 /// use google_cloud_memorystore_v1::model::persistence_config::RDBConfig;
6656 /// let x = PersistenceConfig::new().set_rdb_config(RDBConfig::default()/* use setters */);
6657 /// ```
6658 pub fn set_rdb_config<T>(mut self, v: T) -> Self
6659 where
6660 T: std::convert::Into<crate::model::persistence_config::RDBConfig>,
6661 {
6662 self.rdb_config = std::option::Option::Some(v.into());
6663 self
6664 }
6665
6666 /// Sets or clears the value of [rdb_config][crate::model::PersistenceConfig::rdb_config].
6667 ///
6668 /// # Example
6669 /// ```ignore,no_run
6670 /// # use google_cloud_memorystore_v1::model::PersistenceConfig;
6671 /// use google_cloud_memorystore_v1::model::persistence_config::RDBConfig;
6672 /// let x = PersistenceConfig::new().set_or_clear_rdb_config(Some(RDBConfig::default()/* use setters */));
6673 /// let x = PersistenceConfig::new().set_or_clear_rdb_config(None::<RDBConfig>);
6674 /// ```
6675 pub fn set_or_clear_rdb_config<T>(mut self, v: std::option::Option<T>) -> Self
6676 where
6677 T: std::convert::Into<crate::model::persistence_config::RDBConfig>,
6678 {
6679 self.rdb_config = v.map(|x| x.into());
6680 self
6681 }
6682
6683 /// Sets the value of [aof_config][crate::model::PersistenceConfig::aof_config].
6684 ///
6685 /// # Example
6686 /// ```ignore,no_run
6687 /// # use google_cloud_memorystore_v1::model::PersistenceConfig;
6688 /// use google_cloud_memorystore_v1::model::persistence_config::AOFConfig;
6689 /// let x = PersistenceConfig::new().set_aof_config(AOFConfig::default()/* use setters */);
6690 /// ```
6691 pub fn set_aof_config<T>(mut self, v: T) -> Self
6692 where
6693 T: std::convert::Into<crate::model::persistence_config::AOFConfig>,
6694 {
6695 self.aof_config = std::option::Option::Some(v.into());
6696 self
6697 }
6698
6699 /// Sets or clears the value of [aof_config][crate::model::PersistenceConfig::aof_config].
6700 ///
6701 /// # Example
6702 /// ```ignore,no_run
6703 /// # use google_cloud_memorystore_v1::model::PersistenceConfig;
6704 /// use google_cloud_memorystore_v1::model::persistence_config::AOFConfig;
6705 /// let x = PersistenceConfig::new().set_or_clear_aof_config(Some(AOFConfig::default()/* use setters */));
6706 /// let x = PersistenceConfig::new().set_or_clear_aof_config(None::<AOFConfig>);
6707 /// ```
6708 pub fn set_or_clear_aof_config<T>(mut self, v: std::option::Option<T>) -> Self
6709 where
6710 T: std::convert::Into<crate::model::persistence_config::AOFConfig>,
6711 {
6712 self.aof_config = v.map(|x| x.into());
6713 self
6714 }
6715}
6716
6717impl wkt::message::Message for PersistenceConfig {
6718 fn typename() -> &'static str {
6719 "type.googleapis.com/google.cloud.memorystore.v1.PersistenceConfig"
6720 }
6721}
6722
6723/// Defines additional types related to [PersistenceConfig].
6724pub mod persistence_config {
6725 #[allow(unused_imports)]
6726 use super::*;
6727
6728 /// Configuration for RDB based persistence.
6729 #[derive(Clone, Default, PartialEq)]
6730 #[non_exhaustive]
6731 pub struct RDBConfig {
6732 /// Optional. Period between RDB snapshots.
6733 pub rdb_snapshot_period: crate::model::persistence_config::rdb_config::SnapshotPeriod,
6734
6735 /// Optional. Time that the first snapshot was/will be attempted, and to
6736 /// which future snapshots will be aligned. If not provided, the current time
6737 /// will be used.
6738 pub rdb_snapshot_start_time: std::option::Option<wkt::Timestamp>,
6739
6740 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6741 }
6742
6743 impl RDBConfig {
6744 /// Creates a new default instance.
6745 pub fn new() -> Self {
6746 std::default::Default::default()
6747 }
6748
6749 /// Sets the value of [rdb_snapshot_period][crate::model::persistence_config::RDBConfig::rdb_snapshot_period].
6750 ///
6751 /// # Example
6752 /// ```ignore,no_run
6753 /// # use google_cloud_memorystore_v1::model::persistence_config::RDBConfig;
6754 /// use google_cloud_memorystore_v1::model::persistence_config::rdb_config::SnapshotPeriod;
6755 /// let x0 = RDBConfig::new().set_rdb_snapshot_period(SnapshotPeriod::OneHour);
6756 /// let x1 = RDBConfig::new().set_rdb_snapshot_period(SnapshotPeriod::SixHours);
6757 /// let x2 = RDBConfig::new().set_rdb_snapshot_period(SnapshotPeriod::TwelveHours);
6758 /// ```
6759 pub fn set_rdb_snapshot_period<
6760 T: std::convert::Into<crate::model::persistence_config::rdb_config::SnapshotPeriod>,
6761 >(
6762 mut self,
6763 v: T,
6764 ) -> Self {
6765 self.rdb_snapshot_period = v.into();
6766 self
6767 }
6768
6769 /// Sets the value of [rdb_snapshot_start_time][crate::model::persistence_config::RDBConfig::rdb_snapshot_start_time].
6770 ///
6771 /// # Example
6772 /// ```ignore,no_run
6773 /// # use google_cloud_memorystore_v1::model::persistence_config::RDBConfig;
6774 /// use wkt::Timestamp;
6775 /// let x = RDBConfig::new().set_rdb_snapshot_start_time(Timestamp::default()/* use setters */);
6776 /// ```
6777 pub fn set_rdb_snapshot_start_time<T>(mut self, v: T) -> Self
6778 where
6779 T: std::convert::Into<wkt::Timestamp>,
6780 {
6781 self.rdb_snapshot_start_time = std::option::Option::Some(v.into());
6782 self
6783 }
6784
6785 /// Sets or clears the value of [rdb_snapshot_start_time][crate::model::persistence_config::RDBConfig::rdb_snapshot_start_time].
6786 ///
6787 /// # Example
6788 /// ```ignore,no_run
6789 /// # use google_cloud_memorystore_v1::model::persistence_config::RDBConfig;
6790 /// use wkt::Timestamp;
6791 /// let x = RDBConfig::new().set_or_clear_rdb_snapshot_start_time(Some(Timestamp::default()/* use setters */));
6792 /// let x = RDBConfig::new().set_or_clear_rdb_snapshot_start_time(None::<Timestamp>);
6793 /// ```
6794 pub fn set_or_clear_rdb_snapshot_start_time<T>(mut self, v: std::option::Option<T>) -> Self
6795 where
6796 T: std::convert::Into<wkt::Timestamp>,
6797 {
6798 self.rdb_snapshot_start_time = v.map(|x| x.into());
6799 self
6800 }
6801 }
6802
6803 impl wkt::message::Message for RDBConfig {
6804 fn typename() -> &'static str {
6805 "type.googleapis.com/google.cloud.memorystore.v1.PersistenceConfig.RDBConfig"
6806 }
6807 }
6808
6809 /// Defines additional types related to [RDBConfig].
6810 pub mod rdb_config {
6811 #[allow(unused_imports)]
6812 use super::*;
6813
6814 /// Possible snapshot periods.
6815 ///
6816 /// # Working with unknown values
6817 ///
6818 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6819 /// additional enum variants at any time. Adding new variants is not considered
6820 /// a breaking change. Applications should write their code in anticipation of:
6821 ///
6822 /// - New values appearing in future releases of the client library, **and**
6823 /// - New values received dynamically, without application changes.
6824 ///
6825 /// Please consult the [Working with enums] section in the user guide for some
6826 /// guidelines.
6827 ///
6828 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6829 #[derive(Clone, Debug, PartialEq)]
6830 #[non_exhaustive]
6831 pub enum SnapshotPeriod {
6832 /// Not set.
6833 Unspecified,
6834 /// One hour.
6835 OneHour,
6836 /// Six hours.
6837 SixHours,
6838 /// Twelve hours.
6839 TwelveHours,
6840 /// Twenty four hours.
6841 TwentyFourHours,
6842 /// If set, the enum was initialized with an unknown value.
6843 ///
6844 /// Applications can examine the value using [SnapshotPeriod::value] or
6845 /// [SnapshotPeriod::name].
6846 UnknownValue(snapshot_period::UnknownValue),
6847 }
6848
6849 #[doc(hidden)]
6850 pub mod snapshot_period {
6851 #[allow(unused_imports)]
6852 use super::*;
6853 #[derive(Clone, Debug, PartialEq)]
6854 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6855 }
6856
6857 impl SnapshotPeriod {
6858 /// Gets the enum value.
6859 ///
6860 /// Returns `None` if the enum contains an unknown value deserialized from
6861 /// the string representation of enums.
6862 pub fn value(&self) -> std::option::Option<i32> {
6863 match self {
6864 Self::Unspecified => std::option::Option::Some(0),
6865 Self::OneHour => std::option::Option::Some(1),
6866 Self::SixHours => std::option::Option::Some(2),
6867 Self::TwelveHours => std::option::Option::Some(3),
6868 Self::TwentyFourHours => std::option::Option::Some(4),
6869 Self::UnknownValue(u) => u.0.value(),
6870 }
6871 }
6872
6873 /// Gets the enum value as a string.
6874 ///
6875 /// Returns `None` if the enum contains an unknown value deserialized from
6876 /// the integer representation of enums.
6877 pub fn name(&self) -> std::option::Option<&str> {
6878 match self {
6879 Self::Unspecified => std::option::Option::Some("SNAPSHOT_PERIOD_UNSPECIFIED"),
6880 Self::OneHour => std::option::Option::Some("ONE_HOUR"),
6881 Self::SixHours => std::option::Option::Some("SIX_HOURS"),
6882 Self::TwelveHours => std::option::Option::Some("TWELVE_HOURS"),
6883 Self::TwentyFourHours => std::option::Option::Some("TWENTY_FOUR_HOURS"),
6884 Self::UnknownValue(u) => u.0.name(),
6885 }
6886 }
6887 }
6888
6889 impl std::default::Default for SnapshotPeriod {
6890 fn default() -> Self {
6891 use std::convert::From;
6892 Self::from(0)
6893 }
6894 }
6895
6896 impl std::fmt::Display for SnapshotPeriod {
6897 fn fmt(
6898 &self,
6899 f: &mut std::fmt::Formatter<'_>,
6900 ) -> std::result::Result<(), std::fmt::Error> {
6901 wkt::internal::display_enum(f, self.name(), self.value())
6902 }
6903 }
6904
6905 impl std::convert::From<i32> for SnapshotPeriod {
6906 fn from(value: i32) -> Self {
6907 match value {
6908 0 => Self::Unspecified,
6909 1 => Self::OneHour,
6910 2 => Self::SixHours,
6911 3 => Self::TwelveHours,
6912 4 => Self::TwentyFourHours,
6913 _ => Self::UnknownValue(snapshot_period::UnknownValue(
6914 wkt::internal::UnknownEnumValue::Integer(value),
6915 )),
6916 }
6917 }
6918 }
6919
6920 impl std::convert::From<&str> for SnapshotPeriod {
6921 fn from(value: &str) -> Self {
6922 use std::string::ToString;
6923 match value {
6924 "SNAPSHOT_PERIOD_UNSPECIFIED" => Self::Unspecified,
6925 "ONE_HOUR" => Self::OneHour,
6926 "SIX_HOURS" => Self::SixHours,
6927 "TWELVE_HOURS" => Self::TwelveHours,
6928 "TWENTY_FOUR_HOURS" => Self::TwentyFourHours,
6929 _ => Self::UnknownValue(snapshot_period::UnknownValue(
6930 wkt::internal::UnknownEnumValue::String(value.to_string()),
6931 )),
6932 }
6933 }
6934 }
6935
6936 impl serde::ser::Serialize for SnapshotPeriod {
6937 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6938 where
6939 S: serde::Serializer,
6940 {
6941 match self {
6942 Self::Unspecified => serializer.serialize_i32(0),
6943 Self::OneHour => serializer.serialize_i32(1),
6944 Self::SixHours => serializer.serialize_i32(2),
6945 Self::TwelveHours => serializer.serialize_i32(3),
6946 Self::TwentyFourHours => serializer.serialize_i32(4),
6947 Self::UnknownValue(u) => u.0.serialize(serializer),
6948 }
6949 }
6950 }
6951
6952 impl<'de> serde::de::Deserialize<'de> for SnapshotPeriod {
6953 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6954 where
6955 D: serde::Deserializer<'de>,
6956 {
6957 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SnapshotPeriod>::new(
6958 ".google.cloud.memorystore.v1.PersistenceConfig.RDBConfig.SnapshotPeriod",
6959 ))
6960 }
6961 }
6962 }
6963
6964 /// Configuration for AOF based persistence.
6965 #[derive(Clone, Default, PartialEq)]
6966 #[non_exhaustive]
6967 pub struct AOFConfig {
6968 /// Optional. The fsync mode.
6969 pub append_fsync: crate::model::persistence_config::aof_config::AppendFsync,
6970
6971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6972 }
6973
6974 impl AOFConfig {
6975 /// Creates a new default instance.
6976 pub fn new() -> Self {
6977 std::default::Default::default()
6978 }
6979
6980 /// Sets the value of [append_fsync][crate::model::persistence_config::AOFConfig::append_fsync].
6981 ///
6982 /// # Example
6983 /// ```ignore,no_run
6984 /// # use google_cloud_memorystore_v1::model::persistence_config::AOFConfig;
6985 /// use google_cloud_memorystore_v1::model::persistence_config::aof_config::AppendFsync;
6986 /// let x0 = AOFConfig::new().set_append_fsync(AppendFsync::Never);
6987 /// let x1 = AOFConfig::new().set_append_fsync(AppendFsync::EverySec);
6988 /// let x2 = AOFConfig::new().set_append_fsync(AppendFsync::Always);
6989 /// ```
6990 pub fn set_append_fsync<
6991 T: std::convert::Into<crate::model::persistence_config::aof_config::AppendFsync>,
6992 >(
6993 mut self,
6994 v: T,
6995 ) -> Self {
6996 self.append_fsync = v.into();
6997 self
6998 }
6999 }
7000
7001 impl wkt::message::Message for AOFConfig {
7002 fn typename() -> &'static str {
7003 "type.googleapis.com/google.cloud.memorystore.v1.PersistenceConfig.AOFConfig"
7004 }
7005 }
7006
7007 /// Defines additional types related to [AOFConfig].
7008 pub mod aof_config {
7009 #[allow(unused_imports)]
7010 use super::*;
7011
7012 /// Possible fsync modes.
7013 ///
7014 /// # Working with unknown values
7015 ///
7016 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7017 /// additional enum variants at any time. Adding new variants is not considered
7018 /// a breaking change. Applications should write their code in anticipation of:
7019 ///
7020 /// - New values appearing in future releases of the client library, **and**
7021 /// - New values received dynamically, without application changes.
7022 ///
7023 /// Please consult the [Working with enums] section in the user guide for some
7024 /// guidelines.
7025 ///
7026 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7027 #[derive(Clone, Debug, PartialEq)]
7028 #[non_exhaustive]
7029 pub enum AppendFsync {
7030 /// Not set. Default: EVERY_SEC
7031 Unspecified,
7032 /// Never fsync. Normally Linux will flush data every 30 seconds with this
7033 /// configuration, but it's up to the kernel's exact tuning.
7034 Never,
7035 /// Fsync every second. You may lose 1 second of data if there is a
7036 /// disaster.
7037 EverySec,
7038 /// Fsync every time new write commands are appended to the AOF. The best
7039 /// data loss protection at the cost of performance.
7040 Always,
7041 /// If set, the enum was initialized with an unknown value.
7042 ///
7043 /// Applications can examine the value using [AppendFsync::value] or
7044 /// [AppendFsync::name].
7045 UnknownValue(append_fsync::UnknownValue),
7046 }
7047
7048 #[doc(hidden)]
7049 pub mod append_fsync {
7050 #[allow(unused_imports)]
7051 use super::*;
7052 #[derive(Clone, Debug, PartialEq)]
7053 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7054 }
7055
7056 impl AppendFsync {
7057 /// Gets the enum value.
7058 ///
7059 /// Returns `None` if the enum contains an unknown value deserialized from
7060 /// the string representation of enums.
7061 pub fn value(&self) -> std::option::Option<i32> {
7062 match self {
7063 Self::Unspecified => std::option::Option::Some(0),
7064 Self::Never => std::option::Option::Some(1),
7065 Self::EverySec => std::option::Option::Some(2),
7066 Self::Always => std::option::Option::Some(3),
7067 Self::UnknownValue(u) => u.0.value(),
7068 }
7069 }
7070
7071 /// Gets the enum value as a string.
7072 ///
7073 /// Returns `None` if the enum contains an unknown value deserialized from
7074 /// the integer representation of enums.
7075 pub fn name(&self) -> std::option::Option<&str> {
7076 match self {
7077 Self::Unspecified => std::option::Option::Some("APPEND_FSYNC_UNSPECIFIED"),
7078 Self::Never => std::option::Option::Some("NEVER"),
7079 Self::EverySec => std::option::Option::Some("EVERY_SEC"),
7080 Self::Always => std::option::Option::Some("ALWAYS"),
7081 Self::UnknownValue(u) => u.0.name(),
7082 }
7083 }
7084 }
7085
7086 impl std::default::Default for AppendFsync {
7087 fn default() -> Self {
7088 use std::convert::From;
7089 Self::from(0)
7090 }
7091 }
7092
7093 impl std::fmt::Display for AppendFsync {
7094 fn fmt(
7095 &self,
7096 f: &mut std::fmt::Formatter<'_>,
7097 ) -> std::result::Result<(), std::fmt::Error> {
7098 wkt::internal::display_enum(f, self.name(), self.value())
7099 }
7100 }
7101
7102 impl std::convert::From<i32> for AppendFsync {
7103 fn from(value: i32) -> Self {
7104 match value {
7105 0 => Self::Unspecified,
7106 1 => Self::Never,
7107 2 => Self::EverySec,
7108 3 => Self::Always,
7109 _ => Self::UnknownValue(append_fsync::UnknownValue(
7110 wkt::internal::UnknownEnumValue::Integer(value),
7111 )),
7112 }
7113 }
7114 }
7115
7116 impl std::convert::From<&str> for AppendFsync {
7117 fn from(value: &str) -> Self {
7118 use std::string::ToString;
7119 match value {
7120 "APPEND_FSYNC_UNSPECIFIED" => Self::Unspecified,
7121 "NEVER" => Self::Never,
7122 "EVERY_SEC" => Self::EverySec,
7123 "ALWAYS" => Self::Always,
7124 _ => Self::UnknownValue(append_fsync::UnknownValue(
7125 wkt::internal::UnknownEnumValue::String(value.to_string()),
7126 )),
7127 }
7128 }
7129 }
7130
7131 impl serde::ser::Serialize for AppendFsync {
7132 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7133 where
7134 S: serde::Serializer,
7135 {
7136 match self {
7137 Self::Unspecified => serializer.serialize_i32(0),
7138 Self::Never => serializer.serialize_i32(1),
7139 Self::EverySec => serializer.serialize_i32(2),
7140 Self::Always => serializer.serialize_i32(3),
7141 Self::UnknownValue(u) => u.0.serialize(serializer),
7142 }
7143 }
7144 }
7145
7146 impl<'de> serde::de::Deserialize<'de> for AppendFsync {
7147 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7148 where
7149 D: serde::Deserializer<'de>,
7150 {
7151 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AppendFsync>::new(
7152 ".google.cloud.memorystore.v1.PersistenceConfig.AOFConfig.AppendFsync",
7153 ))
7154 }
7155 }
7156 }
7157
7158 /// Possible persistence modes.
7159 ///
7160 /// # Working with unknown values
7161 ///
7162 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7163 /// additional enum variants at any time. Adding new variants is not considered
7164 /// a breaking change. Applications should write their code in anticipation of:
7165 ///
7166 /// - New values appearing in future releases of the client library, **and**
7167 /// - New values received dynamically, without application changes.
7168 ///
7169 /// Please consult the [Working with enums] section in the user guide for some
7170 /// guidelines.
7171 ///
7172 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7173 #[derive(Clone, Debug, PartialEq)]
7174 #[non_exhaustive]
7175 pub enum PersistenceMode {
7176 /// Not set.
7177 Unspecified,
7178 /// Persistence is disabled, and any snapshot data is deleted.
7179 Disabled,
7180 /// RDB based persistence is enabled.
7181 Rdb,
7182 /// AOF based persistence is enabled.
7183 Aof,
7184 /// If set, the enum was initialized with an unknown value.
7185 ///
7186 /// Applications can examine the value using [PersistenceMode::value] or
7187 /// [PersistenceMode::name].
7188 UnknownValue(persistence_mode::UnknownValue),
7189 }
7190
7191 #[doc(hidden)]
7192 pub mod persistence_mode {
7193 #[allow(unused_imports)]
7194 use super::*;
7195 #[derive(Clone, Debug, PartialEq)]
7196 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7197 }
7198
7199 impl PersistenceMode {
7200 /// Gets the enum value.
7201 ///
7202 /// Returns `None` if the enum contains an unknown value deserialized from
7203 /// the string representation of enums.
7204 pub fn value(&self) -> std::option::Option<i32> {
7205 match self {
7206 Self::Unspecified => std::option::Option::Some(0),
7207 Self::Disabled => std::option::Option::Some(1),
7208 Self::Rdb => std::option::Option::Some(2),
7209 Self::Aof => std::option::Option::Some(3),
7210 Self::UnknownValue(u) => u.0.value(),
7211 }
7212 }
7213
7214 /// Gets the enum value as a string.
7215 ///
7216 /// Returns `None` if the enum contains an unknown value deserialized from
7217 /// the integer representation of enums.
7218 pub fn name(&self) -> std::option::Option<&str> {
7219 match self {
7220 Self::Unspecified => std::option::Option::Some("PERSISTENCE_MODE_UNSPECIFIED"),
7221 Self::Disabled => std::option::Option::Some("DISABLED"),
7222 Self::Rdb => std::option::Option::Some("RDB"),
7223 Self::Aof => std::option::Option::Some("AOF"),
7224 Self::UnknownValue(u) => u.0.name(),
7225 }
7226 }
7227 }
7228
7229 impl std::default::Default for PersistenceMode {
7230 fn default() -> Self {
7231 use std::convert::From;
7232 Self::from(0)
7233 }
7234 }
7235
7236 impl std::fmt::Display for PersistenceMode {
7237 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7238 wkt::internal::display_enum(f, self.name(), self.value())
7239 }
7240 }
7241
7242 impl std::convert::From<i32> for PersistenceMode {
7243 fn from(value: i32) -> Self {
7244 match value {
7245 0 => Self::Unspecified,
7246 1 => Self::Disabled,
7247 2 => Self::Rdb,
7248 3 => Self::Aof,
7249 _ => Self::UnknownValue(persistence_mode::UnknownValue(
7250 wkt::internal::UnknownEnumValue::Integer(value),
7251 )),
7252 }
7253 }
7254 }
7255
7256 impl std::convert::From<&str> for PersistenceMode {
7257 fn from(value: &str) -> Self {
7258 use std::string::ToString;
7259 match value {
7260 "PERSISTENCE_MODE_UNSPECIFIED" => Self::Unspecified,
7261 "DISABLED" => Self::Disabled,
7262 "RDB" => Self::Rdb,
7263 "AOF" => Self::Aof,
7264 _ => Self::UnknownValue(persistence_mode::UnknownValue(
7265 wkt::internal::UnknownEnumValue::String(value.to_string()),
7266 )),
7267 }
7268 }
7269 }
7270
7271 impl serde::ser::Serialize for PersistenceMode {
7272 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7273 where
7274 S: serde::Serializer,
7275 {
7276 match self {
7277 Self::Unspecified => serializer.serialize_i32(0),
7278 Self::Disabled => serializer.serialize_i32(1),
7279 Self::Rdb => serializer.serialize_i32(2),
7280 Self::Aof => serializer.serialize_i32(3),
7281 Self::UnknownValue(u) => u.0.serialize(serializer),
7282 }
7283 }
7284 }
7285
7286 impl<'de> serde::de::Deserialize<'de> for PersistenceMode {
7287 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7288 where
7289 D: serde::Deserializer<'de>,
7290 {
7291 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PersistenceMode>::new(
7292 ".google.cloud.memorystore.v1.PersistenceConfig.PersistenceMode",
7293 ))
7294 }
7295 }
7296}
7297
7298/// Represents configuration for nodes of the instance.
7299#[derive(Clone, Default, PartialEq)]
7300#[non_exhaustive]
7301pub struct NodeConfig {
7302 /// Output only. Memory size in GB of the node.
7303 pub size_gb: f64,
7304
7305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7306}
7307
7308impl NodeConfig {
7309 /// Creates a new default instance.
7310 pub fn new() -> Self {
7311 std::default::Default::default()
7312 }
7313
7314 /// Sets the value of [size_gb][crate::model::NodeConfig::size_gb].
7315 ///
7316 /// # Example
7317 /// ```ignore,no_run
7318 /// # use google_cloud_memorystore_v1::model::NodeConfig;
7319 /// let x = NodeConfig::new().set_size_gb(42.0);
7320 /// ```
7321 pub fn set_size_gb<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
7322 self.size_gb = v.into();
7323 self
7324 }
7325}
7326
7327impl wkt::message::Message for NodeConfig {
7328 fn typename() -> &'static str {
7329 "type.googleapis.com/google.cloud.memorystore.v1.NodeConfig"
7330 }
7331}
7332
7333/// Zone distribution configuration for allocation of instance resources.
7334#[derive(Clone, Default, PartialEq)]
7335#[non_exhaustive]
7336pub struct ZoneDistributionConfig {
7337 /// Optional. Defines zone where all resources will be allocated with
7338 /// SINGLE_ZONE mode. Ignored for MULTI_ZONE mode.
7339 pub zone: std::string::String,
7340
7341 /// Optional. Current zone distribution mode. Defaults to MULTI_ZONE.
7342 pub mode: crate::model::zone_distribution_config::ZoneDistributionMode,
7343
7344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7345}
7346
7347impl ZoneDistributionConfig {
7348 /// Creates a new default instance.
7349 pub fn new() -> Self {
7350 std::default::Default::default()
7351 }
7352
7353 /// Sets the value of [zone][crate::model::ZoneDistributionConfig::zone].
7354 ///
7355 /// # Example
7356 /// ```ignore,no_run
7357 /// # use google_cloud_memorystore_v1::model::ZoneDistributionConfig;
7358 /// let x = ZoneDistributionConfig::new().set_zone("example");
7359 /// ```
7360 pub fn set_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7361 self.zone = v.into();
7362 self
7363 }
7364
7365 /// Sets the value of [mode][crate::model::ZoneDistributionConfig::mode].
7366 ///
7367 /// # Example
7368 /// ```ignore,no_run
7369 /// # use google_cloud_memorystore_v1::model::ZoneDistributionConfig;
7370 /// use google_cloud_memorystore_v1::model::zone_distribution_config::ZoneDistributionMode;
7371 /// let x0 = ZoneDistributionConfig::new().set_mode(ZoneDistributionMode::MultiZone);
7372 /// let x1 = ZoneDistributionConfig::new().set_mode(ZoneDistributionMode::SingleZone);
7373 /// ```
7374 pub fn set_mode<
7375 T: std::convert::Into<crate::model::zone_distribution_config::ZoneDistributionMode>,
7376 >(
7377 mut self,
7378 v: T,
7379 ) -> Self {
7380 self.mode = v.into();
7381 self
7382 }
7383}
7384
7385impl wkt::message::Message for ZoneDistributionConfig {
7386 fn typename() -> &'static str {
7387 "type.googleapis.com/google.cloud.memorystore.v1.ZoneDistributionConfig"
7388 }
7389}
7390
7391/// Defines additional types related to [ZoneDistributionConfig].
7392pub mod zone_distribution_config {
7393 #[allow(unused_imports)]
7394 use super::*;
7395
7396 /// Possible zone distribution modes.
7397 ///
7398 /// # Working with unknown values
7399 ///
7400 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7401 /// additional enum variants at any time. Adding new variants is not considered
7402 /// a breaking change. Applications should write their code in anticipation of:
7403 ///
7404 /// - New values appearing in future releases of the client library, **and**
7405 /// - New values received dynamically, without application changes.
7406 ///
7407 /// Please consult the [Working with enums] section in the user guide for some
7408 /// guidelines.
7409 ///
7410 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7411 #[derive(Clone, Debug, PartialEq)]
7412 #[non_exhaustive]
7413 pub enum ZoneDistributionMode {
7414 /// Not Set. Default: MULTI_ZONE
7415 Unspecified,
7416 /// Distribute resources across 3 zones picked at random within the
7417 /// region.
7418 MultiZone,
7419 /// Provision resources in a single zone. Zone field must be specified.
7420 SingleZone,
7421 /// If set, the enum was initialized with an unknown value.
7422 ///
7423 /// Applications can examine the value using [ZoneDistributionMode::value] or
7424 /// [ZoneDistributionMode::name].
7425 UnknownValue(zone_distribution_mode::UnknownValue),
7426 }
7427
7428 #[doc(hidden)]
7429 pub mod zone_distribution_mode {
7430 #[allow(unused_imports)]
7431 use super::*;
7432 #[derive(Clone, Debug, PartialEq)]
7433 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7434 }
7435
7436 impl ZoneDistributionMode {
7437 /// Gets the enum value.
7438 ///
7439 /// Returns `None` if the enum contains an unknown value deserialized from
7440 /// the string representation of enums.
7441 pub fn value(&self) -> std::option::Option<i32> {
7442 match self {
7443 Self::Unspecified => std::option::Option::Some(0),
7444 Self::MultiZone => std::option::Option::Some(1),
7445 Self::SingleZone => std::option::Option::Some(2),
7446 Self::UnknownValue(u) => u.0.value(),
7447 }
7448 }
7449
7450 /// Gets the enum value as a string.
7451 ///
7452 /// Returns `None` if the enum contains an unknown value deserialized from
7453 /// the integer representation of enums.
7454 pub fn name(&self) -> std::option::Option<&str> {
7455 match self {
7456 Self::Unspecified => {
7457 std::option::Option::Some("ZONE_DISTRIBUTION_MODE_UNSPECIFIED")
7458 }
7459 Self::MultiZone => std::option::Option::Some("MULTI_ZONE"),
7460 Self::SingleZone => std::option::Option::Some("SINGLE_ZONE"),
7461 Self::UnknownValue(u) => u.0.name(),
7462 }
7463 }
7464 }
7465
7466 impl std::default::Default for ZoneDistributionMode {
7467 fn default() -> Self {
7468 use std::convert::From;
7469 Self::from(0)
7470 }
7471 }
7472
7473 impl std::fmt::Display for ZoneDistributionMode {
7474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7475 wkt::internal::display_enum(f, self.name(), self.value())
7476 }
7477 }
7478
7479 impl std::convert::From<i32> for ZoneDistributionMode {
7480 fn from(value: i32) -> Self {
7481 match value {
7482 0 => Self::Unspecified,
7483 1 => Self::MultiZone,
7484 2 => Self::SingleZone,
7485 _ => Self::UnknownValue(zone_distribution_mode::UnknownValue(
7486 wkt::internal::UnknownEnumValue::Integer(value),
7487 )),
7488 }
7489 }
7490 }
7491
7492 impl std::convert::From<&str> for ZoneDistributionMode {
7493 fn from(value: &str) -> Self {
7494 use std::string::ToString;
7495 match value {
7496 "ZONE_DISTRIBUTION_MODE_UNSPECIFIED" => Self::Unspecified,
7497 "MULTI_ZONE" => Self::MultiZone,
7498 "SINGLE_ZONE" => Self::SingleZone,
7499 _ => Self::UnknownValue(zone_distribution_mode::UnknownValue(
7500 wkt::internal::UnknownEnumValue::String(value.to_string()),
7501 )),
7502 }
7503 }
7504 }
7505
7506 impl serde::ser::Serialize for ZoneDistributionMode {
7507 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7508 where
7509 S: serde::Serializer,
7510 {
7511 match self {
7512 Self::Unspecified => serializer.serialize_i32(0),
7513 Self::MultiZone => serializer.serialize_i32(1),
7514 Self::SingleZone => serializer.serialize_i32(2),
7515 Self::UnknownValue(u) => u.0.serialize(serializer),
7516 }
7517 }
7518 }
7519
7520 impl<'de> serde::de::Deserialize<'de> for ZoneDistributionMode {
7521 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7522 where
7523 D: serde::Deserializer<'de>,
7524 {
7525 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ZoneDistributionMode>::new(
7526 ".google.cloud.memorystore.v1.ZoneDistributionConfig.ZoneDistributionMode",
7527 ))
7528 }
7529 }
7530}
7531
7532/// Request for rescheduling instance maintenance.
7533#[derive(Clone, Default, PartialEq)]
7534#[non_exhaustive]
7535pub struct RescheduleMaintenanceRequest {
7536 /// Required. Name of the instance to reschedule maintenance for:
7537 /// `projects/{project}/locations/{location_id}/instances/{instance}`
7538 pub name: std::string::String,
7539
7540 /// Required. If reschedule type is SPECIFIC_TIME, schedule_time must be set.
7541 pub reschedule_type: crate::model::reschedule_maintenance_request::RescheduleType,
7542
7543 /// Optional. Timestamp when the maintenance shall be rescheduled to if
7544 /// reschedule_type=SPECIFIC_TIME, in RFC 3339 format.
7545 /// Example: `2012-11-15T16:19:00.094Z`.
7546 pub schedule_time: std::option::Option<wkt::Timestamp>,
7547
7548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7549}
7550
7551impl RescheduleMaintenanceRequest {
7552 /// Creates a new default instance.
7553 pub fn new() -> Self {
7554 std::default::Default::default()
7555 }
7556
7557 /// Sets the value of [name][crate::model::RescheduleMaintenanceRequest::name].
7558 ///
7559 /// # Example
7560 /// ```ignore,no_run
7561 /// # use google_cloud_memorystore_v1::model::RescheduleMaintenanceRequest;
7562 /// # let project_id = "project_id";
7563 /// # let location_id = "location_id";
7564 /// # let instance_id = "instance_id";
7565 /// let x = RescheduleMaintenanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
7566 /// ```
7567 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7568 self.name = v.into();
7569 self
7570 }
7571
7572 /// Sets the value of [reschedule_type][crate::model::RescheduleMaintenanceRequest::reschedule_type].
7573 ///
7574 /// # Example
7575 /// ```ignore,no_run
7576 /// # use google_cloud_memorystore_v1::model::RescheduleMaintenanceRequest;
7577 /// use google_cloud_memorystore_v1::model::reschedule_maintenance_request::RescheduleType;
7578 /// let x0 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::Immediate);
7579 /// let x1 = RescheduleMaintenanceRequest::new().set_reschedule_type(RescheduleType::SpecificTime);
7580 /// ```
7581 pub fn set_reschedule_type<
7582 T: std::convert::Into<crate::model::reschedule_maintenance_request::RescheduleType>,
7583 >(
7584 mut self,
7585 v: T,
7586 ) -> Self {
7587 self.reschedule_type = v.into();
7588 self
7589 }
7590
7591 /// Sets the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
7592 ///
7593 /// # Example
7594 /// ```ignore,no_run
7595 /// # use google_cloud_memorystore_v1::model::RescheduleMaintenanceRequest;
7596 /// use wkt::Timestamp;
7597 /// let x = RescheduleMaintenanceRequest::new().set_schedule_time(Timestamp::default()/* use setters */);
7598 /// ```
7599 pub fn set_schedule_time<T>(mut self, v: T) -> Self
7600 where
7601 T: std::convert::Into<wkt::Timestamp>,
7602 {
7603 self.schedule_time = std::option::Option::Some(v.into());
7604 self
7605 }
7606
7607 /// Sets or clears the value of [schedule_time][crate::model::RescheduleMaintenanceRequest::schedule_time].
7608 ///
7609 /// # Example
7610 /// ```ignore,no_run
7611 /// # use google_cloud_memorystore_v1::model::RescheduleMaintenanceRequest;
7612 /// use wkt::Timestamp;
7613 /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
7614 /// let x = RescheduleMaintenanceRequest::new().set_or_clear_schedule_time(None::<Timestamp>);
7615 /// ```
7616 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
7617 where
7618 T: std::convert::Into<wkt::Timestamp>,
7619 {
7620 self.schedule_time = v.map(|x| x.into());
7621 self
7622 }
7623}
7624
7625impl wkt::message::Message for RescheduleMaintenanceRequest {
7626 fn typename() -> &'static str {
7627 "type.googleapis.com/google.cloud.memorystore.v1.RescheduleMaintenanceRequest"
7628 }
7629}
7630
7631/// Defines additional types related to [RescheduleMaintenanceRequest].
7632pub mod reschedule_maintenance_request {
7633 #[allow(unused_imports)]
7634 use super::*;
7635
7636 /// Reschedule options.
7637 ///
7638 /// # Working with unknown values
7639 ///
7640 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7641 /// additional enum variants at any time. Adding new variants is not considered
7642 /// a breaking change. Applications should write their code in anticipation of:
7643 ///
7644 /// - New values appearing in future releases of the client library, **and**
7645 /// - New values received dynamically, without application changes.
7646 ///
7647 /// Please consult the [Working with enums] section in the user guide for some
7648 /// guidelines.
7649 ///
7650 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7651 #[derive(Clone, Debug, PartialEq)]
7652 #[non_exhaustive]
7653 pub enum RescheduleType {
7654 /// Not set.
7655 Unspecified,
7656 /// If the user wants to schedule the maintenance to happen now.
7657 Immediate,
7658 /// If the user wants to reschedule the maintenance to a specific time.
7659 SpecificTime,
7660 /// If set, the enum was initialized with an unknown value.
7661 ///
7662 /// Applications can examine the value using [RescheduleType::value] or
7663 /// [RescheduleType::name].
7664 UnknownValue(reschedule_type::UnknownValue),
7665 }
7666
7667 #[doc(hidden)]
7668 pub mod reschedule_type {
7669 #[allow(unused_imports)]
7670 use super::*;
7671 #[derive(Clone, Debug, PartialEq)]
7672 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7673 }
7674
7675 impl RescheduleType {
7676 /// Gets the enum value.
7677 ///
7678 /// Returns `None` if the enum contains an unknown value deserialized from
7679 /// the string representation of enums.
7680 pub fn value(&self) -> std::option::Option<i32> {
7681 match self {
7682 Self::Unspecified => std::option::Option::Some(0),
7683 Self::Immediate => std::option::Option::Some(1),
7684 Self::SpecificTime => std::option::Option::Some(3),
7685 Self::UnknownValue(u) => u.0.value(),
7686 }
7687 }
7688
7689 /// Gets the enum value as a string.
7690 ///
7691 /// Returns `None` if the enum contains an unknown value deserialized from
7692 /// the integer representation of enums.
7693 pub fn name(&self) -> std::option::Option<&str> {
7694 match self {
7695 Self::Unspecified => std::option::Option::Some("RESCHEDULE_TYPE_UNSPECIFIED"),
7696 Self::Immediate => std::option::Option::Some("IMMEDIATE"),
7697 Self::SpecificTime => std::option::Option::Some("SPECIFIC_TIME"),
7698 Self::UnknownValue(u) => u.0.name(),
7699 }
7700 }
7701 }
7702
7703 impl std::default::Default for RescheduleType {
7704 fn default() -> Self {
7705 use std::convert::From;
7706 Self::from(0)
7707 }
7708 }
7709
7710 impl std::fmt::Display for RescheduleType {
7711 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7712 wkt::internal::display_enum(f, self.name(), self.value())
7713 }
7714 }
7715
7716 impl std::convert::From<i32> for RescheduleType {
7717 fn from(value: i32) -> Self {
7718 match value {
7719 0 => Self::Unspecified,
7720 1 => Self::Immediate,
7721 3 => Self::SpecificTime,
7722 _ => Self::UnknownValue(reschedule_type::UnknownValue(
7723 wkt::internal::UnknownEnumValue::Integer(value),
7724 )),
7725 }
7726 }
7727 }
7728
7729 impl std::convert::From<&str> for RescheduleType {
7730 fn from(value: &str) -> Self {
7731 use std::string::ToString;
7732 match value {
7733 "RESCHEDULE_TYPE_UNSPECIFIED" => Self::Unspecified,
7734 "IMMEDIATE" => Self::Immediate,
7735 "SPECIFIC_TIME" => Self::SpecificTime,
7736 _ => Self::UnknownValue(reschedule_type::UnknownValue(
7737 wkt::internal::UnknownEnumValue::String(value.to_string()),
7738 )),
7739 }
7740 }
7741 }
7742
7743 impl serde::ser::Serialize for RescheduleType {
7744 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7745 where
7746 S: serde::Serializer,
7747 {
7748 match self {
7749 Self::Unspecified => serializer.serialize_i32(0),
7750 Self::Immediate => serializer.serialize_i32(1),
7751 Self::SpecificTime => serializer.serialize_i32(3),
7752 Self::UnknownValue(u) => u.0.serialize(serializer),
7753 }
7754 }
7755 }
7756
7757 impl<'de> serde::de::Deserialize<'de> for RescheduleType {
7758 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7759 where
7760 D: serde::Deserializer<'de>,
7761 {
7762 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RescheduleType>::new(
7763 ".google.cloud.memorystore.v1.RescheduleMaintenanceRequest.RescheduleType",
7764 ))
7765 }
7766 }
7767}
7768
7769/// Request message for [ListInstances][].
7770#[derive(Clone, Default, PartialEq)]
7771#[non_exhaustive]
7772pub struct ListInstancesRequest {
7773 /// Required. The parent to list instances from.
7774 /// Format: projects/{project}/locations/{location}
7775 pub parent: std::string::String,
7776
7777 /// Optional. Requested page size. Server may return fewer items than
7778 /// requested. If unspecified, server will pick an appropriate default.
7779 pub page_size: i32,
7780
7781 /// Optional. A token identifying a page of results the server should return.
7782 pub page_token: std::string::String,
7783
7784 /// Optional. Expression for filtering results.
7785 pub filter: std::string::String,
7786
7787 /// Optional. Sort results by a defined order. Supported values: "name",
7788 /// "create_time".
7789 pub order_by: std::string::String,
7790
7791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7792}
7793
7794impl ListInstancesRequest {
7795 /// Creates a new default instance.
7796 pub fn new() -> Self {
7797 std::default::Default::default()
7798 }
7799
7800 /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
7801 ///
7802 /// # Example
7803 /// ```ignore,no_run
7804 /// # use google_cloud_memorystore_v1::model::ListInstancesRequest;
7805 /// # let project_id = "project_id";
7806 /// # let location_id = "location_id";
7807 /// let x = ListInstancesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
7808 /// ```
7809 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7810 self.parent = v.into();
7811 self
7812 }
7813
7814 /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
7815 ///
7816 /// # Example
7817 /// ```ignore,no_run
7818 /// # use google_cloud_memorystore_v1::model::ListInstancesRequest;
7819 /// let x = ListInstancesRequest::new().set_page_size(42);
7820 /// ```
7821 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7822 self.page_size = v.into();
7823 self
7824 }
7825
7826 /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
7827 ///
7828 /// # Example
7829 /// ```ignore,no_run
7830 /// # use google_cloud_memorystore_v1::model::ListInstancesRequest;
7831 /// let x = ListInstancesRequest::new().set_page_token("example");
7832 /// ```
7833 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7834 self.page_token = v.into();
7835 self
7836 }
7837
7838 /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
7839 ///
7840 /// # Example
7841 /// ```ignore,no_run
7842 /// # use google_cloud_memorystore_v1::model::ListInstancesRequest;
7843 /// let x = ListInstancesRequest::new().set_filter("example");
7844 /// ```
7845 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7846 self.filter = v.into();
7847 self
7848 }
7849
7850 /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
7851 ///
7852 /// # Example
7853 /// ```ignore,no_run
7854 /// # use google_cloud_memorystore_v1::model::ListInstancesRequest;
7855 /// let x = ListInstancesRequest::new().set_order_by("example");
7856 /// ```
7857 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7858 self.order_by = v.into();
7859 self
7860 }
7861}
7862
7863impl wkt::message::Message for ListInstancesRequest {
7864 fn typename() -> &'static str {
7865 "type.googleapis.com/google.cloud.memorystore.v1.ListInstancesRequest"
7866 }
7867}
7868
7869/// Response message for `ListInstances`.
7870#[derive(Clone, Default, PartialEq)]
7871#[non_exhaustive]
7872pub struct ListInstancesResponse {
7873 /// If the {location} requested was "-" the response contains a list of
7874 /// instances from all locations. Instances in unreachable locations will be
7875 /// omitted.
7876 pub instances: std::vec::Vec<crate::model::Instance>,
7877
7878 /// A token, which can be sent as `page_token` to retrieve the next page.
7879 /// If this field is omitted, there are no subsequent pages.
7880 pub next_page_token: std::string::String,
7881
7882 /// Locations that could not be reached.
7883 pub unreachable: std::vec::Vec<std::string::String>,
7884
7885 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7886}
7887
7888impl ListInstancesResponse {
7889 /// Creates a new default instance.
7890 pub fn new() -> Self {
7891 std::default::Default::default()
7892 }
7893
7894 /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
7895 ///
7896 /// # Example
7897 /// ```ignore,no_run
7898 /// # use google_cloud_memorystore_v1::model::ListInstancesResponse;
7899 /// use google_cloud_memorystore_v1::model::Instance;
7900 /// let x = ListInstancesResponse::new()
7901 /// .set_instances([
7902 /// Instance::default()/* use setters */,
7903 /// Instance::default()/* use (different) setters */,
7904 /// ]);
7905 /// ```
7906 pub fn set_instances<T, V>(mut self, v: T) -> Self
7907 where
7908 T: std::iter::IntoIterator<Item = V>,
7909 V: std::convert::Into<crate::model::Instance>,
7910 {
7911 use std::iter::Iterator;
7912 self.instances = v.into_iter().map(|i| i.into()).collect();
7913 self
7914 }
7915
7916 /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
7917 ///
7918 /// # Example
7919 /// ```ignore,no_run
7920 /// # use google_cloud_memorystore_v1::model::ListInstancesResponse;
7921 /// let x = ListInstancesResponse::new().set_next_page_token("example");
7922 /// ```
7923 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7924 self.next_page_token = v.into();
7925 self
7926 }
7927
7928 /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
7929 ///
7930 /// # Example
7931 /// ```ignore,no_run
7932 /// # use google_cloud_memorystore_v1::model::ListInstancesResponse;
7933 /// let x = ListInstancesResponse::new().set_unreachable(["a", "b", "c"]);
7934 /// ```
7935 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7936 where
7937 T: std::iter::IntoIterator<Item = V>,
7938 V: std::convert::Into<std::string::String>,
7939 {
7940 use std::iter::Iterator;
7941 self.unreachable = v.into_iter().map(|i| i.into()).collect();
7942 self
7943 }
7944}
7945
7946impl wkt::message::Message for ListInstancesResponse {
7947 fn typename() -> &'static str {
7948 "type.googleapis.com/google.cloud.memorystore.v1.ListInstancesResponse"
7949 }
7950}
7951
7952#[doc(hidden)]
7953impl google_cloud_gax::paginator::internal::PageableResponse for ListInstancesResponse {
7954 type PageItem = crate::model::Instance;
7955
7956 fn items(self) -> std::vec::Vec<Self::PageItem> {
7957 self.instances
7958 }
7959
7960 fn next_page_token(&self) -> std::string::String {
7961 use std::clone::Clone;
7962 self.next_page_token.clone()
7963 }
7964}
7965
7966/// Request message for [GetInstance][].
7967#[derive(Clone, Default, PartialEq)]
7968#[non_exhaustive]
7969pub struct GetInstanceRequest {
7970 /// Required. The name of the instance to retrieve.
7971 /// Format: projects/{project}/locations/{location}/instances/{instance}
7972 pub name: std::string::String,
7973
7974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7975}
7976
7977impl GetInstanceRequest {
7978 /// Creates a new default instance.
7979 pub fn new() -> Self {
7980 std::default::Default::default()
7981 }
7982
7983 /// Sets the value of [name][crate::model::GetInstanceRequest::name].
7984 ///
7985 /// # Example
7986 /// ```ignore,no_run
7987 /// # use google_cloud_memorystore_v1::model::GetInstanceRequest;
7988 /// # let project_id = "project_id";
7989 /// # let location_id = "location_id";
7990 /// # let instance_id = "instance_id";
7991 /// let x = GetInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
7992 /// ```
7993 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7994 self.name = v.into();
7995 self
7996 }
7997}
7998
7999impl wkt::message::Message for GetInstanceRequest {
8000 fn typename() -> &'static str {
8001 "type.googleapis.com/google.cloud.memorystore.v1.GetInstanceRequest"
8002 }
8003}
8004
8005/// Request message for [CreateInstance][].
8006#[derive(Clone, Default, PartialEq)]
8007#[non_exhaustive]
8008pub struct CreateInstanceRequest {
8009 /// Required. The parent resource where this instance will be created.
8010 /// Format: projects/{project}/locations/{location}
8011 pub parent: std::string::String,
8012
8013 /// Required. The ID to use for the instance, which will become the final
8014 /// component of the instance's resource name.
8015 ///
8016 /// This value is subject to the following restrictions:
8017 ///
8018 /// * Must be 4-63 characters in length
8019 /// * Must begin with a letter or digit
8020 /// * Must contain only lowercase letters, digits, and hyphens
8021 /// * Must not end with a hyphen
8022 /// * Must be unique within a location
8023 pub instance_id: std::string::String,
8024
8025 /// Required. The instance to create.
8026 pub instance: std::option::Option<crate::model::Instance>,
8027
8028 /// Optional. An optional request ID to identify requests. Specify a unique
8029 /// request ID so that if you must retry your request, the server will know to
8030 /// ignore the request if it has already been completed. The server will
8031 /// guarantee that for at least 60 minutes since the first request.
8032 ///
8033 /// For example, consider a situation where you make an initial request and the
8034 /// request times out. If you make the request again with the same request
8035 /// ID, the server can check if original operation with the same request ID
8036 /// was received, and if so, will ignore the second request. This prevents
8037 /// clients from accidentally creating duplicate commitments.
8038 ///
8039 /// The request ID must be a valid UUID with the exception that zero UUID is
8040 /// not supported (00000000-0000-0000-0000-000000000000).
8041 pub request_id: std::string::String,
8042
8043 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8044}
8045
8046impl CreateInstanceRequest {
8047 /// Creates a new default instance.
8048 pub fn new() -> Self {
8049 std::default::Default::default()
8050 }
8051
8052 /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
8053 ///
8054 /// # Example
8055 /// ```ignore,no_run
8056 /// # use google_cloud_memorystore_v1::model::CreateInstanceRequest;
8057 /// # let project_id = "project_id";
8058 /// # let location_id = "location_id";
8059 /// let x = CreateInstanceRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
8060 /// ```
8061 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8062 self.parent = v.into();
8063 self
8064 }
8065
8066 /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
8067 ///
8068 /// # Example
8069 /// ```ignore,no_run
8070 /// # use google_cloud_memorystore_v1::model::CreateInstanceRequest;
8071 /// let x = CreateInstanceRequest::new().set_instance_id("example");
8072 /// ```
8073 pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8074 self.instance_id = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_memorystore_v1::model::CreateInstanceRequest;
8083 /// use google_cloud_memorystore_v1::model::Instance;
8084 /// let x = CreateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
8085 /// ```
8086 pub fn set_instance<T>(mut self, v: T) -> Self
8087 where
8088 T: std::convert::Into<crate::model::Instance>,
8089 {
8090 self.instance = std::option::Option::Some(v.into());
8091 self
8092 }
8093
8094 /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
8095 ///
8096 /// # Example
8097 /// ```ignore,no_run
8098 /// # use google_cloud_memorystore_v1::model::CreateInstanceRequest;
8099 /// use google_cloud_memorystore_v1::model::Instance;
8100 /// let x = CreateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
8101 /// let x = CreateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
8102 /// ```
8103 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
8104 where
8105 T: std::convert::Into<crate::model::Instance>,
8106 {
8107 self.instance = v.map(|x| x.into());
8108 self
8109 }
8110
8111 /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
8112 ///
8113 /// # Example
8114 /// ```ignore,no_run
8115 /// # use google_cloud_memorystore_v1::model::CreateInstanceRequest;
8116 /// let x = CreateInstanceRequest::new().set_request_id("example");
8117 /// ```
8118 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8119 self.request_id = v.into();
8120 self
8121 }
8122}
8123
8124impl wkt::message::Message for CreateInstanceRequest {
8125 fn typename() -> &'static str {
8126 "type.googleapis.com/google.cloud.memorystore.v1.CreateInstanceRequest"
8127 }
8128}
8129
8130/// Request message for [UpdateInstance][].
8131#[derive(Clone, Default, PartialEq)]
8132#[non_exhaustive]
8133pub struct UpdateInstanceRequest {
8134 /// Optional. The list of fields to be updated on the instance. At least one
8135 /// field must be specified.
8136 pub update_mask: std::option::Option<wkt::FieldMask>,
8137
8138 /// Required. The instance to update.
8139 pub instance: std::option::Option<crate::model::Instance>,
8140
8141 /// Optional. An optional request ID to identify requests. Specify a unique
8142 /// request ID so that if you must retry your request, the server will know to
8143 /// ignore the request if it has already been completed. The server will
8144 /// guarantee that for at least 60 minutes since the first request.
8145 ///
8146 /// For example, consider a situation where you make an initial request and the
8147 /// request times out. If you make the request again with the same request
8148 /// ID, the server can check if original operation with the same request ID
8149 /// was received, and if so, will ignore the second request. This prevents
8150 /// clients from accidentally creating duplicate commitments.
8151 ///
8152 /// The request ID must be a valid UUID with the exception that zero UUID is
8153 /// not supported (00000000-0000-0000-0000-000000000000).
8154 pub request_id: std::string::String,
8155
8156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8157}
8158
8159impl UpdateInstanceRequest {
8160 /// Creates a new default instance.
8161 pub fn new() -> Self {
8162 std::default::Default::default()
8163 }
8164
8165 /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
8166 ///
8167 /// # Example
8168 /// ```ignore,no_run
8169 /// # use google_cloud_memorystore_v1::model::UpdateInstanceRequest;
8170 /// use wkt::FieldMask;
8171 /// let x = UpdateInstanceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8172 /// ```
8173 pub fn set_update_mask<T>(mut self, v: T) -> Self
8174 where
8175 T: std::convert::Into<wkt::FieldMask>,
8176 {
8177 self.update_mask = std::option::Option::Some(v.into());
8178 self
8179 }
8180
8181 /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
8182 ///
8183 /// # Example
8184 /// ```ignore,no_run
8185 /// # use google_cloud_memorystore_v1::model::UpdateInstanceRequest;
8186 /// use wkt::FieldMask;
8187 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8188 /// let x = UpdateInstanceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8189 /// ```
8190 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8191 where
8192 T: std::convert::Into<wkt::FieldMask>,
8193 {
8194 self.update_mask = v.map(|x| x.into());
8195 self
8196 }
8197
8198 /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
8199 ///
8200 /// # Example
8201 /// ```ignore,no_run
8202 /// # use google_cloud_memorystore_v1::model::UpdateInstanceRequest;
8203 /// use google_cloud_memorystore_v1::model::Instance;
8204 /// let x = UpdateInstanceRequest::new().set_instance(Instance::default()/* use setters */);
8205 /// ```
8206 pub fn set_instance<T>(mut self, v: T) -> Self
8207 where
8208 T: std::convert::Into<crate::model::Instance>,
8209 {
8210 self.instance = std::option::Option::Some(v.into());
8211 self
8212 }
8213
8214 /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
8215 ///
8216 /// # Example
8217 /// ```ignore,no_run
8218 /// # use google_cloud_memorystore_v1::model::UpdateInstanceRequest;
8219 /// use google_cloud_memorystore_v1::model::Instance;
8220 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(Some(Instance::default()/* use setters */));
8221 /// let x = UpdateInstanceRequest::new().set_or_clear_instance(None::<Instance>);
8222 /// ```
8223 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
8224 where
8225 T: std::convert::Into<crate::model::Instance>,
8226 {
8227 self.instance = v.map(|x| x.into());
8228 self
8229 }
8230
8231 /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
8232 ///
8233 /// # Example
8234 /// ```ignore,no_run
8235 /// # use google_cloud_memorystore_v1::model::UpdateInstanceRequest;
8236 /// let x = UpdateInstanceRequest::new().set_request_id("example");
8237 /// ```
8238 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8239 self.request_id = v.into();
8240 self
8241 }
8242}
8243
8244impl wkt::message::Message for UpdateInstanceRequest {
8245 fn typename() -> &'static str {
8246 "type.googleapis.com/google.cloud.memorystore.v1.UpdateInstanceRequest"
8247 }
8248}
8249
8250/// Request message for [DeleteInstance][].
8251#[derive(Clone, Default, PartialEq)]
8252#[non_exhaustive]
8253pub struct DeleteInstanceRequest {
8254 /// Required. The name of the instance to delete.
8255 /// Format: projects/{project}/locations/{location}/instances/{instance}
8256 pub name: std::string::String,
8257
8258 /// Optional. An optional request ID to identify requests. Specify a unique
8259 /// request ID so that if you must retry your request, the server will know to
8260 /// ignore the request if it has already been completed. The server will
8261 /// guarantee that for at least 60 minutes after the first request.
8262 ///
8263 /// For example, consider a situation where you make an initial request and the
8264 /// request times out. If you make the request again with the same request
8265 /// ID, the server can check if original operation with the same request ID
8266 /// was received, and if so, will ignore the second request. This prevents
8267 /// clients from accidentally creating duplicate commitments.
8268 ///
8269 /// The request ID must be a valid UUID with the exception that zero UUID is
8270 /// not supported (00000000-0000-0000-0000-000000000000).
8271 pub request_id: std::string::String,
8272
8273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8274}
8275
8276impl DeleteInstanceRequest {
8277 /// Creates a new default instance.
8278 pub fn new() -> Self {
8279 std::default::Default::default()
8280 }
8281
8282 /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
8283 ///
8284 /// # Example
8285 /// ```ignore,no_run
8286 /// # use google_cloud_memorystore_v1::model::DeleteInstanceRequest;
8287 /// # let project_id = "project_id";
8288 /// # let location_id = "location_id";
8289 /// # let instance_id = "instance_id";
8290 /// let x = DeleteInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
8291 /// ```
8292 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8293 self.name = v.into();
8294 self
8295 }
8296
8297 /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
8298 ///
8299 /// # Example
8300 /// ```ignore,no_run
8301 /// # use google_cloud_memorystore_v1::model::DeleteInstanceRequest;
8302 /// let x = DeleteInstanceRequest::new().set_request_id("example");
8303 /// ```
8304 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8305 self.request_id = v.into();
8306 self
8307 }
8308}
8309
8310impl wkt::message::Message for DeleteInstanceRequest {
8311 fn typename() -> &'static str {
8312 "type.googleapis.com/google.cloud.memorystore.v1.DeleteInstanceRequest"
8313 }
8314}
8315
8316/// Request for `ListBackupCollections`.
8317#[derive(Clone, Default, PartialEq)]
8318#[non_exhaustive]
8319pub struct ListBackupCollectionsRequest {
8320 /// Required. The resource name of the backupCollection location using the
8321 /// form:
8322 /// `projects/{project_id}/locations/{location_id}`
8323 /// where `location_id` refers to a Google Cloud region.
8324 pub parent: std::string::String,
8325
8326 /// Optional. The maximum number of items to return.
8327 ///
8328 /// If not specified, a default value of 1000 will be used by the service.
8329 /// Regardless of the page_size value, the response may include a partial list
8330 /// and a caller should only rely on response's
8331 /// `next_page_token`
8332 /// to determine if there are more clusters left to be queried.
8333 pub page_size: i32,
8334
8335 /// Optional. The `next_page_token` value returned from a previous
8336 /// `ListBackupCollections` request, if any.
8337 pub page_token: std::string::String,
8338
8339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8340}
8341
8342impl ListBackupCollectionsRequest {
8343 /// Creates a new default instance.
8344 pub fn new() -> Self {
8345 std::default::Default::default()
8346 }
8347
8348 /// Sets the value of [parent][crate::model::ListBackupCollectionsRequest::parent].
8349 ///
8350 /// # Example
8351 /// ```ignore,no_run
8352 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsRequest;
8353 /// # let project_id = "project_id";
8354 /// # let location_id = "location_id";
8355 /// let x = ListBackupCollectionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
8356 /// ```
8357 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8358 self.parent = v.into();
8359 self
8360 }
8361
8362 /// Sets the value of [page_size][crate::model::ListBackupCollectionsRequest::page_size].
8363 ///
8364 /// # Example
8365 /// ```ignore,no_run
8366 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsRequest;
8367 /// let x = ListBackupCollectionsRequest::new().set_page_size(42);
8368 /// ```
8369 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8370 self.page_size = v.into();
8371 self
8372 }
8373
8374 /// Sets the value of [page_token][crate::model::ListBackupCollectionsRequest::page_token].
8375 ///
8376 /// # Example
8377 /// ```ignore,no_run
8378 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsRequest;
8379 /// let x = ListBackupCollectionsRequest::new().set_page_token("example");
8380 /// ```
8381 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8382 self.page_token = v.into();
8383 self
8384 }
8385}
8386
8387impl wkt::message::Message for ListBackupCollectionsRequest {
8388 fn typename() -> &'static str {
8389 "type.googleapis.com/google.cloud.memorystore.v1.ListBackupCollectionsRequest"
8390 }
8391}
8392
8393/// Response for `ListBackupCollections`.
8394#[derive(Clone, Default, PartialEq)]
8395#[non_exhaustive]
8396pub struct ListBackupCollectionsResponse {
8397 /// A list of backupCollections in the project.
8398 ///
8399 /// If the `location_id` in the parent field of the request is "-", all regions
8400 /// available to the project are queried, and the results aggregated.
8401 /// If in such an aggregated query a location is unavailable, a placeholder
8402 /// backupCollection entry is included in the response with the `name` field
8403 /// set to a value of the form
8404 /// `projects/{project_id}/locations/{location_id}/backupCollections/`- and the
8405 /// `status` field set to ERROR and `status_message` field set to "location not
8406 /// available for ListBackupCollections".
8407 pub backup_collections: std::vec::Vec<crate::model::BackupCollection>,
8408
8409 /// Token to retrieve the next page of results, or empty if there are no more
8410 /// results in the list.
8411 pub next_page_token: std::string::String,
8412
8413 /// Locations that could not be reached.
8414 pub unreachable: std::vec::Vec<std::string::String>,
8415
8416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8417}
8418
8419impl ListBackupCollectionsResponse {
8420 /// Creates a new default instance.
8421 pub fn new() -> Self {
8422 std::default::Default::default()
8423 }
8424
8425 /// Sets the value of [backup_collections][crate::model::ListBackupCollectionsResponse::backup_collections].
8426 ///
8427 /// # Example
8428 /// ```ignore,no_run
8429 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsResponse;
8430 /// use google_cloud_memorystore_v1::model::BackupCollection;
8431 /// let x = ListBackupCollectionsResponse::new()
8432 /// .set_backup_collections([
8433 /// BackupCollection::default()/* use setters */,
8434 /// BackupCollection::default()/* use (different) setters */,
8435 /// ]);
8436 /// ```
8437 pub fn set_backup_collections<T, V>(mut self, v: T) -> Self
8438 where
8439 T: std::iter::IntoIterator<Item = V>,
8440 V: std::convert::Into<crate::model::BackupCollection>,
8441 {
8442 use std::iter::Iterator;
8443 self.backup_collections = v.into_iter().map(|i| i.into()).collect();
8444 self
8445 }
8446
8447 /// Sets the value of [next_page_token][crate::model::ListBackupCollectionsResponse::next_page_token].
8448 ///
8449 /// # Example
8450 /// ```ignore,no_run
8451 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsResponse;
8452 /// let x = ListBackupCollectionsResponse::new().set_next_page_token("example");
8453 /// ```
8454 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8455 self.next_page_token = v.into();
8456 self
8457 }
8458
8459 /// Sets the value of [unreachable][crate::model::ListBackupCollectionsResponse::unreachable].
8460 ///
8461 /// # Example
8462 /// ```ignore,no_run
8463 /// # use google_cloud_memorystore_v1::model::ListBackupCollectionsResponse;
8464 /// let x = ListBackupCollectionsResponse::new().set_unreachable(["a", "b", "c"]);
8465 /// ```
8466 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8467 where
8468 T: std::iter::IntoIterator<Item = V>,
8469 V: std::convert::Into<std::string::String>,
8470 {
8471 use std::iter::Iterator;
8472 self.unreachable = v.into_iter().map(|i| i.into()).collect();
8473 self
8474 }
8475}
8476
8477impl wkt::message::Message for ListBackupCollectionsResponse {
8478 fn typename() -> &'static str {
8479 "type.googleapis.com/google.cloud.memorystore.v1.ListBackupCollectionsResponse"
8480 }
8481}
8482
8483#[doc(hidden)]
8484impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupCollectionsResponse {
8485 type PageItem = crate::model::BackupCollection;
8486
8487 fn items(self) -> std::vec::Vec<Self::PageItem> {
8488 self.backup_collections
8489 }
8490
8491 fn next_page_token(&self) -> std::string::String {
8492 use std::clone::Clone;
8493 self.next_page_token.clone()
8494 }
8495}
8496
8497/// Request for `GetBackupCollection`.
8498#[derive(Clone, Default, PartialEq)]
8499#[non_exhaustive]
8500pub struct GetBackupCollectionRequest {
8501 /// Required. Instance backupCollection resource name using the form:
8502 /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
8503 /// where `location_id` refers to a Google Cloud region.
8504 pub name: std::string::String,
8505
8506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8507}
8508
8509impl GetBackupCollectionRequest {
8510 /// Creates a new default instance.
8511 pub fn new() -> Self {
8512 std::default::Default::default()
8513 }
8514
8515 /// Sets the value of [name][crate::model::GetBackupCollectionRequest::name].
8516 ///
8517 /// # Example
8518 /// ```ignore,no_run
8519 /// # use google_cloud_memorystore_v1::model::GetBackupCollectionRequest;
8520 /// # let project_id = "project_id";
8521 /// # let location_id = "location_id";
8522 /// # let backup_collection_id = "backup_collection_id";
8523 /// let x = GetBackupCollectionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"));
8524 /// ```
8525 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8526 self.name = v.into();
8527 self
8528 }
8529}
8530
8531impl wkt::message::Message for GetBackupCollectionRequest {
8532 fn typename() -> &'static str {
8533 "type.googleapis.com/google.cloud.memorystore.v1.GetBackupCollectionRequest"
8534 }
8535}
8536
8537/// Request for `ListBackups`.
8538#[derive(Clone, Default, PartialEq)]
8539#[non_exhaustive]
8540pub struct ListBackupsRequest {
8541 /// Required. The resource name of the backupCollection using the form:
8542 /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`
8543 pub parent: std::string::String,
8544
8545 /// Optional. The maximum number of items to return.
8546 ///
8547 /// If not specified, a default value of 1000 will be used by the service.
8548 /// Regardless of the page_size value, the response may include a partial list
8549 /// and a caller should only rely on response's
8550 /// `next_page_token`
8551 /// to determine if there are more clusters left to be queried.
8552 pub page_size: i32,
8553
8554 /// Optional. The `next_page_token` value returned from a previous
8555 /// `ListBackupCollections` request, if any.
8556 pub page_token: std::string::String,
8557
8558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8559}
8560
8561impl ListBackupsRequest {
8562 /// Creates a new default instance.
8563 pub fn new() -> Self {
8564 std::default::Default::default()
8565 }
8566
8567 /// Sets the value of [parent][crate::model::ListBackupsRequest::parent].
8568 ///
8569 /// # Example
8570 /// ```ignore,no_run
8571 /// # use google_cloud_memorystore_v1::model::ListBackupsRequest;
8572 /// # let project_id = "project_id";
8573 /// # let location_id = "location_id";
8574 /// # let backup_collection_id = "backup_collection_id";
8575 /// let x = ListBackupsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}"));
8576 /// ```
8577 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8578 self.parent = v.into();
8579 self
8580 }
8581
8582 /// Sets the value of [page_size][crate::model::ListBackupsRequest::page_size].
8583 ///
8584 /// # Example
8585 /// ```ignore,no_run
8586 /// # use google_cloud_memorystore_v1::model::ListBackupsRequest;
8587 /// let x = ListBackupsRequest::new().set_page_size(42);
8588 /// ```
8589 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8590 self.page_size = v.into();
8591 self
8592 }
8593
8594 /// Sets the value of [page_token][crate::model::ListBackupsRequest::page_token].
8595 ///
8596 /// # Example
8597 /// ```ignore,no_run
8598 /// # use google_cloud_memorystore_v1::model::ListBackupsRequest;
8599 /// let x = ListBackupsRequest::new().set_page_token("example");
8600 /// ```
8601 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8602 self.page_token = v.into();
8603 self
8604 }
8605}
8606
8607impl wkt::message::Message for ListBackupsRequest {
8608 fn typename() -> &'static str {
8609 "type.googleapis.com/google.cloud.memorystore.v1.ListBackupsRequest"
8610 }
8611}
8612
8613/// Response for `ListBackups`.
8614#[derive(Clone, Default, PartialEq)]
8615#[non_exhaustive]
8616pub struct ListBackupsResponse {
8617 /// A list of backups in the project.
8618 pub backups: std::vec::Vec<crate::model::Backup>,
8619
8620 /// Token to retrieve the next page of results, or empty if there are no more
8621 /// results in the list.
8622 pub next_page_token: std::string::String,
8623
8624 /// Backups that could not be reached.
8625 pub unreachable: std::vec::Vec<std::string::String>,
8626
8627 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8628}
8629
8630impl ListBackupsResponse {
8631 /// Creates a new default instance.
8632 pub fn new() -> Self {
8633 std::default::Default::default()
8634 }
8635
8636 /// Sets the value of [backups][crate::model::ListBackupsResponse::backups].
8637 ///
8638 /// # Example
8639 /// ```ignore,no_run
8640 /// # use google_cloud_memorystore_v1::model::ListBackupsResponse;
8641 /// use google_cloud_memorystore_v1::model::Backup;
8642 /// let x = ListBackupsResponse::new()
8643 /// .set_backups([
8644 /// Backup::default()/* use setters */,
8645 /// Backup::default()/* use (different) setters */,
8646 /// ]);
8647 /// ```
8648 pub fn set_backups<T, V>(mut self, v: T) -> Self
8649 where
8650 T: std::iter::IntoIterator<Item = V>,
8651 V: std::convert::Into<crate::model::Backup>,
8652 {
8653 use std::iter::Iterator;
8654 self.backups = v.into_iter().map(|i| i.into()).collect();
8655 self
8656 }
8657
8658 /// Sets the value of [next_page_token][crate::model::ListBackupsResponse::next_page_token].
8659 ///
8660 /// # Example
8661 /// ```ignore,no_run
8662 /// # use google_cloud_memorystore_v1::model::ListBackupsResponse;
8663 /// let x = ListBackupsResponse::new().set_next_page_token("example");
8664 /// ```
8665 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8666 self.next_page_token = v.into();
8667 self
8668 }
8669
8670 /// Sets the value of [unreachable][crate::model::ListBackupsResponse::unreachable].
8671 ///
8672 /// # Example
8673 /// ```ignore,no_run
8674 /// # use google_cloud_memorystore_v1::model::ListBackupsResponse;
8675 /// let x = ListBackupsResponse::new().set_unreachable(["a", "b", "c"]);
8676 /// ```
8677 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8678 where
8679 T: std::iter::IntoIterator<Item = V>,
8680 V: std::convert::Into<std::string::String>,
8681 {
8682 use std::iter::Iterator;
8683 self.unreachable = v.into_iter().map(|i| i.into()).collect();
8684 self
8685 }
8686}
8687
8688impl wkt::message::Message for ListBackupsResponse {
8689 fn typename() -> &'static str {
8690 "type.googleapis.com/google.cloud.memorystore.v1.ListBackupsResponse"
8691 }
8692}
8693
8694#[doc(hidden)]
8695impl google_cloud_gax::paginator::internal::PageableResponse for ListBackupsResponse {
8696 type PageItem = crate::model::Backup;
8697
8698 fn items(self) -> std::vec::Vec<Self::PageItem> {
8699 self.backups
8700 }
8701
8702 fn next_page_token(&self) -> std::string::String {
8703 use std::clone::Clone;
8704 self.next_page_token.clone()
8705 }
8706}
8707
8708/// Request for `GetBackup`.
8709#[derive(Clone, Default, PartialEq)]
8710#[non_exhaustive]
8711pub struct GetBackupRequest {
8712 /// Required. Instance backup resource name using the form:
8713 /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
8714 pub name: std::string::String,
8715
8716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8717}
8718
8719impl GetBackupRequest {
8720 /// Creates a new default instance.
8721 pub fn new() -> Self {
8722 std::default::Default::default()
8723 }
8724
8725 /// Sets the value of [name][crate::model::GetBackupRequest::name].
8726 ///
8727 /// # Example
8728 /// ```ignore,no_run
8729 /// # use google_cloud_memorystore_v1::model::GetBackupRequest;
8730 /// # let project_id = "project_id";
8731 /// # let location_id = "location_id";
8732 /// # let backup_collection_id = "backup_collection_id";
8733 /// # let backup_id = "backup_id";
8734 /// let x = GetBackupRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"));
8735 /// ```
8736 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8737 self.name = v.into();
8738 self
8739 }
8740}
8741
8742impl wkt::message::Message for GetBackupRequest {
8743 fn typename() -> &'static str {
8744 "type.googleapis.com/google.cloud.memorystore.v1.GetBackupRequest"
8745 }
8746}
8747
8748/// Request for `DeleteBackup`.
8749#[derive(Clone, Default, PartialEq)]
8750#[non_exhaustive]
8751pub struct DeleteBackupRequest {
8752 /// Required. Instance backup resource name using the form:
8753 /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
8754 pub name: std::string::String,
8755
8756 /// Optional. Idempotent request UUID.
8757 pub request_id: std::string::String,
8758
8759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8760}
8761
8762impl DeleteBackupRequest {
8763 /// Creates a new default instance.
8764 pub fn new() -> Self {
8765 std::default::Default::default()
8766 }
8767
8768 /// Sets the value of [name][crate::model::DeleteBackupRequest::name].
8769 ///
8770 /// # Example
8771 /// ```ignore,no_run
8772 /// # use google_cloud_memorystore_v1::model::DeleteBackupRequest;
8773 /// # let project_id = "project_id";
8774 /// # let location_id = "location_id";
8775 /// # let backup_collection_id = "backup_collection_id";
8776 /// # let backup_id = "backup_id";
8777 /// let x = DeleteBackupRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"));
8778 /// ```
8779 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8780 self.name = v.into();
8781 self
8782 }
8783
8784 /// Sets the value of [request_id][crate::model::DeleteBackupRequest::request_id].
8785 ///
8786 /// # Example
8787 /// ```ignore,no_run
8788 /// # use google_cloud_memorystore_v1::model::DeleteBackupRequest;
8789 /// let x = DeleteBackupRequest::new().set_request_id("example");
8790 /// ```
8791 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8792 self.request_id = v.into();
8793 self
8794 }
8795}
8796
8797impl wkt::message::Message for DeleteBackupRequest {
8798 fn typename() -> &'static str {
8799 "type.googleapis.com/google.cloud.memorystore.v1.DeleteBackupRequest"
8800 }
8801}
8802
8803/// Request for `ExportBackup`.
8804#[derive(Clone, Default, PartialEq)]
8805#[non_exhaustive]
8806pub struct ExportBackupRequest {
8807 /// Required. Instance backup resource name using the form:
8808 /// `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`
8809 pub name: std::string::String,
8810
8811 /// Required. Specify destination to export a backup.
8812 pub destination: std::option::Option<crate::model::export_backup_request::Destination>,
8813
8814 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8815}
8816
8817impl ExportBackupRequest {
8818 /// Creates a new default instance.
8819 pub fn new() -> Self {
8820 std::default::Default::default()
8821 }
8822
8823 /// Sets the value of [name][crate::model::ExportBackupRequest::name].
8824 ///
8825 /// # Example
8826 /// ```ignore,no_run
8827 /// # use google_cloud_memorystore_v1::model::ExportBackupRequest;
8828 /// # let project_id = "project_id";
8829 /// # let location_id = "location_id";
8830 /// # let backup_collection_id = "backup_collection_id";
8831 /// # let backup_id = "backup_id";
8832 /// let x = ExportBackupRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}"));
8833 /// ```
8834 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8835 self.name = v.into();
8836 self
8837 }
8838
8839 /// Sets the value of [destination][crate::model::ExportBackupRequest::destination].
8840 ///
8841 /// Note that all the setters affecting `destination` are mutually
8842 /// exclusive.
8843 ///
8844 /// # Example
8845 /// ```ignore,no_run
8846 /// # use google_cloud_memorystore_v1::model::ExportBackupRequest;
8847 /// use google_cloud_memorystore_v1::model::export_backup_request::Destination;
8848 /// let x = ExportBackupRequest::new().set_destination(Some(Destination::GcsBucket("example".to_string())));
8849 /// ```
8850 pub fn set_destination<
8851 T: std::convert::Into<std::option::Option<crate::model::export_backup_request::Destination>>,
8852 >(
8853 mut self,
8854 v: T,
8855 ) -> Self {
8856 self.destination = v.into();
8857 self
8858 }
8859
8860 /// The value of [destination][crate::model::ExportBackupRequest::destination]
8861 /// if it holds a `GcsBucket`, `None` if the field is not set or
8862 /// holds a different branch.
8863 pub fn gcs_bucket(&self) -> std::option::Option<&std::string::String> {
8864 #[allow(unreachable_patterns)]
8865 self.destination.as_ref().and_then(|v| match v {
8866 crate::model::export_backup_request::Destination::GcsBucket(v) => {
8867 std::option::Option::Some(v)
8868 }
8869 _ => std::option::Option::None,
8870 })
8871 }
8872
8873 /// Sets the value of [destination][crate::model::ExportBackupRequest::destination]
8874 /// to hold a `GcsBucket`.
8875 ///
8876 /// Note that all the setters affecting `destination` are
8877 /// mutually exclusive.
8878 ///
8879 /// # Example
8880 /// ```ignore,no_run
8881 /// # use google_cloud_memorystore_v1::model::ExportBackupRequest;
8882 /// let x = ExportBackupRequest::new().set_gcs_bucket("example");
8883 /// assert!(x.gcs_bucket().is_some());
8884 /// ```
8885 pub fn set_gcs_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8886 self.destination = std::option::Option::Some(
8887 crate::model::export_backup_request::Destination::GcsBucket(v.into()),
8888 );
8889 self
8890 }
8891}
8892
8893impl wkt::message::Message for ExportBackupRequest {
8894 fn typename() -> &'static str {
8895 "type.googleapis.com/google.cloud.memorystore.v1.ExportBackupRequest"
8896 }
8897}
8898
8899/// Defines additional types related to [ExportBackupRequest].
8900pub mod export_backup_request {
8901 #[allow(unused_imports)]
8902 use super::*;
8903
8904 /// Required. Specify destination to export a backup.
8905 #[derive(Clone, Debug, PartialEq)]
8906 #[non_exhaustive]
8907 pub enum Destination {
8908 /// Google Cloud Storage bucket, like "my-bucket".
8909 GcsBucket(std::string::String),
8910 }
8911}
8912
8913/// Request for `BackupInstance`.
8914#[derive(Clone, Default, PartialEq)]
8915#[non_exhaustive]
8916pub struct BackupInstanceRequest {
8917 /// Required. Instance resource name using the form:
8918 /// `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
8919 /// where `location_id` refers to a Google Cloud region.
8920 pub name: std::string::String,
8921
8922 /// Optional. TTL for the backup to expire. Value range is 1 day to 100 years.
8923 /// If not specified, the default value is 100 years.
8924 pub ttl: std::option::Option<wkt::Duration>,
8925
8926 /// Optional. The id of the backup to be created. If not specified, the
8927 /// default value ([YYYYMMDDHHMMSS]_[Shortened Instance UID] is used.
8928 pub backup_id: std::option::Option<std::string::String>,
8929
8930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8931}
8932
8933impl BackupInstanceRequest {
8934 /// Creates a new default instance.
8935 pub fn new() -> Self {
8936 std::default::Default::default()
8937 }
8938
8939 /// Sets the value of [name][crate::model::BackupInstanceRequest::name].
8940 ///
8941 /// # Example
8942 /// ```ignore,no_run
8943 /// # use google_cloud_memorystore_v1::model::BackupInstanceRequest;
8944 /// # let project_id = "project_id";
8945 /// # let location_id = "location_id";
8946 /// # let instance_id = "instance_id";
8947 /// let x = BackupInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
8948 /// ```
8949 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8950 self.name = v.into();
8951 self
8952 }
8953
8954 /// Sets the value of [ttl][crate::model::BackupInstanceRequest::ttl].
8955 ///
8956 /// # Example
8957 /// ```ignore,no_run
8958 /// # use google_cloud_memorystore_v1::model::BackupInstanceRequest;
8959 /// use wkt::Duration;
8960 /// let x = BackupInstanceRequest::new().set_ttl(Duration::default()/* use setters */);
8961 /// ```
8962 pub fn set_ttl<T>(mut self, v: T) -> Self
8963 where
8964 T: std::convert::Into<wkt::Duration>,
8965 {
8966 self.ttl = std::option::Option::Some(v.into());
8967 self
8968 }
8969
8970 /// Sets or clears the value of [ttl][crate::model::BackupInstanceRequest::ttl].
8971 ///
8972 /// # Example
8973 /// ```ignore,no_run
8974 /// # use google_cloud_memorystore_v1::model::BackupInstanceRequest;
8975 /// use wkt::Duration;
8976 /// let x = BackupInstanceRequest::new().set_or_clear_ttl(Some(Duration::default()/* use setters */));
8977 /// let x = BackupInstanceRequest::new().set_or_clear_ttl(None::<Duration>);
8978 /// ```
8979 pub fn set_or_clear_ttl<T>(mut self, v: std::option::Option<T>) -> Self
8980 where
8981 T: std::convert::Into<wkt::Duration>,
8982 {
8983 self.ttl = v.map(|x| x.into());
8984 self
8985 }
8986
8987 /// Sets the value of [backup_id][crate::model::BackupInstanceRequest::backup_id].
8988 ///
8989 /// # Example
8990 /// ```ignore,no_run
8991 /// # use google_cloud_memorystore_v1::model::BackupInstanceRequest;
8992 /// let x = BackupInstanceRequest::new().set_backup_id("example");
8993 /// ```
8994 pub fn set_backup_id<T>(mut self, v: T) -> Self
8995 where
8996 T: std::convert::Into<std::string::String>,
8997 {
8998 self.backup_id = std::option::Option::Some(v.into());
8999 self
9000 }
9001
9002 /// Sets or clears the value of [backup_id][crate::model::BackupInstanceRequest::backup_id].
9003 ///
9004 /// # Example
9005 /// ```ignore,no_run
9006 /// # use google_cloud_memorystore_v1::model::BackupInstanceRequest;
9007 /// let x = BackupInstanceRequest::new().set_or_clear_backup_id(Some("example"));
9008 /// let x = BackupInstanceRequest::new().set_or_clear_backup_id(None::<String>);
9009 /// ```
9010 pub fn set_or_clear_backup_id<T>(mut self, v: std::option::Option<T>) -> Self
9011 where
9012 T: std::convert::Into<std::string::String>,
9013 {
9014 self.backup_id = v.map(|x| x.into());
9015 self
9016 }
9017}
9018
9019impl wkt::message::Message for BackupInstanceRequest {
9020 fn typename() -> &'static str {
9021 "type.googleapis.com/google.cloud.memorystore.v1.BackupInstanceRequest"
9022 }
9023}
9024
9025/// Request message for `GetCertificateAuthority`.
9026#[derive(Clone, Default, PartialEq)]
9027#[non_exhaustive]
9028pub struct GetCertificateAuthorityRequest {
9029 /// Required. The name of the certificate authority.
9030 /// Format:
9031 /// projects/{project}/locations/{location}/instances/{instance}/certificateAuthority
9032 pub name: std::string::String,
9033
9034 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9035}
9036
9037impl GetCertificateAuthorityRequest {
9038 /// Creates a new default instance.
9039 pub fn new() -> Self {
9040 std::default::Default::default()
9041 }
9042
9043 /// Sets the value of [name][crate::model::GetCertificateAuthorityRequest::name].
9044 ///
9045 /// # Example
9046 /// ```ignore,no_run
9047 /// # use google_cloud_memorystore_v1::model::GetCertificateAuthorityRequest;
9048 /// # let project_id = "project_id";
9049 /// # let location_id = "location_id";
9050 /// # let instance_id = "instance_id";
9051 /// let x = GetCertificateAuthorityRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
9052 /// ```
9053 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9054 self.name = v.into();
9055 self
9056 }
9057}
9058
9059impl wkt::message::Message for GetCertificateAuthorityRequest {
9060 fn typename() -> &'static str {
9061 "type.googleapis.com/google.cloud.memorystore.v1.GetCertificateAuthorityRequest"
9062 }
9063}
9064
9065/// Request message for `ListTokenAuthUsers`.
9066#[derive(Clone, Default, PartialEq)]
9067#[non_exhaustive]
9068pub struct ListTokenAuthUsersRequest {
9069 /// Required. The parent to list token auth users from.
9070 /// Format: projects/{project}/locations/{location}/instances/{instance}
9071 pub parent: std::string::String,
9072
9073 /// Optional. The maximum number of items to return. The maximum value is 1000;
9074 /// values above 1000 will be coerced to 1000. If not specified, a default
9075 /// value of 1000 will be used by the service. Regardless of the page_size
9076 /// value, the response may include a partial list and a caller should only
9077 /// rely on response's `next_page_token` to determine if there are more token
9078 /// auth users left to be queried.
9079 pub page_size: i32,
9080
9081 /// Optional. The `next_page_token` value returned from a previous
9082 /// `ListTokenAuthUsers` request, if any.
9083 pub page_token: std::string::String,
9084
9085 /// Optional. Expression for filtering results.
9086 pub filter: std::string::String,
9087
9088 /// Optional. Sort results by a defined order.
9089 pub order_by: std::string::String,
9090
9091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9092}
9093
9094impl ListTokenAuthUsersRequest {
9095 /// Creates a new default instance.
9096 pub fn new() -> Self {
9097 std::default::Default::default()
9098 }
9099
9100 /// Sets the value of [parent][crate::model::ListTokenAuthUsersRequest::parent].
9101 ///
9102 /// # Example
9103 /// ```ignore,no_run
9104 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersRequest;
9105 /// # let project_id = "project_id";
9106 /// # let location_id = "location_id";
9107 /// # let instance_id = "instance_id";
9108 /// let x = ListTokenAuthUsersRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
9109 /// ```
9110 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9111 self.parent = v.into();
9112 self
9113 }
9114
9115 /// Sets the value of [page_size][crate::model::ListTokenAuthUsersRequest::page_size].
9116 ///
9117 /// # Example
9118 /// ```ignore,no_run
9119 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersRequest;
9120 /// let x = ListTokenAuthUsersRequest::new().set_page_size(42);
9121 /// ```
9122 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9123 self.page_size = v.into();
9124 self
9125 }
9126
9127 /// Sets the value of [page_token][crate::model::ListTokenAuthUsersRequest::page_token].
9128 ///
9129 /// # Example
9130 /// ```ignore,no_run
9131 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersRequest;
9132 /// let x = ListTokenAuthUsersRequest::new().set_page_token("example");
9133 /// ```
9134 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9135 self.page_token = v.into();
9136 self
9137 }
9138
9139 /// Sets the value of [filter][crate::model::ListTokenAuthUsersRequest::filter].
9140 ///
9141 /// # Example
9142 /// ```ignore,no_run
9143 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersRequest;
9144 /// let x = ListTokenAuthUsersRequest::new().set_filter("example");
9145 /// ```
9146 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9147 self.filter = v.into();
9148 self
9149 }
9150
9151 /// Sets the value of [order_by][crate::model::ListTokenAuthUsersRequest::order_by].
9152 ///
9153 /// # Example
9154 /// ```ignore,no_run
9155 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersRequest;
9156 /// let x = ListTokenAuthUsersRequest::new().set_order_by("example");
9157 /// ```
9158 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9159 self.order_by = v.into();
9160 self
9161 }
9162}
9163
9164impl wkt::message::Message for ListTokenAuthUsersRequest {
9165 fn typename() -> &'static str {
9166 "type.googleapis.com/google.cloud.memorystore.v1.ListTokenAuthUsersRequest"
9167 }
9168}
9169
9170/// Response message for `ListTokenAuthUsers`.
9171#[derive(Clone, Default, PartialEq)]
9172#[non_exhaustive]
9173pub struct ListTokenAuthUsersResponse {
9174 /// A list of token auth users in the project.
9175 pub token_auth_users: std::vec::Vec<crate::model::TokenAuthUser>,
9176
9177 /// Token to retrieve the next page of results, or empty if there are no more
9178 /// results in the list.
9179 pub next_page_token: std::string::String,
9180
9181 /// Unordered list. Token auth users that could not be reached.
9182 pub unreachable: std::vec::Vec<std::string::String>,
9183
9184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9185}
9186
9187impl ListTokenAuthUsersResponse {
9188 /// Creates a new default instance.
9189 pub fn new() -> Self {
9190 std::default::Default::default()
9191 }
9192
9193 /// Sets the value of [token_auth_users][crate::model::ListTokenAuthUsersResponse::token_auth_users].
9194 ///
9195 /// # Example
9196 /// ```ignore,no_run
9197 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersResponse;
9198 /// use google_cloud_memorystore_v1::model::TokenAuthUser;
9199 /// let x = ListTokenAuthUsersResponse::new()
9200 /// .set_token_auth_users([
9201 /// TokenAuthUser::default()/* use setters */,
9202 /// TokenAuthUser::default()/* use (different) setters */,
9203 /// ]);
9204 /// ```
9205 pub fn set_token_auth_users<T, V>(mut self, v: T) -> Self
9206 where
9207 T: std::iter::IntoIterator<Item = V>,
9208 V: std::convert::Into<crate::model::TokenAuthUser>,
9209 {
9210 use std::iter::Iterator;
9211 self.token_auth_users = v.into_iter().map(|i| i.into()).collect();
9212 self
9213 }
9214
9215 /// Sets the value of [next_page_token][crate::model::ListTokenAuthUsersResponse::next_page_token].
9216 ///
9217 /// # Example
9218 /// ```ignore,no_run
9219 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersResponse;
9220 /// let x = ListTokenAuthUsersResponse::new().set_next_page_token("example");
9221 /// ```
9222 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9223 self.next_page_token = v.into();
9224 self
9225 }
9226
9227 /// Sets the value of [unreachable][crate::model::ListTokenAuthUsersResponse::unreachable].
9228 ///
9229 /// # Example
9230 /// ```ignore,no_run
9231 /// # use google_cloud_memorystore_v1::model::ListTokenAuthUsersResponse;
9232 /// let x = ListTokenAuthUsersResponse::new().set_unreachable(["a", "b", "c"]);
9233 /// ```
9234 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
9235 where
9236 T: std::iter::IntoIterator<Item = V>,
9237 V: std::convert::Into<std::string::String>,
9238 {
9239 use std::iter::Iterator;
9240 self.unreachable = v.into_iter().map(|i| i.into()).collect();
9241 self
9242 }
9243}
9244
9245impl wkt::message::Message for ListTokenAuthUsersResponse {
9246 fn typename() -> &'static str {
9247 "type.googleapis.com/google.cloud.memorystore.v1.ListTokenAuthUsersResponse"
9248 }
9249}
9250
9251#[doc(hidden)]
9252impl google_cloud_gax::paginator::internal::PageableResponse for ListTokenAuthUsersResponse {
9253 type PageItem = crate::model::TokenAuthUser;
9254
9255 fn items(self) -> std::vec::Vec<Self::PageItem> {
9256 self.token_auth_users
9257 }
9258
9259 fn next_page_token(&self) -> std::string::String {
9260 use std::clone::Clone;
9261 self.next_page_token.clone()
9262 }
9263}
9264
9265/// Request message for `GetTokenAuthUser`.
9266#[derive(Clone, Default, PartialEq)]
9267#[non_exhaustive]
9268pub struct GetTokenAuthUserRequest {
9269 /// Required. The name of token auth user for a basic auth enabled instance.
9270 /// Format:
9271 /// projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}
9272 pub name: std::string::String,
9273
9274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9275}
9276
9277impl GetTokenAuthUserRequest {
9278 /// Creates a new default instance.
9279 pub fn new() -> Self {
9280 std::default::Default::default()
9281 }
9282
9283 /// Sets the value of [name][crate::model::GetTokenAuthUserRequest::name].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_memorystore_v1::model::GetTokenAuthUserRequest;
9288 /// # let project_id = "project_id";
9289 /// # let location_id = "location_id";
9290 /// # let instance_id = "instance_id";
9291 /// # let token_auth_user_id = "token_auth_user_id";
9292 /// let x = GetTokenAuthUserRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"));
9293 /// ```
9294 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9295 self.name = v.into();
9296 self
9297 }
9298}
9299
9300impl wkt::message::Message for GetTokenAuthUserRequest {
9301 fn typename() -> &'static str {
9302 "type.googleapis.com/google.cloud.memorystore.v1.GetTokenAuthUserRequest"
9303 }
9304}
9305
9306/// Request message for `ListAuthTokens`.
9307#[derive(Clone, Default, PartialEq)]
9308#[non_exhaustive]
9309pub struct ListAuthTokensRequest {
9310 /// Required. The parent to list auth tokens from.
9311 /// Format:
9312 /// projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}
9313 pub parent: std::string::String,
9314
9315 /// Optional. The maximum number of items to return. The maximum value is 1000;
9316 /// values above 1000 will be coerced to 1000.
9317 ///
9318 /// If not specified, a default value of 1000 will be used by the service.
9319 /// Regardless of the page_size value, the response may include a partial list
9320 /// and a caller should only rely on response's
9321 /// `next_page_token`
9322 /// to determine if there are more auth tokens left to be queried.
9323 pub page_size: i32,
9324
9325 /// Optional. The `next_page_token` value returned from a previous
9326 /// `ListAuthTokens` request, if any.
9327 pub page_token: std::string::String,
9328
9329 /// Optional. Expression for filtering results.
9330 pub filter: std::string::String,
9331
9332 /// Optional. Sort results by a defined order.
9333 pub order_by: std::string::String,
9334
9335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9336}
9337
9338impl ListAuthTokensRequest {
9339 /// Creates a new default instance.
9340 pub fn new() -> Self {
9341 std::default::Default::default()
9342 }
9343
9344 /// Sets the value of [parent][crate::model::ListAuthTokensRequest::parent].
9345 ///
9346 /// # Example
9347 /// ```ignore,no_run
9348 /// # use google_cloud_memorystore_v1::model::ListAuthTokensRequest;
9349 /// # let project_id = "project_id";
9350 /// # let location_id = "location_id";
9351 /// # let instance_id = "instance_id";
9352 /// # let token_auth_user_id = "token_auth_user_id";
9353 /// let x = ListAuthTokensRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"));
9354 /// ```
9355 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9356 self.parent = v.into();
9357 self
9358 }
9359
9360 /// Sets the value of [page_size][crate::model::ListAuthTokensRequest::page_size].
9361 ///
9362 /// # Example
9363 /// ```ignore,no_run
9364 /// # use google_cloud_memorystore_v1::model::ListAuthTokensRequest;
9365 /// let x = ListAuthTokensRequest::new().set_page_size(42);
9366 /// ```
9367 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9368 self.page_size = v.into();
9369 self
9370 }
9371
9372 /// Sets the value of [page_token][crate::model::ListAuthTokensRequest::page_token].
9373 ///
9374 /// # Example
9375 /// ```ignore,no_run
9376 /// # use google_cloud_memorystore_v1::model::ListAuthTokensRequest;
9377 /// let x = ListAuthTokensRequest::new().set_page_token("example");
9378 /// ```
9379 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9380 self.page_token = v.into();
9381 self
9382 }
9383
9384 /// Sets the value of [filter][crate::model::ListAuthTokensRequest::filter].
9385 ///
9386 /// # Example
9387 /// ```ignore,no_run
9388 /// # use google_cloud_memorystore_v1::model::ListAuthTokensRequest;
9389 /// let x = ListAuthTokensRequest::new().set_filter("example");
9390 /// ```
9391 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9392 self.filter = v.into();
9393 self
9394 }
9395
9396 /// Sets the value of [order_by][crate::model::ListAuthTokensRequest::order_by].
9397 ///
9398 /// # Example
9399 /// ```ignore,no_run
9400 /// # use google_cloud_memorystore_v1::model::ListAuthTokensRequest;
9401 /// let x = ListAuthTokensRequest::new().set_order_by("example");
9402 /// ```
9403 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9404 self.order_by = v.into();
9405 self
9406 }
9407}
9408
9409impl wkt::message::Message for ListAuthTokensRequest {
9410 fn typename() -> &'static str {
9411 "type.googleapis.com/google.cloud.memorystore.v1.ListAuthTokensRequest"
9412 }
9413}
9414
9415/// Response message for `ListAuthTokens`.
9416#[derive(Clone, Default, PartialEq)]
9417#[non_exhaustive]
9418pub struct ListAuthTokensResponse {
9419 /// A list of auth tokens in the project.
9420 pub auth_tokens: std::vec::Vec<crate::model::AuthToken>,
9421
9422 /// Token to retrieve the next page of results, or empty if there are no more
9423 /// results in the list.
9424 pub next_page_token: std::string::String,
9425
9426 /// Unordered list. Auth tokens that could not be reached.
9427 pub unreachable: std::vec::Vec<std::string::String>,
9428
9429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9430}
9431
9432impl ListAuthTokensResponse {
9433 /// Creates a new default instance.
9434 pub fn new() -> Self {
9435 std::default::Default::default()
9436 }
9437
9438 /// Sets the value of [auth_tokens][crate::model::ListAuthTokensResponse::auth_tokens].
9439 ///
9440 /// # Example
9441 /// ```ignore,no_run
9442 /// # use google_cloud_memorystore_v1::model::ListAuthTokensResponse;
9443 /// use google_cloud_memorystore_v1::model::AuthToken;
9444 /// let x = ListAuthTokensResponse::new()
9445 /// .set_auth_tokens([
9446 /// AuthToken::default()/* use setters */,
9447 /// AuthToken::default()/* use (different) setters */,
9448 /// ]);
9449 /// ```
9450 pub fn set_auth_tokens<T, V>(mut self, v: T) -> Self
9451 where
9452 T: std::iter::IntoIterator<Item = V>,
9453 V: std::convert::Into<crate::model::AuthToken>,
9454 {
9455 use std::iter::Iterator;
9456 self.auth_tokens = v.into_iter().map(|i| i.into()).collect();
9457 self
9458 }
9459
9460 /// Sets the value of [next_page_token][crate::model::ListAuthTokensResponse::next_page_token].
9461 ///
9462 /// # Example
9463 /// ```ignore,no_run
9464 /// # use google_cloud_memorystore_v1::model::ListAuthTokensResponse;
9465 /// let x = ListAuthTokensResponse::new().set_next_page_token("example");
9466 /// ```
9467 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9468 self.next_page_token = v.into();
9469 self
9470 }
9471
9472 /// Sets the value of [unreachable][crate::model::ListAuthTokensResponse::unreachable].
9473 ///
9474 /// # Example
9475 /// ```ignore,no_run
9476 /// # use google_cloud_memorystore_v1::model::ListAuthTokensResponse;
9477 /// let x = ListAuthTokensResponse::new().set_unreachable(["a", "b", "c"]);
9478 /// ```
9479 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
9480 where
9481 T: std::iter::IntoIterator<Item = V>,
9482 V: std::convert::Into<std::string::String>,
9483 {
9484 use std::iter::Iterator;
9485 self.unreachable = v.into_iter().map(|i| i.into()).collect();
9486 self
9487 }
9488}
9489
9490impl wkt::message::Message for ListAuthTokensResponse {
9491 fn typename() -> &'static str {
9492 "type.googleapis.com/google.cloud.memorystore.v1.ListAuthTokensResponse"
9493 }
9494}
9495
9496#[doc(hidden)]
9497impl google_cloud_gax::paginator::internal::PageableResponse for ListAuthTokensResponse {
9498 type PageItem = crate::model::AuthToken;
9499
9500 fn items(self) -> std::vec::Vec<Self::PageItem> {
9501 self.auth_tokens
9502 }
9503
9504 fn next_page_token(&self) -> std::string::String {
9505 use std::clone::Clone;
9506 self.next_page_token.clone()
9507 }
9508}
9509
9510/// Request message for `GetAuthToken`.
9511#[derive(Clone, Default, PartialEq)]
9512#[non_exhaustive]
9513pub struct GetAuthTokenRequest {
9514 /// Required. The name of token auth user for a token auth enabled instance.
9515 /// Format:
9516 /// projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}/authTokens/{auth_token}
9517 pub name: std::string::String,
9518
9519 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9520}
9521
9522impl GetAuthTokenRequest {
9523 /// Creates a new default instance.
9524 pub fn new() -> Self {
9525 std::default::Default::default()
9526 }
9527
9528 /// Sets the value of [name][crate::model::GetAuthTokenRequest::name].
9529 ///
9530 /// # Example
9531 /// ```ignore,no_run
9532 /// # use google_cloud_memorystore_v1::model::GetAuthTokenRequest;
9533 /// # let project_id = "project_id";
9534 /// # let location_id = "location_id";
9535 /// # let instance_id = "instance_id";
9536 /// # let token_auth_user_id = "token_auth_user_id";
9537 /// # let auth_token_id = "auth_token_id";
9538 /// let x = GetAuthTokenRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}/authTokens/{auth_token_id}"));
9539 /// ```
9540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9541 self.name = v.into();
9542 self
9543 }
9544}
9545
9546impl wkt::message::Message for GetAuthTokenRequest {
9547 fn typename() -> &'static str {
9548 "type.googleapis.com/google.cloud.memorystore.v1.GetAuthTokenRequest"
9549 }
9550}
9551
9552/// Request message for `AddTokenAuthUser`.
9553#[derive(Clone, Default, PartialEq)]
9554#[non_exhaustive]
9555pub struct AddTokenAuthUserRequest {
9556 /// Required. The instance resource that this token auth user will be added
9557 /// for. Format: projects/{project}/locations/{location}/instances/{instance}
9558 pub instance: std::string::String,
9559
9560 /// Required. The name of the token auth user to add.
9561 pub token_auth_user: std::string::String,
9562
9563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9564}
9565
9566impl AddTokenAuthUserRequest {
9567 /// Creates a new default instance.
9568 pub fn new() -> Self {
9569 std::default::Default::default()
9570 }
9571
9572 /// Sets the value of [instance][crate::model::AddTokenAuthUserRequest::instance].
9573 ///
9574 /// # Example
9575 /// ```ignore,no_run
9576 /// # use google_cloud_memorystore_v1::model::AddTokenAuthUserRequest;
9577 /// # let project_id = "project_id";
9578 /// # let location_id = "location_id";
9579 /// # let instance_id = "instance_id";
9580 /// let x = AddTokenAuthUserRequest::new().set_instance(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}"));
9581 /// ```
9582 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9583 self.instance = v.into();
9584 self
9585 }
9586
9587 /// Sets the value of [token_auth_user][crate::model::AddTokenAuthUserRequest::token_auth_user].
9588 ///
9589 /// # Example
9590 /// ```ignore,no_run
9591 /// # use google_cloud_memorystore_v1::model::AddTokenAuthUserRequest;
9592 /// let x = AddTokenAuthUserRequest::new().set_token_auth_user("example");
9593 /// ```
9594 pub fn set_token_auth_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9595 self.token_auth_user = v.into();
9596 self
9597 }
9598}
9599
9600impl wkt::message::Message for AddTokenAuthUserRequest {
9601 fn typename() -> &'static str {
9602 "type.googleapis.com/google.cloud.memorystore.v1.AddTokenAuthUserRequest"
9603 }
9604}
9605
9606/// Request message for `DeleteTokenAuthUser`.
9607#[derive(Clone, Default, PartialEq)]
9608#[non_exhaustive]
9609pub struct DeleteTokenAuthUserRequest {
9610 /// Required. The name of the token auth user to delete.
9611 /// Format:
9612 /// projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}
9613 pub name: std::string::String,
9614
9615 /// Optional. An optional request ID to identify requests. Specify a unique
9616 /// request ID so that if you must retry your request, the server will know to
9617 /// ignore the request if it has already been completed. The server will
9618 /// guarantee that for at least 60 minutes after the first request.
9619 ///
9620 /// For example, consider a situation where you make an initial request and the
9621 /// request times out. If you make the request again with the same request
9622 /// ID, the server can check if original operation with the same request ID
9623 /// was received, and if so, will ignore the second request. This prevents
9624 /// clients from accidentally creating duplicate commitments.
9625 ///
9626 /// The request ID must be a valid UUID with the exception that zero UUID is
9627 /// not supported (00000000-0000-0000-0000-000000000000).
9628 pub request_id: std::string::String,
9629
9630 /// Optional. If set to true, any auth tokens from this user will also be
9631 /// deleted. Otherwise, the request will only work if the user has no auth
9632 /// tokens.
9633 pub force: bool,
9634
9635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9636}
9637
9638impl DeleteTokenAuthUserRequest {
9639 /// Creates a new default instance.
9640 pub fn new() -> Self {
9641 std::default::Default::default()
9642 }
9643
9644 /// Sets the value of [name][crate::model::DeleteTokenAuthUserRequest::name].
9645 ///
9646 /// # Example
9647 /// ```ignore,no_run
9648 /// # use google_cloud_memorystore_v1::model::DeleteTokenAuthUserRequest;
9649 /// # let project_id = "project_id";
9650 /// # let location_id = "location_id";
9651 /// # let instance_id = "instance_id";
9652 /// # let token_auth_user_id = "token_auth_user_id";
9653 /// let x = DeleteTokenAuthUserRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"));
9654 /// ```
9655 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9656 self.name = v.into();
9657 self
9658 }
9659
9660 /// Sets the value of [request_id][crate::model::DeleteTokenAuthUserRequest::request_id].
9661 ///
9662 /// # Example
9663 /// ```ignore,no_run
9664 /// # use google_cloud_memorystore_v1::model::DeleteTokenAuthUserRequest;
9665 /// let x = DeleteTokenAuthUserRequest::new().set_request_id("example");
9666 /// ```
9667 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9668 self.request_id = v.into();
9669 self
9670 }
9671
9672 /// Sets the value of [force][crate::model::DeleteTokenAuthUserRequest::force].
9673 ///
9674 /// # Example
9675 /// ```ignore,no_run
9676 /// # use google_cloud_memorystore_v1::model::DeleteTokenAuthUserRequest;
9677 /// let x = DeleteTokenAuthUserRequest::new().set_force(true);
9678 /// ```
9679 pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9680 self.force = v.into();
9681 self
9682 }
9683}
9684
9685impl wkt::message::Message for DeleteTokenAuthUserRequest {
9686 fn typename() -> &'static str {
9687 "type.googleapis.com/google.cloud.memorystore.v1.DeleteTokenAuthUserRequest"
9688 }
9689}
9690
9691/// Request message for `AddAuthToken`.
9692#[derive(Clone, Default, PartialEq)]
9693#[non_exhaustive]
9694pub struct AddAuthTokenRequest {
9695 /// Required. The name of the token auth user resource that this token will be
9696 /// added for.
9697 pub token_auth_user: std::string::String,
9698
9699 /// Required. The auth token to add.
9700 pub auth_token: std::option::Option<crate::model::AuthToken>,
9701
9702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9703}
9704
9705impl AddAuthTokenRequest {
9706 /// Creates a new default instance.
9707 pub fn new() -> Self {
9708 std::default::Default::default()
9709 }
9710
9711 /// Sets the value of [token_auth_user][crate::model::AddAuthTokenRequest::token_auth_user].
9712 ///
9713 /// # Example
9714 /// ```ignore,no_run
9715 /// # use google_cloud_memorystore_v1::model::AddAuthTokenRequest;
9716 /// # let project_id = "project_id";
9717 /// # let location_id = "location_id";
9718 /// # let instance_id = "instance_id";
9719 /// # let token_auth_user_id = "token_auth_user_id";
9720 /// let x = AddAuthTokenRequest::new().set_token_auth_user(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}"));
9721 /// ```
9722 pub fn set_token_auth_user<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9723 self.token_auth_user = v.into();
9724 self
9725 }
9726
9727 /// Sets the value of [auth_token][crate::model::AddAuthTokenRequest::auth_token].
9728 ///
9729 /// # Example
9730 /// ```ignore,no_run
9731 /// # use google_cloud_memorystore_v1::model::AddAuthTokenRequest;
9732 /// use google_cloud_memorystore_v1::model::AuthToken;
9733 /// let x = AddAuthTokenRequest::new().set_auth_token(AuthToken::default()/* use setters */);
9734 /// ```
9735 pub fn set_auth_token<T>(mut self, v: T) -> Self
9736 where
9737 T: std::convert::Into<crate::model::AuthToken>,
9738 {
9739 self.auth_token = std::option::Option::Some(v.into());
9740 self
9741 }
9742
9743 /// Sets or clears the value of [auth_token][crate::model::AddAuthTokenRequest::auth_token].
9744 ///
9745 /// # Example
9746 /// ```ignore,no_run
9747 /// # use google_cloud_memorystore_v1::model::AddAuthTokenRequest;
9748 /// use google_cloud_memorystore_v1::model::AuthToken;
9749 /// let x = AddAuthTokenRequest::new().set_or_clear_auth_token(Some(AuthToken::default()/* use setters */));
9750 /// let x = AddAuthTokenRequest::new().set_or_clear_auth_token(None::<AuthToken>);
9751 /// ```
9752 pub fn set_or_clear_auth_token<T>(mut self, v: std::option::Option<T>) -> Self
9753 where
9754 T: std::convert::Into<crate::model::AuthToken>,
9755 {
9756 self.auth_token = v.map(|x| x.into());
9757 self
9758 }
9759}
9760
9761impl wkt::message::Message for AddAuthTokenRequest {
9762 fn typename() -> &'static str {
9763 "type.googleapis.com/google.cloud.memorystore.v1.AddAuthTokenRequest"
9764 }
9765}
9766
9767/// Request message for `DeleteAuthToken`.
9768#[derive(Clone, Default, PartialEq)]
9769#[non_exhaustive]
9770pub struct DeleteAuthTokenRequest {
9771 /// Required. The name of the token auth user resource that this token will be
9772 /// deleted from. Format:
9773 /// projects/{project}/locations/{location}/instances/{instance}/tokenAuthUsers/{token_auth_user}/authTokens/{name}
9774 pub name: std::string::String,
9775
9776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9777}
9778
9779impl DeleteAuthTokenRequest {
9780 /// Creates a new default instance.
9781 pub fn new() -> Self {
9782 std::default::Default::default()
9783 }
9784
9785 /// Sets the value of [name][crate::model::DeleteAuthTokenRequest::name].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_memorystore_v1::model::DeleteAuthTokenRequest;
9790 /// # let project_id = "project_id";
9791 /// # let location_id = "location_id";
9792 /// # let instance_id = "instance_id";
9793 /// # let token_auth_user_id = "token_auth_user_id";
9794 /// # let auth_token_id = "auth_token_id";
9795 /// let x = DeleteAuthTokenRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/tokenAuthUsers/{token_auth_user_id}/authTokens/{auth_token_id}"));
9796 /// ```
9797 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9798 self.name = v.into();
9799 self
9800 }
9801}
9802
9803impl wkt::message::Message for DeleteAuthTokenRequest {
9804 fn typename() -> &'static str {
9805 "type.googleapis.com/google.cloud.memorystore.v1.DeleteAuthTokenRequest"
9806 }
9807}
9808
9809/// A certificate authority for an instance.
9810#[derive(Clone, Default, PartialEq)]
9811#[non_exhaustive]
9812pub struct CertificateAuthority {
9813 /// Identifier. Unique name of the certificate authority.
9814 /// Format:
9815 /// projects/{project}/locations/{location}/instances/{instance}
9816 pub name: std::string::String,
9817
9818 /// Information about the server certificate authority.
9819 pub server_ca: std::option::Option<crate::model::certificate_authority::ServerCa>,
9820
9821 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9822}
9823
9824impl CertificateAuthority {
9825 /// Creates a new default instance.
9826 pub fn new() -> Self {
9827 std::default::Default::default()
9828 }
9829
9830 /// Sets the value of [name][crate::model::CertificateAuthority::name].
9831 ///
9832 /// # Example
9833 /// ```ignore,no_run
9834 /// # use google_cloud_memorystore_v1::model::CertificateAuthority;
9835 /// # let project_id = "project_id";
9836 /// # let location_id = "location_id";
9837 /// # let instance_id = "instance_id";
9838 /// let x = CertificateAuthority::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/certificateAuthority"));
9839 /// ```
9840 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9841 self.name = v.into();
9842 self
9843 }
9844
9845 /// Sets the value of [server_ca][crate::model::CertificateAuthority::server_ca].
9846 ///
9847 /// Note that all the setters affecting `server_ca` are mutually
9848 /// exclusive.
9849 ///
9850 /// # Example
9851 /// ```ignore,no_run
9852 /// # use google_cloud_memorystore_v1::model::CertificateAuthority;
9853 /// use google_cloud_memorystore_v1::model::certificate_authority::ManagedCertificateAuthority;
9854 /// let x = CertificateAuthority::new().set_server_ca(Some(
9855 /// google_cloud_memorystore_v1::model::certificate_authority::ServerCa::ManagedServerCa(ManagedCertificateAuthority::default().into())));
9856 /// ```
9857 pub fn set_server_ca<
9858 T: std::convert::Into<std::option::Option<crate::model::certificate_authority::ServerCa>>,
9859 >(
9860 mut self,
9861 v: T,
9862 ) -> Self {
9863 self.server_ca = v.into();
9864 self
9865 }
9866
9867 /// The value of [server_ca][crate::model::CertificateAuthority::server_ca]
9868 /// if it holds a `ManagedServerCa`, `None` if the field is not set or
9869 /// holds a different branch.
9870 pub fn managed_server_ca(
9871 &self,
9872 ) -> std::option::Option<
9873 &std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
9874 > {
9875 #[allow(unreachable_patterns)]
9876 self.server_ca.as_ref().and_then(|v| match v {
9877 crate::model::certificate_authority::ServerCa::ManagedServerCa(v) => {
9878 std::option::Option::Some(v)
9879 }
9880 _ => std::option::Option::None,
9881 })
9882 }
9883
9884 /// Sets the value of [server_ca][crate::model::CertificateAuthority::server_ca]
9885 /// to hold a `ManagedServerCa`.
9886 ///
9887 /// Note that all the setters affecting `server_ca` are
9888 /// mutually exclusive.
9889 ///
9890 /// # Example
9891 /// ```ignore,no_run
9892 /// # use google_cloud_memorystore_v1::model::CertificateAuthority;
9893 /// use google_cloud_memorystore_v1::model::certificate_authority::ManagedCertificateAuthority;
9894 /// let x = CertificateAuthority::new().set_managed_server_ca(ManagedCertificateAuthority::default()/* use setters */);
9895 /// assert!(x.managed_server_ca().is_some());
9896 /// ```
9897 pub fn set_managed_server_ca<
9898 T: std::convert::Into<
9899 std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
9900 >,
9901 >(
9902 mut self,
9903 v: T,
9904 ) -> Self {
9905 self.server_ca = std::option::Option::Some(
9906 crate::model::certificate_authority::ServerCa::ManagedServerCa(v.into()),
9907 );
9908 self
9909 }
9910}
9911
9912impl wkt::message::Message for CertificateAuthority {
9913 fn typename() -> &'static str {
9914 "type.googleapis.com/google.cloud.memorystore.v1.CertificateAuthority"
9915 }
9916}
9917
9918/// Defines additional types related to [CertificateAuthority].
9919pub mod certificate_authority {
9920 #[allow(unused_imports)]
9921 use super::*;
9922
9923 /// A managed certificate authority.
9924 #[derive(Clone, Default, PartialEq)]
9925 #[non_exhaustive]
9926 pub struct ManagedCertificateAuthority {
9927 /// PEM encoded CA certificate chains for managed server authentication.
9928 pub ca_certs: std::vec::Vec<
9929 crate::model::certificate_authority::managed_certificate_authority::CertChain,
9930 >,
9931
9932 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9933 }
9934
9935 impl ManagedCertificateAuthority {
9936 /// Creates a new default instance.
9937 pub fn new() -> Self {
9938 std::default::Default::default()
9939 }
9940
9941 /// Sets the value of [ca_certs][crate::model::certificate_authority::ManagedCertificateAuthority::ca_certs].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_memorystore_v1::model::certificate_authority::ManagedCertificateAuthority;
9946 /// use google_cloud_memorystore_v1::model::certificate_authority::managed_certificate_authority::CertChain;
9947 /// let x = ManagedCertificateAuthority::new()
9948 /// .set_ca_certs([
9949 /// CertChain::default()/* use setters */,
9950 /// CertChain::default()/* use (different) setters */,
9951 /// ]);
9952 /// ```
9953 pub fn set_ca_certs<T, V>(mut self, v: T) -> Self
9954 where
9955 T: std::iter::IntoIterator<Item = V>,
9956 V: std::convert::Into<
9957 crate::model::certificate_authority::managed_certificate_authority::CertChain,
9958 >,
9959 {
9960 use std::iter::Iterator;
9961 self.ca_certs = v.into_iter().map(|i| i.into()).collect();
9962 self
9963 }
9964 }
9965
9966 impl wkt::message::Message for ManagedCertificateAuthority {
9967 fn typename() -> &'static str {
9968 "type.googleapis.com/google.cloud.memorystore.v1.CertificateAuthority.ManagedCertificateAuthority"
9969 }
9970 }
9971
9972 /// Defines additional types related to [ManagedCertificateAuthority].
9973 pub mod managed_certificate_authority {
9974 #[allow(unused_imports)]
9975 use super::*;
9976
9977 /// A certificate chain.
9978 #[derive(Clone, Default, PartialEq)]
9979 #[non_exhaustive]
9980 pub struct CertChain {
9981 /// The certificates that form the CA chain in order of leaf to root.
9982 pub certificates: std::vec::Vec<std::string::String>,
9983
9984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9985 }
9986
9987 impl CertChain {
9988 /// Creates a new default instance.
9989 pub fn new() -> Self {
9990 std::default::Default::default()
9991 }
9992
9993 /// Sets the value of [certificates][crate::model::certificate_authority::managed_certificate_authority::CertChain::certificates].
9994 ///
9995 /// # Example
9996 /// ```ignore,no_run
9997 /// # use google_cloud_memorystore_v1::model::certificate_authority::managed_certificate_authority::CertChain;
9998 /// let x = CertChain::new().set_certificates(["a", "b", "c"]);
9999 /// ```
10000 pub fn set_certificates<T, V>(mut self, v: T) -> Self
10001 where
10002 T: std::iter::IntoIterator<Item = V>,
10003 V: std::convert::Into<std::string::String>,
10004 {
10005 use std::iter::Iterator;
10006 self.certificates = v.into_iter().map(|i| i.into()).collect();
10007 self
10008 }
10009 }
10010
10011 impl wkt::message::Message for CertChain {
10012 fn typename() -> &'static str {
10013 "type.googleapis.com/google.cloud.memorystore.v1.CertificateAuthority.ManagedCertificateAuthority.CertChain"
10014 }
10015 }
10016 }
10017
10018 /// Information about the server certificate authority.
10019 #[derive(Clone, Debug, PartialEq)]
10020 #[non_exhaustive]
10021 pub enum ServerCa {
10022 /// A managed server certificate authority.
10023 ManagedServerCa(
10024 std::boxed::Box<crate::model::certificate_authority::ManagedCertificateAuthority>,
10025 ),
10026 }
10027}
10028
10029/// Shared regional certificate authority for an instance.
10030#[derive(Clone, Default, PartialEq)]
10031#[non_exhaustive]
10032pub struct SharedRegionalCertificateAuthority {
10033 /// Identifier. Unique name of the resource in this scope including project and
10034 /// location using the form:
10035 /// `projects/{project}/locations/{location}/sharedRegionalCertificateAuthority`
10036 pub name: std::string::String,
10037
10038 /// Server ca information.
10039 pub server_ca:
10040 std::option::Option<crate::model::shared_regional_certificate_authority::ServerCa>,
10041
10042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10043}
10044
10045impl SharedRegionalCertificateAuthority {
10046 /// Creates a new default instance.
10047 pub fn new() -> Self {
10048 std::default::Default::default()
10049 }
10050
10051 /// Sets the value of [name][crate::model::SharedRegionalCertificateAuthority::name].
10052 ///
10053 /// # Example
10054 /// ```ignore,no_run
10055 /// # use google_cloud_memorystore_v1::model::SharedRegionalCertificateAuthority;
10056 /// # let project_id = "project_id";
10057 /// # let location_id = "location_id";
10058 /// let x = SharedRegionalCertificateAuthority::new().set_name(format!("projects/{project_id}/locations/{location_id}/sharedRegionalCertificateAuthority"));
10059 /// ```
10060 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10061 self.name = v.into();
10062 self
10063 }
10064
10065 /// Sets the value of [server_ca][crate::model::SharedRegionalCertificateAuthority::server_ca].
10066 ///
10067 /// Note that all the setters affecting `server_ca` are mutually
10068 /// exclusive.
10069 ///
10070 /// # Example
10071 /// ```ignore,no_run
10072 /// # use google_cloud_memorystore_v1::model::SharedRegionalCertificateAuthority;
10073 /// use google_cloud_memorystore_v1::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority;
10074 /// let x = SharedRegionalCertificateAuthority::new().set_server_ca(Some(
10075 /// google_cloud_memorystore_v1::model::shared_regional_certificate_authority::ServerCa::ManagedServerCa(RegionalManagedCertificateAuthority::default().into())));
10076 /// ```
10077 pub fn set_server_ca<
10078 T: std::convert::Into<
10079 std::option::Option<crate::model::shared_regional_certificate_authority::ServerCa>,
10080 >,
10081 >(
10082 mut self,
10083 v: T,
10084 ) -> Self {
10085 self.server_ca = v.into();
10086 self
10087 }
10088
10089 /// The value of [server_ca][crate::model::SharedRegionalCertificateAuthority::server_ca]
10090 /// if it holds a `ManagedServerCa`, `None` if the field is not set or
10091 /// holds a different branch.
10092 pub fn managed_server_ca(&self) -> std::option::Option<&std::boxed::Box<crate::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority>>{
10093 #[allow(unreachable_patterns)]
10094 self.server_ca.as_ref().and_then(|v| match v {
10095 crate::model::shared_regional_certificate_authority::ServerCa::ManagedServerCa(v) => {
10096 std::option::Option::Some(v)
10097 }
10098 _ => std::option::Option::None,
10099 })
10100 }
10101
10102 /// Sets the value of [server_ca][crate::model::SharedRegionalCertificateAuthority::server_ca]
10103 /// to hold a `ManagedServerCa`.
10104 ///
10105 /// Note that all the setters affecting `server_ca` are
10106 /// mutually exclusive.
10107 ///
10108 /// # Example
10109 /// ```ignore,no_run
10110 /// # use google_cloud_memorystore_v1::model::SharedRegionalCertificateAuthority;
10111 /// use google_cloud_memorystore_v1::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority;
10112 /// let x = SharedRegionalCertificateAuthority::new().set_managed_server_ca(RegionalManagedCertificateAuthority::default()/* use setters */);
10113 /// assert!(x.managed_server_ca().is_some());
10114 /// ```
10115 pub fn set_managed_server_ca<T: std::convert::Into<std::boxed::Box<crate::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority>>>(mut self, v: T) -> Self{
10116 self.server_ca = std::option::Option::Some(
10117 crate::model::shared_regional_certificate_authority::ServerCa::ManagedServerCa(
10118 v.into(),
10119 ),
10120 );
10121 self
10122 }
10123}
10124
10125impl wkt::message::Message for SharedRegionalCertificateAuthority {
10126 fn typename() -> &'static str {
10127 "type.googleapis.com/google.cloud.memorystore.v1.SharedRegionalCertificateAuthority"
10128 }
10129}
10130
10131/// Defines additional types related to [SharedRegionalCertificateAuthority].
10132pub mod shared_regional_certificate_authority {
10133 #[allow(unused_imports)]
10134 use super::*;
10135
10136 /// CA certificate chains for memorystore managed server authentication.
10137 #[derive(Clone, Default, PartialEq)]
10138 #[non_exhaustive]
10139 pub struct RegionalManagedCertificateAuthority {
10140
10141 /// The PEM encoded CA certificate chains for memorystore managed
10142 /// server authentication
10143 pub ca_certs: std::vec::Vec<crate::model::shared_regional_certificate_authority::regional_managed_certificate_authority::RegionalCertChain>,
10144
10145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10146 }
10147
10148 impl RegionalManagedCertificateAuthority {
10149 /// Creates a new default instance.
10150 pub fn new() -> Self {
10151 std::default::Default::default()
10152 }
10153
10154 /// Sets the value of [ca_certs][crate::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority::ca_certs].
10155 ///
10156 /// # Example
10157 /// ```ignore,no_run
10158 /// # use google_cloud_memorystore_v1::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority;
10159 /// use google_cloud_memorystore_v1::model::shared_regional_certificate_authority::regional_managed_certificate_authority::RegionalCertChain;
10160 /// let x = RegionalManagedCertificateAuthority::new()
10161 /// .set_ca_certs([
10162 /// RegionalCertChain::default()/* use setters */,
10163 /// RegionalCertChain::default()/* use (different) setters */,
10164 /// ]);
10165 /// ```
10166 pub fn set_ca_certs<T, V>(mut self, v: T) -> Self
10167 where
10168 T: std::iter::IntoIterator<Item = V>,
10169 V: std::convert::Into<crate::model::shared_regional_certificate_authority::regional_managed_certificate_authority::RegionalCertChain>
10170 {
10171 use std::iter::Iterator;
10172 self.ca_certs = v.into_iter().map(|i| i.into()).collect();
10173 self
10174 }
10175 }
10176
10177 impl wkt::message::Message for RegionalManagedCertificateAuthority {
10178 fn typename() -> &'static str {
10179 "type.googleapis.com/google.cloud.memorystore.v1.SharedRegionalCertificateAuthority.RegionalManagedCertificateAuthority"
10180 }
10181 }
10182
10183 /// Defines additional types related to [RegionalManagedCertificateAuthority].
10184 pub mod regional_managed_certificate_authority {
10185 #[allow(unused_imports)]
10186 use super::*;
10187
10188 /// The certificates that form the CA chain, from leaf to root order.
10189 #[derive(Clone, Default, PartialEq)]
10190 #[non_exhaustive]
10191 pub struct RegionalCertChain {
10192 /// The certificates that form the CA chain, from leaf to root order.
10193 pub certificates: std::vec::Vec<std::string::String>,
10194
10195 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10196 }
10197
10198 impl RegionalCertChain {
10199 /// Creates a new default instance.
10200 pub fn new() -> Self {
10201 std::default::Default::default()
10202 }
10203
10204 /// Sets the value of [certificates][crate::model::shared_regional_certificate_authority::regional_managed_certificate_authority::RegionalCertChain::certificates].
10205 ///
10206 /// # Example
10207 /// ```ignore,no_run
10208 /// # use google_cloud_memorystore_v1::model::shared_regional_certificate_authority::regional_managed_certificate_authority::RegionalCertChain;
10209 /// let x = RegionalCertChain::new().set_certificates(["a", "b", "c"]);
10210 /// ```
10211 pub fn set_certificates<T, V>(mut self, v: T) -> Self
10212 where
10213 T: std::iter::IntoIterator<Item = V>,
10214 V: std::convert::Into<std::string::String>,
10215 {
10216 use std::iter::Iterator;
10217 self.certificates = v.into_iter().map(|i| i.into()).collect();
10218 self
10219 }
10220 }
10221
10222 impl wkt::message::Message for RegionalCertChain {
10223 fn typename() -> &'static str {
10224 "type.googleapis.com/google.cloud.memorystore.v1.SharedRegionalCertificateAuthority.RegionalManagedCertificateAuthority.RegionalCertChain"
10225 }
10226 }
10227 }
10228
10229 /// Server ca information.
10230 #[derive(Clone, Debug, PartialEq)]
10231 #[non_exhaustive]
10232 pub enum ServerCa {
10233 /// CA certificate chains for memorystore managed server authentication.
10234 ManagedServerCa(std::boxed::Box<crate::model::shared_regional_certificate_authority::RegionalManagedCertificateAuthority>),
10235 }
10236}
10237
10238/// Request for `GetSharedRegionalCertificateAuthority`.
10239#[derive(Clone, Default, PartialEq)]
10240#[non_exhaustive]
10241pub struct GetSharedRegionalCertificateAuthorityRequest {
10242 /// Required. Regional certificate authority resource name using the form:
10243 /// `projects/{project}/locations/{location}/sharedRegionalCertificateAuthority`
10244 /// where `location_id` refers to a Google Cloud region.
10245 pub name: std::string::String,
10246
10247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10248}
10249
10250impl GetSharedRegionalCertificateAuthorityRequest {
10251 /// Creates a new default instance.
10252 pub fn new() -> Self {
10253 std::default::Default::default()
10254 }
10255
10256 /// Sets the value of [name][crate::model::GetSharedRegionalCertificateAuthorityRequest::name].
10257 ///
10258 /// # Example
10259 /// ```ignore,no_run
10260 /// # use google_cloud_memorystore_v1::model::GetSharedRegionalCertificateAuthorityRequest;
10261 /// # let project_id = "project_id";
10262 /// # let location_id = "location_id";
10263 /// let x = GetSharedRegionalCertificateAuthorityRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/sharedRegionalCertificateAuthority"));
10264 /// ```
10265 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10266 self.name = v.into();
10267 self
10268 }
10269}
10270
10271impl wkt::message::Message for GetSharedRegionalCertificateAuthorityRequest {
10272 fn typename() -> &'static str {
10273 "type.googleapis.com/google.cloud.memorystore.v1.GetSharedRegionalCertificateAuthorityRequest"
10274 }
10275}
10276
10277/// Represents the metadata of a long-running operation.
10278#[derive(Clone, Default, PartialEq)]
10279#[non_exhaustive]
10280pub struct OperationMetadata {
10281 /// Output only. The time the operation was created.
10282 pub create_time: std::option::Option<wkt::Timestamp>,
10283
10284 /// Output only. The time the operation finished running.
10285 pub end_time: std::option::Option<wkt::Timestamp>,
10286
10287 /// Output only. Server-defined resource path for the target of the operation.
10288 pub target: std::string::String,
10289
10290 /// Output only. Name of the verb executed by the operation.
10291 pub verb: std::string::String,
10292
10293 /// Output only. Human-readable status of the operation, if any.
10294 pub status_message: std::string::String,
10295
10296 /// Output only. Identifies whether the user has requested cancellation
10297 /// of the operation. Operations that have been cancelled successfully
10298 /// have [Operation.error][] value with a
10299 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
10300 /// `Code.CANCELLED`.
10301 pub requested_cancellation: bool,
10302
10303 /// Output only. API version used to start the operation.
10304 pub api_version: std::string::String,
10305
10306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10307}
10308
10309impl OperationMetadata {
10310 /// Creates a new default instance.
10311 pub fn new() -> Self {
10312 std::default::Default::default()
10313 }
10314
10315 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
10316 ///
10317 /// # Example
10318 /// ```ignore,no_run
10319 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10320 /// use wkt::Timestamp;
10321 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10322 /// ```
10323 pub fn set_create_time<T>(mut self, v: T) -> Self
10324 where
10325 T: std::convert::Into<wkt::Timestamp>,
10326 {
10327 self.create_time = std::option::Option::Some(v.into());
10328 self
10329 }
10330
10331 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
10332 ///
10333 /// # Example
10334 /// ```ignore,no_run
10335 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10336 /// use wkt::Timestamp;
10337 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10338 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10339 /// ```
10340 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10341 where
10342 T: std::convert::Into<wkt::Timestamp>,
10343 {
10344 self.create_time = v.map(|x| x.into());
10345 self
10346 }
10347
10348 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
10349 ///
10350 /// # Example
10351 /// ```ignore,no_run
10352 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10353 /// use wkt::Timestamp;
10354 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
10355 /// ```
10356 pub fn set_end_time<T>(mut self, v: T) -> Self
10357 where
10358 T: std::convert::Into<wkt::Timestamp>,
10359 {
10360 self.end_time = std::option::Option::Some(v.into());
10361 self
10362 }
10363
10364 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
10365 ///
10366 /// # Example
10367 /// ```ignore,no_run
10368 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10369 /// use wkt::Timestamp;
10370 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
10371 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
10372 /// ```
10373 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
10374 where
10375 T: std::convert::Into<wkt::Timestamp>,
10376 {
10377 self.end_time = v.map(|x| x.into());
10378 self
10379 }
10380
10381 /// Sets the value of [target][crate::model::OperationMetadata::target].
10382 ///
10383 /// # Example
10384 /// ```ignore,no_run
10385 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10386 /// let x = OperationMetadata::new().set_target("example");
10387 /// ```
10388 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10389 self.target = v.into();
10390 self
10391 }
10392
10393 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
10394 ///
10395 /// # Example
10396 /// ```ignore,no_run
10397 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10398 /// let x = OperationMetadata::new().set_verb("example");
10399 /// ```
10400 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10401 self.verb = v.into();
10402 self
10403 }
10404
10405 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
10406 ///
10407 /// # Example
10408 /// ```ignore,no_run
10409 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10410 /// let x = OperationMetadata::new().set_status_message("example");
10411 /// ```
10412 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10413 self.status_message = v.into();
10414 self
10415 }
10416
10417 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
10418 ///
10419 /// # Example
10420 /// ```ignore,no_run
10421 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10422 /// let x = OperationMetadata::new().set_requested_cancellation(true);
10423 /// ```
10424 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10425 self.requested_cancellation = v.into();
10426 self
10427 }
10428
10429 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
10430 ///
10431 /// # Example
10432 /// ```ignore,no_run
10433 /// # use google_cloud_memorystore_v1::model::OperationMetadata;
10434 /// let x = OperationMetadata::new().set_api_version("example");
10435 /// ```
10436 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10437 self.api_version = v.into();
10438 self
10439 }
10440}
10441
10442impl wkt::message::Message for OperationMetadata {
10443 fn typename() -> &'static str {
10444 "type.googleapis.com/google.cloud.memorystore.v1.OperationMetadata"
10445 }
10446}
10447
10448/// EncryptionInfo describes the encryption information of a cluster.
10449#[derive(Clone, Default, PartialEq)]
10450#[non_exhaustive]
10451pub struct EncryptionInfo {
10452 /// Output only. Type of encryption.
10453 pub encryption_type: crate::model::encryption_info::Type,
10454
10455 /// Output only. KMS key versions that are being used to protect the data
10456 /// at-rest.
10457 pub kms_key_versions: std::vec::Vec<std::string::String>,
10458
10459 /// Output only. The state of the primary version of the KMS key perceived by
10460 /// the system. This field is not populated in backups.
10461 pub kms_key_primary_state: crate::model::encryption_info::KmsKeyState,
10462
10463 /// Output only. The most recent time when the encryption info was updated.
10464 pub last_update_time: std::option::Option<wkt::Timestamp>,
10465
10466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10467}
10468
10469impl EncryptionInfo {
10470 /// Creates a new default instance.
10471 pub fn new() -> Self {
10472 std::default::Default::default()
10473 }
10474
10475 /// Sets the value of [encryption_type][crate::model::EncryptionInfo::encryption_type].
10476 ///
10477 /// # Example
10478 /// ```ignore,no_run
10479 /// # use google_cloud_memorystore_v1::model::EncryptionInfo;
10480 /// use google_cloud_memorystore_v1::model::encryption_info::Type;
10481 /// let x0 = EncryptionInfo::new().set_encryption_type(Type::GoogleDefaultEncryption);
10482 /// let x1 = EncryptionInfo::new().set_encryption_type(Type::CustomerManagedEncryption);
10483 /// ```
10484 pub fn set_encryption_type<T: std::convert::Into<crate::model::encryption_info::Type>>(
10485 mut self,
10486 v: T,
10487 ) -> Self {
10488 self.encryption_type = v.into();
10489 self
10490 }
10491
10492 /// Sets the value of [kms_key_versions][crate::model::EncryptionInfo::kms_key_versions].
10493 ///
10494 /// # Example
10495 /// ```ignore,no_run
10496 /// # use google_cloud_memorystore_v1::model::EncryptionInfo;
10497 /// let x = EncryptionInfo::new().set_kms_key_versions(["a", "b", "c"]);
10498 /// ```
10499 pub fn set_kms_key_versions<T, V>(mut self, v: T) -> Self
10500 where
10501 T: std::iter::IntoIterator<Item = V>,
10502 V: std::convert::Into<std::string::String>,
10503 {
10504 use std::iter::Iterator;
10505 self.kms_key_versions = v.into_iter().map(|i| i.into()).collect();
10506 self
10507 }
10508
10509 /// Sets the value of [kms_key_primary_state][crate::model::EncryptionInfo::kms_key_primary_state].
10510 ///
10511 /// # Example
10512 /// ```ignore,no_run
10513 /// # use google_cloud_memorystore_v1::model::EncryptionInfo;
10514 /// use google_cloud_memorystore_v1::model::encryption_info::KmsKeyState;
10515 /// let x0 = EncryptionInfo::new().set_kms_key_primary_state(KmsKeyState::Enabled);
10516 /// let x1 = EncryptionInfo::new().set_kms_key_primary_state(KmsKeyState::PermissionDenied);
10517 /// let x2 = EncryptionInfo::new().set_kms_key_primary_state(KmsKeyState::Disabled);
10518 /// ```
10519 pub fn set_kms_key_primary_state<
10520 T: std::convert::Into<crate::model::encryption_info::KmsKeyState>,
10521 >(
10522 mut self,
10523 v: T,
10524 ) -> Self {
10525 self.kms_key_primary_state = v.into();
10526 self
10527 }
10528
10529 /// Sets the value of [last_update_time][crate::model::EncryptionInfo::last_update_time].
10530 ///
10531 /// # Example
10532 /// ```ignore,no_run
10533 /// # use google_cloud_memorystore_v1::model::EncryptionInfo;
10534 /// use wkt::Timestamp;
10535 /// let x = EncryptionInfo::new().set_last_update_time(Timestamp::default()/* use setters */);
10536 /// ```
10537 pub fn set_last_update_time<T>(mut self, v: T) -> Self
10538 where
10539 T: std::convert::Into<wkt::Timestamp>,
10540 {
10541 self.last_update_time = std::option::Option::Some(v.into());
10542 self
10543 }
10544
10545 /// Sets or clears the value of [last_update_time][crate::model::EncryptionInfo::last_update_time].
10546 ///
10547 /// # Example
10548 /// ```ignore,no_run
10549 /// # use google_cloud_memorystore_v1::model::EncryptionInfo;
10550 /// use wkt::Timestamp;
10551 /// let x = EncryptionInfo::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
10552 /// let x = EncryptionInfo::new().set_or_clear_last_update_time(None::<Timestamp>);
10553 /// ```
10554 pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10555 where
10556 T: std::convert::Into<wkt::Timestamp>,
10557 {
10558 self.last_update_time = v.map(|x| x.into());
10559 self
10560 }
10561}
10562
10563impl wkt::message::Message for EncryptionInfo {
10564 fn typename() -> &'static str {
10565 "type.googleapis.com/google.cloud.memorystore.v1.EncryptionInfo"
10566 }
10567}
10568
10569/// Defines additional types related to [EncryptionInfo].
10570pub mod encryption_info {
10571 #[allow(unused_imports)]
10572 use super::*;
10573
10574 /// Possible encryption types.
10575 ///
10576 /// # Working with unknown values
10577 ///
10578 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10579 /// additional enum variants at any time. Adding new variants is not considered
10580 /// a breaking change. Applications should write their code in anticipation of:
10581 ///
10582 /// - New values appearing in future releases of the client library, **and**
10583 /// - New values received dynamically, without application changes.
10584 ///
10585 /// Please consult the [Working with enums] section in the user guide for some
10586 /// guidelines.
10587 ///
10588 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10589 #[derive(Clone, Debug, PartialEq)]
10590 #[non_exhaustive]
10591 pub enum Type {
10592 /// Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION.
10593 Unspecified,
10594 /// The data is encrypted at rest with a key that is fully managed by Google.
10595 /// No key version will be populated. This is the default state.
10596 GoogleDefaultEncryption,
10597 /// The data is encrypted at rest with a key that is managed by the customer.
10598 /// KMS key versions will be populated.
10599 CustomerManagedEncryption,
10600 /// If set, the enum was initialized with an unknown value.
10601 ///
10602 /// Applications can examine the value using [Type::value] or
10603 /// [Type::name].
10604 UnknownValue(r#type::UnknownValue),
10605 }
10606
10607 #[doc(hidden)]
10608 pub mod r#type {
10609 #[allow(unused_imports)]
10610 use super::*;
10611 #[derive(Clone, Debug, PartialEq)]
10612 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10613 }
10614
10615 impl Type {
10616 /// Gets the enum value.
10617 ///
10618 /// Returns `None` if the enum contains an unknown value deserialized from
10619 /// the string representation of enums.
10620 pub fn value(&self) -> std::option::Option<i32> {
10621 match self {
10622 Self::Unspecified => std::option::Option::Some(0),
10623 Self::GoogleDefaultEncryption => std::option::Option::Some(1),
10624 Self::CustomerManagedEncryption => std::option::Option::Some(2),
10625 Self::UnknownValue(u) => u.0.value(),
10626 }
10627 }
10628
10629 /// Gets the enum value as a string.
10630 ///
10631 /// Returns `None` if the enum contains an unknown value deserialized from
10632 /// the integer representation of enums.
10633 pub fn name(&self) -> std::option::Option<&str> {
10634 match self {
10635 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
10636 Self::GoogleDefaultEncryption => {
10637 std::option::Option::Some("GOOGLE_DEFAULT_ENCRYPTION")
10638 }
10639 Self::CustomerManagedEncryption => {
10640 std::option::Option::Some("CUSTOMER_MANAGED_ENCRYPTION")
10641 }
10642 Self::UnknownValue(u) => u.0.name(),
10643 }
10644 }
10645 }
10646
10647 impl std::default::Default for Type {
10648 fn default() -> Self {
10649 use std::convert::From;
10650 Self::from(0)
10651 }
10652 }
10653
10654 impl std::fmt::Display for Type {
10655 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10656 wkt::internal::display_enum(f, self.name(), self.value())
10657 }
10658 }
10659
10660 impl std::convert::From<i32> for Type {
10661 fn from(value: i32) -> Self {
10662 match value {
10663 0 => Self::Unspecified,
10664 1 => Self::GoogleDefaultEncryption,
10665 2 => Self::CustomerManagedEncryption,
10666 _ => Self::UnknownValue(r#type::UnknownValue(
10667 wkt::internal::UnknownEnumValue::Integer(value),
10668 )),
10669 }
10670 }
10671 }
10672
10673 impl std::convert::From<&str> for Type {
10674 fn from(value: &str) -> Self {
10675 use std::string::ToString;
10676 match value {
10677 "TYPE_UNSPECIFIED" => Self::Unspecified,
10678 "GOOGLE_DEFAULT_ENCRYPTION" => Self::GoogleDefaultEncryption,
10679 "CUSTOMER_MANAGED_ENCRYPTION" => Self::CustomerManagedEncryption,
10680 _ => Self::UnknownValue(r#type::UnknownValue(
10681 wkt::internal::UnknownEnumValue::String(value.to_string()),
10682 )),
10683 }
10684 }
10685 }
10686
10687 impl serde::ser::Serialize for Type {
10688 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10689 where
10690 S: serde::Serializer,
10691 {
10692 match self {
10693 Self::Unspecified => serializer.serialize_i32(0),
10694 Self::GoogleDefaultEncryption => serializer.serialize_i32(1),
10695 Self::CustomerManagedEncryption => serializer.serialize_i32(2),
10696 Self::UnknownValue(u) => u.0.serialize(serializer),
10697 }
10698 }
10699 }
10700
10701 impl<'de> serde::de::Deserialize<'de> for Type {
10702 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10703 where
10704 D: serde::Deserializer<'de>,
10705 {
10706 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
10707 ".google.cloud.memorystore.v1.EncryptionInfo.Type",
10708 ))
10709 }
10710 }
10711
10712 /// The state of the KMS key perceived by the system. Refer to the public
10713 /// documentation for the impact of each state.
10714 ///
10715 /// # Working with unknown values
10716 ///
10717 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10718 /// additional enum variants at any time. Adding new variants is not considered
10719 /// a breaking change. Applications should write their code in anticipation of:
10720 ///
10721 /// - New values appearing in future releases of the client library, **and**
10722 /// - New values received dynamically, without application changes.
10723 ///
10724 /// Please consult the [Working with enums] section in the user guide for some
10725 /// guidelines.
10726 ///
10727 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10728 #[derive(Clone, Debug, PartialEq)]
10729 #[non_exhaustive]
10730 pub enum KmsKeyState {
10731 /// The default value. This value is unused.
10732 Unspecified,
10733 /// The KMS key is enabled and correctly configured.
10734 Enabled,
10735 /// Permission denied on the KMS key.
10736 PermissionDenied,
10737 /// The KMS key is disabled.
10738 Disabled,
10739 /// The KMS key is destroyed.
10740 Destroyed,
10741 /// The KMS key is scheduled to be destroyed.
10742 DestroyScheduled,
10743 /// The EKM key is unreachable.
10744 EkmKeyUnreachableDetected,
10745 /// Billing is disabled for the project.
10746 BillingDisabled,
10747 /// All other unknown failures.
10748 UnknownFailure,
10749 /// If set, the enum was initialized with an unknown value.
10750 ///
10751 /// Applications can examine the value using [KmsKeyState::value] or
10752 /// [KmsKeyState::name].
10753 UnknownValue(kms_key_state::UnknownValue),
10754 }
10755
10756 #[doc(hidden)]
10757 pub mod kms_key_state {
10758 #[allow(unused_imports)]
10759 use super::*;
10760 #[derive(Clone, Debug, PartialEq)]
10761 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10762 }
10763
10764 impl KmsKeyState {
10765 /// Gets the enum value.
10766 ///
10767 /// Returns `None` if the enum contains an unknown value deserialized from
10768 /// the string representation of enums.
10769 pub fn value(&self) -> std::option::Option<i32> {
10770 match self {
10771 Self::Unspecified => std::option::Option::Some(0),
10772 Self::Enabled => std::option::Option::Some(1),
10773 Self::PermissionDenied => std::option::Option::Some(2),
10774 Self::Disabled => std::option::Option::Some(3),
10775 Self::Destroyed => std::option::Option::Some(4),
10776 Self::DestroyScheduled => std::option::Option::Some(5),
10777 Self::EkmKeyUnreachableDetected => std::option::Option::Some(6),
10778 Self::BillingDisabled => std::option::Option::Some(7),
10779 Self::UnknownFailure => std::option::Option::Some(8),
10780 Self::UnknownValue(u) => u.0.value(),
10781 }
10782 }
10783
10784 /// Gets the enum value as a string.
10785 ///
10786 /// Returns `None` if the enum contains an unknown value deserialized from
10787 /// the integer representation of enums.
10788 pub fn name(&self) -> std::option::Option<&str> {
10789 match self {
10790 Self::Unspecified => std::option::Option::Some("KMS_KEY_STATE_UNSPECIFIED"),
10791 Self::Enabled => std::option::Option::Some("ENABLED"),
10792 Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
10793 Self::Disabled => std::option::Option::Some("DISABLED"),
10794 Self::Destroyed => std::option::Option::Some("DESTROYED"),
10795 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
10796 Self::EkmKeyUnreachableDetected => {
10797 std::option::Option::Some("EKM_KEY_UNREACHABLE_DETECTED")
10798 }
10799 Self::BillingDisabled => std::option::Option::Some("BILLING_DISABLED"),
10800 Self::UnknownFailure => std::option::Option::Some("UNKNOWN_FAILURE"),
10801 Self::UnknownValue(u) => u.0.name(),
10802 }
10803 }
10804 }
10805
10806 impl std::default::Default for KmsKeyState {
10807 fn default() -> Self {
10808 use std::convert::From;
10809 Self::from(0)
10810 }
10811 }
10812
10813 impl std::fmt::Display for KmsKeyState {
10814 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10815 wkt::internal::display_enum(f, self.name(), self.value())
10816 }
10817 }
10818
10819 impl std::convert::From<i32> for KmsKeyState {
10820 fn from(value: i32) -> Self {
10821 match value {
10822 0 => Self::Unspecified,
10823 1 => Self::Enabled,
10824 2 => Self::PermissionDenied,
10825 3 => Self::Disabled,
10826 4 => Self::Destroyed,
10827 5 => Self::DestroyScheduled,
10828 6 => Self::EkmKeyUnreachableDetected,
10829 7 => Self::BillingDisabled,
10830 8 => Self::UnknownFailure,
10831 _ => Self::UnknownValue(kms_key_state::UnknownValue(
10832 wkt::internal::UnknownEnumValue::Integer(value),
10833 )),
10834 }
10835 }
10836 }
10837
10838 impl std::convert::From<&str> for KmsKeyState {
10839 fn from(value: &str) -> Self {
10840 use std::string::ToString;
10841 match value {
10842 "KMS_KEY_STATE_UNSPECIFIED" => Self::Unspecified,
10843 "ENABLED" => Self::Enabled,
10844 "PERMISSION_DENIED" => Self::PermissionDenied,
10845 "DISABLED" => Self::Disabled,
10846 "DESTROYED" => Self::Destroyed,
10847 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
10848 "EKM_KEY_UNREACHABLE_DETECTED" => Self::EkmKeyUnreachableDetected,
10849 "BILLING_DISABLED" => Self::BillingDisabled,
10850 "UNKNOWN_FAILURE" => Self::UnknownFailure,
10851 _ => Self::UnknownValue(kms_key_state::UnknownValue(
10852 wkt::internal::UnknownEnumValue::String(value.to_string()),
10853 )),
10854 }
10855 }
10856 }
10857
10858 impl serde::ser::Serialize for KmsKeyState {
10859 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10860 where
10861 S: serde::Serializer,
10862 {
10863 match self {
10864 Self::Unspecified => serializer.serialize_i32(0),
10865 Self::Enabled => serializer.serialize_i32(1),
10866 Self::PermissionDenied => serializer.serialize_i32(2),
10867 Self::Disabled => serializer.serialize_i32(3),
10868 Self::Destroyed => serializer.serialize_i32(4),
10869 Self::DestroyScheduled => serializer.serialize_i32(5),
10870 Self::EkmKeyUnreachableDetected => serializer.serialize_i32(6),
10871 Self::BillingDisabled => serializer.serialize_i32(7),
10872 Self::UnknownFailure => serializer.serialize_i32(8),
10873 Self::UnknownValue(u) => u.0.serialize(serializer),
10874 }
10875 }
10876 }
10877
10878 impl<'de> serde::de::Deserialize<'de> for KmsKeyState {
10879 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10880 where
10881 D: serde::Deserializer<'de>,
10882 {
10883 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KmsKeyState>::new(
10884 ".google.cloud.memorystore.v1.EncryptionInfo.KmsKeyState",
10885 ))
10886 }
10887 }
10888}
10889
10890/// Status of the PSC connection.
10891///
10892/// # Working with unknown values
10893///
10894/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10895/// additional enum variants at any time. Adding new variants is not considered
10896/// a breaking change. Applications should write their code in anticipation of:
10897///
10898/// - New values appearing in future releases of the client library, **and**
10899/// - New values received dynamically, without application changes.
10900///
10901/// Please consult the [Working with enums] section in the user guide for some
10902/// guidelines.
10903///
10904/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10905#[derive(Clone, Debug, PartialEq)]
10906#[non_exhaustive]
10907pub enum PscConnectionStatus {
10908 /// PSC connection status is not specified.
10909 Unspecified,
10910 /// The connection is active
10911 Active,
10912 /// Connection not found
10913 NotFound,
10914 /// If set, the enum was initialized with an unknown value.
10915 ///
10916 /// Applications can examine the value using [PscConnectionStatus::value] or
10917 /// [PscConnectionStatus::name].
10918 UnknownValue(psc_connection_status::UnknownValue),
10919}
10920
10921#[doc(hidden)]
10922pub mod psc_connection_status {
10923 #[allow(unused_imports)]
10924 use super::*;
10925 #[derive(Clone, Debug, PartialEq)]
10926 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10927}
10928
10929impl PscConnectionStatus {
10930 /// Gets the enum value.
10931 ///
10932 /// Returns `None` if the enum contains an unknown value deserialized from
10933 /// the string representation of enums.
10934 pub fn value(&self) -> std::option::Option<i32> {
10935 match self {
10936 Self::Unspecified => std::option::Option::Some(0),
10937 Self::Active => std::option::Option::Some(1),
10938 Self::NotFound => std::option::Option::Some(2),
10939 Self::UnknownValue(u) => u.0.value(),
10940 }
10941 }
10942
10943 /// Gets the enum value as a string.
10944 ///
10945 /// Returns `None` if the enum contains an unknown value deserialized from
10946 /// the integer representation of enums.
10947 pub fn name(&self) -> std::option::Option<&str> {
10948 match self {
10949 Self::Unspecified => std::option::Option::Some("PSC_CONNECTION_STATUS_UNSPECIFIED"),
10950 Self::Active => std::option::Option::Some("ACTIVE"),
10951 Self::NotFound => std::option::Option::Some("NOT_FOUND"),
10952 Self::UnknownValue(u) => u.0.name(),
10953 }
10954 }
10955}
10956
10957impl std::default::Default for PscConnectionStatus {
10958 fn default() -> Self {
10959 use std::convert::From;
10960 Self::from(0)
10961 }
10962}
10963
10964impl std::fmt::Display for PscConnectionStatus {
10965 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10966 wkt::internal::display_enum(f, self.name(), self.value())
10967 }
10968}
10969
10970impl std::convert::From<i32> for PscConnectionStatus {
10971 fn from(value: i32) -> Self {
10972 match value {
10973 0 => Self::Unspecified,
10974 1 => Self::Active,
10975 2 => Self::NotFound,
10976 _ => Self::UnknownValue(psc_connection_status::UnknownValue(
10977 wkt::internal::UnknownEnumValue::Integer(value),
10978 )),
10979 }
10980 }
10981}
10982
10983impl std::convert::From<&str> for PscConnectionStatus {
10984 fn from(value: &str) -> Self {
10985 use std::string::ToString;
10986 match value {
10987 "PSC_CONNECTION_STATUS_UNSPECIFIED" => Self::Unspecified,
10988 "ACTIVE" => Self::Active,
10989 "NOT_FOUND" => Self::NotFound,
10990 _ => Self::UnknownValue(psc_connection_status::UnknownValue(
10991 wkt::internal::UnknownEnumValue::String(value.to_string()),
10992 )),
10993 }
10994 }
10995}
10996
10997impl serde::ser::Serialize for PscConnectionStatus {
10998 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10999 where
11000 S: serde::Serializer,
11001 {
11002 match self {
11003 Self::Unspecified => serializer.serialize_i32(0),
11004 Self::Active => serializer.serialize_i32(1),
11005 Self::NotFound => serializer.serialize_i32(2),
11006 Self::UnknownValue(u) => u.0.serialize(serializer),
11007 }
11008 }
11009}
11010
11011impl<'de> serde::de::Deserialize<'de> for PscConnectionStatus {
11012 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11013 where
11014 D: serde::Deserializer<'de>,
11015 {
11016 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PscConnectionStatus>::new(
11017 ".google.cloud.memorystore.v1.PscConnectionStatus",
11018 ))
11019 }
11020}
11021
11022/// Type of a PSC connection
11023///
11024/// # Working with unknown values
11025///
11026/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11027/// additional enum variants at any time. Adding new variants is not considered
11028/// a breaking change. Applications should write their code in anticipation of:
11029///
11030/// - New values appearing in future releases of the client library, **and**
11031/// - New values received dynamically, without application changes.
11032///
11033/// Please consult the [Working with enums] section in the user guide for some
11034/// guidelines.
11035///
11036/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11037#[derive(Clone, Debug, PartialEq)]
11038#[non_exhaustive]
11039pub enum ConnectionType {
11040 /// Connection Type is not set
11041 Unspecified,
11042 /// Connection that will be used for topology discovery.
11043 Discovery,
11044 /// Connection that will be used as primary endpoint to access primary.
11045 Primary,
11046 /// Connection that will be used as reader endpoint to access replicas.
11047 Reader,
11048 /// If set, the enum was initialized with an unknown value.
11049 ///
11050 /// Applications can examine the value using [ConnectionType::value] or
11051 /// [ConnectionType::name].
11052 UnknownValue(connection_type::UnknownValue),
11053}
11054
11055#[doc(hidden)]
11056pub mod connection_type {
11057 #[allow(unused_imports)]
11058 use super::*;
11059 #[derive(Clone, Debug, PartialEq)]
11060 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11061}
11062
11063impl ConnectionType {
11064 /// Gets the enum value.
11065 ///
11066 /// Returns `None` if the enum contains an unknown value deserialized from
11067 /// the string representation of enums.
11068 pub fn value(&self) -> std::option::Option<i32> {
11069 match self {
11070 Self::Unspecified => std::option::Option::Some(0),
11071 Self::Discovery => std::option::Option::Some(1),
11072 Self::Primary => std::option::Option::Some(2),
11073 Self::Reader => std::option::Option::Some(3),
11074 Self::UnknownValue(u) => u.0.value(),
11075 }
11076 }
11077
11078 /// Gets the enum value as a string.
11079 ///
11080 /// Returns `None` if the enum contains an unknown value deserialized from
11081 /// the integer representation of enums.
11082 pub fn name(&self) -> std::option::Option<&str> {
11083 match self {
11084 Self::Unspecified => std::option::Option::Some("CONNECTION_TYPE_UNSPECIFIED"),
11085 Self::Discovery => std::option::Option::Some("CONNECTION_TYPE_DISCOVERY"),
11086 Self::Primary => std::option::Option::Some("CONNECTION_TYPE_PRIMARY"),
11087 Self::Reader => std::option::Option::Some("CONNECTION_TYPE_READER"),
11088 Self::UnknownValue(u) => u.0.name(),
11089 }
11090 }
11091}
11092
11093impl std::default::Default for ConnectionType {
11094 fn default() -> Self {
11095 use std::convert::From;
11096 Self::from(0)
11097 }
11098}
11099
11100impl std::fmt::Display for ConnectionType {
11101 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11102 wkt::internal::display_enum(f, self.name(), self.value())
11103 }
11104}
11105
11106impl std::convert::From<i32> for ConnectionType {
11107 fn from(value: i32) -> Self {
11108 match value {
11109 0 => Self::Unspecified,
11110 1 => Self::Discovery,
11111 2 => Self::Primary,
11112 3 => Self::Reader,
11113 _ => Self::UnknownValue(connection_type::UnknownValue(
11114 wkt::internal::UnknownEnumValue::Integer(value),
11115 )),
11116 }
11117 }
11118}
11119
11120impl std::convert::From<&str> for ConnectionType {
11121 fn from(value: &str) -> Self {
11122 use std::string::ToString;
11123 match value {
11124 "CONNECTION_TYPE_UNSPECIFIED" => Self::Unspecified,
11125 "CONNECTION_TYPE_DISCOVERY" => Self::Discovery,
11126 "CONNECTION_TYPE_PRIMARY" => Self::Primary,
11127 "CONNECTION_TYPE_READER" => Self::Reader,
11128 _ => Self::UnknownValue(connection_type::UnknownValue(
11129 wkt::internal::UnknownEnumValue::String(value.to_string()),
11130 )),
11131 }
11132 }
11133}
11134
11135impl serde::ser::Serialize for ConnectionType {
11136 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11137 where
11138 S: serde::Serializer,
11139 {
11140 match self {
11141 Self::Unspecified => serializer.serialize_i32(0),
11142 Self::Discovery => serializer.serialize_i32(1),
11143 Self::Primary => serializer.serialize_i32(2),
11144 Self::Reader => serializer.serialize_i32(3),
11145 Self::UnknownValue(u) => u.0.serialize(serializer),
11146 }
11147 }
11148}
11149
11150impl<'de> serde::de::Deserialize<'de> for ConnectionType {
11151 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11152 where
11153 D: serde::Deserializer<'de>,
11154 {
11155 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConnectionType>::new(
11156 ".google.cloud.memorystore.v1.ConnectionType",
11157 ))
11158 }
11159}